File indexing completed on 2024-09-11 04:32:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <memory>
0011 #include <vector>
0012 #include <iostream>
0013 #include <string>
0014 #include <sstream>
0015
0016
0017 #include "FWCore/Utilities/interface/EDGetToken.h"
0018 #include "FWCore/Framework/interface/Frameworkfwd.h"
0019 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0020 #include "FWCore/Framework/interface/Event.h"
0021 #include "FWCore/Framework/interface/MakerMacros.h"
0022 #include "FWCore/Framework/interface/ESWatcher.h"
0023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0024
0025
0026 #include "CalibTracker/Records/interface/SiStripDetCablingRcd.h"
0027 #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h"
0028 #include "CondFormats/SiStripObjects/interface/FedChannelConnection.h"
0029
0030
0031 #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h"
0032 #include "CondFormats/DataRecord/interface/SiStripPedestalsRcd.h"
0033
0034
0035 #include "CondFormats/SiStripObjects/interface/SiStripNoises.h"
0036 #include "CondFormats/DataRecord/interface/SiStripNoisesRcd.h"
0037
0038
0039 #include "DataFormats/SiStripCommon/interface/SiStripFedKey.h"
0040
0041 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0042 #include "DataFormats/SiStripDigi/interface/SiStripRawDigi.h"
0043 #include "DataFormats/SiStripDigi/interface/SiStripProcessedRawDigi.h"
0044 #include "DataFormats/SiStripDigi/interface/SiStripDigi.h"
0045 #include "DataFormats/Common/interface/DetSetVector.h"
0046 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
0047
0048
0049 #include "EventFilter/SiStripRawToDigi/interface/SiStripFEDBuffer.h"
0050 #include "EventFilter/SiStripRawToDigi/interface/SiStripFEDBufferGenerator.h"
0051
0052
0053
0054
0055 #include "DQM/SiStripMonitorHardware/interface/SiStripSpyUtilities.h"
0056
0057
0058 #include "FWCore/ServiceRegistry/interface/Service.h"
0059 #include "CommonTools/UtilAlgos/interface/TFileService.h"
0060 #include "TH1S.h"
0061 #include "TH1D.h"
0062
0063
0064
0065
0066 enum FEDSpyHistogramType {
0067 SCOPE_MODE,
0068 PAYLOAD_RAW,
0069 REORDERED_PAYLOAD_RAW,
0070 REORDERED_MODULE_RAW,
0071 PEDESTAL_VALUES,
0072 NOISE_VALUES,
0073 POST_PEDESTAL,
0074 POST_COMMON_MODE,
0075 ZERO_SUPPRESSED_PADDED,
0076 ZERO_SUPPRESSED,
0077 VR_COMP,
0078 ZERO_SUPPRESSED_COMP
0079 };
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096 class SiStripSpyDisplayModule : public edm::one::EDAnalyzer<edm::one::SharedResources> {
0097 public:
0098 explicit SiStripSpyDisplayModule(const edm::ParameterSet&);
0099 ~SiStripSpyDisplayModule() override;
0100
0101 private:
0102 void beginJob() override;
0103 void analyze(const edm::Event&, const edm::EventSetup&) override;
0104 void endJob() override;
0105
0106 Bool_t MakeRawDigiHist_(const edm::Handle<edm::DetSetVector<SiStripRawDigi> >& digi_handle,
0107 uint32_t specifier,
0108 const TFileDirectory& dir,
0109 FEDSpyHistogramType type);
0110
0111 Bool_t MakeProcessedRawDigiHist_(const edm::Handle<edm::DetSetVector<SiStripProcessedRawDigi> >& digi_handle,
0112 uint32_t specifier,
0113 const TFileDirectory& dir,
0114 FEDSpyHistogramType type);
0115
0116 Bool_t MakeDigiHist_(const edm::Handle<edm::DetSetVector<SiStripDigi> >& digi_handle,
0117 uint32_t detID,
0118 const TFileDirectory& dir,
0119 FEDSpyHistogramType type);
0120
0121
0122 std::vector<uint32_t> detIDs_;
0123
0124
0125 edm::ESGetToken<SiStripDetCabling, SiStripDetCablingRcd> detCablingToken_;
0126 const SiStripDetCabling* detCabling_;
0127 edm::ESWatcher<SiStripDetCablingRcd> cablingWatcher_;
0128 void updateDetCabling(const SiStripDetCablingRcd& rcd);
0129
0130
0131
0132 edm::InputTag inputScopeModeRawDigiLabel_;
0133 edm::InputTag inputPayloadRawDigiLabel_;
0134 edm::InputTag inputReorderedPayloadRawDigiLabel_;
0135 edm::InputTag inputReorderedModuleRawDigiLabel_;
0136 edm::InputTag inputPedestalsLabel_;
0137 edm::InputTag inputNoisesLabel_;
0138 edm::InputTag inputPostPedestalRawDigiLabel_;
0139 edm::InputTag inputPostCMRawDigiLabel_;
0140 edm::InputTag
0141 inputZeroSuppressedRawDigiLabel_;
0142 edm::InputTag inputZeroSuppressedDigiLabel_;
0143 edm::InputTag inputCompVirginRawDigiLabel_;
0144 edm::InputTag inputCompZeroSuppressedDigiLabel_;
0145
0146 edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> >
0147 inputScopeModeRawDigiToken_;
0148 edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> >
0149 inputPayloadRawDigiToken_;
0150 edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> >
0151 inputReorderedPayloadRawDigiToken_;
0152 edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> >
0153 inputReorderedModuleRawDigiToken_;
0154 edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> > inputPedestalsToken_;
0155 edm::EDGetTokenT<edm::DetSetVector<SiStripProcessedRawDigi> > inputNoisesToken_;
0156 edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> >
0157 inputPostPedestalRawDigiToken_;
0158 edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> >
0159 inputPostCMRawDigiToken_;
0160 edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> >
0161 inputZeroSuppressedRawDigiToken_;
0162 edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> >
0163 inputZeroSuppressedDigiToken_;
0164 edm::EDGetTokenT<edm::DetSetVector<SiStripRawDigi> >
0165 inputCompVirginRawDigiToken_;
0166 edm::EDGetTokenT<edm::DetSetVector<SiStripDigi> >
0167 inputCompZeroSuppressedDigiToken_;
0168
0169
0170
0171 std::string outputFolderName_;
0172
0173 };
0174
0175
0176
0177
0178
0179 using namespace sistrip;
0180 using namespace std;
0181
0182
0183
0184
0185 SiStripSpyDisplayModule::SiStripSpyDisplayModule(const edm::ParameterSet& iConfig)
0186 : detIDs_(iConfig.getParameter<std::vector<uint32_t> >("detIDs")),
0187 detCablingToken_(esConsumes<>()),
0188 cablingWatcher_(this, &SiStripSpyDisplayModule::updateDetCabling),
0189 inputScopeModeRawDigiLabel_(iConfig.getParameter<edm::InputTag>("InputScopeModeRawDigiLabel")),
0190 inputPayloadRawDigiLabel_(iConfig.getParameter<edm::InputTag>("InputPayloadRawDigiLabel")),
0191 inputReorderedPayloadRawDigiLabel_(iConfig.getParameter<edm::InputTag>("InputReorderedPayloadRawDigiLabel")),
0192 inputReorderedModuleRawDigiLabel_(iConfig.getParameter<edm::InputTag>("InputReorderedModuleRawDigiLabel")),
0193 inputPedestalsLabel_(iConfig.getParameter<edm::InputTag>("InputPedestalsLabel")),
0194 inputNoisesLabel_(iConfig.getParameter<edm::InputTag>("InputNoisesLabel")),
0195 inputPostPedestalRawDigiLabel_(iConfig.getParameter<edm::InputTag>("InputPostPedestalRawDigiLabel")),
0196 inputPostCMRawDigiLabel_(iConfig.getParameter<edm::InputTag>("InputPostCMRawDigiLabel")),
0197 inputZeroSuppressedRawDigiLabel_(iConfig.getParameter<edm::InputTag>("InputZeroSuppressedRawDigiLabel")),
0198 inputZeroSuppressedDigiLabel_(iConfig.getParameter<edm::InputTag>("InputZeroSuppressedDigiLabel")),
0199 inputCompVirginRawDigiLabel_(iConfig.getParameter<edm::InputTag>("InputCompVirginRawDigiLabel")),
0200 inputCompZeroSuppressedDigiLabel_(iConfig.getParameter<edm::InputTag>("InputCompZeroSuppressedDigiLabel")),
0201 outputFolderName_(iConfig.getParameter<std::string>("OutputFolderName")) {
0202
0203 inputScopeModeRawDigiToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(inputScopeModeRawDigiLabel_);
0204 inputPayloadRawDigiToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(inputPayloadRawDigiLabel_);
0205 inputReorderedPayloadRawDigiToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(inputReorderedPayloadRawDigiLabel_);
0206 inputReorderedModuleRawDigiToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(inputReorderedModuleRawDigiLabel_);
0207 inputPedestalsToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(inputPedestalsLabel_);
0208 inputNoisesToken_ = consumes<edm::DetSetVector<SiStripProcessedRawDigi> >(inputNoisesLabel_);
0209 inputPostPedestalRawDigiToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(inputPostPedestalRawDigiLabel_);
0210 inputPostCMRawDigiToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(inputPostCMRawDigiLabel_);
0211 inputZeroSuppressedRawDigiToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(inputZeroSuppressedRawDigiLabel_);
0212 inputZeroSuppressedDigiToken_ = consumes<edm::DetSetVector<SiStripDigi> >(inputZeroSuppressedDigiLabel_);
0213 inputCompVirginRawDigiToken_ = consumes<edm::DetSetVector<SiStripRawDigi> >(inputCompVirginRawDigiLabel_);
0214 inputCompZeroSuppressedDigiToken_ = consumes<edm::DetSetVector<SiStripDigi> >(inputCompZeroSuppressedDigiLabel_);
0215
0216 usesResource(TFileService::kSharedResource);
0217 }
0218
0219 SiStripSpyDisplayModule::~SiStripSpyDisplayModule() {
0220
0221
0222 }
0223
0224
0225
0226
0227
0228
0229 void SiStripSpyDisplayModule::updateDetCabling(const SiStripDetCablingRcd& rcd) {
0230 detCabling_ = &rcd.get(detCablingToken_);
0231 }
0232
0233
0234 void SiStripSpyDisplayModule::beginJob() {
0235
0236 edm::Service<TFileService> fs;
0237
0238 if (!fs.isAvailable()) {
0239 throw cms::Exception("Configuration") << "TFileService not available: did you configure it ?";
0240 }
0241 }
0242
0243
0244 void SiStripSpyDisplayModule::endJob() {}
0245
0246
0247 void SiStripSpyDisplayModule::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0248 using namespace edm;
0249 using namespace std;
0250
0251 cablingWatcher_.check(iSetup);
0252
0253
0254
0255
0256 edm::Service<TFileService> fs;
0257
0258
0259 TFileDirectory an_dir = fs->mkdir(outputFolderName_);
0260
0261
0262 stringstream ev_dir_name;
0263 ev_dir_name << "run" << iEvent.id().run() << "_event" << iEvent.id().event();
0264 TFileDirectory evdir = an_dir.mkdir(ev_dir_name.str());
0265
0266
0267 if (detIDs_.empty()) {
0268
0269 if (!((inputCompZeroSuppressedDigiLabel_.label().empty()) &&
0270 (inputCompZeroSuppressedDigiLabel_.instance().empty()))) {
0271 edm::Handle<edm::DetSetVector<SiStripDigi> > czs_digis;
0272
0273 iEvent.getByToken(inputCompZeroSuppressedDigiToken_, czs_digis);
0274 std::vector<edm::DetSet<SiStripDigi> >::const_iterator digis_it = czs_digis->begin();
0275 for (; digis_it != czs_digis->end(); ++digis_it) {
0276 detIDs_.push_back(digis_it->detId());
0277 }
0278 } else if (!((inputCompVirginRawDigiLabel_.label().empty()) && (inputCompVirginRawDigiLabel_.instance().empty()))) {
0279 edm::Handle<edm::DetSetVector<SiStripRawDigi> > cvr_digis;
0280
0281 iEvent.getByToken(inputCompVirginRawDigiToken_, cvr_digis);
0282 std::vector<edm::DetSet<SiStripRawDigi> >::const_iterator digis_it = cvr_digis->begin();
0283 for (; digis_it != cvr_digis->end(); ++digis_it) {
0284 detIDs_.push_back(digis_it->detId());
0285 }
0286 }
0287 }
0288
0289
0290 for (std::vector<uint32_t>::iterator d = detIDs_.begin(); d != detIDs_.end(); ++d) {
0291
0292 const std::vector<const FedChannelConnection*>& conns = detCabling_->getConnections(*d);
0293
0294
0295 if (conns.empty()) {
0296
0297
0298 continue;
0299 }
0300
0301
0302 stringstream sss;
0303 sss << "detID_" << *d;
0304 TFileDirectory detID_dir = evdir.mkdir(sss.str());
0305
0306
0307 for (uint32_t ch = 0; ch < conns.size(); ch++) {
0308 if (conns[ch] && conns[ch]->isConnected()) {
0309
0310 stringstream ssss;
0311 ssss << sss.str() << "_APVpair_" << ch;
0312 TFileDirectory chan_dir = detID_dir.mkdir(ssss.str());
0313
0314
0315 uint32_t fedkey = SiStripFedKey::fedIndex(conns[ch]->fedId(), conns[ch]->fedCh());
0316
0317
0318
0319
0320
0321 if (!((inputScopeModeRawDigiLabel_.label().empty()) && (inputScopeModeRawDigiLabel_.instance().empty()))) {
0322
0323
0324
0325
0326 edm::Handle<edm::DetSetVector<SiStripRawDigi> > sm_rawdigis;
0327
0328 iEvent.getByToken(inputScopeModeRawDigiToken_, sm_rawdigis);
0329
0330
0331
0332
0333
0334 if (!(MakeRawDigiHist_(sm_rawdigis, fedkey, chan_dir, SCOPE_MODE))) {
0335 ;
0336 }
0337 }
0338
0339
0340
0341 if (!((inputPayloadRawDigiLabel_.label().empty()) && (inputPayloadRawDigiLabel_.instance().empty()))) {
0342 uint32_t fedindex = SiStripFedKey::fedIndex(conns[ch]->fedId(), conns[ch]->fedCh());
0343
0344 edm::Handle<edm::DetSetVector<SiStripRawDigi> > ur_rawdigis;
0345
0346 iEvent.getByToken(inputPayloadRawDigiToken_, ur_rawdigis);
0347 if (!(MakeRawDigiHist_(ur_rawdigis, fedindex, chan_dir, PAYLOAD_RAW))) {
0348 ;
0349 }
0350 }
0351
0352
0353 if (!((inputReorderedPayloadRawDigiLabel_.label().empty()) &&
0354 (inputReorderedPayloadRawDigiLabel_.instance().empty()))) {
0355 uint32_t fedkey = SiStripFedKey::fedIndex(conns[ch]->fedId(), conns[ch]->fedCh());
0356 edm::Handle<edm::DetSetVector<SiStripRawDigi> > rrp_rawdigis;
0357
0358 iEvent.getByToken(inputReorderedPayloadRawDigiToken_, rrp_rawdigis);
0359 if (!(MakeRawDigiHist_(rrp_rawdigis, fedkey, chan_dir, REORDERED_PAYLOAD_RAW))) {
0360 ;
0361 }
0362 }
0363 }
0364 }
0365
0366
0367
0368 if (!((inputReorderedModuleRawDigiLabel_.label().empty()) &&
0369 (inputReorderedModuleRawDigiLabel_.instance().empty()))) {
0370 edm::Handle<edm::DetSetVector<SiStripRawDigi> > rr_rawdigis;
0371
0372 iEvent.getByToken(inputReorderedModuleRawDigiToken_, rr_rawdigis);
0373
0374 if (!(MakeRawDigiHist_(rr_rawdigis, *d, detID_dir, REORDERED_MODULE_RAW))) {
0375 ;
0376 }
0377 }
0378
0379
0380
0381
0382 if (!((inputPedestalsLabel_.label().empty()) && (inputPedestalsLabel_.instance().empty()))) {
0383 edm::Handle<edm::DetSetVector<SiStripRawDigi> > pd_rawdigis;
0384
0385 iEvent.getByToken(inputPedestalsToken_, pd_rawdigis);
0386
0387 if (!(MakeRawDigiHist_(pd_rawdigis, *d, detID_dir, PEDESTAL_VALUES))) {
0388 ;
0389 }
0390 }
0391
0392
0393
0394 if (!((inputNoisesLabel_.label().empty()) && (inputNoisesLabel_.instance().empty()))) {
0395 edm::Handle<edm::DetSetVector<SiStripProcessedRawDigi> > pd_rawdigis;
0396
0397 iEvent.getByToken(inputNoisesToken_, pd_rawdigis);
0398
0399 if (!(MakeProcessedRawDigiHist_(pd_rawdigis, *d, detID_dir, NOISE_VALUES))) {
0400 ;
0401 }
0402 }
0403
0404
0405
0406 if (!((inputPostPedestalRawDigiLabel_.label().empty()) && (inputPostPedestalRawDigiLabel_.instance().empty()))) {
0407 edm::Handle<edm::DetSetVector<SiStripRawDigi> > pp_rawdigis;
0408
0409 iEvent.getByToken(inputPostPedestalRawDigiToken_, pp_rawdigis);
0410
0411 if (!(MakeRawDigiHist_(pp_rawdigis, *d, detID_dir, POST_PEDESTAL))) {
0412 ;
0413 }
0414 }
0415
0416
0417
0418 if (!((inputPostCMRawDigiLabel_.label().empty()) && (inputPostCMRawDigiLabel_.instance().empty()))) {
0419 edm::Handle<edm::DetSetVector<SiStripRawDigi> > pc_rawdigis;
0420
0421 iEvent.getByToken(inputPostCMRawDigiToken_, pc_rawdigis);
0422
0423 if (!(MakeRawDigiHist_(pc_rawdigis, *d, detID_dir, POST_COMMON_MODE))) {
0424 ;
0425 }
0426 }
0427
0428
0429
0430
0431
0432 if (!((inputZeroSuppressedDigiLabel_.label().empty()) && (inputZeroSuppressedDigiLabel_.instance().empty()))) {
0433
0434 edm::Handle<edm::DetSetVector<SiStripDigi> > zs_digis;
0435
0436 iEvent.getByToken(inputZeroSuppressedDigiToken_, zs_digis);
0437
0438 MakeDigiHist_(zs_digis, *d, detID_dir, ZERO_SUPPRESSED);
0439 }
0440
0441 if (!((inputCompVirginRawDigiLabel_.label().empty()) && (inputCompVirginRawDigiLabel_.instance().empty()))) {
0442
0443 edm::Handle<edm::DetSetVector<SiStripRawDigi> > cvr_digis;
0444
0445 iEvent.getByToken(inputCompVirginRawDigiToken_, cvr_digis);
0446
0447 MakeRawDigiHist_(cvr_digis, *d, detID_dir, VR_COMP);
0448 }
0449 if (!((inputCompZeroSuppressedDigiLabel_.label().empty()) &&
0450 (inputCompZeroSuppressedDigiLabel_.instance().empty()))) {
0451
0452 edm::Handle<edm::DetSetVector<SiStripDigi> > czs_digis;
0453
0454 iEvent.getByToken(inputCompZeroSuppressedDigiToken_, czs_digis);
0455
0456 MakeDigiHist_(czs_digis, *d, detID_dir, ZERO_SUPPRESSED_COMP);
0457 }
0458
0459
0460 }
0461
0462 }
0463
0464 Bool_t SiStripSpyDisplayModule::MakeRawDigiHist_(const edm::Handle<edm::DetSetVector<SiStripRawDigi> >& digi_handle,
0465 uint32_t specifier,
0466 const TFileDirectory& dir,
0467 FEDSpyHistogramType type)
0468
0469 {
0470
0471 TH1S* hist;
0472 if (type == SCOPE_MODE)
0473 hist = dir.make<TH1S>("ScopeMode", ";Sample number;ADC counts / strip", 298, 0, 298);
0474 else if (type == PAYLOAD_RAW)
0475 hist = dir.make<TH1S>("PayloadRaw", ";Sample number;ADC counts / strip", 256, 0, 256);
0476 else if (type == REORDERED_PAYLOAD_RAW)
0477 hist = dir.make<TH1S>("ReorderedPayloadRaw", ";Sample number;ADC counts / strip", 256, 0, 256);
0478 else if (type == REORDERED_MODULE_RAW)
0479 hist = dir.make<TH1S>("ReorderedModuleRaw", ";Sample number;ADC counts / strip", 768, 0, 768);
0480 else if (type == PEDESTAL_VALUES)
0481 hist = dir.make<TH1S>("PedestalValues", ";Strip number;Pedestal / strip", 768, 0, 768);
0482 else if (type == POST_PEDESTAL)
0483 hist = dir.make<TH1S>("PostPedestal", ";Strip number;ADC counts / strip", 768, 0, 768);
0484 else if (type == POST_COMMON_MODE)
0485 hist = dir.make<TH1S>("PostCommonMode", ";Strip number;ADC counts / strip", 768, 0, 768);
0486 else if (type == ZERO_SUPPRESSED_PADDED)
0487 hist = dir.make<TH1S>("ZeroSuppressedRaw", ";Strip number;ADC counts / strip", 768, 0, 768);
0488 else if (type == VR_COMP)
0489 hist = dir.make<TH1S>("VirginRawCom", ";Strip number;ADC counts / strip", 768, 0, 768);
0490 else {
0491 hist = nullptr;
0492 return false;
0493 }
0494
0495
0496
0497 std::vector<edm::DetSet<SiStripRawDigi> >::const_iterator digis_it = digi_handle->find(specifier);
0498 if (digis_it == digi_handle->end()) {
0499
0500 return false;
0501 }
0502
0503
0504
0505 edm::DetSet<SiStripRawDigi>::const_iterator idigi = digis_it->data.begin();
0506 uint32_t count = 0;
0507 for (; idigi != digis_it->data.end(); ++idigi) {
0508 count++;
0509 hist->SetBinContent(count, static_cast<int>((*idigi).adc()));
0510 }
0511 return true;
0512 }
0513
0514 Bool_t SiStripSpyDisplayModule::MakeProcessedRawDigiHist_(
0515 const edm::Handle<edm::DetSetVector<SiStripProcessedRawDigi> >& digi_handle,
0516 uint32_t specifier,
0517 const TFileDirectory& dir,
0518 FEDSpyHistogramType type)
0519
0520 {
0521
0522 TH1F* hist;
0523 if (type == NOISE_VALUES)
0524 hist = dir.make<TH1F>("NoiseValues", ";Strip number;Noise / strip", 768, 0, 768);
0525 else {
0526 hist = nullptr;
0527 return false;
0528 }
0529
0530
0531
0532 std::vector<edm::DetSet<SiStripProcessedRawDigi> >::const_iterator digis_it = digi_handle->find(specifier);
0533 if (digis_it == digi_handle->end()) {
0534
0535 return false;
0536 }
0537
0538
0539
0540 edm::DetSet<SiStripProcessedRawDigi>::const_iterator idigi = digis_it->data.begin();
0541 uint32_t count = 0;
0542 for (; idigi != digis_it->data.end(); ++idigi) {
0543 count++;
0544 hist->SetBinContent(count, static_cast<float>((*idigi).adc()));
0545 }
0546 return true;
0547 }
0548
0549 Bool_t SiStripSpyDisplayModule::MakeDigiHist_(const edm::Handle<edm::DetSetVector<SiStripDigi> >& digi_handle,
0550 uint32_t detID,
0551
0552 const TFileDirectory& dir,
0553 FEDSpyHistogramType type)
0554
0555 {
0556
0557 TH1S* hist;
0558 if (type == ZERO_SUPPRESSED)
0559 hist = dir.make<TH1S>("ZeroSuppressedDigi", ";Strip number;ADC counts / strip", 768, 0, 768);
0560 else if (type == ZERO_SUPPRESSED_COMP)
0561 hist = dir.make<TH1S>("ZeroSuppressedDigiComp", ";Strip number;ADC counts / strip", 768, 0, 768);
0562 else {
0563 hist = nullptr;
0564 return false;
0565 }
0566
0567
0568 std::vector<edm::DetSet<SiStripDigi> >::const_iterator digis_it = digi_handle->find(detID);
0569 if (digis_it == digi_handle->end()) {
0570 return false;
0571 } else {
0572
0573 }
0574
0575
0576 edm::DetSet<SiStripDigi>::const_iterator idigi = digis_it->data.begin();
0577 bool founddigi = false;
0578 for (; idigi != digis_it->data.end(); ++idigi) {
0579
0580
0581
0582
0583 hist->SetBinContent(static_cast<int>(((*idigi).strip())) + 1, static_cast<int>((*idigi).adc()));
0584 if ((*idigi).adc() > 0)
0585 founddigi = true;
0586
0587
0588 }
0589
0590 return founddigi;
0591 }
0592
0593
0594 DEFINE_FWK_MODULE(SiStripSpyDisplayModule);