]>
Commit | Line | Data |
---|---|---|
9d173aad | 1 | // AliAnalysisTaskTriggerStudy |
2 | ||
3 | // Author: Michele Floris, CERN | |
4 | // TODO: | |
5 | // - Add chi2/cluster plot for primary, secondaries and fakes | |
6 | ||
7 | ||
8 | #include "AliAnalysisTaskTriggerStudy.h" | |
9 | #include "AliESDInputHandler.h" | |
10 | #include "AliHistoListWrapper.h" | |
11 | #include "AliAnalysisManager.h" | |
12 | #include "AliMCEvent.h" | |
13 | #include "AliStack.h" | |
14 | #include "TH1I.h" | |
15 | #include "TH3D.h" | |
16 | #include "AliMCParticle.h" | |
17 | #include "AliGenEventHeader.h" | |
18 | #include "AliESDCentrality.h" | |
19 | ||
20 | #include <iostream> | |
21 | #include "AliTriggerAnalysis.h" | |
22 | #include "AliMultiplicity.h" | |
23 | #include "TFile.h" | |
24 | #include "AliLog.h" | |
eef42d18 | 25 | #include "AliESDtrackCuts.h" |
bcc49144 | 26 | #include "AliESDVZERO.h" |
27 | #include "TH2F.h" | |
abd808b9 | 28 | #include "AliESDUtils.h" |
91ea438c | 29 | #include "AliGenPythiaEventHeader.h" |
30 | #include "AliGenDPMjetEventHeader.h" | |
9d173aad | 31 | |
32 | using namespace std; | |
33 | ||
34 | ClassImp(AliAnalysisTaskTriggerStudy) | |
35 | ||
7f5f2e0c | 36 | //const char * AliAnalysisTaskTriggerStudy::kVDNames[] = {"C0SM1","C0SM2","C0VBA","C0VBC","C0OM2"}; |
f07573a6 | 37 | const char * AliAnalysisTaskTriggerStudy::kVDNames[] = {"V0AND online","V0AND offline","Physics Selection", "Rec Candle"};//,"C0OM2"}; |
52d405b5 | 38 | |
9d173aad | 39 | AliAnalysisTaskTriggerStudy::AliAnalysisTaskTriggerStudy() |
40 | : AliAnalysisTaskSE("TaskTriggerStudy"), | |
eef42d18 | 41 | fESD(0),fHistoList(0),fIsMC(0),fTriggerAnalysis(0),fHistoSuffix(""),fNTrackletsCut(1000000),fNTrackletsCutKine(100),fRejectBGWithV0(0) |
9d173aad | 42 | { |
43 | // constructor | |
44 | ||
45 | DefineOutput(1, AliHistoListWrapper::Class()); | |
46 | ||
47 | } | |
48 | AliAnalysisTaskTriggerStudy::AliAnalysisTaskTriggerStudy(const char * name) | |
49 | : AliAnalysisTaskSE(name), | |
eef42d18 | 50 | fESD(0),fHistoList(0),fIsMC(0),fTriggerAnalysis(0),fHistoSuffix(""),fNTrackletsCut(1000000),fNTrackletsCutKine(100),fRejectBGWithV0(0) |
9d173aad | 51 | { |
52 | // | |
53 | // Standard constructur which should be used | |
54 | // | |
55 | ||
56 | DefineOutput(1, AliHistoListWrapper::Class()); | |
57 | ||
58 | } | |
59 | ||
60 | AliAnalysisTaskTriggerStudy::AliAnalysisTaskTriggerStudy(const AliAnalysisTaskTriggerStudy& obj) : | |
eef42d18 | 61 | AliAnalysisTaskSE(obj) ,fESD (0), fIsMC(0), fTriggerAnalysis(0),fHistoSuffix(""),fNTrackletsCut(1000000),fNTrackletsCutKine(100),fRejectBGWithV0(0) |
9d173aad | 62 | { |
63 | //copy ctor | |
64 | fESD = obj.fESD ; | |
65 | fHistoList = obj.fHistoList; | |
66 | fTriggerAnalysis = obj.fTriggerAnalysis; | |
a82dc581 | 67 | fHistoSuffix = obj.fHistoSuffix; |
eef42d18 | 68 | fNTrackletsCut = obj.fNTrackletsCut; |
69 | fNTrackletsCutKine = obj.fNTrackletsCutKine; | |
70 | fRejectBGWithV0 = obj.fRejectBGWithV0; | |
9d173aad | 71 | } |
72 | ||
73 | AliAnalysisTaskTriggerStudy::~AliAnalysisTaskTriggerStudy(){ | |
74 | // destructor | |
75 | ||
76 | if(!AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { | |
77 | if(fHistoList) { | |
78 | delete fHistoList; | |
79 | fHistoList = 0; | |
80 | } | |
81 | if(fTriggerAnalysis) { | |
82 | delete fTriggerAnalysis; | |
83 | fHistoList = 0; | |
84 | } | |
85 | } | |
86 | // Histo list should not be destroyed: fListWrapper is owner! | |
87 | ||
88 | } | |
89 | void AliAnalysisTaskTriggerStudy::UserCreateOutputObjects() | |
90 | { | |
91 | // Called once | |
92 | fHistoList = new AliHistoListWrapper("histoList","histogram list for trigger studies"); | |
93 | fTriggerAnalysis = new AliTriggerAnalysis(); | |
abd808b9 | 94 | if (fIsMC) fTriggerAnalysis->SetAnalyzeMC(1); |
9d173aad | 95 | } |
96 | ||
97 | ||
98 | void AliAnalysisTaskTriggerStudy::UserExec(Option_t *) | |
99 | { | |
100 | // User code | |
101 | ||
bcc49144 | 102 | // FIXME: make sure you have the right cuts here |
103 | ||
9d173aad | 104 | /* PostData(0) is taken care of by AliAnalysisTaskSE */ |
105 | PostData(1,fHistoList); | |
106 | ||
107 | fESD = dynamic_cast<AliESDEvent*>(fInputEvent); | |
108 | if (strcmp(fESD->ClassName(),"AliESDEvent")) { | |
109 | AliFatal("Not processing ESDs"); | |
110 | } | |
111 | ||
9d173aad | 112 | // get the multiplicity object |
113 | const AliMultiplicity* mult = fESD->GetMultiplicity(); | |
114 | Int_t ntracklets = mult->GetNumberOfTracklets(); | |
bcc49144 | 115 | // Get Number of tracks |
116 | Int_t ntracks = AliESDtrackCuts::GetReferenceMultiplicity(fESD,kTRUE); // tpc only | |
117 | ||
118 | // Get V0 Multiplicity | |
119 | AliESDVZERO* esdV0 = fESD->GetVZEROData(); | |
120 | Float_t multV0A=esdV0->GetMTotV0A(); | |
121 | Float_t multV0C=esdV0->GetMTotV0C(); | |
abd808b9 | 122 | Float_t dummy = 0; |
123 | Float_t multV0 = AliESDUtils::GetCorrV0(fESD, dummy); | |
bcc49144 | 124 | |
125 | // Get number of clusters in layer 1 | |
126 | Float_t outerLayerSPD = mult->GetNumberOfITSClusters(1); | |
127 | Float_t innerLayerSPD = mult->GetNumberOfITSClusters(0); | |
128 | Float_t totalClusSPD = outerLayerSPD+innerLayerSPD; | |
129 | ||
abd808b9 | 130 | if ( !fIsMC &&(!(fESD->IsTriggerClassFired("CMBS2A-B-NOPF-ALL")|| fESD->IsTriggerClassFired("CMBS2C-B-NOPF-ALL") || fESD->IsTriggerClassFired("CMBAC-B-NOPF-ALL")) )) return; |
bcc49144 | 131 | GetHistoSPD1 ("All", "All events before any selection")->Fill(outerLayerSPD); |
abd808b9 | 132 | GetHistoV0M ("All", "All events before any selection")->Fill(multV0); |
bcc49144 | 133 | |
359f9654 | 134 | // V0 triggers |
135 | Bool_t c0v0A = fTriggerAnalysis->IsOfflineTriggerFired(fESD, AliTriggerAnalysis::kV0A); | |
136 | Bool_t c0v0C = fTriggerAnalysis->IsOfflineTriggerFired(fESD, AliTriggerAnalysis::kV0C); | |
137 | Bool_t v0AHW = (fTriggerAnalysis->V0Trigger(fESD, AliTriggerAnalysis::kASide, kTRUE) == AliTriggerAnalysis::kV0BB);// should replay hw trigger | |
138 | Bool_t v0CHW = (fTriggerAnalysis->V0Trigger(fESD, AliTriggerAnalysis::kCSide, kTRUE) == AliTriggerAnalysis::kV0BB);// should replay hw trigger | |
139 | ||
140 | Bool_t v0ABG = fTriggerAnalysis->IsOfflineTriggerFired(fESD, AliTriggerAnalysis::kV0ABG); | |
141 | Bool_t v0CBG = fTriggerAnalysis->IsOfflineTriggerFired(fESD, AliTriggerAnalysis::kV0CBG); | |
142 | Bool_t v0BG = v0ABG || v0CBG; | |
143 | ||
144 | // At least one track in eta < 0.8 with pt > 0.5 | |
91ea438c | 145 | // MC Checks |
146 | Bool_t atLeast1Track = kFALSE; | |
147 | Bool_t isSD = kFALSE; | |
148 | Bool_t isND = kFALSE; | |
149 | ||
150 | if(fIsMC) { | |
151 | if (!fMCEvent) { | |
152 | AliError("No MC info found"); | |
153 | } else { | |
154 | Int_t nMCTracks = fMCEvent->GetNumberOfTracks(); | |
155 | Int_t nPhysicalPrimaries = 0; | |
156 | for (Int_t ipart=0; ipart<nMCTracks; ipart++) { | |
157 | AliMCParticle *mcPart = (AliMCParticle*)fMCEvent->GetTrack(ipart); | |
158 | // We don't care about neutrals and non-physical primaries | |
159 | if(mcPart->Charge() == 0) continue; | |
160 | ||
161 | //check if current particle is a physical primary | |
162 | if(!fMCEvent->IsPhysicalPrimary(ipart)) continue; | |
163 | if(mcPart->Pt()<0.5) continue; | |
164 | if(TMath::Abs(mcPart->Eta())>0.8) continue; | |
165 | atLeast1Track = kTRUE; | |
166 | break; | |
167 | } | |
168 | ||
169 | AliGenPythiaEventHeader * headPy = 0; | |
170 | AliGenDPMjetEventHeader * headPho = 0; | |
171 | AliGenEventHeader * htmp = fMCEvent->GenEventHeader(); | |
172 | if(!htmp) { | |
173 | AliFatal("Cannot Get MC Header!!"); | |
174 | return; | |
175 | } | |
176 | if( TString(htmp->IsA()->GetName()) == "AliGenPythiaEventHeader") { | |
177 | headPy = (AliGenPythiaEventHeader*) htmp; | |
178 | } else if (TString(htmp->IsA()->GetName()) == "AliGenDPMjetEventHeader") { | |
179 | headPho = (AliGenDPMjetEventHeader*) htmp; | |
180 | } else { | |
181 | AliFatal("Unknown header"); | |
182 | } | |
183 | if(headPy) { | |
184 | // cout << "Process: " << headPy->ProcessType() << endl; | |
185 | if(headPy->ProcessType() == 92 || headPy->ProcessType() == 93) { | |
186 | isSD = kTRUE; // is single difractive | |
187 | } | |
188 | if(headPy->ProcessType() != 92 && headPy->ProcessType() != 93 && headPy->ProcessType() != 94) { | |
189 | isND = kTRUE; // is non-diffractive | |
190 | } | |
191 | ||
192 | } else if (headPho) { | |
193 | if(headPho->ProcessType() == 5 || headPho->ProcessType() == 6 ) { | |
194 | isSD = kTRUE; | |
195 | } | |
196 | if(headPho->ProcessType() != 5 && headPho->ProcessType() != 6 && headPho->ProcessType() != 7 ) { | |
197 | isND = kTRUE; | |
198 | } | |
199 | } | |
200 | ||
201 | } | |
202 | } | |
203 | ||
359f9654 | 204 | static AliESDtrackCuts * cuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(); |
91ea438c | 205 | // cuts->SetPtRange(0.5,10000); |
206 | // cuts->SetEtaRange(-0.8, 0.8); | |
207 | Int_t ntracksLoop = fESD->GetNumberOfTracks(); | |
208 | ||
209 | Bool_t atLeast1TrackESD = kFALSE; | |
210 | for (Int_t iTrack = 0; iTrack<ntracksLoop; iTrack++) { | |
211 | AliESDtrack * track = dynamic_cast<AliESDtrack*>(fESD->GetTrack(iTrack)); | |
212 | // for each track | |
213 | ||
214 | // track quality cuts | |
215 | if(!cuts->AcceptTrack(track)) continue; | |
216 | if(track->Pt()<0.5) continue; | |
217 | if(TMath::Abs(track->Eta())>0.8) continue; | |
218 | ||
219 | atLeast1TrackESD = kTRUE; | |
220 | break; | |
221 | } | |
222 | ||
223 | ||
359f9654 | 224 | |
225 | Bool_t vdArray[kNVDEntries]; | |
f07573a6 | 226 | vdArray[kVDV0ANDOnline] = c0v0A && c0v0C; |
227 | vdArray[kVDV0ANDOffline] = v0AHW && v0CHW; | |
228 | vdArray[kVDRecCandle] = atLeast1Track; | |
229 | vdArray[kVDPhysSel] = isSelected; | |
91ea438c | 230 | // vdArray[kVDNTRACKSESD] = atLeast1TrackESD; |
359f9654 | 231 | |
232 | FillTriggerOverlaps("All", "All Events",vdArray); | |
91ea438c | 233 | if(!isSD) FillTriggerOverlaps("NSD", "NSD Events",vdArray); |
359f9654 | 234 | |
bcc49144 | 235 | |
236 | // Physics selection | |
237 | Bool_t isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB); | |
238 | if(!isSelected) return; | |
bcc49144 | 239 | |
abd808b9 | 240 | |
241 | GetHistoSPD1 ("AllPSNoPrino", "All events after physsel (no ZDC time)")->Fill(outerLayerSPD); | |
242 | GetHistoV0M ("AllPSNoPrino", "All events after physsel (no ZDC time)")->Fill(multV0); | |
bcc49144 | 243 | |
244 | ||
245 | // Francesco's cuts | |
abd808b9 | 246 | // const AliESDVertex * vtxESDTPC= fESD->GetPrimaryVertexTPC(); |
247 | // if(vtxESDTPC->GetNContributors()<1) return; | |
248 | // if (vtxESDTPC->GetNContributors()<(-10.+0.25*fESD->GetMultiplicity()->GetNumberOfITSClusters(0))) return; | |
249 | // const AliESDVertex * vtxESDSPD= fESD->GetPrimaryVertexSPD(); | |
250 | // Float_t tpcContr=vtxESDTPC->GetNContributors(); | |
bcc49144 | 251 | |
252 | ||
253 | ||
254 | // GetT0 Stuff | |
255 | const Double32_t *meanT0 = fESD->GetT0TOF(); | |
256 | const Double32_t meanT0A = 0.001* meanT0[1]; | |
257 | const Double32_t meanT0C = 0.001* meanT0[2]; | |
258 | const Double32_t meanT0AC = 0.001* meanT0[0]; | |
259 | Double32_t T0Vertex = fESD->GetT0zVertex(); | |
260 | // Double32_t *ampT0 =Esdevent ->GetT0amplitude(); | |
261 | ||
262 | // cut1yesF = ( (meanC < 95. && meanA < 95.) && (meanC < -2.) ) && francescoscut | |
263 | // cut1notF = ( (meanC < 95. && meanA < 95.) && (meanC < -2.) ) && ! francescoscut | |
264 | // cut2 = ( (meanC < 95. && meanA < 95.) && ( (meanC-meanA) <=-0.7) && meanC > -2) ) | |
265 | // cut3 = ( (meanC < 95. && meanA < 95.) && ( (meanC-meanA) < 0.7 && (meanC-meanA) > -0.7 ) ) | |
266 | // cut4 = ( (meanC < 95. && meanA < 95.) && (meanA < -2.) | |
267 | ||
268 | Bool_t cut1T0 = ( (meanT0C < 95. && meanT0A < 95.) && (meanT0C < -2.) ); | |
269 | Bool_t cut2T0 = ( (meanT0C < 95. && meanT0A < 95.) && ( (meanT0C-meanT0A) <=-0.7) && meanT0C > -2) ; | |
9d173aad | 270 | |
52d405b5 | 271 | if(ntracklets > fNTrackletsCut) return; |
272 | ||
a82dc581 | 273 | // Reset histo suffix and fill reference histograms without any suffix |
274 | fHistoSuffix = ""; | |
9d173aad | 275 | |
276 | // Fast or in the outer layer | |
277 | Int_t nFastOrOnline = fTriggerAnalysis->SPDFiredChips(fESD, 1, 0, 2); // offline | |
278 | Int_t nFastOrOffline = fTriggerAnalysis->SPDFiredChips(fESD, 0, 0, 2); // online | |
9d173aad | 279 | |
280 | Bool_t c0sm1 = nFastOrOffline >= 1; | |
281 | Bool_t c0sm2 = nFastOrOffline >= 2; | |
282 | Bool_t c0sm3 = nFastOrOffline >= 3; | |
283 | Bool_t c0sm4 = nFastOrOffline >= 4; | |
284 | Bool_t c0sm5 = nFastOrOffline >= 5; | |
285 | ||
eef42d18 | 286 | |
9d173aad | 287 | // TOF triggers |
52d405b5 | 288 | // FIXME: move to triggeranalysis? |
289 | AliESDHeader*h = fESD->GetHeader(); // taken the header from AliESDEvent | |
290 | Bool_t c0OM2 = h->IsTriggerInputFired("0OM2"); // thr >= 2 (input 19) | |
291 | Bool_t c0OM3 = h->IsTriggerInputFired("0OM3"); // thr >= 3 (input 20) | |
9d173aad | 292 | |
5ec1c2f5 | 293 | // ZDC triggers |
abd808b9 | 294 | Bool_t zdcA = kFALSE; |
295 | Bool_t zdcC = kFALSE; | |
296 | Bool_t zdcBar = kFALSE; | |
297 | Bool_t zdcTime = fTriggerAnalysis->ZDCTimeTrigger(fESD); | |
bcc49144 | 298 | |
299 | if (!fIsMC) { | |
300 | // If it's data, we use the TDCs | |
301 | zdcA = fTriggerAnalysis->ZDCTDCTrigger(fESD, AliTriggerAnalysis::kASide, kTRUE, kFALSE) ; | |
302 | zdcC = fTriggerAnalysis->ZDCTDCTrigger(fESD, AliTriggerAnalysis::kCSide, kTRUE, kFALSE) ; | |
303 | zdcBar = fTriggerAnalysis->ZDCTDCTrigger(fESD, AliTriggerAnalysis::kCentralBarrel) ; | |
304 | } else { | |
305 | // If it's MC, we use the energy | |
306 | Double_t minEnergy = 0; | |
307 | AliESDZDC *esdZDC = fESD->GetESDZDC(); | |
308 | Double_t zNCEnergy = esdZDC->GetZDCN1Energy(); | |
309 | Double_t zPCEnergy = esdZDC->GetZDCP1Energy(); | |
310 | Double_t zNAEnergy = esdZDC->GetZDCN2Energy(); | |
311 | Double_t zPAEnergy = esdZDC->GetZDCP2Energy(); | |
bcf2601a | 312 | // zdcA = (zNAEnergy>minEnergy || zPAEnergy>minEnergy); |
313 | // zdcC = (zNCEnergy>minEnergy || zPCEnergy>minEnergy); | |
314 | zdcA = (zNAEnergy>minEnergy); | |
315 | zdcC = (zNCEnergy>minEnergy); | |
bcc49144 | 316 | } |
317 | ||
5ec1c2f5 | 318 | |
9d173aad | 319 | // Some macros for the online triggers |
320 | Bool_t cMBS2A = c0sm2 && c0v0A; | |
321 | Bool_t cMBS2C = c0sm2 && c0v0C; | |
322 | Bool_t cMBAC = c0v0A && c0v0C; | |
52d405b5 | 323 | |
9d173aad | 324 | |
359f9654 | 325 | |
326 | ||
52d405b5 | 327 | |
abd808b9 | 328 | // Plots requested by Jurgen on 18/11/2010 + later updates (including plots for the note) |
bcc49144 | 329 | // FIXME: will skip everything else |
330 | ||
abd808b9 | 331 | |
332 | if(zdcTime) { | |
333 | GetHistoSPD1 ("ZDCTIME", "ZDC Time Cut")->Fill(outerLayerSPD); | |
334 | GetHistoTracks("ZDCTIME", "ZDC Time Cut")->Fill(ntracks); | |
335 | GetHistoV0M ("ZDCTIME", "ZDC Time Cut")->Fill(multV0); | |
336 | } | |
337 | ||
338 | if(zdcTime && ntracks > 1) { | |
339 | GetHistoSPD1 ("ZDCTIME1TRACK", "ZDC Time Cut & 1 Track")->Fill(outerLayerSPD); | |
340 | GetHistoTracks("ZDCTIME1TRACK", "ZDC Time Cut & 1 Track")->Fill(ntracks); | |
341 | GetHistoV0M ("ZDCTIME1TRACK", "ZDC Time Cut & 1 Track")->Fill(multV0); | |
342 | } | |
343 | ||
344 | // GetHistoSPD1 ("PhysSel", "All events after physics selection and Francesco's cut")->Fill(outerLayerSPD); | |
345 | // GetHistoTracks("PhysSel", "All events after physics selection and Francesco's cut")->Fill(ntracks); | |
346 | // GetHistoV0M ("PhysSel", "All events after physics selection and Francesco's cut")->Fill(multV0); | |
bcc49144 | 347 | if(c0v0A && c0v0C) { |
348 | GetHistoSPD1 ("V0AND", "V0A & V0C")->Fill(outerLayerSPD); | |
349 | GetHistoTracks("V0AND", "V0A & V0C")->Fill(ntracks); | |
350 | GetHistoV0M ("V0AND", "V0A & V0C")->Fill(multV0); | |
351 | } | |
bfae2924 | 352 | if((c0v0A && !c0v0C) || (!c0v0A && c0v0C)) { |
353 | GetHistoSPD1 ("V0ONLYONE", "(V0A & !V0C) || (!V0A & V0C)")->Fill(outerLayerSPD); | |
354 | GetHistoTracks("V0ONLYONE", "(V0A & !V0C) || (!V0A & V0C)")->Fill(ntracks); | |
355 | GetHistoV0M ("V0ONLYONE", "(V0A & !V0C) || (!V0A & V0C)")->Fill(multV0); | |
356 | } | |
bcc49144 | 357 | if(zdcA && zdcC) { |
358 | GetHistoSPD1 ("ZDCAND", "ZDCA & ZDCC")->Fill(outerLayerSPD); | |
359 | GetHistoTracks("ZDCAND", "ZDCA & ZDCC")->Fill(ntracks); | |
360 | GetHistoV0M ("ZDCAND", "ZDCA & ZDCC")->Fill(multV0); | |
361 | } | |
362 | if((c0v0A && c0v0C) && !(zdcA && zdcC)) { | |
363 | GetHistoSPD1 ("V0ANDNOTZDCAND", "(V0A & V0C) & !(ZDCA & ZDCC)")->Fill(outerLayerSPD); | |
364 | GetHistoTracks("V0ANDNOTZDCAND", "(V0A & V0C) & !(ZDCA & ZDCC)")->Fill(ntracks); | |
365 | GetHistoV0M ("V0ANDNOTZDCAND", "(V0A & V0C) & !(ZDCA & ZDCC)")->Fill(multV0); | |
366 | } | |
367 | if((c0v0A && c0v0C) && !zdcA && !zdcC) { | |
368 | GetHistoSPD1 ("V0ANDNOTZDC", "(V0A & V0C) & !ZDCA & !ZDCC)")->Fill(outerLayerSPD); | |
369 | GetHistoTracks("V0ANDNOTZDC", "(V0A & V0C) & !ZDCA & !ZDCC)")->Fill(ntracks); | |
370 | GetHistoV0M ("V0ANDNOTZDC", "(V0A & V0C) & !ZDCA & !ZDCC)")->Fill(multV0); | |
371 | } | |
372 | if((c0v0A && c0v0C) && ((!zdcA && zdcC) || (zdcA && !zdcC))) { | |
373 | GetHistoSPD1 ("V0ANDONEZDC", "(V0A & V0C) & ((!ZDCA && ZDCC) || (ZDCA && !ZDCC)))")->Fill(outerLayerSPD); | |
374 | GetHistoTracks("V0ANDONEZDC", "(V0A & V0C) & ((!ZDCA && ZDCC) || (ZDCA && !ZDCC)))")->Fill(ntracks); | |
375 | GetHistoV0M ("V0ANDONEZDC", "(V0A & V0C) & ((!ZDCA && ZDCC) || (ZDCA && !ZDCC)))")->Fill(multV0); | |
376 | } | |
377 | ||
378 | if(((c0v0A && !c0v0C) || (!c0v0A && c0v0C)) && (zdcA && zdcC)) { | |
379 | GetHistoSPD1 ("V0ONEZDCBOTH", "((V0A && !V0C) || (!V0A && V0C)) && (ZDCA && ZDCC)")->Fill(outerLayerSPD); | |
380 | GetHistoTracks("V0ONEZDCBOTH", "((V0A && !V0C) || (!V0A && V0C)) && (ZDCA && ZDCC)")->Fill(ntracks); | |
381 | GetHistoV0M ("V0ONEZDCBOTH", "((V0A && !V0C) || (!V0A && V0C)) && (ZDCA && ZDCC)")->Fill(multV0); | |
382 | } | |
383 | ||
384 | if((c0v0A && c0v0C) && (zdcA && zdcC)) { | |
385 | GetHistoSPD1 ("V0ANDZDCAND", "(V0A & V0C) & (ZDCA & ZDCC)")->Fill(outerLayerSPD); | |
386 | GetHistoTracks("V0ANDZDCAND", "(V0A & V0C) & (ZDCA & ZDCC)")->Fill(ntracks); | |
387 | GetHistoV0M ("V0ANDZDCAND", "(V0A & V0C) & (ZDCA & ZDCC)")->Fill(multV0); | |
388 | } | |
389 | ||
390 | if((c0v0A && zdcA && !zdcC && !c0v0C) || (c0v0C && zdcC && !zdcA && !c0v0A)) { | |
391 | GetHistoSPD1 ("OneSided", "(V0A & ZDCA & !ZDCC & !V0C) || (V0C & ZDCC & !ZDCA & !V0A)")->Fill(outerLayerSPD); | |
392 | GetHistoTracks("OneSided", "(V0A & ZDCA & !ZDCC & !V0C) || (V0C & ZDCC & !ZDCA & !V0A)")->Fill(ntracks); | |
393 | GetHistoV0M ("OneSided", "(V0A & ZDCA & !ZDCC & !V0C) || (V0C & ZDCC & !ZDCA & !V0A)")->Fill(multV0); | |
394 | } | |
395 | ||
396 | // GetHistoCorrelationSPDTPCVz("All", "After physics selection and Francesco's cut")->Fill(vtxESDSPD->GetZ(),vtxESDTPC->GetZ()); | |
397 | // if(cut1T0) GetHistoCorrelationSPDTPCVz("Cut1T0", "T0 Cut 1")->Fill(vtxESDSPD->GetZ(),vtxESDTPC->GetZ()); | |
398 | // if(cut2T0) GetHistoCorrelationSPDTPCVz("Cut2T0", "T0 Cut 2")->Fill(vtxESDSPD->GetZ(),vtxESDTPC->GetZ()); | |
399 | ||
400 | // GetHistoCorrelationContrTPCSPDCls("All", "After physics selection and Francesco's cut")->Fill(totalClusSPD,tpcContr); | |
401 | // if(cut1T0) GetHistoCorrelationContrTPCSPDCls("Cut1T0", "T0 Cut 1")->Fill(totalClusSPD,tpcContr); | |
402 | // if(cut2T0) GetHistoCorrelationContrTPCSPDCls("Cut2T0", "T0 Cut 2")->Fill(totalClusSPD,tpcContr); | |
403 | ||
404 | // GetHistoCorrelationTrackletsSPDCls("All", "After physics selection and Francesco's cut")->Fill(totalClusSPD,ntracklets); | |
405 | // if(cut1T0) GetHistoCorrelationTrackletsSPDCls("Cut1T0", "T0 Cut 1")->Fill(totalClusSPD,ntracklets); | |
406 | // if(cut2T0) GetHistoCorrelationTrackletsSPDCls("Cut2T0", "T0 Cut 2")->Fill(totalClusSPD,ntracklets); | |
407 | ||
408 | ||
409 | return; // FIXME | |
410 | ||
411 | ||
eef42d18 | 412 | // Reject background |
413 | if (v0BG && fRejectBGWithV0) { | |
414 | cout << "Rejection BG" << endl; | |
415 | ||
416 | return; | |
417 | } | |
418 | // Fill global histos | |
419 | GetHistoTracklets("all","All events")->Fill(ntracklets); | |
52d405b5 | 420 | FillTriggerOverlaps("All", "All Events",vdArray); |
a82dc581 | 421 | |
7f5f2e0c | 422 | // Fill some combination of trigger classes |
423 | Bool_t cmbs1aOnline = fESD->IsTriggerClassFired("CMBS1A-B-NOPF-ALL"); | |
424 | Bool_t cmbs1cOnline = fESD->IsTriggerClassFired("CMBS1C-B-NOPF-ALL"); | |
425 | Bool_t cmbacOnline = fESD->IsTriggerClassFired("CMBAC-B-NOPF-ALL"); | |
426 | ||
eef42d18 | 427 | Bool_t twoOutOfThree = kFALSE; |
428 | if (cmbs1aOnline || cmbs1cOnline ||cmbacOnline) twoOutOfThree = kTRUE; | |
429 | if (twoOutOfThree) GetHistoTracklets("All_TwoOutOfThree" ,"Events 2-out-of-3 online" )->Fill(ntracklets); | |
7f5f2e0c | 430 | |
a82dc581 | 431 | |
432 | // loop over trigger classes in the event | |
433 | TObjArray * tokens = 0; | |
434 | if(fIsMC) { | |
435 | // in case of montecarlo I override the trigger class | |
436 | tokens = new TObjArray; | |
437 | tokens->SetOwner(); | |
438 | // tokens->Add(new TObjString("CINT1B-ABCE-NOPF-ALL")); | |
439 | tokens->Add(new TObjString("MC")); | |
440 | } | |
441 | else { | |
442 | TString trgClasses = fESD->GetFiredTriggerClasses(); | |
7f5f2e0c | 443 | tokens = trgClasses.Tokenize(" "); |
a82dc581 | 444 | } |
7f5f2e0c | 445 | TIterator * iter = (TIterator*) tokens->MakeIterator(); |
446 | ||
447 | TString classes = fESD->GetFiredTriggerClasses(); | |
448 | ||
449 | // if (classes.Contains("SMH")) { | |
450 | // tokens->Print(); | |
451 | // cout << classes.Data() << endl; | |
452 | // } | |
453 | // iter->Reset(); | |
4d0aa70f | 454 | //Int_t itoken = 0; |
7f5f2e0c | 455 | TObjString * tok=0; |
456 | while((tok = (TObjString*) iter->Next())){ | |
a82dc581 | 457 | // clean up trigger name |
458 | TString trg = tok->GetString(); | |
459 | trg.Strip(TString::kTrailing, ' '); | |
460 | trg.Strip(TString::kLeading, ' '); | |
461 | ||
462 | fHistoSuffix = "_"; | |
463 | fHistoSuffix += trg; | |
464 | ||
7f5f2e0c | 465 | // cout << itoken++ << " " << trg.Data() << endl; |
466 | // continue; | |
467 | // if (trg.Contains("SMH")) cout << itoken++ << " " << trg.Data() << endl; | |
468 | ||
469 | // Fill tracklets | |
eef42d18 | 470 | GetHistoTracklets("All" ,"Events no offline trigger" )->Fill(ntracklets); |
7f5f2e0c | 471 | |
472 | ||
a82dc581 | 473 | // Fill histograms mismatchs |
474 | // TODO: check mismatch trigger class | |
475 | if(nFastOrOffline != nFastOrOnline) { | |
476 | GetHistoTracklets("mismatchingFastOr", "Events where fast or offline differs from fast-or online")->Fill(ntracklets); | |
477 | } | |
478 | ||
479 | if (c0v0A != v0AHW){ | |
480 | GetHistoTracklets("mismatchingV0A", "Events where V0A offline differs from V0A online")->Fill(ntracklets); | |
481 | } | |
482 | ||
483 | if (c0v0C != v0CHW){ | |
484 | GetHistoTracklets("mismatchingV0C", "Events where V0C offline differs from V0C online")->Fill(ntracklets); | |
485 | } | |
486 | ||
487 | // Fill a tracklet histo for each trigger type | |
488 | if(c0sm1) GetHistoTracklets("c0sm1" ,"Events were trigger c0sm1 fired" )->Fill(ntracklets); | |
489 | if(c0sm2) GetHistoTracklets("c0sm2" ,"Events were trigger c0sm2 fired" )->Fill(ntracklets); | |
490 | if(c0sm3) GetHistoTracklets("c0sm3" ,"Events were trigger c0sm3 fired" )->Fill(ntracklets); | |
491 | if(c0sm4) GetHistoTracklets("c0sm4" ,"Events were trigger c0sm4 fired" )->Fill(ntracklets); | |
492 | if(c0sm5) GetHistoTracklets("c0sm5" ,"Events were trigger c0sm5 fired" )->Fill(ntracklets); | |
493 | if(c0OM2) GetHistoTracklets("c0OM2" ,"Events were trigger c0OM2 fired" )->Fill(ntracklets); | |
494 | if(c0OM3) GetHistoTracklets("c0OM3" ,"Events were trigger c0OM3 fired" )->Fill(ntracklets); | |
495 | if(c0v0A) GetHistoTracklets("c0v0A" ,"Events were trigger c0v0A fired" )->Fill(ntracklets); | |
496 | if(c0v0C) GetHistoTracklets("c0v0C" ,"Events were trigger c0v0C fired" )->Fill(ntracklets); | |
497 | if(cMBS2A) GetHistoTracklets("cMBS2A","Events were trigger cMBS2A fired")->Fill(ntracklets); | |
498 | if(cMBS2C) GetHistoTracklets("cMBS2C","Events were trigger cMBS2C fired")->Fill(ntracklets); | |
5ec1c2f5 | 499 | if(cMBAC ) GetHistoTracklets("cMBAC", "Events were trigger cMBAC fired")->Fill(ntracklets); |
500 | if(zdcA ) GetHistoTracklets("cZDCA", "Events were trigger cZDCA fired")->Fill(ntracklets); | |
eef42d18 | 501 | if(zdcC ) GetHistoTracklets("cZDCC", "Events were trigger cZDCC fired")->Fill(ntracklets); |
502 | if(!zdcA && !zdcC ) GetHistoTracklets("NoZDC", "Events were zdc trigger don't fired")->Fill(ntracklets); | |
503 | if( (zdcA && !zdcC) || (!zdcA && zdcC) ) GetHistoTracklets("OneSideZDC", "Events were only 1 ZDC fired")->Fill(ntracklets); | |
504 | if( (zdcA && zdcC) ) GetHistoTracklets("TwoSideZDC", "Events were both ZDC fired")->Fill(ntracklets); | |
505 | ||
506 | if(twoOutOfThree) { | |
507 | if(!zdcA && !zdcC ) GetHistoTracklets("NoZDC_TwoOutOfThree", "Events were zdc trigger don't fired")->Fill(ntracklets); | |
508 | if( (zdcA && !zdcC) || (!zdcA && zdcC) ) GetHistoTracklets("OneSideZDC_TwoOutOfThree", "Events were only 1 ZDC fired")->Fill(ntracklets); | |
509 | if( (zdcA && zdcC) ) GetHistoTracklets("TwoSideZDC_TwoOutOfThree", "Events were both ZDC fired")->Fill(ntracklets); | |
510 | } | |
5ec1c2f5 | 511 | if(zdcBar) GetHistoTracklets("cZDCBar","Events were trigger cZDCB fired")->Fill(ntracklets); |
a82dc581 | 512 | // if() GetHistoTracklets("","Events were trigger fired"); |
52d405b5 | 513 | |
514 | // Fill trigger overlaps | |
515 | FillTriggerOverlaps("All", "All Events in trigger class",vdArray); | |
516 | ||
eef42d18 | 517 | |
518 | // Fill kinematic variables for peripheral events | |
519 | static AliESDtrackCuts * cuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(); // FIXME: change this ? | |
520 | if (ntracklets < fNTrackletsCutKine) { | |
521 | // 1. Loop on tracklets | |
522 | for(Int_t itracklet = 0; itracklet < ntracklets; itracklet++){ | |
523 | GetHistoEta("All", Form("Tracklet #eta distribution, ntracklets < %d",fNTrackletsCutKine))->Fill(mult->GetEta(itracklet)); | |
524 | } | |
525 | // 2. loop on tracks | |
526 | TObjArray * goodTracks = cuts->GetAcceptedTracks(fESD); | |
527 | TIterator * iterTracks = goodTracks->MakeIterator(); | |
528 | AliESDtrack * esdTrack = 0; | |
529 | while ((esdTrack = (AliESDtrack*) iterTracks->Next())) { | |
530 | GetHistoPt("All", Form("Tracklet p_{T} distribution, ntracklets < %d",fNTrackletsCutKine))->Fill(esdTrack->Pt()); | |
531 | } | |
532 | delete goodTracks; | |
533 | } | |
534 | ||
535 | ||
a82dc581 | 536 | } |
7f5f2e0c | 537 | delete tokens; |
a82dc581 | 538 | |
539 | // if (fIsMC) { | |
9d173aad | 540 | |
541 | ||
542 | // if (!fMCEvent) { | |
543 | // AliError("No MC info found"); | |
544 | // } else { | |
545 | ||
546 | // //loop on the MC event | |
547 | // // Int_t nMCTracks = fMCEvent->GetNumberOfTracks(); | |
548 | // Int_t offset = fMCEvent->GetPrimaryOffset(); | |
549 | // Int_t nMCTracks = fMCEvent->GetNumberOfPrimaries()+offset; | |
550 | // for (Int_t ipart=offset; ipart<nMCTracks; ipart++) { | |
551 | ||
552 | // AliMCParticle *mcPart = (AliMCParticle*)fMCEvent->GetTrack(ipart); | |
553 | ||
554 | // // We don't care about neutrals and non-physical primaries | |
555 | // if(mcPart->Charge() == 0) continue; | |
556 | ||
e0376287 | 557 | // PHYSICAL PRIMARY |
9d173aad | 558 | // // Get MC vertex |
e0376287 | 559 | // TArrayF vertex; |
9d173aad | 560 | // fMCEvent->GenEventHeader()->PrimaryVertex(vertex); |
561 | // Float_t zv = vertex[2]; | |
562 | // // Float_t zv = vtxESD->GetZ(); | |
563 | // // Fill generated histo | |
564 | // hTracks[AliAnalysisMultPbTrackHistoManager::kHistoGen]->Fill(mcPart->Pt(),mcPart->Eta(),zv); | |
565 | ||
566 | // } | |
567 | // } | |
568 | // } | |
569 | ||
570 | ||
571 | ||
572 | ||
573 | } | |
574 | ||
575 | void AliAnalysisTaskTriggerStudy::Terminate(Option_t *){ | |
576 | // terminate | |
577 | // Save output in a more friendly format | |
578 | fHistoList = dynamic_cast<AliHistoListWrapper*> (GetOutputData(1)); | |
579 | if (!fHistoList){ | |
580 | Printf("ERROR: fHistoList not available"); | |
581 | return; | |
582 | } | |
583 | TFile * f = new TFile("trigger_study.root", "recreate"); | |
584 | fHistoList->GetList()->Write(); | |
585 | f->Close(); | |
586 | ||
587 | } | |
588 | ||
589 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoTracklets(const char * name, const char * title){ | |
a82dc581 | 590 | // Book histo of events vs ntracklets, if needed |
9d173aad | 591 | |
a82dc581 | 592 | TString hname = "hTracklets_"; |
593 | hname+=name; | |
594 | hname+=fHistoSuffix; | |
9d173aad | 595 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); |
596 | ||
597 | if(!h) { | |
598 | AliInfo(Form("Booking histo %s",hname.Data())); | |
599 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
600 | TH1::AddDirectory(kFALSE); | |
7f5f2e0c | 601 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); |
602 | h = new TH1F (hname.Data(), title, 4000, -0.5, 4000-0.5); | |
9d173aad | 603 | h->Sumw2(); |
604 | h->SetXTitle("ntracklets"); | |
605 | fHistoList->GetList()->Add(h); | |
606 | TH1::AddDirectory(oldStatus); | |
607 | } | |
608 | return h; | |
609 | } | |
610 | ||
bcc49144 | 611 | |
612 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoSPD1(const char * name, const char * title){ | |
613 | // Book histo of events vs ntracklets, if needed | |
614 | ||
615 | TString hname = "hSPD1_"; | |
616 | hname+=name; | |
617 | hname+=fHistoSuffix; | |
618 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
619 | ||
620 | // const Int_t nbin = 118; | |
621 | // Float_t bins[nbin] = {0}; | |
622 | // bins[0] = 0; | |
623 | // for(Int_t ibin = 1; ibin <= nbin; ibin++){ | |
624 | // if (ibin < 100) | |
625 | // bins[ibin] = bins [ibin-1]+1; | |
626 | // else if (ibin < 1000) | |
627 | // bins[ibin] = bins [ibin-1]+100; | |
628 | // else if (ibin < 10000) | |
629 | // bins[ibin] = bins [ibin-1]+1000; | |
630 | // } | |
631 | ||
632 | ||
633 | if(!h) { | |
634 | AliInfo(Form("Booking histo %s",hname.Data())); | |
635 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
636 | TH1::AddDirectory(kFALSE); | |
637 | // h = new TH1F (hname.Data(), title, nbin, bins); | |
638 | //h = new TH1F (hname.Data(), title, 100, -0.5, 100-0.5); | |
639 | h = new TH1F (hname.Data(), title, 10000, -0.5, 10000-0.5); | |
640 | h->Sumw2(); | |
641 | h->SetXTitle("SPD1"); | |
642 | fHistoList->GetList()->Add(h); | |
643 | TH1::AddDirectory(oldStatus); | |
644 | } | |
645 | return h; | |
646 | } | |
647 | ||
648 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoV0M(const char * name, const char * title){ | |
649 | // Book histo of events vs ntracklets, if needed | |
650 | ||
651 | TString hname = "hV0M_"; | |
652 | hname+=name; | |
653 | hname+=fHistoSuffix; | |
654 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
655 | ||
656 | if(!h) { | |
657 | AliInfo(Form("Booking histo %s",hname.Data())); | |
658 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
659 | TH1::AddDirectory(kFALSE); | |
660 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); | |
abd808b9 | 661 | h = new TH1F (hname.Data(), title, 500, -0.5, 500-0.5); |
bcc49144 | 662 | h->Sumw2(); |
663 | h->SetXTitle("V0M"); | |
664 | fHistoList->GetList()->Add(h); | |
665 | TH1::AddDirectory(oldStatus); | |
666 | } | |
667 | return h; | |
668 | } | |
669 | ||
670 | ||
671 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoTracks(const char * name, const char * title){ | |
672 | // Book histo of events vs ntracklets, if needed | |
673 | ||
674 | TString hname = "hTPCTracks_"; | |
675 | hname+=name; | |
676 | hname+=fHistoSuffix; | |
677 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
678 | ||
679 | if(!h) { | |
680 | AliInfo(Form("Booking histo %s",hname.Data())); | |
681 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
682 | TH1::AddDirectory(kFALSE); | |
683 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); | |
684 | h = new TH1F (hname.Data(), title, 50, -0.5, 50-0.5); | |
685 | h->Sumw2(); | |
686 | h->SetXTitle("ntracks"); | |
687 | fHistoList->GetList()->Add(h); | |
688 | TH1::AddDirectory(oldStatus); | |
689 | } | |
690 | return h; | |
691 | } | |
692 | ||
693 | ||
eef42d18 | 694 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoEta(const char * name, const char * title){ |
695 | // Book histo of events vs ntracklets, if needed | |
696 | ||
697 | TString hname = "hEta_"; | |
698 | hname+=name; | |
699 | hname+=fHistoSuffix; | |
700 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
701 | ||
702 | if(!h) { | |
703 | AliInfo(Form("Booking histo %s",hname.Data())); | |
704 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
705 | TH1::AddDirectory(kFALSE); | |
706 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); | |
707 | h = new TH1F (hname.Data(), title, 20, -2, 2); | |
708 | h->Sumw2(); | |
709 | h->SetXTitle("#eta"); | |
710 | fHistoList->GetList()->Add(h); | |
711 | TH1::AddDirectory(oldStatus); | |
712 | } | |
713 | return h; | |
714 | } | |
715 | ||
716 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoPt(const char * name, const char * title){ | |
717 | // Book histo of pt distribution, if needed | |
718 | ||
719 | TString hname = "hPt_"; | |
720 | hname+=name; | |
721 | hname+=fHistoSuffix; | |
722 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
723 | ||
724 | if(!h) { | |
725 | AliInfo(Form("Booking histo %s",hname.Data())); | |
726 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
727 | TH1::AddDirectory(kFALSE); | |
728 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); | |
729 | h = new TH1F (hname.Data(), title, 100, -0.5, 1-0.5); | |
730 | h->Sumw2(); | |
731 | h->SetXTitle("p_{T}"); | |
732 | fHistoList->GetList()->Add(h); | |
733 | TH1::AddDirectory(oldStatus); | |
734 | } | |
735 | return h; | |
736 | } | |
737 | ||
bcc49144 | 738 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoCorrelationSPDTPCVz(const char * name, const char * title){ |
739 | // Book histo of events vs ntracklets, if needed | |
740 | ||
741 | TString hname = "hTPCvsSPD_"; | |
742 | hname+=name; | |
743 | hname+=fHistoSuffix; | |
744 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
745 | ||
746 | if(!h) { | |
747 | AliInfo(Form("Booking histo %s",hname.Data())); | |
748 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
749 | TH1::AddDirectory(kFALSE); | |
750 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); | |
751 | h = new TH2F (hname.Data(), title, 80, -20, 20, 80, -20, 20); | |
752 | h->Sumw2(); | |
753 | h->SetXTitle("SPD Vz"); | |
754 | h->SetYTitle("TPC Vz"); | |
755 | fHistoList->GetList()->Add(h); | |
756 | TH1::AddDirectory(oldStatus); | |
757 | } | |
758 | return h; | |
759 | } | |
760 | ||
761 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoCorrelationContrTPCSPDCls(const char * name, const char * title){ | |
762 | // Book histo of events vs ntracklets, if needed | |
763 | ||
764 | TString hname = "hContrTPCvsSPDCls_"; | |
765 | hname+=name; | |
766 | hname+=fHistoSuffix; | |
767 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
768 | ||
769 | if(!h) { | |
770 | AliInfo(Form("Booking histo %s",hname.Data())); | |
771 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
772 | TH1::AddDirectory(kFALSE); | |
773 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); | |
774 | h = new TH2F (hname.Data(), title, 1000, 0, 9000, 1000, 0, 5000); | |
775 | h->Sumw2(); | |
776 | h->SetXTitle("SPD Clusters"); | |
777 | h->SetYTitle("TPC V Contributors"); | |
778 | fHistoList->GetList()->Add(h); | |
779 | TH1::AddDirectory(oldStatus); | |
780 | } | |
781 | return h; | |
782 | } | |
783 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoCorrelationTrackletsSPDCls(const char * name, const char * title){ | |
784 | // Book histo of events vs ntracklets, if needed | |
785 | ||
786 | TString hname = "hTrackletsvsSPDCls_"; | |
787 | hname+=name; | |
788 | hname+=fHistoSuffix; | |
789 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
790 | ||
791 | if(!h) { | |
792 | AliInfo(Form("Booking histo %s",hname.Data())); | |
793 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
794 | TH1::AddDirectory(kFALSE); | |
795 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); | |
796 | h = new TH2F (hname.Data(), title, 1000, 0, 9000, 1000, 0, 5000); | |
797 | h->Sumw2(); | |
798 | h->SetXTitle("SPD Clusters"); | |
799 | h->SetYTitle("N tracklets"); | |
800 | fHistoList->GetList()->Add(h); | |
801 | TH1::AddDirectory(oldStatus); | |
802 | } | |
803 | return h; | |
804 | } | |
805 | ||
806 | ||
52d405b5 | 807 | void AliAnalysisTaskTriggerStudy::FillTriggerOverlaps (const char * name, const char * title, Bool_t * vdArray){ |
a82dc581 | 808 | //Fills a histo with the different trigger statistics in a venn like diagramm. Books it if needed. |
809 | ||
810 | // Get or book histo | |
811 | TString hname = "hTrigStat_"; | |
812 | hname+=name; | |
813 | hname+=fHistoSuffix; | |
814 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
815 | ||
816 | if(!h) { | |
817 | AliInfo(Form("Booking histo %s",hname.Data())); | |
818 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
819 | TH1::AddDirectory(kFALSE); | |
52d405b5 | 820 | Int_t nbins = 0; |
821 | for(Int_t ientry = 0; ientry < kNVDEntries; ientry++){ | |
822 | nbins = nbins | (1<<ientry); | |
823 | } | |
7f5f2e0c | 824 | // cout << "NBINS " << nbins << endl; |
825 | nbins = nbins+1; | |
52d405b5 | 826 | h = new TH1I (hname, title, nbins, -0.5, nbins-0.5); |
a82dc581 | 827 | fHistoList->GetList()->Add(h); |
828 | TH1::AddDirectory(oldStatus); | |
52d405b5 | 829 | |
830 | // we look at the combinations of n triggers | |
831 | // We set a bit for each trigger to fill the diagram | |
832 | // This is much simpler and faster than any recursive function | |
833 | h->GetXaxis()->SetBinLabel(1,"NONE"); | |
834 | for(Int_t ibin = 1; ibin < nbins; ibin++){ | |
835 | TString binname = ""; | |
836 | Bool_t first = kTRUE; | |
837 | for(Int_t ivdentry = 0; ivdentry < kNVDEntries; ivdentry++){ | |
838 | if (ibin & (1<<ivdentry)) { | |
839 | if(!first) binname += " & "; | |
840 | binname += kVDNames[ivdentry]; | |
841 | first=kFALSE; | |
842 | } | |
843 | } | |
844 | h->GetXaxis()->SetBinLabel(ibin+1,binname.Data()); | |
845 | } | |
846 | ||
a82dc581 | 847 | } |
848 | ||
52d405b5 | 849 | UInt_t mask = 0; |
850 | for(Int_t ivdentry = 0; ivdentry < kNVDEntries; ivdentry++){ | |
851 | if(vdArray[ivdentry]) { | |
852 | mask = mask | (1<<ivdentry); | |
853 | // cout << " 1 " ; | |
854 | } //else cout << " 0 "; | |
855 | } | |
856 | // cout << hex << " = " << mask << endl; | |
a82dc581 | 857 | |
52d405b5 | 858 | h->Fill(mask); |
9d173aad | 859 | |
a82dc581 | 860 | } |