CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
CommonAnalyzer Class Reference

#include <CommonAnalyzer.h>

Public Member Functions

 CommonAnalyzer (TFile *file, const char *run, const char *mod, const char *path="", const char *prefix="")
 
 CommonAnalyzer (const CommonAnalyzer &dtca)
 
TH1F * getBinomialRatio (const CommonAnalyzer &denom, const char *name, const int rebin=-1) const
 
const std::string & getModule () const
 
TObject * getObject (const char *name) const
 
TNamed * getObjectWithSuffix (const char *name, const char *suffix="") const
 
const std::string & getPath () const
 
const std::string & getPrefix () const
 
const std::vector< unsigned int > getRunList () const
 
const std::string & getRunNumber () const
 
CommonAnalyzeroperator= (const CommonAnalyzer &dtca)
 
void setFile (TFile *file)
 
void setModule (const char *mod)
 
void setPath (const char *path)
 
void setPrefix (const char *prefix)
 
void setRunNumber (const char *run)
 

Private Attributes

TFile * _file
 
std::string _module
 
std::string _path
 
std::string _prefix
 
std::string _runnumber
 

Detailed Description

Definition at line 12 of file CommonAnalyzer.h.

Constructor & Destructor Documentation

CommonAnalyzer::CommonAnalyzer ( TFile *  file,
const char *  run,
const char *  mod,
const char *  path = "",
const char *  prefix = "" 
)

Definition at line 14 of file CommonAnalyzer.cc.

14  :
std::string _prefix
std::string _runnumber
tuple path
else: Piece not in the list, fine.
std::string _module
std::string _path
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
CommonAnalyzer::CommonAnalyzer ( const CommonAnalyzer dtca)

Definition at line 17 of file CommonAnalyzer.cc.

17  :
18  _file(dtca._file), _runnumber(dtca._runnumber), _module(dtca._module), _path(dtca._path),
19  _prefix(dtca._prefix){ }
std::string _prefix
std::string _runnumber
std::string _module
std::string _path

Member Function Documentation

TH1F * CommonAnalyzer::getBinomialRatio ( const CommonAnalyzer denom,
const char *  name,
const int  rebin = -1 
) const

Definition at line 102 of file CommonAnalyzer.cc.

References getObject(), and pileupDistInMC::num.

102  {
103 
104  TH1F* den = (TH1F*)denom.getObject(name);
105  TH1F* num = (TH1F*)getObject(name);
106  TH1F* ratio =0;
107 
108  if(den!=0 && num!=0) {
109 
110  TH1F* denreb=den;
111  TH1F* numreb=num;
112  if(rebin>0) {
113  denreb = (TH1F*)den->Rebin(rebin,"denrebinned");
114  numreb = (TH1F*)num->Rebin(rebin,"numrebinned");
115  }
116 
117  ratio = new TH1F(*numreb);
118  ratio->SetDirectory(0);
119  ratio->Reset();
120  ratio->Sumw2();
121  ratio->Divide(numreb,denreb,1,1,"B");
122  delete denreb;
123  delete numreb;
124  }
125 
126  return ratio;
127 }
TObject * getObject(const char *name) const
const std::string & CommonAnalyzer::getModule ( ) const

Definition at line 40 of file CommonAnalyzer.cc.

References _module.

40 {return _module;}
std::string _module
TObject * CommonAnalyzer::getObject ( const char *  name) const
TNamed * CommonAnalyzer::getObjectWithSuffix ( const char *  name,
const char *  suffix = "" 
) const

Definition at line 59 of file CommonAnalyzer.cc.

References _runnumber, getObject(), getGTfromDQMFile::obj, and createPayload::suffix.

59  {
60 
61  TNamed* obj = (TNamed*)getObject(name);
62 
63  if(obj) {
64  if(!strstr(obj->GetTitle(),"run")) {
65  char htitle[300];
66  sprintf(htitle,"%s %s run %s",obj->GetTitle(),suffix,_runnumber.c_str());
67  obj->SetTitle(htitle);
68  }
69  }
70  return obj;
71 
72 }
TObject * getObject(const char *name) const
std::string _runnumber
const std::string & CommonAnalyzer::getPath ( ) const

Definition at line 41 of file CommonAnalyzer.cc.

References _path.

41 {return _path;}
std::string _path
const std::string & CommonAnalyzer::getPrefix ( ) const

Definition at line 42 of file CommonAnalyzer.cc.

References _prefix.

42 {return _prefix;}
std::string _prefix
const std::vector< unsigned int > CommonAnalyzer::getRunList ( ) const

Definition at line 74 of file CommonAnalyzer.cc.

References _file, _module, _path, GetRecoTauVFromDQM_MC_cff::cl, gather_cfg::cout, relval_steps::key, relativeConstraints::keys, convertSQLiteXML::ok, DTTTrigCorrFirst::run, lumiPlot::runlist, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by AverageRunBadChannels(), AverageRunMultiplicity(), BSvsPVPlots(), Combined2DHisto(), CombinedHisto(), multibsvspvplots(), PrimaryVertexPlots(), StatisticsPlots(), and SummaryHisto().

74  {
75 
76  std::vector<unsigned int> runlist;
77 
78  std::string fullpath = _module + "/" + _path;
79  if(_file) {
80  bool ok = _file->cd(fullpath.c_str());
81  if(ok && gDirectory) {
82  TList* keys = gDirectory->GetListOfKeys();
83  TListIter it(keys);
84  TKey* key=0;
85  while((key=(TKey*)it.Next())) {
86  std::cout << key->GetName() << std::endl;
87  TClass cl(key->GetClassName());
88  if (cl.InheritsFrom("TDirectory") && strstr(key->GetName(),"run_") != 0 ) {
89  unsigned int run;
90  sscanf(key->GetName(),"run_%u",&run);
91  runlist.push_back(run);
92  }
93  }
94 
95  }
96  }
97  // sort(runlist);
98  return runlist;
99 
100 }
tuple runlist
Definition: lumiPlot.py:292
std::string _module
std::string _path
tuple cout
Definition: gather_cfg.py:121
const std::string & CommonAnalyzer::getRunNumber ( ) const

Definition at line 39 of file CommonAnalyzer.cc.

References _runnumber.

39 {return _runnumber;}
std::string _runnumber
CommonAnalyzer & CommonAnalyzer::operator= ( const CommonAnalyzer dtca)

Definition at line 21 of file CommonAnalyzer.cc.

References _file, _module, _path, _prefix, and _runnumber.

21  {
22 
23  if(this != &dtca) {
24  _file = dtca._file;
25  _runnumber = dtca._runnumber;
26  _module = dtca._module;
27  _path = dtca._path;
28  _prefix = dtca._prefix;
29  }
30  return *this;
31 }
std::string _prefix
std::string _runnumber
std::string _module
std::string _path
void CommonAnalyzer::setFile ( TFile *  file)

Definition at line 34 of file CommonAnalyzer.cc.

References _file, and mergeVDriftHistosByStation::file.

void CommonAnalyzer::setModule ( const char *  mod)

Definition at line 35 of file CommonAnalyzer.cc.

References _module, and mod().

35 { _module = mod; }
std::string _module
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
void CommonAnalyzer::setPath ( const char *  path)
void CommonAnalyzer::setPrefix ( const char *  prefix)

Definition at line 37 of file CommonAnalyzer.cc.

References _prefix, and prof2calltree::prefix.

37 { _prefix = prefix; }
std::string _prefix
void CommonAnalyzer::setRunNumber ( const char *  run)

Definition at line 33 of file CommonAnalyzer.cc.

References _runnumber, and DTTTrigCorrFirst::run.

Member Data Documentation

TFile* CommonAnalyzer::_file
private
std::string CommonAnalyzer::_module
private

Definition at line 43 of file CommonAnalyzer.h.

Referenced by getModule(), getObject(), getRunList(), operator=(), and setModule().

std::string CommonAnalyzer::_path
private
std::string CommonAnalyzer::_prefix
private

Definition at line 45 of file CommonAnalyzer.h.

Referenced by getPrefix(), operator=(), and setPrefix().

std::string CommonAnalyzer::_runnumber
private

Definition at line 42 of file CommonAnalyzer.h.

Referenced by getObjectWithSuffix(), getRunNumber(), operator=(), and setRunNumber().