CbmRoot
PairAnalysis.cxx
Go to the documentation of this file.
1 // PairAnalysis Main Analysis class //
3 // //
4 // Authors:
5 // * Copyright(c) 1998-2009, ALICE Experiment at CERN, All rights reserved. *
6 // Julian Book <Julian.Book@cern.ch>
7 /*
8 
9 Framework to perform event, single track and pair selections.
10 
11 Convention for the signs of the track in fTracks:
12 The names are available via the function TrackClassName(Int_t i)
13 
14  0: SE+ (same event +)
15  1: SE- (same event -)
16 
17 
18 Convention for the signs of the pair in fPairCandidates:
19 The names are available via the function PairClassName(Int_t i)
20 
21  0: SE+ SE+ (same event like sign +)
22  1: SE+ SE- (same event unlike sign)
23  2: SE- SE- (same event like sign -)
24 
25  3: SE+ ME+ (mixed event like sign +)
26  4: SE- ME+ (mixed event unlike sign -+)
27  5: SE+ ME- (mixed event unlike sign +-)
28  6: SE- ME- (mixed event like sign -)
29 
30  7: SE+ SE- (same event track rotation)
31 
32 
33 Some options to configure your analysis instance:
34  SetLegPdg(Int_t pdgLeg1, Int_t pdgLeg2) // define pair production of interest
35  SetRefitWithMassAssump(kTRUE) // whether tracks should be refitted accordingly
36  SetNoPairing() // look only at track level
37  SetProcessLS(kFALSE) // switch off like-sign pair calculations
38  SetUseKF(kTRUE) // use Kalman-Filter mathematics for vertexing
39 
40 
41 Some options to configure the output:
42  SetHistogramManager(PairAnalysisHistos * const histos) // default histogram manager
43  SetHistogramArray(PairAnalysisHF * const histoarray) // histogram matrix
44  SetCutQA() // switch on basic qa histograms
45 
46 
47 Some options to add background estimators:
48  SetMixingHandler(PairAnalysisMixingHandler *mix) // event mixing
49  SetTrackRotator(PairAnalysisTrackRotator * const rot) // track rotation
50 
51 
52 */
53 // //
55 
56 #include <TDatabasePDG.h>
57 #include <TLorentzVector.h>
58 #include <TRandom3.h>
59 
60 #include <TGrid.h>
61 #include <TList.h>
62 #include <TMath.h>
63 #include <TObject.h>
64 #include <TString.h>
65 
66 #include "FairMCPoint.h"
67 
68 #include "CbmHit.h"
69 #include "CbmMCTrack.h"
70 #include "CbmMatch.h"
71 #include "CbmRichRing.h"
72 #include "CbmTrack.h"
73 
74 #include "PairAnalysisEvent.h"
75 #include "PairAnalysisTrack.h"
76 
77 #include "PairAnalysisHistos.h"
78 #include "PairAnalysisMC.h"
79 #include "PairAnalysisPair.h"
80 #include "PairAnalysisPairKF.h"
81 #include "PairAnalysisPairLV.h"
83 #include "PairAnalysisVarManager.h"
84 //#include "PairAnalysisDebugTree.h"
87 #include "PairAnalysisSignalMC.h"
88 //#include "PairAnalysisV0Cuts.h"
89 #include "PairAnalysisHistos.h"
90 
91 #include "PairAnalysis.h"
92 
94 
95  const char* PairAnalysis::fgkTrackClassNames[2] = {"+", "-"};
96 
97 const char* PairAnalysis::fgkPairClassNames[8] =
98  {"SE++", "SE+-", "SE--", "ME++", "ME-+", "ME+-", "ME--", "TR+-"};
99 
100 //________________________________________________________________
101 PairAnalysis::PairAnalysis() : PairAnalysis("PairAnalysis", "PairAnalysis") {
102  //
103  // Default constructor
104  //
105 }
106 
107 //________________________________________________________________
108 PairAnalysis::PairAnalysis(const char* name, const char* title)
109  : TNamed(name, title)
110  , fEventFilter("EventFilter")
111  , fTrackFilter("TrackFilter")
112  , fPairPreFilterLegs("PairPreFilterLegs")
113  , fPairPreFilter("PairPreFilter")
114  , fFinalTrackFilter("FinalTrackFilter")
115  , fPairFilter("PairFilter")
116  , fTrackFilterMC("TrackFilterMC")
117  , fPairFilterMC("PairFilterMC")
118  , fUsedVars(new TBits(PairAnalysisVarManager::kNMaxValuesMC))
119  , fPairCandidates(new TObjArray(8)) {
120  //
121  // Named constructor
122  //
123 }
124 
125 //________________________________________________________________
127  //
128  // Default destructor
129  //
130  if (fQAmonitor) delete fQAmonitor;
131  if (fHistos) delete fHistos;
132  if (fUsedVars) delete fUsedVars;
134  if (fMixing) delete fMixing;
135  if (fSignalsMC) delete fSignalsMC;
136  if (fHistoArray) delete fHistoArray;
137  if (fCutStepHistos) delete fCutStepHistos;
138 }
139 
140 //________________________________________________________________
142  //
143  // Initialise objects
144  //
145 
146  // if(GetHasMC()) PairAnalysisMC::Instance()->SetHasMC(GetHasMC());
147 
149 
150  // compress the MC signal array
151  if (fSignalsMC) fSignalsMC->Compress();
152 
153  if (fMixing) fMixing->Init(this);
154  if (fHistoArray) {
155  // fHistoArray->SetSignalsMC(fSignalsMC);
156  fHistoArray->Init();
157  }
158 
159  // for internal train wagons
160  if (!fEventProcess) {
161  PairAnalysisPairLegCuts* trk2leg =
162  new PairAnalysisPairLegCuts("trk2leg", "trk2leg");
163  // move all track cuts (if any) into pair leg cuts
164  TIter listIterator(fTrackFilter.GetCuts());
165  while (AnalysisCuts* thisCut = (AnalysisCuts*) listIterator()) {
166  trk2leg->GetLeg1Filter().AddCuts((AnalysisCuts*) thisCut->Clone());
167  trk2leg->GetLeg2Filter().AddCuts((AnalysisCuts*) thisCut->Clone());
168  }
169  TIter listIterator2(fFinalTrackFilter.GetCuts());
170  while (AnalysisCuts* thisCut = (AnalysisCuts*) listIterator2()) {
171  trk2leg->GetLeg1Filter().AddCuts((AnalysisCuts*) thisCut->Clone());
172  trk2leg->GetLeg2Filter().AddCuts((AnalysisCuts*) thisCut->Clone());
173  }
174  // add pair leg cuts to pair filter
175  fPairFilter.AddCuts(trk2leg);
176  }
177 
178  // initialize simple cut qa
179  if (fCutQA) {
180  fQAmonitor = new PairAnalysisCutQA(Form("QAcuts_%s", GetName()), "QAcuts");
187  fQAmonitor->Init();
188  }
189 
190  if (fHistos) { (*fUsedVars) |= (*fHistos->GetUsedVars()); }
191 
192  // initialize cut step histograms
197  if (fCutStepHistos)
199  else
201  if (fCutStepHistos)
203  else
205  fCutStepHistos->SetName(Form("CutSteps_%s", GetName()));
206  }
207 }
208 
209 //________________________________________________________________
210 
211 void PairAnalysis::Process(TObjArray* arr) {
212  //
213  // Process the pair array
214  //
215 
216  // set pair arrays
217  fPairCandidates = arr;
218 
219  // fill pair and pair leg histograms
220  if (fHistos) FillHistograms(0x0, kTRUE);
221 
222  // apply cuts and fill output TODO: OBSOLETE!
223  // if (fHistos) FillHistogramsFromPairArray();
224 
226 }
227 
228 //________________________________________________________________
230  //
231  // Process the events
232  //
233 
235  if (!ev1->GetPrimaryVertex()) {
236  Fatal("Process", "No vertex found!");
237  //Error("Process","No vertex found!");
238  return kFALSE;
239  }
240 
244  TDatabasePDG::Instance()->GetParticle(fPdgMother)->Mass());
245 
249 
251  if (fMixing) {
254  }
255 
256 
257  //in case we have MC load the MC event and process the MC particles
258  // why do not apply the event cuts first ????
259  // if (PairAnalysisMC::Instance()->ConnectMCEvent()){
260  if (PairAnalysisMC::Instance()->HasMC()) { ProcessMC(); }
261 
263  if (!fPairCandidates->UncheckedAt(0)) {
265  } else {
266  ClearArrays();
267  }
268 
270  UInt_t selectedMask = (1 << fEventFilter.GetCuts()->GetEntries()) - 1;
271 
273  UInt_t cutmask = fEventFilter.IsSelected(ev1);
274  if (fCutQA) fQAmonitor->FillAll(ev1);
275  if (fCutQA) fQAmonitor->Fill(cutmask, ev1);
276  if (ev1 && cutmask != selectedMask) return kFALSE;
277 
279  FillTrackArrays(ev1);
280 
281  // prefilter track
283  && (fPairPreFilter.GetCuts()->GetEntries() > 0))
284  PairPreFilter(0, 1, fTracks[0], fTracks[1]);
285 
286  // remove tracks from arrays that DO NOT pass 2nd cut iteration
288 
289  // create SE pairs and fill pair candidate arrays
290  if (!fNoPairing) {
291  for (Int_t itrackArr1 = 0; itrackArr1 < 2; ++itrackArr1) {
292  for (Int_t itrackArr2 = itrackArr1; itrackArr2 < 2; ++itrackArr2) {
293  if (!fProcessLS && GetPairIndex(itrackArr1, itrackArr2) != kSEPM)
294  continue;
295  FillPairArrays(itrackArr1, itrackArr2);
296  }
297  }
298  // add track rotated pairs
299  if (fTrackRotator) { FillPairArrayTR(); }
300  }
301 
302  //process event mixing
303  if (fMixing) {
304  fMixing->Fill(ev1, this);
305  // FillHistograms(0x0,kTRUE);
306  }
307 
308  // fill candidate variables
309  Double_t ntracks = fTracks[0].GetEntriesFast() + fTracks[1].GetEntriesFast();
310  Double_t npairs = PairArray(PairAnalysis::kSEPM)->GetEntriesFast();
313 
314  //in case there is a histogram manager, fill the QA histograms
315  if (fHistos) FillHistograms(ev1);
316  // fill histo array with event information only
317  if (fHistoArray)
318  fHistoArray->Fill(
319  0, const_cast<Double_t*>(PairAnalysisVarManager::GetData()), 0x0, 0x0);
320 
321  // clear arrays
323 
324  return kTRUE;
325 }
326 
327 //________________________________________________________________
329  //
330  // Process the MC data
331  //
333 
334  // fill mc true and rec event
335  // if (fHistos) FillHistogramsMC(papaMC->GetMCEvent(), ev1);
336 
337  // there are mc tracks
338  if (!papaMC->GetNMCTracks()) return;
339 
340  // signals to be studied
341  if (!fSignalsMC) return;
342  Int_t nSignals = fSignalsMC->GetEntries();
343  if (!nSignals) return;
344 
345  //loop over all MC data and Fill the HF, CF containers and histograms if they exist
346 
347  Bool_t bFillHF = kFALSE;
348  Bool_t bFillHist = kFALSE;
349  for (Int_t isig = 0; isig < nSignals; isig++) {
350  PairAnalysisSignalMC* sigMC =
351  (PairAnalysisSignalMC*) fSignalsMC->UncheckedAt(isig);
352  if (!sigMC->GetFillPureMCStep()) continue;
353  TString sigName = sigMC->GetName();
354  if (fHistos && !bFillHist) {
355  bFillHist |=
356  fHistos->HasHistClass(Form("Pair_%s_MCtruth", sigName.Data()));
357  bFillHist |=
358  fHistos->HasHistClass(Form("Track.Leg_%s_MCtruth", sigName.Data()));
359  bFillHist |= fHistos->HasHistClass(
360  Form("Track.%s_%s_MCtruth", fgkPairClassNames[1], sigName.Data()));
361  }
362  if (fHistoArray && !bFillHF) {
363  bFillHF |=
364  fHistoArray->HasHistClass(Form("Pair_%s_MCtruth", sigName.Data()));
365  bFillHF |=
366  fHistoArray->HasHistClass(Form("Track.Leg_%s_MCtruth", sigName.Data()));
367  bFillHF |= fHistoArray->HasHistClass(
368  Form("Track.%s_%s_MCtruth", fgkPairClassNames[1], sigName.Data()));
369  }
370  }
371 
372  // check if there is anything to fill
373  if (!bFillHF && !bFillHist) return;
374 
375  // initialize 2D arrays of labels for particles from each MC signal
376  Int_t** labels1; // labels for particles satisfying branch 1
377  Int_t** labels2; // labels for particles satisfying branch 2
378  Int_t** labels12; // labels for particles satisfying both branches
379  labels1 = new Int_t*[nSignals];
380  labels2 = new Int_t*[nSignals];
381  labels12 = new Int_t*[nSignals];
382  Int_t* indexes1 = new Int_t[nSignals];
383  Int_t* indexes2 = new Int_t[nSignals];
384  Int_t* indexes12 = new Int_t[nSignals];
385  for (Int_t isig = 0; isig < nSignals; ++isig) {
386  *(labels1 + isig) = new Int_t[papaMC->GetNMCTracks()];
387  *(labels2 + isig) = new Int_t[papaMC->GetNMCTracks()];
388  *(labels12 + isig) = new Int_t[papaMC->GetNMCTracks()];
389  for (Int_t ip = 0; ip < papaMC->GetNMCTracks(); ++ip) {
390  labels1[isig][ip] = -1;
391  labels2[isig][ip] = -1;
392  labels12[isig][ip] = -1;
393  }
394  indexes1[isig] = 0;
395  indexes2[isig] = 0;
396  indexes12[isig] = 0;
397  }
398 
399  Bool_t truth1 = kFALSE;
400  Bool_t truth2 = kFALSE;
401  // selection of particles
402  UInt_t selectedMask = (1 << fTrackFilterMC.GetCuts()->GetEntries()) - 1;
403  // get event data (this contains MC event informations as well)
404  Double_t* values = PairAnalysisVarManager::GetData();
405  // loop over the MC tracks
406  for (Int_t ipart = 0; ipart < papaMC->GetNMCTracks(); ++ipart) {
407 
408  //get MC particle
409  CbmMCTrack* mctrk = papaMC->GetMCTrackFromMCEvent(ipart);
410 
411  // fill variables
412  PairAnalysisVarManager::Fill(mctrk, values);
413 
414  //apply track cuts
415  UInt_t cutmask = fTrackFilterMC.IsSelected(values);
416  //fill cut QA
417  if (fCutQA) fQAmonitor->FillAll(mctrk);
418  if (fCutQA) fQAmonitor->Fill(cutmask, mctrk);
419 
421  if (fTrackFilterMC.GetHistogramList()->GetSize())
422  FillCutStepHistogramsMC(&fTrackFilterMC, cutmask, ipart, values);
423 
424  // rejection
425  if (cutmask != selectedMask) continue;
426 
427  // loop over signals
428  for (Int_t isig = 0; isig < nSignals; ++isig) {
429  PairAnalysisSignalMC* sigMC =
430  (PairAnalysisSignalMC*) fSignalsMC->UncheckedAt(isig);
431  // NOTE: Some signals can be satisfied by many particles and this leads to high
432  // computation times (e.g. secondary electrons from the GEANT transport). Be aware of this!!
433 
434  // Proceed only if this signal is required in the pure MC step
435  if (!sigMC->GetFillPureMCStep()) continue;
436 
437  truth1 = papaMC->IsMCTruth(
438  ipart, (PairAnalysisSignalMC*) fSignalsMC->UncheckedAt(isig), 1);
440  truth2 = papaMC->IsMCTruth(
441  ipart, (PairAnalysisSignalMC*) fSignalsMC->UncheckedAt(isig), 2);
442 
443  // particles satisfying both branches are treated separately to avoid double counting during pairing
444  if (truth1 && truth2) {
445  labels12[isig][indexes12[isig]] = ipart;
446  ++indexes12[isig];
447  } else {
448  if (truth1) {
449  labels1[isig][indexes1[isig]] = ipart;
450  ++indexes1[isig];
451  }
452  if (truth2) {
453  labels2[isig][indexes2[isig]] = ipart;
454  ++indexes2[isig];
455  }
456  }
457  }
458  } // end loop over MC particles
459 
463  PairAnalysisPair* pair = new PairAnalysisPairLV();
464 
465  selectedMask = (1 << fPairFilterMC.GetCuts()->GetEntries()) - 1;
466  // loop over signals
467  for (Int_t isig = 0; isig < nSignals; ++isig) {
468 
469  // mix the particles which satisfy only one of the signal branches
470  for (Int_t i1 = 0; i1 < indexes1[isig]; ++i1) {
471  CbmMCTrack* part1 = papaMC->GetMCTrackFromMCEvent(labels1[isig][i1]);
472  Int_t mLabel1 = part1->GetMotherId();
473 
474  // (e.g. single electrons only, no pairs)
475  if (!indexes2[isig]) FillMCHistograms(labels1[isig][i1], -1, isig);
476  // if(sigMC->IsSingleParticle()) continue;
477 
482  for (Int_t i2 = i1; i2 < indexes2[isig]; ++i2) {
483  // for(Int_t i2=0;i2<indexes2[isig];++i2) { /// old slower way
484 
485  CbmMCTrack* part2 = papaMC->GetMCTrackFromMCEvent(labels2[isig][i2]);
486  Int_t mLabel2 = part2->GetMotherId();
487  CbmMCTrack* mother = 0x0;
488 
490  if (mLabel1 == mLabel2) mother = papaMC->GetMCTrackFromMCEvent(mLabel1);
491 
492  // selection of MCtruth pairs
493  UInt_t cutmask = 0;
494  if (mother)
495  cutmask = fPairFilterMC.IsSelected(mother);
496  else {
501  pair->SetMCTracks(part1, part2);
502  cutmask = fPairFilterMC.IsSelected(pair);
503  }
504  //apply MC truth pair cuts
505  if (cutmask != selectedMask) continue;
506 
507  if (bFillHF)
508  fHistoArray->Fill(labels1[isig][i1], labels2[isig][i2], isig);
509  if (bFillHist) {
510  if (FillMCHistograms(labels1[isig][i1], labels2[isig][i2], isig))
511  break;
512  }
513  }
514  }
515 
516  // mix the particles which satisfy both branches
517  for (Int_t i1 = 0; i1 < indexes12[isig]; ++i1) {
518  for (Int_t i2 = 0; i2 < i1; ++i2) {
519 
520  CbmMCTrack* part1 = papaMC->GetMCTrackFromMCEvent(labels12[isig][i1]);
521  CbmMCTrack* part2 = papaMC->GetMCTrackFromMCEvent(labels12[isig][i2]);
522  Int_t mLabel1 = part1->GetMotherId();
523  Int_t mLabel2 = part2->GetMotherId();
524 
526  CbmMCTrack* mother = 0x0;
527  if (mLabel1 == mLabel2) mother = papaMC->GetMCTrackFromMCEvent(mLabel1);
528 
529  // selection of MCtruth pairs
530  UInt_t cutmask = 0;
531  if (mother)
532  cutmask = fPairFilterMC.IsSelected(mother);
533  else {
535  pair->SetMCTracks(part1, part2);
536  cutmask = fPairFilterMC.IsSelected(pair);
537  }
538  //apply MC truth pair cuts
539  if (cutmask != selectedMask) continue;
540 
541  if (bFillHF)
542  fHistoArray->Fill(labels12[isig][i1], labels12[isig][i2], isig);
543  if (bFillHist) {
544  if (FillMCHistograms(labels12[isig][i1], labels12[isig][i2], isig))
545  break;
546  }
547  }
548  }
549  } // end loop over signals
550 
551  // release the memory
552  delete pair;
553  for (Int_t isig = 0; isig < nSignals; ++isig) {
554  delete[] * (labels1 + isig);
555  delete[] * (labels2 + isig);
556  delete[] * (labels12 + isig);
557  }
558  delete[] labels1;
559  delete[] labels2;
560  delete[] labels12;
561  delete[] indexes1;
562  delete[] indexes2;
563  delete[] indexes12;
564 }
565 
566 //________________________________________________________________
568  //
569  // Fill Histogram information for tracks after prefilter
570  // ignore mixed events - for prefilter, only single tracks +/- are relevant
571  //
572 
573  TString className, className2;
574  Double_t* values = PairAnalysisVarManager::GetData();
576 
577  //Fill track information, separately for the track array candidates
578  for (Int_t i = 0; i < 2; ++i) {
579  className.Form("Pre_%s", fgkTrackClassNames[i]);
580  if (!fHistos->GetHistogramList()->FindObject(className.Data())) continue;
581  Int_t ntracks = tracks[i]->GetEntriesFast();
582  for (Int_t itrack = 0; itrack < ntracks; ++itrack) {
583  PairAnalysisVarManager::Fill(tracks[i]->UncheckedAt(itrack), values);
584  fHistos->FillClass(className, values);
585  }
586  }
587 }
588 
589 
590 //________________________________________________________________
592  PairAnalysisEvent* /*ev1*/) {
593  //
594  // Fill Histogram information for MCEvents
595  //
596  return;
597  /*
598  Double_t *values=PairAnalysisVarManager::GetData();
599  PairAnalysisVarManager::SetFillMap(fUsedVars);
600 
601  // Fill event information
602  PairAnalysisVarManager::Fill(ev1, values); // ESD/AOD information
603  PairAnalysisVarManager::Fill(ev, values); // MC truth info
604  if (fHistos->GetHistogramList()->FindObject("MCEvent"))
605  fHistos->FillClass("MCEvent", values);
606  */
607 }
608 
609 
610 //________________________________________________________________
612  Bool_t pairInfoOnly) {
613  //
614  // Fill Histogram information for event, pairs, tracks, hits
615  //
616 
617  TString className, className2, className3;
618  TString sigName;
619  Double_t* values = PairAnalysisVarManager::GetData(); //NEW CHANGED
621 
622  //Fill event information
623  if (ev) {
624  if (fHistos && fHistos->HasHistClass("Event"))
625  fHistos->FillClass("Event", values);
626  if (fHistoArray && fHistoArray->HasHistClass("Event"))
627  fHistoArray->FillClass("Event", values);
628  }
629 
630  //Fill track information, separately for the track array candidates
631  Int_t nsig = (fSignalsMC ? fSignalsMC->GetEntriesFast() : 0);
632  TBits trkClassMC(nsig);
633  TBits trkClassMChf(nsig);
634  TBits fillMC(nsig);
635  PairAnalysisMC* mc = (nsig ? PairAnalysisMC::Instance() : 0x0);
636  PairAnalysisSignalMC* sigMC = 0x0;
637  if (!pairInfoOnly) {
638  className2.Form("Track.%s", fgkPairClassNames[1]); // unlike sign, SE only
639  Bool_t mergedtrkClass = fHistos->HasHistClass(className2);
640  Bool_t mergedtrkClass2 =
641  (fHistoArray && fHistoArray->HasHistClass(className2));
642  // check mc signal filling
643  for (Int_t isig = 0; isig < nsig; isig++) {
644  sigName = className2 + "_" + fSignalsMC->At(isig)->GetName();
645  trkClassMC.SetBitNumber(isig, fHistos->HasHistClass(sigName));
646  trkClassMChf.SetBitNumber(
647  isig, fHistoArray && fHistoArray->HasHistClass(sigName));
648  }
649  // loop over both track arrays
650  for (Int_t i = 0; i < kLegTypes; ++i) {
651  className.Form("Track.%s", fgkTrackClassNames[i]);
652  Bool_t trkClass = fHistos->HasHistClass(className);
653  Bool_t trkClass2 = (fHistoArray && fHistoArray->HasHistClass(className));
654  Bool_t fill =
655  (mergedtrkClass || mergedtrkClass2 || trkClass || trkClass2);
656  // skip stuff not to be filled
657  if (!fill && !trkClassMC.CountBits() && !trkClassMChf.CountBits())
658  continue;
659  Int_t ntracks = fTracks[i].GetEntriesFast();
660  // loop over all tracks
661  for (Int_t itrack = 0; itrack < ntracks; ++itrack) {
662  PairAnalysisTrack* track =
663  static_cast<PairAnalysisTrack*>(fTracks[i].UncheckedAt(itrack));
664  PairAnalysisVarManager::Fill(track, values);
665  if (trkClass) fHistos->FillClass(className, values);
666  if (trkClass2) fHistoArray->FillClass(className, values);
667  if (mergedtrkClass) fHistos->FillClass(className2, values);
668  if (mergedtrkClass2)
669  fHistoArray->FillClass(className2, values); //TODO: check only SE?
670  // check and do mc signal filling
671  for (Int_t isig = 0; isig < nsig; isig++) {
672  if (!trkClassMC.TestBitNumber(isig)
673  && !trkClassMChf.TestBitNumber(isig))
674  continue;
675  // test if track does correspond to the signal
676  fillMC.SetBitNumber(
677  isig,
678  mc->IsMCTruth(
679  track, (PairAnalysisSignalMC*) fSignalsMC->At(isig), 1)
680  || mc->IsMCTruth(
681  track, (PairAnalysisSignalMC*) fSignalsMC->At(isig), 2));
682  sigName = className2 + "_" + fSignalsMC->At(isig)->GetName();
683  // fill histos
684  if (fillMC.TestBitNumber(isig)) {
685  if (trkClassMC.TestBitNumber(isig))
686  fHistos->FillClass(sigName, values);
687  if (trkClassMChf.TestBitNumber(isig))
688  fHistoArray->FillClass(sigName, values);
689  }
690  }
691 
692  //Fill tracks hit information
693  FillHistogramsHits(ev, &fillMC, track, kFALSE, values);
694 
695  } // track loop
696  } // loop leg type
697  } // not pair info only
698 
699  //Fill Pair information, separately for all pair candidate arrays and the legs
700  TBits legClassMC(nsig);
701  TBits legClassMChf(nsig);
702  TBits pairClassMC(nsig);
703  TBits pairClassMChf(nsig);
704  TObjArray arrLegs(100);
705  for (Int_t i = 0; i < (kPairTypes - 1); ++i) {
706  className.Form("Pair.%s", fgkPairClassNames[i]);
707  className2.Form("Track.Legs.%s", fgkPairClassNames[i]);
708  Bool_t pairClass = fHistos->HasHistClass(className);
709  Bool_t pairClass2 = (fHistoArray && fHistoArray->HasHistClass(className));
710  Bool_t legClass = fHistos->HasHistClass(className2);
711  Bool_t legClass2 = (fHistoArray && fHistoArray->HasHistClass(className2));
712 
713  Bool_t legClassHits = kFALSE;
714 
715  // check leg hits and mc signal filling
716  if (i == kSEPM) {
717 
718  // loop over all detectors and check for hit histos
719  for (ECbmModuleId idet = ECbmModuleId::kRef;
721  ++idet) {
722  className3 + Form("Hit.Legs.") + PairAnalysisHelper::GetDetName(idet);
723  legClassHits = fHistos->HasHistClass(className3);
724  if (legClassHits) break;
725  }
726 
727 
728  for (Int_t isig = 0; isig < nsig; isig++) {
729  sigName = Form("Pair_%s", fSignalsMC->At(isig)->GetName());
730  pairClassMC.SetBitNumber(isig, fHistos->HasHistClass(sigName));
731  pairClassMChf.SetBitNumber(
732  isig, fHistoArray && fHistoArray->HasHistClass(sigName));
733  // Printf("fill %s: %d histos %d",sigName.Data(),pairClassMC.TestBitNumber(isig),fHistos->HasHistClass(sigName));
734  sigName = Form("Track.Legs_%s", fSignalsMC->At(isig)->GetName());
735  legClassMC.SetBitNumber(isig, fHistos->HasHistClass(sigName));
736  legClassMChf.SetBitNumber(
737  isig, fHistoArray && fHistoArray->HasHistClass(sigName));
738 
739  // check mc signal leg hits filling
740  if (!legClassHits) {
741  // loop over all detectors
742  for (ECbmModuleId idet = ECbmModuleId::kRef;
744  ++idet) {
745  className3 =
746  Form("Hit.Legs.") + PairAnalysisHelper::GetDetName(idet);
747  sigName = className3 + "_" + fSignalsMC->At(isig)->GetName();
748  legClassHits = fHistos->HasHistClass(className3);
749  if (legClassHits)
750  break; // abort when at least something should be filled
751  }
752  }
753  }
754  }
755 
756  Bool_t fill =
757  (pairClass || pairClass2 || legClass || legClass2 || legClassHits);
758  if (!fill && !legClassMC.CountBits() && !legClassMChf.CountBits()
759  && !pairClassMC.CountBits() && !pairClassMChf.CountBits())
760  continue;
761 
762  // loop over all pairs
763  UInt_t selectedMask = (1 << fPairFilter.GetCuts()->GetEntries())
764  - 1; // for internal train wagons only
765  Int_t npairs = PairArray(i)->GetEntriesFast();
766  for (Int_t ipair = 0; ipair < npairs; ++ipair) {
767  PairAnalysisPair* pair =
768  static_cast<PairAnalysisPair*>(PairArray(i)->UncheckedAt(ipair));
769 
770  //fill pair information
771  if (pairClass || pairClass2 || pairClassMC.CountBits()
772  || pairClassMChf.CountBits()) {
773 
774  // if(i==3)
775  // printf("train: %d \t pair type: %s \t p:%p d1:%p d2:%p \n",!fEventProcess,fgkPairClassNames[i],pair,
776  // pair->GetFirstDaughter()->GetGlobalTrack(),pair->GetSecondDaughter()->GetGlobalTrack());
777  // in case of internal train wagon do the cut selections
778  if (!fEventProcess) {
779  UInt_t cutMask = fPairFilter.IsSelected(pair);
780  // apply cuts
781  if (cutMask != selectedMask) continue;
782  }
783 
784  // fill histograms
785  PairAnalysisVarManager::Fill(pair, values);
786  if (pairClass) fHistos->FillClass(className, values);
787  if (pairClass2) fHistoArray->FillClass(className, values);
788 
789  // check mc filling
790  fillMC.ResetAllBits();
791  if (i == kSEPM) {
792  for (Int_t isig = 0; isig < nsig; isig++) {
793  // next if nothing needs to be filled
794  if (!pairClassMC.TestBitNumber(isig)
795  && !pairClassMChf.TestBitNumber(isig))
796  continue;
797  sigMC = (PairAnalysisSignalMC*) fSignalsMC->At(isig);
798  // next if single particle signal
799  if (sigMC->IsSingleParticle()) continue;
800  Bool_t isMCtruth = mc->IsMCTruth(pair, sigMC);
801  fillMC.SetBitNumber(isig, isMCtruth);
802  if (!isMCtruth) continue;
803  sigName = Form("Pair_%s", sigMC->GetName());
804  if (pairClassMC.TestBitNumber(isig))
805  fHistos->FillClass(sigName, values);
806  if (pairClassMChf.TestBitNumber(isig))
807  fHistoArray->FillClass(sigName, values);
808  // Double_t wght = sigMC->GetWeight(values);
809  // if(wght!= values[PairAnalysisVarManager::kWeight])
810  // Warning("FillHistograms","pair weight from tracks (%.3e) not matching MC weight (%.3e) for signal %s",
811  // values[PairAnalysisVarManager::kWeight],wght,sigMC->GetName());
812  }
813  }
814  }
815 
816  //fill leg information, don't fill the information twice
817  if (legClass || legClass2 || legClassMC.CountBits()
818  || legClassMChf.CountBits() || legClassHits) {
819  PairAnalysisTrack* d1 = pair->GetFirstDaughter();
820  PairAnalysisTrack* d2 = pair->GetSecondDaughter();
821  if (!arrLegs.FindObject(d1)) {
822  PairAnalysisVarManager::Fill(d1, values);
823  if (legClass) fHistos->FillClass(className2, values);
824  if (legClass2) fHistoArray->FillClass(className2, values);
825  // mc signal filling
826  if (i == kSEPM) {
827  for (Int_t isig = 0; isig < nsig; isig++) {
828  if (!fillMC.TestBitNumber(isig)) continue;
829  sigMC = (PairAnalysisSignalMC*) fSignalsMC->At(isig);
830  sigName = Form("Track.Legs_%s", sigMC->GetName());
831  if (legClassMC.TestBitNumber(isig))
832  fHistos->FillClass(sigName, values);
833  if (legClassMChf.TestBitNumber(isig))
834  fHistoArray->FillClass(sigName, values);
835  }
836  }
837 
838  //Fill leg hits information
839  if (legClassHits) FillHistogramsHits(ev, &fillMC, d1, kTRUE, values);
840 
841  arrLegs.Add(d1);
842  }
843  if (!arrLegs.FindObject(d2)) {
844  PairAnalysisVarManager::Fill(d2, values);
845  if (legClass) fHistos->FillClass(className2, values);
846  if (legClass2) fHistoArray->FillClass(className2, values);
847  // mc signal filling
848  if (i == kSEPM) {
849  for (Int_t isig = 0; isig < nsig; isig++) {
850  if (!fillMC.TestBitNumber(isig)) continue;
851  sigMC = (PairAnalysisSignalMC*) fSignalsMC->At(isig);
852  sigName = Form("Track.Legs_%s", sigMC->GetName());
853  if (legClassMC.TestBitNumber(isig))
854  fHistos->FillClass(sigName, values);
855  if (legClassMChf.TestBitNumber(isig))
856  fHistoArray->FillClass(sigName, values);
857  }
858  }
859 
860  //Fill leg hits information
861  if (legClassHits) FillHistogramsHits(ev, &fillMC, d2, kTRUE, values);
862 
863  arrLegs.Add(d2);
864  }
865  }
866  }
867  if (legClass || legClass2) arrLegs.Clear();
868  }
869 }
870 //________________________________________________________________
872  Bool_t fromPreFilter /*=kFALSE*/) {
873  //
874  // Fill Histogram information for pairs and the track in the pair
875  // NOTE: in this funtion the leg information may be filled multiple
876  // times. This funtion is used in the track rotation pairing
877  // and those legs are not saved!
878  //
879  TString className, className2;
880  Double_t* values = PairAnalysisVarManager::GetData();
882 
883  //Fill Pair information, separately for all pair candidate arrays and the legs
884  TObjArray arrLegs(100);
885  const Int_t type = pair->GetType();
886  if (fromPreFilter) {
887  className.Form("RejPair.%s", fgkPairClassNames[type]);
888  className2.Form("RejTrack.%s", fgkPairClassNames[type]);
889  } else {
890  className.Form("Pair.%s", fgkPairClassNames[type]);
891  className2.Form("Track.Legs.%s", fgkPairClassNames[type]);
892  }
893 
894  Bool_t pairClass = fHistos->HasHistClass(className);
895  Bool_t pairClass2 = (fHistoArray && fHistoArray->HasHistClass(className));
896  Bool_t legClass = fHistos->HasHistClass(className2);
897  Bool_t legClass2 = (fHistoArray && fHistoArray->HasHistClass(className2));
898 
899  //fill pair information
900  if (pairClass || pairClass2) {
901  PairAnalysisVarManager::Fill(pair, values);
902  if (pairClass) fHistos->FillClass(className, values);
903  if (pairClass2) fHistoArray->FillClass(className, values);
904  }
905 
906  if (legClass || legClass2) {
907  PairAnalysisTrack* d1 = pair->GetFirstDaughter();
908  PairAnalysisVarManager::Fill(d1, values);
909  if (legClass) fHistos->FillClass(className2, values);
910  if (legClass2) fHistoArray->FillClass(className2, values);
911 
912  PairAnalysisTrack* d2 = pair->GetSecondDaughter();
913  PairAnalysisVarManager::Fill(d2, values);
914  if (legClass) fHistos->FillClass(className2, values);
915  if (legClass2) fHistoArray->FillClass(className2, values);
916  }
917 }
918 
919 //________________________________________________________________
921  //
922  // select tracks and fill track candidate arrays
923  // use track arrays 0 and 1
924  //
925 
927  PairAnalysisMC* papaMC = 0x0;
928  if (fHasMC && fSignalsMC) papaMC = PairAnalysisMC::Instance();
929 
930  // get event data
931  Double_t* values = PairAnalysisVarManager::GetData();
932 
933  Int_t ntracks = ev->GetNumberOfTracks();
934  UInt_t selectedMask = (1 << fTrackFilter.GetCuts()->GetEntries()) - 1;
935  for (Int_t itrack = 0; itrack < ntracks; ++itrack) {
936 
937  //get particle
938  PairAnalysisTrack* particle = ev->GetTrack(itrack);
939 
940  // adapt mass hypothesis accordingly (they were initialized with PDG11)
942 
943  // fill variables
944  PairAnalysisVarManager::Fill(particle, values);
945 
946  //apply track cuts
947  UInt_t cutmask = fTrackFilter.IsSelected(values);
948  //UInt_t cutmask=fTrackFilter.IsSelected(particle);
949  //fill cut QA
950  if (fCutQA) fQAmonitor->FillAll(particle);
951  if (fCutQA) fQAmonitor->Fill(cutmask, particle);
952 
953  // if raw spectra before any cuts are requested then fill
954  if (fHistos && fHistos->HasHistClass("Track.noCuts")) {
956  // PairAnalysisVarManager::Fill(particle, values);
957  fHistos->FillClass("Track.noCuts", values);
958  }
959 
961  if (fTrackFilter.GetHistogramList()->GetSize())
962  FillCutStepHistograms(&fTrackFilter, cutmask, particle, values);
963 
964  // rejection
965  if (cutmask != selectedMask) continue;
966 
967  // store signal weights in the tracks - ATTENTION later signals should be more specific
968  if (fHasMC && fSignalsMC) {
969  // printf("particle %p: pdg: %.0f \t mother: %.0f grand: %.0f \n", particle, values[PairAnalysisVarManager::kPdgCode],
970  // values[PairAnalysisVarManager::kPdgCodeMother], values[PairAnalysisVarManager::kPdgCodeGrandMother]);
971  for (Int_t isig = 0; isig < fSignalsMC->GetEntriesFast(); isig++) {
972  PairAnalysisSignalMC* sigMC =
973  (PairAnalysisSignalMC*) fSignalsMC->At(isig);
974  Double_t wght = sigMC->GetWeight(values);
975  Bool_t useMCweight = (TMath::Abs(wght - 1.) > 1.0e-15);
976  if (!useMCweight) continue;
977  // printf("\t temp. particle weight: %f \t signal weight for %s is %f \n",particle->GetWeight(),sigMC->GetName(),sigMC->GetWeight());
978  if (papaMC->IsMCTruth(particle, sigMC, 1)
979  || papaMC->IsMCTruth(particle, sigMC, 2)) {
980  // printf("particle weight: %f \t signal weight for %s is %f \n",particle->GetWeight(),sigMC->GetName(),sigMC->GetWeight());
981  // if(sig->GetWeight(values) != 1.0) particle->SetWeight( sig->GetWeight(values) );
982  particle->SetWeight(wght);
983  // printf("no weight set for %s, use default (1.)",sigMC->GetName());
984  }
985  }
986  // printf(" -----> final particle weight: %f \n",particle->GetWeight());
987 
988  Double_t wght = particle->GetWeight();
989  Bool_t hasMCweight = (TMath::Abs(wght - 1.) > 1.0e-15);
990 
993  Int_t label = particle->GetLabel();
994  while (!hasMCweight) {
995 
996  Int_t motherLabel = papaMC->GetMothersLabel(label);
997  if (motherLabel == -1) break; // stop if primary particle is reached
998 
1000  for (Int_t isig = 0; isig < fSignalsMC->GetEntriesFast(); isig++) {
1001  PairAnalysisSignalMC* sigMC =
1002  (PairAnalysisSignalMC*) fSignalsMC->At(isig);
1003  Double_t wghtMC = sigMC->GetWeight(values);
1004  Bool_t useMCweight = (TMath::Abs(wghtMC - 1.) > 1.0e-15);
1005  if (!useMCweight) continue; // signal has no weights applied
1006 
1007  if (papaMC->IsMCTruth(motherLabel, sigMC, 1)
1008  || papaMC->IsMCTruth(motherLabel, sigMC, 2)) {
1009  particle->SetWeight(wghtMC);
1010  hasMCweight = kTRUE;
1011  }
1012  }
1013 
1015  label = motherLabel;
1016  }
1017 
1018  } //end: store mc weights
1019 
1020  //fill selected particle into the corresponding track arrays
1021  Short_t charge = particle->Charge();
1022  if (charge > 0)
1023  fTracks[0].Add(particle); // positive tracks
1024  else if (charge < 0)
1025  fTracks[1].Add(particle); // negative tracks
1026  }
1027 }
1028 
1029 //________________________________________________________________
1031  Int_t arr2,
1032  TObjArray& arrTracks1,
1033  TObjArray& arrTracks2) {
1034  //
1035  // Prefilter tracks from pairs
1036  // Needed for datlitz rejections
1037  // remove all tracks from the Single track arrays that pass the cuts in this filter
1038  //
1039 
1046  Double_t mass = TDatabasePDG::Instance()->GetParticle(fPdgLeg1)->Mass();
1047  Double_t pt = gRandom->Exp(3.); // return t from exp(-t/3.)
1048  if (pt < 0.075) pt = 0.075;
1049  Double_t eta = -TMath::Log(
1050  TMath::Tan((gRandom->Uniform(2.5, 25.) / 180. * TMath::Pi()) / 2));
1051  Double_t phi = gRandom->Uniform(TMath::TwoPi());
1053  t1->SetPdgCode(fPdgLeg1);
1054  t1->GetMomentum()->SetPtEtaPhiM(pt, eta, phi, mass);
1055  fTracks[0].Add(t1); // positive tracks
1057  mass = TDatabasePDG::Instance()->GetParticle(fPdgLeg2)->Mass();
1058  pt = gRandom->Exp(3.); // return t from exp(-t/3.)
1059  if (pt < 0.075) pt = 0.075;
1060  eta = -TMath::Log(
1061  TMath::Tan((gRandom->Uniform(2.5, 25.) / 180. * TMath::Pi()) / 2));
1062  phi = gRandom->Uniform(TMath::TwoPi());
1064  t2->SetPdgCode(fPdgLeg2);
1065  t2->GetMomentum()->SetPtEtaPhiM(pt, eta, phi, mass);
1066  fTracks[1].Add(t2); // negative tracks
1068 
1072  UInt_t selectedMaskLeg =
1073  (1 << fPairPreFilterLegs.GetCuts()->GetEntries()) - 1;
1074  Bool_t isLeg1selected = kTRUE;
1075  Bool_t isLeg2selected = kTRUE;
1076 
1077 
1078  Int_t ntrack1 = arrTracks1.GetEntriesFast();
1079  Int_t ntrack2 = arrTracks2.GetEntriesFast();
1080 
1082  Bool_t* bTracks1 = new Bool_t[ntrack1];
1083  for (Int_t itrack1 = 0; itrack1 < ntrack1; ++itrack1)
1084  bTracks1[itrack1] = kFALSE;
1085  Bool_t* bTracks2 = new Bool_t[ntrack2];
1086  for (Int_t itrack2 = 0; itrack2 < ntrack2; ++itrack2)
1087  bTracks2[itrack2] = kFALSE;
1088 
1090  bTracks1[ntrack1 - 1] = kTRUE;
1091  bTracks2[ntrack2 - 1] = kTRUE;
1092 
1093  // candiate
1094  PairAnalysisPair* candidate;
1095  if (fUseKF)
1096  candidate = new PairAnalysisPairKF();
1097  else
1098  candidate = new PairAnalysisPairLV();
1099  candidate->SetKFUsage(fUseKF);
1100 
1101  UInt_t selectedMask = (1 << fPairPreFilter.GetCuts()->GetEntries()) - 1;
1102 
1103  Int_t nRejPasses = 1; //for fPreFilterUnlikeOnly and no set flag
1104  if (fPreFilterAllSigns) nRejPasses = 3;
1105 
1106  // loop over rejection passes: OS (+ 2xLS)
1107  for (Int_t iRP = 0; iRP < nRejPasses; ++iRP) {
1108 
1109  // default rejection pass OS
1110  Int_t arr1RP = arr1, arr2RP = arr2;
1111  TObjArray* arrTracks1RP = &arrTracks1;
1112  TObjArray* arrTracks2RP = &arrTracks2;
1113  Bool_t* bTracks1RP = bTracks1;
1114  Bool_t* bTracks2RP = bTracks2;
1115 
1116  // change for LS rejection passes
1117  switch (iRP) {
1118  case 1:
1119  arr1RP = arr1;
1120  arr2RP = arr1;
1121  arrTracks1RP = &arrTracks1;
1122  arrTracks2RP = &arrTracks1;
1123  bTracks1RP = bTracks1;
1124  bTracks2RP = bTracks1;
1125  break;
1126  case 2:
1127  arr1RP = arr2;
1128  arr2RP = arr2;
1129  arrTracks1RP = &arrTracks2;
1130  arrTracks2RP = &arrTracks2;
1131  bTracks1RP = bTracks2;
1132  bTracks2RP = bTracks2;
1133  break;
1134  default:; //nothing to do
1135  }
1136 
1137  Int_t ntrack1RP = (*arrTracks1RP).GetEntriesFast();
1138  Int_t ntrack2RP = (*arrTracks2RP).GetEntriesFast();
1139 
1140  Int_t pairIndex = GetPairIndex(arr1RP, arr2RP);
1141  // loop over all tracks in both arrays
1142  for (Int_t itrack1 = 0; itrack1 < ntrack1RP; ++itrack1) {
1143  Int_t end = ntrack2RP;
1144  if (arr1RP == arr2RP) end = itrack1;
1145 
1146  TObject* track1 = (*arrTracks1RP).UncheckedAt(itrack1);
1147  if (!track1) continue;
1148 
1150  if (selectedMaskLeg) {
1151  isLeg1selected = (fPairPreFilterLegs.IsSelected(
1152  static_cast<PairAnalysisTrack*>(track1))
1153  == selectedMaskLeg);
1154  if (fCutType == kBothLegs && !isLeg1selected) continue;
1155  }
1156 
1157 
1158  for (Int_t itrack2 = 0; itrack2 < end; ++itrack2) {
1159  TObject* track2 = (*arrTracks2RP).UncheckedAt(itrack2);
1160  if (!track2) continue;
1161 
1165  if ((selectedMaskLeg && fCutType != kAnyLeg)
1166  || (selectedMaskLeg && fCutType == kAnyLeg && !isLeg1selected)) {
1167  isLeg2selected = (fPairPreFilterLegs.IsSelected(
1168  static_cast<PairAnalysisTrack*>(track2))
1169  == selectedMaskLeg); // apply selection
1170  switch (fCutType) {
1171  case kBothLegs:
1172  if (!isLeg2selected) continue;
1173  break;
1174  case kAnyLeg:
1175  if (!isLeg2selected) continue;
1176  break;
1177  case kOneLeg:
1178  if (isLeg1selected == isLeg2selected) continue;
1179  break;
1180  }
1181  }
1182 
1184  candidate->SetTracks(static_cast<PairAnalysisTrack*>(track1),
1185  fPdgLeg1,
1186  static_cast<PairAnalysisTrack*>(track2),
1187  fPdgLeg2);
1188 
1189  candidate->SetType(pairIndex);
1191  candidate, fPdgMother));
1192 
1194  Bool_t testParticle =
1195  (track1 == t1 || track1 == t2 || track2 == t1 || track2 == t2);
1196 
1198  UInt_t cutmask = fPairPreFilter.IsSelected(candidate);
1199 
1201  if (!testParticle) {
1202  if (fCutQA) fQAmonitor->FillAll(candidate, 1);
1203  if (fCutQA) fQAmonitor->Fill(cutmask, candidate, 1);
1204  }
1205 
1207  if (cutmask != selectedMask) { continue; }
1208 
1210  if (testParticle) {
1211  // set variable to randomrejection probability to 1
1213  1.);
1214  continue;
1215  }
1216 
1218  if (fHistos)
1219  FillHistogramsPair(candidate, kTRUE); // kTRUE: fromPrefilter
1220 
1222  bTracks1RP[itrack1] = kTRUE;
1223  bTracks2RP[itrack2] = kTRUE;
1224  }
1225  }
1226 
1227  } // end rejection passes
1228 
1229  //clear surplus candiate
1230  delete candidate;
1231 
1232  //remove the tracks from the Track arrays
1233  for (Int_t itrack1 = 0; itrack1 < ntrack1; ++itrack1) {
1234  if (bTracks1[itrack1]) arrTracks1.AddAt(0x0, itrack1);
1235  }
1236  for (Int_t itrack2 = 0; itrack2 < ntrack2; ++itrack2) {
1237  if (bTracks2[itrack2]) arrTracks2.AddAt(0x0, itrack2);
1238  }
1239 
1240  // clean up
1241  delete[] bTracks1;
1242  delete[] bTracks2;
1243 
1244  //compress the track arrays
1245  arrTracks1.Compress();
1246  arrTracks2.Compress();
1247 
1248  /*
1249  //apply leg cuts after the pre filter
1250  if ( fFinalTrackFilter.GetCuts()->GetEntries()>0 ) {
1251  selectedMask=(1<<fFinalTrackFilter.GetCuts()->GetEntries())-1;
1252  //loop over tracks from array 1
1253  for (Int_t itrack=0; itrack<arrTracks1.GetEntriesFast();++itrack){
1254  //test cuts
1255  UInt_t cutMask=fFinalTrackFilter.IsSelected(arrTracks1.UncheckedAt(itrack));
1256 
1257  //apply cut
1258  if (cutMask!=selectedMask) arrTracks1.AddAt(0x0,itrack);
1259  }
1260  arrTracks1.Compress();
1261 
1262  //in case of like sign don't loop over second array
1263  if (arr1==arr2) {
1264  arrTracks2=arrTracks1;
1265  } else {
1266 
1267  //loop over tracks from array 2
1268  for (Int_t itrack=0; itrack<arrTracks2.GetEntriesFast();++itrack){
1269  //test cuts
1270  UInt_t cutMask=fFinalTrackFilter.IsSelected(arrTracks2.UncheckedAt(itrack));
1271  //apply cut
1272  if (cutMask!=selectedMask) arrTracks2.AddAt(0x0,itrack);
1273  }
1274  arrTracks2.Compress();
1275 
1276  }
1277  }
1278  //For unlike-sign monitor track-cuts:
1279  if (arr1!=arr2&&fHistos) {
1280  TObjArray *unlikesignArray[2] = {&arrTracks1,&arrTracks2};
1281  FillHistogramsTracks(unlikesignArray);
1282  }
1283  */
1284 }
1285 
1286 //________________________________________________________________
1287 void PairAnalysis::FilterTrackArrays(TObjArray& arrTracks1,
1288  TObjArray& arrTracks2) {
1289  //
1290  // select tracks and adapt track candidate arrays
1291  // second and final track selection
1292  //
1293 
1294  // get event data
1295  Double_t* values = PairAnalysisVarManager::GetData();
1296 
1297  //apply leg cuts after the pre filter
1298  if (fFinalTrackFilter.GetCuts()->GetEntries() < 1) return;
1299 
1300  UInt_t selectedMask = (1 << fFinalTrackFilter.GetCuts()->GetEntries()) - 1;
1301  //loop over tracks from array 1
1302  for (Int_t itrack = 0; itrack < arrTracks1.GetEntriesFast(); ++itrack) {
1303 
1304  //get particle
1305  PairAnalysisTrack* particle =
1306  static_cast<PairAnalysisTrack*>(arrTracks1.UncheckedAt(itrack));
1307 
1308  // fill variables
1309  PairAnalysisVarManager::Fill(particle, values);
1310 
1311  //apply cuts
1312  UInt_t cutmask = fFinalTrackFilter.IsSelected(values);
1313  // UInt_t cutmask=fFinalTrackFilter.IsSelected(particle);
1314  //fill cut QA
1315  if (fCutQA) fQAmonitor->FillAll(particle, 1);
1316  if (fCutQA) fQAmonitor->Fill(cutmask, particle, 1);
1317 
1319  if (fFinalTrackFilter.GetHistogramList()->GetSize())
1320  FillCutStepHistograms(&fFinalTrackFilter, cutmask, particle, values);
1321 
1322  // rejection
1323  if (cutmask != selectedMask) arrTracks1.AddAt(0x0, itrack);
1324  }
1325  arrTracks1.Compress();
1326 
1327  //loop over tracks from array 2
1328  for (Int_t itrack = 0; itrack < arrTracks2.GetEntriesFast(); ++itrack) {
1329 
1330  //get particle
1331  PairAnalysisTrack* particle =
1332  static_cast<PairAnalysisTrack*>(arrTracks2.UncheckedAt(itrack));
1333 
1334  // fill variables
1335  PairAnalysisVarManager::Fill(particle, values);
1336 
1337  //apply cuts
1338  UInt_t cutmask = fFinalTrackFilter.IsSelected(values);
1339  // UInt_t cutmask=fFinalTrackFilter.IsSelected(particle);
1340 
1341  //fill cut QA
1342  if (fCutQA) fQAmonitor->FillAll(particle, 1);
1343  if (fCutQA) fQAmonitor->Fill(cutmask, particle, 1);
1344 
1346  if (fFinalTrackFilter.GetHistogramList()->GetSize())
1347  FillCutStepHistograms(&fFinalTrackFilter, cutmask, particle, values);
1348 
1349  // rejection
1350  if (cutmask != selectedMask) arrTracks2.AddAt(0x0, itrack);
1351  }
1352  arrTracks2.Compress();
1353 }
1354 
1355 //________________________________________________________________
1356 void PairAnalysis::FillPairArrays(Int_t arr1, Int_t arr2) {
1357  //
1358  // select pairs and fill pair candidate arrays
1359  //
1360 
1361  TObjArray arrTracks1 = fTracks[arr1];
1362  TObjArray arrTracks2 = fTracks[arr2];
1363 
1364  //process pre filter if set
1365  // if ((!fPreFilterAllSigns) && (!fPreFilterUnlikeOnly) && ( fPairPreFilter.GetCuts()->GetEntries()>0 )) PairPreFilter(arr1, arr2, arrTracks1, arrTracks2);
1366 
1367  Int_t pairIndex = GetPairIndex(arr1, arr2);
1368 
1369  Int_t ntrack1 = arrTracks1.GetEntriesFast();
1370  Int_t ntrack2 = arrTracks2.GetEntriesFast();
1371 
1376  PairAnalysisPair* candidate;
1377  if (fUseKF && pairIndex <= kSEMM)
1378  candidate = new PairAnalysisPairKF();
1379  else
1380  candidate = new PairAnalysisPairLV();
1381  candidate->SetKFUsage(fUseKF);
1382  candidate->SetType(pairIndex);
1383 
1384  UInt_t selectedMask = (1 << fPairFilter.GetCuts()->GetEntries()) - 1;
1385 
1386  for (Int_t itrack1 = 0; itrack1 < ntrack1; ++itrack1) {
1387  Int_t end = ntrack2;
1388  if (arr1 == arr2) end = itrack1;
1389  for (Int_t itrack2 = 0; itrack2 < end; ++itrack2) {
1390  //create the pair (direct pointer to the memory by this daughter reference are kept also for ME)
1391  candidate->SetTracks(
1392  &(*static_cast<PairAnalysisTrack*>(arrTracks1.UncheckedAt(itrack1))),
1393  fPdgLeg1,
1394  &(*static_cast<PairAnalysisTrack*>(arrTracks2.UncheckedAt(itrack2))),
1395  fPdgLeg2);
1396  // TODO: maybe set here the mother pdg code and remove fPdgMother
1398  candidate, fPdgMother);
1399  candidate->SetLabel(label);
1400  if (label > -1)
1401  candidate->SetPdgCode(fPdgMother);
1402  else
1403  candidate->SetPdgCode(0);
1404 
1405  //pair cuts
1406  UInt_t cutMask = fPairFilter.IsSelected(candidate);
1407 
1408  // cut qa
1409  if (pairIndex == kSEPM && fCutQA) {
1410  fQAmonitor->FillAll(candidate);
1411  fQAmonitor->Fill(cutMask, candidate);
1412  }
1413 
1414  //apply cut
1415  if (cutMask != selectedMask) continue;
1416 
1417  // if(pairIndex==3)
1418  // printf("fill pair array \t train: %d \t pair type: %s \t p:%p d1:%p d2:%p \n",!fEventProcess,fgkPairClassNames[pairIndex],candidate,
1419  // candidate->GetFirstDaughter()->GetGlobalTrack(),candidate->GetSecondDaughter()->GetGlobalTrack());
1420  //histogram array for the pair
1422 
1423  //add the candidate to the candidate array
1424  PairArray(pairIndex)->Add(candidate);
1425  //get a new candidate
1426  if (fUseKF && pairIndex <= kSEMM)
1427  candidate = new PairAnalysisPairKF();
1428  else
1429  candidate = new PairAnalysisPairLV();
1430  candidate->SetKFUsage(fUseKF);
1431  candidate->SetType(pairIndex);
1432  }
1433  }
1434  //delete the surplus candidate
1435  delete candidate;
1436 }
1437 
1438 //________________________________________________________________
1440  //
1441  // rotate pairs and fill into pair candidate arrays
1442  //
1443 
1444  Int_t ntrack1 = fTracks[0].GetEntriesFast();
1445  Int_t ntrack2 = fTracks[1].GetEntriesFast();
1446 
1447  PairAnalysisPair* candidate;
1448  if (fUseKF)
1449  candidate = new PairAnalysisPairKF();
1450  else
1451  candidate = new PairAnalysisPairLV();
1452  candidate->SetKFUsage(fUseKF);
1453  candidate->SetType(kSEPMRot);
1454 
1455  UInt_t selectedMask = (1 << fPairFilter.GetCuts()->GetEntries()) - 1;
1456  // loop over track arrays
1457  for (Int_t itrack1 = 0; itrack1 < ntrack1; ++itrack1) {
1458  for (Int_t itrack2 = 0; itrack2 < ntrack2; ++itrack2) {
1459 
1460  // loop over iterations
1461  for (Int_t irot = 0; irot < fTrackRotator->GetIterations(); ++irot) {
1462  // build candidate
1463  candidate->SetTracks(
1464  &(*static_cast<PairAnalysisTrack*>(fTracks[0].UncheckedAt(itrack1))),
1465  fPdgLeg1,
1466  &(*static_cast<PairAnalysisTrack*>(fTracks[1].UncheckedAt(itrack2))),
1467  fPdgLeg2);
1468  // rotate the candidates daughter track
1469  candidate->RotateTrack(fTrackRotator);
1470 
1471  //pair cuts
1472  UInt_t cutMask = fPairFilter.IsSelected(candidate);
1473 
1474  //apply cut
1475  if (cutMask != selectedMask) continue;
1476 
1477  //histogram array for the pair
1478  if (fHistoArray) fHistoArray->Fill((Int_t) kSEPMRot, candidate);
1479 
1480  if (fHistos) FillHistogramsPair(candidate);
1481  if (fStoreRotatedPairs) {
1482  if (fUseKF)
1483  PairArray(kSEPMRot)->Add(
1484  static_cast<PairAnalysisPairKF*>(candidate->Clone()));
1485  else
1486  PairArray(kSEPMRot)->Add(
1487  static_cast<PairAnalysisPairLV*>(candidate->Clone()));
1488  // if(fUseKF) PairArray(kSEPMRot)->Add(new PairAnalysisPairKF(*candidate);
1489  // else PairArray(kSEPMRot)->Add(new PairAnalysisPairLV(*candidate);
1490  }
1491 
1492  } // end of iterations
1493  } //arr0
1494  } //arr1
1495 
1496  //delete the surplus candidate
1497  delete candidate;
1498 }
1499 
1500 //________________________________________________________________
1502  //
1503  // Add an MC signal to the signals list
1504  //
1505  if (!fSignalsMC) {
1506  fSignalsMC = new TObjArray();
1507  fSignalsMC->SetOwner();
1508  }
1509  // sort mc signal (first single particle, then pair signals)
1510  if (signal->IsSingleParticle())
1511  fSignalsMC->AddAtFree(signal);
1512  else
1513  fSignalsMC->AddAtAndExpand(
1514  signal, fSignalsMC->GetLast() < 10 ? 10 : fSignalsMC->GetLast() + 1);
1515  //fSignalsMC->Add(signal);
1516 }
1517 
1518 //________________________________________________________________
1519 Bool_t
1520 PairAnalysis::FillMCHistograms(Int_t label1, Int_t label2, Int_t nSignal) {
1521  //
1522  // fill QA MC TRUTH histograms for pairs and legs of all added mc signals
1523  //
1524  PairAnalysisSignalMC* sigMC = (PairAnalysisSignalMC*) fSignalsMC->At(nSignal);
1525 
1526  TString className = Form("Pair_%s_MCtruth", sigMC->GetName());
1527  TString className2 = Form("Track.Legs_%s_MCtruth", sigMC->GetName());
1528  TString className3 =
1529  Form("Track.%s_%s_MCtruth", fgkPairClassNames[1], sigMC->GetName());
1530  Bool_t pairClass = fHistos->HasHistClass(className.Data());
1531  Bool_t legClass = fHistos->HasHistClass(className2.Data());
1532  Bool_t trkClass = fHistos->HasHistClass(className3.Data());
1533  // printf("fill signal %d: pair %d legs %d trk %d \n",nSignal,pairClass,legClass,trkClass);
1534  if (!pairClass && !legClass && !trkClass) return kFALSE;
1535 
1537  CbmMCTrack* part1 = papaMC->GetMCTrackFromMCEvent(label1);
1538  CbmMCTrack* part2 = papaMC->GetMCTrackFromMCEvent(label2);
1539  if (!part1 && !part2) return kFALSE;
1540  if (part1 && part2) {
1541  // fill only unlike sign (and only SE)
1542  if (part1->GetCharge() * part2->GetCharge() > 0) return kFALSE;
1543  }
1544 
1545  Int_t mLabel1 = papaMC->GetMothersLabel(label1);
1546  Int_t mLabel2 = papaMC->GetMothersLabel(label2);
1547  // printf("leg/mother labels: %d/%d %d/%d \t part %p,%p \n",label1,mLabel1,label2,mLabel2,part1,part2);
1548 
1549  // check the same mother option
1551  && mLabel1 != mLabel2)
1552  return kFALSE;
1554  && mLabel1 == mLabel2)
1555  return kFALSE;
1556 
1557  // fill event values
1558  Double_t* values = PairAnalysisVarManager::GetData(); //NEW CHANGED
1561  // fill the leg variables
1562  if (legClass || trkClass) {
1563  if (part1) PairAnalysisVarManager::Fill(part1, values);
1565  sigMC->GetWeight(values));
1566  if (part1 && trkClass) fHistos->FillClass(className3, values);
1567  if (part1 && part2 && legClass) fHistos->FillClass(className2, values);
1568  if (part2) PairAnalysisVarManager::Fill(part2, values);
1570  sigMC->GetWeight(values));
1571  if (part2 && trkClass) fHistos->FillClass(className3, values);
1572  if (part1 && part2 && legClass) fHistos->FillClass(className2, values);
1573  }
1574 
1576  FairMCPoint* pnt = NULL;
1577  TString className4;
1578  // loop over daughters
1579  for (Int_t ipart = 0; ipart < 2; ipart++) {
1580 
1581  CbmMCTrack* part = (!ipart ? part1 : part2);
1582  Int_t label = (!ipart ? label1 : label2);
1583  if (!part) continue;
1584  if (ipart && sigMC->IsSingleParticle()) continue;
1585 
1586  // leg and no leg loop
1587  for (Int_t ileg = 0; ileg < 2; ileg++) {
1588 
1589  // loop over all detectors
1590  for (ECbmModuleId idet = ECbmModuleId::kRef;
1592  ++idet) {
1593  className4 = Form("Hit.%s", (ileg ? "Legs." : ""));
1594  className4 += PairAnalysisHelper::GetDetName(idet) + "_"
1595  + sigMC->GetName() + "_MCtruth";
1596  if (!fHistos->HasHistClass(className4)) continue;
1597 
1598  Int_t npnts = part->GetNPoints(idet);
1599  //printf("track %p(%d) \t has %d %s mc points \n",part,label1,npnts,PairAnalysisHelper::GetDetName(idet).Data());
1600  if (!npnts) continue;
1601 
1602  TClonesArray* points =
1604  idet); // get point array
1605  Int_t psize = points->GetSize();
1606  if (!points || psize < 1) continue;
1607 
1608  Int_t nfnd = 0;
1609  for (Int_t idx = 0; idx < psize; idx++) {
1610  if (nfnd == npnts) break; // all points found
1611 
1612  pnt = static_cast<FairMCPoint*>(points->At(idx));
1613  if (pnt->GetTrackID() == label) {
1614  // printf("det %s \t point index: %d/%d found! \n",PairAnalysisHelper::GetDetName(idet).Data(),idx,psize);
1615  nfnd++; // found point
1616  PairAnalysisVarManager::Fill(pnt, values);
1617  fHistos->FillClass(className4, values);
1618  }
1619  }
1620 
1621  } //idet loop
1622  } // leg or not loop
1623  } // daughters loop
1624 
1625  //fill pair information
1626  if (pairClass && part1 && part2) {
1627  PairAnalysisVarManager::FillVarMCParticle(part1, part2, values);
1629  sigMC->GetWeight(values));
1630  fHistos->FillClass(className, values);
1631  }
1632 
1633  return kTRUE;
1634 }
1635 
1636 //________________________________________________________________
1638  Bool_t pairInfoOnly /*=kFALSE*/) {
1639  //
1640  // Fill Histogram information for tracks and pairs
1641  //
1642 
1643  TString className, className2;
1644  Double_t* values = PairAnalysisVarManager::GetData();
1646 
1647  //Fill event information
1648  if (!pairInfoOnly) {
1649  if (fHistos->GetHistogramList()->FindObject("Event")) {
1650  fHistos->FillClass("Event", PairAnalysisVarManager::GetData());
1651  }
1652  }
1653 
1654  UInt_t selectedMask = (1 << fPairFilter.GetCuts()->GetEntries()) - 1;
1655 
1656  //Fill Pair information, separately for all pair candidate arrays and the legs
1657  TObjArray arrLegs(100);
1658  for (Int_t i = 0; i < (kPairTypes - 1); ++i) {
1659  Int_t npairs = PairArray(i)->GetEntriesFast();
1660  if (npairs < 1) continue;
1661 
1662  className.Form("Pair.%s", fgkPairClassNames[i]);
1663  className2.Form("Track.Legs_%s", fgkPairClassNames[i]);
1664  Bool_t pairClass = fHistos->HasHistClass(className);
1665  Bool_t legClass = fHistos->HasHistClass(className2);
1666 
1667  // if (!pairClass&&!legClass) continue;
1668  for (Int_t ipair = 0; ipair < npairs; ++ipair) {
1669  PairAnalysisPair* pair =
1670  static_cast<PairAnalysisPair*>(PairArray(i)->UncheckedAt(ipair));
1671 
1672  // apply cuts
1673  UInt_t cutMask = fPairFilter.IsSelected(pair);
1674 
1675  // cut qa
1676  if (i == kSEPM && fCutQA) {
1677  fQAmonitor->FillAll(pair);
1678  fQAmonitor->Fill(cutMask, pair);
1679  }
1680 
1681  //apply cut
1682  if (cutMask != selectedMask) continue;
1683 
1684  //histogram array for the pair
1685  if (fHistoArray) fHistoArray->Fill(i, pair);
1686 
1687  // fill map
1689 
1690  //fill pair information
1691  if (pairClass) {
1692  PairAnalysisVarManager::Fill(pair, values);
1693  fHistos->FillClass(className, values);
1694  }
1695 
1696  //fill leg information, don't fill the information twice
1697  if (legClass) {
1698  PairAnalysisTrack* d1 = pair->GetFirstDaughter();
1699  PairAnalysisTrack* d2 = pair->GetSecondDaughter();
1700  if (!arrLegs.FindObject(d1)) {
1701  PairAnalysisVarManager::Fill(d1, values);
1702  fHistos->FillClass(className2, values);
1703  arrLegs.Add(d1);
1704  }
1705  if (!arrLegs.FindObject(d2)) {
1706  PairAnalysisVarManager::Fill(d2, values);
1707  fHistos->FillClass(className2, values);
1708  arrLegs.Add(d2);
1709  }
1710  }
1711  }
1712  if (legClass) arrLegs.Clear();
1713  }
1714 }
1715 
1716 //________________________________________________________________
1718  UInt_t cutmask,
1719  PairAnalysisTrack* trk,
1720  const Double_t* values) {
1721 
1723  PairAnalysisMC* papaMC = 0x0;
1724  if (fHasMC && fSignalsMC) papaMC = PairAnalysisMC::Instance();
1725 
1727  TString className;
1728  TString classNameMC;
1729  TString classNamePM = Form("Track.%s", fgkPairClassNames[1]);
1730 
1731  PairAnalysisHistos histo;
1732  AnalysisCuts* cuts;
1733  TIter next(filter->GetCuts());
1734  Int_t iCut = 0;
1735 
1737  Int_t nsig = (fSignalsMC ? fSignalsMC->GetEntriesFast() : 1);
1738  PairAnalysisSignalMC* sigMC;
1739  for (Int_t isig = 0; isig < nsig; isig++) {
1740  if (fSignalsMC) {
1741  sigMC = (PairAnalysisSignalMC*) fSignalsMC->At(isig);
1742  classNameMC = classNamePM + "_" + sigMC->GetName();
1743  // printf("fill cut details for %s \n",classNameMC.Data());
1744  }
1745  // check if machtes mc signal
1746  Bool_t isMCtruth =
1747  fSignalsMC
1748  && (papaMC->IsMCTruth(trk, sigMC, 1) || papaMC->IsMCTruth(trk, sigMC, 2));
1749  if (isig && !isMCtruth) continue;
1750 
1752  // if(sigMC->GetWeight(values) != 1.0) trk->SetWeight( sigMC->GetWeight(values) );
1753 
1755  next.Reset();
1756  iCut = 0;
1757 
1759  while ((cuts = (AnalysisCuts*) next())) {
1761  UInt_t cutRef = (1 << (iCut + 1)) - 1; // increasing cut match
1762  // printf(" fill cut %s for track %p in hist details \n",cuts->GetName(),trk);
1763 
1765  if ((cutmask & cutRef) == cutRef) {
1766 
1767  // printf(" track %p passed cut \n",trk);
1769  histo.SetHistogramList(
1770  *(THashList*) filter->GetHistogramList()->FindObject(cuts->GetName()),
1771  kFALSE);
1772 
1774  if (!isig) {
1775  histo.FillClass(classNamePM, values);
1776  for (Int_t i = 0; i < kLegTypes; ++i) {
1777  className.Form("Track.%s", fgkTrackClassNames[i]);
1778  histo.FillClass(className, values);
1779  }
1780  }
1782  if (isMCtruth) histo.FillClass(classNameMC, values);
1783  }
1784  iCut++;
1785  }
1786  }
1787 }
1788 
1789 //________________________________________________________________
1791  UInt_t cutmask,
1792  Int_t label,
1793  const Double_t* values) {
1794 
1796  PairAnalysisMC* papaMC = 0x0;
1797  if (fHasMC && fSignalsMC) papaMC = PairAnalysisMC::Instance();
1798 
1800  TString className;
1801  TString classNameMC;
1802  TString classNamePM = Form("Track.%s", fgkPairClassNames[1]);
1803 
1804  PairAnalysisHistos histo;
1805  AnalysisCuts* cuts;
1806  TIter next(filter->GetCuts());
1807  Int_t iCut = 0;
1808 
1810  Int_t nsig = (fSignalsMC ? fSignalsMC->GetEntriesFast() : 0);
1811  PairAnalysisSignalMC* sigMC;
1812  for (Int_t isig = 0; isig < nsig; isig++) {
1813 
1814  sigMC = (PairAnalysisSignalMC*) fSignalsMC->At(isig);
1815  classNameMC = classNamePM + "_" + sigMC->GetName() + "_MCtruth";
1816  // printf("fill cut details for %s \n",classNameMC.Data());
1817 
1818  // Proceed only if this signal is required in the pure MC step
1819  if (!sigMC->GetFillPureMCStep()) continue;
1820 
1821  // check if matches mc signal
1822  Bool_t isMCtruth = fSignalsMC
1823  && (papaMC->IsMCTruth(label, sigMC, 1)
1824  || papaMC->IsMCTruth(label, sigMC, 2));
1825  if (isig && !isMCtruth) continue;
1826 
1828  // if(sigMC->GetWeight(values) != 1.0) trk->SetWeight( sigMC->GetWeight(values) );
1829 
1831  next.Reset();
1832  iCut = 0;
1833 
1835  while ((cuts = (AnalysisCuts*) next())) {
1837  UInt_t cutRef = (1 << (iCut + 1)) - 1; // increasing cut match
1838 
1840  if ((cutmask & cutRef) == cutRef) {
1841 
1843  histo.SetHistogramList(
1844  *(THashList*) filter->GetHistogramList()->FindObject(cuts->GetName()),
1845  kFALSE);
1846 
1848  if (isMCtruth) histo.FillClass(classNameMC, values);
1849  }
1850  iCut++;
1851  }
1852  }
1853 }
1854 
1855 //________________________________________________________________
1857  TBits* fillMC,
1858  PairAnalysisTrack* track,
1859  Bool_t trackIsLeg,
1860  Double_t* values) {
1861  //
1862  // Fill Histogram information for hits and hits of legs
1863  //
1864  TString className;
1865 
1866  Int_t nsig = (fSignalsMC ? fSignalsMC->GetEntriesFast() : 0);
1867  TBits hitClassMC(nsig);
1868  TBits hitClassMChf(nsig);
1869 
1870  TString sigName;
1871  PairAnalysisMC* mc = (nsig ? PairAnalysisMC::Instance() : 0x0);
1872 
1873 
1874  // loop over all detectors
1876  ++idet) {
1877 
1878  // detectors implemented
1879  switch (idet) {
1880  case ECbmModuleId::kMvd:
1881  case ECbmModuleId::kSts:
1882  case ECbmModuleId::kMuch:
1883  case ECbmModuleId::kTrd:
1884  case ECbmModuleId::kRich:
1885  case ECbmModuleId::kTof: /* */ break;
1886  default: continue;
1887  }
1888 
1890  className.Form("Hit.%s", (trackIsLeg ? "Legs." : ""));
1891  className += PairAnalysisHelper::GetDetName(idet); // detector hit
1892 
1893  Bool_t hitClass = fHistos->HasHistClass(className);
1894  Bool_t hitClass2 = (fHistoArray && fHistoArray->HasHistClass(className));
1895 
1896  // check mc signal filling
1897  for (Int_t isig = 0; isig < nsig; isig++) {
1898  sigName = className + "_" + fSignalsMC->At(isig)->GetName();
1899  hitClassMC.SetBitNumber(isig, fHistos->HasHistClass(sigName));
1900  hitClassMChf.SetBitNumber(
1901  isig, fHistoArray && fHistoArray->HasHistClass(sigName));
1902  }
1903  if (!hitClass && !hitClass2 && !hitClassMC.CountBits()
1904  && !hitClassMChf.CountBits())
1905  continue;
1906 
1907  // get hit array
1908  TClonesArray* hits = ev->GetHits(idet);
1909  if (!hits || hits->GetSize() < 1) continue;
1910 
1911  // get matched track and mc track index/id
1912  CbmTrackMatchNew* tmtch = track->GetTrackMatch(idet);
1913  Int_t mctrk = (tmtch ? tmtch->GetMatchedLink().GetIndex() : -1);
1914  // Printf("mc track id via track match (%p) link: %d",tmtch,mctrk);
1915 
1916  // get detector tracks
1917  CbmTrack* trkl = 0x0;
1918  CbmRichRing* ring = 0x0;
1919  switch (idet) {
1920  case ECbmModuleId::kMvd:
1921  case ECbmModuleId::kSts:
1922  case ECbmModuleId::kMuch:
1923  case ECbmModuleId::kTrd: trkl = track->GetTrack(idet); break;
1924  case ECbmModuleId::kRich: ring = track->GetRichRing(); break;
1925  case ECbmModuleId::kTof: /* */ break;
1926  default: continue;
1927  }
1928 
1929  // get number of hits
1930  Int_t nhits = 0;
1931  switch (idet) {
1932  case ECbmModuleId::kMvd:
1933  if (trkl) nhits = static_cast<CbmStsTrack*>(trkl)->GetNofMvdHits();
1934  break;
1935  case ECbmModuleId::kSts:
1936  if (trkl) nhits = static_cast<CbmStsTrack*>(trkl)->GetNofStsHits();
1937  break;
1938  case ECbmModuleId::kMuch:
1939  case ECbmModuleId::kTrd:
1940  if (trkl) nhits = trkl->GetNofHits();
1941  break;
1942  case ECbmModuleId::kTof:
1943  nhits = 1; /* one is maximum */
1944  break;
1945  case ECbmModuleId::kRich:
1946  if (ring) nhits = ring->GetNofHits();
1947  break;
1948  default: continue;
1949  }
1950 
1951  // loop over all reconstructed hits
1952  CbmHit* hit = 0x0;
1953  CbmMatch* mtch = 0x0;
1954  FairMCPoint* pnt = 0x0;
1955  for (Int_t ihit = 0; ihit < nhits; ihit++) {
1956  Int_t idx = -1;
1957  switch (idet) {
1958  case ECbmModuleId::kMvd:
1959  idx = static_cast<CbmStsTrack*>(trkl)->GetMvdHitIndex(ihit);
1960  break;
1961  case ECbmModuleId::kSts:
1962  idx = static_cast<CbmStsTrack*>(trkl)->GetStsHitIndex(ihit);
1963  break;
1964  case ECbmModuleId::kMuch:
1965  case ECbmModuleId::kTrd: idx = trkl->GetHitIndex(ihit); break;
1966  case ECbmModuleId::kTof: hit = track->GetTofHit(); break;
1967  case ECbmModuleId::kRich: idx = ring->GetHit(ihit); break;
1968  default: continue;
1969  }
1970  // get hit
1971  if (idet != ECbmModuleId::kTof && idx > -1) {
1972  hit = dynamic_cast<CbmHit*>(hits->At(idx));
1973  }
1974  if (!hit) continue;
1975 
1976  // fill rec hit variables
1977  PairAnalysisVarManager::Fill(hit, values);
1978  Bool_t trueHit = kTRUE;
1979  Bool_t fakeHit = kTRUE;
1980  // access to mc points
1981  if ((mtch = hit->GetMatch()) && ev->GetPoints(idet)) {
1982  Int_t nlinks = mtch->GetNofLinks();
1983 
1984  // check if mc point corresponds to the matched track (true or fake pnt)
1985  // DEFINITION: always a fake hit if you link to >1 mc points?
1986  // trueHit = (pnt->GetTrackID() == mctrk && mctrk>-1 && nlinks==1);
1987 
1988  // fill MC hit variables
1989  // NOTE: the sum of all linked mc points is stored, you have to normlize to the mean
1990  // loop over all linked mc points
1991  for (Int_t iLink = 0; iLink < nlinks; iLink++) {
1992  pnt = static_cast<FairMCPoint*>(
1993  ev->GetPoints(idet)->At(mtch->GetLink(iLink).GetIndex()));
1994 
1995  // Fill the MC hit variables
1996  if (!iLink)
1997  PairAnalysisVarManager::Fill(pnt, values);
1998  else
1999  PairAnalysisVarManager::FillSum(pnt, values);
2000 
2001  // hit type defintion
2002  if (!pnt)
2003  trueHit = kFALSE;
2004  else if (mc) {
2005  Int_t lbl = pnt->GetTrackID();
2006  Int_t lblM = mc->GetMothersLabel(lbl);
2007  Int_t lblG = mc->GetMothersLabel(lblM);
2008  if (lbl != mctrk && lblM != mctrk && lblG != mctrk)
2009  trueHit = kFALSE;
2010  else
2011  fakeHit = kFALSE;
2012  }
2013 
2014  } //end links
2015 
2016  } //end match found
2017 
2018  // fill rec hit histos
2019  if (hitClass) fHistos->FillClass(className, values);
2020  if (hitClass2) fHistoArray->FillClass(className, values);
2021  // fill true, distorted or fake hit histos
2022  if (trueHit) {
2023  if (hitClass) fHistos->FillClass(className + "_true", values);
2024  if (hitClass2) fHistoArray->FillClass(className + "_true", values);
2025  } else if (fakeHit) {
2026  if (hitClass) fHistos->FillClass(className + "_fake", values);
2027  if (hitClass2) fHistoArray->FillClass(className + "_fake", values);
2028  } else {
2029  if (hitClass) fHistos->FillClass(className + "_dist", values);
2030  if (hitClass2) fHistoArray->FillClass(className + "_dist", values);
2031  }
2032  // check and fill mc signal histos
2033  for (Int_t isig = 0; isig < nsig; isig++) {
2034  sigName = className + "_" + fSignalsMC->At(isig)->GetName();
2035  if (fillMC->TestBitNumber(isig)) { // track is MC signal truth
2036  if (hitClassMC.TestBitNumber(isig))
2037  fHistos->FillClass(sigName, values);
2038  if (hitClassMChf.TestBitNumber(isig))
2039  fHistoArray->FillClass(sigName, values);
2040  }
2041  }
2042 
2043  // reset pointer (needed for tof)
2044  hit = 0x0;
2045  } // rec hit loop
2046  } // det loop
2047 }
PairAnalysis::GetPairIndex
Int_t GetPairIndex(Int_t arr1, Int_t arr2) const
Definition: PairAnalysis.h:284
PairAnalysisMixingHandler::Init
void Init(const PairAnalysis *papa=0x0)
Definition: PairAnalysisMixingHandler.cxx:229
CbmMCTrack::GetMotherId
Int_t GetMotherId() const
Definition: CbmMCTrack.h:71
PairAnalysisMixingHandler::FindBin
Int_t FindBin(const Double_t values[], TString *dim=0x0)
Definition: PairAnalysisMixingHandler.cxx:265
CbmMatch::GetMatchedLink
const CbmLink & GetMatchedLink() const
Definition: CbmMatch.h:37
PairAnalysisMC::GetLabelMotherWithPdg
Int_t GetLabelMotherWithPdg(const PairAnalysisPair *pair, Int_t pdgMother)
Definition: PairAnalysisMC.h:133
PairAnalysisVarManager::SetEvent
static void SetEvent(PairAnalysisEvent *const ev)
Definition: PairAnalysisVarManager.h:1519
PairAnalysisEvent::GetPrimaryVertex
CbmVertex * GetPrimaryVertex() const
Definition: PairAnalysisEvent.h:38
PairAnalysisPair::SetTracks
virtual void SetTracks(PairAnalysisTrack *const particle1, Int_t pid1, PairAnalysisTrack *const particle2, Int_t pid2)=0
CbmMatch
Definition: CbmMatch.h:22
PairAnalysis::Init
void Init()
Definition: PairAnalysis.cxx:141
PairAnalysisPair::GetFirstDaughter
PairAnalysisTrack * GetFirstDaughter() const
Definition: PairAnalysisPair.h:140
PairAnalysis::fPdgMother
Int_t fPdgMother
Definition: PairAnalysis.h:191
PairAnalysisPairLegCuts
Definition: PairAnalysisPairLegCuts.h:20
PairAnalysisMixingHandler::Fill
void Fill(const PairAnalysisEvent *ev, PairAnalysis *papa)
Definition: PairAnalysisMixingHandler.cxx:82
PairAnalysis::fPdgLeg2
Int_t fPdgLeg2
Definition: PairAnalysis.h:193
PairAnalysis::FillCutStepHistograms
void FillCutStepHistograms(AnalysisFilter *filter, UInt_t cutmask, PairAnalysisTrack *trk, const Double_t *values)
Definition: PairAnalysis.cxx:1717
PairAnalysisTrack::GetWeight
Double_t GetWeight() const
Definition: PairAnalysisTrack.h:110
PairAnalysisSignalMC::IsSingleParticle
Bool_t IsSingleParticle() const
Definition: PairAnalysisSignalMC.h:198
CbmMatch::GetLink
const CbmLink & GetLink(Int_t i) const
Definition: CbmMatch.h:35
PairAnalysisVarManager::SetFillMap
static void SetFillMap(TBits *map)
Definition: PairAnalysisVarManager.h:368
CbmMatch::GetNofLinks
Int_t GetNofLinks() const
Definition: CbmMatch.h:38
PairAnalysisTrack::SetMassHypo
void SetMassHypo(Int_t pdg1, Int_t pdg2, Bool_t refitMassAssump)
Definition: PairAnalysisTrack.cxx:247
CbmTrack::GetNofHits
virtual Int_t GetNofHits() const
Definition: CbmTrack.h:53
PairAnalysis::kAnyLeg
@ kAnyLeg
Definition: PairAnalysis.h:40
PairAnalysis::Process
void Process(TObjArray *arr)
Definition: PairAnalysis.cxx:211
PairAnalysis::fEventFilter
AnalysisFilter fEventFilter
Definition: PairAnalysis.h:181
PairAnalysis::fUsedVars
TBits * fUsedVars
Definition: PairAnalysis.h:210
PairAnalysisTrack::GetRichRing
CbmRichRing * GetRichRing() const
Definition: PairAnalysisTrack.h:74
PairAnalysisSignalMC::GetWeight
Double_t GetWeight() const
Definition: PairAnalysisSignalMC.h:191
PairAnalysisTrack::Charge
Short_t Charge() const
Definition: PairAnalysisTrack.h:107
PairAnalysisPair::GetType
UChar_t GetType() const
Definition: PairAnalysisPair.h:85
PairAnalysisMC.h
PairAnalysisHelper::GetDetName
TString GetDetName(ECbmModuleId det)
Definition: PairAnalysisHelper.cxx:468
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
PairAnalysis::FilterTrackArrays
void FilterTrackArrays(TObjArray &arrTracks1, TObjArray &arrTracks2)
Definition: PairAnalysis.cxx:1287
PairAnalysis::kLegTypes
@ kLegTypes
Definition: PairAnalysis.h:37
PairAnalysisSignalMC::kDifferent
@ kDifferent
Definition: PairAnalysisSignalMC.h:18
PairAnalysis::fgkPairClassNames
static const char * fgkPairClassNames[8]
Definition: PairAnalysis.h:253
ClassImp
ClassImp(PairAnalysis) const char *PairAnalysis
Definition: PairAnalysis.cxx:93
PairAnalysisPair::SetKFUsage
void SetKFUsage(Bool_t KFUsage)
Definition: PairAnalysisPair.h:152
PairAnalysisVarManager
Definition: PairAnalysisVarManager.h:68
PairAnalysis::fPairCandidates
TObjArray * fPairCandidates
Selected track candidates.
Definition: PairAnalysis.h:218
PairAnalysis::fCutQA
Bool_t fCutQA
Definition: PairAnalysis.h:178
ECbmModuleId::kMvd
@ kMvd
Micro-Vertex Detector.
PairAnalysisVarManager::Fill
static void Fill(const TObject *particle, Double_t *const values)
Definition: PairAnalysisVarManager.h:474
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
PairAnalysis::fStoreRotatedPairs
Bool_t fStoreRotatedPairs
Definition: PairAnalysis.h:230
PairAnalysis::fTrackFilter
AnalysisFilter fTrackFilter
Definition: PairAnalysis.h:182
CbmRichRing::GetNofHits
Int_t GetNofHits() const
Definition: CbmRichRing.h:40
PairAnalysisVarManager::FillVarMCParticle
static void FillVarMCParticle(const CbmMCTrack *p1, const CbmMCTrack *p2, Double_t *const values)
Definition: PairAnalysisVarManager.h:1022
PairAnalysisTrackRotator.h
CbmRichRing
Definition: CbmRichRing.h:17
PairAnalysisPair::SetPdgCode
void SetPdgCode(Int_t pdgCode)
Definition: PairAnalysisPair.h:93
PairAnalysisTrack
Definition: PairAnalysisTrack.h:37
PairAnalysis::~PairAnalysis
virtual ~PairAnalysis()
Definition: PairAnalysis.cxx:126
PairAnalysis::fPreFilterAllSigns
Bool_t fPreFilterAllSigns
Definition: PairAnalysis.h:226
PairAnalysisVarManager::GetCurrentEvent
static PairAnalysisEvent * GetCurrentEvent()
Definition: PairAnalysisVarManager.h:375
PairAnalysis::FillPairArrays
void FillPairArrays(Int_t arr1, Int_t arr2)
Definition: PairAnalysis.cxx:1356
PairAnalysisTrack::GetTrack
CbmTrack * GetTrack(ECbmModuleId det) const
Definition: PairAnalysisTrack.cxx:231
CbmRichRing.h
ECbmModuleId::kTof
@ kTof
Time-of-flight Detector.
PairAnalysis::fPairPreFilterLegs
AnalysisFilter fPairPreFilterLegs
Definition: PairAnalysis.h:183
CbmMatch.h
PairAnalysisCutQA::FillAll
void FillAll(TObject *obj, UInt_t addIdx=0)
Definition: PairAnalysisCutQA.cxx:448
PairAnalysis::FillCutStepHistogramsMC
void FillCutStepHistogramsMC(AnalysisFilter *filter, UInt_t cutmask, Int_t label, const Double_t *values)
Definition: PairAnalysis.cxx:1790
PairAnalysis::fPairFilter
AnalysisFilter fPairFilter
Definition: PairAnalysis.h:186
PairAnalysisTrack::GetTofHit
CbmTofHit * GetTofHit() const
Definition: PairAnalysisTrack.h:75
PairAnalysisPair
Definition: PairAnalysisPair.h:25
PairAnalysisVarManager::kRndmRej
@ kRndmRej
Definition: PairAnalysisVarManager.h:252
PairAnalysis::fEventProcess
Bool_t fEventProcess
Definition: PairAnalysis.h:234
PairAnalysis::FillHistogramsFromPairArray
void FillHistogramsFromPairArray(Bool_t pairInfoOnly=kFALSE)
Definition: PairAnalysis.cxx:1637
PairAnalysisEvent::GetPoints
TClonesArray * GetPoints(ECbmModuleId det) const
Definition: PairAnalysisEvent.cxx:542
PairAnalysisMC::IsMCTruth
Bool_t IsMCTruth(const PairAnalysisPair *pair, const PairAnalysisSignalMC *signalMC) const
Definition: PairAnalysisMC.cxx:753
PairAnalysis::AddSignalMC
void AddSignalMC(PairAnalysisSignalMC *signal)
Definition: PairAnalysis.cxx:1501
PairAnalysisCutQA::AddPairFilter
void AddPairFilter(AnalysisFilter *pairFilter)
Definition: PairAnalysisCutQA.cxx:304
CbmMCTrack::GetCharge
Double_t GetCharge() const
Charge of the associated particle.
Definition: CbmMCTrack.cxx:146
PairAnalysisTrack::GetLabel
Int_t GetLabel() const
Definition: PairAnalysisTrack.h:109
PairAnalysis::FillHistograms
void FillHistograms(const PairAnalysisEvent *ev, Bool_t pairInfoOnly=kFALSE)
Definition: PairAnalysis.cxx:611
CbmHit::GetMatch
CbmMatch * GetMatch() const
Definition: CbmHit.h:74
PairAnalysis::FillTrackArrays
void FillTrackArrays(PairAnalysisEvent *const ev)
Definition: PairAnalysis.cxx:920
CbmRichRing::GetHit
UInt_t GetHit(Int_t i) const
Definition: CbmRichRing.h:42
PairAnalysis.h
CbmTrack
Definition: CbmTrack.h:32
CbmHit.h
PairAnalysis::fRefitMassAssump
Bool_t fRefitMassAssump
Definition: PairAnalysis.h:194
PairAnalysis::FillHistogramsMC
void FillHistogramsMC(const PairAnalysisEvent *ev, PairAnalysisEvent *ev1)
Definition: PairAnalysis.cxx:591
PairAnalysis::fSignalsMC
TObjArray * fSignalsMC
Definition: PairAnalysis.h:197
PairAnalysisVarManager.h
PairAnalysis::PairAnalysis
PairAnalysis()
pair prefilter leg cut logic
Definition: PairAnalysis.cxx:101
PairAnalysis::fTrackFilterMC
AnalysisFilter fTrackFilterMC
Definition: PairAnalysis.h:188
PairAnalysisMixingHandler.h
tracks
TClonesArray * tracks
Definition: Analyze_matching.h:17
PairAnalysisTrack::GetTrackMatch
CbmTrackMatchNew * GetTrackMatch(ECbmModuleId det) const
Definition: PairAnalysisTrack.cxx:215
CbmMCTrack::GetNPoints
Int_t GetNPoints(ECbmModuleId detId) const
Definition: CbmMCTrack.cxx:186
PairAnalysis::kSEMM
@ kSEMM
Definition: PairAnalysis.h:29
CbmTrack.h
PairAnalysis::PairPreFilter
void PairPreFilter(Int_t arr1, Int_t arr2, TObjArray &arrTracks1, TObjArray &arrTracks2)
Definition: PairAnalysis.cxx:1030
PairAnalysisEvent::GetTrack
PairAnalysisTrack * GetTrack(UInt_t pos)
Definition: PairAnalysisEvent.cxx:439
PairAnalysis::InitPairCandidateArrays
void InitPairCandidateArrays()
Definition: PairAnalysis.h:299
PairAnalysisVarManager::kWeight
@ kWeight
Definition: PairAnalysisVarManager.h:299
PairAnalysis::fPreFilterUnlikeOnly
Bool_t fPreFilterUnlikeOnly
Definition: PairAnalysis.h:224
PairAnalysis::fgkTrackClassNames
static const char * fgkTrackClassNames[2]
Definition: PairAnalysis.h:252
PairAnalysisCutQA::AddTrackFilterMC
void AddTrackFilterMC(AnalysisFilter *trkFilterMC)
Definition: PairAnalysisCutQA.cxx:261
CbmTrack::GetHitIndex
Int_t GetHitIndex(Int_t iHit) const
Definition: CbmTrack.h:54
PairAnalysisPairLV.h
PairAnalysisCutQA::AddPrePairFilter
void AddPrePairFilter(AnalysisFilter *pairFilter)
Definition: PairAnalysisCutQA.cxx:324
AnalysisFilter::GetCuts
TList * GetCuts() const
Definition: AnalysisFilter.h:28
PairAnalysis::ClearArrays
void ClearArrays()
Definition: PairAnalysis.h:319
PairAnalysis::fHistos
PairAnalysisHistos * fHistos
Definition: PairAnalysis.h:207
PairAnalysisPairLV
Definition: PairAnalysisPairLV.h:25
ECbmModuleId::kNofSystems
@ kNofSystems
For loops over active systems.
ECbmModuleId::kRich
@ kRich
Ring-Imaging Cherenkov Detector.
ECbmModuleId::kRef
@ kRef
Reference plane.
PairAnalysisVarManager::kPairs
@ kPairs
Definition: PairAnalysisVarManager.h:238
PairAnalysis::kOneLeg
@ kOneLeg
Definition: PairAnalysis.h:41
PairAnalysis::fCutType
CutType fCutType
Definition: PairAnalysis.h:199
xMath::Pi
double Pi()
Definition: xMath.h:5
PairAnalysis::kSEPM
@ kSEPM
Definition: PairAnalysis.h:28
AnalysisFilter::IsSelected
virtual UInt_t IsSelected(Double_t *const values)
Definition: AnalysisFilter.cxx:103
PairAnalysisMC
Definition: PairAnalysisMC.h:25
PairAnalysisTrack::SetPdgCode
void SetPdgCode(Int_t pdg)
Definition: PairAnalysisTrack.h:61
PairAnalysisCutQA
Definition: PairAnalysisCutQA.h:24
PairAnalysisVarManager::SetValue
static void SetValue(ValueTypes var, Double_t val)
Definition: PairAnalysisVarManager.h:372
PairAnalysis::kBothLegs
@ kBothLegs
Definition: PairAnalysis.h:39
PairAnalysisTrack.h
AnalysisFilter::GetHistogramList
THashList * GetHistogramList()
Definition: AnalysisFilter.h:30
ECbmModuleId::kTrd
@ kTrd
Transition Radiation Detector.
PairAnalysisEvent
Definition: PairAnalysisEvent.h:25
PairAnalysisVarManager::kMixingBin
@ kMixingBin
Definition: PairAnalysisVarManager.h:261
PairAnalysisPairLegCuts.h
PairAnalysisPairLegCuts::GetLeg2Filter
AnalysisFilter & GetLeg2Filter()
Definition: PairAnalysisPairLegCuts.h:38
points
TClonesArray * points
Definition: Analyze_matching.h:18
CbmMCTrack.h
PairAnalysis::fMixing
PairAnalysisMixingHandler * fMixing
Definition: PairAnalysis.h:222
PairAnalysisEvent::GetHits
TClonesArray * GetHits(ECbmModuleId det) const
Definition: PairAnalysisEvent.cxx:508
AnalysisFilter
Definition: AnalysisFilter.h:15
PairAnalysis::fUseKF
Bool_t fUseKF
Definition: PairAnalysis.h:203
PairAnalysisHF::FillClass
void FillClass(const char *histClass, const Double_t *values)
Definition: PairAnalysisHF.cxx:122
PairAnalysis::fFinalTrackFilter
AnalysisFilter fFinalTrackFilter
Definition: PairAnalysis.h:185
PairAnalysisCutQA::AddTrackFilter2
void AddTrackFilter2(AnalysisFilter *trkFilter2)
Definition: PairAnalysisCutQA.cxx:282
PairAnalysisPair::RotateTrack
virtual void RotateTrack(PairAnalysisTrackRotator *rot)=0
CbmMCTrack
Definition: CbmMCTrack.h:34
CbmHit
Definition: CbmHit.h:38
PairAnalysisPair::SetType
void SetType(Char_t type)
Definition: PairAnalysisPair.h:86
PairAnalysisCutQA::AddEventFilter
void AddEventFilter(AnalysisFilter *eventFilter)
Definition: PairAnalysisCutQA.cxx:345
PairAnalysisHF::Init
void Init()
Definition: PairAnalysisHF.cxx:345
PairAnalysis::kPairTypes
@ kPairTypes
Definition: PairAnalysis.h:35
PairAnalysis::fTracks
TObjArray fTracks[4]
Definition: PairAnalysis.h:212
PairAnalysis
Definition: PairAnalysis.h:22
PairAnalysis::PairArray
TObjArray * PairArray(Int_t i)
Definition: PairAnalysis.h:312
PairAnalysisPair::SetMCTracks
virtual void SetMCTracks(const CbmMCTrack *const particle1, const CbmMCTrack *const particle2)=0
PairAnalysisPair.h
PairAnalysisSignalMC::GetFillPureMCStep
Bool_t GetFillPureMCStep() const
Definition: PairAnalysisSignalMC.h:197
PairAnalysis::FillPairArrayTR
void FillPairArrayTR()
Definition: PairAnalysis.cxx:1439
PairAnalysis::fPdgLeg1
Int_t fPdgLeg1
Definition: PairAnalysis.h:192
hits
static vector< vector< QAHit > > hits
Definition: CbmTofHitFinderTBQA.cxx:114
PairAnalysis::ProcessMC
void ProcessMC()
Definition: PairAnalysis.cxx:328
PairAnalysisVarManager::GetData
static Double_t * GetData()
Definition: PairAnalysisVarManager.h:386
PairAnalysis::fCutStepHistos
THashList * fCutStepHistos
Definition: PairAnalysis.h:205
PairAnalysisMC::GetMCTrackFromMCEvent
CbmMCTrack * GetMCTrackFromMCEvent(Int_t label) const
Definition: PairAnalysisMC.cxx:75
PairAnalysisSignalMC.h
ECbmModuleId::kMuch
@ kMuch
Muon detection system.
CbmTrackMatchNew
Definition: CbmTrackMatchNew.h:19
PairAnalysisMC::Instance
static PairAnalysisMC * Instance()
PairAnalysisVarManager::kTracks
@ kTracks
Definition: PairAnalysisVarManager.h:254
PairAnalysisSignalMC
Definition: PairAnalysisSignalMC.h:15
PairAnalysis::fHasMC
Bool_t fHasMC
Definition: PairAnalysis.h:228
PairAnalysis::kSEPMRot
@ kSEPMRot
Definition: PairAnalysis.h:34
PairAnalysis::fHistoArray
PairAnalysisHF * fHistoArray
Definition: PairAnalysis.h:206
PairAnalysisVarManager::kMPair
@ kMPair
Definition: PairAnalysisVarManager.h:80
PairAnalysisSignalMC::GetMothersRelation
EBranchRelation GetMothersRelation() const
Definition: PairAnalysisSignalMC.h:188
PairAnalysis::FillMCHistograms
Bool_t FillMCHistograms(Int_t label1, Int_t label2, Int_t nSignal)
Definition: PairAnalysis.cxx:1520
PairAnalysisTrackRotator::GetIterations
Int_t GetIterations() const
Definition: PairAnalysisTrackRotator.h:33
PairAnalysis::fTrackRotator
PairAnalysisTrackRotator * fTrackRotator
Pair candidate arrays.
Definition: PairAnalysis.h:221
PairAnalysisSignalMC::kSame
@ kSame
Definition: PairAnalysisSignalMC.h:18
PairAnalysis::fDontClearArrays
Bool_t fDontClearArrays
Definition: PairAnalysis.h:232
CbmStsTrack
Definition: CbmStsTrack.h:37
PairAnalysisPairKF
Definition: PairAnalysisPairKF.h:28
PairAnalysis::fNoPairing
Bool_t fNoPairing
Definition: PairAnalysis.h:200
PairAnalysis::FillHistogramsHits
void FillHistogramsHits(const PairAnalysisEvent *ev, TBits *fillMC, PairAnalysisTrack *track, Bool_t trackIsLeg, Double_t *values)
Definition: PairAnalysis.cxx:1856
PairAnalysis::fPairPreFilter
AnalysisFilter fPairPreFilter
Definition: PairAnalysis.h:184
ECbmModuleId::kSts
@ kSts
Silicon Tracking System.
PairAnalysis::fQAmonitor
PairAnalysisCutQA * fQAmonitor
Definition: PairAnalysis.h:179
PairAnalysisHistos.h
AnalysisFilter::AddCuts
virtual void AddCuts(AnalysisCuts *cuts)
Definition: AnalysisFilter.cxx:160
PairAnalysisTrack::SetWeight
void SetWeight(Double_t wght)
Definition: PairAnalysisTrack.h:63
PairAnalysisCutQA::AddTrackFilter
void AddTrackFilter(AnalysisFilter *trkFilter)
Definition: PairAnalysisCutQA.cxx:240
PairAnalysisTrack::GetMomentum
TLorentzVector * GetMomentum()
Definition: PairAnalysisTrack.h:68
PairAnalysisHF::Fill
void Fill(Int_t pairIndex, const PairAnalysisPair *particle)
Definition: PairAnalysisHF.cxx:220
PairAnalysisVarManager::FillSum
static void FillSum(const TObject *particle, Double_t *const values)
Definition: PairAnalysisVarManager.h:527
PairAnalysisEvent.h
PairAnalysisPair::SetLabel
void SetLabel(Int_t label)
Definition: PairAnalysisPair.h:91
PairAnalysis::fProcessLS
Bool_t fProcessLS
Definition: PairAnalysis.h:202
PairAnalysisEvent::GetNumberOfTracks
Int_t GetNumberOfTracks() const
Definition: PairAnalysisEvent.h:39
AnalysisCuts
Definition: AnalysisCuts.h:12
PairAnalysisPair::GetSecondDaughter
PairAnalysisTrack * GetSecondDaughter() const
Definition: PairAnalysisPair.h:143
PairAnalysisPairLegCuts::GetLeg1Filter
AnalysisFilter & GetLeg1Filter()
Definition: PairAnalysisPairLegCuts.h:37
PairAnalysisMC::GetNMCTracks
Int_t GetNMCTracks()
Definition: PairAnalysisMC.cxx:63
PairAnalysis::fPairFilterMC
AnalysisFilter fPairFilterMC
Definition: PairAnalysis.h:189
PairAnalysis::FillHistogramsTracks
void FillHistogramsTracks(TObjArray **tracks)
Definition: PairAnalysis.cxx:567
PairAnalysisCutQA::Fill
void Fill(UInt_t mask, TObject *obj, UInt_t addIdx=0)
Definition: PairAnalysisCutQA.cxx:366
PairAnalysisCutQA::Init
void Init()
Definition: PairAnalysisCutQA.cxx:80
PairAnalysis::FillHistogramsPair
void FillHistogramsPair(PairAnalysisPair *pair, Bool_t fromPreFilter=kFALSE)
Definition: PairAnalysis.cxx:871
PairAnalysisMC::GetMothersLabel
Int_t GetMothersLabel(Int_t daughterLabel) const
Definition: PairAnalysisMC.cxx:237
PairAnalysisPairKF.h