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() [1/2]

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

◆ CommonAnalyzer() [2/2]

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

◆ getBinomialRatio()

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

Definition at line 101 of file CommonAnalyzer.cc.

References makePileupJSON::denom, getObject(), Skims_PA_cff::name, and EgammaValidation_cff::num.

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

◆ getFillList()

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

◆ getList()

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

Definition at line 72 of file CommonAnalyzer.cc.

References _file, _module, _path, haddnano::cl, gather_cfg::cout, reco_skim_cfg_mod::fullpath, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, submitPVResolutionJobs::key, relativeConstraints::keys, convertSQLiteXML::ok, writedatasetfile::run, test_db_connect::runlist, 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
key
prepare the HTCondor submission files and eventually submit them
std::string _path

◆ getModule()

const std::string & CommonAnalyzer::getModule ( ) const

Definition at line 38 of file CommonAnalyzer.cc.

References _module.

38 { return _module; }
std::string _module

◆ getObject()

TObject * CommonAnalyzer::getObject ( const char *  name) const

Definition at line 42 of file CommonAnalyzer.cc.

References _file, _module, _path, reco_skim_cfg_mod::fullpath, Skims_PA_cff::name, getGTfromDQMFile::obj, convertSQLiteXML::ok, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by AverageRunBadChannels(), AverageRunMultiplicity(), BSvsPVPlots(), ClusMultCorrPlots(), ClusMultInvestPlots(), ClusMultLumiCorrPlots(), ClusMultPlots(), ClusMultVtxCorrPlots(), Combined2DHisto(), CombinedHisto(), getBinomialRatio(), getObjectWithSuffix(), multibsvspvplots(), PlotPixelMultVtxPos(), PrimaryVertexPlots(), SeedMultiplicityComparisonPlot(), SeedMultiplicityPlots(), StatisticsPlots(), SummaryHisto(), TimeRatio(), TrackPlots(), and TrendPlotSingleBin().

42  {
43  TObject* obj = nullptr;
44 
46  if (_file) {
47  bool ok = _file->cd(fullpath.c_str());
48  if (ok && gDirectory) {
49  obj = gDirectory->Get(name);
50  }
51  }
52  return obj;
53 }
std::string _module
std::string _path

◆ getObjectWithSuffix()

TNamed * CommonAnalyzer::getObjectWithSuffix ( const char *  name,
const char *  suffix = "" 
) const

Definition at line 55 of file CommonAnalyzer.cc.

References _runnumber, getObject(), Skims_PA_cff::name, getGTfromDQMFile::obj, and ticlDumper_cff::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 }
std::string _runnumber
TObject * getObject(const char *name) const

◆ getPath()

const std::string & CommonAnalyzer::getPath ( ) const

Definition at line 39 of file CommonAnalyzer.cc.

References _path.

39 { return _path; }
std::string _path

◆ getPrefix()

const std::string & CommonAnalyzer::getPrefix ( ) const

Definition at line 40 of file CommonAnalyzer.cc.

References _prefix.

40 { return _prefix; }
std::string _prefix

◆ getRunList()

const std::vector< unsigned int > CommonAnalyzer::getRunList ( ) const

◆ getRunNumber()

const std::string & CommonAnalyzer::getRunNumber ( ) const

Definition at line 37 of file CommonAnalyzer.cc.

References _runnumber.

37 { return _runnumber; }
std::string _runnumber

◆ operator=()

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

◆ setFile()

void CommonAnalyzer::setFile ( TFile *  file)

Definition at line 32 of file CommonAnalyzer.cc.

References _file, and geometryDiff::file.

32 { _file = file; }

◆ setModule()

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

◆ setPath()

void CommonAnalyzer::setPath ( const char *  path)

◆ setPrefix()

void CommonAnalyzer::setPrefix ( const char *  prefix)

◆ setRunNumber()

void CommonAnalyzer::setRunNumber ( const char *  run)

Definition at line 31 of file CommonAnalyzer.cc.

References _runnumber, and writedatasetfile::run.

Member Data Documentation

◆ _file

TFile* CommonAnalyzer::_file
private

◆ _module

std::string CommonAnalyzer::_module
private

Definition at line 43 of file CommonAnalyzer.h.

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

◆ _path

std::string CommonAnalyzer::_path
private

◆ _prefix

std::string CommonAnalyzer::_prefix
private

Definition at line 45 of file CommonAnalyzer.h.

Referenced by ntupleDataFormat._Object::__getattr__(), datamodel.Object::__getattr__(), ntupleDataFormat.BeamSpot::__getattr__(), datamodel.Collection::__getitem__(), datamodel.Object::__repr__(), 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(), datamodel.Object::subObj(), ntupleDataFormat.SimHit::trackingParticle(), ntupleDataFormat._HitObject::tracks(), and html.PageSet::write().

◆ _runnumber

std::string CommonAnalyzer::_runnumber
private

Definition at line 42 of file CommonAnalyzer.h.

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