CMS 3D CMS Logo

LatencyTask.cc
Go to the documentation of this file.
7 
8 #define NBINS (192)
9 #define LOWBIN (-4800)
10 #define HIGHBIN (0)
11 
12 // -----------------------------------------------------------------------------
13 // static initialization
16 
17 // -----------------------------------------------------------------------------
18 //
20  : CommissioningTask(dqm, conn, "LatencyTask"), firstReading_(-1) {
21  LogDebug("Commissioning") << "[LatencyTask::LatencyTask] Constructing object...";
22 }
23 
24 // -----------------------------------------------------------------------------
25 //
26 LatencyTask::~LatencyTask() { LogDebug("Commissioning") << "[LatencyTask::LatencyTask] Destructing object..."; }
27 
28 // -----------------------------------------------------------------------------
29 //
31  LogDebug("Commissioning") << "[LatencyTask::book]";
32 
34  int nBins = NBINS;
35  SiStripDetKey detkeytracker((uint32_t)0);
36  SiStripDetKey detkeypartition((uint16_t)(connection().fecCrate()));
37 
38  // see if the global timing histogram is already booked
39  if (timing_.histo()) {
40  // if already booked, use it
41  LogDebug("Commissioning") << "[LatencyTask::book] using existing histogram.";
42  } else {
43  // make a new histo on the tracker level if not existing yet
44  LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram in " << dqm()->pwd();
45  // construct the histo title
49  detkeytracker.key(),
51  0,
53  .title();
54  dqm()->setCurrentFolder(detkeytracker.path());
55  timing_.histo(dqm()->bookProfile(title,
56  title, // name and title
57  nBins,
58  LOWBIN,
59  HIGHBIN, // binning + range
60  100,
61  0.,
62  -1.,
63  "s")); // Y range : automatic
64  timing_.vNumOfEntries_.resize(nBins, 0);
65  timing_.vSumOfContents_.resize(nBins, 0);
66  timing_.vSumOfSquares_.resize(nBins, 0);
67  }
68  // make a new histo on the partition level if not existing yet
69  LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram in " << dqm()->pwd();
70  // histo title
74  detkeypartition.key(),
76  0,
78  .title();
79  dqm()->setCurrentFolder(detkeypartition.path());
80  timingPartition_.histo(dqm()->bookProfile(title,
81  title, // name and title
82  nBins,
83  LOWBIN,
84  HIGHBIN, // binning + range
85  100,
86  0.,
87  -1.,
88  "s")); // Y range : automatic
92 
93  // see if the global cluster histogram is already booked
94  if (cluster_.histo()) {
95  // if already booked, use it
96  LogDebug("Commissioning") << "[LatencyTask::book] using existing histogram.";
97  } else {
98  // make a new histo on the tracker level if not existing yet
99  LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram in " << dqm()->pwd();
100  // construct the histo title
104  detkeytracker.key(),
106  0,
108  .title();
109  dqm()->setCurrentFolder(detkeytracker.path());
110  cluster_.histo(dqm()->book1D(title,
111  title, // name and title
112  nBins,
113  LOWBIN,
114  HIGHBIN)); // binning + range
115  cluster_.isProfile_ = false;
116  cluster_.vNumOfEntries_.resize(nBins, 0);
117  cluster_.vSumOfContents_.resize(nBins, 0);
118  cluster_.vSumOfSquares_.resize(nBins, 0);
119  }
120  // make a new histo on the partition level if not existing yet
121  LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram in " << dqm()->pwd();
122  // histo title
126  detkeypartition.key(),
128  0,
130  .title();
131  dqm()->setCurrentFolder(detkeypartition.path());
132  clusterPartition_.histo(dqm()->book1D(title,
133  title, // name and title
134  nBins,
135  LOWBIN,
136  HIGHBIN)); // binning + range
141 
142  LogDebug("Commissioning") << "[LatencyTask::book] done";
143 }
144 
145 // -----------------------------------------------------------------------------
146 //
148  LogDebug("Commissioning") << "[LatencyTask::fill]";
149  // retrieve the delay from the EventSummary
150  int32_t delay = static_cast<int32_t>(summary.latency());
151  if (firstReading_ == -1)
153  float correctedDelay = 0.;
154  LogDebug("Commissioning") << "[LatencyTask::fill]; the delay is " << delay;
155  // loop on the strips to find the (maybe) non-zero digi
156  unsigned int nclusters = 0;
157  for (unsigned int strip = 0; strip < digis.data.size(); strip++) {
158  if (digis.data[strip].adc() != 0) {
159  // count the "cluster"
160  ++nclusters;
161  // no TOF correction is applied.
162  // 2 reasons: the effect is a priori to thin to be seen with 25ns steps
163  // and it biases the result by one clock due to the 25bins in the HistoSet
164  correctedDelay = delay * (-25.); // no TOF correction is applied.
165  // compute the bin
166  int bin = int((correctedDelay - LOWBIN) / ((HIGHBIN - LOWBIN) / NBINS));
167  LogDebug("Commissioning") << "[LatencyTask::fill]; using a hit with value " << (digis.data[strip].adc() & 0xff)
168  << " at corrected delay of " << correctedDelay << " in bin " << bin;
169  updateHistoSet(timing_, bin, digis.data[strip].adc() & 0xff);
170  LogDebug("Commissioning") << "HistoSet timing Updated " << strip << " " << digis.data.size();
171  updateHistoSet(timingPartition_, bin, digis.data[strip].adc() & 0xff);
172  LogDebug("Commissioning") << "HistoSet timingPartition Updated " << strip << " " << digis.data.size();
173  }
174  }
175  // set the occupancy
176  int bin = int((delay * (-25.) - LOWBIN) / ((HIGHBIN - LOWBIN) / NBINS));
177  LogDebug("Commissioning") << "[LatencyTask::fill]; occupancy is " << nclusters;
178  updateHistoSet(cluster_, bin, nclusters);
179  updateHistoSet(clusterPartition_, bin, nclusters);
180 }
181 
182 // -----------------------------------------------------------------------------
183 //
185  LogDebug("Commissioning") << "[LatencyTask::update]";
190 }
std::vector< float > vNumOfEntries_
static HistoSet timing_
Definition: LatencyTask.h:21
Utility class that holds histogram title.
void book() override
Definition: LatencyTask.cc:30
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:647
const std::string & path() const
Definition: SiStripKey.h:121
std::vector< float > vSumOfContents_
std::string pwd() override
Definition: DQMStore.h:645
#define HIGHBIN
Definition: LatencyTask.cc:10
~LatencyTask() override
Definition: LatencyTask.cc:26
int firstReading_
Definition: LatencyTask.h:25
static const char occupancy_[]
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
HistoSet clusterPartition_
Definition: LatencyTask.h:24
HistoSet timingPartition_
Definition: LatencyTask.h:23
Class containning control, module, detector and connection information, at the level of a FED channel...
const uint32_t & key() const
Definition: SiStripKey.h:120
DQMStore *const dqm() const
Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip.
Definition: SiStripDetKey.h:28
#define LOWBIN
Definition: LatencyTask.cc:9
static const char clusterCharge_[]
static HistoSet cluster_
Definition: LatencyTask.h:22
void fill(const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &) override
Definition: LatencyTask.cc:147
LatencyTask(DQMStore *, const FedChannelConnection &)
Definition: LatencyTask.cc:19
void update() override
Definition: LatencyTask.cc:184
#define NBINS
Definition: LatencyTask.cc:8
collection_type data
Definition: DetSet.h:80
void histo(MonitorElement *)
conn
Definition: getInfo.py:9
std::vector< double > vSumOfSquares_
const FedChannelConnection & connection() const
Definition: DQMStore.h:18
#define LogDebug(id)