CMS 3D CMS Logo

FedTimingHistograms.cc
Go to the documentation of this file.
6 #include <iostream>
7 #include <sstream>
8 #include <iomanip>
9 
10 using namespace std;
11 
12 // -----------------------------------------------------------------------------
15  DQMStore* bei )
16  : CommissioningHistograms( pset.getParameter<edm::ParameterSet>("FedTimingParameters"),
17  bei,
19  factory_( new Factory ),
20  optimumSamplingPoint_(15.),
21  minDelay_(sistrip::invalid_),
22  maxDelay_(-1.*sistrip::invalid_),
23  deviceWithMinDelay_(sistrip::invalid_),
24  deviceWithMaxDelay_(sistrip::invalid_)
25 {
26  cout << "[" << __PRETTY_FUNCTION__ << "]"
27  << " Created object for APV TIMING histograms" << endl;
28 }
29 
30 // -----------------------------------------------------------------------------
33  cout << "[" << __PRETTY_FUNCTION__ << "]" << endl;
34 }
35 
36 // -----------------------------------------------------------------------------
39 
40  // Clear std::map holding analysis objects
41  data_.clear();
42 
43  // Reset minimum / maximum delays
44  float time_min = 1. * sistrip::invalid_;
45  float time_max = -1. * sistrip::invalid_;
46  uint32_t device_min = sistrip::invalid_;
47  uint32_t device_max = sistrip::invalid_;
48 
49 // // Iterate through std::map containing std::vectors of profile histograms
50 // CollationsMap::const_iterator iter = collations().begin();
51 // for ( ; iter != collations().end(); iter++ ) {
52 
53 // // Check std::vector of histos is not empty (should be 2 histos)
54 // if ( iter->second.empty() ) {
55 // cerr << "[" << __PRETTY_FUNCTION__ << "]"
56 // << " Zero collation histograms found!" << endl;
57 // continue;
58 // }
59 
60 // // Retrieve pointers to profile histos for this FED channel
61 // std::vector<TH1*> profs;
62 // Collations::const_iterator ihis = iter->second.begin();
63 // for ( ; ihis != iter->second.end(); ihis++ ) {
64 // OBSOLETE!!!
65 // TProfile* prof = ExtractTObject<TProfile>().extract( mui()->get( ihis->first ) );
66 // if ( prof ) { profs.push_back(prof); }
67 // }
68 
69 // // Perform histo analysis
70 // FedTimingAnalysis anal( iter->first );
71 // FedTimingAlgorithm algo( &anal );
72 // algo.analysis( profs );
73 // data_[iter->first] = anal;
74 
75 // // Check tick height is valid
76 // if ( anal.height() < 100. ) {
77 // cerr << "[" << __PRETTY_FUNCTION__ << "]"
78 // << " Tick mark height too small: " << anal.height() << endl;
79 // continue;
80 // }
81 
82 // // Check time of rising edge
83 // if ( anal.time() > sistrip::maximum_ ) { continue; }
84 
85 // // Find maximum time
86 // if ( anal.time() > time_max ) {
87 // time_max = anal.time();
88 // device_max = iter->first;
89 // }
90 
91 // // Find minimum time
92 // if ( anal.time() < time_min ) {
93 // time_min = anal.time();
94 // device_min = iter->first;
95 // }
96 
97 // }
98 
99 // cout << "[" << __PRETTY_FUNCTION__ << "]"
100 // << " Analyzed histograms for "
101 // << collations().size()
102 // << " FED channels" << endl;
103 
104  // Adjust maximum (and minimum) delay(s) to find optimum sampling point(s)
105  if ( time_max > sistrip::maximum_ ||
106  time_max < -1.*sistrip::maximum_ ) {
107  cerr << "[" << __PRETTY_FUNCTION__ << "]"
108  << " Unable to set maximum time! Found unexpected value: "
109  << time_max << endl;
110  return;
111  }
112 
113  SiStripFecKey max( device_max );
114  cout << " Device (FEC/slot/ring/CCU/module/channel) "
115  << max.fecCrate() << "/"
116  << max.fecSlot() << "/"
117  << max.fecRing() << "/"
118  << max.ccuAddr() << "/"
119  << max.ccuChan() << "/"
120  << " has maximum delay (rising edge) [ns]:" << time_max << endl;
121 
122  SiStripFecKey min( device_min );
123  cout << " Device (FEC/slot/ring/CCU/module/channel): "
124  << min.fecCrate() << "/"
125  << min.fecSlot() << "/"
126  << min.fecRing() << "/"
127  << min.ccuAddr() << "/"
128  << min.ccuChan() << "/"
129  << " has minimum delay (rising edge) [ns]:" << time_min << endl;
130 
131  // Set maximum time for all analysis objects
132  std::map<uint32_t,FedTimingAnalysis>::iterator ianal = data_.begin();
133  for ( ; ianal != data_.end(); ianal++ ) {
134  ianal->second.max( time_max );
135  static uint16_t cntr = 0;
136  if ( debug ) {
137  std::stringstream ss;
138  ianal->second.print( ss );
139  cout << ss.str() << endl;
140  cntr++;
141  }
142  }
143 
144 }
145 
146 // -----------------------------------------------------------------------------
149  const sistrip::Presentation& type,
150  const std::string& directory,
151  const sistrip::Granularity& gran ) {
152  cout << "[" << __PRETTY_FUNCTION__ <<"]" << endl;
153 
154  // Check view
156  if ( view == sistrip::UNKNOWN_VIEW ) { return; }
157 
158  // Analyze histograms
159  histoAnalysis( false );
160 
161  // Extract data to be histogrammed
162  factory_->init( histo, type, view, directory, gran );
163  uint32_t xbins = factory_->extract( data_ );
164 
165  // Create summary histogram (if it doesn't already exist)
166  TH1* summary = histogram( histo, type, view, directory, xbins );
167 
168  // Fill histogram with data
169  factory_->fill( *summary );
170 
171 }
type
Definition: HCALResponse.h:21
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 double xbins[]
const uint16_t & fecRing() const
std::auto_ptr< Factory > factory_
FedTimingHistograms(const edm::ParameterSet &pset, DQMStore *)
const uint16_t & fecSlot() const
void createSummaryHisto(const sistrip::Monitorable &, const sistrip::Presentation &, const std::string &top_level_dir, const sistrip::Granularity &) override
sistrip classes
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
static std::string view(const sistrip::View &)
static const uint16_t maximum_
Definition: Constants.h:20
T min(T a, T b)
Definition: MathUtil.h:58
void histoAnalysis(bool debug) override
const uint16_t & fecCrate() const
#define debug
Definition: HDRShower.cc:19
std::map< uint32_t, FedTimingAnalysis > data_
const uint16_t & ccuAddr() const
static const uint16_t invalid_
Definition: Constants.h:16
HLT enums.
const uint16_t & ccuChan() const