70 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals "
71 <<
" Constructing....... ";
80 noiseToken_ = esConsumes<edm::Transition::BeginRun>();
89 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals "
90 <<
" Destructing...... ";
104 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::bookHistograms: "
105 <<
" Creating MEs for new Cabling ";
119 std::vector<uint32_t> SelectedDetIds;
134 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: "
135 <<
"Number of Detector Present in cabling " << SelectedDetIds.size();
137 for (std::vector<uint32_t>::const_iterator idetid = SelectedDetIds.begin(), iEnd = SelectedDetIds.end();
140 uint32_t detid = *idetid;
143 if (detid == 0 || detid == 0xFFFFFFFF) {
144 edm::LogError(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: "
145 <<
"Wrong DetId !!!!!! " << detid <<
" Neglecting !!!!!! ";
152 if (apv_pairs < 1 || apv_pairs > 3) {
153 edm::LogError(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: Wrong APV Pairs => detId "
154 << detid <<
" APV pairs " << apv_pairs <<
" Neglecting !!!!!! ";
157 unsigned int napvs = apv_pairs * 2;
158 unsigned int nStrip = napvs * 128;
189 hid = hidmanager.
createHistoId(
"PedestalFromCondDB",
"det", detid);
191 ibooker.
book1D(hid, hid, nStrip, 0.5, nStrip + 0.5);
192 (local_modmes.
PedsPerStripDB)->setAxisTitle(
"Pedestal from CondDB(ADC) vs Strip Number", 1);
194 hid = hidmanager.
createHistoId(
"NoiseFromCondDB",
"det", detid);
196 (local_modmes.
CMSubNoisePerStripDB)->setAxisTitle(
"CMSubNoise from CondDB(ADC) vs Strip Number", 1);
198 hid = hidmanager.
createHistoId(
"BadStripFlagCondDB",
"det", detid);
199 local_modmes.
BadStripsDB = ibooker.
book2D(hid, hid, nStrip, 0.5, nStrip + 0.5, 6, -0.5, 5.5);
200 (local_modmes.
BadStripsDB)->setAxisTitle(
"Strip Flag from CondDB(ADC) vs Strip Number", 1);
204 hid = hidmanager.
createHistoId(
"PedsPerStrip",
"det", detid);
206 (local_modmes.
PedsPerStrip)->setAxisTitle(
"Pedestal (ADC) vs Strip Number ", 1);
208 hid = hidmanager.
createHistoId(
"PedsDistribution",
"det", detid);
218 (local_modmes.
PedsDistribution)->setAxisTitle(
"Mean Pedestal Value (ADC)", 2);
220 hid = hidmanager.
createHistoId(
"PedsEvolution",
"det", detid);
230 (local_modmes.
PedsEvolution)->setAxisTitle(
"Iteration Number", 2);
233 hid = hidmanager.
createHistoId(
"CMSubNoisePerStrip",
"det", detid);
235 (local_modmes.
CMSubNoisePerStrip)->setAxisTitle(
"CMSubNoise (ADC) vs Strip Number", 1);
237 hid = hidmanager.
createHistoId(
"RawNoisePerStrip",
"det", detid);
239 (local_modmes.
RawNoisePerStrip)->setAxisTitle(
"RawNoise(ADC) vs Strip Number", 1);
241 hid = hidmanager.
createHistoId(
"CMSubNoiseProfile",
"det", detid);
243 (local_modmes.
CMSubNoiseProfile)->setAxisTitle(
"Mean of CMSubNoise (ADC) vs Strip Number", 1);
245 hid = hidmanager.
createHistoId(
"RawNoiseProfile",
"det", detid);
247 (local_modmes.
RawNoiseProfile)->setAxisTitle(
"Mean of RawNoise (ADC) vs Strip Number", 1);
250 local_modmes.
NoisyStrips = ibooker.
book2D(hid, hid, nStrip, 0.5, nStrip + 0.5, 6, -0.5, 5.5);
251 (local_modmes.
NoisyStrips)->setAxisTitle(
"Strip Number", 1);
252 (local_modmes.
NoisyStrips)->setAxisTitle(
"Flag Value", 2);
254 hid = hidmanager.
createHistoId(
"NoisyStripDistribution",
"det", detid);
259 hid = hidmanager.
createHistoId(
"CMDistribution",
"det", detid);
260 local_modmes.
CMDistribution = ibooker.
book2D(hid, hid, napvs, -0.5, napvs - 0.5, 150, -15., 15.);
261 (local_modmes.
CMDistribution)->setAxisTitle(
"Common Mode (ADC) vs APV Number", 1);
263 hid = hidmanager.
createHistoId(
"CMSlopeDistribution",
"det", detid);
269 PedMEs.insert(std::make_pair(detid, local_modmes));
273 <<
"SiStripMonitorPedestals::createMEs: Number of DETS used " <<
PedMEs.size();
278 <<
"SiStripMonitorPedestals::analyze: Run " <<
iEvent.id().run() <<
" Event " <<
iEvent.id().event();
299 for (std::map<uint32_t, ModMEs>::const_iterator
i =
PedMEs.begin();
i !=
PedMEs.end();
i++) {
300 uint32_t detid =
i->first;
301 ModMEs local_modmes =
i->second;
304 std::vector<edm::DetSet<SiStripRawDigi>>::const_iterator digis = digi_collection->find(detid);
305 if (digis == digi_collection->end() || digis->data.empty() || digis->data.size() > 768) {
306 if (digis == digi_collection->end()) {
307 edm::LogError(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: Event " <<
nEvTot_ <<
" DetId "
308 << detid <<
" at the end of Digi Collection!!!";
310 edm::LogError(
"SiStripMonitorPedestals") <<
" [SiStripMonitorPedestals::analyze: Event " <<
nEvTot_ <<
" DetId "
311 << detid <<
" # of Digis " << digis->data.size();
314 bool firstchannel(
true);
315 for (
unsigned int k = 0;
k < fed_conns.size();
k++) {
316 if (fed_conns[
k] && fed_conns[
k]->isConnected()) {
318 edm::LogError(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: Fed Id "
319 << fed_conns[
k]->fedId() <<
" Channel " << fed_conns[
k]->fedCh();
320 firstchannel =
false;
323 <<
" SiStripMonitorPedestals::analyze: Channel " << fed_conns[
k]->fedCh();
330 if (digis->data.empty()) {
331 edm::LogError(
"MonitorDigi_tmp") <<
"[SiStripRawDigiToRaw::createFedBuffers] Zero digis found!";
339 std::vector<float>
tmp;
345 for (std::vector<float>::const_iterator iped =
tmp.begin(); iped !=
tmp.end(); iped++) {
346 int iapv =
int(ibin / numberCMBlocks);
352 std::vector<float>
tmp;
356 for (std::vector<float>::const_iterator it =
tmp.begin(); it !=
tmp.end(); it++) {
365 std::vector<float>
tmp;
369 int numberOfApvs =
int(
tmp.size() / 128.);
370 for (
int i = 0;
i < numberOfApvs;
i++) {
371 std::vector<float> myPedPerApv;
374 avarage = std::accumulate(myPedPerApv.begin(), myPedPerApv.end(), avarage);
375 avarage = avarage / 128.;
380 for (std::vector<float>::const_iterator iped =
tmp.begin(); iped !=
tmp.end(); iped++) {
381 int napv =
int(ibin / 128.);
383 float last_value = (local_modmes.
PedsPerStrip)->getBinContent(ibin);
384 if (last_value != 0.) {
385 (local_modmes.
PedsPerStrip)->setBinContent(ibin, (static_cast<float>(*iped) + last_value) / 2.);
387 (local_modmes.
PedsPerStrip)->setBinContent(ibin, static_cast<float>(*iped));
397 for (std::vector<float>::const_iterator iped =
tmp.begin(); iped !=
tmp.end(); iped++) {
402 if (last_value != 0.) {
403 (local_modmes.
CMSubNoisePerStrip)->setBinContent(ibin, (static_cast<float>(*iped) + last_value) / 2.);
414 for (std::vector<float>::const_iterator iped =
tmp.begin(); iped !=
tmp.end(); iped++) {
416 (local_modmes.
RawNoiseProfile)->
Fill(static_cast<double>(ibin * 1.), static_cast<float>(*iped));
418 if (last_value != 0.) {
419 (local_modmes.
RawNoisePerStrip)->setBinContent(ibin, (static_cast<float>(*iped) + last_value) / 2.);
421 (local_modmes.
RawNoisePerStrip)->setBinContent(ibin, static_cast<float>(*iped));
430 for (TkApvMask::MaskType::const_iterator iped =
temp.begin(); iped !=
temp.end(); iped++) {
456 if (outputMEsInRootFile) {
465 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::EndJob: "
472 std::map<uint32_t, ModMEs>::iterator
pos =
PedMEs.find(idet);
503 for (std::map<uint32_t, ModMEs>::const_iterator
i =
PedMEs.begin();
i !=
PedMEs.end();
i++) {
504 uint32_t detid =
i->first;
505 ModMEs local_modmes =
i->second;
506 edm::LogInfo(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: "
507 <<
" Get Ped/Noise/Bad Strips from CondDb for DetId " << detid;
514 for (
int istrip = 0; istrip < nStrip; ++istrip) {
519 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing "
520 "SiStripPedestalsService_.getPedestal("
521 << detid <<
"," << istrip <<
") : "
529 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing "
530 "SiStripNoiseService_.getNoise("
531 << detid <<
"," << istrip <<
") : "
539 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing "
540 "SiStripNoiseService_.getDisable("
541 << detid <<
"," << istrip <<
") : "