AliPhysics  aaf9c62 (aaf9c62)
AliMTRChEffAnalysis.h
Go to the documentation of this file.
1 #ifndef ALIMTRCHEFFANALYSIS_h
2 #define ALIMTRCHEFFANALYSIS_h
3 
13 
14 #include "TObject.h"
15 #include "TString.h"
16 #include "AliTrigChEffOutput.h"
17 #include <map>
18 #include <string>
19 #include <vector>
20 
21 class TObjArray;
22 class TDirectory;
23 class TH1;
24 class TGraphAsymmErrors;
25 class TArrayI;
26 class TArrayD;
27 class TList;
28 
29 class AliMTRChEffAnalysis : public TObject {
30  public:
32  AliMTRChEffAnalysis ( const char *localFileList, const char *outputName = "testMTRChamberEff" );
33 
34  TArrayI GetHomogeneousRanges ( Double_t chi2Cut = 3, Int_t maxNRanges = 4, Double_t minEffVariation = 0.005, Bool_t perRPC = kTRUE, TArrayI* forcedChanges = 0x0, Double_t minEff = 0.85, Double_t maxEff = 1.01 );
35  TArrayI GetHomogeneousRanges ( TGraphAsymmErrors* trendGraph, Double_t chi2Cut = 3, Int_t maxNRanges = 4, Double_t minEffVariation = 0.005, TArrayI* forcedChanges = 0x0, Bool_t returnIndex = kFALSE );
36  Bool_t CheckRanges ( TArrayI runRanges ) const;
37 
38  void DrawEffTrend ( Int_t itype, Int_t irpc, Double_t maxNsigmasOutliers = -1., Double_t minEff = 0.8, Double_t maxEff = 1.01 ) const;
39  void DrawStatContribution ( Int_t itype, Int_t irpc, Double_t maxNsigmaOutliers = -1., Double_t minY = 0., Double_t maxY = 0.15 ) const;
40 
41  Double_t GetAverageStat ( Int_t firstRun, Int_t lastRun, Int_t itype = AliTrigChEffOutput::kHboardEff, Bool_t excludePeriphericBoards = kTRUE ) const;
42 
43  TGraphAsymmErrors* GetOutliers ( TGraphAsymmErrors* graph, Double_t maxNsigmas = 3. ) const;
44 
45  TH1* GetTrend ( Int_t itype, Int_t icount, Int_t ichamber, Int_t idetelem ) const;
46  TGraphAsymmErrors* GetTrendEff ( Int_t itype, Int_t icount, Int_t ichamber, Int_t idetelem ) const;
47 
48  Int_t CompareEfficiencies ( const char* sources, const char* titles, const char* opt, const char* canvasNameSuffix = "" ) const;
49  Int_t CompareEfficiencyMethods ( const char* source, const char* opt, const char* canvasNameSuffix = "" ) const;
50  void CompareMergedEfficiencies ( const char* opt ) const;
51  Int_t ComputeAndCompareEfficiencies ( const char* sources, const char* titles, const char* opt, const char* canvasNameSuffix = "") const;
52 
53  Bool_t PatchEfficiency ( const char* effToModify, const char* fromEff, const char* boardsToPatch, const char* outFilename ) const;
54  Bool_t AdditionalSystematics ( const char* additionalSystematics, const char* affectedBoards ) const;
55 
56  Bool_t AddSystematicCondition ( const char* physSel, const char* trigClassName, const char* centrality, Int_t itrackSel, Int_t imatch, Int_t imethod );
58  Bool_t SetEffConditions ( const char* physSel, const char* trigClassName, const char* centrality, Int_t itrackSel, Int_t imatch, Int_t imethod );
59 
60  Bool_t MergeOutput ( TArrayI runRanges, Double_t averageStatError = 0.01, Bool_t isIndex = kFALSE );
61 
62  Bool_t InitFromGrid ( const char *runList, const char *path, const char *pattern, const char* localFileList = "localFileList.txt", const char* outDir = "", const char *directory = "MTR_ChamberEffMap", const char *outputName = "testMTRChamberEff" );
63  Bool_t InitFromLocal ( const char *localFileList, const char *outputName = "testMTRChamberEff" );
64  Bool_t InitFromWeb ( const char *runList, const char *path, const char* localFileList = "localFileList.txt", const char* outDir = "", const char *directory = "MTR_ChamberEffMap", const char *outputName = "testMTRChamberEff" );
65 
66 
67  Bool_t WriteMergedToOCDB ( const char* outputCDB = "CDB", Bool_t writeSystematics = kFALSE ) const;
68  Bool_t WriteToOCDB ( const char* inFilename, const char* outputCDB, Int_t firstRun, Int_t lastRun, const char* defaultOCDB = "local://$ALIROOT_OCDB_ROOT/OCDB" ) const;
69  Bool_t DrawSystematicEnvelope ( Bool_t perRPC = kFALSE ) const;
71  Bool_t RecoverEfficiency ( const char* runList, const char* ocdb, const char* systOcdb, Int_t referenceRun = -1 );
72 
73  static void ZoomPad();
74 
75  virtual ~AliMTRChEffAnalysis();
76 
77  private:
78 
79  Bool_t AddToList ( const char *filename, const char *outputName );
80  TArrayI BoardsInRPC ( Int_t irpc ) const;
81  void CopyDir ( TDirectory *source ) const;
82  Bool_t CopyLocally ( const char* runList, const char* path, const char* pattern, const char* localFileList, const char* outDir, const char* directory ) const;
83  Int_t Check() const;
84  Int_t CompareEfficiencies ( TObjArray* effHistoLists, const char* titles, const char* opt, const char* canvasNameSuffix ) const;
85  TList* CloneEffHistoList ( TList* effHistos ) const;
86  Bool_t ExecCommand ( TString command, Bool_t prompt ) const;
88  Double_t GetError ( Double_t errLow, Double_t errHigh ) const;
89  TList* GetEffHistoList ( AliTrigChEffOutput* trigOut, TObjArray* condition ) const;
90  TH1* GetHisto ( TList* effHistoList, Int_t itype, Int_t icount, Int_t ichamber ) const;
91  Int_t GetIndexFromRun ( Int_t runNumber ) const;
92  Int_t GetRunNumber ( Int_t ipt ) const;
93  TList* GetRunList ( const char* runList ) const;
94  TString GetId ( const char* condition, Int_t minRun, Int_t maxRun = -1 ) const;
95 
96  TString GetShortConditionTitle ( const char* conditionName ) const;
97  AliTrigChEffOutput* Namer() const;
98 
99  TH1* GetSum ( AliTrigChEffOutput* trigOut, TObjArray* condition, Int_t itype, Int_t icount, Int_t ichamber ) const;
100 
101  Double_t GetThreeOfFour ( TArrayD eff, TArrayD effErr, Double_t &probErr ) const;
102 
103 
104  Bool_t HasMergedResults () const;
105 
106  TArrayI MergeRangesForStat ( TArrayI runRanges, Double_t averageStatError, Bool_t excludePeriphericBoards = kTRUE ) const;
107 
108  Bool_t PatchEffLists ( TList* listToModify, TList* fromList, const char* boardsToPatch ) const;
109 
110  TList* ReadEffHistoList ( const char* src ) const;
111 
112  Bool_t SetCondition ( const char* physSel, const char* trigClassName, const char* centrality, Int_t itrackSel, Int_t imatch, Int_t imethod, Bool_t isBasic );
113 
114  Bool_t WriteToOCDB ( TList* effHistos, const char* outputCDB, Int_t firstRun, Int_t lastRun, const char* defaultOCDB = "local://$ALIROOT_OCDB_ROOT/OCDB" ) const;
115 
120 
122 
124 
125  class AliMTRChEffInnerObj : public TObject {
126  public:
127  AliMTRChEffInnerObj ( const char* filename, const char* outputname, Int_t minRun, Int_t maxRun = -1 );
128  virtual ~AliMTRChEffInnerObj ();
129  TString GetFilename () const { return fFilename; }
130  TString GetOutputname () const { return fOutputname; }
131  Int_t GetMinRun () const { return fMinRun; }
132  Int_t GetMaxRun () const { return fMaxRun; }
133  std::map<std::string,TList*> GetEffLists() { return fEffLists; }
134  std::vector<std::string> GetSortKeys() { return fSortKeys; }
135  TList* GetEffHistoList ( const char* condition ) const;
136  Bool_t AddEffHistoList ( const char* condition, TList* effHistoList );
137  Bool_t RemoveEffHistoList ( const char* condition );
138 
139  private:
144  std::map<std::string,TList*> fEffLists;
145  std::vector<std::string> fSortKeys;
146  };
147 
148  std::vector<AliMTRChEffAnalysis::AliMTRChEffInnerObj*> fRunMap;
149  std::vector<AliMTRChEffAnalysis::AliMTRChEffInnerObj*> fMergedMap;
150 
152  ClassDef(AliMTRChEffAnalysis, 0); // Trigger chamber efficiencies
154 };
155 
156 #endif
std::map< std::string, TList * > GetEffLists()
const char * filename
Definition: TestFCM.C:1
void CompareMergedEfficiencies(const char *opt) const
double Double_t
Definition: External.C:58
void CopyDir(TDirectory *source) const
Double_t GetError(Double_t errLow, Double_t errHigh) const
Bool_t AdditionalSystematics(const char *additionalSystematics, const char *affectedBoards) const
std::map< std::string, TList * > fEffLists
Bool_t CopyLocally(const char *runList, const char *path, const char *pattern, const char *localFileList, const char *outDir, const char *directory) const
Double_t GetThreeOfFour(TArrayD eff, TArrayD effErr, Double_t &probErr) const
TGraphAsymmErrors * GetTrendEff(Int_t itype, Int_t icount, Int_t ichamber, Int_t idetelem) const
centrality
std::vector< std::string > GetSortKeys()
Bool_t RemoveEffHistoList(const char *condition)
AliMTRChEffInnerObj(const char *filename, const char *outputname, Int_t minRun, Int_t maxRun=-1)
TArrayI MergeRangesForStat(TArrayI runRanges, Double_t averageStatError, Bool_t excludePeriphericBoards=kTRUE) const
Int_t ComputeAndCompareEfficiencies(const char *sources, const char *titles, const char *opt, const char *canvasNameSuffix="") const
Counts per board histogram index.
Bool_t CheckRanges(TArrayI runRanges) const
Bool_t InitFromWeb(const char *runList, const char *path, const char *localFileList="localFileList.txt", const char *outDir="", const char *directory="MTR_ChamberEffMap", const char *outputName="testMTRChamberEff")
Int_t CompareEfficiencies(const char *sources, const char *titles, const char *opt, const char *canvasNameSuffix="") const
TList * GetEffHistoList(const char *condition) const
Bool_t PatchEfficiency(const char *effToModify, const char *fromEff, const char *boardsToPatch, const char *outFilename) const
TList * GetEffHistoList(AliTrigChEffOutput *trigOut, TObjArray *condition) const
int Int_t
Definition: External.C:63
Bool_t WriteMergedToOCDB(const char *outputCDB="CDB", Bool_t writeSystematics=kFALSE) const
AliMTRChEffAnalysis & operator=(const AliMTRChEffAnalysis &)
Dummy.
Bool_t AddToList(const char *filename, const char *outputName)
Int_t CompareEfficiencyMethods(const char *source, const char *opt, const char *canvasNameSuffix="") const
Output for Trig chamber effieincy.
Bool_t InitFromLocal(const char *localFileList, const char *outputName="testMTRChamberEff")
Bool_t AddEffHistoList(const char *condition, TList *effHistoList)
TArrayI GetHomogeneousRanges(Double_t chi2Cut=3, Int_t maxNRanges=4, Double_t minEffVariation=0.005, Bool_t perRPC=kTRUE, TArrayI *forcedChanges=0x0, Double_t minEff=0.85, Double_t maxEff=1.01)
Bool_t SetEffConditions(const char *physSel, const char *trigClassName, const char *centrality, Int_t itrackSel, Int_t imatch, Int_t imethod)
Output for Trig chamber effieincy.
AliTrigChEffOutput * fNamer
! Namer for histograms
void DrawStatContribution(Int_t itype, Int_t irpc, Double_t maxNsigmaOutliers=-1., Double_t minY=0., Double_t maxY=0.15) const
Bool_t PatchEffLists(TList *listToModify, TList *fromList, const char *boardsToPatch) const
Double_t GetAverageStat(Int_t firstRun, Int_t lastRun, Int_t itype=AliTrigChEffOutput::kHboardEff, Bool_t excludePeriphericBoards=kTRUE) const
TString GetId(const char *condition, Int_t minRun, Int_t maxRun=-1) const
AliTrigChEffOutput * Namer() const
std::vector< AliMTRChEffAnalysis::AliMTRChEffInnerObj * > fRunMap
! Map of internal objects per run
std::vector< AliMTRChEffAnalysis::AliMTRChEffInnerObj * > fMergedMap
! Map of merged internal objects
TH1 * GetHisto(TList *effHistoList, Int_t itype, Int_t icount, Int_t ichamber) const
Bool_t SetCondition(const char *physSel, const char *trigClassName, const char *centrality, Int_t itrackSel, Int_t imatch, Int_t imethod, Bool_t isBasic)
Bool_t WriteToOCDB(const char *inFilename, const char *outputCDB, Int_t firstRun, Int_t lastRun, const char *defaultOCDB="local://$ALIROOT_OCDB_ROOT/OCDB") const
TList * GetRunList(const char *runList) const
Int_t GetRunNumber(Int_t ipt) const
Bool_t HasMergedResults() const
Bool_t ExecCommand(TString command, Bool_t prompt) const
TArrayI BoardsInRPC(Int_t irpc) const
Bool_t RecoverEfficiency(const char *runList, const char *ocdb, const char *systOcdb, Int_t referenceRun=-1)
Int_t GetIndexFromRun(Int_t runNumber) const
Double_t FitRangesFunc(Double_t *x, Double_t *par)
void DrawEffTrend(Int_t itype, Int_t irpc, Double_t maxNsigmasOutliers=-1., Double_t minEff=0.8, Double_t maxEff=1.01) const
TObjArray * fConditions
! List of conditions for trigger efficiency
Bool_t InitFromGrid(const char *runList, const char *path, const char *pattern, const char *localFileList="localFileList.txt", const char *outDir="", const char *directory="MTR_ChamberEffMap", const char *outputName="testMTRChamberEff")
TList * CloneEffHistoList(TList *effHistos) const
TGraphAsymmErrors * GetOutliers(TGraphAsymmErrors *graph, Double_t maxNsigmas=3.) const
Bool_t AddSystematicCondition(const char *physSel, const char *trigClassName, const char *centrality, Int_t itrackSel, Int_t imatch, Int_t imethod)
bool Bool_t
Definition: External.C:53
TString GetShortConditionTitle(const char *conditionName) const
Bool_t DrawSystematicEnvelope(Bool_t perRPC=kFALSE) const
Bool_t MergeOutput(TArrayI runRanges, Double_t averageStatError=0.01, Bool_t isIndex=kFALSE)
Definition: External.C:196
TH1 * GetSum(AliTrigChEffOutput *trigOut, TObjArray *condition, Int_t itype, Int_t icount, Int_t ichamber) const
TList * ReadEffHistoList(const char *src) const
TH1 * GetTrend(Int_t itype, Int_t icount, Int_t ichamber, Int_t idetelem) const