CMS 3D CMS Logo

GFOverlay.h
Go to the documentation of this file.
1 #ifndef GFUTILSGFOVERLAY_H
2 #define GFUTILSGFOVERLAY_H
3 
4 #include "TString.h"
5 #include "TObjArray.h"
6 #include <vector>
7 
8 // Author: Gero Flucke
9 // Date: October 2007
10 // last update: $Date: 2012/03/29 08:48:50 $
11 // by: $Author: flucke $
12 //
13 // Class to overlay hists with same names from (several) different files.
14 // Constructor argument 'fileLegendList' is a comma separated list of files
15 // and the legend entry corresponding to it, e.g.
16 // "file1.root=label1,file2.root=label2,..."
17 // Finds recursively all hists in all directories of the first file.
18 // The hists of one directory are grouped in one layer of the GFHistManager.
19 //
20 // Following options are recognised:
21 // 1)
22 // If 'option' contains 'norm', the hists are normalised to their number of entries.
23 // 2)
24 // If 'option' contains 'skip(XYZ)' or 'skipHist(XYZ)', hists are skipped if their names
25 // contain 'XYZ', similarly with 'skip(XYZ)' or 'skipDir(XYZ)' for directories.
26 // Can be given several times.
27 // 3)
28 // If 'option' contains 'name(XYZ)' or 'nameHist(XYZ)', hists are skipped if their names
29 // do NOT contain 'XYZ', similarly with 'name(XYZ)' or 'nameHist(XYZ)' for directories.
30 // Can be given several times.
31 // 4)
32 // If 'option' contains 'sumperdir', for each directory hists created containing
33 // the means and RMS of all (1D-)hists of that directory and puts these in the following
34 // 'layer' of the GFHistManager.
35 //
36 // (Lower and upper case are ignored for 'norm', 'skip', 'name' and 'sumperdir'.)
37 //
38 // CAVEAT:
39 // If you want to skip all hists that contain 'Norm' in their name by option 'skip(Norm)',
40 // this will also lead to the normalisation option being switched on...
41 
42 class TFile;
43 class TDirectory;
44 class GFHistManager;
45 class TH1;
46 
47 class GFOverlay {
48  public:
49  GFOverlay(const char *fileLegendList, Option_t *option = "");
50  ~GFOverlay();
52 
53  private:
54  TObjArray FindAllBetween(const TString &text, const char *startStr, const char *endStr) const;
55  TString FindNextBetween(const TString &input, Ssiz_t startInd,
56  const char *startStr, const char *endStr) const;
57  bool OpenFilesLegends(const char *fileLegendList);
58  void Overlay(const TObjArray &dirs, const TObjArray &legends);
59  bool KeyContainsListMember(const TString &key, const TObjArray &list) const;
60  TObjArray GetTypeWithNameFromDirs(const TClass *aType, const char *name,
61  const TObjArray &dirs) const;
62  Int_t AddHistsAt(const TObjArray &hists, const TObjArray &legends, Int_t layer,Int_t pos);
63  void CreateFillMeanRms(const TObjArray &hists, Int_t layer, const char *dirName,
64  std::vector<TH1*> &meanHists, std::vector<TH1*> &rmsHists) const;
66  Int_t fLayer;
67  TObjArray fFiles;
68  TObjArray fLegends;
69  Bool_t fNormalise;
70  Bool_t fSummaries;
71  TObjArray fDirNames;
72  TObjArray fSkipDirNames;
73  TObjArray fHistNames;
74  TObjArray fSkipHistNames;
75 };
76 
77 #endif
GFOverlay::~GFOverlay
~GFOverlay()
input
static const std::string input
Definition: EdmProvDump.cc:48
GFOverlay::GFOverlay
GFOverlay(const char *fileLegendList, Option_t *option="")
GFOverlay::CreateFillMeanRms
void CreateFillMeanRms(const TObjArray &hists, Int_t layer, const char *dirName, std::vector< TH1 * > &meanHists, std::vector< TH1 * > &rmsHists) const
GFHistManager
Definition: GFHistManager.h:20
heppy_check.dirs
dirs
Definition: heppy_check.py:26
GFOverlay::KeyContainsListMember
bool KeyContainsListMember(const TString &key, const TObjArray &list) const
pos
Definition: PixelAliasList.h:18
GFOverlay::GetHistManager
GFHistManager * GetHistManager()
Definition: GFOverlay.h:51
GFOverlay::fFiles
TObjArray fFiles
Definition: GFOverlay.h:67
GFOverlay::fSummaries
Bool_t fSummaries
Definition: GFOverlay.h:70
GFOverlay::OpenFilesLegends
bool OpenFilesLegends(const char *fileLegendList)
compare.hists
hists
Definition: compare.py:319
fileinputsource_cfi.option
option
Definition: fileinputsource_cfi.py:87
GFOverlay::fSkipHistNames
TObjArray fSkipHistNames
Definition: GFOverlay.h:74
RecoTauValidation_cfi.legends
legends
Definition: RecoTauValidation_cfi.py:317
GFOverlay::fSkipDirNames
TObjArray fSkipDirNames
Definition: GFOverlay.h:72
GFOverlay::fDirNames
TObjArray fDirNames
Definition: GFOverlay.h:71
GFOverlay::AddHistsAt
Int_t AddHistsAt(const TObjArray &hists, const TObjArray &legends, Int_t layer, Int_t pos)
GFOverlay::GetTypeWithNameFromDirs
TObjArray GetTypeWithNameFromDirs(const TClass *aType, const char *name, const TObjArray &dirs) const
GFOverlay::FindAllBetween
TObjArray FindAllBetween(const TString &text, const char *startStr, const char *endStr) const
GFOverlay::fHistNames
TObjArray fHistNames
Definition: GFOverlay.h:73
GFOverlay::Overlay
void Overlay(const TObjArray &dirs, const TObjArray &legends)
GFOverlay::fNormalise
Bool_t fNormalise
Definition: GFOverlay.h:69
TrackerOfflineValidation_Dqm_cff.dirName
dirName
Definition: TrackerOfflineValidation_Dqm_cff.py:55
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
GFOverlay
Definition: GFOverlay.h:47
GFOverlay::FindNextBetween
TString FindNextBetween(const TString &input, Ssiz_t startInd, const char *startStr, const char *endStr) const
runonSM.text
text
Definition: runonSM.py:43
GFOverlay::fLegends
TObjArray fLegends
Definition: GFOverlay.h:68
crabWrapper.key
key
Definition: crabWrapper.py:19
GFOverlay::fHistMan
GFHistManager * fHistMan
Definition: GFOverlay.h:65
GFOverlay::fLayer
Int_t fLayer
Definition: GFOverlay.h:66