1 #include "AliAnalysisMuMu.h"
3 #include "AliAnalysisManager.h"
4 #include "AliCounterCollection.h"
5 #include "AliHistogramCollection.h"
10 #include "TDatabasePDG.h"
13 #include "THashList.h"
16 #include "TObjString.h"
17 #include "TPaveText.h"
22 // AliAnalysisMuMu : base class for mu pairs analysis
24 // Mainly invariant mass (for J/psi and Upsilon) but also
25 // some single control histograms.
27 // This base class contains common things for ESD-based
28 // and AOD-based analysis
30 // The output contains an AliHistogramCollection and
31 // an AliCounterCollection
33 // author: L. Aphecetche (Subatech)
36 ClassImp(AliAnalysisMuMu)
40 Int_t GetNbins(Double_t xmin, Double_t xmax, Double_t xstep)
42 if ( TMath::AreEqualRel(xstep,0.0,1E-9) ) return 1;
44 return TMath::Nint(TMath::Abs((xmax-xmin)/xstep));
48 //_____________________________________________________________________________
49 AliAnalysisMuMu* AliAnalysisMuMu::Create(const char* inputDataType, TList* triggerClassesToConsider)
51 /// Create the right implementation depending on intputDataType
53 TString sinputDataType(inputDataType);
54 sinputDataType.ToUpper();
56 if ( sinputDataType != "AOD" && sinputDataType != "ESD" )
58 AliErrorClass(Form("Unknown input data type : %s",inputDataType));
62 return reinterpret_cast<AliAnalysisMuMu*>(gROOT->ProcessLineFast(Form("new AliAnalysisMuMuFrom%s((TList*)%p)",
63 sinputDataType.Data(),
64 triggerClassesToConsider)));
67 //_____________________________________________________________________________
68 AliAnalysisMuMu* AliAnalysisMuMu::Create(const char* inputDataType, Bool_t aa)
70 /// Create the right implementation depending on intputDataType
72 TString sinputDataType(inputDataType);
73 sinputDataType.ToUpper();
75 if ( sinputDataType != "AOD" && sinputDataType != "ESD" )
77 AliErrorClass(Form("Unknown input data type : %s",inputDataType));
81 return reinterpret_cast<AliAnalysisMuMu*>(gROOT->ProcessLineFast(Form("new AliAnalysisMuMuFrom%s(%d)",
82 sinputDataType.Data(),aa)));
85 //_____________________________________________________________________________
86 AliAnalysisMuMu::AliAnalysisMuMu() : AliAnalysisTaskSE("AliAnalysisMuMu"),
87 fHistogramCollection(0),
92 fSingleTrackCutNames(0x0),
93 fPairTrackCutNames(0x0),
95 fCentralityNames(0x0),
96 fGlobalEventSelectionNames(0x0),
98 fIsDynamicTriggerClasses(kFALSE)
103 //_____________________________________________________________________________
104 AliAnalysisMuMu::AliAnalysisMuMu(Bool_t fromESD, Bool_t aa)
105 : AliAnalysisTaskSE(Form("AliAnalysisMuMu-from%s",fromESD ? "ESD":"AOD")),
106 fHistogramCollection(0),
108 fTriggerClasses(new THashList),
111 fSingleTrackCutNames(0x0),
112 fPairTrackCutNames(0x0),
114 fCentralityNames(new TObjArray),
115 fGlobalEventSelectionNames(0x0),
117 fIsDynamicTriggerClasses(kTRUE)
120 /// The list of triggers to be considered will be updated on the fly
121 /// (see method AddTriggerClasses)
123 fTriggerClasses->SetOwner(kTRUE);
125 DefineOutput(1, TList::Class());
127 DefineCentralityClasses();
131 //_____________________________________________________________________________
132 AliAnalysisMuMu::AliAnalysisMuMu(Bool_t fromESD, TList* triggerClasses)
133 : AliAnalysisTaskSE(Form("AliAnalysisMuMu-from%s",fromESD ? "ESD":"AOD")),
134 fHistogramCollection(0),
136 fTriggerClasses(new THashList),
139 fSingleTrackCutNames(0x0),
140 fPairTrackCutNames(0x0),
142 fCentralityNames(new TObjArray),
143 fGlobalEventSelectionNames(0x0),
145 fIsDynamicTriggerClasses(kFALSE)
147 /// Constructor with a predefined list of triggers to consider
149 fTriggerClasses->SetOwner(kTRUE);
151 DefineOutput(1, TList::Class());
154 TIter next(triggerClasses);
156 while ( ( tname = static_cast<TObjString*>(next()) ) )
158 fTriggerClasses->Add(new TObjString(*tname));
159 if ( tname->String().BeginsWith("CMB") )
165 DefineCentralityClasses();
168 //_____________________________________________________________________________
169 AliAnalysisMuMu::~AliAnalysisMuMu()
172 delete fTriggerClasses;
173 delete fSingleTrackCutNames;
174 delete fPairTrackCutNames;
175 if(fOutput && ! AliAnalysisManager::GetAnalysisManager()->IsProofMode())
179 delete fCentralityNames;
180 delete fGlobalEventSelectionNames;
183 //_____________________________________________________________________________
184 void AliAnalysisMuMu::AddGlobalEventSelection(const char* name)
186 /// Add a name to the list of global event event selection ones.
188 if (!fGlobalEventSelectionNames)
190 fGlobalEventSelectionNames = new TObjArray;
191 fGlobalEventSelectionNames->SetOwner(kTRUE);
193 fGlobalEventSelectionNames->Add(new TObjString(name));
196 //_____________________________________________________________________________
197 UInt_t AliAnalysisMuMu::CodePairCutMask(UInt_t maskForOneOrBothTrack, UInt_t maskForTrackPair) const
199 /// Encode two masks (obviously each one should be 16 bits only) into one
201 return ( ( maskForOneOrBothTrack << 16 ) | maskForTrackPair );
204 //_____________________________________________________________________________
205 void AliAnalysisMuMu::DecodePairCutMask(UInt_t code, UInt_t& maskForOneOrBothTrack, UInt_t& maskForTrackPair) const
207 /// Decode the pair cut mask
208 maskForOneOrBothTrack = ( ( code & 0xFFFF0000 ) >> 16 );
209 maskForTrackPair = ( code & 0xFFFF );
212 //_____________________________________________________________________________
213 void AliAnalysisMuMu::DefineCentralityClasses()
215 /// Define the default centrality classes that will be used.
219 fCentralityLimits.push_back(10.0);
220 fCentralityLimits.push_back(20.0);
221 fCentralityLimits.push_back(30.0);
222 fCentralityLimits.push_back(40.0);
223 fCentralityLimits.push_back(50.0);
224 fCentralityLimits.push_back(60.0);
225 fCentralityLimits.push_back(70.0);
226 fCentralityLimits.push_back(80.0);
227 fCentralityLimits.push_back(90.0);
229 // fCentralityLimits.push_back(100.0);
231 for ( std::vector<double>::size_type i = 0; i < fCentralityLimits.size(); ++i )
233 Double_t limit = fCentralityLimits[i];
234 fCentralityNames->Add(new TObjString(CentralityName(limit)));
237 fCentralityNames->Add(new TObjString(DefaultCentralityName()));
238 fCentralityNames->SetOwner(kTRUE);
241 //_____________________________________________________________________________
242 void AliAnalysisMuMu::AddTriggerClasses(const char* triggerlist)
244 /// Given a list of trigger names (triggerlist) separated by spaces
245 /// add those which we don't know yet (selecting only the few ones
246 /// we're interested in, e.g CINT* CMU* CMB*
249 TString slist(triggerlist);
251 TObjArray* a = slist.Tokenize(" ");
255 while ( ( s = static_cast<TObjString*>(next()) ) )
257 TString trigger(s->String());
260 if ( trigger.BeginsWith("CMB") && trigger.Contains("-B-") ) add = kTRUE;
261 if ( trigger.BeginsWith("CINT") && trigger.Contains("-B-") && !trigger.Contains("WU") ) add = kTRUE;
262 if ( trigger.BeginsWith("CMU") && trigger.Contains("-B-") ) add = kTRUE;
264 if ( trigger.BeginsWith("CMUP") ) add = kFALSE;
266 if ( add && !fTriggerClasses->FindObject(trigger.Data()) )
268 AliInfo(Form("Adding %s to considered trigger classes",trigger.Data()));
269 fTriggerClasses->Add(new TObjString(trigger));
277 //_____________________________________________________________________________
278 void AliAnalysisMuMu::AddPairCut(const char* cutName, UInt_t maskForOneOrBothTrack, UInt_t maskForTrackPair)
280 /// Add a cut for a pair.
281 /// maskForOneOrBothTrack is the mask of cuts that at least one track must satisfy
282 /// maskForTrackPair is the mask of cuts that *both* tracks must satisfy.
283 /// if maskForTrackPair is 0, then no (extra) condition is applied to the pair
285 if ( !fPairTrackCutNames )
287 fPairTrackCutNames = new TObjArray;
288 fPairTrackCutNames->SetOwner(kTRUE);
290 TObjString* oname = new TObjString(Form("p%s",cutName));
291 if ( !maskForTrackPair ) maskForTrackPair = maskForOneOrBothTrack;
292 oname->SetUniqueID(CodePairCutMask(maskForOneOrBothTrack,maskForTrackPair));
293 fPairTrackCutNames->Add(oname);
296 //_____________________________________________________________________________
297 void AliAnalysisMuMu::AddSingleCut(const char* name, UInt_t mask)
299 /// Add a cut for single tracks
300 if ( !fSingleTrackCutNames )
302 fSingleTrackCutNames = new TObjArray;
303 fSingleTrackCutNames->SetOwner(kTRUE);
305 TObjString* oname = new TObjString(Form("s%s",name));
306 oname->SetUniqueID(mask);
307 fSingleTrackCutNames->Add(oname);
310 //_____________________________________________________________________________
311 void AliAnalysisMuMu::BeautifyHistos()
313 /// Put the titles, marker sizes, color, etc...
315 TIter next(fHistogramCollection->CreateIterator());
318 while ( ( h = static_cast<TH1*>(next()) ) )
320 TString name(h->GetName());
322 if ( name.Contains("Plus") )
324 h->SetMarkerStyle(kFullCircle);
325 h->SetMarkerColor(kBlue);
326 h->SetLineColor(kBlue);
330 h->SetMarkerStyle(kOpenCircle);
331 h->SetMarkerColor(kRed);
332 h->SetLineColor(kRed);
337 //_____________________________________________________________________________
339 AliAnalysisMuMu::CreateSingleHisto(const char* physics,
340 const char* triggerClassName,
341 const char* hname, const char* htitle,
342 Int_t nbinsx, Double_t xmin, Double_t xmax,
343 Int_t nbinsy, Double_t ymin, Double_t ymax) const
345 /// Append histograms for single track to our histogram collection
346 CreateHisto(fSingleTrackCutNames,physics,triggerClassName,hname,htitle,
347 nbinsx,xmin,xmax,nbinsy,ymin,ymax);
350 //_____________________________________________________________________________
352 AliAnalysisMuMu::CreatePairHisto(const char* physics,
353 const char* triggerClassName,
354 const char* hname, const char* htitle,
355 Int_t nbinsx, Double_t xmin, Double_t xmax,
356 Int_t nbinsy, Double_t ymin, Double_t ymax) const
358 /// Append histograms for track pairs to our histogram collection
360 CreateHisto(fPairTrackCutNames,physics,triggerClassName,hname,htitle,
361 nbinsx,xmin,xmax,nbinsy,ymin,ymax);
364 //_____________________________________________________________________________
366 AliAnalysisMuMu::CreateEventHisto(const char* physics,
367 const char* triggerClassName,
368 const char* hname, const char* htitle,
369 Int_t nbinsx, Double_t xmin, Double_t xmax,
370 Int_t nbinsy, Double_t ymin, Double_t ymax) const
372 /// Append histograms at the event level
374 TIter next(fCentralityNames);
377 while ( ( cent = static_cast<TObjString*>(next()) ) )
383 h = new TH2F(hname,htitle,nbinsx,xmin,xmax,nbinsy,ymin,ymax);
387 h = new TH1F(hname,htitle,nbinsx,xmin,xmax);
390 fHistogramCollection->Adopt(physics,triggerClassName,cent->String().Data(),h);
394 //_____________________________________________________________________________
396 AliAnalysisMuMu::CreateHisto(TObjArray* array,
398 const char* triggerClassName,
399 const char* hname, const char* htitle,
400 Int_t nbinsx, Double_t xmin, Double_t xmax,
401 Int_t nbinsy, Double_t ymin, Double_t ymax) const
403 /// Create a bunch of histograms for all centralities
404 /// FIXME: have a way to specify the histo precision (i.e. F vs I vs S ...)
408 while ( ( tcn = static_cast<TObjString*>(next()) ) )
410 TIter nextCent(fCentralityNames);
413 while ( ( cent = static_cast<TObjString*>(nextCent()) ) )
419 h = new TH2F(hname,htitle,nbinsx,xmin,xmax,nbinsy,ymin,ymax);
423 h = new TH1F(hname,htitle,nbinsx,xmin,xmax);
426 fHistogramCollection->Adopt(physics,triggerClassName,cent->String().Data(),tcn->String().Data(),h);
431 //_____________________________________________________________________________
433 AliAnalysisMuMu::DefaultCentralityName() const
435 /// Get default centrality name
436 if ( fAA ) return "CENTX";
440 //_____________________________________________________________________________
442 AliAnalysisMuMu::CentralityName(Double_t centrality) const
444 /// Get centrality name corresponding to the floating ^point value
446 if ( centrality > 0 && centrality <= 100.0 )
448 return Form("CENT%02d",TMath::Nint(centrality));
452 return DefaultCentralityName();
456 //_____________________________________________________________________________
457 void AliAnalysisMuMu::AssertHistogramCollection(const char* physics, const char* triggerClassName)
459 // insure that a given set of histogram is created
460 TH1* test = fHistogramCollection->Histo(physics,triggerClassName,DefaultCentralityName(),"Zvertex");
461 if (!test) FillHistogramCollection(physics,triggerClassName);
464 //_____________________________________________________________________________
465 void AliAnalysisMuMu::FillHistogramCollection(const char* physics, const char* triggerClassName)
467 /// Actually create the histograms for phyics/triggerClassName
469 AliDebug(1,Form("(%s,%s)",physics,triggerClassName));
473 Int_t nbinsPt = GetNbins(ptMin,ptMax,0.25);
476 Int_t nbinsP = GetNbins(pMin,pMax,1.0);
477 Double_t etaMin = -6;
479 Int_t nbinsEta = GetNbins(etaMin,etaMax,0.1);
481 CreateSingleHisto(physics,triggerClassName,"PtEtaMuPlus", "#mu+ P_{T} distribution vs Eta", nbinsEta,etaMin,etaMax, nbinsPt,ptMin,ptMax);
482 CreateSingleHisto(physics,triggerClassName,"PtEtaMuMinus", "#mu- P_{T} distribution vs Eta",nbinsEta,etaMin,etaMax, nbinsPt,ptMin,ptMax);
484 CreateSingleHisto(physics,triggerClassName,"PEtaMuPlus", "#mu+ P distribution",nbinsEta,etaMin,etaMax,nbinsP,pMin,pMax);
485 CreateSingleHisto(physics,triggerClassName,"PEtaMuMinus", "#mu- P distribution",nbinsEta,etaMin,etaMax,nbinsP,pMin,pMax);
487 Double_t chi2min = 0;
488 Double_t chi2max = 20;
489 Int_t nbinchi2 = GetNbins(chi2min,chi2max,0.1);
491 CreateSingleHisto(physics, triggerClassName, "Chi2MuPlus", "chisquare per NDF #mu+", nbinchi2, chi2min, chi2max);
492 CreateSingleHisto(physics, triggerClassName, "Chi2MuMinus", "chisquare per NDF #mu-", nbinchi2, chi2min, chi2max);
494 Double_t minvMin = 0;
495 Double_t minvMax = 16;
496 Int_t nMinvBins = GetNbins(minvMin,minvMax,0.05);
498 CreatePairHisto(physics,triggerClassName,"MinvUSPt", "#mu+#mu- inv. mass vs Pt",nbinsPt,ptMin,ptMax,nMinvBins,minvMin,minvMax);
499 CreatePairHisto(physics,triggerClassName,"MinvPPPt", "#mu+#mu+ inv. mass vs Pt",nbinsPt,ptMin,ptMax,nMinvBins,minvMin,minvMax);
500 CreatePairHisto(physics,triggerClassName,"MinvMMPt", "#mu-#mu- inv. mass vs Pt",nbinsPt,ptMin,ptMax,nMinvBins,minvMin,minvMax);
505 Int_t nbins = GetNbins(xmin,xmax,0.5);
507 CreateEventHisto(physics,triggerClassName,"Zvertex","z vertex",nbins,xmin,xmax);
511 nbins = GetNbins(xmin,xmax,0.01);
513 CreateEventHisto(physics,triggerClassName,"Xvertex","x vertex",nbins,xmin,xmax);
514 CreateEventHisto(physics,triggerClassName,"Yvertex","y vertex",nbins,xmin,xmax);
515 CreateEventHisto(physics,triggerClassName,"YXvertex","y vs x vertex",nbins,xmin,xmax,
521 CreateEventHisto(physics,triggerClassName,"PileUpZvertex","pileup z vertex",nbins,xmin,xmax);
523 CreateEventHisto(physics,triggerClassName,"PileUpXvertex","pileup x vertex",nbins,xmin,xmax);
524 CreateEventHisto(physics,triggerClassName,"PileUpYvertex","pileup y vertex",nbins,xmin,xmax);
526 CreateEventHisto(physics,triggerClassName,"PileUpYXvertex","pileup y vs x vertex",nbins,xmin,xmax,
530 CreateEventHisto(physics,triggerClassName,"Nevents","number of events",2,-0.5,1.5);
534 nbins = GetNbins(xmin,xmax,1.0);
536 CreateEventHisto(physics,triggerClassName,"BCX","bunch-crossing ids",nbins,xmin-0.5,xmax-0.5);
540 nbins = GetNbins(xmin,xmax,1.0);
542 CreateSingleHisto(physics,triggerClassName,"XYdcaMuPlus","#mu+ DCA non bending vs bending;dcaY;dcaX",nbins,xmin,xmax,nbins,xmin,xmax);
543 CreateSingleHisto(physics,triggerClassName,"XYdcaMuMinus","#mu- DCA non bending vs bending;dcaY;dcaX",nbins,xmin,xmax,nbins,xmin,xmax);
547 nbins = GetNbins(xmin,xmax,1.0);
549 CreateSingleHisto(physics,triggerClassName,"dcaP23MuPlus","#mu+ DCA vs P for 2-3 degrees;P (GeV);DCA (cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
550 CreateSingleHisto(physics,triggerClassName,"dcaP23MuMinus","#mu- DCA vs P for 2-3 degrees;P (GeV);DCA (cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
551 CreateSingleHisto(physics,triggerClassName,"dcaP310MuPlus","#mu+ DCA vs P for 3-10 degrees;P (GeV);DCA (cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
552 CreateSingleHisto(physics,triggerClassName,"dcaP310MuMinus","#mu- DCA vs P for 3-10 degrees;P (GeV);DCA (cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
554 CreateSingleHisto(physics,triggerClassName,"dcaPwPtCut23MuPlus","#mu+ DCA vs P for 2-3 degrees with Pt Cut;P (GeV);DCA (cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
555 CreateSingleHisto(physics,triggerClassName,"dcaPwPtCut23MuMinus","#mu- DCA vs P for 2-3 degrees with Pt Cut;P (GeV);DCA (cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
556 CreateSingleHisto(physics,triggerClassName,"dcaPwPtCut310MuPlus","#mu+ DCA vs P for 3-10 degrees with Pt Cut;P (GeV);DCA (cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
557 CreateSingleHisto(physics,triggerClassName,"dcaPwPtCut310MuMinus","#mu- DCA vs P for 3-10 degrees with Pt Cut;P (GeV);DCA (cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
561 nbins = GetNbins(xmin,xmax,100.0);
563 CreateSingleHisto(physics,triggerClassName,"PDCAcorrP23MuPlus","#mu+ PxDCAcorr vs P for 2-3 degrees;P (GeV/c);P.DCA (GeV.cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
564 CreateSingleHisto(physics,triggerClassName,"PDCAcorrP23MuMinus","#mu- PxDCAcorr vs P for 2-3 degrees;P (GeV/c);P.DCA (GeV.cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
565 CreateSingleHisto(physics,triggerClassName,"PDCAcorrP310MuPlus","#mu+ PxDCAcorr vs P for 3-10 degrees;P (GeV/c);P.DCA (GeV.cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
566 CreateSingleHisto(physics,triggerClassName,"PDCAcorrP310MuMinus","#mu- PxDCAcorr vs P for 3-10 degrees;P (GeV/c);P.DCA (GeV.cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
568 CreateSingleHisto(physics,triggerClassName,"PDCAcutP23MuPlus","#mu+ PxDCAcut vs P for 2-3 degrees;P (GeV/c);P.DCA (GeV.cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
569 CreateSingleHisto(physics,triggerClassName,"PDCAcutP23MuMinus","#mu- PxDCAcut vs P for 2-3 degrees;P (GeV/c);P.DCA (GeV.cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
570 CreateSingleHisto(physics,triggerClassName,"PDCAcutP310MuPlus","#mu+ PxDCAcut vs P for 3-10 degrees;P (GeV/c);P.DCA (GeV.cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
571 CreateSingleHisto(physics,triggerClassName,"PDCAcutP310MuMinus","#mu- PxDCAcut vs P for 3-10 degrees;P (GeV/c);P.DCA (GeV.cm)",nbinsP,pMin,pMax,nbins,xmin,xmax);
578 nbins = GetNbins(xmin,xmax,0.1);
579 CreateEventHisto(physics,triggerClassName,"V0Time","Mean Time V0C versus V0A;Time V0A (ns);Time V0C (ns)",nbins,xmin,xmax,nbins,xmin,xmax);
583 nbins = GetNbins(xmin,xmax,10);
585 CreateEventHisto(physics,triggerClassName,"V0Amplitude","V0Amult+V0Cmult",nbins,xmin,xmax);
590 Double_t* vbins = new Double_t[fCentralityLimits.size()+1];
594 for ( std::vector<double>::size_type i = 0; i < fCentralityLimits.size(); ++i )
596 vbins[i+1] = fCentralityLimits[i];
599 TH1* h = new TH1F("Centrality","Centrality",fCentralityLimits.size(),vbins);
603 fHistogramCollection->Adopt(physics,triggerClassName,h);
609 nbins = GetNbins(xmin,xmax,10);
611 CreateEventHisto(physics,triggerClassName,"Tracklets","Number of tracklets",nbins,xmin,xmax);
616 //_____________________________________________________________________________
617 Double_t AliAnalysisMuMu::MuonMass2() const
619 /// A usefull constant
620 static Double_t m2 = 1.11636129640000012e-02; // using a constant here as the line below is a problem for CINT...
621 // static Double_t m2 = TDatabasePDG::Instance()->GetParticle("mu-")->Mass()*TDatabasePDG::Instance()->GetParticle("mu-")->Mass();
625 //_____________________________________________________________________________
626 void AliAnalysisMuMu::FinishTaskOutput()
628 /// prune empty histograms BEFORE mergin, in order to save some bytes...
630 if ( fHistogramCollection )
632 UInt_t size = fHistogramCollection->EstimateSize(kFALSE);
634 AliInfo(Form("size before prune histograms = %5.1f MB",size/1024.0/1024.0));
636 fHistogramCollection->PruneEmptyHistograms();
638 AliInfo(Form("size after prune histograms = %5.1f MB",size/1024.0/1024.0));
643 //_____________________________________________________________________________
644 TH1* AliAnalysisMuMu::Histo(const char* physics, const char* triggerClassName, const char* histoname)
646 /// Get one histo back
647 return fHistogramCollection ? fHistogramCollection->Histo(physics,triggerClassName,histoname) : 0x0;
650 //_____________________________________________________________________________
651 TH1* AliAnalysisMuMu::Histo(const char* physics, const char* histoname)
653 /// Get one histo back
654 return fHistogramCollection ? fHistogramCollection->Histo(physics,histoname) : 0x0;
657 //_____________________________________________________________________________
658 TH1* AliAnalysisMuMu::Histo(const char* physics,
659 const char* triggerClassName,
661 const char* histoname)
663 /// Get one histo back
664 return fHistogramCollection ? fHistogramCollection->Histo(physics,triggerClassName,what,histoname) : 0x0;
667 //_____________________________________________________________________________
668 TH1* AliAnalysisMuMu::Histo(const char* physics,
669 const char* triggerClassName,
672 const char* histoname)
674 /// Get one histo back
676 return fHistogramCollection ? fHistogramCollection->Histo(physics,triggerClassName,cent,what,histoname) : 0x0;
679 //_____________________________________________________________________________
680 void AliAnalysisMuMu::NotifyRun()
682 /// Called at each change of run ?
683 AliInfo(Form("Run %09d File %s",fCurrentRunNumber,CurrentFileName()));
686 //_____________________________________________________________________________
688 AliAnalysisMuMu::Print(Option_t* /*opt*/) const
690 /// Print the definition of this analysis
692 cout << ClassName() << " - " << GetName() << " - " << ( fAA ? "PbPb mode" : "pp mode" ) << endl;
694 if ( !fSingleTrackCutNames || !fSingleTrackCutNames )
696 cout << "No single track cut defined yet" << endl;
700 TIter next(fSingleTrackCutNames);
703 while ( ( str = static_cast<TObjString*>(next()) ) )
705 cout << Form("SINGLE CUT %20s MASK %x",str->String().Data(),str->GetUniqueID()) << endl;
709 if ( !fPairTrackCutNames || !fPairTrackCutNames )
711 cout << "No track pair cut defined yet" << endl;
715 TIter next2(fPairTrackCutNames);
718 while ( ( str = static_cast<TObjString*>(next2()) ) )
722 DecodePairCutMask(str->GetUniqueID(),single,pair);
724 cout << Form("PAIR CUT %20s UID %x SINGLE MASK %x PAIR MASK %x",str->String().Data(),str->GetUniqueID(),single,pair) << endl;
728 if ( !fTriggerClasses || !fTriggerClasses->First() )
730 cout << "No trigger classes defined yet" << endl;
734 cout << "Trigger classes that will be considered:" << endl;
735 TIter next(fTriggerClasses);
738 while ( ( s = static_cast<TObjString*>(next()) ) )
740 cout << s->String().Data() << endl;
745 //_____________________________________________________________________________
747 AliAnalysisMuMu::Terminate(Option_t *)
749 /// Called once at the end of the query
750 /// Just a simple printout of the stat we analyse and how many histograms
753 fOutput = dynamic_cast<TList*>(GetOutputData(1));
755 if (!fOutput) return;
757 fHistogramCollection = dynamic_cast<AliHistogramCollection*>(fOutput->FindObject("mumu"));
759 if (!fHistogramCollection)
761 AliError("Could not find back histogram collection in output...");
765 fHistogramCollection->PruneEmptyHistograms();
767 UInt_t size2 = fHistogramCollection->EstimateSize();
769 AliInfo(Form("size after prune histograms = %5.1f MB",size2/1024.0/1024.0));
773 fHistogramCollection->Print("*Minv*");
775 fEventCounters = dynamic_cast<AliCounterCollection*>(fOutput->FindObject("eventCounters"));
779 AliError("Could not find back counters in output...");
783 fEventCounters->Print();
787 //_____________________________________________________________________________
788 void AliAnalysisMuMu::UserExec(Option_t* opt)
790 /// Executed at each event
795 PostData(1, fOutput);
798 //_____________________________________________________________________________
799 void AliAnalysisMuMu::UserCreateOutputObjects()
804 fTriggerClasses->Print();
807 fOutput->SetOwner(kTRUE);
809 fHistogramCollection = new AliHistogramCollection("mumu");
811 fOutput->Add(fHistogramCollection);
813 // initialize event counters
814 fEventCounters = new AliCounterCollection("eventCounters");
816 TIter nextGSN(fGlobalEventSelectionNames);
819 while ( ( str = static_cast<TObjString*>(nextGSN()) ) )
821 if ( eventRubric.Length() > 0 ) eventRubric += "/";
822 eventRubric += str->String();
825 fEventCounters->AddRubric("event", eventRubric.Data());
827 fEventCounters->AddRubric("trigger", 100);
829 fEventCounters->AddRubric("run", 1000000);
831 fEventCounters->Init();
833 fOutput->Add(fEventCounters);
836 PostData(1, fOutput);