69 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals "
70 <<
" Constructing....... ";
81 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals "
82 <<
" Destructing...... ";
98 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::bookHistograms: "
99 <<
" Creating MEs for new Cabling ";
116 std::vector<uint32_t> SelectedDetIds;
131 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: "
132 <<
"Number of Detector Present in cabling " << SelectedDetIds.size();
134 for (std::vector<uint32_t>::const_iterator idetid = SelectedDetIds.begin(), iEnd = SelectedDetIds.end();
137 uint32_t detid = *idetid;
140 if (detid == 0 || detid == 0xFFFFFFFF) {
141 edm::LogError(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: "
142 <<
"Wrong DetId !!!!!! " << detid <<
" Neglecting !!!!!! ";
149 if (apv_pairs < 1 || apv_pairs > 3) {
150 edm::LogError(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::createMEs: Wrong APV Pairs => detId "
151 << detid <<
" APV pairs " << apv_pairs <<
" Neglecting !!!!!! ";
154 unsigned int napvs = apv_pairs * 2;
155 unsigned int nStrip = napvs * 128;
186 hid = hidmanager.
createHistoId(
"PedestalFromCondDB",
"det", detid);
188 ibooker.book1D(hid, hid, nStrip, 0.5, nStrip + 0.5);
189 (local_modmes.
PedsPerStripDB)->setAxisTitle(
"Pedestal from CondDB(ADC) vs Strip Number", 1);
191 hid = hidmanager.
createHistoId(
"NoiseFromCondDB",
"det", detid);
193 (local_modmes.
CMSubNoisePerStripDB)->setAxisTitle(
"CMSubNoise from CondDB(ADC) vs Strip Number", 1);
195 hid = hidmanager.
createHistoId(
"BadStripFlagCondDB",
"det", detid);
196 local_modmes.
BadStripsDB = ibooker.book2D(hid, hid, nStrip, 0.5, nStrip + 0.5, 6, -0.5, 5.5);
197 (local_modmes.
BadStripsDB)->setAxisTitle(
"Strip Flag from CondDB(ADC) vs Strip Number", 1);
201 hid = hidmanager.
createHistoId(
"PedsPerStrip",
"det", detid);
202 local_modmes.
PedsPerStrip = ibooker.book1D(hid, hid, nStrip, 0.5, nStrip + 0.5);
203 (local_modmes.
PedsPerStrip)->setAxisTitle(
"Pedestal (ADC) vs Strip Number ", 1);
205 hid = hidmanager.
createHistoId(
"PedsDistribution",
"det", detid);
215 (local_modmes.
PedsDistribution)->setAxisTitle(
"Mean Pedestal Value (ADC)", 2);
217 hid = hidmanager.
createHistoId(
"PedsEvolution",
"det", detid);
227 (local_modmes.
PedsEvolution)->setAxisTitle(
"Iteration Number", 2);
230 hid = hidmanager.
createHistoId(
"CMSubNoisePerStrip",
"det", detid);
231 local_modmes.
CMSubNoisePerStrip = ibooker.book1D(hid, hid, nStrip, 0.5, nStrip + 0.5);
232 (local_modmes.
CMSubNoisePerStrip)->setAxisTitle(
"CMSubNoise (ADC) vs Strip Number", 1);
234 hid = hidmanager.
createHistoId(
"RawNoisePerStrip",
"det", detid);
235 local_modmes.
RawNoisePerStrip = ibooker.book1D(hid, hid, nStrip, 0.5, nStrip + 0.5);
236 (local_modmes.
RawNoisePerStrip)->setAxisTitle(
"RawNoise(ADC) vs Strip Number", 1);
238 hid = hidmanager.
createHistoId(
"CMSubNoiseProfile",
"det", detid);
239 local_modmes.
CMSubNoiseProfile = ibooker.bookProfile(hid, hid, nStrip, 0.5, nStrip + 0.5, 100, 0., 100.);
240 (local_modmes.
CMSubNoiseProfile)->setAxisTitle(
"Mean of CMSubNoise (ADC) vs Strip Number", 1);
242 hid = hidmanager.
createHistoId(
"RawNoiseProfile",
"det", detid);
243 local_modmes.
RawNoiseProfile = ibooker.bookProfile(hid, hid, nStrip, 0.5, nStrip + 0.5, 100, 0., 100.);
244 (local_modmes.
RawNoiseProfile)->setAxisTitle(
"Mean of RawNoise (ADC) vs Strip Number", 1);
247 local_modmes.
NoisyStrips = ibooker.book2D(hid, hid, nStrip, 0.5, nStrip + 0.5, 6, -0.5, 5.5);
248 (local_modmes.
NoisyStrips)->setAxisTitle(
"Strip Number", 1);
249 (local_modmes.
NoisyStrips)->setAxisTitle(
"Flag Value", 2);
251 hid = hidmanager.
createHistoId(
"NoisyStripDistribution",
"det", detid);
256 hid = hidmanager.
createHistoId(
"CMDistribution",
"det", detid);
257 local_modmes.
CMDistribution = ibooker.book2D(hid, hid, napvs, -0.5, napvs - 0.5, 150, -15., 15.);
258 (local_modmes.
CMDistribution)->setAxisTitle(
"Common Mode (ADC) vs APV Number", 1);
260 hid = hidmanager.
createHistoId(
"CMSlopeDistribution",
"det", detid);
261 local_modmes.
CMSlopeDistribution = ibooker.book2D(hid, hid, napvs, -0.5, napvs - 0.5, 100, -0.05, 0.05);
266 PedMEs.insert(std::make_pair(detid, local_modmes));
270 <<
"SiStripMonitorPedestals::createMEs: Number of DETS used " <<
PedMEs.size();
275 <<
"SiStripMonitorPedestals::analyze: Run " <<
iEvent.id().run() <<
" Event " <<
iEvent.id().event();
296 for (std::map<uint32_t, ModMEs>::const_iterator
i =
PedMEs.begin();
i !=
PedMEs.end();
i++) {
297 uint32_t detid =
i->first;
298 ModMEs local_modmes =
i->second;
301 std::vector<edm::DetSet<SiStripRawDigi>>::const_iterator digis = digi_collection->find(detid);
302 if (digis == digi_collection->end() || digis->data.empty() || digis->data.size() > 768) {
303 if (digis == digi_collection->end()) {
304 edm::LogError(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: Event " <<
nEvTot_ <<
" DetId "
305 << detid <<
" at the end of Digi Collection!!!";
307 edm::LogError(
"SiStripMonitorPedestals") <<
" [SiStripMonitorPedestals::analyze: Event " <<
nEvTot_ <<
" DetId "
308 << detid <<
" # of Digis " << digis->data.size();
311 bool firstchannel(
true);
312 for (
unsigned int k = 0;
k < fed_conns.size();
k++) {
313 if (fed_conns[
k] && fed_conns[
k]->isConnected()) {
315 edm::LogError(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: Fed Id "
316 << fed_conns[
k]->fedId() <<
" Channel " << fed_conns[
k]->fedCh();
317 firstchannel =
false;
320 <<
" SiStripMonitorPedestals::analyze: Channel " << fed_conns[
k]->fedCh();
327 if (digis->data.empty()) {
328 edm::LogError(
"MonitorDigi_tmp") <<
"[SiStripRawDigiToRaw::createFedBuffers] Zero digis found!";
336 std::vector<float>
tmp;
342 for (std::vector<float>::const_iterator iped =
tmp.begin(); iped !=
tmp.end(); iped++) {
343 int iapv =
int(ibin / numberCMBlocks);
349 std::vector<float>
tmp;
353 for (std::vector<float>::const_iterator it =
tmp.begin(); it !=
tmp.end(); it++) {
362 std::vector<float>
tmp;
366 int numberOfApvs =
int(
tmp.size() / 128.);
367 for (
int i = 0;
i < numberOfApvs;
i++) {
368 std::vector<float> myPedPerApv;
371 avarage = std::accumulate(myPedPerApv.begin(), myPedPerApv.end(), avarage);
372 avarage = avarage / 128.;
377 for (std::vector<float>::const_iterator iped =
tmp.begin(); iped !=
tmp.end(); iped++) {
378 int napv =
int(ibin / 128.);
380 float last_value = (local_modmes.
PedsPerStrip)->getBinContent(ibin);
381 if (last_value != 0.) {
382 (local_modmes.
PedsPerStrip)->setBinContent(ibin, (static_cast<float>(*iped) + last_value) / 2.);
384 (local_modmes.
PedsPerStrip)->setBinContent(ibin, static_cast<float>(*iped));
394 for (std::vector<float>::const_iterator iped =
tmp.begin(); iped !=
tmp.end(); iped++) {
399 if (last_value != 0.) {
400 (local_modmes.
CMSubNoisePerStrip)->setBinContent(ibin, (static_cast<float>(*iped) + last_value) / 2.);
411 for (std::vector<float>::const_iterator iped =
tmp.begin(); iped !=
tmp.end(); iped++) {
413 (local_modmes.
RawNoiseProfile)->
Fill(static_cast<double>(ibin * 1.), static_cast<float>(*iped));
415 if (last_value != 0.) {
416 (local_modmes.
RawNoisePerStrip)->setBinContent(ibin, (static_cast<float>(*iped) + last_value) / 2.);
418 (local_modmes.
RawNoisePerStrip)->setBinContent(ibin, static_cast<float>(*iped));
427 for (TkApvMask::MaskType::const_iterator iped =
temp.begin(); iped !=
temp.end(); iped++) {
453 if (outputMEsInRootFile) {
462 edm::LogInfo(
"SiStripMonitorPedestals") <<
"SiStripMonitorPedestals::EndJob: "
469 std::map<uint32_t, ModMEs>::iterator
pos =
PedMEs.find(idet);
506 for (std::map<uint32_t, ModMEs>::const_iterator
i =
PedMEs.begin();
i !=
PedMEs.end();
i++) {
507 uint32_t detid =
i->first;
508 ModMEs local_modmes =
i->second;
509 edm::LogInfo(
"SiStripMonitorPedestals") <<
" SiStripMonitorPedestals::analyze: "
510 <<
" Get Ped/Noise/Bad Strips from CondDb for DetId " << detid;
517 for (
int istrip = 0; istrip < nStrip; ++istrip) {
522 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing "
523 "SiStripPedestalsService_.getPedestal("
524 << detid <<
"," << istrip <<
") : "
532 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing "
533 "SiStripNoiseService_.getNoise("
534 << detid <<
"," << istrip <<
") : "
542 edm::LogError(
"SiStripMonitorPedestals") <<
"[SiStripMonitorPedestals::analyze] cms::Exception accessing "
543 "SiStripNoiseService_.getDisable("
544 << detid <<
"," << istrip <<
") : "