]>
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"}; |
91ea438c | 37 | const char * AliAnalysisTaskTriggerStudy::kVDNames[] = {"V0AND","V0OR","NTRACKS", "NTRACKS ESD"};//,"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]; | |
226 | vdArray[kVDV0AND] = c0v0A && c0v0C; | |
227 | vdArray[kVDV0OR] = c0v0A || c0v0C; | |
228 | vdArray[kVDNTRACKS] = atLeast1Track; | |
91ea438c | 229 | // vdArray[kVDNTRACKSESD] = atLeast1TrackESD; |
359f9654 | 230 | |
231 | FillTriggerOverlaps("All", "All Events",vdArray); | |
91ea438c | 232 | if(!isSD) FillTriggerOverlaps("NSD", "NSD Events",vdArray); |
359f9654 | 233 | |
bcc49144 | 234 | |
235 | // Physics selection | |
236 | Bool_t isSelected = (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kMB); | |
237 | if(!isSelected) return; | |
bcc49144 | 238 | |
abd808b9 | 239 | |
240 | GetHistoSPD1 ("AllPSNoPrino", "All events after physsel (no ZDC time)")->Fill(outerLayerSPD); | |
241 | GetHistoV0M ("AllPSNoPrino", "All events after physsel (no ZDC time)")->Fill(multV0); | |
bcc49144 | 242 | |
243 | ||
244 | // Francesco's cuts | |
abd808b9 | 245 | // const AliESDVertex * vtxESDTPC= fESD->GetPrimaryVertexTPC(); |
246 | // if(vtxESDTPC->GetNContributors()<1) return; | |
247 | // if (vtxESDTPC->GetNContributors()<(-10.+0.25*fESD->GetMultiplicity()->GetNumberOfITSClusters(0))) return; | |
248 | // const AliESDVertex * vtxESDSPD= fESD->GetPrimaryVertexSPD(); | |
249 | // Float_t tpcContr=vtxESDTPC->GetNContributors(); | |
bcc49144 | 250 | |
251 | ||
252 | ||
253 | // GetT0 Stuff | |
254 | const Double32_t *meanT0 = fESD->GetT0TOF(); | |
255 | const Double32_t meanT0A = 0.001* meanT0[1]; | |
256 | const Double32_t meanT0C = 0.001* meanT0[2]; | |
257 | const Double32_t meanT0AC = 0.001* meanT0[0]; | |
258 | Double32_t T0Vertex = fESD->GetT0zVertex(); | |
259 | // Double32_t *ampT0 =Esdevent ->GetT0amplitude(); | |
260 | ||
261 | // cut1yesF = ( (meanC < 95. && meanA < 95.) && (meanC < -2.) ) && francescoscut | |
262 | // cut1notF = ( (meanC < 95. && meanA < 95.) && (meanC < -2.) ) && ! francescoscut | |
263 | // cut2 = ( (meanC < 95. && meanA < 95.) && ( (meanC-meanA) <=-0.7) && meanC > -2) ) | |
264 | // cut3 = ( (meanC < 95. && meanA < 95.) && ( (meanC-meanA) < 0.7 && (meanC-meanA) > -0.7 ) ) | |
265 | // cut4 = ( (meanC < 95. && meanA < 95.) && (meanA < -2.) | |
266 | ||
267 | Bool_t cut1T0 = ( (meanT0C < 95. && meanT0A < 95.) && (meanT0C < -2.) ); | |
268 | Bool_t cut2T0 = ( (meanT0C < 95. && meanT0A < 95.) && ( (meanT0C-meanT0A) <=-0.7) && meanT0C > -2) ; | |
9d173aad | 269 | |
52d405b5 | 270 | if(ntracklets > fNTrackletsCut) return; |
271 | ||
a82dc581 | 272 | // Reset histo suffix and fill reference histograms without any suffix |
273 | fHistoSuffix = ""; | |
9d173aad | 274 | |
275 | // Fast or in the outer layer | |
276 | Int_t nFastOrOnline = fTriggerAnalysis->SPDFiredChips(fESD, 1, 0, 2); // offline | |
277 | Int_t nFastOrOffline = fTriggerAnalysis->SPDFiredChips(fESD, 0, 0, 2); // online | |
9d173aad | 278 | |
279 | Bool_t c0sm1 = nFastOrOffline >= 1; | |
280 | Bool_t c0sm2 = nFastOrOffline >= 2; | |
281 | Bool_t c0sm3 = nFastOrOffline >= 3; | |
282 | Bool_t c0sm4 = nFastOrOffline >= 4; | |
283 | Bool_t c0sm5 = nFastOrOffline >= 5; | |
284 | ||
eef42d18 | 285 | |
9d173aad | 286 | // TOF triggers |
52d405b5 | 287 | // FIXME: move to triggeranalysis? |
288 | AliESDHeader*h = fESD->GetHeader(); // taken the header from AliESDEvent | |
289 | Bool_t c0OM2 = h->IsTriggerInputFired("0OM2"); // thr >= 2 (input 19) | |
290 | Bool_t c0OM3 = h->IsTriggerInputFired("0OM3"); // thr >= 3 (input 20) | |
9d173aad | 291 | |
5ec1c2f5 | 292 | // ZDC triggers |
abd808b9 | 293 | Bool_t zdcA = kFALSE; |
294 | Bool_t zdcC = kFALSE; | |
295 | Bool_t zdcBar = kFALSE; | |
296 | Bool_t zdcTime = fTriggerAnalysis->ZDCTimeTrigger(fESD); | |
bcc49144 | 297 | |
298 | if (!fIsMC) { | |
299 | // If it's data, we use the TDCs | |
300 | zdcA = fTriggerAnalysis->ZDCTDCTrigger(fESD, AliTriggerAnalysis::kASide, kTRUE, kFALSE) ; | |
301 | zdcC = fTriggerAnalysis->ZDCTDCTrigger(fESD, AliTriggerAnalysis::kCSide, kTRUE, kFALSE) ; | |
302 | zdcBar = fTriggerAnalysis->ZDCTDCTrigger(fESD, AliTriggerAnalysis::kCentralBarrel) ; | |
303 | } else { | |
304 | // If it's MC, we use the energy | |
305 | Double_t minEnergy = 0; | |
306 | AliESDZDC *esdZDC = fESD->GetESDZDC(); | |
307 | Double_t zNCEnergy = esdZDC->GetZDCN1Energy(); | |
308 | Double_t zPCEnergy = esdZDC->GetZDCP1Energy(); | |
309 | Double_t zNAEnergy = esdZDC->GetZDCN2Energy(); | |
310 | Double_t zPAEnergy = esdZDC->GetZDCP2Energy(); | |
bcf2601a | 311 | // zdcA = (zNAEnergy>minEnergy || zPAEnergy>minEnergy); |
312 | // zdcC = (zNCEnergy>minEnergy || zPCEnergy>minEnergy); | |
313 | zdcA = (zNAEnergy>minEnergy); | |
314 | zdcC = (zNCEnergy>minEnergy); | |
bcc49144 | 315 | } |
316 | ||
5ec1c2f5 | 317 | |
9d173aad | 318 | // Some macros for the online triggers |
319 | Bool_t cMBS2A = c0sm2 && c0v0A; | |
320 | Bool_t cMBS2C = c0sm2 && c0v0C; | |
321 | Bool_t cMBAC = c0v0A && c0v0C; | |
52d405b5 | 322 | |
9d173aad | 323 | |
359f9654 | 324 | |
325 | ||
52d405b5 | 326 | |
abd808b9 | 327 | // Plots requested by Jurgen on 18/11/2010 + later updates (including plots for the note) |
bcc49144 | 328 | // FIXME: will skip everything else |
329 | ||
abd808b9 | 330 | |
331 | if(zdcTime) { | |
332 | GetHistoSPD1 ("ZDCTIME", "ZDC Time Cut")->Fill(outerLayerSPD); | |
333 | GetHistoTracks("ZDCTIME", "ZDC Time Cut")->Fill(ntracks); | |
334 | GetHistoV0M ("ZDCTIME", "ZDC Time Cut")->Fill(multV0); | |
335 | } | |
336 | ||
337 | if(zdcTime && ntracks > 1) { | |
338 | GetHistoSPD1 ("ZDCTIME1TRACK", "ZDC Time Cut & 1 Track")->Fill(outerLayerSPD); | |
339 | GetHistoTracks("ZDCTIME1TRACK", "ZDC Time Cut & 1 Track")->Fill(ntracks); | |
340 | GetHistoV0M ("ZDCTIME1TRACK", "ZDC Time Cut & 1 Track")->Fill(multV0); | |
341 | } | |
342 | ||
343 | // GetHistoSPD1 ("PhysSel", "All events after physics selection and Francesco's cut")->Fill(outerLayerSPD); | |
344 | // GetHistoTracks("PhysSel", "All events after physics selection and Francesco's cut")->Fill(ntracks); | |
345 | // GetHistoV0M ("PhysSel", "All events after physics selection and Francesco's cut")->Fill(multV0); | |
bcc49144 | 346 | if(c0v0A && c0v0C) { |
347 | GetHistoSPD1 ("V0AND", "V0A & V0C")->Fill(outerLayerSPD); | |
348 | GetHistoTracks("V0AND", "V0A & V0C")->Fill(ntracks); | |
349 | GetHistoV0M ("V0AND", "V0A & V0C")->Fill(multV0); | |
350 | } | |
bfae2924 | 351 | if((c0v0A && !c0v0C) || (!c0v0A && c0v0C)) { |
352 | GetHistoSPD1 ("V0ONLYONE", "(V0A & !V0C) || (!V0A & V0C)")->Fill(outerLayerSPD); | |
353 | GetHistoTracks("V0ONLYONE", "(V0A & !V0C) || (!V0A & V0C)")->Fill(ntracks); | |
354 | GetHistoV0M ("V0ONLYONE", "(V0A & !V0C) || (!V0A & V0C)")->Fill(multV0); | |
355 | } | |
bcc49144 | 356 | if(zdcA && zdcC) { |
357 | GetHistoSPD1 ("ZDCAND", "ZDCA & ZDCC")->Fill(outerLayerSPD); | |
358 | GetHistoTracks("ZDCAND", "ZDCA & ZDCC")->Fill(ntracks); | |
359 | GetHistoV0M ("ZDCAND", "ZDCA & ZDCC")->Fill(multV0); | |
360 | } | |
361 | if((c0v0A && c0v0C) && !(zdcA && zdcC)) { | |
362 | GetHistoSPD1 ("V0ANDNOTZDCAND", "(V0A & V0C) & !(ZDCA & ZDCC)")->Fill(outerLayerSPD); | |
363 | GetHistoTracks("V0ANDNOTZDCAND", "(V0A & V0C) & !(ZDCA & ZDCC)")->Fill(ntracks); | |
364 | GetHistoV0M ("V0ANDNOTZDCAND", "(V0A & V0C) & !(ZDCA & ZDCC)")->Fill(multV0); | |
365 | } | |
366 | if((c0v0A && c0v0C) && !zdcA && !zdcC) { | |
367 | GetHistoSPD1 ("V0ANDNOTZDC", "(V0A & V0C) & !ZDCA & !ZDCC)")->Fill(outerLayerSPD); | |
368 | GetHistoTracks("V0ANDNOTZDC", "(V0A & V0C) & !ZDCA & !ZDCC)")->Fill(ntracks); | |
369 | GetHistoV0M ("V0ANDNOTZDC", "(V0A & V0C) & !ZDCA & !ZDCC)")->Fill(multV0); | |
370 | } | |
371 | if((c0v0A && c0v0C) && ((!zdcA && zdcC) || (zdcA && !zdcC))) { | |
372 | GetHistoSPD1 ("V0ANDONEZDC", "(V0A & V0C) & ((!ZDCA && ZDCC) || (ZDCA && !ZDCC)))")->Fill(outerLayerSPD); | |
373 | GetHistoTracks("V0ANDONEZDC", "(V0A & V0C) & ((!ZDCA && ZDCC) || (ZDCA && !ZDCC)))")->Fill(ntracks); | |
374 | GetHistoV0M ("V0ANDONEZDC", "(V0A & V0C) & ((!ZDCA && ZDCC) || (ZDCA && !ZDCC)))")->Fill(multV0); | |
375 | } | |
376 | ||
377 | if(((c0v0A && !c0v0C) || (!c0v0A && c0v0C)) && (zdcA && zdcC)) { | |
378 | GetHistoSPD1 ("V0ONEZDCBOTH", "((V0A && !V0C) || (!V0A && V0C)) && (ZDCA && ZDCC)")->Fill(outerLayerSPD); | |
379 | GetHistoTracks("V0ONEZDCBOTH", "((V0A && !V0C) || (!V0A && V0C)) && (ZDCA && ZDCC)")->Fill(ntracks); | |
380 | GetHistoV0M ("V0ONEZDCBOTH", "((V0A && !V0C) || (!V0A && V0C)) && (ZDCA && ZDCC)")->Fill(multV0); | |
381 | } | |
382 | ||
383 | if((c0v0A && c0v0C) && (zdcA && zdcC)) { | |
384 | GetHistoSPD1 ("V0ANDZDCAND", "(V0A & V0C) & (ZDCA & ZDCC)")->Fill(outerLayerSPD); | |
385 | GetHistoTracks("V0ANDZDCAND", "(V0A & V0C) & (ZDCA & ZDCC)")->Fill(ntracks); | |
386 | GetHistoV0M ("V0ANDZDCAND", "(V0A & V0C) & (ZDCA & ZDCC)")->Fill(multV0); | |
387 | } | |
388 | ||
389 | if((c0v0A && zdcA && !zdcC && !c0v0C) || (c0v0C && zdcC && !zdcA && !c0v0A)) { | |
390 | GetHistoSPD1 ("OneSided", "(V0A & ZDCA & !ZDCC & !V0C) || (V0C & ZDCC & !ZDCA & !V0A)")->Fill(outerLayerSPD); | |
391 | GetHistoTracks("OneSided", "(V0A & ZDCA & !ZDCC & !V0C) || (V0C & ZDCC & !ZDCA & !V0A)")->Fill(ntracks); | |
392 | GetHistoV0M ("OneSided", "(V0A & ZDCA & !ZDCC & !V0C) || (V0C & ZDCC & !ZDCA & !V0A)")->Fill(multV0); | |
393 | } | |
394 | ||
395 | // GetHistoCorrelationSPDTPCVz("All", "After physics selection and Francesco's cut")->Fill(vtxESDSPD->GetZ(),vtxESDTPC->GetZ()); | |
396 | // if(cut1T0) GetHistoCorrelationSPDTPCVz("Cut1T0", "T0 Cut 1")->Fill(vtxESDSPD->GetZ(),vtxESDTPC->GetZ()); | |
397 | // if(cut2T0) GetHistoCorrelationSPDTPCVz("Cut2T0", "T0 Cut 2")->Fill(vtxESDSPD->GetZ(),vtxESDTPC->GetZ()); | |
398 | ||
399 | // GetHistoCorrelationContrTPCSPDCls("All", "After physics selection and Francesco's cut")->Fill(totalClusSPD,tpcContr); | |
400 | // if(cut1T0) GetHistoCorrelationContrTPCSPDCls("Cut1T0", "T0 Cut 1")->Fill(totalClusSPD,tpcContr); | |
401 | // if(cut2T0) GetHistoCorrelationContrTPCSPDCls("Cut2T0", "T0 Cut 2")->Fill(totalClusSPD,tpcContr); | |
402 | ||
403 | // GetHistoCorrelationTrackletsSPDCls("All", "After physics selection and Francesco's cut")->Fill(totalClusSPD,ntracklets); | |
404 | // if(cut1T0) GetHistoCorrelationTrackletsSPDCls("Cut1T0", "T0 Cut 1")->Fill(totalClusSPD,ntracklets); | |
405 | // if(cut2T0) GetHistoCorrelationTrackletsSPDCls("Cut2T0", "T0 Cut 2")->Fill(totalClusSPD,ntracklets); | |
406 | ||
407 | ||
408 | return; // FIXME | |
409 | ||
410 | ||
eef42d18 | 411 | // Reject background |
412 | if (v0BG && fRejectBGWithV0) { | |
413 | cout << "Rejection BG" << endl; | |
414 | ||
415 | return; | |
416 | } | |
417 | // Fill global histos | |
418 | GetHistoTracklets("all","All events")->Fill(ntracklets); | |
52d405b5 | 419 | FillTriggerOverlaps("All", "All Events",vdArray); |
a82dc581 | 420 | |
7f5f2e0c | 421 | // Fill some combination of trigger classes |
422 | Bool_t cmbs1aOnline = fESD->IsTriggerClassFired("CMBS1A-B-NOPF-ALL"); | |
423 | Bool_t cmbs1cOnline = fESD->IsTriggerClassFired("CMBS1C-B-NOPF-ALL"); | |
424 | Bool_t cmbacOnline = fESD->IsTriggerClassFired("CMBAC-B-NOPF-ALL"); | |
425 | ||
eef42d18 | 426 | Bool_t twoOutOfThree = kFALSE; |
427 | if (cmbs1aOnline || cmbs1cOnline ||cmbacOnline) twoOutOfThree = kTRUE; | |
428 | if (twoOutOfThree) GetHistoTracklets("All_TwoOutOfThree" ,"Events 2-out-of-3 online" )->Fill(ntracklets); | |
7f5f2e0c | 429 | |
a82dc581 | 430 | |
431 | // loop over trigger classes in the event | |
432 | TObjArray * tokens = 0; | |
433 | if(fIsMC) { | |
434 | // in case of montecarlo I override the trigger class | |
435 | tokens = new TObjArray; | |
436 | tokens->SetOwner(); | |
437 | // tokens->Add(new TObjString("CINT1B-ABCE-NOPF-ALL")); | |
438 | tokens->Add(new TObjString("MC")); | |
439 | } | |
440 | else { | |
441 | TString trgClasses = fESD->GetFiredTriggerClasses(); | |
7f5f2e0c | 442 | tokens = trgClasses.Tokenize(" "); |
a82dc581 | 443 | } |
7f5f2e0c | 444 | TIterator * iter = (TIterator*) tokens->MakeIterator(); |
445 | ||
446 | TString classes = fESD->GetFiredTriggerClasses(); | |
447 | ||
448 | // if (classes.Contains("SMH")) { | |
449 | // tokens->Print(); | |
450 | // cout << classes.Data() << endl; | |
451 | // } | |
452 | // iter->Reset(); | |
4d0aa70f | 453 | //Int_t itoken = 0; |
7f5f2e0c | 454 | TObjString * tok=0; |
455 | while((tok = (TObjString*) iter->Next())){ | |
a82dc581 | 456 | // clean up trigger name |
457 | TString trg = tok->GetString(); | |
458 | trg.Strip(TString::kTrailing, ' '); | |
459 | trg.Strip(TString::kLeading, ' '); | |
460 | ||
461 | fHistoSuffix = "_"; | |
462 | fHistoSuffix += trg; | |
463 | ||
7f5f2e0c | 464 | // cout << itoken++ << " " << trg.Data() << endl; |
465 | // continue; | |
466 | // if (trg.Contains("SMH")) cout << itoken++ << " " << trg.Data() << endl; | |
467 | ||
468 | // Fill tracklets | |
eef42d18 | 469 | GetHistoTracklets("All" ,"Events no offline trigger" )->Fill(ntracklets); |
7f5f2e0c | 470 | |
471 | ||
a82dc581 | 472 | // Fill histograms mismatchs |
473 | // TODO: check mismatch trigger class | |
474 | if(nFastOrOffline != nFastOrOnline) { | |
475 | GetHistoTracklets("mismatchingFastOr", "Events where fast or offline differs from fast-or online")->Fill(ntracklets); | |
476 | } | |
477 | ||
478 | if (c0v0A != v0AHW){ | |
479 | GetHistoTracklets("mismatchingV0A", "Events where V0A offline differs from V0A online")->Fill(ntracklets); | |
480 | } | |
481 | ||
482 | if (c0v0C != v0CHW){ | |
483 | GetHistoTracklets("mismatchingV0C", "Events where V0C offline differs from V0C online")->Fill(ntracklets); | |
484 | } | |
485 | ||
486 | // Fill a tracklet histo for each trigger type | |
487 | if(c0sm1) GetHistoTracklets("c0sm1" ,"Events were trigger c0sm1 fired" )->Fill(ntracklets); | |
488 | if(c0sm2) GetHistoTracklets("c0sm2" ,"Events were trigger c0sm2 fired" )->Fill(ntracklets); | |
489 | if(c0sm3) GetHistoTracklets("c0sm3" ,"Events were trigger c0sm3 fired" )->Fill(ntracklets); | |
490 | if(c0sm4) GetHistoTracklets("c0sm4" ,"Events were trigger c0sm4 fired" )->Fill(ntracklets); | |
491 | if(c0sm5) GetHistoTracklets("c0sm5" ,"Events were trigger c0sm5 fired" )->Fill(ntracklets); | |
492 | if(c0OM2) GetHistoTracklets("c0OM2" ,"Events were trigger c0OM2 fired" )->Fill(ntracklets); | |
493 | if(c0OM3) GetHistoTracklets("c0OM3" ,"Events were trigger c0OM3 fired" )->Fill(ntracklets); | |
494 | if(c0v0A) GetHistoTracklets("c0v0A" ,"Events were trigger c0v0A fired" )->Fill(ntracklets); | |
495 | if(c0v0C) GetHistoTracklets("c0v0C" ,"Events were trigger c0v0C fired" )->Fill(ntracklets); | |
496 | if(cMBS2A) GetHistoTracklets("cMBS2A","Events were trigger cMBS2A fired")->Fill(ntracklets); | |
497 | if(cMBS2C) GetHistoTracklets("cMBS2C","Events were trigger cMBS2C fired")->Fill(ntracklets); | |
5ec1c2f5 | 498 | if(cMBAC ) GetHistoTracklets("cMBAC", "Events were trigger cMBAC fired")->Fill(ntracklets); |
499 | if(zdcA ) GetHistoTracklets("cZDCA", "Events were trigger cZDCA fired")->Fill(ntracklets); | |
eef42d18 | 500 | if(zdcC ) GetHistoTracklets("cZDCC", "Events were trigger cZDCC fired")->Fill(ntracklets); |
501 | if(!zdcA && !zdcC ) GetHistoTracklets("NoZDC", "Events were zdc trigger don't fired")->Fill(ntracklets); | |
502 | if( (zdcA && !zdcC) || (!zdcA && zdcC) ) GetHistoTracklets("OneSideZDC", "Events were only 1 ZDC fired")->Fill(ntracklets); | |
503 | if( (zdcA && zdcC) ) GetHistoTracklets("TwoSideZDC", "Events were both ZDC fired")->Fill(ntracklets); | |
504 | ||
505 | if(twoOutOfThree) { | |
506 | if(!zdcA && !zdcC ) GetHistoTracklets("NoZDC_TwoOutOfThree", "Events were zdc trigger don't fired")->Fill(ntracklets); | |
507 | if( (zdcA && !zdcC) || (!zdcA && zdcC) ) GetHistoTracklets("OneSideZDC_TwoOutOfThree", "Events were only 1 ZDC fired")->Fill(ntracklets); | |
508 | if( (zdcA && zdcC) ) GetHistoTracklets("TwoSideZDC_TwoOutOfThree", "Events were both ZDC fired")->Fill(ntracklets); | |
509 | } | |
5ec1c2f5 | 510 | if(zdcBar) GetHistoTracklets("cZDCBar","Events were trigger cZDCB fired")->Fill(ntracklets); |
a82dc581 | 511 | // if() GetHistoTracklets("","Events were trigger fired"); |
52d405b5 | 512 | |
513 | // Fill trigger overlaps | |
514 | FillTriggerOverlaps("All", "All Events in trigger class",vdArray); | |
515 | ||
eef42d18 | 516 | |
517 | // Fill kinematic variables for peripheral events | |
518 | static AliESDtrackCuts * cuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(); // FIXME: change this ? | |
519 | if (ntracklets < fNTrackletsCutKine) { | |
520 | // 1. Loop on tracklets | |
521 | for(Int_t itracklet = 0; itracklet < ntracklets; itracklet++){ | |
522 | GetHistoEta("All", Form("Tracklet #eta distribution, ntracklets < %d",fNTrackletsCutKine))->Fill(mult->GetEta(itracklet)); | |
523 | } | |
524 | // 2. loop on tracks | |
525 | TObjArray * goodTracks = cuts->GetAcceptedTracks(fESD); | |
526 | TIterator * iterTracks = goodTracks->MakeIterator(); | |
527 | AliESDtrack * esdTrack = 0; | |
528 | while ((esdTrack = (AliESDtrack*) iterTracks->Next())) { | |
529 | GetHistoPt("All", Form("Tracklet p_{T} distribution, ntracklets < %d",fNTrackletsCutKine))->Fill(esdTrack->Pt()); | |
530 | } | |
531 | delete goodTracks; | |
532 | } | |
533 | ||
534 | ||
a82dc581 | 535 | } |
7f5f2e0c | 536 | delete tokens; |
a82dc581 | 537 | |
538 | // if (fIsMC) { | |
9d173aad | 539 | |
540 | ||
541 | // if (!fMCEvent) { | |
542 | // AliError("No MC info found"); | |
543 | // } else { | |
544 | ||
545 | // //loop on the MC event | |
546 | // // Int_t nMCTracks = fMCEvent->GetNumberOfTracks(); | |
547 | // Int_t offset = fMCEvent->GetPrimaryOffset(); | |
548 | // Int_t nMCTracks = fMCEvent->GetNumberOfPrimaries()+offset; | |
549 | // for (Int_t ipart=offset; ipart<nMCTracks; ipart++) { | |
550 | ||
551 | // AliMCParticle *mcPart = (AliMCParticle*)fMCEvent->GetTrack(ipart); | |
552 | ||
553 | // // We don't care about neutrals and non-physical primaries | |
554 | // if(mcPart->Charge() == 0) continue; | |
555 | ||
e0376287 | 556 | // PHYSICAL PRIMARY |
9d173aad | 557 | // // Get MC vertex |
e0376287 | 558 | // TArrayF vertex; |
9d173aad | 559 | // fMCEvent->GenEventHeader()->PrimaryVertex(vertex); |
560 | // Float_t zv = vertex[2]; | |
561 | // // Float_t zv = vtxESD->GetZ(); | |
562 | // // Fill generated histo | |
563 | // hTracks[AliAnalysisMultPbTrackHistoManager::kHistoGen]->Fill(mcPart->Pt(),mcPart->Eta(),zv); | |
564 | ||
565 | // } | |
566 | // } | |
567 | // } | |
568 | ||
569 | ||
570 | ||
571 | ||
572 | } | |
573 | ||
574 | void AliAnalysisTaskTriggerStudy::Terminate(Option_t *){ | |
575 | // terminate | |
576 | // Save output in a more friendly format | |
577 | fHistoList = dynamic_cast<AliHistoListWrapper*> (GetOutputData(1)); | |
578 | if (!fHistoList){ | |
579 | Printf("ERROR: fHistoList not available"); | |
580 | return; | |
581 | } | |
582 | TFile * f = new TFile("trigger_study.root", "recreate"); | |
583 | fHistoList->GetList()->Write(); | |
584 | f->Close(); | |
585 | ||
586 | } | |
587 | ||
588 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoTracklets(const char * name, const char * title){ | |
a82dc581 | 589 | // Book histo of events vs ntracklets, if needed |
9d173aad | 590 | |
a82dc581 | 591 | TString hname = "hTracklets_"; |
592 | hname+=name; | |
593 | hname+=fHistoSuffix; | |
9d173aad | 594 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); |
595 | ||
596 | if(!h) { | |
597 | AliInfo(Form("Booking histo %s",hname.Data())); | |
598 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
599 | TH1::AddDirectory(kFALSE); | |
7f5f2e0c | 600 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); |
601 | h = new TH1F (hname.Data(), title, 4000, -0.5, 4000-0.5); | |
9d173aad | 602 | h->Sumw2(); |
603 | h->SetXTitle("ntracklets"); | |
604 | fHistoList->GetList()->Add(h); | |
605 | TH1::AddDirectory(oldStatus); | |
606 | } | |
607 | return h; | |
608 | } | |
609 | ||
bcc49144 | 610 | |
611 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoSPD1(const char * name, const char * title){ | |
612 | // Book histo of events vs ntracklets, if needed | |
613 | ||
614 | TString hname = "hSPD1_"; | |
615 | hname+=name; | |
616 | hname+=fHistoSuffix; | |
617 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
618 | ||
619 | // const Int_t nbin = 118; | |
620 | // Float_t bins[nbin] = {0}; | |
621 | // bins[0] = 0; | |
622 | // for(Int_t ibin = 1; ibin <= nbin; ibin++){ | |
623 | // if (ibin < 100) | |
624 | // bins[ibin] = bins [ibin-1]+1; | |
625 | // else if (ibin < 1000) | |
626 | // bins[ibin] = bins [ibin-1]+100; | |
627 | // else if (ibin < 10000) | |
628 | // bins[ibin] = bins [ibin-1]+1000; | |
629 | // } | |
630 | ||
631 | ||
632 | if(!h) { | |
633 | AliInfo(Form("Booking histo %s",hname.Data())); | |
634 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
635 | TH1::AddDirectory(kFALSE); | |
636 | // h = new TH1F (hname.Data(), title, nbin, bins); | |
637 | //h = new TH1F (hname.Data(), title, 100, -0.5, 100-0.5); | |
638 | h = new TH1F (hname.Data(), title, 10000, -0.5, 10000-0.5); | |
639 | h->Sumw2(); | |
640 | h->SetXTitle("SPD1"); | |
641 | fHistoList->GetList()->Add(h); | |
642 | TH1::AddDirectory(oldStatus); | |
643 | } | |
644 | return h; | |
645 | } | |
646 | ||
647 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoV0M(const char * name, const char * title){ | |
648 | // Book histo of events vs ntracklets, if needed | |
649 | ||
650 | TString hname = "hV0M_"; | |
651 | hname+=name; | |
652 | hname+=fHistoSuffix; | |
653 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
654 | ||
655 | if(!h) { | |
656 | AliInfo(Form("Booking histo %s",hname.Data())); | |
657 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
658 | TH1::AddDirectory(kFALSE); | |
659 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); | |
abd808b9 | 660 | h = new TH1F (hname.Data(), title, 500, -0.5, 500-0.5); |
bcc49144 | 661 | h->Sumw2(); |
662 | h->SetXTitle("V0M"); | |
663 | fHistoList->GetList()->Add(h); | |
664 | TH1::AddDirectory(oldStatus); | |
665 | } | |
666 | return h; | |
667 | } | |
668 | ||
669 | ||
670 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoTracks(const char * name, const char * title){ | |
671 | // Book histo of events vs ntracklets, if needed | |
672 | ||
673 | TString hname = "hTPCTracks_"; | |
674 | hname+=name; | |
675 | hname+=fHistoSuffix; | |
676 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
677 | ||
678 | if(!h) { | |
679 | AliInfo(Form("Booking histo %s",hname.Data())); | |
680 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
681 | TH1::AddDirectory(kFALSE); | |
682 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); | |
683 | h = new TH1F (hname.Data(), title, 50, -0.5, 50-0.5); | |
684 | h->Sumw2(); | |
685 | h->SetXTitle("ntracks"); | |
686 | fHistoList->GetList()->Add(h); | |
687 | TH1::AddDirectory(oldStatus); | |
688 | } | |
689 | return h; | |
690 | } | |
691 | ||
692 | ||
eef42d18 | 693 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoEta(const char * name, const char * title){ |
694 | // Book histo of events vs ntracklets, if needed | |
695 | ||
696 | TString hname = "hEta_"; | |
697 | hname+=name; | |
698 | hname+=fHistoSuffix; | |
699 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
700 | ||
701 | if(!h) { | |
702 | AliInfo(Form("Booking histo %s",hname.Data())); | |
703 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
704 | TH1::AddDirectory(kFALSE); | |
705 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); | |
706 | h = new TH1F (hname.Data(), title, 20, -2, 2); | |
707 | h->Sumw2(); | |
708 | h->SetXTitle("#eta"); | |
709 | fHistoList->GetList()->Add(h); | |
710 | TH1::AddDirectory(oldStatus); | |
711 | } | |
712 | return h; | |
713 | } | |
714 | ||
715 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoPt(const char * name, const char * title){ | |
716 | // Book histo of pt distribution, if needed | |
717 | ||
718 | TString hname = "hPt_"; | |
719 | hname+=name; | |
720 | hname+=fHistoSuffix; | |
721 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
722 | ||
723 | if(!h) { | |
724 | AliInfo(Form("Booking histo %s",hname.Data())); | |
725 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
726 | TH1::AddDirectory(kFALSE); | |
727 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); | |
728 | h = new TH1F (hname.Data(), title, 100, -0.5, 1-0.5); | |
729 | h->Sumw2(); | |
730 | h->SetXTitle("p_{T}"); | |
731 | fHistoList->GetList()->Add(h); | |
732 | TH1::AddDirectory(oldStatus); | |
733 | } | |
734 | return h; | |
735 | } | |
736 | ||
bcc49144 | 737 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoCorrelationSPDTPCVz(const char * name, const char * title){ |
738 | // Book histo of events vs ntracklets, if needed | |
739 | ||
740 | TString hname = "hTPCvsSPD_"; | |
741 | hname+=name; | |
742 | hname+=fHistoSuffix; | |
743 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
744 | ||
745 | if(!h) { | |
746 | AliInfo(Form("Booking histo %s",hname.Data())); | |
747 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
748 | TH1::AddDirectory(kFALSE); | |
749 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); | |
750 | h = new TH2F (hname.Data(), title, 80, -20, 20, 80, -20, 20); | |
751 | h->Sumw2(); | |
752 | h->SetXTitle("SPD Vz"); | |
753 | h->SetYTitle("TPC Vz"); | |
754 | fHistoList->GetList()->Add(h); | |
755 | TH1::AddDirectory(oldStatus); | |
756 | } | |
757 | return h; | |
758 | } | |
759 | ||
760 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoCorrelationContrTPCSPDCls(const char * name, const char * title){ | |
761 | // Book histo of events vs ntracklets, if needed | |
762 | ||
763 | TString hname = "hContrTPCvsSPDCls_"; | |
764 | hname+=name; | |
765 | hname+=fHistoSuffix; | |
766 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
767 | ||
768 | if(!h) { | |
769 | AliInfo(Form("Booking histo %s",hname.Data())); | |
770 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
771 | TH1::AddDirectory(kFALSE); | |
772 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); | |
773 | h = new TH2F (hname.Data(), title, 1000, 0, 9000, 1000, 0, 5000); | |
774 | h->Sumw2(); | |
775 | h->SetXTitle("SPD Clusters"); | |
776 | h->SetYTitle("TPC V Contributors"); | |
777 | fHistoList->GetList()->Add(h); | |
778 | TH1::AddDirectory(oldStatus); | |
779 | } | |
780 | return h; | |
781 | } | |
782 | TH1 * AliAnalysisTaskTriggerStudy::GetHistoCorrelationTrackletsSPDCls(const char * name, const char * title){ | |
783 | // Book histo of events vs ntracklets, if needed | |
784 | ||
785 | TString hname = "hTrackletsvsSPDCls_"; | |
786 | hname+=name; | |
787 | hname+=fHistoSuffix; | |
788 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
789 | ||
790 | if(!h) { | |
791 | AliInfo(Form("Booking histo %s",hname.Data())); | |
792 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
793 | TH1::AddDirectory(kFALSE); | |
794 | // h = new TH1F (hname.Data(), title, 1000, -0.5, 10000-0.5); | |
795 | h = new TH2F (hname.Data(), title, 1000, 0, 9000, 1000, 0, 5000); | |
796 | h->Sumw2(); | |
797 | h->SetXTitle("SPD Clusters"); | |
798 | h->SetYTitle("N tracklets"); | |
799 | fHistoList->GetList()->Add(h); | |
800 | TH1::AddDirectory(oldStatus); | |
801 | } | |
802 | return h; | |
803 | } | |
804 | ||
805 | ||
52d405b5 | 806 | void AliAnalysisTaskTriggerStudy::FillTriggerOverlaps (const char * name, const char * title, Bool_t * vdArray){ |
a82dc581 | 807 | //Fills a histo with the different trigger statistics in a venn like diagramm. Books it if needed. |
808 | ||
809 | // Get or book histo | |
810 | TString hname = "hTrigStat_"; | |
811 | hname+=name; | |
812 | hname+=fHistoSuffix; | |
813 | TH1 * h = (TH1*) fHistoList->GetList()->FindObject(hname.Data()); | |
814 | ||
815 | if(!h) { | |
816 | AliInfo(Form("Booking histo %s",hname.Data())); | |
817 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
818 | TH1::AddDirectory(kFALSE); | |
52d405b5 | 819 | Int_t nbins = 0; |
820 | for(Int_t ientry = 0; ientry < kNVDEntries; ientry++){ | |
821 | nbins = nbins | (1<<ientry); | |
822 | } | |
7f5f2e0c | 823 | // cout << "NBINS " << nbins << endl; |
824 | nbins = nbins+1; | |
52d405b5 | 825 | h = new TH1I (hname, title, nbins, -0.5, nbins-0.5); |
a82dc581 | 826 | fHistoList->GetList()->Add(h); |
827 | TH1::AddDirectory(oldStatus); | |
52d405b5 | 828 | |
829 | // we look at the combinations of n triggers | |
830 | // We set a bit for each trigger to fill the diagram | |
831 | // This is much simpler and faster than any recursive function | |
832 | h->GetXaxis()->SetBinLabel(1,"NONE"); | |
833 | for(Int_t ibin = 1; ibin < nbins; ibin++){ | |
834 | TString binname = ""; | |
835 | Bool_t first = kTRUE; | |
836 | for(Int_t ivdentry = 0; ivdentry < kNVDEntries; ivdentry++){ | |
837 | if (ibin & (1<<ivdentry)) { | |
838 | if(!first) binname += " & "; | |
839 | binname += kVDNames[ivdentry]; | |
840 | first=kFALSE; | |
841 | } | |
842 | } | |
843 | h->GetXaxis()->SetBinLabel(ibin+1,binname.Data()); | |
844 | } | |
845 | ||
a82dc581 | 846 | } |
847 | ||
52d405b5 | 848 | UInt_t mask = 0; |
849 | for(Int_t ivdentry = 0; ivdentry < kNVDEntries; ivdentry++){ | |
850 | if(vdArray[ivdentry]) { | |
851 | mask = mask | (1<<ivdentry); | |
852 | // cout << " 1 " ; | |
853 | } //else cout << " 0 "; | |
854 | } | |
855 | // cout << hex << " = " << mask << endl; | |
a82dc581 | 856 | |
52d405b5 | 857 | h->Fill(mask); |
9d173aad | 858 | |
a82dc581 | 859 | } |