1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
#include "DQM/SiStripCommissioningSources/interface/LatencyTask.h"
#include "DataFormats/SiStripCommon/interface/SiStripHistoTitle.h"
#include <DataFormats/SiStripDetId/interface/SiStripDetId.h>
#include "DQMServices/Core/interface/DQMStore.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "DataFormats/SiStripCommon/interface/SiStripDetKey.h"
#define NBINS (192)
#define LOWBIN (-4800)
#define HIGHBIN (0)
// -----------------------------------------------------------------------------
// static initialization
CommissioningTask::HistoSet LatencyTask::timing_;
CommissioningTask::HistoSet LatencyTask::cluster_;
// -----------------------------------------------------------------------------
//
LatencyTask::LatencyTask(DQMStore* dqm, const FedChannelConnection& conn)
: CommissioningTask(dqm, conn, "LatencyTask"), firstReading_(-1) {
LogDebug("Commissioning") << "[LatencyTask::LatencyTask] Constructing object...";
}
// -----------------------------------------------------------------------------
//
LatencyTask::~LatencyTask() { LogDebug("Commissioning") << "[LatencyTask::LatencyTask] Destructing object..."; }
// -----------------------------------------------------------------------------
//
void LatencyTask::book() {
LogDebug("Commissioning") << "[LatencyTask::book]";
std::string title;
int nBins = NBINS;
SiStripDetKey detkeytracker((uint32_t)0);
SiStripDetKey detkeypartition((uint16_t)(connection().fecCrate()));
// see if the global timing histogram is already booked
if (timing_.histo()) {
// if already booked, use it
LogDebug("Commissioning") << "[LatencyTask::book] using existing histogram.";
} else {
// make a new histo on the tracker level if not existing yet
LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram in " << dqm()->pwd();
// construct the histo title
title = SiStripHistoTitle(sistrip::EXPERT_HISTO,
sistrip::APV_LATENCY,
sistrip::DET_KEY,
detkeytracker.key(),
sistrip::TRACKER,
0,
sistrip::extrainfo::clusterCharge_)
.title();
dqm()->setCurrentFolder(detkeytracker.path());
timing_.histo(dqm()->bookProfile(title,
title, // name and title
nBins,
LOWBIN,
HIGHBIN, // binning + range
100,
0.,
-1.,
"s")); // Y range : automatic
timing_.vNumOfEntries_.resize(nBins, 0);
timing_.vSumOfContents_.resize(nBins, 0);
timing_.vSumOfSquares_.resize(nBins, 0);
}
// make a new histo on the partition level if not existing yet
LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram in " << dqm()->pwd();
// histo title
title = SiStripHistoTitle(sistrip::EXPERT_HISTO,
sistrip::APV_LATENCY,
sistrip::DET_KEY,
detkeypartition.key(),
sistrip::PARTITION,
0,
sistrip::extrainfo::clusterCharge_)
.title();
dqm()->setCurrentFolder(detkeypartition.path());
timingPartition_.histo(dqm()->bookProfile(title,
title, // name and title
nBins,
LOWBIN,
HIGHBIN, // binning + range
100,
0.,
-1.,
"s")); // Y range : automatic
timingPartition_.vNumOfEntries_.resize(nBins, 0);
timingPartition_.vSumOfContents_.resize(nBins, 0);
timingPartition_.vSumOfSquares_.resize(nBins, 0);
// see if the global cluster histogram is already booked
if (cluster_.histo()) {
// if already booked, use it
LogDebug("Commissioning") << "[LatencyTask::book] using existing histogram.";
} else {
// make a new histo on the tracker level if not existing yet
LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram in " << dqm()->pwd();
// construct the histo title
title = SiStripHistoTitle(sistrip::EXPERT_HISTO,
sistrip::APV_LATENCY,
sistrip::DET_KEY,
detkeytracker.key(),
sistrip::TRACKER,
0,
sistrip::extrainfo::occupancy_)
.title();
dqm()->setCurrentFolder(detkeytracker.path());
cluster_.histo(dqm()->book1D(title,
title, // name and title
nBins,
LOWBIN,
HIGHBIN)); // binning + range
cluster_.isProfile_ = false;
cluster_.vNumOfEntries_.resize(nBins, 0);
cluster_.vSumOfContents_.resize(nBins, 0);
cluster_.vSumOfSquares_.resize(nBins, 0);
}
// make a new histo on the partition level if not existing yet
LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram in " << dqm()->pwd();
// histo title
title = SiStripHistoTitle(sistrip::EXPERT_HISTO,
sistrip::APV_LATENCY,
sistrip::DET_KEY,
detkeypartition.key(),
sistrip::PARTITION,
0,
sistrip::extrainfo::occupancy_)
.title();
dqm()->setCurrentFolder(detkeypartition.path());
clusterPartition_.histo(dqm()->book1D(title,
title, // name and title
nBins,
LOWBIN,
HIGHBIN)); // binning + range
clusterPartition_.isProfile_ = false;
clusterPartition_.vNumOfEntries_.resize(nBins, 0);
clusterPartition_.vSumOfContents_.resize(nBins, 0);
clusterPartition_.vSumOfSquares_.resize(nBins, 0);
LogDebug("Commissioning") << "[LatencyTask::book] done";
}
// -----------------------------------------------------------------------------
//
void LatencyTask::fill(const SiStripEventSummary& summary, const edm::DetSet<SiStripRawDigi>& digis) {
LogDebug("Commissioning") << "[LatencyTask::fill]";
// retrieve the delay from the EventSummary
int32_t delay = static_cast<int32_t>(summary.latency());
if (firstReading_ == -1)
firstReading_ = delay;
float correctedDelay = 0.;
LogDebug("Commissioning") << "[LatencyTask::fill]; the delay is " << delay;
// loop on the strips to find the (maybe) non-zero digi
unsigned int nclusters = 0;
for (unsigned int strip = 0; strip < digis.data.size(); strip++) {
if (digis.data[strip].adc() != 0) {
// count the "cluster"
++nclusters;
// no TOF correction is applied.
// 2 reasons: the effect is a priori to thin to be seen with 25ns steps
// and it biases the result by one clock due to the 25bins in the HistoSet
correctedDelay = delay * (-25.); // no TOF correction is applied.
// compute the bin
int bin = int((correctedDelay - LOWBIN) / ((HIGHBIN - LOWBIN) / NBINS));
LogDebug("Commissioning") << "[LatencyTask::fill]; using a hit with value " << (digis.data[strip].adc() & 0xff)
<< " at corrected delay of " << correctedDelay << " in bin " << bin;
updateHistoSet(timing_, bin, digis.data[strip].adc() & 0xff);
LogDebug("Commissioning") << "HistoSet timing Updated " << strip << " " << digis.data.size();
updateHistoSet(timingPartition_, bin, digis.data[strip].adc() & 0xff);
LogDebug("Commissioning") << "HistoSet timingPartition Updated " << strip << " " << digis.data.size();
}
}
// set the occupancy
int bin = int((delay * (-25.) - LOWBIN) / ((HIGHBIN - LOWBIN) / NBINS));
LogDebug("Commissioning") << "[LatencyTask::fill]; occupancy is " << nclusters;
updateHistoSet(cluster_, bin, nclusters);
updateHistoSet(clusterPartition_, bin, nclusters);
}
// -----------------------------------------------------------------------------
//
void LatencyTask::update() {
LogDebug("Commissioning") << "[LatencyTask::update]";
updateHistoSet(timing_);
updateHistoSet(timingPartition_);
updateHistoSet(cluster_);
updateHistoSet(clusterPartition_);
}
|