CMS 3D CMS Logo

List of all members | Public Member Functions
ApvTimingHistograms Class Reference

#include <ApvTimingHistograms.h>

Inheritance diagram for ApvTimingHistograms:
CommissioningHistograms ApvTimingHistosUsingDb

Public Member Functions

 ApvTimingHistograms (const edm::ParameterSet &pset, DQMStore *)
 
void histoAnalysis (bool debug) override
 
 ~ApvTimingHistograms () 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 printAnalyses ()
 
virtual void printSummary ()
 
void remove (std::string pattern="")
 
void save (std::string &filename, uint32_t run_number=0, std::string partitionName="")
 
virtual ~CommissioningHistograms ()
 

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 ApvTimingHistograms.h.

Constructor & Destructor Documentation

◆ ApvTimingHistograms()

ApvTimingHistograms::ApvTimingHistograms ( const edm::ParameterSet pset,
DQMStore bei 
)

Definition at line 20 of file ApvTimingHistograms.cc.

References CommissioningHistograms::factory_, LogTrace, and sistrip::mlDqmClient_.

22  factory_ = std::make_unique<ApvTimingSummaryFactory>();
23  LogTrace(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]"
24  << " Constructing object...";
25 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
static const char mlDqmClient_[]
#define LogTrace(id)
std::unique_ptr< Factory > factory_
const edm::ParameterSet & pset() const
DQMStore *const bei() const

◆ ~ApvTimingHistograms()

ApvTimingHistograms::~ApvTimingHistograms ( )
override

Definition at line 29 of file ApvTimingHistograms.cc.

References LogTrace, and sistrip::mlDqmClient_.

29  {
30  LogTrace(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]"
31  << " Destructing object...";
32 }
static const char mlDqmClient_[]
#define LogTrace(id)

Member Function Documentation

◆ histoAnalysis()

void ApvTimingHistograms::histoAnalysis ( bool  debug)
overridevirtual

Reimplemented from CommissioningHistograms.

Definition at line 36 of file ApvTimingHistograms.cc.

References conversion_template_cfg::anal, submitPVResolutionJobs::count, CommissioningHistograms::data(), relativeConstraints::empty, nano_mu_digi_cff::errors, extract(), CommissioningHistograms::histos(), cuy::ii, sistrip::invalid_, LogTrace, SiStripPI::max, SiStripPI::min, sistrip::mlDqmClient_, CommissioningHistograms::pset(), contentValuesCheck::ss, validateGeometry_cfg::valid, and sistrip::valid_.

36  {
37  LogTrace(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]";
38 
39  // Some initialisation
40  uint16_t valid = 0;
41  HistosMap::const_iterator iter;
42  Analyses::iterator ianal;
43  std::map<std::string, uint16_t> errors;
44 
45  // Clear map holding analysis objects
46  for (ianal = data().begin(); ianal != data().end(); ianal++) {
47  if (ianal->second) {
48  delete ianal->second;
49  }
50  }
51  data().clear();
52 
53  // Reset minimum / maximum delays
54  float time_min = 1. * sistrip::invalid_;
55  float time_max = -1. * sistrip::invalid_;
56  uint32_t device_min = sistrip::invalid_;
57  uint32_t device_max = sistrip::invalid_;
58 
59  // Iterate through map containing histograms
60  for (iter = histos().begin(); iter != histos().end(); iter++) {
61  // Check vector of histos is not empty
62  if (iter->second.empty()) {
63  edm::LogWarning(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]"
64  << " Zero histograms found!";
65  continue;
66  }
67 
68  // Retrieve pointers to histos
69  std::vector<TH1*> profs;
70  Histos::const_iterator ihis = iter->second.begin();
71  for (; ihis != iter->second.end(); ihis++) {
72  TProfile* prof = ExtractTObject<TProfile>().extract((*ihis)->me_);
73  if (prof) {
74  profs.push_back(prof);
75  }
76  }
77 
78  // Perform histo analysis
79  ApvTimingAnalysis* anal = new ApvTimingAnalysis(iter->first);
80  ApvTimingAlgorithm algo(this->pset(), anal);
81  algo.analysis(profs);
82  data()[iter->first] = anal;
83 
84  // Check if tick mark found
85  if (!anal->foundTickMark()) {
86  continue;
87  }
88 
89  // Find maximum time
90  if (anal->time() > time_max) {
91  time_max = anal->time();
92  device_max = iter->first;
93  }
94 
95  // Find minimum time
96  if (anal->time() < time_min) {
97  time_min = anal->time();
98  device_min = iter->first;
99  }
100  }
101 
102  // Adjust maximum (and minimum) delay(s) to find optimum sampling point(s)
103  if (time_max > sistrip::valid_ || time_max < -1. * sistrip::valid_) {
104  edm::LogWarning(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]"
105  << " Unable to set maximum time! Found unexpected value: " << time_max;
106 
107  } else {
108  SiStripFecKey min(device_min);
109  edm::LogVerbatim(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]"
110  << " Crate/FEC/Ring/CCU/module/channel: " << min.fecCrate() << "/" << min.fecSlot()
111  << "/" << min.fecRing() << "/" << min.ccuAddr() << "/" << min.ccuChan() << "/"
112  << min.lldChan() << " has minimum time for tick mark rising edge [ns]: " << time_min;
113 
114  SiStripFecKey max(device_max);
115  edm::LogVerbatim(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]"
116  << " Crate/FEC/Ring/CCU/module/channel: " << max.fecCrate() << "/" << max.fecSlot()
117  << "/" << max.fecRing() << "/" << max.ccuAddr() << "/" << max.ccuChan() << "/"
118  << max.lldChan() << " has maximum time for tick mark rising edge [ns]: " << time_max;
119 
120  edm::LogVerbatim(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]"
121  << " Difference b/w minimum and maximum times"
122  << " for tick mark rising edges [ns] is: " << (time_max - time_min);
123  }
124 
125  // Set reference time for all analysis objects
126  for (ianal = data().begin(); ianal != data().end(); ianal++) {
127  ApvTimingAnalysis* anal = dynamic_cast<ApvTimingAnalysis*>(ianal->second);
128  if (!anal) {
129  continue;
130  }
131  anal->refTime(time_max, this->pset().getParameter<int>("TargetDelay"));
132  if (anal->isValid()) {
133  valid++;
134  }
135  if (!anal->getErrorCodes().empty()) {
136  errors[anal->getErrorCodes()[0]]++;
137  }
138  }
139 
140  if (!histos().empty()) {
141  edm::LogVerbatim(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]"
142  << " Analyzed histograms for " << histos().size() << " FED channels, of which "
143  << valid << " (" << 100 * valid / histos().size() << "%) are valid.";
144  } else {
145  edm::LogWarning(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]"
146  << " No histograms to analyze!";
147  }
148 
149  if (!histos().empty()) {
150  edm::LogVerbatim(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]"
151  << " Analyzed histograms for " << histos().size() << " FED channels, of which "
152  << valid << " (" << 100 * valid / histos().size() << "%) are valid.";
153  if (!errors.empty()) {
154  uint16_t count = 0;
155  std::stringstream ss;
156  ss << std::endl;
157  std::map<std::string, uint16_t>::const_iterator ii;
158  for (ii = errors.begin(); ii != errors.end(); ++ii) {
159  ss << " " << ii->first << ": " << ii->second << std::endl;
160  count += ii->second;
161  }
162  edm::LogWarning(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]"
163  << " Found " << count << " errors (" << 100 * count / histos().size()
164  << "%): " << ss.str();
165  }
166  } else {
167  edm::LogWarning(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]"
168  << " No histograms to analyze!";
169  }
170 }
Log< level::Info, true > LogVerbatim
const HistosMap & histos() const
Analyses & data(bool getMaskedData=false)
Analysis for timing run using APV tick marks.
static const char mlDqmClient_[]
static const uint16_t valid_
Definition: Constants.h:17
#define LogTrace(id)
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
ii
Definition: cuy.py:589
int extract(std::vector< int > *output, const std::string &dati)
static const uint16_t invalid_
Definition: Constants.h:16
const edm::ParameterSet & pset() const
Definition: errors.py:1
Log< level::Warning, false > LogWarning
Analysis for timing run using APV tick marks.