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 (const edm::ParameterSet &pset, DQMStore *const, const sistrip::RunType &)
 
 CommissioningHistograms ()
 
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 SummaryPlotFactory< CommissioningAnalysis * > Factory
 
typedef std::map< uint32_t, uint32_t > FedToFecMap
 
typedef std::vector< Histo * > Histos
 
typedef std::map< uint32_t, HistosHistosMap
 
- 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 9 of file CalibrationHistograms.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file CalibrationHistograms.cc.

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

29  : CommissioningHistograms(pset.getParameter<edm::ParameterSet>("CalibrationParameters"),bei,task){
30 
32  << "[CalibrationHistograms::" << __func__ << "]"
33  << " Constructing object...";
34 
36  factory_ = auto_ptr<CalibrationScanSummaryFactory>( new CalibrationScanSummaryFactory );
37  else
38  factory_ = auto_ptr<CalibrationSummaryFactory>( new CalibrationSummaryFactory );
39 
40  targetRiseTime_ = this->pset().existsAs<double>("targetRiseTime") ? this->pset().getParameter<double>("targetRiseTime") : 50;
41  targetDecayTime_ = this->pset().existsAs<double>("targetDecayTime") ? this->pset().getParameter<double>("targetDecayTime") : 125;
42  tuneSimultaneously_ = this->pset().existsAs<bool>("tuneSimultaneously") ? this->pset().getParameter<bool>("tuneSimultaneously") : false;
43 }
T getParameter(std::string const &) const
const sistrip::RunType & task() const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:161
const edm::ParameterSet & pset() const
static const char mlDqmClient_[]
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
#define LogTrace(id)
std::unique_ptr< Factory > factory_
DQMStore *const bei() const
CalibrationHistograms::~CalibrationHistograms ( )
override

Definition at line 47 of file CalibrationHistograms.cc.

References LogTrace, and sistrip::mlDqmClient_.

47  {
49  << "[CalibrationHistograms::" << __func__ << "]"
50  << " Deleting object...";
51 }
static const char mlDqmClient_[]
#define LogTrace(id)

Member Function Documentation

void CalibrationHistograms::histoAnalysis ( bool  debug)
overridevirtual

Reimplemented from CommissioningHistograms.

Definition at line 55 of file CalibrationHistograms.cc.

References patPFMETCorrections_cff::algo, CommissioningAlgorithm::analysis(), begin, sistrip::CALIBRATION_DECO, sistrip::CALIBRATION_SCAN, sistrip::CALIBRATION_SCAN_DECO, CommissioningHistograms::data(), extract(), CalibrationScanAlgorithm::fillTunedObservables(), CommissioningHistograms::histos(), sistrip::mlDqmClient_, or, CommissioningHistograms::pset(), targetDecayTime_, targetRiseTime_, CommissioningHistograms::task(), CalibrationScanAlgorithm::tuneIndependently(), CalibrationScanAlgorithm::tuneSimultaneously(), and tuneSimultaneously_.

55  {
56 
57  // Clear map holding analysis objects
58  Analyses::iterator ianal;
59  for ( ianal = data().begin(); ianal != data().end(); ianal++ ) {
60  if ( ianal->second ) { delete ianal->second; }
61  }
62  data().clear();
63 
64  // Iterate through map containing vectors of profile histograms
65  HistosMap::const_iterator iter = histos().begin();
66 
67  // One entry for each LLD channel --> differnt thousand entries
68  for ( ; iter != histos().end(); iter++ ) {
69  if ( iter->second.empty() ) {
71  << "[CalibrationHistograms::" << __func__ << "]"
72  << " Zero collation histograms found!";
73  continue;
74  }
75 
76  // Retrieve pointers to 1D histos for this FED channel --> all strips in the fiber = 256
77  vector<TH1*> profs;
78  Histos::const_iterator ihis = iter->second.begin();
79  for ( ; ihis != iter->second.end(); ihis++ ) {
80  TH1F* prof = ExtractTObject<TH1F>().extract( (*ihis)->me_ );
81  if ( prof ) { profs.push_back(prof); }
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  }
104  else{
105  CalibrationAnalysis* anal = new CalibrationAnalysis( iter->first,isdeconv);
106  CalibrationAlgorithm algo( this->pset(), anal );
107  algo.analysis( profs );
108  data()[iter->first] = anal;
109  }
110  }
111 }
const sistrip::RunType & task() const
Analyses & data(bool getMaskedData=false)
const edm::ParameterSet & pset() const
Algorithm for calibration runs.
static const char mlDqmClient_[]
Analysis for calibration runs.
Analysis for calibration scans.
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
Algorithm for calibration runs.
int extract(std::vector< int > *output, const std::string &dati)
#define begin
Definition: vmac.h:32
const HistosMap & histos() const
void CalibrationHistograms::printAnalyses ( )
overridevirtual

Reimplemented from CommissioningHistograms.

Definition at line 115 of file CalibrationHistograms.cc.

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

115  {
116  Analyses::iterator ianal = data().begin();
117  Analyses::iterator janal = data().end();
118  for ( ; ianal != janal; ++ianal ) {
119  if ( ianal->second ) {
120  std::stringstream ss;
121  ianal->second->print( ss,0 );
122  ianal->second->print( ss,1 );
123  if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str();
124  } else { edm::LogWarning(mlDqmClient_) << ss.str(); }
125  }
126  }
127 }
Analyses & data(bool getMaskedData=false)
static const char mlDqmClient_[]
#define LogTrace(id)
void CalibrationHistograms::save ( std::string &  filename,
uint32_t  run_number = 0,
std::string  partitionName = "" 
)

Definition at line 132 of file CalibrationHistograms.cc.

References CommissioningHistograms::bei(), SiStripFecKey::ccuAddr(), SiStripFecKey::ccuChan(), sistrip::collate_, ws_sso_content_reader::content, relmon_rootfiles_spy::contents, CommissioningHistograms::data(), CalibrationScanAnalysis::decayTimeVsISHAVsVFS(), CalibrationScanAnalysis::decayTimeVsVFS(), dir, createBeamHaloJobs::directory, sistrip::dqmClientFileName_, SiStripFecKey::fecCrate(), CommissioningAnalysis::fecKey(), SiStripFecKey::fecRing(), SiStripFecKey::fecSlot(), LogTrace, sistrip::mlDqmClient_, download_sqlite_cfg::outputFile, callgraph::path, CalibrationScanAnalysis::riseTimeVsISHA(), CalibrationScanAnalysis::riseTimeVsISHAVsVFS(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by Vispa.Main.TabController.TabController::allowClose(), SiStripCommissioningOfflineClient::beginRun(), and Vispa.Main.TabController.TabController::checkModificationTimestamp().

134  {
135 
136  // Construct path and filename
137  std::stringstream ss;
138  if ( !path.empty() ) { // create with a specific outputName
139  ss << path;
140  if ( ss.str().find(".root") == std::string::npos ) { ss << ".root"; }
141 
142  } else {
143 
144  // Retrieve SCRATCH directory
145  std::string scratch = "SCRATCH";
146  std::string dir = "";
147  if ( getenv(scratch.c_str()) != nullptr ) {
148  dir = getenv(scratch.c_str());
149  }
150 
151  // Add directory path
152  if ( !dir.empty() ) { ss << dir << "/"; }
153  else { ss << "/tmp/"; }
154 
155  // Add filename with run number and ".root" extension
156  if(partitionName.empty())
157  ss << sistrip::dqmClientFileName_ << "_"
158  << std::setfill('0') << std::setw(8) << run_number
159  << ".root";
160  else
161  ss << sistrip::dqmClientFileName_ << "_" << partitionName << "_"
162  << std::setfill('0') << std::setw(8) << run_number
163  << ".root";
164  }
165 
166  // Save file with appropriate filename
168  << "[CommissioningHistograms::" << __func__ << "]"
169  << " Saving histograms to root file"
170  << " (This may take some time!)";
171  path = ss.str();
172  bei()->save( path, sistrip::collate_ );
174  << "[CommissioningHistograms::" << __func__ << "]"
175  << " Saved histograms to root file \""
176  << ss.str() << "\"!";
177 
178  // In case of calibration-scan, add also the TGraphs
179  // re-open the file
180  TFile* outputFile = TFile::Open(path.c_str(),"UPDATE");
181  outputFile->cd();
182 
183  // get all sub-dirs
184  std::vector<std::string> contents;
185  bei()->getContents( contents );
186 
187  TMultiGraph* graph_isha = new TMultiGraph("riseTime_vs_isha","");
188  TMultiGraph* graph_vfs = new TMultiGraph("decayTime_vs_vfs","");
189 
190  bool save_graph_isha = false;
191  bool save_graph_vfs = false;
192 
193  // loop on the analysis objects which are storing all relevant results
194  Analyses::iterator ianal = data().begin();
195  Analyses::iterator janal = data().end();
196  for ( ; ianal != janal; ++ianal ) {
197  if ( ianal->second ) {
198 
199  CalibrationScanAnalysis* anal = dynamic_cast<CalibrationScanAnalysis*> (ianal->second);
200  SiStripFecKey feckey = anal->fecKey();
201 
202  TString directory;
203  for(auto content : contents){
204  std::vector<std::string> tokens;
205  std::string token;
206  std::istringstream tokenStream(content);
207  while (std::getline(tokenStream, token,':')){
208  tokens.push_back(token);
209  }
210  directory = Form("%s",tokens.at(0).c_str());
211  if(directory.Contains(Form("FecCrate%d",feckey.fecCrate())) and
212  directory.Contains(Form("FecRing%d",feckey.fecRing())) and
213  directory.Contains(Form("FecSlot%d",feckey.fecSlot())) and
214  directory.Contains(Form("CcuAddr%d",feckey.ccuAddr())) and
215  directory.Contains(Form("CcuChan%d",feckey.ccuChan())))
216  break;
217  }
218 
219  outputFile->cd("DQMData/"+directory);
220 
221  for(size_t igraph = 0 ; igraph < anal->decayTimeVsVFS().size(); igraph++){
222  graph_vfs->Add(anal->decayTimeVsVFS()[igraph]);
223  anal->decayTimeVsVFS()[igraph]->Write();
224  save_graph_vfs = true;
225  }
226 
227  for(size_t igraph = 0 ; igraph < anal->riseTimeVsISHA().size(); igraph++){
228  graph_isha->Add(anal->riseTimeVsISHA()[igraph]);
229  anal->riseTimeVsISHA()[igraph]->Write();
230  save_graph_isha = true;
231  }
232 
233  for(size_t igraph = 0 ; igraph < anal->riseTimeVsISHAVsVFS().size(); igraph++)
234  anal->riseTimeVsISHAVsVFS()[igraph]->Write();
235 
236 
237  for(size_t igraph = 0 ; igraph < anal->decayTimeVsISHAVsVFS().size(); igraph++)
238  anal->decayTimeVsISHAVsVFS()[igraph]->Write();
239 
240  outputFile->cd();
241  }
242  }
243 
244  outputFile->cd();
245  outputFile->cd("DQMData/Collate/SiStrip/ControlView");
246 
247 
248  if(save_graph_isha)
249  graph_isha->Write("riseTime_vs_isha");
250  if(save_graph_vfs)
251  graph_vfs->Write("decayTime_vs_vfs");
252 
253  outputFile->Close();
254 }
const std::vector< TGraph2D * > & decayTimeVsISHAVsVFS()
Analyses & data(bool getMaskedData=false)
const uint16_t & fecRing() const
const std::vector< TGraph * > & decayTimeVsVFS()
static const char dqmClientFileName_[]
static const char mlDqmClient_[]
const uint16_t & fecSlot() const
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
Analysis for calibration scans.
const uint32_t & fecKey() const
#define LogTrace(id)
const uint16_t & fecCrate() const
const uint16_t & ccuAddr() const
const uint16_t & ccuChan() const
DQMStore *const bei() const
const std::vector< TGraph2D * > & riseTimeVsISHAVsVFS()
dbl *** dir
Definition: mlp_gen.cc:35
static const char collate_[]
const std::vector< TGraph * > & riseTimeVsISHA()

Member Data Documentation

float CalibrationHistograms::targetDecayTime_
private

Definition at line 30 of file CalibrationHistograms.h.

Referenced by CalibrationHistograms(), and histoAnalysis().

float CalibrationHistograms::targetRiseTime_
private

Definition at line 29 of file CalibrationHistograms.h.

Referenced by CalibrationHistograms(), and histoAnalysis().

bool CalibrationHistograms::tuneSimultaneously_
private

Definition at line 31 of file CalibrationHistograms.h.

Referenced by CalibrationHistograms(), and histoAnalysis().