CMS 3D CMS Logo

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 = "" 
)
CommonAnalyzer::CommonAnalyzer ( const CommonAnalyzer dtca)

Definition at line 17 of file CommonAnalyzer.cc.

18  : _file(dtca._file), _runnumber(dtca._runnumber), _module(dtca._module), _path(dtca._path), _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 101 of file CommonAnalyzer.cc.

References getObject(), EgammaValidation_cff::num, and particleFlowDisplacedVertex_cfi::ratio.

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

Definition at line 70 of file CommonAnalyzer.cc.

References getList().

Referenced by ComputeOOTFractionvsFill().

70 { return getList("fill"); }
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 72 of file CommonAnalyzer.cc.

References _file, _module, _path, GetRecoTauVFromDQM_MC_cff::cl, gather_cfg::cout, reco_skim_cfg_mod::fullpath, crabWrapper::key, relativeConstraints::keys, convertSQLiteXML::ok, writedatasetfile::run, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getFillList(), and getRunList().

72  {
73  std::vector<unsigned int> runlist;
74  char searchstring[100];
75  char decodestring[100];
76  sprintf(searchstring, "%s_", what);
77  sprintf(decodestring, "%s_%%u", what);
78 
80  if (_file) {
81  bool ok = _file->cd(fullpath.c_str());
82  if (ok && gDirectory) {
83  TList* keys = gDirectory->GetListOfKeys();
84  TListIter it(keys);
85  TKey* key = nullptr;
86  while ((key = (TKey*)it.Next())) {
87  std::cout << key->GetName() << std::endl;
88  TClass cl(key->GetClassName());
89  if (cl.InheritsFrom("TDirectory") && strstr(key->GetName(), searchstring) != nullptr) {
90  unsigned int run;
91  sscanf(key->GetName(), decodestring, &run);
92  runlist.push_back(run);
93  }
94  }
95  }
96  }
97  // sort(runlist);
98  return runlist;
99 }
std::string _module
std::string _path
const std::string & CommonAnalyzer::getModule ( ) const

Definition at line 38 of file CommonAnalyzer.cc.

References _module.

38 { 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 55 of file CommonAnalyzer.cc.

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

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

Definition at line 39 of file CommonAnalyzer.cc.

References _path.

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

Definition at line 40 of file CommonAnalyzer.cc.

References _prefix.

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

Definition at line 37 of file CommonAnalyzer.cc.

References _runnumber.

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

Definition at line 20 of file CommonAnalyzer.cc.

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

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

Definition at line 33 of file CommonAnalyzer.cc.

References _module, and mod().

33 { _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)
void CommonAnalyzer::setRunNumber ( const char *  run)

Definition at line 31 of file CommonAnalyzer.cc.

References _runnumber, and writedatasetfile::run.

Member Data Documentation

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

Definition at line 43 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 45 of file CommonAnalyzer.h.

Referenced by ntupleDataFormat._Object::__getattr__(), ntupleDataFormat.BeamSpot::__getattr__(), ntuplePrintersDiff._IndentPrinter::_indent(), ntupleDataFormat._SimHitMatchAdaptor::_nMatchedSimHits(), ntupleDataFormat._TrackingParticleMatchAdaptor::_nMatchedTrackingParticles(), ntuplePrintersDiff._RecHitPrinter::_printHits(), ntuplePrintersDiff.TrackingParticlePrinter::_printMatchedSeeds0(), ntuplePrintersDiff.TrackingParticlePrinter::_printMatchedSeedsHeader(), ntuplePrintersDiff.TrackingParticlePrinter::_printMatchedTracks(), ntuplePrintersDiff.TrackingParticlePrinter::_printMatchedTracksHeader(), ntuplePrintersDiff.TrackingParticlePrinter::_printTP(), ntupleDataFormat._DetIdStrAdaptor::detIdStr(), ntuplePrintersDiff.SeedPrinter::diff(), ntuplePrintersDiff.TrackPrinter::diff(), getPrefix(), ntuplePrintersDiff._IndentPrinter::indent(), ntupleDataFormat._DetIdStrAdaptor::layerStr(), ntupleDataFormat.TrackingParticle::matchedSeedInfos(), ntupleDataFormat._SimHitMatchAdaptor::matchedSimHitInfos(), ntupleDataFormat.TrackingParticle::matchedTrackInfos(), ntupleDataFormat._TrackingParticleMatchAdaptor::matchedTrackingParticleInfos(), ntupleDataFormat._HitObject::nseeds(), ntupleDataFormat._HitObject::ntracks(), operator=(), ntuplePrintersDiff.SeedPrinter::printHeader(), ntuplePrintersDiff.TrackPrinter::printHeader(), ntuplePrintersDiff.SeedPrinter::printHits(), ntuplePrintersDiff.TrackPrinter::printHits(), ntuplePrintersDiff.TrackingParticlePrinter::printHits(), ntuplePrintersDiff.SeedPrinter::printMatchedTrackingParticles(), ntuplePrintersDiff.TrackPrinter::printMatchedTrackingParticles(), ntuplePrintersDiff.TrackingParticlePrinter::printMatchedTracks(), ntuplePrintersDiff.TrackingParticlePrinter::printTrackingParticle(), ntuplePrintersDiff._IndentPrinter::restoreIndent(), ntupleDataFormat.SeedMatchInfo::seed(), ntupleDataFormat._HitObject::seeds(), ntuplePrintersDiff._IndentPrinter::setIndentFrom(), setPrefix(), ntupleDataFormat.SimHitMatchInfo::simHit(), ntupleDataFormat.SimHit::trackingParticle(), ntupleDataFormat._HitObject::tracks(), and html.PageSet::write().

std::string CommonAnalyzer::_runnumber
private

Definition at line 42 of file CommonAnalyzer.h.

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