]>
Commit | Line | Data |
---|---|---|
1c5acb87 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | **************************************************************************/ | |
1c5acb87 | 15 | |
16 | //_________________________________________________________________________ | |
85c4406e | 17 | // Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and |
1c5acb87 | 18 | // Central Barrel Tracking detectors (CTS). |
ff45398a | 19 | // Not all MC particles/tracks/clusters are kept, some kinematical/fiducial restrictions are done. |
591cc579 | 20 | // Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TObjArrays (PHOS, EMCAL, CTS) |
743aa53a | 21 | // : AliCaloTrackMCReader : Fills Kinematics data in 3 TObjArrays (PHOS, EMCAL, CTS) |
85c4406e | 22 | // : AliCaloTrackAODReader: Fills AOD data in 3 TObjArrays (PHOS, EMCAL, CTS) |
23 | //-- Author: Gustavo Conesa (LNF-INFN) | |
1c5acb87 | 24 | ////////////////////////////////////////////////////////////////////////////// |
25 | ||
26 | ||
27 | // --- ROOT system --- | |
49b53920 | 28 | #include <TFile.h> |
de0b770d | 29 | #include <TGeoManager.h> |
d9bea110 | 30 | #include <TStreamerInfo.h> |
1c5acb87 | 31 | |
c5693f62 | 32 | // ---- ANALYSIS system ---- |
477d6cee | 33 | #include "AliMCEvent.h" |
591cc579 | 34 | #include "AliAODMCHeader.h" |
35 | #include "AliGenPythiaEventHeader.h" | |
43cd6c94 | 36 | #include "AliGenCocktailEventHeader.h" |
37 | #include "AliGenHijingEventHeader.h" | |
48c37e02 | 38 | #include "AliESDEvent.h" |
8dacfd76 | 39 | #include "AliAODEvent.h" |
c8fe2783 | 40 | #include "AliVTrack.h" |
41 | #include "AliVParticle.h" | |
42 | #include "AliMixedEvent.h" | |
0ae57829 | 43 | #include "AliESDtrack.h" |
3a58eee6 | 44 | #include "AliESDtrackCuts.h" |
d2ad4a1a | 45 | //#include "AliTriggerAnalysis.h" |
37285e29 | 46 | #include "AliESDVZERO.h" |
c5693f62 | 47 | #include "AliVCaloCells.h" |
029dea5a | 48 | #include "AliAnalysisManager.h" |
49 | #include "AliInputEventHandler.h" | |
914b9fe7 | 50 | #include "AliAODMCParticle.h" |
43cd6c94 | 51 | #include "AliStack.h" |
1c5acb87 | 52 | |
c5693f62 | 53 | // ---- Detectors ---- |
54 | #include "AliPHOSGeoUtils.h" | |
55 | #include "AliEMCALGeometry.h" | |
f3138ecf | 56 | #include "AliEMCALRecoUtils.h" |
c5693f62 | 57 | |
0de1814a | 58 | // ---- CaloTrackCorr --- |
c5693f62 | 59 | #include "AliCalorimeterUtils.h" |
cfaba834 | 60 | #include "AliCaloTrackReader.h" |
43cd6c94 | 61 | // ---- Jets ---- |
62 | #include "AliAODJet.h" | |
d6d84709 | 63 | #include "AliAODJetEventBackground.h" |
cfaba834 | 64 | |
1c5acb87 | 65 | ClassImp(AliCaloTrackReader) |
85c4406e | 66 | |
67 | ||
836b6989 | 68 | //________________________________________ |
85c4406e | 69 | AliCaloTrackReader::AliCaloTrackReader() : |
836b6989 | 70 | TObject(), fEventNumber(-1), //fCurrentFileName(""), |
85c4406e | 71 | fDataType(0), fDebug(0), |
72 | fFiducialCut(0x0), fCheckFidCut(kFALSE), | |
de0b770d | 73 | fComparePtHardAndJetPt(0), fPtHardAndJetPtFactor(0), |
dbb3de7b | 74 | fComparePtHardAndClusterPt(0),fPtHardAndClusterPtFactor(0), |
85c4406e | 75 | fCTSPtMin(0), fEMCALPtMin(0), fPHOSPtMin(0), |
4b7f6e01 | 76 | fCTSPtMax(0), fEMCALPtMax(0), fPHOSPtMax(0), |
9b1587f6 | 77 | fUseEMCALTimeCut(1), fUseParamTimeCut(0), |
78 | fUseTrackTimeCut(0), fAccessTrackTOF(0), | |
d2655d46 | 79 | fEMCALTimeCutMin(-10000), fEMCALTimeCutMax(10000), |
ff440946 | 80 | fEMCALParamTimeCutMin(), fEMCALParamTimeCutMax(), |
975b29fa | 81 | fTrackTimeCutMin(-10000), fTrackTimeCutMax(10000), |
689d9f15 | 82 | fUseTrackDCACut(0), |
f3138ecf | 83 | fAODBranchList(0x0), |
84 | fCTSTracks(0x0), fEMCALClusters(0x0), fPHOSClusters(0x0), | |
836b6989 | 85 | fEMCALCells(0x0), fPHOSCells(0x0), |
86 | fInputEvent(0x0), fOutputEvent(0x0),fMC(0x0), | |
87 | fFillCTS(0), fFillEMCAL(0), fFillPHOS(0), | |
85c4406e | 88 | fFillEMCALCells(0), fFillPHOSCells(0), |
ac207ee4 | 89 | fRecalculateClusters(kFALSE),fCorrectELinearity(kTRUE), |
90 | fSelectEmbeddedClusters(kFALSE), | |
6f20e2a6 | 91 | fTrackStatus(0), fTrackFilterMask(0), fTrackFilterMaskComplementary(0), |
d7601185 | 92 | fESDtrackCuts(0), fESDtrackComplementaryCuts(0), fConstrainTrack(kFALSE), |
7eb4c4a8 | 93 | fSelectHybridTracks(0), fSelectPrimaryTracks(0), |
94 | fSelectSPDHitTracks(0), fSelectFractionTPCSharedClusters(0), fCutTPCSharedClustersFraction(0), | |
2644ead9 | 95 | fTrackMult(0), fTrackMultEtaCut(0.9), |
85c4406e | 96 | fReadStack(kFALSE), fReadAODMCParticles(kFALSE), |
97 | fDeltaAODFileName(""), fFiredTriggerClassName(""), | |
d9bea110 | 98 | |
85c4406e | 99 | fEventTriggerMask(0), fMixEventTriggerMask(0), fEventTriggerAtSE(0), |
d9bea110 | 100 | fEventTrigMinBias(0), fEventTrigCentral(0), |
101 | fEventTrigSemiCentral(0), fEventTrigEMCALL0(0), | |
85c4406e | 102 | fEventTrigEMCALL1Gamma1(0), fEventTrigEMCALL1Gamma2(0), |
d9bea110 | 103 | fEventTrigEMCALL1Jet1(0), fEventTrigEMCALL1Jet2(0), |
104 | fBitEGA(0), fBitEJE(0), | |
105 | ||
029dea5a | 106 | fAnaLED(kFALSE), |
85c4406e | 107 | fTaskName(""), fCaloUtils(0x0), |
108 | fMixedEvent(NULL), fNMixedEvent(0), fVertex(NULL), | |
d783becb | 109 | fListMixedTracksEvents(), fListMixedCaloEvents(), |
110 | fLastMixedTracksEvent(-1), fLastMixedCaloEvent(-1), | |
d70095f2 | 111 | fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE), |
85c4406e | 112 | fEMCALClustersListName(""), fZvtxCut(0.), |
a529ae05 | 113 | fAcceptFastCluster(kFALSE), fRemoveLEDEvents(kTRUE), |
afb3af8a | 114 | //Trigger rejection |
3d8933d7 | 115 | fRemoveBadTriggerEvents(0), fTriggerPatchClusterMatch(1), |
5737e185 | 116 | fTriggerPatchTimeWindow(), fTriggerL0EventThreshold(0), |
117 | fTriggerL1EventThreshold(0), fTriggerL1EventThresholdFix(0), | |
afb3af8a | 118 | fTriggerClusterBC(0), fTriggerClusterIndex(0), fTriggerClusterId(0), |
1035a8d9 | 119 | fIsExoticEvent(0), fIsBadCellEvent(0), fIsBadMaxCellEvent(0), |
6288bcb7 | 120 | fIsTriggerMatch(0), fIsTriggerMatchOpenCut(), |
121 | fTriggerClusterTimeRecal(kTRUE), fRemoveUnMatchedTriggers(kTRUE), | |
fc85781f | 122 | fDoPileUpEventRejection(kFALSE), fDoV0ANDEventSelection(kFALSE), |
2644ead9 | 123 | fDoVertexBCEventSelection(kFALSE), |
124 | fDoRejectNoTrackEvents(kFALSE), | |
cc944149 | 125 | fUseEventsWithPrimaryVertex(kFALSE), |
d2ad4a1a | 126 | //fTriggerAnalysis (0x0), |
127 | fTimeStampEventSelect(0), | |
034e885b | 128 | fTimeStampEventFracMin(0), fTimeStampEventFracMax(0), |
129 | fTimeStampRunMin(0), fTimeStampRunMax(0), | |
3c1a2e95 | 130 | fNPileUpClusters(-1), fNNonPileUpClusters(-1), fNPileUpClustersCut(3), |
cc944149 | 131 | fVertexBC(-200), fRecalculateVertexBC(0), |
9bf1c947 | 132 | fCentralityClass(""), fCentralityOpt(0), |
9e536695 | 133 | fEventPlaneMethod(""), |
667a3592 | 134 | fAcceptOnlyHIJINGLabels(0), fNMCProducedMin(0), fNMCProducedMax(0), |
43cd6c94 | 135 | fFillInputNonStandardJetBranch(kFALSE), |
b09080f1 | 136 | fNonStandardJets(new TClonesArray("AliAODJet",100)),fInputNonStandardJetBranchName("jets"), |
d6d84709 | 137 | fFillInputBackgroundJetBranch(kFALSE), |
138 | fBackgroundJets(0x0),fInputBackgroundJetBranchName("jets"), | |
b83f0015 | 139 | fAcceptEventsWithBit(0), fRejectEventsWithBit(0), fRejectEMCalTriggerEventsWith2Tresholds(0) |
af7b3903 | 140 | { |
1c5acb87 | 141 | //Ctor |
85c4406e | 142 | |
1c5acb87 | 143 | //Initialize parameters |
144 | InitParameters(); | |
145 | } | |
1c5acb87 | 146 | |
836b6989 | 147 | //_______________________________________ |
85c4406e | 148 | AliCaloTrackReader::~AliCaloTrackReader() |
836b6989 | 149 | { |
1c5acb87 | 150 | //Dtor |
151 | ||
743aa53a | 152 | delete fFiducialCut ; |
29b2ceec | 153 | |
d2655d46 | 154 | if(fAODBranchList) |
155 | { | |
f37fa8d2 | 156 | fAODBranchList->Delete(); |
157 | delete fAODBranchList ; | |
85c4406e | 158 | } |
f37fa8d2 | 159 | |
d2655d46 | 160 | if(fCTSTracks) |
161 | { | |
85c4406e | 162 | if(fDataType!=kMC)fCTSTracks->Clear() ; |
163 | else fCTSTracks->Delete() ; | |
be518ab0 | 164 | delete fCTSTracks ; |
1c5acb87 | 165 | } |
166 | ||
d2655d46 | 167 | if(fEMCALClusters) |
168 | { | |
85c4406e | 169 | if(fDataType!=kMC)fEMCALClusters->Clear("C") ; |
170 | else fEMCALClusters->Delete() ; | |
be518ab0 | 171 | delete fEMCALClusters ; |
1c5acb87 | 172 | } |
173 | ||
029dea5a | 174 | if(fPHOSClusters) |
175 | { | |
85c4406e | 176 | if(fDataType!=kMC)fPHOSClusters->Clear("C") ; |
177 | else fPHOSClusters->Delete() ; | |
be518ab0 | 178 | delete fPHOSClusters ; |
1c5acb87 | 179 | } |
180 | ||
d2655d46 | 181 | if(fVertex) |
182 | { | |
85c4406e | 183 | for (Int_t i = 0; i < fNMixedEvent; i++) |
d2655d46 | 184 | { |
7e25653f | 185 | delete [] fVertex[i] ; |
836b6989 | 186 | |
7e25653f | 187 | } |
188 | delete [] fVertex ; | |
85c4406e | 189 | } |
836b6989 | 190 | |
743aa53a | 191 | delete fESDtrackCuts; |
d7601185 | 192 | delete fESDtrackComplementaryCuts; |
d2ad4a1a | 193 | //delete fTriggerAnalysis; |
3a58eee6 | 194 | |
43cd6c94 | 195 | if(fNonStandardJets) |
196 | { | |
197 | if(fDataType!=kMC) fNonStandardJets->Clear("C") ; | |
198 | else fNonStandardJets->Delete() ; | |
199 | delete fNonStandardJets ; | |
200 | } | |
d6d84709 | 201 | delete fBackgroundJets ; |
202 | ||
b09080f1 | 203 | fRejectEventsWithBit.Reset(); |
204 | fAcceptEventsWithBit.Reset(); | |
205 | ||
836b6989 | 206 | // Pointers not owned, done by the analysis frame |
207 | // if(fInputEvent) delete fInputEvent ; | |
208 | // if(fOutputEvent) delete fOutputEvent ; | |
85c4406e | 209 | // if(fMC) delete fMC ; |
836b6989 | 210 | // Pointer not owned, deleted by maker |
211 | // if (fCaloUtils) delete fCaloUtils ; | |
212 | ||
c1ac3823 | 213 | } |
477d6cee | 214 | |
cc944149 | 215 | //________________________________________________________________________ |
8a2dbbff | 216 | Bool_t AliCaloTrackReader::AcceptDCA(Float_t pt, Float_t dca) |
cc944149 | 217 | { |
218 | // Accept track if DCA is smaller than function | |
219 | ||
220 | Float_t cut = fTrackDCACut[0]+fTrackDCACut[1]/TMath::Power(pt,fTrackDCACut[2]); | |
221 | ||
222 | if(TMath::Abs(dca) < cut) | |
223 | return kTRUE; | |
224 | else | |
225 | return kFALSE; | |
226 | ||
227 | } | |
228 | ||
b09080f1 | 229 | //_____________________________________________________ |
230 | Bool_t AliCaloTrackReader::AcceptEventWithTriggerBit() | |
231 | { | |
232 | // Accept events that pass the physics selection | |
233 | // depending on an array of trigger bits set during the configuration | |
234 | ||
235 | Int_t nAccept = fAcceptEventsWithBit.GetSize(); | |
236 | ||
237 | //printf("N accept %d\n", nAccept); | |
238 | ||
239 | if( nAccept <= 0 ) | |
240 | return kTRUE ; // accept the event | |
241 | ||
242 | UInt_t trigFired = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected(); | |
243 | ||
244 | for(Int_t ibit = 0; ibit < nAccept; ibit++) | |
245 | { | |
246 | Bool_t accept = (trigFired & fAcceptEventsWithBit.At(ibit)); | |
247 | ||
248 | //printf("accept %d, ibit %d, bit %d \n",accept, ibit,fAcceptEventsWithBit.At(ibit)); | |
249 | if(accept) return kTRUE ; // accept the event | |
250 | } | |
251 | ||
252 | return kFALSE ; // reject the event | |
253 | ||
254 | } | |
255 | ||
256 | //_____________________________________________________ | |
257 | Bool_t AliCaloTrackReader::RejectEventWithTriggerBit() | |
258 | { | |
259 | // Reject events that pass the physics selection | |
260 | // depending on an array of trigger bits set during the configuration | |
261 | ||
262 | Int_t nReject = fRejectEventsWithBit.GetSize(); | |
263 | ||
264 | //printf("N reject %d\n", nReject); | |
265 | ||
266 | if( nReject <= 0 ) | |
267 | return kTRUE ; // accept the event | |
268 | ||
269 | UInt_t trigFired = ((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected(); | |
270 | ||
271 | for(Int_t ibit = 0; ibit < nReject; ibit++) | |
272 | { | |
273 | Bool_t reject = (trigFired & fRejectEventsWithBit.At(ibit)); | |
274 | ||
275 | //printf("reject %d, ibit %d, bit %d \n",reject, ibit,fRejectEventsWithBit.At(ibit)); | |
276 | if(reject) return kFALSE ; // reject the event | |
277 | } | |
278 | ||
279 | return kTRUE ; // accept the event | |
280 | ||
281 | } | |
282 | ||
b62d68b3 | 283 | //_____________________________________________ |
284 | Bool_t AliCaloTrackReader::CheckEventTriggers() | |
285 | { | |
286 | // Do different selection of the event | |
287 | // depending on trigger name, event type, goodness of the EMCal trigger ... | |
288 | ||
289 | //----------------------------------------------------------- | |
290 | // Reject events depending on the trigger name and event type | |
291 | //----------------------------------------------------------- | |
292 | ||
293 | Int_t eventType = 0; | |
294 | if(fInputEvent->GetHeader()) | |
295 | eventType = ((AliVHeader*)fInputEvent->GetHeader())->GetEventType(); | |
296 | ||
297 | if( fFiredTriggerClassName !="" && !fAnaLED) | |
298 | { | |
299 | //printf("Event type %d\n",eventType); | |
300 | if(eventType!=7) | |
301 | return kFALSE; //Only physics event, do not use for simulated events!!! | |
302 | ||
303 | if(fDebug > 0) | |
304 | printf("AliCaloTrackReader::CheckEventTriggers() - FiredTriggerClass <%s>, selected class <%s>, compare name %d\n", | |
305 | GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data(), GetFiredTriggerClasses().Contains(fFiredTriggerClassName)); | |
306 | ||
307 | if( !GetFiredTriggerClasses().Contains(fFiredTriggerClassName) ) return kFALSE; | |
308 | else if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Accepted triggered event\n"); | |
309 | } | |
310 | else if(fAnaLED) | |
311 | { | |
312 | // kStartOfRun = 1, // START_OF_RUN | |
313 | // kEndOfRun = 2, // END_OF_RUN | |
314 | // kStartOfRunFiles = 3, // START_OF_RUN_FILES | |
315 | // kEndOfRunFiles = 4, // END_OF_RUN_FILES | |
316 | // kStartOfBurst = 5, // START_OF_BURST | |
317 | // kEndOfBurst = 6, // END_OF_BURST | |
318 | // kPhysicsEvent = 7, // PHYSICS_EVENT | |
319 | // kCalibrationEvent = 8, // CALIBRATION_EVENT | |
320 | // kFormatError = 9, // EVENT_FORMAT_ERROR | |
321 | // kStartOfData = 10, // START_OF_DATA | |
322 | // kEndOfData = 11, // END_OF_DATA | |
323 | // kSystemSoftwareTriggerEvent = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT | |
324 | // kDetectorSoftwareTriggerEvent = 13 // DETECTOR_SOFTWARE_TRIGGER_EVENT | |
325 | ||
326 | if(eventType!=7 && fDebug > 1 )printf("AliCaloTrackReader::CheckEventTriggers() - DO LED, Event Type <%d>, 8 Calibration \n", eventType); | |
327 | if(eventType!=8)return kFALSE; | |
328 | } | |
329 | ||
330 | if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Pass Trigger name rejection \n"); | |
331 | ||
9b1587f6 | 332 | //----------------------------------------------------------------- |
333 | // In case of mixing analysis, select here the trigger of the event | |
334 | //----------------------------------------------------------------- | |
a3ee4a7e | 335 | UInt_t isTrigger = kFALSE; |
336 | UInt_t isMB = kFALSE; | |
9b1587f6 | 337 | if(!fEventTriggerAtSE) |
338 | { | |
339 | // In case of mixing analysis, accept MB events, not only Trigger | |
340 | // Track and cluster arrays filled for MB in order to create the pool in the corresponding analysis | |
341 | // via de method in the base class FillMixedEventPool() | |
342 | ||
343 | AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager(); | |
344 | AliInputEventHandler *inputHandler = dynamic_cast<AliInputEventHandler*>(manager->GetInputEventHandler()); | |
345 | ||
346 | if(!inputHandler) return kFALSE ; // to content coverity | |
347 | ||
a3ee4a7e | 348 | isTrigger = inputHandler->IsEventSelected() & fEventTriggerMask; |
349 | isMB = inputHandler->IsEventSelected() & fMixEventTriggerMask; | |
9b1587f6 | 350 | |
351 | if(!isTrigger && !isMB) return kFALSE; | |
352 | ||
353 | //printf("Selected triggered event : %s\n",GetFiredTriggerClasses().Data()); | |
354 | if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Pass uninteresting triggered events rejection in case of mixing analysis \n"); | |
355 | } | |
356 | ||
b62d68b3 | 357 | //------------------------------------------------------------------------------------- |
358 | // Reject or accept events depending on the trigger bit | |
359 | //------------------------------------------------------------------------------------- | |
360 | ||
361 | Bool_t okA = AcceptEventWithTriggerBit(); | |
362 | Bool_t okR = RejectEventWithTriggerBit(); | |
363 | ||
364 | //printf("AliCaloTrackReader::FillInputEvent() - Accept event? %d, Reject event %d? \n",okA,okR); | |
365 | ||
366 | if(!okA || !okR) return kFALSE; | |
367 | ||
368 | if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Pass event bit rejection \n"); | |
369 | ||
370 | //---------------------------------------------------------------------- | |
371 | // Do not count events that were likely triggered by an exotic cluster | |
372 | // or out BC cluster | |
373 | //---------------------------------------------------------------------- | |
374 | ||
375 | // Set a bit with the event kind, MB, L0, L1 ... | |
376 | SetEventTriggerBit(); | |
377 | ||
a3ee4a7e | 378 | // In case of Mixing, avoid checking the triggers in the min bias events |
379 | if(!fEventTriggerAtSE && (isMB && !isTrigger)) return kTRUE; | |
380 | ||
3d8933d7 | 381 | if( (IsEventEMCALL1() || IsEventEMCALL0()) && fTriggerPatchClusterMatch) |
b62d68b3 | 382 | { |
b83f0015 | 383 | if(fRejectEMCalTriggerEventsWith2Tresholds) |
384 | { | |
385 | // Reject triggered events when there is coincidence on both EMCal trigger thresholds, | |
386 | // but the requested trigger is the low trigger threshold | |
387 | if(IsEventEMCALL1Jet1 () && IsEventEMCALL1Jet2 () && fFiredTriggerClassName.Contains("EJ2")) return kFALSE; | |
388 | if(IsEventEMCALL1Gamma1() && IsEventEMCALL1Gamma2() && fFiredTriggerClassName.Contains("EG2")) return kFALSE; | |
389 | } | |
b62d68b3 | 390 | |
391 | //Get Patches that triggered | |
392 | TArrayI patches = GetTriggerPatches(fTriggerPatchTimeWindow[0],fTriggerPatchTimeWindow[1]); | |
393 | ||
394 | MatchTriggerCluster(patches); | |
395 | ||
396 | patches.Reset(); | |
397 | ||
398 | // If requested, remove badly triggeed events, but only when the EMCal trigger bit is set | |
399 | if(fRemoveBadTriggerEvents) | |
400 | { | |
5737e185 | 401 | if(fDebug > 0) |
b62d68b3 | 402 | printf("AliCaloTrackReader::CheckEventTriggers() - ACCEPT triggered event? \n exotic? %d - bad cell %d - bad Max cell %d - BC %d - Matched %d\n", |
403 | fIsExoticEvent,fIsBadCellEvent, fIsBadMaxCellEvent, fTriggerClusterBC,fIsTriggerMatch); | |
404 | if (fIsExoticEvent) return kFALSE; | |
405 | else if(fIsBadCellEvent) return kFALSE; | |
406 | else if(fRemoveUnMatchedTriggers && !fIsTriggerMatch) return kFALSE ; | |
407 | else if(fTriggerClusterBC != 0) return kFALSE; | |
408 | if(fDebug > 0) printf("\t *** YES for %s\n",GetFiredTriggerClasses().Data()); | |
409 | } | |
410 | ||
5737e185 | 411 | if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Pass EMCal triggered event rejection \n"); |
b62d68b3 | 412 | } |
413 | ||
414 | //------------------------------------------------------------------------------------- | |
415 | //Select events only fired by a certain trigger configuration if it is provided | |
416 | //------------------------------------------------------------------------------------- | |
417 | if (GetFiredTriggerClasses().Contains("FAST") && !GetFiredTriggerClasses().Contains("ALL") && !fAcceptFastCluster) | |
418 | { | |
419 | if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Do not count events from fast cluster, trigger name %s\n",fFiredTriggerClassName.Data()); | |
420 | return kFALSE; | |
421 | } | |
422 | ||
423 | //------------------------------------------------------------------------------------- | |
424 | // Reject event if large clusters with large energy | |
425 | // Use only for LHC11a data for the moment, and if input is clusterizer V1 or V1+unfolding | |
426 | // If clusterzer NxN or V2 it does not help | |
427 | //------------------------------------------------------------------------------------- | |
428 | Int_t run = fInputEvent->GetRunNumber(); | |
429 | if( fRemoveLEDEvents && run > 146857 && run < 146861 ) | |
430 | { | |
431 | Bool_t reject = RejectLEDEvents(); | |
432 | ||
433 | if(reject) return kFALSE; | |
434 | ||
435 | if(fDebug > 0) printf("AliCaloTrackReader::CheckEventTriggers() - Pass LED event rejection \n"); | |
436 | ||
437 | }// Remove LED events | |
438 | ||
439 | return kTRUE; | |
440 | } | |
b09080f1 | 441 | |
836b6989 | 442 | //________________________________________________ |
443 | Bool_t AliCaloTrackReader::ComparePtHardAndJetPt() | |
444 | { | |
dbb3de7b | 445 | // Check the event, if the requested ptHard is much smaller than the jet pT, then there is a problem. |
90995603 | 446 | // Only for PYTHIA. |
a20fbb55 | 447 | |
448 | //printf("AliCaloTrackReader::ComparePtHardAndJetPt() - GenHeaderName : %s\n",GetGenEventHeader()->ClassName()); | |
90995603 | 449 | |
d2655d46 | 450 | if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader")) |
451 | { | |
90995603 | 452 | TParticle * jet = 0; |
453 | AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader(); | |
454 | Int_t nTriggerJets = pygeh->NTriggerJets(); | |
455 | Float_t ptHard = pygeh->GetPtHard(); | |
456 | ||
85c4406e | 457 | if(fDebug > 1) |
a20fbb55 | 458 | printf("AliCaloTrackReader::ComparePtHardAndJetPt() - Njets: %d, pT Hard %f\n",nTriggerJets, ptHard); |
459 | ||
898c9d44 | 460 | Float_t tmpjet[]={0,0,0,0}; |
d2655d46 | 461 | for(Int_t ijet = 0; ijet< nTriggerJets; ijet++) |
462 | { | |
90995603 | 463 | pygeh->TriggerJet(ijet, tmpjet); |
464 | jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0); | |
a20fbb55 | 465 | |
85c4406e | 466 | if(fDebug > 1) |
a20fbb55 | 467 | printf("AliCaloTrackReader::ComparePtHardAndJetPt() - jet %d; pycell jet pT %f\n",ijet, jet->Pt()); |
468 | ||
90995603 | 469 | //Compare jet pT and pt Hard |
d2655d46 | 470 | if(jet->Pt() > fPtHardAndJetPtFactor * ptHard) |
471 | { | |
a20fbb55 | 472 | printf("AliCaloTrackReader::ComparePtHardAndJetPt() - Reject jet event with : pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n", |
85c4406e | 473 | ptHard, jet->Pt(), fPtHardAndJetPtFactor); |
cfaba834 | 474 | return kFALSE; |
90995603 | 475 | } |
476 | } | |
a20fbb55 | 477 | |
85c4406e | 478 | if(jet) delete jet; |
90995603 | 479 | } |
480 | ||
481 | return kTRUE ; | |
482 | ||
591cc579 | 483 | } |
484 | ||
dbb3de7b | 485 | //____________________________________________________________________ |
486 | Bool_t AliCaloTrackReader::ComparePtHardAndClusterPt() | |
487 | { | |
488 | // Check the event, if the requested ptHard is smaller than the calorimeter cluster E, then there is a problem. | |
489 | // Only for PYTHIA. | |
490 | ||
491 | if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader")) | |
492 | { | |
493 | AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader(); | |
494 | Float_t ptHard = pygeh->GetPtHard(); | |
495 | ||
496 | Int_t nclusters = fInputEvent->GetNumberOfCaloClusters(); | |
85c4406e | 497 | for (Int_t iclus = 0; iclus < nclusters; iclus++) |
dbb3de7b | 498 | { |
85c4406e | 499 | AliVCluster * clus = fInputEvent->GetCaloCluster(iclus) ; |
dbb3de7b | 500 | Float_t ecluster = clus->E(); |
501 | ||
85c4406e | 502 | if(ecluster > fPtHardAndClusterPtFactor*ptHard) |
dbb3de7b | 503 | { |
504 | printf("AliCaloTrackReader::ComparePtHardAndClusterPt() - Reject : ecluster %2.2f, calo %d, factor %2.2f, ptHard %f\n",ecluster,clus->GetType(),fPtHardAndClusterPtFactor,ptHard); | |
85c4406e | 505 | |
dbb3de7b | 506 | return kFALSE; |
507 | } | |
508 | } | |
509 | ||
510 | } | |
511 | ||
512 | return kTRUE ; | |
513 | ||
514 | } | |
515 | ||
836b6989 | 516 | //____________________________________________ |
85c4406e | 517 | AliStack* AliCaloTrackReader::GetStack() const |
836b6989 | 518 | { |
1c5acb87 | 519 | //Return pointer to stack |
520 | if(fMC) | |
521 | return fMC->Stack(); | |
d2655d46 | 522 | else |
523 | { | |
85c4406e | 524 | if(fDebug > 1) printf("AliCaloTrackReader::GetStack() - Stack is not available\n"); |
1c5acb87 | 525 | return 0x0 ; |
526 | } | |
527 | } | |
528 | ||
836b6989 | 529 | //______________________________________________ |
85c4406e | 530 | AliHeader* AliCaloTrackReader::GetHeader() const |
836b6989 | 531 | { |
1c5acb87 | 532 | //Return pointer to header |
533 | if(fMC) | |
029dea5a | 534 | { |
1c5acb87 | 535 | return fMC->Header(); |
029dea5a | 536 | } |
537 | else | |
538 | { | |
85c4406e | 539 | printf("AliCaloTrackReader::Header is not available\n"); |
1c5acb87 | 540 | return 0x0 ; |
541 | } | |
542 | } | |
836b6989 | 543 | |
667a3592 | 544 | //____________________________________________________ |
545 | void AliCaloTrackReader::SetGeneratorMinMaxParticles() | |
546 | { | |
547 | // In case of access only to hijing particles in cocktail | |
548 | // get the min and max labels | |
549 | // TODO: Check when generator is not the first one ... | |
550 | ||
551 | fNMCProducedMin = 0; | |
552 | fNMCProducedMax = 0; | |
553 | ||
554 | if (ReadStack() && fMC) | |
555 | { | |
556 | AliGenEventHeader * eventHeader = fMC->GenEventHeader(); | |
557 | ||
558 | if(!fAcceptOnlyHIJINGLabels) return ; | |
559 | ||
560 | // TODO Check if it works from here ... | |
561 | ||
562 | AliGenCocktailEventHeader *cocktail = dynamic_cast<AliGenCocktailEventHeader *>(eventHeader); | |
563 | ||
564 | if(!cocktail) return ; | |
565 | ||
566 | TList *genHeaders = cocktail->GetHeaders(); | |
567 | ||
568 | Int_t nGenerators = genHeaders->GetEntries(); | |
569 | //printf("N generators %d \n", nGenerators); | |
570 | ||
571 | for(Int_t igen = 0; igen < nGenerators; igen++) | |
572 | { | |
573 | AliGenEventHeader * eventHeader2 = (AliGenEventHeader*)genHeaders->At(igen) ; | |
574 | TString name = eventHeader2->GetName(); | |
575 | ||
576 | //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader2->ClassName(), name.Data(), eventHeader2->GetTitle()); | |
577 | ||
578 | fNMCProducedMin = fNMCProducedMax; | |
579 | fNMCProducedMax+= eventHeader2->NProduced(); | |
580 | ||
58418c82 | 581 | if(name.Contains("Hijing",TString::kIgnoreCase)) return ; |
667a3592 | 582 | } |
583 | ||
584 | } | |
585 | else if(ReadAODMCParticles() && GetAODMCHeader()) | |
586 | { | |
587 | Int_t nGenerators = GetAODMCHeader()->GetNCocktailHeaders(); | |
588 | //printf("AliCaloTrackReader::GetGenEventHeader() - N headers %d\n",nGenerators); | |
589 | ||
590 | if( nGenerators <= 0) return ; | |
591 | ||
592 | if(!fAcceptOnlyHIJINGLabels) return ; | |
593 | ||
594 | for(Int_t igen = 0; igen < nGenerators; igen++) | |
595 | { | |
596 | AliGenEventHeader * eventHeader = GetAODMCHeader()->GetCocktailHeader(igen) ; | |
597 | TString name = eventHeader->GetName(); | |
598 | ||
599 | //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader->ClassName(), name.Data(), eventHeader->GetTitle()); | |
600 | ||
601 | fNMCProducedMin = fNMCProducedMax; | |
602 | fNMCProducedMax+= eventHeader->NProduced(); | |
603 | ||
58418c82 | 604 | if(name.Contains("Hijing",TString::kIgnoreCase)) return ; |
667a3592 | 605 | } |
606 | ||
607 | } | |
608 | } | |
609 | ||
610 | ||
836b6989 | 611 | //______________________________________________________________ |
85c4406e | 612 | AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const |
836b6989 | 613 | { |
667a3592 | 614 | // Return pointer to Generated event header |
615 | // If requested and cocktail, search for the hijing generator | |
616 | ||
f1da7b44 | 617 | if (ReadStack() && fMC) |
029dea5a | 618 | { |
667a3592 | 619 | AliGenEventHeader * eventHeader = fMC->GenEventHeader(); |
620 | ||
621 | if(!fAcceptOnlyHIJINGLabels) return eventHeader ; | |
622 | ||
623 | // TODO Check if it works from here ... | |
624 | ||
625 | AliGenCocktailEventHeader *cocktail = dynamic_cast<AliGenCocktailEventHeader *>(eventHeader); | |
626 | ||
627 | if(!cocktail) return 0x0 ; | |
628 | ||
629 | TList *genHeaders = cocktail->GetHeaders(); | |
630 | ||
631 | Int_t nGenerators = genHeaders->GetEntries(); | |
632 | //printf("N generators %d \n", nGenerators); | |
633 | ||
634 | for(Int_t igen = 0; igen < nGenerators; igen++) | |
635 | { | |
636 | AliGenEventHeader * eventHeader2 = (AliGenEventHeader*)genHeaders->At(igen) ; | |
637 | TString name = eventHeader2->GetName(); | |
638 | ||
639 | //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader2->ClassName(), name.Data(), eventHeader2->GetTitle()); | |
640 | ||
58418c82 | 641 | if(name.Contains("Hijing",TString::kIgnoreCase)) return eventHeader2 ; |
667a3592 | 642 | } |
643 | ||
644 | return 0x0; | |
43cd6c94 | 645 | |
029dea5a | 646 | } |
f1da7b44 | 647 | else if(ReadAODMCParticles() && GetAODMCHeader()) |
648 | { | |
667a3592 | 649 | Int_t nGenerators = GetAODMCHeader()->GetNCocktailHeaders(); |
650 | //printf("AliCaloTrackReader::GetGenEventHeader() - N headers %d\n",nGenerators); | |
651 | ||
652 | if( nGenerators <= 0) return 0x0; | |
653 | ||
654 | if(!fAcceptOnlyHIJINGLabels) return GetAODMCHeader()->GetCocktailHeader(0); | |
655 | ||
656 | for(Int_t igen = 0; igen < nGenerators; igen++) | |
657 | { | |
658 | AliGenEventHeader * eventHeader = GetAODMCHeader()->GetCocktailHeader(igen) ; | |
659 | TString name = eventHeader->GetName(); | |
660 | ||
661 | //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader->ClassName(), name.Data(), eventHeader->GetTitle()); | |
662 | ||
58418c82 | 663 | if(name.Contains("Hijing",TString::kIgnoreCase)) return eventHeader ; |
667a3592 | 664 | } |
665 | ||
666 | return 0x0; | |
667 | ||
f1da7b44 | 668 | } |
85c4406e | 669 | else |
f1da7b44 | 670 | { |
ec58c056 | 671 | //printf("AliCaloTrackReader::GetGenEventHeader() - MC header not available! \n"); |
667a3592 | 672 | return 0x0; |
1c5acb87 | 673 | } |
674 | } | |
675 | ||
836b6989 | 676 | //____________________________________________________________________ |
85c4406e | 677 | TClonesArray* AliCaloTrackReader::GetAODMCParticles() const |
836b6989 | 678 | { |
1e68a3f4 | 679 | //Return list of particles in AOD. Do it for the corresponding input event. |
680 | ||
85c4406e | 681 | TClonesArray * rv = NULL ; |
029dea5a | 682 | if(fDataType == kAOD) |
683 | { | |
2644ead9 | 684 | //Normal input AOD |
685 | AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ; | |
686 | if(evt) | |
687 | rv = (TClonesArray*)evt->FindListObject("mcparticles"); | |
85c4406e | 688 | else |
689 | printf("AliCaloTrackReader::GetAODMCParticles() - Null AOD event \n"); | |
690 | } | |
691 | else | |
029dea5a | 692 | { |
85c4406e | 693 | printf("AliCaloTrackReader::GetAODMCParticles() - Input are not AODs\n"); |
c8fe2783 | 694 | } |
1e68a3f4 | 695 | |
85c4406e | 696 | return rv ; |
591cc579 | 697 | } |
698 | ||
a20fbb55 | 699 | //________________________________________________________ |
85c4406e | 700 | AliAODMCHeader* AliCaloTrackReader::GetAODMCHeader() const |
836b6989 | 701 | { |
90995603 | 702 | //Return MC header in AOD. Do it for the corresponding input event. |
d2655d46 | 703 | |
1e68a3f4 | 704 | AliAODMCHeader *mch = NULL; |
d2655d46 | 705 | |
706 | if(fDataType == kAOD) | |
707 | { | |
a20fbb55 | 708 | AliAODEvent * aod = dynamic_cast<AliAODEvent*> (fInputEvent); |
709 | if(aod) mch = dynamic_cast<AliAODMCHeader*>(aod->FindListObject("mcHeader")); | |
90995603 | 710 | } |
85c4406e | 711 | else |
d2655d46 | 712 | { |
90995603 | 713 | printf("AliCaloTrackReader::GetAODMCHeader() - Input are not AODs\n"); |
714 | } | |
1e68a3f4 | 715 | |
716 | return mch; | |
591cc579 | 717 | } |
718 | ||
cc944149 | 719 | //___________________________________________________________ |
720 | Int_t AliCaloTrackReader::GetVertexBC(const AliVVertex * vtx) | |
721 | { | |
722 | // Get the vertex BC | |
85c4406e | 723 | |
cc944149 | 724 | Int_t vertexBC=vtx->GetBC(); |
725 | if(!fRecalculateVertexBC) return vertexBC; | |
726 | ||
727 | // In old AODs BC not stored, recalculate it | |
728 | // loop over the global track and select those which have small DCA to primary vertex (e.g. primary). | |
729 | // If at least one of these primaries has valid BC != 0, then this vertex is a pile-up candidate. | |
730 | // Execute after CTS | |
731 | Double_t bz = fInputEvent->GetMagneticField(); | |
732 | Bool_t bc0 = kFALSE; | |
733 | Int_t ntr = GetCTSTracks()->GetEntriesFast(); | |
734 | //printf("N Tracks %d\n",ntr); | |
735 | ||
736 | for(Int_t i = 0 ; i < ntr ; i++) | |
737 | { | |
738 | AliVTrack * track = (AliVTrack*) (GetCTSTracks()->At(i)); | |
739 | ||
740 | //Check if has TOF info, if not skip | |
741 | ULong_t status = track->GetStatus(); | |
742 | Bool_t okTOF = (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ; | |
743 | vertexBC = track->GetTOFBunchCrossing(bz); | |
744 | Float_t pt = track->Pt(); | |
745 | ||
746 | if(!okTOF) continue; | |
747 | ||
748 | // Get DCA x, y | |
749 | Double_t dca[2] = {1e6,1e6}; | |
750 | Double_t covar[3] = {1e6,1e6,1e6}; | |
751 | track->PropagateToDCA(vtx,bz,100.,dca,covar); | |
752 | ||
753 | if(AcceptDCA(pt,dca[0])) | |
754 | { | |
755 | if (vertexBC !=0 && fVertexBC != AliVTrack::kTOFBCNA) return vertexBC; | |
756 | else if(vertexBC == 0) bc0 = kTRUE; | |
757 | } | |
758 | } | |
759 | ||
760 | if( bc0 ) vertexBC = 0 ; | |
761 | else vertexBC = AliVTrack::kTOFBCNA ; | |
762 | ||
763 | return vertexBC; | |
764 | ||
765 | } | |
766 | ||
836b6989 | 767 | //_____________________________ |
591cc579 | 768 | void AliCaloTrackReader::Init() |
769 | { | |
90995603 | 770 | //Init reader. Method to be called in AliAnaPartCorrMaker |
85c4406e | 771 | |
de0b770d | 772 | //printf(" AliCaloTrackReader::Init() %p \n",gGeoManager); |
85c4406e | 773 | |
55d66f31 | 774 | if(fReadStack && fReadAODMCParticles) |
775 | { | |
90995603 | 776 | printf("AliCaloTrackReader::Init() - Cannot access stack and mcparticles at the same time, change them \n"); |
de0b770d | 777 | fReadStack = kFALSE; |
90995603 | 778 | fReadAODMCParticles = kFALSE; |
779 | } | |
9e536695 | 780 | |
d7601185 | 781 | if(!fESDtrackCuts) |
782 | fESDtrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); //initialize with TPC only tracks | |
d9bea110 | 783 | |
591cc579 | 784 | } |
765d44e7 | 785 | |
836b6989 | 786 | //_______________________________________ |
1c5acb87 | 787 | void AliCaloTrackReader::InitParameters() |
788 | { | |
1c5acb87 | 789 | //Initialize the parameters of the analysis. |
591cc579 | 790 | fDataType = kESD ; |
98ec971d | 791 | fCTSPtMin = 0.1 ; |
792 | fEMCALPtMin = 0.1 ; | |
793 | fPHOSPtMin = 0.1 ; | |
794 | fCTSPtMax = 1000. ; | |
795 | fEMCALPtMax = 1000. ; | |
796 | fPHOSPtMax = 1000. ; | |
797 | ||
689d9f15 | 798 | //Track DCA cuts |
cc944149 | 799 | // dca_xy cut = 0.0105+0.0350/TMath::Power(pt,1.1); |
85c4406e | 800 | fTrackDCACut[0] = 0.0105; |
801 | fTrackDCACut[1] = 0.0350; | |
cc944149 | 802 | fTrackDCACut[2] = 1.1; |
803 | ||
902aa95c | 804 | //Do not filter the detectors input by default. |
805 | fFillEMCAL = kFALSE; | |
806 | fFillPHOS = kFALSE; | |
807 | fFillCTS = kFALSE; | |
1c5acb87 | 808 | fFillEMCALCells = kFALSE; |
591cc579 | 809 | fFillPHOSCells = kFALSE; |
836b6989 | 810 | |
591cc579 | 811 | fReadStack = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file |
812 | fReadAODMCParticles = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file | |
42dc8e7d | 813 | fDeltaAODFileName = "deltaAODPartCorr.root"; |
743aa53a | 814 | fFiredTriggerClassName = ""; |
029dea5a | 815 | fEventTriggerMask = AliVEvent::kAny; |
790dea42 | 816 | fMixEventTriggerMask = AliVEvent::kAnyINT; |
029dea5a | 817 | fEventTriggerAtSE = kTRUE; // Use only events that pass event selection at SE base class |
836b6989 | 818 | |
de0b770d | 819 | fAcceptFastCluster = kTRUE; |
820 | fAnaLED = kFALSE; | |
0ae57829 | 821 | |
822 | //We want tracks fitted in the detectors: | |
3a58eee6 | 823 | //fTrackStatus=AliESDtrack::kTPCrefit; |
85c4406e | 824 | //fTrackStatus|=AliESDtrack::kITSrefit; |
de0b770d | 825 | fTrackStatus = 0; |
a5fb4114 | 826 | fTrackFilterMask = 128; //For AODs, but what is the difference between fTrackStatus and fTrackFilterMask? |
6f20e2a6 | 827 | fTrackFilterMaskComplementary = 0; // in case of hybrid tracks, without using the standard method |
3a58eee6 | 828 | |
7eb4c4a8 | 829 | fSelectFractionTPCSharedClusters = kTRUE; |
830 | fCutTPCSharedClustersFraction = 0.4, | |
831 | ||
d7601185 | 832 | fESDtrackCuts = 0; |
833 | fESDtrackComplementaryCuts = 0; | |
836b6989 | 834 | |
a9b8c1d0 | 835 | fConstrainTrack = kFALSE ; // constrain tracks to vertex |
836 | ||
85c4406e | 837 | fV0ADC[0] = 0; fV0ADC[1] = 0; |
838 | fV0Mul[0] = 0; fV0Mul[1] = 0; | |
836b6989 | 839 | |
0b13c1f9 | 840 | fZvtxCut = 10.; |
841 | ||
de0b770d | 842 | fNMixedEvent = 1; |
843 | ||
dbb3de7b | 844 | fPtHardAndJetPtFactor = 7.; |
845 | fPtHardAndClusterPtFactor = 1.; | |
85c4406e | 846 | |
32fd29fe | 847 | //Centrality |
de0b770d | 848 | fCentralityClass = "V0M"; |
849 | fCentralityOpt = 10; | |
850 | fCentralityBin[0] = fCentralityBin[1]=-1; | |
836b6989 | 851 | |
9929c80b | 852 | fEventPlaneMethod = "V0"; |
85c4406e | 853 | |
f3138ecf | 854 | // Allocate memory (not sure this is the right place) |
855 | fCTSTracks = new TObjArray(); | |
856 | fEMCALClusters = new TObjArray(); | |
85c4406e | 857 | fPHOSClusters = new TObjArray(); |
d2ad4a1a | 858 | //fTriggerAnalysis = new AliTriggerAnalysis; |
f3138ecf | 859 | fAODBranchList = new TList ; |
85c4406e | 860 | |
3c1a2e95 | 861 | fPileUpParamSPD[0] = 3 ; fPileUpParamSPD[1] = 0.8 ; |
862 | fPileUpParamSPD[2] = 3.0 ; fPileUpParamSPD[3] = 2.0 ; fPileUpParamSPD[4] = 5.0; | |
4b75cb39 | 863 | |
ff440946 | 864 | // Parametrized time cut (LHC11d) |
85c4406e | 865 | fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 3.5 ; fEMCALParamTimeCutMin[3] = 1. ; |
866 | fEMCALParamTimeCutMax[0] = 5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.45; fEMCALParamTimeCutMax[3] = 1.25; | |
867 | ||
ff440946 | 868 | // Parametrized time cut (LHC11c) |
85c4406e | 869 | //fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 1.87; fEMCALParamTimeCutMin[3] = 0.4; |
b8d661af | 870 | //fEMCALParamTimeCutMax[0] = 3.5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.15; fEMCALParamTimeCutMax[3] = 1.6; |
871 | ||
872 | fTimeStampRunMin = -1; | |
b370e713 | 873 | fTimeStampRunMax = 1e12; |
b8d661af | 874 | fTimeStampEventFracMin = -1; |
875 | fTimeStampEventFracMax = 2; | |
85c4406e | 876 | |
47454666 | 877 | for(Int_t i = 0; i < 19; i++) |
878 | { | |
879 | fEMCalBCEvent [i] = 0; | |
880 | fEMCalBCEventCut[i] = 0; | |
881 | fTrackBCEvent [i] = 0; | |
882 | fTrackBCEventCut[i] = 0; | |
883 | } | |
884 | ||
afb3af8a | 885 | // Trigger match-rejection |
9bf1c947 | 886 | fTriggerPatchTimeWindow[0] = 8; |
887 | fTriggerPatchTimeWindow[1] = 9; | |
888 | ||
93c2e459 | 889 | fTriggerClusterBC = -10000 ; |
890 | fTriggerL0EventThreshold = 2.; | |
5737e185 | 891 | fTriggerL1EventThreshold = 4.; |
93c2e459 | 892 | fTriggerClusterIndex = -1; |
893 | fTriggerClusterId = -1; | |
85c4406e | 894 | |
43cd6c94 | 895 | //Jets |
896 | fInputNonStandardJetBranchName = "jets"; | |
897 | fFillInputNonStandardJetBranch = kFALSE; | |
898 | if(!fNonStandardJets) fNonStandardJets = new TClonesArray("AliAODJet",100); | |
d6d84709 | 899 | fInputBackgroundJetBranchName = "jets"; |
900 | fFillInputBackgroundJetBranch = kFALSE; | |
901 | if(!fBackgroundJets) fBackgroundJets = new AliAODJetEventBackground(); | |
902 | ||
4e2b43d8 | 903 | } |
1c5acb87 | 904 | |
914b9fe7 | 905 | //___________________________________________________________________ |
906 | Bool_t AliCaloTrackReader::IsEMCALCluster(AliVCluster* cluster) const | |
907 | { | |
908 | // Check if it is a cluster from EMCAL. For old AODs cluster type has | |
909 | // different number and need to patch here | |
910 | ||
911 | if(fDataType==kAOD && fOldAOD) | |
912 | { | |
913 | if (cluster->GetType() == 2) return kTRUE; | |
914 | else return kFALSE; | |
915 | } | |
916 | else | |
917 | { | |
918 | return cluster->IsEMCAL(); | |
919 | } | |
920 | ||
921 | } | |
922 | ||
923 | //___________________________________________________________________ | |
924 | Bool_t AliCaloTrackReader::IsPHOSCluster(AliVCluster * cluster) const | |
925 | { | |
926 | //Check if it is a cluster from PHOS.For old AODs cluster type has | |
927 | // different number and need to patch here | |
928 | ||
929 | if(fDataType==kAOD && fOldAOD) | |
930 | { | |
931 | Int_t type = cluster->GetType(); | |
932 | if (type == 0 || type == 1) return kTRUE; | |
933 | else return kFALSE; | |
934 | } | |
935 | else | |
936 | { | |
937 | return cluster->IsPHOS(); | |
938 | } | |
939 | ||
940 | } | |
941 | ||
43cd6c94 | 942 | //________________________________________________________________________ |
943 | Bool_t AliCaloTrackReader::IsHIJINGLabel(Int_t label) | |
944 | { | |
945 | ||
946 | // Find if cluster/track was generated by HIJING | |
43cd6c94 | 947 | |
948 | AliGenHijingEventHeader* hijingHeader = dynamic_cast<AliGenHijingEventHeader *> (GetGenEventHeader()); | |
949 | ||
667a3592 | 950 | //printf("header %p, label %d\n",hijingHeader,label); |
951 | ||
43cd6c94 | 952 | if(!hijingHeader || label < 0 ) return kFALSE; |
953 | ||
667a3592 | 954 | |
955 | //printf("pass a), N produced %d\n",nproduced); | |
956 | ||
957 | if(label >= fNMCProducedMin && label < fNMCProducedMax) | |
958 | { | |
959 | //printf(" accept!, label is smaller than produced, N %d\n",nproduced); | |
960 | ||
961 | return kTRUE; | |
962 | } | |
43cd6c94 | 963 | |
964 | if(ReadStack()) | |
965 | { | |
667a3592 | 966 | if(!GetStack()) return kFALSE; |
967 | ||
43cd6c94 | 968 | Int_t nprimaries = GetStack()->GetNtrack(); |
667a3592 | 969 | |
43cd6c94 | 970 | if(label > nprimaries) return kFALSE; |
667a3592 | 971 | |
43cd6c94 | 972 | TParticle * mom = GetStack()->Particle(label); |
973 | ||
974 | Int_t iMom = label; | |
975 | Int_t iParent = mom->GetFirstMother(); | |
976 | while(iParent!=-1) | |
977 | { | |
667a3592 | 978 | if(iParent >= fNMCProducedMin && iParent < fNMCProducedMax) |
979 | { | |
980 | //printf("\t accept, mother is %d \n",iParent) | |
981 | return kTRUE; | |
982 | } | |
983 | ||
43cd6c94 | 984 | iMom = iParent; |
985 | mom = GetStack()->Particle(iMom); | |
986 | iParent = mom->GetFirstMother(); | |
987 | } | |
988 | ||
667a3592 | 989 | return kFALSE ; |
990 | ||
43cd6c94 | 991 | } // ESD |
992 | else | |
993 | { | |
994 | TClonesArray* mcparticles = GetAODMCParticles(); | |
667a3592 | 995 | |
996 | if(!mcparticles) return kFALSE; | |
997 | ||
43cd6c94 | 998 | Int_t nprimaries = mcparticles->GetEntriesFast(); |
667a3592 | 999 | |
43cd6c94 | 1000 | if(label > nprimaries) return kFALSE; |
667a3592 | 1001 | |
1002 | //printf("pass b) N primaries %d \n",nprimaries); | |
1003 | ||
1004 | if(label >= fNMCProducedMin && label < fNMCProducedMax) | |
1005 | { | |
1006 | return kTRUE; | |
1007 | } | |
1008 | ||
1009 | // Find grand parent, check if produced in the good range | |
43cd6c94 | 1010 | AliAODMCParticle * mom = (AliAODMCParticle *) mcparticles->At(label); |
1011 | ||
1012 | Int_t iMom = label; | |
1013 | Int_t iParent = mom->GetMother(); | |
1014 | while(iParent!=-1) | |
1015 | { | |
667a3592 | 1016 | if(iParent >= fNMCProducedMin && iParent < fNMCProducedMax) |
1017 | { | |
1018 | //printf("\t accept, mother is %d, with nProduced %d \n",iParent, nproduced); | |
1019 | return kTRUE; | |
1020 | } | |
1021 | ||
43cd6c94 | 1022 | iMom = iParent; |
1023 | mom = (AliAODMCParticle *) mcparticles->At(iMom); | |
1024 | iParent = mom->GetMother(); | |
667a3592 | 1025 | |
43cd6c94 | 1026 | } |
1027 | ||
667a3592 | 1028 | //printf("pass c), no match found \n"); |
1029 | ||
1030 | return kFALSE ; | |
1031 | ||
43cd6c94 | 1032 | }//AOD |
1033 | } | |
1034 | ||
8a2dbbff | 1035 | //__________________________________________________________________________ |
1036 | Bool_t AliCaloTrackReader::IsInTimeWindow(Double_t tof, Float_t energy) const | |
3c1a2e95 | 1037 | { |
1038 | // Cluster time selection window | |
1039 | ||
1040 | // Parametrized cut depending on E | |
1041 | if(fUseParamTimeCut) | |
1042 | { | |
1043 | Float_t minCut= fEMCALParamTimeCutMin[0]+fEMCALParamTimeCutMin[1]*TMath::Exp(-(energy-fEMCALParamTimeCutMin[2])/fEMCALParamTimeCutMin[3]); | |
1044 | Float_t maxCut= fEMCALParamTimeCutMax[0]+fEMCALParamTimeCutMax[1]*TMath::Exp(-(energy-fEMCALParamTimeCutMax[2])/fEMCALParamTimeCutMax[3]); | |
1045 | //printf("tof %f, minCut %f, maxCut %f\n",tof,minCut,maxCut); | |
1046 | if( tof < minCut || tof > maxCut ) return kFALSE ; | |
1047 | } | |
1048 | ||
1049 | //In any case, the time should to be larger than the fixed window ... | |
1050 | if( tof < fEMCALTimeCutMin || tof > fEMCALTimeCutMax ) return kFALSE ; | |
1051 | ||
1052 | return kTRUE ; | |
1053 | } | |
64c78c5f | 1054 | |
1055 | //________________________________________________ | |
1056 | Bool_t AliCaloTrackReader::IsPileUpFromSPD() const | |
1057 | { | |
1058 | // Check if event is from pile-up determined by SPD | |
1059 | // Default values: (3, 0.8, 3., 2., 5.) | |
85c4406e | 1060 | return fInputEvent->IsPileupFromSPD((Int_t) fPileUpParamSPD[0] , fPileUpParamSPD[1] , |
1061 | fPileUpParamSPD[2] , fPileUpParamSPD[3] , fPileUpParamSPD[4] ); | |
3c1a2e95 | 1062 | //printf("Param : %d, %2.2f, %2.2f, %2.2f, %2.2f\n",(Int_t) fPileUpParamSPD[0], fPileUpParamSPD[1], fPileUpParamSPD[2], fPileUpParamSPD[3], fPileUpParamSPD[4]); |
85c4406e | 1063 | |
3c1a2e95 | 1064 | } |
1065 | ||
1066 | //__________________________________________________ | |
1067 | Bool_t AliCaloTrackReader::IsPileUpFromEMCal() const | |
1068 | { | |
1069 | // Check if event is from pile-up determined by EMCal | |
1070 | if(fNPileUpClusters > fNPileUpClustersCut) return kTRUE ; | |
1071 | else return kFALSE; | |
1072 | } | |
1073 | ||
1074 | //________________________________________________________ | |
1075 | Bool_t AliCaloTrackReader::IsPileUpFromSPDAndEMCal() const | |
1076 | { | |
1077 | // Check if event is from pile-up determined by SPD and EMCal | |
1078 | if( IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ; | |
1079 | else return kFALSE; | |
1080 | } | |
099de61e | 1081 | |
3c1a2e95 | 1082 | //_______________________________________________________ |
1083 | Bool_t AliCaloTrackReader::IsPileUpFromSPDOrEMCal() const | |
1084 | { | |
1085 | // Check if event is from pile-up determined by SPD or EMCal | |
1086 | if( IsPileUpFromSPD() || IsPileUpFromEMCal()) return kTRUE ; | |
1087 | else return kFALSE; | |
1088 | } | |
1089 | ||
1090 | //___________________________________________________________ | |
1091 | Bool_t AliCaloTrackReader::IsPileUpFromSPDAndNotEMCal() const | |
1092 | { | |
1093 | // Check if event is from pile-up determined by SPD and not by EMCal | |
1094 | if( IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ; | |
1095 | else return kFALSE; | |
1096 | } | |
1097 | ||
1098 | //___________________________________________________________ | |
1099 | Bool_t AliCaloTrackReader::IsPileUpFromEMCalAndNotSPD() const | |
1100 | { | |
1101 | // Check if event is from pile-up determined by EMCal, not by SPD | |
1102 | if( !IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ; | |
1103 | else return kFALSE; | |
1104 | } | |
1105 | ||
1106 | //______________________________________________________________ | |
1107 | Bool_t AliCaloTrackReader::IsPileUpFromNotSPDAndNotEMCal() const | |
1108 | { | |
1109 | // Check if event not from pile-up determined neither by SPD nor by EMCal | |
1110 | if( !IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ; | |
1111 | else return kFALSE; | |
64c78c5f | 1112 | } |
1113 | ||
8a2dbbff | 1114 | //___________________________________________________________________________________ |
1115 | Bool_t AliCaloTrackReader::FillInputEvent(Int_t iEntry, const char * /*curFileName*/) | |
836b6989 | 1116 | { |
6639984f | 1117 | //Fill the event counter and input lists that are needed, called by the analysis maker. |
cc944149 | 1118 | |
e2acbe6d | 1119 | fEventNumber = iEntry; |
afb3af8a | 1120 | fTriggerClusterIndex = -1; |
1121 | fTriggerClusterId = -1; | |
1122 | fIsTriggerMatch = kFALSE; | |
1123 | fTriggerClusterBC = -10000; | |
1124 | fIsExoticEvent = kFALSE; | |
1125 | fIsBadCellEvent = kFALSE; | |
1035a8d9 | 1126 | fIsBadMaxCellEvent = kFALSE; |
afb3af8a | 1127 | |
85c4406e | 1128 | fIsTriggerMatchOpenCut[0] = kFALSE ; |
1129 | fIsTriggerMatchOpenCut[1] = kFALSE ; | |
1130 | fIsTriggerMatchOpenCut[2] = kFALSE ; | |
1131 | ||
1510eee3 | 1132 | //fCurrentFileName = TString(currentFileName); |
55d66f31 | 1133 | if(!fInputEvent) |
1134 | { | |
f6b8da1f | 1135 | if(fDebug >= 0) printf("AliCaloTrackReader::FillInputEvent() - Input event not available, skip event analysis\n"); |
1136 | return kFALSE; | |
be1f5fa4 | 1137 | } |
55d66f31 | 1138 | |
9b1587f6 | 1139 | //----------------------------------------------- |
1140 | // Select the event depending on the trigger type | |
1141 | // and other event characteristics | |
d2ad4a1a | 1142 | // like the goodness of the EMCal trigger |
9b1587f6 | 1143 | //----------------------------------------------- |
1144 | ||
b62d68b3 | 1145 | Bool_t accept = CheckEventTriggers(); |
1146 | if(!accept) return kFALSE; | |
90d5b739 | 1147 | |
9b1587f6 | 1148 | if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass Event trigger selection \n"); |
1149 | ||
b62d68b3 | 1150 | //--------------------------------------------------------------------------- |
1151 | // In case of analysis of events with jets, skip those with jet pt > 5 pt hard | |
1152 | // To be used on for MC data in pT hard bins | |
1153 | //--------------------------------------------------------------------------- | |
fc85781f | 1154 | |
85c4406e | 1155 | if(fComparePtHardAndJetPt) |
55d66f31 | 1156 | { |
7ec23b5a | 1157 | if(!ComparePtHardAndJetPt()) return kFALSE ; |
9b1587f6 | 1158 | if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass Pt Hard - Jet rejection \n"); |
29b2ceec | 1159 | } |
836b6989 | 1160 | |
85c4406e | 1161 | if(fComparePtHardAndClusterPt) |
dbb3de7b | 1162 | { |
1163 | if(!ComparePtHardAndClusterPt()) return kFALSE ; | |
9b1587f6 | 1164 | if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass Pt Hard - Cluster rejection \n"); |
dbb3de7b | 1165 | } |
1166 | ||
034e885b | 1167 | //------------------------------------------------------ |
fc85781f | 1168 | // Event rejection depending on time stamp |
034e885b | 1169 | //------------------------------------------------------ |
fc85781f | 1170 | |
034e885b | 1171 | if(fDataType==kESD && fTimeStampEventSelect) |
1172 | { | |
1173 | AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent); | |
47454666 | 1174 | if(esd) |
1175 | { | |
1176 | Int_t timeStamp = esd->GetTimeStamp(); | |
1177 | Float_t timeStampFrac = 1.*(timeStamp-fTimeStampRunMin) / (fTimeStampRunMax-fTimeStampRunMin); | |
1178 | ||
1179 | //printf("stamp0 %d, max0 %d, frac %f\n", timeStamp-fTimeStampRunMin,fTimeStampRunMax-fTimeStampRunMin, timeStampFrac); | |
1180 | ||
1181 | if(timeStampFrac < fTimeStampEventFracMin || timeStampFrac > fTimeStampEventFracMax) return kFALSE; | |
1182 | } | |
9b1587f6 | 1183 | if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass Time Stamp rejection \n"); |
034e885b | 1184 | } |
85c4406e | 1185 | |
48c37e02 | 1186 | //------------------------------------------------------ |
fc85781f | 1187 | // Event rejection depending on vertex, pileup, v0and |
48c37e02 | 1188 | //------------------------------------------------------ |
85c4406e | 1189 | |
fc85781f | 1190 | FillVertexArray(); |
1191 | ||
1192 | //Reject events with Z vertex too large, only for SE analysis, if not, cut on the analysis code | |
1193 | if(!GetMixedEvent() && TMath::Abs(fVertex[0][2]) > fZvtxCut) return kFALSE; | |
1194 | ||
d2655d46 | 1195 | if(fUseEventsWithPrimaryVertex) |
1196 | { | |
1197 | if( !CheckForPrimaryVertex() ) return kFALSE; | |
85c4406e | 1198 | if( TMath::Abs(fVertex[0][0] ) < 1.e-6 && |
d70095f2 | 1199 | TMath::Abs(fVertex[0][1] ) < 1.e-6 && |
1200 | TMath::Abs(fVertex[0][2] ) < 1.e-6 ) return kFALSE; | |
d2655d46 | 1201 | } |
1202 | ||
9b1587f6 | 1203 | if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass primary vertex rejection \n"); |
90d5b739 | 1204 | |
099de61e | 1205 | //printf("Reader : IsPileUp %d, Multi %d\n",IsPileUpFromSPD(),fInputEvent->IsPileupFromSPDInMultBins()); |
1206 | ||
fc85781f | 1207 | if(fDoPileUpEventRejection) |
55d66f31 | 1208 | { |
d70095f2 | 1209 | // Do not analyze events with pileup |
1210 | Bool_t bPileup = IsPileUpFromSPD(); | |
1211 | //IsPileupFromSPDInMultBins() // method to try | |
1212 | //printf("pile-up %d, %d, %2.2f, %2.2f, %2.2f, %2.2f\n",bPileup, (Int_t) fPileUpParamSPD[0], fPileUpParamSPD[1], fPileUpParamSPD[2], fPileUpParamSPD[3], fPileUpParamSPD[4]); | |
1213 | if(bPileup) return kFALSE; | |
1214 | ||
fc85781f | 1215 | if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass Pile-Up event rejection \n"); |
1216 | } | |
e2acbe6d | 1217 | |
fc85781f | 1218 | if(fDoV0ANDEventSelection) |
1219 | { | |
d2ad4a1a | 1220 | AliVVZERO* v0 = fInputEvent->GetVZEROData(); |
90d5b739 | 1221 | |
d2ad4a1a | 1222 | Bool_t bV0AND = ((v0->GetV0ADecision()==1) && (v0->GetV0CDecision()==1)); |
1223 | //bV0AND = fTriggerAnalysis->IsOfflineTriggerFired((AliESDEvent*)fInputEvent, AliTriggerAnalysis::kV0AND); | |
1224 | //printf("V0AND event? %d\n",bV0AND); | |
1225 | ||
1226 | if(!bV0AND) | |
1227 | { | |
1228 | printf("AliCaloTrackReader::FillInputEvent() - Reject event by V0AND\n"); | |
1229 | return kFALSE; | |
1230 | } | |
fc85781f | 1231 | if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass V0AND event rejection \n"); |
1232 | } | |
1233 | ||
1234 | //------------------------------------------------------ | |
1235 | // Check if there is a centrality value, PbPb analysis, | |
1236 | // and if a centrality bin selection is requested | |
48c37e02 | 1237 | //------------------------------------------------------ |
836b6989 | 1238 | |
32fd29fe | 1239 | //If we need a centrality bin, we select only those events in the corresponding bin. |
55d66f31 | 1240 | if(GetCentrality() && fCentralityBin[0]>=0 && fCentralityBin[1]>=0 && fCentralityOpt==100) |
1241 | { | |
32fd29fe | 1242 | Int_t cen = GetEventCentrality(); |
1243 | if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin. | |
fc85781f | 1244 | |
1245 | if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass centrality rejection \n"); | |
32fd29fe | 1246 | } |
31864468 | 1247 | |
fc85781f | 1248 | //--------------------------------------------------------------------------- |
1249 | // In case of MC analysis, set the range of interest in the MC particles list | |
1250 | // The particle selection is done inside the FillInputDetector() methods | |
1251 | //--------------------------------------------------------------------------- | |
1252 | if(fAcceptOnlyHIJINGLabels) SetGeneratorMinMaxParticles(); | |
1253 | ||
1254 | //printf("N min %d, N max %d\n",fNMCProducedMin,fNMCProducedMax); | |
1255 | ||
9b1587f6 | 1256 | //------------------------------------------------------- |
cc944149 | 1257 | // Get the main vertex BC, in case not available |
1258 | // it is calculated in FillCTS checking the BC of tracks | |
9b1587f6 | 1259 | //------------------------------------------------------ |
fc85781f | 1260 | fVertexBC = fInputEvent->GetPrimaryVertex()->GetBC(); |
667a3592 | 1261 | |
9b1587f6 | 1262 | //----------------------------------------------- |
1263 | // Fill the arrays with cluster/tracks/cells data | |
1264 | //----------------------------------------------- | |
1265 | ||
31864468 | 1266 | if(fFillCTS) |
1267 | { | |
1268 | FillInputCTS(); | |
1269 | //Accept events with at least one track | |
2644ead9 | 1270 | if(fTrackMult == 0 && fDoRejectNoTrackEvents) return kFALSE ; |
fc85781f | 1271 | |
1272 | if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass rejection of null track events \n"); | |
029dea5a | 1273 | } |
1274 | ||
cc944149 | 1275 | if(fDoVertexBCEventSelection) |
1276 | { | |
9b1587f6 | 1277 | if(fVertexBC != 0 && fVertexBC != AliVTrack::kTOFBCNA) return kFALSE ; |
fc85781f | 1278 | |
1279 | if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Pass rejection of events with vertex at BC!=0 \n"); | |
cc944149 | 1280 | } |
afb3af8a | 1281 | |
31864468 | 1282 | if(fFillEMCALCells) |
1283 | FillInputEMCALCells(); | |
1284 | ||
1285 | if(fFillPHOSCells) | |
1286 | FillInputPHOSCells(); | |
1287 | ||
1288 | if(fFillEMCAL) | |
1289 | FillInputEMCAL(); | |
1290 | ||
1291 | if(fFillPHOS) | |
1292 | FillInputPHOS(); | |
1293 | ||
fc85781f | 1294 | FillInputVZERO(); |
85c4406e | 1295 | |
43cd6c94 | 1296 | //one specified jet branch |
1297 | if(fFillInputNonStandardJetBranch) | |
1298 | FillInputNonStandardJets(); | |
d6d84709 | 1299 | if(fFillInputBackgroundJetBranch) |
1300 | FillInputBackgroundJets(); | |
1301 | ||
fc85781f | 1302 | if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Event accepted for analysis \n"); |
1303 | ||
29b2ceec | 1304 | return kTRUE ; |
1c5acb87 | 1305 | } |
1306 | ||
32fd29fe | 1307 | //__________________________________________________ |
85c4406e | 1308 | Int_t AliCaloTrackReader::GetEventCentrality() const |
836b6989 | 1309 | { |
32fd29fe | 1310 | //Return current event centrality |
1311 | ||
029dea5a | 1312 | if(GetCentrality()) |
1313 | { | |
9929c80b | 1314 | if (fCentralityOpt==100) return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass); // 100 bins max |
1315 | else if(fCentralityOpt==10) return GetCentrality()->GetCentralityClass10(fCentralityClass);// 10 bins max | |
1316 | else if(fCentralityOpt==20) return GetCentrality()->GetCentralityClass5(fCentralityClass); // 20 bins max | |
85c4406e | 1317 | else |
029dea5a | 1318 | { |
9929c80b | 1319 | printf("AliCaloTrackReader::GetEventCentrality() - Unknown centrality option %d, use 10, 20 or 100\n",fCentralityOpt); |
1320 | return -1; | |
85c4406e | 1321 | } |
32fd29fe | 1322 | } |
9929c80b | 1323 | else return -1; |
1324 | ||
1325 | } | |
1326 | ||
1327 | //_____________________________________________________ | |
85c4406e | 1328 | Double_t AliCaloTrackReader::GetEventPlaneAngle() const |
9929c80b | 1329 | { |
1330 | //Return current event centrality | |
1331 | ||
1332 | if(GetEventPlane()) | |
1333 | { | |
1334 | Float_t ep = GetEventPlane()->GetEventplane(GetEventPlaneMethod(), GetInputEvent()); | |
1335 | ||
85c4406e | 1336 | if(GetEventPlaneMethod()=="Q" && (ep < 0 || ep > TMath::Pi())) |
9929c80b | 1337 | { |
b14c2b20 | 1338 | if(fDebug > 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Bad EP for <Q> method : %f\n",ep); |
9929c80b | 1339 | return -1000; |
1340 | } | |
85c4406e | 1341 | else if(GetEventPlaneMethod().Contains("V0") ) |
9929c80b | 1342 | { |
1343 | if((ep > TMath::Pi()/2 || ep < -TMath::Pi()/2)) | |
1344 | { | |
b14c2b20 | 1345 | if(fDebug > 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Bad EP for <%s> method : %f\n",GetEventPlaneMethod().Data(), ep); |
9929c80b | 1346 | return -1000; |
1347 | } | |
1348 | ||
1349 | ep+=TMath::Pi()/2; // put same range as for <Q> method | |
1350 | ||
1351 | } | |
85c4406e | 1352 | |
9929c80b | 1353 | //printf("AliCaloTrackReader::GetEventPlaneAngle() = %f\n",ep); |
b14c2b20 | 1354 | if(fDebug > 0 ) |
1355 | { | |
1356 | if (ep > TMath::Pi()) printf("AliCaloTrackReader::GetEventPlaneAngle() - Too large angle = %f\n",ep); | |
1357 | else if(ep < 0 ) printf("AliCaloTrackReader::GetEventPlaneAngle() - Negative angle = %f\n" ,ep); | |
1358 | } | |
9929c80b | 1359 | |
8fd30003 | 1360 | return ep; |
9929c80b | 1361 | } |
1362 | else | |
1363 | { | |
b14c2b20 | 1364 | if(fDataType!=kMC && fDebug > 0) printf("AliCaloTrackReader::GetEventPlaneAngle() - No EP pointer\n"); |
9929c80b | 1365 | return -1000; |
85c4406e | 1366 | } |
32fd29fe | 1367 | |
1368 | } | |
1369 | ||
836b6989 | 1370 | //__________________________________________________________ |
85c4406e | 1371 | void AliCaloTrackReader::GetVertex(Double_t vertex[3]) const |
836b6989 | 1372 | { |
f8006433 | 1373 | //Return vertex position to be used for single event analysis |
85c4406e | 1374 | vertex[0]=fVertex[0][0]; |
1375 | vertex[1]=fVertex[0][1]; | |
f8006433 | 1376 | vertex[2]=fVertex[0][2]; |
1377 | } | |
1378 | ||
8a2dbbff | 1379 | //__________________________________________________________________________ |
1380 | void AliCaloTrackReader::GetVertex(Double_t vertex[3], Int_t evtIndex) const | |
836b6989 | 1381 | { |
f8006433 | 1382 | //Return vertex position for mixed event, recover the vertex in a particular event. |
1383 | ||
f8006433 | 1384 | vertex[0]=fVertex[evtIndex][0]; vertex[1]=fVertex[evtIndex][1]; vertex[2]=fVertex[evtIndex][2]; |
1385 | ||
1386 | } | |
f8006433 | 1387 | |
836b6989 | 1388 | //________________________________________ |
85c4406e | 1389 | void AliCaloTrackReader::FillVertexArray() |
836b6989 | 1390 | { |
f8006433 | 1391 | |
1392 | //Fill data member with vertex | |
1393 | //In case of Mixed event, multiple vertices | |
1394 | ||
1395 | //Delete previous vertex | |
d2655d46 | 1396 | if(fVertex) |
1397 | { | |
85c4406e | 1398 | for (Int_t i = 0; i < fNMixedEvent; i++) |
d2655d46 | 1399 | { |
85c4406e | 1400 | delete [] fVertex[i] ; |
f8006433 | 1401 | } |
85c4406e | 1402 | delete [] fVertex ; |
f8006433 | 1403 | } |
1404 | ||
85c4406e | 1405 | fVertex = new Double_t*[fNMixedEvent] ; |
1406 | for (Int_t i = 0; i < fNMixedEvent; i++) | |
d2655d46 | 1407 | { |
85c4406e | 1408 | fVertex[i] = new Double_t[3] ; |
1409 | fVertex[i][0] = 0.0 ; | |
1410 | fVertex[i][1] = 0.0 ; | |
1411 | fVertex[i][2] = 0.0 ; | |
1412 | } | |
f8006433 | 1413 | |
85c4406e | 1414 | if (!fMixedEvent) |
d2655d46 | 1415 | { //Single event analysis |
1416 | if(fDataType!=kMC) | |
1417 | { | |
836b6989 | 1418 | |
d2655d46 | 1419 | if(fInputEvent->GetPrimaryVertex()) |
1420 | { | |
85c4406e | 1421 | fInputEvent->GetPrimaryVertex()->GetXYZ(fVertex[0]); |
79395d30 | 1422 | } |
85c4406e | 1423 | else |
d2655d46 | 1424 | { |
79395d30 | 1425 | printf("AliCaloTrackReader::FillVertexArray() - NULL primary vertex\n"); |
1426 | fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.; | |
1427 | }//Primary vertex pointer do not exist | |
1428 | ||
d2655d46 | 1429 | } else |
85c4406e | 1430 | {//MC read event |
edffc439 | 1431 | fVertex[0][0]=0.; fVertex[0][1]=0.; fVertex[0][2]=0.; |
1432 | } | |
836b6989 | 1433 | |
f8006433 | 1434 | if(fDebug > 1) |
1435 | printf("AliCaloTrackReader::FillVertexArray() - Single Event Vertex : %f,%f,%f\n",fVertex[0][0],fVertex[0][1],fVertex[0][2]); | |
836b6989 | 1436 | |
85c4406e | 1437 | } else |
d2655d46 | 1438 | { // MultiEvent analysis |
85c4406e | 1439 | for (Int_t iev = 0; iev < fNMixedEvent; iev++) |
d2655d46 | 1440 | { |
8e7bdfa9 | 1441 | if (fMixedEvent->GetVertexOfEvent(iev)) |
1442 | fMixedEvent->GetVertexOfEvent(iev)->GetXYZ(fVertex[iev]); | |
d2655d46 | 1443 | else |
1444 | { // no vertex found !!!! | |
8e7bdfa9 | 1445 | AliWarning("No vertex found"); |
1446 | } | |
836b6989 | 1447 | |
f8006433 | 1448 | if(fDebug > 1) |
1449 | printf("AliCaloTrackReader::FillVertexArray() - Multi Event %d Vertex : %f,%f,%f\n",iev,fVertex[iev][0],fVertex[iev][1],fVertex[iev][2]); | |
836b6989 | 1450 | |
f8006433 | 1451 | } |
c8fe2783 | 1452 | } |
f8006433 | 1453 | |
c8fe2783 | 1454 | } |
1455 | ||
836b6989 | 1456 | //_____________________________________ |
85c4406e | 1457 | void AliCaloTrackReader::FillInputCTS() |
836b6989 | 1458 | { |
f37fa8d2 | 1459 | //Return array with Central Tracking System (CTS) tracks |
1460 | ||
1461 | if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS()\n"); | |
1462 | ||
da91abdb | 1463 | Double_t pTrack[3] = {0,0,0}; |
1464 | ||
1465 | Int_t nTracks = fInputEvent->GetNumberOfTracks() ; | |
1466 | fTrackMult = 0; | |
3a58eee6 | 1467 | Int_t nstatus = 0; |
4b7f6e01 | 1468 | Double_t bz = GetInputEvent()->GetMagneticField(); |
85c4406e | 1469 | |
975b29fa | 1470 | for(Int_t i = 0; i < 19; i++) |
1471 | { | |
1472 | fTrackBCEvent [i] = 0; | |
1473 | fTrackBCEventCut[i] = 0; | |
1474 | } | |
d7601185 | 1475 | |
cc944149 | 1476 | Bool_t bc0 = kFALSE; |
9b1587f6 | 1477 | if(fRecalculateVertexBC) fVertexBC = AliVTrack::kTOFBCNA; |
cc944149 | 1478 | |
975b29fa | 1479 | for (Int_t itrack = 0; itrack < nTracks; itrack++) |
d2655d46 | 1480 | {////////////// track loop |
c8fe2783 | 1481 | AliVTrack * track = (AliVTrack*)fInputEvent->GetTrack(itrack) ; // retrieve track from esd |
836b6989 | 1482 | |
3a58eee6 | 1483 | //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits |
975b29fa | 1484 | ULong_t status = track->GetStatus(); |
85c4406e | 1485 | |
975b29fa | 1486 | if (fTrackStatus && !((status & fTrackStatus) == fTrackStatus)) |
c8fe2783 | 1487 | continue ; |
1488 | ||
3a58eee6 | 1489 | nstatus++; |
1490 | ||
438953f7 | 1491 | Float_t dcaTPC =-999; |
1492 | ||
a9b8c1d0 | 1493 | if (fDataType==kESD) |
a5fb4114 | 1494 | { |
a9b8c1d0 | 1495 | AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (track); |
1496 | ||
d7601185 | 1497 | if(esdTrack) |
a9b8c1d0 | 1498 | { |
d7601185 | 1499 | if(fESDtrackCuts->AcceptTrack(esdTrack)) |
1500 | { | |
1501 | track->GetPxPyPz(pTrack) ; | |
85c4406e | 1502 | |
d7601185 | 1503 | if(fConstrainTrack) |
1504 | { | |
1505 | if(esdTrack->GetConstrainedParam()) | |
1506 | { | |
1507 | const AliExternalTrackParam* constrainParam = esdTrack->GetConstrainedParam(); | |
1508 | esdTrack->Set(constrainParam->GetX(),constrainParam->GetAlpha(),constrainParam->GetParameter(),constrainParam->GetCovariance()); | |
1509 | esdTrack->GetConstrainedPxPyPz(pTrack); | |
1510 | } | |
1511 | else continue; | |
1512 | ||
1513 | } // use constrained tracks | |
1514 | ||
1515 | if(fSelectSPDHitTracks) | |
1516 | {//Not much sense to use with TPC only or Hybrid tracks | |
1517 | if(!esdTrack->HasPointOnITSLayer(0) && !esdTrack->HasPointOnITSLayer(1)) continue ; | |
1518 | } | |
1519 | } | |
1520 | // Complementary track to global : Hybrids (make sure that the previous selection is for Global) | |
1521 | else if(fESDtrackComplementaryCuts && fESDtrackComplementaryCuts->AcceptTrack(esdTrack)) | |
a9b8c1d0 | 1522 | { |
d7601185 | 1523 | // constrain the track |
a9b8c1d0 | 1524 | if(esdTrack->GetConstrainedParam()) |
1525 | { | |
d7601185 | 1526 | esdTrack->Set(esdTrack->GetConstrainedParam()->GetX(),esdTrack->GetConstrainedParam()->GetAlpha(),esdTrack->GetConstrainedParam()->GetParameter(),esdTrack->GetConstrainedParam()->GetCovariance()); |
85c4406e | 1527 | |
d7601185 | 1528 | track->GetPxPyPz(pTrack) ; |
85c4406e | 1529 | |
a9b8c1d0 | 1530 | } |
1531 | else continue; | |
f5500c7a | 1532 | } |
d7601185 | 1533 | else continue; |
a9b8c1d0 | 1534 | } |
da91abdb | 1535 | } // ESD |
a5fb4114 | 1536 | else if(fDataType==kAOD) |
1537 | { | |
743aa53a | 1538 | AliAODTrack *aodtrack = dynamic_cast <AliAODTrack*>(track); |
a9b8c1d0 | 1539 | |
d2655d46 | 1540 | if(aodtrack) |
1541 | { | |
85c4406e | 1542 | if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS():AOD track type: %d (primary %d), hybrid? %d \n", |
1543 | aodtrack->GetType(),AliAODTrack::kPrimary, | |
1544 | aodtrack->IsHybridGlobalConstrainedGlobal()); | |
21812953 | 1545 | |
6f20e2a6 | 1546 | if (fSelectHybridTracks && fTrackFilterMaskComplementary == 0) |
21812953 | 1547 | { |
da91abdb | 1548 | if (!aodtrack->IsHybridGlobalConstrainedGlobal()) continue ; |
21812953 | 1549 | } |
85c4406e | 1550 | else |
da91abdb | 1551 | { |
6f20e2a6 | 1552 | Bool_t accept = aodtrack->TestFilterBit(fTrackFilterMask); |
1553 | ||
1554 | if(!fSelectHybridTracks && !accept) continue ; | |
1555 | ||
1556 | if(fSelectHybridTracks) | |
1557 | { | |
1558 | Bool_t acceptcomplement = aodtrack->TestFilterBit(fTrackFilterMaskComplementary); | |
1559 | if (!accept && !acceptcomplement) continue ; | |
1560 | } | |
da91abdb | 1561 | } |
1562 | ||
f5500c7a | 1563 | if(fSelectSPDHitTracks) |
1564 | {//Not much sense to use with TPC only or Hybrid tracks | |
1565 | if(!aodtrack->HasPointOnITSLayer(0) && !aodtrack->HasPointOnITSLayer(1)) continue ; | |
1566 | } | |
1567 | ||
7eb4c4a8 | 1568 | if ( fSelectFractionTPCSharedClusters ) |
6f20e2a6 | 1569 | { |
7eb4c4a8 | 1570 | Double_t frac = Double_t(aodtrack->GetTPCnclsS()) / Double_t(aodtrack->GetTPCncls()); |
1571 | if (frac > fCutTPCSharedClustersFraction) | |
1572 | { | |
1573 | if (fDebug > 2 )printf("\t Reject track, shared cluster fraction %f > %f\n",frac, fCutTPCSharedClustersFraction); | |
1574 | continue ; | |
1575 | } | |
6f20e2a6 | 1576 | } |
da91abdb | 1577 | |
7eb4c4a8 | 1578 | if ( fSelectPrimaryTracks ) |
1579 | { | |
1580 | if ( aodtrack->GetType()!= AliAODTrack::kPrimary ) | |
1581 | { | |
1582 | if (fDebug > 2 ) printf("\t Remove not primary track\n"); | |
1583 | continue ; | |
1584 | } | |
1585 | } | |
1586 | ||
1587 | if (fDebug > 2 ) printf("\t accepted track! \n"); | |
a9b8c1d0 | 1588 | |
438953f7 | 1589 | //In case of AODs, TPC tracks cannot be propagated back to primary vertex, |
1590 | // info stored here | |
1591 | dcaTPC = aodtrack->DCA(); | |
1592 | ||
a9b8c1d0 | 1593 | track->GetPxPyPz(pTrack) ; |
da91abdb | 1594 | |
1595 | } // aod track exists | |
1596 | else continue ; | |
1597 | ||
1598 | } // AOD | |
3b13c34c | 1599 | |
9b1587f6 | 1600 | // TOF cuts |
cc944149 | 1601 | Bool_t okTOF = ( (status & AliVTrack::kTOFout) == AliVTrack::kTOFout ) ; |
1602 | Double_t tof = -1000; | |
4b7f6e01 | 1603 | Int_t trackBC = -1000 ; |
1604 | ||
9b1587f6 | 1605 | if(fAccessTrackTOF) |
d2655d46 | 1606 | { |
9b1587f6 | 1607 | if(okTOF) |
1608 | { | |
1609 | trackBC = track->GetTOFBunchCrossing(bz); | |
1610 | SetTrackEventBC(trackBC+9); | |
1611 | ||
1612 | tof = track->GetTOFsignal()*1e-3; | |
1613 | ||
1614 | //After selecting tracks with small DCA, pointing to vertex, set vertex BC depeding on tracks BC | |
1615 | if(fRecalculateVertexBC) | |
1616 | { | |
1617 | if (trackBC != 0 && trackBC != AliVTrack::kTOFBCNA) fVertexBC = trackBC; | |
1618 | else if(trackBC == 0) bc0 = kTRUE; | |
1619 | } | |
1620 | ||
1621 | //In any case, the time should to be larger than the fixed window ... | |
1622 | if( fUseTrackTimeCut && (trackBC !=0 || tof < fTrackTimeCutMin || tof > fTrackTimeCutMax) ) | |
1623 | { | |
1624 | //printf("Remove track time %f and bc = %d\n",tof,trackBC); | |
1625 | continue ; | |
1626 | } | |
1627 | //else printf("Accept track time %f and bc = %d\n",tof,trackBC); | |
1628 | } | |
975b29fa | 1629 | } |
85c4406e | 1630 | |
9b1587f6 | 1631 | TLorentzVector momentum(pTrack[0],pTrack[1],pTrack[2],0); |
1632 | ||
1633 | // DCA cuts | |
1634 | ||
689d9f15 | 1635 | if(fUseTrackDCACut) |
1636 | { | |
cc944149 | 1637 | //normal way to get the dca, cut on dca_xy |
1638 | if(dcaTPC==-999) | |
689d9f15 | 1639 | { |
1640 | Double_t dca[2] = {1e6,1e6}; | |
1641 | Double_t covar[3] = {1e6,1e6,1e6}; | |
438953f7 | 1642 | Bool_t okDCA = track->PropagateToDCA(fInputEvent->GetPrimaryVertex(),bz,100.,dca,covar); |
1643 | if( okDCA) okDCA = AcceptDCA(momentum.Pt(),dca[0]); | |
1644 | if(!okDCA) | |
1645 | { | |
9b1587f6 | 1646 | //printf("AliCaloTrackReader::FillInputCTS() - Reject track pt %2.2f, dca_xy %2.4f\n",momentum.Pt(),dca[0]); |
438953f7 | 1647 | continue ; |
1648 | } | |
689d9f15 | 1649 | } |
1650 | }// DCA cuts | |
1651 | ||
2644ead9 | 1652 | //Count the tracks in eta < 0.9 |
2644ead9 | 1653 | if(TMath::Abs(track->Eta())< fTrackMultEtaCut) fTrackMult++; |
1654 | ||
1655 | if(fCTSPtMin > momentum.Pt() || fCTSPtMax < momentum.Pt()) continue ; | |
1656 | ||
9b1587f6 | 1657 | // Check effect of cuts on track BC |
1658 | if(fAccessTrackTOF && okTOF) SetTrackEventBCcut(trackBC+9); | |
1659 | ||
2644ead9 | 1660 | if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue; |
1661 | ||
975b29fa | 1662 | if(fDebug > 2 && momentum.Pt() > 0.1) |
6f20e2a6 | 1663 | printf("AliCaloTrackReader::FillInputCTS() - Selected tracks pt %3.2f, phi %3.2f, eta %3.2f\n", |
1664 | momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); | |
975b29fa | 1665 | |
1666 | if (fMixedEvent) track->SetID(itrack); | |
85c4406e | 1667 | |
667a3592 | 1668 | if(fAcceptOnlyHIJINGLabels && !IsHIJINGLabel(track->GetLabel())) continue ; |
43cd6c94 | 1669 | |
975b29fa | 1670 | fCTSTracks->Add(track); |
1671 | ||
c8fe2783 | 1672 | }// track loop |
1673 | ||
9b1587f6 | 1674 | if( fRecalculateVertexBC && (fVertexBC == 0 || fVertexBC == AliVTrack::kTOFBCNA)) |
cc944149 | 1675 | { |
1676 | if( bc0 ) fVertexBC = 0 ; | |
1677 | else fVertexBC = AliVTrack::kTOFBCNA ; | |
1678 | } | |
1679 | ||
975b29fa | 1680 | if(fDebug > 1) |
be518ab0 | 1681 | printf("AliCaloTrackReader::FillInputCTS() - aod entries %d, input tracks %d, pass status %d, multipliticy %d\n", fCTSTracks->GetEntriesFast(), nTracks, nstatus, fTrackMult);//fCTSTracksNormalInputEntries); |
836b6989 | 1682 | |
c8fe2783 | 1683 | } |
1684 | ||
8a2dbbff | 1685 | //_______________________________________________________________________________ |
1686 | void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus, Int_t iclus) | |
836b6989 | 1687 | { |
c4eec29f | 1688 | //Fill the EMCAL data in the array, do it |
85c4406e | 1689 | |
1690 | Int_t vindex = 0 ; | |
1691 | if (fMixedEvent) | |
c4eec29f | 1692 | vindex = fMixedEvent->EventIndexForCaloCluster(iclus); |
1693 | ||
d2655d46 | 1694 | if(fRecalculateClusters) |
1695 | { | |
35954a8e | 1696 | //Recalibrate the cluster energy |
d2655d46 | 1697 | if(GetCaloUtils()->IsRecalibrationOn()) |
1698 | { | |
b487d080 | 1699 | Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, GetEMCALCells()); |
9e8998b1 | 1700 | |
b487d080 | 1701 | clus->SetE(energy); |
35954a8e | 1702 | //printf("Recalibrated Energy %f\n",clus->E()); |
9e8998b1 | 1703 | |
b487d080 | 1704 | GetCaloUtils()->RecalculateClusterShowerShapeParameters(GetEMCALCells(),clus); |
1705 | GetCaloUtils()->RecalculateClusterPID(clus); | |
9e8998b1 | 1706 | |
b487d080 | 1707 | } // recalculate E |
1708 | ||
1709 | //Recalculate distance to bad channels, if new list of bad channels provided | |
1710 | GetCaloUtils()->RecalculateClusterDistanceToBadChannel(GetEMCALCells(),clus); | |
1711 | ||
1712 | //Recalculate cluster position | |
d2655d46 | 1713 | if(GetCaloUtils()->IsRecalculationOfClusterPositionOn()) |
1714 | { | |
35954a8e | 1715 | GetCaloUtils()->RecalculateClusterPosition(GetEMCALCells(),clus); |
b487d080 | 1716 | //clus->GetPosition(pos); |
1717 | //printf("After Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]); | |
1718 | } | |
c4eec29f | 1719 | |
f46af216 | 1720 | // Recalculate TOF |
35954a8e | 1721 | if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn()) |
d2655d46 | 1722 | { |
f46af216 | 1723 | Double_t tof = clus->GetTOF(); |
1724 | Float_t frac =-1; | |
1725 | Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac); | |
1726 | ||
d2655d46 | 1727 | if(fDataType==AliCaloTrackReader::kESD) |
35954a8e | 1728 | { |
f46af216 | 1729 | tof = fEMCALCells->GetCellTime(absIdMax); |
1730 | } | |
1731 | ||
1732 | GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof); | |
1733 | ||
1734 | clus->SetTOF(tof); | |
1735 | ||
35954a8e | 1736 | }// Time recalibration |
f46af216 | 1737 | } |
b487d080 | 1738 | |
35954a8e | 1739 | //Reject clusters with bad channels, close to borders and exotic; |
1740 | if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) return; | |
1741 | ||
1742 | //Mask all cells in collumns facing ALICE thick material if requested | |
1743 | if(GetCaloUtils()->GetNMaskCellColumns()) | |
1744 | { | |
1745 | Int_t absId = -1; | |
1746 | Int_t iSupMod = -1; | |
1747 | Int_t iphi = -1; | |
1748 | Int_t ieta = -1; | |
1749 | Bool_t shared = kFALSE; | |
1750 | GetCaloUtils()->GetEMCALRecoUtils()->GetMaxEnergyCell(GetCaloUtils()->GetEMCALGeometry(), GetEMCALCells(),clus,absId,iSupMod,ieta,iphi,shared); | |
1751 | if(GetCaloUtils()->MaskFrameCluster(iSupMod, ieta)) return; | |
1752 | } | |
1753 | ||
1754 | if(fSelectEmbeddedClusters) | |
1755 | { | |
1756 | if(clus->GetNLabels()==0 || clus->GetLabel() < 0) return; | |
1757 | //else printf("Embedded cluster, %d, n label %d label %d \n",iclus,clus->GetNLabels(),clus->GetLabel()); | |
1758 | } | |
1759 | ||
1760 | //Float_t pos[3]; | |
1761 | //clus->GetPosition(pos); | |
1762 | //printf("Before Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]); | |
1763 | ||
b487d080 | 1764 | //Correct non linearity |
ac207ee4 | 1765 | if(fCorrectELinearity && GetCaloUtils()->IsCorrectionOfClusterEnergyOn()) |
d2655d46 | 1766 | { |
b487d080 | 1767 | GetCaloUtils()->CorrectClusterEnergy(clus) ; |
b487d080 | 1768 | |
1769 | //In case of MC analysis, to match resolution/calibration in real data | |
1770 | Float_t rdmEnergy = GetCaloUtils()->GetEMCALRecoUtils()->SmearClusterEnergy(clus); | |
1771 | // printf("\t Energy %f, smeared %f\n", clus->E(),rdmEnergy); | |
1772 | clus->SetE(rdmEnergy); | |
c4eec29f | 1773 | } |
ac207ee4 | 1774 | |
975b29fa | 1775 | Double_t tof = clus->GetTOF()*1e9; |
85c4406e | 1776 | |
975b29fa | 1777 | Int_t bc = TMath::Nint(tof/50) + 9; |
1778 | //printf("tof %2.2f, bc+5=%d\n",tof,bc); | |
1779 | ||
1780 | SetEMCalEventBC(bc); | |
1781 | ||
1782 | if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) return ; | |
85c4406e | 1783 | |
b487d080 | 1784 | TLorentzVector momentum ; |
1785 | ||
975b29fa | 1786 | clus->GetMomentum(momentum, fVertex[vindex]); |
b487d080 | 1787 | |
ff440946 | 1788 | if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return ; |
ca0c58aa | 1789 | |
975b29fa | 1790 | SetEMCalEventBCcut(bc); |
85c4406e | 1791 | |
975b29fa | 1792 | if(!IsInTimeWindow(tof,clus->E())) |
ff440946 | 1793 | { |
3c1a2e95 | 1794 | fNPileUpClusters++ ; |
4b7f6e01 | 1795 | if(fUseEMCALTimeCut) return ; |
ff440946 | 1796 | } |
3c1a2e95 | 1797 | else |
1798 | fNNonPileUpClusters++; | |
975b29fa | 1799 | |
85c4406e | 1800 | if(fDebug > 2 && momentum.E() > 0.1) |
b487d080 | 1801 | printf("AliCaloTrackReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", |
1802 | momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); | |
836b6989 | 1803 | |
85c4406e | 1804 | if (fMixedEvent) |
1805 | clus->SetID(iclus) ; | |
b487d080 | 1806 | |
667a3592 | 1807 | if(fAcceptOnlyHIJINGLabels && !IsHIJINGLabel( clus->GetLabel() )) return ; |
1808 | ||
1809 | // if(fAcceptOnlyHIJINGLabels) | |
43cd6c94 | 1810 | // { |
667a3592 | 1811 | // printf("Accept label %d?\n",clus->GetLabel()); |
1812 | // | |
1813 | // if( !IsHIJINGLabel( clus->GetLabel() ) ) { printf("\t Reject label\n") ; return ; } | |
1814 | // else printf("\t Accept label\n") ; | |
43cd6c94 | 1815 | // } |
2644ead9 | 1816 | |
2644ead9 | 1817 | fEMCALClusters->Add(clus); |
1818 | ||
c4eec29f | 1819 | } |
1820 | ||
836b6989 | 1821 | //_______________________________________ |
85c4406e | 1822 | void AliCaloTrackReader::FillInputEMCAL() |
836b6989 | 1823 | { |
f37fa8d2 | 1824 | //Return array with EMCAL clusters in aod format |
c8fe2783 | 1825 | |
f37fa8d2 | 1826 | if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputEMCAL()\n"); |
1827 | ||
3bfc4732 | 1828 | // First recalibrate cells, time or energy |
1829 | // if(GetCaloUtils()->IsRecalibrationOn()) | |
85c4406e | 1830 | // GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCells(GetCaloUtils()->GetEMCALGeometry(), |
1831 | // GetEMCALCells(), | |
3bfc4732 | 1832 | // fInputEvent->GetBunchCrossNumber()); |
1833 | ||
3c1a2e95 | 1834 | fNPileUpClusters = 0; // Init counter |
1835 | fNNonPileUpClusters = 0; // Init counter | |
975b29fa | 1836 | for(Int_t i = 0; i < 19; i++) |
1837 | { | |
1838 | fEMCalBCEvent [i] = 0; | |
1839 | fEMCalBCEventCut[i] = 0; | |
1840 | } | |
3c1a2e95 | 1841 | |
f37fa8d2 | 1842 | //Loop to select clusters in fiducial cut and fill container with aodClusters |
029dea5a | 1843 | if(fEMCALClustersListName=="") |
1844 | { | |
c4eec29f | 1845 | Int_t nclusters = fInputEvent->GetNumberOfCaloClusters(); |
85c4406e | 1846 | for (Int_t iclus = 0; iclus < nclusters; iclus++) |
d2655d46 | 1847 | { |
c4eec29f | 1848 | AliVCluster * clus = 0; |
85c4406e | 1849 | if ( (clus = fInputEvent->GetCaloCluster(iclus)) ) |
d2655d46 | 1850 | { |
029dea5a | 1851 | if (IsEMCALCluster(clus)) |
85c4406e | 1852 | { |
c4eec29f | 1853 | FillInputEMCALAlgorithm(clus, iclus); |
1854 | }//EMCAL cluster | |
1855 | }// cluster exists | |
1856 | }// cluster loop | |
385b7abf | 1857 | |
1858 | //Recalculate track matching | |
a38a48f2 | 1859 | GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent); |
385b7abf | 1860 | |
c4eec29f | 1861 | }//Get the clusters from the input event |
d2655d46 | 1862 | else |
1863 | { | |
85c4406e | 1864 | TClonesArray * clusterList = 0x0; |
7842c845 | 1865 | |
1866 | if (fInputEvent->FindListObject(fEMCALClustersListName)) | |
1867 | { | |
24026a5c | 1868 | clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName)); |
7842c845 | 1869 | } |
1870 | else if(fOutputEvent) | |
24026a5c | 1871 | { |
7842c845 | 1872 | clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName)); |
1873 | } | |
1874 | ||
d2655d46 | 1875 | if(!clusterList) |
1876 | { | |
85c4406e | 1877 | printf("AliCaloTrackReader::FillInputEMCAL() - Wrong name of list with clusters? <%s>\n",fEMCALClustersListName.Data()); |
1878 | return; | |
c4eec29f | 1879 | } |
ca0c58aa | 1880 | |
c4eec29f | 1881 | Int_t nclusters = clusterList->GetEntriesFast(); |
85c4406e | 1882 | for (Int_t iclus = 0; iclus < nclusters; iclus++) |
d2655d46 | 1883 | { |
c4eec29f | 1884 | AliVCluster * clus = dynamic_cast<AliVCluster*> (clusterList->At(iclus)); |
1885 | //printf("E %f\n",clus->E()); | |
e615d952 | 1886 | if (clus) FillInputEMCALAlgorithm(clus, iclus); |
1887 | else printf("AliCaloTrackReader::FillInputEMCAL() - Null cluster in list!\n"); | |
c4eec29f | 1888 | }// cluster loop |
385b7abf | 1889 | |
24026a5c | 1890 | // Recalculate the pile-up time, in case long time clusters removed during clusterization |
1891 | //printf("Input event INIT : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters); | |
85c4406e | 1892 | |
24026a5c | 1893 | fNPileUpClusters = 0; // Init counter |
1894 | fNNonPileUpClusters = 0; // Init counter | |
975b29fa | 1895 | for(Int_t i = 0; i < 19; i++) |
1896 | { | |
1897 | fEMCalBCEvent [i] = 0; | |
1898 | fEMCalBCEventCut[i] = 0; | |
1899 | } | |
24026a5c | 1900 | |
1901 | for (Int_t iclus = 0; iclus < fInputEvent->GetNumberOfCaloClusters(); iclus++) | |
1902 | { | |
1903 | AliVCluster * clus = 0; | |
1904 | ||
1905 | if ( (clus = fInputEvent->GetCaloCluster(iclus)) ) | |
1906 | { | |
1907 | if (IsEMCALCluster(clus)) | |
1908 | { | |
1909 | ||
24026a5c | 1910 | Float_t frac =-1; |
1911 | Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac); | |
1912 | Double_t tof = clus->GetTOF(); | |
1913 | GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof); | |
1914 | tof*=1e9; | |
85c4406e | 1915 | |
24026a5c | 1916 | //printf("Input event cluster : AbsIdMax %d, E %2.2f, time %2.2f \n", absIdMax,clus->E(),tof); |
85c4406e | 1917 | |
24026a5c | 1918 | //Reject clusters with bad channels, close to borders and exotic; |
1919 | if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) continue; | |
85c4406e | 1920 | |
975b29fa | 1921 | Int_t bc = TMath::Nint(tof/50) + 9; |
1922 | SetEMCalEventBC(bc); | |
1923 | ||
1924 | if(fEMCALPtMin > clus->E() || fEMCALPtMax < clus->E()) continue ; | |
85c4406e | 1925 | |
975b29fa | 1926 | TLorentzVector momentum ; |
1927 | ||
1928 | clus->GetMomentum(momentum, fVertex[0]); | |
1929 | ||
1930 | if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return ; | |
85c4406e | 1931 | |
975b29fa | 1932 | SetEMCalEventBCcut(bc); |
85c4406e | 1933 | |
24026a5c | 1934 | if(!IsInTimeWindow(tof,clus->E())) |
24026a5c | 1935 | fNPileUpClusters++ ; |
24026a5c | 1936 | else |
1937 | fNNonPileUpClusters++; | |
975b29fa | 1938 | |
24026a5c | 1939 | } |
1940 | } | |
1941 | } | |
1942 | ||
1943 | //printf("Input event : Pile-up clusters %d, NO pile-up %d\n",fNPileUpClusters,fNNonPileUpClusters); | |
1944 | ||
cb5780f4 | 1945 | // Recalculate track matching, not necessary if already done in the reclusterization task. |
1946 | // in case it was not done ... | |
1947 | GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent,clusterList); | |
385b7abf | 1948 | |
c4eec29f | 1949 | } |
85c4406e | 1950 | |
3c1a2e95 | 1951 | if(fDebug > 1) printf("AliCaloTrackReader::FillInputEMCAL() - aod entries %d, n pile-up clusters %d, n non pile-up %d \n", fEMCALClusters->GetEntriesFast(),fNPileUpClusters,fNNonPileUpClusters); |
c8fe2783 | 1952 | |
c8fe2783 | 1953 | } |
1954 | ||
836b6989 | 1955 | //______________________________________ |
85c4406e | 1956 | void AliCaloTrackReader::FillInputPHOS() |
836b6989 | 1957 | { |
f37fa8d2 | 1958 | //Return array with PHOS clusters in aod format |
c8fe2783 | 1959 | |
f37fa8d2 | 1960 | if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputPHOS()\n"); |
b487d080 | 1961 | |
f37fa8d2 | 1962 | //Loop to select clusters in fiducial cut and fill container with aodClusters |
c8fe2783 | 1963 | Int_t nclusters = fInputEvent->GetNumberOfCaloClusters(); |
85c4406e | 1964 | for (Int_t iclus = 0; iclus < nclusters; iclus++) |
d2655d46 | 1965 | { |
c8fe2783 | 1966 | AliVCluster * clus = 0; |
85c4406e | 1967 | if ( (clus = fInputEvent->GetCaloCluster(iclus)) ) |
d2655d46 | 1968 | { |
029dea5a | 1969 | if (IsPHOSCluster(clus)) |
1970 | { | |
f37fa8d2 | 1971 | //Check if the cluster contains any bad channel and if close to calorimeter borders |
85c4406e | 1972 | Int_t vindex = 0 ; |
1973 | if (fMixedEvent) | |
c8fe2783 | 1974 | vindex = fMixedEvent->EventIndexForCaloCluster(iclus); |
85c4406e | 1975 | if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells())) |
c8fe2783 | 1976 | continue; |
85c4406e | 1977 | if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells(), fInputEvent, vindex)) |
c8fe2783 | 1978 | continue; |
836b6989 | 1979 | |
d2655d46 | 1980 | if(fRecalculateClusters) |
1981 | { | |
85c4406e | 1982 | //Recalibrate the cluster energy |
1983 | if(GetCaloUtils()->IsRecalibrationOn()) | |
d2655d46 | 1984 | { |
b487d080 | 1985 | Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells()); |
1986 | clus->SetE(energy); | |
1987 | } | |
b487d080 | 1988 | } |
c8fe2783 | 1989 | |
1990 | TLorentzVector momentum ; | |
1991 | ||
85c4406e | 1992 | clus->GetMomentum(momentum, fVertex[vindex]); |
c8fe2783 | 1993 | |
ca0c58aa | 1994 | if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue; |
1995 | ||
1996 | if(fPHOSPtMin > momentum.E() || fPHOSPtMax < momentum.E()) continue; | |
b487d080 | 1997 | |
85c4406e | 1998 | if(fDebug > 2 && momentum.E() > 0.1) |
b487d080 | 1999 | printf("AliCaloTrackReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n", |
85c4406e | 2000 | momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta()); |
b487d080 | 2001 | |
b487d080 | 2002 | |
85c4406e | 2003 | if (fMixedEvent) |
d2655d46 | 2004 | { |
85c4406e | 2005 | clus->SetID(iclus) ; |
2006 | } | |
b487d080 | 2007 | |
667a3592 | 2008 | if(fAcceptOnlyHIJINGLabels && !IsHIJINGLabel(clus->GetLabel())) continue ; |
43cd6c94 | 2009 | |
85c4406e | 2010 | fPHOSClusters->Add(clus); |
b487d080 | 2011 | |
c8fe2783 | 2012 | }//PHOS cluster |
2013 | }//cluster exists | |
2014 | }//esd cluster loop | |
2015 | ||
b487d080 | 2016 | if(fDebug > 1) printf("AliCaloTrackReader::FillInputPHOS() - aod entries %d\n", fPHOSClusters->GetEntriesFast()); |
2017 | ||
c8fe2783 | 2018 | } |
2019 | ||
836b6989 | 2020 | //____________________________________________ |
85c4406e | 2021 | void AliCaloTrackReader::FillInputEMCALCells() |
836b6989 | 2022 | { |
743aa53a | 2023 | //Return array with EMCAL cells in aod format |
c8fe2783 | 2024 | |
85c4406e | 2025 | fEMCALCells = fInputEvent->GetEMCALCells(); |
c8fe2783 | 2026 | |
2027 | } | |
2028 | ||
836b6989 | 2029 | //___________________________________________ |
85c4406e | 2030 | void AliCaloTrackReader::FillInputPHOSCells() |
836b6989 | 2031 | { |
743aa53a | 2032 | //Return array with PHOS cells in aod format |
c8fe2783 | 2033 | |
85c4406e | 2034 | fPHOSCells = fInputEvent->GetPHOSCells(); |
c8fe2783 | 2035 | |
2036 | } | |
2037 | ||
836b6989 | 2038 | //_______________________________________ |
2039 | void AliCaloTrackReader::FillInputVZERO() | |
2040 | { | |
be518ab0 | 2041 | //Fill VZERO information in data member, add all the channels information. |
2042 | AliVVZERO* v0 = fInputEvent->GetVZEROData(); | |
2043 | //printf("Init V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]); | |
2044 | ||
85c4406e | 2045 | if (v0) |
be518ab0 | 2046 | { |
2047 | AliESDVZERO* esdV0 = dynamic_cast<AliESDVZERO*> (v0); | |
2048 | for (Int_t i = 0; i < 32; i++) | |
2049 | { | |
029dea5a | 2050 | if(esdV0) |
2051 | {//Only available in ESDs | |
be518ab0 | 2052 | fV0ADC[0] += (Int_t)esdV0->GetAdcV0C(i); |
2053 | fV0ADC[1] += (Int_t)esdV0->GetAdcV0A(i); | |
2054 | } | |
029dea5a | 2055 | |
be518ab0 | 2056 | fV0Mul[0] += (Int_t)v0->GetMultiplicityV0C(i); |
2057 | fV0Mul[1] += (Int_t)v0->GetMultiplicityV0A(i); | |
2058 | } | |
2059 | if(fDebug > 0) | |
b62d68b3 | 2060 | printf("AliCaloTrackReader::FillInputVZERO() - ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]); |
be518ab0 | 2061 | } |
2062 | else | |
2063 | { | |
713a258b | 2064 | if(fDebug > 0) |
b62d68b3 | 2065 | printf("AliCaloTrackReader::FillInputVZERO() - Cannot retrieve V0 ESD! Run w/ null V0 charges\n "); |
be518ab0 | 2066 | } |
2067 | } | |
2068 | ||
43cd6c94 | 2069 | //_________________________________________________ |
2070 | void AliCaloTrackReader::FillInputNonStandardJets() | |
2071 | { | |
2072 | // | |
2073 | //fill array with non standard jets | |
2074 | // | |
2075 | // Adam T. Matyja | |
2076 | ||
2077 | if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputNonStandardJets()\n"); | |
2078 | // | |
2079 | //check if branch name is given | |
2080 | if(!fInputNonStandardJetBranchName.Length()) | |
2081 | { | |
2082 | Printf("No non-standard jet branch name specified. Specify among existing ones."); | |
2083 | fInputEvent->Print(); | |
2084 | abort(); | |
2085 | } | |
2086 | ||
2087 | fNonStandardJets = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(fInputNonStandardJetBranchName.Data())); | |
2088 | ||
2089 | if(!fNonStandardJets) | |
2090 | { | |
2091 | //check if jet branch exist; exit if not | |
2092 | Printf("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputNonStandardJetBranchName.Data()); | |
2093 | fInputEvent->Print(); | |
2094 | abort(); | |
2095 | } | |
2096 | else | |
2097 | { | |
2098 | if(fDebug > 1) | |
2099 | printf("AliCaloTrackReader::FillInputNonStandardJets() - aod input jets %d\n", fNonStandardJets->GetEntriesFast() ); | |
2100 | } | |
2101 | ||
2102 | } | |
f37fa8d2 | 2103 | |
d6d84709 | 2104 | //_________________________________________________ |
2105 | void AliCaloTrackReader::FillInputBackgroundJets() | |
2106 | { | |
2107 | // | |
2108 | //fill array with Background jets | |
2109 | // | |
2110 | // Adam T. Matyja | |
2111 | ||
2112 | if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputBackgroundJets()\n"); | |
2113 | // | |
2114 | //check if branch name is given | |
2115 | if(!fInputBackgroundJetBranchName.Length()) | |
2116 | { | |
2117 | Printf("No background jet branch name specified. Specify among existing ones."); | |
2118 | fInputEvent->Print(); | |
2119 | abort(); | |
2120 | } | |
2121 | ||
2122 | fBackgroundJets = (AliAODJetEventBackground*)(fInputEvent->FindListObject(fInputBackgroundJetBranchName.Data())); | |
2123 | ||
2124 | if(!fBackgroundJets) | |
2125 | { | |
2126 | //check if jet branch exist; exit if not | |
2127 | Printf("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputBackgroundJetBranchName.Data()); | |
2128 | fInputEvent->Print(); | |
2129 | abort(); | |
2130 | } | |
2131 | else | |
2132 | { | |
2133 | if(fDebug > 1){ | |
2134 | printf("AliCaloTrackReader::FillInputBackgroundJets()\n"); | |
2135 | fBackgroundJets->Print(""); | |
2136 | } | |
2137 | } | |
2138 | ||
2139 | } | |
2140 | ||
2141 | ||
c5693f62 | 2142 | //________________________________________________ |
2143 | Bool_t AliCaloTrackReader::CheckForPrimaryVertex() | |
2144 | { | |
fb822d4e | 2145 | //Check if the vertex was well reconstructed, copy of conversion group |
ad30b142 | 2146 | |
fb822d4e | 2147 | if(fDataType==kESD) |
d2655d46 | 2148 | { |
fb822d4e | 2149 | AliESDEvent * esdevent = dynamic_cast<AliESDEvent*> (fInputEvent); |
2150 | if(!esdevent) return kFALSE; | |
2151 | ||
2152 | if(esdevent->GetPrimaryVertex()->GetNContributors() > 0) | |
2153 | { | |
2154 | return kTRUE; | |
2155 | } | |
2156 | ||
2157 | if(esdevent->GetPrimaryVertex()->GetNContributors() < 1) | |
2158 | { | |
2159 | // SPD vertex | |
2160 | if(esdevent->GetPrimaryVertexSPD()->GetNContributors() > 0) | |
2161 | { | |
2162 | return kTRUE; | |
2163 | ||
2164 | } | |
2165 | if(esdevent->GetPrimaryVertexSPD()->GetNContributors() < 1) | |
2166 | { | |
2167 | return kFALSE; | |
2168 | } | |
2169 | } | |
ad30b142 | 2170 | } |
fb822d4e | 2171 | else if(fDataType==kAOD) |
d2655d46 | 2172 | { |
fb822d4e | 2173 | AliAODEvent * aodevent = dynamic_cast<AliAODEvent*>(fInputEvent); |
2174 | if(!aodevent) return kFALSE; | |
2175 | ||
2176 | if (aodevent->GetPrimaryVertex() != NULL) | |
d2655d46 | 2177 | { |
fb822d4e | 2178 | if(aodevent->GetPrimaryVertex()->GetNContributors() > 0) |
2179 | { | |
2180 | return kTRUE; | |
2181 | } | |
48c37e02 | 2182 | } |
fb822d4e | 2183 | |
2184 | if(aodevent->GetPrimaryVertexSPD() != NULL) | |
d2655d46 | 2185 | { |
fb822d4e | 2186 | if(aodevent->GetPrimaryVertexSPD()->GetNContributors() > 0) |
2187 | { | |
2188 | return kTRUE; | |
2189 | } | |
2190 | else | |
2191 | { | |
2192 | AliWarning(Form("Number of contributors from bad vertex type:: %s",aodevent->GetPrimaryVertex()->GetName())); | |
2193 | return kFALSE; | |
2194 | } | |
48c37e02 | 2195 | } |
48c37e02 | 2196 | } |
fb822d4e | 2197 | else return kTRUE; |
48c37e02 | 2198 | |
85c4406e | 2199 | return kFALSE; |
48c37e02 | 2200 | |
2201 | } | |
2202 | ||
85c4406e | 2203 | //________________________________________________________________________________ |
8a2dbbff | 2204 | TArrayI AliCaloTrackReader::GetTriggerPatches(Int_t tmin, Int_t tmax ) |
c2a62a94 | 2205 | { |
d9bea110 | 2206 | // Select the patches that triggered |
2207 | // Depend on L0 or L1 | |
2208 | ||
c2a62a94 | 2209 | // some variables |
2210 | Int_t trigtimes[30], globCol, globRow,ntimes, i; | |
2211 | Int_t absId = -1; //[100]; | |
2212 | Int_t nPatch = 0; | |
d9bea110 | 2213 | |
c2a62a94 | 2214 | TArrayI patches(0); |
85c4406e | 2215 | |
c2a62a94 | 2216 | // get object pointer |
2217 | AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" ); | |
b62d68b3 | 2218 | |
93c2e459 | 2219 | // Recover the threshold of the event that triggered, only possible for L1 |
5737e185 | 2220 | if(!fTriggerL1EventThresholdFix) |
2221 | { | |
2222 | if(fBitEGA==6) | |
2223 | { | |
2224 | if (IsEventEMCALL1Gamma1()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(1); | |
2225 | else if(IsEventEMCALL1Gamma2()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(3); | |
2226 | else if(IsEventEMCALL1Jet1 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(0); | |
2227 | else if(IsEventEMCALL1Jet2 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(2); | |
2228 | ||
2229 | // printf("L1 trigger Threshold Jet1 %f, Gamma1 %f, Jet2 %f, Gamma2 %f\n", | |
2230 | // 0.07874*caloTrigger->GetL1Threshold(0), | |
2231 | // 0.07874*caloTrigger->GetL1Threshold(1), | |
2232 | // 0.07874*caloTrigger->GetL1Threshold(2), | |
2233 | // 0.07874*caloTrigger->GetL1Threshold(3)); | |
2234 | } | |
2235 | else | |
2236 | { | |
2237 | // Old AOD data format, in such case, order of thresholds different!!! | |
2238 | if (IsEventEMCALL1Gamma1()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(0); | |
2239 | else if(IsEventEMCALL1Gamma2()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(2); | |
2240 | else if(IsEventEMCALL1Jet1 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(1); | |
2241 | else if(IsEventEMCALL1Jet2 ()) fTriggerL1EventThreshold = 0.07874*caloTrigger->GetL1Threshold(3); | |
2242 | ||
2243 | // printf("L1 trigger Threshold Jet1 %f, Gamma1 %f, Jet2 %f, Gamma2 %f\n", | |
2244 | // 0.07874*caloTrigger->GetL1Threshold(1), | |
2245 | // 0.07874*caloTrigger->GetL1Threshold(0), | |
2246 | // 0.07874*caloTrigger->GetL1Threshold(3), | |
2247 | // 0.07874*caloTrigger->GetL1Threshold(2)); | |
2248 | } | |
2249 | } | |
2250 | ||
48f32a76 | 2251 | //printf("CaloTrigger Entries %d\n",caloTrigger->GetEntries() ); |
b62d68b3 | 2252 | |
c2a62a94 | 2253 | // class is not empty |
2254 | if( caloTrigger->GetEntries() > 0 ) | |
2255 | { | |
2256 | // must reset before usage, or the class will fail | |
2257 | caloTrigger->Reset(); | |
b62d68b3 | 2258 | |
c2a62a94 | 2259 | // go throuth the trigger channels |
2260 | while( caloTrigger->Next() ) | |
2261 | { | |
2262 | // get position in global 2x2 tower coordinates | |
2263 | caloTrigger->GetPosition( globCol, globRow ); | |
b62d68b3 | 2264 | |
85c4406e | 2265 | //L0 |
2266 | if(IsEventEMCALL0()) | |
2267 | { | |
2268 | // get dimension of time arrays | |
2269 | caloTrigger->GetNL0Times( ntimes ); | |
2270 | ||
2271 | // no L0s in this channel | |
2272 | // presence of the channel in the iterator still does not guarantee that L0 was produced!! | |
2273 | if( ntimes < 1 ) | |
2274 | continue; | |
2275 | ||
2276 | // get timing array | |
2277 | caloTrigger->GetL0Times( trigtimes ); | |
48f32a76 | 2278 | //printf("Get L0 patch : n times %d - trigger time window %d - %d\n",ntimes, tmin,tmax); |
b62d68b3 | 2279 | |
85c4406e | 2280 | // go through the array |
2281 | for( i = 0; i < ntimes; i++ ) | |
2282 | { | |
2283 | // check if in cut - 8,9 shall be accepted in 2011 | |
2284 | if( trigtimes[i] >= tmin && trigtimes[i] <= tmax ) | |
2285 | { | |
2286 | //printf("Accepted trigger time %d \n",trigtimes[i]); | |
2287 | //if(nTrig > 99) continue; | |
2288 | GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol,globRow, absId); | |
48f32a76 | 2289 | //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absId); |
85c4406e | 2290 | patches.Set(nPatch+1); |
2291 | patches.AddAt(absId,nPatch++); | |
2292 | } | |
2293 | } // trigger time array | |
d9bea110 | 2294 | }//L0 |
85c4406e | 2295 | else if(IsEventEMCALL1()) // L1 |
2296 | { | |
2297 | Int_t bit = 0; | |
2298 | caloTrigger->GetTriggerBits(bit); | |
2299 | ||
b62d68b3 | 2300 | Int_t sum = 0; |
2301 | caloTrigger->GetL1TimeSum(sum); | |
5737e185 | 2302 | //fBitEGA-=2; |
eef22263 | 2303 | Bool_t isEGA1 = ((bit >> fBitEGA ) & 0x1) && IsEventEMCALL1Gamma1() ; |
2304 | Bool_t isEGA2 = ((bit >> (fBitEGA+1)) & 0x1) && IsEventEMCALL1Gamma2() ; | |
2305 | Bool_t isEJE1 = ((bit >> fBitEJE ) & 0x1) && IsEventEMCALL1Jet1 () ; | |
2306 | Bool_t isEJE2 = ((bit >> (fBitEJE+1)) & 0x1) && IsEventEMCALL1Jet2 () ; | |
85c4406e | 2307 | |
5737e185 | 2308 | //if((bit>> fBitEGA )&0x1) printf("Trig Bit %d - bit %d - EG1 %d - EG2 %d\n",fBitEGA ,bit,IsEventEMCALL1Gamma1(),IsEventEMCALL1Gamma2()); |
2309 | //if((bit>>(fBitEGA+1))&0x1) printf("Trig Bit %d - bit %d - EG1 %d - EG2 %d\n",fBitEGA+1,bit,IsEventEMCALL1Gamma1(),IsEventEMCALL1Gamma2()); | |
2310 | ||
b62d68b3 | 2311 | if(!isEGA1 && !isEJE1 && !isEGA2 && !isEJE2) continue; |
48f32a76 | 2312 | |
85c4406e | 2313 | Int_t patchsize = -1; |
b62d68b3 | 2314 | if (isEGA1 || isEGA2) patchsize = 2; |
2315 | else if (isEJE1 || isEJE2) patchsize = 16; | |
2316 | ||
2317 | //printf("**** Get L1 Patch: Bit %x, sum %d, patchsize %d, EGA1 %d, EGA2 %d, EJE1 %d, EJE2 %d, EGA bit %d, EJE bit %d, Trigger Gamma %d, Trigger Jet %d\n", | |
2318 | // bit,sum,patchsize,isEGA1,isEGA2,isEJE1,isEJE2,fBitEGA,fBitEJE,IsEventEMCALL1Gamma(),IsEventEMCALL1Jet()); | |
2319 | ||
85c4406e | 2320 | |
2321 | // add 2x2 (EGA) or 16x16 (EJE) patches | |
2322 | for(Int_t irow=0; irow < patchsize; irow++) | |
2323 | { | |
2324 | for(Int_t icol=0; icol < patchsize; icol++) | |
2325 | { | |
2326 | GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol+icol,globRow+irow, absId); | |
48f32a76 | 2327 | //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absId); |
85c4406e | 2328 | patches.Set(nPatch+1); |
2329 | patches.AddAt(absId,nPatch++); | |
2330 | } | |
2331 | } | |
2332 | ||
2333 | } // L1 | |
2334 | ||
c2a62a94 | 2335 | } // trigger iterator |
b62d68b3 | 2336 | } // go through triggers |
c2a62a94 | 2337 | |
b62d68b3 | 2338 | if(patches.GetSize()<=0) printf("AliCaloTrackReader::GetTriggerPatches() - No patch found! for triggers: %s and selected <%s>\n", |
2339 | GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data()); | |
2340 | //else printf(">>>>> N patches %d, test %d,first %d, last %d\n",patches.GetSize(), nPatch, patches.At(0), patches.At(patches.GetSize()-1)); | |
2341 | ||
c2a62a94 | 2342 | return patches; |
2343 | } | |
2344 | ||
afb3af8a | 2345 | //______________________________________________________________________ |
2346 | void AliCaloTrackReader::MatchTriggerCluster(TArrayI patches) | |
2347 | { | |
2348 | // Finds the cluster that triggered | |
2349 | ||
2350 | // Init info from previous event | |
2351 | fTriggerClusterIndex = -1; | |
2352 | fTriggerClusterId = -1; | |
afb3af8a | 2353 | fTriggerClusterBC = -10000; |
2354 | fIsExoticEvent = kFALSE; | |
2355 | fIsBadCellEvent = kFALSE; | |
1035a8d9 | 2356 | fIsBadMaxCellEvent = kFALSE; |
afb3af8a | 2357 | |
85c4406e | 2358 | fIsTriggerMatch = kFALSE; |
2359 | fIsTriggerMatchOpenCut[0] = kFALSE; | |
2360 | fIsTriggerMatchOpenCut[1] = kFALSE; | |
2361 | fIsTriggerMatchOpenCut[2] = kFALSE; | |
2362 | ||
afb3af8a | 2363 | // Do only analysis for triggered events |
d9bea110 | 2364 | if(!IsEventEMCALL1() && !IsEventEMCALL0()) |
afb3af8a | 2365 | { |
1035a8d9 | 2366 | fTriggerClusterBC = 0; |
afb3af8a | 2367 | return; |
2368 | } | |
2369 | ||
48f32a76 | 2370 | //printf("***** Try to match trigger to cluster %d **** L0 %d, L1 %d\n",fTriggerPatchClusterMatch,IsEventEMCALL0(),IsEventEMCALL1()); |
2371 | ||
afb3af8a | 2372 | //Recover the list of clusters |
2373 | TClonesArray * clusterList = 0; | |
2374 | if (fInputEvent->FindListObject(fEMCALClustersListName)) | |
2375 | { | |
2376 | clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName)); | |
2377 | } | |
2378 | else if(fOutputEvent) | |
2379 | { | |
2380 | clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName)); | |
2381 | } | |
2382 | ||
2383 | // Get number of clusters and of trigger patches | |
1035a8d9 | 2384 | Int_t nclusters = fInputEvent->GetNumberOfCaloClusters(); |
2385 | if(clusterList) | |
85c4406e | 2386 | nclusters = clusterList->GetEntriesFast(); |
2387 | ||
1035a8d9 | 2388 | Int_t nPatch = patches.GetSize(); |
2389 | Float_t exoDiffTime = GetCaloUtils()->GetEMCALRecoUtils()->GetExoticCellDiffTimeCut(); | |
85c4406e | 2390 | |
afb3af8a | 2391 | //Init some variables used in the cluster loop |
2392 | Float_t tofPatchMax = 100000; | |
2393 | Float_t ePatchMax =-1; | |
2394 | ||
2395 | Float_t tofMax = 100000; | |
2396 | Float_t eMax =-1; | |
2397 | ||
2398 | Int_t clusMax =-1; | |
2399 | Int_t idclusMax =-1; | |
1035a8d9 | 2400 | Bool_t badClMax = kFALSE; |
2401 | Bool_t badCeMax = kFALSE; | |
afb3af8a | 2402 | Bool_t exoMax = kFALSE; |
8a871c4f | 2403 | // Int_t absIdMaxTrig= -1; |
85c4406e | 2404 | Int_t absIdMaxMax = -1; |
afb3af8a | 2405 | |
2406 | Int_t nOfHighECl = 0 ; | |
93c2e459 | 2407 | |
2408 | Float_t triggerThreshold = fTriggerL1EventThreshold; | |
2409 | if(IsEventEMCALL0()) triggerThreshold = fTriggerL0EventThreshold; | |
5737e185 | 2410 | //printf("Threshold %f\n",triggerThreshold); |
93c2e459 | 2411 | Float_t minE = triggerThreshold / 2.; |
2412 | ||
85c4406e | 2413 | // This method is not really suitable for JET trigger |
2414 | // but in case, reduce the energy cut since we do not trigger on high energy particle | |
48f32a76 | 2415 | if(IsEventEMCALL1Jet() || minE < 1) minE = 1; |
2416 | ||
2417 | //printf("Min trigger Energy threshold %f\n",minE); | |
2418 | ||
afb3af8a | 2419 | // Loop on the clusters, check if there is any that falls into one of the patches |
2420 | for (Int_t iclus = 0; iclus < nclusters; iclus++) | |
2421 | { | |
2422 | AliVCluster * clus = 0; | |
2423 | if(clusterList) clus = (AliVCluster*) clusterList->At(iclus); | |
2424 | else clus = fInputEvent->GetCaloCluster(iclus); | |
2425 | ||
2426 | if ( !clus ) continue ; | |
2427 | ||
2428 | if ( !IsEMCALCluster(clus)) continue ; | |
85c4406e | 2429 | |
f6b8da1f | 2430 | //Skip clusters with too low energy to be triggering |
d9bea110 | 2431 | if ( clus->E() < minE ) continue ; |
afb3af8a | 2432 | |
1035a8d9 | 2433 | Float_t frac = -1; |
2434 | Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac); | |
2435 | ||
2436 | Bool_t badCluster = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(), | |
85c4406e | 2437 | clus->GetCellsAbsId(),clus->GetNCells()); |
8a871c4f | 2438 | UShort_t cellMax[] = {(UShort_t) absIdMax}; |
1035a8d9 | 2439 | Bool_t badCell = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),cellMax,1); |
2440 | ||
2441 | // if cell is bad, it can happen that time calibration is not available, | |
2442 | // when calculating if it is exotic, this can make it to be exotic by default | |
2443 | // open it temporarily for this cluster | |
2444 | if(badCell) | |
85c4406e | 2445 | GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(10000000); |
1035a8d9 | 2446 | |
2447 | Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells()); | |
afb3af8a | 2448 | |
1035a8d9 | 2449 | // Set back the time cut on exotics |
2450 | if(badCell) | |
2451 | GetCaloUtils()->GetEMCALRecoUtils()->SetExoticCellDiffTimeCut(exoDiffTime); | |
afb3af8a | 2452 | |
1035a8d9 | 2453 | // Energy threshold for exotic Ecross typically at 4 GeV, |
2454 | // for lower energy, check that there are more than 1 cell in the cluster | |
2455 | if(!exotic && clus->GetNCells() < 2) exotic = kTRUE; | |
afb3af8a | 2456 | |
1035a8d9 | 2457 | Float_t energy = clus->E(); |
2458 | Int_t idclus = clus->GetID(); | |
afb3af8a | 2459 | |
1035a8d9 | 2460 | Double_t tof = clus->GetTOF(); |
ac207ee4 | 2461 | if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn() && fTriggerClusterTimeRecal) |
afb3af8a | 2462 | GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof); |
2463 | tof *=1.e9; | |
2464 | ||
d9bea110 | 2465 | //printf("cluster %d, ID %d, E %2.2f, tof %2.2f, AbsId max %d, exotic %d, bad Cluster %d, bad Cell %d\n", |
2466 | // iclus,idclus, energy,tof,absIdMax, exotic, badCluster,badCell); | |
85c4406e | 2467 | |
afb3af8a | 2468 | // Find the highest energy cluster, avobe trigger threshold |
2469 | // in the event in case no match to trigger is found | |
05ace4e1 | 2470 | if( energy > eMax ) |
afb3af8a | 2471 | { |
85c4406e | 2472 | tofMax = tof; |
2473 | eMax = energy; | |
2474 | badClMax = badCluster; | |
2475 | badCeMax = badCell; | |
2476 | exoMax = exotic; | |
2477 | clusMax = iclus; | |
2478 | idclusMax = idclus; | |
2479 | absIdMaxMax = absIdMax; | |
afb3af8a | 2480 | } |
2481 | ||
2482 | // count the good clusters in the event avobe the trigger threshold | |
85c4406e | 2483 | // to check the exotic events |
05ace4e1 | 2484 | if(!badCluster && !exotic) |
afb3af8a | 2485 | nOfHighECl++; |
2486 | ||
2487 | // Find match to trigger | |
b62d68b3 | 2488 | if(fTriggerPatchClusterMatch && nPatch>0) |
afb3af8a | 2489 | { |
2490 | for(Int_t iabsId =0; iabsId < nPatch; iabsId++) | |
2491 | { | |
2492 | Int_t absIDCell[4]; | |
2493 | GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patches.At(iabsId), absIDCell); | |
2494 | //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n", | |
2495 | // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]); | |
2496 | ||
2497 | for(Int_t ipatch = 0; ipatch < 4; ipatch++) | |
2498 | { | |
2499 | if(absIdMax == absIDCell[ipatch]) | |
2500 | { | |
2501 | //printf("*** Patches : absId %d, E %2.1f, tof %f \n",absIdMax,clus->E(), tof); | |
2502 | if(energy > ePatchMax) | |
2503 | { | |
2504 | tofPatchMax = tof; | |
2505 | ePatchMax = energy; | |
1035a8d9 | 2506 | fIsBadCellEvent = badCluster; |
2507 | fIsBadMaxCellEvent = badCell; | |
afb3af8a | 2508 | fIsExoticEvent = exotic; |
2509 | fTriggerClusterIndex = iclus; | |
2510 | fTriggerClusterId = idclus; | |
2511 | fIsTriggerMatch = kTRUE; | |
8a871c4f | 2512 | // absIdMaxTrig = absIdMax; |
afb3af8a | 2513 | } |
2514 | } | |
2515 | }// cell patch loop | |
2516 | }// trigger patch loop | |
2517 | } // Do trigger patch matching | |
2518 | ||
2519 | }// Cluster loop | |
85c4406e | 2520 | |
afb3af8a | 2521 | // If there was no match, assign as trigger |
2522 | // the highest energy cluster in the event | |
2523 | if(!fIsTriggerMatch) | |
2524 | { | |
2525 | tofPatchMax = tofMax; | |
2526 | ePatchMax = eMax; | |
1035a8d9 | 2527 | fIsBadCellEvent = badClMax; |
2528 | fIsBadMaxCellEvent = badCeMax; | |
afb3af8a | 2529 | fIsExoticEvent = exoMax; |
2530 | fTriggerClusterIndex = clusMax; | |
2531 | fTriggerClusterId = idclusMax; | |
2532 | } | |
2533 | ||
2534 | Double_t tofPatchMaxUS = TMath::Abs(tofPatchMax); | |
85c4406e | 2535 | |
f6b8da1f | 2536 | if (tofPatchMaxUS < 28 ) fTriggerClusterBC = 0 ; |
afb3af8a | 2537 | else if(tofPatchMaxUS < 75 ) fTriggerClusterBC = 1 ; |
2538 | else if(tofPatchMaxUS < 125) fTriggerClusterBC = 2 ; | |
2539 | else if(tofPatchMaxUS < 175) fTriggerClusterBC = 3 ; | |
2540 | else if(tofPatchMaxUS < 225) fTriggerClusterBC = 4 ; | |
2541 | else if(tofPatchMaxUS < 275) fTriggerClusterBC = 5 ; | |
2542 | else | |
2543 | { | |
2544 | //printf("AliCaloTrackReader::MatchTriggerCluster() - Large BC - tof %2.3f - Index %d\n",tofPatchMaxUS,fTriggerClusterIndex); | |
2545 | if(fTriggerClusterIndex >= 0) fTriggerClusterBC = 6 ; | |
2546 | else | |
2547 | { | |
2548 | fTriggerClusterIndex = -2; | |
2549 | fTriggerClusterId = -2; | |
2550 | } | |
2551 | } | |
2552 | ||
2553 | if(tofPatchMax < 0) fTriggerClusterBC*=-1; | |
2554 | ||
85c4406e | 2555 | |
2556 | // printf("AliCaloTrackReader::MatchTriggerCluster(TArrayI patches) - Trigger cluster: index %d, ID %d, E = %2.2f, tof = %2.2f (BC = %d), bad cluster? %d, bad cell? %d, exotic? %d, patch match? %d, n High E cluster %d, absId Max %d\n", | |
2557 | // fTriggerClusterIndex, fTriggerClusterId,ePatchMax, tofPatchMax, | |
2558 | // fTriggerClusterBC, fIsBadCellEvent,fIsBadMaxCellEvent,fIsExoticEvent, fIsTriggerMatch, nOfHighECl,absIdMaxMax); | |
2559 | // | |
2560 | // if(!fIsTriggerMatch) printf("\t highest energy cluster: index %d, ID %d, E = %2.2f, tof = %2.2f, bad cluster? %d, bad cell? %d, exotic? %d\n", | |
2561 | // clusMax, idclusMax, eMax,tofMax, badClMax, badCeMax,exoMax); | |
2562 | ||
2563 | //Redo matching but open cuts | |
5a798e72 | 2564 | if(!fIsTriggerMatch && fTriggerClusterId >= 0) |
2565 | { | |
2566 | // Open time patch time | |
2567 | TArrayI patchOpen = GetTriggerPatches(7,10); | |
2568 | ||
2569 | ||
2570 | Int_t patchAbsIdOpenTime = -1; | |
2571 | for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++) | |
2572 | { | |
2573 | Int_t absIDCell[4]; | |
2574 | patchAbsIdOpenTime = patchOpen.At(iabsId); | |
2575 | GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patchAbsIdOpenTime, absIDCell); | |
2576 | //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n", | |
2577 | // clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]); | |
2578 | ||
2579 | for(Int_t ipatch = 0; ipatch < 4; ipatch++) | |
2580 | { | |
2581 | if(absIdMaxMax == absIDCell[ipatch]) | |
2582 | { | |
2583 | fIsTriggerMatchOpenCut[0] = kTRUE; | |
2584 | break; | |
2585 | } | |
2586 | }// cell patch loop | |
2587 | }// trigger patch loop | |
2588 | ||
2589 | // Check neighbour patches | |
2590 | Int_t patchAbsId = -1; | |
2591 | Int_t globalCol = -1; | |
2592 | Int_t globalRow = -1; | |
2593 | GetCaloUtils()->GetEMCALGeometry()->GetFastORIndexFromCellIndex(absIdMaxMax, patchAbsId); | |
2594 | GetCaloUtils()->GetEMCALGeometry()->GetPositionInEMCALFromAbsFastORIndex(patchAbsId,globalCol,globalRow); | |
2595 | ||
2596 | // Check patches with strict time cut | |
2597 | Int_t patchAbsIdNeigh = -1; | |
2598 | for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++) | |
2599 | { | |
2600 | if(icol < 0 || icol > 47) continue; | |
2601 | ||
2602 | for(Int_t irow = globalRow; irow <= globalRow+1; irow++) | |
2603 | { | |
2604 | if(irow < 0 || irow > 63) continue; | |
2605 | ||
2606 | GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeigh); | |
2607 | ||
2608 | if ( patchAbsIdNeigh < 0 ) continue; | |
2609 | ||
2610 | for(Int_t iabsId =0; iabsId < patches.GetSize(); iabsId++) | |
2611 | { | |
2612 | if(patchAbsIdNeigh == patches.At(iabsId)) | |
2613 | { | |
2614 | fIsTriggerMatchOpenCut[1] = kTRUE; | |
2615 | break; | |
2616 | } | |
2617 | }// trigger patch loop | |
2618 | ||
2619 | }// row | |
2620 | }// col | |
2621 | ||
2622 | // Check patches with open time cut | |
2623 | Int_t patchAbsIdNeighOpenTime = -1; | |
2624 | for(Int_t icol = globalCol-1; icol <= globalCol+1; icol++) | |
2625 | { | |
2626 | if(icol < 0 || icol > 47) continue; | |
2627 | ||
2628 | for(Int_t irow = globalRow; irow <= globalRow+1; irow++) | |
2629 | { | |
2630 | if(irow < 0 || irow > 63) continue; | |
2631 | ||
2632 | GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(icol, irow, patchAbsIdNeighOpenTime); | |
2633 | ||
2634 | if ( patchAbsIdNeighOpenTime < 0 ) continue; | |
2635 | ||
2636 | for(Int_t iabsId =0; iabsId < patchOpen.GetSize(); iabsId++) | |
2637 | { | |
2638 | if(patchAbsIdNeighOpenTime == patchOpen.At(iabsId)) | |
2639 | { | |
2640 | fIsTriggerMatchOpenCut[2] = kTRUE; | |
2641 | break; | |
2642 | } | |
2643 | }// trigger patch loop | |
2644 | ||
2645 | }// row | |
2646 | }// col | |
2647 | ||
2648 | // printf("No match, new match: Open time %d-%d, open Neigh %d-%d, both open %d-%d\n",fIsTriggerMatchOpenCut[0],patchAbsIdOpenTime, | |
2649 | // fIsTriggerMatchOpenCut[1],patchAbsIdNeigh, | |
2650 | // fIsTriggerMatchOpenCut[2],patchAbsIdNeighOpenTime); | |
2651 | ||
2652 | patchOpen.Reset(); | |
2653 | ||
2654 | }// No trigger match found | |
48f32a76 | 2655 | //printf("Trigger BC %d, Id %d, Index %d\n",fTriggerClusterBC,fTriggerClusterId,fTriggerClusterIndex); |
85c4406e | 2656 | |
a529ae05 | 2657 | } |
2658 | ||
914b9fe7 | 2659 | //________________________________________________________ |
2660 | void AliCaloTrackReader::Print(const Option_t * opt) const | |
2661 | { | |
2662 | ||
2663 | //Print some relevant parameters set for the analysis | |
2664 | if(! opt) | |
2665 | return; | |
2666 | ||
2667 | printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ; | |
2668 | printf("Task name : %s\n", fTaskName.Data()) ; | |
2669 | printf("Data type : %d\n", fDataType) ; | |
2670 | printf("CTS Min pT : %2.1f GeV/c\n", fCTSPtMin) ; | |
2671 | printf("EMCAL Min pT : %2.1f GeV/c\n", fEMCALPtMin) ; | |
2672 | printf("PHOS Min pT : %2.1f GeV/c\n", fPHOSPtMin) ; | |
2673 | printf("CTS Max pT : %2.1f GeV/c\n", fCTSPtMax) ; | |
2674 | printf("EMCAL Max pT : %2.1f GeV/c\n", fEMCALPtMax) ; | |
2675 | printf("PHOS Max pT : %2.1f GeV/c\n", fPHOSPtMax) ; | |
2676 | printf("EMCAL Time Cut: %3.1f < TOF < %3.1f\n", fEMCALTimeCutMin, fEMCALTimeCutMax); | |
2677 | printf("Use CTS = %d\n", fFillCTS) ; | |
2678 | printf("Use EMCAL = %d\n", fFillEMCAL) ; | |
2679 | printf("Use PHOS = %d\n", fFillPHOS) ; | |
2680 | printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ; | |
2681 | printf("Use PHOS Cells = %d\n", fFillPHOSCells) ; | |
2682 | printf("Track status = %d\n", (Int_t) fTrackStatus) ; | |
6f20e2a6 | 2683 | printf("AODs Track filter mask = %d or hybrid %d (if filter bit comp %d), select : SPD hit %d, primary %d\n", |
2684 | (Int_t) fTrackFilterMask, fSelectHybridTracks, (Int_t) fTrackFilterMaskComplementary, fSelectSPDHitTracks,fSelectPrimaryTracks) ; | |
914b9fe7 | 2685 | printf("Track Mult Eta Cut = %d\n", (Int_t) fTrackMultEtaCut) ; |
2686 | printf("Write delta AOD = %d\n", fWriteOutputDeltaAOD) ; | |
ac207ee4 | 2687 | printf("Recalculate Clusters = %d, E linearity = %d\n", fRecalculateClusters, fCorrectELinearity) ; |
914b9fe7 | 2688 | |
7e42e071 | 2689 | printf("Use Triggers selected in SE base class %d; If not what Trigger Mask? %d; MB Trigger Mask for mixed %d \n", |
914b9fe7 | 2690 | fEventTriggerAtSE, fEventTriggerMask,fMixEventTriggerMask); |
2691 | ||
2692 | if(fComparePtHardAndClusterPt) | |
2693 | printf("Compare jet pt and pt hard to accept event, factor = %2.2f",fPtHardAndJetPtFactor); | |
2694 | ||
2695 | if(fComparePtHardAndClusterPt) | |
2696 | printf("Compare cluster pt and pt hard to accept event, factor = %2.2f",fPtHardAndClusterPtFactor); | |
2697 | ||
2698 | printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ; | |
2699 | printf("Delta AOD File Name = %s\n", fDeltaAODFileName.Data()) ; | |
2700 | printf("Centrality: Class %s, Option %d, Bin [%d,%d] \n", fCentralityClass.Data(),fCentralityOpt,fCentralityBin[0], fCentralityBin[1]) ; | |
2701 | ||
2702 | printf(" \n") ; | |
2703 | ||
2704 | } | |
2705 | ||
a529ae05 | 2706 | //__________________________________________ |
2707 | Bool_t AliCaloTrackReader::RejectLEDEvents() | |
2708 | { | |
2709 | // LED Events in period LHC11a contaminated sample, simple method | |
2710 | // to reject such events | |
2711 | ||
2712 | // Count number of cells with energy larger than 0.1 in SM3, cut on this number | |
2713 | Int_t ncellsSM3 = 0; | |
2714 | for(Int_t icell = 0; icell < fInputEvent->GetEMCALCells()->GetNumberOfCells(); icell++) | |
2715 | { | |
2716 | Int_t absID = fInputEvent->GetEMCALCells()->GetCellNumber(icell); | |
2717 | Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID); | |
2718 | if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==3) ncellsSM3++; | |
2719 | } | |
2720 | ||
2721 | Int_t ncellcut = 21; | |
2722 | if(GetFiredTriggerClasses().Contains("EMC")) ncellcut = 35; | |
85c4406e | 2723 | |
a529ae05 | 2724 | if(ncellsSM3 >= ncellcut) |
2725 | { | |
2726 | if(fDebug > 0) | |
2727 | printf(" AliCaloTrackReader::FillInputEvent() - reject event with ncells in SM3 %d, cut %d, trig %s\n", | |
2728 | ncellsSM3,ncellcut,GetFiredTriggerClasses().Data()); | |
2729 | return kTRUE; | |
2730 | } | |
2731 | ||
2732 | return kFALSE; | |
2733 | ||
2734 | } | |
2735 | ||
914b9fe7 | 2736 | //_________________________________________________________ |
2737 | void AliCaloTrackReader::RemapMCLabelForAODs(Int_t & label) | |
2738 | { | |
2739 | // MC label for Cells not remapped after ESD filtering, do it here. | |
2740 | ||
2741 | if(label < 0) return ; | |
2742 | ||
2743 | AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ; | |
2744 | if(!evt) return ; | |
2745 | ||
2746 | TClonesArray * arr = dynamic_cast<TClonesArray*>(evt->FindListObject("mcparticles")) ; | |
2747 | if(!arr) return ; | |
2748 | ||
2749 | if(label < arr->GetEntriesFast()) | |
2750 | { | |
2751 | AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(label)); | |
2752 | if(!particle) return ; | |
2753 | ||
2754 | if(label == particle->Label()) return ; // label already OK | |
2755 | //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d - AOD stack %d \n",label, particle->Label()); | |
2756 | } | |
2757 | //else printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label %d > AOD labels %d \n",label, arr->GetEntriesFast()); | |
2758 | ||
2759 | // loop on the particles list and check if there is one with the same label | |
2760 | for(Int_t ind = 0; ind < arr->GetEntriesFast(); ind++ ) | |
2761 | { | |
2762 | AliAODMCParticle * particle = dynamic_cast<AliAODMCParticle *>(arr->At(ind)); | |
2763 | if(!particle) continue ; | |
2764 | ||
2765 | if(label == particle->Label()) | |
2766 | { | |
2767 | label = ind; | |
2768 | //printf("AliAnalysisTaskEMCALClusterize::RemapMCLabelForAODs() - New Label Index %d \n",label); | |
2769 | return; | |
2770 | } | |
2771 | } | |
2772 | ||
2773 | label = -1; | |
2774 | ||
2775 | //printf("AliCaloTrackReader::RemapMCLabelForAODs() - Label not found set to -1 \n"); | |
2776 | ||
2777 | } | |
2778 | ||
2779 | ||
2780 | //___________________________________ | |
2781 | void AliCaloTrackReader::ResetLists() | |
2782 | { | |
2783 | // Reset lists, called by the analysis maker | |
2784 | ||
2785 | if(fCTSTracks) fCTSTracks -> Clear(); | |
2786 | if(fEMCALClusters) fEMCALClusters -> Clear("C"); | |
2787 | if(fPHOSClusters) fPHOSClusters -> Clear("C"); | |
2788 | ||
2789 | fV0ADC[0] = 0; fV0ADC[1] = 0; | |
2790 | fV0Mul[0] = 0; fV0Mul[1] = 0; | |
2791 | ||
43cd6c94 | 2792 | if(fNonStandardJets) fNonStandardJets -> Clear("C"); |
d6d84709 | 2793 | fBackgroundJets->Reset(); |
2794 | ||
914b9fe7 | 2795 | } |
2796 | ||
d9bea110 | 2797 | //___________________________________________ |
2798 | void AliCaloTrackReader::SetEventTriggerBit() | |
2799 | { | |
85c4406e | 2800 | // Tag event depeding on trigger name |
d9bea110 | 2801 | |
85c4406e | 2802 | fEventTrigMinBias = kFALSE; |
2803 | fEventTrigCentral = kFALSE; | |
2804 | fEventTrigSemiCentral = kFALSE; | |
2805 | fEventTrigEMCALL0 = kFALSE; | |
2806 | fEventTrigEMCALL1Gamma1 = kFALSE; | |
2807 | fEventTrigEMCALL1Gamma2 = kFALSE; | |
2808 | fEventTrigEMCALL1Jet1 = kFALSE; | |
2809 | fEventTrigEMCALL1Jet2 = kFALSE; | |
2810 | ||
48f32a76 | 2811 | if(fDebug > 0) |
b62d68b3 | 2812 | printf("AliCaloTrackReader::SetEventTriggerBit() - Select trigger mask bit %d - Trigger Event %s - Select <%s>\n", |
2813 | fEventTriggerMask,GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data()); | |
ac207ee4 | 2814 | |
85c4406e | 2815 | if(fEventTriggerMask <=0 )// in case no mask set |
2816 | { | |
2817 | // EMC triggered event? Which type? | |
2818 | if( GetFiredTriggerClasses().Contains("-B-") || GetFiredTriggerClasses().Contains("-S-") || GetFiredTriggerClasses().Contains("-I-") ) | |
2819 | { | |
2820 | if ( GetFiredTriggerClasses().Contains("EGA" ) || | |
2821 | GetFiredTriggerClasses().Contains("EG1" ) ) | |
2822 | { | |
2823 | fEventTrigEMCALL1Gamma1 = kTRUE; | |
2824 | if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE; | |
2825 | } | |
2826 | else if( GetFiredTriggerClasses().Contains("EG2" ) ) | |
2827 | { | |
2828 | fEventTrigEMCALL1Gamma2 = kTRUE; | |
2829 | if( !fFiredTriggerClassName.Contains("EG2") ) fEventTrigEMCALL1Gamma2 = kFALSE; | |
2830 | } | |
2831 | else if( GetFiredTriggerClasses().Contains("EJE" ) || | |
2832 | GetFiredTriggerClasses().Contains("EJ1" ) ) | |
2833 | { | |
2834 | fEventTrigEMCALL1Jet1 = kTRUE; | |
2835 | if( GetFiredTriggerClasses().Contains("EJ1" ) && !fFiredTriggerClassName.Contains("EJ1") ) | |
2836 | fEventTrigEMCALL1Jet1 = kFALSE; | |
2837 | } | |
2838 | else if( GetFiredTriggerClasses().Contains("EJ2" ) ) | |
2839 | { | |
2840 | fEventTrigEMCALL1Jet2 = kTRUE; | |
2841 | if( !fFiredTriggerClassName.Contains("EJ2") ) fEventTrigEMCALL1Jet2 = kFALSE; | |
2842 | } | |
2843 | else if( GetFiredTriggerClasses().Contains("CEMC") && | |
2844 | !GetFiredTriggerClasses().Contains("EGA" ) && | |
2845 | !GetFiredTriggerClasses().Contains("EJE" ) && | |
2846 | !GetFiredTriggerClasses().Contains("EG1" ) && | |
2847 | !GetFiredTriggerClasses().Contains("EJ1" ) && | |
2848 | !GetFiredTriggerClasses().Contains("EG2" ) && | |
2849 | !GetFiredTriggerClasses().Contains("EJ2" ) ) | |
ac207ee4 | 2850 | { |
85c4406e | 2851 | fEventTrigEMCALL0 = kTRUE; |
ac207ee4 | 2852 | } |
85c4406e | 2853 | |
2854 | //Min bias event trigger? | |
2855 | if (GetFiredTriggerClasses().Contains("CCENT_R2-B-NOPF-ALLNOTRD")) | |
ac207ee4 | 2856 | { |
85c4406e | 2857 | fEventTrigCentral = kTRUE; |
ac207ee4 | 2858 | } |
85c4406e | 2859 | else if(GetFiredTriggerClasses().Contains("CSEMI_R1-B-NOPF-ALLNOTRD")) |
ac207ee4 | 2860 | { |
85c4406e | 2861 | fEventTrigSemiCentral = kTRUE; |
ac207ee4 | 2862 | } |
85c4406e | 2863 | else if((GetFiredTriggerClasses().Contains("CINT") || GetFiredTriggerClasses().Contains("CPBI2_B1") ) && |
2864 | GetFiredTriggerClasses().Contains("-NOPF-ALLNOTRD") ) | |
ac207ee4 | 2865 | { |
85c4406e | 2866 | fEventTrigMinBias = kTRUE; |
ac207ee4 | 2867 | } |
85c4406e | 2868 | } |
d9bea110 | 2869 | } |
85c4406e | 2870 | else |
d9bea110 | 2871 | { |
85c4406e | 2872 | // EMC L1 Gamma |
2873 | if ( fEventTriggerMask & AliVEvent::kEMCEGA ) | |
2874 | { | |
48f32a76 | 2875 | //printf("EGA trigger bit\n"); |
b62d68b3 | 2876 | if (GetFiredTriggerClasses().Contains("EG")) |
85c4406e | 2877 | { |
b62d68b3 | 2878 | if (GetFiredTriggerClasses().Contains("EGA")) fEventTrigEMCALL1Gamma1 = kTRUE; |
2879 | else | |
2880 | { | |
2881 | if(GetFiredTriggerClasses().Contains("EG1")) fEventTrigEMCALL1Gamma1 = kTRUE; | |
2882 | if(GetFiredTriggerClasses().Contains("EG2")) fEventTrigEMCALL1Gamma2 = kTRUE; | |
2883 | } | |
85c4406e | 2884 | } |
2885 | } | |
2886 | // EMC L1 Jet | |
2887 | else if( fEventTriggerMask & AliVEvent::kEMCEJE ) | |
2888 | { | |
b62d68b3 | 2889 | //printf("EGA trigger bit\n"); |
2890 | if (GetFiredTriggerClasses().Contains("EJ")) | |
85c4406e | 2891 | { |
b62d68b3 | 2892 | if (GetFiredTriggerClasses().Contains("EJE")) fEventTrigEMCALL1Jet1 = kTRUE; |
2893 | else | |
2894 | { | |
2895 | if(GetFiredTriggerClasses().Contains("EJ1")) fEventTrigEMCALL1Jet1 = kTRUE; | |
2896 | if(GetFiredTriggerClasses().Contains("EJ2")) fEventTrigEMCALL1Jet2 = kTRUE; | |
2897 | } | |
85c4406e | 2898 | } |
2899 | } | |
2900 | // EMC L0 | |
2901 | else if((fEventTriggerMask & AliVEvent::kEMC7) || | |
2902 | (fEventTriggerMask & AliVEvent::kEMC1) ) | |
ac207ee4 | 2903 | { |
48f32a76 | 2904 | //printf("L0 trigger bit\n"); |
85c4406e | 2905 | fEventTrigEMCALL0 = kTRUE; |
ac207ee4 | 2906 | } |
85c4406e | 2907 | // Min Bias Pb-Pb |
2908 | else if( fEventTriggerMask & AliVEvent::kCentral ) | |
ac207ee4 | 2909 | { |
48f32a76 | 2910 | //printf("MB semi central trigger bit\n"); |
85c4406e | 2911 | fEventTrigSemiCentral = kTRUE; |
ac207ee4 | 2912 | } |
85c4406e | 2913 | // Min Bias Pb-Pb |
2914 | else if( fEventTriggerMask & AliVEvent::kSemiCentral ) | |
ac207ee4 | 2915 | { |
48f32a76 | 2916 | //printf("MB central trigger bit\n"); |
85c4406e | 2917 | fEventTrigCentral = kTRUE; |
ac207ee4 | 2918 | } |
85c4406e | 2919 | // Min Bias pp, PbPb, pPb |
2920 | else if((fEventTriggerMask & AliVEvent::kMB ) || | |
2921 | (fEventTriggerMask & AliVEvent::kINT7) || | |
42e8bf7a | 2922 | (fEventTriggerMask & AliVEvent::kINT8) || |
2923 | (fEventTriggerMask & AliVEvent::kAnyINT) ) | |
ac207ee4 | 2924 | { |
48f32a76 | 2925 | //printf("MB trigger bit\n"); |
85c4406e | 2926 | fEventTrigMinBias = kTRUE; |
ac207ee4 | 2927 | } |
85c4406e | 2928 | } |
2929 | ||
2930 | if(fDebug > 0 ) | |
2931 | printf("AliCaloTrackReader::SetEventTriggerBit() - Event bits: \n \t MB %d, Cen %d, Sem %d, L0 %d, L1G1 %d, L1G2 %d, L1J1 %d, L1J2 %d \n", | |
2932 | fEventTrigMinBias, fEventTrigCentral, fEventTrigSemiCentral, | |
2933 | fEventTrigEMCALL0 , fEventTrigEMCALL1Gamma1, fEventTrigEMCALL1Gamma2, | |
2934 | fEventTrigEMCALL1Jet1 , fEventTrigEMCALL1Jet2); | |
2935 | ||
2936 | if(fBitEGA == 0 && fBitEJE ==0) | |
2937 | { | |
b62d68b3 | 2938 | // Init the trigger bit once, correct depending on AliESDAODCaloTrigger header version |
2939 | // Old values | |
85c4406e | 2940 | fBitEGA = 4; |
2941 | fBitEJE = 5; | |
2942 | ||
2943 | TFile* file = AliAnalysisManager::GetAnalysisManager()->GetTree()->GetCurrentFile(); | |
2944 | ||
2945 | const TList *clist = file->GetStreamerInfoCache(); | |
2946 | ||
2947 | if(clist) | |
2948 | { | |
2949 | TStreamerInfo *cinfo = (TStreamerInfo*)clist->FindObject("AliESDCaloTrigger"); | |
b62d68b3 | 2950 | Int_t verid = 5; // newer ESD header version |
2951 | if(!cinfo) | |
2952 | { | |
2953 | cinfo = (TStreamerInfo*)clist->FindObject("AliAODCaloTrigger"); | |
e353df0c | 2954 | verid = 3; // newer AOD header version |
b62d68b3 | 2955 | } |
5737e185 | 2956 | |
85c4406e | 2957 | if(cinfo) |
2958 | { | |
2959 | Int_t classversionid = cinfo->GetClassVersion(); | |
b62d68b3 | 2960 | //printf("********* Header class version %d *********** \n",classversionid); |
85c4406e | 2961 | |
b62d68b3 | 2962 | if (classversionid >= verid) |
85c4406e | 2963 | { |
2964 | fBitEGA = 6; | |
2965 | fBitEJE = 8; | |
2966 | } | |
48f32a76 | 2967 | } else printf("AliCaloTrackReader()::SetEventTriggerBit() - Streamer info for trigger class not available, bit not changed\n"); |
2968 | } else printf("AliCaloTrackReader::SetEventTriggerBit() - Streamer list not available!, bit not changed\n"); | |
85c4406e | 2969 | |
2970 | } // set once the EJE, EGA trigger bit | |
2971 | ||
d9bea110 | 2972 | } |
2973 | ||
914b9fe7 | 2974 | //____________________________________________________________ |
2975 | void AliCaloTrackReader::SetInputEvent(AliVEvent* const input) | |
2976 | { | |
2977 | fInputEvent = input; | |
2978 | fMixedEvent = dynamic_cast<AliMixedEvent*>(GetInputEvent()) ; | |
2979 | if (fMixedEvent) | |
2980 | fNMixedEvent = fMixedEvent->GetNumberOfEvents() ; | |
2981 | ||
2982 | //Delete previous vertex | |
2983 | if(fVertex) | |
2984 | { | |
2985 | for (Int_t i = 0; i < fNMixedEvent; i++) | |
2986 | { | |
2987 | delete [] fVertex[i] ; | |
2988 | } | |
2989 | delete [] fVertex ; | |
2990 | } | |
2991 | ||
2992 | fVertex = new Double_t*[fNMixedEvent] ; | |
2993 | for (Int_t i = 0; i < fNMixedEvent; i++) | |
2994 | { | |
2995 | fVertex[i] = new Double_t[3] ; | |
2996 | fVertex[i][0] = 0.0 ; | |
2997 | fVertex[i][1] = 0.0 ; | |
2998 | fVertex[i][2] = 0.0 ; | |
2999 | } | |
3000 | } | |
d9bea110 | 3001 | |
c5693f62 | 3002 | //____________________________________________________________ |
a529ae05 | 3003 | void AliCaloTrackReader::SetTrackCuts(AliESDtrackCuts * cuts) |
85c4406e | 3004 | { |
c5693f62 | 3005 | // Set Track cuts |
3006 | ||
3007 | if(fESDtrackCuts) delete fESDtrackCuts ; | |
3008 | ||
85c4406e | 3009 | fESDtrackCuts = cuts ; |
836b6989 | 3010 | |
85c4406e | 3011 | } |
48c37e02 | 3012 | |
d7601185 | 3013 | //_________________________________________________________________________ |
3014 | void AliCaloTrackReader::SetTrackComplementaryCuts(AliESDtrackCuts * cuts) | |
3015 | { | |
3016 | // Set Track cuts for complementary tracks (hybrids) | |
3017 | ||
3018 | if(fESDtrackComplementaryCuts) delete fESDtrackComplementaryCuts ; | |
3019 | ||
3020 | fESDtrackComplementaryCuts = cuts ; | |
3021 | ||
3022 | } | |
3023 | ||
3024 |