AMSDST
myTrdQtFromTrTrack.cxx
Go to the documentation of this file.
1 // Authors: M.Duranti - INFN di Perugia
2 #include "myTrdQtFromTrTrack.h"
3 #include "debug.h"
4 #include "TClass.h"
5 
6 using namespace std;
7 
8 #define NEP 2.71828182845904
9 
10 //--------------------------------------------------------------------
11 
13 #ifdef _WITHGBATCH_
14 ClassImp(myTrdQtFromTrTrackFiller);
15 #endif
16 
17 //--------------------------------------------------------------------
18 
20 #ifdef PDEBUG
21  printf("In myTrdQtFromTrTrack::myTrdQtFromTrTrack\n");
22 #endif
23  PRINTDEBUG;
24  init();
25  PRINTDEBUG;
26 }
27 
29 #ifdef PDEBUG
30  printf("In myTrdQtFromTrTrack::~myTrdQtFromTrTrack\n");
31 #endif
32  PRINTDEBUG;
33  Clear();
34 }
35 
36 void myTrdQtFromTrTrack::Clear(Option_t* option){
37 #ifdef PDEBUG
38  printf("In myTrdQtFromTrTrack::Clear\n");
39 #endif
40  PRINTDEBUG;
41  IfProcessed = false;
42  NumberOfActiveLayers = -999999;
43  NHitsUsedInLH = -999999;
44  fill_n(LHR, 3, (int)(-999999));
45  IsInsideTrdGeometricalAcceptance = false;
46  PassesTrdPreselectionCuts = false;
47  UsefulForTrdParticleId = false;
48  PRINTDEBUG;
49  return;
50 }
51 
53 #ifdef PDEBUG
54  printf("In myTrdQtFromTrTrack::init\n");
55 #endif
56  PRINTDEBUG;
57  Clear();
58  PRINTDEBUG;
59  return;
60 }
61 
62 //-----------------------------------------------------------------------------
63 
64 #ifdef _WITHGBATCH_
65 
66 myTrdQtFromTrTrackFiller::myTrdQtFromTrTrackFiller(){
67 #ifdef PDEBUG
68  printf("In myTrdQtFromTrTrackFiller::myTrdQtFromTrTrackFiller\n");
69 #endif
70  PRINTDEBUG;
71  init();
72  PRINTDEBUG;
73 }
74 
75 myTrdQtFromTrTrackFiller::~myTrdQtFromTrTrackFiller(){
76 #ifdef PDEBUG
77  printf("In myTrdQtFromTrTrackFiller::~myTrdQtFromTrTrackFiller\n");
78 #endif
79  PRINTDEBUG;
80  Clear();
81 }
82 
83 void myTrdQtFromTrTrackFiller::Clear(Option_t* option){
84 #ifdef PDEBUG
85  printf("In myTrdQtFromTrTrackFiller::Clear\n");
86 #endif
87  PRINTDEBUG;
88  return;
89 }
90 
91 void myTrdQtFromTrTrackFiller::init(){
92 #ifdef PDEBUG
93  printf("In myTrdQtFromTrTrackFiller::init\n");
94 #endif
95  PRINTDEBUG;
96  Clear();
97  PRINTDEBUG;
98  return;
99 }
100 
101 void myTrdQtFromTrTrackFiller::Fill(short int i_track, TrTrackR* track, int kDef, float Energy){
102 #ifdef PDEBUG
103  printf("In myTrdQtFromTrTrackFiller::Fill\n");
104 #endif
105  PRINTDEBUG;
106 
107  AMSEventR* pev = AMSEventR::Head();
108 
109  int NTrdRawHits = pev->nTrdRawHit();
110 
111 #ifdef AMS_ACQT_INTERFACE
112 
113 #if !defined _B524_ && !defined _B550_ && !defined _B572_
114 
115  if (kDef>0 && track && NTrdRawHits>0) {
116 
117 #if !defined _B584_ && !defined _B610_ && !defined _B620_
118 
119  static TrdQt* trdQt = new TrdQt(0);
120 
121  // Query TRD information by passing the trackIndex 0 to operate on the first tracker track, and the 1,3,3 tracker track fit.
122  IfProcessed = trdQt->ProcessEvent(pev, i_track, 1, 0, 1);
123  NumberOfActiveLayers = trdQt->GetNumberOfActiveLayers();
124  NHitsUsedInLH = trdQt->GetNumberOfActiveStraws();
125  // test if chosen track is inside TRD acceptance
126  IsInsideTrdGeometricalAcceptance = trdQt->IsInsideTrdGeometricalAcceptance();
127  // TRD preselection
128  PassesTrdPreselectionCuts = trdQt->PassesTrdPreselectionCuts();
129  // enough information in TRD for reliable particle ID?
130  UsefulForTrdParticleId = trdQt->UsefulForTrdParticleId();
131  if (IfProcessed) {
132  // get the e/p log-likelihood ratio
133  LHR[0]=trdQt->LogLikelihoodRatioElectronProton();
134  LHR[1]=-log(1.0-pow(NEP,-trdQt->LogLikelihoodRatioHeliumElectron()));
135  LHR[2]=-log(1.0-pow(NEP,-trdQt->LogLikelihoodRatioHeliumProton()));
136  }
137 
138 #endif //#if !defined _B584_ && !defined _B610_ && !defined _B620_
139 
140  }
141 
142 #endif //#if !defined _B524_ && !defined _B550_ && !defined _B572_
143 
144 #endif //#ifdef AMS_ACQT_INTERFACE
145 
146  PRINTDEBUG;
147 
148  return;
149 }
150 
151 #endif