]>
Commit | Line | Data |
---|---|---|
99d87d49 | 1 | /************************************************************************** |
2 | * Copyright(c) 2013, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | // evaluate TRD trigger conditions, | |
17 | // potentially with hardened conditions to remove | |
18 | // triggers caused by conversions of low-pt photons | |
19 | // at large radii | |
20 | // | |
21 | // Author: Jochen Klein <jochen.klein@cern.ch> | |
22 | ||
23 | #include "AliLog.h" | |
24 | #include "AliVTrack.h" | |
d384e2d6 | 25 | #include "AliVEvent.h" |
16edfc85 AG |
26 | #include "AliESDEvent.h" |
27 | #include "AliAODEvent.h" | |
d384e2d6 | 28 | #include "AliVTrdTrack.h" |
16edfc85 | 29 | #include "AliESDTrdTrigger.h" |
99d87d49 | 30 | |
31 | #include "AliTRDTriggerAnalysis.h" | |
32 | ||
33 | AliTRDTriggerAnalysis::AliTRDTriggerAnalysis() : | |
34 | TObject(), | |
16edfc85 | 35 | fTriggerFlags(), |
99d87d49 | 36 | fTriggerInputs(0), |
37 | fTriggerClasses(0), | |
16edfc85 | 38 | fVerbosity(0), |
99d87d49 | 39 | fRequireMatch(kFALSE), |
16edfc85 AG |
40 | fRequireMatchElectron(kFALSE), |
41 | fRequireInTime(kTRUE), | |
42 | fTRDlayerMaskEl(0x1), | |
43 | fTRDnTrackletsEl(5), | |
99d87d49 | 44 | fTRDptHSE(3.), |
45 | fTRDpidHSE(144), | |
46 | fTRDptHQU(2.), | |
47 | fTRDpidHQU(164), | |
48 | fTRDptHEE(3.), | |
49 | fTRDpidHEE(144), | |
50 | fTRDminSectorHEE(6), | |
51 | fTRDmaxSectorHEE(8), | |
52 | fTRDptHJT(3.), | |
53 | fTRDnHJT(3) | |
54 | { | |
55 | // ctor | |
16edfc85 AG |
56 | |
57 | memset(fTriggerFlags, 0, sizeof(fTriggerFlags)); | |
51d42792 | 58 | memset(fTriggerContribs, 0, sizeof(fTriggerContribs)); |
99d87d49 | 59 | } |
60 | ||
61 | AliTRDTriggerAnalysis::~AliTRDTriggerAnalysis() | |
62 | { | |
63 | // dtor | |
64 | } | |
65 | ||
16edfc85 AG |
66 | void AliTRDTriggerAnalysis::ResetTriggers() |
67 | { | |
68 | // reset internal cache of trigger status | |
69 | ||
70 | memset(fTriggerFlags, 0, sizeof(fTriggerFlags)); | |
71 | fTriggerInputs = fTriggerClasses = 0; | |
72 | } | |
73 | ||
d384e2d6 | 74 | Bool_t AliTRDTriggerAnalysis::CalcTriggers(const AliVEvent *event) |
99d87d49 | 75 | { |
76 | // evaluate the TRD trigger conditions, | |
77 | // so far HCO, HSE, HQU, HJT, HEE | |
78 | ||
79 | ResetTriggers(); | |
80 | ||
d384e2d6 | 81 | if (!event) { |
82 | AliErrorClass("event pointer is null"); | |
99d87d49 | 83 | return kFALSE; |
84 | } | |
85 | ||
16edfc85 AG |
86 | // GTU information |
87 | UInt_t header = 0x0; | |
88 | ||
89 | if (fVerbosity > 0) | |
90 | printf("******************************************************************\n"); | |
91 | const AliESDEvent *esdEvent = dynamic_cast<const AliESDEvent*> (event); | |
92 | if (esdEvent) { | |
93 | AliESDTrdTrigger* trdTriggerInfo = esdEvent->GetTrdTrigger(); | |
94 | ||
95 | for (Int_t iSector = 0; iSector < 18; ++iSector) { | |
96 | UInt_t trgFlags = trdTriggerInfo->GetFlags(iSector); | |
97 | ||
98 | UInt_t trgContribs = fTriggerContribs[iSector] = trgFlags & 0xfff; | |
99 | header |= trgContribs; | |
100 | if (fVerbosity > 0) | |
101 | printf("sector %2i: %5s %5s %5s %5s %5s %5s %5s %5s (0x%03x)\n", iSector, | |
102 | trgContribs & (1 << 7) ? "TO" : "--", | |
103 | trgContribs & (1 << 6) ? "E2" : "--", | |
104 | trgContribs & (1 << 5) ? "E1" : "--", | |
105 | trgContribs & (1 << 4) ? "J1" : "--", | |
106 | trgContribs & (1 << 3) ? "H2" : "--", | |
107 | trgContribs & (1 << 2) ? "H1" : "--", | |
108 | trgContribs & (1 << 1) ? "E3" : "--", | |
109 | trgContribs & (1 << 0) ? "M1" : "--", | |
110 | trgContribs); | |
111 | ||
112 | // trackingDoneTimeSMU = ((trgFlags >> 12) & 0x3ff) * 1./120.; | |
113 | ||
114 | // for (Int_t iStack = 0; iStack < 5; ++iStack) { | |
115 | // trackingDoneTMU = ((trgFlags >> 27) & (1 << iStack)) ? kTRUE : kFALSE; // TMU-level tracking done flag | |
116 | // trackingDoneSMUStack = ((trgFlags >> 22) & (1 << iStack)) ? kTRUE : kFALSE; // SMU-level stack-related tracking done flag | |
117 | ||
118 | // lmeFlags = trdTriggerInfo->GetLME(iStack) & 0xffffff; | |
119 | // crcErrorFlags = (~(trdTriggerInfo->GetLME(iStack) >> 24)) & 0x3; | |
120 | // } | |
121 | } | |
122 | if (fVerbosity > 0) { | |
123 | printf("------------------------------------------------------------------\n"); | |
124 | printf("total : %5s %5s %5s %5s %5s %5s %5s %5s (0x%03x)\n", | |
125 | header & (1 << 7) ? "TO" : "--", | |
126 | header & (1 << 6) ? "E2" : "--", | |
127 | header & (1 << 5) ? "E1" : "--", | |
128 | header & (1 << 4) ? "J1" : "--", | |
129 | header & (1 << 3) ? "H2" : "--", | |
130 | header & (1 << 2) ? "H1" : "--", | |
131 | header & (1 << 1) ? "E3" : "--", | |
132 | header & (1 << 0) ? "M1" : "--", | |
133 | header); | |
134 | } | |
135 | } | |
99d87d49 | 136 | |
16edfc85 AG |
137 | // evaluate trigger classes |
138 | TString trgClasses = event->GetFiredTriggerClasses(); | |
139 | if (trgClasses.Contains("TRDCO2")) | |
140 | MarkClass(kHCO); | |
141 | if (trgClasses.Contains("WUHJT")) | |
142 | MarkClass(kHJT); | |
143 | if (trgClasses.Contains("WUHSE")) | |
144 | MarkClass(kHSE); | |
145 | if (trgClasses.Contains("WUHQU")) | |
146 | MarkClass(kHQU); | |
147 | if (trgClasses.Contains("WUHEE")) | |
148 | MarkClass(kHEE); | |
149 | ||
150 | // evaluate trigger inputs | |
151 | UInt_t trgInputs = 0; | |
152 | if (esdEvent) | |
153 | trgInputs = esdEvent->GetHeader()->GetL1TriggerInputs(); | |
154 | else if (const AliAODEvent *aodEvent = dynamic_cast<const AliAODEvent*> (event)) | |
155 | trgInputs = aodEvent->GetHeader()->GetL1TriggerInputs(); | |
156 | else | |
157 | AliError("failed to retrieve L1 trigger inputs"); | |
158 | ||
159 | if (trgInputs & (1 << 8)) | |
160 | MarkInput(kHCO); | |
161 | if (trgInputs & (1 << 9)) | |
162 | MarkInput(kHJT); | |
163 | if (trgInputs & (1 << 10)) | |
164 | MarkInput(kHSE); | |
165 | if (trgInputs & (1 << 12)) | |
166 | MarkInput(kHQU); | |
167 | if (trgInputs & (1 << 13)) | |
168 | MarkInput(kHEE); | |
169 | ||
170 | // evaluate TRD GTU tracks | |
99d87d49 | 171 | Int_t nTracks[90] = { 0 }; // stack-wise counted number of tracks above pt threshold |
172 | ||
d384e2d6 | 173 | Int_t nTrdTracks = event->GetNumberOfTrdTracks(); |
99d87d49 | 174 | |
99d87d49 | 175 | for (Int_t iTrack = 0; iTrack < nTrdTracks; ++iTrack) { |
d384e2d6 | 176 | AliVTrdTrack *trdTrack = event->GetTrdTrack(iTrack); |
16edfc85 AG |
177 | if (!trdTrack) { |
178 | AliError(Form("Failed to get track %i", iTrack)); | |
99d87d49 | 179 | continue; |
16edfc85 AG |
180 | } |
181 | ||
182 | Int_t globalStack = 5*trdTrack->GetSector() + trdTrack->GetStack(); | |
183 | ||
184 | MarkCondition(kHCO, globalStack); | |
185 | ||
186 | for (Int_t iLayer = 0; iLayer < 6; ++iLayer) { | |
187 | if (trdTrack->GetLayerMask() & (1 << iLayer)) { | |
188 | AliVTrdTracklet *trkl = trdTrack->GetTracklet(iLayer); | |
189 | if (!trkl) { | |
190 | AliError(Form("no tracklet in layer %i where one should be for track %i", | |
191 | iLayer, iTrack)); | |
192 | } | |
193 | } | |
194 | } | |
99d87d49 | 195 | |
196 | // ignore the track if it was not in time | |
197 | // (if required) | |
198 | if (fRequireInTime && !trdTrack->GetTrackInTime()) | |
199 | continue; | |
200 | ||
201 | AliVTrack *match = trdTrack->GetTrackMatch(); | |
202 | AliDebug(2, Form("GTU track %2i with pt = %5.2f has match: %p (pt = %5.2f)", | |
203 | iTrack, trdTrack->Pt(), match, match ? match->Pt() : 0)); | |
204 | ||
205 | // ignore the track if it does not have a matched global track | |
206 | // (if required) | |
207 | if (fRequireMatch && !match) | |
208 | continue; | |
209 | ||
99d87d49 | 210 | // stack-wise counting of tracks above pt threshold for jet trigger |
16edfc85 | 211 | if (TMath::Abs(trdTrack->Pt()) >= fTRDptHJT) { |
99d87d49 | 212 | ++nTracks[globalStack]; |
213 | } | |
214 | ||
215 | // ignore the track for the electron triggers | |
216 | // if it does not have a matched global track | |
217 | // (if required) | |
218 | if (fRequireMatchElectron && !match) | |
219 | continue; | |
220 | ||
16edfc85 AG |
221 | // ignore the track for the electron triggers |
222 | // if it does not fulfill the tracklet requirement | |
223 | if (trdTrack->GetNTracklets() < fTRDnTrackletsEl) | |
224 | continue; | |
225 | if ((trdTrack->GetLayerMask() & fTRDlayerMaskEl) != fTRDlayerMaskEl) | |
226 | continue; | |
227 | ||
228 | if ((TMath::Abs(trdTrack->Pt()) >= fTRDptHQU) && (trdTrack->GetPID() >= fTRDpidHQU)) | |
229 | MarkCondition(kHQU, globalStack); | |
99d87d49 | 230 | |
16edfc85 AG |
231 | if ((TMath::Abs(trdTrack->Pt()) >= fTRDptHSE) && (trdTrack->GetPID() >= fTRDpidHSE)) |
232 | MarkCondition(kHSE, globalStack); | |
99d87d49 | 233 | |
234 | if ((trdTrack->GetSector() >= fTRDminSectorHEE) && (trdTrack->GetSector() <= fTRDmaxSectorHEE) && | |
16edfc85 AG |
235 | (TMath::Abs(trdTrack->Pt()) >= fTRDptHEE) && (trdTrack->GetPID() >= fTRDpidHEE)) |
236 | MarkCondition(kHEE, globalStack); | |
99d87d49 | 237 | } |
238 | ||
239 | // check if HJT condition is fulfilled in any stack | |
240 | for (Int_t iStack = 0; iStack < 90; ++iStack) { | |
241 | if (nTracks[iStack] >= fTRDnHJT) { | |
16edfc85 | 242 | MarkCondition(kHJT, iStack); |
99d87d49 | 243 | break; |
244 | } | |
245 | } | |
246 | ||
247 | return kTRUE; | |
248 | } |