AliPhysics  f9b5d69 (f9b5d69)
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 
37  void DrawEffTrend ( Int_t itype, Int_t irpc, Double_t maxNsigmasOutliers = -1., Double_t minEff = 0.8, Double_t maxEff = 1.01 ) const;
38  void DrawStatContribution ( Int_t itype, Int_t irpc, Double_t maxNsigmaOutliers = -1., Double_t minY = 0., Double_t maxY = 0.15 ) const;
39 
40  Double_t GetAverageStat ( Int_t firstRun, Int_t lastRun, Int_t itype = AliTrigChEffOutput::kHboardEff, Bool_t excludePeriphericBoards = kTRUE ) const;
41 
42  TGraphAsymmErrors* GetOutliers ( TGraphAsymmErrors* graph, Double_t maxNsigmas = 3. ) const;
43 
44  TH1* GetTrend ( Int_t itype, Int_t icount, Int_t ichamber, Int_t idetelem ) const;
45  TGraphAsymmErrors* GetTrendEff ( Int_t itype, Int_t icount, Int_t ichamber, Int_t idetelem ) const;
46 
47  Int_t CompareEfficiencies ( const char* sources, const char* titles, const char* opt, const char* canvasNameSuffix = "" ) const;
48  Int_t CompareEfficiencyMethods ( const char* source, const char* opt, const char* canvasNameSuffix = "" ) const;
49  void CompareMergedEfficiencies ( const char* opt ) const;
50  Int_t ComputeAndCompareEfficiencies ( const char* sources, const char* titles, const char* opt, const char* canvasNameSuffix = "") const;
51 
52  Bool_t PatchEfficiency ( const char* effToModify, const char* fromEff, const char* boardsToPatch, const char* outFilename ) const;
53  Bool_t AdditionalSystematics ( const char* additionalSystematics, const char* affectedBoards ) const;
54 
55  Bool_t AddSystematicCondition ( const char* physSel, const char* trigClassName, const char* centrality, Int_t itrackSel, Int_t imatch, Int_t imethod );
57  Bool_t SetEffConditions ( const char* physSel, const char* trigClassName, const char* centrality, Int_t itrackSel, Int_t imatch, Int_t imethod );
58 
59  Bool_t MergeOutput ( TArrayI runRanges, Double_t averageStatError = 0.01, Bool_t isIndex = kFALSE );
60 
61  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" );
62  Bool_t InitFromLocal ( const char *localFileList, const char *outputName = "testMTRChamberEff" );
63  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" );
64 
65 
66  Bool_t WriteMergedToOCDB ( const char* outputCDB = "CDB", Bool_t writeSystematics = kFALSE ) const;
67  Bool_t WriteToOCDB ( const char* inFilename, const char* outputCDB, Int_t firstRun, Int_t lastRun, const char* defaultOCDB = "local://$ALIROOT_OCDB_ROOT/OCDB" ) const;
68  Bool_t DrawSystematicEnvelope ( Bool_t perRPC = kFALSE ) const;
70  Bool_t RecoverEfficiency ( const char* runList, const char* ocdb, const char* systOcdb, Int_t referenceRun = -1 );
71 
72  static void ZoomPad();
73 
74  virtual ~AliMTRChEffAnalysis();
75 
76  private:
77 
78  Bool_t AddToList ( const char *filename, const char *outputName );
79  TArrayI BoardsInRPC ( Int_t irpc ) const;
80  void CopyDir ( TDirectory *source ) const;
81  Bool_t CopyLocally ( const char* runList, const char* path, const char* pattern, const char* localFileList, const char* outDir, const char* directory ) const;
82  Int_t Check() const;
83  Int_t CompareEfficiencies ( TObjArray* effHistoLists, const char* titles, const char* opt, const char* canvasNameSuffix ) const;
84  TList* CloneEffHistoList ( TList* effHistos ) const;
85  Bool_t ExecCommand ( TString command, Bool_t prompt ) const;
87  Double_t GetError ( Double_t errLow, Double_t errHigh ) const;
88  TList* GetEffHistoList ( AliTrigChEffOutput* trigOut, TObjArray* condition ) const;
89  TH1* GetHisto ( TList* effHistoList, Int_t itype, Int_t icount, Int_t ichamber ) const;
90  Int_t GetIndexFromRun ( Int_t runNumber ) const;
91  Int_t GetRunNumber ( Int_t ipt ) const;
92  TList* GetRunList ( const char* runList ) const;
93  TString GetId ( const char* condition, Int_t minRun, Int_t maxRun = -1 ) const;
94 
95  TString GetShortConditionTitle ( const char* conditionName ) const;
96  AliTrigChEffOutput* Namer() const;
97 
98  TH1* GetSum ( AliTrigChEffOutput* trigOut, TObjArray* condition, Int_t itype, Int_t icount, Int_t ichamber ) const;
99 
100  Double_t GetThreeOfFour ( TArrayD eff, TArrayD effErr, Double_t &probErr ) const;
101 
102 
103  Bool_t HasMergedResults () const;
104 
105  TArrayI MergeRangesForStat ( TArrayI runRanges, Double_t averageStatError, Bool_t excludePeriphericBoards = kTRUE ) const;
106 
107  Bool_t PatchEffLists ( TList* listToModify, TList* fromList, const char* boardsToPatch ) const;
108 
109  TList* ReadEffHistoList ( const char* src ) const;
110 
111  Bool_t SetCondition ( const char* physSel, const char* trigClassName, const char* centrality, Int_t itrackSel, Int_t imatch, Int_t imethod, Bool_t isBasic );
112 
113  Bool_t WriteToOCDB ( TList* effHistos, const char* outputCDB, Int_t firstRun, Int_t lastRun, const char* defaultOCDB = "local://$ALIROOT_OCDB_ROOT/OCDB" ) const;
114 
119 
121 
123 
124  class AliMTRChEffInnerObj : public TObject {
125  public:
126  AliMTRChEffInnerObj ( const char* filename, const char* outputname, Int_t minRun, Int_t maxRun = -1 );
127  virtual ~AliMTRChEffInnerObj ();
128  TString GetFilename () const { return fFilename; }
129  TString GetOutputname () const { return fOutputname; }
130  Int_t GetMinRun () const { return fMinRun; }
131  Int_t GetMaxRun () const { return fMaxRun; }
132  std::map<std::string,TList*> GetEffLists() { return fEffLists; }
133  std::vector<std::string> GetSortKeys() { return fSortKeys; }
134  TList* GetEffHistoList ( const char* condition ) const;
135  Bool_t AddEffHistoList ( const char* condition, TList* effHistoList );
136  Bool_t RemoveEffHistoList ( const char* condition );
137 
138  private:
143  std::map<std::string,TList*> fEffLists;
144  std::vector<std::string> fSortKeys;
145  };
146 
147  std::vector<AliMTRChEffAnalysis::AliMTRChEffInnerObj*> fRunMap;
148  std::vector<AliMTRChEffAnalysis::AliMTRChEffInnerObj*> fMergedMap;
149 
151  ClassDef(AliMTRChEffAnalysis, 0); // Trigger chamber efficiencies
153 };
154 
155 #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 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