]>
Commit | Line | Data |
---|---|---|
b0a53615 | 1 | // $Id$ |
2 | // | |
980821ba | 3 | // Emcal physics selection class. |
b0a53615 | 4 | // |
cd231d42 | 5 | // Author: C.Loizides |
be94a07d | 6 | |
7 | #include "AliEmcalPhysicsSelection.h" | |
bb33f819 | 8 | #include "AliAODEvent.h" |
be94a07d | 9 | #include "AliESDEvent.h" |
0abef324 | 10 | #include "AliLog.h" |
be94a07d | 11 | |
12 | ClassImp(AliEmcalPhysicsSelection) | |
13 | ||
fb81cdb7 | 14 | AliEmcalPhysicsSelection::AliEmcalPhysicsSelection() : |
15 | AliPhysicsSelection(), | |
16 | fMarkFastOnly(0), | |
17 | fMarkLedEvent(0), | |
18 | fSkipFastOnly(0), | |
19 | fSkipLedEvent(0), | |
2c091b4a | 20 | fCellMinE(-1), |
21 | fClusMinE(-1), | |
22 | fTrackMinPt(-1), | |
23 | fTriggers(0), | |
1dc3ded9 | 24 | fZvertex(-1), |
25 | fZvertexDiff(0), | |
26 | fCentMin(-1), | |
27 | fCentMax(-1), | |
fb81cdb7 | 28 | fIsFastOnly(0), |
29 | fIsLedEvent(0), | |
30 | fIsGoodEvent(0), | |
31 | fCellMaxE(0), | |
2c091b4a | 32 | fClusMaxE(0), |
33 | fTrackMaxPt(0) | |
fb81cdb7 | 34 | { |
35 | // Default constructor. | |
36 | } | |
37 | ||
be94a07d | 38 | //__________________________________________________________________________________________________ |
39 | UInt_t AliEmcalPhysicsSelection::GetSelectionMask(const TObject* obj) | |
40 | { | |
bb33f819 | 41 | // Calculate selection mask. |
42 | ||
43 | const AliVEvent *ev = dynamic_cast<const AliVEvent*>(obj); | |
44 | if (!ev) { | |
45 | return 0; | |
46 | } | |
47 | ||
48 | UInt_t res = 0; | |
49 | const AliESDEvent *eev = dynamic_cast<const AliESDEvent*>(obj); | |
50 | const AliAODEvent *aev = 0; | |
51 | if (eev) { | |
52 | res = IsCollisionCandidate(eev); | |
53 | } else { | |
54 | aev = dynamic_cast<const AliAODEvent*>(obj); | |
55 | res = aev->GetHeader()->GetOfflineTrigger(); | |
56 | } | |
be94a07d | 57 | |
1dc3ded9 | 58 | // return 0, if 0 found |
f4fa7802 | 59 | if (res==0) |
60 | return 0; | |
61 | ||
1dc3ded9 | 62 | // return 0, if ptrs are not set |
63 | if ((eev==0) && (aev==0)) | |
64 | return 0; | |
65 | ||
2c091b4a | 66 | if (fTriggers) { // only process given triggers |
1dc3ded9 | 67 | if ((res & fTriggers) == 0) |
2c091b4a | 68 | return res; |
69 | } | |
70 | ||
1dc3ded9 | 71 | AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager(); |
72 | ||
fb81cdb7 | 73 | fIsFastOnly = kFALSE; |
74 | fIsGoodEvent = kFALSE; | |
75 | fIsLedEvent = kFALSE; | |
f4fa7802 | 76 | fCellMaxE = -1; |
77 | fClusMaxE = -1; | |
78 | fTrackMaxPt = -1; | |
fb81cdb7 | 79 | |
1dc3ded9 | 80 | if ((res & AliVEvent::kAnyINT) || |
81 | (res & AliVEvent::kSemiCentral) || | |
82 | (res & AliVEvent::kCentral) || | |
83 | (res & AliVEvent::kEMC1) || | |
84 | (res & AliVEvent::kEMC7) || | |
85 | (res & AliVEvent::kEMCEJE) || | |
bb33f819 | 86 | (res & AliVEvent::kEMCEGA)) |
fb81cdb7 | 87 | fIsGoodEvent = kTRUE; |
88 | ||
1dc3ded9 | 89 | if (fZvertexDiff || (fZvertex>0)) { |
90 | Double_t vzPRI = +999; | |
91 | Double_t vzSPD = -999; | |
92 | const AliVVertex *pv = 0; | |
93 | if (eev) | |
94 | pv = eev->GetPrimaryVertex(); | |
95 | else | |
96 | pv = aev->GetPrimaryVertex(); | |
97 | if (pv && pv->GetNContributors()>0) { | |
98 | vzPRI = pv->GetZ(); | |
99 | } | |
100 | const AliVVertex *sv = 0; | |
101 | if (eev) | |
102 | sv = eev->GetPrimaryVertexSPD(); | |
103 | else | |
104 | sv = aev->GetPrimaryVertexSPD(); | |
105 | if (sv && sv->GetNContributors()>0) { | |
106 | vzSPD = sv->GetZ(); | |
107 | } | |
108 | Double_t dvertex = TMath::Abs(vzPRI-vzSPD); | |
1b91882c | 109 | // skip events with dvertex>1mm if requested |
1dc3ded9 | 110 | // https://indico.cern.ch/getFile.py/access?contribId=4&resId=0&materialId=slides&confId=189624 |
111 | // also check on vertex z if requested | |
1b91882c | 112 | if (fZvertexDiff && (dvertex>0.1)) |
1dc3ded9 | 113 | fIsGoodEvent = kFALSE; |
114 | if ((fZvertex>0) && (TMath::Abs(dvertex)>fZvertex)) | |
115 | fIsGoodEvent = kFALSE; | |
116 | } | |
117 | ||
118 | if ((fCentMin>-1) && (fCentMax>-1)) { | |
119 | Double_t v0mcent = -1; | |
120 | AliCentrality *centin = 0; | |
121 | if (eev) { | |
122 | am->LoadBranch("Centrality."); | |
123 | centin = dynamic_cast<AliCentrality*>(eev->FindListObject("Centrality")); | |
124 | } else { | |
125 | centin = const_cast<AliAODEvent*>(aev)->GetCentrality(); | |
126 | } | |
127 | if (centin) | |
128 | v0mcent = centin->GetCentralityPercentileUnchecked("V0M"); | |
77a933e7 | 129 | if ((v0mcent<fCentMin) || (v0mcent>fCentMax)) |
1dc3ded9 | 130 | fIsGoodEvent = kFALSE; |
131 | } | |
132 | ||
2c091b4a | 133 | AliVCaloCells *cells = ev->GetEMCALCells(); |
fb81cdb7 | 134 | const Short_t nCells = cells->GetNumberOfCells(); |
135 | ||
136 | // mark LHC11a fast only partition if requested | |
137 | if (res & AliVEvent::kFastOnly) { | |
138 | fIsFastOnly = kTRUE; | |
139 | if (fMarkFastOnly||fSkipFastOnly) { | |
140 | if (nCells>0) { | |
141 | AliFatal(Form("Number of cells %d, even though EMCAL should not be in fast only partition.",nCells)); | |
be94a07d | 142 | } |
fb81cdb7 | 143 | fIsGoodEvent = kFALSE; |
be94a07d | 144 | } |
145 | } | |
146 | ||
2c091b4a | 147 | if (fCellMinE>0) { |
148 | if (eev) | |
149 | am->LoadBranch("EMCALCells."); | |
150 | for(Int_t iCell=0; iCell<nCells; ++iCell) { | |
151 | Short_t cellId = cells->GetCellNumber(iCell); | |
152 | Double_t cellE = cells->GetCellAmplitude(cellId); | |
153 | if (cellE>fCellMaxE) | |
154 | fCellMaxE = cellE; | |
155 | } | |
fb81cdb7 | 156 | } |
2c091b4a | 157 | |
158 | if (fClusMinE>0) { | |
159 | if (eev) | |
160 | am->LoadBranch("CaloClusters"); | |
161 | ||
162 | const Int_t nCaloClusters = ev->GetNumberOfCaloClusters(); | |
163 | for(Int_t iClus = 0; iClus<nCaloClusters; ++iClus) { | |
164 | AliVCluster *cl = ev->GetCaloCluster(iClus); | |
165 | if (!cl->IsEMCAL()) | |
166 | continue; | |
167 | Double_t e = cl->E(); | |
168 | if (e>fClusMaxE) | |
169 | fClusMaxE = e; | |
170 | } | |
171 | } | |
172 | ||
173 | if (fTrackMinPt>0) { | |
174 | TClonesArray *trks = 0; | |
175 | if (eev) { | |
176 | am->LoadBranch("PicoTracks"); | |
177 | trks = dynamic_cast<TClonesArray*>(eev->FindListObject("PicoTracks")); | |
178 | if (!trks) { | |
179 | am->LoadBranch("Tracks"); | |
180 | trks = dynamic_cast<TClonesArray*>(eev->FindListObject("Tracks")); | |
181 | } | |
182 | } else { | |
183 | trks = dynamic_cast<TClonesArray*>(aev->FindListObject("tracks")); | |
184 | } | |
185 | const Int_t Ntracks = trks->GetEntriesFast(); | |
186 | for (Int_t iTracks = 0; iTracks < Ntracks; ++iTracks) { | |
f4fa7802 | 187 | AliVTrack *track = static_cast<AliVTrack*>(trks->At(iTracks)); |
2c091b4a | 188 | if (!track) |
189 | continue; | |
f4fa7802 | 190 | if (aev) { // a bit ugly since cuts are hard coded for now |
191 | AliAODTrack *aodtrack = static_cast<AliAODTrack*>(track); | |
192 | if (!aodtrack->TestFilterBit(256) && !aodtrack->TestFilterBit(512)) | |
193 | continue; | |
194 | } | |
2c091b4a | 195 | Double_t pt = track->Pt(); |
196 | if (pt>fTrackMaxPt) | |
197 | fTrackMaxPt = pt; | |
198 | } | |
fb81cdb7 | 199 | } |
200 | ||
201 | // bad cell criterion for LHC11a from | |
202 | // https://indico.cern.ch/materialDisplay.py?contribId=4&materialId=slides&confId=147067 | |
203 | const Int_t runN = ev->GetRunNumber(); | |
204 | if ((runN>=144871) && (runN<=146860)) { | |
2c091b4a | 205 | |
206 | if (eev) | |
207 | am->LoadBranch("EMCALCells."); | |
208 | ||
209 | // count cells above threshold | |
210 | Int_t nCellCount[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; | |
211 | for(Int_t iCell=0; iCell<nCells; ++iCell) { | |
212 | Short_t cellId = cells->GetCellNumber(iCell); | |
213 | Double_t cellE = cells->GetCellAmplitude(cellId); | |
214 | Int_t sm = cellId / (24*48); | |
215 | if (cellE>0.1) | |
216 | ++nCellCount[sm]; | |
217 | } | |
218 | ||
fb81cdb7 | 219 | if (nCellCount[4] > 100) |
220 | fIsLedEvent = kTRUE; | |
221 | else { | |
222 | if ((runN>=146858) && (runN<=146860)) { | |
223 | if ((res&AliVEvent::kMB) && (nCellCount[3]>=21)) | |
224 | fIsLedEvent = kTRUE; | |
225 | else if ((res&AliVEvent::kEMC1) && (nCellCount[3]>=35)) | |
226 | fIsLedEvent = kTRUE; | |
227 | } | |
228 | } | |
229 | if (fIsLedEvent) { | |
230 | fIsGoodEvent = kFALSE; | |
231 | } | |
232 | } | |
233 | ||
77a933e7 | 234 | if (fIsGoodEvent) { |
235 | if (fCellMaxE>fCellMinE) | |
236 | res |= kEmcalHC; | |
237 | if ((fClusMaxE>fClusMinE) || (fTrackMaxPt>fTrackMinPt)) | |
238 | res |= kEmcalHT; | |
fb81cdb7 | 239 | res |= kEmcalOk; |
77a933e7 | 240 | } |
fb81cdb7 | 241 | |
242 | if ((fSkipLedEvent && fIsLedEvent) || | |
243 | (fSkipFastOnly && fIsFastOnly)) | |
244 | res = 0; | |
245 | ||
be94a07d | 246 | return res; |
247 | } |