CMS 3D CMS Logo

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

#include <CalibrationHistograms.h>

Inheritance diagram for CalibrationHistograms:
CommissioningHistograms CalibrationHistosUsingDb

Public Member Functions

 CalibrationHistograms (const edm::ParameterSet &pset, DQMStore *, const sistrip::RunType &task=sistrip::CALIBRATION)
 
void histoAnalysis (bool debug) override
 
void printAnalyses () override
 
void save (std::string &filename, uint32_t run_number=0, std::string partitionName="")
 
 ~CalibrationHistograms () override
 
- Public Member Functions inherited from CommissioningHistograms
 CommissioningHistograms ()
 
 CommissioningHistograms (const edm::ParameterSet &pset, DQMStore *const, const sistrip::RunType &)
 
virtual void configure (const edm::ParameterSet &, const edm::EventSetup &)
 
void createCollations (const std::vector< std::string > &)
 
virtual void createSummaryHisto (const sistrip::Monitorable &, const sistrip::Presentation &, const std::string &top_level_dir, const sistrip::Granularity &)
 
void extractHistograms (const std::vector< std::string > &)
 
virtual void printSummary ()
 
void remove (std::string pattern="")
 
void save (std::string &filename, uint32_t run_number=0, std::string partitionName="")
 
virtual ~CommissioningHistograms ()
 

Private Attributes

float targetDecayTime_
 
float targetRiseTime_
 
bool tuneSimultaneously_
 

Additional Inherited Members

- Public Types inherited from CommissioningHistograms
typedef std::map< uint32_t, CommissioningAnalysis * > Analyses
 
typedef Analyses::iterator Analysis
 
typedef dqm::harvesting::DQMStore DQMStore
 
typedef SummaryPlotFactory< CommissioningAnalysis * > Factory
 
typedef std::map< uint32_t, uint32_t > FedToFecMap
 
typedef std::vector< Histo * > Histos
 
typedef std::map< uint32_t, HistosHistosMap
 
typedef dqm::harvesting::MonitorElement MonitorElement
 
- Static Public Member Functions inherited from CommissioningHistograms
static void copyCustomInformation (DQMStore *const, const std::vector< std::string > &)
 
static uint32_t runNumber (DQMStore *const, const std::vector< std::string > &)
 
static sistrip::RunType runType (DQMStore *const, const std::vector< std::string > &)
 
- Protected Member Functions inherited from CommissioningHistograms
DQMStore *const bei () const
 
void clearHistosMap ()
 
Analysesdata (bool getMaskedData=false)
 
Factory *const factory ()
 
TH1 * histogram (const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory, const uint32_t &xbins, const float &xlow=1. *sistrip::invalid_, const float &xhigh=1. *sistrip::invalid_)
 
const HistosMaphistos () const
 
const FedToFecMapmapping () const
 
void printHistosMap ()
 
const edm::ParameterSetpset () const
 
const sistrip::RunTypetask () const
 
- Protected Attributes inherited from CommissioningHistograms
std::unique_ptr< Factoryfactory_
 

Detailed Description

Definition at line 7 of file CalibrationHistograms.h.

Constructor & Destructor Documentation

◆ CalibrationHistograms()

CalibrationHistograms::CalibrationHistograms ( const edm::ParameterSet pset,
DQMStore bei,
const sistrip::RunType task = sistrip::CALIBRATION 
)

Definition at line 26 of file CalibrationHistograms.cc.

27  : CommissioningHistograms(pset.getParameter<edm::ParameterSet>("CalibrationParameters"), bei, task) {
28  LogTrace(mlDqmClient_) << "[CalibrationHistograms::" << __func__ << "]"
29  << " Constructing object...";
30 
32  factory_ = auto_ptr<CalibrationScanSummaryFactory>(new CalibrationScanSummaryFactory);
33  else
34  factory_ = auto_ptr<CalibrationSummaryFactory>(new CalibrationSummaryFactory);
35 
37  this->pset().existsAs<double>("targetRiseTime") ? this->pset().getParameter<double>("targetRiseTime") : 50;
39  this->pset().existsAs<double>("targetDecayTime") ? this->pset().getParameter<double>("targetDecayTime") : 125;
41  this->pset().existsAs<bool>("tuneSimultaneously") ? this->pset().getParameter<bool>("tuneSimultaneously") : false;
42 }

References sistrip::CALIBRATION_SCAN, sistrip::CALIBRATION_SCAN_DECO, edm::ParameterSet::existsAs(), CommissioningHistograms::factory_, edm::ParameterSet::getParameter(), LogTrace, sistrip::mlDqmClient_, or, CommissioningHistograms::pset(), targetDecayTime_, targetRiseTime_, CommissioningHistograms::task(), and tuneSimultaneously_.

◆ ~CalibrationHistograms()

CalibrationHistograms::~CalibrationHistograms ( )
override

Definition at line 46 of file CalibrationHistograms.cc.

46  {
47  LogTrace(mlDqmClient_) << "[CalibrationHistograms::" << __func__ << "]"
48  << " Deleting object...";
49 }

References LogTrace, and sistrip::mlDqmClient_.

Member Function Documentation

◆ histoAnalysis()

void CalibrationHistograms::histoAnalysis ( bool  debug)
overridevirtual

Reimplemented from CommissioningHistograms.

Definition at line 53 of file CalibrationHistograms.cc.

53  {
54  // Clear map holding analysis objects
55  Analyses::iterator ianal;
56  for (ianal = data().begin(); ianal != data().end(); ianal++) {
57  if (ianal->second) {
58  delete ianal->second;
59  }
60  }
61  data().clear();
62 
63  // Iterate through map containing vectors of profile histograms
64  HistosMap::const_iterator iter = histos().begin();
65 
66  // One entry for each LLD channel --> differnt thousand entries
67  for (; iter != histos().end(); iter++) {
68  if (iter->second.empty()) {
69  edm::LogWarning(mlDqmClient_) << "[CalibrationHistograms::" << __func__ << "]"
70  << " Zero collation histograms found!";
71  continue;
72  }
73 
74  // Retrieve pointers to 1D histos for this FED channel --> all strips in the fiber = 256
75  vector<TH1*> profs;
76  Histos::const_iterator ihis = iter->second.begin();
77  for (; ihis != iter->second.end(); ihis++) {
78  TH1F* prof = ExtractTObject<TH1F>().extract((*ihis)->me_);
79  if (prof) {
80  profs.push_back(prof);
81  }
82  }
83 
84  // Perform histo analysis
85  bool isdeconv = false;
87  isdeconv = true;
88 
90  CalibrationScanAnalysis* anal = new CalibrationScanAnalysis(iter->first, isdeconv);
91  CalibrationScanAlgorithm algo(this->pset(), anal);
92  algo.analysis(profs);
93  data()[iter->first] = anal;
94 
95  // tune the parameters for this a given target
96  for (int iapv = 0; iapv < 2; iapv++) {
98  algo.tuneSimultaneously(iapv, targetRiseTime_, targetDecayTime_);
99  else
100  algo.tuneIndependently(iapv, targetRiseTime_, targetDecayTime_);
101  algo.fillTunedObservables(iapv);
102  }
103  } else {
104  CalibrationAnalysis* anal = new CalibrationAnalysis(iter->first, isdeconv);
105  CalibrationAlgorithm algo(this->pset(), anal);
106  algo.analysis(profs);
107  data()[iter->first] = anal;
108  }
109  }
110 }

References conversion_template_cfg::anal, begin, sistrip::CALIBRATION_DECO, sistrip::CALIBRATION_SCAN, sistrip::CALIBRATION_SCAN_DECO, CommissioningHistograms::data(), ExtractTObject< T >::extract(), CommissioningHistograms::histos(), sistrip::mlDqmClient_, or, CommissioningHistograms::pset(), targetDecayTime_, targetRiseTime_, CommissioningHistograms::task(), and tuneSimultaneously_.

◆ printAnalyses()

void CalibrationHistograms::printAnalyses ( )
overridevirtual

Reimplemented from CommissioningHistograms.

Definition at line 114 of file CalibrationHistograms.cc.

114  {
115  Analyses::iterator ianal = data().begin();
116  Analyses::iterator janal = data().end();
117  for (; ianal != janal; ++ianal) {
118  if (ianal->second) {
119  std::stringstream ss;
120  ianal->second->print(ss, 0);
121  ianal->second->print(ss, 1);
122  if (ianal->second->isValid()) {
123  LogTrace(mlDqmClient_) << ss.str();
124  } else {
125  edm::LogWarning(mlDqmClient_) << ss.str();
126  }
127  }
128  }
129 }

References CommissioningHistograms::data(), LogTrace, sistrip::mlDqmClient_, and contentValuesCheck::ss.

◆ save()

void CalibrationHistograms::save ( std::string &  filename,
uint32_t  run_number = 0,
std::string  partitionName = "" 
)

Definition at line 133 of file CalibrationHistograms.cc.

133  {
134  // Construct path and filename
135  std::stringstream ss;
136  if (!path.empty()) { // create with a specific outputName
137  ss << path;
138  if (ss.str().find(".root") == std::string::npos) {
139  ss << ".root";
140  }
141 
142  } else {
143  // Retrieve SCRATCH directory
144  std::string scratch = "SCRATCH";
145  std::string dir = "";
146  if (std::getenv(scratch.c_str()) != nullptr) {
147  dir = std::getenv(scratch.c_str());
148  }
149 
150  // Add directory path
151  if (!dir.empty()) {
152  ss << dir << "/";
153  } else {
154  ss << "/tmp/";
155  }
156 
157  // Add filename with run number and ".root" extension
158  if (partitionName.empty())
159  ss << sistrip::dqmClientFileName_ << "_" << std::setfill('0') << std::setw(8) << run_number << ".root";
160  else
161  ss << sistrip::dqmClientFileName_ << "_" << partitionName << "_" << std::setfill('0') << std::setw(8)
162  << run_number << ".root";
163  }
164 
165  // Save file with appropriate filename
166  LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
167  << " Saving histograms to root file"
168  << " (This may take some time!)";
169  path = ss.str();
171  edm::LogVerbatim(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"
172  << " Saved histograms to root file \"" << ss.str() << "\"!";
173 
174  // In case of calibration-scan, add also the TGraphs
175  // re-open the file
176  TFile* outputFile = TFile::Open(path.c_str(), "UPDATE");
177  outputFile->cd();
178 
179  auto contents = bei()->getAllContents("");
180 
181  TMultiGraph* graph_isha = new TMultiGraph("riseTime_vs_isha", "");
182  TMultiGraph* graph_vfs = new TMultiGraph("decayTime_vs_vfs", "");
183 
184  bool save_graph_isha = false;
185  bool save_graph_vfs = false;
186 
187  // loop on the analysis objects which are storing all relevant results
188  Analyses::iterator ianal = data().begin();
189  Analyses::iterator janal = data().end();
190  for (; ianal != janal; ++ianal) {
191  if (ianal->second) {
192  CalibrationScanAnalysis* anal = dynamic_cast<CalibrationScanAnalysis*>(ianal->second);
193  SiStripFecKey feckey = anal->fecKey();
194 
195  TString directory;
196  for (auto me : contents) {
197  directory = me->getPathname();
198  if (directory.Contains(Form("FecCrate%d", feckey.fecCrate())) and
199  directory.Contains(Form("FecRing%d", feckey.fecRing())) and
200  directory.Contains(Form("FecSlot%d", feckey.fecSlot())) and
201  directory.Contains(Form("CcuAddr%d", feckey.ccuAddr())) and
202  directory.Contains(Form("CcuChan%d", feckey.ccuChan())))
203  break;
204  }
205 
206  outputFile->cd("DQMData/" + directory);
207 
208  for (size_t igraph = 0; igraph < anal->decayTimeVsVFS().size(); igraph++) {
209  graph_vfs->Add(anal->decayTimeVsVFS()[igraph]);
210  anal->decayTimeVsVFS()[igraph]->Write();
211  save_graph_vfs = true;
212  }
213 
214  for (size_t igraph = 0; igraph < anal->riseTimeVsISHA().size(); igraph++) {
215  graph_isha->Add(anal->riseTimeVsISHA()[igraph]);
216  anal->riseTimeVsISHA()[igraph]->Write();
217  save_graph_isha = true;
218  }
219 
220  for (size_t igraph = 0; igraph < anal->riseTimeVsISHAVsVFS().size(); igraph++)
221  anal->riseTimeVsISHAVsVFS()[igraph]->Write();
222 
223  for (size_t igraph = 0; igraph < anal->decayTimeVsISHAVsVFS().size(); igraph++)
224  anal->decayTimeVsISHAVsVFS()[igraph]->Write();
225 
226  outputFile->cd();
227  }
228  }
229 
230  outputFile->cd();
231  outputFile->cd("DQMData/Collate/SiStrip/ControlView");
232 
233  if (save_graph_isha)
234  graph_isha->Write("riseTime_vs_isha");
235  if (save_graph_vfs)
236  graph_vfs->Write("decayTime_vs_vfs");
237 
238  outputFile->Close();
239 }

References conversion_template_cfg::anal, CommissioningHistograms::bei(), SiStripFecKey::ccuAddr(), SiStripFecKey::ccuChan(), sistrip::collate_, relmon_rootfiles_spy::contents, CommissioningHistograms::data(), DeadROC_duringRun::dir, createBeamHaloJobs::directory, sistrip::dqmClientFileName_, SiStripFecKey::fecCrate(), SiStripFecKey::fecRing(), SiStripFecKey::fecSlot(), dqm::implementation::IGetter::getAllContents(), LogTrace, hlt_dqm_clientPB-live_cfg::me, sistrip::mlDqmClient_, download_sqlite_cfg::outputFile, FrameHeaderEvents_cfi::partitionName, castor_dqm_sourceclient_file_cfg::path, contentValuesCheck::run_number, dqm::implementation::DQMStore::save(), contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

Member Data Documentation

◆ targetDecayTime_

float CalibrationHistograms::targetDecayTime_
private

Definition at line 21 of file CalibrationHistograms.h.

Referenced by CalibrationHistograms(), and histoAnalysis().

◆ targetRiseTime_

float CalibrationHistograms::targetRiseTime_
private

Definition at line 20 of file CalibrationHistograms.h.

Referenced by CalibrationHistograms(), and histoAnalysis().

◆ tuneSimultaneously_

bool CalibrationHistograms::tuneSimultaneously_
private

Definition at line 22 of file CalibrationHistograms.h.

Referenced by CalibrationHistograms(), and histoAnalysis().

sistrip::CALIBRATION_SCAN
Definition: ConstantsForRunType.h:87
CommissioningHistograms::task
const sistrip::RunType & task() const
Definition: CommissioningHistograms.h:158
CalibrationHistograms::targetRiseTime_
float targetRiseTime_
Definition: CalibrationHistograms.h:20
CommissioningHistograms::pset
const edm::ParameterSet & pset() const
Definition: CommissioningHistograms.h:163
CommissioningHistograms::bei
DQMStore *const bei() const
Definition: CommissioningHistograms.h:159
CalibrationScanSummaryFactory
Definition: CalibrationScanSummaryFactory.h:6
CalibrationScanAnalysis
Analysis for calibration scans.
Definition: CalibrationScanAnalysis.h:19
contentValuesCheck.run_number
run_number
Definition: contentValuesCheck.py:38
SiStripFecKey::fecCrate
const uint16_t & fecCrate() const
Definition: SiStripFecKey.h:198
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
sistrip::dqmClientFileName_
static const char dqmClientFileName_[]
Definition: ConstantsForDqm.h:26
dqm::implementation::IGetter::getAllContents
virtual std::vector< dqm::harvesting::MonitorElement * > getAllContents(std::string const &path) const
Definition: DQMStore.cc:609
CommissioningHistograms::data
Analyses & data(bool getMaskedData=false)
Definition: CommissioningHistograms.cc:718
ExtractTObject
Definition: ExtractTObject.h:9
sistrip::mlDqmClient_
static const char mlDqmClient_[]
Definition: ConstantsForLogger.h:19
CommissioningHistograms::CommissioningHistograms
CommissioningHistograms()
Definition: CommissioningHistograms.cc:60
relmon_rootfiles_spy.contents
contents
Definition: relmon_rootfiles_spy.py:129
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
cmsdt::algo
algo
Definition: constants.h:164
download_sqlite_cfg.outputFile
outputFile
Definition: download_sqlite_cfg.py:5
CalibrationScanAlgorithm
Algorithm for calibration runs.
Definition: CalibrationScanAlgorithm.h:20
SiStripFecKey::fecRing
const uint16_t & fecRing() const
Definition: SiStripFecKey.h:200
CommissioningHistograms::factory_
std::unique_ptr< Factory > factory_
Definition: CommissioningHistograms.h:129
dqm::implementation::DQMStore::save
DQM_DEPRECATED void save(std::string const &filename, std::string const &path="")
Definition: DQMStore.cc:760
SiStripFecKey
Utility class that identifies a position within the strip tracker control structure,...
Definition: SiStripFecKey.h:45
CalibrationSummaryFactory
Definition: CalibrationSummaryFactory.h:6
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripFecKey::ccuChan
const uint16_t & ccuChan() const
Definition: SiStripFecKey.h:202
edm::LogWarning
Definition: MessageLogger.h:141
edm::ParameterSet
Definition: ParameterSet.h:36
sistrip::CALIBRATION_DECO
Definition: ConstantsForRunType.h:93
FrameHeaderEvents_cfi.partitionName
partitionName
Definition: FrameHeaderEvents_cfi.py:5
CalibrationAlgorithm
Algorithm for calibration runs.
Definition: CalibrationAlgorithm.h:19
edm::LogVerbatim
Definition: MessageLogger.h:297
ExtractTObject::extract
static T * extract(MonitorElement *me)
Definition: ExtractTObject.cc:21
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
sistrip::CALIBRATION_SCAN_DECO
Definition: ConstantsForRunType.h:88
CalibrationHistograms::tuneSimultaneously_
bool tuneSimultaneously_
Definition: CalibrationHistograms.h:22
sistrip::collate_
static const char collate_[]
Definition: ConstantsForDqm.h:29
SiStripFecKey::ccuAddr
const uint16_t & ccuAddr() const
Definition: SiStripFecKey.h:201
createBeamHaloJobs.directory
string directory
Definition: createBeamHaloJobs.py:211
CommissioningHistograms::histos
const HistosMap & histos() const
Definition: CommissioningHistograms.h:161
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
CalibrationHistograms::targetDecayTime_
float targetDecayTime_
Definition: CalibrationHistograms.h:21
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
conversion_template_cfg.anal
anal
Definition: conversion_template_cfg.py:16
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
SiStripFecKey::fecSlot
const uint16_t & fecSlot() const
Definition: SiStripFecKey.h:199
CalibrationAnalysis
Analysis for calibration runs.
Definition: CalibrationAnalysis.h:16
begin
#define begin
Definition: vmac.h:32
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23