test
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 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::vector< unsigned int > getFillList () 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 Member Functions

const std::vector< unsigned int > getList (const char *what) const
 

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  :
15  _file(file), _runnumber(run), _module(mod), _path(path), _prefix(prefix) { }
std::string _prefix
std::string _runnumber
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 118 of file CommonAnalyzer.cc.

References getObject(), and pileupDistInMC::num.

118  {
119 
120  TH1F* den = (TH1F*)denom.getObject(name);
121  TH1F* num = (TH1F*)getObject(name);
122  TH1F* ratio =0;
123 
124  if(den!=0 && num!=0) {
125 
126  TH1F* denreb=den;
127  TH1F* numreb=num;
128  if(rebin>0) {
129  denreb = (TH1F*)den->Rebin(rebin,"denrebinned");
130  numreb = (TH1F*)num->Rebin(rebin,"numrebinned");
131  }
132 
133  ratio = new TH1F(*numreb);
134  ratio->SetDirectory(0);
135  ratio->Reset();
136  ratio->Sumw2();
137  ratio->Divide(numreb,denreb,1,1,"B");
138  delete denreb;
139  delete numreb;
140  }
141 
142  return ratio;
143 }
TObject * getObject(const char *name) const
const std::vector< unsigned int > CommonAnalyzer::getFillList ( ) const

Definition at line 80 of file CommonAnalyzer.cc.

References getList().

Referenced by ComputeOOTFractionvsFill().

80  {
81 
82  return getList("fill");
83 
84 }
const std::vector< unsigned int > getList(const char *what) const
const std::vector< unsigned int > CommonAnalyzer::getList ( const char *  what) const
private

Definition at line 86 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 getFillList(), and getRunList().

86  {
87 
88  std::vector<unsigned int> runlist;
89  char searchstring[100];
90  char decodestring[100];
91  sprintf(searchstring,"%s_",what);
92  sprintf(decodestring,"%s_%%u",what);
93 
94  std::string fullpath = _module + "/" + _path;
95  if(_file) {
96  bool ok = _file->cd(fullpath.c_str());
97  if(ok && gDirectory) {
98  TList* keys = gDirectory->GetListOfKeys();
99  TListIter it(keys);
100  TKey* key=0;
101  while((key=(TKey*)it.Next())) {
102  std::cout << key->GetName() << std::endl;
103  TClass cl(key->GetClassName());
104  if (cl.InheritsFrom("TDirectory") && strstr(key->GetName(),searchstring) != 0 ) {
105  unsigned int run;
106  sscanf(key->GetName(),decodestring,&run);
107  runlist.push_back(run);
108  }
109  }
110 
111  }
112  }
113  // sort(runlist);
114  return runlist;
115 
116 }
tuple runlist
Definition: lumiPlot.py:292
std::string _module
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
std::string _path
tuple cout
Definition: gather_cfg.py:145
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 getList().

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

74  {
75 
76  return getList("run");
77 
78 }
const std::vector< unsigned int > getList(const char *what) const
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.

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 45 of file CommonAnalyzer.h.

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

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

Definition at line 47 of file CommonAnalyzer.h.

Referenced by getPrefix(), operator=(), setPrefix(), and html.PageSet::write().

std::string CommonAnalyzer::_runnumber
private

Definition at line 44 of file CommonAnalyzer.h.

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