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 ( const edm::ParameterSet pset,
DQMStore bei 
)

Definition at line 18 of file ApvTimingHistograms.cc.

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

20  factory_ = unique_ptr<ApvTimingSummaryFactory>(new ApvTimingSummaryFactory);
21  LogTrace(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]"
22  << " Constructing object...";
23 }
T getParameter(std::string const &) const
static const char mlDqmClient_[]
DQMStore *const bei() const
#define LogTrace(id)
std::unique_ptr< Factory > factory_
ApvTimingHistograms::~ApvTimingHistograms ( )
override

Definition at line 27 of file ApvTimingHistograms.cc.

References LogTrace, and sistrip::mlDqmClient_.

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

Member Function Documentation

void ApvTimingHistograms::histoAnalysis ( bool  debug)
overridevirtual

Reimplemented from CommissioningHistograms.

Definition at line 34 of file ApvTimingHistograms.cc.

References ecalcalib_dqm_sourceclient-live_cfg::algo, conversion_template_cfg::anal, CommissioningAlgorithm::analysis(), begin, SiStripFecKey::ccuAddr(), SiStripFecKey::ccuChan(), KineDebug3::count(), CommissioningHistograms::data(), relativeConstraints::empty, MessageLogger_cfi::errors, extract(), SiStripFecKey::fecCrate(), SiStripFecKey::fecRing(), SiStripFecKey::fecSlot(), ApvTimingAnalysis::foundTickMark(), CommissioningAnalysis::getErrorCodes(), CommissioningHistograms::histos(), cuy::ii, sistrip::invalid_, ApvTimingAnalysis::isValid(), SiStripFecKey::lldChan(), LogTrace, SiStripPI::max, min(), sistrip::mlDqmClient_, CommissioningHistograms::pset(), ApvTimingAnalysis::refTime(), contentValuesCheck::ss, ApvTimingAnalysis::time(), validateGeometry_cfg::valid, and sistrip::valid_.

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