15 #include <TClonesArray.h>
21 , fHitsArray1Name(
"FairTutPropHits")
22 , fHitsArray2Name(
"FairTutPropHits2")
23 , fHitsArray1(nullptr)
24 , fHitsArray2(nullptr)
25 , fTracksArray(new TClonesArray(
"FairTutPropTrack", 100))
27 LOG(debug) <<
"Default Constructor of FairTutPropTrackFinder";
32 LOG(debug) <<
"Destructor of FairTutPropTrackFinder";
33 fTracksArray->Delete();
39 LOG(debug) <<
"SetParContainers of FairTutPropTrackFinder";
52 LOG(debug) <<
"Initilization of FairTutPropTrackFinder";
58 fHitsArray1 =
static_cast<TClonesArray*
>(ioman->
GetObject(fHitsArray1Name.data()));
59 fHitsArray2 =
static_cast<TClonesArray*
>(ioman->
GetObject(fHitsArray2Name.data()));
60 if (!fHitsArray1 || !fHitsArray2) {
61 LOG(error) <<
"No InputData array!";
62 LOG(error) <<
"FairTutPropTrackFinder will be inactive";
68 ioman->
Register(
"FairTutPropTracks",
"TutProp", fTracksArray, kTRUE);
79 LOG(debug) <<
"Reinitilization of FairTutPropTrackFinder";
85 fTracksArray->Delete();
87 std::map<int, int> trackNofHitsMap;
89 int nofHits1 = fHitsArray1->GetEntries();
90 int nofHits2 = fHitsArray2->GetEntries();
92 for (
int ihit1 = 0; ihit1 < nofHits1; ihit1++) {
94 auto trackFromMap = trackNofHitsMap.find(hit1->
GetTrackID());
95 if (trackFromMap != trackNofHitsMap.end()) {
96 trackFromMap->second = trackFromMap->second + 1;
98 trackNofHitsMap.insert(std::pair<int, int>{hit1->
GetTrackID(), 1});
101 for (
int ihit2 = 0; ihit2 < nofHits2; ihit2++) {
103 auto trackFromMap = trackNofHitsMap.find(hit2->
GetTrackID());
104 if (trackFromMap != trackNofHitsMap.end()) {
105 trackFromMap->second = trackFromMap->second + 1;
107 trackNofHitsMap.insert(std::pair<int, int>{hit2->
GetTrackID(), 2});
111 std::map<int, int>::iterator it;
113 for (it = trackNofHitsMap.begin(); it != trackNofHitsMap.end(); it++) {
114 if (it->second < 3) {
118 bool trackCreated =
false;
119 for (
int ihit1 = 0; ihit1 < nofHits1; ihit1++) {
123 std::vector<std::pair<int, int>> trackHits;
124 for (
int jhit1 = 0; jhit1 < nofHits1; jhit1++) {
127 trackHits.push_back(std::make_pair(1, jhit1));
129 for (
int jhit2 = 0; jhit2 < nofHits2; jhit2++) {
132 trackHits.push_back(std::make_pair(2, jhit2));
139 TVector3(0., 0., hit1->
GetZ()),
140 TVector3(1., 0., 0.),
141 TVector3(0., 1., 0.));
142 new ((*fTracksArray)[fTracksArray->GetEntries()])
149 for (
int ihit2 = 0; ihit2 < nofHits2; ihit2++) {
153 std::vector<std::pair<int, int>> trackHits;
154 for (
int jhit1 = 0; jhit1 < nofHits1; jhit1++) {
157 trackHits.push_back(std::make_pair(1, jhit1));
159 for (
int jhit2 = 0; jhit2 < nofHits2; jhit2++) {
162 trackHits.push_back(std::make_pair(2, jhit2));
169 TVector3(0., 0., hit2->
GetZ()),
170 TVector3(1., 0., 0.),
171 TVector3(0., 1., 0.));
172 new ((*fTracksArray)[fTracksArray->GetEntries()])
virtual InitStatus ReInit()
static FairRootManager * Instance()
virtual void Exec(Option_t *opt)
ClassImp(FairEventBuilder)
TObject * GetObject(const char *BrName)
~FairTutPropTrackFinder()
void Register(const char *name, const char *Foldername, TNamed *obj, Bool_t toFile)
virtual InitStatus Init()
virtual void SetParContainers()