CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
RunHistogramManager Class Reference

#include <RunHistogramManager.h>

Public Member Functions

void beginRun (const edm::Run &iRun)
 
void beginRun (const edm::Run &iRun, TFileDirectory &subdir)
 
void beginRun (const unsigned int irun)
 
void beginRun (const unsigned int irun, TFileDirectory &subdir)
 
TH1F ** makeTH1F (const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
 
TH2F ** makeTH2F (const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax, const unsigned int nbiny, const double ymin, const double ymax)
 
TProfile ** makeTProfile (const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
 
TProfile2D ** makeTProfile2D (const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax, const unsigned int nbiny, const double ymin, const double ymax)
 
 RunHistogramManager (edm::ConsumesCollector &&iC, const bool fillHistograms=false)
 
 RunHistogramManager (edm::ConsumesCollector &iC, const bool fillHistograms=false)
 
 ~RunHistogramManager ()
 

Private Attributes

edm::EDGetTokenT< edm::ConditionsInRunBlock_conditionsInRunToken
 
bool _fillHistograms
 
std::vector< BaseHistoParams * > _histograms
 

Detailed Description

Definition at line 210 of file RunHistogramManager.h.

Constructor & Destructor Documentation

◆ RunHistogramManager() [1/2]

RunHistogramManager::RunHistogramManager ( edm::ConsumesCollector &&  iC,
const bool  fillHistograms = false 
)

◆ RunHistogramManager() [2/2]

RunHistogramManager::RunHistogramManager ( edm::ConsumesCollector iC,
const bool  fillHistograms = false 
)

◆ ~RunHistogramManager()

RunHistogramManager::~RunHistogramManager ( )

Definition at line 45 of file RunHistogramManager.cc.

45  {
46  for (std::vector<BaseHistoParams*>::const_iterator hp = _histograms.begin(); hp != _histograms.end(); ++hp) {
47  delete *hp;
48  }
49  LogDebug("Destructor") << "All BaseHistoParams destroyed ";
50 }

References _histograms, trackingPlots::hp, and LogDebug.

Member Function Documentation

◆ beginRun() [1/4]

void RunHistogramManager::beginRun ( const edm::Run iRun)

◆ beginRun() [2/4]

void RunHistogramManager::beginRun ( const edm::Run iRun,
TFileDirectory subdir 
)

Definition at line 106 of file RunHistogramManager.cc.

106  {
107  if (!_fillHistograms) {
108  beginRun(iRun.run(), subdir);
109  } else {
110  unsigned int fillnum = 0;
111 
113  iRun.getByToken(_conditionsInRunToken, cirb);
114 
115  if (!cirb.failedToGet() && cirb.isValid())
116  fillnum = cirb->lhcFillNumber;
117 
118  beginRun(fillnum, subdir);
119  }
120 }

References _conditionsInRunToken, _fillHistograms, beginRun(), edm::HandleBase::failedToGet(), edm::Run::getByToken(), edm::HandleBase::isValid(), edm::ConditionsInRunBlock::lhcFillNumber, and edm::RunBase::run().

◆ beginRun() [3/4]

void RunHistogramManager::beginRun ( const unsigned int  irun)

Definition at line 122 of file RunHistogramManager.cc.

122  {
124  beginRun(irun, tfserv->tFileDirectory());
125 }

References beginRun(), and TFileService::tFileDirectory().

◆ beginRun() [4/4]

void RunHistogramManager::beginRun ( const unsigned int  irun,
TFileDirectory subdir 
)

Definition at line 127 of file RunHistogramManager.cc.

127  {
128  // create/go to the run subdirectory
129 
130  char fillrun[30];
131 
132  if (!_fillHistograms) {
133  sprintf(fillrun, "%s", "run");
134  } else {
135  sprintf(fillrun, "%s", "fill");
136  }
137 
138  char dirname[300];
139  sprintf(dirname, "%s_%d", fillrun, irun);
140  TFileDirectory subrun = subdir.mkdir(dirname);
141 
142  // loop on the histograms and update the pointer references
143 
144  for (unsigned int ih = 0; ih < _histograms.size(); ++ih) {
145  _histograms[ih]->beginRun(irun, subrun, fillrun);
146  }
147 }

References _fillHistograms, _histograms, BTVHLTOfflineSource_cfi::dirname, and TFileDirectory::mkdir().

◆ makeTH1F()

TH1F ** RunHistogramManager::makeTH1F ( const char *  name,
const char *  title,
const unsigned int  nbinx,
const double  xmin,
const double  xmax 
)

◆ makeTH2F()

TH2F ** RunHistogramManager::makeTH2F ( const char *  name,
const char *  title,
const unsigned int  nbinx,
const double  xmin,
const double  xmax,
const unsigned int  nbiny,
const double  ymin,
const double  ymax 
)

◆ makeTProfile()

TProfile ** RunHistogramManager::makeTProfile ( const char *  name,
const char *  title,
const unsigned int  nbinx,
const double  xmin,
const double  xmax 
)

◆ makeTProfile2D()

TProfile2D ** RunHistogramManager::makeTProfile2D ( const char *  name,
const char *  title,
const unsigned int  nbinx,
const double  xmin,
const double  xmax,
const unsigned int  nbiny,
const double  ymin,
const double  ymax 
)

Definition at line 82 of file RunHistogramManager.cc.

89  {
90  TProfile2D** pointer = new TProfile2D*(nullptr);
91 
93  new HistoParams<TProfile2D>(pointer, "TProfile2D", name, title, nbinx, xmin, xmax, nbiny, ymin, ymax);
94  _histograms.push_back(hp);
95 
96  LogDebug("TProfile2Dmade") << "Histogram " << name << " " << title << " pre-booked :" << _histograms.size();
97 
98  return pointer;
99 }

References _histograms, trackingPlots::hp, LogDebug, Skims_PA_cff::name, runGCPTkAlMap::title, TrackerOfflineValidation_Dqm_cff::xmax, TrackerOfflineValidation_Dqm_cff::xmin, L1TOccupancyClient_cfi::ymax, and L1TOccupancyClient_cfi::ymin.

Referenced by VertexHistogramMaker::book(), and MultiplicityCorrelatorHistogramMaker::MultiplicityCorrelatorHistogramMaker().

Member Data Documentation

◆ _conditionsInRunToken

edm::EDGetTokenT<edm::ConditionsInRunBlock> RunHistogramManager::_conditionsInRunToken
private

Definition at line 244 of file RunHistogramManager.h.

Referenced by beginRun().

◆ _fillHistograms

bool RunHistogramManager::_fillHistograms
private

Definition at line 242 of file RunHistogramManager.h.

Referenced by beginRun().

◆ _histograms

std::vector<BaseHistoParams*> RunHistogramManager::_histograms
private
HistoParams
Definition: RunHistogramManager.h:28
TFileDirectory::mkdir
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileDirectory.cc:112
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
HistoParams< TH2F >
Definition: RunHistogramManager.h:89
RPCNoise_cfi.fillHistograms
fillHistograms
Definition: RPCNoise_cfi.py:8
TFileService::tFileDirectory
TFileDirectory & tFileDirectory()
Definition: TFileService.h:42
TFileDirectory
Definition: TFileDirectory.h:24
edm::Handle
Definition: AssociativeIterator.h:50
edm::RunBase::run
RunNumber_t run() const
Definition: RunBase.h:40
RunHistogramManager::_histograms
std::vector< BaseHistoParams * > _histograms
Definition: RunHistogramManager.h:243
edm::InRun
Definition: BranchType.h:11
edm::ConditionsInRunBlock::lhcFillNumber
uint32_t lhcFillNumber
Definition: ConditionsInEdm.h:24
BTVHLTOfflineSource_cfi.dirname
dirname
Definition: BTVHLTOfflineSource_cfi.py:7
trackingPlots.hp
hp
Definition: trackingPlots.py:1231
RunHistogramManager::_conditionsInRunToken
edm::EDGetTokenT< edm::ConditionsInRunBlock > _conditionsInRunToken
Definition: RunHistogramManager.h:244
edm::Run::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Run.h:318
L1TOccupancyClient_cfi.ymax
ymax
Definition: L1TOccupancyClient_cfi.py:43
BaseHistoParams
Definition: RunHistogramManager.h:18
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
edm::ConditionsInRunBlock
Definition: ConditionsInEdm.h:18
edm::HandleBase::failedToGet
bool failedToGet() const
Definition: HandleBase.h:72
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
RunHistogramManager::beginRun
void beginRun(const edm::Run &iRun)
Definition: RunHistogramManager.cc:101
edm::Service< TFileService >
L1TOccupancyClient_cfi.ymin
ymin
Definition: L1TOccupancyClient_cfi.py:43
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
RunHistogramManager::_fillHistograms
bool _fillHistograms
Definition: RunHistogramManager.h:242
HistoParams< TProfile2D >
Definition: RunHistogramManager.h:150
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15