Initialize newer arrays of histograms in case of Terminate execution to avoir problem...
[u/mrichter/AliRoot.git] / ANALYSIS / AliPhysicsSelection.h
CommitLineData
61899827 1/* $Id: AliPhysicsSelection.h 35782 2009-10-22 11:54:31Z jgrosseo $ */
2
3#ifndef ALIPHYSICSSELECTION_H
4#define ALIPHYSICSSELECTION_H
5
6/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
7 * See cxx source for full Copyright notice */
8
9//-------------------------------------------------------------------------
10// Implementation of Class AliPhysicsSelection
11//
12// This class selects collision candidates from data runs, applying selection cuts on triggers
13// and background rejection based on the content of the ESD
14//
15// Origin: Jan Fiete Grosse-Oetringhaus, CERN
73cc8654 16// Michele Floris, CERN
61899827 17//-------------------------------------------------------------------------
18
296dd262 19#include <AliAnalysisCuts.h>
61899827 20#include <TList.h>
91bea6e7 21#include "TObjString.h"
61899827 22
73cc8654 23#define VERBOSE_STAT
24
61899827 25class AliESDEvent;
17ba346c 26class TH2F;
73cc8654 27class TH1F;
61899827 28class TCollection;
29class AliTriggerAnalysis;
85c71ba7 30class AliAnalysisTaskSE;
61899827 31
296dd262 32class AliPhysicsSelection : public AliAnalysisCuts
61899827 33{
9b0cb3c3 34public:
85c71ba7 35
5f337f3d 36public:
85c71ba7 37 enum {kStatTriggerClass=1,kStatHWTrig,kStatV0ABG,kStatV0CBG,kStatMB1,kStatMB1Prime,kStatFMD,kStatFO1,kStatFO2,kStatV0A,kStatV0C,kStatSSD1,kStatFO1AndV0,kStatV0,kStatAny2Hits,kStatOffline,kStatBG,kStatAccepted};
38
39#ifdef VERBOSE_STAT
ca234d7a 40 enum {kStatRowBG=5,kStatRowAcc,kStatRowBGFrac,kStatRowAccFrac,kStatRowErrGoodFrac,kStatRowGoodFrac,kStatRowErrGood,kStatRowGood};
85c71ba7 41#else
42 enum {kStatRowBG=5,kStatRowAcc,kStatRowGood};
43#endif
44
45 enum {kStatIdxAll=0,kStatIdxBin0=1};
46
47
ff097e3f 48 typedef Bool_t (*Bin0Callback_t)(const AliESDEvent *);
85c71ba7 49
50 AliPhysicsSelection();
51 virtual ~AliPhysicsSelection();
61899827 52
85c71ba7 53 // AliAnalysisCuts interface
0c6c629b 54 virtual UInt_t GetSelectionMask(const TObject* obj) { return IsCollisionCandidate((const AliESDEvent*) obj); }
85c71ba7 55 virtual Bool_t IsSelected(TList*) { return kFALSE; }
0c6c629b 56 virtual Bool_t IsSelected(TObject*) {return kFALSE;}
296dd262 57
518b6d59 58 Int_t GetCurrentRun() const {return fCurrentRun;}
0c6c629b 59 UInt_t IsCollisionCandidate(const AliESDEvent* aEsd);
85c71ba7 60 Bool_t Initialize(Int_t runNumber);
decf6fd4 61
85c71ba7 62 void SetAnalyzeMC(Bool_t flag = kTRUE) { fMC = flag; }
63 void SetSkipTriggerClassSelection(Bool_t flag = kTRUE) { fSkipTriggerClassSelection = flag; }
64 void SetSkipV0(Bool_t flag=kTRUE) { fSkipV0 = flag;}
91bea6e7 65
85c71ba7 66 void AddBackgroundIdentification(AliAnalysisCuts* background) { fBackgroundIdentification = background; }
296dd262 67
85c71ba7 68 virtual void Print(Option_t* option = "") const;
69 virtual Long64_t Merge(TCollection* list);
70 void SaveHistograms(const char* folder = 0) const;
61899827 71
85c71ba7 72 const TList* GetCollisionTriggerClasses() const { return &fCollTrigClasses; }
73 const TList* GetBGTriggerClasses() const { return &fBGTrigClasses; }
74 void AddCollisionTriggerClass(const char* className){ fCollTrigClasses.Add(new TObjString(className)); fUsingCustomClasses = kTRUE; }
75 void AddBGTriggerClass(const char* className) { fBGTrigClasses.Add(new TObjString(className)); fUsingCustomClasses = kTRUE; }
91bea6e7 76
c3a12f21 77 AliTriggerAnalysis* GetTriggerAnalysis(Int_t i = 0) { return (fTriggerAnalysis.GetEntries() > 0) ? (AliTriggerAnalysis*) fTriggerAnalysis.At(i) : 0; }
61899827 78
85c71ba7 79 const TH2F* GetStatisticsHistogram(Int_t idx=kStatIdxAll) const { return fHistStatistics[idx]; }
80 const TH2F* GetBunchCrossingHistogram() const { return fHistBunchCrossing; }
17ba346c 81
85c71ba7 82 void SetBIFactors(Int_t run);
83
84 void SetUseBXNumbers(Bool_t flag = kTRUE) {fUseBXNumbers = flag;}
85 void SetComputeBG (Bool_t flag = kTRUE) {fComputeBG = flag; if(flag) fUseBXNumbers = flag;}
85fc0208 86 void SetUseMuonTriggers(Bool_t) { Printf("ERROR: Use of AliPhysicsSelection::SetUseMuonTriggers is deprecated. Use AliVEvent::kMUON selection instead."); }
85c71ba7 87 void SetBin0Callback( const char * cb) {fBin0CallBack = cb;}
ff097e3f 88 void SetBin0CallbackViaPointer( Bin0Callback_t cb) {fBin0CallBackPointer = cb;}// WARNING: THIS SHOULD NOT BE USED, WILL BE REMOVED SOON
73cc8654 89
85c71ba7 90
91protected:
0c6c629b 92 UInt_t CheckTriggerClass(const AliESDEvent* aEsd, const char* trigger) const;
85c71ba7 93 Int_t GetTriggerScheme(UInt_t runNumber) const;
94 const char * GetBXIDs(UInt_t runNumber, const char * trigger ) ;
95 const char * GetFillingScheme(UInt_t runNumber) ;
85c71ba7 96 TH2F * BookHistStatistics(const char * tag) ;
97
85c71ba7 98 Int_t fCurrentRun; // run number for which the object is initialized
99 Bool_t fMC; // flag if MC is analyzed
100 TList fCollTrigClasses; // trigger class identifying collision candidates
101 TList fBGTrigClasses; // trigger classes identifying background events
296dd262 102
85c71ba7 103 TList fTriggerAnalysis; // list of offline trigger objects (several are needed to keep the control histograms separate per trigger class)
61899827 104
85c71ba7 105 AliAnalysisCuts* fBackgroundIdentification; // class that performs additional background identification
61899827 106
85c71ba7 107 TH2F* fHistStatistics[2]; // how many events are cut away why {all,bin 0}
108 TH2F* fHistBunchCrossing; // histograms of accepted bunch crossing numbers
73cc8654 109 TH1F* fHistTriggerPattern; // Pattern of the individual detectors in the MB1 trigger. Can reveal inconsistencies/inefficiencies in the trigger
61899827 110
85c71ba7 111 Bool_t fSkipTriggerClassSelection; // flag that determines if the trigger classs selection is skipped
112 Bool_t fUsingCustomClasses; // flag that is set if costum trigger classes are defined
113 Bool_t fSkipV0; // ignore information from v0
114
115 Float_t fBIFactorA; // ratio of interacting over non interacting bunch intensities for beam 1
116 Float_t fBIFactorC; // ratio of interacting over non interacting bunch intensities for beam 2
117
85c71ba7 118
73cc8654 119 Bool_t fComputeBG; // Switch on computation of background and filling of relevant stat table entries. If you enable this you can only process one run at a time (the relative bunch intensity used to compute this chages from run to run)
120 Bool_t fUseBXNumbers; // Explicitely select "good" bunch crossing numbers (exclude pilot, afterpulses and fakes). If you anable this you can only process runs within the same filling scheme.
121 Bool_t fUseMuonTriggers; // if true, also use the muon triggers
122 TString fFillingScheme; // stores the filling scheme of the current run.
85c71ba7 123
124 TString fBin0CallBack; // callback used to determine if an event is in the bin0 (name of the task where the callback is implemented);
ff097e3f 125 Bin0Callback_t fBin0CallBackPointer; //! don't stream this. TO BE REMOVED SOON
91bea6e7 126
5f337f3d 127 ClassDef(AliPhysicsSelection, 9)
61899827 128
85c71ba7 129 private:
130 AliPhysicsSelection(const AliPhysicsSelection&);
131 AliPhysicsSelection& operator=(const AliPhysicsSelection&);
61899827 132};
133
134#endif