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  const FedChannelConnection& conn ) :
21  CommissioningTask( dqm, conn, "LatencyTask" ),firstReading_(-1)
22 {
23  LogDebug("Commissioning") << "[LatencyTask::LatencyTask] Constructing object...";
24 }
25 
26 // -----------------------------------------------------------------------------
27 //
29  LogDebug("Commissioning") << "[LatencyTask::LatencyTask] Destructing object...";
30 }
31 
32 // -----------------------------------------------------------------------------
33 //
35  LogDebug("Commissioning") << "[LatencyTask::book]";
36 
38  int nBins = NBINS;
39  SiStripDetKey detkeytracker((uint32_t) 0);
40  SiStripDetKey detkeypartition((uint16_t) (connection().fecCrate()));
41 
42  // see if the global timing histogram is already booked
43  if (timing_.histo()) {
44  // if already booked, use it
45  LogDebug("Commissioning") << "[LatencyTask::book] using existing histogram.";
46  } else {
47  // make a new histo on the tracker level if not existing yet
48  LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram in " << dqm()->pwd();
49  // construct the histo title
53  detkeytracker.key(),
55  0,
57  dqm()->setCurrentFolder( detkeytracker.path() );
58  timing_.histo( dqm()->bookProfile( title, title, // name and title
59  nBins, LOWBIN, HIGHBIN, // binning + range
60  100, 0., -1., "s" ) ); // Y range : automatic
61  timing_.vNumOfEntries_.resize(nBins,0);
62  timing_.vSumOfContents_.resize(nBins,0);
63  timing_.vSumOfSquares_.resize(nBins,0);
64  }
65  // make a new histo on the partition level if not existing yet
66  LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram in " << dqm()->pwd();
67  // histo title
71  detkeypartition.key(),
73  0,
75  dqm()->setCurrentFolder( detkeypartition.path() );
76  timingPartition_.histo( dqm()->bookProfile( title, title, // name and title
77  nBins, LOWBIN, HIGHBIN, // binning + range
78  100, 0., -1., "s" ) ); // Y range : automatic
79  timingPartition_.vNumOfEntries_.resize(nBins,0);
80  timingPartition_.vSumOfContents_.resize(nBins,0);
81  timingPartition_.vSumOfSquares_.resize(nBins,0);
82 
83  // see if the global cluster histogram is already booked
84  if (cluster_.histo()) {
85  // if already booked, use it
86  LogDebug("Commissioning") << "[LatencyTask::book] using existing histogram.";
87  } else {
88  // make a new histo on the tracker level if not existing yet
89  LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram in " << dqm()->pwd();
90  // construct the histo title
94  detkeytracker.key(),
96  0,
98  dqm()->setCurrentFolder( detkeytracker.path() );
99  cluster_.histo( dqm()->book1D( title, title, // name and title
100  nBins, LOWBIN, HIGHBIN )); // binning + range
101  cluster_.isProfile_ = false;
102  cluster_.vNumOfEntries_.resize(nBins,0);
103  cluster_.vSumOfContents_.resize(nBins,0);
104  cluster_.vSumOfSquares_.resize(nBins,0);
105  }
106  // make a new histo on the partition level if not existing yet
107  LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram in " << dqm()->pwd();
108  // histo title
112  detkeypartition.key(),
114  0,
116  dqm()->setCurrentFolder( detkeypartition.path() );
117  clusterPartition_.histo( dqm()->book1D( title, title, // name and title
118  nBins, LOWBIN, HIGHBIN ) ); // binning + range
120  clusterPartition_.vNumOfEntries_.resize(nBins,0);
121  clusterPartition_.vSumOfContents_.resize(nBins,0);
122  clusterPartition_.vSumOfSquares_.resize(nBins,0);
123 
124  LogDebug("Commissioning") << "[LatencyTask::book] done";
125 }
126 
127 // -----------------------------------------------------------------------------
128 //
130  const edm::DetSet<SiStripRawDigi>& digis ) {
131  LogDebug("Commissioning") << "[LatencyTask::fill]";
132  // retrieve the delay from the EventSummary
133  int32_t delay = static_cast<int32_t>( const_cast<SiStripEventSummary&>(summary).latency() );
134  if(firstReading_==-1) firstReading_ = delay;
135  float correctedDelay = 0.;
136  LogDebug("Commissioning") << "[LatencyTask::fill]; the delay is " << delay;
137  // loop on the strips to find the (maybe) non-zero digi
138  unsigned int nclusters = 0;
139  for(unsigned int strip=0;strip<digis.data.size();strip++) {
140  if(digis.data[strip].adc()!=0) {
141  // count the "cluster"
142  ++nclusters;
143  // no TOF correction is applied.
144  // 2 reasons: the effect is a priori to thin to be seen with 25ns steps
145  // and it biases the result by one clock due to the 25bins in the HistoSet
146  correctedDelay = delay*(-25.); // no TOF correction is applied.
147  // compute the bin
148  int bin = int((correctedDelay-LOWBIN)/((HIGHBIN-LOWBIN)/NBINS));
149  LogDebug("Commissioning") << "[LatencyTask::fill]; using a hit with value " << ( digis.data[strip].adc()&0xff )
150  << " at corrected delay of " << correctedDelay
151  << " in bin " << bin ;
152  updateHistoSet( timing_,bin,digis.data[strip].adc()&0xff);
153  LogDebug("Commissioning") << "HistoSet timing Updated " << strip << " " << digis.data.size();
154  updateHistoSet( timingPartition_,bin,digis.data[strip].adc()&0xff);
155  LogDebug("Commissioning") << "HistoSet timingPartition Updated " << strip << " " << digis.data.size();
156  }
157  }
158  // set the occupancy
159  int bin = int((delay*(-25.)-LOWBIN)/((HIGHBIN-LOWBIN)/NBINS));
160  LogDebug("Commissioning") << "[LatencyTask::fill]; occupancy is " << nclusters;
161  updateHistoSet( cluster_,bin,nclusters );
162  updateHistoSet( clusterPartition_,bin,nclusters );
163 }
164 
165 // -----------------------------------------------------------------------------
166 //
168  LogDebug("Commissioning") << "[LatencyTask::update]";
173 }
174 
#define LogDebug(id)
std::vector< float > vNumOfEntries_
static HistoSet timing_
Definition: LatencyTask.h:25
const std::string & pwd() const
Definition: DQMStore.cc:517
Utility class that holds histogram title.
void book() override
Definition: LatencyTask.cc:34
std::vector< float > vSumOfContents_
#define HIGHBIN
Definition: LatencyTask.cc:10
~LatencyTask() override
Definition: LatencyTask.cc:28
const uint32_t & key() const
Definition: SiStripKey.h:125
int firstReading_
Definition: LatencyTask.h:29
static const char occupancy_[]
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
HistoSet clusterPartition_
Definition: LatencyTask.h:28
HistoSet timingPartition_
Definition: LatencyTask.h:27
Class containning control, module, detector and connection information, at the level of a FED channel...
const std::string & path() const
Definition: SiStripKey.h:126
Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip.
Definition: SiStripDetKey.h:28
bin
set the eta bin as selection string.
#define LOWBIN
Definition: LatencyTask.cc:9
static const char clusterCharge_[]
static HistoSet cluster_
Definition: LatencyTask.h:26
DQMStore *const dqm() const
void fill(const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &) override
Definition: LatencyTask.cc:129
LatencyTask(DQMStore *, const FedChannelConnection &)
Definition: LatencyTask.cc:19
void update() override
Definition: LatencyTask.cc:167
#define NBINS
Definition: LatencyTask.cc:8
collection_type data
Definition: DetSet.h:78
void histo(MonitorElement *)
std::vector< double > vSumOfSquares_
const FedChannelConnection & connection() const
latency
hardware algo
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:545