225 options.
AddOptions(
"Tracking options")(
"QwTracking.debug",
226 po::value<int>()->default_value(0),
227 "track reconstruction debug level");
228 options.
AddOptions(
"Tracking options")(
"QwTracking.regenerate",
230 "regenerate search trees");
231 options.
AddOptions(
"Tracking options")(
"QwTracking.disable-tracking",
233 "disable all tracking analysis");
234 options.
AddOptions(
"Tracking options")(
"QwTracking.print-pattern-db",
236 "print pattern database");
237 options.
AddOptions(
"Tracking options")(
"QwTracking.showeventpattern",
239 "show bit pattern for all events");
240 options.
AddOptions(
"Tracking options")(
"QwTracking.showmatchingpattern",
242 "show bit pattern for matching tracks");
244 options.
AddOptions(
"Tracking options")(
"QwTracking.package-mismatch",
246 "if the package number is different for R2 and R3 at the same octant");
249 options.
AddOptions(
"Tracking options")(
"QwTracking.R2.levels",
250 po::value<int>()->default_value(8),
251 "number of search tree levels in region 2");
252 options.
AddOptions(
"Tracking options")(
"QwTracking.R2.maxslope",
253 po::value<float>()->default_value(0.862),
254 "maximum allowed slope for region 2 tracks");
255 options.
AddOptions(
"Tracking options")(
"QwTracking.R2.maxroad",
256 po::value<float>()->default_value(1.4),
257 "maximum allowed road width for region 2 tracks");
258 options.
AddOptions(
"Tracking options")(
"QwTracking.R2.maxxroad",
259 po::value<float>()->default_value(25.0),
260 "maximum allowed X road width for region 2 tracks");
261 options.
AddOptions(
"Tracking options")(
"QwTracking.R2.MaxMissedPlanes",
262 po::value<int>()->default_value(1),
263 "maximum number of missed planes");
264 options.
AddOptions(
"Tracking options")(
"QwTracking.R2.DropWorstHit",
266 "attempt partial track fit without worst hit");
269 options.
AddOptions(
"Tracking options")(
"QwTracking.R3.levels",
270 po::value<int>()->default_value(4),
271 "number of search tree levels in region 3");
272 options.
AddOptions(
"Tracking options")(
"QwTracking.R3.MaxMissedWires",
273 po::value<int>()->default_value(4),
274 "maximum number of missed wires");
275 options.
AddOptions(
"Tracking options")(
"QwTracking.R3.RotatorTilt",
276 po::value<bool>()->default_value(
true),
277 "apply region 3 rotator tilt correction");
280 options.
AddOptions(
"Tracking options")(
"QwTracking.disable-momentum",
282 "disable the momentum reconstruction");
283 options.
AddOptions(
"Tracking options")(
"QwTracking.disable-matrixlookup",
285 "disable the use of the momentum lookup table");
286 options.
AddOptions(
"Tracking options")(
"QwTracking.disable-raytracer",
288 "disable the magnetic field map tracking");
289 options.
AddOptions(
"Tracking options")(
"QwTracking.lookuptable",
290 po::value<std::string>()->default_value(
"QwTrajMatrix.root"),
291 "filename of the lookup table in QW_LOOKUP");
333 package <= kPackage2; package++) {
343 if (detectors.size() == 0)
continue;
377 std::stringstream filename;
379 <<
"/tree" << numlayers <<
"-" << levels
380 <<
"-" <<
package << "-" << region << "-" << direction << ".tre";
396 searchtree->SetRegion(region);
397 searchtree->SetPackage(package);
398 searchtree->SetDirection(direction);
401 for (
size_t i = 0; i < detectors.size(); i++) {
402 detectors.at(i)->SetTrackingSearchTree(searchtree);
441 if (hitlist->size() == 0) {
458 package <= kPackage2;
460 QwDebug <<
"[QwTrackingWorker::ProcessHits] Package: " <<
package << QwLog::endl;
480 if (detectors.size() == 0)
continue;
495 event->fTreeLine[package][region][dir] = 0;
496 QwDebug <<
"[QwTrackingWorker::ProcessHits] Search tree not searchable!" <<
QwLog::endl;
513 QwTreeLine *treelinelist1 = 0, *treelinelist2 = 0;
519 for (std::vector<QwDetectorInfo*>::iterator iter = detectors.begin();
520 iter != detectors.end(); iter++) {
537 if (subhitlist->size() == 0) {
543 std::cout <<
"region: " << region <<
" package: " <<
package << " plane: " << plane << std::endl;
551 for (QwHitContainer::iterator hit = subhitlist->begin();
552 hit != subhitlist->end();
559 int wire = hit->GetElement();
560 patterns.at(wire) += hitpattern;
567 for (
size_t wire = 0; wire < patterns.size(); wire++)
568 if (patterns.at(wire).HasHits())
574 char** channel =
new char*[patterns.size()];
575 int** hashchannel =
new int*[patterns.size()];
576 for (
size_t wire = 0; wire < patterns.size(); wire++) {
577 channel[wire] =
new char[patterns.at(wire).GetNumberOfBins()];
578 hashchannel[wire] =
new int[patterns.at(wire).GetFinestBinWidth()];
579 patterns.at(wire).GetPattern(channel[wire]);
580 patterns.at(wire).GetPatternHash(hashchannel[wire]);
586 QwDebug <<
"Searching for matching patterns (direction " << dir <<
")" <<
QwLog::endl;
592 for (
size_t wire = 0; wire < patterns.size(); wire++) {
593 delete[] channel[wire];
594 delete[] hashchannel[wire];
597 delete[] hashchannel;
604 treeline; treeline = treeline->
next) {
606 treeline->SetPackage(package);
607 treeline->SetDirection(dir);
608 treeline->SetPlane(plane);
613 cout <<
"List of treelines:" << endl;
614 if (treelinelist) treelinelist->
Print();
618 double width = searchtree->
GetWidth();
620 package, region, dir,
621 1UL << (
fLevelsR3 - 1), 0, dlayer, width);
627 treelinelist1 = treelinelist;
629 treelinelist2 = treelinelist;
637 event->AddTreeLineList(treelinelist1);
638 event->AddTreeLineList(treelinelist2);
642 if (treelinelist1 && treelinelist2) {
644 event->fTreeLine[package][region][dir] = treelinelist;
645 event->AddTreeLineList(treelinelist);
648 cout <<
"VDC1:" << endl;
649 if (treelinelist1) treelinelist1->
Print();
650 cout <<
"VDC2:" << endl;
651 if (treelinelist2) treelinelist2->Print();
654 cout <<
"VDC1+2:" << endl;
655 if (treelinelist) treelinelist->
Print();
664 while (tl) { tl_next = tl->
next;
delete tl; tl = tl_next; }
666 while (tl) { tl_next = tl->
next;
delete tl; tl = tl_next; }
678 std::vector<QwHitPattern> patterns;
685 for (std::vector<QwDetectorInfo*>::iterator iter = detectors.begin();
686 iter != detectors.end(); iter++, tlayers++) {
697 treelinehits->
Append(planehits);
709 patterns.push_back(hitpattern);
718 for (
size_t layer = 0; layer < patterns.size(); layer++)
723 int levels = patterns.at(0).GetNumberOfLevels();
724 char** channel =
new char*[patterns.size()];
725 int** hashchannel =
new int*[patterns.size()];
726 for (
size_t layer = 0; layer < patterns.size(); layer++) {
727 channel[layer] =
new char[patterns.at(layer).GetNumberOfBins()];
728 hashchannel[layer] =
new int[patterns.at(layer).GetFinestBinWidth()];
729 patterns.at(layer).GetPattern(channel[layer]);
730 patterns.at(layer).GetPatternHash(hashchannel[layer]);
735 channel, hashchannel, levels,
739 for (
size_t layer = 0; layer < patterns.size(); layer++) {
740 delete[] channel[layer];
741 delete[] hashchannel[layer];
744 delete[] hashchannel;
751 treeline; treeline = treeline->
next) {
753 treeline->SetPackage(package);
754 treeline->SetDirection(dir);
760 double width = searchtree->
GetWidth();
762 package, region, dir,
771 cout <<
"List of treelines:" << endl;
772 if (treelinelist) treelinelist->
Print();
774 event->fTreeLine[package][region][dir] = treelinelist;
775 event->AddTreeLineList(treelinelist);
782 QwWarning <<
"[QwTrackingWorker::ProcessHits] Warning: no support for this detector." <<
QwLog::endl;
793 std::vector<QwPartialTrack*> parttracklist;
797 std::vector<QwTreeLine*> treelines_x =
798 event->fTreeLine[package][region][
kDirectionX]->GetListAsVector();
799 std::vector<QwTreeLine*> treelines_u =
800 event->fTreeLine[package][region][
kDirectionU]->GetListAsVector();
801 std::vector<QwTreeLine*> treelines_v =
802 event->fTreeLine[package][region][
kDirectionV]->GetListAsVector();
805 treelines_x, treelines_u, treelines_v,
812 if (parttracklist.size() > 0) {
822 event->AddPartialTrackList(parttracklist);
827 for (
size_t pt = 0; pt < parttracklist.size(); pt++)
828 QwOut << *parttracklist[pt] << QwLog::endl;
832 for (
size_t pt = 0; pt < parttracklist.size(); pt++)
833 delete parttracklist[pt];
838 if (region == 2) ++
R2Good;
839 if (region == 3) ++
R3Good;
846 if (region == 2) ++
R2Bad;
847 if (region == 3) ++
R3Bad;
880 std::vector<QwPartialTrack*> frontlist =
event->GetListOfPartialTracks(
kRegionID2,R2package);
881 std::vector<QwPartialTrack*> backlist =
event->GetListOfPartialTracks(
kRegionID3,R3package);
884 for (
size_t ifront = 0; ifront < frontlist.size(); ifront++) {
887 for (
size_t iback = 0; iback < backlist.size(); iback++) {
902 event->AddTrack(track);
915 int num_of_bridged =
event->GetNumberOfTracks();
916 if ( num_of_bridged > 0) {
918 event->CalculateKinematics(event->
GetTrack(0));
922 if (
fDebug)
event->Print();
#define QwMessage
Predefined log drain for regular messages.
void SetPlane(int plane)
Set the plane number.
bool IsSearchable() const
Is this region searchable?
void SetDebugLevel(int debug)
Set the debug level.
#define QwOut
Predefined log drain for explicit output.
#define default_bool_value(b)
Definition of the ray-tracing bridging method for R2/R3 partial tracks.
bool fDisableTracking
Disable all tracking.
const QwGeometry in(const EQwRegionID &r) const
Get detectors in given region.
void SetShowMatchingPatterns(bool show=true)
Set the flag to show matching patterns when they are found.
bool fPrintPatternDatabase
Print the pattern database.
void SetMaxRoad(const double maxroad)
Set the maximum road width.
Int_t GetNumberOfTreeLines() const
Get the number of tree lines.
QwTrackingTreeRegion * inittree(const string &filename, int levels, int tlayer, double width, QwDetectorInfo *detector, bool regenerate)
void SetRegion(EQwRegionID region)
Set the region.
A container for the pattern databases for each detector region.
Definition of the matrix lookup bridging method.
Controls all the routines involved in finding tracks in an event.
Hit patterns used in the tracking tree search.
void SetMaxXRoad(const double maxxroad)
Set the maximum X road width (?)
void PrintNodes() const
Print the list of nodes.
EQwRegionID GetRegion() const
#define QwVerbose
Predefined log drain for verbose messages.
int fLevelsR2
Region 2 levels.
int rcTreeConnSort(QwTreeLine *head, EQwRegionID region)
The best (by chi^2) treelines are select.
virtual ~QwTrackingWorker()
Destructor.
void SetPackage(EQwDetectorPackage package)
Set the package.
int nbad
number of bad events
void TlTreeLineSort(QwTreeLine *tl, QwHitContainer *hl, EQwDetectorPackage package, EQwRegionID region, EQwDirectionID dir, unsigned long bins, int tlayer, int dlayer, double width)
QwTrackingTreeSort * fTreeSort
Module that sorts lists of treelines and partial tracks.
Definition of the partial track class.
void ProcessEvent(const QwSubsystemArrayTracking *detectors, QwEvent *event)
Process the hit list and construct the event.
EStatus Filter(const QwPartialTrack *front, const QwPartialTrack *back) const
Filter front and back track combinations.
std::vector< QwTrackingTreeRegion * > fSearchTrees
Internal list of search trees created by QwTrackingWorker.
void SetGeometry(const QwGeometry &geometry)
Set the geometry.
Definition of the track class.
Definition of the hit patterns used in the tracking tree search.
void SetGeometry(const QwGeometry &geometry)
Set the geometry.
void SetHDCHitList(double detectorwidth, QwHitContainer *hitlist)
Set the hit pattern bins for the specified HDC-type hit list.
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
QwRayTracer * fRayTracer
Ray tracing bridging method.
QwTrackingTreeMatch * fTreeMatch
Module that matches up VDC front and back treelines.
std::vector< QwPartialTrack * > TlTreeCombine(const std::vector< QwTreeLine * > &treelines_x, const std::vector< QwTreeLine * > &treelines_u, const std::vector< QwTreeLine * > &treelines_v, EQwDetectorPackage package, EQwRegionID region, int tlayer, int dlayer)
bool fDisableMatrixLookup
Disable matrix lookup momentum reconstruction.
Track filter for the bridging methods.
T GetValue(const std::string &key)
Get a templated value.
Contains a tracked event, i.e. all information from hits to tracks.
#define QwDebug
Predefined log drain for debugging output.
void ProcessOptions(QwOptions &options)
Process command line and config file options.
A logfile class, based on an identical class in the Hermes analyzer.
Draft skeleton for the decoding-to-QTR interface class.
QwTrackingTreeSearch * fTreeSearch
Module that handles the tree search.
QwTrackingTreeCombine * fTreeCombine
Module that combines treelines and partial tracks.
void Print(const Option_t *options=0) const
Contains the complete track as a concatenation of partial tracks.
static void DefineOptions(QwOptions &options)
Define command line and config file options.
Performs the treesearch algorithm to generate one treeline.
int rcPartConnSort(std::vector< QwPartialTrack * > head)
void SetDebugLevel(const int debuglevel)
Set the debug level.
Module that matches track segments for pairs of wire planes.
bool fShowMatchingPattern
Show matching event patterns.
Creates and manages the treesearch pattern database.
const QwTrack * Bridge(const QwPartialTrack *front, const QwPartialTrack *back)
Bridge from the front to back partial track.
QwBridgingTrackFilter * fBridgingTrackFilter
Track filter.
QwTreeLine * MatchRegion3(QwTreeLine *frontlist, QwTreeLine *backlist)
Match the tree lines in two planes in region 3.
void SetDebugLevel(int debug)
Set the debug level.
This module is used to identify good track segments versus ghost tracks/hits.
Definition of the one-dimensional track stubs.
QwGeometry fGeometry
Detector geometry.
bool fShowEventPattern
Show all event patterns.
Module that matches track segments for pairs of wire planes.
void SetDebugLevel(const int debuglevel)
void SetDirection(EQwDirectionID direction)
Set the direction.
One-dimensional (u, v, or x) track stubs and associated hits.
const QwTrack * GetTrack(const int t) const
Get the specified track.
int ngood
number of good events
double GetActiveWidthZ() const
static std::ostream & endl(std::ostream &)
End of the line.
bool fDisableRayTracer
Disable ray tracer momentum reconstruction.
double GetElementSpacing() const
void SetGeometry(const QwGeometry &geometry)
void Print(const Option_t *option=0) const
const std::string getenv_safe_string(const char *name)
Collection of QwDetectorInfo pointers that specifies an experimental geometry.
void InitTree(const QwGeometry &geometry)
Initialize the pattern search tree.
double GetWidth() const
Get the width.
An options class which parses command line, config file and environment.
Definition of the track search tree.
Combines track segments and performs line fitting.
std::string fFilenameLookupTable
Filename of the lookup table in QW_LOOKUP.
int fLevelsR3
Region 3 levels.
QwTreeLine * SearchTreeLines(QwTrackingTreeRegion *searchtree, char *pattern[16], int *hashpat[16], int maxlevel, int numwires, int numlayers)
Search for the tree lines consistent with the hit pattern.
Definition of the track filter for the bridging methods.
void SetVDCHit(double detectorwidth, QwHit *hit)
Set the hit pattern bins for the specified VDC-type hit.
int nbridged
number of beidged tracks
#define QwWarning
Predefined log drain for warnings.
void GetSubList_Plane(EQwRegionID region, EQwDetectorPackage package, Int_t plane, std::vector< QwHit > &sublist)
void Append(const QwHitContainer &mylist)
int GetNumberOfElements() const
Contains the straight part of a track in one region only.
static size_t GetObjectsAlive()
Get number of objects still alive.
bool fMismatchPkg
Indicates if the pkg for R2 and R3 is differnt at the same octant.
bool fRegenerate
Regenerate the search tree.
bool fDisableMomentum
Disable momentum reconstruction.
static size_t GetObjectsCreated()
Get number of objects ever created.
void SetMaxSlope(const double maxslope)
Set the maximum allowed slope.