diff --git a/DQM/EcalMonitorTasks/interface/ClusterTask.h b/DQM/EcalMonitorTasks/interface/ClusterTask.h index 1798abc53e150..9783f072d107b 100644 --- a/DQM/EcalMonitorTasks/interface/ClusterTask.h +++ b/DQM/EcalMonitorTasks/interface/ClusterTask.h @@ -16,8 +16,7 @@ #include -namespace ecaldqm -{ +namespace ecaldqm { class ClusterTask : public DQWorkerTask { public: ClusterTask(); @@ -38,14 +37,7 @@ namespace ecaldqm void setTokens(edm::ConsumesCollector&) override; - enum TriggerTypes { - kEcalTrigger, - kHcalTrigger, - kCSCTrigger, - kDTTrigger, - kRPCTrigger, - nTriggerTypes - }; + enum TriggerTypes { kEcalTrigger, kHcalTrigger, kCSCTrigger, kDTTrigger, kRPCTrigger, nTriggerTypes }; private: void setParams(edm::ParameterSet const&) override; @@ -67,31 +59,33 @@ namespace ecaldqm edm::EDGetTokenT L1MuGMTReadoutCollectionToken_; }; - inline bool ClusterTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kEBRecHit: - case kEERecHit: - if(_p) runOnRecHits(*static_cast(_p), _collection); - return true; - break; - case kEBBasicCluster: - case kEEBasicCluster: - if(_p) runOnBasicClusters(*static_cast const*>(_p), _collection); - return true; - break; - case kEBSuperCluster: - case kEESuperCluster: - if(_p) runOnSuperClusters(*static_cast(_p), _collection); - return true; - break; - default: - break; + inline bool ClusterTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kEBRecHit: + case kEERecHit: + if (_p) + runOnRecHits(*static_cast(_p), _collection); + return true; + break; + case kEBBasicCluster: + case kEEBasicCluster: + if (_p) + runOnBasicClusters(*static_cast const*>(_p), _collection); + return true; + break; + case kEBSuperCluster: + case kEESuperCluster: + if (_p) + runOnSuperClusters(*static_cast(_p), _collection); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif - diff --git a/DQM/EcalMonitorTasks/interface/Collections.h b/DQM/EcalMonitorTasks/interface/Collections.h index 7bf86c0c18a99..d4549389131c4 100644 --- a/DQM/EcalMonitorTasks/interface/Collections.h +++ b/DQM/EcalMonitorTasks/interface/Collections.h @@ -44,44 +44,42 @@ namespace ecaldqm { nCollections }; - std::string const collectionName[nCollections] = { - "Source", - "EcalRawData", - "EBGainErrors", - "EEGainErrors", - "EBChIdErrors", - "EEChIdErrors", - "EBGainSwitchErrors", - "EEGainSwitchErrors", - "TowerIdErrors", - "BlockSizeErrors", - "MEMTowerIdErrors", - "MEMBlockSizeErrors", - "MEMChIdErrors", - "MEMGainErrors", - "EBSrFlag", - "EESrFlag", - "EBDigi", - "EEDigi", - "PnDiodeDigi", - "TrigPrimDigi", - "TrigPrimEmulDigi", - "EBUncalibRecHit", - "EEUncalibRecHit", - "EBLaserLedUncalibRecHit", - "EELaserLedUncalibRecHit", - "EBTestPulseUncalibRecHit", - "EETestPulseUncalibRecHit", - "EBRecHit", - "EERecHit", - "EBReducedRecHit", - "EEReducedRecHit", - "EBBasicCluster", - "EEBasicCluster", - "EBSuperCluster", - "EESuperCluster" - }; + std::string const collectionName[nCollections] = {"Source", + "EcalRawData", + "EBGainErrors", + "EEGainErrors", + "EBChIdErrors", + "EEChIdErrors", + "EBGainSwitchErrors", + "EEGainSwitchErrors", + "TowerIdErrors", + "BlockSizeErrors", + "MEMTowerIdErrors", + "MEMBlockSizeErrors", + "MEMChIdErrors", + "MEMGainErrors", + "EBSrFlag", + "EESrFlag", + "EBDigi", + "EEDigi", + "PnDiodeDigi", + "TrigPrimDigi", + "TrigPrimEmulDigi", + "EBUncalibRecHit", + "EEUncalibRecHit", + "EBLaserLedUncalibRecHit", + "EELaserLedUncalibRecHit", + "EBTestPulseUncalibRecHit", + "EETestPulseUncalibRecHit", + "EBRecHit", + "EERecHit", + "EBReducedRecHit", + "EEReducedRecHit", + "EBBasicCluster", + "EEBasicCluster", + "EBSuperCluster", + "EESuperCluster"}; -} +} // namespace ecaldqm #endif diff --git a/DQM/EcalMonitorTasks/interface/DQWorkerTask.h b/DQM/EcalMonitorTasks/interface/DQWorkerTask.h index f65905b7ca873..c1df059a97d47 100644 --- a/DQM/EcalMonitorTasks/interface/DQWorkerTask.h +++ b/DQM/EcalMonitorTasks/interface/DQWorkerTask.h @@ -9,63 +9,60 @@ #include -namespace edm -{ +namespace edm { class TriggerResultsByName; class ConsumesCollector; -} +} // namespace edm -namespace ecaldqm -{ +namespace ecaldqm { struct Dependency { Collections dependant; std::set requisite; Dependency() : dependant(Collections(-1)), requisite() {} - Dependency(Collections _d, int _r1 = -1, int _r2 = -1, int _r3 = -1, int _r4 = -1) : - dependant(_d), - requisite() - { - if(_r1 >= 0) append(Collections(_r1)); - if(_r2 >= 0) append(Collections(_r2)); - if(_r3 >= 0) append(Collections(_r3)); - if(_r4 >= 0) append(Collections(_r4)); + Dependency(Collections _d, int _r1 = -1, int _r2 = -1, int _r3 = -1, int _r4 = -1) : dependant(_d), requisite() { + if (_r1 >= 0) + append(Collections(_r1)); + if (_r2 >= 0) + append(Collections(_r2)); + if (_r3 >= 0) + append(Collections(_r3)); + if (_r4 >= 0) + append(Collections(_r4)); } - void append(Collections _r) - { - if(_r != int(dependant)) requisite.insert(_r); + void append(Collections _r) { + if (_r != int(dependant)) + requisite.insert(_r); } - void append(std::set const& _s) - { - for(std::set::const_iterator sItr(_s.begin()); sItr != _s.end(); ++sItr) + void append(std::set const& _s) { + for (std::set::const_iterator sItr(_s.begin()); sItr != _s.end(); ++sItr) append(*sItr); } }; struct DependencySet { - DependencySet() : - set_() - {} - void push_back(Dependency const& _d) - { + DependencySet() : set_() {} + void push_back(Dependency const& _d) { std::vector::iterator dItr(set_.begin()); std::vector::iterator dEnd(set_.end()); - for(; dItr != dEnd; ++dItr) - if(dItr->dependant == _d.dependant) dItr->append(_d.requisite); - if(dItr == dEnd) set_.push_back(_d); + for (; dItr != dEnd; ++dItr) + if (dItr->dependant == _d.dependant) + dItr->append(_d.requisite); + if (dItr == dEnd) + set_.push_back(_d); } - std::vector formSequence() const - { + std::vector formSequence() const { std::vector sequence; - for(unsigned iD(0); iD < set_.size(); iD++){ - if(std::find(sequence.begin(), sequence.end(), set_[iD].dependant) != sequence.end()) continue; + for (unsigned iD(0); iD < set_.size(); iD++) { + if (std::find(sequence.begin(), sequence.end(), set_[iD].dependant) != sequence.end()) + continue; formSequenceFragment_(set_[iD], sequence, sequence.end()); } return sequence; } - private: + private: std::vector set_; void formSequenceFragment_(Dependency const&, std::vector&, std::vector::iterator) const; @@ -102,5 +99,5 @@ namespace ecaldqm std::set resettable_; }; -} +} // namespace ecaldqm #endif diff --git a/DQM/EcalMonitorTasks/interface/EcalDQMonitorTask.h b/DQM/EcalMonitorTasks/interface/EcalDQMonitorTask.h index eb16142cc8d3f..5ec08fbdac1ee 100644 --- a/DQM/EcalMonitorTasks/interface/EcalDQMonitorTask.h +++ b/DQM/EcalMonitorTasks/interface/EcalDQMonitorTask.h @@ -10,39 +10,41 @@ #include #include -namespace edm -{ +namespace edm { class InputTag; class ParameterSetDescription; -} +} // namespace edm class EcalDQMonitorTask : public one::DQMEDAnalyzer, public ecaldqm::EcalDQMonitor { - public: +public: EcalDQMonitorTask(edm::ParameterSet const&); - ~EcalDQMonitorTask() {} + ~EcalDQMonitorTask() override {} static void fillDescriptions(edm::ConfigurationDescriptions&); void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override; - private: +private: void endRun(edm::Run const&, edm::EventSetup const&) override; void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; void analyze(edm::Event const&, edm::EventSetup const&) override; - - typedef void (EcalDQMonitorTask::*Processor)(edm::Event const&, ecaldqm::Collections, std::set const&); - template void runOnCollection(edm::Event const&, ecaldqm::Collections, std::set const&); + typedef void (EcalDQMonitorTask::*Processor)(edm::Event const&, + ecaldqm::Collections, + std::set const&); + + template + void runOnCollection(edm::Event const&, ecaldqm::Collections, std::set const&); void formSchedule(std::vector const&, edm::ParameterSet const&); /* DATA MEMBERS */ - edm::EDGetToken collectionTokens_[ecaldqm::nCollections]; // list of EDGetTokens - std::vector > schedule_; // schedule of collections to run - bool allowMissingCollections_; // when true, skip missing collections silently + edm::EDGetToken collectionTokens_[ecaldqm::nCollections]; // list of EDGetTokens + std::vector > schedule_; // schedule of collections to run + bool allowMissingCollections_; // when true, skip missing collections silently int processedEvents_; /* TASK TIME PROFILING */ diff --git a/DQM/EcalMonitorTasks/interface/EcalFEDMonitor.h b/DQM/EcalMonitorTasks/interface/EcalFEDMonitor.h index bdde0ee0b40ce..b529b019bef8e 100644 --- a/DQM/EcalMonitorTasks/interface/EcalFEDMonitor.h +++ b/DQM/EcalMonitorTasks/interface/EcalFEDMonitor.h @@ -24,27 +24,19 @@ #include // Making the class templated temporarily, until HLT sequence can be fixed (is using EBHltTask and EEHltTask currently) -template -class EcalFEDMonitorTemp : public DQMEDAnalyzer{ - public: +template +class EcalFEDMonitorTemp : public DQMEDAnalyzer { +public: EcalFEDMonitorTemp(edm::ParameterSet const&); - ~EcalFEDMonitorTemp() {} + ~EcalFEDMonitorTemp() override {} - private: +private: void analyze(edm::Event const&, edm::EventSetup const&) override; void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override; void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; - enum MEs { - kEBOccupancy, - kEBFatal, - kEBNonFatal, - kEEOccupancy, - kEEFatal, - kEENonFatal, - nMEs - }; + enum MEs { kEBOccupancy, kEBFatal, kEBNonFatal, kEEOccupancy, kEEFatal, kEENonFatal, nMEs }; std::string folderName_; diff --git a/DQM/EcalMonitorTasks/interface/EnergyTask.h b/DQM/EcalMonitorTasks/interface/EnergyTask.h index 1540ade328eb5..65db3519a0fe1 100644 --- a/DQM/EcalMonitorTasks/interface/EnergyTask.h +++ b/DQM/EcalMonitorTasks/interface/EnergyTask.h @@ -10,7 +10,7 @@ namespace ecaldqm { class EnergyTask : public DQWorkerTask { public: EnergyTask(); - ~EnergyTask() {} + ~EnergyTask() override {} bool filterRunType(short const*) override; @@ -27,21 +27,21 @@ namespace ecaldqm { // float threshS9_; }; - inline bool EnergyTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kEBRecHit: - case kEERecHit: - if(_p) runOnRecHits(*static_cast(_p)); - return true; - break; - default: - break; + inline bool EnergyTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kEBRecHit: + case kEERecHit: + if (_p) + runOnRecHits(*static_cast(_p)); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif - diff --git a/DQM/EcalMonitorTasks/interface/IntegrityTask.h b/DQM/EcalMonitorTasks/interface/IntegrityTask.h index b6c186a11ce97..12ea52085dff8 100644 --- a/DQM/EcalMonitorTasks/interface/IntegrityTask.h +++ b/DQM/EcalMonitorTasks/interface/IntegrityTask.h @@ -8,48 +8,50 @@ #include "DataFormats/DetId/interface/DetIdCollection.h" #include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h" -namespace ecaldqm -{ +namespace ecaldqm { class IntegrityTask : public DQWorkerTask { public: IntegrityTask(); - ~IntegrityTask() {} + ~IntegrityTask() override {} void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; bool analyze(void const*, Collections) override; - template void runOnDetIdCollection(C const&, Collections); + template + void runOnDetIdCollection(C const&, Collections); void runOnElectronicsIdCollection(EcalElectronicsIdCollection const&, Collections); }; - inline bool IntegrityTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kEBGainErrors: - case kEBChIdErrors: - case kEBGainSwitchErrors: - if(_p) runOnDetIdCollection(*static_cast(_p), _collection); - return true; - case kEEGainErrors: - case kEEChIdErrors: - case kEEGainSwitchErrors: - if(_p) runOnDetIdCollection(*static_cast(_p), _collection); - return true; - break; - case kTowerIdErrors: - case kBlockSizeErrors: - if(_p) runOnElectronicsIdCollection(*static_cast(_p), _collection); - return true; - break; - default: - break; + inline bool IntegrityTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kEBGainErrors: + case kEBChIdErrors: + case kEBGainSwitchErrors: + if (_p) + runOnDetIdCollection(*static_cast(_p), _collection); + return true; + case kEEGainErrors: + case kEEChIdErrors: + case kEEGainSwitchErrors: + if (_p) + runOnDetIdCollection(*static_cast(_p), _collection); + return true; + break; + case kTowerIdErrors: + case kBlockSizeErrors: + if (_p) + runOnElectronicsIdCollection(*static_cast(_p), _collection); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif - diff --git a/DQM/EcalMonitorTasks/interface/LaserTask.h b/DQM/EcalMonitorTasks/interface/LaserTask.h index 5a55c0af508fd..cc92ad773ae1c 100644 --- a/DQM/EcalMonitorTasks/interface/LaserTask.h +++ b/DQM/EcalMonitorTasks/interface/LaserTask.h @@ -14,7 +14,7 @@ namespace ecaldqm { class LaserTask : public DQWorkerTask { public: LaserTask(); - ~LaserTask() {} + ~LaserTask() override {} void addDependencies(DependencySet&) override; @@ -27,16 +27,12 @@ namespace ecaldqm { bool analyze(void const*, Collections) override; void runOnRawData(EcalRawDataCollection const&); - template void runOnDigis(DigiCollection const&); + template + void runOnDigis(DigiCollection const&); void runOnPnDigis(EcalPnDiodeDigiCollection const&); void runOnUncalibRecHits(EcalUncalibratedRecHitCollection const&); - enum Wavelength{ - kGreen, - kBlue, - kIRed, - nWavelength - }; + enum Wavelength { kGreen, kBlue, kIRed, nWavelength }; private: void setParams(edm::ParameterSet const&) override; @@ -53,35 +49,40 @@ namespace ecaldqm { int maxPedestal_; }; - inline bool LaserTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kEcalRawData: - if(_p) runOnRawData(*static_cast(_p)); - return true; - break; - case kEBDigi: - if(_p) runOnDigis(*static_cast(_p)); - return true; - break; - case kEEDigi: - if(_p) runOnDigis(*static_cast(_p)); - return true; - break; - case kPnDiodeDigi: - if(_p) runOnPnDigis(*static_cast(_p)); - return true; - break; - case kEBLaserLedUncalibRecHit: - case kEELaserLedUncalibRecHit: - if(_p) runOnUncalibRecHits(*static_cast(_p)); - return true; - break; - default: - break; + inline bool LaserTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kEcalRawData: + if (_p) + runOnRawData(*static_cast(_p)); + return true; + break; + case kEBDigi: + if (_p) + runOnDigis(*static_cast(_p)); + return true; + break; + case kEEDigi: + if (_p) + runOnDigis(*static_cast(_p)); + return true; + break; + case kPnDiodeDigi: + if (_p) + runOnPnDigis(*static_cast(_p)); + return true; + break; + case kEBLaserLedUncalibRecHit: + case kEELaserLedUncalibRecHit: + if (_p) + runOnUncalibRecHits(*static_cast(_p)); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif diff --git a/DQM/EcalMonitorTasks/interface/LedTask.h b/DQM/EcalMonitorTasks/interface/LedTask.h index 7ed5fc726405c..6b7a33b5b7e6c 100644 --- a/DQM/EcalMonitorTasks/interface/LedTask.h +++ b/DQM/EcalMonitorTasks/interface/LedTask.h @@ -14,7 +14,7 @@ namespace ecaldqm { class LedTask : public DQWorkerTask { public: LedTask(); - ~LedTask() {} + ~LedTask() override {} void addDependencies(DependencySet&) override; @@ -32,6 +32,7 @@ namespace ecaldqm { void runOnUncalibRecHits(EcalUncalibratedRecHitCollection const&); void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + private: void setParams(edm::ParameterSet const&) override; @@ -44,34 +45,38 @@ namespace ecaldqm { int emptyLS_; int emptyLSLimit_; - int isemptyLS; + int isemptyLS; }; - inline bool LedTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kEcalRawData: - if(_p) runOnRawData(*static_cast(_p)); - return true; - break; - case kEEDigi: - if(_p) runOnDigis(*static_cast(_p)); - return true; - break; - case kPnDiodeDigi: - if(_p) runOnPnDigis(*static_cast(_p)); - return true; - break; - case kEELaserLedUncalibRecHit: - if(_p) runOnUncalibRecHits(*static_cast(_p)); - return true; - break; - default: - break; + inline bool LedTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kEcalRawData: + if (_p) + runOnRawData(*static_cast(_p)); + return true; + break; + case kEEDigi: + if (_p) + runOnDigis(*static_cast(_p)); + return true; + break; + case kPnDiodeDigi: + if (_p) + runOnPnDigis(*static_cast(_p)); + return true; + break; + case kEELaserLedUncalibRecHit: + if (_p) + runOnUncalibRecHits(*static_cast(_p)); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif diff --git a/DQM/EcalMonitorTasks/interface/OccupancyTask.h b/DQM/EcalMonitorTasks/interface/OccupancyTask.h index 25f7edf796301..2ab22d558bd44 100644 --- a/DQM/EcalMonitorTasks/interface/OccupancyTask.h +++ b/DQM/EcalMonitorTasks/interface/OccupancyTask.h @@ -7,12 +7,11 @@ #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" -namespace ecaldqm -{ +namespace ecaldqm { class OccupancyTask : public DQWorkerTask { public: OccupancyTask(); - ~OccupancyTask() {} + ~OccupancyTask() override {} bool filterRunType(short const*) override; @@ -21,7 +20,8 @@ namespace ecaldqm bool analyze(void const*, Collections) override; void runOnRawData(EcalRawDataCollection const&); - template void runOnDigis(DigiCollection const&, Collections); + template + void runOnDigis(DigiCollection const&, Collections); void runOnTPDigis(EcalTrigPrimDigiCollection const&); void runOnRecHits(EcalRecHitCollection const&, Collections); @@ -32,35 +32,39 @@ namespace ecaldqm float tpThreshold_; }; - inline bool OccupancyTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kEcalRawData: - if(_p) runOnRawData(*static_cast(_p)); - return true; - case kEBDigi: - if(_p) runOnDigis(*static_cast(_p), _collection); - return true; - break; - case kEEDigi: - if(_p) runOnDigis(*static_cast(_p), _collection); - return true; - break; - case kTrigPrimDigi: - if(_p) runOnTPDigis(*static_cast(_p)); - return true; - break; - case kEBRecHit: - case kEERecHit: - if(_p) runOnRecHits(*static_cast(_p), _collection); - return true; - break; - default: - break; + inline bool OccupancyTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kEcalRawData: + if (_p) + runOnRawData(*static_cast(_p)); + return true; + case kEBDigi: + if (_p) + runOnDigis(*static_cast(_p), _collection); + return true; + break; + case kEEDigi: + if (_p) + runOnDigis(*static_cast(_p), _collection); + return true; + break; + case kTrigPrimDigi: + if (_p) + runOnTPDigis(*static_cast(_p)); + return true; + break; + case kEBRecHit: + case kEERecHit: + if (_p) + runOnRecHits(*static_cast(_p), _collection); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif - diff --git a/DQM/EcalMonitorTasks/interface/PNDiodeTask.h b/DQM/EcalMonitorTasks/interface/PNDiodeTask.h index b8db8a2d17f68..ce7b19f25452a 100644 --- a/DQM/EcalMonitorTasks/interface/PNDiodeTask.h +++ b/DQM/EcalMonitorTasks/interface/PNDiodeTask.h @@ -13,7 +13,7 @@ namespace ecaldqm { class PNDiodeTask : public DQWorkerTask { public: PNDiodeTask(); - ~PNDiodeTask() {} + ~PNDiodeTask() override {} bool filterRunType(short const*) override; @@ -26,27 +26,28 @@ namespace ecaldqm { bool enable_[ecaldqm::nDCC]; }; - inline bool PNDiodeTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kMEMTowerIdErrors: - case kMEMBlockSizeErrors: - case kMEMChIdErrors: - case kMEMGainErrors: - if(_p) runOnErrors(*static_cast(_p), _collection); - return true; - break; - case kPnDiodeDigi: - if(_p) runOnPnDigis(*static_cast(_p)); - return true; - break; - default: - break; + inline bool PNDiodeTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kMEMTowerIdErrors: + case kMEMBlockSizeErrors: + case kMEMChIdErrors: + case kMEMGainErrors: + if (_p) + runOnErrors(*static_cast(_p), _collection); + return true; + break; + case kPnDiodeDigi: + if (_p) + runOnPnDigis(*static_cast(_p)); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif - diff --git a/DQM/EcalMonitorTasks/interface/PedestalTask.h b/DQM/EcalMonitorTasks/interface/PedestalTask.h index 63d6cdf2cc16e..18a740aa14558 100644 --- a/DQM/EcalMonitorTasks/interface/PedestalTask.h +++ b/DQM/EcalMonitorTasks/interface/PedestalTask.h @@ -12,13 +12,14 @@ namespace ecaldqm { class PedestalTask : public DQWorkerTask { public: PedestalTask(); - ~PedestalTask() {} + ~PedestalTask() override {} bool filterRunType(short const*) override; bool analyze(void const*, Collections) override; - template void runOnDigis(DigiCollection const&); + template + void runOnDigis(DigiCollection const&); void runOnPnDigis(EcalPnDiodeDigiCollection const&); private: @@ -30,27 +31,30 @@ namespace ecaldqm { bool enable_[nDCC]; }; - inline bool PedestalTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kEBDigi: - if(_p) runOnDigis(*static_cast(_p)); - return true; - break; - case kEEDigi: - if(_p) runOnDigis(*static_cast(_p)); - return true; - break; - case kPnDiodeDigi: - if(_p) runOnPnDigis(*static_cast(_p)); - return true; - break; - default: - break; + inline bool PedestalTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kEBDigi: + if (_p) + runOnDigis(*static_cast(_p)); + return true; + break; + case kEEDigi: + if (_p) + runOnDigis(*static_cast(_p)); + return true; + break; + case kPnDiodeDigi: + if (_p) + runOnPnDigis(*static_cast(_p)); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif diff --git a/DQM/EcalMonitorTasks/interface/PresampleTask.h b/DQM/EcalMonitorTasks/interface/PresampleTask.h index e70706bae8dfd..e4bce5d61b7d3 100644 --- a/DQM/EcalMonitorTasks/interface/PresampleTask.h +++ b/DQM/EcalMonitorTasks/interface/PresampleTask.h @@ -6,18 +6,18 @@ #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h" #include "DataFormats/EcalDigi/interface/EcalDataFrame.h" -namespace ecaldqm -{ +namespace ecaldqm { class PresampleTask : public DQWorkerTask { public: PresampleTask(); - ~PresampleTask() {} + ~PresampleTask() override {} bool filterRunType(short const*) override; bool analyze(void const*, Collections) override; - template void runOnDigis(DigiCollection const&); + template + void runOnDigis(DigiCollection const&); private: void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; @@ -29,22 +29,23 @@ namespace ecaldqm MESet* mePedestalByLS; }; - inline bool PresampleTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kEBDigi: - if(_p) runOnDigis(*static_cast(_p)); - return true; - case kEEDigi: - if(_p) runOnDigis(*static_cast(_p)); - return true; - break; - default: - break; + inline bool PresampleTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kEBDigi: + if (_p) + runOnDigis(*static_cast(_p)); + return true; + case kEEDigi: + if (_p) + runOnDigis(*static_cast(_p)); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif - diff --git a/DQM/EcalMonitorTasks/interface/RawDataTask.h b/DQM/EcalMonitorTasks/interface/RawDataTask.h index 5c47ae7937240..5892550bd2d39 100644 --- a/DQM/EcalMonitorTasks/interface/RawDataTask.h +++ b/DQM/EcalMonitorTasks/interface/RawDataTask.h @@ -8,12 +8,11 @@ #include "DataFormats/Provenance/interface/RunID.h" -namespace ecaldqm -{ +namespace ecaldqm { class RawDataTask : public DQWorkerTask { public: RawDataTask(); - ~RawDataTask() {} + ~RawDataTask() override {} void addDependencies(DependencySet&) override; @@ -26,37 +25,35 @@ namespace ecaldqm void runOnSource(FEDRawDataCollection const&); void runOnRawData(EcalRawDataCollection const&); - enum Constants { - nEventTypes = 25 - }; + enum Constants { nEventTypes = 25 }; private: - edm::RunNumber_t runNumber_; // run number needed regardless of single-/multi-thread operation + edm::RunNumber_t runNumber_; // run number needed regardless of single-/multi-thread operation int l1A_; int orbit_; int bx_; short triggerType_; int feL1Offset_; - }; - inline bool RawDataTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kSource: - if(_p) runOnSource(*static_cast(_p)); - return true; - break; - case kEcalRawData: - if(_p) runOnRawData(*static_cast(_p)); - return true; - break; - default: - break; + inline bool RawDataTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kSource: + if (_p) + runOnSource(*static_cast(_p)); + return true; + break; + case kEcalRawData: + if (_p) + runOnRawData(*static_cast(_p)); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif - diff --git a/DQM/EcalMonitorTasks/interface/RecoSummaryTask.h b/DQM/EcalMonitorTasks/interface/RecoSummaryTask.h index 8399c60ffa339..569f550f41835 100644 --- a/DQM/EcalMonitorTasks/interface/RecoSummaryTask.h +++ b/DQM/EcalMonitorTasks/interface/RecoSummaryTask.h @@ -13,7 +13,7 @@ namespace ecaldqm { class RecoSummaryTask : public DQWorkerTask { public: RecoSummaryTask(); - ~RecoSummaryTask() {} + ~RecoSummaryTask() override {} bool filterRunType(short const*) override; @@ -35,30 +35,32 @@ namespace ecaldqm { EcalRecHitCollection const* eeHits_; }; - inline bool RecoSummaryTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kEBRecHit: - case kEERecHit: - if(_p) runOnRecHits(*static_cast(_p), _collection); - return true; - break; - case kEBReducedRecHit: - case kEEReducedRecHit: - if(_p) runOnReducedRecHits(*static_cast(_p), _collection); - return true; - break; - case kEBBasicCluster: - case kEEBasicCluster: - if(_p) runOnBasicClusters(*static_cast const*>(_p), _collection); - return true; - break; - default: - break; + inline bool RecoSummaryTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kEBRecHit: + case kEERecHit: + if (_p) + runOnRecHits(*static_cast(_p), _collection); + return true; + break; + case kEBReducedRecHit: + case kEEReducedRecHit: + if (_p) + runOnReducedRecHits(*static_cast(_p), _collection); + return true; + break; + case kEBBasicCluster: + case kEEBasicCluster: + if (_p) + runOnBasicClusters(*static_cast const*>(_p), _collection); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif - diff --git a/DQM/EcalMonitorTasks/interface/SelectiveReadoutTask.h b/DQM/EcalMonitorTasks/interface/SelectiveReadoutTask.h index 62bc537ab29c2..7adaa8505b118 100644 --- a/DQM/EcalMonitorTasks/interface/SelectiveReadoutTask.h +++ b/DQM/EcalMonitorTasks/interface/SelectiveReadoutTask.h @@ -18,7 +18,7 @@ namespace ecaldqm { class SelectiveReadoutTask : public DQWorkerTask { public: SelectiveReadoutTask(); - ~SelectiveReadoutTask() {} + ~SelectiveReadoutTask() override {} void addDependencies(DependencySet&) override; @@ -29,8 +29,10 @@ namespace ecaldqm { void runOnSource(FEDRawDataCollection const&); void runOnRawData(EcalRawDataCollection const&); - template void runOnSrFlags(SRFlagCollection const&, Collections); - template void runOnDigis(DigiCollection const&, Collections); + template + void runOnSrFlags(SRFlagCollection const&, Collections); + template + void runOnDigis(DigiCollection const&, Collections); enum Constants { nFIRTaps = 6, @@ -51,39 +53,44 @@ namespace ecaldqm { std::vector flags_; }; - inline bool SelectiveReadoutTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kSource: - if(_p) runOnSource(*static_cast(_p)); - return true; - break; - case kEcalRawData: - if(_p) runOnRawData(*static_cast(_p)); - return true; - break; - case kEBSrFlag: - if(_p) runOnSrFlags(*static_cast(_p), _collection); - return true; - break; - case kEESrFlag: - if(_p) runOnSrFlags(*static_cast(_p), _collection); - return true; - break; - case kEBDigi: - if(_p) runOnDigis(*static_cast(_p), _collection); - return true; - break; - case kEEDigi: - if(_p) runOnDigis(*static_cast(_p), _collection); - return true; - break; - default: - break; + inline bool SelectiveReadoutTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kSource: + if (_p) + runOnSource(*static_cast(_p)); + return true; + break; + case kEcalRawData: + if (_p) + runOnRawData(*static_cast(_p)); + return true; + break; + case kEBSrFlag: + if (_p) + runOnSrFlags(*static_cast(_p), _collection); + return true; + break; + case kEESrFlag: + if (_p) + runOnSrFlags(*static_cast(_p), _collection); + return true; + break; + case kEBDigi: + if (_p) + runOnDigis(*static_cast(_p), _collection); + return true; + break; + case kEEDigi: + if (_p) + runOnDigis(*static_cast(_p), _collection); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif - diff --git a/DQM/EcalMonitorTasks/interface/TestPulseTask.h b/DQM/EcalMonitorTasks/interface/TestPulseTask.h index a545a2665ca46..1610b6bd7da0b 100644 --- a/DQM/EcalMonitorTasks/interface/TestPulseTask.h +++ b/DQM/EcalMonitorTasks/interface/TestPulseTask.h @@ -14,7 +14,7 @@ namespace ecaldqm { class TestPulseTask : public DQWorkerTask { public: TestPulseTask(); - ~TestPulseTask() {} + ~TestPulseTask() override {} bool filterRunType(short const*) override; @@ -23,7 +23,8 @@ namespace ecaldqm { bool analyze(void const*, Collections) override; void runOnRawData(EcalRawDataCollection const&); - template void runOnDigis(DigiCollection const&); + template + void runOnDigis(DigiCollection const&); void runOnPnDigis(EcalPnDiodeDigiCollection const&); void runOnUncalibRecHits(EcalUncalibratedRecHitCollection const&); @@ -37,35 +38,40 @@ namespace ecaldqm { int gain_[nDCC]; }; - inline bool TestPulseTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kEcalRawData: - if(_p) runOnRawData(*static_cast(_p)); - return true; - break; - case kEBDigi: - if(_p) runOnDigis(*static_cast(_p)); - return true; - break; - case kEEDigi: - if(_p) runOnDigis(*static_cast(_p)); - return true; - break; - case kPnDiodeDigi: - if(_p) runOnPnDigis(*static_cast(_p)); - return true; - break; - case kEBTestPulseUncalibRecHit: - case kEETestPulseUncalibRecHit: - if(_p) runOnUncalibRecHits(*static_cast(_p)); - return true; - break; - default: - break; + inline bool TestPulseTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kEcalRawData: + if (_p) + runOnRawData(*static_cast(_p)); + return true; + break; + case kEBDigi: + if (_p) + runOnDigis(*static_cast(_p)); + return true; + break; + case kEEDigi: + if (_p) + runOnDigis(*static_cast(_p)); + return true; + break; + case kPnDiodeDigi: + if (_p) + runOnPnDigis(*static_cast(_p)); + return true; + break; + case kEBTestPulseUncalibRecHit: + case kEETestPulseUncalibRecHit: + if (_p) + runOnUncalibRecHits(*static_cast(_p)); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif diff --git a/DQM/EcalMonitorTasks/interface/TimingTask.h b/DQM/EcalMonitorTasks/interface/TimingTask.h index 529d875ae7948..fd3d73e6f9f4b 100644 --- a/DQM/EcalMonitorTasks/interface/TimingTask.h +++ b/DQM/EcalMonitorTasks/interface/TimingTask.h @@ -10,7 +10,7 @@ namespace ecaldqm { class TimingTask : public DQWorkerTask { public: TimingTask(); - ~TimingTask() {} + ~TimingTask() override {} bool filterRunType(short const*) override; @@ -38,25 +38,26 @@ namespace ecaldqm { MESet* meTimeMapByLS; }; - inline bool TimingTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kEBRecHit: - case kEERecHit: - if(_p) runOnRecHits(*static_cast(_p), _collection); - return true; - break; - case kEBUncalibRecHit: - case kEEUncalibRecHit: - if(_p) runOnUncalibRecHits(*static_cast(_p)); - return true; - break; - default: - break; + inline bool TimingTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kEBRecHit: + case kEERecHit: + if (_p) + runOnRecHits(*static_cast(_p), _collection); + return true; + break; + case kEBUncalibRecHit: + case kEEUncalibRecHit: + if (_p) + runOnUncalibRecHits(*static_cast(_p)); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif - diff --git a/DQM/EcalMonitorTasks/interface/TrigPrimTask.h b/DQM/EcalMonitorTasks/interface/TrigPrimTask.h index ff395671d2bc5..e546b08d774c5 100644 --- a/DQM/EcalMonitorTasks/interface/TrigPrimTask.h +++ b/DQM/EcalMonitorTasks/interface/TrigPrimTask.h @@ -19,7 +19,7 @@ namespace ecaldqm { class TrigPrimTask : public DQWorkerTask { public: TrigPrimTask(); - ~TrigPrimTask() {} + ~TrigPrimTask() override {} void addDependencies(DependencySet&) override; @@ -31,13 +31,12 @@ namespace ecaldqm { void runOnRealTPs(EcalTrigPrimDigiCollection const&); void runOnEmulTPs(EcalTrigPrimDigiCollection const&); - template void runOnDigis(DigiCollection const&); + template + void runOnDigis(DigiCollection const&); void setTokens(edm::ConsumesCollector&) override; - enum Constants { - nBXBins = 15 - }; + enum Constants { nBXBins = 15 }; private: void setParams(edm::ParameterSet const&) override; @@ -46,12 +45,12 @@ namespace ecaldqm { bool runOnEmul_; -/* std::string HLTCaloPath_; */ -/* std::string HLTMuonPath_; */ -/* bool HLTCaloBit_; */ -/* bool HLTMuonBit_; */ + /* std::string HLTCaloPath_; */ + /* std::string HLTMuonPath_; */ + /* bool HLTCaloBit_; */ + /* bool HLTMuonBit_; */ - std::array bxBinEdges_; + std::array bxBinEdges_; double bxBin_; std::map towerReadouts_; @@ -62,34 +61,36 @@ namespace ecaldqm { edm::InputTag lhcStatusInfoCollectionTag_; edm::EDGetTokenT lhcStatusInfoRecordToken_; bool lhcStatusSet_; - }; - inline bool TrigPrimTask::analyze(void const* _p, Collections _collection){ - switch(_collection){ - case kTrigPrimDigi: - if(_p) runOnRealTPs(*static_cast(_p)); - return true; - break; - case kTrigPrimEmulDigi: - if(_p && runOnEmul_) runOnEmulTPs(*static_cast(_p)); - return runOnEmul_; - break; - case kEBDigi: - if(_p) runOnDigis(*static_cast(_p)); - return true; - break; - case kEEDigi: - if(_p) runOnDigis(*static_cast(_p)); - return true; - break; - default: - break; + inline bool TrigPrimTask::analyze(void const* _p, Collections _collection) { + switch (_collection) { + case kTrigPrimDigi: + if (_p) + runOnRealTPs(*static_cast(_p)); + return true; + break; + case kTrigPrimEmulDigi: + if (_p && runOnEmul_) + runOnEmulTPs(*static_cast(_p)); + return runOnEmul_; + break; + case kEBDigi: + if (_p) + runOnDigis(*static_cast(_p)); + return true; + break; + case kEEDigi: + if (_p) + runOnDigis(*static_cast(_p)); + return true; + break; + default: + break; } return false; } -} +} // namespace ecaldqm #endif - diff --git a/DQM/EcalMonitorTasks/plugins/EcalDQMonitorTask.cc b/DQM/EcalMonitorTasks/plugins/EcalDQMonitorTask.cc index 10a6eca664cf3..18f7351ec9107 100644 --- a/DQM/EcalMonitorTasks/plugins/EcalDQMonitorTask.cc +++ b/DQM/EcalMonitorTasks/plugins/EcalDQMonitorTask.cc @@ -24,68 +24,68 @@ #include #include -EcalDQMonitorTask::EcalDQMonitorTask(edm::ParameterSet const& _ps) : - DQMEDAnalyzer(), - ecaldqm::EcalDQMonitor(_ps), - schedule_(), - allowMissingCollections_(_ps.getUntrackedParameter("allowMissingCollections")), - processedEvents_(0), - lastResetTime_(0), - resetInterval_(_ps.getUntrackedParameter("resetInterval")) -{ +EcalDQMonitorTask::EcalDQMonitorTask(edm::ParameterSet const& _ps) + : DQMEDAnalyzer(), + ecaldqm::EcalDQMonitor(_ps), + schedule_(), + allowMissingCollections_(_ps.getUntrackedParameter("allowMissingCollections")), + processedEvents_(0), + lastResetTime_(0), + resetInterval_(_ps.getUntrackedParameter("resetInterval")) { ecaldqm::DependencySet dependencies; std::bitset hasTaskToRun; edm::ConsumesCollector collector(consumesCollector()); - executeOnWorkers_([&dependencies, &hasTaskToRun, &collector](ecaldqm::DQWorker* worker){ - ecaldqm::DQWorkerTask* task(dynamic_cast(worker)); - if(!task) - throw cms::Exception("InvalidConfiguration") << "Non-task DQWorker " << worker->getName() << " passed"; + executeOnWorkers_( + [&dependencies, &hasTaskToRun, &collector](ecaldqm::DQWorker* worker) { + ecaldqm::DQWorkerTask* task(dynamic_cast(worker)); + if (!task) + throw cms::Exception("InvalidConfiguration") << "Non-task DQWorker " << worker->getName() << " passed"; - task->addDependencies(dependencies); - for(unsigned iCol(0); iCol < ecaldqm::nCollections; ++iCol){ - if(task->analyze(nullptr, ecaldqm::Collections(iCol))) // "dry run" mode - hasTaskToRun.set(iCol); - } + task->addDependencies(dependencies); + for (unsigned iCol(0); iCol < ecaldqm::nCollections; ++iCol) { + if (task->analyze(nullptr, ecaldqm::Collections(iCol))) // "dry run" mode + hasTaskToRun.set(iCol); + } - task->setTokens(collector); - }, "initialization"); + task->setTokens(collector); + }, + "initialization"); edm::ParameterSet const& collectionTags(_ps.getUntrackedParameterSet("collectionTags")); - for(unsigned iCol(0); iCol < ecaldqm::nCollections; iCol++){ - if(hasTaskToRun[iCol]) + for (unsigned iCol(0); iCol < ecaldqm::nCollections; iCol++) { + if (hasTaskToRun[iCol]) dependencies.push_back(ecaldqm::Dependency(ecaldqm::Collections(iCol))); } - if(collectionTags.existsAs("EcalRawData", false)) + if (collectionTags.existsAs("EcalRawData", false)) dependencies.push_back(ecaldqm::Dependency(ecaldqm::kEcalRawData)); formSchedule(dependencies.formSequence(), collectionTags); - if(verbosity_ > 0){ + if (verbosity_ > 0) { std::stringstream ss; ss << moduleName_ << ": Using collections" << std::endl; - for(unsigned iCol(0); iCol < schedule_.size(); iCol++) + for (unsigned iCol(0); iCol < schedule_.size(); iCol++) ss << ecaldqm::collectionName[schedule_[iCol].second] << std::endl; edm::LogInfo("EcalDQM") << ss.str(); } edm::ParameterSet const& commonParams(_ps.getUntrackedParameterSet("commonParameters")); - if(commonParams.getUntrackedParameter("onlineMode")) + if (commonParams.getUntrackedParameter("onlineMode")) lastResetTime_ = time(nullptr); } /*static*/ -void -EcalDQMonitorTask::fillDescriptions(edm::ConfigurationDescriptions& _descs) -{ +void EcalDQMonitorTask::fillDescriptions(edm::ConfigurationDescriptions& _descs) { edm::ParameterSetDescription desc; ecaldqm::EcalDQMonitor::fillDescriptions(desc); edm::ParameterSetDescription taskParameters; ecaldqm::DQWorkerTask::fillDescriptions(taskParameters); edm::ParameterSetDescription allWorkers; - allWorkers.addNode(edm::ParameterWildcard("*", edm::RequireZeroOrMore, false, taskParameters)); + allWorkers.addNode( + edm::ParameterWildcard("*", edm::RequireZeroOrMore, false, taskParameters)); desc.addUntracked("workerParameters", allWorkers); edm::ParameterSetDescription collectionTags; @@ -98,128 +98,126 @@ EcalDQMonitorTask::fillDescriptions(edm::ConfigurationDescriptions& _descs) _descs.addDefault(desc); } -void -EcalDQMonitorTask::bookHistograms(DQMStore::IBooker& _ibooker, edm::Run const&, edm::EventSetup const& _es) -{ +void EcalDQMonitorTask::bookHistograms(DQMStore::IBooker& _ibooker, edm::Run const&, edm::EventSetup const& _es) { ecaldqmGetSetupObjects(_es); - executeOnWorkers_([&_ibooker](ecaldqm::DQWorker* worker){ - worker->bookMEs(_ibooker); - }, "bookMEs", "Booking MEs"); + executeOnWorkers_([&_ibooker](ecaldqm::DQWorker* worker) { worker->bookMEs(_ibooker); }, "bookMEs", "Booking MEs"); } -void -EcalDQMonitorTask::dqmBeginRun(edm::Run const& _run, edm::EventSetup const& _es) -{ +void EcalDQMonitorTask::dqmBeginRun(edm::Run const& _run, edm::EventSetup const& _es) { ecaldqmBeginRun(_run, _es); processedEvents_ = 0; - if(lastResetTime_ != 0) lastResetTime_ = time(nullptr); + if (lastResetTime_ != 0) + lastResetTime_ = time(nullptr); } -void -EcalDQMonitorTask::endRun(edm::Run const& _run, edm::EventSetup const& _es) -{ - if(lastResetTime_ != 0) - executeOnWorkers_([](ecaldqm::DQWorker* worker){ - static_cast(worker)->recoverStats(); - }, "recoverStats"); +void EcalDQMonitorTask::endRun(edm::Run const& _run, edm::EventSetup const& _es) { + if (lastResetTime_ != 0) + executeOnWorkers_([](ecaldqm::DQWorker* worker) { static_cast(worker)->recoverStats(); }, + "recoverStats"); ecaldqmEndRun(_run, _es); - executeOnWorkers_([](ecaldqm::DQWorker* worker){ - worker->releaseMEs(); - }, "releaseMEs", "releasing histograms"); + executeOnWorkers_([](ecaldqm::DQWorker* worker) { worker->releaseMEs(); }, "releaseMEs", "releasing histograms"); } -void -EcalDQMonitorTask::beginLuminosityBlock(edm::LuminosityBlock const& _lumi, edm::EventSetup const& _es) -{ +void EcalDQMonitorTask::beginLuminosityBlock(edm::LuminosityBlock const& _lumi, edm::EventSetup const& _es) { ecaldqmBeginLuminosityBlock(_lumi, _es); } -void -EcalDQMonitorTask::endLuminosityBlock(edm::LuminosityBlock const& _lumi, edm::EventSetup const& _es) -{ +void EcalDQMonitorTask::endLuminosityBlock(edm::LuminosityBlock const& _lumi, edm::EventSetup const& _es) { ecaldqmEndLuminosityBlock(_lumi, _es); - - if(lastResetTime_ != 0 && (time(nullptr) - lastResetTime_) / 3600. > resetInterval_){ - if(verbosity_ > 0) edm::LogInfo("EcalDQM") << moduleName_ << ": Soft-resetting the histograms"; - executeOnWorkers_([](ecaldqm::DQWorker* worker){ - static_cast(worker)->softReset(); - }, "softReset"); + + if (lastResetTime_ != 0 && (time(nullptr) - lastResetTime_) / 3600. > resetInterval_) { + if (verbosity_ > 0) + edm::LogInfo("EcalDQM") << moduleName_ << ": Soft-resetting the histograms"; + executeOnWorkers_([](ecaldqm::DQWorker* worker) { static_cast(worker)->softReset(); }, + "softReset"); lastResetTime_ = time(nullptr); } } -void -EcalDQMonitorTask::analyze(edm::Event const& _evt, edm::EventSetup const& _es) -{ - if(verbosity_ > 2) edm::LogInfo("EcalDQM") << moduleName_ << "::analyze: Run " << _evt.id().run() << " Lumisection " << _evt.id().luminosityBlock() << " Event " << _evt.id().event() << ": processed " << processedEvents_; +void EcalDQMonitorTask::analyze(edm::Event const& _evt, edm::EventSetup const& _es) { + if (verbosity_ > 2) + edm::LogInfo("EcalDQM") << moduleName_ << "::analyze: Run " << _evt.id().run() << " Lumisection " + << _evt.id().luminosityBlock() << " Event " << _evt.id().event() << ": processed " + << processedEvents_; - if(schedule_.empty()) return; + if (schedule_.empty()) + return; std::set enabledTasks; edm::Handle dcchsHndl; - if(_evt.getByToken(collectionTokens_[ecaldqm::kEcalRawData], dcchsHndl)){ + if (_evt.getByToken(collectionTokens_[ecaldqm::kEcalRawData], dcchsHndl)) { // determine event type (called run type in DCCHeader for some reason) for each FED std::stringstream ss; - if(verbosity_ > 2) ss << moduleName_ << ": Event type "; + if (verbosity_ > 2) + ss << moduleName_ << ": Event type "; short runType[ecaldqm::nDCC]; std::fill_n(runType, ecaldqm::nDCC, -1); - for(EcalRawDataCollection::const_iterator dcchItr = dcchsHndl->begin(); dcchItr != dcchsHndl->end(); ++dcchItr){ - if(verbosity_ > 2) ss << dcchItr->getRunType() << " "; + for (EcalRawDataCollection::const_iterator dcchItr = dcchsHndl->begin(); dcchItr != dcchsHndl->end(); ++dcchItr) { + if (verbosity_ > 2) + ss << dcchItr->getRunType() << " "; runType[dcchItr->id() - 1] = dcchItr->getRunType(); } - if(verbosity_ > 2) edm::LogInfo("EcalDQM") << ss.str(); + if (verbosity_ > 2) + edm::LogInfo("EcalDQM") << ss.str(); bool processEvent(false); - executeOnWorkers_([&enabledTasks, &runType, &processEvent, this](ecaldqm::DQWorker* worker){ - if(static_cast(worker)->filterRunType(runType)){ - if(this->verbosity_ > 2) edm::LogInfo("EcalDQM") << worker->getName() << " will run on this event"; - enabledTasks.insert(worker); - processEvent = true; - } - }, "filterRunType"); - - if(!processEvent) return; - } - else{ + executeOnWorkers_( + [&enabledTasks, &runType, &processEvent, this](ecaldqm::DQWorker* worker) { + if (static_cast(worker)->filterRunType(runType)) { + if (this->verbosity_ > 2) + edm::LogInfo("EcalDQM") << worker->getName() << " will run on this event"; + enabledTasks.insert(worker); + processEvent = true; + } + }, + "filterRunType"); + + if (!processEvent) + return; + } else { edm::LogWarning("EcalDQM") << "EcalRawDataCollection does not exist. No event-type filtering will be applied"; - executeOnWorkers_([&enabledTasks](ecaldqm::DQWorker* worker){ - enabledTasks.insert(worker); - }, ""); + executeOnWorkers_([&enabledTasks](ecaldqm::DQWorker* worker) { enabledTasks.insert(worker); }, ""); } ++processedEvents_; // start event processing - executeOnWorkers_([&_evt, &_es, &enabledTasks](ecaldqm::DQWorker* worker){ - if(enabledTasks.find(worker) != enabledTasks.end()){ - if(worker->onlineMode()) worker->setTime(time(nullptr)); - worker->setEventNumber(_evt.id().event()); - static_cast(worker)->beginEvent(_evt, _es); - } - }, "beginEvent"); + executeOnWorkers_( + [&_evt, &_es, &enabledTasks](ecaldqm::DQWorker* worker) { + if (enabledTasks.find(worker) != enabledTasks.end()) { + if (worker->onlineMode()) + worker->setTime(time(nullptr)); + worker->setEventNumber(_evt.id().event()); + static_cast(worker)->beginEvent(_evt, _es); + } + }, + "beginEvent"); // run on collections - for(unsigned iSch(0); iSch < schedule_.size(); iSch++){ + for (unsigned iSch(0); iSch < schedule_.size(); iSch++) { Processor processor(schedule_[iSch].first); (this->*processor)(_evt, schedule_[iSch].second, enabledTasks); } // close event processing - executeOnWorkers_([&_evt, &_es, &enabledTasks](ecaldqm::DQWorker* worker){ - if(enabledTasks.find(worker) != enabledTasks.end()) - static_cast(worker)->endEvent(_evt, _es); - }, "endEvent"); - - if(verbosity_ > 2) edm::LogInfo("EcalDQM") << moduleName_ << "::analyze: Closing Event " << _evt.id().event(); + executeOnWorkers_( + [&_evt, &_es, &enabledTasks](ecaldqm::DQWorker* worker) { + if (enabledTasks.find(worker) != enabledTasks.end()) + static_cast(worker)->endEvent(_evt, _es); + }, + "endEvent"); + + if (verbosity_ > 2) + edm::LogInfo("EcalDQM") << moduleName_ << "::analyze: Closing Event " << _evt.id().event(); } DEFINE_FWK_MODULE(EcalDQMonitorTask); diff --git a/DQM/EcalMonitorTasks/plugins/EcalDQMonitorTask2.cc b/DQM/EcalMonitorTasks/plugins/EcalDQMonitorTask2.cc index 8706212407e42..460df62ae446c 100644 --- a/DQM/EcalMonitorTasks/plugins/EcalDQMonitorTask2.cc +++ b/DQM/EcalMonitorTasks/plugins/EcalDQMonitorTask2.cc @@ -17,118 +17,123 @@ #include "DataFormats/CaloRecHit/interface/CaloCluster.h" template -void -EcalDQMonitorTask::runOnCollection(edm::Event const& _evt, ecaldqm::Collections _col, std::set const& _enabledTasks) -{ +void EcalDQMonitorTask::runOnCollection(edm::Event const& _evt, + ecaldqm::Collections _col, + std::set const& _enabledTasks) { edm::Handle hndl; - if(!_evt.getByToken(collectionTokens_[_col], hndl)){ - if(!allowMissingCollections_) - throw cms::Exception("ObjectNotFound") << moduleName_ << "::runOnCollection: " << ecaldqm::collectionName[_col] << " does not exist"; - edm::LogWarning("EcalDQM") << moduleName_ << "::runOnCollection: " << ecaldqm::collectionName[_col] << " does not exist"; + if (!_evt.getByToken(collectionTokens_[_col], hndl)) { + if (!allowMissingCollections_) + throw cms::Exception("ObjectNotFound") + << moduleName_ << "::runOnCollection: " << ecaldqm::collectionName[_col] << " does not exist"; + edm::LogWarning("EcalDQM") << moduleName_ << "::runOnCollection: " << ecaldqm::collectionName[_col] + << " does not exist"; return; } CollectionClass const* collection(hndl.product()); - executeOnWorkers_([collection, _col, &_enabledTasks](ecaldqm::DQWorker* worker){ - if(_enabledTasks.find(worker) != _enabledTasks.end()) - static_cast(worker)->analyze(collection, _col); - }, "analyze"); + executeOnWorkers_( + [collection, _col, &_enabledTasks](ecaldqm::DQWorker* worker) { + if (_enabledTasks.find(worker) != _enabledTasks.end()) + static_cast(worker)->analyze(collection, _col); + }, + "analyze"); - if(verbosity_ > 1) edm::LogInfo("EcalDQM") << moduleName_ << "::runOn" << ecaldqm::collectionName[_col] << " returning"; + if (verbosity_ > 1) + edm::LogInfo("EcalDQM") << moduleName_ << "::runOn" << ecaldqm::collectionName[_col] << " returning"; } -void -EcalDQMonitorTask::formSchedule(std::vector const& _preSchedule, edm::ParameterSet const& _tagPSet) -{ - for(std::vector::const_iterator colItr(_preSchedule.begin()); colItr != _preSchedule.end(); ++colItr){ +void EcalDQMonitorTask::formSchedule(std::vector const& _preSchedule, + edm::ParameterSet const& _tagPSet) { + for (std::vector::const_iterator colItr(_preSchedule.begin()); colItr != _preSchedule.end(); + ++colItr) { std::pair sch; edm::InputTag tag(_tagPSet.getUntrackedParameter(ecaldqm::collectionName[*colItr])); - switch(*colItr){ - case ecaldqm::kSource: - collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection; - break; - case ecaldqm::kEcalRawData: - collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection; - break; - case ecaldqm::kEBGainErrors: - case ecaldqm::kEBChIdErrors: - case ecaldqm::kEBGainSwitchErrors: - collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection; - break; - case ecaldqm::kEEGainErrors: - case ecaldqm::kEEChIdErrors: - case ecaldqm::kEEGainSwitchErrors: - collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection; - break; - case ecaldqm::kTowerIdErrors: - case ecaldqm::kBlockSizeErrors: - case ecaldqm::kMEMTowerIdErrors: - case ecaldqm::kMEMBlockSizeErrors: - case ecaldqm::kMEMChIdErrors: - case ecaldqm::kMEMGainErrors: - collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection; - break; - case ecaldqm::kEBSrFlag: - collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection; - break; - case ecaldqm::kEESrFlag: - collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection; - break; - case ecaldqm::kEBDigi: - collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection; - break; - case ecaldqm::kEEDigi: - collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection; - break; - case ecaldqm::kPnDiodeDigi: - collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection; - break; - case ecaldqm::kTrigPrimDigi: - case ecaldqm::kTrigPrimEmulDigi: - collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection; - break; - case ecaldqm::kEBUncalibRecHit: - case ecaldqm::kEEUncalibRecHit: - case ecaldqm::kEBLaserLedUncalibRecHit: - case ecaldqm::kEELaserLedUncalibRecHit: - case ecaldqm::kEBTestPulseUncalibRecHit: - case ecaldqm::kEETestPulseUncalibRecHit: - collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection; - break; - case ecaldqm::kEBRecHit: - case ecaldqm::kEBReducedRecHit: - case ecaldqm::kEERecHit: - case ecaldqm::kEEReducedRecHit: - collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection; - break; - case ecaldqm::kEBBasicCluster: - case ecaldqm::kEEBasicCluster: - collectionTokens_[*colItr] = edm::EDGetToken(consumes >(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection >; - break; - case ecaldqm::kEBSuperCluster: - case ecaldqm::kEESuperCluster: - collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); - sch.first = &EcalDQMonitorTask::runOnCollection; - break; - default: - throw cms::Exception("InvalidConfiguration") << "Undefined collection " << *colItr; + switch (*colItr) { + case ecaldqm::kSource: + collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection; + break; + case ecaldqm::kEcalRawData: + collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection; + break; + case ecaldqm::kEBGainErrors: + case ecaldqm::kEBChIdErrors: + case ecaldqm::kEBGainSwitchErrors: + collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection; + break; + case ecaldqm::kEEGainErrors: + case ecaldqm::kEEChIdErrors: + case ecaldqm::kEEGainSwitchErrors: + collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection; + break; + case ecaldqm::kTowerIdErrors: + case ecaldqm::kBlockSizeErrors: + case ecaldqm::kMEMTowerIdErrors: + case ecaldqm::kMEMBlockSizeErrors: + case ecaldqm::kMEMChIdErrors: + case ecaldqm::kMEMGainErrors: + collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection; + break; + case ecaldqm::kEBSrFlag: + collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection; + break; + case ecaldqm::kEESrFlag: + collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection; + break; + case ecaldqm::kEBDigi: + collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection; + break; + case ecaldqm::kEEDigi: + collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection; + break; + case ecaldqm::kPnDiodeDigi: + collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection; + break; + case ecaldqm::kTrigPrimDigi: + case ecaldqm::kTrigPrimEmulDigi: + collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection; + break; + case ecaldqm::kEBUncalibRecHit: + case ecaldqm::kEEUncalibRecHit: + case ecaldqm::kEBLaserLedUncalibRecHit: + case ecaldqm::kEELaserLedUncalibRecHit: + case ecaldqm::kEBTestPulseUncalibRecHit: + case ecaldqm::kEETestPulseUncalibRecHit: + collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection; + break; + case ecaldqm::kEBRecHit: + case ecaldqm::kEBReducedRecHit: + case ecaldqm::kEERecHit: + case ecaldqm::kEEReducedRecHit: + collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection; + break; + case ecaldqm::kEBBasicCluster: + case ecaldqm::kEEBasicCluster: + collectionTokens_[*colItr] = edm::EDGetToken(consumes >(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection >; + break; + case ecaldqm::kEBSuperCluster: + case ecaldqm::kEESuperCluster: + collectionTokens_[*colItr] = edm::EDGetToken(consumes(tag)); + sch.first = &EcalDQMonitorTask::runOnCollection; + break; + default: + throw cms::Exception("InvalidConfiguration") << "Undefined collection " << *colItr; } sch.second = *colItr; diff --git a/DQM/EcalMonitorTasks/plugins/EcalFEDMonitor.cc b/DQM/EcalMonitorTasks/plugins/EcalFEDMonitor.cc index 3ff92ae51b2eb..e1a2931934fcc 100644 --- a/DQM/EcalMonitorTasks/plugins/EcalFEDMonitor.cc +++ b/DQM/EcalMonitorTasks/plugins/EcalFEDMonitor.cc @@ -2,39 +2,38 @@ #include "DataFormats/EcalDetId/interface/EcalSubdetector.h" #include "FWCore/Framework/interface/MakerMacros.h" -template -EcalFEDMonitorTemp::EcalFEDMonitorTemp(edm::ParameterSet const& _ps) : - folderName_(_ps.getUntrackedParameter("folderName")), - FEDRawDataToken_(consumes(_ps.getParameter("FEDRawDataCollection"))), - ebGainErrorsToken_(), - eeGainErrorsToken_(), - ebChIdErrorsToken_(), - eeChIdErrorsToken_(), - ebGainSwitchErrorsToken_(), - eeGainSwitchErrorsToken_(), - towerIdErrorsToken_(consumes(_ps.getParameter("EcalElectronicsIdCollection1"))), - blockSizeErrorsToken_(consumes(_ps.getParameter("EcalElectronicsIdCollection2"))), - MEs_(nMEs, nullptr) -{ - if(_ps.existsAs("EBDetIdCollection1")) +template +EcalFEDMonitorTemp::EcalFEDMonitorTemp(edm::ParameterSet const& _ps) + : folderName_(_ps.getUntrackedParameter("folderName")), + FEDRawDataToken_(consumes(_ps.getParameter("FEDRawDataCollection"))), + ebGainErrorsToken_(), + eeGainErrorsToken_(), + ebChIdErrorsToken_(), + eeChIdErrorsToken_(), + ebGainSwitchErrorsToken_(), + eeGainSwitchErrorsToken_(), + towerIdErrorsToken_( + consumes(_ps.getParameter("EcalElectronicsIdCollection1"))), + blockSizeErrorsToken_( + consumes(_ps.getParameter("EcalElectronicsIdCollection2"))), + MEs_(nMEs, nullptr) { + if (_ps.existsAs("EBDetIdCollection1")) ebGainErrorsToken_ = consumes(_ps.getParameter("EBDetIdCollection1")); - if(_ps.existsAs("EEDetIdCollection1")) + if (_ps.existsAs("EEDetIdCollection1")) eeGainErrorsToken_ = consumes(_ps.getParameter("EEDetIdCollection1")); - if(_ps.existsAs("EBDetIdCollection2")) + if (_ps.existsAs("EBDetIdCollection2")) ebChIdErrorsToken_ = consumes(_ps.getParameter("EBDetIdCollection2")); - if(_ps.existsAs("EEDetIdCollection2")) + if (_ps.existsAs("EEDetIdCollection2")) eeChIdErrorsToken_ = consumes(_ps.getParameter("EEDetIdCollection2")); - if(_ps.existsAs("EBDetIdCollection3")) + if (_ps.existsAs("EBDetIdCollection3")) ebGainSwitchErrorsToken_ = consumes(_ps.getParameter("EBDetIdCollection3")); - if(_ps.existsAs("EEDetIdCollection3")) + if (_ps.existsAs("EEDetIdCollection3")) eeGainSwitchErrorsToken_ = consumes(_ps.getParameter("EEDetIdCollection3")); } -template -void -EcalFEDMonitorTemp::dqmBeginRun(edm::Run const&, edm::EventSetup const& _es) -{ - if(!ecaldqm::checkElectronicsMap(false)){ +template +void EcalFEDMonitorTemp::dqmBeginRun(edm::Run const&, edm::EventSetup const& _es) { + if (!ecaldqm::checkElectronicsMap(false)) { // set up ecaldqm::electronicsMap in EcalDQMCommonUtils edm::ESHandle elecMapHandle; _es.get().get(elecMapHandle); @@ -42,15 +41,13 @@ EcalFEDMonitorTemp::dqmBeginRun(edm::Run const&, edm::EventSetup const& } } -template -void -EcalFEDMonitorTemp::bookHistograms(DQMStore::IBooker& _ibooker, edm::Run const&, edm::EventSetup const&) -{ +template +void EcalFEDMonitorTemp::bookHistograms(DQMStore::IBooker& _ibooker, edm::Run const&, edm::EventSetup const&) { _ibooker.cd(); std::string name; - if(SUBDET == EcalBarrel || SUBDET < 0){ + if (SUBDET == EcalBarrel || SUBDET < 0) { _ibooker.setCurrentFolder("EcalBarrel/" + folderName_); name = "FEDEntries"; @@ -62,7 +59,7 @@ EcalFEDMonitorTemp::bookHistograms(DQMStore::IBooker& _ibooker, edm::Run name = "FEDNonFatal"; MEs_[kEBNonFatal] = _ibooker.book1D(name, name, 36, 610, 646); } - if(SUBDET == EcalEndcap || SUBDET < 0){ + if (SUBDET == EcalEndcap || SUBDET < 0) { _ibooker.setCurrentFolder("EcalEndcap/" + folderName_); name = "FEDEntries"; @@ -76,37 +73,36 @@ EcalFEDMonitorTemp::bookHistograms(DQMStore::IBooker& _ibooker, edm::Run } } -template -void -EcalFEDMonitorTemp::analyze(edm::Event const& _evt, edm::EventSetup const&) -{ +template +void EcalFEDMonitorTemp::analyze(edm::Event const& _evt, edm::EventSetup const&) { edm::Handle fedHndl; - if(_evt.getByToken(FEDRawDataToken_, fedHndl)){ - for(unsigned fedId(601); fedId <= 654; fedId++){ - if(SUBDET == EcalBarrel && (fedId < 610 || fedId > 645)) continue; - if(SUBDET == EcalEndcap && (fedId > 609 && fedId < 646)) continue; + if (_evt.getByToken(FEDRawDataToken_, fedHndl)) { + for (unsigned fedId(601); fedId <= 654; fedId++) { + if (SUBDET == EcalBarrel && (fedId < 610 || fedId > 645)) + continue; + if (SUBDET == EcalEndcap && (fedId > 609 && fedId < 646)) + continue; unsigned occupancy(-1); // unsigned fatal(-1); - if(fedId < 610 || fedId > 645){ + if (fedId < 610 || fedId > 645) { occupancy = kEEOccupancy; - // fatal = kEEFatal; - } - else{ + // fatal = kEEFatal; + } else { occupancy = kEBOccupancy; - // fatal = kEBFatal; + // fatal = kEBFatal; } const FEDRawData& fedData(fedHndl->FEDData(fedId)); unsigned length(fedData.size() / sizeof(uint64_t)); - if(length > 1){ // FED header is one 64 bit word + if (length > 1) { // FED header is one 64 bit word MEs_[occupancy]->Fill(fedId + 0.5); -// const uint64_t* pData(reinterpret_cast(fedData.data())); -// bool crcError(((pData[length - 1] >> 2) & 0x1) == 0x1); + // const uint64_t* pData(reinterpret_cast(fedData.data())); + // bool crcError(((pData[length - 1] >> 2) & 0x1) == 0x1); -// if(crcError) MEs_[fatal]->Fill(fedId + 0.5); + // if(crcError) MEs_[fatal]->Fill(fedId + 0.5); } } } @@ -115,110 +111,118 @@ EcalFEDMonitorTemp::analyze(edm::Event const& _evt, edm::EventSetup cons edm::Handle eeHndl; edm::Handle eleHndl; - if((SUBDET == EcalBarrel || SUBDET < 0) && _evt.getByToken(ebGainErrorsToken_, ebHndl)){ + if ((SUBDET == EcalBarrel || SUBDET < 0) && _evt.getByToken(ebGainErrorsToken_, ebHndl)) { EBDetIdCollection::const_iterator ebEnd(ebHndl->end()); - for(EBDetIdCollection::const_iterator ebItr(ebHndl->begin()); ebItr != ebEnd; ++ebItr){ + for (EBDetIdCollection::const_iterator ebItr(ebHndl->begin()); ebItr != ebEnd; ++ebItr) { unsigned iDCC(ecaldqm::dccId(*ebItr) - 1); double normalization(ecaldqm::nCrystals(iDCC + 1)); - if(normalization < 1.) continue; + if (normalization < 1.) + continue; MEs_[kEBNonFatal]->Fill(iDCC + 601.5, 1. / normalization); } } - if((SUBDET == EcalEndcap || SUBDET < 0) && _evt.getByToken(eeGainErrorsToken_, eeHndl)){ + if ((SUBDET == EcalEndcap || SUBDET < 0) && _evt.getByToken(eeGainErrorsToken_, eeHndl)) { EEDetIdCollection::const_iterator eeEnd(eeHndl->end()); - for(EEDetIdCollection::const_iterator eeItr(eeHndl->begin()); eeItr != eeEnd; ++eeItr){ + for (EEDetIdCollection::const_iterator eeItr(eeHndl->begin()); eeItr != eeEnd; ++eeItr) { unsigned iDCC(ecaldqm::dccId(*eeItr) - 1); double normalization(ecaldqm::nCrystals(iDCC + 1)); - if(normalization < 1.) continue; + if (normalization < 1.) + continue; MEs_[kEENonFatal]->Fill(iDCC + 601.5, 1. / normalization); } } - if((SUBDET == EcalBarrel || SUBDET < 0) && _evt.getByToken(ebChIdErrorsToken_, ebHndl)){ + if ((SUBDET == EcalBarrel || SUBDET < 0) && _evt.getByToken(ebChIdErrorsToken_, ebHndl)) { EBDetIdCollection::const_iterator ebEnd(ebHndl->end()); - for(EBDetIdCollection::const_iterator ebItr(ebHndl->begin()); ebItr != ebEnd; ++ebItr){ + for (EBDetIdCollection::const_iterator ebItr(ebHndl->begin()); ebItr != ebEnd; ++ebItr) { unsigned iDCC(ecaldqm::dccId(*ebItr) - 1); double normalization(ecaldqm::nCrystals(iDCC + 1)); - if(normalization < 1.) continue; + if (normalization < 1.) + continue; MEs_[kEBNonFatal]->Fill(iDCC + 601.5, 1. / normalization); } } - if((SUBDET == EcalEndcap || SUBDET < 0) && _evt.getByToken(eeChIdErrorsToken_, eeHndl)){ + if ((SUBDET == EcalEndcap || SUBDET < 0) && _evt.getByToken(eeChIdErrorsToken_, eeHndl)) { EEDetIdCollection::const_iterator eeEnd(eeHndl->end()); - for(EEDetIdCollection::const_iterator eeItr(eeHndl->begin()); eeItr != eeEnd; ++eeItr){ + for (EEDetIdCollection::const_iterator eeItr(eeHndl->begin()); eeItr != eeEnd; ++eeItr) { unsigned iDCC(ecaldqm::dccId(*eeItr) - 1); double normalization(ecaldqm::nCrystals(iDCC + 1)); - if(normalization < 1.) continue; + if (normalization < 1.) + continue; MEs_[kEENonFatal]->Fill(iDCC + 601.5, 1. / normalization); } } - if((SUBDET == EcalBarrel || SUBDET < 0) && _evt.getByToken(ebGainSwitchErrorsToken_, ebHndl)){ + if ((SUBDET == EcalBarrel || SUBDET < 0) && _evt.getByToken(ebGainSwitchErrorsToken_, ebHndl)) { EBDetIdCollection::const_iterator ebEnd(ebHndl->end()); - for(EBDetIdCollection::const_iterator ebItr(ebHndl->begin()); ebItr != ebEnd; ++ebItr){ + for (EBDetIdCollection::const_iterator ebItr(ebHndl->begin()); ebItr != ebEnd; ++ebItr) { unsigned iDCC(ecaldqm::dccId(*ebItr) - 1); double normalization(ecaldqm::nCrystals(iDCC + 1)); - if(normalization < 1.) continue; + if (normalization < 1.) + continue; MEs_[kEBNonFatal]->Fill(iDCC + 601.5, 1. / normalization); } } - if((SUBDET == EcalEndcap || SUBDET < 0) && _evt.getByToken(eeGainSwitchErrorsToken_, eeHndl)){ + if ((SUBDET == EcalEndcap || SUBDET < 0) && _evt.getByToken(eeGainSwitchErrorsToken_, eeHndl)) { EEDetIdCollection::const_iterator eeEnd(eeHndl->end()); - for(EEDetIdCollection::const_iterator eeItr(eeHndl->begin()); eeItr != eeEnd; ++eeItr){ + for (EEDetIdCollection::const_iterator eeItr(eeHndl->begin()); eeItr != eeEnd; ++eeItr) { unsigned iDCC(ecaldqm::dccId(*eeItr) - 1); double normalization(ecaldqm::nCrystals(iDCC + 1)); - if(normalization < 1.) continue; + if (normalization < 1.) + continue; MEs_[kEENonFatal]->Fill(iDCC + 601.5, 1. / normalization); } } - if(_evt.getByToken(towerIdErrorsToken_, eleHndl)){ + if (_evt.getByToken(towerIdErrorsToken_, eleHndl)) { EcalElectronicsIdCollection::const_iterator eleEnd(eleHndl->end()); - for(EcalElectronicsIdCollection::const_iterator eleItr(eleHndl->begin()); eleItr != eleEnd; ++eleItr){ + for (EcalElectronicsIdCollection::const_iterator eleItr(eleHndl->begin()); eleItr != eleEnd; ++eleItr) { unsigned iDCC(eleItr->dccId() - 1); unsigned nonfatal(-1); - if((SUBDET == EcalBarrel || SUBDET < 0) && iDCC >= ecaldqm::kEBmLow && iDCC <= ecaldqm::kEBpHigh) + if ((SUBDET == EcalBarrel || SUBDET < 0) && iDCC >= ecaldqm::kEBmLow && iDCC <= ecaldqm::kEBpHigh) nonfatal = kEBNonFatal; - else if((SUBDET == EcalEndcap || SUBDET < 0) && (iDCC <= ecaldqm::kEEmHigh || iDCC >= ecaldqm::kEEpLow)) + else if ((SUBDET == EcalEndcap || SUBDET < 0) && (iDCC <= ecaldqm::kEEmHigh || iDCC >= ecaldqm::kEEpLow)) nonfatal = kEENonFatal; else continue; double normalization(ecaldqm::nCrystals(iDCC + 1)); - if(normalization < 1.) continue; + if (normalization < 1.) + continue; MEs_[nonfatal]->Fill(iDCC + 601.5, 25. / normalization); } } - if(_evt.getByToken(blockSizeErrorsToken_, eleHndl)){ + if (_evt.getByToken(blockSizeErrorsToken_, eleHndl)) { EcalElectronicsIdCollection::const_iterator eleEnd(eleHndl->end()); - for(EcalElectronicsIdCollection::const_iterator eleItr(eleHndl->begin()); eleItr != eleEnd; ++eleItr){ + for (EcalElectronicsIdCollection::const_iterator eleItr(eleHndl->begin()); eleItr != eleEnd; ++eleItr) { unsigned iDCC(eleItr->dccId() - 1); unsigned nonfatal(-1); - if((SUBDET == EcalBarrel || SUBDET < 0) && iDCC >= ecaldqm::kEBmLow && iDCC <= ecaldqm::kEBpHigh) + if ((SUBDET == EcalBarrel || SUBDET < 0) && iDCC >= ecaldqm::kEBmLow && iDCC <= ecaldqm::kEBpHigh) nonfatal = kEBNonFatal; - else if((SUBDET == EcalEndcap || SUBDET < 0) && (iDCC <= ecaldqm::kEEmHigh || iDCC >= ecaldqm::kEEpLow)) + else if ((SUBDET == EcalEndcap || SUBDET < 0) && (iDCC <= ecaldqm::kEEmHigh || iDCC >= ecaldqm::kEEpLow)) nonfatal = kEENonFatal; else continue; double normalization(ecaldqm::nCrystals(iDCC + 1)); - if(normalization < 1.) continue; + if (normalization < 1.) + continue; MEs_[nonfatal]->Fill(iDCC + 601.5, 25. / normalization); } diff --git a/DQM/EcalMonitorTasks/src/ClusterTask.cc b/DQM/EcalMonitorTasks/src/ClusterTask.cc index 6dc8285962fed..506c40e675768 100644 --- a/DQM/EcalMonitorTasks/src/ClusterTask.cc +++ b/DQM/EcalMonitorTasks/src/ClusterTask.cc @@ -17,32 +17,27 @@ #include "FWCore/Framework/interface/ConsumesCollector.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -namespace ecaldqm -{ - ClusterTask::ClusterTask() : - DQWorkerTask(), - ebHits_(nullptr), - eeHits_(nullptr), - // ievt_(0), - // massCalcPrescale_(_workerParams.getUntrackedParameter("massCalcPrescale")), - doExtra_(true), - energyThreshold_(0.), - swissCrossMaxThreshold_(3.), - egTriggerAlgos_(), - trigTypeToME_{0, 1, 2, 3, 4}, - L1GlobalTriggerReadoutRecordTag_(), - L1MuGMTReadoutCollectionTag_(), - L1GlobalTriggerReadoutRecordToken_(), - L1MuGMTReadoutCollectionToken_() - { - } - - void - ClusterTask::setParams(edm::ParameterSet const& _params) - { +namespace ecaldqm { + ClusterTask::ClusterTask() + : DQWorkerTask(), + ebHits_(nullptr), + eeHits_(nullptr), + // ievt_(0), + // massCalcPrescale_(_workerParams.getUntrackedParameter("massCalcPrescale")), + doExtra_(true), + energyThreshold_(0.), + swissCrossMaxThreshold_(3.), + egTriggerAlgos_(), + trigTypeToME_{0, 1, 2, 3, 4}, + L1GlobalTriggerReadoutRecordTag_(), + L1MuGMTReadoutCollectionTag_(), + L1GlobalTriggerReadoutRecordToken_(), + L1MuGMTReadoutCollectionToken_() {} + + void ClusterTask::setParams(edm::ParameterSet const& _params) { doExtra_ = _params.getUntrackedParameter("doExtra"); - if(!doExtra_){ + if (!doExtra_) { MEs_.erase(std::string("SCSizeVsEnergy")); MEs_.erase(std::string("SCSeedOccupancyHighE")); MEs_.erase(std::string("SCSeedOccupancyTrig")); @@ -65,32 +60,23 @@ namespace ecaldqm MESet::PathReplacements repl; - std::string triggerTypeNames[nTriggerTypes] = { - "ECAL", - "HCAL", - "CSC", - "DT", - "RPC" - }; + std::string triggerTypeNames[nTriggerTypes] = {"ECAL", "HCAL", "CSC", "DT", "RPC"}; MESetMulti& occupancy(static_cast(MEs_.at("SCSeedOccupancyTrig"))); - for(unsigned iT(0); iT != nTriggerTypes; ++iT){ + for (unsigned iT(0); iT != nTriggerTypes; ++iT) { repl["trig"] = triggerTypeNames[iT]; trigTypeToME_[iT] = occupancy.getIndex(repl); } } - void - ClusterTask::addDependencies(DependencySet& _dependencies) - { + void ClusterTask::addDependencies(DependencySet& _dependencies) { _dependencies.push_back(Dependency(kEBSuperCluster, kEBRecHit)); _dependencies.push_back(Dependency(kEESuperCluster, kEERecHit)); } - void - ClusterTask::beginEvent(edm::Event const& _evt, edm::EventSetup const& _es) - { - if(!doExtra_) return; + void ClusterTask::beginEvent(edm::Event const& _evt, edm::EventSetup const& _es) { + if (!doExtra_) + return; triggered_.reset(); @@ -102,15 +88,15 @@ namespace ecaldqm //Ecal edm::ESHandle menuRcd; - _es.get().get(menuRcd) ; + _es.get().get(menuRcd); L1GtTriggerMenu const* menu(menuRcd.product()); - if ( !dWord.empty()) { //protect against no L1GT in run - for(unsigned iT(0); iT != egTriggerAlgos_.size(); ++iT){ - if(menu->gtAlgorithmResult(egTriggerAlgos_[iT], dWord)){ - triggered_.set(kEcalTrigger); - break; - } + if (!dWord.empty()) { //protect against no L1GT in run + for (unsigned iT(0); iT != egTriggerAlgos_.size(); ++iT) { + if (menu->gtAlgorithmResult(egTriggerAlgos_[iT], dWord)) { + triggered_.set(kEcalTrigger); + break; + } } } @@ -118,102 +104,114 @@ namespace ecaldqm bool hcal_top = false; bool hcal_bot = false; const L1GtPsbWord psb = l1GTHndl->gtPsbWord(0xbb0d, 0); - std::vector valid_phi; - if((psb.aData(4)&0x3f) >= 1) {valid_phi.push_back( (psb.aData(4)>>10)&0x1f ); } - if((psb.bData(4)&0x3f) >= 1) {valid_phi.push_back( (psb.bData(4)>>10)&0x1f ); } - if((psb.aData(5)&0x3f) >= 1) {valid_phi.push_back( (psb.aData(5)>>10)&0x1f ); } - if((psb.bData(5)&0x3f) >= 1) {valid_phi.push_back( (psb.bData(5)>>10)&0x1f ); } + std::vector valid_phi; + if ((psb.aData(4) & 0x3f) >= 1) { + valid_phi.push_back((psb.aData(4) >> 10) & 0x1f); + } + if ((psb.bData(4) & 0x3f) >= 1) { + valid_phi.push_back((psb.bData(4) >> 10) & 0x1f); + } + if ((psb.aData(5) & 0x3f) >= 1) { + valid_phi.push_back((psb.aData(5) >> 10) & 0x1f); + } + if ((psb.bData(5) & 0x3f) >= 1) { + valid_phi.push_back((psb.bData(5) >> 10) & 0x1f); + } std::vector::const_iterator iphi; - for(iphi=valid_phi.begin(); iphi!=valid_phi.end(); iphi++) { - if(*iphi<9) hcal_top=true; - if(*iphi>8) hcal_bot=true; + for (iphi = valid_phi.begin(); iphi != valid_phi.end(); iphi++) { + if (*iphi < 9) + hcal_top = true; + if (*iphi > 8) + hcal_bot = true; } - if(hcal_top && hcal_bot) triggered_.set(kHcalTrigger); + if (hcal_top && hcal_bot) + triggered_.set(kHcalTrigger); //Muons edm::Handle l1MuHndl; - if(!_evt.getByToken(L1MuGMTReadoutCollectionToken_, l1MuHndl)) return; + if (!_evt.getByToken(L1MuGMTReadoutCollectionToken_, l1MuHndl)) + return; std::vector const& records(l1MuHndl->getRecords()); - for(unsigned iR(0); iR != records.size(); ++iR){ - if(records[iR].getBxInEvent() != 0) continue; + for (unsigned iR(0); iR != records.size(); ++iR) { + if (records[iR].getBxInEvent() != 0) + continue; unsigned iC(0); //DT triggers std::vector dtBXCands(records[iR].getDTBXCands()); - for(iC = 0; iC != dtBXCands.size(); ++iC) - if(!dtBXCands[iC].empty()) break; - if(iC != dtBXCands.size()) triggered_.set(kDTTrigger); + for (iC = 0; iC != dtBXCands.size(); ++iC) + if (!dtBXCands[iC].empty()) + break; + if (iC != dtBXCands.size()) + triggered_.set(kDTTrigger); //RPC triggers std::vector brlRPCCands(records[iR].getBrlRPCCands()); - for(iC = 0; iC != brlRPCCands.size(); ++iC) - if(!brlRPCCands[iC].empty()) break; - if(iC != brlRPCCands.size()) triggered_.set(kRPCTrigger); + for (iC = 0; iC != brlRPCCands.size(); ++iC) + if (!brlRPCCands[iC].empty()) + break; + if (iC != brlRPCCands.size()) + triggered_.set(kRPCTrigger); //CSC Triggers std::vector cscCands(records[iR].getCSCCands()); - for(iC = 0; iC != cscCands.size(); ++iC) - if(!cscCands[iC].empty()) break; - if(iC != cscCands.size()) triggered_.set(kCSCTrigger); + for (iC = 0; iC != cscCands.size(); ++iC) + if (!cscCands[iC].empty()) + break; + if (iC != cscCands.size()) + triggered_.set(kCSCTrigger); } - if(triggered_.none()) return; + if (triggered_.none()) + return; MESet& meTriggers(MEs_.at("Triggers")); MESet& meExclusiveTriggers(MEs_.at("ExclusiveTriggers")); - for(unsigned iT(0); iT != nTriggerTypes; ++iT){ - if(!triggered_[iT]) continue; + for (unsigned iT(0); iT != nTriggerTypes; ++iT) { + if (!triggered_[iT]) + continue; meTriggers.fill(iT + 0.5); - if(triggered_.count() == 1) + if (triggered_.count() == 1) meExclusiveTriggers.fill(iT + 0.5); } } - void - ClusterTask::endEvent(edm::Event const&, edm::EventSetup const&) - { + void ClusterTask::endEvent(edm::Event const&, edm::EventSetup const&) { // ++ievt_; ebHits_ = nullptr; eeHits_ = nullptr; } - - bool - ClusterTask::filterRunType(short const* _runType) - { - for(unsigned iFED(0); iFED != nDCC; iFED++){ - if(_runType[iFED] == EcalDCCHeaderBlock::COSMIC || - _runType[iFED] == EcalDCCHeaderBlock::MTCC || - _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL || - _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || - _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL || - _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) return true; + + bool ClusterTask::filterRunType(short const* _runType) { + for (unsigned iFED(0); iFED != nDCC; iFED++) { + if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC || + _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL || + _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL || + _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) + return true; } return false; } - void - ClusterTask::runOnRecHits(EcalRecHitCollection const& _hits, Collections _collection) - { - switch(_collection){ - case kEBRecHit: - ebHits_ = &_hits; - break; - case kEERecHit: - eeHits_ = &_hits; - break; - default: - break; + void ClusterTask::runOnRecHits(EcalRecHitCollection const& _hits, Collections _collection) { + switch (_collection) { + case kEBRecHit: + ebHits_ = &_hits; + break; + case kEERecHit: + eeHits_ = &_hits; + break; + default: + break; } } - void - ClusterTask::runOnBasicClusters(edm::View const& _bcs, Collections _collection) - { + void ClusterTask::runOnBasicClusters(edm::View const& _bcs, Collections _collection) { MESet& meBCE(MEs_.at("BCE")); MESet& meBCEMap(MEs_.at("BCEMap")); MESet& meBCEMapProjEta(MEs_.at("BCEMapProjEta")); @@ -236,30 +234,35 @@ namespace ecaldqm // vector lowMassCands; - for(edm::View::const_iterator bcItr(_bcs.begin()); bcItr != _bcs.end(); ++bcItr){ - if(bcItr->caloID().detectors() != 0){ - if(isBarrel && !bcItr->caloID().detector(reco::CaloID::DET_ECAL_BARREL)) continue; - if(!isBarrel && !bcItr->caloID().detector(reco::CaloID::DET_ECAL_ENDCAP)) continue; + for (edm::View::const_iterator bcItr(_bcs.begin()); bcItr != _bcs.end(); ++bcItr) { + if (bcItr->caloID().detectors() != 0) { + if (isBarrel && !bcItr->caloID().detector(reco::CaloID::DET_ECAL_BARREL)) + continue; + if (!isBarrel && !bcItr->caloID().detector(reco::CaloID::DET_ECAL_ENDCAP)) + continue; } math::XYZPoint const& position(bcItr->position()); DetId id(bcItr->seed()); - if(id.null()){ + if (id.null()) { GlobalPoint gp(position.x(), position.y(), position.z()); - CaloSubdetectorGeometry const* subgeom(getGeometry()->getSubdetectorGeometry(DetId::Ecal, isBarrel ? EcalBarrel : EcalEndcap)); + CaloSubdetectorGeometry const* subgeom( + getGeometry()->getSubdetectorGeometry(DetId::Ecal, isBarrel ? EcalBarrel : EcalEndcap)); id = subgeom->getClosestCell(gp); } - if(id.null() || (id.subdetId() == EcalBarrel && !isBarrel) || (id.subdetId() == EcalEndcap && isBarrel)) continue; + if (id.null() || (id.subdetId() == EcalBarrel && !isBarrel) || (id.subdetId() == EcalEndcap && isBarrel)) + continue; float energy(bcItr->energy()); float posEta(position.eta()); float posPhi(phi(position.phi())); float et(energy / std::cosh(posEta)); int subdet(isBarrel ? EcalBarrel : EcalEndcap); - if(subdet == EcalEndcap && position.z() < 0.) subdet = -EcalEndcap; + if (subdet == EcalEndcap && position.z() < 0.) + subdet = -EcalEndcap; meBCE.fill(id, energy); @@ -300,10 +303,10 @@ namespace ecaldqm // lowMassCands.push_back(&(*bcItr)); } - if(isBarrel){ + if (isBarrel) { meBCNum.fill(EcalBarrel, nBC[0] + nBC[1]); meTrendNBC.fill(EcalBarrel, double(timestamp_.iLumi), nBC[0] + nBC[1]); - }else{ + } else { meBCNum.fill(-EcalEndcap, nBC[0]); meBCNum.fill(EcalEndcap, nBC[1]); meTrendNBC.fill(EcalEndcap, double(timestamp_.iLumi), nBC[0] + nBC[1]); @@ -336,7 +339,7 @@ namespace ecaldqm // float m2(epair * epair - pzpair * pzpair - ptpair * ptpair); // if(m2 < 0.) continue; - + // float eta(0.5 * log((epair + pzpair)/(epair - pzpair))); // float phi(atan2(px1 + px2, py1 + py2)); @@ -357,9 +360,7 @@ namespace ecaldqm // } } - void - ClusterTask::runOnSuperClusters(reco::SuperClusterCollection const& _scs, Collections _collection) - { + void ClusterTask::runOnSuperClusters(reco::SuperClusterCollection const& _scs, Collections _collection) { bool isBarrel(_collection == kEBSuperCluster); EcalSubdetector subdet(isBarrel ? EcalBarrel : EcalEndcap); @@ -390,22 +391,25 @@ namespace ecaldqm int nSC(0); - for(reco::SuperClusterCollection::const_iterator scItr(_scs.begin()); scItr != _scs.end(); ++scItr){ + for (reco::SuperClusterCollection::const_iterator scItr(_scs.begin()); scItr != _scs.end(); ++scItr) { DetId seedId(scItr->seed()->seed()); - if(seedId.null()){ + if (seedId.null()) { math::XYZPoint const& position(scItr->position()); - GlobalPoint gp(position.x(), position.y(), position.z()); + GlobalPoint gp(position.x(), position.y(), position.z()); - CaloSubdetectorGeometry const* subgeom(getGeometry()->getSubdetectorGeometry(DetId::Ecal, isBarrel ? EcalBarrel : EcalEndcap)); + CaloSubdetectorGeometry const* subgeom( + getGeometry()->getSubdetectorGeometry(DetId::Ecal, isBarrel ? EcalBarrel : EcalEndcap)); - seedId = subgeom->getClosestCell(gp); + seedId = subgeom->getClosestCell(gp); } - if(seedId.null() || (seedId.subdetId() != subdet)) continue; + if (seedId.null() || (seedId.subdetId() != subdet)) + continue; EcalRecHitCollection::const_iterator seedItr(hits->find(seedId)); - if(seedItr == hits->end()) continue; + if (seedItr == hits->end()) + continue; ++nSC; @@ -418,7 +422,8 @@ namespace ecaldqm meSCNBCs.fill(seedId, scItr->clustersSize()); meSCNcrystals.fill(seedId, size); - if(doExtra_) meSCSizeVsEnergy->fill(subdet, energy, size); + if (doExtra_) + meSCSizeVsEnergy->fill(subdet, energy, size); meTrendSCSize.fill(seedId, double(timestamp_.iLumi), size); @@ -426,22 +431,25 @@ namespace ecaldqm meSCClusterVsSeed.fill(seedId, seedItr->energy(), energy); meSCSeedOccupancy.fill(seedId); - if(doExtra_ && energy > energyThreshold_) meSCSeedOccupancyHighE->fill(seedId); + if (doExtra_ && energy > energyThreshold_) + meSCSeedOccupancyHighE->fill(seedId); - if(scItr->size() == 1) meSingleCrystalCluster.fill(seedId); + if (scItr->size() == 1) + meSingleCrystalCluster.fill(seedId); float e3x3(EcalClusterTools::e3x3(*scItr->seed(), hits, getTopology())); meSCR9.fill(seedId, e3x3 / energy); - if(doExtra_){ - for(unsigned iT(0); iT != nTriggerTypes; ++iT){ - if(!triggered_[iT]) continue; + if (doExtra_) { + for (unsigned iT(0); iT != nTriggerTypes; ++iT) { + if (!triggered_[iT]) + continue; static_cast(meSCSeedOccupancyTrig)->use(trigTypeToME_[iT]); meSCSeedOccupancyTrig->fill(seedId); // exclusive - if(triggered_.count() == 1){ + if (triggered_.count() == 1) { static_cast(meSCSeedTimeTrigEx)->use(trigTypeToME_[iT]); static_cast(meSCSeedTimeMapTrigEx)->use(trigTypeToME_[iT]); meSCSeedTimeTrigEx->fill(subdet, seedItr->time()); @@ -452,9 +460,9 @@ namespace ecaldqm meSCOccupancyProjEta->fill(subdet, scItr->eta()); meSCOccupancyProjPhi->fill(subdet, phi(scItr->phi())); - if(isBarrel){ + if (isBarrel) { float e1(EcalClusterTools::eMax(*scItr, ebHits_)); - if(e1 > swissCrossMaxThreshold_){ + if (e1 > swissCrossMaxThreshold_) { float e4(EcalClusterTools::eTop(*scItr, ebHits_, getTopology()) + EcalClusterTools::eRight(*scItr, ebHits_, getTopology()) + EcalClusterTools::eBottom(*scItr, ebHits_, getTopology()) + @@ -493,15 +501,13 @@ namespace ecaldqm // float mass(sqrt(m2)); // MEs_[kZ]->fill(mass); // MEs_[kHighMass]->fill(mass); - } - void - ClusterTask::setTokens(edm::ConsumesCollector& _collector) - { - L1GlobalTriggerReadoutRecordToken_ = _collector.consumes(L1GlobalTriggerReadoutRecordTag_); + void ClusterTask::setTokens(edm::ConsumesCollector& _collector) { + L1GlobalTriggerReadoutRecordToken_ = + _collector.consumes(L1GlobalTriggerReadoutRecordTag_); L1MuGMTReadoutCollectionToken_ = _collector.consumes(L1MuGMTReadoutCollectionTag_); } DEFINE_ECALDQM_WORKER(ClusterTask); -} +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/DQWorkerTask.cc b/DQM/EcalMonitorTasks/src/DQWorkerTask.cc index 5070606b62083..30f2a8d283362 100644 --- a/DQM/EcalMonitorTasks/src/DQWorkerTask.cc +++ b/DQM/EcalMonitorTasks/src/DQWorkerTask.cc @@ -4,68 +4,55 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -namespace ecaldqm -{ - DQWorkerTask::DQWorkerTask() : - DQWorker(), - resettable_() - { - } +namespace ecaldqm { + DQWorkerTask::DQWorkerTask() : DQWorker(), resettable_() {} /*static*/ - void - DQWorkerTask::fillDescriptions(edm::ParameterSetDescription& _desc) - { - DQWorker::fillDescriptions(_desc); - } + void DQWorkerTask::fillDescriptions(edm::ParameterSetDescription& _desc) { DQWorker::fillDescriptions(_desc); } - void - DQWorkerTask::setME(edm::ParameterSet const& _ps) - { + void DQWorkerTask::setME(edm::ParameterSet const& _ps) { DQWorker::setME(_ps); - - for(MESetCollection::iterator mItr(MEs_.begin()); mItr != MEs_.end(); ++mItr){ - if(willConvertToEDM_) mItr->second->setBatchMode(); - + + for (MESetCollection::iterator mItr(MEs_.begin()); mItr != MEs_.end(); ++mItr) { + if (willConvertToEDM_) + mItr->second->setBatchMode(); + // TEMPORARY MEASURE - softReset does not accept variable bin size as of September 2012 // isVariableBinning is true for 1. MESetEcal or MESetNonObject with any custom binning or 2. MESetTrend // In principle it is sufficient to protect the MESetTrends from being reset - if(mItr->second->getBinType() != ecaldqm::binning::kTrend && - !mItr->second->isVariableBinning() && - mItr->second->getKind() != MonitorElement::DQM_KIND_REAL) + if (mItr->second->getBinType() != ecaldqm::binning::kTrend && !mItr->second->isVariableBinning() && + mItr->second->getKind() != MonitorElement::DQM_KIND_REAL) resettable_.insert(mItr->first); } } - void - DQWorkerTask::softReset() - { - std::for_each(resettable_.begin(), resettable_.end(), [this](std::string const& name){ - this->MEs_.at(name).softReset(); - }); + void DQWorkerTask::softReset() { + std::for_each( + resettable_.begin(), resettable_.end(), [this](std::string const& name) { this->MEs_.at(name).softReset(); }); } - void - DQWorkerTask::recoverStats() - { - std::for_each(resettable_.begin(), resettable_.end(), [this](std::string const& name){ - this->MEs_.at(name).recoverStats(); - }); + void DQWorkerTask::recoverStats() { + std::for_each(resettable_.begin(), resettable_.end(), [this](std::string const& name) { + this->MEs_.at(name).recoverStats(); + }); } - void - DependencySet::formSequenceFragment_(Dependency const& _d, std::vector& _sequence, std::vector::iterator _maxPos) const - { + void DependencySet::formSequenceFragment_(Dependency const& _d, + std::vector& _sequence, + std::vector::iterator _maxPos) const { Collections col(_d.dependant); std::vector::iterator pos(std::find(_sequence.begin(), _sequence.end(), col)); - if(pos == _sequence.end()) _sequence.insert(_maxPos, col); - else if(pos < _maxPos) return; + if (pos == _sequence.end()) + _sequence.insert(_maxPos, col); + else if (pos < _maxPos) + return; else throw cms::Exception("InvalidConfiguration") << "Circular dependency of collections"; - for(std::set::const_iterator rItr(_d.requisite.begin()); rItr != _d.requisite.end(); ++rItr){ - for(std::vector::const_iterator dItr(set_.begin()); dItr != set_.end(); ++dItr){ - if(dItr->dependant != *rItr) continue; + for (std::set::const_iterator rItr(_d.requisite.begin()); rItr != _d.requisite.end(); ++rItr) { + for (std::vector::const_iterator dItr(set_.begin()); dItr != set_.end(); ++dItr) { + if (dItr->dependant != *rItr) + continue; pos = std::find(_sequence.begin(), _sequence.end(), col); formSequenceFragment_(*dItr, _sequence, pos); break; @@ -73,5 +60,4 @@ namespace ecaldqm } } -} - +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/EnergyTask.cc b/DQM/EcalMonitorTasks/src/EnergyTask.cc index 67f41d91ea73a..7c3ed6d8e03e0 100644 --- a/DQM/EcalMonitorTasks/src/EnergyTask.cc +++ b/DQM/EcalMonitorTasks/src/EnergyTask.cc @@ -7,64 +7,50 @@ #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h" -namespace ecaldqm -{ - EnergyTask::EnergyTask() : - DQWorkerTask(), - isPhysicsRun_(false) - { - } +namespace ecaldqm { + EnergyTask::EnergyTask() : DQWorkerTask(), isPhysicsRun_(false) {} - void - EnergyTask::setParams(edm::ParameterSet const& _params) - { + void EnergyTask::setParams(edm::ParameterSet const& _params) { isPhysicsRun_ = _params.getUntrackedParameter("isPhysicsRun"); } - bool - EnergyTask::filterRunType(short const* _runType) - { - for(unsigned iFED(0); iFED != ecaldqm::nDCC; iFED++){ - if(_runType[iFED] == EcalDCCHeaderBlock::COSMIC || - _runType[iFED] == EcalDCCHeaderBlock::MTCC || - _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL || - _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || - _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL || - _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) return true; + bool EnergyTask::filterRunType(short const* _runType) { + for (unsigned iFED(0); iFED != ecaldqm::nDCC; iFED++) { + if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC || + _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL || + _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL || + _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) + return true; } return false; } - void - EnergyTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) - { + void EnergyTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) { // Reset by LS plots at beginning of every LS MEs_.at("HitMapAllByLumi").reset(); } - void - EnergyTask::runOnRecHits(EcalRecHitCollection const& _hits) - { + void EnergyTask::runOnRecHits(EcalRecHitCollection const& _hits) { MESet& meHitMap(MEs_.at("HitMap")); MESet& meHitMapAll(MEs_.at("HitMapAll")); MESet& meHitMapAllByLumi(MEs_.at("HitMapAllByLumi")); MESet& meHit(MEs_.at("Hit")); MESet& meHitAll(MEs_.at("HitAll")); - uint32_t neitherGoodNorPoorCalib(~(0x1 << EcalRecHit::kGood | - 0x1 << EcalRecHit::kPoorCalib)); - uint32_t neitherGoodNorOOT(~(0x1 << EcalRecHit::kGood | - 0x1 << EcalRecHit::kOutOfTime)); - - for(EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr){ + uint32_t neitherGoodNorPoorCalib(~(0x1 << EcalRecHit::kGood | 0x1 << EcalRecHit::kPoorCalib)); + uint32_t neitherGoodNorOOT(~(0x1 << EcalRecHit::kGood | 0x1 << EcalRecHit::kOutOfTime)); - if(isPhysicsRun_ && hitItr->checkFlagMask(neitherGoodNorPoorCalib)) continue; - if(!isPhysicsRun_ && hitItr->checkFlagMask(neitherGoodNorOOT)) continue; + for (EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr) { + if (isPhysicsRun_ && hitItr->checkFlagMask(neitherGoodNorPoorCalib)) + continue; + if (!isPhysicsRun_ && hitItr->checkFlagMask(neitherGoodNorOOT)) + continue; float energy(hitItr->energy()); - if(energy < 0.) continue; + if (energy < 0.) + continue; DetId id(hitItr->id()); @@ -75,32 +61,30 @@ namespace ecaldqm meHitAll.fill(id, energy); // look for the seeds -// float e3x3(energy); -// bool isSeed = true; - -// EcalRecHitCollection::const_iterator neighborItr; -// float neighborE; -// std::vector window(getTopology()->getWindow(id, 3, 3)); -// for(std::vector::iterator idItr(window.begin()); idItr != window.end(); ++idItr){ -// if((neighborItr = _hits.find(*idItr)) == _hits.end()) continue; -// if(isPhysicsRun_ && neighborItr->checkFlagMask(notGood)) continue; -// if(!isPhysicsRun_ && neighborItr->checkFlagMask(neitherGoodNorOOT)) continue; -// neighborE = isPhysicsRun_ ? neighborItr->energy() : neighborItr->outOfTimeEnergy(); -// if(neighborE > energy){ -// isSeed = false; -// break; -// } -// e3x3 += neighborE; -// } - -// if(!isSeed) continue; - -// if ( e3x3 >= threshS9_ ) -// MEs_[kMiniCluster]->fill(id, e3x3); - + // float e3x3(energy); + // bool isSeed = true; + + // EcalRecHitCollection::const_iterator neighborItr; + // float neighborE; + // std::vector window(getTopology()->getWindow(id, 3, 3)); + // for(std::vector::iterator idItr(window.begin()); idItr != window.end(); ++idItr){ + // if((neighborItr = _hits.find(*idItr)) == _hits.end()) continue; + // if(isPhysicsRun_ && neighborItr->checkFlagMask(notGood)) continue; + // if(!isPhysicsRun_ && neighborItr->checkFlagMask(neitherGoodNorOOT)) continue; + // neighborE = isPhysicsRun_ ? neighborItr->energy() : neighborItr->outOfTimeEnergy(); + // if(neighborE > energy){ + // isSeed = false; + // break; + // } + // e3x3 += neighborE; + // } + + // if(!isSeed) continue; + + // if ( e3x3 >= threshS9_ ) + // MEs_[kMiniCluster]->fill(id, e3x3); } } DEFINE_ECALDQM_WORKER(EnergyTask); -} - +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/IntegrityTask.cc b/DQM/EcalMonitorTasks/src/IntegrityTask.cc index f79839ba11427..a634a17fb127c 100644 --- a/DQM/EcalMonitorTasks/src/IntegrityTask.cc +++ b/DQM/EcalMonitorTasks/src/IntegrityTask.cc @@ -3,44 +3,37 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/Exception.h" -namespace ecaldqm -{ - IntegrityTask::IntegrityTask() : - DQWorkerTask() - { - } +namespace ecaldqm { + IntegrityTask::IntegrityTask() : DQWorkerTask() {} - void - IntegrityTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) - { + void IntegrityTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) { // Reset by LS plots at beginning of every LS MEs_.at("MapByLumi").reset(); MEs_.at("ByLumi").reset(); } - template - void - IntegrityTask::runOnDetIdCollection(IDCollection const& _ids, Collections _collection) - { + template + void IntegrityTask::runOnDetIdCollection(IDCollection const& _ids, Collections _collection) { // Collection is empty if there are no errors - if(_ids.empty()) return; + if (_ids.empty()) + return; MESet* set(nullptr); - switch(_collection){ - case kEBGainErrors: - case kEEGainErrors: - set = &MEs_.at("Gain"); - break; - case kEBChIdErrors: - case kEEChIdErrors: - set = &MEs_.at("ChId"); - break; - case kEBGainSwitchErrors: - case kEEGainSwitchErrors: - set = &MEs_.at("GainSwitch"); - break; - default: - return; + switch (_collection) { + case kEBGainErrors: + case kEEGainErrors: + set = &MEs_.at("Gain"); + break; + case kEBChIdErrors: + case kEEChIdErrors: + set = &MEs_.at("ChId"); + break; + case kEBGainSwitchErrors: + case kEEGainSwitchErrors: + set = &MEs_.at("GainSwitch"); + break; + default: + return; } MESet& meMapByLumi(MEs_.at("MapByLumi")); @@ -48,35 +41,33 @@ namespace ecaldqm MESet& meTotal(MEs_.at("Total")); MESet& meTrendNErrors(MEs_.at("TrendNErrors")); - std::for_each(_ids.begin(), _ids.end(), - [&](typename IDCollection::value_type const& id){ - set->fill(id); - int dccid(dccId(id)); - meByLumi.fill(dccid); - meTotal.fill(dccid); - // Fill Integrity Errors Map with channel errors for this lumi - meMapByLumi.fill(id); + std::for_each(_ids.begin(), _ids.end(), [&](typename IDCollection::value_type const& id) { + set->fill(id); + int dccid(dccId(id)); + meByLumi.fill(dccid); + meTotal.fill(dccid); + // Fill Integrity Errors Map with channel errors for this lumi + meMapByLumi.fill(id); - meTrendNErrors.fill(double(timestamp_.iLumi), 1.); - }); + meTrendNErrors.fill(double(timestamp_.iLumi), 1.); + }); } - void - IntegrityTask::runOnElectronicsIdCollection(EcalElectronicsIdCollection const& _ids, Collections _collection) - { + void IntegrityTask::runOnElectronicsIdCollection(EcalElectronicsIdCollection const& _ids, Collections _collection) { // Collection is empty if there are no errors - if(_ids.empty()) return; + if (_ids.empty()) + return; MESet* set(nullptr); - switch(_collection){ - case kTowerIdErrors: - set = &MEs_.at("TowerId"); - break; - case kBlockSizeErrors: - set = &MEs_.at("BlockSize"); - break; - default: - return; + switch (_collection) { + case kTowerIdErrors: + set = &MEs_.at("TowerId"); + break; + case kBlockSizeErrors: + set = &MEs_.at("BlockSize"); + break; + default: + return; } MESet& meMapByLumi(MEs_.at("MapByLumi")); @@ -84,29 +75,26 @@ namespace ecaldqm MESet& meTotal(MEs_.at("Total")); MESet& meTrendNErrors(MEs_.at("TrendNErrors")); - std::for_each(_ids.begin(), _ids.end(), - [&](EcalElectronicsIdCollection::value_type const& id){ - set->fill(id); - int dccid(id.dccId()); - double nCrystals(0.); - std::vector chIds( getElectronicsMap()->dccTowerConstituents(dccid, id.towerId()) ); - if(dccid <= kEEmHigh + 1 || dccid >= kEEpLow + 1) - nCrystals = chIds.size(); - else - nCrystals = 25.; - meByLumi.fill(dccid, nCrystals); - meTotal.fill(dccid, nCrystals); - // Fill Integrity Errors Map with tower errors for this lumi - // Since binned by crystal for compatibility with channel errors, - // fill with constituent channels of tower - for(std::vector::iterator chItr(chIds.begin()); chItr != chIds.end(); ++chItr) - meMapByLumi.fill(*chItr); - - meTrendNErrors.fill(double(timestamp_.iLumi), nCrystals); - }); + std::for_each(_ids.begin(), _ids.end(), [&](EcalElectronicsIdCollection::value_type const& id) { + set->fill(id); + int dccid(id.dccId()); + double nCrystals(0.); + std::vector chIds(getElectronicsMap()->dccTowerConstituents(dccid, id.towerId())); + if (dccid <= kEEmHigh + 1 || dccid >= kEEpLow + 1) + nCrystals = chIds.size(); + else + nCrystals = 25.; + meByLumi.fill(dccid, nCrystals); + meTotal.fill(dccid, nCrystals); + // Fill Integrity Errors Map with tower errors for this lumi + // Since binned by crystal for compatibility with channel errors, + // fill with constituent channels of tower + for (std::vector::iterator chItr(chIds.begin()); chItr != chIds.end(); ++chItr) + meMapByLumi.fill(*chItr); + + meTrendNErrors.fill(double(timestamp_.iLumi), nCrystals); + }); } DEFINE_ECALDQM_WORKER(IntegrityTask); -} - - +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/LaserTask.cc b/DQM/EcalMonitorTasks/src/LaserTask.cc index 4712f67550f86..e73a097bbeb86 100644 --- a/DQM/EcalMonitorTasks/src/LaserTask.cc +++ b/DQM/EcalMonitorTasks/src/LaserTask.cc @@ -4,24 +4,14 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" -namespace ecaldqm -{ - LaserTask::LaserTask() : - DQWorkerTask(), - wlToME_(), - pnAmp_(), - emptyLS_(0), - emptyLSLimit_(0), - maxPedestal_(0) - { +namespace ecaldqm { + LaserTask::LaserTask() : DQWorkerTask(), wlToME_(), pnAmp_(), emptyLS_(0), emptyLSLimit_(0), maxPedestal_(0) { std::fill_n(enable_, nDCC, false); std::fill_n(wavelength_, nDCC, 0); std::fill_n(rtHalf_, nDCC, 0); } - void - LaserTask::setParams(edm::ParameterSet const& _params) - { + void LaserTask::setParams(edm::ParameterSet const& _params) { emptyLSLimit_ = _params.getUntrackedParameter("emptyLSLimit"); std::vector laserWavelengths(_params.getUntrackedParameter >("laserWavelengths")); @@ -30,9 +20,10 @@ namespace ecaldqm MESetMulti& amplitude(static_cast(MEs_.at("Amplitude"))); unsigned nWL(laserWavelengths.size()); - for(unsigned iWL(0); iWL != nWL; ++iWL){ + for (unsigned iWL(0); iWL != nWL; ++iWL) { int wl(laserWavelengths[iWL]); - if(wl <= 0 || wl >= 5) throw cms::Exception("InvalidConfiguration") << "Laser Wavelength"; + if (wl <= 0 || wl >= 5) + throw cms::Exception("InvalidConfiguration") << "Laser Wavelength"; repl["wl"] = std::to_string(wl); wlToME_[wl] = amplitude.getIndex(repl); } @@ -40,9 +31,7 @@ namespace ecaldqm maxPedestal_ = _params.getUntrackedParameter("maxPedestal"); } - void - LaserTask::addDependencies(DependencySet& _dependencies) - { + void LaserTask::addDependencies(DependencySet& _dependencies) { _dependencies.push_back(Dependency(kEBDigi, kEcalRawData)); _dependencies.push_back(Dependency(kEEDigi, kEcalRawData)); _dependencies.push_back(Dependency(kPnDiodeDigi, kEBDigi, kEEDigi, kEcalRawData)); @@ -50,92 +39,74 @@ namespace ecaldqm _dependencies.push_back(Dependency(kEELaserLedUncalibRecHit, kPnDiodeDigi, kEEDigi, kEcalRawData)); } - bool - LaserTask::filterRunType(short const* _runType) - { + bool LaserTask::filterRunType(short const* _runType) { bool enable(false); - for(unsigned iDCC(0); iDCC < nDCC; iDCC++){ - if(_runType[iDCC] == EcalDCCHeaderBlock::LASER_STD || - _runType[iDCC] == EcalDCCHeaderBlock::LASER_GAP){ - enable = true; - enable_[iDCC] = true; - } - else + for (unsigned iDCC(0); iDCC < nDCC; iDCC++) { + if (_runType[iDCC] == EcalDCCHeaderBlock::LASER_STD || _runType[iDCC] == EcalDCCHeaderBlock::LASER_GAP) { + enable = true; + enable_[iDCC] = true; + } else enable_[iDCC] = false; } return enable; } - void - LaserTask::beginRun(edm::Run const&, edm::EventSetup const&) - { - emptyLS_ = 0; - } + void LaserTask::beginRun(edm::Run const&, edm::EventSetup const&) { emptyLS_ = 0; } - void - LaserTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) - { - if(++emptyLS_ > emptyLSLimit_) emptyLS_ = -1; + void LaserTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) { + if (++emptyLS_ > emptyLSLimit_) + emptyLS_ = -1; } - void - LaserTask::beginEvent(edm::Event const& _evt, edm::EventSetup const&) - { - pnAmp_.clear(); - } + void LaserTask::beginEvent(edm::Event const& _evt, edm::EventSetup const&) { pnAmp_.clear(); } - void - LaserTask::runOnRawData(EcalRawDataCollection const& _rawData) - { + void LaserTask::runOnRawData(EcalRawDataCollection const& _rawData) { MESet& meCalibStatus(MEs_.at("CalibStatus")); - for(EcalRawDataCollection::const_iterator rItr(_rawData.begin()); rItr != _rawData.end(); ++rItr){ + for (EcalRawDataCollection::const_iterator rItr(_rawData.begin()); rItr != _rawData.end(); ++rItr) { unsigned iDCC(rItr->id() - 1); - if(!enable_[iDCC]){ + if (!enable_[iDCC]) { wavelength_[iDCC] = -1; rtHalf_[iDCC] = -1; continue; } wavelength_[iDCC] = rItr->getEventSettings().wavelength + 1; - if(wlToME_.find(wavelength_[iDCC]) == wlToME_.end()) + if (wlToME_.find(wavelength_[iDCC]) == wlToME_.end()) enable_[iDCC] = false; rtHalf_[iDCC] = rItr->getRtHalf(); } bool LaserStatus[nWavelength]; - for(unsigned iW(0); iW < nWavelength; iW++){ - LaserStatus[iW] = false; + for (unsigned iW(0); iW < nWavelength; iW++) { + LaserStatus[iW] = false; + } + for (unsigned iDCC(0); iDCC < nDCC; iDCC++) { + switch (wavelength_[iDCC]) { + case 1: + break; + case 2: + LaserStatus[Wavelength::kGreen] = true; + break; + case 3: + LaserStatus[Wavelength::kBlue] = true; + break; + case 4: + LaserStatus[Wavelength::kIRed] = true; + break; + default: + break; + } } - for(unsigned iDCC(0); iDCC < nDCC; iDCC++){ - switch (wavelength_[iDCC]) - { - case 1: - break; - case 2: - LaserStatus[Wavelength::kGreen] = true; - break; - case 3: - LaserStatus[Wavelength::kBlue] = true; - break; - case 4: - LaserStatus[Wavelength::kIRed] = true; - break; - default: - break; - } + for (unsigned iWL(0); iWL < nWavelength; iWL++) { + meCalibStatus.fill(double(iWL), LaserStatus[iWL] ? 1 : 0); } - for(unsigned iWL(0); iWL - void - LaserTask::runOnDigis(DigiCollection const& _digis) - { + template + void LaserTask::runOnDigis(DigiCollection const& _digis) { MESet& meOccupancy(MEs_.at("Occupancy")); MESet& meShape(MEs_.at("Shape")); MESet& meSignalRate(MEs_.at("SignalRate")); @@ -144,22 +115,25 @@ namespace ecaldqm int nReadouts[nDCC]; int maxpos[nDCC][EcalDataFrame::MAXSAMPLES]; bool largeAmplitude[nDCC]; - for(unsigned iDCC(0); iDCC < nDCC; ++iDCC){ + for (unsigned iDCC(0); iDCC < nDCC; ++iDCC) { inData[iDCC] = false; nReadouts[iDCC] = 0; - for(int i(0); i < EcalDataFrame::MAXSAMPLES; i++) maxpos[iDCC][i] = 0; + for (int i(0); i < EcalDataFrame::MAXSAMPLES; i++) + maxpos[iDCC][i] = 0; largeAmplitude[iDCC] = false; } - for(typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ + for (typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) { const DetId& id(digiItr->id()); unsigned iDCC(dccId(id) - 1); inData[iDCC] = true; - if(!enable_[iDCC]) continue; - if(rtHalf(id) != rtHalf_[iDCC]) continue; + if (!enable_[iDCC]) + continue; + if (rtHalf(id) != rtHalf_[iDCC]) + continue; meOccupancy.fill(id); @@ -172,14 +146,16 @@ namespace ecaldqm int min(4096); for (int i(0); i < EcalDataFrame::MAXSAMPLES; i++) { int adc(dataFrame.sample(i).adc()); - if(adc > max){ + if (adc > max) { max = adc; iMax = i; } - if(adc < min) min = adc; - if(adc > maxPedestal_) largeAmplitude[iDCC] = true; + if (adc < min) + min = adc; + if (adc > maxPedestal_) + largeAmplitude[iDCC] = true; } - if(iMax >= 0 && max - min > 3) // normal RMS of pedestal is ~2.5 + if (iMax >= 0 && max - min > 3) // normal RMS of pedestal is ~2.5 maxpos[iDCC][iMax] += 1; } @@ -189,32 +165,33 @@ namespace ecaldqm unsigned iME(-1); - for(int iDCC(0); iDCC < nDCC; ++iDCC){ - if(!inData[iDCC]) continue; + for (int iDCC(0); iDCC < nDCC; ++iDCC) { + if (!inData[iDCC]) + continue; - if(nReadouts[iDCC] == 0){ + if (nReadouts[iDCC] == 0) { enable_[iDCC] = false; continue; } int threshold(nReadouts[iDCC] / 3); - if(laserOnExpected) enable_[iDCC] = false; + if (laserOnExpected) + enable_[iDCC] = false; - if(largeAmplitude[iDCC]){ - enable = true; - enable_[iDCC] = true; - } - else{ - for(int i(0); i < EcalDataFrame::MAXSAMPLES; i++){ - if(maxpos[iDCC][i] > threshold){ - enable = true; - enable_[iDCC] = true; - break; - } - } + if (largeAmplitude[iDCC]) { + enable = true; + enable_[iDCC] = true; + } else { + for (int i(0); i < EcalDataFrame::MAXSAMPLES; i++) { + if (maxpos[iDCC][i] > threshold) { + enable = true; + enable_[iDCC] = true; + break; + } + } } - if(iME != wlToME_[wavelength_[iDCC]]){ + if (iME != wlToME_[wavelength_[iDCC]]) { iME = wlToME_[wavelength_[iDCC]]; static_cast(meSignalRate).use(iME); } @@ -222,71 +199,78 @@ namespace ecaldqm meSignalRate.fill(iDCC + 1, enable_[iDCC] ? 1 : 0); } - if(enable) emptyLS_ = 0; - else if(laserOnExpected) return; + if (enable) + emptyLS_ = 0; + else if (laserOnExpected) + return; iME = -1; - for(typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ + for (typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) { const DetId& id(digiItr->id()); unsigned iDCC(dccId(id) - 1); - if(!enable_[iDCC]) continue; - if(rtHalf(id) != rtHalf_[iDCC]) continue; + if (!enable_[iDCC]) + continue; + if (rtHalf(id) != rtHalf_[iDCC]) + continue; EcalDataFrame dataFrame(*digiItr); - if(iME != wlToME_[wavelength_[iDCC]]){ + if (iME != wlToME_[wavelength_[iDCC]]) { iME = wlToME_[wavelength_[iDCC]]; static_cast(meShape).use(iME); } - for(int iSample(0); iSample < EcalDataFrame::MAXSAMPLES; iSample++) - meShape.fill(id, iSample + 0.5, float(dataFrame.sample(iSample).adc())); + for (int iSample(0); iSample < EcalDataFrame::MAXSAMPLES; iSample++) + meShape.fill(id, iSample + 0.5, float(dataFrame.sample(iSample).adc())); EcalPnDiodeDetId pnidA(pnForCrystal(id, 'a')); EcalPnDiodeDetId pnidB(pnForCrystal(id, 'b')); - if(pnidA.null() || pnidB.null()) continue; + if (pnidA.null() || pnidB.null()) + continue; pnAmp_.insert(std::make_pair(pnidA.rawId(), 0.)); pnAmp_.insert(std::make_pair(pnidB.rawId(), 0.)); } } - void - LaserTask::runOnPnDigis(EcalPnDiodeDigiCollection const& _digis) - { + void LaserTask::runOnPnDigis(EcalPnDiodeDigiCollection const& _digis) { MESet& mePNAmplitude(MEs_.at("PNAmplitude")); bool enable(false); - for(unsigned iDCC(0); iDCC < nDCC; ++iDCC) + for (unsigned iDCC(0); iDCC < nDCC; ++iDCC) enable |= enable_[iDCC]; - if(!enable) return; + if (!enable) + return; unsigned iME(-1); - for(EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ - if(digiItr->sample(0).gainId() != 0 && digiItr->sample(0).gainId() != 1) continue; + for (EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) { + if (digiItr->sample(0).gainId() != 0 && digiItr->sample(0).gainId() != 1) + continue; const EcalPnDiodeDetId& id(digiItr->id()); std::map::iterator ampItr(pnAmp_.find(id.rawId())); - if(ampItr == pnAmp_.end()) continue; + if (ampItr == pnAmp_.end()) + continue; unsigned iDCC(dccId(id) - 1); double pedestal(0.); - for(int iSample(0); iSample < 4; iSample++) - pedestal += digiItr->sample(iSample).adc(); + for (int iSample(0); iSample < 4; iSample++) + pedestal += digiItr->sample(iSample).adc(); pedestal /= 4.; double max(0.); - for(int iSample(0); iSample < 50; iSample++){ - float amp(digiItr->sample(iSample).adc() - pedestal); - if(amp > max) max = amp; + for (int iSample(0); iSample < 50; iSample++) { + float amp(digiItr->sample(iSample).adc() - pedestal); + if (amp > max) + max = amp; } - if(iME != wlToME_[wavelength_[iDCC]]){ + if (iME != wlToME_[wavelength_[iDCC]]) { iME = wlToME_[wavelength_[iDCC]]; static_cast(mePNAmplitude).use(iME); } @@ -297,9 +281,7 @@ namespace ecaldqm } } - void - LaserTask::runOnUncalibRecHits(EcalUncalibratedRecHitCollection const& _uhits) - { + void LaserTask::runOnUncalibRecHits(EcalUncalibratedRecHitCollection const& _uhits) { MESet& meAmplitude(MEs_.at("Amplitude")); MESet& meAmplitudeSummary(MEs_.at("AmplitudeSummary")); MESet& meTiming(MEs_.at("Timing")); @@ -308,21 +290,24 @@ namespace ecaldqm using namespace std; bool enable(false); - for(unsigned iDCC(0); iDCC < nDCC; ++iDCC) + for (unsigned iDCC(0); iDCC < nDCC; ++iDCC) enable |= enable_[iDCC]; - if(!enable) return; + if (!enable) + return; unsigned iME(-1); - for(EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr){ + for (EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr) { const DetId& id(uhitItr->id()); unsigned iDCC(dccId(id) - 1); - if(!enable_[iDCC]) continue; - if(rtHalf(id) != rtHalf_[iDCC]) continue; + if (!enable_[iDCC]) + continue; + if (rtHalf(id) != rtHalf_[iDCC]) + continue; - if(iME != wlToME_[wavelength_[iDCC]]){ + if (iME != wlToME_[wavelength_[iDCC]]) { iME = wlToME_[wavelength_[iDCC]]; static_cast(meAmplitude).use(iME); static_cast(meAmplitudeSummary).use(iME); @@ -341,15 +326,18 @@ namespace ecaldqm map::iterator ampItrA(pnAmp_.find(pnForCrystal(id, 'a'))); map::iterator ampItrB(pnAmp_.find(pnForCrystal(id, 'b'))); - if(ampItrA == pnAmp_.end() && ampItrB == pnAmp_.end()) continue; - else if(ampItrB == pnAmp_.end()) aop = amp / ampItrA->second; - else if(ampItrA == pnAmp_.end()) aop = amp / ampItrB->second; - else aop = amp / (ampItrA->second + ampItrB->second) * 2.; + if (ampItrA == pnAmp_.end() && ampItrB == pnAmp_.end()) + continue; + else if (ampItrB == pnAmp_.end()) + aop = amp / ampItrA->second; + else if (ampItrA == pnAmp_.end()) + aop = amp / ampItrB->second; + else + aop = amp / (ampItrA->second + ampItrB->second) * 2.; meAOverP.fill(id, aop); } } DEFINE_ECALDQM_WORKER(LaserTask); -} - +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/LedTask.cc b/DQM/EcalMonitorTasks/src/LedTask.cc index ebfc881d8f1d8..3f354fa71504e 100644 --- a/DQM/EcalMonitorTasks/src/LedTask.cc +++ b/DQM/EcalMonitorTasks/src/LedTask.cc @@ -6,21 +6,13 @@ namespace ecaldqm { - LedTask::LedTask() : - DQWorkerTask(), - wlToME_(), - pnAmp_(), - emptyLS_(0), - emptyLSLimit_(0) - { + LedTask::LedTask() : DQWorkerTask(), wlToME_(), pnAmp_(), emptyLS_(0), emptyLSLimit_(0) { std::fill_n(enable_, nEEDCC, false); std::fill_n(wavelength_, nEEDCC, 0); std::fill_n(rtHalf_, nEEDCC, 0); } - void - LedTask::setParams(edm::ParameterSet const& _params) - { + void LedTask::setParams(edm::ParameterSet const& _params) { emptyLSLimit_ = _params.getUntrackedParameter("emptyLSLimit"); std::vector ledWavelengths(_params.getUntrackedParameter >("ledWavelengths")); @@ -29,132 +21,119 @@ namespace ecaldqm { MESetMulti& amplitude(static_cast(MEs_.at("Amplitude"))); unsigned nWL(ledWavelengths.size()); - for(unsigned iWL(0); iWL != nWL; ++iWL){ + for (unsigned iWL(0); iWL != nWL; ++iWL) { int wl(ledWavelengths[iWL]); - if(wl != 1 && wl != 2) throw cms::Exception("InvalidConfiguration") << "Led Wavelength"; + if (wl != 1 && wl != 2) + throw cms::Exception("InvalidConfiguration") << "Led Wavelength"; repl["wl"] = std::to_string(wl); wlToME_[wl] = amplitude.getIndex(repl); } } - void - LedTask::addDependencies(DependencySet& _dependencies) - { + void LedTask::addDependencies(DependencySet& _dependencies) { _dependencies.push_back(Dependency(kEEDigi, kEcalRawData)); _dependencies.push_back(Dependency(kPnDiodeDigi, kEEDigi, kEcalRawData)); _dependencies.push_back(Dependency(kEELaserLedUncalibRecHit, kPnDiodeDigi, kEEDigi, kEcalRawData)); } - bool - LedTask::filterRunType(short const* _runType) - { + bool LedTask::filterRunType(short const* _runType) { bool enable(false); - for(unsigned iDCC(0); iDCC != nDCC; iDCC++){ - if(iDCC >= kEBmLow && iDCC <= kEBpHigh) continue; + for (unsigned iDCC(0); iDCC != nDCC; iDCC++) { + if (iDCC >= kEBmLow && iDCC <= kEBpHigh) + continue; unsigned index(iDCC <= kEEmHigh ? iDCC : iDCC - nEBDCC); - if(_runType[iDCC] == EcalDCCHeaderBlock::LED_STD || - _runType[iDCC] == EcalDCCHeaderBlock::LED_GAP){ - enable = true; - enable_[index] = true; - } - else + if (_runType[iDCC] == EcalDCCHeaderBlock::LED_STD || _runType[iDCC] == EcalDCCHeaderBlock::LED_GAP) { + enable = true; + enable_[index] = true; + } else enable_[index] = false; } return enable; } - void - LedTask::beginRun(edm::Run const&, edm::EventSetup const&) - { - emptyLS_ = 0; - } + void LedTask::beginRun(edm::Run const&, edm::EventSetup const&) { emptyLS_ = 0; } - void - LedTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) - { + void LedTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) { isemptyLS = 0; - if(emptyLS_+1 > emptyLSLimit_) emptyLS_ = -1; + if (emptyLS_ + 1 > emptyLSLimit_) + emptyLS_ = -1; } - void - LedTask::beginEvent(edm::Event const&, edm::EventSetup const&) - { - pnAmp_.clear(); - } + void LedTask::beginEvent(edm::Event const&, edm::EventSetup const&) { pnAmp_.clear(); } - void - LedTask::runOnRawData(EcalRawDataCollection const& _rawData) - { + void LedTask::runOnRawData(EcalRawDataCollection const& _rawData) { MESet& meCalibStatus(MEs_.at("CalibStatus")); - for(EcalRawDataCollection::const_iterator rItr(_rawData.begin()); rItr != _rawData.end(); ++rItr){ + for (EcalRawDataCollection::const_iterator rItr(_rawData.begin()); rItr != _rawData.end(); ++rItr) { unsigned iDCC(rItr->id() - 1); - if(iDCC >= kEBmLow && iDCC <= kEBpHigh) continue; + if (iDCC >= kEBmLow && iDCC <= kEBpHigh) + continue; unsigned index(iDCC <= kEEmHigh ? iDCC : iDCC - nEBDCC); - if(!enable_[index]){ + if (!enable_[index]) { wavelength_[index] = -1; rtHalf_[index] = -1; continue; } - if(rItr->getEventSettings().wavelength == 0) + if (rItr->getEventSettings().wavelength == 0) wavelength_[index] = 1; - else if(rItr->getEventSettings().wavelength == 2) + else if (rItr->getEventSettings().wavelength == 2) wavelength_[index] = 2; else wavelength_[index] = -1; - if(wlToME_.find(wavelength_[index]) == wlToME_.end()) + if (wlToME_.find(wavelength_[index]) == wlToME_.end()) enable_[index] = false; rtHalf_[index] = rItr->getRtHalf(); } bool LedStatus[2]; - for(unsigned iW(0); iW < 2; iW++){ - LedStatus[iW] = false; + for (unsigned iW(0); iW < 2; iW++) { + LedStatus[iW] = false; } - for(unsigned index(0); index < nEEDCC; ++index){ - switch (wavelength_[index]) - { - case 1: - LedStatus[0] = true; - break; - case 2: - LedStatus[1] = true; - break; - default: - break; - } + for (unsigned index(0); index < nEEDCC; ++index) { + switch (wavelength_[index]) { + case 1: + LedStatus[0] = true; + break; + case 2: + LedStatus[1] = true; + break; + default: + break; + } + } + for (unsigned iWL(0); iWL < 2; iWL++) { + meCalibStatus.fill(double(iWL + 3), LedStatus[iWL] ? 1 : 0); } - for(unsigned iWL(0); iWL<2; iWL++){ - meCalibStatus.fill(double(iWL+3), LedStatus[iWL]? 1:0); - } } - void - LedTask::runOnDigis(EEDigiCollection const& _digis) - { + void LedTask::runOnDigis(EEDigiCollection const& _digis) { MESet& meOccupancy(MEs_.at("Occupancy")); MESet& meShape(MEs_.at("Shape")); MESet& meSignalRate(MEs_.at("SignalRate")); int nReadouts[nEEDCC]; int maxpos[nEEDCC][10]; - for(unsigned index(0); index < nEEDCC; ++index){ + for (unsigned index(0); index < nEEDCC; ++index) { nReadouts[index] = 0; - for(int i(0); i < 10; i++) maxpos[index][i] = 0; + for (int i(0); i < 10; i++) + maxpos[index][i] = 0; } - for(EEDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ + for (EEDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) { const DetId& id(digiItr->id()); unsigned iDCC(dccId(id) - 1); - if(iDCC >= kEBmLow && iDCC <= kEBpHigh) continue; + if (iDCC >= kEBmLow && iDCC <= kEBpHigh) + continue; unsigned index(iDCC <= kEEmHigh ? iDCC : iDCC - nEBDCC); - if(!enable_[index]) continue; - if(rtHalf(id) != rtHalf_[index]) continue; + if (!enable_[index]) + continue; + if (rtHalf(id) != rtHalf_[index]) + continue; meOccupancy.fill(id); @@ -167,13 +146,14 @@ namespace ecaldqm { int min(4096); for (int i(0); i < 10; i++) { int adc(dataFrame.sample(i).adc()); - if(adc > max){ + if (adc > max) { max = adc; iMax = i; } - if(adc < min) min = adc; + if (adc < min) + min = adc; } - if(iMax >= 0 && max - min > 3) // normal RMS of pedestal is ~2.5 + if (iMax >= 0 && max - min > 3) // normal RMS of pedestal is ~2.5 maxpos[index][iMax] += 1; } @@ -183,24 +163,25 @@ namespace ecaldqm { unsigned iME(-1); - for(int index(0); index < nEEDCC; ++index){ - if(nReadouts[index] == 0){ + for (int index(0); index < nEEDCC; ++index) { + if (nReadouts[index] == 0) { enable_[index] = false; continue; } int threshold(nReadouts[index] / 3); - if(ledOnExpected) enable_[index] = false; + if (ledOnExpected) + enable_[index] = false; - for(int i(0); i < 10; i++){ - if(maxpos[index][i] > threshold){ + for (int i(0); i < 10; i++) { + if (maxpos[index][i] > threshold) { enable = true; enable_[index] = true; break; } } - if(iME != wlToME_[wavelength_[index]]){ + if (iME != wlToME_[wavelength_[index]]) { iME = wlToME_[wavelength_[index]]; static_cast(meSignalRate).use(iME); } @@ -208,25 +189,32 @@ namespace ecaldqm { meSignalRate.fill((index <= kEEmHigh ? index : index + nEBDCC) + 1, enable_[index] ? 1 : 0); } - if(!enable && isemptyLS >= 0) isemptyLS = 1; - else if(enable) isemptyLS = -1; + if (!enable && isemptyLS >= 0) + isemptyLS = 1; + else if (enable) + isemptyLS = -1; - if(enable) emptyLS_ = 0; - else if(ledOnExpected) return; + if (enable) + emptyLS_ = 0; + else if (ledOnExpected) + return; iME = -1; - for(EEDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ + for (EEDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) { const DetId& id(digiItr->id()); unsigned iDCC(dccId(id) - 1); - if(iDCC >= kEBmLow && iDCC <= kEBpHigh) continue; + if (iDCC >= kEBmLow && iDCC <= kEBpHigh) + continue; unsigned index(iDCC <= kEEmHigh ? iDCC : iDCC - nEBDCC); - if(!enable_[index]) continue; - if(rtHalf(id) != rtHalf_[index]) continue; + if (!enable_[index]) + continue; + if (rtHalf(id) != rtHalf_[index]) + continue; - if(iME != wlToME_[wavelength_[index]]){ + if (iME != wlToME_[wavelength_[index]]) { iME = wlToME_[wavelength_[index]]; static_cast(meShape).use(iME); } @@ -234,48 +222,51 @@ namespace ecaldqm { // EcalDataFrame is not a derived class of edm::DataFrame, but can take edm::DataFrame in the constructor EcalDataFrame dataFrame(*digiItr); - for(int iSample(0); iSample < 10; iSample++) - meShape.fill(id, iSample + 0.5, float(dataFrame.sample(iSample).adc())); + for (int iSample(0); iSample < 10; iSample++) + meShape.fill(id, iSample + 0.5, float(dataFrame.sample(iSample).adc())); EcalPnDiodeDetId pnidA(pnForCrystal(id, 'a')); EcalPnDiodeDetId pnidB(pnForCrystal(id, 'b')); - if(pnidA.null() || pnidB.null()) continue; + if (pnidA.null() || pnidB.null()) + continue; pnAmp_.insert(std::make_pair(pnidA.rawId(), 0.)); pnAmp_.insert(std::make_pair(pnidB.rawId(), 0.)); } } - void - LedTask::runOnPnDigis(EcalPnDiodeDigiCollection const& _digis) - { + void LedTask::runOnPnDigis(EcalPnDiodeDigiCollection const& _digis) { MESet& mePNAmplitude(MEs_.at("PNAmplitude")); unsigned iME(-1); - for(EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ - if(digiItr->sample(0).gainId() != 0 && digiItr->sample(0).gainId() != 1) continue; + for (EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) { + if (digiItr->sample(0).gainId() != 0 && digiItr->sample(0).gainId() != 1) + continue; const EcalPnDiodeDetId& id(digiItr->id()); std::map::iterator ampItr(pnAmp_.find(id.rawId())); - if(ampItr == pnAmp_.end()) continue; + if (ampItr == pnAmp_.end()) + continue; unsigned iDCC(dccId(id) - 1); - if(iDCC >= kEBmLow && iDCC <= kEBpHigh) continue; + if (iDCC >= kEBmLow && iDCC <= kEBpHigh) + continue; unsigned index(iDCC <= kEEmHigh ? iDCC : iDCC - nEBDCC); float pedestal(0.); - for(int iSample(0); iSample < 4; iSample++) - pedestal += digiItr->sample(iSample).adc(); + for (int iSample(0); iSample < 4; iSample++) + pedestal += digiItr->sample(iSample).adc(); pedestal /= 4.; float max(0.); - for(int iSample(0); iSample < 50; iSample++){ - float amp(digiItr->sample(iSample).adc() - pedestal); - if(amp > max) max = amp; + for (int iSample(0); iSample < 50; iSample++) { + float amp(digiItr->sample(iSample).adc() - pedestal); + if (amp > max) + max = amp; } - if(iME != wlToME_[wavelength_[index]]){ + if (iME != wlToME_[wavelength_[index]]) { iME = wlToME_[wavelength_[index]]; static_cast(mePNAmplitude).use(iME); } @@ -286,9 +277,7 @@ namespace ecaldqm { } } - void - LedTask::runOnUncalibRecHits(EcalUncalibratedRecHitCollection const& _uhits) - { + void LedTask::runOnUncalibRecHits(EcalUncalibratedRecHitCollection const& _uhits) { using namespace std; MESet& meAmplitude(MEs_.at("Amplitude")); @@ -298,17 +287,20 @@ namespace ecaldqm { unsigned iME(-1); - for(EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr){ + for (EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr) { EEDetId id(uhitItr->id()); unsigned iDCC(dccId(id) - 1); - if(iDCC >= kEBmLow && iDCC <= kEBpHigh) continue; + if (iDCC >= kEBmLow && iDCC <= kEBpHigh) + continue; unsigned index(iDCC <= kEEmHigh ? iDCC : iDCC - nEBDCC); - if(!enable_[index]) continue; - if(rtHalf(id) != rtHalf_[index]) continue; + if (!enable_[index]) + continue; + if (rtHalf(id) != rtHalf_[index]) + continue; - if(iME != wlToME_[wavelength_[index]]){ + if (iME != wlToME_[wavelength_[index]]) { iME = wlToME_[wavelength_[index]]; static_cast(meAmplitude).use(iME); static_cast(meAmplitudeSummary).use(iME); @@ -327,20 +319,23 @@ namespace ecaldqm { map::iterator ampItrA(pnAmp_.find(pnForCrystal(id, 'a'))); map::iterator ampItrB(pnAmp_.find(pnForCrystal(id, 'b'))); - if(ampItrA == pnAmp_.end() && ampItrB == pnAmp_.end()) continue; - else if(ampItrB == pnAmp_.end()) aop = amp / ampItrA->second; - else if(ampItrA == pnAmp_.end()) aop = amp / ampItrB->second; - else aop = amp / (ampItrA->second + ampItrB->second) * 2.; + if (ampItrA == pnAmp_.end() && ampItrB == pnAmp_.end()) + continue; + else if (ampItrB == pnAmp_.end()) + aop = amp / ampItrA->second; + else if (ampItrA == pnAmp_.end()) + aop = amp / ampItrB->second; + else + aop = amp / (ampItrA->second + ampItrB->second) * 2.; meAOverP.fill(id, aop); } } - void - LedTask::endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&){ - if(isemptyLS == 1)emptyLS_ += 1; + void LedTask::endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) { + if (isemptyLS == 1) + emptyLS_ += 1; } DEFINE_ECALDQM_WORKER(LedTask); -} - +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/OccupancyTask.cc b/DQM/EcalMonitorTasks/src/OccupancyTask.cc index 52ff29e356195..aedc914de1d19 100644 --- a/DQM/EcalMonitorTasks/src/OccupancyTask.cc +++ b/DQM/EcalMonitorTasks/src/OccupancyTask.cc @@ -5,59 +5,42 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" -namespace ecaldqm -{ - OccupancyTask::OccupancyTask() : - DQWorkerTask(), - recHitThreshold_(0.), - tpThreshold_(0.) - { - } +namespace ecaldqm { + OccupancyTask::OccupancyTask() : DQWorkerTask(), recHitThreshold_(0.), tpThreshold_(0.) {} - void - OccupancyTask::setParams(edm::ParameterSet const& _params) - { + void OccupancyTask::setParams(edm::ParameterSet const& _params) { recHitThreshold_ = _params.getUntrackedParameter("recHitThreshold"); tpThreshold_ = _params.getUntrackedParameter("tpThreshold"); } - bool - OccupancyTask::filterRunType(short const* _runType) - { - for(int iFED(0); iFED < 54; iFED++){ - if(_runType[iFED] == EcalDCCHeaderBlock::COSMIC || - _runType[iFED] == EcalDCCHeaderBlock::MTCC || - _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL || - _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || - _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL || - _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) return true; + bool OccupancyTask::filterRunType(short const* _runType) { + for (int iFED(0); iFED < 54; iFED++) { + if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC || + _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL || + _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL || + _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) + return true; } return false; } - void - OccupancyTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) - { + void OccupancyTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) { // Reset by LS plots at beginning of every LS MEs_.at("DigiAllByLumi").reset(); MEs_.at("TPDigiThrAllByLumi").reset(); MEs_.at("RecHitThrAllByLumi").reset(); } - void - OccupancyTask::runOnRawData(EcalRawDataCollection const& _dcchs) - { + void OccupancyTask::runOnRawData(EcalRawDataCollection const& _dcchs) { MESet& meDCC(MEs_.at("DCC")); - for(EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr) + for (EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr) meDCC.fill(dcchItr->id()); } - template - void - OccupancyTask::runOnDigis(DigiCollection const& _digis, Collections _collection) - { + template + void OccupancyTask::runOnDigis(DigiCollection const& _digis, Collections _collection) { MESet& meDigi(MEs_.at("Digi")); MESet& meDigiProjEta(MEs_.at("DigiProjEta")); MESet& meDigiProjPhi(MEs_.at("DigiProjPhi")); @@ -67,24 +50,22 @@ namespace ecaldqm MESet& meDigi1D(MEs_.at("Digi1D")); MESet& meTrendNDigi(MEs_.at("TrendNDigi")); - std::for_each(_digis.begin(), _digis.end(), [&](typename DigiCollection::Digi const& digi){ - DetId id(digi.id()); - meDigi.fill(id); - meDigiProjEta.fill(id); - meDigiProjPhi.fill(id); - meDigiAll.fill(id); - meDigiAllByLumi.fill(id); - meDigiDCC.fill(id); - }); + std::for_each(_digis.begin(), _digis.end(), [&](typename DigiCollection::Digi const& digi) { + DetId id(digi.id()); + meDigi.fill(id); + meDigiProjEta.fill(id); + meDigiProjPhi.fill(id); + meDigiAll.fill(id); + meDigiAllByLumi.fill(id); + meDigiDCC.fill(id); + }); int iSubdet(_collection == kEBDigi ? EcalBarrel : EcalEndcap); meDigi1D.fill(iSubdet, double(_digis.size())); meTrendNDigi.fill(iSubdet, double(timestamp_.iLumi), double(_digis.size())); } - void - OccupancyTask::runOnTPDigis(EcalTrigPrimDigiCollection const& _digis) - { + void OccupancyTask::runOnTPDigis(EcalTrigPrimDigiCollection const& _digis) { // MESet& meTPDigiAll(MEs_.at("TPDigiAll")); // MESet& meTPDigiProjEta(MEs_.at("TPDigiProjEta")); // MESet& meTPDigiProjPhi(MEs_.at("TPDigiProjPhi")); @@ -98,29 +79,29 @@ namespace ecaldqm double nFilteredEB(0.); double nFilteredEE(0.); - std::for_each(_digis.begin(), _digis.end(), [&](EcalTrigPrimDigiCollection::value_type const& digi){ - EcalTrigTowerDetId const& id(digi.id()); - // meTPDigiProjEta.fill(id); - // meTPDigiProjPhi.fill(id); - // meTPDigiAll.fill(id); - if(digi.compressedEt() > tpThreshold_){ - meTPDigiThrProjEta.fill(id); - meTPDigiThrProjPhi.fill(id); - meTPDigiThrAll.fill(id); - meTPDigiThrAllByLumi.fill(id); - meTPDigiRCT.fill(id); - if(id.subDet() == EcalBarrel) nFilteredEB += 1.; - else nFilteredEE += 1.; - } - }); + std::for_each(_digis.begin(), _digis.end(), [&](EcalTrigPrimDigiCollection::value_type const& digi) { + EcalTrigTowerDetId const& id(digi.id()); + // meTPDigiProjEta.fill(id); + // meTPDigiProjPhi.fill(id); + // meTPDigiAll.fill(id); + if (digi.compressedEt() > tpThreshold_) { + meTPDigiThrProjEta.fill(id); + meTPDigiThrProjPhi.fill(id); + meTPDigiThrAll.fill(id); + meTPDigiThrAllByLumi.fill(id); + meTPDigiRCT.fill(id); + if (id.subDet() == EcalBarrel) + nFilteredEB += 1.; + else + nFilteredEE += 1.; + } + }); meTrendNTPDigi.fill(EcalBarrel, double(timestamp_.iLumi), nFilteredEB); meTrendNTPDigi.fill(EcalEndcap, double(timestamp_.iLumi), nFilteredEE); } - void - OccupancyTask::runOnRecHits(EcalRecHitCollection const& _hits, Collections _collection) - { + void OccupancyTask::runOnRecHits(EcalRecHitCollection const& _hits, Collections _collection) { MESet& meRecHitAll(MEs_.at("RecHitAll")); MESet& meRecHitProjEta(MEs_.at("RecHitProjEta")); MESet& meRecHitProjPhi(MEs_.at("RecHitProjPhi")); @@ -138,33 +119,32 @@ namespace ecaldqm float nRHThrp(0), nRHThrm(0); int iSubdet(_collection == kEBRecHit ? EcalBarrel : EcalEndcap); - std::for_each(_hits.begin(), _hits.end(), [&](EcalRecHitCollection::value_type const& hit){ - DetId id(hit.id()); - - meRecHitAll.fill(id); - meRecHitProjEta.fill(id); - meRecHitProjPhi.fill(id); - - if(!hit.checkFlagMask(mask) && hit.energy() > recHitThreshold_){ - meRecHitThrProjEta.fill(id); - meRecHitThrProjPhi.fill(id); - meRecHitThrAll.fill(id); - meRecHitThrAllByLumi.fill(id); - nFiltered += 1.; - bool isPlusFar ( iSubdet == EcalBarrel ? (EBDetId(id).iphi() > 100 && EBDetId(id).iphi() < 280) : zside(id) > 0 ); - if ( isPlusFar ) - nRHThrp++; - else - nRHThrm++; - } - }); + std::for_each(_hits.begin(), _hits.end(), [&](EcalRecHitCollection::value_type const& hit) { + DetId id(hit.id()); + + meRecHitAll.fill(id); + meRecHitProjEta.fill(id); + meRecHitProjPhi.fill(id); + + if (!hit.checkFlagMask(mask) && hit.energy() > recHitThreshold_) { + meRecHitThrProjEta.fill(id); + meRecHitThrProjPhi.fill(id); + meRecHitThrAll.fill(id); + meRecHitThrAllByLumi.fill(id); + nFiltered += 1.; + bool isPlusFar(iSubdet == EcalBarrel ? (EBDetId(id).iphi() > 100 && EBDetId(id).iphi() < 280) : zside(id) > 0); + if (isPlusFar) + nRHThrp++; + else + nRHThrm++; + } + }); meRecHitThr1D.fill(iSubdet, nFiltered); meTrendNRecHitThr.fill(iSubdet, double(timestamp_.iLumi), nFiltered); - meRecHitThrmvp.fill(iSubdet,nRHThrp,nRHThrm); - meRecHitThrpm.fill(iSubdet,nRHThrp-nRHThrm); + meRecHitThrmvp.fill(iSubdet, nRHThrp, nRHThrm); + meRecHitThrpm.fill(iSubdet, nRHThrp - nRHThrm); } DEFINE_ECALDQM_WORKER(OccupancyTask); -} - +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/PNDiodeTask.cc b/DQM/EcalMonitorTasks/src/PNDiodeTask.cc index 00f2cc21d3c6b..af1ed4bdf500f 100644 --- a/DQM/EcalMonitorTasks/src/PNDiodeTask.cc +++ b/DQM/EcalMonitorTasks/src/PNDiodeTask.cc @@ -5,93 +5,83 @@ namespace ecaldqm { - PNDiodeTask::PNDiodeTask() : - DQWorkerTask() - { - std::fill_n(enable_, nDCC, false); - } + PNDiodeTask::PNDiodeTask() : DQWorkerTask() { std::fill_n(enable_, nDCC, false); } - bool - PNDiodeTask::filterRunType(short const* _runType) - { + bool PNDiodeTask::filterRunType(short const* _runType) { bool enable(false); - for(int iDCC(0); iDCC < 54; iDCC++){ - if(_runType[iDCC] == EcalDCCHeaderBlock::LASER_STD || - _runType[iDCC] == EcalDCCHeaderBlock::LASER_GAP || - _runType[iDCC] == EcalDCCHeaderBlock::LED_STD || - _runType[iDCC] == EcalDCCHeaderBlock::LED_GAP || - _runType[iDCC] == EcalDCCHeaderBlock::TESTPULSE_MGPA || - _runType[iDCC] == EcalDCCHeaderBlock::TESTPULSE_GAP || - _runType[iDCC] == EcalDCCHeaderBlock::PEDESTAL_STD || - _runType[iDCC] == EcalDCCHeaderBlock::PEDESTAL_GAP){ + for (int iDCC(0); iDCC < 54; iDCC++) { + if (_runType[iDCC] == EcalDCCHeaderBlock::LASER_STD || _runType[iDCC] == EcalDCCHeaderBlock::LASER_GAP || + _runType[iDCC] == EcalDCCHeaderBlock::LED_STD || _runType[iDCC] == EcalDCCHeaderBlock::LED_GAP || + _runType[iDCC] == EcalDCCHeaderBlock::TESTPULSE_MGPA || _runType[iDCC] == EcalDCCHeaderBlock::TESTPULSE_GAP || + _runType[iDCC] == EcalDCCHeaderBlock::PEDESTAL_STD || _runType[iDCC] == EcalDCCHeaderBlock::PEDESTAL_GAP) { enable = true; enable_[iDCC] = true; - } - else + } else enable_[iDCC] = false; } return enable; } - void - PNDiodeTask::runOnErrors(EcalElectronicsIdCollection const& _ids, Collections _collection) - { - if(_ids.empty()) return; + void PNDiodeTask::runOnErrors(EcalElectronicsIdCollection const& _ids, Collections _collection) { + if (_ids.empty()) + return; MESet* set(nullptr); - switch(_collection){ - case kMEMTowerIdErrors: - set = &MEs_.at("MEMTowerId"); - break; - case kMEMBlockSizeErrors: - set = &MEs_.at("MEMBlockSize"); - break; - case kMEMChIdErrors: - set = &MEs_.at("MEMChId"); - break; - case kMEMGainErrors: - set = &MEs_.at("MEMGain"); - break; - default: - return; + switch (_collection) { + case kMEMTowerIdErrors: + set = &MEs_.at("MEMTowerId"); + break; + case kMEMBlockSizeErrors: + set = &MEs_.at("MEMBlockSize"); + break; + case kMEMChIdErrors: + set = &MEs_.at("MEMChId"); + break; + case kMEMGainErrors: + set = &MEs_.at("MEMGain"); + break; + default: + return; } - std::for_each(_ids.begin(), _ids.end(), [&](EcalElectronicsIdCollection::value_type const& id){ - if (id.towerId() == 69) { - edm::LogWarning("EcalDQM") << "PNDiodeTask::runOnErrors : one of the ids in the electronics ID collection is unphysical in lumi number " << timestamp_.iLumi << ", event number " << timestamp_.iEvt; // Added March 2018 because some events have this unphysical tower ID and cause the ECAL calibration application to crash. - } - else { - set->fill(EcalElectronicsId(id.dccId(), id.towerId(), 1, id.xtalId())); - } - }); + std::for_each(_ids.begin(), _ids.end(), [&](EcalElectronicsIdCollection::value_type const& id) { + if (id.towerId() == 69) { + edm::LogWarning("EcalDQM") + << "PNDiodeTask::runOnErrors : one of the ids in the electronics ID collection is unphysical in lumi " + "number " + << timestamp_.iLumi << ", event number " + << timestamp_ + .iEvt; // Added March 2018 because some events have this unphysical tower ID and cause the ECAL calibration application to crash. + } else { + set->fill(EcalElectronicsId(id.dccId(), id.towerId(), 1, id.xtalId())); + } + }); } - void - PNDiodeTask::runOnPnDigis(EcalPnDiodeDigiCollection const& _digis) - { + void PNDiodeTask::runOnPnDigis(EcalPnDiodeDigiCollection const& _digis) { MESet& meOccupancy(MEs_.at("Occupancy")); MESet& meOccupancySummary(MEs_.at("OccupancySummary")); MESet& mePedestal(MEs_.at("Pedestal")); - std::for_each(_digis.begin(), _digis.end(), [&](EcalPnDiodeDigiCollection::value_type const& digi){ - const EcalPnDiodeDetId& id(digi.id()); + std::for_each(_digis.begin(), _digis.end(), [&](EcalPnDiodeDigiCollection::value_type const& digi) { + const EcalPnDiodeDetId& id(digi.id()); - if(!enable_[dccId(id) - 1]) return; + if (!enable_[dccId(id) - 1]) + return; - meOccupancy.fill(id); - meOccupancySummary.fill(id); + meOccupancy.fill(id); + meOccupancySummary.fill(id); - for(int iSample(0); iSample < 4; iSample++){ - if(digi.sample(iSample).gainId() != 1) break; - mePedestal.fill(id, double(digi.sample(iSample).adc())); - } - }); + for (int iSample(0); iSample < 4; iSample++) { + if (digi.sample(iSample).gainId() != 1) + break; + mePedestal.fill(id, double(digi.sample(iSample).adc())); + } + }); } DEFINE_ECALDQM_WORKER(PNDiodeTask); -} - - +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/PedestalTask.cc b/DQM/EcalMonitorTasks/src/PedestalTask.cc index 7f88507cd5c05..f39f37ffb3e6e 100644 --- a/DQM/EcalMonitorTasks/src/PedestalTask.cc +++ b/DQM/EcalMonitorTasks/src/PedestalTask.cc @@ -9,19 +9,10 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" -namespace ecaldqm -{ - PedestalTask::PedestalTask() : - DQWorkerTask(), - gainToME_(), - pnGainToME_() - { - std::fill_n(enable_, nDCC, false); - } +namespace ecaldqm { + PedestalTask::PedestalTask() : DQWorkerTask(), gainToME_(), pnGainToME_() { std::fill_n(enable_, nDCC, false); } - void - PedestalTask::setParams(edm::ParameterSet const& _params) - { + void PedestalTask::setParams(edm::ParameterSet const& _params) { std::vector MGPAGains(_params.getUntrackedParameter >("MGPAGains")); std::vector MGPAGainsPN(_params.getUntrackedParameter >("MGPAGainsPN")); @@ -29,9 +20,10 @@ namespace ecaldqm MESetMulti& pedestal(static_cast(MEs_.at("Pedestal"))); unsigned nG(MGPAGains.size()); - for(unsigned iG(0); iG != nG; ++iG){ + for (unsigned iG(0); iG != nG; ++iG) { int gain(MGPAGains[iG]); - if(gain != 1 && gain != 6 && gain != 12) throw cms::Exception("InvalidConfiguration") << "MGPA gain"; + if (gain != 1 && gain != 6 && gain != 12) + throw cms::Exception("InvalidConfiguration") << "MGPA gain"; repl["gain"] = std::to_string(gain); gainToME_[gain] = pedestal.getIndex(repl); } @@ -40,105 +32,114 @@ namespace ecaldqm MESetMulti& pnPedestal(static_cast(MEs_.at("PNPedestal"))); unsigned nGPN(MGPAGainsPN.size()); - for(unsigned iG(0); iG != nGPN; ++iG){ + for (unsigned iG(0); iG != nGPN; ++iG) { int gain(MGPAGainsPN[iG]); - if(gain != 1 && gain != 16) throw cms::Exception("InvalidConfiguration") << "PN MGPA gain"; + if (gain != 1 && gain != 16) + throw cms::Exception("InvalidConfiguration") << "PN MGPA gain"; repl["pngain"] = std::to_string(gain); pnGainToME_[gain] = pnPedestal.getIndex(repl); } } - bool - PedestalTask::filterRunType(short const* _runType) - { + bool PedestalTask::filterRunType(short const* _runType) { bool enable(false); - for(int iFED(0); iFED < nDCC; iFED++){ - if(_runType[iFED] == EcalDCCHeaderBlock::PEDESTAL_STD || - _runType[iFED] == EcalDCCHeaderBlock::PEDESTAL_GAP){ - enable = true; - enable_[iFED] = true; - } - else + for (int iFED(0); iFED < nDCC; iFED++) { + if (_runType[iFED] == EcalDCCHeaderBlock::PEDESTAL_STD || _runType[iFED] == EcalDCCHeaderBlock::PEDESTAL_GAP) { + enable = true; + enable_[iFED] = true; + } else enable_[iFED] = false; } return enable; } - template - void - PedestalTask::runOnDigis(DigiCollection const& _digis) - { + template + void PedestalTask::runOnDigis(DigiCollection const& _digis) { MESet& mePedestal(MEs_.at("Pedestal")); MESet& meOccupancy(MEs_.at("Occupancy")); unsigned iME(-1); - for(typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ + for (typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) { DetId id(digiItr->id()); int iDCC(dccId(id) - 1); - if(!enable_[iDCC]) continue; + if (!enable_[iDCC]) + continue; // EcalDataFrame is not a derived class of edm::DataFrame, but can take edm::DataFrame in the constructor EcalDataFrame dataFrame(*digiItr); int gain(0); - switch(dataFrame.sample(0).gainId()){ - case 1: gain = 12; break; - case 2: gain = 6; break; - case 3: gain = 1; break; - default: continue; + switch (dataFrame.sample(0).gainId()) { + case 1: + gain = 12; + break; + case 2: + gain = 6; + break; + case 3: + gain = 1; + break; + default: + continue; } - if(gainToME_.find(gain) == gainToME_.end()) continue; + if (gainToME_.find(gain) == gainToME_.end()) + continue; - if(iME != gainToME_[gain]){ + if (iME != gainToME_[gain]) { iME = gainToME_[gain]; static_cast(mePedestal).use(iME); } meOccupancy.fill(id); - for(int iSample(0); iSample < EcalDataFrame::MAXSAMPLES; iSample++) - mePedestal.fill(id, double(dataFrame.sample(iSample).adc())); + for (int iSample(0); iSample < EcalDataFrame::MAXSAMPLES; iSample++) + mePedestal.fill(id, double(dataFrame.sample(iSample).adc())); } } - void - PedestalTask::runOnPnDigis(EcalPnDiodeDigiCollection const& _digis) - { + void PedestalTask::runOnPnDigis(EcalPnDiodeDigiCollection const& _digis) { MESet& mePNPedestal(MEs_.at("PNPedestal")); unsigned iME(-1); - for(EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ + for (EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) { EcalPnDiodeDetId id(digiItr->id()); int iDCC(dccId(id) - 1); - if(!enable_[iDCC]) continue; + if (!enable_[iDCC]) + continue; int gain(0); - switch(digiItr->sample(0).gainId()){ - case 0: gain = 1; break; - case 1: gain = 16; break; - default: continue; + switch (digiItr->sample(0).gainId()) { + case 0: + gain = 1; + break; + case 1: + gain = 16; + break; + default: + continue; } - if(pnGainToME_.find(gain) == pnGainToME_.end()) continue; + if (pnGainToME_.find(gain) == pnGainToME_.end()) + continue; - if(iME != pnGainToME_[gain]){ + if (iME != pnGainToME_[gain]) { iME = pnGainToME_[gain]; static_cast(mePNPedestal).use(iME); } - for(int iSample(0); iSample < 50; iSample++) + for (int iSample(0); iSample < 50; iSample++) mePNPedestal.fill(id, double(digiItr->sample(iSample).adc())); } } DEFINE_ECALDQM_WORKER(PedestalTask); -} +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/PresampleTask.cc b/DQM/EcalMonitorTasks/src/PresampleTask.cc index d3d604c60a6f1..5ce6dfea7e069 100644 --- a/DQM/EcalMonitorTasks/src/PresampleTask.cc +++ b/DQM/EcalMonitorTasks/src/PresampleTask.cc @@ -6,58 +6,42 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" -namespace ecaldqm -{ - PresampleTask::PresampleTask() : - DQWorkerTask(), - doPulseMaxCheck_(true), - pulseMaxPosition_(0), - nSamples_(0), - mePedestalByLS(nullptr) - { - } +namespace ecaldqm { + PresampleTask::PresampleTask() + : DQWorkerTask(), doPulseMaxCheck_(true), pulseMaxPosition_(0), nSamples_(0), mePedestalByLS(nullptr) {} - void - PresampleTask::setParams(edm::ParameterSet const& _params) - { + void PresampleTask::setParams(edm::ParameterSet const& _params) { doPulseMaxCheck_ = _params.getUntrackedParameter("doPulseMaxCheck"); pulseMaxPosition_ = _params.getUntrackedParameter("pulseMaxPosition"); nSamples_ = _params.getUntrackedParameter("nSamples"); } - bool - PresampleTask::filterRunType(short const* _runType) - { - for(int iFED(0); iFED < nDCC; iFED++){ - if(_runType[iFED] == EcalDCCHeaderBlock::COSMIC || - _runType[iFED] == EcalDCCHeaderBlock::MTCC || - _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL || - _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || - _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL || - _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) return true; + bool PresampleTask::filterRunType(short const* _runType) { + for (int iFED(0); iFED < nDCC; iFED++) { + if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC || + _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL || + _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL || + _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) + return true; } return false; } - void - PresampleTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) - { + void PresampleTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) { // Fill separate MEs with only 10 LSs worth of stats // Used to correctly fill Presample Trend plots: // 1 pt:10 LS in Trend plots mePedestalByLS = &MEs_.at("PedestalByLS"); - if ( timestamp_.iLumi % 10 == 0 ) + if (timestamp_.iLumi % 10 == 0) mePedestalByLS->reset(); } - template - void - PresampleTask::runOnDigis(DigiCollection const& _digis) - { - MESet& mePedestal(MEs_.at("Pedestal")); // contains cumulative run stats => not suitable for Trend plots + template + void PresampleTask::runOnDigis(DigiCollection const& _digis) { + MESet& mePedestal(MEs_.at("Pedestal")); // contains cumulative run stats => not suitable for Trend plots - for(typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ + for (typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) { DetId id(digiItr->id()); // EcalDataFrame is not a derived class of edm::DataFrame, but can take edm::DataFrame in the constructor @@ -65,32 +49,32 @@ namespace ecaldqm // Check that the digi pulse maximum occurs on the 6th sample // For cosmics: disable this check to preserve statistics - if ( doPulseMaxCheck_ ) { + if (doPulseMaxCheck_) { bool gainSwitch(false); int iMax(-1); int maxADC(0); - for(int iSample(0); iSample < EcalDataFrame::MAXSAMPLES; ++iSample){ + for (int iSample(0); iSample < EcalDataFrame::MAXSAMPLES; ++iSample) { int adc(dataFrame.sample(iSample).adc()); - if(adc > maxADC){ + if (adc > maxADC) { iMax = iSample; maxADC = adc; } - if(iSample < nSamples_ && dataFrame.sample(iSample).gainId() != 1){ + if (iSample < nSamples_ && dataFrame.sample(iSample).gainId() != 1) { gainSwitch = true; break; } - } // iSample - if(iMax != pulseMaxPosition_ || gainSwitch) continue; - } // PulseMaxCheck + } // iSample + if (iMax != pulseMaxPosition_ || gainSwitch) + continue; + } // PulseMaxCheck - for(int iSample(0); iSample < nSamples_; ++iSample) { + for (int iSample(0); iSample < nSamples_; ++iSample) { mePedestal.fill(id, double(dataFrame.sample(iSample).adc())); mePedestalByLS->fill(id, double(dataFrame.sample(iSample).adc())); } - } // _digis loop - } // runOnDigis + } // _digis loop + } // runOnDigis DEFINE_ECALDQM_WORKER(PresampleTask); -} - +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/RawDataTask.cc b/DQM/EcalMonitorTasks/src/RawDataTask.cc index a2cb9acd6c392..d372d8e3700b2 100644 --- a/DQM/EcalMonitorTasks/src/RawDataTask.cc +++ b/DQM/EcalMonitorTasks/src/RawDataTask.cc @@ -11,41 +11,23 @@ namespace ecaldqm { - RawDataTask::RawDataTask() : - DQWorkerTask(), - runNumber_(0), - l1A_(0), - orbit_(0), - bx_(0), - triggerType_(0), - feL1Offset_(0) - { - } + RawDataTask::RawDataTask() + : DQWorkerTask(), runNumber_(0), l1A_(0), orbit_(0), bx_(0), triggerType_(0), feL1Offset_(0) {} - void - RawDataTask::addDependencies(DependencySet& _dependencies) - { + void RawDataTask::addDependencies(DependencySet& _dependencies) { _dependencies.push_back(Dependency(kEcalRawData, kSource)); } - void - RawDataTask::beginRun(edm::Run const& _run, edm::EventSetup const&) - { - runNumber_ = _run.run(); - } + void RawDataTask::beginRun(edm::Run const& _run, edm::EventSetup const&) { runNumber_ = _run.run(); } - void - RawDataTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) - { + void RawDataTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) { // Reset by LS plots at beginning of every LS MEs_.at("DesyncByLumi").reset(); MEs_.at("FEByLumi").reset(); MEs_.at("FEStatusErrMapByLumi").reset(); } - void - RawDataTask::beginEvent(edm::Event const& _evt, edm::EventSetup const&) - { + void RawDataTask::beginEvent(edm::Event const& _evt, edm::EventSetup const&) { orbit_ = _evt.orbitNumber() & 0xffffffff; bx_ = _evt.bunchCrossing() & 0xfff; triggerType_ = _evt.experimentType() & 0xf; @@ -53,31 +35,28 @@ namespace ecaldqm { feL1Offset_ = _evt.isRealData() ? 1 : 0; } - void - RawDataTask::runOnSource(FEDRawDataCollection const& _fedRaw) - { + void RawDataTask::runOnSource(FEDRawDataCollection const& _fedRaw) { MESet& meCRC(MEs_.at("CRC")); // Get GT L1 info - const FEDRawData >FED(_fedRaw.FEDData(812)); - if(gtFED.size() > sizeof(uint64_t)){ // FED header is one 64 bit word - const uint32_t *halfHeader = reinterpret_cast(gtFED.data()); + const FEDRawData& gtFED(_fedRaw.FEDData(812)); + if (gtFED.size() > sizeof(uint64_t)) { // FED header is one 64 bit word + const uint32_t* halfHeader = reinterpret_cast(gtFED.data()); l1A_ = *(halfHeader + 1) & 0xffffff; } - for(int iFED(601); iFED <= 654; iFED++){ + for (int iFED(601); iFED <= 654; iFED++) { const FEDRawData& fedData(_fedRaw.FEDData(iFED)); unsigned length(fedData.size() / sizeof(uint64_t)); - if(length > 1){ // FED header is one 64 bit word + if (length > 1) { // FED header is one 64 bit word const uint64_t* pData(reinterpret_cast(fedData.data())); - if((pData[length - 1] & 0x4) != 0) meCRC.fill(iFED - 600); + if ((pData[length - 1] & 0x4) != 0) + meCRC.fill(iFED - 600); } } } - - void - RawDataTask::runOnRawData(EcalRawDataCollection const& _dcchs) - { + + void RawDataTask::runOnRawData(EcalRawDataCollection const& _dcchs) { using namespace std; MESet& meRunNumber(MEs_.at("RunNumber")); @@ -105,22 +84,22 @@ namespace ecaldqm { MESet& meEventTypeCalib(MEs_.at("EventTypeCalib")); MESet& meEventTypePostCalib(MEs_.at("EventTypePostCalib")); - if(!l1A_){ + if (!l1A_) { // majority vote on L1A.. is there no better implementation? map l1aCounts; - for(EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr){ + for (EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr) { l1aCounts[dcchItr->getLV1()]++; } int maxVote(0); - for(map::iterator l1aItr(l1aCounts.begin()); l1aItr != l1aCounts.end(); ++l1aItr){ - if(l1aItr->second > maxVote){ + for (map::iterator l1aItr(l1aCounts.begin()); l1aItr != l1aCounts.end(); ++l1aItr) { + if (l1aItr->second > maxVote) { maxVote = l1aItr->second; l1A_ = l1aItr->first; } } } - for(EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr){ + for (EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr) { int dccId(dcchItr->id()); int dccL1A(dcchItr->getLV1()); @@ -129,124 +108,132 @@ namespace ecaldqm { meOrbitDiff.fill(dccId, dcchItr->getOrbit() - orbit_); meBXDCCDiff.fill(dccId, dccBX - bx_); - if(dccBX == -1) meBXFEInvalid.fill(dccId, 68.5); - - if(dcchItr->getRunNumber() != int(runNumber_)) meRunNumber.fill(dccId); - if(dcchItr->getOrbit() != orbit_) meOrbit.fill(dccId); - if(dcchItr->getBasicTriggerType() != triggerType_) meTriggerType.fill(dccId); - if(dccL1A != l1A_) meL1ADCC.fill(dccId); - if(dccBX != bx_) meBXDCC.fill(dccId); - - const vector &feStatus(dcchItr->getFEStatus()); - const vector &feBxs(dcchItr->getFEBxs()); - const vector &feL1s(dcchItr->getFELv1()); + if (dccBX == -1) + meBXFEInvalid.fill(dccId, 68.5); + + if (dcchItr->getRunNumber() != int(runNumber_)) + meRunNumber.fill(dccId); + if (dcchItr->getOrbit() != orbit_) + meOrbit.fill(dccId); + if (dcchItr->getBasicTriggerType() != triggerType_) + meTriggerType.fill(dccId); + if (dccL1A != l1A_) + meL1ADCC.fill(dccId); + if (dccBX != bx_) + meBXDCC.fill(dccId); + + const vector& feStatus(dcchItr->getFEStatus()); + const vector& feBxs(dcchItr->getFEBxs()); + const vector& feL1s(dcchItr->getFELv1()); double feDesync(0.); double statusError(0.); - for(unsigned iFE(0); iFE < feStatus.size(); iFE++){ - if(!ccuExists(dccId, iFE + 1)) continue; + for (unsigned iFE(0); iFE < feStatus.size(); iFE++) { + if (!ccuExists(dccId, iFE + 1)) + continue; short status(feStatus[iFE]); - if(feBxs[iFE] != -1 && dccBX != -1){ + if (feBxs[iFE] != -1 && dccBX != -1) { meBXFEDiff.fill(dccId, feBxs[iFE] - dccBX); } - if(feBxs[iFE] == -1) meBXFEInvalid.fill(dccId, iFE + 0.5); + if (feBxs[iFE] == -1) + meBXFEInvalid.fill(dccId, iFE + 0.5); - if(status != BXDesync && status != L1ABXDesync){ // BX desync not detected in the DCC - if(feBxs[iFE] != dccBX && feBxs[iFE] != -1 && dccBX != -1){ + if (status != BXDesync && status != L1ABXDesync) { // BX desync not detected in the DCC + if (feBxs[iFE] != dccBX && feBxs[iFE] != -1 && dccBX != -1) { meBXFE.fill(dccId, iFE + 0.5); feDesync += 1.; } } - if(status != L1ADesync && status != L1ABXDesync){ - if(feL1s[iFE] + feL1Offset_ != dccL1AShort && feL1s[iFE] != -1 && dccL1AShort != 0){ + if (status != L1ADesync && status != L1ABXDesync) { + if (feL1s[iFE] + feL1Offset_ != dccL1AShort && feL1s[iFE] != -1 && dccL1AShort != 0) { meL1AFE.fill(dccId, iFE + 0.5); feDesync += 1.; } } - if(iFE >= 68) continue; + if (iFE >= 68) + continue; DetId id(getElectronicsMap()->dccTowerConstituents(dccId, iFE + 1).at(0)); meFEStatus.fill(id, status); // Fill FE Status Error Map with error states only - if(status != Enabled && status != Suppressed && - status != FIFOFull && status != FIFOFullL1ADesync && status != ForcedZS) + if (status != Enabled && status != Suppressed && status != FIFOFull && status != FIFOFullL1ADesync && + status != ForcedZS) meFEStatusErrMapByLumi.fill(id, status); - switch(status){ - case Timeout: - case HeaderError: - case ChannelId: - case LinkError: - case BlockSize: - case L1ADesync: - case BXDesync: - case L1ABXDesync: - case HParity: - case VParity: - statusError += 1.; - break; - default: - continue; + switch (status) { + case Timeout: + case HeaderError: + case ChannelId: + case LinkError: + case BlockSize: + case L1ADesync: + case BXDesync: + case L1ABXDesync: + case HParity: + case VParity: + statusError += 1.; + break; + default: + continue; } } - if(feDesync > 0.){ + if (feDesync > 0.) { meDesyncByLumi.fill(dccId, feDesync); meDesyncTotal.fill(dccId, feDesync); meTrendNSyncErrors.fill(double(timestamp_.iLumi), feDesync); } - if(statusError > 0.) + if (statusError > 0.) meFEByLumi.fill(dccId, statusError); - const vector &tccBx(dcchItr->getTCCBx()); - const vector &tccL1(dcchItr->getTCCLv1()); - - if(tccBx.size() == 4){ // EB uses tccBx[0]; EE uses all - if(dccId <= kEEmHigh + 1 || dccId >= kEEpLow + 1){ - for(int iTCC(0); iTCC < 4; iTCC++){ + const vector& tccBx(dcchItr->getTCCBx()); + const vector& tccL1(dcchItr->getTCCLv1()); - if(tccBx[iTCC] != dccBX && tccBx[iTCC] != -1 && dccBX != -1) + if (tccBx.size() == 4) { // EB uses tccBx[0]; EE uses all + if (dccId <= kEEmHigh + 1 || dccId >= kEEpLow + 1) { + for (int iTCC(0); iTCC < 4; iTCC++) { + if (tccBx[iTCC] != dccBX && tccBx[iTCC] != -1 && dccBX != -1) meBXTCC.fill(dccId); - if(tccL1[iTCC] != dccL1AShort && tccL1[iTCC] != -1 && dccL1AShort != 0) + if (tccL1[iTCC] != dccL1AShort && tccL1[iTCC] != -1 && dccL1AShort != 0) meL1ATCC.fill(dccId); - } - }else{ - - if(tccBx[0] != dccBX && tccBx[0] != -1 && dccBX != -1) + } else { + if (tccBx[0] != dccBX && tccBx[0] != -1 && dccBX != -1) meBXTCC.fill(dccId); - if(tccL1[0] != dccL1AShort && tccL1[0] != -1 && dccL1AShort != 0) + if (tccL1[0] != dccL1AShort && tccL1[0] != -1 && dccL1AShort != 0) meL1ATCC.fill(dccId); - } } short srpBx(dcchItr->getSRPBx()); short srpL1(dcchItr->getSRPLv1()); - if(srpBx != dccBX && srpBx != -1 && dccBX != -1) + if (srpBx != dccBX && srpBx != -1 && dccBX != -1) meBXSRP.fill(dccId); - if(srpL1 != dccL1AShort && srpL1 != -1 && dccL1AShort != 0) + if (srpL1 != dccL1AShort && srpL1 != -1 && dccL1AShort != 0) meL1ASRP.fill(dccId); const int calibBX(3490); short runType(dcchItr->getRunType() + 1); - if(runType < 0 || runType > 22) runType = 0; - if(dccBX < calibBX) meEventTypePreCalib.fill(dccId, runType, 1. / 54.); - else if(dccBX == calibBX) meEventTypeCalib.fill(dccId, runType, 1. / 54.); - else meEventTypePostCalib.fill(dccId, runType, 1. / 54.); - + if (runType < 0 || runType > 22) + runType = 0; + if (dccBX < calibBX) + meEventTypePreCalib.fill(dccId, runType, 1. / 54.); + else if (dccBX == calibBX) + meEventTypeCalib.fill(dccId, runType, 1. / 54.); + else + meEventTypePostCalib.fill(dccId, runType, 1. / 54.); } } DEFINE_ECALDQM_WORKER(RawDataTask); -} +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/RecoSummaryTask.cc b/DQM/EcalMonitorTasks/src/RecoSummaryTask.cc index 0c3fef35ff2e0..905f1ac39d924 100644 --- a/DQM/EcalMonitorTasks/src/RecoSummaryTask.cc +++ b/DQM/EcalMonitorTasks/src/RecoSummaryTask.cc @@ -10,56 +10,38 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" -namespace ecaldqm -{ - RecoSummaryTask::RecoSummaryTask() : - DQWorkerTask(), - rechitThresholdEB_(0.), - rechitThresholdEE_(0.), - ebHits_(nullptr), - eeHits_(nullptr) - { - } +namespace ecaldqm { + RecoSummaryTask::RecoSummaryTask() + : DQWorkerTask(), rechitThresholdEB_(0.), rechitThresholdEE_(0.), ebHits_(nullptr), eeHits_(nullptr) {} - void - RecoSummaryTask::setParams(edm::ParameterSet const& _params) - { + void RecoSummaryTask::setParams(edm::ParameterSet const& _params) { rechitThresholdEB_ = _params.getUntrackedParameter("rechitThresholdEB"); rechitThresholdEE_ = _params.getUntrackedParameter("rechitThresholdEE"); } - void - RecoSummaryTask::addDependencies(DependencySet& _dependencies) - { + void RecoSummaryTask::addDependencies(DependencySet& _dependencies) { _dependencies.push_back(Dependency(kEBBasicCluster, kEBRecHit)); _dependencies.push_back(Dependency(kEEBasicCluster, kEERecHit)); } - - bool - RecoSummaryTask::filterRunType(short const* _runType) - { - for(unsigned iFED(0); iFED != ecaldqm::nDCC; iFED++){ - if(_runType[iFED] == EcalDCCHeaderBlock::COSMIC || - _runType[iFED] == EcalDCCHeaderBlock::MTCC || - _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL || - _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || - _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL || - _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) return true; + + bool RecoSummaryTask::filterRunType(short const* _runType) { + for (unsigned iFED(0); iFED != ecaldqm::nDCC; iFED++) { + if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC || + _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL || + _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL || + _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) + return true; } return false; } - void - RecoSummaryTask::endEvent(edm::Event const&, edm::EventSetup const&) - { + void RecoSummaryTask::endEvent(edm::Event const&, edm::EventSetup const&) { ebHits_ = nullptr; eeHits_ = nullptr; } - void - RecoSummaryTask::runOnRecHits(EcalRecHitCollection const& _hits, Collections _collection) - { + void RecoSummaryTask::runOnRecHits(EcalRecHitCollection const& _hits, Collections _collection) { bool isBarrel(_collection == kEBRecHit); MESet& meEnergyMax(MEs_.at("EnergyMax")); @@ -68,54 +50,54 @@ namespace ecaldqm MESet* meSwissCross(isBarrel ? &MEs_.at("SwissCross") : nullptr); MESet& meRecoFlag(MEs_.at("RecoFlagAll")); - double maxE[2] = {-1. -1}; + double maxE[2] = {-1. - 1}; int subdet(isBarrel ? EcalBarrel : EcalEndcap); - - for(EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr){ + + for (EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr) { meRecoFlag.fill(subdet, hitItr->recoFlag()); float energy(hitItr->energy()); int signedSubdet; float rechitThreshold; - if(isBarrel){ + if (isBarrel) { signedSubdet = EcalBarrel; rechitThreshold = rechitThresholdEB_; - if(energy > 3.){ + if (energy > 3.) { EBDetId ebId(hitItr->id()); - if(ebId.ieta() != 85) + if (ebId.ieta() != 85) meSwissCross->fill(EcalTools::swissCross(ebId, _hits, 0.)); } - if(energy > maxE[0]) maxE[0] = energy; - } - else{ + if (energy > maxE[0]) + maxE[0] = energy; + } else { rechitThreshold = rechitThresholdEE_; EEDetId eeId(hitItr->id()); - if(eeId.zside() < 0){ + if (eeId.zside() < 0) { signedSubdet = -EcalEndcap; - if(energy > maxE[0]) maxE[0] = energy; - } - else{ + if (energy > maxE[0]) + maxE[0] = energy; + } else { signedSubdet = EcalEndcap; - if(energy > maxE[1]) maxE[1] = energy; + if (energy > maxE[1]) + maxE[1] = energy; } } - if(energy > rechitThreshold){ + if (energy > rechitThreshold) { meChi2.fill(signedSubdet, hitItr->chi2()); meTime.fill(signedSubdet, hitItr->time()); } } - if(isBarrel){ + if (isBarrel) { meEnergyMax.fill(EcalBarrel, maxE[0]); ebHits_ = &_hits; - } - else{ + } else { meEnergyMax.fill(-EcalEndcap, maxE[0]); meEnergyMax.fill(EcalEndcap, maxE[1]); @@ -123,20 +105,16 @@ namespace ecaldqm } } - void - RecoSummaryTask::runOnReducedRecHits(EcalRecHitCollection const& _hits, Collections _collections) - { + void RecoSummaryTask::runOnReducedRecHits(EcalRecHitCollection const& _hits, Collections _collections) { MESet& meRecoFlag(MEs_.at("RecoFlagReduced")); int subdet(_collections == kEBReducedRecHit ? EcalBarrel : EcalEndcap); - for(EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr) + for (EcalRecHitCollection::const_iterator hitItr(_hits.begin()); hitItr != _hits.end(); ++hitItr) meRecoFlag.fill(subdet, hitItr->recoFlag()); } - void - RecoSummaryTask::runOnBasicClusters(edm::View const& _bcs, Collections _collection) - { + void RecoSummaryTask::runOnBasicClusters(edm::View const& _bcs, Collections _collection) { bool isBarrel(_collection == kEBBasicCluster); MESet& meRecoFlag(MEs_.at("RecoFlagBasicCluster")); @@ -144,22 +122,27 @@ namespace ecaldqm EcalRecHitCollection const* hitCol(isBarrel ? ebHits_ : eeHits_); int subdet(isBarrel ? EcalBarrel : EcalEndcap); - for(edm::View::const_iterator bcItr(_bcs.begin()); bcItr != _bcs.end(); ++bcItr){ - if(bcItr->caloID().detectors() != 0){ - if(isBarrel && !bcItr->caloID().detector(reco::CaloID::DET_ECAL_BARREL)) continue; - if(!isBarrel && !bcItr->caloID().detector(reco::CaloID::DET_ECAL_ENDCAP)) continue; + for (edm::View::const_iterator bcItr(_bcs.begin()); bcItr != _bcs.end(); ++bcItr) { + if (bcItr->caloID().detectors() != 0) { + if (isBarrel && !bcItr->caloID().detector(reco::CaloID::DET_ECAL_BARREL)) + continue; + if (!isBarrel && !bcItr->caloID().detector(reco::CaloID::DET_ECAL_ENDCAP)) + continue; } std::vector > const& haf(bcItr->hitsAndFractions()); - for(unsigned iH(0); iH != haf.size(); ++iH){ - if(isBarrel && haf[iH].first.subdetId() != EcalBarrel) continue; - if(!isBarrel && haf[iH].first.subdetId() != EcalEndcap) continue; + for (unsigned iH(0); iH != haf.size(); ++iH) { + if (isBarrel && haf[iH].first.subdetId() != EcalBarrel) + continue; + if (!isBarrel && haf[iH].first.subdetId() != EcalEndcap) + continue; EcalRecHitCollection::const_iterator hItr(hitCol->find(haf[iH].first)); - if(hItr == hitCol->end()) continue; + if (hItr == hitCol->end()) + continue; meRecoFlag.fill(subdet, hItr->recoFlag()); } } } DEFINE_ECALDQM_WORKER(RecoSummaryTask); -} +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/SelectiveReadoutTask.cc b/DQM/EcalMonitorTasks/src/SelectiveReadoutTask.cc index bff0114c752f6..132e92c810f85 100644 --- a/DQM/EcalMonitorTasks/src/SelectiveReadoutTask.cc +++ b/DQM/EcalMonitorTasks/src/SelectiveReadoutTask.cc @@ -17,66 +17,54 @@ namespace ecaldqm { - SelectiveReadoutTask::SelectiveReadoutTask() : - DQWorkerTask(), - useCondDb_(false), - iFirstSample_(0), - ZSFIRWeights_(nFIRTaps, 0.), - suppressed_(), - flags_(nRU, -1) - { - } - - void - SelectiveReadoutTask::setParams(edm::ParameterSet const& _params) - { + SelectiveReadoutTask::SelectiveReadoutTask() + : DQWorkerTask(), + useCondDb_(false), + iFirstSample_(0), + ZSFIRWeights_(nFIRTaps, 0.), + suppressed_(), + flags_(nRU, -1) {} + + void SelectiveReadoutTask::setParams(edm::ParameterSet const& _params) { useCondDb_ = _params.getUntrackedParameter("useCondDb"); iFirstSample_ = _params.getUntrackedParameter("DCCZS1stSample"); - if(!useCondDb_){ + if (!useCondDb_) { std::vector normWeights(_params.getUntrackedParameter >("ZSFIRWeights")); setFIRWeights_(normWeights); } } - void - SelectiveReadoutTask::addDependencies(DependencySet& _dependencies) - { + void SelectiveReadoutTask::addDependencies(DependencySet& _dependencies) { _dependencies.push_back(Dependency(kEBDigi, kEcalRawData, kEBSrFlag)); _dependencies.push_back(Dependency(kEEDigi, kEcalRawData, kEESrFlag)); } - void - SelectiveReadoutTask::beginRun(edm::Run const&, edm::EventSetup const& _es) - { + void SelectiveReadoutTask::beginRun(edm::Run const&, edm::EventSetup const& _es) { using namespace std; - if(useCondDb_){ + if (useCondDb_) { edm::ESHandle hSr; _es.get().get(hSr); vector > weights(hSr->dccNormalizedWeights_); - if(weights.size() == 1){ - vector normWeights; - for(vector::iterator it(weights[0].begin()); it != weights[0].end(); it++) - normWeights.push_back(*it); - - setFIRWeights_(normWeights); - } - else edm::LogWarning("EcalDQM") << "SelectiveReadoutTask: DCC weight set is not exactly 1."; + if (weights.size() == 1) { + vector normWeights; + for (vector::iterator it(weights[0].begin()); it != weights[0].end(); it++) + normWeights.push_back(*it); + + setFIRWeights_(normWeights); + } else + edm::LogWarning("EcalDQM") << "SelectiveReadoutTask: DCC weight set is not exactly 1."; } } - void - SelectiveReadoutTask::beginEvent(edm::Event const&, edm::EventSetup const&) - { + void SelectiveReadoutTask::beginEvent(edm::Event const&, edm::EventSetup const&) { flags_.assign(nRU, -1); suppressed_.clear(); } - void - SelectiveReadoutTask::runOnSource(FEDRawDataCollection const& _fedRaw) - { + void SelectiveReadoutTask::runOnSource(FEDRawDataCollection const& _fedRaw) { MESet& meDCCSize(MEs_.at("DCCSize")); MESet& meDCCSizeProf(MEs_.at("DCCSizeProf")); MESet& meEventSize(MEs_.at("EventSize")); @@ -84,13 +72,16 @@ namespace ecaldqm { float ebSize(0.), eemSize(0.), eepSize(0.); // DCC event size - for(int iFED(601); iFED <= 654; iFED++){ + for (int iFED(601); iFED <= 654; iFED++) { float size(_fedRaw.FEDData(iFED).size() / 1024.); meDCCSize.fill(iFED - 600, size); meDCCSizeProf.fill(iFED - 600, size); - if(iFED - 601 <= kEEmHigh) eemSize += size; - else if(iFED - 601 >= kEEpLow) eepSize += size; - else ebSize += size; + if (iFED - 601 <= kEEmHigh) + eemSize += size; + else if (iFED - 601 >= kEEpLow) + eepSize += size; + else + ebSize += size; } meEventSize.fill(-EcalEndcap, eemSize / 9.); @@ -98,21 +89,18 @@ namespace ecaldqm { meEventSize.fill(EcalBarrel, ebSize / 36.); } - void - SelectiveReadoutTask::runOnRawData(EcalRawDataCollection const& _dcchs) - { - for(EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr){ + void SelectiveReadoutTask::runOnRawData(EcalRawDataCollection const& _dcchs) { + for (EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr) { std::vector const& feStatus(dcchItr->getFEStatus()); unsigned nFE(feStatus.size()); - for(unsigned iFE(0); iFE < nFE; ++iFE) - if(feStatus[iFE] == Disabled) suppressed_.insert(std::make_pair(dcchItr->id(), iFE + 1)); + for (unsigned iFE(0); iFE < nFE; ++iFE) + if (feStatus[iFE] == Disabled) + suppressed_.insert(std::make_pair(dcchItr->id(), iFE + 1)); } } - template - void - SelectiveReadoutTask::runOnSrFlags(SRFlagCollection const& _srfs, Collections _col) - { + template + void SelectiveReadoutTask::runOnSrFlags(SRFlagCollection const& _srfs, Collections _col) { MESet& meFlagCounterMap(MEs_.at("FlagCounterMap")); MESet& meFullReadoutMap(MEs_.at("FullReadoutMap")); MESet& meZS1Map(MEs_.at("ZS1Map")); @@ -121,45 +109,43 @@ namespace ecaldqm { double nFR(0.); - std::for_each(_srfs.begin(), _srfs.end(), [&](typename SRFlagCollection::value_type const& srf){ - DetId const& id(srf.id()); - int flag(srf.value()); - - meFlagCounterMap.fill(id); - - unsigned iRU(-1); - if(id.subdetId() == EcalTriggerTower) - iRU = EcalTrigTowerDetId(id).hashedIndex(); - else - iRU = EcalScDetId(id).hashedIndex() + EcalTrigTowerDetId::kEBTotalTowers; - flags_[iRU] = flag; - - switch(flag & ~EcalSrFlag::SRF_FORCED_MASK){ - case EcalSrFlag::SRF_FULL: - meFullReadoutMap.fill(id); - nFR += 1.; - break; - case EcalSrFlag::SRF_ZS1: - meZS1Map.fill(id); - // fallthrough - case EcalSrFlag::SRF_ZS2: - meZSMap.fill(id); - break; - default: - break; - } - - if(flag & EcalSrFlag::SRF_FORCED_MASK) - meRUForcedMap.fill(id); - }); + std::for_each(_srfs.begin(), _srfs.end(), [&](typename SRFlagCollection::value_type const& srf) { + DetId const& id(srf.id()); + int flag(srf.value()); + + meFlagCounterMap.fill(id); + + unsigned iRU(-1); + if (id.subdetId() == EcalTriggerTower) + iRU = EcalTrigTowerDetId(id).hashedIndex(); + else + iRU = EcalScDetId(id).hashedIndex() + EcalTrigTowerDetId::kEBTotalTowers; + flags_[iRU] = flag; + + switch (flag & ~EcalSrFlag::SRF_FORCED_MASK) { + case EcalSrFlag::SRF_FULL: + meFullReadoutMap.fill(id); + nFR += 1.; + break; + case EcalSrFlag::SRF_ZS1: + meZS1Map.fill(id); + // fallthrough + case EcalSrFlag::SRF_ZS2: + meZSMap.fill(id); + break; + default: + break; + } + + if (flag & EcalSrFlag::SRF_FORCED_MASK) + meRUForcedMap.fill(id); + }); MEs_.at("FullReadout").fill(_col == kEBSrFlag ? EcalBarrel : EcalEndcap, nFR); } - template - void - SelectiveReadoutTask::runOnDigis(DigiCollection const& _digis, Collections _collection) - { + template + void SelectiveReadoutTask::runOnDigis(DigiCollection const& _digis, Collections _collection) { MESet& meHighIntOutput(MEs_.at("HighIntOutput")); MESet& meLowIntOutput(MEs_.at("LowIntOutput")); MESet& meHighIntPayload(MEs_.at("HighIntPayload")); @@ -172,30 +158,30 @@ namespace ecaldqm { bool isEB(_collection == kEBDigi); - unsigned const nTower(isEB ? unsigned(EcalTrigTowerDetId::kEBTotalTowers) : unsigned(EcalScDetId::kSizeForDenseIndexing)); + unsigned const nTower(isEB ? unsigned(EcalTrigTowerDetId::kEBTotalTowers) + : unsigned(EcalScDetId::kSizeForDenseIndexing)); std::vector sizes(nTower, 0); int nHighInt[] = {0, 0}; int nLowInt[] = {0, 0}; - for(typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ - + for (typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) { DetId const& id(digiItr->id()); unsigned iTower(-1); unsigned iRU(-1); - if(isEB){ + if (isEB) { iTower = EBDetId(id).tower().hashedIndex(); iRU = iTower; - } - else{ + } else { iTower = EEDetId(id).sc().hashedIndex(); iRU = iTower + EcalTrigTowerDetId::kEBTotalTowers; } - if(flags_[iRU] < 0) continue; + if (flags_[iRU] < 0) + continue; sizes[iTower] += 1; @@ -203,30 +189,31 @@ namespace ecaldqm { EcalDataFrame frame(*digiItr); - int ZSFIRValue(0); // output + int ZSFIRValue(0); // output bool gain12saturated(false); const int gain12(0x01); - for(int iWeight(0); iWeight < nFIRTaps; ++iWeight){ - - int iSample(iFirstSample_ + iWeight - 1); - - if(iSample >= 0 && iSample < frame.size()){ - EcalMGPASample sample(frame[iSample]); - if(sample.gainId() != gain12){ - gain12saturated = true; - break; - } - ZSFIRValue += sample.adc() * ZSFIRWeights_[iWeight]; - }else{ - edm::LogWarning("EcalDQM") << "SelectiveReadoutTask: Not enough samples in data frame or 'ecalDccZs1stSample' module parameter is not valid"; - } - + for (int iWeight(0); iWeight < nFIRTaps; ++iWeight) { + int iSample(iFirstSample_ + iWeight - 1); + + if (iSample >= 0 && iSample < frame.size()) { + EcalMGPASample sample(frame[iSample]); + if (sample.gainId() != gain12) { + gain12saturated = true; + break; + } + ZSFIRValue += sample.adc() * ZSFIRWeights_[iWeight]; + } else { + edm::LogWarning("EcalDQM") << "SelectiveReadoutTask: Not enough samples in data frame or " + "'ecalDccZs1stSample' module parameter is not valid"; + } } - if(gain12saturated) ZSFIRValue = std::numeric_limits::max(); - else ZSFIRValue /= (0x1 << 8); //discards the 8 LSBs + if (gain12saturated) + ZSFIRValue = std::numeric_limits::max(); + else + ZSFIRValue /= (0x1 << 8); //discards the 8 LSBs //ZS passed if weighted sum above ZS threshold or if //one sample has a lower gain than gain 12 (that is gain 12 output @@ -234,27 +221,25 @@ namespace ecaldqm { bool highInterest((flags_[iRU] & ~EcalSrFlag::SRF_FORCED_MASK) == EcalSrFlag::SRF_FULL); - if(highInterest){ - meHighIntOutput.fill(id, ZSFIRValue); - if(isEB || dccId(id) - 1 <= kEEmHigh) + if (highInterest) { + meHighIntOutput.fill(id, ZSFIRValue); + if (isEB || dccId(id) - 1 <= kEEmHigh) nHighInt[0] += 1; else nHighInt[1] += 1; - } - else{ - meLowIntOutput.fill(id, ZSFIRValue); - if(isEB || dccId(id) - 1 <= kEEmHigh) + } else { + meLowIntOutput.fill(id, ZSFIRValue); + if (isEB || dccId(id) - 1 <= kEEmHigh) nLowInt[0] += 1; else nLowInt[1] += 1; } } - if(isEB){ + if (isEB) { meHighIntPayload.fill(EcalBarrel, nHighInt[0] * bytesPerCrystal / 1024. / nEBDCC); meLowIntPayload.fill(EcalBarrel, nLowInt[0] * bytesPerCrystal / 1024. / nEBDCC); - } - else{ + } else { meHighIntPayload.fill(-EcalEndcap, nHighInt[0] * bytesPerCrystal / 1024. / (nEEDCC / 2)); meHighIntPayload.fill(EcalEndcap, nHighInt[1] * bytesPerCrystal / 1024. / (nEEDCC / 2)); meLowIntPayload.fill(-EcalEndcap, nLowInt[0] * bytesPerCrystal / 1024. / (nEEDCC / 2)); @@ -262,75 +247,75 @@ namespace ecaldqm { } unsigned iRU(isEB ? 0 : EcalTrigTowerDetId::kEBTotalTowers); - for(unsigned iTower(0); iTower < nTower; ++iTower, ++iRU){ + for (unsigned iTower(0); iTower < nTower; ++iTower, ++iRU) { DetId id; - if(isEB) id = EcalTrigTowerDetId::detIdFromDenseIndex(iTower); - else id = EcalScDetId::unhashIndex(iTower); + if (isEB) + id = EcalTrigTowerDetId::detIdFromDenseIndex(iTower); + else + id = EcalScDetId::unhashIndex(iTower); double towerSize(sizes[iTower] * bytesPerCrystal); meTowerSize.fill(id, towerSize); - if(flags_[iRU] < 0) continue; + if (flags_[iRU] < 0) + continue; int dccid(dccId(id)); int towerid(towerId(id)); - if(suppressed_.find(std::make_pair(dccid, towerid)) != suppressed_.end()) continue; + if (suppressed_.find(std::make_pair(dccid, towerid)) != suppressed_.end()) + continue; int flag(flags_[iRU] & ~EcalSrFlag::SRF_FORCED_MASK); bool ruFullyReadout(sizes[iTower] == getElectronicsMap()->dccTowerConstituents(dccid, towerid).size()); - if(ruFullyReadout && (flag == EcalSrFlag::SRF_ZS1 || flag == EcalSrFlag::SRF_ZS2)){ - meZSFullReadoutMap.fill(id); + if (ruFullyReadout && (flag == EcalSrFlag::SRF_ZS1 || flag == EcalSrFlag::SRF_ZS2)) { + meZSFullReadoutMap.fill(id); meZSFullReadout.fill(id); } - if(sizes[iTower] == 0 && flag == EcalSrFlag::SRF_FULL){ + if (sizes[iTower] == 0 && flag == EcalSrFlag::SRF_FULL) { meFRDroppedMap.fill(id); meFRDropped.fill(id); } } } - void - SelectiveReadoutTask::setFIRWeights_(std::vector const& _normWeights) - { - if(_normWeights.size() < nFIRTaps) + void SelectiveReadoutTask::setFIRWeights_(std::vector const& _normWeights) { + if (_normWeights.size() < nFIRTaps) throw cms::Exception("InvalidConfiguration") << "weightsForZsFIR" << std::endl; bool notNormalized(false), notInt(false); - for(std::vector::const_iterator it(_normWeights.begin()); it != _normWeights.end(); ++it){ - if(*it > 1.) notNormalized = true; - if(int(*it) != *it) notInt = true; + for (std::vector::const_iterator it(_normWeights.begin()); it != _normWeights.end(); ++it) { + if (*it > 1.) + notNormalized = true; + if (int(*it) != *it) + notInt = true; } - if(notInt && notNormalized){ - throw cms::Exception("InvalidConfiguration") - << "weigtsForZsFIR paramater values are not valid: they " - << "must either be integer and uses the hardware representation " - << "of the weights or less or equal than 1 and used the normalized " - << "representation."; + if (notInt && notNormalized) { + throw cms::Exception("InvalidConfiguration") << "weigtsForZsFIR paramater values are not valid: they " + << "must either be integer and uses the hardware representation " + << "of the weights or less or equal than 1 and used the normalized " + << "representation."; } ZSFIRWeights_.clear(); ZSFIRWeights_.resize(_normWeights.size()); - if(notNormalized){ - for(unsigned i(0); i< ZSFIRWeights_.size(); ++i) - ZSFIRWeights_[i] = int(_normWeights[i]); - } - else{ - const int maxWeight(0xEFF); //weights coded on 11+1 signed bits - for(unsigned i(0); i < ZSFIRWeights_.size(); ++i){ - ZSFIRWeights_[i] = lround(_normWeights[i] * (0x1 << 10)); - if(std::abs(ZSFIRWeights_[i]) > maxWeight) //overflow - ZSFIRWeights_[i] = ZSFIRWeights_[i] < 0 ? -maxWeight : maxWeight; + if (notNormalized) { + for (unsigned i(0); i < ZSFIRWeights_.size(); ++i) + ZSFIRWeights_[i] = int(_normWeights[i]); + } else { + const int maxWeight(0xEFF); //weights coded on 11+1 signed bits + for (unsigned i(0); i < ZSFIRWeights_.size(); ++i) { + ZSFIRWeights_[i] = lround(_normWeights[i] * (0x1 << 10)); + if (std::abs(ZSFIRWeights_[i]) > maxWeight) //overflow + ZSFIRWeights_[i] = ZSFIRWeights_[i] < 0 ? -maxWeight : maxWeight; } } } DEFINE_ECALDQM_WORKER(SelectiveReadoutTask); -} - - +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/TestPulseTask.cc b/DQM/EcalMonitorTasks/src/TestPulseTask.cc index 2cc1f6387fbab..d6c008212448e 100644 --- a/DQM/EcalMonitorTasks/src/TestPulseTask.cc +++ b/DQM/EcalMonitorTasks/src/TestPulseTask.cc @@ -11,20 +11,13 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" -namespace ecaldqm -{ - TestPulseTask::TestPulseTask() : - DQWorkerTask(), - gainToME_(), - pnGainToME_() - { +namespace ecaldqm { + TestPulseTask::TestPulseTask() : DQWorkerTask(), gainToME_(), pnGainToME_() { std::fill_n(enable_, nDCC, false); std::fill_n(gain_, nDCC, 0); } - void - TestPulseTask::setParams(edm::ParameterSet const& _params) - { + void TestPulseTask::setParams(edm::ParameterSet const& _params) { std::vector MGPAGains(_params.getUntrackedParameter >("MGPAGains")); std::vector MGPAGainsPN(_params.getUntrackedParameter >("MGPAGainsPN")); @@ -32,9 +25,10 @@ namespace ecaldqm MESetMulti& amplitude(static_cast(MEs_.at("Amplitude"))); unsigned nG(MGPAGains.size()); - for(unsigned iG(0); iG != nG; ++iG){ + for (unsigned iG(0); iG != nG; ++iG) { int gain(MGPAGains[iG]); - if(gain != 1 && gain != 6 && gain != 12) throw cms::Exception("InvalidConfiguration") << "MGPA gain"; + if (gain != 1 && gain != 6 && gain != 12) + throw cms::Exception("InvalidConfiguration") << "MGPA gain"; repl["gain"] = std::to_string(gain); gainToME_[gain] = amplitude.getIndex(repl); } @@ -43,135 +37,133 @@ namespace ecaldqm MESetMulti& pnAmplitude(static_cast(MEs_.at("PNAmplitude"))); unsigned nGPN(MGPAGainsPN.size()); - for(unsigned iG(0); iG != nGPN; ++iG){ + for (unsigned iG(0); iG != nGPN; ++iG) { int gain(MGPAGainsPN[iG]); - if(gain != 1 && gain != 16) throw cms::Exception("InvalidConfiguration") << "PN MGPA gain"; + if (gain != 1 && gain != 16) + throw cms::Exception("InvalidConfiguration") << "PN MGPA gain"; repl["pngain"] = std::to_string(gain); pnGainToME_[gain] = pnAmplitude.getIndex(repl); } } - void - TestPulseTask::addDependencies(DependencySet& _dependencies) - { + void TestPulseTask::addDependencies(DependencySet& _dependencies) { _dependencies.push_back(Dependency(kEBTestPulseUncalibRecHit, kEcalRawData)); _dependencies.push_back(Dependency(kEETestPulseUncalibRecHit, kEcalRawData)); } - bool - TestPulseTask::filterRunType(short const* _runType) - { + bool TestPulseTask::filterRunType(short const* _runType) { bool enable(false); - for(int iFED(0); iFED < nDCC; iFED++){ - if(_runType[iFED] == EcalDCCHeaderBlock::TESTPULSE_MGPA || - _runType[iFED] == EcalDCCHeaderBlock::TESTPULSE_GAP){ - enable = true; - enable_[iFED] = true; - } - else + for (int iFED(0); iFED < nDCC; iFED++) { + if (_runType[iFED] == EcalDCCHeaderBlock::TESTPULSE_MGPA || _runType[iFED] == EcalDCCHeaderBlock::TESTPULSE_GAP) { + enable = true; + enable_[iFED] = true; + } else enable_[iFED] = false; } return enable; } - void - TestPulseTask::runOnRawData(EcalRawDataCollection const& _rawData) - { - for(EcalRawDataCollection::const_iterator rItr(_rawData.begin()); rItr != _rawData.end(); ++rItr){ + void TestPulseTask::runOnRawData(EcalRawDataCollection const& _rawData) { + for (EcalRawDataCollection::const_iterator rItr(_rawData.begin()); rItr != _rawData.end(); ++rItr) { unsigned iDCC(rItr->id() - 1); - if(!enable_[iDCC]){ + if (!enable_[iDCC]) { gain_[iDCC] = 0; continue; } - switch(rItr->getMgpaGain()){ - case 1: - gain_[iDCC] = 12; - break; - case 2: - gain_[iDCC] = 6; - break; - case 3: - gain_[iDCC] = 1; - break; - default: - break; + switch (rItr->getMgpaGain()) { + case 1: + gain_[iDCC] = 12; + break; + case 2: + gain_[iDCC] = 6; + break; + case 3: + gain_[iDCC] = 1; + break; + default: + break; } - if(gainToME_.find(gain_[iDCC]) == gainToME_.end()) + if (gainToME_.find(gain_[iDCC]) == gainToME_.end()) enable_[iDCC] = false; } } - template - void - TestPulseTask::runOnDigis(DigiCollection const& _digis) - { + template + void TestPulseTask::runOnDigis(DigiCollection const& _digis) { MESet& meOccupancy(MEs_.at("Occupancy")); MESet& meShape(MEs_.at("Shape")); unsigned iME(-1); - for(typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ + for (typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) { DetId id(digiItr->id()); meOccupancy.fill(id); int iDCC(dccId(id) - 1); - if(!enable_[iDCC]) continue; + if (!enable_[iDCC]) + continue; // EcalDataFrame is not a derived class of edm::DataFrame, but can take edm::DataFrame in the constructor EcalDataFrame dataFrame(*digiItr); - if(iME != gainToME_[gain_[iDCC]]){ + if (iME != gainToME_[gain_[iDCC]]) { iME = gainToME_[gain_[iDCC]]; static_cast(meShape).use(iME); } - for(int iSample(0); iSample < 10; iSample++) - meShape.fill(id, iSample + 0.5, float(dataFrame.sample(iSample).adc())); + for (int iSample(0); iSample < 10; iSample++) + meShape.fill(id, iSample + 0.5, float(dataFrame.sample(iSample).adc())); } } - void - TestPulseTask::runOnPnDigis(EcalPnDiodeDigiCollection const& _digis) - { + void TestPulseTask::runOnPnDigis(EcalPnDiodeDigiCollection const& _digis) { MESet& mePNAmplitude(MEs_.at("PNAmplitude")); unsigned iME(-1); - for(EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ + for (EcalPnDiodeDigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) { EcalPnDiodeDetId const& id(digiItr->id()); int iDCC(dccId(id) - 1); - if(!enable_[iDCC]) continue; + if (!enable_[iDCC]) + continue; int gain(0); - switch(digiItr->sample(0).gainId()){ - case 0: gain = 1; break; - case 1: gain = 16; break; - default: continue; + switch (digiItr->sample(0).gainId()) { + case 0: + gain = 1; + break; + case 1: + gain = 16; + break; + default: + continue; } - if(pnGainToME_.find(gain) == pnGainToME_.end()) continue; + if (pnGainToME_.find(gain) == pnGainToME_.end()) + continue; - if(iME != pnGainToME_[gain]){ + if (iME != pnGainToME_[gain]) { iME = pnGainToME_[gain]; static_cast(mePNAmplitude).use(iME); } float pedestal(0.); - for(int iSample(0); iSample < 4; iSample++) - pedestal += digiItr->sample(iSample).adc(); + for (int iSample(0); iSample < 4; iSample++) + pedestal += digiItr->sample(iSample).adc(); pedestal /= 4.; float max(0.); - for(int iSample(0); iSample < 50; iSample++) - if(digiItr->sample(iSample).adc() > max) max = digiItr->sample(iSample).adc(); + for (int iSample(0); iSample < 50; iSample++) + if (digiItr->sample(iSample).adc() > max) + max = digiItr->sample(iSample).adc(); double amplitude(max - pedestal); @@ -179,21 +171,20 @@ namespace ecaldqm } } - void - TestPulseTask::runOnUncalibRecHits(EcalUncalibratedRecHitCollection const& _uhits) - { + void TestPulseTask::runOnUncalibRecHits(EcalUncalibratedRecHitCollection const& _uhits) { MESet& meAmplitude(MEs_.at("Amplitude")); unsigned iME(-1); - for(EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr){ + for (EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr) { DetId id(uhitItr->id()); int iDCC(dccId(id) - 1); - if(!enable_[iDCC]) continue; + if (!enable_[iDCC]) + continue; - if(iME != gainToME_[gain_[iDCC]]){ + if (iME != gainToME_[gain_[iDCC]]) { iME = gainToME_[gain_[iDCC]]; static_cast(meAmplitude).use(iME); } @@ -203,4 +194,4 @@ namespace ecaldqm } DEFINE_ECALDQM_WORKER(TestPulseTask); -} +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/TimingTask.cc b/DQM/EcalMonitorTasks/src/TimingTask.cc index c61e19afe13e7..8840ed345cf26 100644 --- a/DQM/EcalMonitorTasks/src/TimingTask.cc +++ b/DQM/EcalMonitorTasks/src/TimingTask.cc @@ -9,29 +9,25 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" -namespace ecaldqm -{ - TimingTask::TimingTask() : - DQWorkerTask(), - bxBinEdges_(), - bxBin_(0.), - chi2ThresholdEB_(0.), - chi2ThresholdEE_(0.), - energyThresholdEB_(0.), - energyThresholdEE_(0.), - energyThresholdEEFwd_(0.), - timingVsBXThreshold_(0.), - timeErrorThreshold_(0.), - meTimeMapByLS(nullptr) - { - } - - void - TimingTask::setParams(edm::ParameterSet const& _params) - { - bxBinEdges_ = onlineMode_? _params.getUntrackedParameter >("bxBins"): _params.getUntrackedParameter >("bxBinsFine"); - chi2ThresholdEB_ = _params.getUntrackedParameter("chi2ThresholdEB"); - chi2ThresholdEE_ = _params.getUntrackedParameter("chi2ThresholdEE"); +namespace ecaldqm { + TimingTask::TimingTask() + : DQWorkerTask(), + bxBinEdges_(), + bxBin_(0.), + chi2ThresholdEB_(0.), + chi2ThresholdEE_(0.), + energyThresholdEB_(0.), + energyThresholdEE_(0.), + energyThresholdEEFwd_(0.), + timingVsBXThreshold_(0.), + timeErrorThreshold_(0.), + meTimeMapByLS(nullptr) {} + + void TimingTask::setParams(edm::ParameterSet const& _params) { + bxBinEdges_ = onlineMode_ ? _params.getUntrackedParameter >("bxBins") + : _params.getUntrackedParameter >("bxBinsFine"); + chi2ThresholdEB_ = _params.getUntrackedParameter("chi2ThresholdEB"); + chi2ThresholdEE_ = _params.getUntrackedParameter("chi2ThresholdEE"); energyThresholdEB_ = _params.getUntrackedParameter("energyThresholdEB"); energyThresholdEE_ = _params.getUntrackedParameter("energyThresholdEE"); energyThresholdEEFwd_ = _params.getUntrackedParameter("energyThresholdEEFwd"); @@ -39,147 +35,142 @@ namespace ecaldqm timeErrorThreshold_ = _params.getUntrackedParameter("timeErrorThreshold"); } - bool - TimingTask::filterRunType(short const* _runType) - { - for(int iFED(0); iFED < nDCC; iFED++){ - if(_runType[iFED] == EcalDCCHeaderBlock::COSMIC || - _runType[iFED] == EcalDCCHeaderBlock::MTCC || - _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL || - _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || - _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL || - _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) return true; + bool TimingTask::filterRunType(short const* _runType) { + for (int iFED(0); iFED < nDCC; iFED++) { + if (_runType[iFED] == EcalDCCHeaderBlock::COSMIC || _runType[iFED] == EcalDCCHeaderBlock::MTCC || + _runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL || + _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL || _runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL || + _runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL) + return true; } return false; } - void - TimingTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) - { + void TimingTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) { // Fill separate MEs with only 10 LSs worth of stats // Used to correctly fill Presample Trend plots: // 1 pt:10 LS in Trend plots meTimeMapByLS = &MEs_.at("TimeMapByLS"); - if ( timestamp_.iLumi % 10 == 0 ) + if (timestamp_.iLumi % 10 == 0) meTimeMapByLS->reset(); } - void - TimingTask::beginEvent(edm::Event const& _evt, edm::EventSetup const& _es) - { + void TimingTask::beginEvent(edm::Event const& _evt, edm::EventSetup const& _es) { using namespace std; std::vector::iterator pBin = std::upper_bound(bxBinEdges_.begin(), bxBinEdges_.end(), _evt.bunchCrossing()); bxBin_ = static_cast(pBin - bxBinEdges_.begin()) - 0.5; } - void - TimingTask::runOnRecHits(EcalRecHitCollection const& _hits, Collections _collection) - { + void TimingTask::runOnRecHits(EcalRecHitCollection const& _hits, Collections _collection) { MESet& meTimeAmp(MEs_.at("TimeAmp")); MESet& meTimeAmpAll(MEs_.at("TimeAmpAll")); - MESet& meTimingVsBX(onlineMode_? MEs_.at("BarrelTimingVsBX"): MEs_.at("BarrelTimingVsBXFineBinned")); + MESet& meTimingVsBX(onlineMode_ ? MEs_.at("BarrelTimingVsBX") : MEs_.at("BarrelTimingVsBXFineBinned")); MESet& meTimeAll(MEs_.at("TimeAll")); MESet& meTimeAllMap(MEs_.at("TimeAllMap")); - MESet& meTimeMap(MEs_.at("TimeMap")); // contains cumulative run stats => not suitable for Trend plots + MESet& meTimeMap(MEs_.at("TimeMap")); // contains cumulative run stats => not suitable for Trend plots MESet& meTime1D(MEs_.at("Time1D")); MESet& meChi2(MEs_.at("Chi2")); uint32_t mask(~((0x1 << EcalRecHit::kGood) | (0x1 << EcalRecHit::kOutOfTime))); int signedSubdet; - std::for_each(_hits.begin(), _hits.end(), [&](EcalRecHitCollection::value_type const& hit){ - if(hit.checkFlagMask(mask)) return; - - DetId id(hit.id()); - - float time(hit.time()); - float energy(hit.energy()); - - float chi2Threshold, energyThreshold; - if (id.subdetId() == EcalBarrel) { - chi2Threshold = chi2ThresholdEB_; - energyThreshold = energyThresholdEB_; - } - else { - chi2Threshold = chi2ThresholdEE_; - energyThreshold = (isForward(id)) ? energyThresholdEEFwd_ : energyThresholdEE_; - } - - if ( id.subdetId() == EcalBarrel ) - signedSubdet = EcalBarrel; - else { - EEDetId eeId( hit.id() ); - if ( eeId.zside() < 0 ) - signedSubdet = -EcalEndcap; - else - signedSubdet = EcalEndcap; - } - - if (energy > energyThreshold) meChi2.fill(signedSubdet, hit.chi2()); - - // Apply cut on chi2 of pulse shape fit - if ( hit.chi2() > chi2Threshold ) return; - - // Apply cut based on timing error of rechit - if (hit.timeError() > timeErrorThreshold_) return; - - meTimeAmp.fill(id, energy, time); - meTimeAmpAll.fill(id, energy, time); - - if (energy > timingVsBXThreshold_ && signedSubdet == EcalBarrel) meTimingVsBX.fill(bxBin_, time); - - if(energy > energyThreshold){ - meTimeAll.fill(id, time); - meTimeMap.fill(id, time); - meTimeMapByLS->fill(id, time); - meTime1D.fill(id, time); - meTimeAllMap.fill(id, time); - } - }); + std::for_each(_hits.begin(), _hits.end(), [&](EcalRecHitCollection::value_type const& hit) { + if (hit.checkFlagMask(mask)) + return; + + DetId id(hit.id()); + + float time(hit.time()); + float energy(hit.energy()); + + float chi2Threshold, energyThreshold; + if (id.subdetId() == EcalBarrel) { + chi2Threshold = chi2ThresholdEB_; + energyThreshold = energyThresholdEB_; + } else { + chi2Threshold = chi2ThresholdEE_; + energyThreshold = (isForward(id)) ? energyThresholdEEFwd_ : energyThresholdEE_; + } + + if (id.subdetId() == EcalBarrel) + signedSubdet = EcalBarrel; + else { + EEDetId eeId(hit.id()); + if (eeId.zside() < 0) + signedSubdet = -EcalEndcap; + else + signedSubdet = EcalEndcap; + } + + if (energy > energyThreshold) + meChi2.fill(signedSubdet, hit.chi2()); + + // Apply cut on chi2 of pulse shape fit + if (hit.chi2() > chi2Threshold) + return; + + // Apply cut based on timing error of rechit + if (hit.timeError() > timeErrorThreshold_) + return; + + meTimeAmp.fill(id, energy, time); + meTimeAmpAll.fill(id, energy, time); + + if (energy > timingVsBXThreshold_ && signedSubdet == EcalBarrel) + meTimingVsBX.fill(bxBin_, time); + + if (energy > energyThreshold) { + meTimeAll.fill(id, time); + meTimeMap.fill(id, time); + meTimeMapByLS->fill(id, time); + meTime1D.fill(id, time); + meTimeAllMap.fill(id, time); + } + }); } // For In-time vs Out-of-Time amplitude correlation MEs: // Only UncalibRecHits carry information about OOT amplitude // But still need to make sure we apply similar cuts as on RecHits - void TimingTask::runOnUncalibRecHits( EcalUncalibratedRecHitCollection const& _uhits ) - { - MESet& meTimeAmpBXm( MEs_.at("TimeAmpBXm") ); - MESet& meTimeAmpBXp( MEs_.at("TimeAmpBXp") ); - - for( EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr ) { + void TimingTask::runOnUncalibRecHits(EcalUncalibratedRecHitCollection const& _uhits) { + MESet& meTimeAmpBXm(MEs_.at("TimeAmpBXm")); + MESet& meTimeAmpBXp(MEs_.at("TimeAmpBXp")); + for (EcalUncalibratedRecHitCollection::const_iterator uhitItr(_uhits.begin()); uhitItr != _uhits.end(); ++uhitItr) { // Apply reconstruction quality cuts - if( !uhitItr->checkFlag(EcalUncalibratedRecHit::kGood) ) continue; - DetId id( uhitItr->id() ); + if (!uhitItr->checkFlag(EcalUncalibratedRecHit::kGood)) + continue; + DetId id(uhitItr->id()); float chi2Threshold = 0.; float ampThreshold = 0.; if (id.subdetId() == EcalBarrel) { chi2Threshold = chi2ThresholdEB_; - ampThreshold = 20.*energyThresholdEB_; // 1 GeV ~ 20 ADC in EB - } - else { + ampThreshold = 20. * energyThresholdEB_; // 1 GeV ~ 20 ADC in EB + } else { chi2Threshold = chi2ThresholdEE_; - ampThreshold = 5.*((isForward(id)) ? energyThresholdEEFwd_ : energyThresholdEE_); // 1 GeV ~ 5 ADC in EE + ampThreshold = 5. * ((isForward(id)) ? energyThresholdEEFwd_ : energyThresholdEE_); // 1 GeV ~ 5 ADC in EE } - if( uhitItr->chi2() > chi2Threshold ) continue; + if (uhitItr->chi2() > chi2Threshold) + continue; // Apply amplitude cut based on approx rechit energy - float amp( uhitItr->amplitude() ); - if( amp < ampThreshold ) continue; + float amp(uhitItr->amplitude()); + if (amp < ampThreshold) + continue; // Apply jitter timing cut based on approx rechit timing - float timeOff( id.subdetId() == EcalBarrel ? 0.4 : 1.8 ); - float hitTime( uhitItr->jitter()*25. + timeOff ); // 1 jitter ~ 25 ns - if( std::abs(hitTime) >= 5. ) continue; + float timeOff(id.subdetId() == EcalBarrel ? 0.4 : 1.8); + float hitTime(uhitItr->jitter() * 25. + timeOff); // 1 jitter ~ 25 ns + if (std::abs(hitTime) >= 5.) + continue; // Fill MEs - meTimeAmpBXm.fill( id,amp,uhitItr->outOfTimeAmplitude(4) ); // BX-1 - meTimeAmpBXp.fill( id,amp,uhitItr->outOfTimeAmplitude(6) ); // BX+1 - + meTimeAmpBXm.fill(id, amp, uhitItr->outOfTimeAmplitude(4)); // BX-1 + meTimeAmpBXp.fill(id, amp, uhitItr->outOfTimeAmplitude(6)); // BX+1 } } DEFINE_ECALDQM_WORKER(TimingTask); -} +} // namespace ecaldqm diff --git a/DQM/EcalMonitorTasks/src/TrigPrimTask.cc b/DQM/EcalMonitorTasks/src/TrigPrimTask.cc index f9428d9c005b1..e218f2df68980 100644 --- a/DQM/EcalMonitorTasks/src/TrigPrimTask.cc +++ b/DQM/EcalMonitorTasks/src/TrigPrimTask.cc @@ -12,57 +12,48 @@ #include -namespace ecaldqm -{ - TrigPrimTask::TrigPrimTask() : - DQWorkerTask(), - realTps_(nullptr), - runOnEmul_(false), - // HLTCaloPath_(""), - // HLTMuonPath_(""), - // HLTCaloBit_(false), - // HLTMuonBit_(false), - bxBinEdges_{ {1, 271, 541, 892, 1162, 1432, 1783, 2053, 2323, 2674, 2944, 3214, 3446, 3490, 3491, 3565} }, - bxBin_(0.), - towerReadouts_(), - lhcStatusInfoCollectionTag_(), - lhcStatusSet_(false) - { - } - - void - TrigPrimTask::setParams(edm::ParameterSet const& _params) - { +namespace ecaldqm { + TrigPrimTask::TrigPrimTask() + : DQWorkerTask(), + realTps_(nullptr), + runOnEmul_(false), + // HLTCaloPath_(""), + // HLTMuonPath_(""), + // HLTCaloBit_(false), + // HLTMuonBit_(false), + bxBinEdges_{{1, 271, 541, 892, 1162, 1432, 1783, 2053, 2323, 2674, 2944, 3214, 3446, 3490, 3491, 3565}}, + bxBin_(0.), + towerReadouts_(), + lhcStatusInfoCollectionTag_(), + lhcStatusSet_(false) {} + + void TrigPrimTask::setParams(edm::ParameterSet const& _params) { runOnEmul_ = _params.getUntrackedParameter("runOnEmul"); - if(!runOnEmul_){ + if (!runOnEmul_) { MEs_.erase(std::string("EtMaxEmul")); MEs_.erase(std::string("EmulMaxIndex")); MEs_.erase(std::string("MatchedIndex")); MEs_.erase(std::string("EtEmulError")); MEs_.erase(std::string("FGEmulError")); } - lhcStatusInfoCollectionTag_ = _params.getUntrackedParameter("lhcStatusInfoCollectionTag", edm::InputTag("tcdsDigis", "tcdsRecord")); + lhcStatusInfoCollectionTag_ = _params.getUntrackedParameter( + "lhcStatusInfoCollectionTag", edm::InputTag("tcdsDigis", "tcdsRecord")); } - void - TrigPrimTask::addDependencies(DependencySet& _dependencies) - { - if(runOnEmul_) _dependencies.push_back(Dependency(kTrigPrimEmulDigi, kEBDigi, kEEDigi, kTrigPrimDigi)); + void TrigPrimTask::addDependencies(DependencySet& _dependencies) { + if (runOnEmul_) + _dependencies.push_back(Dependency(kTrigPrimEmulDigi, kEBDigi, kEEDigi, kTrigPrimDigi)); } - void - TrigPrimTask::beginRun(edm::Run const&, edm::EventSetup const& _es) - { + void TrigPrimTask::beginRun(edm::Run const&, edm::EventSetup const& _es) { // Read-in Status records: // Status records stay constant over run so they are read-in only once here // but filled by LS in runOnRealTPs() because MEs are not yet booked at beginRun() - _es.get().get( TTStatusRcd ); - _es.get().get( StripStatusRcd ); + _es.get().get(TTStatusRcd); + _es.get().get(StripStatusRcd); } - void - TrigPrimTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) - { + void TrigPrimTask::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) { // Reset by LS plots at beginning of every LS MEs_.at("EtSummaryByLumi").reset(); MEs_.at("TTFlags4ByLumi").reset(); @@ -72,9 +63,7 @@ namespace ecaldqm lhcStatusSet_ = false; } - void - TrigPrimTask::beginEvent(edm::Event const& _evt, edm::EventSetup const& _es) - { + void TrigPrimTask::beginEvent(edm::Event const& _evt, edm::EventSetup const& _es) { using namespace std; towerReadouts_.clear(); @@ -100,36 +89,32 @@ namespace ecaldqm edm::ESHandle TTStatusRcd_; _es.get().get(TTStatusRcd_); - const EcalTPGTowerStatus * TTStatus=TTStatusRcd_.product(); - const EcalTPGTowerStatusMap &towerMap=TTStatus->getMap(); + const EcalTPGTowerStatus* TTStatus = TTStatusRcd_.product(); + const EcalTPGTowerStatusMap& towerMap = TTStatus->getMap(); edm::ESHandle StripStatusRcd_; _es.get().get(StripStatusRcd_); - const EcalTPGStripStatus * StripStatus=StripStatusRcd_.product(); - const EcalTPGStripStatusMap &stripMap=StripStatus->getMap(); + const EcalTPGStripStatus* StripStatus = StripStatusRcd_.product(); + const EcalTPGStripStatusMap& stripMap = StripStatus->getMap(); MESet& meTTMaskMap(MEs_.at("TTMaskMap")); - for(EcalTPGTowerStatusMap::const_iterator ttItr(towerMap.begin()); ttItr != towerMap.end(); ++ttItr){ - - if ((*ttItr).second > 0) - { - const EcalTrigTowerDetId ttid((*ttItr).first); - //if(ttid.subDet() == EcalBarrel) - meTTMaskMap.fill(ttid,1); - }//masked - }//loop on towers - - for(EcalTPGStripStatusMap::const_iterator stItr(stripMap.begin()); stItr != stripMap.end(); ++stItr){ - - if ((*stItr).second > 0) - { - const EcalElectronicsId stid((*stItr).first); - //if(stid.subdet() == EcalEndcap); - meTTMaskMap.fill(stid,1); - }//masked - }//loop on pseudo-strips - + for (EcalTPGTowerStatusMap::const_iterator ttItr(towerMap.begin()); ttItr != towerMap.end(); ++ttItr) { + if ((*ttItr).second > 0) { + const EcalTrigTowerDetId ttid((*ttItr).first); + //if(ttid.subDet() == EcalBarrel) + meTTMaskMap.fill(ttid, 1); + } //masked + } //loop on towers + + for (EcalTPGStripStatusMap::const_iterator stItr(stripMap.begin()); stItr != stripMap.end(); ++stItr) { + if ((*stItr).second > 0) { + const EcalElectronicsId stid((*stItr).first); + //if(stid.subdet() == EcalEndcap); + meTTMaskMap.fill(stid, 1); + } //masked + } //loop on pseudo-strips + // if(HLTCaloPath_.size() || HLTMuonPath_.size()){ // edm::TriggerResultsByName results(_evt.triggerResultsByName("HLT")); // if(!results.isValid()) results = _evt.triggerResultsByName("RECO"); @@ -186,25 +171,19 @@ namespace ecaldqm // } } - template - void - TrigPrimTask::runOnDigis(DigiCollection const& _digis) - { - for(typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr){ + template + void TrigPrimTask::runOnDigis(DigiCollection const& _digis) { + for (typename DigiCollection::const_iterator digiItr(_digis.begin()); digiItr != _digis.end(); ++digiItr) { EcalTrigTowerDetId ttid(getTrigTowerMap()->towerOf(digiItr->id())); towerReadouts_[ttid.rawId()]++; } } - void - TrigPrimTask::setTokens(edm::ConsumesCollector& _collector) - { + void TrigPrimTask::setTokens(edm::ConsumesCollector& _collector) { lhcStatusInfoRecordToken_ = _collector.consumes(lhcStatusInfoCollectionTag_); } - void - TrigPrimTask::runOnRealTPs(EcalTrigPrimDigiCollection const& _tps) - { + void TrigPrimTask::runOnRealTPs(EcalTrigPrimDigiCollection const& _tps) { MESet& meEtVsBx(MEs_.at("EtVsBx")); MESet& meEtReal(MEs_.at("EtReal")); MESet& meEtRealMap(MEs_.at("EtRealMap")); @@ -215,8 +194,8 @@ namespace ecaldqm MESet& meHighIntMap(MEs_.at("HighIntMap")); MESet& meTTFlags(MEs_.at("TTFlags")); MESet& meTTFlagsVsEt(MEs_.at("TTFlagsVsEt")); - MESet& meTTFlags4( MEs_.at("TTFlags4") ); - MESet& meTTFlags4ByLumi( MEs_.at("TTFlags4ByLumi") ); + MESet& meTTFlags4(MEs_.at("TTFlags4")); + MESet& meTTFlags4ByLumi(MEs_.at("TTFlags4ByLumi")); MESet& meTTFMismatch(MEs_.at("TTFMismatch")); MESet& meOccVsBx(MEs_.at("OccVsBx")); @@ -224,14 +203,14 @@ namespace ecaldqm double nTP[] = {0., 0., 0.}; - for(EcalTrigPrimDigiCollection::const_iterator tpItr(_tps.begin()); tpItr != _tps.end(); ++tpItr){ + for (EcalTrigPrimDigiCollection::const_iterator tpItr(_tps.begin()); tpItr != _tps.end(); ++tpItr) { EcalTrigTowerDetId ttid(tpItr->id()); float et(tpItr->compressedEt()); - if(et > 0.){ - if(ttid.subDet() == EcalBarrel) + if (et > 0.) { + if (ttid.subDet() == EcalBarrel) nTP[0] += 1.; - else if(ttid.zside() < 0) + else if (ttid.zside() < 0) nTP[1] += 1.; else nTP[2] += 2.; @@ -245,37 +224,37 @@ namespace ecaldqm int interest(tpItr->ttFlag() & 0x3); - switch(interest){ - case 0: - meLowIntMap.fill(ttid); - break; - case 1: - meMedIntMap.fill(ttid); - break; - case 3: - meHighIntMap.fill(ttid); - break; - default: - break; + switch (interest) { + case 0: + meLowIntMap.fill(ttid); + break; + case 1: + meMedIntMap.fill(ttid); + break; + case 3: + meHighIntMap.fill(ttid); + break; + default: + break; } // Fill TT Flag MEs - int ttF( tpItr->ttFlag() ); - meTTFlags.fill( ttid, 1.0*ttF ); - meTTFlagsVsEt.fill(ttid, et, 1.0*ttF); + int ttF(tpItr->ttFlag()); + meTTFlags.fill(ttid, 1.0 * ttF); + meTTFlagsVsEt.fill(ttid, et, 1.0 * ttF); // Monitor occupancy of TTF=4 // which contains info about TT auto-masking - if ( ttF >= 4 ) { - meTTFlags4.fill( ttid ); - meTTFlags4ByLumi.fill( ttid ); + if (ttF >= 4) { + meTTFlags4.fill(ttid); + meTTFlags4ByLumi.fill(ttid); } - if((ttF == 1 || ttF == 3) && towerReadouts_[ttid.rawId()] != getTrigTowerMap()->constituentsOf(ttid).size()) + if ((ttF == 1 || ttF == 3) && towerReadouts_[ttid.rawId()] != getTrigTowerMap()->constituentsOf(ttid).size()) meTTFMismatch.fill(ttid); } - meOccVsBx.fill( EcalBarrel, bxBin_, nTP[0]); + meOccVsBx.fill(EcalBarrel, bxBin_, nTP[0]); meOccVsBx.fill(-EcalEndcap, bxBin_, nTP[1]); - meOccVsBx.fill( EcalEndcap, bxBin_, nTP[2]); + meOccVsBx.fill(EcalEndcap, bxBin_, nTP[2]); // Set TT/Strip Masking status in Ecal3P view // Status Records are read-in at beginRun() but filled here @@ -283,31 +262,29 @@ namespace ecaldqm MESet& meTTMaskMapAll(MEs_.at("TTMaskMapAll")); // Fill from TT Status Rcd - const EcalTPGTowerStatus *TTStatus( TTStatusRcd.product() ); - const EcalTPGTowerStatusMap &TTStatusMap( TTStatus->getMap() ); - for( EcalTPGTowerStatusMap::const_iterator ttItr(TTStatusMap.begin()); ttItr != TTStatusMap.end(); ++ttItr ){ - const EcalTrigTowerDetId ttid( ttItr->first ); - if ( ttItr->second > 0 ) - meTTMaskMapAll.setBinContent( ttid,1 ); // TT is masked - } // TTs + const EcalTPGTowerStatus* TTStatus(TTStatusRcd.product()); + const EcalTPGTowerStatusMap& TTStatusMap(TTStatus->getMap()); + for (EcalTPGTowerStatusMap::const_iterator ttItr(TTStatusMap.begin()); ttItr != TTStatusMap.end(); ++ttItr) { + const EcalTrigTowerDetId ttid(ttItr->first); + if (ttItr->second > 0) + meTTMaskMapAll.setBinContent(ttid, 1); // TT is masked + } // TTs // Fill from Strip Status Rcd - const EcalTPGStripStatus *StripStatus( StripStatusRcd.product() ); - const EcalTPGStripStatusMap &StripStatusMap( StripStatus->getMap() ); - for( EcalTPGStripStatusMap::const_iterator stItr(StripStatusMap.begin()); stItr != StripStatusMap.end(); ++stItr ){ - const EcalTriggerElectronicsId stid( stItr->first ); + const EcalTPGStripStatus* StripStatus(StripStatusRcd.product()); + const EcalTPGStripStatusMap& StripStatusMap(StripStatus->getMap()); + for (EcalTPGStripStatusMap::const_iterator stItr(StripStatusMap.begin()); stItr != StripStatusMap.end(); ++stItr) { + const EcalTriggerElectronicsId stid(stItr->first); // Since ME has kTriggerTower binning, convert to EcalTrigTowerDetId first // In principle, setBinContent() could be implemented for EcalTriggerElectronicsId class as well - const EcalTrigTowerDetId ttid( getElectronicsMap()->getTrigTowerDetId(stid.tccId(), stid.ttId()) ); - if ( stItr->second > 0 ) - meTTMaskMapAll.setBinContent( ttid,1 ); // PseudoStrip is masked - } // PseudoStrips + const EcalTrigTowerDetId ttid(getElectronicsMap()->getTrigTowerDetId(stid.tccId(), stid.ttId())); + if (stItr->second > 0) + meTTMaskMapAll.setBinContent(ttid, 1); // PseudoStrip is masked + } // PseudoStrips - } // TrigPrimTask::runOnRealTPs() + } // TrigPrimTask::runOnRealTPs() - void - TrigPrimTask::runOnEmulTPs(EcalTrigPrimDigiCollection const& _tps) - { + void TrigPrimTask::runOnEmulTPs(EcalTrigPrimDigiCollection const& _tps) { MESet& meEtMaxEmul(MEs_.at("EtMaxEmul")); MESet& meEmulMaxIndex(MEs_.at("EmulMaxIndex")); MESet& meMatchedIndex(MEs_.at("MatchedIndex")); @@ -315,24 +292,24 @@ namespace ecaldqm MESet& meFGEmulError(MEs_.at("FGEmulError")); MESet& meRealvEmulEt(MEs_.at("RealvEmulEt")); - for(EcalTrigPrimDigiCollection::const_iterator tpItr(_tps.begin()); tpItr != _tps.end(); ++tpItr){ + for (EcalTrigPrimDigiCollection::const_iterator tpItr(_tps.begin()); tpItr != _tps.end(); ++tpItr) { EcalTrigTowerDetId ttid(tpItr->id()); int et(tpItr->compressedEt()); float maxEt(0.); int iMax(0); - for(int iDigi(0); iDigi < 5; iDigi++){ + for (int iDigi(0); iDigi < 5; iDigi++) { float sampleEt((*tpItr)[iDigi].compressedEt()); - if(sampleEt > maxEt){ + if (sampleEt > maxEt) { maxEt = sampleEt; iMax = iDigi + 1; } } meEtMaxEmul.fill(ttid, maxEt); - if(maxEt > 0.) + if (maxEt > 0.) meEmulMaxIndex.fill(ttid, iMax); bool match(true); @@ -342,25 +319,25 @@ namespace ecaldqm // If an Et match is found, return TP index correpsonding to BX of emulated TP where match was found // Standard TPG comparison: { TP index:matched BX } = { no emul:No Et match, 0:BX-2, 1:BX-1, 2:in-time, 3:BX+1, 4:BX+2 } EcalTrigPrimDigiCollection::const_iterator realItr(realTps_->find(ttid)); - if(realItr != realTps_->end()){ - + if (realItr != realTps_->end()) { int realEt(realItr->compressedEt()); - if(realEt > 0){ - + if (realEt > 0) { int ttF(realItr->ttFlag()); - if((ttF == 1 || ttF == 3) && towerReadouts_[ttid.rawId()] == getTrigTowerMap()->constituentsOf(ttid).size()){ - - if(et != realEt) match = false; - if(tpItr->fineGrain() != realItr->fineGrain()) matchFG = false; + if ((ttF == 1 || ttF == 3) && + towerReadouts_[ttid.rawId()] == getTrigTowerMap()->constituentsOf(ttid).size()) { + if (et != realEt) + match = false; + if (tpItr->fineGrain() != realItr->fineGrain()) + matchFG = false; // NOTE: matchedIndex comparison differs from Standard TPG comparison: // { matchedIndex:TP index } = { 0:no emul, 1:BX-2, 2:BX-1, 3:in-time, 4:BX+1, 5:BX+2 } std::vector matchedIndex(0); // iDigi only loops over explicit Et matches: // { iDigi:TP index } = { 0:BX-2, 1:BX-1, 2:in-time, 3:BX+1, 4:BX+2 } - for(int iDigi(0); iDigi < 5; iDigi++){ - if((*tpItr)[iDigi].compressedEt() == realEt) { + for (int iDigi(0); iDigi < 5; iDigi++) { + if ((*tpItr)[iDigi].compressedEt() == realEt) { // matchedIndex = iDigi + 1 if (iDigi != 2) { matchedIndex.push_back(iDigi + 1); @@ -369,18 +346,20 @@ namespace ecaldqm // Ensures multiple matches are not returned (e.g. during saturation) else { matchedIndex.clear(); - matchedIndex.push_back(3); // Et match is to in-time emulated TP + matchedIndex.push_back(3); // Et match is to in-time emulated TP break; } - } // Et match found - } // iDigi - if(matchedIndex.empty()) matchedIndex.push_back(0); // no Et match found => no emul - + } // Et match found + } // iDigi + if (matchedIndex.empty()) + matchedIndex.push_back(0); // no Et match found => no emul + // Fill Real vs Emulated TP Et - meRealvEmulEt.fill( ttid,realEt,(*tpItr)[2].compressedEt() ); // iDigi=2:in-time BX + meRealvEmulEt.fill(ttid, realEt, (*tpItr)[2].compressedEt()); // iDigi=2:in-time BX // Fill matchedIndex ME - for(std::vector::iterator matchItr(matchedIndex.begin()); matchItr != matchedIndex.end(); ++matchItr){ + for (std::vector::iterator matchItr(matchedIndex.begin()); matchItr != matchedIndex.end(); + ++matchItr) { meMatchedIndex.fill(ttid, *matchItr + 0.5); // timing information is only within emulated TPs (real TPs have one time sample) @@ -388,19 +367,18 @@ namespace ecaldqm // if(HLTMuonBit_) MEs_[kTimingMuon].fill(ttid, float(*matchItr)); } } - } - } - else{ + } else { match = false; matchFG = false; } - if(!match) meEtEmulError.fill(ttid); - if(!matchFG) meFGEmulError.fill(ttid); + if (!match) + meEtEmulError.fill(ttid); + if (!matchFG) + meFGEmulError.fill(ttid); } } DEFINE_ECALDQM_WORKER(TrigPrimTask); -} - +} // namespace ecaldqm diff --git a/DQM/HcalTasks/interface/DigiComparisonTask.h b/DQM/HcalTasks/interface/DigiComparisonTask.h index 3e7fde934aa8d..e1cf7c013bc7b 100644 --- a/DQM/HcalTasks/interface/DigiComparisonTask.h +++ b/DQM/HcalTasks/interface/DigiComparisonTask.h @@ -16,60 +16,56 @@ #include "DQM/HcalCommon/interface/ElectronicsMap.h" #include "DQM/HcalCommon/interface/HashFilter.h" -class DigiComparisonTask : public hcaldqm::DQTask -{ - public: - DigiComparisonTask(edm::ParameterSet const&); - ~DigiComparisonTask() override - {} +class DigiComparisonTask : public hcaldqm::DQTask { +public: + DigiComparisonTask(edm::ParameterSet const&); + ~DigiComparisonTask() override {} - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - void endLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; - protected: - // funcs - void _process(edm::Event const&, edm::EventSetup const&) override; - void _resetMonitors(hcaldqm::UpdateFreq) override; +protected: + // funcs + void _process(edm::Event const&, edm::EventSetup const&) override; + void _resetMonitors(hcaldqm::UpdateFreq) override; - // Tags and corresponding Tokens - edm::InputTag _tagHBHE1; - edm::InputTag _tagHBHE2; - edm::EDGetTokenT _tokHBHE1; - edm::EDGetTokenT _tokHBHE2; + // Tags and corresponding Tokens + edm::InputTag _tagHBHE1; + edm::InputTag _tagHBHE2; + edm::EDGetTokenT _tokHBHE1; + edm::EDGetTokenT _tokHBHE2; - // emap+hashmap - hcaldqm::electronicsmap::ElectronicsMap _ehashmapuTCA; - hcaldqm::electronicsmap::ElectronicsMap _ehashmapVME; + // emap+hashmap + hcaldqm::electronicsmap::ElectronicsMap _ehashmapuTCA; + hcaldqm::electronicsmap::ElectronicsMap _ehashmapVME; - // hashes/FED vectors - std::vector _vhashFEDs; + // hashes/FED vectors + std::vector _vhashFEDs; - // Filters - hcaldqm::filter::HashFilter _filter_VME; - hcaldqm::filter::HashFilter _filter_uTCA; + // Filters + hcaldqm::filter::HashFilter _filter_VME; + hcaldqm::filter::HashFilter _filter_uTCA; - /** + /** * Containers */ - // ADC - hcaldqm::Container2D _cADC_Subdet[10]; - hcaldqm::Container2D _cADCall_Subdet; + // ADC + hcaldqm::Container2D _cADC_Subdet[10]; + hcaldqm::Container2D _cADCall_Subdet; - // Mismatched - hcaldqm::Container2D _cMsm_FEDVME; - hcaldqm::Container2D _cMsm_FEDuTCA; - hcaldqm::Container2D _cMsm_depth; + // Mismatched + hcaldqm::Container2D _cMsm_FEDVME; + hcaldqm::Container2D _cMsm_FEDuTCA; + hcaldqm::Container2D _cMsm_depth; - // Missing Completely - hcaldqm::Container1D _cADCMsnuTCA_Subdet; - hcaldqm::Container1D _cADCMsnVME_Subdet; - hcaldqm::Container2D _cMsnVME_depth; - hcaldqm::Container2D _cMsnuTCA_depth; - hcaldqm::Container2D _cMsn_FEDVME; - hcaldqm::Container2D _cMsn_FEDuTCA; + // Missing Completely + hcaldqm::Container1D _cADCMsnuTCA_Subdet; + hcaldqm::Container1D _cADCMsnVME_Subdet; + hcaldqm::Container2D _cMsnVME_depth; + hcaldqm::Container2D _cMsnuTCA_depth; + hcaldqm::Container2D _cMsn_FEDVME; + hcaldqm::Container2D _cMsn_FEDuTCA; }; #endif diff --git a/DQM/HcalTasks/interface/DigiPhase1Task.h b/DQM/HcalTasks/interface/DigiPhase1Task.h index 83edff8ab2e42..76e993c06f7a8 100644 --- a/DQM/HcalTasks/interface/DigiPhase1Task.h +++ b/DQM/HcalTasks/interface/DigiPhase1Task.h @@ -26,127 +26,116 @@ #include "DQM/HcalCommon/interface/ContainerSingleProf2D.h" #include "DQM/HcalCommon/interface/ContainerXXX.h" -class DigiPhase1Task : public hcaldqm::DQTask -{ - public: - DigiPhase1Task(edm::ParameterSet const&); - ~DigiPhase1Task() override {} - - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - void beginLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - void endLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - - protected: - void _process(edm::Event const&, edm::EventSetup const&) override; - void _resetMonitors(hcaldqm::UpdateFreq) override; - - edm::InputTag _tagHBHE; - edm::InputTag _tagHO; - edm::InputTag _tagHF; - edm::EDGetTokenT _tokHBHE; - edm::EDGetTokenT _tokHO; - edm::EDGetTokenT _tokHF; - - double _cutSumQ_HBHE, _cutSumQ_HO, _cutSumQ_HF; - double _thresh_unihf; - - // flag vector - std::vector _vflags; - enum DigiFlag - { - fDigiSize=0, - fUni = 1, - fNChsHF = 2, - fUnknownIds = 3, - nDigiFlag = 4 - }; - - // hashes/FED vectors - std::vector _vhashFEDs; - - // emap - hcaldqm::electronicsmap::ElectronicsMap _ehashmap; // online only - hcaldqm::electronicsmap::ElectronicsMap _dhashmap; - - // Filters - hcaldqm::filter::HashFilter _filter_VME; - hcaldqm::filter::HashFilter _filter_uTCA; - hcaldqm::filter::HashFilter _filter_FEDHF; - hcaldqm::filter::HashFilter _filter_HF; - - /* hcaldqm::Containers */ - // ADC, fC - Charge - just filling - no summary! - hcaldqm::Container1D _cADC_SubdetPM; - hcaldqm::Container1D _cfC_SubdetPM; - hcaldqm::Container1D _cSumQ_SubdetPM; - hcaldqm::ContainerProf2D _cSumQ_depth; - hcaldqm::ContainerProf1D _cSumQvsLS_SubdetPM; - hcaldqm::ContainerProf1D _cSumQvsBX_SubdetPM; // online only! - - // Shape - just filling - not summary! - hcaldqm::Container1D _cShapeCut_FED; - - // Timing - // just filling - no summary! - hcaldqm::Container1D _cTimingCut_SubdetPM; - hcaldqm::ContainerProf2D _cTimingCut_FEDVME; - hcaldqm::ContainerProf2D _cTimingCut_FEDuTCA; - hcaldqm::ContainerProf2D _cTimingCut_ElectronicsVME; - hcaldqm::ContainerProf2D _cTimingCut_ElectronicsuTCA; - hcaldqm::ContainerProf1D _cTimingCutvsLS_FED; - hcaldqm::ContainerProf2D _cTimingCut_depth; - hcaldqm::ContainerProf1D _cTimingCutvsiphi_SubdetPM; // online only! - hcaldqm::ContainerProf1D _cTimingCutvsieta_Subdet; // online only! - - // Only for Online mode! just filling - no summary! - hcaldqm::ContainerProf1D _cQ2Q12CutvsLS_FEDHF; // online only! - - // Occupancy w/o a Cut - whatever is sitting in the Digi Collection - // used to determine Missing Digis => used for Summary! - hcaldqm::Container2D _cOccupancy_FEDVME; - hcaldqm::Container2D _cOccupancy_FEDuTCA; - hcaldqm::Container2D _cOccupancy_ElectronicsVME; - hcaldqm::Container2D _cOccupancy_ElectronicsuTCA; - hcaldqm::Container2D _cOccupancy_depth; - hcaldqm::Container1D _cOccupancyvsiphi_SubdetPM; // online only - hcaldqm::Container1D _cOccupancyvsieta_Subdet; // online only - - // Occupancy w/ a Cut - // used to determine if occupancy is symmetric or not. => - // used for Summary - hcaldqm::Container2D _cOccupancyCut_FEDVME; - hcaldqm::Container2D _cOccupancyCut_FEDuTCA; - hcaldqm::Container2D _cOccupancyCut_ElectronicsVME; - hcaldqm::Container2D _cOccupancyCut_ElectronicsuTCA; - hcaldqm::Container2D _cOccupancyCut_depth; - hcaldqm::Container1D _cOccupancyCutvsiphi_SubdetPM; // online only - hcaldqm::Container1D _cOccupancyCutvsieta_Subdet; // online only - hcaldqm::Container2D _cOccupancyCutvsSlotvsLS_HFPM; // online only - hcaldqm::Container2D _cOccupancyCutvsiphivsLS_SubdetPM; // online only - - // Occupancy w/o and w/ a Cut vs BX and vs LS - hcaldqm::ContainerProf1D _cOccupancyvsLS_Subdet; - hcaldqm::ContainerProf1D _cOccupancyCutvsLS_Subdet; // online only - hcaldqm::ContainerProf1D _cOccupancyCutvsBX_Subdet; // online only - - // #Time Samples for a digi. Used for Summary generation - hcaldqm::Container1D _cDigiSize_FED; - hcaldqm::ContainerProf1D _cDigiSizevsLS_FED; // online only - hcaldqm::ContainerXXX _xDigiSize; // online only - hcaldqm::ContainerXXX _xUniHF,_xUni; // online only - hcaldqm::ContainerXXX _xNChs; // online only - hcaldqm::ContainerXXX _xNChsNominal; // online only - - // #events counters - MonitorElement *meNumEvents1LS; // to transfer the #events to harvesting - MonitorElement *meUnknownIds1LS; - bool _unknownIdsPresent; - - hcaldqm::Container2D _cSummaryvsLS_FED; // online only - hcaldqm::ContainerSingle2D _cSummaryvsLS; // online only +class DigiPhase1Task : public hcaldqm::DQTask { +public: + DigiPhase1Task(edm::ParameterSet const &); + ~DigiPhase1Task() override {} + + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override; + void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override; + +protected: + void _process(edm::Event const &, edm::EventSetup const &) override; + void _resetMonitors(hcaldqm::UpdateFreq) override; + + edm::InputTag _tagHBHE; + edm::InputTag _tagHO; + edm::InputTag _tagHF; + edm::EDGetTokenT _tokHBHE; + edm::EDGetTokenT _tokHO; + edm::EDGetTokenT _tokHF; + + double _cutSumQ_HBHE, _cutSumQ_HO, _cutSumQ_HF; + double _thresh_unihf; + + // flag vector + std::vector _vflags; + enum DigiFlag { fDigiSize = 0, fUni = 1, fNChsHF = 2, fUnknownIds = 3, nDigiFlag = 4 }; + + // hashes/FED vectors + std::vector _vhashFEDs; + + // emap + hcaldqm::electronicsmap::ElectronicsMap _ehashmap; // online only + hcaldqm::electronicsmap::ElectronicsMap _dhashmap; + + // Filters + hcaldqm::filter::HashFilter _filter_VME; + hcaldqm::filter::HashFilter _filter_uTCA; + hcaldqm::filter::HashFilter _filter_FEDHF; + hcaldqm::filter::HashFilter _filter_HF; + + /* hcaldqm::Containers */ + // ADC, fC - Charge - just filling - no summary! + hcaldqm::Container1D _cADC_SubdetPM; + hcaldqm::Container1D _cfC_SubdetPM; + hcaldqm::Container1D _cSumQ_SubdetPM; + hcaldqm::ContainerProf2D _cSumQ_depth; + hcaldqm::ContainerProf1D _cSumQvsLS_SubdetPM; + hcaldqm::ContainerProf1D _cSumQvsBX_SubdetPM; // online only! + + // Shape - just filling - not summary! + hcaldqm::Container1D _cShapeCut_FED; + + // Timing + // just filling - no summary! + hcaldqm::Container1D _cTimingCut_SubdetPM; + hcaldqm::ContainerProf2D _cTimingCut_FEDVME; + hcaldqm::ContainerProf2D _cTimingCut_FEDuTCA; + hcaldqm::ContainerProf2D _cTimingCut_ElectronicsVME; + hcaldqm::ContainerProf2D _cTimingCut_ElectronicsuTCA; + hcaldqm::ContainerProf1D _cTimingCutvsLS_FED; + hcaldqm::ContainerProf2D _cTimingCut_depth; + hcaldqm::ContainerProf1D _cTimingCutvsiphi_SubdetPM; // online only! + hcaldqm::ContainerProf1D _cTimingCutvsieta_Subdet; // online only! + + // Only for Online mode! just filling - no summary! + hcaldqm::ContainerProf1D _cQ2Q12CutvsLS_FEDHF; // online only! + + // Occupancy w/o a Cut - whatever is sitting in the Digi Collection + // used to determine Missing Digis => used for Summary! + hcaldqm::Container2D _cOccupancy_FEDVME; + hcaldqm::Container2D _cOccupancy_FEDuTCA; + hcaldqm::Container2D _cOccupancy_ElectronicsVME; + hcaldqm::Container2D _cOccupancy_ElectronicsuTCA; + hcaldqm::Container2D _cOccupancy_depth; + hcaldqm::Container1D _cOccupancyvsiphi_SubdetPM; // online only + hcaldqm::Container1D _cOccupancyvsieta_Subdet; // online only + + // Occupancy w/ a Cut + // used to determine if occupancy is symmetric or not. => + // used for Summary + hcaldqm::Container2D _cOccupancyCut_FEDVME; + hcaldqm::Container2D _cOccupancyCut_FEDuTCA; + hcaldqm::Container2D _cOccupancyCut_ElectronicsVME; + hcaldqm::Container2D _cOccupancyCut_ElectronicsuTCA; + hcaldqm::Container2D _cOccupancyCut_depth; + hcaldqm::Container1D _cOccupancyCutvsiphi_SubdetPM; // online only + hcaldqm::Container1D _cOccupancyCutvsieta_Subdet; // online only + hcaldqm::Container2D _cOccupancyCutvsSlotvsLS_HFPM; // online only + hcaldqm::Container2D _cOccupancyCutvsiphivsLS_SubdetPM; // online only + + // Occupancy w/o and w/ a Cut vs BX and vs LS + hcaldqm::ContainerProf1D _cOccupancyvsLS_Subdet; + hcaldqm::ContainerProf1D _cOccupancyCutvsLS_Subdet; // online only + hcaldqm::ContainerProf1D _cOccupancyCutvsBX_Subdet; // online only + + // #Time Samples for a digi. Used for Summary generation + hcaldqm::Container1D _cDigiSize_FED; + hcaldqm::ContainerProf1D _cDigiSizevsLS_FED; // online only + hcaldqm::ContainerXXX _xDigiSize; // online only + hcaldqm::ContainerXXX _xUniHF, _xUni; // online only + hcaldqm::ContainerXXX _xNChs; // online only + hcaldqm::ContainerXXX _xNChsNominal; // online only + + // #events counters + MonitorElement *meNumEvents1LS; // to transfer the #events to harvesting + MonitorElement *meUnknownIds1LS; + bool _unknownIdsPresent; + + hcaldqm::Container2D _cSummaryvsLS_FED; // online only + hcaldqm::ContainerSingle2D _cSummaryvsLS; // online only }; #endif diff --git a/DQM/HcalTasks/interface/DigiRunSummary.h b/DQM/HcalTasks/interface/DigiRunSummary.h index 8289f13fdd25c..d598ee22ac0bb 100644 --- a/DQM/HcalTasks/interface/DigiRunSummary.h +++ b/DQM/HcalTasks/interface/DigiRunSummary.h @@ -5,55 +5,50 @@ #include "DQM/HcalCommon/interface/ElectronicsMap.h" #include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -namespace hcaldqm -{ - class DigiRunSummary : public DQClient - { - public: - DigiRunSummary(std::string const&, std::string const&, - edm::ParameterSet const&); - ~DigiRunSummary() override {} - - void beginRun(edm::Run const&, edm::EventSetup const&) override; - void endLuminosityBlock(DQMStore::IBooker&, - DQMStore::IGetter&, edm::LuminosityBlock const&, - edm::EventSetup const&) override; - std::vector endJob( - DQMStore::IBooker&, DQMStore::IGetter&) override; - - protected: - std::vector _vflagsLS; - - double _thresh_unihf; - - electronicsmap::ElectronicsMap _ehashmap; - - std::vector _vhashVME, _vhashuTCA, _vhashFEDHF; - std::vector _vFEDsVME, _vFEDsuTCA; - filter::HashFilter _filter_VME, _filter_uTCA, _filter_FEDHF; - - Container2D _cOccupancy_depth; - bool _booked; - MonitorElement *_meNumEvents; // number of events vs LS - - ContainerXXX _xDead, _xDigiSize, _xUniHF, - _xUni, _xNChs, _xNChsNominal; - - std::map _refDigiSize; - - // flag enum - enum DigiLSFlag - { - fDigiSize = 0, - fNChsHF=1, - fUnknownIds=2, - fLED=3, - nLSFlags=4, // defines the boundary between lumi-based and run-based flags - fUniHF=5, - fDead=6, - nDigiFlag = 7 - }; - }; -} +namespace hcaldqm { + class DigiRunSummary : public DQClient { + public: + DigiRunSummary(std::string const &, std::string const &, edm::ParameterSet const &); + ~DigiRunSummary() override {} + + void beginRun(edm::Run const &, edm::EventSetup const &) override; + void endLuminosityBlock(DQMStore::IBooker &, + DQMStore::IGetter &, + edm::LuminosityBlock const &, + edm::EventSetup const &) override; + std::vector endJob(DQMStore::IBooker &, DQMStore::IGetter &) override; + + protected: + std::vector _vflagsLS; + + double _thresh_unihf; + + electronicsmap::ElectronicsMap _ehashmap; + + std::vector _vhashVME, _vhashuTCA, _vhashFEDHF; + std::vector _vFEDsVME, _vFEDsuTCA; + filter::HashFilter _filter_VME, _filter_uTCA, _filter_FEDHF; + + Container2D _cOccupancy_depth; + bool _booked; + MonitorElement *_meNumEvents; // number of events vs LS + + ContainerXXX _xDead, _xDigiSize, _xUniHF, _xUni, _xNChs, _xNChsNominal; + + std::map _refDigiSize; + + // flag enum + enum DigiLSFlag { + fDigiSize = 0, + fNChsHF = 1, + fUnknownIds = 2, + fLED = 3, + nLSFlags = 4, // defines the boundary between lumi-based and run-based flags + fUniHF = 5, + fDead = 6, + nDigiFlag = 7 + }; + }; +} // namespace hcaldqm #endif diff --git a/DQM/HcalTasks/interface/DigiTask.h b/DQM/HcalTasks/interface/DigiTask.h index adb8282c80d4d..1c8d5f7ea3fde 100644 --- a/DQM/HcalTasks/interface/DigiTask.h +++ b/DQM/HcalTasks/interface/DigiTask.h @@ -26,186 +26,173 @@ #include "DQM/HcalCommon/interface/ContainerSingleProf2D.h" #include "DQM/HcalCommon/interface/ContainerXXX.h" -class DigiTask : public hcaldqm::DQTask -{ - public: - DigiTask(edm::ParameterSet const&); - ~DigiTask() override {} - - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - void beginLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - void endLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - - protected: - void _process(edm::Event const&, edm::EventSetup const&) override; - void _resetMonitors(hcaldqm::UpdateFreq) override; - - edm::InputTag _tagHBHE; - edm::InputTag _tagHE; - edm::InputTag _tagHO; - edm::InputTag _tagHF; - edm::EDGetTokenT _tokHBHE; - edm::EDGetTokenT _tokHE; - edm::EDGetTokenT _tokHO; - edm::EDGetTokenT _tokHF; - - double _cutSumQ_HBHE, _cutSumQ_HE, _cutSumQ_HO, _cutSumQ_HF; - double _thresh_unihf; - - // flag vector - std::vector _vflags; - enum DigiFlag - { - fDigiSize=0, - fUni = 1, - fNChsHF = 2, - fUnknownIds = 3, - fLED=4, - fCapId=5, - nDigiFlag=6 - }; - - // hashes/FED vectors - std::vector _vhashFEDs; - - std::map _refDigiSize; - - // emap - hcaldqm::electronicsmap::ElectronicsMap _ehashmap; // online only - hcaldqm::electronicsmap::ElectronicsMap _dhashmap; - - // Filters - hcaldqm::filter::HashFilter _filter_VME; - hcaldqm::filter::HashFilter _filter_uTCA; - hcaldqm::filter::HashFilter _filter_FEDHF; - hcaldqm::filter::HashFilter _filter_QIE1011; - hcaldqm::filter::HashFilter _filter_QIE8; - hcaldqm::filter::HashFilter _filter_HEP17; - - /* hcaldqm::Containers */ - // ADC, fC - Charge - just filling - no summary! - hcaldqm::Container1D _cADC_SubdetPM; - hcaldqm::Container1D _cfC_SubdetPM; - hcaldqm::Container1D _cSumQ_SubdetPM; - hcaldqm::ContainerProf2D _cSumQ_depth; - hcaldqm::ContainerProf1D _cSumQvsLS_SubdetPM; - hcaldqm::ContainerProf1D _cSumQvsBX_SubdetPM; // online only! - - // ADC, fC for HF (QIE10 has different ADC/fC) - hcaldqm::Container1D _cADC_SubdetPM_QIE1011; - hcaldqm::Container1D _cfC_SubdetPM_QIE1011; - hcaldqm::Container1D _cSumQ_SubdetPM_QIE1011; - hcaldqm::ContainerProf1D _cSumQvsLS_SubdetPM_QIE1011; - hcaldqm::ContainerProf1D _cSumQvsBX_SubdetPM_QIE1011; // online only! - - - // Shape - just filling - not summary! - hcaldqm::Container1D _cShapeCut_FED; - hcaldqm::Container2D _cADCvsTS_SubdetPM; - hcaldqm::Container2D _cADCvsTS_SubdetPM_QIE1011; - - // Timing - // just filling - no summary! - hcaldqm::Container1D _cTimingCut_SubdetPM; - hcaldqm::ContainerProf2D _cTimingCut_FEDVME; - hcaldqm::ContainerProf2D _cTimingCut_FEDuTCA; - hcaldqm::ContainerProf2D _cTimingCut_ElectronicsVME; - hcaldqm::ContainerProf2D _cTimingCut_ElectronicsuTCA; - hcaldqm::ContainerProf1D _cTimingCutvsLS_FED; - hcaldqm::ContainerProf1D _cTimingCutvsLS_SubdetPM; - hcaldqm::ContainerProf2D _cTimingCut_depth; - hcaldqm::ContainerProf1D _cTimingCutvsiphi_SubdetPM; // online only! - hcaldqm::ContainerProf1D _cTimingCutvsieta_Subdet; // online only! - - // Only for Online mode! just filling - no summary! - hcaldqm::ContainerProf1D _cQ2Q12CutvsLS_FEDHF; // online only! - - // Occupancy w/o a Cut - whatever is sitting in the Digi Collection - // used to determine Missing Digis => used for Summary! - hcaldqm::Container2D _cOccupancy_FEDVME; - hcaldqm::Container2D _cOccupancy_FEDuTCA; - hcaldqm::Container2D _cOccupancy_ElectronicsVME; - hcaldqm::Container2D _cOccupancy_ElectronicsuTCA; - hcaldqm::Container2D _cOccupancy_Crate; - hcaldqm::Container2D _cOccupancy_CrateSlot; - hcaldqm::Container2D _cOccupancy_depth; - hcaldqm::Container1D _cOccupancyvsiphi_SubdetPM; // online only - hcaldqm::Container1D _cOccupancyvsieta_Subdet; // online only - - // Occupancy w/ a Cut - // used to determine if occupancy is symmetric or not. => - // used for Summary - hcaldqm::Container2D _cOccupancyCut_FEDVME; - hcaldqm::Container2D _cOccupancyCut_FEDuTCA; - hcaldqm::Container2D _cOccupancyCut_ElectronicsVME; - hcaldqm::Container2D _cOccupancyCut_ElectronicsuTCA; - hcaldqm::Container2D _cOccupancyCut_depth; - hcaldqm::Container1D _cOccupancyCutvsiphi_SubdetPM; // online only - hcaldqm::Container1D _cOccupancyCutvsieta_Subdet; // online only - //hcaldqm::Container2D _cOccupancyCutvsSlotvsLS_HFPM; // online only - hcaldqm::Container2D _cOccupancyCutvsiphivsLS_SubdetPM; // online only - - // Occupancy w/o and w/ a Cut vs BX and vs LS - hcaldqm::ContainerProf1D _cOccupancyvsLS_Subdet; - hcaldqm::ContainerProf1D _cOccupancyCutvsLS_Subdet; // online only - hcaldqm::ContainerProf1D _cOccupancyCutvsBX_Subdet; // online only - - // #Time Samples for a digi. Used for Summary generation - hcaldqm::Container1D _cDigiSize_Crate; - hcaldqm::Container1D _cDigiSize_FED; - hcaldqm::ContainerProf1D _cDigiSizevsLS_FED; // online only - hcaldqm::ContainerXXX _xDigiSize; // online only - hcaldqm::ContainerXXX _xUniHF,_xUni; // online only - hcaldqm::ContainerXXX _xNChs; // online only - hcaldqm::ContainerXXX _xNChsNominal; // online only - hcaldqm::ContainerXXX _xBadCapid; // online only - - // QIE10 TDC histograms - hcaldqm::Container2D _cLETDCTimevsADC_SubdetPM; - hcaldqm::Container2D _cLETDCvsADC_SubdetPM; - hcaldqm::Container2D _cLETDCvsTS_SubdetPM; - hcaldqm::Container1D _cLETDCTime_SubdetPM; - hcaldqm::ContainerProf2D _cLETDCTime_depth; - - // Bad TDC histograms - hcaldqm::Container1D _cBadTDCValues_SubdetPM; - hcaldqm::Container1D _cBadTDCvsBX_SubdetPM; - hcaldqm::Container1D _cBadTDCvsLS_SubdetPM; - hcaldqm::Container2D _cBadTDCCount_depth; - - hcaldqm::Container1D _cBadTDCValues; - hcaldqm::Container1D _cBadTDCvsBX; - hcaldqm::Container1D _cBadTDCvsLS; - - // (Capid - BX) % 4 - hcaldqm::Container1D _cCapidMinusBXmod4_SubdetPM; - hcaldqm::ContainerSingle2D _cCapidMinusBXmod4_CrateSlotuTCA[4]; // CrateSlot 2D histograms for each (capid-BX)%4 - hcaldqm::ContainerSingle2D _cCapidMinusBXmod4_CrateSlotVME[4]; // CrateSlot 2D histograms for each (capid-BX)%4 - hcaldqm::ContainerSingle2D _cCapid_BadvsFEDvsLS; - hcaldqm::ContainerSingle2D _cCapid_BadvsFEDvsLSmod60; // Same as _cCapid_BadvsFEDvsLS, but only for last 50 LSes (for sound alarm turning off when problem goes away) - - // #events counters - MonitorElement *meNumEvents1LS; // to transfer the #events to harvesting - MonitorElement *meUnknownIds1LS; - bool _unknownIdsPresent; - - hcaldqm::Container2D _cSummaryvsLS_FED; // online only - hcaldqm::ContainerSingle2D _cSummaryvsLS; // online only - - bool _qie10InConditions; // Flag to protect against QIE10 digis not in conditions in 2016. - - std::map _capidmbx; // Expected (capid - BX) % 4 for each subdet - - // LED monitoring stuff - double _thresh_led; - std::map > _ledCalibrationChannels; - - hcaldqm::Container1D _LED_CUCountvsLS_Subdet; // Misfire count vs LS - hcaldqm::Container1D _LED_CUCountvsLSmod60_Subdet; // Misfire count vs LS - hcaldqm::Container2D _LED_ADCvsBX_Subdet; // Pin diode amplitude vs BX +class DigiTask : public hcaldqm::DQTask { +public: + DigiTask(edm::ParameterSet const &); + ~DigiTask() override {} + + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override; + void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override; + +protected: + void _process(edm::Event const &, edm::EventSetup const &) override; + void _resetMonitors(hcaldqm::UpdateFreq) override; + + edm::InputTag _tagHBHE; + edm::InputTag _tagHE; + edm::InputTag _tagHO; + edm::InputTag _tagHF; + edm::EDGetTokenT _tokHBHE; + edm::EDGetTokenT _tokHE; + edm::EDGetTokenT _tokHO; + edm::EDGetTokenT _tokHF; + + double _cutSumQ_HBHE, _cutSumQ_HE, _cutSumQ_HO, _cutSumQ_HF; + double _thresh_unihf; + + // flag vector + std::vector _vflags; + enum DigiFlag { fDigiSize = 0, fUni = 1, fNChsHF = 2, fUnknownIds = 3, fLED = 4, fCapId = 5, nDigiFlag = 6 }; + + // hashes/FED vectors + std::vector _vhashFEDs; + + std::map _refDigiSize; + + // emap + hcaldqm::electronicsmap::ElectronicsMap _ehashmap; // online only + hcaldqm::electronicsmap::ElectronicsMap _dhashmap; + + // Filters + hcaldqm::filter::HashFilter _filter_VME; + hcaldqm::filter::HashFilter _filter_uTCA; + hcaldqm::filter::HashFilter _filter_FEDHF; + hcaldqm::filter::HashFilter _filter_QIE1011; + hcaldqm::filter::HashFilter _filter_QIE8; + hcaldqm::filter::HashFilter _filter_HEP17; + + /* hcaldqm::Containers */ + // ADC, fC - Charge - just filling - no summary! + hcaldqm::Container1D _cADC_SubdetPM; + hcaldqm::Container1D _cfC_SubdetPM; + hcaldqm::Container1D _cSumQ_SubdetPM; + hcaldqm::ContainerProf2D _cSumQ_depth; + hcaldqm::ContainerProf1D _cSumQvsLS_SubdetPM; + hcaldqm::ContainerProf1D _cSumQvsBX_SubdetPM; // online only! + + // ADC, fC for HF (QIE10 has different ADC/fC) + hcaldqm::Container1D _cADC_SubdetPM_QIE1011; + hcaldqm::Container1D _cfC_SubdetPM_QIE1011; + hcaldqm::Container1D _cSumQ_SubdetPM_QIE1011; + hcaldqm::ContainerProf1D _cSumQvsLS_SubdetPM_QIE1011; + hcaldqm::ContainerProf1D _cSumQvsBX_SubdetPM_QIE1011; // online only! + + // Shape - just filling - not summary! + hcaldqm::Container1D _cShapeCut_FED; + hcaldqm::Container2D _cADCvsTS_SubdetPM; + hcaldqm::Container2D _cADCvsTS_SubdetPM_QIE1011; + + // Timing + // just filling - no summary! + hcaldqm::Container1D _cTimingCut_SubdetPM; + hcaldqm::ContainerProf2D _cTimingCut_FEDVME; + hcaldqm::ContainerProf2D _cTimingCut_FEDuTCA; + hcaldqm::ContainerProf2D _cTimingCut_ElectronicsVME; + hcaldqm::ContainerProf2D _cTimingCut_ElectronicsuTCA; + hcaldqm::ContainerProf1D _cTimingCutvsLS_FED; + hcaldqm::ContainerProf1D _cTimingCutvsLS_SubdetPM; + hcaldqm::ContainerProf2D _cTimingCut_depth; + hcaldqm::ContainerProf1D _cTimingCutvsiphi_SubdetPM; // online only! + hcaldqm::ContainerProf1D _cTimingCutvsieta_Subdet; // online only! + + // Only for Online mode! just filling - no summary! + hcaldqm::ContainerProf1D _cQ2Q12CutvsLS_FEDHF; // online only! + + // Occupancy w/o a Cut - whatever is sitting in the Digi Collection + // used to determine Missing Digis => used for Summary! + hcaldqm::Container2D _cOccupancy_FEDVME; + hcaldqm::Container2D _cOccupancy_FEDuTCA; + hcaldqm::Container2D _cOccupancy_ElectronicsVME; + hcaldqm::Container2D _cOccupancy_ElectronicsuTCA; + hcaldqm::Container2D _cOccupancy_Crate; + hcaldqm::Container2D _cOccupancy_CrateSlot; + hcaldqm::Container2D _cOccupancy_depth; + hcaldqm::Container1D _cOccupancyvsiphi_SubdetPM; // online only + hcaldqm::Container1D _cOccupancyvsieta_Subdet; // online only + + // Occupancy w/ a Cut + // used to determine if occupancy is symmetric or not. => + // used for Summary + hcaldqm::Container2D _cOccupancyCut_FEDVME; + hcaldqm::Container2D _cOccupancyCut_FEDuTCA; + hcaldqm::Container2D _cOccupancyCut_ElectronicsVME; + hcaldqm::Container2D _cOccupancyCut_ElectronicsuTCA; + hcaldqm::Container2D _cOccupancyCut_depth; + hcaldqm::Container1D _cOccupancyCutvsiphi_SubdetPM; // online only + hcaldqm::Container1D _cOccupancyCutvsieta_Subdet; // online only + //hcaldqm::Container2D _cOccupancyCutvsSlotvsLS_HFPM; // online only + hcaldqm::Container2D _cOccupancyCutvsiphivsLS_SubdetPM; // online only + + // Occupancy w/o and w/ a Cut vs BX and vs LS + hcaldqm::ContainerProf1D _cOccupancyvsLS_Subdet; + hcaldqm::ContainerProf1D _cOccupancyCutvsLS_Subdet; // online only + hcaldqm::ContainerProf1D _cOccupancyCutvsBX_Subdet; // online only + + // #Time Samples for a digi. Used for Summary generation + hcaldqm::Container1D _cDigiSize_Crate; + hcaldqm::Container1D _cDigiSize_FED; + hcaldqm::ContainerProf1D _cDigiSizevsLS_FED; // online only + hcaldqm::ContainerXXX _xDigiSize; // online only + hcaldqm::ContainerXXX _xUniHF, _xUni; // online only + hcaldqm::ContainerXXX _xNChs; // online only + hcaldqm::ContainerXXX _xNChsNominal; // online only + hcaldqm::ContainerXXX _xBadCapid; // online only + + // QIE10 TDC histograms + hcaldqm::Container2D _cLETDCTimevsADC_SubdetPM; + hcaldqm::Container2D _cLETDCvsADC_SubdetPM; + hcaldqm::Container2D _cLETDCvsTS_SubdetPM; + hcaldqm::Container1D _cLETDCTime_SubdetPM; + hcaldqm::ContainerProf2D _cLETDCTime_depth; + + // Bad TDC histograms + hcaldqm::Container1D _cBadTDCValues_SubdetPM; + hcaldqm::Container1D _cBadTDCvsBX_SubdetPM; + hcaldqm::Container1D _cBadTDCvsLS_SubdetPM; + hcaldqm::Container2D _cBadTDCCount_depth; + + hcaldqm::Container1D _cBadTDCValues; + hcaldqm::Container1D _cBadTDCvsBX; + hcaldqm::Container1D _cBadTDCvsLS; + + // (Capid - BX) % 4 + hcaldqm::Container1D _cCapidMinusBXmod4_SubdetPM; + hcaldqm::ContainerSingle2D _cCapidMinusBXmod4_CrateSlotuTCA[4]; // CrateSlot 2D histograms for each (capid-BX)%4 + hcaldqm::ContainerSingle2D _cCapidMinusBXmod4_CrateSlotVME[4]; // CrateSlot 2D histograms for each (capid-BX)%4 + hcaldqm::ContainerSingle2D _cCapid_BadvsFEDvsLS; + hcaldqm::ContainerSingle2D + _cCapid_BadvsFEDvsLSmod60; // Same as _cCapid_BadvsFEDvsLS, but only for last 50 LSes (for sound alarm turning off when problem goes away) + + // #events counters + MonitorElement *meNumEvents1LS; // to transfer the #events to harvesting + MonitorElement *meUnknownIds1LS; + bool _unknownIdsPresent; + + hcaldqm::Container2D _cSummaryvsLS_FED; // online only + hcaldqm::ContainerSingle2D _cSummaryvsLS; // online only + + bool _qie10InConditions; // Flag to protect against QIE10 digis not in conditions in 2016. + + std::map _capidmbx; // Expected (capid - BX) % 4 for each subdet + + // LED monitoring stuff + double _thresh_led; + std::map > _ledCalibrationChannels; + + hcaldqm::Container1D _LED_CUCountvsLS_Subdet; // Misfire count vs LS + hcaldqm::Container1D _LED_CUCountvsLSmod60_Subdet; // Misfire count vs LS + hcaldqm::Container2D _LED_ADCvsBX_Subdet; // Pin diode amplitude vs BX }; #endif diff --git a/DQM/HcalTasks/interface/FCDTask.h b/DQM/HcalTasks/interface/FCDTask.h index e2cac485ada29..96320b38329cc 100644 --- a/DQM/HcalTasks/interface/FCDTask.h +++ b/DQM/HcalTasks/interface/FCDTask.h @@ -10,45 +10,38 @@ #include "DQM/HcalCommon/interface/ElectronicsMap.h" -class FCDTask : public DQMEDAnalyzer -{ - public: - struct FCDChannel { - int crate; - int slot; - int fiber; - int fiberChannel; - }; - - public: - FCDTask(edm::ParameterSet const&); - ~FCDTask() override{} - - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - - protected: - void analyze(edm::Event const&, edm::EventSetup const&) override; - - // tags - edm::InputTag _tagQIE10; - edm::EDGetTokenT _tokQIE10; - - // hcaldqm::Containers - std::map _cADC; - std::map _cADC_vs_TS; - std::map _cTDC; - std::map _cTDCTime; - - std::vector _fcd_eids; - std::vector _channels; - HcalElectronicsMap const* _emap; - hcaldqm::electronicsmap::ElectronicsMap _ehashmap; - - +class FCDTask : public DQMEDAnalyzer { +public: + struct FCDChannel { + int crate; + int slot; + int fiber; + int fiberChannel; + }; + +public: + FCDTask(edm::ParameterSet const&); + ~FCDTask() override {} + + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + +protected: + void analyze(edm::Event const&, edm::EventSetup const&) override; + + // tags + edm::InputTag _tagQIE10; + edm::EDGetTokenT _tokQIE10; + + // hcaldqm::Containers + std::map _cADC; + std::map _cADC_vs_TS; + std::map _cTDC; + std::map _cTDCTime; + + std::vector _fcd_eids; + std::vector _channels; + HcalElectronicsMap const* _emap; + hcaldqm::electronicsmap::ElectronicsMap _ehashmap; }; #endif - - - diff --git a/DQM/HcalTasks/interface/HFRaddamTask.h b/DQM/HcalTasks/interface/HFRaddamTask.h index c0973a88cb1a0..62bc9c8124248 100644 --- a/DQM/HcalTasks/interface/HFRaddamTask.h +++ b/DQM/HcalTasks/interface/HFRaddamTask.h @@ -15,43 +15,33 @@ #include "DQM/HcalCommon/interface/ContainerProf2D.h" #include "DQM/HcalCommon/interface/ContainerSingle1D.h" -class HFRaddamTask : public hcaldqm::DQTask -{ - public: - HFRaddamTask(edm::ParameterSet const&); - ~HFRaddamTask() override - {} +class HFRaddamTask : public hcaldqm::DQTask { +public: + HFRaddamTask(edm::ParameterSet const&); + ~HFRaddamTask() override {} - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; - protected: - // funcs - void _process(edm::Event const&, edm::EventSetup const&) override; - bool _isApplicable(edm::Event const&) override; +protected: + // funcs + void _process(edm::Event const&, edm::EventSetup const&) override; + bool _isApplicable(edm::Event const&) override; - // Tags and Tokens - edm::InputTag _tagHF; - edm::InputTag _taguMN; - edm::EDGetTokenT _tokHF; - edm::EDGetTokenT _tokuMN; + // Tags and Tokens + edm::InputTag _tagHF; + edm::InputTag _taguMN; + edm::EDGetTokenT _tokHF; + edm::EDGetTokenT _tokuMN; - // vector of Detector Ids for RadDam - std::vector _vDetIds; + // vector of Detector Ids for RadDam + std::vector _vDetIds; - // Cuts + // Cuts - // Compact + // Compact - // 1D - std::vector _vcShape; + // 1D + std::vector _vcShape; }; #endif - - - - - - - diff --git a/DQM/HcalTasks/interface/HcalOfflineHarvesting.h b/DQM/HcalTasks/interface/HcalOfflineHarvesting.h index bb60fd92e55c7..36c8cfb86ebdb 100644 --- a/DQM/HcalTasks/interface/HcalOfflineHarvesting.h +++ b/DQM/HcalTasks/interface/HcalOfflineHarvesting.h @@ -36,42 +36,33 @@ #include "DQM/HcalTasks/interface/RecoRunSummary.h" #include "DQM/HcalTasks/interface/TPRunSummary.h" -class HcalOfflineHarvesting : public hcaldqm::DQHarvester -{ - public: - HcalOfflineHarvesting(edm::ParameterSet const&); - ~HcalOfflineHarvesting() override{} +class HcalOfflineHarvesting : public hcaldqm::DQHarvester { +public: + HcalOfflineHarvesting(edm::ParameterSet const &); + ~HcalOfflineHarvesting() override {} - void beginRun(edm::Run const&, - edm::EventSetup const&) override; + void beginRun(edm::Run const &, edm::EventSetup const &) override; - protected: - void _dqmEndLuminosityBlock(DQMStore::IBooker&, - DQMStore::IGetter&, edm::LuminosityBlock const&, - edm::EventSetup const&) override; - void _dqmEndJob(DQMStore::IBooker&, - DQMStore::IGetter&) override; +protected: + void _dqmEndLuminosityBlock(DQMStore::IBooker &, + DQMStore::IGetter &, + edm::LuminosityBlock const &, + edm::EventSetup const &) override; + void _dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override; - enum Summary - { - fRaw=0, - fDigi=1, - fReco=2, - fTP=3, - nSummary=4 - }; + enum Summary { fRaw = 0, fDigi = 1, fReco = 2, fTP = 3, nSummary = 4 }; - std::vector _summaryList; + std::vector _summaryList; - // vector of Summary Generators and marks of being present - // by default all false - std::map _sumgen; - std::map _summarks; - std::map _sumnames; - - // reportSummaryMap - MonitorElement *_reportSummaryMap; - MonitorElement *me; + // vector of Summary Generators and marks of being present + // by default all false + std::map _sumgen; + std::map _summarks; + std::map _sumnames; + + // reportSummaryMap + MonitorElement *_reportSummaryMap; + MonitorElement *me; }; #endif diff --git a/DQM/HcalTasks/interface/HcalOnlineHarvesting.h b/DQM/HcalTasks/interface/HcalOnlineHarvesting.h index 6690d3b965e9d..6cd5c445d7707 100644 --- a/DQM/HcalTasks/interface/HcalOnlineHarvesting.h +++ b/DQM/HcalTasks/interface/HcalOnlineHarvesting.h @@ -44,55 +44,45 @@ #include "DQM/HcalTasks/interface/TPRunSummary.h" #include "DQM/HcalTasks/interface/PedestalRunSummary.h" -class HcalOnlineHarvesting : public hcaldqm::DQHarvester -{ - public: - HcalOnlineHarvesting(edm::ParameterSet const&); - ~HcalOnlineHarvesting() override{} - void beginRun(edm::Run const&, edm::EventSetup const&) override; +class HcalOnlineHarvesting : public hcaldqm::DQHarvester { +public: + HcalOnlineHarvesting(edm::ParameterSet const &); + ~HcalOnlineHarvesting() override {} + void beginRun(edm::Run const &, edm::EventSetup const &) override; - protected: - void _dqmEndLuminosityBlock(DQMStore::IBooker&, - DQMStore::IGetter&, edm::LuminosityBlock const&, - edm::EventSetup const&) override; - void _dqmEndJob(DQMStore::IBooker&, - DQMStore::IGetter&) override; +protected: + void _dqmEndLuminosityBlock(DQMStore::IBooker &, + DQMStore::IGetter &, + edm::LuminosityBlock const &, + edm::EventSetup const &) override; + void _dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override; - enum Summary - { - fRaw=0, - fDigi=1, - fReco=2, - fTP=3, - fPedestal=4, - nSummary=5 - }; + enum Summary { fRaw = 0, fDigi = 1, fReco = 2, fTP = 3, fPedestal = 4, nSummary = 5 }; - // flags to harvest... - std::vector _vmarks; - std::vector _vsumgen; - std::vector _vnames; + // flags to harvest... + std::vector _vmarks; + std::vector _vsumgen; + std::vector _vnames; - // thresholds - double _thresh_bad_bad; + // thresholds + double _thresh_bad_bad; - // counters - int _nBad; - int _nTotal; + // counters + int _nBad; + int _nTotal; - // summaries - std::vector _vcSummaryvsLS; + // summaries + std::vector _vcSummaryvsLS; - hcaldqm::Container2D _cKnownBadChannels_depth; + hcaldqm::Container2D _cKnownBadChannels_depth; - // reportSummaryMap - MonitorElement *_reportSummaryMap; - MonitorElement *_runSummary; - - // Efficiencies - hcaldqm::ContainerSingle2D _cTDCCutEfficiency_depth; - hcaldqm::ContainerSingle1D _cTDCCutEfficiency_ieta; + // reportSummaryMap + MonitorElement *_reportSummaryMap; + MonitorElement *_runSummary; + // Efficiencies + hcaldqm::ContainerSingle2D _cTDCCutEfficiency_depth; + hcaldqm::ContainerSingle1D _cTDCCutEfficiency_ieta; }; #endif diff --git a/DQM/HcalTasks/interface/LEDTask.h b/DQM/HcalTasks/interface/LEDTask.h index cbbfc59dbbc6d..fc7ca13dd303a 100644 --- a/DQM/HcalTasks/interface/LEDTask.h +++ b/DQM/HcalTasks/interface/LEDTask.h @@ -19,111 +19,99 @@ #include "DQM/HcalCommon/interface/ContainerProf2D.h" #include "FWCore/Framework/interface/Run.h" -class LEDTask : public hcaldqm::DQTask -{ - public: - LEDTask(edm::ParameterSet const&); - ~LEDTask() override - {} - - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - void endRun(edm::Run const& r, edm::EventSetup const&) override - { - if (_ptype==hcaldqm::fLocal) - if (r.runAuxiliary().run()==1) - return; - this->_dump(); - } - - protected: - // funcs - void _process(edm::Event const&, edm::EventSetup const&) override; - void _resetMonitors(hcaldqm::UpdateFreq) override; - bool _isApplicable(edm::Event const&) override; - virtual void _dump(); - - // tags and tokens - edm::InputTag _tagHBHE; - edm::InputTag _tagHE; - edm::InputTag _tagHO; - edm::InputTag _tagHF; - edm::InputTag _tagTrigger; - edm::InputTag _taguMN; - edm::EDGetTokenT _tokHBHE; - edm::EDGetTokenT _tokHE; - edm::EDGetTokenT _tokHO; - edm::EDGetTokenT _tokHF; - edm::EDGetTokenT _tokTrigger; - edm::EDGetTokenT _tokuMN; - - // emap - hcaldqm::electronicsmap::ElectronicsMap _ehashmap; - hcaldqm::filter::HashFilter _filter_uTCA; - hcaldqm::filter::HashFilter _filter_VME; - - // Cuts - int _nevents; - double _lowHBHE; - double _lowHE; - double _lowHO; - double _lowHF; - - // Compact - hcaldqm::ContainerXXX _xSignalSum; - hcaldqm::ContainerXXX _xSignalSum2; - hcaldqm::ContainerXXX _xEntries; - hcaldqm::ContainerXXX _xTimingSum; - hcaldqm::ContainerXXX _xTimingSum2; - - // 1D - hcaldqm::Container1D _cSignalMean_Subdet; - hcaldqm::Container1D _cSignalRMS_Subdet; - hcaldqm::Container1D _cTimingMean_Subdet; - hcaldqm::Container1D _cTimingRMS_Subdet; - - // Prof1D - hcaldqm::ContainerProf1D _cShapeCut_FEDSlot; - - // 2D timing/signals - hcaldqm::ContainerProf2D _cSignalMean_depth; - hcaldqm::ContainerProf2D _cSignalRMS_depth; - hcaldqm::ContainerProf2D _cTimingMean_depth; - hcaldqm::ContainerProf2D _cTimingRMS_depth; - - hcaldqm::ContainerProf2D _cSignalMean_FEDVME; - hcaldqm::ContainerProf2D _cSignalMean_FEDuTCA; - hcaldqm::ContainerProf2D _cTimingMean_FEDVME; - hcaldqm::ContainerProf2D _cTimingMean_FEDuTCA; - hcaldqm::ContainerProf2D _cSignalRMS_FEDVME; - hcaldqm::ContainerProf2D _cSignalRMS_FEDuTCA; - hcaldqm::ContainerProf2D _cTimingRMS_FEDVME; - hcaldqm::ContainerProf2D _cTimingRMS_FEDuTCA; - - // Bad Quality and Missing Channels - hcaldqm::Container2D _cMissing_depth; - hcaldqm::Container2D _cMissing_FEDVME; - hcaldqm::Container2D _cMissing_FEDuTCA; - - // For hcalcalib online LED - hcaldqm::Container2D _cADCvsTS_SubdetPM; - hcaldqm::Container1D _cSumQ_SubdetPM; - hcaldqm::Container1D _cTDCTime_SubdetPM; - hcaldqm::ContainerProf2D _cTDCTime_depth; - hcaldqm::ContainerSingle2D _cLowSignal_CrateSlot; - - // For monitoring LED firing: ADC vs BX - std::map > _ledCalibrationChannels; - hcaldqm::Container2D _LED_ADCvsBX_Subdet; // Pin diode amplitude vs BX for online DQM - hcaldqm::Container2D _LED_ADCvsEvn_Subdet; // Pin diode amplitude vs Evn for local DQM - +class LEDTask : public hcaldqm::DQTask { +public: + LEDTask(edm::ParameterSet const&); + ~LEDTask() override {} + + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const& r, edm::EventSetup const&) override { + if (_ptype == hcaldqm::fLocal) + if (r.runAuxiliary().run() == 1) + return; + this->_dump(); + } + +protected: + // funcs + void _process(edm::Event const&, edm::EventSetup const&) override; + void _resetMonitors(hcaldqm::UpdateFreq) override; + bool _isApplicable(edm::Event const&) override; + virtual void _dump(); + + // tags and tokens + edm::InputTag _tagHBHE; + edm::InputTag _tagHE; + edm::InputTag _tagHO; + edm::InputTag _tagHF; + edm::InputTag _tagTrigger; + edm::InputTag _taguMN; + edm::EDGetTokenT _tokHBHE; + edm::EDGetTokenT _tokHE; + edm::EDGetTokenT _tokHO; + edm::EDGetTokenT _tokHF; + edm::EDGetTokenT _tokTrigger; + edm::EDGetTokenT _tokuMN; + + // emap + hcaldqm::electronicsmap::ElectronicsMap _ehashmap; + hcaldqm::filter::HashFilter _filter_uTCA; + hcaldqm::filter::HashFilter _filter_VME; + + // Cuts + int _nevents; + double _lowHBHE; + double _lowHE; + double _lowHO; + double _lowHF; + + // Compact + hcaldqm::ContainerXXX _xSignalSum; + hcaldqm::ContainerXXX _xSignalSum2; + hcaldqm::ContainerXXX _xEntries; + hcaldqm::ContainerXXX _xTimingSum; + hcaldqm::ContainerXXX _xTimingSum2; + + // 1D + hcaldqm::Container1D _cSignalMean_Subdet; + hcaldqm::Container1D _cSignalRMS_Subdet; + hcaldqm::Container1D _cTimingMean_Subdet; + hcaldqm::Container1D _cTimingRMS_Subdet; + + // Prof1D + hcaldqm::ContainerProf1D _cShapeCut_FEDSlot; + + // 2D timing/signals + hcaldqm::ContainerProf2D _cSignalMean_depth; + hcaldqm::ContainerProf2D _cSignalRMS_depth; + hcaldqm::ContainerProf2D _cTimingMean_depth; + hcaldqm::ContainerProf2D _cTimingRMS_depth; + + hcaldqm::ContainerProf2D _cSignalMean_FEDVME; + hcaldqm::ContainerProf2D _cSignalMean_FEDuTCA; + hcaldqm::ContainerProf2D _cTimingMean_FEDVME; + hcaldqm::ContainerProf2D _cTimingMean_FEDuTCA; + hcaldqm::ContainerProf2D _cSignalRMS_FEDVME; + hcaldqm::ContainerProf2D _cSignalRMS_FEDuTCA; + hcaldqm::ContainerProf2D _cTimingRMS_FEDVME; + hcaldqm::ContainerProf2D _cTimingRMS_FEDuTCA; + + // Bad Quality and Missing Channels + hcaldqm::Container2D _cMissing_depth; + hcaldqm::Container2D _cMissing_FEDVME; + hcaldqm::Container2D _cMissing_FEDuTCA; + + // For hcalcalib online LED + hcaldqm::Container2D _cADCvsTS_SubdetPM; + hcaldqm::Container1D _cSumQ_SubdetPM; + hcaldqm::Container1D _cTDCTime_SubdetPM; + hcaldqm::ContainerProf2D _cTDCTime_depth; + hcaldqm::ContainerSingle2D _cLowSignal_CrateSlot; + + // For monitoring LED firing: ADC vs BX + std::map > _ledCalibrationChannels; + hcaldqm::Container2D _LED_ADCvsBX_Subdet; // Pin diode amplitude vs BX for online DQM + hcaldqm::Container2D _LED_ADCvsEvn_Subdet; // Pin diode amplitude vs Evn for local DQM }; #endif - - - - - - - diff --git a/DQM/HcalTasks/interface/LaserTask.h b/DQM/HcalTasks/interface/LaserTask.h index a7ac5f00b1938..298938f6b7113 100644 --- a/DQM/HcalTasks/interface/LaserTask.h +++ b/DQM/HcalTasks/interface/LaserTask.h @@ -21,154 +21,141 @@ #include "DQM/HcalCommon/interface/ContainerProf2D.h" #include "FWCore/Framework/interface/Run.h" -class LaserTask : public hcaldqm::DQTask -{ - public: - LaserTask(edm::ParameterSet const&); - ~LaserTask() override - {} - - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - void endRun(edm::Run const& r, edm::EventSetup const&) override - { - if (_ptype==hcaldqm::fLocal) - { - if (r.runAuxiliary().run()==1) - return; - else - this->_dump(); - } - } - void endLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - - protected: - // funcs - void _process(edm::Event const&, edm::EventSetup const&) override; - void _resetMonitors(hcaldqm::UpdateFreq) override; - bool _isApplicable(edm::Event const&) override; - virtual void _dump(); - void processLaserMon(edm::Handle &col, std::vector &iLaserMonADC); - - - // tags and tokens - edm::InputTag _tagHBHE; - edm::InputTag _tagHE; - edm::InputTag _tagHO; - edm::InputTag _tagHF; - edm::InputTag _taguMN; - edm::EDGetTokenT _tokHBHE; - edm::EDGetTokenT _tokHE; - edm::EDGetTokenT _tokHO; - edm::EDGetTokenT _tokHF; - edm::EDGetTokenT _tokuMN; - - enum LaserFlag - { - fBadTiming = 0, - fMissingLaserMon = 1, - nLaserFlag = 2 - }; - std::vector _vflags; - - // emap - hcaldqm::electronicsmap::ElectronicsMap _ehashmap; - hcaldqm::filter::HashFilter _filter_uTCA; - hcaldqm::filter::HashFilter _filter_VME; - std::vector _vhashFEDs; - - // Cuts and variables - int _nevents; - double _lowHBHE; - double _lowHE; - double _lowHO; - double _lowHF; - uint32_t _laserType; - - // Compact - hcaldqm::ContainerXXX _xSignalSum; - hcaldqm::ContainerXXX _xSignalSum2; - hcaldqm::ContainerXXX _xEntries; - hcaldqm::ContainerXXX _xTimingSum; - hcaldqm::ContainerXXX _xTimingSum2; - hcaldqm::ContainerXXX _xTimingRefLMSum; // For computation of channel-by-channel mean timing w.r.t. lasermon - hcaldqm::ContainerXXX _xTimingRefLMSum2; - hcaldqm::ContainerXXX _xNBadTimingRefLM; // Count channels with bad timing - hcaldqm::ContainerXXX _xNChs; // number of channels per FED as in emap - - - // 1D - hcaldqm::Container1D _cSignalMean_Subdet; - hcaldqm::Container1D _cSignalRMS_Subdet; - hcaldqm::Container1D _cSignalMeanQIE1011_Subdet; - hcaldqm::Container1D _cSignalRMSQIE1011_Subdet; - hcaldqm::Container1D _cTimingMean_Subdet; - hcaldqm::Container1D _cTimingRMS_Subdet; - - hcaldqm::Container1D _cADC_SubdetPM; - - // Prof1D - hcaldqm::ContainerProf1D _cShapeCut_FEDSlot; - hcaldqm::ContainerProf1D _cTimingvsEvent_SubdetPM; - hcaldqm::ContainerProf1D _cSignalvsEvent_SubdetPM; - hcaldqm::ContainerProf1D _cTimingvsLS_SubdetPM; - hcaldqm::ContainerProf1D _cSignalvsLS_SubdetPM; - hcaldqm::ContainerProf1D _cSignalvsLSQIE1011_SubdetPM; - hcaldqm::ContainerProf1D _cTimingvsBX_SubdetPM; - hcaldqm::ContainerProf1D _cSignalvsBX_SubdetPM; - hcaldqm::ContainerProf1D _cSignalvsBXQIE1011_SubdetPM; - - // 2D timing/signals - hcaldqm::ContainerProf2D _cSignalMean_depth; - hcaldqm::ContainerProf2D _cSignalRMS_depth; - hcaldqm::ContainerProf2D _cSignalMeanQIE1011_depth; - hcaldqm::ContainerProf2D _cSignalRMSQIE1011_depth; - hcaldqm::ContainerProf2D _cTimingMean_depth; - hcaldqm::ContainerProf2D _cTimingRMS_depth; - - hcaldqm::ContainerProf2D _cSignalMean_FEDVME; - hcaldqm::ContainerProf2D _cSignalMean_FEDuTCA; - hcaldqm::ContainerProf2D _cTimingMean_FEDVME; - hcaldqm::ContainerProf2D _cTimingMean_FEDuTCA; - hcaldqm::ContainerProf2D _cSignalRMS_FEDVME; - hcaldqm::ContainerProf2D _cSignalRMS_FEDuTCA; - hcaldqm::ContainerProf2D _cTimingRMS_FEDVME; - hcaldqm::ContainerProf2D _cTimingRMS_FEDuTCA; - - // Bad Quality and Missing Channels - hcaldqm::Container2D _cMissing_depth; - hcaldqm::Container2D _cMissing_FEDVME; - hcaldqm::Container2D _cMissing_FEDuTCA; - - // Things for LASERMON - edm::InputTag _tagLaserMon; - edm::EDGetTokenT _tokLaserMon; - - std::vector _vLaserMonIPhi; // Laser mon digis are assigned to CBox=5, IEta=0, IPhi=[23-index] by the emap - int _laserMonIEta; - int _laserMonCBox; - int _laserMonDigiOverlap; - int _laserMonTS0; - double _laserMonThreshold; - std::map> _thresh_timingreflm; // Min and max timing (ref. lasermon) - double _thresh_frac_timingreflm; // Flag threshold (BAD) on fraction of channels with bad timing - double _thresh_min_lmsumq; // Threshold on minimum SumQ from lasermon, if laser is expected - int _xMissingLaserMon; // Counter for missing lasermon events - - hcaldqm::ContainerSingle1D _cLaserMonSumQ; - hcaldqm::ContainerSingle1D _cLaserMonTiming; - hcaldqm::ContainerSingleProf1D _cLaserMonSumQ_LS; // Online - hcaldqm::ContainerSingleProf1D _cLaserMonTiming_LS; // Online - hcaldqm::ContainerSingleProf1D _cLaserMonSumQ_Event; // Local - hcaldqm::ContainerSingleProf1D _cLaserMonTiming_Event; // Local - hcaldqm::Container2D _cTiming_DigivsLaserMon_SubdetPM; - hcaldqm::ContainerProf2D _cTimingDiffLS_SubdetPM; - hcaldqm::ContainerProf2D _cTimingDiffEvent_SubdetPM; - - // Summaries - hcaldqm::Container2D _cSummaryvsLS_FED; - hcaldqm::ContainerSingle2D _cSummaryvsLS; +class LaserTask : public hcaldqm::DQTask { +public: + LaserTask(edm::ParameterSet const &); + ~LaserTask() override {} + + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void endRun(edm::Run const &r, edm::EventSetup const &) override { + if (_ptype == hcaldqm::fLocal) { + if (r.runAuxiliary().run() == 1) + return; + else + this->_dump(); + } + } + void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override; + +protected: + // funcs + void _process(edm::Event const &, edm::EventSetup const &) override; + void _resetMonitors(hcaldqm::UpdateFreq) override; + bool _isApplicable(edm::Event const &) override; + virtual void _dump(); + void processLaserMon(edm::Handle &col, std::vector &iLaserMonADC); + + // tags and tokens + edm::InputTag _tagHBHE; + edm::InputTag _tagHE; + edm::InputTag _tagHO; + edm::InputTag _tagHF; + edm::InputTag _taguMN; + edm::EDGetTokenT _tokHBHE; + edm::EDGetTokenT _tokHE; + edm::EDGetTokenT _tokHO; + edm::EDGetTokenT _tokHF; + edm::EDGetTokenT _tokuMN; + + enum LaserFlag { fBadTiming = 0, fMissingLaserMon = 1, nLaserFlag = 2 }; + std::vector _vflags; + + // emap + hcaldqm::electronicsmap::ElectronicsMap _ehashmap; + hcaldqm::filter::HashFilter _filter_uTCA; + hcaldqm::filter::HashFilter _filter_VME; + std::vector _vhashFEDs; + + // Cuts and variables + int _nevents; + double _lowHBHE; + double _lowHE; + double _lowHO; + double _lowHF; + uint32_t _laserType; + + // Compact + hcaldqm::ContainerXXX _xSignalSum; + hcaldqm::ContainerXXX _xSignalSum2; + hcaldqm::ContainerXXX _xEntries; + hcaldqm::ContainerXXX _xTimingSum; + hcaldqm::ContainerXXX _xTimingSum2; + hcaldqm::ContainerXXX _xTimingRefLMSum; // For computation of channel-by-channel mean timing w.r.t. lasermon + hcaldqm::ContainerXXX _xTimingRefLMSum2; + hcaldqm::ContainerXXX _xNBadTimingRefLM; // Count channels with bad timing + hcaldqm::ContainerXXX _xNChs; // number of channels per FED as in emap + + // 1D + hcaldqm::Container1D _cSignalMean_Subdet; + hcaldqm::Container1D _cSignalRMS_Subdet; + hcaldqm::Container1D _cSignalMeanQIE1011_Subdet; + hcaldqm::Container1D _cSignalRMSQIE1011_Subdet; + hcaldqm::Container1D _cTimingMean_Subdet; + hcaldqm::Container1D _cTimingRMS_Subdet; + + hcaldqm::Container1D _cADC_SubdetPM; + + // Prof1D + hcaldqm::ContainerProf1D _cShapeCut_FEDSlot; + hcaldqm::ContainerProf1D _cTimingvsEvent_SubdetPM; + hcaldqm::ContainerProf1D _cSignalvsEvent_SubdetPM; + hcaldqm::ContainerProf1D _cTimingvsLS_SubdetPM; + hcaldqm::ContainerProf1D _cSignalvsLS_SubdetPM; + hcaldqm::ContainerProf1D _cSignalvsLSQIE1011_SubdetPM; + hcaldqm::ContainerProf1D _cTimingvsBX_SubdetPM; + hcaldqm::ContainerProf1D _cSignalvsBX_SubdetPM; + hcaldqm::ContainerProf1D _cSignalvsBXQIE1011_SubdetPM; + + // 2D timing/signals + hcaldqm::ContainerProf2D _cSignalMean_depth; + hcaldqm::ContainerProf2D _cSignalRMS_depth; + hcaldqm::ContainerProf2D _cSignalMeanQIE1011_depth; + hcaldqm::ContainerProf2D _cSignalRMSQIE1011_depth; + hcaldqm::ContainerProf2D _cTimingMean_depth; + hcaldqm::ContainerProf2D _cTimingRMS_depth; + + hcaldqm::ContainerProf2D _cSignalMean_FEDVME; + hcaldqm::ContainerProf2D _cSignalMean_FEDuTCA; + hcaldqm::ContainerProf2D _cTimingMean_FEDVME; + hcaldqm::ContainerProf2D _cTimingMean_FEDuTCA; + hcaldqm::ContainerProf2D _cSignalRMS_FEDVME; + hcaldqm::ContainerProf2D _cSignalRMS_FEDuTCA; + hcaldqm::ContainerProf2D _cTimingRMS_FEDVME; + hcaldqm::ContainerProf2D _cTimingRMS_FEDuTCA; + + // Bad Quality and Missing Channels + hcaldqm::Container2D _cMissing_depth; + hcaldqm::Container2D _cMissing_FEDVME; + hcaldqm::Container2D _cMissing_FEDuTCA; + + // Things for LASERMON + edm::InputTag _tagLaserMon; + edm::EDGetTokenT _tokLaserMon; + + std::vector _vLaserMonIPhi; // Laser mon digis are assigned to CBox=5, IEta=0, IPhi=[23-index] by the emap + int _laserMonIEta; + int _laserMonCBox; + int _laserMonDigiOverlap; + int _laserMonTS0; + double _laserMonThreshold; + std::map> _thresh_timingreflm; // Min and max timing (ref. lasermon) + double _thresh_frac_timingreflm; // Flag threshold (BAD) on fraction of channels with bad timing + double _thresh_min_lmsumq; // Threshold on minimum SumQ from lasermon, if laser is expected + int _xMissingLaserMon; // Counter for missing lasermon events + + hcaldqm::ContainerSingle1D _cLaserMonSumQ; + hcaldqm::ContainerSingle1D _cLaserMonTiming; + hcaldqm::ContainerSingleProf1D _cLaserMonSumQ_LS; // Online + hcaldqm::ContainerSingleProf1D _cLaserMonTiming_LS; // Online + hcaldqm::ContainerSingleProf1D _cLaserMonSumQ_Event; // Local + hcaldqm::ContainerSingleProf1D _cLaserMonTiming_Event; // Local + hcaldqm::Container2D _cTiming_DigivsLaserMon_SubdetPM; + hcaldqm::ContainerProf2D _cTimingDiffLS_SubdetPM; + hcaldqm::ContainerProf2D _cTimingDiffEvent_SubdetPM; + + // Summaries + hcaldqm::Container2D _cSummaryvsLS_FED; + hcaldqm::ContainerSingle2D _cSummaryvsLS; }; #endif diff --git a/DQM/HcalTasks/interface/NoCQTask.h b/DQM/HcalTasks/interface/NoCQTask.h index b27f55d7df1f5..4a80a53de1b10 100644 --- a/DQM/HcalTasks/interface/NoCQTask.h +++ b/DQM/HcalTasks/interface/NoCQTask.h @@ -6,7 +6,7 @@ #include "DQM/HcalCommon/interface/HashFilter.h" #include "DQM/HcalCommon/interface/ElectronicsMap.h" #include "DQM/HcalCommon/interface/Container1D.h" - #include "DQM/HcalCommon/interface/Container2D.h" +#include "DQM/HcalCommon/interface/Container2D.h" #include "DQM/HcalCommon/interface/ContainerProf1D.h" #include "DQM/HcalCommon/interface/ContainerProf2D.h" #include "DQM/HcalCommon/interface/ContainerSingle1D.h" @@ -14,40 +14,36 @@ #include "DQM/HcalCommon/interface/ContainerSingleProf2D.h" #include "DQM/HcalCommon/interface/ContainerXXX.h" -class NoCQTask : public hcaldqm::DQTask -{ - public: - NoCQTask(edm::ParameterSet const&); - ~NoCQTask() override {} - - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - void beginLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - void endLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - - protected: - void _process(edm::Event const&, edm::EventSetup const&) override; - void _resetMonitors(hcaldqm::UpdateFreq) override; - - edm::InputTag _tagHBHE; - edm::InputTag _tagHO; - edm::InputTag _tagHF; - edm::InputTag _tagReport; - edm::EDGetTokenT _tokHBHE; - edm::EDGetTokenT _tokHO; - edm::EDGetTokenT _tokHF; - edm::EDGetTokenT _tokReport; - - double _cutSumQ_HBHE, _cutSumQ_HO, _cutSumQ_HF; - - hcaldqm::electronicsmap::ElectronicsMap _ehashmap; - - hcaldqm::ContainerProf2D _cTimingCut_depth; - hcaldqm::Container2D _cOccupancy_depth; - hcaldqm::Container2D _cOccupancyCut_depth; - hcaldqm::Container2D _cBadQuality_depth; +class NoCQTask : public hcaldqm::DQTask { +public: + NoCQTask(edm::ParameterSet const&); + ~NoCQTask() override {} + + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + +protected: + void _process(edm::Event const&, edm::EventSetup const&) override; + void _resetMonitors(hcaldqm::UpdateFreq) override; + + edm::InputTag _tagHBHE; + edm::InputTag _tagHO; + edm::InputTag _tagHF; + edm::InputTag _tagReport; + edm::EDGetTokenT _tokHBHE; + edm::EDGetTokenT _tokHO; + edm::EDGetTokenT _tokHF; + edm::EDGetTokenT _tokReport; + + double _cutSumQ_HBHE, _cutSumQ_HO, _cutSumQ_HF; + + hcaldqm::electronicsmap::ElectronicsMap _ehashmap; + + hcaldqm::ContainerProf2D _cTimingCut_depth; + hcaldqm::Container2D _cOccupancy_depth; + hcaldqm::Container2D _cOccupancyCut_depth; + hcaldqm::Container2D _cBadQuality_depth; }; #endif diff --git a/DQM/HcalTasks/interface/PedestalRunSummary.h b/DQM/HcalTasks/interface/PedestalRunSummary.h index 6b68711a1fa53..cb1dae1a2a2cc 100644 --- a/DQM/HcalTasks/interface/PedestalRunSummary.h +++ b/DQM/HcalTasks/interface/PedestalRunSummary.h @@ -4,24 +4,21 @@ #include "DQM/HcalCommon/interface/DQClient.h" #include "DQM/HcalCommon/interface/ElectronicsMap.h" -namespace hcaldqm -{ - class PedestalRunSummary : public DQClient - { - public: - PedestalRunSummary(std::string const&, std::string const&, - edm::ParameterSet const&); - ~PedestalRunSummary() override {} +namespace hcaldqm { + class PedestalRunSummary : public DQClient { + public: + PedestalRunSummary(std::string const&, std::string const&, edm::ParameterSet const&); + ~PedestalRunSummary() override {} - void beginRun(edm::Run const&, edm::EventSetup const&) override; - void endLuminosityBlock(DQMStore::IBooker&, - DQMStore::IGetter&, edm::LuminosityBlock const&, - edm::EventSetup const&) override; - std::vector endJob( - DQMStore::IBooker&, DQMStore::IGetter&) override; + void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endLuminosityBlock(DQMStore::IBooker&, + DQMStore::IGetter&, + edm::LuminosityBlock const&, + edm::EventSetup const&) override; + std::vector endJob(DQMStore::IBooker&, DQMStore::IGetter&) override; - protected: - }; -} + protected: + }; +} // namespace hcaldqm #endif diff --git a/DQM/HcalTasks/interface/PedestalTask.h b/DQM/HcalTasks/interface/PedestalTask.h index 51adbd0df7d3c..47da4a2d43cef 100644 --- a/DQM/HcalTasks/interface/PedestalTask.h +++ b/DQM/HcalTasks/interface/PedestalTask.h @@ -18,163 +18,145 @@ #include "DQM/HcalCommon/interface/HashFilter.h" #include "DQM/HcalCommon/interface/ElectronicsMap.h" -class PedestalTask : public hcaldqm::DQTask -{ - public: - PedestalTask(edm::ParameterSet const&); - ~PedestalTask() override - {} - - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - void beginLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - void endLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - void endRun(edm::Run const&, edm::EventSetup const&) override; - - protected: - // funcs - void _process(edm::Event const&, edm::EventSetup const&) override; - void _resetMonitors(hcaldqm::UpdateFreq) override; - bool _isApplicable(edm::Event const&) override; - virtual void _dump(); - - // tags and tokens - edm::InputTag _tagHBHE; - edm::InputTag _tagHE; - edm::InputTag _tagHO; - edm::InputTag _tagHF; - edm::InputTag _tagTrigger; - edm::InputTag _taguMN; - edm::EDGetTokenT _tokuMN; - edm::EDGetTokenT _tokHBHE; - edm::EDGetTokenT _tokHEP17; - edm::EDGetTokenT _tokHO; - edm::EDGetTokenT _tokHF; - edm::EDGetTokenT _tokTrigger; - - std::vector _vflags; - enum PedestalFlag - { - fMsn = 0, - fBadM = 1, - fBadR = 2, - nPedestalFlag=3 - }; - - // emap - hcaldqm::electronicsmap::ElectronicsMap _ehashmap; - hcaldqm::filter::HashFilter _filter_uTCA; - hcaldqm::filter::HashFilter _filter_VME; - hcaldqm::filter::HashFilter _filter_C38; - - // thresholds - double _thresh_mean, _thresh_rms, _thresh_badm, _thresh_badr; - double _thresh_missing_high, _thresh_missing_low; - - // hashed ids of FEDs - std::vector _vhashFEDs; - - // need containers total over the run and per 1LS - hcaldqm::ContainerXXX _xPedSum1LS; - hcaldqm::ContainerXXX _xPedSum21LS; - hcaldqm::ContainerXXX _xPedEntries1LS; - hcaldqm::ContainerXXX _xPedSumTotal; - hcaldqm::ContainerXXX _xPedSum2Total; - hcaldqm::ContainerXXX _xPedEntriesTotal; - hcaldqm::ContainerXXX _xNChs; // number of channels per FED as in emap - hcaldqm::ContainerXXX _xNMsn1LS; // #missing for 1LS per FED - hcaldqm::ContainerXXX _xNBadMean1LS,_xNBadRMS1LS; - - // CondBD Reference - hcaldqm::ContainerXXX _xPedRefMean; - hcaldqm::ContainerXXX _xPedRefRMS; - - // 1D actual Means/RMSs - hcaldqm::Container1D _cMeanTotal_Subdet; - hcaldqm::Container1D _cRMSTotal_Subdet; - hcaldqm::Container1D _cMean1LS_Subdet; // 1LS - hcaldqm::Container1D _cRMS1LS_Subdet; // 1LS - - // 2D actual values - hcaldqm::ContainerProf2D _cMean1LS_depth; // 1LS - hcaldqm::ContainerProf2D _cRMS1LS_depth; // 1lS - hcaldqm::ContainerProf2D _cMean1LS_FEDVME; // 1ls - hcaldqm::ContainerProf2D _cMean1LS_FEDuTCA; // 1ls - hcaldqm::ContainerProf2D _cRMS1LS_FEDVME; // 1ls - hcaldqm::ContainerProf2D _cRMS1LS_FEDuTCA; // 1ls - - hcaldqm::ContainerProf2D _cMeanTotal_depth; - hcaldqm::ContainerProf2D _cRMSTotal_depth; - hcaldqm::ContainerProf2D _cMeanTotal_FEDVME; - hcaldqm::ContainerProf2D _cMeanTotal_FEDuTCA; - hcaldqm::ContainerProf2D _cRMSTotal_FEDVME; - hcaldqm::ContainerProf2D _cRMSTotal_FEDuTCA; - - // Comparison with DB Conditions - hcaldqm::Container1D _cMeanDBRef1LS_Subdet; // 1LS - hcaldqm::Container1D _cRMSDBRef1LS_Subdet; // 1LS - hcaldqm::Container1D _cMeanDBRefTotal_Subdet; - hcaldqm::Container1D _cRMSDBRefTotal_Subdet; - hcaldqm::ContainerProf2D _cMeanDBRef1LS_depth; - hcaldqm::ContainerProf2D _cRMSDBRef1LS_depth; - hcaldqm::ContainerProf2D _cMeanDBRef1LS_FEDVME; - hcaldqm::ContainerProf2D _cMeanDBRef1LS_FEDuTCA; - hcaldqm::ContainerProf2D _cRMSDBRef1LS_FEDVME; - hcaldqm::ContainerProf2D _cRMSDBRef1LS_FEDuTCA; - - hcaldqm::ContainerProf2D _cMeanDBRefTotal_depth; - hcaldqm::ContainerProf2D _cRMSDBRefTotal_depth; - hcaldqm::ContainerProf2D _cMeanDBRefTotal_FEDVME; - hcaldqm::ContainerProf2D _cMeanDBRefTotal_FEDuTCA; - hcaldqm::ContainerProf2D _cRMSDBRefTotal_FEDVME; - hcaldqm::ContainerProf2D _cRMSDBRefTotal_FEDuTCA; - - // vs LS - hcaldqm::Container1D _cMissingvsLS_Subdet; - hcaldqm::Container1D _cOccupancyvsLS_Subdet; - hcaldqm::Container1D _cNBadMeanvsLS_Subdet; - hcaldqm::Container1D _cNBadRMSvsLS_Subdet; - - // averaging per event - hcaldqm::ContainerProf1D _cOccupancyEAvsLS_Subdet; - - // map of missing channels - hcaldqm::Container2D _cMissing1LS_depth; - hcaldqm::Container2D _cMissing1LS_FEDVME; - hcaldqm::Container2D _cMissing1LS_FEDuTCA; - hcaldqm::Container2D _cMissingTotal_depth; - hcaldqm::Container2D _cMissingTotal_FEDVME; - hcaldqm::Container2D _cMissingTotal_FEDuTCA; - - // Mean/RMS Bad Maps - hcaldqm::Container2D _cMeanBad1LS_depth; - hcaldqm::Container2D _cRMSBad1LS_depth; - hcaldqm::Container2D _cMeanBad1LS_FEDVME; - hcaldqm::Container2D _cRMSBad1LS_FEDuTCA; - hcaldqm::Container2D _cRMSBad1LS_FEDVME; - hcaldqm::Container2D _cMeanBad1LS_FEDuTCA; - - hcaldqm::Container2D _cMeanBadTotal_depth; - hcaldqm::Container2D _cRMSBadTotal_depth; - hcaldqm::Container2D _cMeanBadTotal_FEDVME; - hcaldqm::Container2D _cRMSBadTotal_FEDuTCA; - hcaldqm::Container2D _cRMSBadTotal_FEDVME; - hcaldqm::Container2D _cMeanBadTotal_FEDuTCA; - - hcaldqm::Container1D _cADC_SubdetPM; - - // Summaries - hcaldqm::Container2D _cSummaryvsLS_FED; - hcaldqm::ContainerSingle2D _cSummaryvsLS; +class PedestalTask : public hcaldqm::DQTask { +public: + PedestalTask(edm::ParameterSet const&); + ~PedestalTask() override {} + + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + void endRun(edm::Run const&, edm::EventSetup const&) override; + +protected: + // funcs + void _process(edm::Event const&, edm::EventSetup const&) override; + void _resetMonitors(hcaldqm::UpdateFreq) override; + bool _isApplicable(edm::Event const&) override; + virtual void _dump(); + + // tags and tokens + edm::InputTag _tagHBHE; + edm::InputTag _tagHE; + edm::InputTag _tagHO; + edm::InputTag _tagHF; + edm::InputTag _tagTrigger; + edm::InputTag _taguMN; + edm::EDGetTokenT _tokuMN; + edm::EDGetTokenT _tokHBHE; + edm::EDGetTokenT _tokHEP17; + edm::EDGetTokenT _tokHO; + edm::EDGetTokenT _tokHF; + edm::EDGetTokenT _tokTrigger; + + std::vector _vflags; + enum PedestalFlag { fMsn = 0, fBadM = 1, fBadR = 2, nPedestalFlag = 3 }; + + // emap + hcaldqm::electronicsmap::ElectronicsMap _ehashmap; + hcaldqm::filter::HashFilter _filter_uTCA; + hcaldqm::filter::HashFilter _filter_VME; + hcaldqm::filter::HashFilter _filter_C38; + + // thresholds + double _thresh_mean, _thresh_rms, _thresh_badm, _thresh_badr; + double _thresh_missing_high, _thresh_missing_low; + + // hashed ids of FEDs + std::vector _vhashFEDs; + + // need containers total over the run and per 1LS + hcaldqm::ContainerXXX _xPedSum1LS; + hcaldqm::ContainerXXX _xPedSum21LS; + hcaldqm::ContainerXXX _xPedEntries1LS; + hcaldqm::ContainerXXX _xPedSumTotal; + hcaldqm::ContainerXXX _xPedSum2Total; + hcaldqm::ContainerXXX _xPedEntriesTotal; + hcaldqm::ContainerXXX _xNChs; // number of channels per FED as in emap + hcaldqm::ContainerXXX _xNMsn1LS; // #missing for 1LS per FED + hcaldqm::ContainerXXX _xNBadMean1LS, _xNBadRMS1LS; + + // CondBD Reference + hcaldqm::ContainerXXX _xPedRefMean; + hcaldqm::ContainerXXX _xPedRefRMS; + + // 1D actual Means/RMSs + hcaldqm::Container1D _cMeanTotal_Subdet; + hcaldqm::Container1D _cRMSTotal_Subdet; + hcaldqm::Container1D _cMean1LS_Subdet; // 1LS + hcaldqm::Container1D _cRMS1LS_Subdet; // 1LS + + // 2D actual values + hcaldqm::ContainerProf2D _cMean1LS_depth; // 1LS + hcaldqm::ContainerProf2D _cRMS1LS_depth; // 1lS + hcaldqm::ContainerProf2D _cMean1LS_FEDVME; // 1ls + hcaldqm::ContainerProf2D _cMean1LS_FEDuTCA; // 1ls + hcaldqm::ContainerProf2D _cRMS1LS_FEDVME; // 1ls + hcaldqm::ContainerProf2D _cRMS1LS_FEDuTCA; // 1ls + + hcaldqm::ContainerProf2D _cMeanTotal_depth; + hcaldqm::ContainerProf2D _cRMSTotal_depth; + hcaldqm::ContainerProf2D _cMeanTotal_FEDVME; + hcaldqm::ContainerProf2D _cMeanTotal_FEDuTCA; + hcaldqm::ContainerProf2D _cRMSTotal_FEDVME; + hcaldqm::ContainerProf2D _cRMSTotal_FEDuTCA; + + // Comparison with DB Conditions + hcaldqm::Container1D _cMeanDBRef1LS_Subdet; // 1LS + hcaldqm::Container1D _cRMSDBRef1LS_Subdet; // 1LS + hcaldqm::Container1D _cMeanDBRefTotal_Subdet; + hcaldqm::Container1D _cRMSDBRefTotal_Subdet; + hcaldqm::ContainerProf2D _cMeanDBRef1LS_depth; + hcaldqm::ContainerProf2D _cRMSDBRef1LS_depth; + hcaldqm::ContainerProf2D _cMeanDBRef1LS_FEDVME; + hcaldqm::ContainerProf2D _cMeanDBRef1LS_FEDuTCA; + hcaldqm::ContainerProf2D _cRMSDBRef1LS_FEDVME; + hcaldqm::ContainerProf2D _cRMSDBRef1LS_FEDuTCA; + + hcaldqm::ContainerProf2D _cMeanDBRefTotal_depth; + hcaldqm::ContainerProf2D _cRMSDBRefTotal_depth; + hcaldqm::ContainerProf2D _cMeanDBRefTotal_FEDVME; + hcaldqm::ContainerProf2D _cMeanDBRefTotal_FEDuTCA; + hcaldqm::ContainerProf2D _cRMSDBRefTotal_FEDVME; + hcaldqm::ContainerProf2D _cRMSDBRefTotal_FEDuTCA; + + // vs LS + hcaldqm::Container1D _cMissingvsLS_Subdet; + hcaldqm::Container1D _cOccupancyvsLS_Subdet; + hcaldqm::Container1D _cNBadMeanvsLS_Subdet; + hcaldqm::Container1D _cNBadRMSvsLS_Subdet; + + // averaging per event + hcaldqm::ContainerProf1D _cOccupancyEAvsLS_Subdet; + + // map of missing channels + hcaldqm::Container2D _cMissing1LS_depth; + hcaldqm::Container2D _cMissing1LS_FEDVME; + hcaldqm::Container2D _cMissing1LS_FEDuTCA; + hcaldqm::Container2D _cMissingTotal_depth; + hcaldqm::Container2D _cMissingTotal_FEDVME; + hcaldqm::Container2D _cMissingTotal_FEDuTCA; + + // Mean/RMS Bad Maps + hcaldqm::Container2D _cMeanBad1LS_depth; + hcaldqm::Container2D _cRMSBad1LS_depth; + hcaldqm::Container2D _cMeanBad1LS_FEDVME; + hcaldqm::Container2D _cRMSBad1LS_FEDuTCA; + hcaldqm::Container2D _cRMSBad1LS_FEDVME; + hcaldqm::Container2D _cMeanBad1LS_FEDuTCA; + + hcaldqm::Container2D _cMeanBadTotal_depth; + hcaldqm::Container2D _cRMSBadTotal_depth; + hcaldqm::Container2D _cMeanBadTotal_FEDVME; + hcaldqm::Container2D _cRMSBadTotal_FEDuTCA; + hcaldqm::Container2D _cRMSBadTotal_FEDVME; + hcaldqm::Container2D _cMeanBadTotal_FEDuTCA; + + hcaldqm::Container1D _cADC_SubdetPM; + + // Summaries + hcaldqm::Container2D _cSummaryvsLS_FED; + hcaldqm::ContainerSingle2D _cSummaryvsLS; }; #endif - - - - - - - diff --git a/DQM/HcalTasks/interface/QIE10Task.h b/DQM/HcalTasks/interface/QIE10Task.h index 17e4a3e506d6e..0d43b8128719e 100644 --- a/DQM/HcalTasks/interface/QIE10Task.h +++ b/DQM/HcalTasks/interface/QIE10Task.h @@ -19,62 +19,55 @@ #include "DQM/HcalCommon/interface/HashFilter.h" #include "DQM/HcalCommon/interface/ElectronicsMap.h" -class QIE10Task : public hcaldqm::DQTask -{ - public: - QIE10Task(edm::ParameterSet const&); - ~QIE10Task() override{} - - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - void endLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - - protected: - void _process(edm::Event const&, edm::EventSetup const&) override; - void _resetMonitors(hcaldqm::UpdateFreq) override; - - // tags - edm::InputTag _tagQIE10; - edm::InputTag _tagHF; - edm::EDGetTokenT _tokQIE10; - edm::EDGetTokenT _tokHF; - - // cuts/constants from input - double _cut; - int _ped; - - // filters - hcaldqm::filter::HashFilter _filter_slot[36]; - - - // Electronics Maps/Hashes - hcaldqm::electronicsmap::ElectronicsMap _ehashmap; - - // hcaldqm::Containers - hcaldqm::ContainerProf1D _cShapeCut_EChannel[36]; - hcaldqm::Container2D _cLETDCvsADC_EChannel[10][36]; - hcaldqm::Container2D _cLETDCvsTS_EChannel[36]; - hcaldqm::Container1D _cLETDC_EChannel[10][36]; - hcaldqm::Container1D _cADC_EChannel[10][36]; - hcaldqm::Container1D _cLETDCTime_EChannel[36]; - - // hcaldqm::Containers overall - hcaldqm::ContainerSingleProf1D _cShapeCut; - hcaldqm::ContainerSingle2D _cLETDCTimevsADC; - hcaldqm::ContainerSingle2D _cLETDCvsADC; - hcaldqm::ContainerSingle1D _cLETDC; - hcaldqm::ContainerSingle1D _cADC; - - //occupancy per crate/slot - hcaldqm::Container2D _cOccupancy_Crate; - hcaldqm::Container2D _cOccupancy_CrateSlot; - - // Detector coordinates - hcaldqm::Container2D _cOccupancy_depth; +class QIE10Task : public hcaldqm::DQTask { +public: + QIE10Task(edm::ParameterSet const&); + ~QIE10Task() override {} + + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + +protected: + void _process(edm::Event const&, edm::EventSetup const&) override; + void _resetMonitors(hcaldqm::UpdateFreq) override; + + // tags + edm::InputTag _tagQIE10; + edm::InputTag _tagHF; + edm::EDGetTokenT _tokQIE10; + edm::EDGetTokenT _tokHF; + + // cuts/constants from input + double _cut; + int _ped; + + // filters + hcaldqm::filter::HashFilter _filter_slot[36]; + + // Electronics Maps/Hashes + hcaldqm::electronicsmap::ElectronicsMap _ehashmap; + + // hcaldqm::Containers + hcaldqm::ContainerProf1D _cShapeCut_EChannel[36]; + hcaldqm::Container2D _cLETDCvsADC_EChannel[10][36]; + hcaldqm::Container2D _cLETDCvsTS_EChannel[36]; + hcaldqm::Container1D _cLETDC_EChannel[10][36]; + hcaldqm::Container1D _cADC_EChannel[10][36]; + hcaldqm::Container1D _cLETDCTime_EChannel[36]; + + // hcaldqm::Containers overall + hcaldqm::ContainerSingleProf1D _cShapeCut; + hcaldqm::ContainerSingle2D _cLETDCTimevsADC; + hcaldqm::ContainerSingle2D _cLETDCvsADC; + hcaldqm::ContainerSingle1D _cLETDC; + hcaldqm::ContainerSingle1D _cADC; + + //occupancy per crate/slot + hcaldqm::Container2D _cOccupancy_Crate; + hcaldqm::Container2D _cOccupancy_CrateSlot; + + // Detector coordinates + hcaldqm::Container2D _cOccupancy_depth; }; #endif - - - diff --git a/DQM/HcalTasks/interface/QIE11Task.h b/DQM/HcalTasks/interface/QIE11Task.h index 0fefb7f4d4461..0aa1ac4844e02 100644 --- a/DQM/HcalTasks/interface/QIE11Task.h +++ b/DQM/HcalTasks/interface/QIE11Task.h @@ -19,66 +19,55 @@ #include "DQM/HcalCommon/interface/HashFilter.h" #include "DQM/HcalCommon/interface/ElectronicsMap.h" -class QIE11Task : public hcaldqm::DQTask -{ - public: - QIE11Task(edm::ParameterSet const&); - ~QIE11Task() override{} - - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - void endLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - - protected: - void _process(edm::Event const&, edm::EventSetup const&) override; - void _resetMonitors(hcaldqm::UpdateFreq) override; - bool _isApplicable(edm::Event const&) override; - - - // tags - edm::InputTag _tagQIE11; - edm::EDGetTokenT _tokQIE11; - - edm::InputTag _taguMN; - edm::EDGetTokenT _tokuMN; - - - - // cuts/constants from input - double _cut; - int _ped; - int _laserType; - int _eventType; - - - // filters - hcaldqm::filter::HashFilter _filter_C34; - hcaldqm::filter::HashFilter _filter_slot[2]; - hcaldqm::filter::HashFilter _filter_timingChannels[4]; - - // Electronics Maps/Hashes - hcaldqm::electronicsmap::ElectronicsMap _ehashmap; - - // hcaldqm::Containers - hcaldqm::ContainerProf1D _cShapeCut_EChannel[2]; - hcaldqm::Container2D _cLETDCvsADC_EChannel[10][2]; - hcaldqm::Container2D _cLETDCvsTS_EChannel[2]; - hcaldqm::Container1D _cLETDC_EChannel[10][2]; - hcaldqm::Container1D _cLETDCTime_EChannel[2]; - hcaldqm::Container1D _cADC_EChannel[10][2]; - hcaldqm::Container2D _cOccupancy_depth; - - // hcaldqm::Containers overall - hcaldqm::ContainerSingleProf1D _cShapeCut; - hcaldqm::ContainerSingle2D _cLETDCvsADC; - hcaldqm::ContainerSingle2D _cLETDCTimevsADC; - hcaldqm::ContainerSingle1D _cLETDC; - hcaldqm::ContainerSingle1D _cADC; - +class QIE11Task : public hcaldqm::DQTask { +public: + QIE11Task(edm::ParameterSet const&); + ~QIE11Task() override {} + + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + +protected: + void _process(edm::Event const&, edm::EventSetup const&) override; + void _resetMonitors(hcaldqm::UpdateFreq) override; + bool _isApplicable(edm::Event const&) override; + + // tags + edm::InputTag _tagQIE11; + edm::EDGetTokenT _tokQIE11; + + edm::InputTag _taguMN; + edm::EDGetTokenT _tokuMN; + + // cuts/constants from input + double _cut; + int _ped; + int _laserType; + int _eventType; + + // filters + hcaldqm::filter::HashFilter _filter_C34; + hcaldqm::filter::HashFilter _filter_slot[2]; + hcaldqm::filter::HashFilter _filter_timingChannels[4]; + + // Electronics Maps/Hashes + hcaldqm::electronicsmap::ElectronicsMap _ehashmap; + + // hcaldqm::Containers + hcaldqm::ContainerProf1D _cShapeCut_EChannel[2]; + hcaldqm::Container2D _cLETDCvsADC_EChannel[10][2]; + hcaldqm::Container2D _cLETDCvsTS_EChannel[2]; + hcaldqm::Container1D _cLETDC_EChannel[10][2]; + hcaldqm::Container1D _cLETDCTime_EChannel[2]; + hcaldqm::Container1D _cADC_EChannel[10][2]; + hcaldqm::Container2D _cOccupancy_depth; + + // hcaldqm::Containers overall + hcaldqm::ContainerSingleProf1D _cShapeCut; + hcaldqm::ContainerSingle2D _cLETDCvsADC; + hcaldqm::ContainerSingle2D _cLETDCTimevsADC; + hcaldqm::ContainerSingle1D _cLETDC; + hcaldqm::ContainerSingle1D _cADC; }; #endif - - - diff --git a/DQM/HcalTasks/interface/RawRunSummary.h b/DQM/HcalTasks/interface/RawRunSummary.h index 70f8d0d78e822..77767630f0c02 100644 --- a/DQM/HcalTasks/interface/RawRunSummary.h +++ b/DQM/HcalTasks/interface/RawRunSummary.h @@ -4,51 +4,42 @@ #include "DQM/HcalCommon/interface/DQClient.h" #include "DQM/HcalCommon/interface/ElectronicsMap.h" -namespace hcaldqm -{ - class RawRunSummary : public DQClient - { - public: - RawRunSummary(std::string const&, std::string const&, - edm::ParameterSet const&); - ~RawRunSummary() override {} - - void beginRun(edm::Run const&, edm::EventSetup const&) override; - void endLuminosityBlock(DQMStore::IBooker&, - DQMStore::IGetter&, edm::LuminosityBlock const&, - edm::EventSetup const&) override; - std::vector endJob( - DQMStore::IBooker&, DQMStore::IGetter&) override; - - protected: - // Flag Summary for each LS and Run as a whole - std::vector _vflagsLS; - - electronicsmap::ElectronicsMap _ehashmap; - - // some useful vectors - not to reintialize all the time - std::vector _vhashVME, _vhashuTCA; - std::vector _vFEDsVME, _vFEDsuTCA; - filter::HashFilter _filter_VME, _filter_uTCA; - - // Containers to store info for the whole run - Container2D _cEvnMsm_ElectronicsVME, _cEvnMsm_ElectronicsuTCA; - Container2D _cBcnMsm_ElectronicsVME, _cBcnMsm_ElectronicsuTCA; - Container2D _cBadQuality_depth; - - bool _booked; - - // - ContainerXXX _xEvn, _xBcn, _xBadQ; - - enum RawLSFlag - { - fEvnMsm=0, - fBcnMsm=1, - fBadQ=2, - nRawFlag=3 - }; - }; -} +namespace hcaldqm { + class RawRunSummary : public DQClient { + public: + RawRunSummary(std::string const&, std::string const&, edm::ParameterSet const&); + ~RawRunSummary() override {} + + void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endLuminosityBlock(DQMStore::IBooker&, + DQMStore::IGetter&, + edm::LuminosityBlock const&, + edm::EventSetup const&) override; + std::vector endJob(DQMStore::IBooker&, DQMStore::IGetter&) override; + + protected: + // Flag Summary for each LS and Run as a whole + std::vector _vflagsLS; + + electronicsmap::ElectronicsMap _ehashmap; + + // some useful vectors - not to reintialize all the time + std::vector _vhashVME, _vhashuTCA; + std::vector _vFEDsVME, _vFEDsuTCA; + filter::HashFilter _filter_VME, _filter_uTCA; + + // Containers to store info for the whole run + Container2D _cEvnMsm_ElectronicsVME, _cEvnMsm_ElectronicsuTCA; + Container2D _cBcnMsm_ElectronicsVME, _cBcnMsm_ElectronicsuTCA; + Container2D _cBadQuality_depth; + + bool _booked; + + // + ContainerXXX _xEvn, _xBcn, _xBadQ; + + enum RawLSFlag { fEvnMsm = 0, fBcnMsm = 1, fBadQ = 2, nRawFlag = 3 }; + }; +} // namespace hcaldqm #endif diff --git a/DQM/HcalTasks/interface/RawTask.h b/DQM/HcalTasks/interface/RawTask.h index 9590ba1c50eb9..dc1a33c6beb06 100644 --- a/DQM/HcalTasks/interface/RawTask.h +++ b/DQM/HcalTasks/interface/RawTask.h @@ -21,75 +21,64 @@ #include "DQM/HcalCommon/interface/ElectronicsMap.h" #include "DQM/HcalCommon/interface/Flag.h" -class RawTask : public hcaldqm::DQTask -{ - public: - RawTask(edm::ParameterSet const&); - ~RawTask() override {} +class RawTask : public hcaldqm::DQTask { +public: + RawTask(edm::ParameterSet const&); + ~RawTask() override {} - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - void beginLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - void endLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; - protected: - void _process(edm::Event const&, edm::EventSetup const&) override; - void _resetMonitors(hcaldqm::UpdateFreq) override; +protected: + void _process(edm::Event const&, edm::EventSetup const&) override; + void _resetMonitors(hcaldqm::UpdateFreq) override; - edm::InputTag _tagFEDs; - edm::InputTag _tagReport; - edm::EDGetTokenT _tokFEDs; - edm::EDGetTokenT _tokReport; + edm::InputTag _tagFEDs; + edm::InputTag _tagReport; + edm::EDGetTokenT _tokFEDs; + edm::EDGetTokenT _tokReport; - // flag vector - std::vector _vflags; - enum RawFlag - { - fEvnMsm = 0, - fBcnMsm = 1, - fOrnMsm = 2, - fBadQ = 3, - nRawFlag = 4 - }; + // flag vector + std::vector _vflags; + enum RawFlag { fEvnMsm = 0, fBcnMsm = 1, fOrnMsm = 2, fBadQ = 3, nRawFlag = 4 }; - // emap - hcaldqm::electronicsmap::ElectronicsMap _ehashmap; + // emap + hcaldqm::electronicsmap::ElectronicsMap _ehashmap; - // physics vs calib processing switch - bool _calibProcessing; - int _thresh_calib_nbadq; + // physics vs calib processing switch + bool _calibProcessing; + int _thresh_calib_nbadq; - // vector of HcalElectronicsId for FEDs - std::vector _vhashFEDs; + // vector of HcalElectronicsId for FEDs + std::vector _vhashFEDs; - // Filters - hcaldqm::filter::HashFilter _filter_VME; - hcaldqm::filter::HashFilter _filter_uTCA; - hcaldqm::filter::HashFilter _filter_FEDsVME; - hcaldqm::filter::HashFilter _filter_FEDsuTCA; + // Filters + hcaldqm::filter::HashFilter _filter_VME; + hcaldqm::filter::HashFilter _filter_uTCA; + hcaldqm::filter::HashFilter _filter_FEDsVME; + hcaldqm::filter::HashFilter _filter_FEDsuTCA; - // Bad Quality - hcaldqm::Container2D _cBadQuality_FEDVME; - hcaldqm::Container2D _cBadQuality_FEDuTCA; - hcaldqm::Container2D _cBadQuality_depth; - hcaldqm::Container2D _cBadQualityLS_depth; // online only - hcaldqm::ContainerSingleProf1D _cBadQualityvsLS; - hcaldqm::ContainerSingleProf1D _cBadQualityvsBX; - hcaldqm::ContainerProf1D _cDataSizevsLS_FED; // online only + // Bad Quality + hcaldqm::Container2D _cBadQuality_FEDVME; + hcaldqm::Container2D _cBadQuality_FEDuTCA; + hcaldqm::Container2D _cBadQuality_depth; + hcaldqm::Container2D _cBadQualityLS_depth; // online only + hcaldqm::ContainerSingleProf1D _cBadQualityvsLS; + hcaldqm::ContainerSingleProf1D _cBadQualityvsBX; + hcaldqm::ContainerProf1D _cDataSizevsLS_FED; // online only - // Mismatches - hcaldqm::Container2D _cEvnMsm_ElectronicsVME; - hcaldqm::Container2D _cBcnMsm_ElectronicsVME; - hcaldqm::Container2D _cOrnMsm_ElectronicsVME; - hcaldqm::Container2D _cEvnMsm_ElectronicsuTCA; - hcaldqm::Container2D _cBcnMsm_ElectronicsuTCA; - hcaldqm::Container2D _cOrnMsm_ElectronicsuTCA; - hcaldqm::ContainerXXX _xEvnMsmLS, _xBcnMsmLS, _xOrnMsmLS, _xBadQLS; - - hcaldqm::Container2D _cSummaryvsLS_FED; // online only - hcaldqm::ContainerSingle2D _cSummaryvsLS; // online only + // Mismatches + hcaldqm::Container2D _cEvnMsm_ElectronicsVME; + hcaldqm::Container2D _cBcnMsm_ElectronicsVME; + hcaldqm::Container2D _cOrnMsm_ElectronicsVME; + hcaldqm::Container2D _cEvnMsm_ElectronicsuTCA; + hcaldqm::Container2D _cBcnMsm_ElectronicsuTCA; + hcaldqm::Container2D _cOrnMsm_ElectronicsuTCA; + hcaldqm::ContainerXXX _xEvnMsmLS, _xBcnMsmLS, _xOrnMsmLS, _xBadQLS; + + hcaldqm::Container2D _cSummaryvsLS_FED; // online only + hcaldqm::ContainerSingle2D _cSummaryvsLS; // online only }; #endif diff --git a/DQM/HcalTasks/interface/RecHitTask.h b/DQM/HcalTasks/interface/RecHitTask.h index e642b329028fc..9d34fd1836b3d 100644 --- a/DQM/HcalTasks/interface/RecHitTask.h +++ b/DQM/HcalTasks/interface/RecHitTask.h @@ -23,119 +23,109 @@ #include "DQM/HcalCommon/interface/ContainerSingleProf2D.h" #include "DQM/HcalCommon/interface/ElectronicsMap.h" -class RecHitTask : public hcaldqm::DQTask -{ - public: - RecHitTask(edm::ParameterSet const&); - ~RecHitTask() override {} - - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - void beginLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - void endLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - - protected: - void _process(edm::Event const&, edm::EventSetup const&) override; - void _resetMonitors(hcaldqm::UpdateFreq) override; - - edm::InputTag _tagHBHE; - edm::InputTag _tagHO; - edm::InputTag _tagHF; - edm::InputTag _tagPreHF; - bool _hfPreRecHitsAvailable; - edm::EDGetTokenT _tokHBHE; - edm::EDGetTokenT _tokHO; - edm::EDGetTokenT _tokHF; - edm::EDGetTokenT _tokPreHF; - - double _cutE_HBHE, _cutE_HO, _cutE_HF; - double _thresh_unihf; - - // hashes/FED vectors - std::vector _vhashFEDs; - - // flag vectors - std::vector _vflags; - enum RecoFlag - { - fUni=0, - fTCDS=1, - fUnknownIds = 2, - nRecoFlag=3 - }; - - // emap - hcaldqm::electronicsmap::ElectronicsMap _ehashmap; - - // Filters - hcaldqm::filter::HashFilter _filter_VME; - hcaldqm::filter::HashFilter _filter_uTCA; - hcaldqm::filter::HashFilter _filter_FEDsVME; - hcaldqm::filter::HashFilter _filter_FEDsuTCA; - hcaldqm::filter::HashFilter _filter_HF; - - // Energy. Just filling. No Summary Generation - hcaldqm::Container1D _cEnergy_Subdet; - hcaldqm::ContainerProf1D _cEnergyvsieta_Subdet; // online only! - hcaldqm::ContainerProf1D _cEnergyvsiphi_SubdetPM; // online only! - hcaldqm::ContainerProf2D _cEnergy_depth; - hcaldqm::ContainerProf1D _cEnergyvsLS_SubdetPM; // online only! - hcaldqm::ContainerProf1D _cEnergyvsBX_SubdetPM; // online only - - // Timing vs Energy. No Summary Generation - hcaldqm::Container2D _cTimingvsEnergy_SubdetPM; - - // Timing. HBHE Partition is used for TCDS shift monitoring - hcaldqm::Container1D _cTimingCut_SubdetPM; - hcaldqm::Container1D _cTimingCut_HBHEPartition; - hcaldqm::ContainerProf2D _cTimingCut_FEDVME; - hcaldqm::ContainerProf2D _cTimingCut_FEDuTCA; - hcaldqm::ContainerProf2D _cTimingCut_ElectronicsVME; - hcaldqm::ContainerProf2D _cTimingCut_ElectronicsuTCA; - hcaldqm::ContainerProf2D _cTimingCut_depth; - hcaldqm::ContainerProf1D _cTimingCutvsLS_FED; - hcaldqm::ContainerProf1D _cTimingCutvsLS_SubdetPM; - hcaldqm::ContainerProf1D _cTimingCutvsieta_Subdet; // online only - hcaldqm::ContainerProf1D _cTimingCutvsiphi_SubdetPM; // online only - hcaldqm::ContainerProf1D _cTimingCutvsBX_SubdetPM; // online only - - // Occupancy w/o a cut. Used for checking missing channels - hcaldqm::Container2D _cOccupancy_depth; - hcaldqm::Container2D _cOccupancy_FEDVME; - hcaldqm::Container2D _cOccupancy_FEDuTCA; - hcaldqm::Container2D _cOccupancy_ElectronicsVME; - hcaldqm::Container2D _cOccupancy_ElectronicsuTCA; - hcaldqm::ContainerProf1D _cOccupancyvsLS_Subdet; - hcaldqm::Container1D _cOccupancyvsiphi_SubdetPM; // online only - hcaldqm::Container1D _cOccupancyvsieta_Subdet; // online only - - // Occupancy w/ a Cut. - hcaldqm::Container2D _cOccupancyCut_FEDVME; - hcaldqm::Container2D _cOccupancyCut_FEDuTCA; - hcaldqm::Container2D _cOccupancyCut_ElectronicsVME; - hcaldqm::Container2D _cOccupancyCut_ElectronicsuTCA; - hcaldqm::ContainerProf1D _cOccupancyCutvsLS_Subdet; // online only - hcaldqm::Container2D _cOccupancyCut_depth; - hcaldqm::Container1D _cOccupancyCutvsiphi_SubdetPM; // online only - hcaldqm::Container1D _cOccupancyCutvsieta_Subdet; // online only - hcaldqm::ContainerProf1D _cOccupancyCutvsBX_Subdet; // online only! - hcaldqm::Container2D _cOccupancyCutvsiphivsLS_SubdetPM; // online only - hcaldqm::ContainerXXX _xUniHF, _xUni; - - // QIE10 dual anode histograms - hcaldqm::Container2D _cDAAsymmetryVsCharge_SubdetPM; - hcaldqm::ContainerProf2D _cDAAsymmetryMean_cut_depth; - hcaldqm::Container1D _cDAAsymmetry_cut_SubdetPM; - - // tracks the unknown ids - MonitorElement *meUnknownIds1LS; - bool _unknownIdsPresent; - - std::vector _gids; // online only - hcaldqm::Container2D _cSummaryvsLS_FED; // online only! - hcaldqm::ContainerSingle2D _cSummaryvsLS; +class RecHitTask : public hcaldqm::DQTask { +public: + RecHitTask(edm::ParameterSet const &); + ~RecHitTask() override {} + + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override; + void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override; + +protected: + void _process(edm::Event const &, edm::EventSetup const &) override; + void _resetMonitors(hcaldqm::UpdateFreq) override; + + edm::InputTag _tagHBHE; + edm::InputTag _tagHO; + edm::InputTag _tagHF; + edm::InputTag _tagPreHF; + bool _hfPreRecHitsAvailable; + edm::EDGetTokenT _tokHBHE; + edm::EDGetTokenT _tokHO; + edm::EDGetTokenT _tokHF; + edm::EDGetTokenT _tokPreHF; + + double _cutE_HBHE, _cutE_HO, _cutE_HF; + double _thresh_unihf; + + // hashes/FED vectors + std::vector _vhashFEDs; + + // flag vectors + std::vector _vflags; + enum RecoFlag { fUni = 0, fTCDS = 1, fUnknownIds = 2, nRecoFlag = 3 }; + + // emap + hcaldqm::electronicsmap::ElectronicsMap _ehashmap; + + // Filters + hcaldqm::filter::HashFilter _filter_VME; + hcaldqm::filter::HashFilter _filter_uTCA; + hcaldqm::filter::HashFilter _filter_FEDsVME; + hcaldqm::filter::HashFilter _filter_FEDsuTCA; + hcaldqm::filter::HashFilter _filter_HF; + + // Energy. Just filling. No Summary Generation + hcaldqm::Container1D _cEnergy_Subdet; + hcaldqm::ContainerProf1D _cEnergyvsieta_Subdet; // online only! + hcaldqm::ContainerProf1D _cEnergyvsiphi_SubdetPM; // online only! + hcaldqm::ContainerProf2D _cEnergy_depth; + hcaldqm::ContainerProf1D _cEnergyvsLS_SubdetPM; // online only! + hcaldqm::ContainerProf1D _cEnergyvsBX_SubdetPM; // online only + + // Timing vs Energy. No Summary Generation + hcaldqm::Container2D _cTimingvsEnergy_SubdetPM; + + // Timing. HBHE Partition is used for TCDS shift monitoring + hcaldqm::Container1D _cTimingCut_SubdetPM; + hcaldqm::Container1D _cTimingCut_HBHEPartition; + hcaldqm::ContainerProf2D _cTimingCut_FEDVME; + hcaldqm::ContainerProf2D _cTimingCut_FEDuTCA; + hcaldqm::ContainerProf2D _cTimingCut_ElectronicsVME; + hcaldqm::ContainerProf2D _cTimingCut_ElectronicsuTCA; + hcaldqm::ContainerProf2D _cTimingCut_depth; + hcaldqm::ContainerProf1D _cTimingCutvsLS_FED; + hcaldqm::ContainerProf1D _cTimingCutvsLS_SubdetPM; + hcaldqm::ContainerProf1D _cTimingCutvsieta_Subdet; // online only + hcaldqm::ContainerProf1D _cTimingCutvsiphi_SubdetPM; // online only + hcaldqm::ContainerProf1D _cTimingCutvsBX_SubdetPM; // online only + + // Occupancy w/o a cut. Used for checking missing channels + hcaldqm::Container2D _cOccupancy_depth; + hcaldqm::Container2D _cOccupancy_FEDVME; + hcaldqm::Container2D _cOccupancy_FEDuTCA; + hcaldqm::Container2D _cOccupancy_ElectronicsVME; + hcaldqm::Container2D _cOccupancy_ElectronicsuTCA; + hcaldqm::ContainerProf1D _cOccupancyvsLS_Subdet; + hcaldqm::Container1D _cOccupancyvsiphi_SubdetPM; // online only + hcaldqm::Container1D _cOccupancyvsieta_Subdet; // online only + + // Occupancy w/ a Cut. + hcaldqm::Container2D _cOccupancyCut_FEDVME; + hcaldqm::Container2D _cOccupancyCut_FEDuTCA; + hcaldqm::Container2D _cOccupancyCut_ElectronicsVME; + hcaldqm::Container2D _cOccupancyCut_ElectronicsuTCA; + hcaldqm::ContainerProf1D _cOccupancyCutvsLS_Subdet; // online only + hcaldqm::Container2D _cOccupancyCut_depth; + hcaldqm::Container1D _cOccupancyCutvsiphi_SubdetPM; // online only + hcaldqm::Container1D _cOccupancyCutvsieta_Subdet; // online only + hcaldqm::ContainerProf1D _cOccupancyCutvsBX_Subdet; // online only! + hcaldqm::Container2D _cOccupancyCutvsiphivsLS_SubdetPM; // online only + hcaldqm::ContainerXXX _xUniHF, _xUni; + + // QIE10 dual anode histograms + hcaldqm::Container2D _cDAAsymmetryVsCharge_SubdetPM; + hcaldqm::ContainerProf2D _cDAAsymmetryMean_cut_depth; + hcaldqm::Container1D _cDAAsymmetry_cut_SubdetPM; + + // tracks the unknown ids + MonitorElement *meUnknownIds1LS; + bool _unknownIdsPresent; + + std::vector _gids; // online only + hcaldqm::Container2D _cSummaryvsLS_FED; // online only! + hcaldqm::ContainerSingle2D _cSummaryvsLS; }; #endif diff --git a/DQM/HcalTasks/interface/RecoRunSummary.h b/DQM/HcalTasks/interface/RecoRunSummary.h index e58640f491945..e971b85671ed9 100644 --- a/DQM/HcalTasks/interface/RecoRunSummary.h +++ b/DQM/HcalTasks/interface/RecoRunSummary.h @@ -4,32 +4,24 @@ #include "DQM/HcalCommon/interface/DQClient.h" #include "DQM/HcalCommon/interface/ElectronicsMap.h" -namespace hcaldqm -{ - class RecoRunSummary : public DQClient - { - public: - RecoRunSummary(std::string const&, std::string const&, - edm::ParameterSet const&); - ~RecoRunSummary() override {} +namespace hcaldqm { + class RecoRunSummary : public DQClient { + public: + RecoRunSummary(std::string const&, std::string const&, edm::ParameterSet const&); + ~RecoRunSummary() override {} - void beginRun(edm::Run const&, edm::EventSetup const&) override; - void endLuminosityBlock(DQMStore::IBooker&, - DQMStore::IGetter&, edm::LuminosityBlock const&, - edm::EventSetup const&) override; - std::vector endJob( - DQMStore::IBooker&, DQMStore::IGetter&) override; + void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endLuminosityBlock(DQMStore::IBooker&, + DQMStore::IGetter&, + edm::LuminosityBlock const&, + edm::EventSetup const&) override; + std::vector endJob(DQMStore::IBooker&, DQMStore::IGetter&) override; - protected: - double _thresh_unihf, _thresh_tcds; + protected: + double _thresh_unihf, _thresh_tcds; - enum RecoFlag - { - fTCDS = 0, - fUniSlotHF=1, - nRecoFlag=2 - }; - }; -} + enum RecoFlag { fTCDS = 0, fUniSlotHF = 1, nRecoFlag = 2 }; + }; +} // namespace hcaldqm #endif diff --git a/DQM/HcalTasks/interface/TPComparisonTask.h b/DQM/HcalTasks/interface/TPComparisonTask.h index 0482f4cf8e67b..6af957fa14160 100644 --- a/DQM/HcalTasks/interface/TPComparisonTask.h +++ b/DQM/HcalTasks/interface/TPComparisonTask.h @@ -17,69 +17,65 @@ #include "DQM/HcalCommon/interface/HashFilter.h" #include "DQM/HcalCommon/interface/ElectronicsMap.h" -class TPComparisonTask : public hcaldqm::DQTask -{ - public: - TPComparisonTask(edm::ParameterSet const&); - ~TPComparisonTask() override - {} - - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - void endLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - - protected: - // funcs - void _process(edm::Event const&, edm::EventSetup const&) override; - void _resetMonitors(hcaldqm::UpdateFreq) override; - - // Tags and corresponding Tokens - edm::InputTag _tag1; - edm::InputTag _tag2; - edm::EDGetTokenT _tok1; - edm::EDGetTokenT _tok2; - - // tmp flags - bool _skip1x1; - - // emap - hcaldqm::electronicsmap::ElectronicsMap _ehashmapuTCA; - hcaldqm::electronicsmap::ElectronicsMap _ehashmapVME; - - // hahses/FED vectors - std::vector _vhashFEDs; - - // Filters - hcaldqm::filter::HashFilter _filter_VME; - hcaldqm::filter::HashFilter _filter_uTCA; - - /** +class TPComparisonTask : public hcaldqm::DQTask { +public: + TPComparisonTask(edm::ParameterSet const&); + ~TPComparisonTask() override {} + + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; + +protected: + // funcs + void _process(edm::Event const&, edm::EventSetup const&) override; + void _resetMonitors(hcaldqm::UpdateFreq) override; + + // Tags and corresponding Tokens + edm::InputTag _tag1; + edm::InputTag _tag2; + edm::EDGetTokenT _tok1; + edm::EDGetTokenT _tok2; + + // tmp flags + bool _skip1x1; + + // emap + hcaldqm::electronicsmap::ElectronicsMap _ehashmapuTCA; + hcaldqm::electronicsmap::ElectronicsMap _ehashmapVME; + + // hahses/FED vectors + std::vector _vhashFEDs; + + // Filters + hcaldqm::filter::HashFilter _filter_VME; + hcaldqm::filter::HashFilter _filter_uTCA; + + /** * hcaldqm::Containers */ - // Et - hcaldqm::Container2D _cEt_TTSubdet[4]; - hcaldqm::Container2D _cEtall_TTSubdet; + // Et + hcaldqm::Container2D _cEt_TTSubdet[4]; + hcaldqm::Container2D _cEtall_TTSubdet; - // FG - hcaldqm::Container2D _cFG_TTSubdet[4]; + // FG + hcaldqm::Container2D _cFG_TTSubdet[4]; - // Missing - hcaldqm::Container2D _cMsn_FEDVME; - hcaldqm::Container2D _cMsn_FEDuTCA; - hcaldqm::ContainerSingle2D _cMsnVME; - hcaldqm::ContainerSingle2D _cMsnuTCA; + // Missing + hcaldqm::Container2D _cMsn_FEDVME; + hcaldqm::Container2D _cMsn_FEDuTCA; + hcaldqm::ContainerSingle2D _cMsnVME; + hcaldqm::ContainerSingle2D _cMsnuTCA; - // mismatches - hcaldqm::Container2D _cEtMsm_FEDVME; - hcaldqm::Container2D _cEtMsm_FEDuTCA; - hcaldqm::Container2D _cFGMsm_FEDVME; - hcaldqm::Container2D _cFGMsm_FEDuTCA; + // mismatches + hcaldqm::Container2D _cEtMsm_FEDVME; + hcaldqm::Container2D _cEtMsm_FEDuTCA; + hcaldqm::Container2D _cFGMsm_FEDVME; + hcaldqm::Container2D _cFGMsm_FEDuTCA; - // depth like - hcaldqm::ContainerSingle2D _cEtMsm; - hcaldqm::ContainerSingle2D _cFGMsm; + // depth like + hcaldqm::ContainerSingle2D _cEtMsm; + hcaldqm::ContainerSingle2D _cFGMsm; }; #endif diff --git a/DQM/HcalTasks/interface/TPRunSummary.h b/DQM/HcalTasks/interface/TPRunSummary.h index 48eb61f545ff6..1783f05dc303c 100644 --- a/DQM/HcalTasks/interface/TPRunSummary.h +++ b/DQM/HcalTasks/interface/TPRunSummary.h @@ -4,36 +4,28 @@ #include "DQM/HcalCommon/interface/DQClient.h" #include "DQM/HcalCommon/interface/ElectronicsMap.h" -namespace hcaldqm -{ - class TPRunSummary : public DQClient - { - public: - TPRunSummary(std::string const&, std::string const&, - edm::ParameterSet const&); - ~TPRunSummary() override {} +namespace hcaldqm { + class TPRunSummary : public DQClient { + public: + TPRunSummary(std::string const&, std::string const&, edm::ParameterSet const&); + ~TPRunSummary() override {} - void beginRun(edm::Run const&, edm::EventSetup const&) override; - void endLuminosityBlock(DQMStore::IBooker&, - DQMStore::IGetter&, edm::LuminosityBlock const&, - edm::EventSetup const&) override; - std::vector endJob( - DQMStore::IBooker&, DQMStore::IGetter&) override; + void beginRun(edm::Run const&, edm::EventSetup const&) override; + void endLuminosityBlock(DQMStore::IBooker&, + DQMStore::IGetter&, + edm::LuminosityBlock const&, + edm::EventSetup const&) override; + std::vector endJob(DQMStore::IBooker&, DQMStore::IGetter&) override; - protected: - ContainerSingle2D _cEtMsmFraction_depthlike; - ContainerSingle2D _cFGMsmFraction_depthlike; + protected: + ContainerSingle2D _cEtMsmFraction_depthlike; + ContainerSingle2D _cFGMsmFraction_depthlike; - double _thresh_FGMsmRate_high, _thresh_FGMsmRate_low; - double _thresh_EtMsmRate_high, _thresh_EtMsmRate_low; + double _thresh_FGMsmRate_high, _thresh_FGMsmRate_low; + double _thresh_EtMsmRate_high, _thresh_EtMsmRate_low; - enum TPFlag - { - fEtMsm=0, - fFGMsm=1, - nTPFlag=3 - }; - }; -} + enum TPFlag { fEtMsm = 0, fFGMsm = 1, nTPFlag = 3 }; + }; +} // namespace hcaldqm #endif diff --git a/DQM/HcalTasks/interface/TPTask.h b/DQM/HcalTasks/interface/TPTask.h index 33d8e795ebe8a..503a77a9206ff 100644 --- a/DQM/HcalTasks/interface/TPTask.h +++ b/DQM/HcalTasks/interface/TPTask.h @@ -19,173 +19,159 @@ #include "DQM/HcalCommon/interface/ContainerSingleProf2D.h" #include "DQM/HcalCommon/interface/ElectronicsMap.h" -class TPTask : public hcaldqm::DQTask -{ - public: - TPTask(edm::ParameterSet const&); - ~TPTask() override {} - - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - void endLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - void beginLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; - - protected: - void _process(edm::Event const&, edm::EventSetup const&) override; - void _resetMonitors(hcaldqm::UpdateFreq) override; - - edm::InputTag _tagData; - edm::InputTag _tagDataL1Rec; - edm::InputTag _tagEmul; - edm::InputTag _tagEmulNoTDCCut; - edm::EDGetTokenT _tokData; - edm::EDGetTokenT _tokDataL1Rec; - edm::EDGetTokenT _tokEmul; - edm::EDGetTokenT _tokEmulNoTDCCut; - - // flag vector - std::vector _vflags; - enum TPFlag - { - fEtMsm=0, - fDataMsn=1, - fEmulMsn=2, - fUnknownIds=3, - fSentRecL1Msm=4, - nTPFlag=5 - }; - - // switches/cuts/etc... - bool _skip1x1; - int _cutEt; - double _thresh_EtMsmRate_high, _thresh_EtMsmRate_low, - _thresh_FGMsmRate_high, _thresh_FGMsmRate_low, - _thresh_DataMsn, _thresh_EmulMsn; - std::vector _vFGBitsReady; - - // hashes/FEDs vectors - std::vector _vhashFEDs; - - // emap - hcaldqm::electronicsmap::ElectronicsMap _ehashmap; - - // Filters - hcaldqm::filter::HashFilter _filter_VME; - hcaldqm::filter::HashFilter _filter_uTCA; - hcaldqm::filter::HashFilter _filter_depth0; - - // Et/FG - hcaldqm::Container1D _cEtData_TTSubdet; - hcaldqm::Container1D _cEtEmul_TTSubdet; - hcaldqm::Container2D _cEtCorr_TTSubdet; - hcaldqm::Container2D _cEtCorr2x3_TTSubdet; // online only - hcaldqm::Container2D _cFGCorr_TTSubdet[hcaldqm::constants::NUM_FGBITS]; - hcaldqm::ContainerProf1D _cEtCutDatavsLS_TTSubdet; // online only! - hcaldqm::ContainerProf1D _cEtCutEmulvsLS_TTSubdet; // online only! - hcaldqm::ContainerProf1D _cEtCutDatavsBX_TTSubdet; // online only! - hcaldqm::ContainerProf1D _cEtCutEmulvsBX_TTSubdet; // online only! - - hcaldqm::ContainerProf2D _cEtData_ElectronicsVME; - hcaldqm::ContainerProf2D _cEtData_ElectronicsuTCA; - hcaldqm::ContainerProf2D _cEtEmul_ElectronicsVME; - hcaldqm::ContainerProf2D _cEtEmul_ElectronicsuTCA; - - // depth like - hcaldqm::ContainerSingleProf2D _cEtData_depthlike; - hcaldqm::ContainerSingleProf2D _cEtEmul_depthlike; - hcaldqm::ContainerSingleProf2D _cEtCutData_depthlike; - hcaldqm::ContainerSingleProf2D _cEtCutEmul_depthlike; - - // Et Correlation Ratio - hcaldqm::ContainerProf2D _cEtCorrRatio_ElectronicsVME; - hcaldqm::ContainerProf2D _cEtCorrRatio_ElectronicsuTCA; - hcaldqm::ContainerSingleProf2D _cEtCorrRatio_depthlike; - hcaldqm::ContainerProf1D _cEtCorrRatiovsLS_TTSubdet; // online only! - hcaldqm::ContainerProf1D _cEtCorrRatiovsBX_TTSubdet; // online only! - - // Occupancies - hcaldqm::Container2D _cOccupancyData_ElectronicsVME; - hcaldqm::Container2D _cOccupancyData_ElectronicsuTCA; - hcaldqm::Container2D _cOccupancyEmul_ElectronicsVME; - hcaldqm::Container2D _cOccupancyEmul_ElectronicsuTCA; - - hcaldqm::Container2D _cOccupancyCutData_ElectronicsVME; - hcaldqm::Container2D _cOccupancyCutData_ElectronicsuTCA; - hcaldqm::Container2D _cOccupancyCutEmul_ElectronicsVME; - hcaldqm::Container2D _cOccupancyCutEmul_ElectronicsuTCA; - - // depth like - hcaldqm::ContainerSingle2D _cOccupancyData_depthlike; - hcaldqm::ContainerSingle2D _cOccupancyEmul_depthlike; - hcaldqm::ContainerSingle2D _cOccupancyCutData_depthlike; - hcaldqm::ContainerSingle2D _cOccupancyCutEmul_depthlike; - - // 2x3 occupancies just in case - hcaldqm::ContainerSingle2D _cOccupancyData2x3_depthlike; // online only! - hcaldqm::ContainerSingle2D _cOccupancyEmul2x3_depthlike; // online only! - - // Mismatches: Et and FG - hcaldqm::Container2D _cEtMsm_ElectronicsVME; - hcaldqm::Container2D _cEtMsm_ElectronicsuTCA; - hcaldqm::Container2D _cFGMsm_ElectronicsVME; - hcaldqm::Container2D _cFGMsm_ElectronicsuTCA; - hcaldqm::ContainerSingle2D _cEtMsm_depthlike; - hcaldqm::ContainerSingle2D _cFGMsm_depthlike; - hcaldqm::ContainerProf1D _cEtMsmvsLS_TTSubdet; // online only - hcaldqm::ContainerProf1D _cEtMsmRatiovsLS_TTSubdet; // online only - hcaldqm::ContainerProf1D _cEtMsmvsBX_TTSubdet; // online only - hcaldqm::ContainerProf1D _cEtMsmRatiovsBX_TTSubdet; // online only - - // Mismatches: data sent vs received - hcaldqm::ContainerSingle2D _cEtMsm_uHTR_L1T_depthlike; - hcaldqm::ContainerSingle1D _cEtMsm_uHTR_L1T_LS; - - // Missing Data w.r.t. Emulator - hcaldqm::Container2D _cMsnData_ElectronicsVME; - hcaldqm::Container2D _cMsnData_ElectronicsuTCA; - hcaldqm::ContainerSingle2D _cMsnData_depthlike; - hcaldqm::ContainerProf1D _cMsnDatavsLS_TTSubdet; // online only - hcaldqm::ContainerProf1D _cMsnCutDatavsLS_TTSubdet; // online only - hcaldqm::ContainerProf1D _cMsnDatavsBX_TTSubdet; // online only - hcaldqm::ContainerProf1D _cMsnCutDatavsBX_TTSubdet; // online only - - // Missing Emulator w.r.t. Data - hcaldqm::Container2D _cMsnEmul_ElectronicsVME; - hcaldqm::Container2D _cMsnEmul_ElectronicsuTCA; - hcaldqm::ContainerSingle2D _cMsnEmul_depthlike; - hcaldqm::ContainerProf1D _cMsnEmulvsLS_TTSubdet; // online only - hcaldqm::ContainerProf1D _cMsnCutEmulvsLS_TTSubdet; // online only - hcaldqm::ContainerProf1D _cMsnEmulvsBX_TTSubdet; // online only - hcaldqm::ContainerProf1D _cMsnCutEmulvsBX_TTSubdet; // online only - - // Occupancy vs BX and LS - hcaldqm::ContainerProf1D _cOccupancyDatavsBX_TTSubdet; // online only - hcaldqm::ContainerProf1D _cOccupancyEmulvsBX_TTSubdet; // online only - hcaldqm::ContainerProf1D _cOccupancyCutDatavsBX_TTSubdet; // online only - hcaldqm::ContainerProf1D _cOccupancyCutEmulvsBX_TTSubdet; // online only - hcaldqm::ContainerProf1D _cOccupancyDatavsLS_TTSubdet; // online only - hcaldqm::ContainerProf1D _cOccupancyEmulvsLS_TTSubdet; // online only - hcaldqm::ContainerProf1D _cOccupancyCutDatavsLS_TTSubdet; // online only - hcaldqm::ContainerProf1D _cOccupancyCutEmulvsLS_TTSubdet; // online only - - // track unknown ids - MonitorElement *meUnknownIds1LS; - bool _unknownIdsPresent; - - hcaldqm::Container2D _cSummaryvsLS_FED; // online only - hcaldqm::ContainerSingle2D _cSummaryvsLS; // online only - hcaldqm::ContainerXXX _xEtMsm, _xFGMsm, _xNumCorr, - _xDataMsn, _xDataTotal, _xEmulMsn, _xEmulTotal, _xSentRecL1Msm; - - // Temporary storage for occupancy with and without HF TDC cut - hcaldqm::ContainerSingle2D _cOccupancy_HF_depth, _cOccupancyNoTDC_HF_depth; - hcaldqm::ContainerSingle1D _cOccupancy_HF_ieta, _cOccupancyNoTDC_HF_ieta; - - // Container storing matched sent-received TPs - std::vector > _vTPDigis_SentRec; - +class TPTask : public hcaldqm::DQTask { +public: + TPTask(edm::ParameterSet const &); + ~TPTask() override {} + + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override; + void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override; + +protected: + void _process(edm::Event const &, edm::EventSetup const &) override; + void _resetMonitors(hcaldqm::UpdateFreq) override; + + edm::InputTag _tagData; + edm::InputTag _tagDataL1Rec; + edm::InputTag _tagEmul; + edm::InputTag _tagEmulNoTDCCut; + edm::EDGetTokenT _tokData; + edm::EDGetTokenT _tokDataL1Rec; + edm::EDGetTokenT _tokEmul; + edm::EDGetTokenT _tokEmulNoTDCCut; + + // flag vector + std::vector _vflags; + enum TPFlag { fEtMsm = 0, fDataMsn = 1, fEmulMsn = 2, fUnknownIds = 3, fSentRecL1Msm = 4, nTPFlag = 5 }; + + // switches/cuts/etc... + bool _skip1x1; + int _cutEt; + double _thresh_EtMsmRate_high, _thresh_EtMsmRate_low, _thresh_FGMsmRate_high, _thresh_FGMsmRate_low, _thresh_DataMsn, + _thresh_EmulMsn; + std::vector _vFGBitsReady; + + // hashes/FEDs vectors + std::vector _vhashFEDs; + + // emap + hcaldqm::electronicsmap::ElectronicsMap _ehashmap; + + // Filters + hcaldqm::filter::HashFilter _filter_VME; + hcaldqm::filter::HashFilter _filter_uTCA; + hcaldqm::filter::HashFilter _filter_depth0; + + // Et/FG + hcaldqm::Container1D _cEtData_TTSubdet; + hcaldqm::Container1D _cEtEmul_TTSubdet; + hcaldqm::Container2D _cEtCorr_TTSubdet; + hcaldqm::Container2D _cEtCorr2x3_TTSubdet; // online only + hcaldqm::Container2D _cFGCorr_TTSubdet[hcaldqm::constants::NUM_FGBITS]; + hcaldqm::ContainerProf1D _cEtCutDatavsLS_TTSubdet; // online only! + hcaldqm::ContainerProf1D _cEtCutEmulvsLS_TTSubdet; // online only! + hcaldqm::ContainerProf1D _cEtCutDatavsBX_TTSubdet; // online only! + hcaldqm::ContainerProf1D _cEtCutEmulvsBX_TTSubdet; // online only! + + hcaldqm::ContainerProf2D _cEtData_ElectronicsVME; + hcaldqm::ContainerProf2D _cEtData_ElectronicsuTCA; + hcaldqm::ContainerProf2D _cEtEmul_ElectronicsVME; + hcaldqm::ContainerProf2D _cEtEmul_ElectronicsuTCA; + + // depth like + hcaldqm::ContainerSingleProf2D _cEtData_depthlike; + hcaldqm::ContainerSingleProf2D _cEtEmul_depthlike; + hcaldqm::ContainerSingleProf2D _cEtCutData_depthlike; + hcaldqm::ContainerSingleProf2D _cEtCutEmul_depthlike; + + // Et Correlation Ratio + hcaldqm::ContainerProf2D _cEtCorrRatio_ElectronicsVME; + hcaldqm::ContainerProf2D _cEtCorrRatio_ElectronicsuTCA; + hcaldqm::ContainerSingleProf2D _cEtCorrRatio_depthlike; + hcaldqm::ContainerProf1D _cEtCorrRatiovsLS_TTSubdet; // online only! + hcaldqm::ContainerProf1D _cEtCorrRatiovsBX_TTSubdet; // online only! + + // Occupancies + hcaldqm::Container2D _cOccupancyData_ElectronicsVME; + hcaldqm::Container2D _cOccupancyData_ElectronicsuTCA; + hcaldqm::Container2D _cOccupancyEmul_ElectronicsVME; + hcaldqm::Container2D _cOccupancyEmul_ElectronicsuTCA; + + hcaldqm::Container2D _cOccupancyCutData_ElectronicsVME; + hcaldqm::Container2D _cOccupancyCutData_ElectronicsuTCA; + hcaldqm::Container2D _cOccupancyCutEmul_ElectronicsVME; + hcaldqm::Container2D _cOccupancyCutEmul_ElectronicsuTCA; + + // depth like + hcaldqm::ContainerSingle2D _cOccupancyData_depthlike; + hcaldqm::ContainerSingle2D _cOccupancyEmul_depthlike; + hcaldqm::ContainerSingle2D _cOccupancyCutData_depthlike; + hcaldqm::ContainerSingle2D _cOccupancyCutEmul_depthlike; + + // 2x3 occupancies just in case + hcaldqm::ContainerSingle2D _cOccupancyData2x3_depthlike; // online only! + hcaldqm::ContainerSingle2D _cOccupancyEmul2x3_depthlike; // online only! + + // Mismatches: Et and FG + hcaldqm::Container2D _cEtMsm_ElectronicsVME; + hcaldqm::Container2D _cEtMsm_ElectronicsuTCA; + hcaldqm::Container2D _cFGMsm_ElectronicsVME; + hcaldqm::Container2D _cFGMsm_ElectronicsuTCA; + hcaldqm::ContainerSingle2D _cEtMsm_depthlike; + hcaldqm::ContainerSingle2D _cFGMsm_depthlike; + hcaldqm::ContainerProf1D _cEtMsmvsLS_TTSubdet; // online only + hcaldqm::ContainerProf1D _cEtMsmRatiovsLS_TTSubdet; // online only + hcaldqm::ContainerProf1D _cEtMsmvsBX_TTSubdet; // online only + hcaldqm::ContainerProf1D _cEtMsmRatiovsBX_TTSubdet; // online only + + // Mismatches: data sent vs received + hcaldqm::ContainerSingle2D _cEtMsm_uHTR_L1T_depthlike; + hcaldqm::ContainerSingle1D _cEtMsm_uHTR_L1T_LS; + + // Missing Data w.r.t. Emulator + hcaldqm::Container2D _cMsnData_ElectronicsVME; + hcaldqm::Container2D _cMsnData_ElectronicsuTCA; + hcaldqm::ContainerSingle2D _cMsnData_depthlike; + hcaldqm::ContainerProf1D _cMsnDatavsLS_TTSubdet; // online only + hcaldqm::ContainerProf1D _cMsnCutDatavsLS_TTSubdet; // online only + hcaldqm::ContainerProf1D _cMsnDatavsBX_TTSubdet; // online only + hcaldqm::ContainerProf1D _cMsnCutDatavsBX_TTSubdet; // online only + + // Missing Emulator w.r.t. Data + hcaldqm::Container2D _cMsnEmul_ElectronicsVME; + hcaldqm::Container2D _cMsnEmul_ElectronicsuTCA; + hcaldqm::ContainerSingle2D _cMsnEmul_depthlike; + hcaldqm::ContainerProf1D _cMsnEmulvsLS_TTSubdet; // online only + hcaldqm::ContainerProf1D _cMsnCutEmulvsLS_TTSubdet; // online only + hcaldqm::ContainerProf1D _cMsnEmulvsBX_TTSubdet; // online only + hcaldqm::ContainerProf1D _cMsnCutEmulvsBX_TTSubdet; // online only + + // Occupancy vs BX and LS + hcaldqm::ContainerProf1D _cOccupancyDatavsBX_TTSubdet; // online only + hcaldqm::ContainerProf1D _cOccupancyEmulvsBX_TTSubdet; // online only + hcaldqm::ContainerProf1D _cOccupancyCutDatavsBX_TTSubdet; // online only + hcaldqm::ContainerProf1D _cOccupancyCutEmulvsBX_TTSubdet; // online only + hcaldqm::ContainerProf1D _cOccupancyDatavsLS_TTSubdet; // online only + hcaldqm::ContainerProf1D _cOccupancyEmulvsLS_TTSubdet; // online only + hcaldqm::ContainerProf1D _cOccupancyCutDatavsLS_TTSubdet; // online only + hcaldqm::ContainerProf1D _cOccupancyCutEmulvsLS_TTSubdet; // online only + + // track unknown ids + MonitorElement *meUnknownIds1LS; + bool _unknownIdsPresent; + + hcaldqm::Container2D _cSummaryvsLS_FED; // online only + hcaldqm::ContainerSingle2D _cSummaryvsLS; // online only + hcaldqm::ContainerXXX _xEtMsm, _xFGMsm, _xNumCorr, _xDataMsn, _xDataTotal, _xEmulMsn, _xEmulTotal, + _xSentRecL1Msm; + + // Temporary storage for occupancy with and without HF TDC cut + hcaldqm::ContainerSingle2D _cOccupancy_HF_depth, _cOccupancyNoTDC_HF_depth; + hcaldqm::ContainerSingle1D _cOccupancy_HF_ieta, _cOccupancyNoTDC_HF_ieta; + + // Container storing matched sent-received TPs + std::vector > _vTPDigis_SentRec; }; #endif diff --git a/DQM/HcalTasks/interface/UMNioTask.h b/DQM/HcalTasks/interface/UMNioTask.h index 01de2ca83eb92..154d63a2c1045 100644 --- a/DQM/HcalTasks/interface/UMNioTask.h +++ b/DQM/HcalTasks/interface/UMNioTask.h @@ -20,56 +20,50 @@ #include "DQM/HcalCommon/interface/ContainerProf2D.h" #include "FWCore/Framework/interface/Run.h" -class UMNioTask : public hcaldqm::DQTask -{ - public: - UMNioTask(edm::ParameterSet const&); - ~UMNioTask() override - {} +class UMNioTask : public hcaldqm::DQTask { +public: + UMNioTask(edm::ParameterSet const&); + ~UMNioTask() override {} - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; - void endRun(edm::Run const& r, edm::EventSetup const&) override - { - if (_ptype==hcaldqm::fLocal) - { - if (r.runAuxiliary().run()==1) - return; - } - } - void endLuminosityBlock(edm::LuminosityBlock const&, - edm::EventSetup const&) override; + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + void endRun(edm::Run const& r, edm::EventSetup const&) override { + if (_ptype == hcaldqm::fLocal) { + if (r.runAuxiliary().run() == 1) + return; + } + } + void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override; - protected: - // funcs - void _process(edm::Event const&, edm::EventSetup const&) override; +protected: + // funcs + void _process(edm::Event const&, edm::EventSetup const&) override; - // Get index of a particular OrbitGapType in the vector, which is used as the value for filling the histogram - int getOrbitGapIndex(uint8_t eventType, uint32_t laserType); + // Get index of a particular OrbitGapType in the vector, which is used as the value for filling the histogram + int getOrbitGapIndex(uint8_t eventType, uint32_t laserType); - std::vector _eventtypes; + std::vector _eventtypes; - // tags and tokens - edm::InputTag _taguMN; - edm::InputTag _tagHBHE; - edm::InputTag _tagHO; - edm::InputTag _tagHF; - edm::EDGetTokenT _tokHBHE; - edm::EDGetTokenT _tokHO; - edm::EDGetTokenT _tokHF; - edm::EDGetTokenT _tokuMN; + // tags and tokens + edm::InputTag _taguMN; + edm::InputTag _tagHBHE; + edm::InputTag _tagHO; + edm::InputTag _tagHF; + edm::EDGetTokenT _tokHBHE; + edm::EDGetTokenT _tokHO; + edm::EDGetTokenT _tokHF; + edm::EDGetTokenT _tokuMN; - // cuts - double _lowHBHE, _lowHO, _lowHF; + // cuts + double _lowHBHE, _lowHO, _lowHF; - // emap - hcaldqm::electronicsmap::ElectronicsMap _ehashmap; - hcaldqm::filter::HashFilter _filter_uTCA; - hcaldqm::filter::HashFilter _filter_VME; + // emap + hcaldqm::electronicsmap::ElectronicsMap _ehashmap; + hcaldqm::filter::HashFilter _filter_uTCA; + hcaldqm::filter::HashFilter _filter_VME; - // 1D - hcaldqm::ContainerSingle2D _cEventType; - hcaldqm::ContainerSingle2D _cTotalCharge; - hcaldqm::ContainerSingleProf2D _cTotalChargeProfile; + // 1D + hcaldqm::ContainerSingle2D _cEventType; + hcaldqm::ContainerSingle2D _cTotalCharge; + hcaldqm::ContainerSingleProf2D _cTotalChargeProfile; }; #endif diff --git a/DQM/HcalTasks/interface/ZDCQIE10Task.h b/DQM/HcalTasks/interface/ZDCQIE10Task.h index 50f39e909fa85..ef94e36c49cf0 100644 --- a/DQM/HcalTasks/interface/ZDCQIE10Task.h +++ b/DQM/HcalTasks/interface/ZDCQIE10Task.h @@ -10,29 +10,23 @@ #include "DQM/HcalCommon/interface/ElectronicsMap.h" -class ZDCQIE10Task : public DQMEDAnalyzer -{ - public: - ZDCQIE10Task(edm::ParameterSet const&); - ~ZDCQIE10Task() override{} +class ZDCQIE10Task : public DQMEDAnalyzer { +public: + ZDCQIE10Task(edm::ParameterSet const&); + ~ZDCQIE10Task() override {} - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; - protected: - void analyze(edm::Event const&, edm::EventSetup const&) override; +protected: + void analyze(edm::Event const&, edm::EventSetup const&) override; - // tags - edm::InputTag _tagQIE10; - edm::EDGetTokenT _tokQIE10; - - // hcaldqm::Containers - std::map _cADC_EChannel; - std::map _cADC_vs_TS_EChannel; + // tags + edm::InputTag _tagQIE10; + edm::EDGetTokenT _tokQIE10; + // hcaldqm::Containers + std::map _cADC_EChannel; + std::map _cADC_vs_TS_EChannel; }; #endif - - - diff --git a/DQM/HcalTasks/interface/ZDCTask.h b/DQM/HcalTasks/interface/ZDCTask.h index 5fedd1d38ee20..51fe1412de00a 100644 --- a/DQM/HcalTasks/interface/ZDCTask.h +++ b/DQM/HcalTasks/interface/ZDCTask.h @@ -19,40 +19,33 @@ #include "DQM/HcalCommon/interface/HashFilter.h" #include "DQM/HcalCommon/interface/ElectronicsMap.h" -class ZDCTask : public DQMEDAnalyzer -{ - public: - ZDCTask(edm::ParameterSet const&); - ~ZDCTask() override{} +class ZDCTask : public DQMEDAnalyzer { +public: + ZDCTask(edm::ParameterSet const&); + ~ZDCTask() override {} - void bookHistograms(DQMStore::IBooker&, - edm::Run const&, edm::EventSetup const&) override; + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; - protected: - void analyze(edm::Event const&, edm::EventSetup const&) override; +protected: + void analyze(edm::Event const&, edm::EventSetup const&) override; - // tags - edm::InputTag _tagQIE10; - edm::EDGetTokenT _tokQIE10; + // tags + edm::InputTag _tagQIE10; + edm::EDGetTokenT _tokQIE10; - // cuts/constants from input - double _cut; - int _ped; + // cuts/constants from input + double _cut; + int _ped; - - // hcaldqm::Containers - std::map _cShape_EChannel; - std::map _cADC_EChannel; - std::map _cADC_vs_TS_EChannel; + // hcaldqm::Containers + std::map _cShape_EChannel; + std::map _cADC_EChannel; + std::map _cADC_vs_TS_EChannel; - - // hcaldqm::Containers overall - MonitorElement* _cShape; - MonitorElement* _cADC; - MonitorElement* _cADC_vs_TS; + // hcaldqm::Containers overall + MonitorElement* _cShape; + MonitorElement* _cADC; + MonitorElement* _cADC_vs_TS; }; #endif - - - diff --git a/DQM/HcalTasks/plugins/DigiComparisonTask.cc b/DQM/HcalTasks/plugins/DigiComparisonTask.cc index b59dbc7b13541..65dbe37d781b3 100644 --- a/DQM/HcalTasks/plugins/DigiComparisonTask.cc +++ b/DQM/HcalTasks/plugins/DigiComparisonTask.cc @@ -4,228 +4,216 @@ using namespace hcaldqm; using namespace hcaldqm::constants; -DigiComparisonTask::DigiComparisonTask(edm::ParameterSet const& ps): - DQTask(ps) -{ - // tags and tokens - _tagHBHE1 = ps.getUntrackedParameter("tagHBHE1", - edm::InputTag("hcalDigis")); - _tagHBHE2 = ps.getUntrackedParameter("tagHBHE2", - edm::InputTag("vmeDigis")); - _tokHBHE1 = consumes(_tagHBHE1); - _tokHBHE2 = consumes(_tagHBHE2); +DigiComparisonTask::DigiComparisonTask(edm::ParameterSet const& ps) : DQTask(ps) { + // tags and tokens + _tagHBHE1 = ps.getUntrackedParameter("tagHBHE1", edm::InputTag("hcalDigis")); + _tagHBHE2 = ps.getUntrackedParameter("tagHBHE2", edm::InputTag("vmeDigis")); + _tokHBHE1 = consumes(_tagHBHE1); + _tokHBHE2 = consumes(_tagHBHE2); } -/* virtual */ void DigiComparisonTask::bookHistograms(DQMStore::IBooker &ib, - edm::Run const& r, edm::EventSetup const& es) -{ - DQTask::bookHistograms(ib, r, es); +/* virtual */ void DigiComparisonTask::bookHistograms(DQMStore::IBooker& ib, + edm::Run const& r, + edm::EventSetup const& es) { + DQTask::bookHistograms(ib, r, es); - // GET WHAT YOU NEED - edm::ESHandle dbs; - es.get().get(dbs); - edm::ESHandle item; - es.get().get("full", item); - _emap = item.product(); - if (_ptype != fOffline) { // hidefed2crate - std::vector vFEDs = utilities::getFEDList(_emap); - std::vector vFEDsVME = utilities::getFEDVMEList(_emap); - std::vector vFEDsuTCA = utilities::getFEDuTCAList(_emap); - } - std::vector vhashVME; - std::vector vhashuTCA; - vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); - vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_VME.initialize(filter::fFilter, hashfunctions::fElectronics, - vhashVME); - _filter_uTCA.initialize(filter::fFilter, hashfunctions::fElectronics, - vhashuTCA); - - // INITIALIZE - for (unsigned int i=0; i<10; i++) - { - _cADC_Subdet[i].initialize(_name, "ADC", - hashfunctions::fSubdet, - new quantity::ValueQuantity(quantity::fADCCorr_128), - new quantity::ValueQuantity(quantity::fADCCorr_128), - new quantity::ValueQuantity(quantity::fN, true),0); - } - _cADCall_Subdet.initialize(_name, "ADC", - hashfunctions::fSubdet, - new quantity::ValueQuantity(quantity::fADCCorr_128), - new quantity::ValueQuantity(quantity::fADCCorr_128), - new quantity::ValueQuantity(quantity::fN, true),0); - _cADCMsnuTCA_Subdet.initialize(_name, "ADCMsnuTCA", - hashfunctions::fSubdet, - new quantity::ValueQuantity(quantity::fADC_128), - new quantity::ValueQuantity(quantity::fN, true),0); - _cADCMsnVME_Subdet.initialize(_name, "ADCMsnVME", - hashfunctions::fSubdet, - new quantity::ValueQuantity(quantity::fADC_128), - new quantity::ValueQuantity(quantity::fN, true),0); - _cMsm_depth.initialize(_name, "Mismatched", - hashfunctions::fdepth, - new quantity::DetectorQuantity(quantity::fieta), - new quantity::DetectorQuantity(quantity::fiphi), - new quantity::ValueQuantity(quantity::fN),0); - if (_ptype != fOffline) { // hidefed2crate - _cMsm_FEDVME.initialize(_name, "Mismatched", - hashfunctions::fFED, - new quantity::ElectronicsQuantity(quantity::fSpigot), - new quantity::ElectronicsQuantity(quantity::fFiberVMEFiberCh), - new quantity::ValueQuantity(quantity::fN),0); - _cMsm_FEDuTCA.initialize(_name, "Mismatched", - hashfunctions::fFED, - new quantity::ElectronicsQuantity(quantity::fSlotuTCA), - new quantity::ElectronicsQuantity(quantity::fFiberuTCAFiberCh), - new quantity::ValueQuantity(quantity::fN),0); - } - _cMsnVME_depth.initialize(_name, "Missing", - hashfunctions::fdepth, - new quantity::DetectorQuantity(quantity::fieta), - new quantity::DetectorQuantity(quantity::fiphi), - new quantity::ValueQuantity(quantity::fN),0); - _cMsnuTCA_depth.initialize(_name, "Missing", - hashfunctions::fdepth, - new quantity::DetectorQuantity(quantity::fieta), - new quantity::DetectorQuantity(quantity::fiphi), - new quantity::ValueQuantity(quantity::fN),0); - if (_ptype != fOffline) { // hidefed2crate - _cMsn_FEDVME.initialize(_name, "Missing", - hashfunctions::fFED, - new quantity::ElectronicsQuantity(quantity::fSpigot), - new quantity::ElectronicsQuantity(quantity::fFiberVMEFiberCh), - new quantity::ValueQuantity(quantity::fN),0); - _cMsn_FEDuTCA.initialize(_name, "Missing", - hashfunctions::fFED, - new quantity::ElectronicsQuantity(quantity::fSlotuTCA), - new quantity::ElectronicsQuantity(quantity::fFiberuTCAFiberCh), - new quantity::ValueQuantity(quantity::fN),0); - } + // GET WHAT YOU NEED + edm::ESHandle dbs; + es.get().get(dbs); + edm::ESHandle item; + es.get().get("full", item); + _emap = item.product(); + if (_ptype != fOffline) { // hidefed2crate + std::vector vFEDs = utilities::getFEDList(_emap); + std::vector vFEDsVME = utilities::getFEDVMEList(_emap); + std::vector vFEDsuTCA = utilities::getFEDuTCAList(_emap); + } + std::vector vhashVME; + std::vector vhashuTCA; + vhashVME.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); + vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_VME.initialize(filter::fFilter, hashfunctions::fElectronics, vhashVME); + _filter_uTCA.initialize(filter::fFilter, hashfunctions::fElectronics, vhashuTCA); - // BOOK - char aux[20]; - for (unsigned int i=0; i<10; i++) - { - sprintf(aux, "TS%d", i); - _cADC_Subdet[i].book(ib, _emap, _subsystem, aux); - } - _cADCall_Subdet.book(ib, _emap, _subsystem); - _cADCMsnVME_Subdet.book(ib, _emap, _subsystem); - _cADCMsnuTCA_Subdet.book(ib, _emap, _subsystem); - _cMsm_depth.book(ib, _emap, _subsystem); - _cMsnVME_depth.book(ib, _emap, _subsystem, std::string("VME")); - _cMsnuTCA_depth.book(ib, _emap, _subsystem, std::string("uTCA")); - if (_ptype != fOffline) { // hidefed2crate - _cMsm_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cMsn_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cMsm_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cMsn_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - } + // INITIALIZE + for (unsigned int i = 0; i < 10; i++) { + _cADC_Subdet[i].initialize(_name, + "ADC", + hashfunctions::fSubdet, + new quantity::ValueQuantity(quantity::fADCCorr_128), + new quantity::ValueQuantity(quantity::fADCCorr_128), + new quantity::ValueQuantity(quantity::fN, true), + 0); + } + _cADCall_Subdet.initialize(_name, + "ADC", + hashfunctions::fSubdet, + new quantity::ValueQuantity(quantity::fADCCorr_128), + new quantity::ValueQuantity(quantity::fADCCorr_128), + new quantity::ValueQuantity(quantity::fN, true), + 0); + _cADCMsnuTCA_Subdet.initialize(_name, + "ADCMsnuTCA", + hashfunctions::fSubdet, + new quantity::ValueQuantity(quantity::fADC_128), + new quantity::ValueQuantity(quantity::fN, true), + 0); + _cADCMsnVME_Subdet.initialize(_name, + "ADCMsnVME", + hashfunctions::fSubdet, + new quantity::ValueQuantity(quantity::fADC_128), + new quantity::ValueQuantity(quantity::fN, true), + 0); + _cMsm_depth.initialize(_name, + "Mismatched", + hashfunctions::fdepth, + new quantity::DetectorQuantity(quantity::fieta), + new quantity::DetectorQuantity(quantity::fiphi), + new quantity::ValueQuantity(quantity::fN), + 0); + if (_ptype != fOffline) { // hidefed2crate + _cMsm_FEDVME.initialize(_name, + "Mismatched", + hashfunctions::fFED, + new quantity::ElectronicsQuantity(quantity::fSpigot), + new quantity::ElectronicsQuantity(quantity::fFiberVMEFiberCh), + new quantity::ValueQuantity(quantity::fN), + 0); + _cMsm_FEDuTCA.initialize(_name, + "Mismatched", + hashfunctions::fFED, + new quantity::ElectronicsQuantity(quantity::fSlotuTCA), + new quantity::ElectronicsQuantity(quantity::fFiberuTCAFiberCh), + new quantity::ValueQuantity(quantity::fN), + 0); + } + _cMsnVME_depth.initialize(_name, + "Missing", + hashfunctions::fdepth, + new quantity::DetectorQuantity(quantity::fieta), + new quantity::DetectorQuantity(quantity::fiphi), + new quantity::ValueQuantity(quantity::fN), + 0); + _cMsnuTCA_depth.initialize(_name, + "Missing", + hashfunctions::fdepth, + new quantity::DetectorQuantity(quantity::fieta), + new quantity::DetectorQuantity(quantity::fiphi), + new quantity::ValueQuantity(quantity::fN), + 0); + if (_ptype != fOffline) { // hidefed2crate + _cMsn_FEDVME.initialize(_name, + "Missing", + hashfunctions::fFED, + new quantity::ElectronicsQuantity(quantity::fSpigot), + new quantity::ElectronicsQuantity(quantity::fFiberVMEFiberCh), + new quantity::ValueQuantity(quantity::fN), + 0); + _cMsn_FEDuTCA.initialize(_name, + "Missing", + hashfunctions::fFED, + new quantity::ElectronicsQuantity(quantity::fSlotuTCA), + new quantity::ElectronicsQuantity(quantity::fFiberuTCAFiberCh), + new quantity::ValueQuantity(quantity::fN), + 0); + } - _ehashmapuTCA.initialize(_emap, hcaldqm::electronicsmap::fD2EHashMap, - _filter_VME); - _ehashmapVME.initialize(_emap, hcaldqm::electronicsmap::fD2EHashMap, - _filter_uTCA); -} + // BOOK + char aux[20]; + for (unsigned int i = 0; i < 10; i++) { + sprintf(aux, "TS%d", i); + _cADC_Subdet[i].book(ib, _emap, _subsystem, aux); + } + _cADCall_Subdet.book(ib, _emap, _subsystem); + _cADCMsnVME_Subdet.book(ib, _emap, _subsystem); + _cADCMsnuTCA_Subdet.book(ib, _emap, _subsystem); + _cMsm_depth.book(ib, _emap, _subsystem); + _cMsnVME_depth.book(ib, _emap, _subsystem, std::string("VME")); + _cMsnuTCA_depth.book(ib, _emap, _subsystem, std::string("uTCA")); + if (_ptype != fOffline) { // hidefed2crate + _cMsm_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMsn_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMsm_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cMsn_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + } -/* virtual */ void DigiComparisonTask::_resetMonitors(hcaldqm::UpdateFreq uf) -{ - DQTask::_resetMonitors(uf); + _ehashmapuTCA.initialize(_emap, hcaldqm::electronicsmap::fD2EHashMap, _filter_VME); + _ehashmapVME.initialize(_emap, hcaldqm::electronicsmap::fD2EHashMap, _filter_uTCA); } -/* virtual */ void DigiComparisonTask::_process(edm::Event const& e, - edm::EventSetup const& es) -{ - edm::Handle chbhe1; - edm::Handle chbhe2; - - if (!e.getByToken(_tokHBHE1, chbhe1)) - _logger.dqmthrow("Collection HBHEDigiCollection isn't available" - + _tagHBHE1.label() + " " + _tagHBHE1.instance()); - if (!e.getByToken(_tokHBHE2, chbhe2)) - _logger.dqmthrow("Collection HBHEDigiCollection isn't available" - + _tagHBHE2.label() + " " + _tagHBHE2.instance()); +/* virtual */ void DigiComparisonTask::_resetMonitors(hcaldqm::UpdateFreq uf) { DQTask::_resetMonitors(uf); } + +/* virtual */ void DigiComparisonTask::_process(edm::Event const& e, edm::EventSetup const& es) { + edm::Handle chbhe1; + edm::Handle chbhe2; - // assume that coll1 is primary(uTCA) and coll2 is secondary(VME) - // uTCA is X and VME is Y axis - for (HBHEDigiCollection::const_iterator it1=chbhe1->begin(); - it1!=chbhe1->end(); ++it1) - { - // iterate thru the utca collection - // get the same detid digi from vme collection - // if missing - fill vme missing - // else correlate - HcalDetId did = it1->id(); - HcalElectronicsId eid1 = it1->elecId(); - HBHEDigiCollection::const_iterator it2 = chbhe2->find(did); + if (!e.getByToken(_tokHBHE1, chbhe1)) + _logger.dqmthrow("Collection HBHEDigiCollection isn't available" + _tagHBHE1.label() + " " + _tagHBHE1.instance()); + if (!e.getByToken(_tokHBHE2, chbhe2)) + _logger.dqmthrow("Collection HBHEDigiCollection isn't available" + _tagHBHE2.label() + " " + _tagHBHE2.instance()); - // get the eid for vme by did - HcalElectronicsId eid2 = HcalElectronicsId(_ehashmapVME.lookup(did)); - if (it2==chbhe2->end()) - { - // fill the depth plot - _cMsnVME_depth.fill(did); - if (_ptype != fOffline) { // hidefed2crate - _cMsn_FEDVME.fill(eid2); - } - for (int i=0; isize(); i++) - { - _cADCMsnVME_Subdet.fill(did, it1->sample(i).adc()); - _cADCall_Subdet.fill(did, it1->sample(i).adc(), -2); - _cADC_Subdet[i].fill(did, it1->sample(i).adc(), -2); - } - } - else - for (int i=0; isize(); i++) - { - _cADCall_Subdet.fill(did, double(it1->sample(i).adc()), - double(it2->sample(i).adc())); - _cADC_Subdet[i].fill(did, double(it1->sample(i).adc()), - double(it2->sample(i).adc())); - if (it1->sample(i).adc()!=it2->sample(i).adc()) - { - // fill depth, uTCA and VME as well for which guys - // mismatches happen - _cMsm_depth.fill(did); - if (_ptype != fOffline) { // hidefed2crate - _cMsm_FEDVME.fill(eid2); - _cMsm_FEDuTCA.fill(eid1); - } - } - } - } - for (HBHEDigiCollection::const_iterator it2=chbhe2->begin(); - it2!=chbhe2->end(); ++it2) - { - // itearte thru VME - // find utca digi by detid - // check if present or missing - HcalDetId did = it2->id(); - HBHEDigiCollection::const_iterator it1 = chbhe1->find(did); - if (it1==chbhe1->end()) - { - HcalElectronicsId eid1 = HcalElectronicsId(_ehashmapuTCA.lookup(did)); - if (_ptype != fOffline) { // hidefed2crate - _cMsn_FEDuTCA.fill(eid1); - } - for (int i=0; isize(); i++) - { - _cADCMsnuTCA_Subdet.fill(did, it2->sample(i).adc()); - _cADCall_Subdet.fill(did, -2, it2->sample(i).adc()); - _cADC_Subdet[i].fill(did, -2, it2->sample(i).adc()); - } - } - } + // assume that coll1 is primary(uTCA) and coll2 is secondary(VME) + // uTCA is X and VME is Y axis + for (HBHEDigiCollection::const_iterator it1 = chbhe1->begin(); it1 != chbhe1->end(); ++it1) { + // iterate thru the utca collection + // get the same detid digi from vme collection + // if missing - fill vme missing + // else correlate + HcalDetId did = it1->id(); + HcalElectronicsId eid1 = it1->elecId(); + HBHEDigiCollection::const_iterator it2 = chbhe2->find(did); + + // get the eid for vme by did + HcalElectronicsId eid2 = HcalElectronicsId(_ehashmapVME.lookup(did)); + if (it2 == chbhe2->end()) { + // fill the depth plot + _cMsnVME_depth.fill(did); + if (_ptype != fOffline) { // hidefed2crate + _cMsn_FEDVME.fill(eid2); + } + for (int i = 0; i < it1->size(); i++) { + _cADCMsnVME_Subdet.fill(did, it1->sample(i).adc()); + _cADCall_Subdet.fill(did, it1->sample(i).adc(), -2); + _cADC_Subdet[i].fill(did, it1->sample(i).adc(), -2); + } + } else + for (int i = 0; i < it1->size(); i++) { + _cADCall_Subdet.fill(did, double(it1->sample(i).adc()), double(it2->sample(i).adc())); + _cADC_Subdet[i].fill(did, double(it1->sample(i).adc()), double(it2->sample(i).adc())); + if (it1->sample(i).adc() != it2->sample(i).adc()) { + // fill depth, uTCA and VME as well for which guys + // mismatches happen + _cMsm_depth.fill(did); + if (_ptype != fOffline) { // hidefed2crate + _cMsm_FEDVME.fill(eid2); + _cMsm_FEDuTCA.fill(eid1); + } + } + } + } + for (HBHEDigiCollection::const_iterator it2 = chbhe2->begin(); it2 != chbhe2->end(); ++it2) { + // itearte thru VME + // find utca digi by detid + // check if present or missing + HcalDetId did = it2->id(); + HBHEDigiCollection::const_iterator it1 = chbhe1->find(did); + if (it1 == chbhe1->end()) { + HcalElectronicsId eid1 = HcalElectronicsId(_ehashmapuTCA.lookup(did)); + if (_ptype != fOffline) { // hidefed2crate + _cMsn_FEDuTCA.fill(eid1); + } + for (int i = 0; i < it2->size(); i++) { + _cADCMsnuTCA_Subdet.fill(did, it2->sample(i).adc()); + _cADCall_Subdet.fill(did, -2, it2->sample(i).adc()); + _cADC_Subdet[i].fill(did, -2, it2->sample(i).adc()); + } + } + } } -/* virtual */ void DigiComparisonTask::endLuminosityBlock( - edm::LuminosityBlock const& lb, edm::EventSetup const& es) -{ - // in the end always - DQTask::endLuminosityBlock(lb, es); +/* virtual */ void DigiComparisonTask::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + // in the end always + DQTask::endLuminosityBlock(lb, es); } DEFINE_FWK_MODULE(DigiComparisonTask); - diff --git a/DQM/HcalTasks/plugins/DigiPhase1Task.cc b/DQM/HcalTasks/plugins/DigiPhase1Task.cc index 690ee47a7d99d..0d9273038662d 100644 --- a/DQM/HcalTasks/plugins/DigiPhase1Task.cc +++ b/DQM/HcalTasks/plugins/DigiPhase1Task.cc @@ -4,671 +4,650 @@ using namespace hcaldqm; using namespace hcaldqm::constants; using namespace hcaldqm::filter; -DigiPhase1Task::DigiPhase1Task(edm::ParameterSet const& ps): - DQTask(ps) -{ - _tagHBHE = ps.getUntrackedParameter("tagHBHE", - edm::InputTag("hcalDigis")); - _tagHO = ps.getUntrackedParameter("tagHO", - edm::InputTag("hcalDigis")); - _tagHF = ps.getUntrackedParameter("tagHF", - edm::InputTag("hcalDigis")); - - _tokHBHE = consumes(_tagHBHE); - _tokHO = consumes(_tagHO); - _tokHF = consumes(_tagHF); - - _cutSumQ_HBHE = ps.getUntrackedParameter("cutSumQ_HBHE", 20); - _cutSumQ_HO = ps.getUntrackedParameter("cutSumQ_HO", 20); - _cutSumQ_HF = ps.getUntrackedParameter("cutSumQ_HF", 20); - _thresh_unihf = ps.getUntrackedParameter("thresh_unihf", 0.2); - - _vflags.resize(nDigiFlag); - _vflags[fUni]=hcaldqm::flag::Flag("UniSlotHF"); - _vflags[fDigiSize]=hcaldqm::flag::Flag("DigiSize"); - _vflags[fNChsHF]=hcaldqm::flag::Flag("NChsHF"); - _vflags[fUnknownIds]=hcaldqm::flag::Flag("UnknownIds"); +DigiPhase1Task::DigiPhase1Task(edm::ParameterSet const& ps) : DQTask(ps) { + _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); + _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); + _tagHF = ps.getUntrackedParameter("tagHF", edm::InputTag("hcalDigis")); + + _tokHBHE = consumes(_tagHBHE); + _tokHO = consumes(_tagHO); + _tokHF = consumes(_tagHF); + + _cutSumQ_HBHE = ps.getUntrackedParameter("cutSumQ_HBHE", 20); + _cutSumQ_HO = ps.getUntrackedParameter("cutSumQ_HO", 20); + _cutSumQ_HF = ps.getUntrackedParameter("cutSumQ_HF", 20); + _thresh_unihf = ps.getUntrackedParameter("thresh_unihf", 0.2); + + _vflags.resize(nDigiFlag); + _vflags[fUni] = hcaldqm::flag::Flag("UniSlotHF"); + _vflags[fDigiSize] = hcaldqm::flag::Flag("DigiSize"); + _vflags[fNChsHF] = hcaldqm::flag::Flag("NChsHF"); + _vflags[fUnknownIds] = hcaldqm::flag::Flag("UnknownIds"); } -/* virtual */ void DigiPhase1Task::bookHistograms(DQMStore::IBooker& ib, - edm::Run const& r, edm::EventSetup const& es) -{ - DQTask::bookHistograms(ib,r,es); - - // GET WHAT YOU NEED - edm::ESHandle dbs; - es.get().get(dbs); - _emap = dbs->getHcalMapping(); - std::vector vVME; - std::vector vuTCA; - vVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); - vuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vVME); - _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vuTCA); - - // INITIALIZE FIRST - _cADC_SubdetPM.initialize(_name, "ADC", hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_128), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cfC_SubdetPM.initialize(_name, "fC", hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cSumQ_SubdetPM.initialize(_name, "SumQ", hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cSumQ_depth.initialize(_name, "SumQ", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),0); - _cSumQvsLS_SubdetPM.initialize(_name, "SumQvsLS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),0); - _cTimingCut_SubdetPM.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cTimingCut_depth.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - - // Occupancy w/o a cut - _cOccupancyvsLS_Subdet.initialize(_name, "OccupancyvsLS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),0); - _cOccupancy_depth.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - // Occupancy w/ a cut - _cOccupancyCutvsLS_Subdet.initialize(_name, "OccupancyCutvsLS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),0); - _cOccupancyCut_depth.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - if (_ptype != fOffline) { // hidefed2crate - std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); - std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); - std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); - - std::vector vFEDHF; - vFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - // initialize filters - _filter_FEDHF.initialize(filter::fPreserver, hcaldqm::hashfunctions::fFED, - vFEDHF); - - // push the rawIds of each fed into the vector... - for (std::vector::const_iterator it=vFEDsVME.begin(); it!=vFEDsVME.end(); ++it) { - _vhashFEDs.push_back(HcalElectronicsId( - constants::FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, - (*it)-FED_VME_MIN).rawId()); - } - for (std::vector::const_iterator it=vFEDsuTCA.begin(); - it!=vFEDsuTCA.end(); ++it) - { - std::pair cspair = hcaldqm::utilities::fed2crate(*it); - _vhashFEDs.push_back(HcalElectronicsId( - cspair.first, cspair.second, FIBER_uTCA_MIN1, - FIBERCH_MIN, false).rawId()); - } - - _cShapeCut_FED.initialize(_name, "Shape", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),0); - - _cTimingCut_FEDVME.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingCut_FEDuTCA.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingCut_ElectronicsVME.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingCut_ElectronicsuTCA.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingCutvsLS_FED.initialize(_name, "TimingvsLS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - - _cOccupancy_FEDVME.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancy_FEDuTCA.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancy_ElectronicsVME.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancy_ElectronicsuTCA.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - _cOccupancyCut_FEDVME.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCut_FEDuTCA.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCut_ElectronicsVME.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCut_ElectronicsuTCA.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - _cDigiSize_FED.initialize(_name, "DigiSize", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDigiSize), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - } - - - // BOOK HISTOGRAMS - char cutstr[200]; - sprintf(cutstr, "_SumQHBHE%dHO%dHF%d", int(_cutSumQ_HBHE), - int(_cutSumQ_HO), int(_cutSumQ_HF)); - char cutstr2[200]; - sprintf(cutstr2, "_SumQHF%d", int(_cutSumQ_HF)); - - _cADC_SubdetPM.book(ib, _emap, _subsystem); - - _cfC_SubdetPM.book(ib, _emap, _subsystem); - _cSumQ_SubdetPM.book(ib, _emap, _subsystem); - _cSumQ_depth.book(ib, _emap, _subsystem); - _cSumQvsLS_SubdetPM.book(ib, _emap, _subsystem); - - - _cTimingCut_SubdetPM.book(ib, _emap, _subsystem); - _cTimingCut_depth.book(ib, _emap, _subsystem); - - _cOccupancyvsLS_Subdet.book(ib, _emap, _subsystem); - _cOccupancy_depth.book(ib, _emap, _subsystem); - _cOccupancyCut_depth.book(ib, _emap, _subsystem); - - if (_ptype != fOffline) { // hidefed2crate - _cShapeCut_FED.book(ib, _emap, _subsystem); - _cTimingCut_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cTimingCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cTimingCutvsLS_FED.book(ib, _emap, _subsystem); - _cTimingCut_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cTimingCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cOccupancy_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cOccupancy_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cOccupancy_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cOccupancy_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cOccupancyCut_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cOccupancyCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cOccupancyCut_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cOccupancyCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cDigiSize_FED.book(ib, _emap, _subsystem); - } - - // BOOK HISTOGRAMS that are only for Online - _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); - _dhashmap.initialize(_emap, electronicsmap::fE2DHashMap); - - // MARK THESE HISTOGRAMS AS LUMI BASED FOR OFFLINE PROCESSING - if (_ptype==fOffline) - { - //_cDigiSize_FED.setLumiFlag(); // hidefed2crate : FED stuff not available offline anymore, so this histogram doesn't make sense? - _cOccupancy_depth.setLumiFlag(); - } - - // book Number of Events vs LS histogram - ib.setCurrentFolder(_subsystem+"/RunInfo"); - meNumEvents1LS = ib.book1D("NumberOfEvents", "NumberOfEvents", - 1, 0, 1); - meNumEvents1LS->setLumiFlag(); - - // book the flag for unknown ids and the online guy as well - ib.setCurrentFolder(_subsystem+"/"+_name); - meUnknownIds1LS = ib.book1D("UnknownIds", "UnknownIds", - 1, 0, 1); - _unknownIdsPresent = false; - meUnknownIds1LS->setLumiFlag(); +/* virtual */ void DigiPhase1Task::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + DQTask::bookHistograms(ib, r, es); + + // GET WHAT YOU NEED + edm::ESHandle dbs; + es.get().get(dbs); + _emap = dbs->getHcalMapping(); + std::vector vVME; + std::vector vuTCA; + vVME.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); + vuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vVME); + _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vuTCA); + + // INITIALIZE FIRST + _cADC_SubdetPM.initialize(_name, + "ADC", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_128), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cfC_SubdetPM.initialize(_name, + "fC", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cSumQ_SubdetPM.initialize(_name, + "SumQ", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cSumQ_depth.initialize(_name, + "SumQ", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000), + 0); + _cSumQvsLS_SubdetPM.initialize(_name, + "SumQvsLS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000), + 0); + _cTimingCut_SubdetPM.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cTimingCut_depth.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + + // Occupancy w/o a cut + _cOccupancyvsLS_Subdet.initialize(_name, + "OccupancyvsLS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000), + 0); + _cOccupancy_depth.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + // Occupancy w/ a cut + _cOccupancyCutvsLS_Subdet.initialize(_name, + "OccupancyCutvsLS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000), + 0); + _cOccupancyCut_depth.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + if (_ptype != fOffline) { // hidefed2crate + std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); + std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); + std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); + + std::vector vFEDHF; + vFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + // initialize filters + _filter_FEDHF.initialize(filter::fPreserver, hcaldqm::hashfunctions::fFED, vFEDHF); + + // push the rawIds of each fed into the vector... + for (std::vector::const_iterator it = vFEDsVME.begin(); it != vFEDsVME.end(); ++it) { + _vhashFEDs.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, (*it) - FED_VME_MIN).rawId()); + } + for (std::vector::const_iterator it = vFEDsuTCA.begin(); it != vFEDsuTCA.end(); ++it) { + std::pair cspair = hcaldqm::utilities::fed2crate(*it); + _vhashFEDs.push_back(HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + } + + _cShapeCut_FED.initialize(_name, + "Shape", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000), + 0); + + _cTimingCut_FEDVME.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingCut_FEDuTCA.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingCut_ElectronicsVME.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingCut_ElectronicsuTCA.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingCutvsLS_FED.initialize(_name, + "TimingvsLS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + + _cOccupancy_FEDVME.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancy_FEDuTCA.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancy_ElectronicsVME.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancy_ElectronicsuTCA.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cOccupancyCut_FEDVME.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCut_FEDuTCA.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCut_ElectronicsVME.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCut_ElectronicsuTCA.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cDigiSize_FED.initialize(_name, + "DigiSize", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDigiSize), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + } + + // BOOK HISTOGRAMS + char cutstr[200]; + sprintf(cutstr, "_SumQHBHE%dHO%dHF%d", int(_cutSumQ_HBHE), int(_cutSumQ_HO), int(_cutSumQ_HF)); + char cutstr2[200]; + sprintf(cutstr2, "_SumQHF%d", int(_cutSumQ_HF)); + + _cADC_SubdetPM.book(ib, _emap, _subsystem); + + _cfC_SubdetPM.book(ib, _emap, _subsystem); + _cSumQ_SubdetPM.book(ib, _emap, _subsystem); + _cSumQ_depth.book(ib, _emap, _subsystem); + _cSumQvsLS_SubdetPM.book(ib, _emap, _subsystem); + + _cTimingCut_SubdetPM.book(ib, _emap, _subsystem); + _cTimingCut_depth.book(ib, _emap, _subsystem); + + _cOccupancyvsLS_Subdet.book(ib, _emap, _subsystem); + _cOccupancy_depth.book(ib, _emap, _subsystem); + _cOccupancyCut_depth.book(ib, _emap, _subsystem); + + if (_ptype != fOffline) { // hidefed2crate + _cShapeCut_FED.book(ib, _emap, _subsystem); + _cTimingCut_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cTimingCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cTimingCutvsLS_FED.book(ib, _emap, _subsystem); + _cTimingCut_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cTimingCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cOccupancy_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancy_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cOccupancy_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancy_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cOccupancyCut_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancyCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cOccupancyCut_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancyCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cDigiSize_FED.book(ib, _emap, _subsystem); + } + + // BOOK HISTOGRAMS that are only for Online + _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); + _dhashmap.initialize(_emap, electronicsmap::fE2DHashMap); + + // MARK THESE HISTOGRAMS AS LUMI BASED FOR OFFLINE PROCESSING + if (_ptype == fOffline) { + //_cDigiSize_FED.setLumiFlag(); // hidefed2crate : FED stuff not available offline anymore, so this histogram doesn't make sense? + _cOccupancy_depth.setLumiFlag(); + } + + // book Number of Events vs LS histogram + ib.setCurrentFolder(_subsystem + "/RunInfo"); + meNumEvents1LS = ib.book1D("NumberOfEvents", "NumberOfEvents", 1, 0, 1); + meNumEvents1LS->setLumiFlag(); + + // book the flag for unknown ids and the online guy as well + ib.setCurrentFolder(_subsystem + "/" + _name); + meUnknownIds1LS = ib.book1D("UnknownIds", "UnknownIds", 1, 0, 1); + _unknownIdsPresent = false; + meUnknownIds1LS->setLumiFlag(); } -/* virtual */ void DigiPhase1Task::_resetMonitors(hcaldqm::UpdateFreq uf) -{ - DQTask::_resetMonitors(uf); - - switch(uf) - { - case hcaldqm::f1LS: - _unknownIdsPresent = false; - break; - case hcaldqm::f50LS: - break; - default: - break; - } +/* virtual */ void DigiPhase1Task::_resetMonitors(hcaldqm::UpdateFreq uf) { + DQTask::_resetMonitors(uf); + + switch (uf) { + case hcaldqm::f1LS: + _unknownIdsPresent = false; + break; + case hcaldqm::f50LS: + break; + default: + break; + } } -/* virtual */ void DigiPhase1Task::_process(edm::Event const& e, - edm::EventSetup const&) -{ - edm::Handle chbhe; - edm::Handle cho; - edm::Handle chf; - - if (!e.getByToken(_tokHBHE, chbhe)) - _logger.dqmthrow("Collection HBHEDigiCollection isn't available" - + _tagHBHE.label() + " " + _tagHBHE.instance()); - if (!e.getByToken(_tokHO, cho)) - _logger.dqmthrow("Collection HODigiCollection isn't available" - + _tagHO.label() + " " + _tagHO.instance()); - if (!e.getByToken(_tokHF, chf)) - _logger.dqmthrow("Collection HF QIE10Collection isn't available" - + _tagHF.label() + " " + _tagHF.instance()); - - // extract some info per event - meNumEvents1LS->Fill(0.5); // just increment - - // To fill histograms outside of the loop, you need to determine if there were - // any valid det ids first - uint32_t rawidValid = 0; - uint32_t rawidHBValid = 0; - uint32_t rawidHEValid = 0; - - // HB collection - int numChs = 0; - int numChsCut = 0; - int numChsHE = 0; - int numChsCutHE = 0; - for (QIE11DigiCollection::const_iterator it=chbhe->begin(); it!=chbhe->end(); ++it) { - QIE11DataFrame const& frame = *it; - double sumQ = hcaldqm::utilities::sumQ_v10(frame, 2.5, 0, frame.samples()-1); - - // Explicit check on the DetIds present in the Collection - HcalDetId const& did = frame.detid(); - uint32_t rawid = _ehashmap.lookup(did); - if (rawid==0) - {meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;} - HcalElectronicsId const& eid(rawid); - if (did.subdet()==HcalBarrel) { - rawidHBValid = did.rawId(); - } else if (did.subdet()==HcalEndcap) { - rawidHEValid = did.rawId(); - } else { - // Skip non-HB or HE detids - continue; - } - - // filter out channels that are masked out - if (_xQuality.exists(did)) - { - HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); - if ( - cs.isBitSet(HcalChannelStatus::HcalCellMask) || - cs.isBitSet(HcalChannelStatus::HcalCellDead)) - continue; - } - - _cSumQ_SubdetPM.fill(did, sumQ); - _cOccupancy_depth.fill(did); - - if (_ptype != fOffline) { // hidefed2crate - _cDigiSize_FED.fill(eid, frame.samples()); - } - if (eid.isVMEid()) - { - if (_ptype != fOffline) { // hidefed2crate - _cOccupancy_FEDVME.fill(eid); - _cOccupancy_ElectronicsVME.fill(eid); - } - } - else - { - if (_ptype != fOffline) { // hidefed2crate - _cOccupancy_FEDuTCA.fill(eid); - _cOccupancy_ElectronicsuTCA.fill(eid); - } - /* +/* virtual */ void DigiPhase1Task::_process(edm::Event const& e, edm::EventSetup const&) { + edm::Handle chbhe; + edm::Handle cho; + edm::Handle chf; + + if (!e.getByToken(_tokHBHE, chbhe)) + _logger.dqmthrow("Collection HBHEDigiCollection isn't available" + _tagHBHE.label() + " " + _tagHBHE.instance()); + if (!e.getByToken(_tokHO, cho)) + _logger.dqmthrow("Collection HODigiCollection isn't available" + _tagHO.label() + " " + _tagHO.instance()); + if (!e.getByToken(_tokHF, chf)) + _logger.dqmthrow("Collection HF QIE10Collection isn't available" + _tagHF.label() + " " + _tagHF.instance()); + + // extract some info per event + meNumEvents1LS->Fill(0.5); // just increment + + // To fill histograms outside of the loop, you need to determine if there were + // any valid det ids first + uint32_t rawidValid = 0; + uint32_t rawidHBValid = 0; + uint32_t rawidHEValid = 0; + + // HB collection + int numChs = 0; + int numChsCut = 0; + int numChsHE = 0; + int numChsCutHE = 0; + for (QIE11DigiCollection::const_iterator it = chbhe->begin(); it != chbhe->end(); ++it) { + QIE11DataFrame const& frame = *it; + double sumQ = hcaldqm::utilities::sumQ_v10(frame, 2.5, 0, frame.samples() - 1); + + // Explicit check on the DetIds present in the Collection + HcalDetId const& did = frame.detid(); + uint32_t rawid = _ehashmap.lookup(did); + if (rawid == 0) { + meUnknownIds1LS->Fill(1); + _unknownIdsPresent = true; + continue; + } + HcalElectronicsId const& eid(rawid); + if (did.subdet() == HcalBarrel) { + rawidHBValid = did.rawId(); + } else if (did.subdet() == HcalEndcap) { + rawidHEValid = did.rawId(); + } else { + // Skip non-HB or HE detids + continue; + } + + // filter out channels that are masked out + if (_xQuality.exists(did)) { + HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); + if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead)) + continue; + } + + _cSumQ_SubdetPM.fill(did, sumQ); + _cOccupancy_depth.fill(did); + + if (_ptype != fOffline) { // hidefed2crate + _cDigiSize_FED.fill(eid, frame.samples()); + } + if (eid.isVMEid()) { + if (_ptype != fOffline) { // hidefed2crate + _cOccupancy_FEDVME.fill(eid); + _cOccupancy_ElectronicsVME.fill(eid); + } + } else { + if (_ptype != fOffline) { // hidefed2crate + _cOccupancy_FEDuTCA.fill(eid); + _cOccupancy_ElectronicsuTCA.fill(eid); + } + /* if (!it->validate(0, it->size())) { _cCapIdRots_depth.fill(did); _cCapIdRots_FEDuTCA.fill(eid, 1); }*/ - } - - for (int i=0; i_cutSumQ_HBHE) - _cShapeCut_FED.fill(eid, i, constants::adc2fC[frame[i].adc()]); - } - } - - if (sumQ>_cutSumQ_HBHE) - { - double timing = hcaldqm::utilities::aveTS_v10(frame, 2.5, 0, frame.samples()-1); - _cTimingCut_SubdetPM.fill(did, timing); - _cTimingCut_depth.fill(did, timing); - _cOccupancyCut_depth.fill(did); - if (_ptype != fOffline) { // hidefed2crate - _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); - } - _cSumQ_depth.fill(did, sumQ); - _cSumQvsLS_SubdetPM.fill(did, _currentLS, sumQ); - - if (eid.isVMEid()) - { - if (_ptype != fOffline) { // hidefed2crate - _cTimingCut_FEDVME.fill(eid, timing); - _cOccupancyCut_FEDVME.fill(eid); - _cTimingCut_ElectronicsVME.fill(eid, timing); - _cOccupancyCut_ElectronicsVME.fill(eid); - } - } - else - { - if (_ptype != fOffline) { // hidefed2crate - _cTimingCut_FEDuTCA.fill(eid, timing); - _cOccupancyCut_FEDuTCA.fill(eid); - _cTimingCut_ElectronicsuTCA.fill(eid, timing); - _cOccupancyCut_ElectronicsuTCA.fill(eid); - } - } - did.subdet()==HcalBarrel?numChsCut++:numChsCutHE++; - } - did.subdet()==HcalBarrel?numChs++:numChsHE++; - } - - if (rawidHBValid!=0 && rawidHEValid!=0) - { - _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHBValid), _currentLS, - numChs); - _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHEValid), _currentLS, - numChsHE); - - } - numChs=0; - numChsCut = 0; - - // reset - rawidValid = 0; - - // HO collection - for (HODigiCollection::const_iterator it=cho->begin(); it!=cho->end(); - ++it) - { - double sumQ = hcaldqm::utilities::sumQ(*it, 8.5, 0, it->size()-1); - - // Explicit check on the DetIds present in the Collection - HcalDetId const& did = it->id(); - uint32_t rawid = _ehashmap.lookup(did); - if (rawid==0) - {meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;} - HcalElectronicsId const& eid(rawid); - if (did.subdet()==HcalOuter) - rawidValid = did.rawId(); - - // filter out channels that are masked out - if (_xQuality.exists(did)) - { - HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); - if ( - cs.isBitSet(HcalChannelStatus::HcalCellMask) || - cs.isBitSet(HcalChannelStatus::HcalCellDead)) - continue; - } - - _cSumQ_SubdetPM.fill(did, sumQ); - _cOccupancy_depth.fill(did); - if (_ptype != fOffline) { // hidefed2crate - _cDigiSize_FED.fill(eid, it->size()); - } - if (eid.isVMEid()) - { - if (_ptype != fOffline) { // hidefed2crate - _cOccupancy_FEDVME.fill(eid); - _cOccupancy_ElectronicsVME.fill(eid); - } - /* + } + + for (int i = 0; i < frame.samples(); i++) { + _cADC_SubdetPM.fill(did, frame[i].adc()); + _cfC_SubdetPM.fill(did, constants::adc2fC[frame[i].adc()]); + if (_ptype != fOffline) { // hidefed2crate + if (sumQ > _cutSumQ_HBHE) + _cShapeCut_FED.fill(eid, i, constants::adc2fC[frame[i].adc()]); + } + } + + if (sumQ > _cutSumQ_HBHE) { + double timing = hcaldqm::utilities::aveTS_v10(frame, 2.5, 0, frame.samples() - 1); + _cTimingCut_SubdetPM.fill(did, timing); + _cTimingCut_depth.fill(did, timing); + _cOccupancyCut_depth.fill(did); + if (_ptype != fOffline) { // hidefed2crate + _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); + } + _cSumQ_depth.fill(did, sumQ); + _cSumQvsLS_SubdetPM.fill(did, _currentLS, sumQ); + + if (eid.isVMEid()) { + if (_ptype != fOffline) { // hidefed2crate + _cTimingCut_FEDVME.fill(eid, timing); + _cOccupancyCut_FEDVME.fill(eid); + _cTimingCut_ElectronicsVME.fill(eid, timing); + _cOccupancyCut_ElectronicsVME.fill(eid); + } + } else { + if (_ptype != fOffline) { // hidefed2crate + _cTimingCut_FEDuTCA.fill(eid, timing); + _cOccupancyCut_FEDuTCA.fill(eid); + _cTimingCut_ElectronicsuTCA.fill(eid, timing); + _cOccupancyCut_ElectronicsuTCA.fill(eid); + } + } + did.subdet() == HcalBarrel ? numChsCut++ : numChsCutHE++; + } + did.subdet() == HcalBarrel ? numChs++ : numChsHE++; + } + + if (rawidHBValid != 0 && rawidHEValid != 0) { + _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHBValid), _currentLS, numChs); + _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHEValid), _currentLS, numChsHE); + } + numChs = 0; + numChsCut = 0; + + // reset + rawidValid = 0; + + // HO collection + for (HODigiCollection::const_iterator it = cho->begin(); it != cho->end(); ++it) { + double sumQ = hcaldqm::utilities::sumQ(*it, 8.5, 0, it->size() - 1); + + // Explicit check on the DetIds present in the Collection + HcalDetId const& did = it->id(); + uint32_t rawid = _ehashmap.lookup(did); + if (rawid == 0) { + meUnknownIds1LS->Fill(1); + _unknownIdsPresent = true; + continue; + } + HcalElectronicsId const& eid(rawid); + if (did.subdet() == HcalOuter) + rawidValid = did.rawId(); + + // filter out channels that are masked out + if (_xQuality.exists(did)) { + HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); + if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead)) + continue; + } + + _cSumQ_SubdetPM.fill(did, sumQ); + _cOccupancy_depth.fill(did); + if (_ptype != fOffline) { // hidefed2crate + _cDigiSize_FED.fill(eid, it->size()); + } + if (eid.isVMEid()) { + if (_ptype != fOffline) { // hidefed2crate + _cOccupancy_FEDVME.fill(eid); + _cOccupancy_ElectronicsVME.fill(eid); + } + /* if (!it->validate(0, it->size())) _cCapIdRots_FEDVME.fill(eid, 1); */ - } - else - { - if (_ptype != fOffline) { // hidefed2crate - _cOccupancy_FEDuTCA.fill(eid); - _cOccupancy_ElectronicsuTCA.fill(eid); - } - /* + } else { + if (_ptype != fOffline) { // hidefed2crate + _cOccupancy_FEDuTCA.fill(eid); + _cOccupancy_ElectronicsuTCA.fill(eid); + } + /* if (!it->validate(0, it->size())) _cCapIdRots_FEDuTCA.fill(eid, 1);*/ - } - - for (int i=0; isize(); i++) - { - _cADC_SubdetPM.fill(did, it->sample(i).adc()); - _cfC_SubdetPM.fill(did, it->sample(i).nominal_fC()); - if (_ptype != fOffline) { // hidefed2crate - if (sumQ>_cutSumQ_HO) - _cShapeCut_FED.fill(eid, i, it->sample(i).nominal_fC()); - } - } - - if (sumQ>_cutSumQ_HO) - { - double timing = hcaldqm::utilities::aveTS(*it, 8.5, 0, - it->size()-1); - _cSumQ_depth.fill(did, sumQ); - _cSumQvsLS_SubdetPM.fill(did, _currentLS, sumQ); - _cOccupancyCut_depth.fill(did); - _cTimingCut_SubdetPM.fill(did, timing); - _cTimingCut_depth.fill(did, timing); - if (_ptype != fOffline) { // hidefed2crate - _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); - } - - if (eid.isVMEid()) - { - if (_ptype != fOffline) { // hidefed2crate - _cTimingCut_FEDVME.fill(eid, timing); - _cOccupancyCut_FEDVME.fill(eid); - _cTimingCut_ElectronicsVME.fill(eid, timing); - _cOccupancyCut_ElectronicsVME.fill(eid); - } - } - else - { - if (_ptype != fOffline) { // hidefed2crate - _cTimingCut_FEDuTCA.fill(eid, timing); - _cOccupancyCut_FEDuTCA.fill(eid); - _cTimingCut_ElectronicsuTCA.fill(eid, timing); - _cOccupancyCut_ElectronicsuTCA.fill(eid); - } - } - numChsCut++; - } - numChs++; - } - - if (rawidValid!=0) - { - _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, - numChs); - } - numChs=0; numChsCut=0; - - // reset - rawidValid = 0; - - // HF collection - for (QIE10DigiCollection::const_iterator it=chf->begin(); it!=chf->end(); - ++it) - { - QIE10DataFrame frame = *it; - double sumQ = hcaldqm::utilities::sumQ_v10(frame, - 2.5, 0, frame.samples()-1); - - // Explicit check on the DetIds present in the Collection - HcalDetId const& did = it->id(); - uint32_t rawid = _ehashmap.lookup(did); - if (rawid==0) - {meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;} - HcalElectronicsId const& eid(rawid); - if (did.subdet()==HcalForward) { - rawidValid = did.rawId(); - } else { - // Skip non-HF detids - continue; - } - - // filter out channels that are masked out - if (_xQuality.exists(did)) - { - HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); - if ( - cs.isBitSet(HcalChannelStatus::HcalCellMask) || - cs.isBitSet(HcalChannelStatus::HcalCellDead)) - continue; - } - - _cSumQ_SubdetPM.fill(did, sumQ); - _cOccupancy_depth.fill(did); - if (_ptype != fOffline) { // hidefed2crate - _cDigiSize_FED.fill(eid, frame.samples()); - } - if (eid.isVMEid()) - { - if (_ptype != fOffline) { // hidefed2crate - _cOccupancy_FEDVME.fill(eid); - _cOccupancy_ElectronicsVME.fill(eid); - } - /* + } + + for (int i = 0; i < it->size(); i++) { + _cADC_SubdetPM.fill(did, it->sample(i).adc()); + _cfC_SubdetPM.fill(did, it->sample(i).nominal_fC()); + if (_ptype != fOffline) { // hidefed2crate + if (sumQ > _cutSumQ_HO) + _cShapeCut_FED.fill(eid, i, it->sample(i).nominal_fC()); + } + } + + if (sumQ > _cutSumQ_HO) { + double timing = hcaldqm::utilities::aveTS(*it, 8.5, 0, it->size() - 1); + _cSumQ_depth.fill(did, sumQ); + _cSumQvsLS_SubdetPM.fill(did, _currentLS, sumQ); + _cOccupancyCut_depth.fill(did); + _cTimingCut_SubdetPM.fill(did, timing); + _cTimingCut_depth.fill(did, timing); + if (_ptype != fOffline) { // hidefed2crate + _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); + } + + if (eid.isVMEid()) { + if (_ptype != fOffline) { // hidefed2crate + _cTimingCut_FEDVME.fill(eid, timing); + _cOccupancyCut_FEDVME.fill(eid); + _cTimingCut_ElectronicsVME.fill(eid, timing); + _cOccupancyCut_ElectronicsVME.fill(eid); + } + } else { + if (_ptype != fOffline) { // hidefed2crate + _cTimingCut_FEDuTCA.fill(eid, timing); + _cOccupancyCut_FEDuTCA.fill(eid); + _cTimingCut_ElectronicsuTCA.fill(eid, timing); + _cOccupancyCut_ElectronicsuTCA.fill(eid); + } + } + numChsCut++; + } + numChs++; + } + + if (rawidValid != 0) { + _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, numChs); + } + numChs = 0; + numChsCut = 0; + + // reset + rawidValid = 0; + + // HF collection + for (QIE10DigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) { + QIE10DataFrame frame = *it; + double sumQ = hcaldqm::utilities::sumQ_v10(frame, 2.5, 0, frame.samples() - 1); + + // Explicit check on the DetIds present in the Collection + HcalDetId const& did = it->id(); + uint32_t rawid = _ehashmap.lookup(did); + if (rawid == 0) { + meUnknownIds1LS->Fill(1); + _unknownIdsPresent = true; + continue; + } + HcalElectronicsId const& eid(rawid); + if (did.subdet() == HcalForward) { + rawidValid = did.rawId(); + } else { + // Skip non-HF detids + continue; + } + + // filter out channels that are masked out + if (_xQuality.exists(did)) { + HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); + if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead)) + continue; + } + + _cSumQ_SubdetPM.fill(did, sumQ); + _cOccupancy_depth.fill(did); + if (_ptype != fOffline) { // hidefed2crate + _cDigiSize_FED.fill(eid, frame.samples()); + } + if (eid.isVMEid()) { + if (_ptype != fOffline) { // hidefed2crate + _cOccupancy_FEDVME.fill(eid); + _cOccupancy_ElectronicsVME.fill(eid); + } + /* if (!it->validate(0, it->size())) _cCapIdRots_FEDVME.fill(eid, 1);*/ - } - else - { - if (_ptype != fOffline) { // hidefed2crate - _cOccupancy_FEDuTCA.fill(eid); - _cOccupancy_ElectronicsuTCA.fill(eid); - } - /* + } else { + if (_ptype != fOffline) { // hidefed2crate + _cOccupancy_FEDuTCA.fill(eid); + _cOccupancy_ElectronicsuTCA.fill(eid); + } + /* if (!it->validate(0, it->size())) _cCapIdRots_FEDuTCA.fill(eid, 1);*/ - } - - for (int i=0; i_cutSumQ_HF) - _cShapeCut_FED.fill(eid, i, constants::adc2fC[frame[i].adc()]); - } - } - - if (sumQ>_cutSumQ_HF) - { - double timing = hcaldqm::utilities::aveTS_v10(frame, 2.5, 0, - frame.samples()-1); - - _cSumQ_depth.fill(did, sumQ); - _cSumQvsLS_SubdetPM.fill(did, _currentLS, sumQ); - - _cTimingCut_SubdetPM.fill(did, timing); - _cTimingCut_depth.fill(did, timing); - if (_ptype != fOffline) { // hidefed2crate - _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); - } - _cOccupancyCut_depth.fill(did); - if (eid.isVMEid()) - { - if (_ptype != fOffline) { // hidefed2crate - _cTimingCut_FEDVME.fill(eid, timing); - _cOccupancyCut_FEDVME.fill(eid); - _cTimingCut_ElectronicsVME.fill(eid, timing); - _cOccupancyCut_ElectronicsVME.fill(eid); - } - } - else - { - if (_ptype != fOffline) { // hidefed2crate - _cTimingCut_FEDuTCA.fill(eid, timing); - _cOccupancyCut_FEDuTCA.fill(eid); - _cTimingCut_ElectronicsuTCA.fill(eid, timing); - _cOccupancyCut_ElectronicsuTCA.fill(eid); - } - } - numChsCut++; - } - numChs++; - } - - if (rawidValid!=0) - { - _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, - numChs); - - } + } + + for (int i = 0; i < frame.samples(); i++) { + _cADC_SubdetPM.fill(did, frame[i].adc()); + _cfC_SubdetPM.fill(did, constants::adc2fC[frame[i].adc()]); + if (_ptype != fOffline) { // hidefed2crate + if (sumQ > _cutSumQ_HF) + _cShapeCut_FED.fill(eid, i, constants::adc2fC[frame[i].adc()]); + } + } + + if (sumQ > _cutSumQ_HF) { + double timing = hcaldqm::utilities::aveTS_v10(frame, 2.5, 0, frame.samples() - 1); + + _cSumQ_depth.fill(did, sumQ); + _cSumQvsLS_SubdetPM.fill(did, _currentLS, sumQ); + + _cTimingCut_SubdetPM.fill(did, timing); + _cTimingCut_depth.fill(did, timing); + if (_ptype != fOffline) { // hidefed2crate + _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); + } + _cOccupancyCut_depth.fill(did); + if (eid.isVMEid()) { + if (_ptype != fOffline) { // hidefed2crate + _cTimingCut_FEDVME.fill(eid, timing); + _cOccupancyCut_FEDVME.fill(eid); + _cTimingCut_ElectronicsVME.fill(eid, timing); + _cOccupancyCut_ElectronicsVME.fill(eid); + } + } else { + if (_ptype != fOffline) { // hidefed2crate + _cTimingCut_FEDuTCA.fill(eid, timing); + _cOccupancyCut_FEDuTCA.fill(eid); + _cTimingCut_ElectronicsuTCA.fill(eid, timing); + _cOccupancyCut_ElectronicsuTCA.fill(eid); + } + } + numChsCut++; + } + numChs++; + } + + if (rawidValid != 0) { + _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, numChs); + } } -/* virtual */ void DigiPhase1Task::beginLuminosityBlock( - edm::LuminosityBlock const& lb, edm::EventSetup const& es) -{ - DQTask::beginLuminosityBlock(lb, es); +/* virtual */ void DigiPhase1Task::beginLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + DQTask::beginLuminosityBlock(lb, es); } -/* virtual */ void DigiPhase1Task::endLuminosityBlock(edm::LuminosityBlock const& lb, - edm::EventSetup const& es) -{ - DQTask::endLuminosityBlock(lb, es); +/* virtual */ void DigiPhase1Task::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + DQTask::endLuminosityBlock(lb, es); } DEFINE_FWK_MODULE(DigiPhase1Task); - diff --git a/DQM/HcalTasks/plugins/DigiTask.cc b/DQM/HcalTasks/plugins/DigiTask.cc index 3b2cbf92b746e..6940a3c57887f 100644 --- a/DQM/HcalTasks/plugins/DigiTask.cc +++ b/DQM/HcalTasks/plugins/DigiTask.cc @@ -4,1614 +4,1613 @@ using namespace hcaldqm; using namespace hcaldqm::constants; using namespace hcaldqm::filter; -DigiTask::DigiTask(edm::ParameterSet const& ps): - DQTask(ps) -{ - _tagHBHE = ps.getUntrackedParameter("tagHBHE", - edm::InputTag("hcalDigis")); - _tagHE = ps.getUntrackedParameter("tagHE", - edm::InputTag("hcalDigis")); - _tagHO = ps.getUntrackedParameter("tagHO", - edm::InputTag("hcalDigis")); - _tagHF = ps.getUntrackedParameter("tagHF", - edm::InputTag("hcalDigis")); - - _tokHBHE = consumes(_tagHBHE); - _tokHE = consumes(_tagHE); - _tokHO = consumes(_tagHO); - _tokHF = consumes(_tagHF); - - _cutSumQ_HBHE = ps.getUntrackedParameter("cutSumQ_HBHE", 20); - _cutSumQ_HE = ps.getUntrackedParameter("cutSumQ_HE", 20); - _cutSumQ_HO = ps.getUntrackedParameter("cutSumQ_HO", 20); - _cutSumQ_HF = ps.getUntrackedParameter("cutSumQ_HF", 20); - _thresh_unihf = ps.getUntrackedParameter("thresh_unihf", 0.2); - _thresh_led = ps.getUntrackedParameter("thresh_led", 20); - - _vflags.resize(nDigiFlag); - _vflags[fUni]=hcaldqm::flag::Flag("UniSlotHF"); - _vflags[fDigiSize]=hcaldqm::flag::Flag("DigiSize"); - _vflags[fNChsHF]=hcaldqm::flag::Flag("NChsHF"); - _vflags[fUnknownIds]=hcaldqm::flag::Flag("UnknownIds"); - _vflags[fLED]=hcaldqm::flag::Flag("LEDMisfire"); - _vflags[fCapId]=hcaldqm::flag::Flag("BadCapId"); - - _qie10InConditions = ps.getUntrackedParameter("qie10InConditions", true); - - // Get reference digi sizes. Convert from unsigned to signed int, because ::size()/samples() return ints for some reason. - std::vector vrefDigiSize = ps.getUntrackedParameter>("refDigiSize"); - _refDigiSize[HcalBarrel] = (int)vrefDigiSize[0]; - _refDigiSize[HcalEndcap] = (int)vrefDigiSize[1]; - _refDigiSize[HcalOuter] = (int)vrefDigiSize[2]; - _refDigiSize[HcalForward] = (int)vrefDigiSize[3]; - - // (capid - BX) % 4 to 1 - _capidmbx[HcalBarrel] = 1; - _capidmbx[HcalEndcap] = 1; - _capidmbx[HcalOuter] = 1; - _capidmbx[HcalForward] = 1; - - // LED calibration channels - std::vector vLedCalibChannels = ps.getParameter>("ledCalibrationChannels"); - for (int i = 0; i <= 3; ++i) { - HcalSubdetector this_subdet = HcalEmpty; - switch (i) { - case 0: - this_subdet = HcalBarrel; - break; - case 1: - this_subdet = HcalEndcap; - break; - case 2: - this_subdet = HcalOuter; - break; - case 3: - this_subdet = HcalForward; - break; - default: - this_subdet = HcalEmpty; - break; - } - std::vector subdet_calib_ietas = vLedCalibChannels[i].getUntrackedParameter>("ieta"); - std::vector subdet_calib_iphis = vLedCalibChannels[i].getUntrackedParameter>("iphi"); - std::vector subdet_calib_depths = vLedCalibChannels[i].getUntrackedParameter>("depth"); - for (unsigned int ichannel = 0; ichannel < subdet_calib_ietas.size(); ++ichannel) { - _ledCalibrationChannels[this_subdet].push_back(HcalDetId(HcalOther, subdet_calib_ietas[ichannel], subdet_calib_iphis[ichannel], subdet_calib_depths[ichannel])); - } - } +DigiTask::DigiTask(edm::ParameterSet const& ps) : DQTask(ps) { + _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); + _tagHE = ps.getUntrackedParameter("tagHE", edm::InputTag("hcalDigis")); + _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); + _tagHF = ps.getUntrackedParameter("tagHF", edm::InputTag("hcalDigis")); + + _tokHBHE = consumes(_tagHBHE); + _tokHE = consumes(_tagHE); + _tokHO = consumes(_tagHO); + _tokHF = consumes(_tagHF); + + _cutSumQ_HBHE = ps.getUntrackedParameter("cutSumQ_HBHE", 20); + _cutSumQ_HE = ps.getUntrackedParameter("cutSumQ_HE", 20); + _cutSumQ_HO = ps.getUntrackedParameter("cutSumQ_HO", 20); + _cutSumQ_HF = ps.getUntrackedParameter("cutSumQ_HF", 20); + _thresh_unihf = ps.getUntrackedParameter("thresh_unihf", 0.2); + _thresh_led = ps.getUntrackedParameter("thresh_led", 20); + + _vflags.resize(nDigiFlag); + _vflags[fUni] = hcaldqm::flag::Flag("UniSlotHF"); + _vflags[fDigiSize] = hcaldqm::flag::Flag("DigiSize"); + _vflags[fNChsHF] = hcaldqm::flag::Flag("NChsHF"); + _vflags[fUnknownIds] = hcaldqm::flag::Flag("UnknownIds"); + _vflags[fLED] = hcaldqm::flag::Flag("LEDMisfire"); + _vflags[fCapId] = hcaldqm::flag::Flag("BadCapId"); + + _qie10InConditions = ps.getUntrackedParameter("qie10InConditions", true); + + // Get reference digi sizes. Convert from unsigned to signed int, because ::size()/samples() return ints for some reason. + std::vector vrefDigiSize = ps.getUntrackedParameter>("refDigiSize"); + _refDigiSize[HcalBarrel] = (int)vrefDigiSize[0]; + _refDigiSize[HcalEndcap] = (int)vrefDigiSize[1]; + _refDigiSize[HcalOuter] = (int)vrefDigiSize[2]; + _refDigiSize[HcalForward] = (int)vrefDigiSize[3]; + + // (capid - BX) % 4 to 1 + _capidmbx[HcalBarrel] = 1; + _capidmbx[HcalEndcap] = 1; + _capidmbx[HcalOuter] = 1; + _capidmbx[HcalForward] = 1; + + // LED calibration channels + std::vector vLedCalibChannels = + ps.getParameter>("ledCalibrationChannels"); + for (int i = 0; i <= 3; ++i) { + HcalSubdetector this_subdet = HcalEmpty; + switch (i) { + case 0: + this_subdet = HcalBarrel; + break; + case 1: + this_subdet = HcalEndcap; + break; + case 2: + this_subdet = HcalOuter; + break; + case 3: + this_subdet = HcalForward; + break; + default: + this_subdet = HcalEmpty; + break; + } + std::vector subdet_calib_ietas = vLedCalibChannels[i].getUntrackedParameter>("ieta"); + std::vector subdet_calib_iphis = vLedCalibChannels[i].getUntrackedParameter>("iphi"); + std::vector subdet_calib_depths = + vLedCalibChannels[i].getUntrackedParameter>("depth"); + for (unsigned int ichannel = 0; ichannel < subdet_calib_ietas.size(); ++ichannel) { + _ledCalibrationChannels[this_subdet].push_back(HcalDetId( + HcalOther, subdet_calib_ietas[ichannel], subdet_calib_iphis[ichannel], subdet_calib_depths[ichannel])); + } + } } -/* virtual */ void DigiTask::bookHistograms(DQMStore::IBooker& ib, - edm::Run const& r, edm::EventSetup const& es) -{ - DQTask::bookHistograms(ib,r,es); - - // GET WHAT YOU NEED - edm::ESHandle dbs; - es.get().get(dbs); - _emap = dbs->getHcalMapping(); - std::vector vVME; - std::vector vuTCA; - vVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); - vuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vVME); - _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vuTCA); - - // Filters for QIE8 vs QIE10/11 - std::vector vhashQIE1011; - vhashQIE1011.push_back(hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalEndcap, 20,1,1))); - vhashQIE1011.push_back(hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalForward, 29,1,1))); - _filter_QIE1011.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdet, - vhashQIE1011); - _filter_QIE8.initialize(filter::fFilter, hcaldqm::hashfunctions::fSubdet, - vhashQIE1011); - - // INITIALIZE FIRST - _cADC_SubdetPM.initialize(_name, "ADC", hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_128), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cfC_SubdetPM.initialize(_name, "fC", hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cSumQ_SubdetPM.initialize(_name, "SumQ", hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cSumQ_depth.initialize(_name, "SumQ", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_400000, true),0); - _cSumQvsLS_SubdetPM.initialize(_name, "SumQvsLS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),0); - - _cADC_SubdetPM_QIE1011.initialize(_name, "ADC", hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cfC_SubdetPM_QIE1011.initialize(_name, "fC", hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cSumQ_SubdetPM_QIE1011.initialize(_name, "SumQ", hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cSumQvsLS_SubdetPM_QIE1011.initialize(_name, "SumQvsLS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000),0); - - _cTimingCut_SubdetPM.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cTimingCut_depth.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingCutvsLS_SubdetPM.initialize(_name, "TimingvsLS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - - // Occupancy w/o a cut - _cOccupancyvsLS_Subdet.initialize(_name, "OccupancyvsLS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),0); - _cOccupancy_depth.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - // Occupancy w/ a cut - _cOccupancyCutvsLS_Subdet.initialize(_name, "OccupancyCutvsLS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),0); - _cOccupancyCut_depth.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - // Digi size - _cDigiSize_Crate.initialize(_name, "DigiSize", - hcaldqm::hashfunctions::fCrate, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDigiSize), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cADCvsTS_SubdetPM.initialize(_name, "ADCvsTS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_128), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cADCvsTS_SubdetPM_QIE1011.initialize(_name, "ADCvsTS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - _cLETDCTimevsADC_SubdetPM.initialize(_name, "LETDCTimevsADC", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250_coarse), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cLETDCvsADC_SubdetPM.initialize(_name, "LETDCvsADC", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cLETDCvsTS_SubdetPM.initialize(_name, "LETDCvsTS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cLETDCTime_SubdetPM.initialize(_name, "LETDCTime", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cLETDCTime_depth.initialize(_name, "LETDCTime", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - _cBadTDCValues_SubdetPM.initialize(_name, "BadTDCValues", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBadTDC), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cBadTDCvsBX_SubdetPM.initialize(_name, "BadTDCvsBX", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cBadTDCvsLS_SubdetPM.initialize(_name, "BadTDCvsLS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cBadTDCCount_depth.initialize(_name, "BadTDCCount", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - if (_ptype == fOnline || _ptype == fLocal) { - _cOccupancy_Crate.initialize(_name, - "Occupancy", hashfunctions::fCrate, - new quantity::ElectronicsQuantity(quantity::fSlotuTCA), - new quantity::ElectronicsQuantity(quantity::fFiberuTCAFiberCh), - new quantity::ValueQuantity(quantity::fN),0); - _cOccupancy_CrateSlot.initialize(_name, - "Occupancy", hashfunctions::fCrateSlot, - new quantity::ElectronicsQuantity(quantity::fFiberuTCA), - new quantity::ElectronicsQuantity(quantity::fFiberCh), - new quantity::ValueQuantity(quantity::fN),0); - } - - // INITIALIZE HISTOGRAMS that are only for Online - if (_ptype==fOnline) - { - // Charge sharing - _cQ2Q12CutvsLS_FEDHF.initialize(_name, "Q2Q12vsLS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio_0to2),0); - _cSumQvsBX_SubdetPM.initialize(_name, "SumQvsBX", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),0); - _cSumQvsBX_SubdetPM_QIE1011.initialize(_name, "SumQvsBX", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_10000),0); - _cDigiSizevsLS_FED.initialize(_name, "DigiSizevsLS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDigiSize),0); - _cTimingCutvsiphi_SubdetPM.initialize(_name, "TimingCutvsiphi", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingCutvsieta_Subdet.initialize(_name, "TimingCutvsieta", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cOccupancyvsiphi_SubdetPM.initialize(_name, "Occupancyvsiphi", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyvsieta_Subdet.initialize(_name, "Occupancyvsieta", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCutvsiphi_SubdetPM.initialize(_name, "OccupancyCutvsiphi", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCutvsieta_Subdet.initialize(_name, "OccupancyCutvsieta", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCutvsLS_Subdet.initialize(_name, "OccupancyCutvsLS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),0); - _cOccupancyCutvsBX_Subdet.initialize(_name, "OccupancyCutvsBX", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),0); -// _cOccupancyCutvsSlotvsLS_HFPM.initialize(_name, -// "OccupancyCutvsSlotvsLS", hcaldqm::hashfunctions::fSubdetPM, -// new hcaldqm::quantity::LumiSection(_maxLS), -// new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), -// new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCutvsiphivsLS_SubdetPM.initialize(_name, - "OccupancyCutvsiphivsLS", hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - } - _cCapidMinusBXmod4_SubdetPM.initialize(_name, - "CapID", hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fCapidMinusBXmod4), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - - for (int i = 0; i < 4; ++i) { - _cCapidMinusBXmod4_CrateSlotuTCA[i].initialize(_name, "CapID", - new quantity::ElectronicsQuantity(quantity::fCrateuTCA), - new quantity::ElectronicsQuantity(quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cCapidMinusBXmod4_CrateSlotVME[i].initialize(_name, "CapID", - new quantity::ElectronicsQuantity(quantity::fCrateVME), - new quantity::ElectronicsQuantity(quantity::fSlotVME), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - } - - if (_ptype != fOffline) { // hidefed2crate - std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); - std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); - std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); - - if (_ptype == fOnline) { - _cCapid_BadvsFEDvsLS.initialize(_name, "CapID", - new hcaldqm::quantity::LumiSectionCoarse(_maxLS, 10), - new hcaldqm::quantity::FEDQuantity(vFEDs), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - - _cCapid_BadvsFEDvsLSmod60.initialize(_name, "CapID", - new hcaldqm::quantity::LumiSection(60), - new hcaldqm::quantity::FEDQuantity(vFEDs), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - } - - std::vector vFEDHF; - vFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN+6, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN+6, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN+6, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - - // initialize filters - _filter_FEDHF.initialize(filter::fPreserver, hcaldqm::hashfunctions::fFED, - vFEDHF); - - // push the rawIds of each fed into the vector... - for (std::vector::const_iterator it=vFEDsVME.begin(); - it!=vFEDsVME.end(); ++it) - _vhashFEDs.push_back(HcalElectronicsId( - constants::FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, - (*it)-FED_VME_MIN).rawId()); - for (std::vector::const_iterator it=vFEDsuTCA.begin(); - it!=vFEDsuTCA.end(); ++it) - { - std::pair cspair = utilities::fed2crate(*it); - _vhashFEDs.push_back(HcalElectronicsId( - cspair.first, cspair.second, FIBER_uTCA_MIN1, - FIBERCH_MIN, false).rawId()); - } - - _cShapeCut_FED.initialize(_name, "ShapeCut", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),0); - - _cTimingCut_FEDVME.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingCut_FEDuTCA.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingCut_ElectronicsVME.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingCut_ElectronicsuTCA.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingCutvsLS_FED.initialize(_name, "TimingvsLS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - - _cOccupancy_FEDVME.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancy_FEDuTCA.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancy_ElectronicsVME.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancy_ElectronicsuTCA.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - _cOccupancyCut_FEDVME.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCut_FEDuTCA.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCut_ElectronicsVME.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCut_ElectronicsuTCA.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - _cDigiSize_FED.initialize(_name, "DigiSize", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDigiSize), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - if (_ptype == fOnline) { - _cSummaryvsLS_FED.initialize(_name, "SummaryvsLS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::FlagQuantity(_vflags), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),0); - _cSummaryvsLS.initialize(_name, "SummaryvsLS", - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::FEDQuantity(vFEDs), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),0); - - _xUniHF.initialize(hcaldqm::hashfunctions::fFEDSlot); - _xUni.initialize(hcaldqm::hashfunctions::fFED); - _xDigiSize.initialize(hcaldqm::hashfunctions::fFED); - _xNChs.initialize(hcaldqm::hashfunctions::fFED); - _xNChsNominal.initialize(hcaldqm::hashfunctions::fFED); - _xBadCapid.initialize(hcaldqm::hashfunctions::fFED); - } - } - if (_ptype != fLocal) { - _LED_ADCvsBX_Subdet.initialize(_name, "LED_ADCvsBX", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX_36), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_256_4), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - _LED_CUCountvsLS_Subdet.initialize(_name, "LED_CUCountvsLS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - if (_ptype == fOnline) { - _LED_CUCountvsLSmod60_Subdet.initialize(_name, "LED_CUCountvsLSmod60", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::LumiSection(60), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - } - } - - // BOOK HISTOGRAMS - char cutstr[200]; - sprintf(cutstr, "_SumQHBHE%dHO%dHF%d", int(_cutSumQ_HBHE), - int(_cutSumQ_HO), int(_cutSumQ_HF)); - char cutstr2[200]; - sprintf(cutstr2, "_SumQHF%d", int(_cutSumQ_HF)); - - _cADC_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); - _cADC_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); - _cfC_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); - _cfC_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); - _cSumQ_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); - _cSumQ_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); - _cSumQ_depth.book(ib, _emap, _subsystem); - _cSumQvsLS_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); - _cSumQvsLS_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); - _cDigiSize_Crate.book(ib, _emap, _subsystem); - _cADCvsTS_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); - _cADCvsTS_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); - - if (_ptype != fOffline) { // hidefed2crate - _cShapeCut_FED.book(ib, _emap, _subsystem); - _cTimingCut_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cTimingCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cTimingCut_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cTimingCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cTimingCutvsLS_FED.book(ib, _emap, _subsystem); - _cOccupancy_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cOccupancy_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cOccupancy_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cOccupancy_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cOccupancyCut_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cOccupancyCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cOccupancyCut_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cOccupancyCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cDigiSize_FED.book(ib, _emap, _subsystem); - } - - _cTimingCut_SubdetPM.book(ib, _emap, _subsystem); - _cTimingCut_depth.book(ib, _emap, _subsystem); - _cTimingCutvsLS_SubdetPM.book(ib, _emap, _subsystem); - - _cOccupancyvsLS_Subdet.book(ib, _emap, _subsystem); - _cOccupancy_depth.book(ib, _emap, _subsystem); - _cOccupancyCut_depth.book(ib, _emap, _subsystem); - - _cLETDCTimevsADC_SubdetPM.book(ib, _emap, _subsystem); - _cLETDCvsADC_SubdetPM.book(ib, _emap, _subsystem); - _cLETDCvsTS_SubdetPM.book(ib, _emap, _subsystem); - _cLETDCTime_SubdetPM.book(ib, _emap, _subsystem); - _cLETDCTime_depth.book(ib, _emap, _subsystem); - - _cBadTDCValues_SubdetPM.book(ib, _emap, _subsystem); - _cBadTDCvsBX_SubdetPM.book(ib, _emap, _subsystem); - _cBadTDCvsLS_SubdetPM.book(ib, _emap, _subsystem); - _cBadTDCCount_depth.book(ib, _emap, _subsystem); - - _cCapidMinusBXmod4_SubdetPM.book(ib, _emap, _subsystem); - if (_ptype == fOnline) { - _cCapid_BadvsFEDvsLS.book(ib, _subsystem, "BadvsLS"); - _cCapid_BadvsFEDvsLSmod60.book(ib, _subsystem, "BadvsLSmod60"); - } - for (int i = 0; i < 4; ++i) { - constexpr unsigned int kSize=16; - char aux[kSize]; - snprintf(aux, kSize, "%d_uTCA", i); - _cCapidMinusBXmod4_CrateSlotuTCA[i].book(ib, _subsystem, aux); - - snprintf(aux, kSize, "%d_VME", i); - _cCapidMinusBXmod4_CrateSlotVME[i].book(ib, _subsystem, aux); - } - - if (_ptype != fLocal) { - _LED_ADCvsBX_Subdet.book(ib, _emap, _subsystem); - _LED_CUCountvsLS_Subdet.book(ib, _emap, _subsystem); - if (_ptype == fOnline) { - _LED_CUCountvsLSmod60_Subdet.book(ib, _emap, _subsystem); - } - } - - // BOOK HISTOGRAMS that are only for Online - _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); - _dhashmap.initialize(_emap, electronicsmap::fE2DHashMap); - - if (_ptype == fOnline || _ptype == fLocal) { - _cOccupancy_Crate.book(ib, _emap, _subsystem); - _cOccupancy_CrateSlot.book(ib, _emap, _subsystem); - } - - if (_ptype==fOnline) - { - _cQ2Q12CutvsLS_FEDHF.book(ib, _emap, _filter_FEDHF, _subsystem); - _cSumQvsBX_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); - _cSumQvsBX_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); - _cDigiSizevsLS_FED.book(ib, _emap, _subsystem); - _cTimingCutvsiphi_SubdetPM.book(ib, _emap, _subsystem); - _cTimingCutvsieta_Subdet.book(ib, _emap, _subsystem); - _cOccupancyCutvsLS_Subdet.book(ib, _emap, _subsystem); - _cOccupancyCutvsBX_Subdet.book(ib, _emap, _subsystem); - _cOccupancyvsiphi_SubdetPM.book(ib, _emap, _subsystem); - _cOccupancyvsieta_Subdet.book(ib, _emap, _subsystem); - _cOccupancyCutvsiphi_SubdetPM.book(ib, _emap, _subsystem); - _cOccupancyCutvsieta_Subdet.book(ib, _emap, _subsystem); -// _cOccupancyCutvsSlotvsLS_HFPM.book(ib, _emap, _filter_QIE1011, _subsystem); - _cOccupancyCutvsiphivsLS_SubdetPM.book(ib, _emap, _subsystem); - _cSummaryvsLS_FED.book(ib, _emap, _subsystem); - _cSummaryvsLS.book(ib, _subsystem); - - _xUniHF.book(_emap, _filter_FEDHF); - _xNChs.book(_emap); - _xNChsNominal.book(_emap); - _xUni.book(_emap); - _xDigiSize.book(_emap); - _xBadCapid.book(_emap); - - // just PER HF FED RECORD THE #CHANNELS - // ONLY WAY TO DO THAT AUTOMATICALLY AND W/O HARDCODING 1728 - // or ANY OTHER VALUES LIKE 2592, 2192 - std::vector gids = _emap->allPrecisionId(); - for (std::vector::const_iterator it=gids.begin(); - it!=gids.end(); ++it) - { - if (!it->isHcalDetId()) - continue; - HcalDetId did(it->rawId()); - if (_xQuality.exists(did)) - { - HcalChannelStatus cs(it->rawId(), _xQuality.get( - HcalDetId(*it))); - if ( - cs.isBitSet(HcalChannelStatus::HcalCellMask) || - cs.isBitSet(HcalChannelStatus::HcalCellDead)) - continue; - } - HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); - _xNChsNominal.get(eid)++; // he will know the nominal #channels per FED - } - } - - // MARK THESE HISTOGRAMS AS LUMI BASED FOR OFFLINE PROCESSING - if (_ptype==fOffline) - { - _cDigiSize_Crate.setLumiFlag(); - //_cDigiSize_FED.setLumiFlag(); - _cOccupancy_depth.setLumiFlag(); - } - - // book Number of Events vs LS histogram - ib.setCurrentFolder(_subsystem+"/RunInfo"); - meNumEvents1LS = ib.book1D("NumberOfEvents", "NumberOfEvents", - 1, 0, 1); - meNumEvents1LS->setLumiFlag(); - - // book the flag for unknown ids and the online guy as well - ib.setCurrentFolder(_subsystem+"/"+_name); - meUnknownIds1LS = ib.book1D("UnknownIds", "UnknownIds", - 1, 0, 1); - _unknownIdsPresent = false; - meUnknownIds1LS->setLumiFlag(); - +/* virtual */ void DigiTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + DQTask::bookHistograms(ib, r, es); + + // GET WHAT YOU NEED + edm::ESHandle dbs; + es.get().get(dbs); + _emap = dbs->getHcalMapping(); + std::vector vVME; + std::vector vuTCA; + vVME.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); + vuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vVME); + _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vuTCA); + + // Filters for QIE8 vs QIE10/11 + std::vector vhashQIE1011; + vhashQIE1011.push_back( + hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalEndcap, 20, 1, 1))); + vhashQIE1011.push_back( + hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalForward, 29, 1, 1))); + _filter_QIE1011.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdet, vhashQIE1011); + _filter_QIE8.initialize(filter::fFilter, hcaldqm::hashfunctions::fSubdet, vhashQIE1011); + + // INITIALIZE FIRST + _cADC_SubdetPM.initialize(_name, + "ADC", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_128), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cfC_SubdetPM.initialize(_name, + "fC", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cSumQ_SubdetPM.initialize(_name, + "SumQ", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cSumQ_depth.initialize(_name, + "SumQ", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_400000, true), + 0); + _cSumQvsLS_SubdetPM.initialize(_name, + "SumQvsLS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000), + 0); + + _cADC_SubdetPM_QIE1011.initialize(_name, + "ADC", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cfC_SubdetPM_QIE1011.initialize(_name, + "fC", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cSumQ_SubdetPM_QIE1011.initialize(_name, + "SumQ", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cSumQvsLS_SubdetPM_QIE1011.initialize(_name, + "SumQvsLS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000), + 0); + + _cTimingCut_SubdetPM.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cTimingCut_depth.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingCutvsLS_SubdetPM.initialize(_name, + "TimingvsLS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + + // Occupancy w/o a cut + _cOccupancyvsLS_Subdet.initialize(_name, + "OccupancyvsLS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000), + 0); + _cOccupancy_depth.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + // Occupancy w/ a cut + _cOccupancyCutvsLS_Subdet.initialize(_name, + "OccupancyCutvsLS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000), + 0); + _cOccupancyCut_depth.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + // Digi size + _cDigiSize_Crate.initialize(_name, + "DigiSize", + hcaldqm::hashfunctions::fCrate, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDigiSize), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cADCvsTS_SubdetPM.initialize(_name, + "ADCvsTS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_128), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cADCvsTS_SubdetPM_QIE1011.initialize(_name, + "ADCvsTS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cLETDCTimevsADC_SubdetPM.initialize(_name, + "LETDCTimevsADC", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250_coarse), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + _cLETDCvsADC_SubdetPM.initialize(_name, + "LETDCvsADC", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + _cLETDCvsTS_SubdetPM.initialize(_name, + "LETDCvsTS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + _cLETDCTime_SubdetPM.initialize(_name, + "LETDCTime", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + _cLETDCTime_depth.initialize(_name, + "LETDCTime", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cBadTDCValues_SubdetPM.initialize(_name, + "BadTDCValues", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBadTDC), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + _cBadTDCvsBX_SubdetPM.initialize(_name, + "BadTDCvsBX", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + _cBadTDCvsLS_SubdetPM.initialize(_name, + "BadTDCvsLS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + _cBadTDCCount_depth.initialize(_name, + "BadTDCCount", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + if (_ptype == fOnline || _ptype == fLocal) { + _cOccupancy_Crate.initialize(_name, + "Occupancy", + hashfunctions::fCrate, + new quantity::ElectronicsQuantity(quantity::fSlotuTCA), + new quantity::ElectronicsQuantity(quantity::fFiberuTCAFiberCh), + new quantity::ValueQuantity(quantity::fN), + 0); + _cOccupancy_CrateSlot.initialize(_name, + "Occupancy", + hashfunctions::fCrateSlot, + new quantity::ElectronicsQuantity(quantity::fFiberuTCA), + new quantity::ElectronicsQuantity(quantity::fFiberCh), + new quantity::ValueQuantity(quantity::fN), + 0); + } + + // INITIALIZE HISTOGRAMS that are only for Online + if (_ptype == fOnline) { + // Charge sharing + _cQ2Q12CutvsLS_FEDHF.initialize(_name, + "Q2Q12vsLS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio_0to2), + 0); + _cSumQvsBX_SubdetPM.initialize(_name, + "SumQvsBX", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000), + 0); + _cSumQvsBX_SubdetPM_QIE1011.initialize(_name, + "SumQvsBX", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_10000), + 0); + _cDigiSizevsLS_FED.initialize(_name, + "DigiSizevsLS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDigiSize), + 0); + _cTimingCutvsiphi_SubdetPM.initialize(_name, + "TimingCutvsiphi", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingCutvsieta_Subdet.initialize(_name, + "TimingCutvsieta", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cOccupancyvsiphi_SubdetPM.initialize(_name, + "Occupancyvsiphi", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyvsieta_Subdet.initialize(_name, + "Occupancyvsieta", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCutvsiphi_SubdetPM.initialize(_name, + "OccupancyCutvsiphi", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCutvsieta_Subdet.initialize(_name, + "OccupancyCutvsieta", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCutvsLS_Subdet.initialize(_name, + "OccupancyCutvsLS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000), + 0); + _cOccupancyCutvsBX_Subdet.initialize(_name, + "OccupancyCutvsBX", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000), + 0); + // _cOccupancyCutvsSlotvsLS_HFPM.initialize(_name, + // "OccupancyCutvsSlotvsLS", hcaldqm::hashfunctions::fSubdetPM, + // new hcaldqm::quantity::LumiSection(_maxLS), + // new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + // new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); + _cOccupancyCutvsiphivsLS_SubdetPM.initialize(_name, + "OccupancyCutvsiphivsLS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + } + _cCapidMinusBXmod4_SubdetPM.initialize(_name, + "CapID", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fCapidMinusBXmod4), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + + for (int i = 0; i < 4; ++i) { + _cCapidMinusBXmod4_CrateSlotuTCA[i].initialize(_name, + "CapID", + new quantity::ElectronicsQuantity(quantity::fCrateuTCA), + new quantity::ElectronicsQuantity(quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cCapidMinusBXmod4_CrateSlotVME[i].initialize(_name, + "CapID", + new quantity::ElectronicsQuantity(quantity::fCrateVME), + new quantity::ElectronicsQuantity(quantity::fSlotVME), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + } + + if (_ptype != fOffline) { // hidefed2crate + std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); + std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); + std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); + + if (_ptype == fOnline) { + _cCapid_BadvsFEDvsLS.initialize(_name, + "CapID", + new hcaldqm::quantity::LumiSectionCoarse(_maxLS, 10), + new hcaldqm::quantity::FEDQuantity(vFEDs), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + + _cCapid_BadvsFEDvsLSmod60.initialize(_name, + "CapID", + new hcaldqm::quantity::LumiSection(60), + new hcaldqm::quantity::FEDQuantity(vFEDs), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + } + + std::vector vFEDHF; + vFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + + // initialize filters + _filter_FEDHF.initialize(filter::fPreserver, hcaldqm::hashfunctions::fFED, vFEDHF); + + // push the rawIds of each fed into the vector... + for (std::vector::const_iterator it = vFEDsVME.begin(); it != vFEDsVME.end(); ++it) + _vhashFEDs.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, (*it) - FED_VME_MIN).rawId()); + for (std::vector::const_iterator it = vFEDsuTCA.begin(); it != vFEDsuTCA.end(); ++it) { + std::pair cspair = utilities::fed2crate(*it); + _vhashFEDs.push_back(HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + } + + _cShapeCut_FED.initialize(_name, + "ShapeCut", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000), + 0); + + _cTimingCut_FEDVME.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingCut_FEDuTCA.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingCut_ElectronicsVME.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingCut_ElectronicsuTCA.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingCutvsLS_FED.initialize(_name, + "TimingvsLS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + + _cOccupancy_FEDVME.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancy_FEDuTCA.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancy_ElectronicsVME.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancy_ElectronicsuTCA.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cOccupancyCut_FEDVME.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCut_FEDuTCA.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCut_ElectronicsVME.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCut_ElectronicsuTCA.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cDigiSize_FED.initialize(_name, + "DigiSize", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDigiSize), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + if (_ptype == fOnline) { + _cSummaryvsLS_FED.initialize(_name, + "SummaryvsLS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::FlagQuantity(_vflags), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState), + 0); + _cSummaryvsLS.initialize(_name, + "SummaryvsLS", + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::FEDQuantity(vFEDs), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState), + 0); + + _xUniHF.initialize(hcaldqm::hashfunctions::fFEDSlot); + _xUni.initialize(hcaldqm::hashfunctions::fFED); + _xDigiSize.initialize(hcaldqm::hashfunctions::fFED); + _xNChs.initialize(hcaldqm::hashfunctions::fFED); + _xNChsNominal.initialize(hcaldqm::hashfunctions::fFED); + _xBadCapid.initialize(hcaldqm::hashfunctions::fFED); + } + } + if (_ptype != fLocal) { + _LED_ADCvsBX_Subdet.initialize(_name, + "LED_ADCvsBX", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX_36), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_256_4), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _LED_CUCountvsLS_Subdet.initialize(_name, + "LED_CUCountvsLS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + if (_ptype == fOnline) { + _LED_CUCountvsLSmod60_Subdet.initialize(_name, + "LED_CUCountvsLSmod60", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::LumiSection(60), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + } + } + + // BOOK HISTOGRAMS + char cutstr[200]; + sprintf(cutstr, "_SumQHBHE%dHO%dHF%d", int(_cutSumQ_HBHE), int(_cutSumQ_HO), int(_cutSumQ_HF)); + char cutstr2[200]; + sprintf(cutstr2, "_SumQHF%d", int(_cutSumQ_HF)); + + _cADC_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cADC_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); + _cfC_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cfC_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); + _cSumQ_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cSumQ_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); + _cSumQ_depth.book(ib, _emap, _subsystem); + _cSumQvsLS_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cSumQvsLS_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); + _cDigiSize_Crate.book(ib, _emap, _subsystem); + _cADCvsTS_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cADCvsTS_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); + + if (_ptype != fOffline) { // hidefed2crate + _cShapeCut_FED.book(ib, _emap, _subsystem); + _cTimingCut_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cTimingCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cTimingCut_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cTimingCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cTimingCutvsLS_FED.book(ib, _emap, _subsystem); + _cOccupancy_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancy_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cOccupancy_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancy_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cOccupancyCut_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancyCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cOccupancyCut_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancyCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cDigiSize_FED.book(ib, _emap, _subsystem); + } + + _cTimingCut_SubdetPM.book(ib, _emap, _subsystem); + _cTimingCut_depth.book(ib, _emap, _subsystem); + _cTimingCutvsLS_SubdetPM.book(ib, _emap, _subsystem); + + _cOccupancyvsLS_Subdet.book(ib, _emap, _subsystem); + _cOccupancy_depth.book(ib, _emap, _subsystem); + _cOccupancyCut_depth.book(ib, _emap, _subsystem); + + _cLETDCTimevsADC_SubdetPM.book(ib, _emap, _subsystem); + _cLETDCvsADC_SubdetPM.book(ib, _emap, _subsystem); + _cLETDCvsTS_SubdetPM.book(ib, _emap, _subsystem); + _cLETDCTime_SubdetPM.book(ib, _emap, _subsystem); + _cLETDCTime_depth.book(ib, _emap, _subsystem); + + _cBadTDCValues_SubdetPM.book(ib, _emap, _subsystem); + _cBadTDCvsBX_SubdetPM.book(ib, _emap, _subsystem); + _cBadTDCvsLS_SubdetPM.book(ib, _emap, _subsystem); + _cBadTDCCount_depth.book(ib, _emap, _subsystem); + + _cCapidMinusBXmod4_SubdetPM.book(ib, _emap, _subsystem); + if (_ptype == fOnline) { + _cCapid_BadvsFEDvsLS.book(ib, _subsystem, "BadvsLS"); + _cCapid_BadvsFEDvsLSmod60.book(ib, _subsystem, "BadvsLSmod60"); + } + for (int i = 0; i < 4; ++i) { + constexpr unsigned int kSize = 16; + char aux[kSize]; + snprintf(aux, kSize, "%d_uTCA", i); + _cCapidMinusBXmod4_CrateSlotuTCA[i].book(ib, _subsystem, aux); + + snprintf(aux, kSize, "%d_VME", i); + _cCapidMinusBXmod4_CrateSlotVME[i].book(ib, _subsystem, aux); + } + + if (_ptype != fLocal) { + _LED_ADCvsBX_Subdet.book(ib, _emap, _subsystem); + _LED_CUCountvsLS_Subdet.book(ib, _emap, _subsystem); + if (_ptype == fOnline) { + _LED_CUCountvsLSmod60_Subdet.book(ib, _emap, _subsystem); + } + } + + // BOOK HISTOGRAMS that are only for Online + _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); + _dhashmap.initialize(_emap, electronicsmap::fE2DHashMap); + + if (_ptype == fOnline || _ptype == fLocal) { + _cOccupancy_Crate.book(ib, _emap, _subsystem); + _cOccupancy_CrateSlot.book(ib, _emap, _subsystem); + } + + if (_ptype == fOnline) { + _cQ2Q12CutvsLS_FEDHF.book(ib, _emap, _filter_FEDHF, _subsystem); + _cSumQvsBX_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem); + _cSumQvsBX_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem); + _cDigiSizevsLS_FED.book(ib, _emap, _subsystem); + _cTimingCutvsiphi_SubdetPM.book(ib, _emap, _subsystem); + _cTimingCutvsieta_Subdet.book(ib, _emap, _subsystem); + _cOccupancyCutvsLS_Subdet.book(ib, _emap, _subsystem); + _cOccupancyCutvsBX_Subdet.book(ib, _emap, _subsystem); + _cOccupancyvsiphi_SubdetPM.book(ib, _emap, _subsystem); + _cOccupancyvsieta_Subdet.book(ib, _emap, _subsystem); + _cOccupancyCutvsiphi_SubdetPM.book(ib, _emap, _subsystem); + _cOccupancyCutvsieta_Subdet.book(ib, _emap, _subsystem); + // _cOccupancyCutvsSlotvsLS_HFPM.book(ib, _emap, _filter_QIE1011, _subsystem); + _cOccupancyCutvsiphivsLS_SubdetPM.book(ib, _emap, _subsystem); + _cSummaryvsLS_FED.book(ib, _emap, _subsystem); + _cSummaryvsLS.book(ib, _subsystem); + + _xUniHF.book(_emap, _filter_FEDHF); + _xNChs.book(_emap); + _xNChsNominal.book(_emap); + _xUni.book(_emap); + _xDigiSize.book(_emap); + _xBadCapid.book(_emap); + + // just PER HF FED RECORD THE #CHANNELS + // ONLY WAY TO DO THAT AUTOMATICALLY AND W/O HARDCODING 1728 + // or ANY OTHER VALUES LIKE 2592, 2192 + std::vector gids = _emap->allPrecisionId(); + for (std::vector::const_iterator it = gids.begin(); it != gids.end(); ++it) { + if (!it->isHcalDetId()) + continue; + HcalDetId did(it->rawId()); + if (_xQuality.exists(did)) { + HcalChannelStatus cs(it->rawId(), _xQuality.get(HcalDetId(*it))); + if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead)) + continue; + } + HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); + _xNChsNominal.get(eid)++; // he will know the nominal #channels per FED + } + } + + // MARK THESE HISTOGRAMS AS LUMI BASED FOR OFFLINE PROCESSING + if (_ptype == fOffline) { + _cDigiSize_Crate.setLumiFlag(); + //_cDigiSize_FED.setLumiFlag(); + _cOccupancy_depth.setLumiFlag(); + } + + // book Number of Events vs LS histogram + ib.setCurrentFolder(_subsystem + "/RunInfo"); + meNumEvents1LS = ib.book1D("NumberOfEvents", "NumberOfEvents", 1, 0, 1); + meNumEvents1LS->setLumiFlag(); + + // book the flag for unknown ids and the online guy as well + ib.setCurrentFolder(_subsystem + "/" + _name); + meUnknownIds1LS = ib.book1D("UnknownIds", "UnknownIds", 1, 0, 1); + _unknownIdsPresent = false; + meUnknownIds1LS->setLumiFlag(); } -/* virtual */ void DigiTask::_resetMonitors(hcaldqm::UpdateFreq uf) -{ - DQTask::_resetMonitors(uf); - - switch(uf) - { - case hcaldqm::f1LS: - _unknownIdsPresent = false; - break; - case hcaldqm::f50LS: - // ^^^ONLINE ONLY! - if (_ptype==fOnline) - _cOccupancyvsiphi_SubdetPM.reset(); - // ^^^ - break; - default: - break; - } +/* virtual */ void DigiTask::_resetMonitors(hcaldqm::UpdateFreq uf) { + DQTask::_resetMonitors(uf); + + switch (uf) { + case hcaldqm::f1LS: + _unknownIdsPresent = false; + break; + case hcaldqm::f50LS: + // ^^^ONLINE ONLY! + if (_ptype == fOnline) + _cOccupancyvsiphi_SubdetPM.reset(); + // ^^^ + break; + default: + break; + } } -/* virtual */ void DigiTask::_process(edm::Event const& e, - edm::EventSetup const&) -{ - edm::Handle chbhe; - edm::Handle che_qie11; - edm::Handle cho; - edm::Handle chf; - - if (!e.getByToken(_tokHBHE, chbhe)) - _logger.dqmthrow("Collection HBHEDigiCollection isn't available" - + _tagHBHE.label() + " " + _tagHBHE.instance()); - if (!e.getByToken(_tokHE, che_qie11)) - _logger.dqmthrow("Collection QIE11DigiCollection isn't available" - + _tagHE.label() + " " + _tagHE.instance()); - if (!e.getByToken(_tokHO, cho)) - _logger.dqmthrow("Collection HODigiCollection isn't available" - + _tagHO.label() + " " + _tagHO.instance()); - if (!e.getByToken(_tokHF, chf)) - _logger.dqmthrow("Collection QIE10DigiCollection isn't available" - + _tagHF.label() + " " + _tagHF.instance()); - - // extract some info per event - int bx = e.bunchCrossing(); - meNumEvents1LS->Fill(0.5); // just increment - - // To fill histograms outside of the loop, you need to determine if there were - // any valid det ids first - uint32_t rawidValid = 0; - uint32_t rawidHBValid = 0; - uint32_t rawidHEValid = 0; - - // HB collection - int numChs = 0; - int numChsCut = 0; - int numChsHE = 0; - int numChsCutHE = 0; - for (HBHEDigiCollection::const_iterator it=chbhe->begin(); it!=chbhe->end(); - ++it) - { - // Explicit check on the DetIds present in the Collection - HcalDetId const& did = it->id(); - if (did.subdet() != HcalBarrel) { - continue; - } - uint32_t rawid = _ehashmap.lookup(did); - if (rawid == 0) { - meUnknownIds1LS->Fill(1); - _unknownIdsPresent=true; - continue; - } else { - if (did.subdet()==HcalBarrel) { - rawidHBValid = did.rawId(); - } else if (did.subdet()==HcalEndcap) { - rawidHEValid = did.rawId(); - } - } - HcalElectronicsId const& eid(rawid); - - // filter out channels that are masked out - if (_xQuality.exists(did)) - { - HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); - if ( - cs.isBitSet(HcalChannelStatus::HcalCellMask) || - cs.isBitSet(HcalChannelStatus::HcalCellDead)) - continue; - } - - if (_ptype == fOnline) { - short this_capidmbx = (it->sample(it->presamples()).capid() - bx) % 4; - if (this_capidmbx < 0) { - this_capidmbx += 4; - } - _cCapidMinusBXmod4_SubdetPM.fill(did, this_capidmbx); - bool good_capidmbx = (_capidmbx[did.subdet()] == this_capidmbx); - if (!good_capidmbx) { - _xBadCapid.get(eid)++; - _cCapid_BadvsFEDvsLS.fill(eid, _currentLS); - _cCapid_BadvsFEDvsLSmod60.fill(eid, _currentLS % 60); - } - if (eid.isVMEid()) { - _cCapidMinusBXmod4_CrateSlotVME[this_capidmbx].fill(eid); - - } else { - _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid); - } - } - - //double sumQ = hcaldqm::utilities::sumQ(*it, 2.5, 0, it->size()-1); - CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, *it); - double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, *it, 0, it->size()-1); - - _cSumQ_SubdetPM.fill(did, sumQ); - _cOccupancy_depth.fill(did); - if (_ptype == fOnline || _ptype == fLocal) { - _cOccupancy_Crate.fill(eid); - _cOccupancy_CrateSlot.fill(eid); - } - if (_ptype==fOnline) - { - _cDigiSizevsLS_FED.fill(eid, _currentLS, it->size()); - it->size()!=_refDigiSize[did.subdet()]? - _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; - _cOccupancyvsiphi_SubdetPM.fill(did); - _cOccupancyvsieta_Subdet.fill(did); - } - _cDigiSize_Crate.fill(eid, it->size()); - if (_ptype != fOffline) { // hidefed2crate - _cDigiSize_FED.fill(eid, it->size()); - if (eid.isVMEid()) - { - _cOccupancy_FEDVME.fill(eid); - _cOccupancy_ElectronicsVME.fill(eid); - } - else - { - _cOccupancy_FEDuTCA.fill(eid); - _cOccupancy_ElectronicsuTCA.fill(eid); - /* +/* virtual */ void DigiTask::_process(edm::Event const& e, edm::EventSetup const&) { + edm::Handle chbhe; + edm::Handle che_qie11; + edm::Handle cho; + edm::Handle chf; + + if (!e.getByToken(_tokHBHE, chbhe)) + _logger.dqmthrow("Collection HBHEDigiCollection isn't available" + _tagHBHE.label() + " " + _tagHBHE.instance()); + if (!e.getByToken(_tokHE, che_qie11)) + _logger.dqmthrow("Collection QIE11DigiCollection isn't available" + _tagHE.label() + " " + _tagHE.instance()); + if (!e.getByToken(_tokHO, cho)) + _logger.dqmthrow("Collection HODigiCollection isn't available" + _tagHO.label() + " " + _tagHO.instance()); + if (!e.getByToken(_tokHF, chf)) + _logger.dqmthrow("Collection QIE10DigiCollection isn't available" + _tagHF.label() + " " + _tagHF.instance()); + + // extract some info per event + int bx = e.bunchCrossing(); + meNumEvents1LS->Fill(0.5); // just increment + + // To fill histograms outside of the loop, you need to determine if there were + // any valid det ids first + uint32_t rawidValid = 0; + uint32_t rawidHBValid = 0; + uint32_t rawidHEValid = 0; + + // HB collection + int numChs = 0; + int numChsCut = 0; + int numChsHE = 0; + int numChsCutHE = 0; + for (HBHEDigiCollection::const_iterator it = chbhe->begin(); it != chbhe->end(); ++it) { + // Explicit check on the DetIds present in the Collection + HcalDetId const& did = it->id(); + if (did.subdet() != HcalBarrel) { + continue; + } + uint32_t rawid = _ehashmap.lookup(did); + if (rawid == 0) { + meUnknownIds1LS->Fill(1); + _unknownIdsPresent = true; + continue; + } else { + if (did.subdet() == HcalBarrel) { + rawidHBValid = did.rawId(); + } else if (did.subdet() == HcalEndcap) { + rawidHEValid = did.rawId(); + } + } + HcalElectronicsId const& eid(rawid); + + // filter out channels that are masked out + if (_xQuality.exists(did)) { + HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); + if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead)) + continue; + } + + if (_ptype == fOnline) { + short this_capidmbx = (it->sample(it->presamples()).capid() - bx) % 4; + if (this_capidmbx < 0) { + this_capidmbx += 4; + } + _cCapidMinusBXmod4_SubdetPM.fill(did, this_capidmbx); + bool good_capidmbx = (_capidmbx[did.subdet()] == this_capidmbx); + if (!good_capidmbx) { + _xBadCapid.get(eid)++; + _cCapid_BadvsFEDvsLS.fill(eid, _currentLS); + _cCapid_BadvsFEDvsLSmod60.fill(eid, _currentLS % 60); + } + if (eid.isVMEid()) { + _cCapidMinusBXmod4_CrateSlotVME[this_capidmbx].fill(eid); + + } else { + _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid); + } + } + + //double sumQ = hcaldqm::utilities::sumQ(*it, 2.5, 0, it->size()-1); + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, *it); + double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, *it, 0, it->size() - 1); + + _cSumQ_SubdetPM.fill(did, sumQ); + _cOccupancy_depth.fill(did); + if (_ptype == fOnline || _ptype == fLocal) { + _cOccupancy_Crate.fill(eid); + _cOccupancy_CrateSlot.fill(eid); + } + if (_ptype == fOnline) { + _cDigiSizevsLS_FED.fill(eid, _currentLS, it->size()); + it->size() != _refDigiSize[did.subdet()] ? _xDigiSize.get(eid)++ : _xDigiSize.get(eid) += 0; + _cOccupancyvsiphi_SubdetPM.fill(did); + _cOccupancyvsieta_Subdet.fill(did); + } + _cDigiSize_Crate.fill(eid, it->size()); + if (_ptype != fOffline) { // hidefed2crate + _cDigiSize_FED.fill(eid, it->size()); + if (eid.isVMEid()) { + _cOccupancy_FEDVME.fill(eid); + _cOccupancy_ElectronicsVME.fill(eid); + } else { + _cOccupancy_FEDuTCA.fill(eid); + _cOccupancy_ElectronicsuTCA.fill(eid); + /* if (!it->validate(0, it->size())) { _cCapIdRots_depth.fill(did); _cCapIdRots_FEDuTCA.fill(eid, 1); }*/ - } - } - - for (int i=0; isize(); i++) - { - _cADC_SubdetPM.fill(did, it->sample(i).adc()); - _cfC_SubdetPM.fill(did, it->sample(i).nominal_fC()); - if (_ptype != fOffline) { // hidefed2crate - _cADCvsTS_SubdetPM.fill(did, i, it->sample(i).adc()); - if (sumQ>_cutSumQ_HBHE) { - _cShapeCut_FED.fill(eid, i, it->sample(i).nominal_fC()); - } - } - } - - if (sumQ>_cutSumQ_HBHE) - { - //double timing = hcaldqm::utilities::aveTS(*it, 2.5, 0, it->size()-1); - double timing = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, *it, 0, it->size()-1); - _cTimingCut_SubdetPM.fill(did, timing); - _cTimingCut_depth.fill(did, timing); - _cOccupancyCut_depth.fill(did); - _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); - if (_ptype != fOffline) { // hidefed2crate - _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); - } - _cSumQ_depth.fill(did, sumQ); - _cSumQvsLS_SubdetPM.fill(did, _currentLS, sumQ); - if (_ptype==fOnline) - { - _cSumQvsBX_SubdetPM.fill(did, bx, sumQ); - _cTimingCutvsiphi_SubdetPM.fill(did, timing); - _cTimingCutvsieta_Subdet.fill(did, timing); - _cOccupancyCutvsiphi_SubdetPM.fill(did); - _cOccupancyCutvsieta_Subdet.fill(did); - _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); - } - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - { - _cTimingCut_FEDVME.fill(eid, timing); - _cTimingCut_ElectronicsVME.fill(eid, timing); - _cOccupancyCut_FEDVME.fill(eid); - _cOccupancyCut_ElectronicsVME.fill(eid); - } - else - { - _cTimingCut_FEDuTCA.fill(eid, timing); - _cTimingCut_ElectronicsuTCA.fill(eid, timing); - _cOccupancyCut_FEDuTCA.fill(eid); - _cOccupancyCut_ElectronicsuTCA.fill(eid); - } - } - did.subdet()==HcalBarrel?numChsCut++:numChsCutHE++; - } - did.subdet()==HcalBarrel?numChs++:numChsHE++; - } - - // HE QIE11 collection - for (QIE11DigiCollection::const_iterator it=che_qie11->begin(); it!=che_qie11->end(); - ++it) - { - const QIE11DataFrame digi = static_cast(*it); - - // Explicit check on the DetIds present in the Collection - HcalDetId const& did = digi.detid(); - if (did.subdet() != HcalEndcap) { - // LED monitoring from calibration channels - if (_ptype != fLocal) { - if (did.subdet() == HcalOther) { - HcalOtherDetId hodid(digi.detid()); - if (hodid.subdet() == HcalCalibration) { - // New method: use configurable list of channels - if (std::find(_ledCalibrationChannels[HcalEndcap].begin(), _ledCalibrationChannels[HcalEndcap].end(), did) != _ledCalibrationChannels[HcalEndcap].end()) { - bool channelLEDSignalPresent = false; - for (int i=0; i _thresh_led) { - channelLEDSignalPresent = true; - } - } - if (channelLEDSignalPresent) { - _LED_CUCountvsLS_Subdet.fill(HcalDetId(HcalEndcap, 16, 1, 1), _currentLS); - if (_ptype == fOnline) { - _LED_CUCountvsLSmod60_Subdet.fill(HcalDetId(HcalEndcap, 16, 1, 1), _currentLS % 60); - } - } - } - } - } - } - continue; - } - - uint32_t rawid = _ehashmap.lookup(did); - if (rawid == 0) { - meUnknownIds1LS->Fill(1); - _unknownIdsPresent=true; - continue; - } else { - if (did.subdet()==HcalBarrel) { // Note: since this is HE, we obviously expect did.subdet() always to be HcalEndcap, but QIE11DigiCollection will have HB for Run 3. - rawidHBValid = did.rawId(); - } else if (did.subdet()==HcalEndcap) { - rawidHEValid = did.rawId(); - } - } - HcalElectronicsId const& eid(rawid); - - // filter out channels that are masked out - if (_xQuality.exists(did)) - { - HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); - if ( - cs.isBitSet(HcalChannelStatus::HcalCellMask) || - cs.isBitSet(HcalChannelStatus::HcalCellDead)) - continue; - } - - // (capid - BX) % 4 - if (_ptype == fOnline) { - short soi = -1; - for (int i=0; i(_dbService, did, digi); - double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples()-1); - - _cSumQ_SubdetPM_QIE1011.fill(did, sumQ); - _cOccupancy_depth.fill(did); - if (_ptype == fOnline || _ptype == fLocal) { - _cOccupancy_Crate.fill(eid); - _cOccupancy_CrateSlot.fill(eid); - } - if (_ptype==fOnline) - { - _cDigiSizevsLS_FED.fill(eid, _currentLS, digi.samples()); - digi.samples()!=_refDigiSize[did.subdet()]? - _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; - _cOccupancyvsiphi_SubdetPM.fill(did); - _cOccupancyvsieta_Subdet.fill(did); - } - _cDigiSize_Crate.fill(eid, digi.samples()); - if (_ptype != fOffline) { // hidefed2crate - _cDigiSize_FED.fill(eid, digi.samples()); - if (eid.isVMEid()) - { - _cOccupancy_FEDVME.fill(eid); - _cOccupancy_ElectronicsVME.fill(eid); - } - else - { - _cOccupancy_FEDuTCA.fill(eid); - _cOccupancy_ElectronicsuTCA.fill(eid); - /* + } + } + + for (int i = 0; i < it->size(); i++) { + _cADC_SubdetPM.fill(did, it->sample(i).adc()); + _cfC_SubdetPM.fill(did, it->sample(i).nominal_fC()); + if (_ptype != fOffline) { // hidefed2crate + _cADCvsTS_SubdetPM.fill(did, i, it->sample(i).adc()); + if (sumQ > _cutSumQ_HBHE) { + _cShapeCut_FED.fill(eid, i, it->sample(i).nominal_fC()); + } + } + } + + if (sumQ > _cutSumQ_HBHE) { + //double timing = hcaldqm::utilities::aveTS(*it, 2.5, 0, it->size()-1); + double timing = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, *it, 0, it->size() - 1); + _cTimingCut_SubdetPM.fill(did, timing); + _cTimingCut_depth.fill(did, timing); + _cOccupancyCut_depth.fill(did); + _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); + if (_ptype != fOffline) { // hidefed2crate + _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); + } + _cSumQ_depth.fill(did, sumQ); + _cSumQvsLS_SubdetPM.fill(did, _currentLS, sumQ); + if (_ptype == fOnline) { + _cSumQvsBX_SubdetPM.fill(did, bx, sumQ); + _cTimingCutvsiphi_SubdetPM.fill(did, timing); + _cTimingCutvsieta_Subdet.fill(did, timing); + _cOccupancyCutvsiphi_SubdetPM.fill(did); + _cOccupancyCutvsieta_Subdet.fill(did); + _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); + } + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) { + _cTimingCut_FEDVME.fill(eid, timing); + _cTimingCut_ElectronicsVME.fill(eid, timing); + _cOccupancyCut_FEDVME.fill(eid); + _cOccupancyCut_ElectronicsVME.fill(eid); + } else { + _cTimingCut_FEDuTCA.fill(eid, timing); + _cTimingCut_ElectronicsuTCA.fill(eid, timing); + _cOccupancyCut_FEDuTCA.fill(eid); + _cOccupancyCut_ElectronicsuTCA.fill(eid); + } + } + did.subdet() == HcalBarrel ? numChsCut++ : numChsCutHE++; + } + did.subdet() == HcalBarrel ? numChs++ : numChsHE++; + } + + // HE QIE11 collection + for (QIE11DigiCollection::const_iterator it = che_qie11->begin(); it != che_qie11->end(); ++it) { + const QIE11DataFrame digi = static_cast(*it); + + // Explicit check on the DetIds present in the Collection + HcalDetId const& did = digi.detid(); + if (did.subdet() != HcalEndcap) { + // LED monitoring from calibration channels + if (_ptype != fLocal) { + if (did.subdet() == HcalOther) { + HcalOtherDetId hodid(digi.detid()); + if (hodid.subdet() == HcalCalibration) { + // New method: use configurable list of channels + if (std::find(_ledCalibrationChannels[HcalEndcap].begin(), + _ledCalibrationChannels[HcalEndcap].end(), + did) != _ledCalibrationChannels[HcalEndcap].end()) { + bool channelLEDSignalPresent = false; + for (int i = 0; i < digi.samples(); i++) { + _LED_ADCvsBX_Subdet.fill(HcalDetId(HcalEndcap, 16, 1, 1), bx, digi[i].adc()); + + if (digi[i].adc() > _thresh_led) { + channelLEDSignalPresent = true; + } + } + if (channelLEDSignalPresent) { + _LED_CUCountvsLS_Subdet.fill(HcalDetId(HcalEndcap, 16, 1, 1), _currentLS); + if (_ptype == fOnline) { + _LED_CUCountvsLSmod60_Subdet.fill(HcalDetId(HcalEndcap, 16, 1, 1), _currentLS % 60); + } + } + } + } + } + } + continue; + } + + uint32_t rawid = _ehashmap.lookup(did); + if (rawid == 0) { + meUnknownIds1LS->Fill(1); + _unknownIdsPresent = true; + continue; + } else { + if (did.subdet() == + HcalBarrel) { // Note: since this is HE, we obviously expect did.subdet() always to be HcalEndcap, but QIE11DigiCollection will have HB for Run 3. + rawidHBValid = did.rawId(); + } else if (did.subdet() == HcalEndcap) { + rawidHEValid = did.rawId(); + } + } + HcalElectronicsId const& eid(rawid); + + // filter out channels that are masked out + if (_xQuality.exists(did)) { + HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); + if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead)) + continue; + } + + // (capid - BX) % 4 + if (_ptype == fOnline) { + short soi = -1; + for (int i = 0; i < digi.samples(); i++) { + if (digi[i].soi()) { + soi = i; + break; + } + } + short this_capidmbx = (digi[soi].capid() - bx) % 4; + if (this_capidmbx < 0) { + this_capidmbx += 4; + } + _cCapidMinusBXmod4_SubdetPM.fill(did, this_capidmbx); + bool good_capidmbx = (_capidmbx[did.subdet()] == this_capidmbx); + if (!good_capidmbx) { + _xBadCapid.get(eid)++; + _cCapid_BadvsFEDvsLS.fill(eid, _currentLS); + _cCapid_BadvsFEDvsLSmod60.fill(eid, _currentLS % 60); + } + if (eid.isVMEid()) { + _cCapidMinusBXmod4_CrateSlotVME[this_capidmbx].fill(eid); + + } else { + _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid); + } + } + + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); + double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples() - 1); + + _cSumQ_SubdetPM_QIE1011.fill(did, sumQ); + _cOccupancy_depth.fill(did); + if (_ptype == fOnline || _ptype == fLocal) { + _cOccupancy_Crate.fill(eid); + _cOccupancy_CrateSlot.fill(eid); + } + if (_ptype == fOnline) { + _cDigiSizevsLS_FED.fill(eid, _currentLS, digi.samples()); + digi.samples() != _refDigiSize[did.subdet()] ? _xDigiSize.get(eid)++ : _xDigiSize.get(eid) += 0; + _cOccupancyvsiphi_SubdetPM.fill(did); + _cOccupancyvsieta_Subdet.fill(did); + } + _cDigiSize_Crate.fill(eid, digi.samples()); + if (_ptype != fOffline) { // hidefed2crate + _cDigiSize_FED.fill(eid, digi.samples()); + if (eid.isVMEid()) { + _cOccupancy_FEDVME.fill(eid); + _cOccupancy_ElectronicsVME.fill(eid); + } else { + _cOccupancy_FEDuTCA.fill(eid); + _cOccupancy_ElectronicsuTCA.fill(eid); + /* if (!digi.validate(0, digi.size())) { _cCapIdRots_depth.fill(did); _cCapIdRots_FEDuTCA.fill(eid, 1); }*/ - } - } - for (int i=0; i(_dbService, digi_fC, did, digi, i); - _cADC_SubdetPM_QIE1011.fill(did, digi[i].adc()); - _cfC_SubdetPM_QIE1011.fill(did, q); - _cLETDCvsADC_SubdetPM.fill(did, digi[i].adc(), digi[i].tdc()); - _cLETDCvsTS_SubdetPM.fill(did, (int)i, digi[i].tdc()); - if (digi[i].tdc() <50) { - double time = i*25. + (digi[i].tdc() / 2.); - _cLETDCTime_SubdetPM.fill(did, time); - _cLETDCTime_depth.fill(did, time); - _cLETDCTimevsADC_SubdetPM.fill(did, digi[i].adc(), time); - } - // Bad TDC values: 50-61 should never happen in QIE10 or QIE11, but we saw some in 2017 data. - if ((50 <= digi[i].tdc()) && (digi[i].tdc() <= 61)) { - _cBadTDCValues_SubdetPM.fill(did, digi[i].tdc()); - _cBadTDCvsBX_SubdetPM.fill(did, bx); - _cBadTDCvsLS_SubdetPM.fill(did, _currentLS); - _cBadTDCCount_depth.fill(did); - } - if (_ptype != fOffline) { // hidefed2crate - _cADCvsTS_SubdetPM_QIE1011.fill(did, i, digi[i].adc()); - if (sumQ>_cutSumQ_HE) { - _cShapeCut_FED.fill(eid, i, q); - } - } - } - - if (sumQ>_cutSumQ_HE) - { - //double timing = hcaldqm::utilities::aveTS_v10(digi, 2.5, 0,digi.samples()-1); - double timing = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.samples()-1); - _cTimingCut_SubdetPM.fill(did, timing); - _cTimingCut_depth.fill(did, timing); - _cOccupancyCut_depth.fill(did); - _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); - if (_ptype != fOffline) { // hidefed2crate - _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); - } - _cSumQ_depth.fill(did, sumQ); - _cSumQvsLS_SubdetPM_QIE1011.fill(did, _currentLS, sumQ); - if (_ptype==fOnline) - { - _cSumQvsBX_SubdetPM_QIE1011.fill(did, bx, sumQ); - _cTimingCutvsiphi_SubdetPM.fill(did, timing); - _cTimingCutvsieta_Subdet.fill(did, timing); - _cOccupancyCutvsiphi_SubdetPM.fill(did); - _cOccupancyCutvsieta_Subdet.fill(did); - _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); - } - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - { - _cTimingCut_FEDVME.fill(eid, timing); - _cTimingCut_ElectronicsVME.fill(eid, timing); - _cOccupancyCut_FEDVME.fill(eid); - _cOccupancyCut_ElectronicsVME.fill(eid); - } - else - { - _cTimingCut_FEDuTCA.fill(eid, timing); - _cTimingCut_ElectronicsuTCA.fill(eid, timing); - _cOccupancyCut_FEDuTCA.fill(eid); - _cOccupancyCut_ElectronicsuTCA.fill(eid); - } - } - did.subdet()==HcalBarrel?numChsCut++:numChsCutHE++; - } - did.subdet()==HcalBarrel?numChs++:numChsHE++; - } - - if (rawidHBValid!=0 && rawidHEValid!=0) - { - _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHBValid), _currentLS, - numChs); - _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHEValid), _currentLS, - numChsHE); - // ONLINE ONLY! - if (_ptype==fOnline) - { - _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidHBValid), - _currentLS, numChsCut); - _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidHBValid), bx, - numChsCut); - _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidHEValid), - _currentLS, numChsCutHE); - _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidHEValid), bx, - numChsCutHE); - } - // ^^^ONLINE ONLY! - } - numChs=0; - numChsCut = 0; - - // reset - rawidValid = 0; - - - // HO collection - for (HODigiCollection::const_iterator it=cho->begin(); it!=cho->end(); - ++it) - { - // Explicit check on the DetIds present in the Collection - HcalDetId const& did = it->id(); - if (did.subdet() != HcalOuter) { - continue; - } - uint32_t rawid = _ehashmap.lookup(did); - if (rawid == 0) { - meUnknownIds1LS->Fill(1); - _unknownIdsPresent = true; - continue; - } else { - rawidValid = did.rawId(); - } - HcalElectronicsId const& eid(rawid); - - // filter out channels that are masked out - if (_xQuality.exists(did)) - { - HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); - if ( - cs.isBitSet(HcalChannelStatus::HcalCellMask) || - cs.isBitSet(HcalChannelStatus::HcalCellDead)) - continue; - } - - if (_ptype == fOnline) { - short this_capidmbx = (it->sample(it->presamples()).capid() - bx) % 4; - if (this_capidmbx < 0) { - this_capidmbx += 4; - } - _cCapidMinusBXmod4_SubdetPM.fill(did, this_capidmbx); - bool good_capidmbx = (_capidmbx[did.subdet()] == this_capidmbx); - if (!good_capidmbx) { - _xBadCapid.get(eid)++; - _cCapid_BadvsFEDvsLS.fill(eid, _currentLS); - _cCapid_BadvsFEDvsLSmod60.fill(eid, _currentLS % 60); - } - if (eid.isVMEid()) { - _cCapidMinusBXmod4_CrateSlotVME[this_capidmbx].fill(eid); - - } else { - _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid); - } - } - - //double sumQ = hcaldqm::utilities::sumQ(*it, 8.5, 0, it->size()-1); - CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, *it); - double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, *it, 0, it->size()-1); - - _cSumQ_SubdetPM.fill(did, sumQ); - _cOccupancy_depth.fill(did); - if (_ptype==fOnline) - { - _cDigiSizevsLS_FED.fill(eid, _currentLS, it->size()); - it->size()!=_refDigiSize[did.subdet()]? - _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; - _cOccupancyvsiphi_SubdetPM.fill(did); - _cOccupancyvsieta_Subdet.fill(did); - } - _cDigiSize_Crate.fill(eid, it->size()); - if (_ptype != fOffline) { // hidefed2crate - _cDigiSize_FED.fill(eid, it->size()); - if (eid.isVMEid()) - { - _cOccupancy_FEDVME.fill(eid); - _cOccupancy_ElectronicsVME.fill(eid); - /* + } + } + for (int i = 0; i < digi.samples(); i++) { + double q = hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, i); + _cADC_SubdetPM_QIE1011.fill(did, digi[i].adc()); + _cfC_SubdetPM_QIE1011.fill(did, q); + _cLETDCvsADC_SubdetPM.fill(did, digi[i].adc(), digi[i].tdc()); + _cLETDCvsTS_SubdetPM.fill(did, (int)i, digi[i].tdc()); + if (digi[i].tdc() < 50) { + double time = i * 25. + (digi[i].tdc() / 2.); + _cLETDCTime_SubdetPM.fill(did, time); + _cLETDCTime_depth.fill(did, time); + _cLETDCTimevsADC_SubdetPM.fill(did, digi[i].adc(), time); + } + // Bad TDC values: 50-61 should never happen in QIE10 or QIE11, but we saw some in 2017 data. + if ((50 <= digi[i].tdc()) && (digi[i].tdc() <= 61)) { + _cBadTDCValues_SubdetPM.fill(did, digi[i].tdc()); + _cBadTDCvsBX_SubdetPM.fill(did, bx); + _cBadTDCvsLS_SubdetPM.fill(did, _currentLS); + _cBadTDCCount_depth.fill(did); + } + if (_ptype != fOffline) { // hidefed2crate + _cADCvsTS_SubdetPM_QIE1011.fill(did, i, digi[i].adc()); + if (sumQ > _cutSumQ_HE) { + _cShapeCut_FED.fill(eid, i, q); + } + } + } + + if (sumQ > _cutSumQ_HE) { + //double timing = hcaldqm::utilities::aveTS_v10(digi, 2.5, 0,digi.samples()-1); + double timing = + hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.samples() - 1); + _cTimingCut_SubdetPM.fill(did, timing); + _cTimingCut_depth.fill(did, timing); + _cOccupancyCut_depth.fill(did); + _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); + if (_ptype != fOffline) { // hidefed2crate + _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); + } + _cSumQ_depth.fill(did, sumQ); + _cSumQvsLS_SubdetPM_QIE1011.fill(did, _currentLS, sumQ); + if (_ptype == fOnline) { + _cSumQvsBX_SubdetPM_QIE1011.fill(did, bx, sumQ); + _cTimingCutvsiphi_SubdetPM.fill(did, timing); + _cTimingCutvsieta_Subdet.fill(did, timing); + _cOccupancyCutvsiphi_SubdetPM.fill(did); + _cOccupancyCutvsieta_Subdet.fill(did); + _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); + } + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) { + _cTimingCut_FEDVME.fill(eid, timing); + _cTimingCut_ElectronicsVME.fill(eid, timing); + _cOccupancyCut_FEDVME.fill(eid); + _cOccupancyCut_ElectronicsVME.fill(eid); + } else { + _cTimingCut_FEDuTCA.fill(eid, timing); + _cTimingCut_ElectronicsuTCA.fill(eid, timing); + _cOccupancyCut_FEDuTCA.fill(eid); + _cOccupancyCut_ElectronicsuTCA.fill(eid); + } + } + did.subdet() == HcalBarrel ? numChsCut++ : numChsCutHE++; + } + did.subdet() == HcalBarrel ? numChs++ : numChsHE++; + } + + if (rawidHBValid != 0 && rawidHEValid != 0) { + _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHBValid), _currentLS, numChs); + _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHEValid), _currentLS, numChsHE); + // ONLINE ONLY! + if (_ptype == fOnline) { + _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidHBValid), _currentLS, numChsCut); + _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidHBValid), bx, numChsCut); + _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidHEValid), _currentLS, numChsCutHE); + _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidHEValid), bx, numChsCutHE); + } + // ^^^ONLINE ONLY! + } + numChs = 0; + numChsCut = 0; + + // reset + rawidValid = 0; + + // HO collection + for (HODigiCollection::const_iterator it = cho->begin(); it != cho->end(); ++it) { + // Explicit check on the DetIds present in the Collection + HcalDetId const& did = it->id(); + if (did.subdet() != HcalOuter) { + continue; + } + uint32_t rawid = _ehashmap.lookup(did); + if (rawid == 0) { + meUnknownIds1LS->Fill(1); + _unknownIdsPresent = true; + continue; + } else { + rawidValid = did.rawId(); + } + HcalElectronicsId const& eid(rawid); + + // filter out channels that are masked out + if (_xQuality.exists(did)) { + HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); + if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead)) + continue; + } + + if (_ptype == fOnline) { + short this_capidmbx = (it->sample(it->presamples()).capid() - bx) % 4; + if (this_capidmbx < 0) { + this_capidmbx += 4; + } + _cCapidMinusBXmod4_SubdetPM.fill(did, this_capidmbx); + bool good_capidmbx = (_capidmbx[did.subdet()] == this_capidmbx); + if (!good_capidmbx) { + _xBadCapid.get(eid)++; + _cCapid_BadvsFEDvsLS.fill(eid, _currentLS); + _cCapid_BadvsFEDvsLSmod60.fill(eid, _currentLS % 60); + } + if (eid.isVMEid()) { + _cCapidMinusBXmod4_CrateSlotVME[this_capidmbx].fill(eid); + + } else { + _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid); + } + } + + //double sumQ = hcaldqm::utilities::sumQ(*it, 8.5, 0, it->size()-1); + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, *it); + double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, *it, 0, it->size() - 1); + + _cSumQ_SubdetPM.fill(did, sumQ); + _cOccupancy_depth.fill(did); + if (_ptype == fOnline) { + _cDigiSizevsLS_FED.fill(eid, _currentLS, it->size()); + it->size() != _refDigiSize[did.subdet()] ? _xDigiSize.get(eid)++ : _xDigiSize.get(eid) += 0; + _cOccupancyvsiphi_SubdetPM.fill(did); + _cOccupancyvsieta_Subdet.fill(did); + } + _cDigiSize_Crate.fill(eid, it->size()); + if (_ptype != fOffline) { // hidefed2crate + _cDigiSize_FED.fill(eid, it->size()); + if (eid.isVMEid()) { + _cOccupancy_FEDVME.fill(eid); + _cOccupancy_ElectronicsVME.fill(eid); + /* if (!it->validate(0, it->size())) _cCapIdRots_FEDVME.fill(eid, 1); */ - } - else - { - _cOccupancy_FEDuTCA.fill(eid); - _cOccupancy_ElectronicsuTCA.fill(eid); - /* + } else { + _cOccupancy_FEDuTCA.fill(eid); + _cOccupancy_ElectronicsuTCA.fill(eid); + /* if (!it->validate(0, it->size())) _cCapIdRots_FEDuTCA.fill(eid, 1);*/ - } - } - - for (int i=0; isize(); i++) - { - _cADC_SubdetPM.fill(did, it->sample(i).adc()); - _cfC_SubdetPM.fill(did, it->sample(i).nominal_fC()); - if (_ptype != fOffline) { // hidefed2crate - _cADCvsTS_SubdetPM.fill(did, i, it->sample(i).adc()); - if (sumQ>_cutSumQ_HO) - _cShapeCut_FED.fill(eid, i, it->sample(i).nominal_fC()); - } - } - - if (sumQ>_cutSumQ_HO) - { - //double timing = hcaldqm::utilities::aveTS(*it, 8.5, 0,it->size()-1); - double timing = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, *it, 0, it->size()-1); - _cSumQ_depth.fill(did, sumQ); - _cSumQvsLS_SubdetPM.fill(did, _currentLS, sumQ); - _cOccupancyCut_depth.fill(did); - _cTimingCut_SubdetPM.fill(did, timing); - _cTimingCut_depth.fill(did, timing); - _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); - if (_ptype != fOffline) { // hidefed2crate - _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); - } - if (_ptype==fOnline) - { - _cSumQvsBX_SubdetPM.fill(did, bx, sumQ); - _cTimingCutvsiphi_SubdetPM.fill(did, timing); - _cTimingCutvsieta_Subdet.fill(did, timing); - _cOccupancyCutvsiphi_SubdetPM.fill(did); - _cOccupancyCutvsieta_Subdet.fill(did); - _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); - } - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - { - _cTimingCut_FEDVME.fill(eid, timing); - _cTimingCut_ElectronicsVME.fill(eid, timing); - _cOccupancyCut_FEDVME.fill(eid); - _cOccupancyCut_ElectronicsVME.fill(eid); - } - else - { - _cTimingCut_FEDuTCA.fill(eid, timing); - _cTimingCut_ElectronicsuTCA.fill(eid, timing); - _cOccupancyCut_FEDuTCA.fill(eid); - _cOccupancyCut_ElectronicsuTCA.fill(eid); - } - } - numChsCut++; - } - numChs++; - } - - if (rawidValid!=0) - { - _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, - numChs); - - if (_ptype==fOnline) - { - _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidValid), - _currentLS, numChsCut); - _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidValid), bx, - numChsCut); - } - } - numChs=0; numChsCut=0; - - // reset - rawidValid = 0; - - // HF collection - if (_qie10InConditions) { - for (QIE10DigiCollection::const_iterator it=chf->begin(); it!=chf->end(); ++it) { - const QIE10DataFrame digi = static_cast(*it); - - // Explicit check on the DetIds present in the Collection - HcalDetId const& did = digi.detid(); - if (did.subdet() != HcalForward) { - // LED monitoring from calibration channels - if (_ptype != fLocal) { - if (did.subdet() == HcalOther) { - HcalOtherDetId hodid(digi.detid()); - if (hodid.subdet() == HcalCalibration) { - // New method: use configurable list of channels - if (std::find(_ledCalibrationChannels[HcalForward].begin(), _ledCalibrationChannels[HcalForward].end(), did) != _ledCalibrationChannels[HcalForward].end()) { - bool channelLEDSignalPresent = false; - for (int i=0; i _thresh_led) { - channelLEDSignalPresent = true; - } - } - if (channelLEDSignalPresent) { - _LED_CUCountvsLS_Subdet.fill(HcalDetId(HcalForward, 16, 1, 1), _currentLS); - if (_ptype == fOnline) { - _LED_CUCountvsLSmod60_Subdet.fill(HcalDetId(HcalForward, 16, 1, 1), _currentLS % 60); - } - } - } - } - } - } - continue; - } - - uint32_t rawid = _ehashmap.lookup(did); - if (rawid == 0) { - meUnknownIds1LS->Fill(1); - _unknownIdsPresent=true; - continue; - } else { - rawidValid = did.rawId(); - } - HcalElectronicsId const& eid(rawid); - - // filter out channels that are masked out - if (_xQuality.exists(did)) - { - HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); - if ( - cs.isBitSet(HcalChannelStatus::HcalCellMask) || - cs.isBitSet(HcalChannelStatus::HcalCellDead)) - continue; - } - - // (capid - BX) % 4 - if (_ptype == fOnline) { - short soi = -1; - for (int i=0; i(_dbService, did, digi); - double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples()-1); - //double sumQ = hcaldqm::utilities::sumQ_v10(digi, 2.5, 0, digi.samples()-1); - - //if (!_filter_QIE1011.filter(did)) { - _cSumQ_SubdetPM_QIE1011.fill(did, sumQ); - //} - _cOccupancy_depth.fill(did); - if (_ptype==fOnline) - { - _xNChs.get(eid)++; - _cDigiSizevsLS_FED.fill(eid, _currentLS, digi.samples()); - digi.samples()!=_refDigiSize[did.subdet()]? - _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; - _cOccupancyvsiphi_SubdetPM.fill(did); - _cOccupancyvsieta_Subdet.fill(did); - } - _cDigiSize_Crate.fill(eid, digi.samples()); - if (_ptype != fOffline) { // hidefed2crate - _cDigiSize_FED.fill(eid, digi.samples()); - if (eid.isVMEid()) - { - _cOccupancy_FEDVME.fill(eid); - _cOccupancy_ElectronicsVME.fill(eid); - /* + } + } + + for (int i = 0; i < it->size(); i++) { + _cADC_SubdetPM.fill(did, it->sample(i).adc()); + _cfC_SubdetPM.fill(did, it->sample(i).nominal_fC()); + if (_ptype != fOffline) { // hidefed2crate + _cADCvsTS_SubdetPM.fill(did, i, it->sample(i).adc()); + if (sumQ > _cutSumQ_HO) + _cShapeCut_FED.fill(eid, i, it->sample(i).nominal_fC()); + } + } + + if (sumQ > _cutSumQ_HO) { + //double timing = hcaldqm::utilities::aveTS(*it, 8.5, 0,it->size()-1); + double timing = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, *it, 0, it->size() - 1); + _cSumQ_depth.fill(did, sumQ); + _cSumQvsLS_SubdetPM.fill(did, _currentLS, sumQ); + _cOccupancyCut_depth.fill(did); + _cTimingCut_SubdetPM.fill(did, timing); + _cTimingCut_depth.fill(did, timing); + _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); + if (_ptype != fOffline) { // hidefed2crate + _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); + } + if (_ptype == fOnline) { + _cSumQvsBX_SubdetPM.fill(did, bx, sumQ); + _cTimingCutvsiphi_SubdetPM.fill(did, timing); + _cTimingCutvsieta_Subdet.fill(did, timing); + _cOccupancyCutvsiphi_SubdetPM.fill(did); + _cOccupancyCutvsieta_Subdet.fill(did); + _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); + } + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) { + _cTimingCut_FEDVME.fill(eid, timing); + _cTimingCut_ElectronicsVME.fill(eid, timing); + _cOccupancyCut_FEDVME.fill(eid); + _cOccupancyCut_ElectronicsVME.fill(eid); + } else { + _cTimingCut_FEDuTCA.fill(eid, timing); + _cTimingCut_ElectronicsuTCA.fill(eid, timing); + _cOccupancyCut_FEDuTCA.fill(eid); + _cOccupancyCut_ElectronicsuTCA.fill(eid); + } + } + numChsCut++; + } + numChs++; + } + + if (rawidValid != 0) { + _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, numChs); + + if (_ptype == fOnline) { + _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, numChsCut); + _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidValid), bx, numChsCut); + } + } + numChs = 0; + numChsCut = 0; + + // reset + rawidValid = 0; + + // HF collection + if (_qie10InConditions) { + for (QIE10DigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) { + const QIE10DataFrame digi = static_cast(*it); + + // Explicit check on the DetIds present in the Collection + HcalDetId const& did = digi.detid(); + if (did.subdet() != HcalForward) { + // LED monitoring from calibration channels + if (_ptype != fLocal) { + if (did.subdet() == HcalOther) { + HcalOtherDetId hodid(digi.detid()); + if (hodid.subdet() == HcalCalibration) { + // New method: use configurable list of channels + if (std::find(_ledCalibrationChannels[HcalForward].begin(), + _ledCalibrationChannels[HcalForward].end(), + did) != _ledCalibrationChannels[HcalForward].end()) { + bool channelLEDSignalPresent = false; + for (int i = 0; i < digi.samples(); i++) { + _LED_ADCvsBX_Subdet.fill(HcalDetId(HcalForward, 16, 1, 1), bx, digi[i].adc()); + + if (digi[i].adc() > _thresh_led) { + channelLEDSignalPresent = true; + } + } + if (channelLEDSignalPresent) { + _LED_CUCountvsLS_Subdet.fill(HcalDetId(HcalForward, 16, 1, 1), _currentLS); + if (_ptype == fOnline) { + _LED_CUCountvsLSmod60_Subdet.fill(HcalDetId(HcalForward, 16, 1, 1), _currentLS % 60); + } + } + } + } + } + } + continue; + } + + uint32_t rawid = _ehashmap.lookup(did); + if (rawid == 0) { + meUnknownIds1LS->Fill(1); + _unknownIdsPresent = true; + continue; + } else { + rawidValid = did.rawId(); + } + HcalElectronicsId const& eid(rawid); + + // filter out channels that are masked out + if (_xQuality.exists(did)) { + HcalChannelStatus cs(did.rawId(), _xQuality.get(did)); + if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead)) + continue; + } + + // (capid - BX) % 4 + if (_ptype == fOnline) { + short soi = -1; + for (int i = 0; i < digi.samples(); i++) { + if (digi[i].soi()) { + soi = i; + break; + } + } + short this_capidmbx = (digi[soi].capid() - bx) % 4; + if (this_capidmbx < 0) { + this_capidmbx += 4; + } + _cCapidMinusBXmod4_SubdetPM.fill(did, this_capidmbx); + bool good_capidmbx = (_capidmbx[did.subdet()] == this_capidmbx); + if (!good_capidmbx) { + _xBadCapid.get(eid)++; + _cCapid_BadvsFEDvsLS.fill(eid, _currentLS); + _cCapid_BadvsFEDvsLSmod60.fill(eid, _currentLS % 60); + } + if (eid.isVMEid()) { + _cCapidMinusBXmod4_CrateSlotVME[this_capidmbx].fill(eid); + + } else { + _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid); + } + } + + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); + double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples() - 1); + //double sumQ = hcaldqm::utilities::sumQ_v10(digi, 2.5, 0, digi.samples()-1); + + //if (!_filter_QIE1011.filter(did)) { + _cSumQ_SubdetPM_QIE1011.fill(did, sumQ); + //} + _cOccupancy_depth.fill(did); + if (_ptype == fOnline) { + _xNChs.get(eid)++; + _cDigiSizevsLS_FED.fill(eid, _currentLS, digi.samples()); + digi.samples() != _refDigiSize[did.subdet()] ? _xDigiSize.get(eid)++ : _xDigiSize.get(eid) += 0; + _cOccupancyvsiphi_SubdetPM.fill(did); + _cOccupancyvsieta_Subdet.fill(did); + } + _cDigiSize_Crate.fill(eid, digi.samples()); + if (_ptype != fOffline) { // hidefed2crate + _cDigiSize_FED.fill(eid, digi.samples()); + if (eid.isVMEid()) { + _cOccupancy_FEDVME.fill(eid); + _cOccupancy_ElectronicsVME.fill(eid); + /* if (!it->validate(0, it->size())) _cCapIdRots_FEDVME.fill(eid, 1);*/ - } - else - { - _cOccupancy_FEDuTCA.fill(eid); - _cOccupancy_ElectronicsuTCA.fill(eid); - /* + } else { + _cOccupancy_FEDuTCA.fill(eid); + _cOccupancy_ElectronicsuTCA.fill(eid); + /* if (!it->validate(0, it->size())) _cCapIdRots_FEDuTCA.fill(eid, 1);*/ - } - } - - for (int i=0; i(_dbService, digi_fC, did, digi, i); - //if (!_filter_QIE1011.filter(did)) { - _cADC_SubdetPM_QIE1011.fill(did, digi[i].adc()); - _cfC_SubdetPM_QIE1011.fill(did, q); - _cLETDCvsADC_SubdetPM.fill(did, digi[i].adc(), digi[i].le_tdc()); - _cLETDCvsTS_SubdetPM.fill(did, (int)i, digi[i].le_tdc()); - if (digi[i].le_tdc() <50) { - double time = i*25. + (digi[i].le_tdc() / 2.); - _cLETDCTime_SubdetPM.fill(did, time); - _cLETDCTime_depth.fill(did, time); - _cLETDCTimevsADC_SubdetPM.fill(did, digi[i].adc(), time); - } - - // Bad TDC values: 50-61 should never happen in QIE10 or QIE11, but we are seeing some in 2017 data. - if ((50 <= digi[i].le_tdc()) && (digi[i].le_tdc() <= 61)) { - _cBadTDCValues_SubdetPM.fill(did, digi[i].le_tdc()); - _cBadTDCvsBX_SubdetPM.fill(did, bx); - _cBadTDCvsLS_SubdetPM.fill(did, _currentLS); - _cBadTDCCount_depth.fill(did); - } - if (_ptype != fOffline) { // hidefed2crate - _cADCvsTS_SubdetPM_QIE1011.fill(did, (int)i, digi[i].adc()); - if (sumQ>_cutSumQ_HF) - _cShapeCut_FED.fill(eid, (int)i, q); - } - //} - } - - if (sumQ>_cutSumQ_HF) - { - double timing = hcaldqm::utilities::aveTS_v10(digi, 2.5, 0, - digi.samples()-1); - double q1 = hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, 1); - double q2 = hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, 2); - double q2q12 = q2/(q1+q2); - _cSumQ_depth.fill(did, sumQ); - //if (!_filter_QIE1011.filter(did)) { - _cSumQvsLS_SubdetPM_QIE1011.fill(did, _currentLS, sumQ); - //} - _cTimingCut_SubdetPM.fill(did, timing); - _cTimingCut_depth.fill(did, timing); - _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); - if (_ptype==fOnline) - { - //if (!_filter_QIE1011.filter(did)) { - _cSumQvsBX_SubdetPM_QIE1011.fill(did, bx, sumQ); - //} - _cTimingCutvsiphi_SubdetPM.fill(did, timing); - _cTimingCutvsieta_Subdet.fill(did, timing); - _cOccupancyCutvsiphi_SubdetPM.fill(did); - _cOccupancyCutvsieta_Subdet.fill(did); - _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); - // _cOccupancyCutvsSlotvsLS_HFPM.fill(did, _currentLS); - _xUniHF.get(eid)++; - } - if (_ptype != fOffline) { // hidefed2crate - _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); - } - _cOccupancyCut_depth.fill(did); - if (!eid.isVMEid()) - if (_ptype==fOnline) - _cQ2Q12CutvsLS_FEDHF.fill(eid, _currentLS, q2q12); - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - { - _cTimingCut_FEDVME.fill(eid, timing); - _cTimingCut_ElectronicsVME.fill(eid, timing); - _cOccupancyCut_FEDVME.fill(eid); - _cOccupancyCut_ElectronicsVME.fill(eid); - } - else - { - _cTimingCut_FEDuTCA.fill(eid, timing); - _cTimingCut_ElectronicsuTCA.fill(eid, timing); - _cOccupancyCut_FEDuTCA.fill(eid); - _cOccupancyCut_ElectronicsuTCA.fill(eid); - } - } - numChsCut++; - } - numChs++; - } - } - - if (rawidValid!=0) - { - _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, - numChs); - - if (_ptype==fOnline) - { - _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidValid), - _currentLS, numChsCut); - _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidValid), bx, - numChsCut); - } - } + } + } + + for (int i = 0; i < digi.samples(); i++) { + double q = hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, i); + //if (!_filter_QIE1011.filter(did)) { + _cADC_SubdetPM_QIE1011.fill(did, digi[i].adc()); + _cfC_SubdetPM_QIE1011.fill(did, q); + _cLETDCvsADC_SubdetPM.fill(did, digi[i].adc(), digi[i].le_tdc()); + _cLETDCvsTS_SubdetPM.fill(did, (int)i, digi[i].le_tdc()); + if (digi[i].le_tdc() < 50) { + double time = i * 25. + (digi[i].le_tdc() / 2.); + _cLETDCTime_SubdetPM.fill(did, time); + _cLETDCTime_depth.fill(did, time); + _cLETDCTimevsADC_SubdetPM.fill(did, digi[i].adc(), time); + } + + // Bad TDC values: 50-61 should never happen in QIE10 or QIE11, but we are seeing some in 2017 data. + if ((50 <= digi[i].le_tdc()) && (digi[i].le_tdc() <= 61)) { + _cBadTDCValues_SubdetPM.fill(did, digi[i].le_tdc()); + _cBadTDCvsBX_SubdetPM.fill(did, bx); + _cBadTDCvsLS_SubdetPM.fill(did, _currentLS); + _cBadTDCCount_depth.fill(did); + } + if (_ptype != fOffline) { // hidefed2crate + _cADCvsTS_SubdetPM_QIE1011.fill(did, (int)i, digi[i].adc()); + if (sumQ > _cutSumQ_HF) + _cShapeCut_FED.fill(eid, (int)i, q); + } + //} + } + + if (sumQ > _cutSumQ_HF) { + double timing = hcaldqm::utilities::aveTS_v10(digi, 2.5, 0, digi.samples() - 1); + double q1 = hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, 1); + double q2 = hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, 2); + double q2q12 = q2 / (q1 + q2); + _cSumQ_depth.fill(did, sumQ); + //if (!_filter_QIE1011.filter(did)) { + _cSumQvsLS_SubdetPM_QIE1011.fill(did, _currentLS, sumQ); + //} + _cTimingCut_SubdetPM.fill(did, timing); + _cTimingCut_depth.fill(did, timing); + _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); + if (_ptype == fOnline) { + //if (!_filter_QIE1011.filter(did)) { + _cSumQvsBX_SubdetPM_QIE1011.fill(did, bx, sumQ); + //} + _cTimingCutvsiphi_SubdetPM.fill(did, timing); + _cTimingCutvsieta_Subdet.fill(did, timing); + _cOccupancyCutvsiphi_SubdetPM.fill(did); + _cOccupancyCutvsieta_Subdet.fill(did); + _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); + // _cOccupancyCutvsSlotvsLS_HFPM.fill(did, _currentLS); + _xUniHF.get(eid)++; + } + if (_ptype != fOffline) { // hidefed2crate + _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); + } + _cOccupancyCut_depth.fill(did); + if (!eid.isVMEid()) + if (_ptype == fOnline) + _cQ2Q12CutvsLS_FEDHF.fill(eid, _currentLS, q2q12); + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) { + _cTimingCut_FEDVME.fill(eid, timing); + _cTimingCut_ElectronicsVME.fill(eid, timing); + _cOccupancyCut_FEDVME.fill(eid); + _cOccupancyCut_ElectronicsVME.fill(eid); + } else { + _cTimingCut_FEDuTCA.fill(eid, timing); + _cTimingCut_ElectronicsuTCA.fill(eid, timing); + _cOccupancyCut_FEDuTCA.fill(eid); + _cOccupancyCut_ElectronicsuTCA.fill(eid); + } + } + numChsCut++; + } + numChs++; + } + } + + if (rawidValid != 0) { + _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, numChs); + + if (_ptype == fOnline) { + _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, numChsCut); + _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidValid), bx, numChsCut); + } + } } -/* virtual */ void DigiTask::beginLuminosityBlock( - edm::LuminosityBlock const& lb, edm::EventSetup const& es) -{ - DQTask::beginLuminosityBlock(lb, es); - if (_ptype == fOnline) { - // Reset the bin for _cCapid_BadvsFEDvsLSmod60 - for (std::vector::const_iterator it=_vhashFEDs.begin(); - it!=_vhashFEDs.end(); ++it) { - HcalElectronicsId eid = HcalElectronicsId(*it); - _cCapid_BadvsFEDvsLSmod60.setBinContent(eid, _currentLS % 50, 0); - } - } +/* virtual */ void DigiTask::beginLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + DQTask::beginLuminosityBlock(lb, es); + if (_ptype == fOnline) { + // Reset the bin for _cCapid_BadvsFEDvsLSmod60 + for (std::vector::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) { + HcalElectronicsId eid = HcalElectronicsId(*it); + _cCapid_BadvsFEDvsLSmod60.setBinContent(eid, _currentLS % 50, 0); + } + } } -/* virtual */ void DigiTask::endLuminosityBlock(edm::LuminosityBlock const& lb, - edm::EventSetup const& es) -{ - if (_ptype!=fOnline) - return; - - for (uintCompactMap::const_iterator it=_xUniHF.begin(); - it!=_xUniHF.end(); ++it) - { - uint32_t hash1 = it->first; - HcalElectronicsId eid1(hash1); - double x1 = it->second; - - for (uintCompactMap::const_iterator jt=_xUniHF.begin(); - jt!=_xUniHF.end(); ++jt) - { - if (jt==it) - continue; - double x2 = jt->second; - if (x2==0) - continue; - if (x1/x2<_thresh_unihf) - _xUni.get(eid1)++; - } - } - - if (_ptype != fOffline) { // hidefed2crate - for (std::vector::const_iterator it=_vhashFEDs.begin(); - it!=_vhashFEDs.end(); ++it) - { - hcaldqm::flag::Flag fSum("DIGI"); - HcalElectronicsId eid = HcalElectronicsId(*it); - - std::vector::const_iterator cit=std::find( - _vcdaqEids.begin(), _vcdaqEids.end(), *it); - if (cit==_vcdaqEids.end()) - { - // not @cDAQ - for (uint32_t iflag=0; iflag<_vflags.size(); iflag++) - _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), - int(hcaldqm::flag::fNCDAQ)); - _cSummaryvsLS.setBinContent(eid, _currentLS, int(hcaldqm::flag::fNCDAQ)); - continue; - } - - // FED is @cDAQ - if (hcaldqm::utilities::isFEDHBHE(eid) || hcaldqm::utilities::isFEDHF(eid) || - hcaldqm::utilities::isFEDHO(eid)) - { - if (_xDigiSize.get(eid)>0) - _vflags[fDigiSize]._state = hcaldqm::flag::fBAD; - else - _vflags[fDigiSize]._state = hcaldqm::flag::fGOOD; - - if (_xBadCapid.get(eid) > 0) { - _vflags[fCapId]._state = hcaldqm::flag::fBAD; - } else { - _vflags[fCapId]._state = hcaldqm::flag::fGOOD; - } - - if (hcaldqm::utilities::isFEDHF(eid)) - { - double fr = double(_xNChs.get(eid))/double( - _xNChsNominal.get(eid)*_evsPerLS); - if (_runkeyVal==0 || _runkeyVal==4) - { - // only for pp or hi - if (_xUni.get(eid)>0) - _vflags[fUni]._state = hcaldqm::flag::fPROBLEMATIC; - else - _vflags[fUni]._state = hcaldqm::flag::fGOOD; - } - if (fr<0.95) - _vflags[fNChsHF]._state = hcaldqm::flag::fBAD; - else if (fr<1.0) - _vflags[fNChsHF]._state = hcaldqm::flag::fPROBLEMATIC; - else - _vflags[fNChsHF]._state = hcaldqm::flag::fGOOD; - } - } - if (_unknownIdsPresent) - _vflags[fUnknownIds]._state = hcaldqm::flag::fBAD; - else - _vflags[fUnknownIds]._state = hcaldqm::flag::fGOOD; - - // LED misfires - if (_ptype != fLocal) { - if (hcaldqm::utilities::isFEDHBHE(eid)) { - HcalDetId did_hb(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalBarrel, 1, 1, 1))); - HcalDetId did_he(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalEndcap, 16, 1, 1))); - - if (_LED_CUCountvsLS_Subdet.getBinContent(did_hb, _currentLS) > 0 || _LED_CUCountvsLS_Subdet.getBinContent(did_he, _currentLS) > 0) { - _vflags[fLED]._state = hcaldqm::flag::fBAD; - } else { - _vflags[fLED]._state = hcaldqm::flag::fGOOD; - } - } else if (hcaldqm::utilities::isFEDHF(eid)) { - HcalDetId did_hf(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalForward, 29, 1, 1))); - if (_LED_CUCountvsLS_Subdet.getBinContent(did_hf, _currentLS) > 0) { - _vflags[fLED]._state = hcaldqm::flag::fBAD; - } else { - _vflags[fLED]._state = hcaldqm::flag::fGOOD; - } - } else if (hcaldqm::utilities::isFEDHO(eid)) { - HcalDetId did_ho(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalOuter, 1, 1, 1))); - if (_LED_CUCountvsLS_Subdet.getBinContent(did_ho, _currentLS) > 0) { - _vflags[fLED]._state = hcaldqm::flag::fBAD; - } else { - _vflags[fLED]._state = hcaldqm::flag::fGOOD; - } - } - } - - int iflag=0; - for (std::vector::iterator ft=_vflags.begin(); - ft!=_vflags.end(); ++ft) - { - _cSummaryvsLS_FED.setBinContent(eid, _currentLS, iflag, - int(ft->_state)); - fSum+=(*ft); - iflag++; - - // reset! - ft->reset(); - } - _cSummaryvsLS.setBinContent(eid, _currentLS, fSum._state); - } - } - - _xDigiSize.reset(); _xUniHF.reset(); _xUni.reset(); - _xNChs.reset(); - _xBadCapid.reset(); - - // in the end always do the DQTask::endLumi - DQTask::endLuminosityBlock(lb, es); +/* virtual */ void DigiTask::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + if (_ptype != fOnline) + return; + + for (uintCompactMap::const_iterator it = _xUniHF.begin(); it != _xUniHF.end(); ++it) { + uint32_t hash1 = it->first; + HcalElectronicsId eid1(hash1); + double x1 = it->second; + + for (uintCompactMap::const_iterator jt = _xUniHF.begin(); jt != _xUniHF.end(); ++jt) { + if (jt == it) + continue; + double x2 = jt->second; + if (x2 == 0) + continue; + if (x1 / x2 < _thresh_unihf) + _xUni.get(eid1)++; + } + } + + if (_ptype != fOffline) { // hidefed2crate + for (std::vector::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) { + hcaldqm::flag::Flag fSum("DIGI"); + HcalElectronicsId eid = HcalElectronicsId(*it); + + std::vector::const_iterator cit = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), *it); + if (cit == _vcdaqEids.end()) { + // not @cDAQ + for (uint32_t iflag = 0; iflag < _vflags.size(); iflag++) + _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), int(hcaldqm::flag::fNCDAQ)); + _cSummaryvsLS.setBinContent(eid, _currentLS, int(hcaldqm::flag::fNCDAQ)); + continue; + } + + // FED is @cDAQ + if (hcaldqm::utilities::isFEDHBHE(eid) || hcaldqm::utilities::isFEDHF(eid) || hcaldqm::utilities::isFEDHO(eid)) { + if (_xDigiSize.get(eid) > 0) + _vflags[fDigiSize]._state = hcaldqm::flag::fBAD; + else + _vflags[fDigiSize]._state = hcaldqm::flag::fGOOD; + + if (_xBadCapid.get(eid) > 0) { + _vflags[fCapId]._state = hcaldqm::flag::fBAD; + } else { + _vflags[fCapId]._state = hcaldqm::flag::fGOOD; + } + + if (hcaldqm::utilities::isFEDHF(eid)) { + double fr = double(_xNChs.get(eid)) / double(_xNChsNominal.get(eid) * _evsPerLS); + if (_runkeyVal == 0 || _runkeyVal == 4) { + // only for pp or hi + if (_xUni.get(eid) > 0) + _vflags[fUni]._state = hcaldqm::flag::fPROBLEMATIC; + else + _vflags[fUni]._state = hcaldqm::flag::fGOOD; + } + if (fr < 0.95) + _vflags[fNChsHF]._state = hcaldqm::flag::fBAD; + else if (fr < 1.0) + _vflags[fNChsHF]._state = hcaldqm::flag::fPROBLEMATIC; + else + _vflags[fNChsHF]._state = hcaldqm::flag::fGOOD; + } + } + if (_unknownIdsPresent) + _vflags[fUnknownIds]._state = hcaldqm::flag::fBAD; + else + _vflags[fUnknownIds]._state = hcaldqm::flag::fGOOD; + + // LED misfires + if (_ptype != fLocal) { + if (hcaldqm::utilities::isFEDHBHE(eid)) { + HcalDetId did_hb(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalBarrel, 1, 1, 1))); + HcalDetId did_he(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalEndcap, 16, 1, 1))); + + if (_LED_CUCountvsLS_Subdet.getBinContent(did_hb, _currentLS) > 0 || + _LED_CUCountvsLS_Subdet.getBinContent(did_he, _currentLS) > 0) { + _vflags[fLED]._state = hcaldqm::flag::fBAD; + } else { + _vflags[fLED]._state = hcaldqm::flag::fGOOD; + } + } else if (hcaldqm::utilities::isFEDHF(eid)) { + HcalDetId did_hf(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalForward, 29, 1, 1))); + if (_LED_CUCountvsLS_Subdet.getBinContent(did_hf, _currentLS) > 0) { + _vflags[fLED]._state = hcaldqm::flag::fBAD; + } else { + _vflags[fLED]._state = hcaldqm::flag::fGOOD; + } + } else if (hcaldqm::utilities::isFEDHO(eid)) { + HcalDetId did_ho(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalOuter, 1, 1, 1))); + if (_LED_CUCountvsLS_Subdet.getBinContent(did_ho, _currentLS) > 0) { + _vflags[fLED]._state = hcaldqm::flag::fBAD; + } else { + _vflags[fLED]._state = hcaldqm::flag::fGOOD; + } + } + } + + int iflag = 0; + for (std::vector::iterator ft = _vflags.begin(); ft != _vflags.end(); ++ft) { + _cSummaryvsLS_FED.setBinContent(eid, _currentLS, iflag, int(ft->_state)); + fSum += (*ft); + iflag++; + + // reset! + ft->reset(); + } + _cSummaryvsLS.setBinContent(eid, _currentLS, fSum._state); + } + } + + _xDigiSize.reset(); + _xUniHF.reset(); + _xUni.reset(); + _xNChs.reset(); + _xBadCapid.reset(); + + // in the end always do the DQTask::endLumi + DQTask::endLuminosityBlock(lb, es); } DEFINE_FWK_MODULE(DigiTask); - diff --git a/DQM/HcalTasks/plugins/FCDTask.cc b/DQM/HcalTasks/plugins/FCDTask.cc index 92f788237226f..afcee77101e2a 100644 --- a/DQM/HcalTasks/plugins/FCDTask.cc +++ b/DQM/HcalTasks/plugins/FCDTask.cc @@ -2,105 +2,98 @@ #include "DQM/HcalTasks/interface/FCDTask.h" bool operator==(const FCDTask::FCDChannel& lhs, const FCDTask::FCDChannel& rhs) { - return ((lhs.crate == rhs.crate) && (lhs.slot == rhs.slot) && (lhs.fiber == rhs.fiber) && (lhs.fiberChannel == rhs.fiberChannel)); + return ((lhs.crate == rhs.crate) && (lhs.slot == rhs.slot) && (lhs.fiber == rhs.fiber) && + (lhs.fiberChannel == rhs.fiberChannel)); } - -FCDTask::FCDTask(edm::ParameterSet const& ps) -{ - // tags - _tagQIE10 = ps.getUntrackedParameter("tagQIE10", - edm::InputTag("hcalDigis", "ZDC")); - _tokQIE10 = consumes(_tagQIE10); - - // channels - edm::ParameterSet channelPSet = ps.getParameter("fcdChannels"); - std::vector crates = channelPSet.getUntrackedParameter >("crate"); - std::vector slots = channelPSet.getUntrackedParameter >("slot"); - std::vector fibers = channelPSet.getUntrackedParameter >("fiber"); - std::vector fiberChannels = channelPSet.getUntrackedParameter >("fiber_channel"); - for (unsigned int i = 0; i < crates.size(); ++i) { - _channels.push_back({crates[i], slots[i], fibers[i], fiberChannels[i]}); - } +FCDTask::FCDTask(edm::ParameterSet const& ps) { + // tags + _tagQIE10 = ps.getUntrackedParameter("tagQIE10", edm::InputTag("hcalDigis", "ZDC")); + _tokQIE10 = consumes(_tagQIE10); + + // channels + edm::ParameterSet channelPSet = ps.getParameter("fcdChannels"); + std::vector crates = channelPSet.getUntrackedParameter >("crate"); + std::vector slots = channelPSet.getUntrackedParameter >("slot"); + std::vector fibers = channelPSet.getUntrackedParameter >("fiber"); + std::vector fiberChannels = channelPSet.getUntrackedParameter >("fiber_channel"); + for (unsigned int i = 0; i < crates.size(); ++i) { + _channels.push_back({crates[i], slots[i], fibers[i], fiberChannels[i]}); + } } -/* virtual */ void FCDTask::bookHistograms(DQMStore::IBooker &ib, - edm::Run const& r, edm::EventSetup const& es) -{ - edm::ESHandle dbService; - es.get().get(dbService); - _emap = dbService->getHcalMapping(); - _ehashmap.initialize(_emap, hcaldqm::electronicsmap::fD2EHashMap); - - ib.cd(); - - //book histos per channel - std::string histoname; - std::vector gids = _emap->allPrecisionId(); - for (auto& it_gid : gids) { - if (it_gid.genericSubdet() != HcalGenericDetId::HcalGenZDC) { - continue; - } - HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(it_gid)); - for (auto& it_channel : _channels) { - if ((eid.crateId() == it_channel.crate) && (eid.slot() == it_channel.slot) && (eid.fiberIndex() == it_channel.fiber) && (eid.fiberChanId() == it_channel.fiberChannel)) { - _fcd_eids.push_back(eid); - } - } - } - for (auto& it_eid : _fcd_eids) { - // EM Pos - histoname = std::to_string(it_eid.crateId()) + "-" + std::to_string(it_eid.slot()) + "-" + std::to_string(it_eid.fiberIndex()) + "-" + std::to_string(it_eid.fiberChanId()); - ib.setCurrentFolder("Hcal/FCDTask/ADC"); - _cADC[it_eid] = ib.book1D( histoname.c_str(), histoname.c_str(), 256, 0, 256); - _cADC[it_eid]->setAxisTitle("ADC", 1); - _cADC[it_eid]->setAxisTitle("N", 2); - - ib.setCurrentFolder("Hcal/FCDTask/ADC_vs_TS"), - _cADC_vs_TS[it_eid] = ib.book2D( histoname.c_str(), histoname.c_str(), 10, 0, 10, 64, 0, 256); - _cADC_vs_TS[it_eid]->setAxisTitle("TS", 1); - _cADC_vs_TS[it_eid]->setAxisTitle("ADC", 2); - - ib.setCurrentFolder("Hcal/FCDTask/TDCTime"); - _cTDCTime[it_eid] = ib.book1D( histoname.c_str(), histoname.c_str(), 500, 0., 250.); - _cTDCTime[it_eid]->setAxisTitle("TDC time [ns]", 1); - - - ib.setCurrentFolder("Hcal/FCDTask/TDC"); - _cTDC[it_eid] = ib.book1D( histoname.c_str(), histoname.c_str(), 64, -0.5, 63.5); - _cTDC[it_eid]->setAxisTitle("TDC", 1); - - } +/* virtual */ void FCDTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + edm::ESHandle dbService; + es.get().get(dbService); + _emap = dbService->getHcalMapping(); + _ehashmap.initialize(_emap, hcaldqm::electronicsmap::fD2EHashMap); + + ib.cd(); + + //book histos per channel + std::string histoname; + std::vector gids = _emap->allPrecisionId(); + for (auto& it_gid : gids) { + if (it_gid.genericSubdet() != HcalGenericDetId::HcalGenZDC) { + continue; + } + HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(it_gid)); + for (auto& it_channel : _channels) { + if ((eid.crateId() == it_channel.crate) && (eid.slot() == it_channel.slot) && + (eid.fiberIndex() == it_channel.fiber) && (eid.fiberChanId() == it_channel.fiberChannel)) { + _fcd_eids.push_back(eid); + } + } + } + for (auto& it_eid : _fcd_eids) { + // EM Pos + histoname = std::to_string(it_eid.crateId()) + "-" + std::to_string(it_eid.slot()) + "-" + + std::to_string(it_eid.fiberIndex()) + "-" + std::to_string(it_eid.fiberChanId()); + ib.setCurrentFolder("Hcal/FCDTask/ADC"); + _cADC[it_eid] = ib.book1D(histoname.c_str(), histoname.c_str(), 256, 0, 256); + _cADC[it_eid]->setAxisTitle("ADC", 1); + _cADC[it_eid]->setAxisTitle("N", 2); + + ib.setCurrentFolder("Hcal/FCDTask/ADC_vs_TS"), + _cADC_vs_TS[it_eid] = ib.book2D(histoname.c_str(), histoname.c_str(), 10, 0, 10, 64, 0, 256); + _cADC_vs_TS[it_eid]->setAxisTitle("TS", 1); + _cADC_vs_TS[it_eid]->setAxisTitle("ADC", 2); + + ib.setCurrentFolder("Hcal/FCDTask/TDCTime"); + _cTDCTime[it_eid] = ib.book1D(histoname.c_str(), histoname.c_str(), 500, 0., 250.); + _cTDCTime[it_eid]->setAxisTitle("TDC time [ns]", 1); + + ib.setCurrentFolder("Hcal/FCDTask/TDC"); + _cTDC[it_eid] = ib.book1D(histoname.c_str(), histoname.c_str(), 64, -0.5, 63.5); + _cTDC[it_eid]->setAxisTitle("TDC", 1); + } } - -/* virtual */ void FCDTask::analyze(edm::Event const& e, edm::EventSetup const&) -{ - edm::Handle digis; - if (!e.getByToken(_tokQIE10, digis)) - edm::LogError("Collection QIE10DigiCollection for ZDC isn't available" - + _tagQIE10.label() + " " + _tagQIE10.instance()); - - for ( auto it = digis->begin(); it != digis->end(); it++ ) { - const QIE10DataFrame digi = static_cast(*it); - HcalGenericDetId const& gdid = digi.detid(); - HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(gdid)); - if (std::find(_fcd_eids.begin(), _fcd_eids.end(), eid) == _fcd_eids.end()) { - continue; - } - - for ( int i = 0; i < digi.samples(); i++ ) { - // iter over all samples - _cADC[eid]->Fill(digi[i].adc()); - _cADC_vs_TS[eid]->Fill(i, digi[i].adc()); - _cTDC[eid]->Fill(digi[i].le_tdc()); - if (digi[i].le_tdc() <= 50.) { - double tdctime = 25. * i + 0.5 * digi[i].le_tdc(); - _cTDCTime[eid]->Fill(tdctime); - } - } - } +/* virtual */ void FCDTask::analyze(edm::Event const& e, edm::EventSetup const&) { + edm::Handle digis; + if (!e.getByToken(_tokQIE10, digis)) + edm::LogError("Collection QIE10DigiCollection for ZDC isn't available" + _tagQIE10.label() + " " + + _tagQIE10.instance()); + + for (auto it = digis->begin(); it != digis->end(); it++) { + const QIE10DataFrame digi = static_cast(*it); + HcalGenericDetId const& gdid = digi.detid(); + HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(gdid)); + if (std::find(_fcd_eids.begin(), _fcd_eids.end(), eid) == _fcd_eids.end()) { + continue; + } + + for (int i = 0; i < digi.samples(); i++) { + // iter over all samples + _cADC[eid]->Fill(digi[i].adc()); + _cADC_vs_TS[eid]->Fill(i, digi[i].adc()); + _cTDC[eid]->Fill(digi[i].le_tdc()); + if (digi[i].le_tdc() <= 50.) { + double tdctime = 25. * i + 0.5 * digi[i].le_tdc(); + _cTDCTime[eid]->Fill(tdctime); + } + } + } } - DEFINE_FWK_MODULE(FCDTask); diff --git a/DQM/HcalTasks/plugins/HFRaddamTask.cc b/DQM/HcalTasks/plugins/HFRaddamTask.cc index 5a5a33dc728d2..1aca941fab06c 100644 --- a/DQM/HcalTasks/plugins/HFRaddamTask.cc +++ b/DQM/HcalTasks/plugins/HFRaddamTask.cc @@ -1,150 +1,130 @@ - + #include "DQM/HcalTasks/interface/HFRaddamTask.h" using namespace hcaldqm; using namespace hcaldqm::constants; using namespace hcaldqm::filter; -HFRaddamTask::HFRaddamTask(edm::ParameterSet const& ps): - DQTask(ps) -{ - // List all the DetIds - _vDetIds.push_back(HcalDetId(HcalForward, -30, 35, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, -30, 71, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, -32, 15, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, -32, 51, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, -34, 35, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, -34, 71, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, -36, 15, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, -36, 51, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, -38, 35, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, -38, 71, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, -40, 15, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, -40, 51, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, -41, 35, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, -41, 71, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, -30, 15, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, -30, 51, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, -32, 35, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, -32, 71, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, -34, 15, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, -34, 51, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, -36, 35, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, -36, 71, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, -38, 15, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, -38, 51, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, -40, 35, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, -40, 71, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, -41, 15, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, -41, 51, 2)); +HFRaddamTask::HFRaddamTask(edm::ParameterSet const& ps) : DQTask(ps) { + // List all the DetIds + _vDetIds.push_back(HcalDetId(HcalForward, -30, 35, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, -30, 71, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, -32, 15, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, -32, 51, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, -34, 35, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, -34, 71, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, -36, 15, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, -36, 51, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, -38, 35, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, -38, 71, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, -40, 15, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, -40, 51, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, -41, 35, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, -41, 71, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, -30, 15, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, -30, 51, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, -32, 35, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, -32, 71, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, -34, 15, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, -34, 51, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, -36, 35, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, -36, 71, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, -38, 15, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, -38, 51, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, -40, 35, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, -40, 71, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, -41, 15, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, -41, 51, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, 30, 21, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, 30, 57, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, 32, 1, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, 32, 37, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, 34, 21, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, 34, 57, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, 36, 1, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, 36, 37, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, 38, 21, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, 38, 57, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, 40, 35, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, 40, 71, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, 41, 19, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, 41, 55, 1)); - _vDetIds.push_back(HcalDetId(HcalForward, 30, 1, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, 30, 37, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, 32, 21, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, 32, 57, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, 34, 1, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, 34, 37, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, 36, 21, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, 36, 57, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, 38, 1, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, 38, 37, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, 40, 19, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, 40, 55, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, 41, 35, 2)); - _vDetIds.push_back(HcalDetId(HcalForward, 41, 71, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, 30, 21, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, 30, 57, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, 32, 1, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, 32, 37, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, 34, 21, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, 34, 57, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, 36, 1, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, 36, 37, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, 38, 21, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, 38, 57, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, 40, 35, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, 40, 71, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, 41, 19, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, 41, 55, 1)); + _vDetIds.push_back(HcalDetId(HcalForward, 30, 1, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, 30, 37, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, 32, 21, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, 32, 57, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, 34, 1, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, 34, 37, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, 36, 21, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, 36, 57, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, 38, 1, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, 38, 37, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, 40, 19, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, 40, 55, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, 41, 35, 2)); + _vDetIds.push_back(HcalDetId(HcalForward, 41, 71, 2)); - // tags - _tagHF = ps.getUntrackedParameter("tagHF", - edm::InputTag("hcalDigis")); - _taguMN = ps.getUntrackedParameter("taguMN", - edm::InputTag("hcalDigis")); - _tokHF = consumes(_tagHF); - _tokuMN = consumes(_taguMN); + // tags + _tagHF = ps.getUntrackedParameter("tagHF", edm::InputTag("hcalDigis")); + _taguMN = ps.getUntrackedParameter("taguMN", edm::InputTag("hcalDigis")); + _tokHF = consumes(_tagHF); + _tokuMN = consumes(_taguMN); } -/* virtual */ void HFRaddamTask::bookHistograms(DQMStore::IBooker& ib, - edm::Run const& r, edm::EventSetup const& es) -{ - // Initialize all the Single Containers - for (std::vector::const_iterator it=_vDetIds.begin(); - it!=_vDetIds.end(); ++it) - { - _vcShape.push_back(ContainerSingle1D(_name, - "Shape", - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000))); - } +/* virtual */ void HFRaddamTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + // Initialize all the Single Containers + for (std::vector::const_iterator it = _vDetIds.begin(); it != _vDetIds.end(); ++it) { + _vcShape.push_back(ContainerSingle1D(_name, + "Shape", + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000))); + } - DQTask::bookHistograms(ib, r, es); - char aux[200]; - for (unsigned int i=0; i<_vDetIds.size(); i++) - { - sprintf(aux, "ieta%diphi%dd%d", _vDetIds[i].ieta(), - _vDetIds[i].iphi(), _vDetIds[i].depth()); - _vcShape[i].book(ib, _subsystem, aux); - } + DQTask::bookHistograms(ib, r, es); + char aux[200]; + for (unsigned int i = 0; i < _vDetIds.size(); i++) { + sprintf(aux, "ieta%diphi%dd%d", _vDetIds[i].ieta(), _vDetIds[i].iphi(), _vDetIds[i].depth()); + _vcShape[i].book(ib, _subsystem, aux); + } } -/* virtual */ void HFRaddamTask::_process(edm::Event const &e, - edm::EventSetup const& es) -{ - edm::Handle chf; - if (!e.getByToken(_tokHF, chf)) - _logger.dqmthrow("Collection HFDigiCollection isn't avalaible" - + _tagHF.label() + " " + _tagHF.instance()); +/* virtual */ void HFRaddamTask::_process(edm::Event const& e, edm::EventSetup const& es) { + edm::Handle chf; + if (!e.getByToken(_tokHF, chf)) + _logger.dqmthrow("Collection HFDigiCollection isn't avalaible" + _tagHF.label() + " " + _tagHF.instance()); - for (HFDigiCollection::const_iterator it=chf->begin(); - it!=chf->end(); ++it) - { - const HFDataFrame digi = (const HFDataFrame)(*it); - for (unsigned int i=0; i<_vDetIds.size(); i++) - if (digi.id()==_vDetIds[i]) - { - for (int j=0; jbegin(); it != chf->end(); ++it) { + const HFDataFrame digi = (const HFDataFrame)(*it); + for (unsigned int i = 0; i < _vDetIds.size(); i++) + if (digi.id() == _vDetIds[i]) { + for (int j = 0; j < digi.size(); j++) + _vcShape[i].fill(j, digi.sample(j).nominal_fC() - 2.5); + } + } } -/* virtual */ bool HFRaddamTask::_isApplicable(edm::Event const &e) -{ - if (_ptype==fOnline) - { - edm::Handle cumn; - if (!e.getByToken(_tokuMN, cumn)) - return false; +/* virtual */ bool HFRaddamTask::_isApplicable(edm::Event const& e) { + if (_ptype == fOnline) { + edm::Handle cumn; + if (!e.getByToken(_tokuMN, cumn)) + return false; - // event type check first - uint8_t eventType = cumn->eventType(); - if (eventType!=constants::EVENTTYPE_LASER) - return false; + // event type check first + uint8_t eventType = cumn->eventType(); + if (eventType != constants::EVENTTYPE_LASER) + return false; - // check if this analysis task is of the right laser type - uint32_t laserType = cumn->valueUserWord(0); - if (laserType==constants::tHFRaddam) return true; - } - else - { - // local, just return true as all the settings will be done in cfg - return true; - } + // check if this analysis task is of the right laser type + uint32_t laserType = cumn->valueUserWord(0); + if (laserType == constants::tHFRaddam) + return true; + } else { + // local, just return true as all the settings will be done in cfg + return true; + } - return false; + return false; } DEFINE_FWK_MODULE(HFRaddamTask); diff --git a/DQM/HcalTasks/plugins/HcalOfflineHarvesting.cc b/DQM/HcalTasks/plugins/HcalOfflineHarvesting.cc index b7372482dc817..e1df4107a8f11 100644 --- a/DQM/HcalTasks/plugins/HcalOfflineHarvesting.cc +++ b/DQM/HcalTasks/plugins/HcalOfflineHarvesting.cc @@ -4,145 +4,132 @@ using namespace hcaldqm; using namespace hcaldqm::constants; using namespace hcaldqm::filter; -HcalOfflineHarvesting::HcalOfflineHarvesting(edm::ParameterSet const& ps) : - DQHarvester(ps), _reportSummaryMap(nullptr) -{ - _summaryList.push_back(fTP); - _summaryList.push_back(fDigi); - _summaryList.push_back(fReco); - _sumnames[fRaw]="RawTask"; - _sumnames[fDigi]="DigiTask"; - _sumnames[fReco]="RecHitTask"; - _sumnames[fTP]="TPTask"; - for (auto& it_sum : _summaryList) { - _summarks[it_sum]=false; - } +HcalOfflineHarvesting::HcalOfflineHarvesting(edm::ParameterSet const& ps) + : DQHarvester(ps), _reportSummaryMap(nullptr) { + _summaryList.push_back(fTP); + _summaryList.push_back(fDigi); + _summaryList.push_back(fReco); + _sumnames[fRaw] = "RawTask"; + _sumnames[fDigi] = "DigiTask"; + _sumnames[fReco] = "RecHitTask"; + _sumnames[fTP] = "TPTask"; + for (auto& it_sum : _summaryList) { + _summarks[it_sum] = false; + } - if (std::find(_summaryList.begin(), _summaryList.end(), fRaw) != _summaryList.end()) { - _sumgen[fRaw]=new hcaldqm::RawRunSummary("RawRunHarvesting", _sumnames[fRaw],ps); - } - if (std::find(_summaryList.begin(), _summaryList.end(), fDigi) != _summaryList.end()) { - _sumgen[fDigi]=new hcaldqm::DigiRunSummary("DigiRunHarvesting", _sumnames[fDigi],ps); - } - if (std::find(_summaryList.begin(), _summaryList.end(), fReco) != _summaryList.end()) { - _sumgen[fReco]=new hcaldqm::RecoRunSummary("RecoRunHarvesting", _sumnames[fReco],ps); - } - if (std::find(_summaryList.begin(), _summaryList.end(), fTP) != _summaryList.end()) { - _sumgen[fTP]=new hcaldqm::TPRunSummary("TPRunHarvesting", _sumnames[fTP],ps); - } + if (std::find(_summaryList.begin(), _summaryList.end(), fRaw) != _summaryList.end()) { + _sumgen[fRaw] = new hcaldqm::RawRunSummary("RawRunHarvesting", _sumnames[fRaw], ps); + } + if (std::find(_summaryList.begin(), _summaryList.end(), fDigi) != _summaryList.end()) { + _sumgen[fDigi] = new hcaldqm::DigiRunSummary("DigiRunHarvesting", _sumnames[fDigi], ps); + } + if (std::find(_summaryList.begin(), _summaryList.end(), fReco) != _summaryList.end()) { + _sumgen[fReco] = new hcaldqm::RecoRunSummary("RecoRunHarvesting", _sumnames[fReco], ps); + } + if (std::find(_summaryList.begin(), _summaryList.end(), fTP) != _summaryList.end()) { + _sumgen[fTP] = new hcaldqm::TPRunSummary("TPRunHarvesting", _sumnames[fTP], ps); + } } -/* virtual */ void HcalOfflineHarvesting::beginRun( - edm::Run const& r, edm::EventSetup const& es) -{ - DQHarvester::beginRun(r,es); +/* virtual */ void HcalOfflineHarvesting::beginRun(edm::Run const& r, edm::EventSetup const& es) { + DQHarvester::beginRun(r, es); - for (auto& it_sum : _summaryList) { - _sumgen[it_sum]->beginRun(r,es); - } + for (auto& it_sum : _summaryList) { + _sumgen[it_sum]->beginRun(r, es); + } } // // For OFFLINE there is no per LS evaluation // -/* virtual */ void HcalOfflineHarvesting::_dqmEndLuminosityBlock( - DQMStore::IBooker& ib, - DQMStore::IGetter& ig, edm::LuminosityBlock const& lb, - edm::EventSetup const& es) -{ - for (auto& it_sum : _summaryList) { - if (ig.get(_subsystem + "/" + _sumnames[it_sum] + "/EventsTotal") != nullptr) { - _summarks[it_sum] = true; - } - } +/* virtual */ void HcalOfflineHarvesting::_dqmEndLuminosityBlock(DQMStore::IBooker& ib, + DQMStore::IGetter& ig, + edm::LuminosityBlock const& lb, + edm::EventSetup const& es) { + for (auto& it_sum : _summaryList) { + if (ig.get(_subsystem + "/" + _sumnames[it_sum] + "/EventsTotal") != nullptr) { + _summarks[it_sum] = true; + } + } - // CALL ALL THE HARVESTERS - for (auto& it_sum : _summaryList) { - // run only if have to - if (_summarks[it_sum]) { - (_sumgen[it_sum])->endLuminosityBlock(ib,ig,lb,es); - } - } + // CALL ALL THE HARVESTERS + for (auto& it_sum : _summaryList) { + // run only if have to + if (_summarks[it_sum]) { + (_sumgen[it_sum])->endLuminosityBlock(ib, ig, lb, es); + } + } } // // Evaluate and Generate Run Summary // -/* virtual */ void HcalOfflineHarvesting::_dqmEndJob(DQMStore::IBooker& ib, - DQMStore::IGetter& ig) -{ - // OBTAIN/SET WHICH MODULES ARE PRESENT - std::map datatier_names; - datatier_names[fRaw] = "RAW"; - datatier_names[fDigi] = "DIGI"; - datatier_names[fReco] = "RECO"; - datatier_names[fTP] = "TP"; +/* virtual */ void HcalOfflineHarvesting::_dqmEndJob(DQMStore::IBooker& ib, DQMStore::IGetter& ig) { + // OBTAIN/SET WHICH MODULES ARE PRESENT + std::map datatier_names; + datatier_names[fRaw] = "RAW"; + datatier_names[fDigi] = "DIGI"; + datatier_names[fReco] = "RECO"; + datatier_names[fTP] = "TP"; - int num=0; std::map datatiers; - for (auto& it_sum : _summaryList) { - if (_summarks[it_sum]) { - datatiers.insert(std::pair(datatier_names[it_sum], num)); - ++num; - } - } - - // CREATE THE REPORT SUMMARY MAP - // num is #modules - // datatiers - std map [DATATIER_NAME] -> [positional value [0,num-1]] - // -> bin wise +1 should be - if (!_reportSummaryMap) - { - ib.setCurrentFolder(_subsystem+"/EventInfo"); - _reportSummaryMap = ib.book2D("reportSummaryMap", "reportSummaryMap", - _vCrates.size(), 0, _vCrates.size(), num,0,num); - // x axis labels - - for (uint32_t i=0; i<_vCrates.size(); i++) - { - char name[5]; - sprintf(name, "%d", _vCrates[i]); - _reportSummaryMap->setBinLabel(i+1, name, 1); - } - // y axis lables - for (std::map::const_iterator - it=datatiers.begin(); it!=datatiers.end(); ++it) - { - std::string name = it->first; - int value = it->second; - _reportSummaryMap->setBinLabel(value+1, name, 2); - } - } + int num = 0; + std::map datatiers; + for (auto& it_sum : _summaryList) { + if (_summarks[it_sum]) { + datatiers.insert(std::pair(datatier_names[it_sum], num)); + ++num; + } + } - // iterate over all summary generators and get the flags - for (auto& it_sum : _summaryList) { - // IF MODULE IS NOT PRESENT IN DATA SKIP - if (!_summarks[it_sum]) { - continue; - } + // CREATE THE REPORT SUMMARY MAP + // num is #modules + // datatiers - std map [DATATIER_NAME] -> [positional value [0,num-1]] + // -> bin wise +1 should be + if (!_reportSummaryMap) { + ib.setCurrentFolder(_subsystem + "/EventInfo"); + _reportSummaryMap = + ib.book2D("reportSummaryMap", "reportSummaryMap", _vCrates.size(), 0, _vCrates.size(), num, 0, num); + // x axis labels - // OBTAIN ALL THE FLAGS FOR THIS MODULE - // AND SET THE REPORT STATUS MAP - // NOTE AGAIN: datatiers map [DATATIER]->[value not bin!]+1 therefore - if (_debug>0) { - std::cout << _sumnames[it_sum] << std::endl; - } - std::vector flags = (_sumgen[it_sum])->endJob(ib,ig); - if (_debug>0) - { - std::cout << "********************" << std::endl; - std::cout << "SUMMARY" << std::endl; - } - for (uint32_t icrate=0; icrate<_vCrates.size(); icrate++) - { - _reportSummaryMap->setBinContent(icrate+1, datatiers[flags[icrate]._name]+1, (int)flags[icrate]._state); - if (_debug>0) - { - std::cout << "Crate=" << _vCrates[icrate] << std::endl; - std::cout << flags[icrate]._name << " " << flags[icrate]._state - <setBinLabel(i + 1, name, 1); + } + // y axis lables + for (std::map::const_iterator it = datatiers.begin(); it != datatiers.end(); ++it) { + std::string name = it->first; + int value = it->second; + _reportSummaryMap->setBinLabel(value + 1, name, 2); + } + } + + // iterate over all summary generators and get the flags + for (auto& it_sum : _summaryList) { + // IF MODULE IS NOT PRESENT IN DATA SKIP + if (!_summarks[it_sum]) { + continue; + } + + // OBTAIN ALL THE FLAGS FOR THIS MODULE + // AND SET THE REPORT STATUS MAP + // NOTE AGAIN: datatiers map [DATATIER]->[value not bin!]+1 therefore + if (_debug > 0) { + std::cout << _sumnames[it_sum] << std::endl; + } + std::vector flags = (_sumgen[it_sum])->endJob(ib, ig); + if (_debug > 0) { + std::cout << "********************" << std::endl; + std::cout << "SUMMARY" << std::endl; + } + for (uint32_t icrate = 0; icrate < _vCrates.size(); icrate++) { + _reportSummaryMap->setBinContent(icrate + 1, datatiers[flags[icrate]._name] + 1, (int)flags[icrate]._state); + if (_debug > 0) { + std::cout << "Crate=" << _vCrates[icrate] << std::endl; + std::cout << flags[icrate]._name << " " << flags[icrate]._state << std::endl; + } + } + } } DEFINE_FWK_MODULE(HcalOfflineHarvesting); diff --git a/DQM/HcalTasks/plugins/HcalOnlineHarvesting.cc b/DQM/HcalTasks/plugins/HcalOnlineHarvesting.cc index b58faed5c99c4..2e3c6ed9875b6 100644 --- a/DQM/HcalTasks/plugins/HcalOnlineHarvesting.cc +++ b/DQM/HcalTasks/plugins/HcalOnlineHarvesting.cc @@ -3,178 +3,162 @@ using namespace hcaldqm; using namespace hcaldqm::constants; -HcalOnlineHarvesting::HcalOnlineHarvesting(edm::ParameterSet const& ps) : - DQHarvester(ps), _nBad(0), _nTotal(0), _reportSummaryMap(nullptr) -{ - - // NOTE: I will leave Run Summary Generators in place - // just not triggering on endJob! - _vsumgen.resize(nSummary); - _vnames.resize(nSummary); - _vmarks.resize(nSummary); - for (uint32_t i=0; i<_vmarks.size(); i++) - _vmarks[i]=false; - _vnames[fRaw]="RawTask"; - _vnames[fDigi]="DigiTask"; - _vnames[fReco]="RecHitTask"; - _vnames[fTP]="TPTask"; - _vnames[fPedestal]="PedestalTask"; - - _vsumgen[fRaw] = new hcaldqm::RawRunSummary("RawRunHarvesting", - _vnames[fRaw], ps); - _vsumgen[fDigi] = new hcaldqm::DigiRunSummary("DigiRunHarvesting", - _vnames[fDigi],ps); - _vsumgen[fReco] = new hcaldqm::RecoRunSummary("RecoRunHarvesting", - _vnames[fReco], ps); - _vsumgen[fTP] = new hcaldqm::TPRunSummary("TPRunHarvesting", - _vnames[fTP], ps); - _vsumgen[fPedestal] = new hcaldqm::PedestalRunSummary("PedestalRunHarvesting", - _vnames[fPedestal], ps); - - _thresh_bad_bad = ps.getUntrackedParameter("thresh_bad_bad", 0.05); +HcalOnlineHarvesting::HcalOnlineHarvesting(edm::ParameterSet const& ps) + : DQHarvester(ps), _nBad(0), _nTotal(0), _reportSummaryMap(nullptr) { + // NOTE: I will leave Run Summary Generators in place + // just not triggering on endJob! + _vsumgen.resize(nSummary); + _vnames.resize(nSummary); + _vmarks.resize(nSummary); + for (uint32_t i = 0; i < _vmarks.size(); i++) + _vmarks[i] = false; + _vnames[fRaw] = "RawTask"; + _vnames[fDigi] = "DigiTask"; + _vnames[fReco] = "RecHitTask"; + _vnames[fTP] = "TPTask"; + _vnames[fPedestal] = "PedestalTask"; + + _vsumgen[fRaw] = new hcaldqm::RawRunSummary("RawRunHarvesting", _vnames[fRaw], ps); + _vsumgen[fDigi] = new hcaldqm::DigiRunSummary("DigiRunHarvesting", _vnames[fDigi], ps); + _vsumgen[fReco] = new hcaldqm::RecoRunSummary("RecoRunHarvesting", _vnames[fReco], ps); + _vsumgen[fTP] = new hcaldqm::TPRunSummary("TPRunHarvesting", _vnames[fTP], ps); + _vsumgen[fPedestal] = new hcaldqm::PedestalRunSummary("PedestalRunHarvesting", _vnames[fPedestal], ps); + + _thresh_bad_bad = ps.getUntrackedParameter("thresh_bad_bad", 0.05); } -/* virtual */ void HcalOnlineHarvesting::beginRun( - edm::Run const& r, edm::EventSetup const& es) -{ - DQHarvester::beginRun(r,es); - for (std::vector::const_iterator it=_vsumgen.begin(); - it!=_vsumgen.end(); ++it) - (*it)->beginRun(r,es); +/* virtual */ void HcalOnlineHarvesting::beginRun(edm::Run const& r, edm::EventSetup const& es) { + DQHarvester::beginRun(r, es); + for (std::vector::const_iterator it = _vsumgen.begin(); it != _vsumgen.end(); ++it) + (*it)->beginRun(r, es); } -/* virtual */ void HcalOnlineHarvesting::_dqmEndLuminosityBlock( - DQMStore::IBooker& ib, - DQMStore::IGetter& ig, edm::LuminosityBlock const&, - edm::EventSetup const&) -{ - // DETERMINE WHICH MODULES ARE PRESENT IN DATA - if (ig.get(_subsystem+"/"+_vnames[fRaw]+"/EventsTotal")!=nullptr) - _vmarks[fRaw]=true; - if (ig.get(_subsystem+"/"+_vnames[fDigi]+"/EventsTotal")!=nullptr) - _vmarks[fDigi]=true; - if (ig.get(_subsystem+"/"+_vnames[fTP]+"/EventsTotal")!=nullptr) - _vmarks[fTP]=true; - if (ig.get(_subsystem+"/"+_vnames[fReco]+"/EventsTotal")!=nullptr) - _vmarks[fReco]=true; - if (ig.get(_subsystem+"/"+_vnames[fPedestal]+"/EventsTotal")!=nullptr) - _vmarks[fPedestal]=true; - - // CREATE SUMMARY REPORT MAP FED vs LS and LOAD MODULE'S SUMMARIES - // NOTE: THIS STATEMENTS WILL BE EXECUTED ONLY ONCE! - if (!_reportSummaryMap) - { - ig.setCurrentFolder(_subsystem+"/EventInfo"); - _reportSummaryMap = ib.book2D("reportSummaryMap", "reportSummaryMap", - _maxLS, 1, _maxLS+1, _vFEDs.size(), 0, _vFEDs.size()); - for (uint32_t i=0; i<_vFEDs.size(); i++) - { - char name[5]; - sprintf(name, "%d", _vFEDs[i]); - _reportSummaryMap->setBinLabel(i+1, name, 2); - } - // set LS bit to mark Xaxis as LS axis - _reportSummaryMap->getTH1()->SetBit(BIT(BIT_OFFSET+BIT_AXIS_LS)); - - // INITIALIZE ALL THE MODULES - for (uint32_t i=0; i<_vnames.size(); i++) - _vcSummaryvsLS.push_back(ContainerSingle2D(_vnames[i], - "SummaryvsLS", - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::FEDQuantity(_vFEDs), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState))); - - // LOAD ONLY THOSE MODULES THAT ARE PRESENT IN DATA - for (uint32_t i=0; i<_vmarks.size(); i++) - { - if (_vmarks[i]) - _vcSummaryvsLS[i].load(ig, _subsystem); - } - - // Create a map of bad channels and fill - _cKnownBadChannels_depth.initialize("RunInfo", "KnownBadChannels", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cKnownBadChannels_depth.book(ib, _emap, _subsystem); - for (uintCompactMap::const_iterator it=_xQuality.begin(); - it!=_xQuality.end(); ++it) - _cKnownBadChannels_depth.fill(HcalDetId(it->first)); - - ig.setCurrentFolder(_subsystem+"/EventInfo"); - _runSummary = ib.book2D("runSummary", "runSummary", - 1, 0, 1, 1, 0, 1); - } - - int ifed=0; - hcaldqm::flag::Flag fTotal("Status", hcaldqm::flag::fNCDAQ); - if (_ptype != fOffline) { // hidefed2crate - for (std::vector::const_iterator it=_vhashFEDs.begin(); - it!=_vhashFEDs.end(); ++it) - { - HcalElectronicsId eid(*it); - hcaldqm::flag::Flag fSum("Status", hcaldqm::flag::fNCDAQ); - for (uint32_t im=0; im<_vmarks.size(); im++) - if (_vmarks[im]) - { - int x = _vcSummaryvsLS[im].getBinContent(eid, _currentLS); - hcaldqm::flag::Flag flag("Status", (hcaldqm::flag::State)x); - fSum+=flag; - } - _reportSummaryMap->setBinContent(_currentLS, ifed+1, int(fSum._state)); - ifed++; - fTotal+=fSum; - } - } - - // update the Run Summary - // ^^^TEMPORARY AT THIS POINT! - if (fTotal._state==hcaldqm::flag::fBAD) _nBad++; - _nTotal++; - if (double(_nBad)/double(_nTotal)>=_thresh_bad_bad) - _runSummary->setBinContent(1, 1, int(hcaldqm::flag::fBAD)); - else if (fTotal._state==hcaldqm::flag::fNCDAQ) - _runSummary->setBinContent(1,1, int(hcaldqm::flag::fNCDAQ)); - else - _runSummary->setBinContent(1,1, int(hcaldqm::flag::fGOOD)); - - // HF TDC TP efficiency - if (_vmarks[fTP]) { - MonitorElement* meOccupancy_HF_depth = ig.get("Hcal/TPTask/OccupancyDataHF_depth/OccupancyDataHF_depth"); - MonitorElement* meOccupancyNoTDC_HF_depth = ig.get("Hcal/TPTask/OccupancyEmulHFNoTDC_depth/OccupancyEmulHFNoTDC_depth"); - MonitorElement* meOccupancy_HF_ieta = ig.get("Hcal/TPTask/OccupancyDataHF_ieta/OccupancyDataHF_ieta"); - MonitorElement* meOccupancyNoTDC_HF_ieta = ig.get("Hcal/TPTask/OccupancyEmulHFNoTDC_ieta/OccupancyEmulHFNoTDC_ieta"); - - if (meOccupancy_HF_depth && meOccupancyNoTDC_HF_depth && meOccupancy_HF_ieta && meOccupancyNoTDC_HF_ieta) { - TH2F* hOccupancy_HF_depth = meOccupancy_HF_depth->getTH2F(); - TH2F* hOccupancyNoTDC_HF_depth = meOccupancyNoTDC_HF_depth->getTH2F(); - TH1F* hOccupancy_HF_ieta = meOccupancy_HF_ieta->getTH1F(); - TH1F* hOccupancyNoTDC_HF_ieta = meOccupancyNoTDC_HF_ieta->getTH1F(); - - TH2F *hEfficiency_HF_depth = (TH2F*)hOccupancy_HF_depth->Clone(); - hEfficiency_HF_depth->Divide(hOccupancyNoTDC_HF_depth); - TH1F *hEfficiency_HF_ieta = (TH1F*)hOccupancy_HF_ieta->Clone(); - hEfficiency_HF_ieta->Divide(hOccupancyNoTDC_HF_ieta); - - ib.setCurrentFolder("Hcal/TPTask"); - - MonitorElement* meEfficiency_HF_depth = ib.book2D("TDCCutEfficiency_depth", hEfficiency_HF_depth); - meEfficiency_HF_depth->setEfficiencyFlag(); - MonitorElement* meEfficiency_HF_ieta = ib.book1D("TDCCutEfficiency_ieta", hEfficiency_HF_ieta); - meEfficiency_HF_ieta->setEfficiencyFlag(); - - delete hEfficiency_HF_depth; - delete hEfficiency_HF_ieta; - } - } +/* virtual */ void HcalOnlineHarvesting::_dqmEndLuminosityBlock(DQMStore::IBooker& ib, + DQMStore::IGetter& ig, + edm::LuminosityBlock const&, + edm::EventSetup const&) { + // DETERMINE WHICH MODULES ARE PRESENT IN DATA + if (ig.get(_subsystem + "/" + _vnames[fRaw] + "/EventsTotal") != nullptr) + _vmarks[fRaw] = true; + if (ig.get(_subsystem + "/" + _vnames[fDigi] + "/EventsTotal") != nullptr) + _vmarks[fDigi] = true; + if (ig.get(_subsystem + "/" + _vnames[fTP] + "/EventsTotal") != nullptr) + _vmarks[fTP] = true; + if (ig.get(_subsystem + "/" + _vnames[fReco] + "/EventsTotal") != nullptr) + _vmarks[fReco] = true; + if (ig.get(_subsystem + "/" + _vnames[fPedestal] + "/EventsTotal") != nullptr) + _vmarks[fPedestal] = true; + + // CREATE SUMMARY REPORT MAP FED vs LS and LOAD MODULE'S SUMMARIES + // NOTE: THIS STATEMENTS WILL BE EXECUTED ONLY ONCE! + if (!_reportSummaryMap) { + ig.setCurrentFolder(_subsystem + "/EventInfo"); + _reportSummaryMap = + ib.book2D("reportSummaryMap", "reportSummaryMap", _maxLS, 1, _maxLS + 1, _vFEDs.size(), 0, _vFEDs.size()); + for (uint32_t i = 0; i < _vFEDs.size(); i++) { + char name[5]; + sprintf(name, "%d", _vFEDs[i]); + _reportSummaryMap->setBinLabel(i + 1, name, 2); + } + // set LS bit to mark Xaxis as LS axis + _reportSummaryMap->getTH1()->SetBit(BIT(BIT_OFFSET + BIT_AXIS_LS)); + + // INITIALIZE ALL THE MODULES + for (uint32_t i = 0; i < _vnames.size(); i++) + _vcSummaryvsLS.push_back(ContainerSingle2D(_vnames[i], + "SummaryvsLS", + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::FEDQuantity(_vFEDs), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState))); + + // LOAD ONLY THOSE MODULES THAT ARE PRESENT IN DATA + for (uint32_t i = 0; i < _vmarks.size(); i++) { + if (_vmarks[i]) + _vcSummaryvsLS[i].load(ig, _subsystem); + } + + // Create a map of bad channels and fill + _cKnownBadChannels_depth.initialize("RunInfo", + "KnownBadChannels", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cKnownBadChannels_depth.book(ib, _emap, _subsystem); + for (uintCompactMap::const_iterator it = _xQuality.begin(); it != _xQuality.end(); ++it) + _cKnownBadChannels_depth.fill(HcalDetId(it->first)); + + ig.setCurrentFolder(_subsystem + "/EventInfo"); + _runSummary = ib.book2D("runSummary", "runSummary", 1, 0, 1, 1, 0, 1); + } + + int ifed = 0; + hcaldqm::flag::Flag fTotal("Status", hcaldqm::flag::fNCDAQ); + if (_ptype != fOffline) { // hidefed2crate + for (std::vector::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) { + HcalElectronicsId eid(*it); + hcaldqm::flag::Flag fSum("Status", hcaldqm::flag::fNCDAQ); + for (uint32_t im = 0; im < _vmarks.size(); im++) + if (_vmarks[im]) { + int x = _vcSummaryvsLS[im].getBinContent(eid, _currentLS); + hcaldqm::flag::Flag flag("Status", (hcaldqm::flag::State)x); + fSum += flag; + } + _reportSummaryMap->setBinContent(_currentLS, ifed + 1, int(fSum._state)); + ifed++; + fTotal += fSum; + } + } + + // update the Run Summary + // ^^^TEMPORARY AT THIS POINT! + if (fTotal._state == hcaldqm::flag::fBAD) + _nBad++; + _nTotal++; + if (double(_nBad) / double(_nTotal) >= _thresh_bad_bad) + _runSummary->setBinContent(1, 1, int(hcaldqm::flag::fBAD)); + else if (fTotal._state == hcaldqm::flag::fNCDAQ) + _runSummary->setBinContent(1, 1, int(hcaldqm::flag::fNCDAQ)); + else + _runSummary->setBinContent(1, 1, int(hcaldqm::flag::fGOOD)); + + // HF TDC TP efficiency + if (_vmarks[fTP]) { + MonitorElement* meOccupancy_HF_depth = ig.get("Hcal/TPTask/OccupancyDataHF_depth/OccupancyDataHF_depth"); + MonitorElement* meOccupancyNoTDC_HF_depth = + ig.get("Hcal/TPTask/OccupancyEmulHFNoTDC_depth/OccupancyEmulHFNoTDC_depth"); + MonitorElement* meOccupancy_HF_ieta = ig.get("Hcal/TPTask/OccupancyDataHF_ieta/OccupancyDataHF_ieta"); + MonitorElement* meOccupancyNoTDC_HF_ieta = + ig.get("Hcal/TPTask/OccupancyEmulHFNoTDC_ieta/OccupancyEmulHFNoTDC_ieta"); + + if (meOccupancy_HF_depth && meOccupancyNoTDC_HF_depth && meOccupancy_HF_ieta && meOccupancyNoTDC_HF_ieta) { + TH2F* hOccupancy_HF_depth = meOccupancy_HF_depth->getTH2F(); + TH2F* hOccupancyNoTDC_HF_depth = meOccupancyNoTDC_HF_depth->getTH2F(); + TH1F* hOccupancy_HF_ieta = meOccupancy_HF_ieta->getTH1F(); + TH1F* hOccupancyNoTDC_HF_ieta = meOccupancyNoTDC_HF_ieta->getTH1F(); + + TH2F* hEfficiency_HF_depth = (TH2F*)hOccupancy_HF_depth->Clone(); + hEfficiency_HF_depth->Divide(hOccupancyNoTDC_HF_depth); + TH1F* hEfficiency_HF_ieta = (TH1F*)hOccupancy_HF_ieta->Clone(); + hEfficiency_HF_ieta->Divide(hOccupancyNoTDC_HF_ieta); + + ib.setCurrentFolder("Hcal/TPTask"); + + MonitorElement* meEfficiency_HF_depth = ib.book2D("TDCCutEfficiency_depth", hEfficiency_HF_depth); + meEfficiency_HF_depth->setEfficiencyFlag(); + MonitorElement* meEfficiency_HF_ieta = ib.book1D("TDCCutEfficiency_ieta", hEfficiency_HF_ieta); + meEfficiency_HF_ieta->setEfficiencyFlag(); + + delete hEfficiency_HF_depth; + delete hEfficiency_HF_ieta; + } + } } /* * NO END JOB PROCESSING FOR ONLINE! */ -/* virtual */ void HcalOnlineHarvesting::_dqmEndJob(DQMStore::IBooker& ib, - DQMStore::IGetter& ig) -{} +/* virtual */ void HcalOnlineHarvesting::_dqmEndJob(DQMStore::IBooker& ib, DQMStore::IGetter& ig) {} DEFINE_FWK_MODULE(HcalOnlineHarvesting); diff --git a/DQM/HcalTasks/plugins/LEDTask.cc b/DQM/HcalTasks/plugins/LEDTask.cc index c20d5c91841b5..1d4c009b3ac03 100644 --- a/DQM/HcalTasks/plugins/LEDTask.cc +++ b/DQM/HcalTasks/plugins/LEDTask.cc @@ -4,632 +4,651 @@ using namespace hcaldqm; using namespace hcaldqm::constants; using namespace hcaldqm::filter; -LEDTask::LEDTask(edm::ParameterSet const& ps): - DQTask(ps) -{ - _nevents = ps.getUntrackedParameter("nevents", 2000); - // tags - _tagHBHE = ps.getUntrackedParameter("tagHBHE", - edm::InputTag("hcalDigis")); - _tagHE = ps.getUntrackedParameter("tagHE", - edm::InputTag("hcalDigis")); - _tagHO = ps.getUntrackedParameter("tagHO", - edm::InputTag("hcalDigis")); - _tagHF = ps.getUntrackedParameter("tagHF", - edm::InputTag("hcalDigis")); - _tagTrigger = ps.getUntrackedParameter("tagTrigger", - edm::InputTag("tbunpacker")); - _taguMN = ps.getUntrackedParameter("taguMN", - edm::InputTag("hcalDigis")); - _tokHBHE = consumes(_tagHBHE); - _tokHE = consumes(_tagHE); - _tokHO = consumes(_tagHO); - _tokHF = consumes(_tagHF); - _tokTrigger = consumes(_tagTrigger); - _tokuMN = consumes(_taguMN); - - // constants - _lowHBHE = ps.getUntrackedParameter("lowHBHE", - 20); - _lowHE = ps.getUntrackedParameter("lowHE", - 20); - _lowHO = ps.getUntrackedParameter("lowHO", - 20); - _lowHF = ps.getUntrackedParameter("lowHF", - 20); - - // LED calibration channels - std::vector vLedCalibChannels = ps.getParameter>("ledCalibrationChannels"); - for (int i = 0; i <= 3; ++i) { - HcalSubdetector this_subdet = HcalEmpty; - switch (i) { - case 0: - this_subdet = HcalBarrel; - break; - case 1: - this_subdet = HcalEndcap; - break; - case 2: - this_subdet = HcalOuter; - break; - case 3: - this_subdet = HcalForward; - break; - default: - this_subdet = HcalEmpty; - break; - } - std::vector subdet_calib_ietas = vLedCalibChannels[i].getUntrackedParameter>("ieta"); - std::vector subdet_calib_iphis = vLedCalibChannels[i].getUntrackedParameter>("iphi"); - std::vector subdet_calib_depths = vLedCalibChannels[i].getUntrackedParameter>("depth"); - for (unsigned int ichannel = 0; ichannel < subdet_calib_ietas.size(); ++ichannel) { - _ledCalibrationChannels[this_subdet].push_back(HcalDetId(HcalOther, subdet_calib_ietas[ichannel], subdet_calib_iphis[ichannel], subdet_calib_depths[ichannel])); - } - } - -} - -/* virtual */ void LEDTask::bookHistograms(DQMStore::IBooker &ib, - edm::Run const& r, edm::EventSetup const& es) -{ - if (_ptype==fLocal) - if (r.runAuxiliary().run()==1) - return; - - DQTask::bookHistograms(ib, r, es); - - edm::ESHandle dbService; - es.get().get(dbService); - _emap = dbService->getHcalMapping(); - - std::vector vhashVME; - std::vector vhashuTCA; - std::vector vhashC36; - vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); - vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vhashVME); - _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vhashuTCA); - - // INITIALIZE - _cSignalMean_Subdet.initialize(_name, "SignalMean", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cSignalRMS_Subdet.initialize(_name, "SignalRMS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cTimingMean_Subdet.initialize(_name, "TimingMean", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cTimingRMS_Subdet.initialize(_name, "TimingRMS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - - if (_ptype == fLocal) { // hidefed2crate - _cSignalMean_FEDVME.initialize(_name, "SignalMean", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_400000, true),0); - _cSignalMean_FEDuTCA.initialize(_name, "SignalMean", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_400000, true),0); - _cSignalRMS_FEDVME.initialize(_name, "SignalRMS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_10000, true),0); - _cSignalRMS_FEDuTCA.initialize(_name, "SignalRMS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_10000, true),0); - _cTimingMean_FEDVME.initialize(_name, "TimingMean", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingMean_FEDuTCA.initialize(_name, "TimingMean", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingRMS_FEDVME.initialize(_name, "TimingRMS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingRMS_FEDuTCA.initialize(_name, "TimingRMS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - - _cShapeCut_FEDSlot.initialize(_name, "Shape", - hcaldqm::hashfunctions::fFEDSlot, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_400000),0); - } - - _cSignalMean_depth.initialize(_name, "SignalMean", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_400000, true),0); - _cSignalRMS_depth.initialize(_name, "SignalRMS", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_10000, true),0); - _cTimingMean_depth.initialize(_name, "TimingMean", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingRMS_depth.initialize(_name, "TimingRMS", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - - _cMissing_depth.initialize(_name, "Missing", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - if (_ptype != fOffline) { // hidefed2crate - _cMissing_FEDVME.initialize(_name, "Missing", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMissing_FEDuTCA.initialize(_name, "Missing", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - } - - // Plots for LED in global - if (_ptype == fOnline) { - _cADCvsTS_SubdetPM.initialize(_name, "ADCvsTS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cLowSignal_CrateSlot.initialize(_name, "LowSignal", - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fCrateuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cSumQ_SubdetPM.initialize(_name, "SumQ", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cTDCTime_SubdetPM.initialize(_name, "TDCTime", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cTDCTime_depth.initialize(_name, "TDCTime", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250),0); - _LED_ADCvsBX_Subdet.initialize(_name, "LED_ADCvsBX", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX_36), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_256_4), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - } else if (_ptype == fLocal) { - _LED_ADCvsEvn_Subdet.initialize(_name, "LED_ADCvsEvn", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::EventNumber(_nevents), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_256_4), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - } - - // initialize compact containers - _xSignalSum.initialize(hcaldqm::hashfunctions::fDChannel); - _xSignalSum2.initialize(hcaldqm::hashfunctions::fDChannel); - _xTimingSum.initialize(hcaldqm::hashfunctions::fDChannel); - _xTimingSum2.initialize(hcaldqm::hashfunctions::fDChannel); - _xEntries.initialize(hcaldqm::hashfunctions::fDChannel); - - // BOOK - _cSignalMean_Subdet.book(ib, _emap, _subsystem); - _cSignalRMS_Subdet.book(ib, _emap, _subsystem); - _cTimingMean_Subdet.book(ib, _emap, _subsystem); - _cTimingRMS_Subdet.book(ib, _emap, _subsystem); - - _cSignalMean_depth.book(ib, _emap, _subsystem); - _cSignalRMS_depth.book(ib, _emap, _subsystem); - _cTimingMean_depth.book(ib, _emap, _subsystem); - _cTimingRMS_depth.book(ib, _emap, _subsystem); - - _cMissing_depth.book(ib, _emap, _subsystem); - if (_ptype == fLocal) { // hidefed2crate - _cSignalMean_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cSignalMean_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cSignalRMS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cSignalRMS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cTimingMean_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cTimingMean_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cTimingRMS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cTimingRMS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cShapeCut_FEDSlot.book(ib, _emap, _subsystem); - _cMissing_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cMissing_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - } - if (_ptype == fOnline) { - _cADCvsTS_SubdetPM.book(ib, _emap, _subsystem); - _cLowSignal_CrateSlot.book(ib, _subsystem); - _cSumQ_SubdetPM.book(ib, _emap, _subsystem); - _cTDCTime_SubdetPM.book(ib, _emap, _subsystem); - _cTDCTime_depth.book(ib, _emap, _subsystem); - } - - if (_ptype == fOnline) { - _LED_ADCvsBX_Subdet.book(ib, _emap, _subsystem); - } else if (_ptype == fLocal) { - _LED_ADCvsEvn_Subdet.book(ib, _emap, _subsystem); - } - - _xSignalSum.book(_emap); - _xSignalSum2.book(_emap); - _xEntries.book(_emap); - _xTimingSum.book(_emap); - _xTimingSum2.book(_emap); - - _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); +LEDTask::LEDTask(edm::ParameterSet const& ps) : DQTask(ps) { + _nevents = ps.getUntrackedParameter("nevents", 2000); + // tags + _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); + _tagHE = ps.getUntrackedParameter("tagHE", edm::InputTag("hcalDigis")); + _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); + _tagHF = ps.getUntrackedParameter("tagHF", edm::InputTag("hcalDigis")); + _tagTrigger = ps.getUntrackedParameter("tagTrigger", edm::InputTag("tbunpacker")); + _taguMN = ps.getUntrackedParameter("taguMN", edm::InputTag("hcalDigis")); + _tokHBHE = consumes(_tagHBHE); + _tokHE = consumes(_tagHE); + _tokHO = consumes(_tagHO); + _tokHF = consumes(_tagHF); + _tokTrigger = consumes(_tagTrigger); + _tokuMN = consumes(_taguMN); + + // constants + _lowHBHE = ps.getUntrackedParameter("lowHBHE", 20); + _lowHE = ps.getUntrackedParameter("lowHE", 20); + _lowHO = ps.getUntrackedParameter("lowHO", 20); + _lowHF = ps.getUntrackedParameter("lowHF", 20); + + // LED calibration channels + std::vector vLedCalibChannels = + ps.getParameter>("ledCalibrationChannels"); + for (int i = 0; i <= 3; ++i) { + HcalSubdetector this_subdet = HcalEmpty; + switch (i) { + case 0: + this_subdet = HcalBarrel; + break; + case 1: + this_subdet = HcalEndcap; + break; + case 2: + this_subdet = HcalOuter; + break; + case 3: + this_subdet = HcalForward; + break; + default: + this_subdet = HcalEmpty; + break; + } + std::vector subdet_calib_ietas = vLedCalibChannels[i].getUntrackedParameter>("ieta"); + std::vector subdet_calib_iphis = vLedCalibChannels[i].getUntrackedParameter>("iphi"); + std::vector subdet_calib_depths = + vLedCalibChannels[i].getUntrackedParameter>("depth"); + for (unsigned int ichannel = 0; ichannel < subdet_calib_ietas.size(); ++ichannel) { + _ledCalibrationChannels[this_subdet].push_back(HcalDetId( + HcalOther, subdet_calib_ietas[ichannel], subdet_calib_iphis[ichannel], subdet_calib_depths[ichannel])); + } + } } -/* virtual */ void LEDTask::_resetMonitors(hcaldqm::UpdateFreq uf) -{ - DQTask::_resetMonitors(uf); +/* virtual */ void LEDTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + if (_ptype == fLocal) + if (r.runAuxiliary().run() == 1) + return; + + DQTask::bookHistograms(ib, r, es); + + edm::ESHandle dbService; + es.get().get(dbService); + _emap = dbService->getHcalMapping(); + + std::vector vhashVME; + std::vector vhashuTCA; + std::vector vhashC36; + vhashVME.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); + vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vhashVME); + _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vhashuTCA); + + // INITIALIZE + _cSignalMean_Subdet.initialize(_name, + "SignalMean", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cSignalRMS_Subdet.initialize(_name, + "SignalRMS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cTimingMean_Subdet.initialize(_name, + "TimingMean", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cTimingRMS_Subdet.initialize(_name, + "TimingRMS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + + if (_ptype == fLocal) { // hidefed2crate + _cSignalMean_FEDVME.initialize(_name, + "SignalMean", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_400000, true), + 0); + _cSignalMean_FEDuTCA.initialize(_name, + "SignalMean", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_400000, true), + 0); + _cSignalRMS_FEDVME.initialize(_name, + "SignalRMS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_10000, true), + 0); + _cSignalRMS_FEDuTCA.initialize(_name, + "SignalRMS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_10000, true), + 0); + _cTimingMean_FEDVME.initialize(_name, + "TimingMean", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingMean_FEDuTCA.initialize(_name, + "TimingMean", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingRMS_FEDVME.initialize(_name, + "TimingRMS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingRMS_FEDuTCA.initialize(_name, + "TimingRMS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + + _cShapeCut_FEDSlot.initialize(_name, + "Shape", + hcaldqm::hashfunctions::fFEDSlot, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_400000), + 0); + } + + _cSignalMean_depth.initialize(_name, + "SignalMean", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_400000, true), + 0); + _cSignalRMS_depth.initialize(_name, + "SignalRMS", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_10000, true), + 0); + _cTimingMean_depth.initialize(_name, + "TimingMean", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingRMS_depth.initialize(_name, + "TimingRMS", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + + _cMissing_depth.initialize(_name, + "Missing", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + if (_ptype != fOffline) { // hidefed2crate + _cMissing_FEDVME.initialize(_name, + "Missing", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMissing_FEDuTCA.initialize(_name, + "Missing", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + } + + // Plots for LED in global + if (_ptype == fOnline) { + _cADCvsTS_SubdetPM.initialize(_name, + "ADCvsTS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cLowSignal_CrateSlot.initialize(_name, + "LowSignal", + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fCrateuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cSumQ_SubdetPM.initialize(_name, + "SumQ", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cTDCTime_SubdetPM.initialize(_name, + "TDCTime", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cTDCTime_depth.initialize(_name, + "TDCTime", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), + 0); + _LED_ADCvsBX_Subdet.initialize(_name, + "LED_ADCvsBX", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX_36), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_256_4), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + } else if (_ptype == fLocal) { + _LED_ADCvsEvn_Subdet.initialize(_name, + "LED_ADCvsEvn", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::EventNumber(_nevents), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_256_4), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + } + + // initialize compact containers + _xSignalSum.initialize(hcaldqm::hashfunctions::fDChannel); + _xSignalSum2.initialize(hcaldqm::hashfunctions::fDChannel); + _xTimingSum.initialize(hcaldqm::hashfunctions::fDChannel); + _xTimingSum2.initialize(hcaldqm::hashfunctions::fDChannel); + _xEntries.initialize(hcaldqm::hashfunctions::fDChannel); + + // BOOK + _cSignalMean_Subdet.book(ib, _emap, _subsystem); + _cSignalRMS_Subdet.book(ib, _emap, _subsystem); + _cTimingMean_Subdet.book(ib, _emap, _subsystem); + _cTimingRMS_Subdet.book(ib, _emap, _subsystem); + + _cSignalMean_depth.book(ib, _emap, _subsystem); + _cSignalRMS_depth.book(ib, _emap, _subsystem); + _cTimingMean_depth.book(ib, _emap, _subsystem); + _cTimingRMS_depth.book(ib, _emap, _subsystem); + + _cMissing_depth.book(ib, _emap, _subsystem); + if (_ptype == fLocal) { // hidefed2crate + _cSignalMean_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cSignalMean_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cSignalRMS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cSignalRMS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cTimingMean_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cTimingMean_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cTimingRMS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cTimingRMS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cShapeCut_FEDSlot.book(ib, _emap, _subsystem); + _cMissing_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMissing_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + } + if (_ptype == fOnline) { + _cADCvsTS_SubdetPM.book(ib, _emap, _subsystem); + _cLowSignal_CrateSlot.book(ib, _subsystem); + _cSumQ_SubdetPM.book(ib, _emap, _subsystem); + _cTDCTime_SubdetPM.book(ib, _emap, _subsystem); + _cTDCTime_depth.book(ib, _emap, _subsystem); + } + + if (_ptype == fOnline) { + _LED_ADCvsBX_Subdet.book(ib, _emap, _subsystem); + } else if (_ptype == fLocal) { + _LED_ADCvsEvn_Subdet.book(ib, _emap, _subsystem); + } + + _xSignalSum.book(_emap); + _xSignalSum2.book(_emap); + _xEntries.book(_emap); + _xTimingSum.book(_emap); + _xTimingSum2.book(_emap); + + _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); } -/* virtual */ void LEDTask::_dump() -{ - _cSignalMean_Subdet.reset(); - _cSignalRMS_Subdet.reset(); - _cTimingMean_Subdet.reset(); - _cTimingRMS_Subdet.reset(); - _cSignalMean_depth.reset(); - _cSignalRMS_depth.reset(); - _cTimingMean_depth.reset(); - _cTimingRMS_depth.reset(); - - if (_ptype == fLocal) { // hidefed2crate - _cSignalMean_FEDVME.reset(); - _cSignalMean_FEDuTCA.reset(); - _cSignalRMS_FEDVME.reset(); - _cSignalRMS_FEDuTCA.reset(); - _cTimingMean_FEDVME.reset(); - _cTimingMean_FEDuTCA.reset(); - _cTimingRMS_FEDVME.reset(); - _cTimingRMS_FEDuTCA.reset(); - } - - std::vector dids = _emap->allPrecisionId(); - for (std::vector::const_iterator it=dids.begin(); - it!=dids.end(); ++it) - { - if (!it->isHcalDetId()) - continue; - HcalDetId did = HcalDetId(it->rawId()); - HcalElectronicsId eid(_ehashmap.lookup(did)); - int n = _xEntries.get(did); - double msig = _xSignalSum.get(did)/n; - double mtim = _xTimingSum.get(did)/n; - double rsig = sqrt(_xSignalSum2.get(did)/n-msig*msig); - double rtim = sqrt(_xTimingSum2.get(did)/n-mtim*mtim); - - // channels missing or low signal - if (n==0) - { - _cMissing_depth.fill(did); - if (_ptype == fLocal) { // hidefed2crate - if (eid.isVMEid()) - _cMissing_FEDVME.fill(eid); - else - _cMissing_FEDuTCA.fill(eid); - } - continue; - } - _cSignalMean_Subdet.fill(did, msig); - _cSignalMean_depth.fill(did, msig); - _cSignalRMS_Subdet.fill(did, rsig); - _cSignalRMS_depth.fill(did, rsig); - _cTimingMean_Subdet.fill(did, mtim); - _cTimingMean_depth.fill(did, mtim); - _cTimingRMS_Subdet.fill(did, rtim); - _cTimingRMS_depth.fill(did, rtim); - if (_ptype == fLocal) { // hidefed2crate - if (eid.isVMEid()) - { - _cSignalMean_FEDVME.fill(eid, msig); - _cSignalRMS_FEDVME.fill(eid, rsig); - _cTimingMean_FEDVME.fill(eid, mtim); - _cTimingRMS_FEDVME.fill(eid, rtim); - } - else - { - _cSignalMean_FEDuTCA.fill(eid, msig); - _cSignalRMS_FEDuTCA.fill(eid, rsig); - _cTimingMean_FEDuTCA.fill(eid, mtim); - _cTimingRMS_FEDuTCA.fill(eid, rtim); - } - } - } +/* virtual */ void LEDTask::_resetMonitors(hcaldqm::UpdateFreq uf) { DQTask::_resetMonitors(uf); } + +/* virtual */ void LEDTask::_dump() { + _cSignalMean_Subdet.reset(); + _cSignalRMS_Subdet.reset(); + _cTimingMean_Subdet.reset(); + _cTimingRMS_Subdet.reset(); + _cSignalMean_depth.reset(); + _cSignalRMS_depth.reset(); + _cTimingMean_depth.reset(); + _cTimingRMS_depth.reset(); + + if (_ptype == fLocal) { // hidefed2crate + _cSignalMean_FEDVME.reset(); + _cSignalMean_FEDuTCA.reset(); + _cSignalRMS_FEDVME.reset(); + _cSignalRMS_FEDuTCA.reset(); + _cTimingMean_FEDVME.reset(); + _cTimingMean_FEDuTCA.reset(); + _cTimingRMS_FEDVME.reset(); + _cTimingRMS_FEDuTCA.reset(); + } + + std::vector dids = _emap->allPrecisionId(); + for (std::vector::const_iterator it = dids.begin(); it != dids.end(); ++it) { + if (!it->isHcalDetId()) + continue; + HcalDetId did = HcalDetId(it->rawId()); + HcalElectronicsId eid(_ehashmap.lookup(did)); + int n = _xEntries.get(did); + double msig = _xSignalSum.get(did) / n; + double mtim = _xTimingSum.get(did) / n; + double rsig = sqrt(_xSignalSum2.get(did) / n - msig * msig); + double rtim = sqrt(_xTimingSum2.get(did) / n - mtim * mtim); + + // channels missing or low signal + if (n == 0) { + _cMissing_depth.fill(did); + if (_ptype == fLocal) { // hidefed2crate + if (eid.isVMEid()) + _cMissing_FEDVME.fill(eid); + else + _cMissing_FEDuTCA.fill(eid); + } + continue; + } + _cSignalMean_Subdet.fill(did, msig); + _cSignalMean_depth.fill(did, msig); + _cSignalRMS_Subdet.fill(did, rsig); + _cSignalRMS_depth.fill(did, rsig); + _cTimingMean_Subdet.fill(did, mtim); + _cTimingMean_depth.fill(did, mtim); + _cTimingRMS_Subdet.fill(did, rtim); + _cTimingRMS_depth.fill(did, rtim); + if (_ptype == fLocal) { // hidefed2crate + if (eid.isVMEid()) { + _cSignalMean_FEDVME.fill(eid, msig); + _cSignalRMS_FEDVME.fill(eid, rsig); + _cTimingMean_FEDVME.fill(eid, mtim); + _cTimingRMS_FEDVME.fill(eid, rtim); + } else { + _cSignalMean_FEDuTCA.fill(eid, msig); + _cSignalRMS_FEDuTCA.fill(eid, rsig); + _cTimingMean_FEDuTCA.fill(eid, mtim); + _cTimingRMS_FEDuTCA.fill(eid, rtim); + } + } + } } -/* virtual */ void LEDTask::_process(edm::Event const& e, - edm::EventSetup const& es) -{ - edm::Handle chbhe; - edm::Handle cho; - edm::Handle chf; - edm::Handle che; - - if (!e.getByToken(_tokHBHE, chbhe)) - _logger.dqmthrow("Collection HBHEDigiCollection isn't available " - + _tagHBHE.label() + " " + _tagHBHE.instance()); - if (!e.getByToken(_tokHO, cho)) - _logger.dqmthrow("Collection HODigiCollection isn't available " - + _tagHO.label() + " " + _tagHO.instance()); - if (!e.getByToken(_tokHF, chf)) - _logger.dqmthrow("Collection QIE10DigiCollection isn't available " - + _tagHF.label() + " " + _tagHF.instance()); - if (!e.getByToken(_tokHE, che)) - _logger.dqmthrow("Collection QIE11DigiCollection isn't available " - + _tagHE.label() + " " + _tagHE.instance()); - -// int currentEvent = e.eventAuxiliary().id().event(); - - for (HBHEDigiCollection::const_iterator it=chbhe->begin(); - it!=chbhe->end(); ++it) - { - const HBHEDataFrame digi = (const HBHEDataFrame)(*it); - HcalDetId did = digi.id(); - HcalElectronicsId eid = digi.elecId(); - - // Get total charge and apply charge cut - CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); - //double sumQ = hcaldqm::utilities::sumQ(digi, 2.5, 0, digi.size()-1); - double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.size()-1); - if (sumQ >= _lowHBHE) { - //double aveTS = hcaldqm::utilities::aveTS(digi, 2.5, 0,digi.size()-1); - double aveTS = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.size()-1); - - _xSignalSum.get(did)+=sumQ; - _xSignalSum2.get(did)+=sumQ*sumQ; - _xTimingSum.get(did)+=aveTS; - _xTimingSum2.get(did)+=aveTS*aveTS; - _xEntries.get(did)++; - - if (_ptype == fLocal) { // hidefed2crate - for (int i=0; i(_dbService, digi_fC, did, digi, i)); - } - } - - if (_ptype == fOnline) { - for (int iTS = 0; iTS < digi.size(); ++iTS) { - _cADCvsTS_SubdetPM.fill(did, iTS, digi.sample(iTS).adc()); - } - _cSumQ_SubdetPM.fill(did, sumQ); - } - } - } - - for (QIE11DigiCollection::const_iterator it=che->begin(); it!=che->end(); - ++it) - { - const QIE11DataFrame digi = static_cast(*it); - HcalDetId const& did = digi.detid(); - if (did.subdet() != HcalEndcap) { - // LED monitoring from calibration channels - if (did.subdet() == HcalOther) { - HcalOtherDetId hodid(digi.detid()); - if (hodid.subdet() == HcalCalibration) { - if (std::find(_ledCalibrationChannels[HcalEndcap].begin(), _ledCalibrationChannels[HcalEndcap].end(), did) != _ledCalibrationChannels[HcalEndcap].end()) { - for (int i=0; i(_dbService, did, digi); - //double sumQ = hcaldqm::utilities::sumQ_v10(digi, 2.5, 0, digi.samples()-1); - double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples()-1); - if (sumQ >= _lowHE) { - //double aveTS = hcaldqm::utilities::aveTS_v10(digi, 2.5, 0,digi.samples()-1); - double aveTS = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.size()-1); - - _xSignalSum.get(did)+=sumQ; - _xSignalSum2.get(did)+=sumQ*sumQ; - _xTimingSum.get(did)+=aveTS; - _xTimingSum2.get(did)+=aveTS*aveTS; - _xEntries.get(did)++; - - if (_ptype == fLocal) { // hidefed2crate - for (int i=0; i(_dbService, digi_fC, did, digi, i)); - } - } - if (_ptype == fOnline) { - for (int iTS = 0; iTS < digi.samples(); ++iTS) { - _cADCvsTS_SubdetPM.fill(did, iTS, digi[iTS].adc()); - if (digi[iTS].tdc() <50) { - double time = iTS*25. + (digi[iTS].tdc() / 2.); - _cTDCTime_SubdetPM.fill(did, time); - _cTDCTime_depth.fill(did, time); - } - } - _cSumQ_SubdetPM.fill(did, sumQ); - - // Low signal in SOI - short soi = -1; - for (int i=0; ibegin(); - it!=cho->end(); ++it) - { - const HODataFrame digi = (const HODataFrame)(*it); - HcalDetId did = digi.id(); - HcalElectronicsId eid = digi.elecId(); - //double sumQ = hcaldqm::utilities::sumQ(digi, 8.5, 0, digi.size()-1); - CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); - double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.size()-1); - if (sumQ >= _lowHO) { - //double aveTS = hcaldqm::utilities::aveTS(digi, 8.5, 0, digi.size()-1); - double aveTS = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.size()-1); - - _xSignalSum.get(did)+=sumQ; - _xSignalSum2.get(did)+=sumQ*sumQ; - _xTimingSum.get(did)+=aveTS; - _xTimingSum2.get(did)+=aveTS*aveTS; - _xEntries.get(did)++; - - if (_ptype == fLocal) { // hidefed2crate - for (int i=0; i(_dbService, digi_fC, did, digi, i)); - } - } - if (_ptype == fOnline) { - for (int iTS = 0; iTS < digi.size(); ++iTS) { - _cADCvsTS_SubdetPM.fill(did, iTS, digi.sample(iTS).adc()); - } - _cSumQ_SubdetPM.fill(did, sumQ); - } - } - } - - for (QIE10DigiCollection::const_iterator it=chf->begin(); - it!=chf->end(); ++it) - { - const QIE10DataFrame digi = static_cast(*it); - HcalDetId did = digi.detid(); - if (did.subdet() != HcalForward) { - // LED monitoring from calibration channels - if (did.subdet() == HcalOther) { - HcalOtherDetId hodid(digi.detid()); - if (hodid.subdet() == HcalCalibration) { - if (std::find(_ledCalibrationChannels[HcalForward].begin(), _ledCalibrationChannels[HcalForward].end(), did) != _ledCalibrationChannels[HcalForward].end()) { - for (int i=0; i(digi, 2.5, 0, digi.samples()-1); - CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); - double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples()-1); - if (sumQ >= _lowHF) { - //double aveTS = hcaldqm::utilities::aveTS_v10(digi, 2.5, 0, digi.samples()-1); - double aveTS = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.size()-1); - - _xSignalSum.get(did)+=sumQ; - _xSignalSum2.get(did)+=sumQ*sumQ; - _xTimingSum.get(did)+=aveTS; - _xTimingSum2.get(did)+=aveTS*aveTS; - _xEntries.get(did)++; - - if (_ptype == fLocal) { // hidefed2crate - for (int i = 0; i < digi.samples(); ++i) { - // Note: this used to be digi.sample(i).nominal_fC() - 2.5, but this branch doesn't exist in QIE10DataFrame. - // Instead, use lookup table. - //_cShapeCut_FEDSlot.fill(eid, i, constants::adc2fC[digi[i].adc()]); - _cShapeCut_FEDSlot.fill(eid, i, hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, i)); - } - } - if (_ptype == fOnline) { - for (int iTS = 0; iTS < digi.samples(); ++iTS) { - _cADCvsTS_SubdetPM.fill(did, iTS, digi[iTS].adc()); - if (digi[iTS].le_tdc() <50) { - double time = iTS*25. + (digi[iTS].le_tdc() / 2.); - _cTDCTime_SubdetPM.fill(did, time); - _cTDCTime_depth.fill(did, time); - } - } - _cSumQ_SubdetPM.fill(did, sumQ); - } - } - } - - if (_ptype==fOnline && _evsTotal>0 && - _evsTotal%constants::CALIBEVENTS_MIN==0) - this->_dump(); +/* virtual */ void LEDTask::_process(edm::Event const& e, edm::EventSetup const& es) { + edm::Handle chbhe; + edm::Handle cho; + edm::Handle chf; + edm::Handle che; + + if (!e.getByToken(_tokHBHE, chbhe)) + _logger.dqmthrow("Collection HBHEDigiCollection isn't available " + _tagHBHE.label() + " " + _tagHBHE.instance()); + if (!e.getByToken(_tokHO, cho)) + _logger.dqmthrow("Collection HODigiCollection isn't available " + _tagHO.label() + " " + _tagHO.instance()); + if (!e.getByToken(_tokHF, chf)) + _logger.dqmthrow("Collection QIE10DigiCollection isn't available " + _tagHF.label() + " " + _tagHF.instance()); + if (!e.getByToken(_tokHE, che)) + _logger.dqmthrow("Collection QIE11DigiCollection isn't available " + _tagHE.label() + " " + _tagHE.instance()); + + // int currentEvent = e.eventAuxiliary().id().event(); + + for (HBHEDigiCollection::const_iterator it = chbhe->begin(); it != chbhe->end(); ++it) { + const HBHEDataFrame digi = (const HBHEDataFrame)(*it); + HcalDetId did = digi.id(); + HcalElectronicsId eid = digi.elecId(); + + // Get total charge and apply charge cut + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); + //double sumQ = hcaldqm::utilities::sumQ(digi, 2.5, 0, digi.size()-1); + double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.size() - 1); + if (sumQ >= _lowHBHE) { + //double aveTS = hcaldqm::utilities::aveTS(digi, 2.5, 0,digi.size()-1); + double aveTS = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.size() - 1); + + _xSignalSum.get(did) += sumQ; + _xSignalSum2.get(did) += sumQ * sumQ; + _xTimingSum.get(did) += aveTS; + _xTimingSum2.get(did) += aveTS * aveTS; + _xEntries.get(did)++; + + if (_ptype == fLocal) { // hidefed2crate + for (int i = 0; i < digi.size(); i++) { + //_cShapeCut_FEDSlot.fill(eid, i, digi.sample(i).nominal_fC()-2.5); + _cShapeCut_FEDSlot.fill( + eid, i, hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, i)); + } + } + + if (_ptype == fOnline) { + for (int iTS = 0; iTS < digi.size(); ++iTS) { + _cADCvsTS_SubdetPM.fill(did, iTS, digi.sample(iTS).adc()); + } + _cSumQ_SubdetPM.fill(did, sumQ); + } + } + } + + for (QIE11DigiCollection::const_iterator it = che->begin(); it != che->end(); ++it) { + const QIE11DataFrame digi = static_cast(*it); + HcalDetId const& did = digi.detid(); + if (did.subdet() != HcalEndcap) { + // LED monitoring from calibration channels + if (did.subdet() == HcalOther) { + HcalOtherDetId hodid(digi.detid()); + if (hodid.subdet() == HcalCalibration) { + if (std::find(_ledCalibrationChannels[HcalEndcap].begin(), _ledCalibrationChannels[HcalEndcap].end(), did) != + _ledCalibrationChannels[HcalEndcap].end()) { + for (int i = 0; i < digi.samples(); i++) { + if (_ptype == fOnline) { + _LED_ADCvsBX_Subdet.fill(HcalDetId(HcalEndcap, 16, 1, 1), e.bunchCrossing(), digi[i].adc()); + } else if (_ptype == fLocal) { + _LED_ADCvsEvn_Subdet.fill( + HcalDetId(HcalEndcap, 16, 1, 1), e.eventAuxiliary().id().event(), digi[i].adc()); + } + } + } + } + } + + continue; + } + uint32_t rawid = _ehashmap.lookup(did); + if (!rawid) { + std::string unknown_id_string = "Detid " + std::to_string(int(did)) + ", ieta " + std::to_string(did.ieta()); + unknown_id_string += ", iphi " + std::to_string(did.iphi()) + ", depth " + std::to_string(did.depth()); + unknown_id_string += ", is not in emap. Skipping."; + _logger.warn(unknown_id_string); + continue; + } + HcalElectronicsId const& eid(rawid); + + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); + //double sumQ = hcaldqm::utilities::sumQ_v10(digi, 2.5, 0, digi.samples()-1); + double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples() - 1); + if (sumQ >= _lowHE) { + //double aveTS = hcaldqm::utilities::aveTS_v10(digi, 2.5, 0,digi.samples()-1); + double aveTS = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.size() - 1); + + _xSignalSum.get(did) += sumQ; + _xSignalSum2.get(did) += sumQ * sumQ; + _xTimingSum.get(did) += aveTS; + _xTimingSum2.get(did) += aveTS * aveTS; + _xEntries.get(did)++; + + if (_ptype == fLocal) { // hidefed2crate + for (int i = 0; i < digi.samples(); i++) { + //_cShapeCut_FEDSlot.fill(eid, i, digi.sample(i).nominal_fC()-2.5); + _cShapeCut_FEDSlot.fill( + eid, i, hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, i)); + } + } + if (_ptype == fOnline) { + for (int iTS = 0; iTS < digi.samples(); ++iTS) { + _cADCvsTS_SubdetPM.fill(did, iTS, digi[iTS].adc()); + if (digi[iTS].tdc() < 50) { + double time = iTS * 25. + (digi[iTS].tdc() / 2.); + _cTDCTime_SubdetPM.fill(did, time); + _cTDCTime_depth.fill(did, time); + } + } + _cSumQ_SubdetPM.fill(did, sumQ); + + // Low signal in SOI + short soi = -1; + for (int i = 0; i < digi.samples(); i++) { + if (digi[i].soi()) { + soi = i; + break; + } + } + if (digi[soi].adc() < 30) { + _cLowSignal_CrateSlot.fill(eid); + } + } + } + } + for (HODigiCollection::const_iterator it = cho->begin(); it != cho->end(); ++it) { + const HODataFrame digi = (const HODataFrame)(*it); + HcalDetId did = digi.id(); + HcalElectronicsId eid = digi.elecId(); + //double sumQ = hcaldqm::utilities::sumQ(digi, 8.5, 0, digi.size()-1); + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); + double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.size() - 1); + if (sumQ >= _lowHO) { + //double aveTS = hcaldqm::utilities::aveTS(digi, 8.5, 0, digi.size()-1); + double aveTS = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.size() - 1); + + _xSignalSum.get(did) += sumQ; + _xSignalSum2.get(did) += sumQ * sumQ; + _xTimingSum.get(did) += aveTS; + _xTimingSum2.get(did) += aveTS * aveTS; + _xEntries.get(did)++; + + if (_ptype == fLocal) { // hidefed2crate + for (int i = 0; i < digi.size(); i++) { + //_cShapeCut_FEDSlot.fill(eid, i, digi.sample(i).nominal_fC()-8.5); + _cShapeCut_FEDSlot.fill( + eid, i, hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, i)); + } + } + if (_ptype == fOnline) { + for (int iTS = 0; iTS < digi.size(); ++iTS) { + _cADCvsTS_SubdetPM.fill(did, iTS, digi.sample(iTS).adc()); + } + _cSumQ_SubdetPM.fill(did, sumQ); + } + } + } + + for (QIE10DigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) { + const QIE10DataFrame digi = static_cast(*it); + HcalDetId did = digi.detid(); + if (did.subdet() != HcalForward) { + // LED monitoring from calibration channels + if (did.subdet() == HcalOther) { + HcalOtherDetId hodid(digi.detid()); + if (hodid.subdet() == HcalCalibration) { + if (std::find(_ledCalibrationChannels[HcalForward].begin(), + _ledCalibrationChannels[HcalForward].end(), + did) != _ledCalibrationChannels[HcalForward].end()) { + for (int i = 0; i < digi.samples(); i++) { + if (_ptype == fOnline) { + _LED_ADCvsBX_Subdet.fill(HcalDetId(HcalForward, 29, 1, 1), e.bunchCrossing(), digi[i].adc()); + } else if (_ptype == fLocal) { + _LED_ADCvsEvn_Subdet.fill( + HcalDetId(HcalForward, 29, 1, 1), e.eventAuxiliary().id().event(), digi[i].adc()); + } + } + } + } + } + continue; + } + HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); + //double sumQ = hcaldqm::utilities::sumQ_v10(digi, 2.5, 0, digi.samples()-1); + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); + double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples() - 1); + if (sumQ >= _lowHF) { + //double aveTS = hcaldqm::utilities::aveTS_v10(digi, 2.5, 0, digi.samples()-1); + double aveTS = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.size() - 1); + + _xSignalSum.get(did) += sumQ; + _xSignalSum2.get(did) += sumQ * sumQ; + _xTimingSum.get(did) += aveTS; + _xTimingSum2.get(did) += aveTS * aveTS; + _xEntries.get(did)++; + + if (_ptype == fLocal) { // hidefed2crate + for (int i = 0; i < digi.samples(); ++i) { + // Note: this used to be digi.sample(i).nominal_fC() - 2.5, but this branch doesn't exist in QIE10DataFrame. + // Instead, use lookup table. + //_cShapeCut_FEDSlot.fill(eid, i, constants::adc2fC[digi[i].adc()]); + _cShapeCut_FEDSlot.fill( + eid, i, hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, i)); + } + } + if (_ptype == fOnline) { + for (int iTS = 0; iTS < digi.samples(); ++iTS) { + _cADCvsTS_SubdetPM.fill(did, iTS, digi[iTS].adc()); + if (digi[iTS].le_tdc() < 50) { + double time = iTS * 25. + (digi[iTS].le_tdc() / 2.); + _cTDCTime_SubdetPM.fill(did, time); + _cTDCTime_depth.fill(did, time); + } + } + _cSumQ_SubdetPM.fill(did, sumQ); + } + } + } + + if (_ptype == fOnline && _evsTotal > 0 && _evsTotal % constants::CALIBEVENTS_MIN == 0) + this->_dump(); } -/* virtual */ bool LEDTask::_isApplicable(edm::Event const& e) -{ - if (_ptype!=fOnline) - { - // local - edm::Handle ctrigger; - if (!e.getByToken(_tokTrigger, ctrigger)) - _logger.dqmthrow("Collection HcalTBTriggerData isn't available " - + _tagTrigger.label() + " " + _tagTrigger.instance()); - return ctrigger->wasLEDTrigger(); - } else { - // fOnline mode - edm::Handle cumn; - if (!e.getByToken(_tokuMN, cumn)) { - return false; - } - - return (cumn->eventType() == constants::EVENTTYPE_LED); - } - - return false; +/* virtual */ bool LEDTask::_isApplicable(edm::Event const& e) { + if (_ptype != fOnline) { + // local + edm::Handle ctrigger; + if (!e.getByToken(_tokTrigger, ctrigger)) + _logger.dqmthrow("Collection HcalTBTriggerData isn't available " + _tagTrigger.label() + " " + + _tagTrigger.instance()); + return ctrigger->wasLEDTrigger(); + } else { + // fOnline mode + edm::Handle cumn; + if (!e.getByToken(_tokuMN, cumn)) { + return false; + } + + return (cumn->eventType() == constants::EVENTTYPE_LED); + } + + return false; } DEFINE_FWK_MODULE(LEDTask); - - diff --git a/DQM/HcalTasks/plugins/LaserTask.cc b/DQM/HcalTasks/plugins/LaserTask.cc index f5665719335e0..59a462f6682d6 100644 --- a/DQM/HcalTasks/plugins/LaserTask.cc +++ b/DQM/HcalTasks/plugins/LaserTask.cc @@ -3,888 +3,877 @@ using namespace hcaldqm; using namespace hcaldqm::constants; using namespace hcaldqm::filter; -LaserTask::LaserTask(edm::ParameterSet const& ps): - DQTask(ps) -{ - _nevents = ps.getUntrackedParameter("nevents", 2000); - - // tags - _tagHBHE = ps.getUntrackedParameter("tagHBHE", - edm::InputTag("hcalDigis")); - _tagHE = ps.getUntrackedParameter("tagHE", - edm::InputTag("hcalDigis")); - _tagHO = ps.getUntrackedParameter("tagHO", - edm::InputTag("hcalDigis")); - _tagHF = ps.getUntrackedParameter("tagHF", - edm::InputTag("hcalDigis")); - _taguMN = ps.getUntrackedParameter("taguMN", - edm::InputTag("hcalDigis")); - _tagLaserMon = ps.getUntrackedParameter("tagLaserMon", - edm::InputTag("LASERMON")); - _tokHBHE = consumes(_tagHBHE); - _tokHE = consumes(_tagHE); - _tokHO = consumes(_tagHO); - _tokHF = consumes(_tagHF); - _tokuMN = consumes(_taguMN); - _tokLaserMon = consumes(_tagLaserMon); - - _vflags.resize(nLaserFlag); - _vflags[fBadTiming]=hcaldqm::flag::Flag("BadTiming"); - _vflags[fMissingLaserMon]=hcaldqm::flag::Flag("MissingLaserMon"); - - // constants - _lowHBHE = ps.getUntrackedParameter("lowHBHE", - 50); - _lowHE = ps.getUntrackedParameter("lowHE", - 150); - _lowHO = ps.getUntrackedParameter("lowHO", - 100); - _lowHF = ps.getUntrackedParameter("lowHF", - 50); - _laserType = (uint32_t)ps.getUntrackedParameter("laserType"); - - // Laser mon digi ordering list - _vLaserMonIPhi = ps.getUntrackedParameter >("vLaserMonIPhi"); - _laserMonIEta = ps.getUntrackedParameter("laserMonIEta"); - _laserMonCBox = ps.getUntrackedParameter("laserMonCBox"); - _laserMonDigiOverlap = ps.getUntrackedParameter("laserMonDigiOverlap"); - _laserMonTS0 = ps.getUntrackedParameter("laserMonTS0"); - _laserMonThreshold = ps.getUntrackedParameter("laserMonThreshold", 1.e5); - _thresh_frac_timingreflm = ps.getUntrackedParameter("_thresh_frac_timingreflm", 0.01); - _thresh_min_lmsumq = ps.getUntrackedParameter("thresh_min_lmsumq", 50000.); - - std::vector vTimingRangeHB = ps.getUntrackedParameter>("thresh_timingreflm_HB", std::vector({-70, -10.})); - std::vector vTimingRangeHE = ps.getUntrackedParameter>("thresh_timingreflm_HE", std::vector({-60., 0.})); - std::vector vTimingRangeHO = ps.getUntrackedParameter>("thresh_timingreflm_HO", std::vector({-50., 20.})); - std::vector vTimingRangeHF = ps.getUntrackedParameter>("thresh_timingreflm_HF", std::vector({-50., 20.})); - _thresh_timingreflm[HcalBarrel] = std::make_pair(vTimingRangeHB[0], vTimingRangeHB[1]); - _thresh_timingreflm[HcalEndcap] = std::make_pair(vTimingRangeHE[0], vTimingRangeHE[1]); - _thresh_timingreflm[HcalOuter] = std::make_pair(vTimingRangeHO[0], vTimingRangeHO[1]); - _thresh_timingreflm[HcalForward] = std::make_pair(vTimingRangeHF[0], vTimingRangeHF[1]); -} - -/* virtual */ void LaserTask::bookHistograms(DQMStore::IBooker &ib, - edm::Run const& r, edm::EventSetup const& es) -{ - if (_ptype==fLocal) - if (r.runAuxiliary().run()==1) - return; - - DQTask::bookHistograms(ib, r, es); - - edm::ESHandle dbService; - es.get().get(dbService); - _emap = dbService->getHcalMapping(); - - std::vector vhashVME; - std::vector vhashuTCA; - std::vector vhashC36; - vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); - vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vhashVME); - _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vhashuTCA); - - // INITIALIZE - _cSignalMean_Subdet.initialize(_name, "SignalMean", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cSignalRMS_Subdet.initialize(_name, "SignalRMS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_1000), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cTimingMean_Subdet.initialize(_name, "TimingMean", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cTimingRMS_Subdet.initialize(_name, "TimingRMS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - - _cADC_SubdetPM.initialize(_name, "ADC", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_128), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - - if (_ptype == fLocal) { // hidefed2crate - _cSignalMean_FEDVME.initialize(_name, "SignalMean", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse),0); - _cSignalMean_FEDuTCA.initialize(_name, "SignalMean", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse),0); - _cSignalRMS_FEDVME.initialize(_name, "SignalRMS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000),0); - _cSignalRMS_FEDuTCA.initialize(_name, "SignalRMS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000),0); - _cTimingMean_FEDVME.initialize(_name, "TimingMean", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingMean_FEDuTCA.initialize(_name, "TimingMean", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingRMS_FEDVME.initialize(_name, "TimingRMS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingRMS_FEDuTCA.initialize(_name, "TimingRMS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cMissing_FEDVME.initialize(_name, "Missing", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMissing_FEDuTCA.initialize(_name, "Missing", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - _cShapeCut_FEDSlot.initialize(_name, "Shape", - hcaldqm::hashfunctions::fFEDSlot, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000),0); - } - _cTimingvsEvent_SubdetPM.initialize(_name, "TimingvsEvent", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::EventNumber(_nevents), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cSignalvsEvent_SubdetPM.initialize(_name, "SignalvsEvent", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::EventNumber(_nevents), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000),0); - _cTimingvsLS_SubdetPM.initialize(_name, "TimingvsLS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cSignalvsLS_SubdetPM.initialize(_name, "SignalvsLS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000),0); - _cTimingvsBX_SubdetPM.initialize(_name, "TimingvsBX", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cSignalvsBX_SubdetPM.initialize(_name, "SignalvsBX", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000),0); - - _cSignalMean_depth.initialize(_name, "SignalMean", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse),0); - _cSignalRMS_depth.initialize(_name, "SignalRMS", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_1000),0); - _cTimingMean_depth.initialize(_name, "TimingMean", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cTimingRMS_depth.initialize(_name, "TimingRMS", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - - _cMissing_depth.initialize(_name, "Missing", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - - // initialize compact containers - _xSignalSum.initialize(hcaldqm::hashfunctions::fDChannel); - _xSignalSum2.initialize(hcaldqm::hashfunctions::fDChannel); - _xTimingSum.initialize(hcaldqm::hashfunctions::fDChannel); - _xTimingSum2.initialize(hcaldqm::hashfunctions::fDChannel); - _xEntries.initialize(hcaldqm::hashfunctions::fDChannel); - - // LaserMon containers - if (_ptype == fOnline || _ptype == fLocal) { - _cLaserMonSumQ.initialize(_name, - "LaserMonSumQ", - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_1000000), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cLaserMonSumQ.showOverflowX(true); - - _cLaserMonTiming.initialize(_name, - "LaserMonTiming", - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cLaserMonTiming.showOverflowX(true); - - if (_ptype == fOnline) { - _cLaserMonSumQ_LS.initialize(_name, - "LaserMonSumQ_LS", - new hcaldqm::quantity::LumiSectionCoarse(_maxLS, 10), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_1000000) - ); - _cLaserMonTiming_LS.initialize(_name, - "LaserMonTiming_LS", - new hcaldqm::quantity::LumiSectionCoarse(_maxLS, 10), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_100TS) - ); - _cTimingDiffLS_SubdetPM.initialize(_name, "TimingDiff_DigiMinusLaserMon", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::LumiSectionCoarse(_maxLS, 10), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRBX), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTimingDiff_ns), 0); - _cTimingDiffLS_SubdetPM.showOverflowY(true); - } else if (_ptype == fLocal) { - _cLaserMonSumQ_Event.initialize(_name, - "LaserMonSumQ_Event", - new hcaldqm::quantity::EventNumber(_nevents), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_1000000) - ); - _cLaserMonTiming_Event.initialize(_name, - "LaserMonTiming_Event", - new hcaldqm::quantity::EventNumber(_nevents), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_100TS) - ); - _cTimingDiffEvent_SubdetPM.initialize(_name, "TimingDiff_DigiMinusLaserMon", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::EventNumber(_nevents), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRBX), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTimingDiff_ns), 0); - _cTimingDiffEvent_SubdetPM.showOverflowY(true); - } - _cTiming_DigivsLaserMon_SubdetPM.initialize(_name, "Timing_DigivsLaserMon", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250_coarse), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250_coarse), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cTiming_DigivsLaserMon_SubdetPM.showOverflowX(true); - _cTiming_DigivsLaserMon_SubdetPM.showOverflowY(true); - - _xTimingRefLMSum.initialize(hcaldqm::hashfunctions::fDChannel); - _xTimingRefLMSum2.initialize(hcaldqm::hashfunctions::fDChannel); - _xNBadTimingRefLM.initialize(hcaldqm::hashfunctions::fFED); - _xNChs.initialize(hcaldqm::hashfunctions::fFED); - _xMissingLaserMon = 0; - - std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); - std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); - std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); - for (std::vector::const_iterator it=vFEDsVME.begin(); - it!=vFEDsVME.end(); ++it) - _vhashFEDs.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - FIBER_VME_MIN, SPIGOT_MIN, (*it)-FED_VME_MIN).rawId()); - for (std::vector::const_iterator it=vFEDsuTCA.begin(); - it!=vFEDsuTCA.end(); ++it) - { - std::pair cspair = utilities::fed2crate(*it); - _vhashFEDs.push_back(HcalElectronicsId( - cspair.first, cspair.second, FIBER_uTCA_MIN1, - FIBERCH_MIN, false).rawId()); - } - - _cSummaryvsLS_FED.initialize(_name, "SummaryvsLS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::FlagQuantity(_vflags), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),0); - _cSummaryvsLS.initialize(_name, "SummaryvsLS", - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::FEDQuantity(vFEDs), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),0); - } // End if (_ptype == fOnline || _ptype == fLocal) { - - - // BOOK - _cSignalMean_Subdet.book(ib, _emap, _subsystem); - _cSignalRMS_Subdet.book(ib, _emap, _subsystem); - _cTimingMean_Subdet.book(ib, _emap, _subsystem); - _cTimingRMS_Subdet.book(ib, _emap, _subsystem); - - _cSignalMean_depth.book(ib, _emap, _subsystem); - _cSignalRMS_depth.book(ib, _emap, _subsystem); - _cTimingMean_depth.book(ib, _emap, _subsystem); - _cTimingRMS_depth.book(ib, _emap, _subsystem); - - if (_ptype==fLocal) - { - _cTimingvsEvent_SubdetPM.book(ib, _emap, _subsystem); - _cSignalvsEvent_SubdetPM.book(ib, _emap, _subsystem); - } - else - { - _cTimingvsLS_SubdetPM.book(ib, _emap, _subsystem); - _cSignalvsLS_SubdetPM.book(ib, _emap, _subsystem); - _cTimingvsBX_SubdetPM.book(ib, _emap, _subsystem); - _cSignalvsBX_SubdetPM.book(ib, _emap, _subsystem); - } - - if (_ptype == fLocal) { // hidefed2crate - _cSignalMean_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cSignalMean_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cSignalRMS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cSignalRMS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cTimingMean_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cTimingMean_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cTimingRMS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cTimingRMS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cMissing_FEDVME.book(ib, _emap, _filter_uTCA,_subsystem); - _cMissing_FEDuTCA.book(ib, _emap, _filter_VME,_subsystem); - _cShapeCut_FEDSlot.book(ib, _emap, _subsystem); - } - _cADC_SubdetPM.book(ib, _emap, _subsystem); - - _cMissing_depth.book(ib, _emap,_subsystem); - - _xSignalSum.book(_emap); - _xSignalSum2.book(_emap); - _xEntries.book(_emap); - _xTimingSum.book(_emap); - _xTimingSum2.book(_emap); - - if (_ptype == fOnline || _ptype == fLocal) { - _cLaserMonSumQ.book(ib, _subsystem); - _cLaserMonTiming.book(ib, _subsystem); - if (_ptype == fOnline) { - _cLaserMonSumQ_LS.book(ib, _subsystem); - _cLaserMonTiming_LS.book(ib, _subsystem); - _cTimingDiffLS_SubdetPM.book(ib, _emap, _subsystem); - } else if (_ptype == fLocal) { - _cLaserMonSumQ_Event.book(ib, _subsystem); - _cLaserMonTiming_Event.book(ib, _subsystem); - _cTimingDiffEvent_SubdetPM.book(ib, _emap, _subsystem); - } - _cTiming_DigivsLaserMon_SubdetPM.book(ib, _emap, _subsystem); - _xTimingRefLMSum.book(_emap); - _xTimingRefLMSum2.book(_emap); - _xNBadTimingRefLM.book(_emap); - _xNChs.book(_emap); - _cSummaryvsLS_FED.book(ib, _emap, _subsystem); - _cSummaryvsLS.book(ib, _subsystem); - } - - _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); +LaserTask::LaserTask(edm::ParameterSet const& ps) : DQTask(ps) { + _nevents = ps.getUntrackedParameter("nevents", 2000); + + // tags + _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); + _tagHE = ps.getUntrackedParameter("tagHE", edm::InputTag("hcalDigis")); + _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); + _tagHF = ps.getUntrackedParameter("tagHF", edm::InputTag("hcalDigis")); + _taguMN = ps.getUntrackedParameter("taguMN", edm::InputTag("hcalDigis")); + _tagLaserMon = ps.getUntrackedParameter("tagLaserMon", edm::InputTag("LASERMON")); + _tokHBHE = consumes(_tagHBHE); + _tokHE = consumes(_tagHE); + _tokHO = consumes(_tagHO); + _tokHF = consumes(_tagHF); + _tokuMN = consumes(_taguMN); + _tokLaserMon = consumes(_tagLaserMon); + + _vflags.resize(nLaserFlag); + _vflags[fBadTiming] = hcaldqm::flag::Flag("BadTiming"); + _vflags[fMissingLaserMon] = hcaldqm::flag::Flag("MissingLaserMon"); + + // constants + _lowHBHE = ps.getUntrackedParameter("lowHBHE", 50); + _lowHE = ps.getUntrackedParameter("lowHE", 150); + _lowHO = ps.getUntrackedParameter("lowHO", 100); + _lowHF = ps.getUntrackedParameter("lowHF", 50); + _laserType = (uint32_t)ps.getUntrackedParameter("laserType"); + + // Laser mon digi ordering list + _vLaserMonIPhi = ps.getUntrackedParameter>("vLaserMonIPhi"); + _laserMonIEta = ps.getUntrackedParameter("laserMonIEta"); + _laserMonCBox = ps.getUntrackedParameter("laserMonCBox"); + _laserMonDigiOverlap = ps.getUntrackedParameter("laserMonDigiOverlap"); + _laserMonTS0 = ps.getUntrackedParameter("laserMonTS0"); + _laserMonThreshold = ps.getUntrackedParameter("laserMonThreshold", 1.e5); + _thresh_frac_timingreflm = ps.getUntrackedParameter("_thresh_frac_timingreflm", 0.01); + _thresh_min_lmsumq = ps.getUntrackedParameter("thresh_min_lmsumq", 50000.); + + std::vector vTimingRangeHB = + ps.getUntrackedParameter>("thresh_timingreflm_HB", std::vector({-70, -10.})); + std::vector vTimingRangeHE = + ps.getUntrackedParameter>("thresh_timingreflm_HE", std::vector({-60., 0.})); + std::vector vTimingRangeHO = + ps.getUntrackedParameter>("thresh_timingreflm_HO", std::vector({-50., 20.})); + std::vector vTimingRangeHF = + ps.getUntrackedParameter>("thresh_timingreflm_HF", std::vector({-50., 20.})); + _thresh_timingreflm[HcalBarrel] = std::make_pair(vTimingRangeHB[0], vTimingRangeHB[1]); + _thresh_timingreflm[HcalEndcap] = std::make_pair(vTimingRangeHE[0], vTimingRangeHE[1]); + _thresh_timingreflm[HcalOuter] = std::make_pair(vTimingRangeHO[0], vTimingRangeHO[1]); + _thresh_timingreflm[HcalForward] = std::make_pair(vTimingRangeHF[0], vTimingRangeHF[1]); } -/* virtual */ void LaserTask::_resetMonitors(hcaldqm::UpdateFreq uf) -{ - DQTask::_resetMonitors(uf); +/* virtual */ void LaserTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + if (_ptype == fLocal) + if (r.runAuxiliary().run() == 1) + return; + + DQTask::bookHistograms(ib, r, es); + + edm::ESHandle dbService; + es.get().get(dbService); + _emap = dbService->getHcalMapping(); + + std::vector vhashVME; + std::vector vhashuTCA; + std::vector vhashC36; + vhashVME.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); + vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vhashVME); + _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vhashuTCA); + + // INITIALIZE + _cSignalMean_Subdet.initialize(_name, + "SignalMean", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cSignalRMS_Subdet.initialize(_name, + "SignalRMS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_1000), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cTimingMean_Subdet.initialize(_name, + "TimingMean", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cTimingRMS_Subdet.initialize(_name, + "TimingRMS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + + _cADC_SubdetPM.initialize(_name, + "ADC", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_128), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + + if (_ptype == fLocal) { // hidefed2crate + _cSignalMean_FEDVME.initialize(_name, + "SignalMean", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse), + 0); + _cSignalMean_FEDuTCA.initialize(_name, + "SignalMean", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse), + 0); + _cSignalRMS_FEDVME.initialize(_name, + "SignalRMS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000), + 0); + _cSignalRMS_FEDuTCA.initialize(_name, + "SignalRMS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000), + 0); + _cTimingMean_FEDVME.initialize(_name, + "TimingMean", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingMean_FEDuTCA.initialize(_name, + "TimingMean", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingRMS_FEDVME.initialize(_name, + "TimingRMS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingRMS_FEDuTCA.initialize(_name, + "TimingRMS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cMissing_FEDVME.initialize(_name, + "Missing", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMissing_FEDuTCA.initialize(_name, + "Missing", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cShapeCut_FEDSlot.initialize(_name, + "Shape", + hcaldqm::hashfunctions::fFEDSlot, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000), + 0); + } + _cTimingvsEvent_SubdetPM.initialize(_name, + "TimingvsEvent", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::EventNumber(_nevents), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cSignalvsEvent_SubdetPM.initialize(_name, + "SignalvsEvent", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::EventNumber(_nevents), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000), + 0); + _cTimingvsLS_SubdetPM.initialize(_name, + "TimingvsLS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cSignalvsLS_SubdetPM.initialize(_name, + "SignalvsLS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000), + 0); + _cTimingvsBX_SubdetPM.initialize(_name, + "TimingvsBX", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cSignalvsBX_SubdetPM.initialize(_name, + "SignalvsBX", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_3000), + 0); + + _cSignalMean_depth.initialize(_name, + "SignalMean", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_100000Coarse), + 0); + _cSignalRMS_depth.initialize(_name, + "SignalRMS", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_1000), + 0); + _cTimingMean_depth.initialize(_name, + "TimingMean", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cTimingRMS_depth.initialize(_name, + "TimingRMS", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + + _cMissing_depth.initialize(_name, + "Missing", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + // initialize compact containers + _xSignalSum.initialize(hcaldqm::hashfunctions::fDChannel); + _xSignalSum2.initialize(hcaldqm::hashfunctions::fDChannel); + _xTimingSum.initialize(hcaldqm::hashfunctions::fDChannel); + _xTimingSum2.initialize(hcaldqm::hashfunctions::fDChannel); + _xEntries.initialize(hcaldqm::hashfunctions::fDChannel); + + // LaserMon containers + if (_ptype == fOnline || _ptype == fLocal) { + _cLaserMonSumQ.initialize(_name, + "LaserMonSumQ", + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_1000000), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cLaserMonSumQ.showOverflowX(true); + + _cLaserMonTiming.initialize(_name, + "LaserMonTiming", + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cLaserMonTiming.showOverflowX(true); + + if (_ptype == fOnline) { + _cLaserMonSumQ_LS.initialize(_name, + "LaserMonSumQ_LS", + new hcaldqm::quantity::LumiSectionCoarse(_maxLS, 10), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_1000000)); + _cLaserMonTiming_LS.initialize(_name, + "LaserMonTiming_LS", + new hcaldqm::quantity::LumiSectionCoarse(_maxLS, 10), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_100TS)); + _cTimingDiffLS_SubdetPM.initialize(_name, + "TimingDiff_DigiMinusLaserMon", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::LumiSectionCoarse(_maxLS, 10), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTimingDiff_ns), + 0); + _cTimingDiffLS_SubdetPM.showOverflowY(true); + } else if (_ptype == fLocal) { + _cLaserMonSumQ_Event.initialize(_name, + "LaserMonSumQ_Event", + new hcaldqm::quantity::EventNumber(_nevents), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_1000000)); + _cLaserMonTiming_Event.initialize(_name, + "LaserMonTiming_Event", + new hcaldqm::quantity::EventNumber(_nevents), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_100TS)); + _cTimingDiffEvent_SubdetPM.initialize(_name, + "TimingDiff_DigiMinusLaserMon", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::EventNumber(_nevents), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTimingDiff_ns), + 0); + _cTimingDiffEvent_SubdetPM.showOverflowY(true); + } + _cTiming_DigivsLaserMon_SubdetPM.initialize( + _name, + "Timing_DigivsLaserMon", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250_coarse), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250_coarse), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cTiming_DigivsLaserMon_SubdetPM.showOverflowX(true); + _cTiming_DigivsLaserMon_SubdetPM.showOverflowY(true); + + _xTimingRefLMSum.initialize(hcaldqm::hashfunctions::fDChannel); + _xTimingRefLMSum2.initialize(hcaldqm::hashfunctions::fDChannel); + _xNBadTimingRefLM.initialize(hcaldqm::hashfunctions::fFED); + _xNChs.initialize(hcaldqm::hashfunctions::fFED); + _xMissingLaserMon = 0; + + std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); + std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); + std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); + for (std::vector::const_iterator it = vFEDsVME.begin(); it != vFEDsVME.end(); ++it) + _vhashFEDs.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, (*it) - FED_VME_MIN).rawId()); + for (std::vector::const_iterator it = vFEDsuTCA.begin(); it != vFEDsuTCA.end(); ++it) { + std::pair cspair = utilities::fed2crate(*it); + _vhashFEDs.push_back(HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + } + + _cSummaryvsLS_FED.initialize(_name, + "SummaryvsLS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::FlagQuantity(_vflags), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState), + 0); + _cSummaryvsLS.initialize(_name, + "SummaryvsLS", + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::FEDQuantity(vFEDs), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState), + 0); + } // End if (_ptype == fOnline || _ptype == fLocal) { + + // BOOK + _cSignalMean_Subdet.book(ib, _emap, _subsystem); + _cSignalRMS_Subdet.book(ib, _emap, _subsystem); + _cTimingMean_Subdet.book(ib, _emap, _subsystem); + _cTimingRMS_Subdet.book(ib, _emap, _subsystem); + + _cSignalMean_depth.book(ib, _emap, _subsystem); + _cSignalRMS_depth.book(ib, _emap, _subsystem); + _cTimingMean_depth.book(ib, _emap, _subsystem); + _cTimingRMS_depth.book(ib, _emap, _subsystem); + + if (_ptype == fLocal) { + _cTimingvsEvent_SubdetPM.book(ib, _emap, _subsystem); + _cSignalvsEvent_SubdetPM.book(ib, _emap, _subsystem); + } else { + _cTimingvsLS_SubdetPM.book(ib, _emap, _subsystem); + _cSignalvsLS_SubdetPM.book(ib, _emap, _subsystem); + _cTimingvsBX_SubdetPM.book(ib, _emap, _subsystem); + _cSignalvsBX_SubdetPM.book(ib, _emap, _subsystem); + } + + if (_ptype == fLocal) { // hidefed2crate + _cSignalMean_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cSignalMean_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cSignalRMS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cSignalRMS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cTimingMean_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cTimingMean_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cTimingRMS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cTimingRMS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cMissing_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMissing_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cShapeCut_FEDSlot.book(ib, _emap, _subsystem); + } + _cADC_SubdetPM.book(ib, _emap, _subsystem); + + _cMissing_depth.book(ib, _emap, _subsystem); + + _xSignalSum.book(_emap); + _xSignalSum2.book(_emap); + _xEntries.book(_emap); + _xTimingSum.book(_emap); + _xTimingSum2.book(_emap); + + if (_ptype == fOnline || _ptype == fLocal) { + _cLaserMonSumQ.book(ib, _subsystem); + _cLaserMonTiming.book(ib, _subsystem); + if (_ptype == fOnline) { + _cLaserMonSumQ_LS.book(ib, _subsystem); + _cLaserMonTiming_LS.book(ib, _subsystem); + _cTimingDiffLS_SubdetPM.book(ib, _emap, _subsystem); + } else if (_ptype == fLocal) { + _cLaserMonSumQ_Event.book(ib, _subsystem); + _cLaserMonTiming_Event.book(ib, _subsystem); + _cTimingDiffEvent_SubdetPM.book(ib, _emap, _subsystem); + } + _cTiming_DigivsLaserMon_SubdetPM.book(ib, _emap, _subsystem); + _xTimingRefLMSum.book(_emap); + _xTimingRefLMSum2.book(_emap); + _xNBadTimingRefLM.book(_emap); + _xNChs.book(_emap); + _cSummaryvsLS_FED.book(ib, _emap, _subsystem); + _cSummaryvsLS.book(ib, _subsystem); + } + + _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); } -/* virtual */ void LaserTask::_dump() -{ - _cSignalMean_Subdet.reset(); - _cSignalRMS_Subdet.reset(); - _cTimingMean_Subdet.reset(); - _cTimingRMS_Subdet.reset(); - _cSignalMean_depth.reset(); - _cSignalRMS_depth.reset(); - _cTimingMean_depth.reset(); - _cTimingRMS_depth.reset(); - - if (_ptype == fLocal) { // hidefed2crate - _cSignalMean_FEDVME.reset(); - _cSignalMean_FEDuTCA.reset(); - _cSignalRMS_FEDVME.reset(); - _cSignalRMS_FEDuTCA.reset(); - _cTimingMean_FEDVME.reset(); - _cTimingMean_FEDuTCA.reset(); - _cTimingRMS_FEDVME.reset(); - _cTimingRMS_FEDuTCA.reset(); - } - if (_ptype != fOffline) { - _xNChs.reset(); - } - - std::vector dids = _emap->allPrecisionId(); - for (std::vector::const_iterator it=dids.begin(); - it!=dids.end(); ++it) - { - if (!it->isHcalDetId()) - continue; - HcalDetId did = HcalDetId(it->rawId()); - HcalElectronicsId eid(_ehashmap.lookup(*it)); - int n = _xEntries.get(did); - // channels missing or low signal - if (n == 0) { - _cMissing_depth.fill(did); - if (_ptype == fLocal) { // hidefed2crate - if (eid.isVMEid()) - _cMissing_FEDVME.fill(eid); - else - _cMissing_FEDuTCA.fill(eid); - } - continue; - } - - _xNChs.get(eid)++; - - double msig = _xSignalSum.get(did)/n; - double mtim = _xTimingSum.get(did)/n; - double rsig = sqrt(_xSignalSum2.get(did)/n-msig*msig); - double rtim = sqrt(_xTimingSum2.get(did)/n-mtim*mtim); - - _cSignalMean_Subdet.fill(did, msig); - _cSignalMean_depth.fill(did, msig); - _cSignalRMS_Subdet.fill(did, rsig); - _cSignalRMS_depth.fill(did, rsig); - _cTimingMean_Subdet.fill(did, mtim); - _cTimingMean_depth.fill(did, mtim); - _cTimingRMS_Subdet.fill(did, rtim); - _cTimingRMS_depth.fill(did, rtim); - if (_ptype == fLocal) { // hidefed2crate - if (eid.isVMEid()) - { - _cSignalMean_FEDVME.fill(eid, msig); - _cSignalRMS_FEDVME.fill(eid, rsig); - _cTimingMean_FEDVME.fill(eid, mtim); - _cTimingRMS_FEDVME.fill(eid, rtim); - } - else - { - _cSignalMean_FEDuTCA.fill(eid, msig); - _cSignalRMS_FEDuTCA.fill(eid, rsig); - _cTimingMean_FEDuTCA.fill(eid, mtim); - _cTimingRMS_FEDuTCA.fill(eid, rtim); - } - } - - // Bad timing - - double timingreflm_mean = _xTimingRefLMSum.get(did) / n; - //double timingreflm_rms = sqrt(_xTimingRefLMSum2.get(did) / n - timingreflm_mean * timingreflm_mean); - - if ((timingreflm_mean < _thresh_timingreflm[did.subdet()].first) || (timingreflm_mean > _thresh_timingreflm[did.subdet()].second)) { - _xNBadTimingRefLM.get(eid)++; - } - } - if (_ptype != fOffline) { // hidefed2crate - for (std::vector::const_iterator it=_vhashFEDs.begin(); it!=_vhashFEDs.end(); ++it) { - hcaldqm::flag::Flag fSum("LASER"); - HcalElectronicsId eid = HcalElectronicsId(*it); - std::vector::const_iterator jt= - std::find(_vcdaqEids.begin(), _vcdaqEids.end(), (*it)); - if (jt==_vcdaqEids.end()) - { - // not @cDAQ - for ( - uint32_t iflag=0; iflag<_vflags.size(); iflag++) - _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), - int(hcaldqm::flag::fNCDAQ)); - _cSummaryvsLS.setBinContent(eid, _currentLS, int(hcaldqm::flag::fNCDAQ)); - continue; - } - // @cDAQ - if (hcaldqm::utilities::isFEDHBHE(eid) || hcaldqm::utilities::isFEDHO(eid) || hcaldqm::utilities::isFEDHF(eid)) { - int min_nchs = 10; - if (_xNChs.get(eid) < min_nchs) { - _vflags[fBadTiming]._state = hcaldqm::flag::fNA; - } else { - double frbadtimingreflm = double(_xNBadTimingRefLM.get(eid))/double(_xNChs.get(eid)); - if (frbadtimingreflm > _thresh_frac_timingreflm) { - _vflags[fBadTiming]._state = hcaldqm::flag::fBAD; - } else { - _vflags[fBadTiming]._state = hcaldqm::flag::fGOOD; - } - } - if (_xMissingLaserMon) { - _vflags[fMissingLaserMon]._state = hcaldqm::flag::fBAD; - } else { - _vflags[fMissingLaserMon]._state = hcaldqm::flag::fGOOD; - } - } - - // Set SummaryVsLS bins - int iflag=0; - for (std::vector::iterator ft=_vflags.begin(); - ft!=_vflags.end(); ++ft) - { - _cSummaryvsLS_FED.setBinContent(eid, _currentLS, iflag, - int(ft->_state)); - fSum+=(*ft); - iflag++; - ft->reset(); - } - _cSummaryvsLS.setBinContent(eid, _currentLS, fSum._state); - } // End loop over FEDs - - // Reset per-LS containers - _xNBadTimingRefLM.reset(); - _xMissingLaserMon = 0; - } // End if _ptype != fOffline +/* virtual */ void LaserTask::_resetMonitors(hcaldqm::UpdateFreq uf) { DQTask::_resetMonitors(uf); } + +/* virtual */ void LaserTask::_dump() { + _cSignalMean_Subdet.reset(); + _cSignalRMS_Subdet.reset(); + _cTimingMean_Subdet.reset(); + _cTimingRMS_Subdet.reset(); + _cSignalMean_depth.reset(); + _cSignalRMS_depth.reset(); + _cTimingMean_depth.reset(); + _cTimingRMS_depth.reset(); + + if (_ptype == fLocal) { // hidefed2crate + _cSignalMean_FEDVME.reset(); + _cSignalMean_FEDuTCA.reset(); + _cSignalRMS_FEDVME.reset(); + _cSignalRMS_FEDuTCA.reset(); + _cTimingMean_FEDVME.reset(); + _cTimingMean_FEDuTCA.reset(); + _cTimingRMS_FEDVME.reset(); + _cTimingRMS_FEDuTCA.reset(); + } + if (_ptype != fOffline) { + _xNChs.reset(); + } + + std::vector dids = _emap->allPrecisionId(); + for (std::vector::const_iterator it = dids.begin(); it != dids.end(); ++it) { + if (!it->isHcalDetId()) + continue; + HcalDetId did = HcalDetId(it->rawId()); + HcalElectronicsId eid(_ehashmap.lookup(*it)); + int n = _xEntries.get(did); + // channels missing or low signal + if (n == 0) { + _cMissing_depth.fill(did); + if (_ptype == fLocal) { // hidefed2crate + if (eid.isVMEid()) + _cMissing_FEDVME.fill(eid); + else + _cMissing_FEDuTCA.fill(eid); + } + continue; + } + + _xNChs.get(eid)++; + + double msig = _xSignalSum.get(did) / n; + double mtim = _xTimingSum.get(did) / n; + double rsig = sqrt(_xSignalSum2.get(did) / n - msig * msig); + double rtim = sqrt(_xTimingSum2.get(did) / n - mtim * mtim); + + _cSignalMean_Subdet.fill(did, msig); + _cSignalMean_depth.fill(did, msig); + _cSignalRMS_Subdet.fill(did, rsig); + _cSignalRMS_depth.fill(did, rsig); + _cTimingMean_Subdet.fill(did, mtim); + _cTimingMean_depth.fill(did, mtim); + _cTimingRMS_Subdet.fill(did, rtim); + _cTimingRMS_depth.fill(did, rtim); + if (_ptype == fLocal) { // hidefed2crate + if (eid.isVMEid()) { + _cSignalMean_FEDVME.fill(eid, msig); + _cSignalRMS_FEDVME.fill(eid, rsig); + _cTimingMean_FEDVME.fill(eid, mtim); + _cTimingRMS_FEDVME.fill(eid, rtim); + } else { + _cSignalMean_FEDuTCA.fill(eid, msig); + _cSignalRMS_FEDuTCA.fill(eid, rsig); + _cTimingMean_FEDuTCA.fill(eid, mtim); + _cTimingRMS_FEDuTCA.fill(eid, rtim); + } + } + + // Bad timing + + double timingreflm_mean = _xTimingRefLMSum.get(did) / n; + //double timingreflm_rms = sqrt(_xTimingRefLMSum2.get(did) / n - timingreflm_mean * timingreflm_mean); + + if ((timingreflm_mean < _thresh_timingreflm[did.subdet()].first) || + (timingreflm_mean > _thresh_timingreflm[did.subdet()].second)) { + _xNBadTimingRefLM.get(eid)++; + } + } + if (_ptype != fOffline) { // hidefed2crate + for (std::vector::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) { + hcaldqm::flag::Flag fSum("LASER"); + HcalElectronicsId eid = HcalElectronicsId(*it); + std::vector::const_iterator jt = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), (*it)); + if (jt == _vcdaqEids.end()) { + // not @cDAQ + for (uint32_t iflag = 0; iflag < _vflags.size(); iflag++) + _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), int(hcaldqm::flag::fNCDAQ)); + _cSummaryvsLS.setBinContent(eid, _currentLS, int(hcaldqm::flag::fNCDAQ)); + continue; + } + // @cDAQ + if (hcaldqm::utilities::isFEDHBHE(eid) || hcaldqm::utilities::isFEDHO(eid) || hcaldqm::utilities::isFEDHF(eid)) { + int min_nchs = 10; + if (_xNChs.get(eid) < min_nchs) { + _vflags[fBadTiming]._state = hcaldqm::flag::fNA; + } else { + double frbadtimingreflm = double(_xNBadTimingRefLM.get(eid)) / double(_xNChs.get(eid)); + if (frbadtimingreflm > _thresh_frac_timingreflm) { + _vflags[fBadTiming]._state = hcaldqm::flag::fBAD; + } else { + _vflags[fBadTiming]._state = hcaldqm::flag::fGOOD; + } + } + if (_xMissingLaserMon) { + _vflags[fMissingLaserMon]._state = hcaldqm::flag::fBAD; + } else { + _vflags[fMissingLaserMon]._state = hcaldqm::flag::fGOOD; + } + } + + // Set SummaryVsLS bins + int iflag = 0; + for (std::vector::iterator ft = _vflags.begin(); ft != _vflags.end(); ++ft) { + _cSummaryvsLS_FED.setBinContent(eid, _currentLS, iflag, int(ft->_state)); + fSum += (*ft); + iflag++; + ft->reset(); + } + _cSummaryvsLS.setBinContent(eid, _currentLS, fSum._state); + } // End loop over FEDs + + // Reset per-LS containers + _xNBadTimingRefLM.reset(); + _xMissingLaserMon = 0; + } // End if _ptype != fOffline } -/* virtual */ void LaserTask::_process(edm::Event const& e, - edm::EventSetup const& es) -{ - edm::Handle chbhe; - edm::Handle cHE; - edm::Handle cho; - edm::Handle chf; - - if (!e.getByToken(_tokHBHE, chbhe)) - _logger.dqmthrow("Collection HBHEDigiCollection isn't available " - + _tagHBHE.label() + " " + _tagHBHE.instance()); - if (!e.getByToken(_tokHE, cHE)) - _logger.dqmthrow("Collection QIE11DigiCollection isn't available " - + _tagHE.label() + " " + _tagHE.instance()); - if (!e.getByToken(_tokHO, cho)) - _logger.dqmthrow("Collection HODigiCollection isn't available " - + _tagHO.label() + " " + _tagHO.instance()); - if (!e.getByToken(_tokHF, chf)) - _logger.dqmthrow("Collection QIE10DigiCollection isn't available " - + _tagHF.label() + " " + _tagHF.instance()); - -// int currentEvent = e.eventAuxiliary().id().event(); - int bx = e.bunchCrossing(); - - - // LASERMON - edm::Handle cLaserMon; - if (!e.getByToken(_tokLaserMon, cLaserMon)) { - _logger.dqmthrow("QIE10DigiCollection for laserMonDigis isn't available."); - } - std::vector laserMonADC; - processLaserMon(cLaserMon, laserMonADC); - - // SumQ = peak +/- 3 TSes - // Timing = fC-weighted average (TS-TS0) * 25 ns, also in peak +/- 3 TSes - int peakTS = -1; - double peakLaserMonADC = -1; - for (unsigned int iTS = 0; iTS < laserMonADC.size(); ++iTS) { - if (laserMonADC[iTS] > peakLaserMonADC) { - peakLaserMonADC = laserMonADC[iTS]; - peakTS = iTS; - } - } - - double laserMonSumQ = 0; - double laserMonTiming = 0.; - - if (peakTS >= 0) { - int minTS = std::max(0, peakTS - 3); - int maxTS = std::min(int(laserMonADC.size()-1), peakTS + 3); - for (int iTS = minTS; iTS <= maxTS; ++iTS) { - double this_fC = hcaldqm::constants::adc2fC[laserMonADC[iTS]]; - laserMonSumQ += this_fC; - laserMonTiming += 25. * (iTS - _laserMonTS0) * this_fC; - } - } - if (laserMonSumQ > 0.) { - laserMonTiming = laserMonTiming / laserMonSumQ; - } else { - ++_xMissingLaserMon; - } - - if (laserMonSumQ > _laserMonThreshold) { - _cLaserMonSumQ.fill(laserMonSumQ); - _cLaserMonTiming.fill(laserMonTiming); - if (_ptype == fOnline) { - _cLaserMonSumQ_LS.fill(_currentLS, laserMonSumQ); - _cLaserMonTiming_LS.fill(_currentLS, laserMonTiming); - } else if (_ptype == fLocal) { - int currentEvent = e.eventAuxiliary().id().event(); - _cLaserMonSumQ_Event.fill(currentEvent, laserMonSumQ); - _cLaserMonTiming_Event.fill(currentEvent, laserMonTiming); - } - } - - for (HBHEDigiCollection::const_iterator it=chbhe->begin(); - it!=chbhe->end(); ++it) - { - const HBHEDataFrame digi = (const HBHEDataFrame)(*it); - double sumQ = hcaldqm::utilities::sumQ(digi, 2.5, 0, - digi.size()-1); - if (sumQ<_lowHBHE) - continue; - HcalDetId did = digi.id(); - HcalElectronicsId eid = digi.elecId(); - - double aveTS = hcaldqm::utilities::aveTS(digi, 2.5, 0, - digi.size()-1); - _xSignalSum.get(did)+=sumQ; - _xSignalSum2.get(did)+=sumQ*sumQ; - _xTimingSum.get(did)+=aveTS; - _xTimingSum2.get(did)+=aveTS*aveTS; - _xEntries.get(did)++; - - for (int i=0; ibegin(); it!=cHE->end(); - ++it) - { - const QIE11DataFrame digi = static_cast(*it); - HcalDetId const& did = digi.detid(); - if (did.subdet() != HcalEndcap) { - continue; - } - uint32_t rawid = _ehashmap.lookup(did); - HcalElectronicsId const& eid(rawid); - - CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); - //double sumQ = hcaldqm::utilities::sumQ_v10(digi, 2.5, 0, digi.samples()-1); - double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples()-1); - if (sumQ<_lowHE) - continue; - - - //double aveTS = hcaldqm::utilities::aveTS_v10(digi, 2.5, 0,digi.samples()-1); - double aveTS = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.samples()-1); - _xSignalSum.get(did)+=sumQ; - _xSignalSum2.get(did)+=sumQ*sumQ; - _xTimingSum.get(did)+=aveTS; - _xTimingSum2.get(did)+=aveTS*aveTS; - _xEntries.get(did)++; - - for (int i=0; i(_dbService, digi_fC, did, digi, i)); - } - _cADC_SubdetPM.fill(did, digi[i].adc()); - } - - // select based on local global - double digiTimingSOI = (aveTS - digi.presamples()) * 25.; - double deltaTiming = digiTimingSOI - laserMonTiming; - _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI); - _xTimingRefLMSum.get(did) += deltaTiming; - _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming; - if (_ptype==fLocal) - { - int currentEvent = e.eventAuxiliary().id().event(); - _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS); - _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ); - _cTimingDiffEvent_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming); - } - else - { - _cTimingvsLS_SubdetPM.fill(did, _currentLS, aveTS); - _cSignalvsLS_SubdetPM.fill(did, _currentLS, sumQ); - _cTimingvsBX_SubdetPM.fill(did, bx, aveTS); - _cSignalvsBX_SubdetPM.fill(did, bx, sumQ); - _cTimingDiffLS_SubdetPM.fill(did, _currentLS, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming); - } - } - for (HODigiCollection::const_iterator it=cho->begin(); - it!=cho->end(); ++it) - { - const HODataFrame digi = (const HODataFrame)(*it); - double sumQ = hcaldqm::utilities::sumQ(digi, 8.5, 0, - digi.size()-1); - if (sumQ<_lowHO) - continue; - HcalDetId did = digi.id(); - HcalElectronicsId eid = digi.elecId(); - - double aveTS = hcaldqm::utilities::aveTS(digi, 8.5, 0, - digi.size()-1); - _xSignalSum.get(did)+=sumQ; - _xSignalSum2.get(did)+=sumQ*sumQ; - _xTimingSum.get(did)+=aveTS; - _xTimingSum2.get(did)+=aveTS*aveTS; - _xEntries.get(did)++; - - for (int i=0; ibegin(); - it!=chf->end(); ++it) - { - const QIE10DataFrame digi = (const QIE10DataFrame)(*it); - HcalDetId did = digi.detid(); - if (did.subdet() != HcalForward) { - continue; - } - HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); - - CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); - double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples()-1); - //double sumQ = hcaldqm::utilities::sumQ_v10(digi, 2.5, 0, digi.samples()-1); - if (sumQ<_lowHF) - continue; - - //double aveTS = hcaldqm::utilities::aveTS_v10(digi, 2.5, 0, digi.samples()-1); - double aveTS = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.samples()-1); - - _xSignalSum.get(did)+=sumQ; - _xSignalSum2.get(did)+=sumQ*sumQ; - _xTimingSum.get(did)+=aveTS; - _xTimingSum2.get(did)+=aveTS*aveTS; - _xEntries.get(did)++; - - for (int i=0; i(_dbService, digi_fC, did, digi, i)); - } - _cADC_SubdetPM.fill(did, digi[i].adc()); - } - - // select based on local global - double digiTimingSOI = (aveTS - digi.presamples()) * 25.; - double deltaTiming = digiTimingSOI - laserMonTiming; - _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI); - _xTimingRefLMSum.get(did) += deltaTiming; - _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming; - if (_ptype==fLocal) - { - int currentEvent = e.eventAuxiliary().id().event(); - _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS); - _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ); - _cTimingDiffEvent_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming); - } - else - { - _cTimingvsLS_SubdetPM.fill(did, _currentLS, aveTS); - _cSignalvsLS_SubdetPM.fill(did, _currentLS, sumQ); - _cTimingvsBX_SubdetPM.fill(did, bx, aveTS); - _cSignalvsBX_SubdetPM.fill(did, bx, sumQ); - _cTimingDiffLS_SubdetPM.fill(did, _currentLS, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming); - } - } +/* virtual */ void LaserTask::_process(edm::Event const& e, edm::EventSetup const& es) { + edm::Handle chbhe; + edm::Handle cHE; + edm::Handle cho; + edm::Handle chf; + + if (!e.getByToken(_tokHBHE, chbhe)) + _logger.dqmthrow("Collection HBHEDigiCollection isn't available " + _tagHBHE.label() + " " + _tagHBHE.instance()); + if (!e.getByToken(_tokHE, cHE)) + _logger.dqmthrow("Collection QIE11DigiCollection isn't available " + _tagHE.label() + " " + _tagHE.instance()); + if (!e.getByToken(_tokHO, cho)) + _logger.dqmthrow("Collection HODigiCollection isn't available " + _tagHO.label() + " " + _tagHO.instance()); + if (!e.getByToken(_tokHF, chf)) + _logger.dqmthrow("Collection QIE10DigiCollection isn't available " + _tagHF.label() + " " + _tagHF.instance()); + + // int currentEvent = e.eventAuxiliary().id().event(); + int bx = e.bunchCrossing(); + + // LASERMON + edm::Handle cLaserMon; + if (!e.getByToken(_tokLaserMon, cLaserMon)) { + _logger.dqmthrow("QIE10DigiCollection for laserMonDigis isn't available."); + } + std::vector laserMonADC; + processLaserMon(cLaserMon, laserMonADC); + + // SumQ = peak +/- 3 TSes + // Timing = fC-weighted average (TS-TS0) * 25 ns, also in peak +/- 3 TSes + int peakTS = -1; + double peakLaserMonADC = -1; + for (unsigned int iTS = 0; iTS < laserMonADC.size(); ++iTS) { + if (laserMonADC[iTS] > peakLaserMonADC) { + peakLaserMonADC = laserMonADC[iTS]; + peakTS = iTS; + } + } + + double laserMonSumQ = 0; + double laserMonTiming = 0.; + + if (peakTS >= 0) { + int minTS = std::max(0, peakTS - 3); + int maxTS = std::min(int(laserMonADC.size() - 1), peakTS + 3); + for (int iTS = minTS; iTS <= maxTS; ++iTS) { + double this_fC = hcaldqm::constants::adc2fC[laserMonADC[iTS]]; + laserMonSumQ += this_fC; + laserMonTiming += 25. * (iTS - _laserMonTS0) * this_fC; + } + } + if (laserMonSumQ > 0.) { + laserMonTiming = laserMonTiming / laserMonSumQ; + } else { + ++_xMissingLaserMon; + } + + if (laserMonSumQ > _laserMonThreshold) { + _cLaserMonSumQ.fill(laserMonSumQ); + _cLaserMonTiming.fill(laserMonTiming); + if (_ptype == fOnline) { + _cLaserMonSumQ_LS.fill(_currentLS, laserMonSumQ); + _cLaserMonTiming_LS.fill(_currentLS, laserMonTiming); + } else if (_ptype == fLocal) { + int currentEvent = e.eventAuxiliary().id().event(); + _cLaserMonSumQ_Event.fill(currentEvent, laserMonSumQ); + _cLaserMonTiming_Event.fill(currentEvent, laserMonTiming); + } + } + + for (HBHEDigiCollection::const_iterator it = chbhe->begin(); it != chbhe->end(); ++it) { + const HBHEDataFrame digi = (const HBHEDataFrame)(*it); + double sumQ = hcaldqm::utilities::sumQ(digi, 2.5, 0, digi.size() - 1); + if (sumQ < _lowHBHE) + continue; + HcalDetId did = digi.id(); + HcalElectronicsId eid = digi.elecId(); + + double aveTS = hcaldqm::utilities::aveTS(digi, 2.5, 0, digi.size() - 1); + _xSignalSum.get(did) += sumQ; + _xSignalSum2.get(did) += sumQ * sumQ; + _xTimingSum.get(did) += aveTS; + _xTimingSum2.get(did) += aveTS * aveTS; + _xEntries.get(did)++; + + for (int i = 0; i < digi.size(); i++) { + if (_ptype == fLocal) { // hidefed2crate + _cShapeCut_FEDSlot.fill(eid, i, digi.sample(i).nominal_fC() - 2.5); + } + _cADC_SubdetPM.fill(did, digi.sample(i).adc()); + } + + // select based on local global + double digiTimingSOI = (aveTS - digi.presamples()) * 25.; + double deltaTiming = digiTimingSOI - laserMonTiming; + _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI); + _xTimingRefLMSum.get(did) += deltaTiming; + _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming; + if (_ptype == fLocal) { + int currentEvent = e.eventAuxiliary().id().event(); + _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS); + _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ); + _cTimingDiffLS_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming); + } else { + _cTimingvsLS_SubdetPM.fill(did, _currentLS, aveTS); + _cSignalvsLS_SubdetPM.fill(did, _currentLS, sumQ); + _cTimingvsBX_SubdetPM.fill(did, bx, aveTS); + _cSignalvsBX_SubdetPM.fill(did, bx, sumQ); + _cTimingDiffLS_SubdetPM.fill(did, _currentLS, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming); + } + } + for (QIE11DigiCollection::const_iterator it = cHE->begin(); it != cHE->end(); ++it) { + const QIE11DataFrame digi = static_cast(*it); + HcalDetId const& did = digi.detid(); + if (did.subdet() != HcalEndcap) { + continue; + } + uint32_t rawid = _ehashmap.lookup(did); + HcalElectronicsId const& eid(rawid); + + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); + //double sumQ = hcaldqm::utilities::sumQ_v10(digi, 2.5, 0, digi.samples()-1); + double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples() - 1); + if (sumQ < _lowHE) + continue; + + //double aveTS = hcaldqm::utilities::aveTS_v10(digi, 2.5, 0,digi.samples()-1); + double aveTS = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.samples() - 1); + _xSignalSum.get(did) += sumQ; + _xSignalSum2.get(did) += sumQ * sumQ; + _xTimingSum.get(did) += aveTS; + _xTimingSum2.get(did) += aveTS * aveTS; + _xEntries.get(did)++; + + for (int i = 0; i < digi.samples(); i++) { + if (_ptype == fLocal) { + _cShapeCut_FEDSlot.fill( + eid, i, hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, i)); + } + _cADC_SubdetPM.fill(did, digi[i].adc()); + } + + // select based on local global + double digiTimingSOI = (aveTS - digi.presamples()) * 25.; + double deltaTiming = digiTimingSOI - laserMonTiming; + _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI); + _xTimingRefLMSum.get(did) += deltaTiming; + _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming; + if (_ptype == fLocal) { + int currentEvent = e.eventAuxiliary().id().event(); + _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS); + _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ); + _cTimingDiffEvent_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming); + } else { + _cTimingvsLS_SubdetPM.fill(did, _currentLS, aveTS); + _cSignalvsLS_SubdetPM.fill(did, _currentLS, sumQ); + _cTimingvsBX_SubdetPM.fill(did, bx, aveTS); + _cSignalvsBX_SubdetPM.fill(did, bx, sumQ); + _cTimingDiffLS_SubdetPM.fill(did, _currentLS, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming); + } + } + for (HODigiCollection::const_iterator it = cho->begin(); it != cho->end(); ++it) { + const HODataFrame digi = (const HODataFrame)(*it); + double sumQ = hcaldqm::utilities::sumQ(digi, 8.5, 0, digi.size() - 1); + if (sumQ < _lowHO) + continue; + HcalDetId did = digi.id(); + HcalElectronicsId eid = digi.elecId(); + + double aveTS = hcaldqm::utilities::aveTS(digi, 8.5, 0, digi.size() - 1); + _xSignalSum.get(did) += sumQ; + _xSignalSum2.get(did) += sumQ * sumQ; + _xTimingSum.get(did) += aveTS; + _xTimingSum2.get(did) += aveTS * aveTS; + _xEntries.get(did)++; + + for (int i = 0; i < digi.size(); i++) { + if (_ptype == fLocal) { // hidefed2crate + _cShapeCut_FEDSlot.fill(eid, i, digi.sample(i).nominal_fC() - 8.5); + } + _cADC_SubdetPM.fill(did, digi.sample(i).adc()); + } + + // select based on local global + double digiTimingSOI = (aveTS - digi.presamples()) * 25.; + double deltaTiming = digiTimingSOI - laserMonTiming; + _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI); + _xTimingRefLMSum.get(did) += deltaTiming; + _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming; + if (_ptype == fLocal) { + int currentEvent = e.eventAuxiliary().id().event(); + _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS); + _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ); + _cTimingDiffEvent_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming); + } else { + _cTimingvsLS_SubdetPM.fill(did, _currentLS, aveTS); + _cSignalvsLS_SubdetPM.fill(did, _currentLS, sumQ); + _cTimingvsBX_SubdetPM.fill(did, bx, aveTS); + _cSignalvsBX_SubdetPM.fill(did, bx, sumQ); + _cTimingDiffLS_SubdetPM.fill(did, _currentLS, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming); + } + } + for (QIE10DigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) { + const QIE10DataFrame digi = (const QIE10DataFrame)(*it); + HcalDetId did = digi.detid(); + if (did.subdet() != HcalForward) { + continue; + } + HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); + + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, digi); + double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, digi, 0, digi.samples() - 1); + //double sumQ = hcaldqm::utilities::sumQ_v10(digi, 2.5, 0, digi.samples()-1); + if (sumQ < _lowHF) + continue; + + //double aveTS = hcaldqm::utilities::aveTS_v10(digi, 2.5, 0, digi.samples()-1); + double aveTS = hcaldqm::utilities::aveTSDB(_dbService, digi_fC, did, digi, 0, digi.samples() - 1); + + _xSignalSum.get(did) += sumQ; + _xSignalSum2.get(did) += sumQ * sumQ; + _xTimingSum.get(did) += aveTS; + _xTimingSum2.get(did) += aveTS * aveTS; + _xEntries.get(did)++; + + for (int i = 0; i < digi.samples(); i++) { + if (_ptype == fLocal) { // hidefed2crate + _cShapeCut_FEDSlot.fill( + eid, (int)i, hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, digi, i)); + } + _cADC_SubdetPM.fill(did, digi[i].adc()); + } + + // select based on local global + double digiTimingSOI = (aveTS - digi.presamples()) * 25.; + double deltaTiming = digiTimingSOI - laserMonTiming; + _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI); + _xTimingRefLMSum.get(did) += deltaTiming; + _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming; + if (_ptype == fLocal) { + int currentEvent = e.eventAuxiliary().id().event(); + _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS); + _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ); + _cTimingDiffEvent_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming); + } else { + _cTimingvsLS_SubdetPM.fill(did, _currentLS, aveTS); + _cSignalvsLS_SubdetPM.fill(did, _currentLS, sumQ); + _cTimingvsBX_SubdetPM.fill(did, bx, aveTS); + _cSignalvsBX_SubdetPM.fill(did, bx, sumQ); + _cTimingDiffLS_SubdetPM.fill(did, _currentLS, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming); + } + } } -void LaserTask::processLaserMon(edm::Handle &col, std::vector &iLaserMonADC) { - for (QIE10DigiCollection::const_iterator it=col->begin(); it!=col->end(); ++it) { - const QIE10DataFrame digi = (const QIE10DataFrame)(*it); - HcalCalibDetId hcdid(digi.id()); - - if ((hcdid.ieta() != _laserMonIEta) || (hcdid.cboxChannel() != _laserMonCBox)) { - continue; - } - - unsigned int digiIndex = std::find(_vLaserMonIPhi.begin(), _vLaserMonIPhi.end(), hcdid.iphi()) - _vLaserMonIPhi.begin(); - if (digiIndex == _vLaserMonIPhi.size()) { - continue; - } - - // First digi: initialize the vectors to -1 (need to know the length of the digi) - if (iLaserMonADC.empty()) { - int totalNSamples = (digi.samples() - _laserMonDigiOverlap) * _vLaserMonIPhi.size(); - for (int i = 0; i < totalNSamples; ++i) { - iLaserMonADC.push_back(-1); - } - } - - for (int subindex = 0; subindex < digi.samples() - _laserMonDigiOverlap; ++subindex) { - int totalIndex = (digi.samples() - _laserMonDigiOverlap) * digiIndex + subindex; - iLaserMonADC[totalIndex] = (digi[subindex].ok() ? digi[subindex].adc() : -1); - } - } +void LaserTask::processLaserMon(edm::Handle& col, std::vector& iLaserMonADC) { + for (QIE10DigiCollection::const_iterator it = col->begin(); it != col->end(); ++it) { + const QIE10DataFrame digi = (const QIE10DataFrame)(*it); + HcalCalibDetId hcdid(digi.id()); + + if ((hcdid.ieta() != _laserMonIEta) || (hcdid.cboxChannel() != _laserMonCBox)) { + continue; + } + + unsigned int digiIndex = + std::find(_vLaserMonIPhi.begin(), _vLaserMonIPhi.end(), hcdid.iphi()) - _vLaserMonIPhi.begin(); + if (digiIndex == _vLaserMonIPhi.size()) { + continue; + } + + // First digi: initialize the vectors to -1 (need to know the length of the digi) + if (iLaserMonADC.empty()) { + int totalNSamples = (digi.samples() - _laserMonDigiOverlap) * _vLaserMonIPhi.size(); + for (int i = 0; i < totalNSamples; ++i) { + iLaserMonADC.push_back(-1); + } + } + + for (int subindex = 0; subindex < digi.samples() - _laserMonDigiOverlap; ++subindex) { + int totalIndex = (digi.samples() - _laserMonDigiOverlap) * digiIndex + subindex; + iLaserMonADC[totalIndex] = (digi[subindex].ok() ? digi[subindex].adc() : -1); + } + } } -/* virtual */ void LaserTask::endLuminosityBlock(edm::LuminosityBlock const& lb, - edm::EventSetup const& es) -{ - if (_ptype==fLocal) - return; - this->_dump(); +/* virtual */ void LaserTask::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + if (_ptype == fLocal) + return; + this->_dump(); - DQTask::endLuminosityBlock(lb, es); + DQTask::endLuminosityBlock(lb, es); } -/* virtual */ bool LaserTask::_isApplicable(edm::Event const& e) -{ - if (_ptype!=fOnline) - return true; - else - { - // fOnline mode - edm::Handle cumn; - if (!e.getByToken(_tokuMN, cumn)) - return false; - - // event type check first - uint8_t eventType = cumn->eventType(); - if (eventType!=constants::EVENTTYPE_LASER) - return false; - - // check if this analysis task is of the right laser type - uint32_t laserType = cumn->valueUserWord(0); - if (laserType==_laserType) return true; - } - - return false; +/* virtual */ bool LaserTask::_isApplicable(edm::Event const& e) { + if (_ptype != fOnline) + return true; + else { + // fOnline mode + edm::Handle cumn; + if (!e.getByToken(_tokuMN, cumn)) + return false; + + // event type check first + uint8_t eventType = cumn->eventType(); + if (eventType != constants::EVENTTYPE_LASER) + return false; + + // check if this analysis task is of the right laser type + uint32_t laserType = cumn->valueUserWord(0); + if (laserType == _laserType) + return true; + } + + return false; } DEFINE_FWK_MODULE(LaserTask); diff --git a/DQM/HcalTasks/plugins/NoCQTask.cc b/DQM/HcalTasks/plugins/NoCQTask.cc index 3150c475467fa..34e43002a9b9b 100644 --- a/DQM/HcalTasks/plugins/NoCQTask.cc +++ b/DQM/HcalTasks/plugins/NoCQTask.cc @@ -3,159 +3,134 @@ using namespace hcaldqm; using namespace hcaldqm::constants; -NoCQTask::NoCQTask(edm::ParameterSet const& ps) : - DQTask(ps) -{ - _tagHBHE = ps.getUntrackedParameter("tagHBHE", - edm::InputTag("hcalDigis")); - _tagHO = ps.getUntrackedParameter("tagHO", - edm::InputTag("hcalDigis")); - _tagHF = ps.getUntrackedParameter("tagHF", - edm::InputTag("hcalDigis")); - _tagReport = ps.getUntrackedParameter("tagReport", - edm::InputTag("hcalDigis")); - - _tokHBHE = consumes(_tagHBHE); - _tokHO = consumes(_tagHO); - _tokHF = consumes(_tagHF); - _tokReport = consumes(_tagReport); - - _cutSumQ_HBHE = ps.getUntrackedParameter("cutSumQ_HBHE", 20); - _cutSumQ_HO = ps.getUntrackedParameter("cutSumQ_HO", 20); - _cutSumQ_HF = ps.getUntrackedParameter("cutSumQ_HF", 20); +NoCQTask::NoCQTask(edm::ParameterSet const& ps) : DQTask(ps) { + _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); + _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); + _tagHF = ps.getUntrackedParameter("tagHF", edm::InputTag("hcalDigis")); + _tagReport = ps.getUntrackedParameter("tagReport", edm::InputTag("hcalDigis")); + + _tokHBHE = consumes(_tagHBHE); + _tokHO = consumes(_tagHO); + _tokHF = consumes(_tagHF); + _tokReport = consumes(_tagReport); + + _cutSumQ_HBHE = ps.getUntrackedParameter("cutSumQ_HBHE", 20); + _cutSumQ_HO = ps.getUntrackedParameter("cutSumQ_HO", 20); + _cutSumQ_HF = ps.getUntrackedParameter("cutSumQ_HF", 20); } -/* virtual */ void NoCQTask::bookHistograms(DQMStore::IBooker& ib, - edm::Run const& r, edm::EventSetup const& es) -{ - DQTask::bookHistograms(ib, r, es); - - edm::ESHandle dbs; - es.get().get(dbs); - _emap = dbs->getHcalMapping(); - - _cTimingCut_depth.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),0); - _cOccupancy_depth.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCut_depth.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cBadQuality_depth.initialize(_name, "BadQuality", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - _cTimingCut_depth.book(ib, _emap, _subsystem); - _cOccupancy_depth.book(ib, _emap, _subsystem); - _cOccupancyCut_depth.book(ib, _emap, _subsystem); - _cBadQuality_depth.book(ib, _emap, _subsystem); +/* virtual */ void NoCQTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + DQTask::bookHistograms(ib, r, es); + + edm::ESHandle dbs; + es.get().get(dbs); + _emap = dbs->getHcalMapping(); + + _cTimingCut_depth.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200), + 0); + _cOccupancy_depth.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCut_depth.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cBadQuality_depth.initialize(_name, + "BadQuality", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cTimingCut_depth.book(ib, _emap, _subsystem); + _cOccupancy_depth.book(ib, _emap, _subsystem); + _cOccupancyCut_depth.book(ib, _emap, _subsystem); + _cBadQuality_depth.book(ib, _emap, _subsystem); } -/* virtual */ void NoCQTask::_resetMonitors(hcaldqm::UpdateFreq uf) -{ - DQTask::_resetMonitors(uf); +/* virtual */ void NoCQTask::_resetMonitors(hcaldqm::UpdateFreq uf) { DQTask::_resetMonitors(uf); } + +/* virtual */ void NoCQTask::_process(edm::Event const& e, edm::EventSetup const&) { + edm::Handle chbhe; + edm::Handle cho; + edm::Handle chf; + edm::Handle creport; + + if (!e.getByToken(_tokHBHE, chbhe)) + _logger.dqmthrow("Collection HBHEDigiCollection isn't available" + _tagHBHE.label() + " " + _tagHBHE.instance()); + if (!e.getByToken(_tokHO, cho)) + _logger.dqmthrow("Collection HODigiCollection isn't available" + _tagHO.label() + " " + _tagHO.instance()); + if (!e.getByToken(_tokHF, chf)) + _logger.dqmthrow("Collection HFDigiCollection isn't available" + _tagHF.label() + " " + _tagHF.instance()); + if (!e.getByToken(_tokReport, creport)) + _logger.dqmthrow("Collection HcalUnpackerReport isn't available" + _tagReport.label() + " " + + _tagReport.instance()); + + // RAW Bad Quality + for (std::vector::const_iterator it = creport->bad_quality_begin(); it != creport->bad_quality_end(); ++it) { + if (!HcalGenericDetId(*it).isHcalDetId()) + continue; + + _cBadQuality_depth.fill(HcalDetId(*it)); + } + + // DIGI HBH, HO, HF + for (HBHEDigiCollection::const_iterator it = chbhe->begin(); it != chbhe->end(); ++it) { + double sumQ = hcaldqm::utilities::sumQ(*it, 2.5, 0, it->size() - 1); + HcalDetId const& did = it->id(); + + _cOccupancy_depth.fill(did); + if (sumQ > _cutSumQ_HBHE) { + double timing = hcaldqm::utilities::aveTS(*it, 2.5, 0, it->size() - 1); + _cOccupancyCut_depth.fill(did); + _cTimingCut_depth.fill(did, timing); + } + } + + for (HODigiCollection::const_iterator it = cho->begin(); it != cho->end(); ++it) { + double sumQ = hcaldqm::utilities::sumQ(*it, 8.5, 0, it->size() - 1); + HcalDetId const& did = it->id(); + + _cOccupancy_depth.fill(did); + if (sumQ > _cutSumQ_HO) { + double timing = hcaldqm::utilities::aveTS(*it, 8.5, 0, it->size() - 1); + _cOccupancyCut_depth.fill(did); + _cTimingCut_depth.fill(did, timing); + } + } + + for (HFDigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) { + double sumQ = hcaldqm::utilities::sumQ(*it, 2.5, 0, it->size() - 1); + HcalDetId const& did = it->id(); + + _cOccupancy_depth.fill(did); + if (sumQ > _cutSumQ_HF) { + double timing = hcaldqm::utilities::aveTS(*it, 2.5, 0, it->size() - 1); + _cOccupancyCut_depth.fill(did); + _cTimingCut_depth.fill(did, timing); + } + } } -/* virtual */ void NoCQTask::_process(edm::Event const& e, - edm::EventSetup const&) -{ - edm::Handle chbhe; - edm::Handle cho; - edm::Handle chf; - edm::Handle creport; - - if (!e.getByToken(_tokHBHE, chbhe)) - _logger.dqmthrow("Collection HBHEDigiCollection isn't available" - + _tagHBHE.label() + " " + _tagHBHE.instance()); - if (!e.getByToken(_tokHO, cho)) - _logger.dqmthrow("Collection HODigiCollection isn't available" - + _tagHO.label() + " " + _tagHO.instance()); - if (!e.getByToken(_tokHF, chf)) - _logger.dqmthrow("Collection HFDigiCollection isn't available" - + _tagHF.label() + " " + _tagHF.instance()); - if (!e.getByToken(_tokReport, creport)) - _logger.dqmthrow("Collection HcalUnpackerReport isn't available"+ - _tagReport.label()+" " +_tagReport.instance()); - - // RAW Bad Quality - for (std::vector::const_iterator it=creport->bad_quality_begin(); - it!=creport->bad_quality_end(); ++it) - { - if (!HcalGenericDetId(*it).isHcalDetId()) - continue; - - _cBadQuality_depth.fill(HcalDetId(*it)); - } - - // DIGI HBH, HO, HF - for (HBHEDigiCollection::const_iterator it=chbhe->begin(); it!=chbhe->end(); - ++it) - { - double sumQ = hcaldqm::utilities::sumQ(*it, 2.5, 0, it->size()-1); - HcalDetId const& did = it->id(); - - _cOccupancy_depth.fill(did); - if (sumQ>_cutSumQ_HBHE) - { - double timing = hcaldqm::utilities::aveTS(*it, 2.5, 0, - it->size()-1); - _cOccupancyCut_depth.fill(did); - _cTimingCut_depth.fill(did, timing); - } - } - - for (HODigiCollection::const_iterator it=cho->begin(); it!=cho->end(); - ++it) - { - double sumQ = hcaldqm::utilities::sumQ(*it, 8.5, 0, it->size()-1); - HcalDetId const& did = it->id(); - - _cOccupancy_depth.fill(did); - if (sumQ>_cutSumQ_HO) - { - double timing = hcaldqm::utilities::aveTS(*it, 8.5, 0, - it->size()-1); - _cOccupancyCut_depth.fill(did); - _cTimingCut_depth.fill(did, timing); - } - } - - for (HFDigiCollection::const_iterator it=chf->begin(); it!=chf->end(); - ++it) - { - double sumQ = hcaldqm::utilities::sumQ(*it, 2.5, 0, it->size()-1); - HcalDetId const& did = it->id(); - - _cOccupancy_depth.fill(did); - if (sumQ>_cutSumQ_HF) - { - double timing = hcaldqm::utilities::aveTS(*it, 2.5, 0, it->size()-1); - _cOccupancyCut_depth.fill(did); - _cTimingCut_depth.fill(did, timing); - } - } +/* virtual */ void NoCQTask::beginLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + DQTask::beginLuminosityBlock(lb, es); } -/* virtual */ void NoCQTask::beginLuminosityBlock( - edm::LuminosityBlock const& lb, edm::EventSetup const& es) -{ - DQTask::beginLuminosityBlock(lb, es); -} - -/* virtual */ void NoCQTask::endLuminosityBlock(edm::LuminosityBlock const& - lb, edm::EventSetup const& es) -{ - DQTask::endLuminosityBlock(lb, es); +/* virtual */ void NoCQTask::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + DQTask::endLuminosityBlock(lb, es); } DEFINE_FWK_MODULE(NoCQTask); diff --git a/DQM/HcalTasks/plugins/PedestalTask.cc b/DQM/HcalTasks/plugins/PedestalTask.cc index aedff21b0adc3..f12599f40a7c0 100644 --- a/DQM/HcalTasks/plugins/PedestalTask.cc +++ b/DQM/HcalTasks/plugins/PedestalTask.cc @@ -3,996 +3,1073 @@ using namespace hcaldqm; using namespace hcaldqm::constants; -PedestalTask::PedestalTask(edm::ParameterSet const& ps): - DQTask(ps) -{ - // tags - _tagHBHE = ps.getUntrackedParameter("tagHBHE", - edm::InputTag("hcalDigis")); - _tagHE = ps.getUntrackedParameter("tagHE", - edm::InputTag("hcalDigis")); - _tagHO = ps.getUntrackedParameter("tagHO", - edm::InputTag("hcalDigis")); - _tagHF = ps.getUntrackedParameter("tagHF", - edm::InputTag("hcalDigis")); - _tagTrigger = ps.getUntrackedParameter("tagTrigger", - edm::InputTag("tbunpacker")); - _taguMN = ps.getUntrackedParameter("taguMN", - edm::InputTag("hcalDigis")); - _tokHBHE = consumes(_tagHBHE); - _tokHEP17 = consumes(_tagHE); - _tokHO = consumes(_tagHO); - _tokHF = consumes(_tagHF); - _tokTrigger = consumes(_tagTrigger); - _tokuMN = consumes(_taguMN); - - _vflags.resize(2); - _vflags[fMsn]=hcaldqm::flag::Flag("Msn"); - _vflags[fBadM]=hcaldqm::flag::Flag("BadM"); - //_vflags[fBadR]=hcaldqm::flag::Flag("BadR"); - - _thresh_mean = ps.getUntrackedParameter("thresh_mean", - 0.25); - _thresh_rms = ps.getUntrackedParameter("thresh_mean", - 0.25); - _thresh_badm = ps.getUntrackedParameter("thresh_badm", 0.1); - _thresh_badr = ps.getUntrackedParameter("thresh_badr", 0.1); - _thresh_missing_high = ps.getUntrackedParameter( - "thresh_missing_high", 0.2); - _thresh_missing_low = ps.getUntrackedParameter( - "thresh_missing_low", 0.05); +PedestalTask::PedestalTask(edm::ParameterSet const& ps) : DQTask(ps) { + // tags + _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hcalDigis")); + _tagHE = ps.getUntrackedParameter("tagHE", edm::InputTag("hcalDigis")); + _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); + _tagHF = ps.getUntrackedParameter("tagHF", edm::InputTag("hcalDigis")); + _tagTrigger = ps.getUntrackedParameter("tagTrigger", edm::InputTag("tbunpacker")); + _taguMN = ps.getUntrackedParameter("taguMN", edm::InputTag("hcalDigis")); + _tokHBHE = consumes(_tagHBHE); + _tokHEP17 = consumes(_tagHE); + _tokHO = consumes(_tagHO); + _tokHF = consumes(_tagHF); + _tokTrigger = consumes(_tagTrigger); + _tokuMN = consumes(_taguMN); + + _vflags.resize(2); + _vflags[fMsn] = hcaldqm::flag::Flag("Msn"); + _vflags[fBadM] = hcaldqm::flag::Flag("BadM"); + //_vflags[fBadR]=hcaldqm::flag::Flag("BadR"); + + _thresh_mean = ps.getUntrackedParameter("thresh_mean", 0.25); + _thresh_rms = ps.getUntrackedParameter("thresh_mean", 0.25); + _thresh_badm = ps.getUntrackedParameter("thresh_badm", 0.1); + _thresh_badr = ps.getUntrackedParameter("thresh_badr", 0.1); + _thresh_missing_high = ps.getUntrackedParameter("thresh_missing_high", 0.2); + _thresh_missing_low = ps.getUntrackedParameter("thresh_missing_low", 0.05); } -/* virtual */ void PedestalTask::bookHistograms(DQMStore::IBooker &ib, - edm::Run const& r, edm::EventSetup const& es) -{ - if (_ptype==fLocal) - if (r.runAuxiliary().run()==1) - return; - DQTask::bookHistograms(ib, r, es); - - edm::ESHandle dbs; - es.get().get(dbs); - _emap = dbs->getHcalMapping(); - std::vector vhashVME; - std::vector vhashuTCA; - std::vector vhashC38; - vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); - vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vhashC38.push_back(HcalElectronicsId(38, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vhashVME); - _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vhashuTCA); - _filter_C38.initialize(filter::fFilter, hcaldqm::hashfunctions::fCrate, - vhashC38); - - // Containers XXX - _xPedSum1LS.initialize(hcaldqm::hashfunctions::fDChannel); - _xPedSum21LS.initialize(hcaldqm::hashfunctions::fDChannel); - _xPedEntries1LS.initialize(hcaldqm::hashfunctions::fDChannel); - _xPedSumTotal.initialize(hcaldqm::hashfunctions::fDChannel); - _xPedSum2Total.initialize(hcaldqm::hashfunctions::fDChannel); - _xPedEntriesTotal.initialize(hcaldqm::hashfunctions::fDChannel); +/* virtual */ void PedestalTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + if (_ptype == fLocal) + if (r.runAuxiliary().run() == 1) + return; + DQTask::bookHistograms(ib, r, es); + + edm::ESHandle dbs; + es.get().get(dbs); + _emap = dbs->getHcalMapping(); + std::vector vhashVME; + std::vector vhashuTCA; + std::vector vhashC38; + vhashVME.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); + vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vhashC38.push_back(HcalElectronicsId(38, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vhashVME); + _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vhashuTCA); + _filter_C38.initialize(filter::fFilter, hcaldqm::hashfunctions::fCrate, vhashC38); + + // Containers XXX + _xPedSum1LS.initialize(hcaldqm::hashfunctions::fDChannel); + _xPedSum21LS.initialize(hcaldqm::hashfunctions::fDChannel); + _xPedEntries1LS.initialize(hcaldqm::hashfunctions::fDChannel); + _xPedSumTotal.initialize(hcaldqm::hashfunctions::fDChannel); + _xPedSum2Total.initialize(hcaldqm::hashfunctions::fDChannel); + _xPedEntriesTotal.initialize(hcaldqm::hashfunctions::fDChannel); #ifndef HIDE_PEDESTAL_CONDITIONS - _xPedRefMean.initialize(hcaldqm::hashfunctions::fDChannel); - _xPedRefRMS.initialize(hcaldqm::hashfunctions::fDChannel); + _xPedRefMean.initialize(hcaldqm::hashfunctions::fDChannel); + _xPedRefRMS.initialize(hcaldqm::hashfunctions::fDChannel); #endif - - // Containers - _cMean1LS_Subdet.initialize(_name, "Mean1LS",hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cRMS1LS_Subdet.initialize(_name, "RMS1LS", hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cMean1LS_depth.initialize(_name, "Mean1LS", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15),0); - _cRMS1LS_depth.initialize(_name, "RMS1LS", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5),0); - if (_ptype != fOffline) { // hidefed2crate - _cMean1LS_FEDVME.initialize(_name, "Mean1LS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15),0); - _cMean1LS_FEDuTCA.initialize(_name, "Mean1LS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15),0); - _cRMS1LS_FEDVME.initialize(_name, "RMS1LS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5),0); - _cRMS1LS_FEDuTCA.initialize(_name, "RMS1LS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5),0); - } - - _cMeanTotal_Subdet.initialize(_name, "Mean",hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cRMSTotal_Subdet.initialize(_name, "RMS", hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cMeanTotal_depth.initialize(_name, "Mean", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15),0); - _cRMSTotal_depth.initialize(_name, "RMS", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15),0); - - _cMeanDBRef1LS_Subdet.initialize(_name, "MeanDBRef1LS", hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cRMSDBRef1LS_Subdet.initialize(_name, "RMSDBRef1LS", hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cMeanDBRef1LS_depth.initialize(_name, "MeanDBRef1LS", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero),0); - _cRMSDBRef1LS_depth.initialize(_name, "RMSDBRef1LS", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero),0); - - _cMeanDBRefTotal_Subdet.initialize(_name, "MeanDBRef", hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cRMSDBRefTotal_Subdet.initialize(_name, "RMSDBRef", hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cMeanDBRefTotal_depth.initialize(_name, "MeanDBRef", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero),0); - _cRMSDBRefTotal_depth.initialize(_name, "RMSDBRef", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero),0); - - _cMissingvsLS_Subdet.initialize(_name, "MissingvsLS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyvsLS_Subdet.initialize(_name, "OccupancyvsLS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyEAvsLS_Subdet.initialize(_name, "OccupancyEAvsLS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),0); - _cNBadMeanvsLS_Subdet.initialize(_name, "NBadMeanvsLS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cNBadRMSvsLS_Subdet.initialize(_name, "NBadRMSvsLS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - _cMissing1LS_depth.initialize(_name, "Missing1LS", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMeanBad1LS_depth.initialize(_name, "MeanBad1LS", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cRMSBad1LS_depth.initialize(_name, "RMSBad1LS", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - _cMissingTotal_depth.initialize(_name, "Missing", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMeanBadTotal_depth.initialize(_name, "MeanBad", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cRMSBadTotal_depth.initialize(_name, "RMSBad", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - _cADC_SubdetPM.initialize(_name, "ADC", hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - - if (_ptype != fOffline) { // hidefed2crate - std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); - std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); - std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); - for (std::vector::const_iterator it=vFEDsVME.begin(); - it!=vFEDsVME.end(); ++it) - _vhashFEDs.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - FIBER_VME_MIN, SPIGOT_MIN, (*it)-FED_VME_MIN).rawId()); - for (std::vector::const_iterator it=vFEDsuTCA.begin(); - it!=vFEDsuTCA.end(); ++it) - { - std::pair cspair = utilities::fed2crate(*it); - _vhashFEDs.push_back(HcalElectronicsId( - cspair.first, cspair.second, FIBER_uTCA_MIN1, - FIBERCH_MIN, false).rawId()); - } - _xNChs.initialize(hcaldqm::hashfunctions::fFED); - _xNMsn1LS.initialize(hcaldqm::hashfunctions::fFED); - _xNBadMean1LS.initialize(hcaldqm::hashfunctions::fFED); - _xNBadRMS1LS.initialize(hcaldqm::hashfunctions::fFED); - _cMeanTotal_FEDVME.initialize(_name, "Mean", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15),0); - _cMeanTotal_FEDuTCA.initialize(_name, "Mean", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15),0); - _cRMSTotal_FEDVME.initialize(_name, "RMS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5),0); - _cRMSTotal_FEDuTCA.initialize(_name, "RMS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5),0); - _cMeanDBRef1LS_FEDVME.initialize(_name, "MeanDBRef1LS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5),0); - _cMeanDBRef1LS_FEDuTCA.initialize(_name, "MeanDBRef1LS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5),0); - _cRMSDBRef1LS_FEDVME.initialize(_name, "RMSDBRef1LS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5),0); - _cRMSDBRef1LS_FEDuTCA.initialize(_name, "RMSDBRef1LS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5),0); - _cMeanDBRefTotal_FEDVME.initialize(_name, "MeanDBRef", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5),0); - _cMeanDBRefTotal_FEDuTCA.initialize(_name, "MeanDBRef", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5),0); - _cRMSDBRefTotal_FEDVME.initialize(_name, "RMSDBRef", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5),0); - _cRMSDBRefTotal_FEDuTCA.initialize(_name, "RMSDBRef", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5),0); - _cMissing1LS_FEDVME.initialize(_name, "Missing1LS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMissing1LS_FEDuTCA.initialize(_name, "Missing1LS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMeanBad1LS_FEDVME.initialize(_name, "MeanBad1LS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMeanBad1LS_FEDuTCA.initialize(_name, "MeanBad1LS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cRMSBad1LS_FEDVME.initialize(_name, "RMSBad1LS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cRMSBad1LS_FEDuTCA.initialize(_name, "RMSBad1LS", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMissingTotal_FEDVME.initialize(_name, "Missing", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMissingTotal_FEDuTCA.initialize(_name, "Missing", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMeanBadTotal_FEDVME.initialize(_name, "MeanBad", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMeanBadTotal_FEDuTCA.initialize(_name, "MeanBad", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cRMSBadTotal_FEDVME.initialize(_name, "RMSBad", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cRMSBadTotal_FEDuTCA.initialize(_name, "RMSBad", hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cSummaryvsLS_FED.initialize(_name, "SummaryvsLS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::FlagQuantity(_vflags), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),0); - _cSummaryvsLS.initialize(_name, "SummaryvsLS", - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::FEDQuantity(vFEDs), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),0); - } - - // book plots - _cADC_SubdetPM.book(ib, _emap, _subsystem); - _cMean1LS_Subdet.book(ib, _emap, _subsystem); - _cRMS1LS_Subdet.book(ib, _emap, _subsystem); - _cMean1LS_depth.book(ib, _emap, _subsystem); - _cRMS1LS_depth.book(ib, _emap, _subsystem); - _cMeanDBRef1LS_Subdet.book(ib, _emap, _subsystem); - _cRMSDBRef1LS_Subdet.book(ib, _emap, _subsystem); - _cMeanDBRef1LS_depth.book(ib, _emap, _subsystem); - _cRMSDBRef1LS_depth.book(ib, _emap, _subsystem); - _cMissing1LS_depth.book(ib, _emap, _subsystem); - _cMeanBad1LS_depth.book(ib, _emap, _subsystem); - _cRMSBad1LS_depth.book(ib, _emap, _subsystem); - - _cMeanTotal_Subdet.book(ib, _emap, _subsystem); - _cRMSTotal_Subdet.book(ib, _emap, _subsystem); - _cMeanTotal_depth.book(ib, _emap, _subsystem); - _cRMSTotal_depth.book(ib, _emap, _subsystem); - _cMeanDBRefTotal_Subdet.book(ib, _emap, _subsystem); - _cRMSDBRefTotal_Subdet.book(ib, _emap, _subsystem); - _cMeanDBRefTotal_depth.book(ib, _emap, _subsystem); - _cRMSDBRefTotal_depth.book(ib, _emap, _subsystem); - _cMissingTotal_depth.book(ib, _emap, _subsystem); - _cMeanBadTotal_depth.book(ib, _emap, _subsystem); - _cRMSBadTotal_depth.book(ib, _emap, _subsystem); - - if (_ptype != fOffline) { // hidefed2crate - _cMean1LS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cMean1LS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cRMS1LS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cRMS1LS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cMeanDBRef1LS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cMeanDBRef1LS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cRMSDBRef1LS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cRMSDBRef1LS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cMissing1LS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cMissing1LS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cRMSBad1LS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cRMSBad1LS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cMeanBad1LS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cMeanBad1LS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - - _cMeanTotal_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cMeanTotal_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cRMSTotal_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cRMSTotal_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cMeanDBRefTotal_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cMeanDBRefTotal_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cRMSDBRefTotal_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cRMSDBRefTotal_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cMissingTotal_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cMissingTotal_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cRMSBadTotal_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cRMSBadTotal_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cMeanBadTotal_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cMeanBadTotal_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - } - - _cMissingvsLS_Subdet.book(ib, _emap, _subsystem); - _cOccupancyvsLS_Subdet.book(ib, _emap, _subsystem); - _cOccupancyEAvsLS_Subdet.book(ib, _emap, _subsystem); - _cNBadMeanvsLS_Subdet.book(ib, _emap, _subsystem); - _cNBadRMSvsLS_Subdet.book(ib, _emap, _subsystem); - if (_ptype != fOffline) { // hidefed2crate - _cSummaryvsLS_FED.book(ib, _emap, _subsystem); - _cSummaryvsLS.book(ib, _subsystem); - } - - // book compact containers - _xPedSum1LS.book(_emap); - _xPedSum21LS.book(_emap); - _xPedEntries1LS.book(_emap); - _xPedSumTotal.book(_emap); - _xPedSum2Total.book(_emap); - _xPedEntriesTotal.book(_emap); + // Containers + _cMean1LS_Subdet.initialize(_name, + "Mean1LS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cRMS1LS_Subdet.initialize(_name, + "RMS1LS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cMean1LS_depth.initialize(_name, + "Mean1LS", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15), + 0); + _cRMS1LS_depth.initialize(_name, + "RMS1LS", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), + 0); + if (_ptype != fOffline) { // hidefed2crate + _cMean1LS_FEDVME.initialize(_name, + "Mean1LS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15), + 0); + _cMean1LS_FEDuTCA.initialize(_name, + "Mean1LS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15), + 0); + _cRMS1LS_FEDVME.initialize(_name, + "RMS1LS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), + 0); + _cRMS1LS_FEDuTCA.initialize(_name, + "RMS1LS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), + 0); + } + + _cMeanTotal_Subdet.initialize(_name, + "Mean", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cRMSTotal_Subdet.initialize(_name, + "RMS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cMeanTotal_depth.initialize(_name, + "Mean", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15), + 0); + _cRMSTotal_depth.initialize(_name, + "RMS", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15), + 0); + + _cMeanDBRef1LS_Subdet.initialize(_name, + "MeanDBRef1LS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cRMSDBRef1LS_Subdet.initialize(_name, + "RMSDBRef1LS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cMeanDBRef1LS_depth.initialize(_name, + "MeanDBRef1LS", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero), + 0); + _cRMSDBRef1LS_depth.initialize(_name, + "RMSDBRef1LS", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero), + 0); + + _cMeanDBRefTotal_Subdet.initialize(_name, + "MeanDBRef", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cRMSDBRefTotal_Subdet.initialize(_name, + "RMSDBRef", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cMeanDBRefTotal_depth.initialize(_name, + "MeanDBRef", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero), + 0); + _cRMSDBRefTotal_depth.initialize(_name, + "RMSDBRef", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fAroundZero), + 0); + + _cMissingvsLS_Subdet.initialize(_name, + "MissingvsLS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyvsLS_Subdet.initialize(_name, + "OccupancyvsLS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyEAvsLS_Subdet.initialize(_name, + "OccupancyEAvsLS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000), + 0); + _cNBadMeanvsLS_Subdet.initialize(_name, + "NBadMeanvsLS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cNBadRMSvsLS_Subdet.initialize(_name, + "NBadRMSvsLS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cMissing1LS_depth.initialize(_name, + "Missing1LS", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMeanBad1LS_depth.initialize(_name, + "MeanBad1LS", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cRMSBad1LS_depth.initialize(_name, + "RMSBad1LS", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cMissingTotal_depth.initialize(_name, + "Missing", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMeanBadTotal_depth.initialize(_name, + "MeanBad", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cRMSBadTotal_depth.initialize(_name, + "RMSBad", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cADC_SubdetPM.initialize(_name, + "ADC", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + + if (_ptype != fOffline) { // hidefed2crate + std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); + std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); + std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); + for (std::vector::const_iterator it = vFEDsVME.begin(); it != vFEDsVME.end(); ++it) + _vhashFEDs.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, (*it) - FED_VME_MIN).rawId()); + for (std::vector::const_iterator it = vFEDsuTCA.begin(); it != vFEDsuTCA.end(); ++it) { + std::pair cspair = utilities::fed2crate(*it); + _vhashFEDs.push_back(HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + } + _xNChs.initialize(hcaldqm::hashfunctions::fFED); + _xNMsn1LS.initialize(hcaldqm::hashfunctions::fFED); + _xNBadMean1LS.initialize(hcaldqm::hashfunctions::fFED); + _xNBadRMS1LS.initialize(hcaldqm::hashfunctions::fFED); + _cMeanTotal_FEDVME.initialize(_name, + "Mean", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15), + 0); + _cMeanTotal_FEDuTCA.initialize(_name, + "Mean", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_15), + 0); + _cRMSTotal_FEDVME.initialize(_name, + "RMS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), + 0); + _cRMSTotal_FEDuTCA.initialize(_name, + "RMS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), + 0); + _cMeanDBRef1LS_FEDVME.initialize(_name, + "MeanDBRef1LS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), + 0); + _cMeanDBRef1LS_FEDuTCA.initialize(_name, + "MeanDBRef1LS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), + 0); + _cRMSDBRef1LS_FEDVME.initialize(_name, + "RMSDBRef1LS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), + 0); + _cRMSDBRef1LS_FEDuTCA.initialize(_name, + "RMSDBRef1LS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), + 0); + _cMeanDBRefTotal_FEDVME.initialize(_name, + "MeanDBRef", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), + 0); + _cMeanDBRefTotal_FEDuTCA.initialize( + _name, + "MeanDBRef", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), + 0); + _cRMSDBRefTotal_FEDVME.initialize(_name, + "RMSDBRef", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), + 0); + _cRMSDBRefTotal_FEDuTCA.initialize(_name, + "RMSDBRef", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_5), + 0); + _cMissing1LS_FEDVME.initialize(_name, + "Missing1LS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMissing1LS_FEDuTCA.initialize(_name, + "Missing1LS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMeanBad1LS_FEDVME.initialize(_name, + "MeanBad1LS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMeanBad1LS_FEDuTCA.initialize(_name, + "MeanBad1LS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cRMSBad1LS_FEDVME.initialize(_name, + "RMSBad1LS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cRMSBad1LS_FEDuTCA.initialize(_name, + "RMSBad1LS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMissingTotal_FEDVME.initialize(_name, + "Missing", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMissingTotal_FEDuTCA.initialize(_name, + "Missing", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMeanBadTotal_FEDVME.initialize(_name, + "MeanBad", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMeanBadTotal_FEDuTCA.initialize(_name, + "MeanBad", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cRMSBadTotal_FEDVME.initialize(_name, + "RMSBad", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cRMSBadTotal_FEDuTCA.initialize(_name, + "RMSBad", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cSummaryvsLS_FED.initialize(_name, + "SummaryvsLS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::FlagQuantity(_vflags), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState), + 0); + _cSummaryvsLS.initialize(_name, + "SummaryvsLS", + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::FEDQuantity(vFEDs), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState), + 0); + } + + // book plots + _cADC_SubdetPM.book(ib, _emap, _subsystem); + _cMean1LS_Subdet.book(ib, _emap, _subsystem); + _cRMS1LS_Subdet.book(ib, _emap, _subsystem); + _cMean1LS_depth.book(ib, _emap, _subsystem); + _cRMS1LS_depth.book(ib, _emap, _subsystem); + _cMeanDBRef1LS_Subdet.book(ib, _emap, _subsystem); + _cRMSDBRef1LS_Subdet.book(ib, _emap, _subsystem); + _cMeanDBRef1LS_depth.book(ib, _emap, _subsystem); + _cRMSDBRef1LS_depth.book(ib, _emap, _subsystem); + _cMissing1LS_depth.book(ib, _emap, _subsystem); + _cMeanBad1LS_depth.book(ib, _emap, _subsystem); + _cRMSBad1LS_depth.book(ib, _emap, _subsystem); + + _cMeanTotal_Subdet.book(ib, _emap, _subsystem); + _cRMSTotal_Subdet.book(ib, _emap, _subsystem); + _cMeanTotal_depth.book(ib, _emap, _subsystem); + _cRMSTotal_depth.book(ib, _emap, _subsystem); + _cMeanDBRefTotal_Subdet.book(ib, _emap, _subsystem); + _cRMSDBRefTotal_Subdet.book(ib, _emap, _subsystem); + _cMeanDBRefTotal_depth.book(ib, _emap, _subsystem); + _cRMSDBRefTotal_depth.book(ib, _emap, _subsystem); + _cMissingTotal_depth.book(ib, _emap, _subsystem); + _cMeanBadTotal_depth.book(ib, _emap, _subsystem); + _cRMSBadTotal_depth.book(ib, _emap, _subsystem); + + if (_ptype != fOffline) { // hidefed2crate + _cMean1LS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMean1LS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cRMS1LS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cRMS1LS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cMeanDBRef1LS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMeanDBRef1LS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cRMSDBRef1LS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cRMSDBRef1LS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cMissing1LS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMissing1LS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cRMSBad1LS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cRMSBad1LS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cMeanBad1LS_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMeanBad1LS_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + + _cMeanTotal_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMeanTotal_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cRMSTotal_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cRMSTotal_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cMeanDBRefTotal_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMeanDBRefTotal_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cRMSDBRefTotal_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cRMSDBRefTotal_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cMissingTotal_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMissingTotal_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cRMSBadTotal_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cRMSBadTotal_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cMeanBadTotal_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMeanBadTotal_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + } + + _cMissingvsLS_Subdet.book(ib, _emap, _subsystem); + _cOccupancyvsLS_Subdet.book(ib, _emap, _subsystem); + _cOccupancyEAvsLS_Subdet.book(ib, _emap, _subsystem); + _cNBadMeanvsLS_Subdet.book(ib, _emap, _subsystem); + _cNBadRMSvsLS_Subdet.book(ib, _emap, _subsystem); + if (_ptype != fOffline) { // hidefed2crate + _cSummaryvsLS_FED.book(ib, _emap, _subsystem); + _cSummaryvsLS.book(ib, _subsystem); + } + + // book compact containers + _xPedSum1LS.book(_emap); + _xPedSum21LS.book(_emap); + _xPedEntries1LS.book(_emap); + _xPedSumTotal.book(_emap); + _xPedSum2Total.book(_emap); + _xPedEntriesTotal.book(_emap); #ifndef HIDE_PEDESTAL_CONDITIONS - _xPedRefMean.book(_emap); - _xPedRefRMS.book(_emap); + _xPedRefMean.book(_emap); + _xPedRefRMS.book(_emap); #endif - if (_ptype != fOffline) { // hidefed2crate - _xNChs.book(_emap); - _xNMsn1LS.book(_emap); - _xNBadMean1LS.book(_emap); - _xNBadRMS1LS.book(_emap); - } - - _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); - - // load conditions pedestals - std::vector dids = _emap->allPrecisionId(); - for (std::vector::const_iterator it=dids.begin(); - it!=dids.end(); ++it) - { - // skip if calib or whatever - if (!it->isHcalDetId()) - continue; - // skip Crate 38 - if (_filter_C38.filter(HcalElectronicsId(_ehashmap.lookup(*it)))) - continue; + if (_ptype != fOffline) { // hidefed2crate + _xNChs.book(_emap); + _xNMsn1LS.book(_emap); + _xNBadMean1LS.book(_emap); + _xNBadRMS1LS.book(_emap); + } + + _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); + + // load conditions pedestals + std::vector dids = _emap->allPrecisionId(); + for (std::vector::const_iterator it = dids.begin(); it != dids.end(); ++it) { + // skip if calib or whatever + if (!it->isHcalDetId()) + continue; + // skip Crate 38 + if (_filter_C38.filter(HcalElectronicsId(_ehashmap.lookup(*it)))) + continue; #ifndef HIDE_PEDESTAL_CONDITIONS - HcalDetId did = HcalDetId(it->rawId()); - - HcalPedestal const* peds = dbs->getPedestal(did); - float const *means = peds->getValues(); - float const *rmss = peds->getWidths(); - double msum=0; double rsum=0; - for (uint32_t i=0; i<4; i++) - {msum+=means[i]; rsum+=rmss[i];} - msum/=4; rsum/=4; - _xPedRefMean.set(did, msum); - _xPedRefRMS.set(did, rsum); + HcalDetId did = HcalDetId(it->rawId()); + + HcalPedestal const* peds = dbs->getPedestal(did); + float const* means = peds->getValues(); + float const* rmss = peds->getWidths(); + double msum = 0; + double rsum = 0; + for (uint32_t i = 0; i < 4; i++) { + msum += means[i]; + rsum += rmss[i]; + } + msum /= 4; + rsum /= 4; + _xPedRefMean.set(did, msum); + _xPedRefRMS.set(did, rsum); #endif - } + } } -/* virtual */ void PedestalTask::_resetMonitors(hcaldqm::UpdateFreq uf) -{ - DQTask::_resetMonitors(uf); - - switch(uf) - { - case hcaldqm::f50LS: - _cADC_SubdetPM.reset(); - break; - default: - break; - } +/* virtual */ void PedestalTask::_resetMonitors(hcaldqm::UpdateFreq uf) { + DQTask::_resetMonitors(uf); + + switch (uf) { + case hcaldqm::f50LS: + _cADC_SubdetPM.reset(); + break; + default: + break; + } } -/* virtual */ void PedestalTask::_dump() -{ - // reset what's needed - - // Mean/RMS actual values - _cMean1LS_Subdet.reset(); - _cRMS1LS_Subdet.reset(); - _cMean1LS_depth.reset(); - _cRMS1LS_depth.reset(); - if (_ptype != fOffline) { // hidefed2crate - _cMean1LS_FEDVME.reset(); - _cMean1LS_FEDuTCA.reset(); - _cRMS1LS_FEDVME.reset(); - _cRMS1LS_FEDuTCA.reset(); - } - - _cMeanTotal_Subdet.reset(); - _cRMSTotal_Subdet.reset(); - _cMeanTotal_depth.reset(); - _cRMSTotal_depth.reset(); - if (_ptype != fOffline) { // hidefed2crate - _cMeanTotal_FEDVME.reset(); - _cMeanTotal_FEDuTCA.reset(); - _cRMSTotal_FEDVME.reset(); - _cRMSTotal_FEDuTCA.reset(); - } - - - // DB Conditions Comparison - _cMeanDBRef1LS_Subdet.reset(); - _cMeanDBRef1LS_depth.reset(); - _cRMSDBRef1LS_Subdet.reset(); - _cRMSDBRef1LS_depth.reset(); - - _cMeanDBRefTotal_Subdet.reset(); - _cMeanDBRefTotal_depth.reset(); - _cRMSDBRefTotal_Subdet.reset(); - _cRMSDBRefTotal_depth.reset(); - - if (_ptype != fOffline) { // hidefed2crate - _cMeanDBRef1LS_FEDVME.reset(); - _cMeanDBRef1LS_FEDuTCA.reset(); - _cRMSDBRef1LS_FEDVME.reset(); - _cRMSDBRef1LS_FEDuTCA.reset(); - - _cMeanDBRefTotal_FEDVME.reset(); - _cMeanDBRefTotal_FEDuTCA.reset(); - _cRMSDBRefTotal_FEDVME.reset(); - _cRMSDBRefTotal_FEDuTCA.reset(); - } - - // missing channels - _cMissing1LS_depth.reset(); - _cMeanBad1LS_depth.reset(); - _cRMSBad1LS_depth.reset(); - - _cMissingTotal_depth.reset(); - _cMeanBadTotal_depth.reset(); - _cRMSBadTotal_depth.reset(); - - // Missing or Bad - if (_ptype != fOffline) { // hidefed2crate - _cMissing1LS_FEDVME.reset(); - _cMissing1LS_FEDuTCA.reset(); - _cMeanBad1LS_FEDVME.reset(); - _cMeanBad1LS_FEDuTCA.reset(); - _cRMSBad1LS_FEDVME.reset(); - _cRMSBad1LS_FEDuTCA.reset(); - - _cMissingTotal_FEDVME.reset(); - _cMissingTotal_FEDuTCA.reset(); - _cMeanBadTotal_FEDVME.reset(); - _cMeanBadTotal_FEDuTCA.reset(); - _cRMSBadTotal_FEDVME.reset(); - _cRMSBadTotal_FEDuTCA.reset(); - - // reset some XXX containers - _xNChs.reset(); - _xNMsn1LS.reset(); - _xNBadMean1LS.reset(); _xNBadRMS1LS.reset(); - } - // - ITERATE OVER ALL TEH CHANNELS - // - FIND THE ONES THAT ARE MISSING - // - FIND THE ONES WITH BAD PEDESTAL MEANs - // - FIND THE ONES WITH BAD PEDESTAL RMSs - std::vector dids = _emap->allPrecisionId(); - for (std::vector::const_iterator it=dids.begin(); - it!=dids.end(); ++it) - { - if (!it->isHcalDetId()) - continue; - HcalElectronicsId eid(_ehashmap.lookup(*it)); - if (_filter_C38.filter(eid)) - continue; - - // filter out channels with bad quality - if (_xQuality.exists(HcalDetId(*it))) - { - HcalChannelStatus cs(it->rawId(), _xQuality.get(HcalDetId(*it))); - if ( - cs.isBitSet(HcalChannelStatus::HcalCellMask) || - cs.isBitSet(HcalChannelStatus::HcalCellDead)) - continue; - } - - HcalDetId did = HcalDetId(it->rawId()); - double sum1LS = _xPedSum1LS.get(did); +/* virtual */ void PedestalTask::_dump() { + // reset what's needed + + // Mean/RMS actual values + _cMean1LS_Subdet.reset(); + _cRMS1LS_Subdet.reset(); + _cMean1LS_depth.reset(); + _cRMS1LS_depth.reset(); + if (_ptype != fOffline) { // hidefed2crate + _cMean1LS_FEDVME.reset(); + _cMean1LS_FEDuTCA.reset(); + _cRMS1LS_FEDVME.reset(); + _cRMS1LS_FEDuTCA.reset(); + } + + _cMeanTotal_Subdet.reset(); + _cRMSTotal_Subdet.reset(); + _cMeanTotal_depth.reset(); + _cRMSTotal_depth.reset(); + if (_ptype != fOffline) { // hidefed2crate + _cMeanTotal_FEDVME.reset(); + _cMeanTotal_FEDuTCA.reset(); + _cRMSTotal_FEDVME.reset(); + _cRMSTotal_FEDuTCA.reset(); + } + + // DB Conditions Comparison + _cMeanDBRef1LS_Subdet.reset(); + _cMeanDBRef1LS_depth.reset(); + _cRMSDBRef1LS_Subdet.reset(); + _cRMSDBRef1LS_depth.reset(); + + _cMeanDBRefTotal_Subdet.reset(); + _cMeanDBRefTotal_depth.reset(); + _cRMSDBRefTotal_Subdet.reset(); + _cRMSDBRefTotal_depth.reset(); + + if (_ptype != fOffline) { // hidefed2crate + _cMeanDBRef1LS_FEDVME.reset(); + _cMeanDBRef1LS_FEDuTCA.reset(); + _cRMSDBRef1LS_FEDVME.reset(); + _cRMSDBRef1LS_FEDuTCA.reset(); + + _cMeanDBRefTotal_FEDVME.reset(); + _cMeanDBRefTotal_FEDuTCA.reset(); + _cRMSDBRefTotal_FEDVME.reset(); + _cRMSDBRefTotal_FEDuTCA.reset(); + } + + // missing channels + _cMissing1LS_depth.reset(); + _cMeanBad1LS_depth.reset(); + _cRMSBad1LS_depth.reset(); + + _cMissingTotal_depth.reset(); + _cMeanBadTotal_depth.reset(); + _cRMSBadTotal_depth.reset(); + + // Missing or Bad + if (_ptype != fOffline) { // hidefed2crate + _cMissing1LS_FEDVME.reset(); + _cMissing1LS_FEDuTCA.reset(); + _cMeanBad1LS_FEDVME.reset(); + _cMeanBad1LS_FEDuTCA.reset(); + _cRMSBad1LS_FEDVME.reset(); + _cRMSBad1LS_FEDuTCA.reset(); + + _cMissingTotal_FEDVME.reset(); + _cMissingTotal_FEDuTCA.reset(); + _cMeanBadTotal_FEDVME.reset(); + _cMeanBadTotal_FEDuTCA.reset(); + _cRMSBadTotal_FEDVME.reset(); + _cRMSBadTotal_FEDuTCA.reset(); + + // reset some XXX containers + _xNChs.reset(); + _xNMsn1LS.reset(); + _xNBadMean1LS.reset(); + _xNBadRMS1LS.reset(); + } + // - ITERATE OVER ALL TEH CHANNELS + // - FIND THE ONES THAT ARE MISSING + // - FIND THE ONES WITH BAD PEDESTAL MEANs + // - FIND THE ONES WITH BAD PEDESTAL RMSs + std::vector dids = _emap->allPrecisionId(); + for (std::vector::const_iterator it = dids.begin(); it != dids.end(); ++it) { + if (!it->isHcalDetId()) + continue; + HcalElectronicsId eid(_ehashmap.lookup(*it)); + if (_filter_C38.filter(eid)) + continue; + + // filter out channels with bad quality + if (_xQuality.exists(HcalDetId(*it))) { + HcalChannelStatus cs(it->rawId(), _xQuality.get(HcalDetId(*it))); + if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead)) + continue; + } + + HcalDetId did = HcalDetId(it->rawId()); + double sum1LS = _xPedSum1LS.get(did); #ifndef HIDE_PEDESTAL_CONDITIONS - double refm = _xPedRefMean.get(did); + double refm = _xPedRefMean.get(did); #endif - double sum21LS = _xPedSum21LS.get(did); + double sum21LS = _xPedSum21LS.get(did); #ifndef HIDE_PEDESTAL_CONDITIONS - double refr = _xPedRefRMS.get(did); + double refr = _xPedRefRMS.get(did); #endif - double n1LS = _xPedEntries1LS.get(did); - - double sumTotal = _xPedSumTotal.get(did); - double sum2Total = _xPedSum2Total.get(did); - double nTotal = _xPedEntriesTotal.get(did); - - if (_ptype != fOffline) { // hidefed2crate - _xNChs.get(eid)++; - } - // IF A CHANNEL IS MISSING FOR THIS LS - if (n1LS==0) - { - _cMissing1LS_depth.fill(did); - _cMissingvsLS_Subdet.fill(did, _currentLS); - if (_ptype != fOffline) { // hidefed2crate - eid.isVMEid()?_cMissing1LS_FEDVME.fill(eid): - _cMissing1LS_FEDuTCA.fill(eid); - _xNMsn1LS.get(eid)++; - } - // ALSO CHECK - // IF A CHANNEL HAS BEEN MISSING FOR ALL LSs SO FAR - if (nTotal==0) - { - _cMissingTotal_depth.fill(did); - if (_ptype != fOffline) { // hidefed2crate - eid.isVMEid()?_cMissingTotal_FEDVME.fill(eid): - _cMissingTotal_FEDuTCA.fill(eid); - } - } - continue; - } - - // if not missing, fill the occupancy... - _cOccupancyvsLS_Subdet.fill(did, _currentLS); - - // compute the means and diffs for this LS - sum1LS/=n1LS; double rms1LS = sqrt(sum21LS/n1LS-sum1LS*sum1LS); + double n1LS = _xPedEntries1LS.get(did); + + double sumTotal = _xPedSumTotal.get(did); + double sum2Total = _xPedSum2Total.get(did); + double nTotal = _xPedEntriesTotal.get(did); + + if (_ptype != fOffline) { // hidefed2crate + _xNChs.get(eid)++; + } + // IF A CHANNEL IS MISSING FOR THIS LS + if (n1LS == 0) { + _cMissing1LS_depth.fill(did); + _cMissingvsLS_Subdet.fill(did, _currentLS); + if (_ptype != fOffline) { // hidefed2crate + eid.isVMEid() ? _cMissing1LS_FEDVME.fill(eid) : _cMissing1LS_FEDuTCA.fill(eid); + _xNMsn1LS.get(eid)++; + } + // ALSO CHECK + // IF A CHANNEL HAS BEEN MISSING FOR ALL LSs SO FAR + if (nTotal == 0) { + _cMissingTotal_depth.fill(did); + if (_ptype != fOffline) { // hidefed2crate + eid.isVMEid() ? _cMissingTotal_FEDVME.fill(eid) : _cMissingTotal_FEDuTCA.fill(eid); + } + } + continue; + } + + // if not missing, fill the occupancy... + _cOccupancyvsLS_Subdet.fill(did, _currentLS); + + // compute the means and diffs for this LS + sum1LS /= n1LS; + double rms1LS = sqrt(sum21LS / n1LS - sum1LS * sum1LS); #ifndef HIDE_PEDESTAL_CONDITIONS - double diffm1LS = sum1LS-refm; - double diffr1LS = rms1LS - refr; + double diffm1LS = sum1LS - refm; + double diffr1LS = rms1LS - refr; #endif - // compute the means and diffs for the whole Run - sumTotal/=nTotal; - double rmsTotal = sqrt(sum2Total/nTotal-sumTotal*sumTotal); + // compute the means and diffs for the whole Run + sumTotal /= nTotal; + double rmsTotal = sqrt(sum2Total / nTotal - sumTotal * sumTotal); #ifndef HIDE_PEDESTAL_CONDITIONS - double diffmTotal = sumTotal-refm; - double diffrTotal = rmsTotal - refr; + double diffmTotal = sumTotal - refm; + double diffrTotal = rmsTotal - refr; #endif - // FILL ACTUAL MEANs AND RMSs FOR THIS LS - _cMean1LS_Subdet.fill(did, sum1LS); - _cMean1LS_depth.fill(did, sum1LS); - _cRMS1LS_Subdet.fill(did, rms1LS); - _cRMS1LS_depth.fill(did, rms1LS); + // FILL ACTUAL MEANs AND RMSs FOR THIS LS + _cMean1LS_Subdet.fill(did, sum1LS); + _cMean1LS_depth.fill(did, sum1LS); + _cRMS1LS_Subdet.fill(did, rms1LS); + _cRMS1LS_depth.fill(did, rms1LS); - // FILL THE DIFFERENCES FOR THIS LS + // FILL THE DIFFERENCES FOR THIS LS #ifndef HIDE_PEDESTAL_CONDITIONS - _cMeanDBRef1LS_Subdet.fill(did, diffm1LS); - _cMeanDBRef1LS_depth.fill(did, diffm1LS); - _cRMSDBRef1LS_Subdet.fill(did, diffr1LS); - _cRMSDBRef1LS_depth.fill(did, diffr1LS); + _cMeanDBRef1LS_Subdet.fill(did, diffm1LS); + _cMeanDBRef1LS_depth.fill(did, diffm1LS); + _cRMSDBRef1LS_Subdet.fill(did, diffr1LS); + _cRMSDBRef1LS_depth.fill(did, diffr1LS); #endif - // FILL ACTUAL MEANs AND RMSs FOR THE WHOLE RUN - _cMeanTotal_Subdet.fill(did, sumTotal); - _cMeanTotal_depth.fill(did, sumTotal); - _cRMSTotal_Subdet.fill(did, rmsTotal); - _cRMSTotal_depth.fill(did, rmsTotal); + // FILL ACTUAL MEANs AND RMSs FOR THE WHOLE RUN + _cMeanTotal_Subdet.fill(did, sumTotal); + _cMeanTotal_depth.fill(did, sumTotal); + _cRMSTotal_Subdet.fill(did, rmsTotal); + _cRMSTotal_depth.fill(did, rmsTotal); - // FILL THE DIFFERENCES FOR THE WHOLE RUN + // FILL THE DIFFERENCES FOR THE WHOLE RUN #ifndef HIDE_PEDESTAL_CONDITIONS - _cMeanDBRefTotal_Subdet.fill(did, diffmTotal); - _cMeanDBRefTotal_depth.fill(did, diffmTotal); - _cRMSDBRefTotal_Subdet.fill(did, diffrTotal); - _cRMSDBRefTotal_depth.fill(did, diffrTotal); + _cMeanDBRefTotal_Subdet.fill(did, diffmTotal); + _cMeanDBRefTotal_depth.fill(did, diffmTotal); + _cRMSDBRefTotal_Subdet.fill(did, diffrTotal); + _cRMSDBRefTotal_depth.fill(did, diffrTotal); #endif - // FOR THIS LS - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - { - _cMean1LS_FEDVME.fill(eid, sum1LS); - _cRMS1LS_FEDVME.fill(eid, rms1LS); - _cMeanDBRef1LS_FEDVME.fill(eid, diffm1LS); - _cRMSDBRef1LS_FEDVME.fill(eid, diffr1LS); - } - else - { - _cMean1LS_FEDuTCA.fill(eid, sum1LS); - _cRMS1LS_FEDuTCA.fill(eid, rms1LS); - _cMeanDBRef1LS_FEDuTCA.fill(eid, diffm1LS); - _cRMSDBRef1LS_FEDuTCA.fill(eid, diffr1LS); - } - - // FOR THE WHOLE RUN - if (eid.isVMEid()) - { - _cMeanTotal_FEDVME.fill(eid, sumTotal); - _cRMSTotal_FEDVME.fill(eid, rmsTotal); - _cMeanDBRefTotal_FEDVME.fill(eid, diffmTotal); - _cRMSDBRefTotal_FEDVME.fill(eid, diffrTotal); - } - else - { - _cMeanTotal_FEDuTCA.fill(eid, sumTotal); - _cRMSTotal_FEDuTCA.fill(eid, rmsTotal); - _cMeanDBRefTotal_FEDuTCA.fill(eid, diffmTotal); - _cRMSDBRefTotal_FEDuTCA.fill(eid, diffrTotal); - } - } - - // FOR THE CURRENT LS COMPARE MEANS AND RMSS + // FOR THIS LS + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) { + _cMean1LS_FEDVME.fill(eid, sum1LS); + _cRMS1LS_FEDVME.fill(eid, rms1LS); + _cMeanDBRef1LS_FEDVME.fill(eid, diffm1LS); + _cRMSDBRef1LS_FEDVME.fill(eid, diffr1LS); + } else { + _cMean1LS_FEDuTCA.fill(eid, sum1LS); + _cRMS1LS_FEDuTCA.fill(eid, rms1LS); + _cMeanDBRef1LS_FEDuTCA.fill(eid, diffm1LS); + _cRMSDBRef1LS_FEDuTCA.fill(eid, diffr1LS); + } + + // FOR THE WHOLE RUN + if (eid.isVMEid()) { + _cMeanTotal_FEDVME.fill(eid, sumTotal); + _cRMSTotal_FEDVME.fill(eid, rmsTotal); + _cMeanDBRefTotal_FEDVME.fill(eid, diffmTotal); + _cRMSDBRefTotal_FEDVME.fill(eid, diffrTotal); + } else { + _cMeanTotal_FEDuTCA.fill(eid, sumTotal); + _cRMSTotal_FEDuTCA.fill(eid, rmsTotal); + _cMeanDBRefTotal_FEDuTCA.fill(eid, diffmTotal); + _cRMSDBRefTotal_FEDuTCA.fill(eid, diffrTotal); + } + } + + // FOR THE CURRENT LS COMPARE MEANS AND RMSS #ifndef HIDE_PEDESTAL_CONDITIONS - if (fabs(diffm1LS)>_thresh_mean) - { - _cMeanBad1LS_depth.fill(did); - _cNBadMeanvsLS_Subdet.fill(did, _currentLS); - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - _cMeanBad1LS_FEDVME.fill(eid); - else - _cMeanBad1LS_FEDuTCA.fill(eid); - _xNBadMean1LS.get(eid)++; - } - } - if (fabs(diffr1LS)>_thresh_rms) - { - _cRMSBad1LS_depth.fill(did); - _cNBadRMSvsLS_Subdet.fill(did, _currentLS); - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - _cRMSBad1LS_FEDVME.fill(eid); - else - _cRMSBad1LS_FEDuTCA.fill(eid); - _xNBadRMS1LS.get(eid)++; - } - } - - // FOR THIS RUN - if (fabs(diffmTotal)>_thresh_mean) - { - _cMeanBadTotal_depth.fill(did); - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - _cMeanBadTotal_FEDVME.fill(eid); - else - _cMeanBadTotal_FEDuTCA.fill(eid); - } - } - if (fabs(diffrTotal)>_thresh_rms) - { - _cRMSBadTotal_depth.fill(did); - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - _cRMSBadTotal_FEDVME.fill(eid); - else - _cRMSBadTotal_FEDuTCA.fill(eid); - } - } + if (fabs(diffm1LS) > _thresh_mean) { + _cMeanBad1LS_depth.fill(did); + _cNBadMeanvsLS_Subdet.fill(did, _currentLS); + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) + _cMeanBad1LS_FEDVME.fill(eid); + else + _cMeanBad1LS_FEDuTCA.fill(eid); + _xNBadMean1LS.get(eid)++; + } + } + if (fabs(diffr1LS) > _thresh_rms) { + _cRMSBad1LS_depth.fill(did); + _cNBadRMSvsLS_Subdet.fill(did, _currentLS); + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) + _cRMSBad1LS_FEDVME.fill(eid); + else + _cRMSBad1LS_FEDuTCA.fill(eid); + _xNBadRMS1LS.get(eid)++; + } + } + + // FOR THIS RUN + if (fabs(diffmTotal) > _thresh_mean) { + _cMeanBadTotal_depth.fill(did); + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) + _cMeanBadTotal_FEDVME.fill(eid); + else + _cMeanBadTotal_FEDuTCA.fill(eid); + } + } + if (fabs(diffrTotal) > _thresh_rms) { + _cRMSBadTotal_depth.fill(did); + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) + _cRMSBadTotal_FEDVME.fill(eid); + else + _cRMSBadTotal_FEDuTCA.fill(eid); + } + } #endif - - } - - // SET THE FLAGS FOR THIS LS - if (_ptype != fOffline) { // hidefed2crate - for (std::vector::const_iterator it=_vhashFEDs.begin(); - it!=_vhashFEDs.end(); ++it) - { - hcaldqm::flag::Flag fSum("PED"); - HcalElectronicsId eid = HcalElectronicsId(*it); - - std::vector::const_iterator jt= - std::find(_vcdaqEids.begin(), _vcdaqEids.end(), (*it)); - if (jt==_vcdaqEids.end()) - { - // not @cDAQ - for (uint32_t iflag=0; iflag<_vflags.size(); iflag++) - _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), - int(hcaldqm::flag::fNCDAQ)); - _cSummaryvsLS.setBinContent(eid, _currentLS, int(hcaldqm::flag::fNCDAQ)); - continue; - } - - // @cDAQ - if (hcaldqm::utilities::isFEDHBHE(eid) || hcaldqm::utilities::isFEDHO(eid) || - hcaldqm::utilities::isFEDHF(eid)) - { - double frmissing = double(_xNMsn1LS.get(eid))/ - double(_xNChs.get(eid)); - double frbadm = _xNBadMean1LS.get(eid)/_xNChs.get(eid); - //double frbadr = _xNBadRMS1LS.get(eid)/_xNChs.get(eid); - - if (frmissing>=_thresh_missing_high) - _vflags[fMsn]._state = hcaldqm::flag::fBAD; - else if (frmissing>=_thresh_missing_low) - _vflags[fMsn]._state = hcaldqm::flag::fPROBLEMATIC; - else - _vflags[fMsn]._state = hcaldqm::flag::fGOOD; - if (frbadm>=_thresh_badm) - _vflags[fBadM]._state = hcaldqm::flag::fBAD; - else - _vflags[fBadM]._state = hcaldqm::flag::fGOOD; - // BadR removed May 9, 2018 - the pedestal RMS isn't stable enough to monitor right now. - //if (frbadr>=_thresh_badr) - // _vflags[fBadR]._state = hcaldqm::flag::fBAD; - //else - // _vflags[fBadR]._state = hcaldqm::flag::fGOOD; - } - - int iflag=0; - for (std::vector::iterator ft=_vflags.begin(); - ft!=_vflags.end(); ++ft) - { - _cSummaryvsLS_FED.setBinContent(eid, _currentLS, iflag, - int(ft->_state)); - fSum+=(*ft); - iflag++; - ft->reset(); - } - _cSummaryvsLS.setBinContent(eid, _currentLS, fSum._state); - } - } - - // reset the pedestal containers instead of writting reset... func - _xPedSum1LS.reset(); _xPedSum21LS.reset(); _xPedEntries1LS.reset(); - + } + + // SET THE FLAGS FOR THIS LS + if (_ptype != fOffline) { // hidefed2crate + for (std::vector::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) { + hcaldqm::flag::Flag fSum("PED"); + HcalElectronicsId eid = HcalElectronicsId(*it); + + std::vector::const_iterator jt = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), (*it)); + if (jt == _vcdaqEids.end()) { + // not @cDAQ + for (uint32_t iflag = 0; iflag < _vflags.size(); iflag++) + _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), int(hcaldqm::flag::fNCDAQ)); + _cSummaryvsLS.setBinContent(eid, _currentLS, int(hcaldqm::flag::fNCDAQ)); + continue; + } + + // @cDAQ + if (hcaldqm::utilities::isFEDHBHE(eid) || hcaldqm::utilities::isFEDHO(eid) || hcaldqm::utilities::isFEDHF(eid)) { + double frmissing = double(_xNMsn1LS.get(eid)) / double(_xNChs.get(eid)); + double frbadm = _xNBadMean1LS.get(eid) / _xNChs.get(eid); + //double frbadr = _xNBadRMS1LS.get(eid)/_xNChs.get(eid); + + if (frmissing >= _thresh_missing_high) + _vflags[fMsn]._state = hcaldqm::flag::fBAD; + else if (frmissing >= _thresh_missing_low) + _vflags[fMsn]._state = hcaldqm::flag::fPROBLEMATIC; + else + _vflags[fMsn]._state = hcaldqm::flag::fGOOD; + if (frbadm >= _thresh_badm) + _vflags[fBadM]._state = hcaldqm::flag::fBAD; + else + _vflags[fBadM]._state = hcaldqm::flag::fGOOD; + // BadR removed May 9, 2018 - the pedestal RMS isn't stable enough to monitor right now. + //if (frbadr>=_thresh_badr) + // _vflags[fBadR]._state = hcaldqm::flag::fBAD; + //else + // _vflags[fBadR]._state = hcaldqm::flag::fGOOD; + } + + int iflag = 0; + for (std::vector::iterator ft = _vflags.begin(); ft != _vflags.end(); ++ft) { + _cSummaryvsLS_FED.setBinContent(eid, _currentLS, iflag, int(ft->_state)); + fSum += (*ft); + iflag++; + ft->reset(); + } + _cSummaryvsLS.setBinContent(eid, _currentLS, fSum._state); + } + } + + // reset the pedestal containers instead of writting reset... func + _xPedSum1LS.reset(); + _xPedSum21LS.reset(); + _xPedEntries1LS.reset(); } -/* virtual */ void PedestalTask::beginLuminosityBlock( - edm::LuminosityBlock const& lb, edm::EventSetup const& es) -{ - DQTask::beginLuminosityBlock(lb, es); +/* virtual */ void PedestalTask::beginLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + DQTask::beginLuminosityBlock(lb, es); } -/* virtual */ void PedestalTask::endRun(edm::Run const& r, - edm::EventSetup const&) -{ - if (_ptype==fLocal) - { - if (r.runAuxiliary().run()==1) - return; - else - this->_dump(); - } - else if (_ptype==fOnline) - return; +/* virtual */ void PedestalTask::endRun(edm::Run const& r, edm::EventSetup const&) { + if (_ptype == fLocal) { + if (r.runAuxiliary().run() == 1) + return; + else + this->_dump(); + } else if (_ptype == fOnline) + return; } -/* virtual */ void PedestalTask::endLuminosityBlock( - edm::LuminosityBlock const& lb, edm::EventSetup const& es) -{ - if (_ptype==fLocal) - return; - this->_dump(); +/* virtual */ void PedestalTask::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + if (_ptype == fLocal) + return; + this->_dump(); - DQTask::endLuminosityBlock(lb, es); + DQTask::endLuminosityBlock(lb, es); } -/* virtual */ void PedestalTask::_process(edm::Event const& e, - edm::EventSetup const& es) -{ - edm::Handle chbhe; - edm::Handle cho; - edm::Handle chf; - edm::Handle chep17; - - if (!e.getByToken(_tokHBHE, chbhe)) - _logger.dqmthrow("Collection HBHEDigiCollection isn't available" - + _tagHBHE.label() + " " + _tagHBHE.instance()); - if (!e.getByToken(_tokHO, cho)) - _logger.dqmthrow("Collection HODigiCollection isn't available" - + _tagHO.label() + " " + _tagHO.instance()); - if (!e.getByToken(_tokHF, chf)) - _logger.dqmthrow("Collection QIE10DigiCollection isn't available" - + _tagHF.label() + " " + _tagHF.instance()); - if (!e.getByToken(_tokHEP17, chep17)) - _logger.dqmthrow("Collection QIE11DigiCollection isn't available" - + _tagHE.label() + " " + _tagHE.instance()); - - int nHB(0), nHE(0), nHO(0), nHF(0); - for (HBHEDigiCollection::const_iterator it=chbhe->begin(); - it!=chbhe->end(); ++it) - { - const HBHEDataFrame digi = (const HBHEDataFrame)(*it); - HcalDetId did = digi.id(); - int digiSizeToUse = floor(digi.size()/constants::CAPS_NUM)* - constants::CAPS_NUM-1; - did.subdet()==HcalBarrel ? nHB++ : nHE++; - - for (int i=0; isample(i).adc()); - - _xPedSum1LS.get(did)+=it->sample(i).adc(); - _xPedSum21LS.get(did)+=it->sample(i).adc()*it->sample(i).adc(); - _xPedEntries1LS.get(did)++; - - _xPedSumTotal.get(did)+=it->sample(i).adc(); - _xPedSum2Total.get(did)+=it->sample(i).adc()*it->sample(i).adc(); - _xPedEntriesTotal.get(did)++; - } - } - for (QIE11DigiCollection::const_iterator it=chep17->begin(); it!=chep17->end(); - ++it) - { - const QIE11DataFrame digi = static_cast(*it); - HcalDetId const& did = digi.detid(); - // Require barrel or endcap. As of 2017, some calibration channels are ending up in this collection. - if ((did.subdet() != HcalEndcap) && (did.subdet() != HcalBarrel)) { - continue; - } - int digiSizeToUse = floor(digi.samples()/constants::CAPS_NUM)* - constants::CAPS_NUM-1; - did.subdet()==HcalBarrel ? nHB++ : nHE++; - - for (int i=0; ibegin(); - it!=cho->end(); ++it) - { - const HODataFrame digi = (const HODataFrame)(*it); - HcalDetId did = digi.id(); - int digiSizeToUse = floor(digi.size()/constants::CAPS_NUM)* - constants::CAPS_NUM-1; - nHO++; - for (int i=0; isample(i).adc()); - - _xPedSum1LS.get(did)+=it->sample(i).adc(); - _xPedSum21LS.get(did)+=it->sample(i).adc()*it->sample(i).adc(); - _xPedEntries1LS.get(did)++; - - _xPedSumTotal.get(did)+=it->sample(i).adc(); - _xPedSum2Total.get(did)+=it->sample(i).adc()*it->sample(i).adc(); - _xPedEntriesTotal.get(did)++; - } - } - _cOccupancyEAvsLS_Subdet.fill(HcalDetId(HcalOuter, 1,1,1), - _currentLS, nHO); - - for (QIE10DigiCollection::const_iterator it=chf->begin(); - it!=chf->end(); ++it) - { - const QIE10DataFrame digi = static_cast(*it); - HcalDetId did = digi.detid(); - if (did.subdet() != HcalForward) { - continue; - } - // HF has 3 samples in global, so impossible to make divisible by 4 - int digiSizeToUse = (digi.samples() >= 4 ? floor(digi.samples()/constants::CAPS_NUM)*constants::CAPS_NUM-1 : digi.samples()); - nHF++; - for (int i=0; i chbhe; + edm::Handle cho; + edm::Handle chf; + edm::Handle chep17; + + if (!e.getByToken(_tokHBHE, chbhe)) + _logger.dqmthrow("Collection HBHEDigiCollection isn't available" + _tagHBHE.label() + " " + _tagHBHE.instance()); + if (!e.getByToken(_tokHO, cho)) + _logger.dqmthrow("Collection HODigiCollection isn't available" + _tagHO.label() + " " + _tagHO.instance()); + if (!e.getByToken(_tokHF, chf)) + _logger.dqmthrow("Collection QIE10DigiCollection isn't available" + _tagHF.label() + " " + _tagHF.instance()); + if (!e.getByToken(_tokHEP17, chep17)) + _logger.dqmthrow("Collection QIE11DigiCollection isn't available" + _tagHE.label() + " " + _tagHE.instance()); + + int nHB(0), nHE(0), nHO(0), nHF(0); + for (HBHEDigiCollection::const_iterator it = chbhe->begin(); it != chbhe->end(); ++it) { + const HBHEDataFrame digi = (const HBHEDataFrame)(*it); + HcalDetId did = digi.id(); + int digiSizeToUse = floor(digi.size() / constants::CAPS_NUM) * constants::CAPS_NUM - 1; + did.subdet() == HcalBarrel ? nHB++ : nHE++; + + for (int i = 0; i < digiSizeToUse; i++) { + _cADC_SubdetPM.fill(did, it->sample(i).adc()); + + _xPedSum1LS.get(did) += it->sample(i).adc(); + _xPedSum21LS.get(did) += it->sample(i).adc() * it->sample(i).adc(); + _xPedEntries1LS.get(did)++; + + _xPedSumTotal.get(did) += it->sample(i).adc(); + _xPedSum2Total.get(did) += it->sample(i).adc() * it->sample(i).adc(); + _xPedEntriesTotal.get(did)++; + } + } + for (QIE11DigiCollection::const_iterator it = chep17->begin(); it != chep17->end(); ++it) { + const QIE11DataFrame digi = static_cast(*it); + HcalDetId const& did = digi.detid(); + // Require barrel or endcap. As of 2017, some calibration channels are ending up in this collection. + if ((did.subdet() != HcalEndcap) && (did.subdet() != HcalBarrel)) { + continue; + } + int digiSizeToUse = floor(digi.samples() / constants::CAPS_NUM) * constants::CAPS_NUM - 1; + did.subdet() == HcalBarrel ? nHB++ : nHE++; + + for (int i = 0; i < digiSizeToUse; i++) { + _cADC_SubdetPM.fill(did, digi[i].adc()); + + _xPedSum1LS.get(did) += digi[i].adc(); + _xPedSum21LS.get(did) += digi[i].adc() * digi[i].adc(); + _xPedEntries1LS.get(did)++; + + _xPedSumTotal.get(did) += digi[i].adc(); + _xPedSum2Total.get(did) += digi[i].adc() * digi[i].adc(); + _xPedEntriesTotal.get(did)++; + } + } + + _cOccupancyEAvsLS_Subdet.fill(HcalDetId(HcalBarrel, 1, 1, 1), _currentLS, nHB); + _cOccupancyEAvsLS_Subdet.fill(HcalDetId(HcalEndcap, 1, 1, 1), _currentLS, nHE); + + for (HODigiCollection::const_iterator it = cho->begin(); it != cho->end(); ++it) { + const HODataFrame digi = (const HODataFrame)(*it); + HcalDetId did = digi.id(); + int digiSizeToUse = floor(digi.size() / constants::CAPS_NUM) * constants::CAPS_NUM - 1; + nHO++; + for (int i = 0; i < digiSizeToUse; i++) { + _cADC_SubdetPM.fill(did, it->sample(i).adc()); + + _xPedSum1LS.get(did) += it->sample(i).adc(); + _xPedSum21LS.get(did) += it->sample(i).adc() * it->sample(i).adc(); + _xPedEntries1LS.get(did)++; + + _xPedSumTotal.get(did) += it->sample(i).adc(); + _xPedSum2Total.get(did) += it->sample(i).adc() * it->sample(i).adc(); + _xPedEntriesTotal.get(did)++; + } + } + _cOccupancyEAvsLS_Subdet.fill(HcalDetId(HcalOuter, 1, 1, 1), _currentLS, nHO); + + for (QIE10DigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) { + const QIE10DataFrame digi = static_cast(*it); + HcalDetId did = digi.detid(); + if (did.subdet() != HcalForward) { + continue; + } + // HF has 3 samples in global, so impossible to make divisible by 4 + int digiSizeToUse = + (digi.samples() >= 4 ? floor(digi.samples() / constants::CAPS_NUM) * constants::CAPS_NUM - 1 : digi.samples()); + nHF++; + for (int i = 0; i < digiSizeToUse; i++) { + _cADC_SubdetPM.fill(did, digi[i].adc()); + + _xPedSum1LS.get(did) += digi[i].adc(); + _xPedSum21LS.get(did) += digi[i].adc() * digi[i].adc(); + _xPedEntries1LS.get(did)++; + + _xPedSumTotal.get(did) += digi[i].adc(); + _xPedSum2Total.get(did) += digi[i].adc() * digi[i].adc(); + _xPedEntriesTotal.get(did)++; + } + } + _cOccupancyEAvsLS_Subdet.fill(HcalDetId(HcalForward, 1, 1, 1), _currentLS, nHF); } -/* virtual */ bool PedestalTask::_isApplicable(edm::Event const& e) -{ - if (_ptype==fOnline) - { - edm::Handle cumn; - if (!e.getByToken(_tokuMN, cumn)) - return false; - - // for online just check the event type not the user Word - uint8_t eventType = cumn->eventType(); - if (eventType == constants::EVENTTYPE_PEDESTAL) - return true; - } - else - { - // local - edm::Handle ctrigger; - if (!e.getByToken(_tokTrigger, ctrigger)) - _logger.dqmthrow("Collection HcalTBTriggerData isn't available" - + _tagTrigger.label() + " " + _tagTrigger.instance()); - return ctrigger->wasSpillIgnorantPedestalTrigger(); - } - - return false; +/* virtual */ bool PedestalTask::_isApplicable(edm::Event const& e) { + if (_ptype == fOnline) { + edm::Handle cumn; + if (!e.getByToken(_tokuMN, cumn)) + return false; + + // for online just check the event type not the user Word + uint8_t eventType = cumn->eventType(); + if (eventType == constants::EVENTTYPE_PEDESTAL) + return true; + } else { + // local + edm::Handle ctrigger; + if (!e.getByToken(_tokTrigger, ctrigger)) + _logger.dqmthrow("Collection HcalTBTriggerData isn't available" + _tagTrigger.label() + " " + + _tagTrigger.instance()); + return ctrigger->wasSpillIgnorantPedestalTrigger(); + } + + return false; } DEFINE_FWK_MODULE(PedestalTask); diff --git a/DQM/HcalTasks/plugins/QIE10Task.cc b/DQM/HcalTasks/plugins/QIE10Task.cc index 4b77118718840..953fc870621b7 100644 --- a/DQM/HcalTasks/plugins/QIE10Task.cc +++ b/DQM/HcalTasks/plugins/QIE10Task.cc @@ -5,241 +5,231 @@ using namespace hcaldqm; using namespace hcaldqm::constants; -QIE10Task::QIE10Task(edm::ParameterSet const& ps): - DQTask(ps) -{ - - // tags - _tagQIE10 = ps.getUntrackedParameter("tagQIE10", - edm::InputTag("hcalDigis")); - _tagHF = ps.getUntrackedParameter("tagHF", - edm::InputTag("hcalDigis")); - _tokQIE10 = consumes(_tagQIE10); - _tokHF = consumes(_tagHF); - - // cuts - _cut = ps.getUntrackedParameter("cut", 50.0); - _ped = ps.getUntrackedParameter("ped", 4); +QIE10Task::QIE10Task(edm::ParameterSet const& ps) : DQTask(ps) { + // tags + _tagQIE10 = ps.getUntrackedParameter("tagQIE10", edm::InputTag("hcalDigis")); + _tagHF = ps.getUntrackedParameter("tagHF", edm::InputTag("hcalDigis")); + _tokQIE10 = consumes(_tagQIE10); + _tokHF = consumes(_tagHF); + + // cuts + _cut = ps.getUntrackedParameter("cut", 50.0); + _ped = ps.getUntrackedParameter("ped", 4); } -/* virtual */ void QIE10Task::bookHistograms(DQMStore::IBooker &ib, - edm::Run const& r, edm::EventSetup const& es) -{ - if (_ptype==fLocal) - if (r.runAuxiliary().run()==1) - return; - - DQTask::bookHistograms(ib, r, es); - - // GET WHAT YOU NEED - edm::ESHandle dbs; - es.get().get(dbs); - _emap = dbs->getHcalMapping(); - - unsigned int nTS = _ptype==fLocal ? 10 : 6; - - // create a slot filter and initialize what you need - unsigned int itr=0; - for (auto& crate : constants::crateListHF) { - for(unsigned int slot=SLOT_uTCA_MIN; slot<=SLOT_uTCA_MAX; ++slot) { - std::vector vhashSlot; - vhashSlot.push_back(HcalElectronicsId(crate, slot, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_slot[itr].initialize(filter::fPreserver, hashfunctions::fCrateSlot, vhashSlot); - - _cShapeCut_EChannel[itr].initialize(_name, - "ShapeCut", hcaldqm::hashfunctions::fEChannel, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000)); - _cLETDCTime_EChannel[itr].initialize(_name, - "LETDCTime", hcaldqm::hashfunctions::fEChannel, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - _cLETDCvsTS_EChannel[itr].initialize(_name, - "TDCvsTS", hcaldqm::hashfunctions::fEChannel, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); - - for (unsigned int j=0; j dbs; + es.get().get(dbs); + _emap = dbs->getHcalMapping(); + + unsigned int nTS = _ptype == fLocal ? 10 : 6; + + // create a slot filter and initialize what you need + unsigned int itr = 0; + for (auto& crate : constants::crateListHF) { + for (unsigned int slot = SLOT_uTCA_MIN; slot <= SLOT_uTCA_MAX; ++slot) { + std::vector vhashSlot; + vhashSlot.push_back(HcalElectronicsId(crate, slot, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_slot[itr].initialize(filter::fPreserver, hashfunctions::fCrateSlot, vhashSlot); + + _cShapeCut_EChannel[itr].initialize(_name, + "ShapeCut", + hcaldqm::hashfunctions::fEChannel, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000)); + _cLETDCTime_EChannel[itr].initialize(_name, + "LETDCTime", + hcaldqm::hashfunctions::fEChannel, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + _cLETDCvsTS_EChannel[itr].initialize(_name, + "TDCvsTS", + hcaldqm::hashfunctions::fEChannel, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + + for (unsigned int j = 0; j < nTS; j++) { + _cLETDCvsADC_EChannel[j][itr].initialize(_name, + "LETDCvsADC", + hcaldqm::hashfunctions::fEChannel, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + _cADC_EChannel[j][itr].initialize(_name, + "ADC", + hcaldqm::hashfunctions::fEChannel, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + _cLETDC_EChannel[j][itr].initialize(_name, + "LETDC", + hcaldqm::hashfunctions::fEChannel, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + } + ++itr; + } + } + + _cShapeCut.initialize(_name, + "ShapeCut", + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000)); + _cLETDCvsADC.initialize(_name, + "LETDCvsADC", + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + _cLETDCTimevsADC.initialize(_name, + "LETDCTimevsADC", + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + _cLETDC.initialize(_name, + "LETDC", + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + _cADC.initialize(_name, + "ADC", + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true)); + + //OCCUPANCY PER CRATE/SLOT + _cOccupancy_Crate.initialize(_name, + "Occupancy", + hashfunctions::fCrate, + new quantity::ElectronicsQuantity(quantity::fSlotuTCA), + new quantity::ElectronicsQuantity(quantity::fFiberuTCAFiberCh), + new quantity::ValueQuantity(quantity::fN)); + _cOccupancy_CrateSlot.initialize(_name, + "Occupancy", + hashfunctions::fCrateSlot, + new quantity::ElectronicsQuantity(quantity::fFiberuTCA), + new quantity::ElectronicsQuantity(quantity::fFiberCh), + new quantity::ValueQuantity(quantity::fN)); + + // OCCUPANCY IN DETECTOR COORDINATES + _cOccupancy_depth.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN)); + + itr = 0; + for (auto& crate : constants::crateListHF) { + for (unsigned int slot = SLOT_uTCA_MIN; slot <= SLOT_uTCA_MAX; ++slot) { + char aux[100]; + sprintf(aux, "/Crate%d_Slot%d", crate, slot); + _cShapeCut_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux); + _cLETDCTime_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux); + _cLETDCvsTS_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux); + for (unsigned int i = 0; i < nTS; i++) { + char aux2[100]; + sprintf(aux2, "/Crate%d_Slot%d/TS%d", crate, slot, i); + _cLETDCvsADC_EChannel[i][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux); + _cLETDC_EChannel[i][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux); + _cADC_EChannel[i][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux); + } + ++itr; + } + } + + _cShapeCut.book(ib, _subsystem); + _cLETDCvsADC.book(ib, _subsystem); + _cLETDCTimevsADC.book(ib, _subsystem); + _cLETDC.book(ib, _subsystem); + _cADC.book(ib, _subsystem); + + _cOccupancy_Crate.book(ib, _emap, _subsystem); + _cOccupancy_CrateSlot.book(ib, _emap, _subsystem); + _cOccupancy_depth.book(ib, _emap, _subsystem); + + _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); } -/* virtual */ void QIE10Task::endLuminosityBlock(edm::LuminosityBlock const& lb, - edm::EventSetup const& es) -{ - - // finish - DQTask::endLuminosityBlock(lb, es); +/* virtual */ void QIE10Task::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + // finish + DQTask::endLuminosityBlock(lb, es); } -/* virtual */ void QIE10Task::_process(edm::Event const& e, - edm::EventSetup const&) -{ - edm::Handle cqie10; - edm::Handle chf; - if (!e.getByToken(_tokQIE10, cqie10)) - return; - if (!e.getByToken(_tokHF, chf)) - _logger.dqmthrow("Collection HFDigiCollection isn't available" - + _tagHF.label() + " " + _tagHF.instance()); - - std::map mqie10; - for (uint32_t i=0; isize(); i++) - { - QIE10DataFrame frame = static_cast((*cqie10)[i]); - HcalDetId did = frame.detid(); - HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); - if (did.subdet() != HcalForward) { - continue; - } - - // Compute index for EChannel plots - int fakecrate =-1; - if (eid.crateId() == 22) { - fakecrate = 0; - } else if (eid.crateId() == 29) { - fakecrate = 1; - } else if (eid.crateId() == 32) { - fakecrate = 2; - } else { - // Unknown crate, skip digi - continue; - } - int index = fakecrate*12+eid.slot()-1; - - // compute the signal, ped subracted - CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, frame); - double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, frame, 0, frame.samples()-1); - // double sumQ = hcaldqm::utilities::sumQ_v10(frame, constants::adc2fC[_ped], 0, frame.samples()-1); - - _cOccupancy_Crate.fill(eid); - _cOccupancy_CrateSlot.fill(eid); - _cOccupancy_depth.fill(did); - - // iterate thru all TS and fill - for (int j=0; j_cut) - { - double q = hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, frame, j); - _cShapeCut_EChannel[index].fill(eid, j, q); - _cShapeCut.fill(j, q); - } - // w/o a cut - _cLETDCvsADC_EChannel[j][index].fill(eid, frame[j].adc(), - frame[j].le_tdc()); - _cLETDCvsADC.fill(frame[j].adc(), frame[j].le_tdc()); - _cLETDC_EChannel[j][index].fill(eid, frame[j].le_tdc()); - _cLETDC.fill(frame[j].le_tdc()); - _cADC_EChannel[j][index].fill(eid, frame[j].adc()); - _cADC.fill(frame[j].adc()); - _cLETDCvsTS_EChannel[index].fill(eid, j, frame[j].le_tdc()); - - // TDC conversion to time - if (frame[j].le_tdc() < 50) { - // Each TDC count is 0.5 ns. - // tdc == 62 or 63 means value was below or above threshold for whole time slice. - double time = j*25. + (frame[j].le_tdc() / 2.); - _cLETDCTime_EChannel[index].fill(eid, time); - _cLETDCTimevsADC.fill(frame[j].adc(), time); - } - } - - mqie10[did.rawId()] = frame; - } +/* virtual */ void QIE10Task::_process(edm::Event const& e, edm::EventSetup const&) { + edm::Handle cqie10; + edm::Handle chf; + if (!e.getByToken(_tokQIE10, cqie10)) + return; + if (!e.getByToken(_tokHF, chf)) + _logger.dqmthrow("Collection HFDigiCollection isn't available" + _tagHF.label() + " " + _tagHF.instance()); + + std::map mqie10; + for (uint32_t i = 0; i < cqie10->size(); i++) { + QIE10DataFrame frame = static_cast((*cqie10)[i]); + HcalDetId did = frame.detid(); + HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); + if (did.subdet() != HcalForward) { + continue; + } + + // Compute index for EChannel plots + int fakecrate = -1; + if (eid.crateId() == 22) { + fakecrate = 0; + } else if (eid.crateId() == 29) { + fakecrate = 1; + } else if (eid.crateId() == 32) { + fakecrate = 2; + } else { + // Unknown crate, skip digi + continue; + } + int index = fakecrate * 12 + eid.slot() - 1; + + // compute the signal, ped subracted + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, frame); + double sumQ = hcaldqm::utilities::sumQDB(_dbService, digi_fC, did, frame, 0, frame.samples() - 1); + // double sumQ = hcaldqm::utilities::sumQ_v10(frame, constants::adc2fC[_ped], 0, frame.samples()-1); + + _cOccupancy_Crate.fill(eid); + _cOccupancy_CrateSlot.fill(eid); + _cOccupancy_depth.fill(did); + + // iterate thru all TS and fill + for (int j = 0; j < frame.samples(); j++) { + // shapes are after the cut + if (sumQ > _cut) { + double q = hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, frame, j); + _cShapeCut_EChannel[index].fill(eid, j, q); + _cShapeCut.fill(j, q); + } + // w/o a cut + _cLETDCvsADC_EChannel[j][index].fill(eid, frame[j].adc(), frame[j].le_tdc()); + _cLETDCvsADC.fill(frame[j].adc(), frame[j].le_tdc()); + _cLETDC_EChannel[j][index].fill(eid, frame[j].le_tdc()); + _cLETDC.fill(frame[j].le_tdc()); + _cADC_EChannel[j][index].fill(eid, frame[j].adc()); + _cADC.fill(frame[j].adc()); + _cLETDCvsTS_EChannel[index].fill(eid, j, frame[j].le_tdc()); + + // TDC conversion to time + if (frame[j].le_tdc() < 50) { + // Each TDC count is 0.5 ns. + // tdc == 62 or 63 means value was below or above threshold for whole time slice. + double time = j * 25. + (frame[j].le_tdc() / 2.); + _cLETDCTime_EChannel[index].fill(eid, time); + _cLETDCTimevsADC.fill(frame[j].adc(), time); + } + } + + mqie10[did.rawId()] = frame; + } } -/* virtual */ void QIE10Task::_resetMonitors(hcaldqm::UpdateFreq) -{ -} +/* virtual */ void QIE10Task::_resetMonitors(hcaldqm::UpdateFreq) {} DEFINE_FWK_MODULE(QIE10Task); diff --git a/DQM/HcalTasks/plugins/QIE11Task.cc b/DQM/HcalTasks/plugins/QIE11Task.cc index 73369b186a6a4..9562d88952d4f 100644 --- a/DQM/HcalTasks/plugins/QIE11Task.cc +++ b/DQM/HcalTasks/plugins/QIE11Task.cc @@ -3,252 +3,249 @@ using namespace hcaldqm; using namespace hcaldqm::constants; -QIE11Task::QIE11Task(edm::ParameterSet const& ps): - DQTask(ps) -{ - - // tags - _tagQIE11 = ps.getUntrackedParameter("tagQIE11", - edm::InputTag("hcalDigis")); - _tokQIE11 = consumes(_tagQIE11); - - _taguMN = ps.getUntrackedParameter("taguMN", - edm::InputTag("hcalDigis")); - _tokuMN = consumes(_taguMN); - - // cuts - _cut = ps.getUntrackedParameter("cut", 50.0); - _ped = ps.getUntrackedParameter("ped", 4); - _laserType = ps.getUntrackedParameter("laserType", -1); - _eventType = ps.getUntrackedParameter("eventType", -1); +QIE11Task::QIE11Task(edm::ParameterSet const& ps) : DQTask(ps) { + // tags + _tagQIE11 = ps.getUntrackedParameter("tagQIE11", edm::InputTag("hcalDigis")); + _tokQIE11 = consumes(_tagQIE11); + + _taguMN = ps.getUntrackedParameter("taguMN", edm::InputTag("hcalDigis")); + _tokuMN = consumes(_taguMN); + + // cuts + _cut = ps.getUntrackedParameter("cut", 50.0); + _ped = ps.getUntrackedParameter("ped", 4); + _laserType = ps.getUntrackedParameter("laserType", -1); + _eventType = ps.getUntrackedParameter("eventType", -1); } -/* virtual */ void QIE11Task::bookHistograms(DQMStore::IBooker &ib, - edm::Run const& r, edm::EventSetup const& es) -{ - if (_ptype==fLocal) - if (r.runAuxiliary().run()==1) - return; - - DQTask::bookHistograms(ib, r, es); - - // GET WHAT YOU NEED - edm::ESHandle dbs; - es.get().get(dbs); - _emap = dbs->getHcalMapping(); - std::vector vhashC34; - vhashC34.push_back(HcalElectronicsId(34, 11, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vhashC34.push_back(HcalElectronicsId(34, 12, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_C34.initialize(filter::fPreserver, hcaldqm::hashfunctions::fCrateSlot, - vhashC34); - - std::vector > timingChannels; - timingChannels.push_back(std::pair(28, 63)); - timingChannels.push_back(std::pair(28, 65)); - timingChannels.push_back(std::pair(20, 63)); - timingChannels.push_back(std::pair(20, 65)); - for (int iChan = 0; iChan < 4; ++iChan) { - std::vector vhashTimingChannel; - for (int depth = 1; depth <= 7; ++depth) { - vhashTimingChannel.push_back(HcalDetId(HcalEndcap, timingChannels[iChan].first, timingChannels[iChan].second, depth)); - } - _filter_timingChannels[iChan].initialize(filter::fPreserver, hcaldqm::hashfunctions::fDChannel, vhashTimingChannel); - } - - // INITIALIZE what you need - - // EChannel plots, online+local only - if (_ptype != fOffline) { - unsigned int itr = 0; - for (unsigned int crate = 34; crate <= 34; ++crate) { - for (unsigned int slot = 11; slot <= 12; ++slot) { - std::vector vhashSlot; - vhashSlot.push_back(HcalElectronicsId(crate, slot, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_slot[itr].initialize(filter::fPreserver, hashfunctions::fCrateSlot, vhashSlot); - _cShapeCut_EChannel[itr].initialize(_name, - "ShapeCut", hcaldqm::hashfunctions::fEChannel, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000)); - _cLETDCvsTS_EChannel[itr].initialize(_name, - "LETDCvsTS", hcaldqm::hashfunctions::fEChannel, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), 0); - _cLETDCTime_EChannel[itr].initialize(_name, - "LETDCTime", hcaldqm::hashfunctions::fEChannel, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - for (unsigned int j=0; j<10; j++) { - _cLETDCvsADC_EChannel[j][itr].initialize(_name, - "LETDCvsADC", hcaldqm::hashfunctions::fEChannel, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cADC_EChannel[j][itr].initialize(_name, - "ADC", hcaldqm::hashfunctions::fEChannel, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cLETDC_EChannel[j][itr].initialize(_name, - "LETDC", hcaldqm::hashfunctions::fEChannel, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - } - ++itr; - } - } - } - _cShapeCut.initialize(_name, - "ShapeCut", - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000)); - _cLETDCvsADC.initialize(_name, "LETDCvsADC", - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cLETDCTimevsADC.initialize(_name, "LETDCTimevsADC", - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cLETDC.initialize(_name, "LETDC", - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cADC.initialize(_name, "ADC", - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - - if (_ptype != fOffline) { - unsigned int itr = 0; - std::map, unsigned int> itr_map; - for(unsigned int crate = 34; crate <= 34; ++crate) { - for(unsigned int slot=11; slot<=12; ++slot) { - char aux[100]; - sprintf(aux, "/Crate%d_Slot%d", crate, slot); - _cShapeCut_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux); - _cLETDCvsTS_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux); - _cLETDCTime_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux); - for (unsigned int j=0; j<10; j++) { - char aux2[100]; - sprintf(aux2, "/Crate%d_Slot%d/TS%d", crate, slot, j); - _cLETDCvsADC_EChannel[j][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux2); - _cLETDC_EChannel[j][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux2); - _cADC_EChannel[j][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux2); - } - itr_map[std::make_pair(crate, slot)] = itr; - ++itr; - } - } - } - _cShapeCut.book(ib, _subsystem); - _cLETDCvsADC.book(ib, _subsystem); - _cLETDCTimevsADC.book(ib, _subsystem); - _cLETDC.book(ib, _subsystem); - _cADC.book(ib, _subsystem); - - _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap, _filter_C34); -} - -/* virtual */ void QIE11Task::endLuminosityBlock(edm::LuminosityBlock const& lb, - edm::EventSetup const& es) -{ - - // finish - DQTask::endLuminosityBlock(lb, es); +/* virtual */ void QIE11Task::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + if (_ptype == fLocal) + if (r.runAuxiliary().run() == 1) + return; + + DQTask::bookHistograms(ib, r, es); + + // GET WHAT YOU NEED + edm::ESHandle dbs; + es.get().get(dbs); + _emap = dbs->getHcalMapping(); + std::vector vhashC34; + vhashC34.push_back(HcalElectronicsId(34, 11, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vhashC34.push_back(HcalElectronicsId(34, 12, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_C34.initialize(filter::fPreserver, hcaldqm::hashfunctions::fCrateSlot, vhashC34); + + std::vector > timingChannels; + timingChannels.push_back(std::pair(28, 63)); + timingChannels.push_back(std::pair(28, 65)); + timingChannels.push_back(std::pair(20, 63)); + timingChannels.push_back(std::pair(20, 65)); + for (int iChan = 0; iChan < 4; ++iChan) { + std::vector vhashTimingChannel; + for (int depth = 1; depth <= 7; ++depth) { + vhashTimingChannel.push_back( + HcalDetId(HcalEndcap, timingChannels[iChan].first, timingChannels[iChan].second, depth)); + } + _filter_timingChannels[iChan].initialize(filter::fPreserver, hcaldqm::hashfunctions::fDChannel, vhashTimingChannel); + } + + // INITIALIZE what you need + + // EChannel plots, online+local only + if (_ptype != fOffline) { + unsigned int itr = 0; + for (unsigned int crate = 34; crate <= 34; ++crate) { + for (unsigned int slot = 11; slot <= 12; ++slot) { + std::vector vhashSlot; + vhashSlot.push_back(HcalElectronicsId(crate, slot, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_slot[itr].initialize(filter::fPreserver, hashfunctions::fCrateSlot, vhashSlot); + _cShapeCut_EChannel[itr].initialize(_name, + "ShapeCut", + hcaldqm::hashfunctions::fEChannel, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000)); + _cLETDCvsTS_EChannel[itr].initialize(_name, + "LETDCvsTS", + hcaldqm::hashfunctions::fEChannel, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cLETDCTime_EChannel[itr].initialize(_name, + "LETDCTime", + hcaldqm::hashfunctions::fEChannel, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + for (unsigned int j = 0; j < 10; j++) { + _cLETDCvsADC_EChannel[j][itr].initialize( + _name, + "LETDCvsADC", + hcaldqm::hashfunctions::fEChannel, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cADC_EChannel[j][itr].initialize(_name, + "ADC", + hcaldqm::hashfunctions::fEChannel, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cLETDC_EChannel[j][itr].initialize(_name, + "LETDC", + hcaldqm::hashfunctions::fEChannel, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + } + ++itr; + } + } + } + _cShapeCut.initialize(_name, + "ShapeCut", + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000)); + _cLETDCvsADC.initialize(_name, + "LETDCvsADC", + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cLETDCTimevsADC.initialize(_name, + "LETDCTimevsADC", + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cLETDC.initialize(_name, + "LETDC", + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cADC.initialize(_name, + "ADC", + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + + if (_ptype != fOffline) { + unsigned int itr = 0; + std::map, unsigned int> itr_map; + for (unsigned int crate = 34; crate <= 34; ++crate) { + for (unsigned int slot = 11; slot <= 12; ++slot) { + char aux[100]; + sprintf(aux, "/Crate%d_Slot%d", crate, slot); + _cShapeCut_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux); + _cLETDCvsTS_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux); + _cLETDCTime_EChannel[itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux); + for (unsigned int j = 0; j < 10; j++) { + char aux2[100]; + sprintf(aux2, "/Crate%d_Slot%d/TS%d", crate, slot, j); + _cLETDCvsADC_EChannel[j][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux2); + _cLETDC_EChannel[j][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux2); + _cADC_EChannel[j][itr].book(ib, _emap, _filter_slot[itr], _subsystem, aux2); + } + itr_map[std::make_pair(crate, slot)] = itr; + ++itr; + } + } + } + _cShapeCut.book(ib, _subsystem); + _cLETDCvsADC.book(ib, _subsystem); + _cLETDCTimevsADC.book(ib, _subsystem); + _cLETDC.book(ib, _subsystem); + _cADC.book(ib, _subsystem); + + _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap, _filter_C34); } -/* virtual */ void QIE11Task::_process(edm::Event const& e, - edm::EventSetup const&) -{ - edm::Handle cqie11; - if (!e.getByToken(_tokQIE11, cqie11)) - return; - - for (uint32_t i=0; isize(); i++) - { - QIE11DataFrame frame = static_cast((*cqie11)[i]); - DetId did = frame.detid(); - if (HcalDetId(frame.detid()).subdet() != HcalEndcap) { - continue; - } - - HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); - if (!eid.rawId()) { - continue; - } - int fakecrate = -1; - if (eid.crateId() == 34) fakecrate = 0; - int index = fakecrate * 12 + (eid.slot() - 10) - 1; - - // compute the signal, ped subracted - CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, frame); -// double q = hcaldqm::utilities::aveTS_v10(frame, -// constants::adc2fC[_ped], 0, frame.samples()-1); - - // iterate thru all TS and fill - for (int j=0; j(_dbService, digi_fC, did, frame, j); - if (_ptype != fOffline) { - if (index == 0 || index == 1) { - // shapes are after the cut - _cShapeCut_EChannel[index].fill(eid, j, q_pedsub); - _cLETDCvsTS_EChannel[index].fill(eid, j, frame[j].tdc()); - - // w/o a cut - _cLETDCvsADC_EChannel[j][index].fill(eid, frame[j].adc(), - frame[j].tdc()); - _cLETDC_EChannel[j][index].fill(eid, frame[j].tdc()); - if (frame[j].tdc() < 50) { - // Each TDC count is 0.5 ns. - // tdc == 62 or 63 means value was below or above threshold for whole time slice. - _cLETDCTime_EChannel[index].fill(eid, j*25. + (frame[j].tdc() / 2.)); - } - _cADC_EChannel[j][index].fill(eid, frame[j].adc()); - } - } - _cShapeCut.fill(eid, j, q_pedsub); - - _cLETDCvsADC.fill(frame[j].adc(), frame[j].tdc()); - if (frame[j].tdc() < 50) { - _cLETDCTimevsADC.fill(frame[j].adc(), j*25. + (frame[j].tdc() / 2.)); - } - _cLETDC.fill(eid, frame[j].tdc()); - - _cADC.fill(eid, frame[j].adc()); - - } - } +/* virtual */ void QIE11Task::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + // finish + DQTask::endLuminosityBlock(lb, es); } +/* virtual */ void QIE11Task::_process(edm::Event const& e, edm::EventSetup const&) { + edm::Handle cqie11; + if (!e.getByToken(_tokQIE11, cqie11)) + return; -/* virtual */ bool QIE11Task::_isApplicable(edm::Event const& e) -{ - if (_ptype!=fOnline || (_laserType < 0 && _eventType < 0)) - return true; - else - { - // fOnline mode - edm::Handle cumn; - if (!e.getByToken(_tokuMN, cumn)) - return false; - - // event type check first - int eventType = cumn->eventType(); - if (eventType==_eventType) - return true; - - // check if this analysis task is of the right laser type - int laserType = cumn->valueUserWord(0); - if (laserType==_laserType) - return true; + for (uint32_t i = 0; i < cqie11->size(); i++) { + QIE11DataFrame frame = static_cast((*cqie11)[i]); + DetId did = frame.detid(); + if (HcalDetId(frame.detid()).subdet() != HcalEndcap) { + continue; } - return false; + HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); + if (!eid.rawId()) { + continue; + } + int fakecrate = -1; + if (eid.crateId() == 34) + fakecrate = 0; + int index = fakecrate * 12 + (eid.slot() - 10) - 1; + + // compute the signal, ped subracted + CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB(_dbService, did, frame); + // double q = hcaldqm::utilities::aveTS_v10(frame, + // constants::adc2fC[_ped], 0, frame.samples()-1); + + // iterate thru all TS and fill + for (int j = 0; j < frame.samples(); j++) { + double q_pedsub = hcaldqm::utilities::adc2fCDBMinusPedestal(_dbService, digi_fC, did, frame, j); + if (_ptype != fOffline) { + if (index == 0 || index == 1) { + // shapes are after the cut + _cShapeCut_EChannel[index].fill(eid, j, q_pedsub); + _cLETDCvsTS_EChannel[index].fill(eid, j, frame[j].tdc()); + + // w/o a cut + _cLETDCvsADC_EChannel[j][index].fill(eid, frame[j].adc(), frame[j].tdc()); + _cLETDC_EChannel[j][index].fill(eid, frame[j].tdc()); + if (frame[j].tdc() < 50) { + // Each TDC count is 0.5 ns. + // tdc == 62 or 63 means value was below or above threshold for whole time slice. + _cLETDCTime_EChannel[index].fill(eid, j * 25. + (frame[j].tdc() / 2.)); + } + _cADC_EChannel[j][index].fill(eid, frame[j].adc()); + } + } + _cShapeCut.fill(eid, j, q_pedsub); + + _cLETDCvsADC.fill(frame[j].adc(), frame[j].tdc()); + if (frame[j].tdc() < 50) { + _cLETDCTimevsADC.fill(frame[j].adc(), j * 25. + (frame[j].tdc() / 2.)); + } + _cLETDC.fill(eid, frame[j].tdc()); + + _cADC.fill(eid, frame[j].adc()); + } + } } +/* virtual */ bool QIE11Task::_isApplicable(edm::Event const& e) { + if (_ptype != fOnline || (_laserType < 0 && _eventType < 0)) + return true; + else { + // fOnline mode + edm::Handle cumn; + if (!e.getByToken(_tokuMN, cumn)) + return false; + + // event type check first + int eventType = cumn->eventType(); + if (eventType == _eventType) + return true; + + // check if this analysis task is of the right laser type + int laserType = cumn->valueUserWord(0); + if (laserType == _laserType) + return true; + } -/* virtual */ void QIE11Task::_resetMonitors(hcaldqm::UpdateFreq) -{ + return false; } +/* virtual */ void QIE11Task::_resetMonitors(hcaldqm::UpdateFreq) {} + DEFINE_FWK_MODULE(QIE11Task); diff --git a/DQM/HcalTasks/plugins/RawTask.cc b/DQM/HcalTasks/plugins/RawTask.cc index c5bfdf91d206b..a17bfac293531 100644 --- a/DQM/HcalTasks/plugins/RawTask.cc +++ b/DQM/HcalTasks/plugins/RawTask.cc @@ -1,525 +1,486 @@ #include "DQM/HcalTasks/interface/RawTask.h" - using namespace hcaldqm; using namespace hcaldqm::constants; -RawTask::RawTask(edm::ParameterSet const& ps): - DQTask(ps) -{ - _tagFEDs = ps.getUntrackedParameter("tagFEDs", - edm::InputTag("rawDataCollector")); - _tagReport = ps.getUntrackedParameter("tagReport", - edm::InputTag("hcalDigis")); - _calibProcessing = ps.getUntrackedParameter("calibProcessing", - false); - _thresh_calib_nbadq = ps.getUntrackedParameter("thresh_calib_nbadq", - 5000); - - _tokFEDs = consumes(_tagFEDs); - _tokReport = consumes(_tagReport); - - _vflags.resize(nRawFlag); - _vflags[fEvnMsm]=flag::Flag("EvnMsm"); - _vflags[fBcnMsm]=flag::Flag("BcnMsm"); - _vflags[fBadQ]=flag::Flag("BadQ"); - _vflags[fOrnMsm]=flag::Flag("OrnMsm"); +RawTask::RawTask(edm::ParameterSet const& ps) : DQTask(ps) { + _tagFEDs = ps.getUntrackedParameter("tagFEDs", edm::InputTag("rawDataCollector")); + _tagReport = ps.getUntrackedParameter("tagReport", edm::InputTag("hcalDigis")); + _calibProcessing = ps.getUntrackedParameter("calibProcessing", false); + _thresh_calib_nbadq = ps.getUntrackedParameter("thresh_calib_nbadq", 5000); + + _tokFEDs = consumes(_tagFEDs); + _tokReport = consumes(_tagReport); + + _vflags.resize(nRawFlag); + _vflags[fEvnMsm] = flag::Flag("EvnMsm"); + _vflags[fBcnMsm] = flag::Flag("BcnMsm"); + _vflags[fBadQ] = flag::Flag("BadQ"); + _vflags[fOrnMsm] = flag::Flag("OrnMsm"); } -/* virtual */ void RawTask::bookHistograms(DQMStore::IBooker& ib, - edm::Run const& r, edm::EventSetup const& es) -{ - DQTask::bookHistograms(ib,r,es); - - // GET WHAT YOU NEED - edm::ESHandle dbs; - es.get().get(dbs); - _emap = dbs->getHcalMapping(); - std::vector vVME; - std::vector vuTCA; - vVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); - vuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vVME); - _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vuTCA); - - _cBadQualityvsLS.initialize(_name, "BadQualityvsLS", - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_m0to10000),0); - _cBadQualityvsBX.initialize(_name, "BadQualityvsBX", - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_m0to10000),0); - _cBadQuality_depth.initialize(_name, "BadQuality", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - // FED-based plots - if (_ptype != fOffline) { // hidefed2crate - std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); - std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); - std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); - - std::vector vhashFEDsVME; - std::vector vhashFEDsuTCA; - - for (std::vector::const_iterator it=vFEDsVME.begin(); - it!=vFEDsVME.end(); ++it) - { - vhashFEDsVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - constants::FIBER_VME_MIN, SPIGOT_MIN, - (*it)-constants::FED_VME_MIN).rawId()); - _vhashFEDs.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - constants::FIBER_VME_MIN, SPIGOT_MIN, - (*it)-constants::FED_VME_MIN).rawId()); - } - for (std::vector::const_iterator it=vFEDsuTCA.begin(); - it!=vFEDsuTCA.end(); ++it) - { - std::pair cspair = utilities::fed2crate(*it); - vhashFEDsuTCA.push_back(HcalElectronicsId( - cspair.first, cspair.second, FIBER_uTCA_MIN1, - FIBERCH_MIN, false).rawId()); - _vhashFEDs.push_back(HcalElectronicsId( - cspair.first, cspair.second, FIBER_uTCA_MIN1, - FIBERCH_MIN, false).rawId()); - } - _filter_FEDsVME.initialize(filter::fPreserver, - hcaldqm::hashfunctions::fFED, vhashFEDsVME); - _filter_FEDsuTCA.initialize(filter::fPreserver, - hcaldqm::hashfunctions::fFED, vhashFEDsuTCA); - - // INITIALIZE FIRST - _cEvnMsm_ElectronicsVME.initialize(_name, "EvnMsm", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cBcnMsm_ElectronicsVME.initialize(_name, "BcnMsm", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOrnMsm_ElectronicsVME.initialize(_name, "OrnMsm", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cEvnMsm_ElectronicsuTCA.initialize(_name, "EvnMsm", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cBcnMsm_ElectronicsuTCA.initialize(_name, "BcnMsm", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOrnMsm_ElectronicsuTCA.initialize(_name, "OrnMsm", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - // Bad Quality - _cBadQuality_FEDVME.initialize(_name, "BadQuality", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cBadQuality_FEDuTCA.initialize(_name, "BadQuality", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - // Online only - if (_ptype==fOnline) - { - _xEvnMsmLS.initialize(hcaldqm::hashfunctions::fFED); - _xBcnMsmLS.initialize(hcaldqm::hashfunctions::fFED); - _xOrnMsmLS.initialize(hcaldqm::hashfunctions::fFED); - _xBadQLS.initialize(hcaldqm::hashfunctions::fFED); - _cSummaryvsLS_FED.initialize(_name, "SummaryvsLS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::FlagQuantity(_vflags), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),0); - _cSummaryvsLS.initialize(_name, "SummaryvsLS", - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::FEDQuantity(vFEDs), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),0); - // FED Size vs LS - _cDataSizevsLS_FED.initialize(_name, "DataSizevsLS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDataSize),0); - } - - } - - - // BOOK HISTOGRAMS - if (_ptype != fOffline) { - _cEvnMsm_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cBcnMsm_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cOrnMsm_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cEvnMsm_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cBcnMsm_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cOrnMsm_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); - - _cBadQuality_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cBadQuality_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - } - _cBadQuality_depth.book(ib, _emap, _subsystem); - _cBadQualityvsLS.book(ib, _subsystem); - _cBadQualityvsBX.book(ib, _subsystem); - - // BOOK HISTOGRAMS to be used in ONLINE ONLY! - if (_ptype==fOnline) - { - _xEvnMsmLS.book(_emap); - _xBcnMsmLS.book(_emap); - _xOrnMsmLS.book(_emap); - _xBadQLS.book(_emap); - _cSummaryvsLS_FED.book(ib, _emap, _subsystem); - _cSummaryvsLS.book(ib, _subsystem); - _cDataSizevsLS_FED.book(ib, _emap, _subsystem); - } - - // FOR OFFLINE PROCESSING MARK THESE HISTOGRAMS AS LUMI BASED - if (_ptype==fOffline) - { - if (_ptype != fOffline) { // hidefed2crate - // Note that this is deliberately contradictory for the fed2crate fix, so it can be reversed if fed2crate is ever fixed properly, - _cEvnMsm_ElectronicsVME.setLumiFlag(); - _cBcnMsm_ElectronicsVME.setLumiFlag(); - _cEvnMsm_ElectronicsuTCA.setLumiFlag(); - _cBcnMsm_ElectronicsuTCA.setLumiFlag(); - } - _cBadQuality_depth.setLumiFlag(); - } - - // initialize hash map - _ehashmap.initialize(_emap, hcaldqm::electronicsmap::fD2EHashMap); +/* virtual */ void RawTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + DQTask::bookHistograms(ib, r, es); + + // GET WHAT YOU NEED + edm::ESHandle dbs; + es.get().get(dbs); + _emap = dbs->getHcalMapping(); + std::vector vVME; + std::vector vuTCA; + vVME.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); + vuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vVME); + _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vuTCA); + + _cBadQualityvsLS.initialize(_name, + "BadQualityvsLS", + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_m0to10000), + 0); + _cBadQualityvsBX.initialize(_name, + "BadQualityvsBX", + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_m0to10000), + 0); + _cBadQuality_depth.initialize(_name, + "BadQuality", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + // FED-based plots + if (_ptype != fOffline) { // hidefed2crate + std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); + std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); + std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); + + std::vector vhashFEDsVME; + std::vector vhashFEDsuTCA; + + for (std::vector::const_iterator it = vFEDsVME.begin(); it != vFEDsVME.end(); ++it) { + vhashFEDsVME.push_back( + HcalElectronicsId( + constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, (*it) - constants::FED_VME_MIN) + .rawId()); + _vhashFEDs.push_back( + HcalElectronicsId( + constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, (*it) - constants::FED_VME_MIN) + .rawId()); + } + for (std::vector::const_iterator it = vFEDsuTCA.begin(); it != vFEDsuTCA.end(); ++it) { + std::pair cspair = utilities::fed2crate(*it); + vhashFEDsuTCA.push_back( + HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _vhashFEDs.push_back(HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + } + _filter_FEDsVME.initialize(filter::fPreserver, hcaldqm::hashfunctions::fFED, vhashFEDsVME); + _filter_FEDsuTCA.initialize(filter::fPreserver, hcaldqm::hashfunctions::fFED, vhashFEDsuTCA); + + // INITIALIZE FIRST + _cEvnMsm_ElectronicsVME.initialize(_name, + "EvnMsm", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cBcnMsm_ElectronicsVME.initialize(_name, + "BcnMsm", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOrnMsm_ElectronicsVME.initialize(_name, + "OrnMsm", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cEvnMsm_ElectronicsuTCA.initialize(_name, + "EvnMsm", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cBcnMsm_ElectronicsuTCA.initialize(_name, + "BcnMsm", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOrnMsm_ElectronicsuTCA.initialize(_name, + "OrnMsm", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + // Bad Quality + _cBadQuality_FEDVME.initialize(_name, + "BadQuality", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cBadQuality_FEDuTCA.initialize(_name, + "BadQuality", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + // Online only + if (_ptype == fOnline) { + _xEvnMsmLS.initialize(hcaldqm::hashfunctions::fFED); + _xBcnMsmLS.initialize(hcaldqm::hashfunctions::fFED); + _xOrnMsmLS.initialize(hcaldqm::hashfunctions::fFED); + _xBadQLS.initialize(hcaldqm::hashfunctions::fFED); + _cSummaryvsLS_FED.initialize(_name, + "SummaryvsLS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::FlagQuantity(_vflags), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState), + 0); + _cSummaryvsLS.initialize(_name, + "SummaryvsLS", + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::FEDQuantity(vFEDs), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState), + 0); + // FED Size vs LS + _cDataSizevsLS_FED.initialize(_name, + "DataSizevsLS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDataSize), + 0); + } + } + + // BOOK HISTOGRAMS + if (_ptype != fOffline) { + _cEvnMsm_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cBcnMsm_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOrnMsm_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cEvnMsm_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cBcnMsm_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cOrnMsm_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + + _cBadQuality_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cBadQuality_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + } + _cBadQuality_depth.book(ib, _emap, _subsystem); + _cBadQualityvsLS.book(ib, _subsystem); + _cBadQualityvsBX.book(ib, _subsystem); + + // BOOK HISTOGRAMS to be used in ONLINE ONLY! + if (_ptype == fOnline) { + _xEvnMsmLS.book(_emap); + _xBcnMsmLS.book(_emap); + _xOrnMsmLS.book(_emap); + _xBadQLS.book(_emap); + _cSummaryvsLS_FED.book(ib, _emap, _subsystem); + _cSummaryvsLS.book(ib, _subsystem); + _cDataSizevsLS_FED.book(ib, _emap, _subsystem); + } + + // FOR OFFLINE PROCESSING MARK THESE HISTOGRAMS AS LUMI BASED + if (_ptype == fOffline) { + if (_ptype != fOffline) { // hidefed2crate + // Note that this is deliberately contradictory for the fed2crate fix, so it can be reversed if fed2crate is ever fixed properly, + _cEvnMsm_ElectronicsVME.setLumiFlag(); + _cBcnMsm_ElectronicsVME.setLumiFlag(); + _cEvnMsm_ElectronicsuTCA.setLumiFlag(); + _cBcnMsm_ElectronicsuTCA.setLumiFlag(); + } + _cBadQuality_depth.setLumiFlag(); + } + + // initialize hash map + _ehashmap.initialize(_emap, hcaldqm::electronicsmap::fD2EHashMap); } -/* virtual */ void RawTask::_resetMonitors(hcaldqm::UpdateFreq uf) -{ - // base reset - DQTask::_resetMonitors(uf); +/* virtual */ void RawTask::_resetMonitors(hcaldqm::UpdateFreq uf) { + // base reset + DQTask::_resetMonitors(uf); } -/* virtual */ void RawTask::_process(edm::Event const& e, - edm::EventSetup const&) -{ - edm::Handle craw; - edm::Handle creport; - if (!e.getByToken(_tokFEDs, craw)) - _logger.dqmthrow("Collection FEDRawDataCollection isn't available"+ - _tagFEDs.label()+" " +_tagFEDs.instance()); - if (!e.getByToken(_tokReport, creport)) - _logger.dqmthrow("Collection HcalUnpackerReport isn't available"+ - _tagReport.label()+" " +_tagReport.instance()); - - // extract some info - int bx = e.bunchCrossing(); - - /* +/* virtual */ void RawTask::_process(edm::Event const& e, edm::EventSetup const&) { + edm::Handle craw; + edm::Handle creport; + if (!e.getByToken(_tokFEDs, craw)) + _logger.dqmthrow("Collection FEDRawDataCollection isn't available" + _tagFEDs.label() + " " + _tagFEDs.instance()); + if (!e.getByToken(_tokReport, creport)) + _logger.dqmthrow("Collection HcalUnpackerReport isn't available" + _tagReport.label() + " " + + _tagReport.instance()); + + // extract some info + int bx = e.bunchCrossing(); + + /* * For Calibration/Abort Gap Processing * check if the #channels taht are bad from the unpacker * is > 5000. If it is skip... */ - if (_calibProcessing) - { - int nbadq = creport->badQualityDigis(); - if (nbadq>=_thresh_calib_nbadq) - return; - } - - int nn = 0; - // loop thru and fill the detIds with bad quality - // NOTE: Calibration Channels are skipped! - // TODO: Include for Online Calibration Channels marked as bad - // a comment below is left on purpose! - //_cBadQualityvsBX.fill(bx, creport->badQualityDigis()); - for (std::vector::const_iterator it=creport->bad_quality_begin(); - it!=creport->bad_quality_end(); ++it) - { - // skip non HCAL det ids - if (!HcalGenericDetId(*it).isHcalDetId()) - continue; - - // skip those that are of bad quality from conditions - // Masked or Dead - if (_xQuality.exists(HcalDetId(*it))) - { - HcalChannelStatus cs(it->rawId(), _xQuality.get(HcalDetId(*it))); - if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || - cs.isBitSet(HcalChannelStatus::HcalCellDead)) - continue; - } - - nn++; - HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(*it)); - _cBadQuality_depth.fill(HcalDetId(*it)); - // ONLINE ONLY! - if (_ptype==fOnline) - _xBadQLS.get(eid)++; - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - { - if (_filter_FEDsVME.filter(eid)) - continue; - _cBadQuality_FEDVME.fill(eid); - } - else - { - if (_filter_FEDsuTCA.filter(eid)) - continue; - _cBadQuality_FEDuTCA.fill(eid); - } - } - } - _cBadQualityvsLS.fill(_currentLS,nn); - _cBadQualityvsBX.fill(bx, nn); - - if (_ptype != fOffline) { // hidefed2crate - for (int fed=FEDNumbering::MINHCALFEDID; fed<=FEDNumbering::MAXHCALuTCAFEDID; fed++) { - // skip nonHCAL FEDs - if ((fed>FEDNumbering::MAXHCALFEDID && - fedFEDNumbering::MAXHCALuTCAFEDID) - continue; - FEDRawData const& raw = craw->FEDData(fed); - if (raw.size()getBunchId(); - uint32_t orn = hdcc->getOrbitNumber() & 0x1F; // LS 5 bits only - uint32_t evn = hdcc->getDCCEventNumber(); - int dccId = hdcc->getSourceId()-constants::FED_VME_MIN; - - /* online only */ - if (_ptype==fOnline) - { - HcalElectronicsId eid = HcalElectronicsId(constants::FIBERCH_MIN, - constants::FIBER_VME_MIN, constants::SPIGOT_MIN, dccId); - if (_filter_FEDsVME.filter(eid)) - continue; - _cDataSizevsLS_FED.fill(eid, _currentLS, double(raw.size())/1024.); - } - - // iterate over spigots - HcalHTRData htr; - for (int is=0; isgetSpigotData(is, htr, raw.size()); - if (r!=0 || !htr.check()) - continue; - HcalElectronicsId eid = HcalElectronicsId( - constants::FIBERCH_MIN, constants::FIBER_VME_MIN, - is, dccId); - if (_filter_FEDsVME.filter(eid)) - continue; - - uint32_t htr_evn = htr.getL1ANumber(); - uint32_t htr_orn = htr.getOrbitNumber(); - uint32_t htr_bcn = htr.getBunchNumber(); - bool qevn = (htr_evn!=evn); - bool qbcn = (htr_bcn!=bcn); - bool qorn = (htr_orn!=orn); - if (qevn) - { - _cEvnMsm_ElectronicsVME.fill(eid); - - if (_ptype==fOnline && is<=constants::SPIGOT_MAX) - _xEvnMsmLS.get(eid)++; - } - if (qorn) - { - _cOrnMsm_ElectronicsVME.fill(eid); - - if (_ptype==fOnline && is<=constants::SPIGOT_MAX) - _xOrnMsmLS.get(eid)++; - } - if (qbcn) - { - _cBcnMsm_ElectronicsVME.fill(eid); - - if (_ptype==fOnline && is<=constants::SPIGOT_MAX) - _xBcnMsmLS.get(eid)++; - } - } - } - else // uTCA - { - hcal::AMC13Header const* hamc13 = (hcal::AMC13Header const*) - raw.data(); - if (!hamc13) - continue; - - /* online only */ - if (_ptype==fOnline) - { - std::pair cspair = utilities::fed2crate(fed); - HcalElectronicsId eid = HcalElectronicsId(cspair.first, - cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false); - if (_filter_FEDsuTCA.filter(eid)) - continue; - _cDataSizevsLS_FED.fill(eid, _currentLS, double(raw.size())/1024.); - } - - uint32_t bcn = hamc13->bunchId(); - uint32_t orn = hamc13->orbitNumber() & 0xFFFF; // LS 16bits only - uint32_t evn = hamc13->l1aNumber(); - int namc = hamc13->NAMC(); - - for (int iamc=0; iamcAMCSlot(iamc); - int crate = hamc13->AMCId(iamc)&0xFF; - HcalElectronicsId eid(crate, slot, FIBER_uTCA_MIN1, - FIBERCH_MIN, false); - if (_filter_FEDsuTCA.filter(eid)) - continue; - HcalUHTRData uhtr(hamc13->AMCPayload(iamc), - hamc13->AMCSize(iamc)); - - uint32_t uhtr_evn = uhtr.l1ANumber(); - uint32_t uhtr_bcn = uhtr.bunchNumber(); - uint32_t uhtr_orn = uhtr.orbitNumber(); - bool qevn = (uhtr_evn!=evn); - bool qbcn = (uhtr_bcn!=bcn); - bool qorn = (uhtr_orn!=orn); - if (qevn) - { - _cEvnMsm_ElectronicsuTCA.fill(eid); - - if (_ptype==fOnline) - _xEvnMsmLS.get(eid)++; - } - if (qorn) - { - _cOrnMsm_ElectronicsuTCA.fill(eid); - - if (_ptype==fOnline) - _xOrnMsmLS.get(eid)++; - } - if (qbcn) - { - _cBcnMsm_ElectronicsuTCA.fill(eid); - - if (_ptype==fOnline) - _xBcnMsmLS.get(eid)++; - } - } - } - } - } + if (_calibProcessing) { + int nbadq = creport->badQualityDigis(); + if (nbadq >= _thresh_calib_nbadq) + return; + } + + int nn = 0; + // loop thru and fill the detIds with bad quality + // NOTE: Calibration Channels are skipped! + // TODO: Include for Online Calibration Channels marked as bad + // a comment below is left on purpose! + //_cBadQualityvsBX.fill(bx, creport->badQualityDigis()); + for (std::vector::const_iterator it = creport->bad_quality_begin(); it != creport->bad_quality_end(); ++it) { + // skip non HCAL det ids + if (!HcalGenericDetId(*it).isHcalDetId()) + continue; + + // skip those that are of bad quality from conditions + // Masked or Dead + if (_xQuality.exists(HcalDetId(*it))) { + HcalChannelStatus cs(it->rawId(), _xQuality.get(HcalDetId(*it))); + if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead)) + continue; + } + + nn++; + HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(*it)); + _cBadQuality_depth.fill(HcalDetId(*it)); + // ONLINE ONLY! + if (_ptype == fOnline) + _xBadQLS.get(eid)++; + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) { + if (_filter_FEDsVME.filter(eid)) + continue; + _cBadQuality_FEDVME.fill(eid); + } else { + if (_filter_FEDsuTCA.filter(eid)) + continue; + _cBadQuality_FEDuTCA.fill(eid); + } + } + } + _cBadQualityvsLS.fill(_currentLS, nn); + _cBadQualityvsBX.fill(bx, nn); + + if (_ptype != fOffline) { // hidefed2crate + for (int fed = FEDNumbering::MINHCALFEDID; fed <= FEDNumbering::MAXHCALuTCAFEDID; fed++) { + // skip nonHCAL FEDs + if ((fed > FEDNumbering::MAXHCALFEDID && fed < FEDNumbering::MINHCALuTCAFEDID) || + fed > FEDNumbering::MAXHCALuTCAFEDID) + continue; + FEDRawData const& raw = craw->FEDData(fed); + if (raw.size() < constants::RAW_EMPTY) + continue; + + if (fed <= FEDNumbering::MAXHCALFEDID) // VME + { + HcalDCCHeader const* hdcc = (HcalDCCHeader const*)(raw.data()); + if (!hdcc) + continue; + + uint32_t bcn = hdcc->getBunchId(); + uint32_t orn = hdcc->getOrbitNumber() & 0x1F; // LS 5 bits only + uint32_t evn = hdcc->getDCCEventNumber(); + int dccId = hdcc->getSourceId() - constants::FED_VME_MIN; + + /* online only */ + if (_ptype == fOnline) { + HcalElectronicsId eid = + HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, constants::SPIGOT_MIN, dccId); + if (_filter_FEDsVME.filter(eid)) + continue; + _cDataSizevsLS_FED.fill(eid, _currentLS, double(raw.size()) / 1024.); + } + + // iterate over spigots + HcalHTRData htr; + for (int is = 0; is < HcalDCCHeader::SPIGOT_COUNT; is++) { + int r = hdcc->getSpigotData(is, htr, raw.size()); + if (r != 0 || !htr.check()) + continue; + HcalElectronicsId eid = HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, is, dccId); + if (_filter_FEDsVME.filter(eid)) + continue; + + uint32_t htr_evn = htr.getL1ANumber(); + uint32_t htr_orn = htr.getOrbitNumber(); + uint32_t htr_bcn = htr.getBunchNumber(); + bool qevn = (htr_evn != evn); + bool qbcn = (htr_bcn != bcn); + bool qorn = (htr_orn != orn); + if (qevn) { + _cEvnMsm_ElectronicsVME.fill(eid); + + if (_ptype == fOnline && is <= constants::SPIGOT_MAX) + _xEvnMsmLS.get(eid)++; + } + if (qorn) { + _cOrnMsm_ElectronicsVME.fill(eid); + + if (_ptype == fOnline && is <= constants::SPIGOT_MAX) + _xOrnMsmLS.get(eid)++; + } + if (qbcn) { + _cBcnMsm_ElectronicsVME.fill(eid); + + if (_ptype == fOnline && is <= constants::SPIGOT_MAX) + _xBcnMsmLS.get(eid)++; + } + } + } else // uTCA + { + hcal::AMC13Header const* hamc13 = (hcal::AMC13Header const*)raw.data(); + if (!hamc13) + continue; + + /* online only */ + if (_ptype == fOnline) { + std::pair cspair = utilities::fed2crate(fed); + HcalElectronicsId eid = HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false); + if (_filter_FEDsuTCA.filter(eid)) + continue; + _cDataSizevsLS_FED.fill(eid, _currentLS, double(raw.size()) / 1024.); + } + + uint32_t bcn = hamc13->bunchId(); + uint32_t orn = hamc13->orbitNumber() & 0xFFFF; // LS 16bits only + uint32_t evn = hamc13->l1aNumber(); + int namc = hamc13->NAMC(); + + for (int iamc = 0; iamc < namc; iamc++) { + int slot = hamc13->AMCSlot(iamc); + int crate = hamc13->AMCId(iamc) & 0xFF; + HcalElectronicsId eid(crate, slot, FIBER_uTCA_MIN1, FIBERCH_MIN, false); + if (_filter_FEDsuTCA.filter(eid)) + continue; + HcalUHTRData uhtr(hamc13->AMCPayload(iamc), hamc13->AMCSize(iamc)); + + uint32_t uhtr_evn = uhtr.l1ANumber(); + uint32_t uhtr_bcn = uhtr.bunchNumber(); + uint32_t uhtr_orn = uhtr.orbitNumber(); + bool qevn = (uhtr_evn != evn); + bool qbcn = (uhtr_bcn != bcn); + bool qorn = (uhtr_orn != orn); + if (qevn) { + _cEvnMsm_ElectronicsuTCA.fill(eid); + + if (_ptype == fOnline) + _xEvnMsmLS.get(eid)++; + } + if (qorn) { + _cOrnMsm_ElectronicsuTCA.fill(eid); + + if (_ptype == fOnline) + _xOrnMsmLS.get(eid)++; + } + if (qbcn) { + _cBcnMsm_ElectronicsuTCA.fill(eid); + + if (_ptype == fOnline) + _xBcnMsmLS.get(eid)++; + } + } + } + } + } } -/* virtual */ void RawTask::beginLuminosityBlock(edm::LuminosityBlock const& lb, - edm::EventSetup const& es) -{ - DQTask::beginLuminosityBlock(lb, es); +/* virtual */ void RawTask::beginLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + DQTask::beginLuminosityBlock(lb, es); -// _cBadQualityvsLS.extendAxisRange(_currentLS); + // _cBadQualityvsLS.extendAxisRange(_currentLS); - // ONLINE ONLY! - if (_ptype!=fOnline) - return; -// _cSummaryvsLS_FED.extendAxisRange(_currentLS); -// _cSummaryvsLS.extendAxisRange(_currentLS); - + // ONLINE ONLY! + if (_ptype != fOnline) + return; + // _cSummaryvsLS_FED.extendAxisRange(_currentLS); + // _cSummaryvsLS.extendAxisRange(_currentLS); } -/* virtual */ void RawTask::endLuminosityBlock(edm::LuminosityBlock const& lb, - edm::EventSetup const& es) -{ - if (_ptype!=fOnline) - return; - - // - // GENERATE STATUS ONLY FOR ONLINE! - // - for (std::vector::const_iterator it=_vhashFEDs.begin(); - it!=_vhashFEDs.end(); ++it) - { - flag::Flag fSum("RAW"); - HcalElectronicsId eid = HcalElectronicsId(*it); - - std::vector::const_iterator cit=std::find( - _vcdaqEids.begin(), _vcdaqEids.end(), *it); - if (cit==_vcdaqEids.end()) - { - // not @cDAQ - for (uint32_t iflag=0; iflag<_vflags.size(); iflag++) - _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), - int(flag::fNCDAQ)); - _cSummaryvsLS.setBinContent(eid, _currentLS, int(flag::fNCDAQ)); - continue; - } - - // FED is @cDAQ - if (hcaldqm::utilities::isFEDHBHE(eid) || hcaldqm::utilities::isFEDHF(eid) || - hcaldqm::utilities::isFEDHO(eid)) - { - if (_xEvnMsmLS.get(eid)>0) - _vflags[fEvnMsm]._state = flag::fBAD; - else - _vflags[fEvnMsm]._state = flag::fGOOD; - if (_xBcnMsmLS.get(eid)>0) - _vflags[fBcnMsm]._state = flag::fBAD; - else - _vflags[fBcnMsm]._state = flag::fGOOD; - if (_xOrnMsmLS.get(eid)>0) - _vflags[fOrnMsm]._state = flag::fBAD; - else - _vflags[fOrnMsm]._state = flag::fGOOD; - if (double(_xBadQLS.get(eid))>double(12*_evsPerLS)) - _vflags[fBadQ]._state = flag::fBAD; - else if (_xBadQLS.get(eid)>0) - _vflags[fBadQ]._state = flag::fPROBLEMATIC; - else - _vflags[fBadQ]._state = flag::fGOOD; - } - - int iflag=0; - // iterate over all flags: - // - sum them all up in summary flag for this FED - // - reset each flag right after using it - for (std::vector::iterator ft=_vflags.begin(); - ft!=_vflags.end(); ++ft) - { - _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), - ft->_state); - fSum+=(*ft); - iflag++; - - // this is the MUST! We don't keep flags per FED, reset - // each one of them after using - ft->reset(); - } - _cSummaryvsLS.setBinContent(eid, _currentLS, fSum._state); - } - - // reset... - _xOrnMsmLS.reset(); _xEvnMsmLS.reset(); _xBcnMsmLS.reset(); _xBadQLS.reset(); - - // in the end always do the DQTask::endLumi - DQTask::endLuminosityBlock(lb, es); +/* virtual */ void RawTask::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + if (_ptype != fOnline) + return; + + // + // GENERATE STATUS ONLY FOR ONLINE! + // + for (std::vector::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) { + flag::Flag fSum("RAW"); + HcalElectronicsId eid = HcalElectronicsId(*it); + + std::vector::const_iterator cit = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), *it); + if (cit == _vcdaqEids.end()) { + // not @cDAQ + for (uint32_t iflag = 0; iflag < _vflags.size(); iflag++) + _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), int(flag::fNCDAQ)); + _cSummaryvsLS.setBinContent(eid, _currentLS, int(flag::fNCDAQ)); + continue; + } + + // FED is @cDAQ + if (hcaldqm::utilities::isFEDHBHE(eid) || hcaldqm::utilities::isFEDHF(eid) || hcaldqm::utilities::isFEDHO(eid)) { + if (_xEvnMsmLS.get(eid) > 0) + _vflags[fEvnMsm]._state = flag::fBAD; + else + _vflags[fEvnMsm]._state = flag::fGOOD; + if (_xBcnMsmLS.get(eid) > 0) + _vflags[fBcnMsm]._state = flag::fBAD; + else + _vflags[fBcnMsm]._state = flag::fGOOD; + if (_xOrnMsmLS.get(eid) > 0) + _vflags[fOrnMsm]._state = flag::fBAD; + else + _vflags[fOrnMsm]._state = flag::fGOOD; + if (double(_xBadQLS.get(eid)) > double(12 * _evsPerLS)) + _vflags[fBadQ]._state = flag::fBAD; + else if (_xBadQLS.get(eid) > 0) + _vflags[fBadQ]._state = flag::fPROBLEMATIC; + else + _vflags[fBadQ]._state = flag::fGOOD; + } + + int iflag = 0; + // iterate over all flags: + // - sum them all up in summary flag for this FED + // - reset each flag right after using it + for (std::vector::iterator ft = _vflags.begin(); ft != _vflags.end(); ++ft) { + _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), ft->_state); + fSum += (*ft); + iflag++; + + // this is the MUST! We don't keep flags per FED, reset + // each one of them after using + ft->reset(); + } + _cSummaryvsLS.setBinContent(eid, _currentLS, fSum._state); + } + + // reset... + _xOrnMsmLS.reset(); + _xEvnMsmLS.reset(); + _xBcnMsmLS.reset(); + _xBadQLS.reset(); + + // in the end always do the DQTask::endLumi + DQTask::endLuminosityBlock(lb, es); } DEFINE_FWK_MODULE(RawTask); - diff --git a/DQM/HcalTasks/plugins/RecHitTask.cc b/DQM/HcalTasks/plugins/RecHitTask.cc index 5362a39f9d7ef..cbbb51d369206 100644 --- a/DQM/HcalTasks/plugins/RecHitTask.cc +++ b/DQM/HcalTasks/plugins/RecHitTask.cc @@ -5,939 +5,936 @@ using namespace hcaldqm; using namespace hcaldqm::constants; using namespace hcaldqm::filter; -RecHitTask::RecHitTask(edm::ParameterSet const& ps): - DQTask(ps) -{ - _tagHBHE = ps.getUntrackedParameter("tagHBHE", - edm::InputTag("hbhereco")); - _tagHO = ps.getUntrackedParameter("tagHO", - edm::InputTag("horeco")); - _tagHF = ps.getUntrackedParameter("tagHF", - edm::InputTag("hfreco")); - _tagPreHF = ps.getUntrackedParameter("tagPreHF", - edm::InputTag("")); - _hfPreRecHitsAvailable = ps.getUntrackedParameter("hfPreRecHitsAvailable", false); - - _tokHBHE = consumes(_tagHBHE); - _tokHO = consumes(_tagHO); - _tokHF = consumes(_tagHF); - _tokPreHF = consumes(_tagPreHF); - - _cutE_HBHE = ps.getUntrackedParameter("cutE_HBHE", 5); - _cutE_HO = ps.getUntrackedParameter("cutE_HO", 5); - _cutE_HF = ps.getUntrackedParameter("cutE_HF", 5); - _thresh_unihf = ps.getUntrackedParameter("thresh_unihf", 0.2); - - // order must be the same as in RecoFlag enum - _vflags.resize(nRecoFlag); - _vflags[fUni]=flag::Flag("UniSlotHF"); - _vflags[fTCDS]=flag::Flag("TCDS"); - _vflags[fUnknownIds] = flag::Flag("UnknownIds"); +RecHitTask::RecHitTask(edm::ParameterSet const& ps) : DQTask(ps) { + _tagHBHE = ps.getUntrackedParameter("tagHBHE", edm::InputTag("hbhereco")); + _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("horeco")); + _tagHF = ps.getUntrackedParameter("tagHF", edm::InputTag("hfreco")); + _tagPreHF = ps.getUntrackedParameter("tagPreHF", edm::InputTag("")); + _hfPreRecHitsAvailable = ps.getUntrackedParameter("hfPreRecHitsAvailable", false); + + _tokHBHE = consumes(_tagHBHE); + _tokHO = consumes(_tagHO); + _tokHF = consumes(_tagHF); + _tokPreHF = consumes(_tagPreHF); + + _cutE_HBHE = ps.getUntrackedParameter("cutE_HBHE", 5); + _cutE_HO = ps.getUntrackedParameter("cutE_HO", 5); + _cutE_HF = ps.getUntrackedParameter("cutE_HF", 5); + _thresh_unihf = ps.getUntrackedParameter("thresh_unihf", 0.2); + + // order must be the same as in RecoFlag enum + _vflags.resize(nRecoFlag); + _vflags[fUni] = flag::Flag("UniSlotHF"); + _vflags[fTCDS] = flag::Flag("TCDS"); + _vflags[fUnknownIds] = flag::Flag("UnknownIds"); } -/* virtual */ void RecHitTask::bookHistograms(DQMStore::IBooker& ib, - edm::Run const& r, edm::EventSetup const& es) -{ - DQTask::bookHistograms(ib,r,es); - - // GET WHAT YOU NEED - edm::ESHandle dbs; - es.get().get(dbs); - _emap = dbs->getHcalMapping(); - - std::vector vVME; - std::vector vuTCA; - vVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); - vuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vVME); - _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vuTCA); - std::vector vhashHF; - vhashHF.push_back(hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalForward, 29,1,1))); - - _filter_HF.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdet, vhashHF); - - // INITIALIZE FIRST - // Energy - _cEnergy_Subdet.initialize(_name, "Energy", hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cEnergy_depth.initialize(_name, "Energy", hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy, true),0); - - // Timing - _cTimingCut_SubdetPM.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cTimingvsEnergy_SubdetPM.initialize(_name, "TimingvsEnergy", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy, true), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - - _cTimingCut_HBHEPartition.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fHBHEPartition, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cTimingCut_depth.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),0); - _cTimingCutvsLS_SubdetPM.initialize(_name, "TimingCutvsLS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),0); - - // Occupancy - _cOccupancy_depth.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - _cOccupancyvsLS_Subdet.initialize(_name, "OccupancyvsLS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),0); - - _cOccupancyCut_depth.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - if (_hfPreRecHitsAvailable) { - _cDAAsymmetryVsCharge_SubdetPM.initialize(_name, "ChargeVsAsymmetry", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDualAnodeAsymmetry), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cDAAsymmetryMean_cut_depth.initialize(_name, "AsymmetryMean", - hcaldqm::hashfunctions::fdepth, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDualAnodeAsymmetry),0); - _cDAAsymmetry_cut_SubdetPM.initialize(_name, "Asymmetry", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDualAnodeAsymmetry), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), 0); - } - - // INITIALIZE HISTOGRAMS to be used only in Online - if (_ptype==fOnline) - { - _cEnergyvsieta_Subdet.initialize(_name, "Energyvsieta", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy_1TeV),0); - _cEnergyvsiphi_SubdetPM.initialize(_name, "Energyvsiphi", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy_1TeV),0); - _cEnergyvsLS_SubdetPM.initialize(_name, "EnergyvsLS", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy_1TeV),0); - _cEnergyvsBX_SubdetPM.initialize(_name, "EnergyvsBX", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy_1TeV),0); - _cTimingCutvsieta_Subdet.initialize(_name, "TimingCutvsieta", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),0); - _cTimingCutvsiphi_SubdetPM.initialize(_name, "TimingCutvsiphi", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),0); - _cTimingCutvsBX_SubdetPM.initialize(_name, "TimingCutvsBX", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),0); - _cOccupancyvsiphi_SubdetPM.initialize(_name, "Occupancyvsiphi", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyvsieta_Subdet.initialize(_name, "Occupancyvsieta", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCutvsiphi_SubdetPM.initialize(_name, "OccupancyCutvsiphi", - hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCutvsieta_Subdet.initialize(_name, "OccupancyCutvsieta", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCutvsBX_Subdet.initialize(_name, "OccupancyCutvsBX", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCutvsiphivsLS_SubdetPM.initialize(_name, - "OccupancyCutvsiphivsLS", hcaldqm::hashfunctions::fSubdetPM, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCutvsLS_Subdet.initialize(_name, "OccupancyCutvsLS", - hcaldqm::hashfunctions::fSubdet, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),0); - } - - // FED-based plots - if (_ptype != fOffline) { // hidefed2crate - std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); - std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); - std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); - - // push the rawIds of each fed into the vector - for (std::vector::const_iterator it=vFEDsVME.begin(); - it!=vFEDsVME.end(); ++it) - _vhashFEDs.push_back(HcalElectronicsId( - FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, (*it)-FED_VME_MIN).rawId()); - for (std::vector::const_iterator it=vFEDsuTCA.begin(); - it!=vFEDsuTCA.end(); ++it) - { - std::pair cspair = utilities::fed2crate(*it); - _vhashFEDs.push_back(HcalElectronicsId( - cspair.first, cspair.second, FIBER_uTCA_MIN1, - FIBERCH_MIN, false).rawId()); - } - - _cTimingCut_FEDVME.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),0); - _cTimingCut_FEDuTCA.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),0); - _cTimingCutvsLS_FED.initialize(_name, "TimingCutvsLS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),0); - _cTimingCut_ElectronicsVME.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),0); - _cTimingCut_ElectronicsuTCA.initialize(_name, "TimingCut", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns),0); - - _cOccupancy_FEDVME.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancy_FEDuTCA.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancy_ElectronicsVME.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancy_ElectronicsuTCA.initialize(_name, "Occupancy", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - _cOccupancyCut_FEDVME.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCut_FEDuTCA.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCut_ElectronicsVME.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cOccupancyCut_ElectronicsuTCA.initialize(_name, "OccupancyCut", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - if (_ptype == fOnline) { - _cSummaryvsLS_FED.initialize(_name, "SummaryvsLS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::FlagQuantity(_vflags), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),0); - _cSummaryvsLS.initialize(_name, "SummaryvsLS", - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::FEDQuantity(vFEDs), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),0); - - _xUniHF.initialize(hcaldqm::hashfunctions::fFEDSlot); - _xUni.initialize(hcaldqm::hashfunctions::fFED); - } - } - - // BOOK HISTOGRAMS - char cutstr[200]; - sprintf(cutstr, "_EHBHE%dHO%dHF%d", int(_cutE_HBHE), - int(_cutE_HO), int(_cutE_HF)); - char cutstr2[200]; - sprintf(cutstr2, "_EHF%d", int(_cutE_HF)); - - // Energy - _cEnergy_Subdet.book(ib, _emap, _subsystem); - _cEnergy_depth.book(ib, _emap, _subsystem); - - // Timing - _cTimingCut_SubdetPM.book(ib, _emap, _subsystem); - _cTimingvsEnergy_SubdetPM.book(ib, _emap, _subsystem); - if (_ptype != fOffline) { // hidefed2crate - _cTimingCut_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cTimingCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cTimingCut_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cTimingCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); - } - _cTimingCut_HBHEPartition.book(ib, _emap, _subsystem); - _cTimingCut_depth.book(ib, _emap, _subsystem); - _cTimingCutvsLS_SubdetPM.book(ib, _emap, _subsystem); - if (_ptype != fOffline) { // hidefed2crate - _cTimingCutvsLS_FED.book(ib, _emap, _subsystem); - } - - // Occupancy - _cOccupancy_depth.book(ib, _emap, _subsystem); - if (_ptype != fOffline) { // hidefed2crate - _cOccupancy_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cOccupancy_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cOccupancy_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cOccupancy_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); - } - _cOccupancyvsLS_Subdet.book(ib, _emap, _subsystem); - _cOccupancyCut_depth.book(ib, _emap, _subsystem); - if (_ptype != fOffline) { // hidefed2crate - _cOccupancyCut_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cOccupancyCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cOccupancyCut_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cOccupancyCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); - } - - if (_hfPreRecHitsAvailable) { - _cDAAsymmetryVsCharge_SubdetPM.book(ib, _emap, _filter_HF, _subsystem); - _cDAAsymmetryMean_cut_depth.book(ib, _emap, _filter_HF, _subsystem); - _cDAAsymmetry_cut_SubdetPM.book(ib, _emap, _filter_HF, _subsystem); - } - - // BOOK HISTOGRAMS to be used only in Online - if (_ptype==fOnline) - { - _cEnergyvsLS_SubdetPM.book(ib, _emap, _subsystem); - _cEnergyvsieta_Subdet.book(ib, _emap, _subsystem); - _cEnergyvsiphi_SubdetPM.book(ib, _emap, _subsystem); - _cEnergyvsBX_SubdetPM.book(ib, _emap, _subsystem); - _cTimingCutvsieta_Subdet.book(ib, _emap, _subsystem); - _cTimingCutvsiphi_SubdetPM.book(ib, _emap, _subsystem); - _cTimingCutvsBX_SubdetPM.book(ib, _emap, _subsystem); - _cOccupancyvsiphi_SubdetPM.book(ib, _emap, _subsystem); - _cOccupancyvsieta_Subdet.book(ib, _emap, _subsystem); - _cOccupancyCutvsiphi_SubdetPM.book(ib, _emap, _subsystem); - _cOccupancyCutvsieta_Subdet.book(ib, _emap, _subsystem); - _cOccupancyCutvsBX_Subdet.book(ib, _emap, _subsystem); - _cOccupancyCutvsiphivsLS_SubdetPM.book(ib, _emap, _subsystem); - _cOccupancyCutvsLS_Subdet.book(ib, _emap, _subsystem); - _cSummaryvsLS_FED.book(ib, _emap, _subsystem); - _cSummaryvsLS.book(ib, _subsystem); - - std::vector vhashFEDHF; - vhashFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vhashFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vhashFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vhashFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN+6, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vhashFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN+6, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vhashFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN+6, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - HashFilter filter_FEDHF; - filter_FEDHF.initialize(filter::fPreserver, hcaldqm::hashfunctions::fFED, - vhashFEDHF); - - _gids = _emap->allPrecisionId(); - if (_ptype != fOffline) { // hidefed2crate - _xUniHF.book(_emap, filter_FEDHF); - _xUni.book(_emap); - } - } - - // initialize hash map - _ehashmap.initialize(_emap, hcaldqm::electronicsmap::fD2EHashMap); - - // book some mes... - ib.setCurrentFolder(_subsystem+"/"+_name); - meUnknownIds1LS = ib.book1D("UnknownIds", "UnknownIds", - 1, 0, 1); - _unknownIdsPresent = false; - meUnknownIds1LS->setLumiFlag(); +/* virtual */ void RecHitTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + DQTask::bookHistograms(ib, r, es); + + // GET WHAT YOU NEED + edm::ESHandle dbs; + es.get().get(dbs); + _emap = dbs->getHcalMapping(); + + std::vector vVME; + std::vector vuTCA; + vVME.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); + vuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vVME); + _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vuTCA); + std::vector vhashHF; + vhashHF.push_back( + hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalForward, 29, 1, 1))); + + _filter_HF.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdet, vhashHF); + + // INITIALIZE FIRST + // Energy + _cEnergy_Subdet.initialize(_name, + "Energy", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cEnergy_depth.initialize(_name, + "Energy", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy, true), + 0); + + // Timing + _cTimingCut_SubdetPM.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cTimingvsEnergy_SubdetPM.initialize(_name, + "TimingvsEnergy", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy, true), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + + _cTimingCut_HBHEPartition.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fHBHEPartition, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cTimingCut_depth.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), + 0); + _cTimingCutvsLS_SubdetPM.initialize(_name, + "TimingCutvsLS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), + 0); + + // Occupancy + _cOccupancy_depth.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cOccupancyvsLS_Subdet.initialize(_name, + "OccupancyvsLS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000), + 0); + + _cOccupancyCut_depth.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + if (_hfPreRecHitsAvailable) { + _cDAAsymmetryVsCharge_SubdetPM.initialize( + _name, + "ChargeVsAsymmetry", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDualAnodeAsymmetry), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cDAAsymmetryMean_cut_depth.initialize(_name, + "AsymmetryMean", + hcaldqm::hashfunctions::fdepth, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDualAnodeAsymmetry), + 0); + _cDAAsymmetry_cut_SubdetPM.initialize(_name, + "Asymmetry", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDualAnodeAsymmetry), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + } + + // INITIALIZE HISTOGRAMS to be used only in Online + if (_ptype == fOnline) { + _cEnergyvsieta_Subdet.initialize(_name, + "Energyvsieta", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy_1TeV), + 0); + _cEnergyvsiphi_SubdetPM.initialize(_name, + "Energyvsiphi", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy_1TeV), + 0); + _cEnergyvsLS_SubdetPM.initialize(_name, + "EnergyvsLS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy_1TeV), + 0); + _cEnergyvsBX_SubdetPM.initialize(_name, + "EnergyvsBX", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEnergy_1TeV), + 0); + _cTimingCutvsieta_Subdet.initialize(_name, + "TimingCutvsieta", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), + 0); + _cTimingCutvsiphi_SubdetPM.initialize(_name, + "TimingCutvsiphi", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), + 0); + _cTimingCutvsBX_SubdetPM.initialize(_name, + "TimingCutvsBX", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), + 0); + _cOccupancyvsiphi_SubdetPM.initialize(_name, + "Occupancyvsiphi", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyvsieta_Subdet.initialize(_name, + "Occupancyvsieta", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCutvsiphi_SubdetPM.initialize(_name, + "OccupancyCutvsiphi", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCutvsieta_Subdet.initialize(_name, + "OccupancyCutvsieta", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCutvsBX_Subdet.initialize(_name, + "OccupancyCutvsBX", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCutvsiphivsLS_SubdetPM.initialize(_name, + "OccupancyCutvsiphivsLS", + hcaldqm::hashfunctions::fSubdetPM, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCutvsLS_Subdet.initialize(_name, + "OccupancyCutvsLS", + hcaldqm::hashfunctions::fSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000), + 0); + } + + // FED-based plots + if (_ptype != fOffline) { // hidefed2crate + std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); + std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); + std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); + + // push the rawIds of each fed into the vector + for (std::vector::const_iterator it = vFEDsVME.begin(); it != vFEDsVME.end(); ++it) + _vhashFEDs.push_back(HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, (*it) - FED_VME_MIN).rawId()); + for (std::vector::const_iterator it = vFEDsuTCA.begin(); it != vFEDsuTCA.end(); ++it) { + std::pair cspair = utilities::fed2crate(*it); + _vhashFEDs.push_back(HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + } + + _cTimingCut_FEDVME.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), + 0); + _cTimingCut_FEDuTCA.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), + 0); + _cTimingCutvsLS_FED.initialize(_name, + "TimingCutvsLS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), + 0); + _cTimingCut_ElectronicsVME.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), + 0); + _cTimingCut_ElectronicsuTCA.initialize(_name, + "TimingCut", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_ns), + 0); + + _cOccupancy_FEDVME.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancy_FEDuTCA.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancy_ElectronicsVME.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancy_ElectronicsuTCA.initialize(_name, + "Occupancy", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cOccupancyCut_FEDVME.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberVMEFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCut_FEDuTCA.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCut_ElectronicsVME.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCut_ElectronicsuTCA.initialize(_name, + "OccupancyCut", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + if (_ptype == fOnline) { + _cSummaryvsLS_FED.initialize(_name, + "SummaryvsLS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::FlagQuantity(_vflags), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState), + 0); + _cSummaryvsLS.initialize(_name, + "SummaryvsLS", + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::FEDQuantity(vFEDs), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState), + 0); + + _xUniHF.initialize(hcaldqm::hashfunctions::fFEDSlot); + _xUni.initialize(hcaldqm::hashfunctions::fFED); + } + } + + // BOOK HISTOGRAMS + char cutstr[200]; + sprintf(cutstr, "_EHBHE%dHO%dHF%d", int(_cutE_HBHE), int(_cutE_HO), int(_cutE_HF)); + char cutstr2[200]; + sprintf(cutstr2, "_EHF%d", int(_cutE_HF)); + + // Energy + _cEnergy_Subdet.book(ib, _emap, _subsystem); + _cEnergy_depth.book(ib, _emap, _subsystem); + + // Timing + _cTimingCut_SubdetPM.book(ib, _emap, _subsystem); + _cTimingvsEnergy_SubdetPM.book(ib, _emap, _subsystem); + if (_ptype != fOffline) { // hidefed2crate + _cTimingCut_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cTimingCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cTimingCut_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cTimingCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + } + _cTimingCut_HBHEPartition.book(ib, _emap, _subsystem); + _cTimingCut_depth.book(ib, _emap, _subsystem); + _cTimingCutvsLS_SubdetPM.book(ib, _emap, _subsystem); + if (_ptype != fOffline) { // hidefed2crate + _cTimingCutvsLS_FED.book(ib, _emap, _subsystem); + } + + // Occupancy + _cOccupancy_depth.book(ib, _emap, _subsystem); + if (_ptype != fOffline) { // hidefed2crate + _cOccupancy_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancy_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cOccupancy_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancy_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + } + _cOccupancyvsLS_Subdet.book(ib, _emap, _subsystem); + _cOccupancyCut_depth.book(ib, _emap, _subsystem); + if (_ptype != fOffline) { // hidefed2crate + _cOccupancyCut_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancyCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cOccupancyCut_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancyCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + } + + if (_hfPreRecHitsAvailable) { + _cDAAsymmetryVsCharge_SubdetPM.book(ib, _emap, _filter_HF, _subsystem); + _cDAAsymmetryMean_cut_depth.book(ib, _emap, _filter_HF, _subsystem); + _cDAAsymmetry_cut_SubdetPM.book(ib, _emap, _filter_HF, _subsystem); + } + + // BOOK HISTOGRAMS to be used only in Online + if (_ptype == fOnline) { + _cEnergyvsLS_SubdetPM.book(ib, _emap, _subsystem); + _cEnergyvsieta_Subdet.book(ib, _emap, _subsystem); + _cEnergyvsiphi_SubdetPM.book(ib, _emap, _subsystem); + _cEnergyvsBX_SubdetPM.book(ib, _emap, _subsystem); + _cTimingCutvsieta_Subdet.book(ib, _emap, _subsystem); + _cTimingCutvsiphi_SubdetPM.book(ib, _emap, _subsystem); + _cTimingCutvsBX_SubdetPM.book(ib, _emap, _subsystem); + _cOccupancyvsiphi_SubdetPM.book(ib, _emap, _subsystem); + _cOccupancyvsieta_Subdet.book(ib, _emap, _subsystem); + _cOccupancyCutvsiphi_SubdetPM.book(ib, _emap, _subsystem); + _cOccupancyCutvsieta_Subdet.book(ib, _emap, _subsystem); + _cOccupancyCutvsBX_Subdet.book(ib, _emap, _subsystem); + _cOccupancyCutvsiphivsLS_SubdetPM.book(ib, _emap, _subsystem); + _cOccupancyCutvsLS_Subdet.book(ib, _emap, _subsystem); + _cSummaryvsLS_FED.book(ib, _emap, _subsystem); + _cSummaryvsLS.book(ib, _subsystem); + + std::vector vhashFEDHF; + vhashFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vhashFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vhashFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vhashFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vhashFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vhashFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + HashFilter filter_FEDHF; + filter_FEDHF.initialize(filter::fPreserver, hcaldqm::hashfunctions::fFED, vhashFEDHF); + + _gids = _emap->allPrecisionId(); + if (_ptype != fOffline) { // hidefed2crate + _xUniHF.book(_emap, filter_FEDHF); + _xUni.book(_emap); + } + } + + // initialize hash map + _ehashmap.initialize(_emap, hcaldqm::electronicsmap::fD2EHashMap); + + // book some mes... + ib.setCurrentFolder(_subsystem + "/" + _name); + meUnknownIds1LS = ib.book1D("UnknownIds", "UnknownIds", 1, 0, 1); + _unknownIdsPresent = false; + meUnknownIds1LS->setLumiFlag(); } -/* virtual */ void RecHitTask::_resetMonitors(hcaldqm::UpdateFreq uf) -{ - switch(uf) - { - case hcaldqm::f1LS: - _unknownIdsPresent = false; - break; - default: - break; - } - - DQTask::_resetMonitors(uf); +/* virtual */ void RecHitTask::_resetMonitors(hcaldqm::UpdateFreq uf) { + switch (uf) { + case hcaldqm::f1LS: + _unknownIdsPresent = false; + break; + default: + break; + } + + DQTask::_resetMonitors(uf); } -/* virtual */ void RecHitTask::_process(edm::Event const& e, - edm::EventSetup const&) -{ - edm::Handle chbhe; - edm::Handle cho; - edm::Handle chf; - - if (!(e.getByToken(_tokHBHE, chbhe))) - _logger.dqmthrow("Collection HBHERecHitCollection not available " - + _tagHBHE.label() + " " + _tagHBHE.instance()); - if (!(e.getByToken(_tokHO, cho))) - _logger.dqmthrow("Collection HORecHitCollection not available " - + _tagHO.label() + " " + _tagHO.instance()); - if (!(e.getByToken(_tokHF, chf))) - _logger.dqmthrow("Collection HFRecHitCollection not available " - + _tagHF.label() + " " + _tagHF.instance()); - - edm::Handle cprehf; - if (_hfPreRecHitsAvailable) { - if (!(e.getByToken(_tokPreHF, cprehf))) - _logger.dqmthrow("Collection HFPreRecHitCollection not available " - + _tagPreHF.label() + " " + _tagPreHF.instance()); - } - - // extract some info per event - int bx = e.bunchCrossing(); - - // To fill histograms outside of the loop, you need to determine if there were - // any valid det ids first - uint32_t rawidValid = 0; - uint32_t rawidHBValid = 0; - uint32_t rawidHEValid = 0; - - double ehbm = 0; double ehbp = 0; - double ehem = 0; double ehep = 0; - int nChsHB = 0; int nChsHE = 0; - int nChsHBCut = 0; int nChsHECut = 0; - for (HBHERecHitCollection::const_iterator it=chbhe->begin(); - it!=chbhe->end(); ++it) - { - double energy = it->energy(); - double timing = it->time(); - - // Explicit check on the DetIds present in the Collection - HcalDetId did = it->id(); - uint32_t rawid = _ehashmap.lookup(did); - /* +/* virtual */ void RecHitTask::_process(edm::Event const& e, edm::EventSetup const&) { + edm::Handle chbhe; + edm::Handle cho; + edm::Handle chf; + + if (!(e.getByToken(_tokHBHE, chbhe))) + _logger.dqmthrow("Collection HBHERecHitCollection not available " + _tagHBHE.label() + " " + _tagHBHE.instance()); + if (!(e.getByToken(_tokHO, cho))) + _logger.dqmthrow("Collection HORecHitCollection not available " + _tagHO.label() + " " + _tagHO.instance()); + if (!(e.getByToken(_tokHF, chf))) + _logger.dqmthrow("Collection HFRecHitCollection not available " + _tagHF.label() + " " + _tagHF.instance()); + + edm::Handle cprehf; + if (_hfPreRecHitsAvailable) { + if (!(e.getByToken(_tokPreHF, cprehf))) + _logger.dqmthrow("Collection HFPreRecHitCollection not available " + _tagPreHF.label() + " " + + _tagPreHF.instance()); + } + + // extract some info per event + int bx = e.bunchCrossing(); + + // To fill histograms outside of the loop, you need to determine if there were + // any valid det ids first + uint32_t rawidValid = 0; + uint32_t rawidHBValid = 0; + uint32_t rawidHEValid = 0; + + double ehbm = 0; + double ehbp = 0; + double ehem = 0; + double ehep = 0; + int nChsHB = 0; + int nChsHE = 0; + int nChsHBCut = 0; + int nChsHECut = 0; + for (HBHERecHitCollection::const_iterator it = chbhe->begin(); it != chbhe->end(); ++it) { + double energy = it->energy(); + double timing = it->time(); + + // Explicit check on the DetIds present in the Collection + HcalDetId did = it->id(); + uint32_t rawid = _ehashmap.lookup(did); + /* * Needs to be removed as DetIds that belong to the HEP17 after combination * are not present in the emap * Removed until further notice! * */ - //if (rawid==0) - //{meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;} - - HcalElectronicsId const& eid(rawid); - rawidValid = did.rawId(); - if (did.subdet()==HcalBarrel) - rawidHBValid = did.rawId(); - else if (did.subdet()==HcalEndcap) - rawidHEValid = did.rawId(); - - _cEnergy_Subdet.fill(did, energy); - _cTimingvsEnergy_SubdetPM.fill(did, energy, timing); - _cOccupancy_depth.fill(did); - did.subdet()==HcalBarrel?did.ieta()>0?ehbp+=energy:ehbm+=energy: - did.ieta()>0?ehep+=energy:ehem+=energy; - - // ONLINE ONLY! - if (_ptype==fOnline) - { - _cOccupancyvsiphi_SubdetPM.fill(did); - _cOccupancyvsieta_Subdet.fill(did); - } - // ^^^ONLINE ONLY! - // - if (_ptype != fOffline) { // hidefed2crate - // Also, for these electronics plots, require that the channel was found in the emap. - if (rawid != 0) { - if (eid.isVMEid()) - { - _cOccupancy_FEDVME.fill(eid); - _cOccupancy_ElectronicsVME.fill(eid); - } else if (eid.isUTCAid()) { - _cOccupancy_FEDuTCA.fill(eid); - _cOccupancy_ElectronicsuTCA.fill(eid); - } - } - } - - if (energy>_cutE_HBHE) - { - // ONLINE ONLY! - if (_ptype==fOnline) - { - _cEnergyvsLS_SubdetPM.fill(did, _currentLS, energy); - _cEnergyvsBX_SubdetPM.fill(did, bx, energy); - _cEnergyvsieta_Subdet.fill(did, energy); - _cEnergyvsiphi_SubdetPM.fill(did, energy); - _cTimingCutvsieta_Subdet.fill(did, timing); - _cTimingCutvsiphi_SubdetPM.fill(did, timing); - _cTimingCutvsBX_SubdetPM.fill(did, bx, timing); - _cOccupancyCutvsiphi_SubdetPM.fill(did); - _cOccupancyCutvsieta_Subdet.fill(did); - _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); - } - // ^^^ONLINE ONLY! - _cEnergy_depth.fill(did, energy); - _cTimingCut_SubdetPM.fill(did, timing); - _cTimingCut_HBHEPartition.fill(did, timing); - _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); - - // ONLINE - if (_ptype==fOnline) { - if (rawid != 0) { - _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); - } - _cTimingCut_depth.fill(did, timing); - // ^^^ONLINE - } else { - if (_ptype != fOffline) { // hidefed2crate - if (rawid != 0) { - _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); - } - } - _cTimingCut_depth.fill(did, timing); - } - _cOccupancyCut_depth.fill(did); - if (_ptype != fOffline) { // hidefed2crate - if (rawid != 0) { - if (eid.isVMEid()){ - // ONLINE - if (_ptype==fOnline) - { - _cTimingCut_FEDVME.fill(eid, timing); - _cTimingCut_ElectronicsVME.fill(eid, timing); - } // ^^^ ONLINE - else - { - _cTimingCut_FEDVME.fill(eid, timing); - _cTimingCut_ElectronicsVME.fill(eid, timing); - } - // ^^^ONLINE - - _cOccupancyCut_FEDVME.fill(eid); - _cOccupancyCut_ElectronicsVME.fill(eid); - } else if (eid.isUTCAid()) { - if (_ptype==fOnline) - { - // time constraints are explicit! - _cTimingCut_FEDuTCA.fill(eid, timing); - _cTimingCut_ElectronicsuTCA.fill(eid, timing); - } - else - { - _cTimingCut_FEDuTCA.fill(eid, timing); - _cTimingCut_ElectronicsuTCA.fill(eid, timing); - } - _cOccupancyCut_FEDuTCA.fill(eid); - _cOccupancyCut_ElectronicsuTCA.fill(eid); - } - } - } - did.subdet()==HcalBarrel?nChsHBCut++:nChsHECut++; - } - did.subdet()==HcalBarrel?nChsHB++:nChsHE++; - } - - if (rawidHBValid!=0 && rawidHEValid!=0) - { - _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHBValid), _currentLS, - nChsHB); - _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHEValid), _currentLS, - nChsHE); - - // ONLINE ONLY! - if (_ptype==fOnline) - { - _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidHBValid), - bx, nChsHBCut); - _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidHEValid), - bx, nChsHECut); - _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidHBValid), - _currentLS, nChsHBCut); - _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidHEValid), - _currentLS, nChsHECut); - } - // ^^^ONLINE ONLY! - } - - // reset - rawidValid = 0; - - int nChsHO = 0; int nChsHOCut = 0; - double ehop = 0; double ehom = 0; - for (HORecHitCollection::const_iterator it=cho->begin(); - it!=cho->end(); ++it) - { - double energy = it->energy(); - double timing = it->time(); - - // Explicit check on the DetIds present in the Collection - HcalDetId did = it->id(); - uint32_t rawid = _ehashmap.lookup(did); - if (rawid==0) - {meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;} - HcalElectronicsId const& eid(rawid); - if (did.subdet()==HcalOuter) - rawidValid = did.rawId(); - - _cEnergy_Subdet.fill(did, energy); - _cTimingvsEnergy_SubdetPM.fill(did, energy, timing); - _cOccupancy_depth.fill(did); - did.ieta()>0?ehop+=energy:ehom+=energy; - - // IMPORTANT: ONLINE ONLY! - if (_ptype==fOnline) - { - _cOccupancyvsiphi_SubdetPM.fill(did); - _cOccupancyvsieta_Subdet.fill(did); - } - // ONLINE ONLY! - - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - { - _cOccupancy_FEDVME.fill(eid); - _cOccupancy_ElectronicsVME.fill(eid); - } - else - { - _cOccupancy_FEDuTCA.fill(eid); - _cOccupancy_ElectronicsuTCA.fill(eid); - } - } - - if (energy>_cutE_HO) - { - // ONLINE ONLY! - if (_ptype==fOnline) - { - _cEnergyvsLS_SubdetPM.fill(did, _currentLS, energy); - _cEnergyvsBX_SubdetPM.fill(did, bx, energy); - _cEnergyvsieta_Subdet.fill(did, energy); - _cEnergyvsiphi_SubdetPM.fill(did, energy); - _cTimingCutvsieta_Subdet.fill(did, timing); - _cTimingCutvsiphi_SubdetPM.fill(did, timing); - _cTimingCutvsBX_SubdetPM.fill(did, bx, timing); - _cOccupancyCutvsiphi_SubdetPM.fill(did); - _cOccupancyCutvsieta_Subdet.fill(did); - _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); - } - // ^^^ONLINE ONLY! - - _cEnergy_depth.fill(did, energy); - _cTimingCut_SubdetPM.fill(did, timing); - _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); - if (_ptype != fOffline) { // hidefed2crate - _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); - } - _cOccupancyCut_depth.fill(did); - _cTimingCut_depth.fill(did, timing); - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - { - _cTimingCut_FEDVME.fill(eid, timing); - _cTimingCut_ElectronicsVME.fill(eid, timing); - _cOccupancyCut_FEDVME.fill(eid); - _cOccupancyCut_ElectronicsVME.fill(eid); - } - else - { - _cTimingCut_FEDuTCA.fill(eid, timing); - _cTimingCut_ElectronicsuTCA.fill(eid, timing); - _cOccupancyCut_FEDuTCA.fill(eid); - _cOccupancyCut_ElectronicsuTCA.fill(eid); - } - } - nChsHOCut++; - } - nChsHO++; - } - - if (rawidValid!=0) - { - _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, - nChsHO); - // ONLINE ONLY! - if (_ptype==fOnline) - { - _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidValid), - bx, nChsHOCut); - _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidValid), - _currentLS, nChsHOCut); - } - // ^^^ONLINE ONLY! - } - - //reset - rawidValid = 0; - - int nChsHF = 0; int nChsHFCut = 0; - double ehfp = 0; double ehfm = 0; - for (HFRecHitCollection::const_iterator it=chf->begin(); - it!=chf->end(); ++it) - { - double energy = it->energy(); - double timing = it->time(); - - // Explicit check on the DetIds present in the Collection - HcalDetId did = it->id(); - uint32_t rawid = _ehashmap.lookup(did); - if (rawid==0) - {meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;} - HcalElectronicsId const& eid(rawid); - if (did.subdet()==HcalForward) - rawidValid = did.rawId(); - - _cEnergy_Subdet.fill(did, energy); - _cTimingvsEnergy_SubdetPM.fill(did, energy, timing); - _cOccupancy_depth.fill(did); - did.ieta()>0?ehfp+=energy:ehfm+=energy; - - // IMPORTANT: - // only for Online Processing - // - if (_ptype==fOnline) - { - _cOccupancyvsiphi_SubdetPM.fill(did); - _cOccupancyvsieta_Subdet.fill(did); - } - // ONLINE ONLY! - - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - { - _cOccupancy_FEDVME.fill(eid); - _cOccupancy_ElectronicsVME.fill(eid); - } - else - { - _cOccupancy_FEDuTCA.fill(eid); - _cOccupancy_ElectronicsuTCA.fill(eid); - } - } - - if (energy>_cutE_HF) - { - // ONLINE ONLY! - if (_ptype==fOnline) - { - _cEnergyvsLS_SubdetPM.fill(did, _currentLS, energy); - _cEnergyvsBX_SubdetPM.fill(did, bx, energy); - _cEnergyvsieta_Subdet.fill(did, energy); - _cEnergyvsiphi_SubdetPM.fill(did, energy); - _cTimingCutvsieta_Subdet.fill(did, timing); - _cTimingCutvsiphi_SubdetPM.fill(did, timing); - _cTimingCutvsBX_SubdetPM.fill(did, bx, timing); - _cOccupancyCutvsiphi_SubdetPM.fill(did); - _cOccupancyCutvsieta_Subdet.fill(did); - _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); - if (_ptype != fOffline) { // hidefed2crate - _xUniHF.get(eid)++; - } - } - // ^^^ONLINE ONLY! - _cEnergy_depth.fill(did, energy); - _cTimingCut_SubdetPM.fill(did, timing); - _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); - if (_ptype != fOffline) { // hidefed2crate - _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); - } - _cOccupancyCut_depth.fill(did); - _cTimingCut_depth.fill(did, timing); - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - { - _cTimingCut_FEDVME.fill(eid, timing); - _cTimingCut_ElectronicsVME.fill(eid, timing); - _cOccupancyCut_FEDVME.fill(eid); - _cOccupancyCut_ElectronicsVME.fill(eid); - } - else - { - _cTimingCut_FEDuTCA.fill(eid, timing); - _cTimingCut_ElectronicsuTCA.fill(eid, timing); - _cOccupancyCut_FEDuTCA.fill(eid); - _cOccupancyCut_ElectronicsuTCA.fill(eid); - } - } - nChsHFCut++; - } - nChsHF++; - } - - if (rawidValid!=0) - { - _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, - nChsHF); - // ONLINE ONLY! - if (_ptype==fOnline) - { - _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidValid), - bx, nChsHFCut); - _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidValid), - _currentLS, nChsHFCut); - } - // ^^^ONLINE ONLY! - } - - // Loop over HFPreRecHits to get charge and charge asymmetry - if (_hfPreRecHitsAvailable) { - for (HFPreRecHitCollection::const_iterator it=cprehf->begin(); - it!=cprehf->end(); ++it) - { - HcalDetId did = it->id(); - if (_filter_HF.filter(did)) { - continue; - } - std::pair chargeAsymmetry = it->chargeAsymmetry(0.); - std::pair chargeAsymmetryCut = it->chargeAsymmetry(20.); - - if (chargeAsymmetry.second) { - _cDAAsymmetryVsCharge_SubdetPM.fill(did, chargeAsymmetry.first, it->charge()); - } - if (chargeAsymmetryCut.second) { - _cDAAsymmetryMean_cut_depth.fill(did, chargeAsymmetryCut.first); - _cDAAsymmetry_cut_SubdetPM.fill(did, chargeAsymmetryCut.first); - } - } - } + //if (rawid==0) + //{meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;} + + HcalElectronicsId const& eid(rawid); + rawidValid = did.rawId(); + if (did.subdet() == HcalBarrel) + rawidHBValid = did.rawId(); + else if (did.subdet() == HcalEndcap) + rawidHEValid = did.rawId(); + + _cEnergy_Subdet.fill(did, energy); + _cTimingvsEnergy_SubdetPM.fill(did, energy, timing); + _cOccupancy_depth.fill(did); + did.subdet() == HcalBarrel ? did.ieta() > 0 ? ehbp += energy : ehbm += energy + : did.ieta() > 0 ? ehep += energy : ehem += energy; + + // ONLINE ONLY! + if (_ptype == fOnline) { + _cOccupancyvsiphi_SubdetPM.fill(did); + _cOccupancyvsieta_Subdet.fill(did); + } + // ^^^ONLINE ONLY! + // + if (_ptype != fOffline) { // hidefed2crate + // Also, for these electronics plots, require that the channel was found in the emap. + if (rawid != 0) { + if (eid.isVMEid()) { + _cOccupancy_FEDVME.fill(eid); + _cOccupancy_ElectronicsVME.fill(eid); + } else if (eid.isUTCAid()) { + _cOccupancy_FEDuTCA.fill(eid); + _cOccupancy_ElectronicsuTCA.fill(eid); + } + } + } + + if (energy > _cutE_HBHE) { + // ONLINE ONLY! + if (_ptype == fOnline) { + _cEnergyvsLS_SubdetPM.fill(did, _currentLS, energy); + _cEnergyvsBX_SubdetPM.fill(did, bx, energy); + _cEnergyvsieta_Subdet.fill(did, energy); + _cEnergyvsiphi_SubdetPM.fill(did, energy); + _cTimingCutvsieta_Subdet.fill(did, timing); + _cTimingCutvsiphi_SubdetPM.fill(did, timing); + _cTimingCutvsBX_SubdetPM.fill(did, bx, timing); + _cOccupancyCutvsiphi_SubdetPM.fill(did); + _cOccupancyCutvsieta_Subdet.fill(did); + _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); + } + // ^^^ONLINE ONLY! + _cEnergy_depth.fill(did, energy); + _cTimingCut_SubdetPM.fill(did, timing); + _cTimingCut_HBHEPartition.fill(did, timing); + _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); + + // ONLINE + if (_ptype == fOnline) { + if (rawid != 0) { + _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); + } + _cTimingCut_depth.fill(did, timing); + // ^^^ONLINE + } else { + if (_ptype != fOffline) { // hidefed2crate + if (rawid != 0) { + _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); + } + } + _cTimingCut_depth.fill(did, timing); + } + _cOccupancyCut_depth.fill(did); + if (_ptype != fOffline) { // hidefed2crate + if (rawid != 0) { + if (eid.isVMEid()) { + // ONLINE + if (_ptype == fOnline) { + _cTimingCut_FEDVME.fill(eid, timing); + _cTimingCut_ElectronicsVME.fill(eid, timing); + } // ^^^ ONLINE + else { + _cTimingCut_FEDVME.fill(eid, timing); + _cTimingCut_ElectronicsVME.fill(eid, timing); + } + // ^^^ONLINE + + _cOccupancyCut_FEDVME.fill(eid); + _cOccupancyCut_ElectronicsVME.fill(eid); + } else if (eid.isUTCAid()) { + if (_ptype == fOnline) { + // time constraints are explicit! + _cTimingCut_FEDuTCA.fill(eid, timing); + _cTimingCut_ElectronicsuTCA.fill(eid, timing); + } else { + _cTimingCut_FEDuTCA.fill(eid, timing); + _cTimingCut_ElectronicsuTCA.fill(eid, timing); + } + _cOccupancyCut_FEDuTCA.fill(eid); + _cOccupancyCut_ElectronicsuTCA.fill(eid); + } + } + } + did.subdet() == HcalBarrel ? nChsHBCut++ : nChsHECut++; + } + did.subdet() == HcalBarrel ? nChsHB++ : nChsHE++; + } + + if (rawidHBValid != 0 && rawidHEValid != 0) { + _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHBValid), _currentLS, nChsHB); + _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHEValid), _currentLS, nChsHE); + + // ONLINE ONLY! + if (_ptype == fOnline) { + _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidHBValid), bx, nChsHBCut); + _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidHEValid), bx, nChsHECut); + _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidHBValid), _currentLS, nChsHBCut); + _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidHEValid), _currentLS, nChsHECut); + } + // ^^^ONLINE ONLY! + } + + // reset + rawidValid = 0; + + int nChsHO = 0; + int nChsHOCut = 0; + double ehop = 0; + double ehom = 0; + for (HORecHitCollection::const_iterator it = cho->begin(); it != cho->end(); ++it) { + double energy = it->energy(); + double timing = it->time(); + + // Explicit check on the DetIds present in the Collection + HcalDetId did = it->id(); + uint32_t rawid = _ehashmap.lookup(did); + if (rawid == 0) { + meUnknownIds1LS->Fill(1); + _unknownIdsPresent = true; + continue; + } + HcalElectronicsId const& eid(rawid); + if (did.subdet() == HcalOuter) + rawidValid = did.rawId(); + + _cEnergy_Subdet.fill(did, energy); + _cTimingvsEnergy_SubdetPM.fill(did, energy, timing); + _cOccupancy_depth.fill(did); + did.ieta() > 0 ? ehop += energy : ehom += energy; + + // IMPORTANT: ONLINE ONLY! + if (_ptype == fOnline) { + _cOccupancyvsiphi_SubdetPM.fill(did); + _cOccupancyvsieta_Subdet.fill(did); + } + // ONLINE ONLY! + + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) { + _cOccupancy_FEDVME.fill(eid); + _cOccupancy_ElectronicsVME.fill(eid); + } else { + _cOccupancy_FEDuTCA.fill(eid); + _cOccupancy_ElectronicsuTCA.fill(eid); + } + } + + if (energy > _cutE_HO) { + // ONLINE ONLY! + if (_ptype == fOnline) { + _cEnergyvsLS_SubdetPM.fill(did, _currentLS, energy); + _cEnergyvsBX_SubdetPM.fill(did, bx, energy); + _cEnergyvsieta_Subdet.fill(did, energy); + _cEnergyvsiphi_SubdetPM.fill(did, energy); + _cTimingCutvsieta_Subdet.fill(did, timing); + _cTimingCutvsiphi_SubdetPM.fill(did, timing); + _cTimingCutvsBX_SubdetPM.fill(did, bx, timing); + _cOccupancyCutvsiphi_SubdetPM.fill(did); + _cOccupancyCutvsieta_Subdet.fill(did); + _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); + } + // ^^^ONLINE ONLY! + + _cEnergy_depth.fill(did, energy); + _cTimingCut_SubdetPM.fill(did, timing); + _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); + if (_ptype != fOffline) { // hidefed2crate + _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); + } + _cOccupancyCut_depth.fill(did); + _cTimingCut_depth.fill(did, timing); + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) { + _cTimingCut_FEDVME.fill(eid, timing); + _cTimingCut_ElectronicsVME.fill(eid, timing); + _cOccupancyCut_FEDVME.fill(eid); + _cOccupancyCut_ElectronicsVME.fill(eid); + } else { + _cTimingCut_FEDuTCA.fill(eid, timing); + _cTimingCut_ElectronicsuTCA.fill(eid, timing); + _cOccupancyCut_FEDuTCA.fill(eid); + _cOccupancyCut_ElectronicsuTCA.fill(eid); + } + } + nChsHOCut++; + } + nChsHO++; + } + + if (rawidValid != 0) { + _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, nChsHO); + // ONLINE ONLY! + if (_ptype == fOnline) { + _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidValid), bx, nChsHOCut); + _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, nChsHOCut); + } + // ^^^ONLINE ONLY! + } + + //reset + rawidValid = 0; + + int nChsHF = 0; + int nChsHFCut = 0; + double ehfp = 0; + double ehfm = 0; + for (HFRecHitCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) { + double energy = it->energy(); + double timing = it->time(); + + // Explicit check on the DetIds present in the Collection + HcalDetId did = it->id(); + uint32_t rawid = _ehashmap.lookup(did); + if (rawid == 0) { + meUnknownIds1LS->Fill(1); + _unknownIdsPresent = true; + continue; + } + HcalElectronicsId const& eid(rawid); + if (did.subdet() == HcalForward) + rawidValid = did.rawId(); + + _cEnergy_Subdet.fill(did, energy); + _cTimingvsEnergy_SubdetPM.fill(did, energy, timing); + _cOccupancy_depth.fill(did); + did.ieta() > 0 ? ehfp += energy : ehfm += energy; + + // IMPORTANT: + // only for Online Processing + // + if (_ptype == fOnline) { + _cOccupancyvsiphi_SubdetPM.fill(did); + _cOccupancyvsieta_Subdet.fill(did); + } + // ONLINE ONLY! + + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) { + _cOccupancy_FEDVME.fill(eid); + _cOccupancy_ElectronicsVME.fill(eid); + } else { + _cOccupancy_FEDuTCA.fill(eid); + _cOccupancy_ElectronicsuTCA.fill(eid); + } + } + + if (energy > _cutE_HF) { + // ONLINE ONLY! + if (_ptype == fOnline) { + _cEnergyvsLS_SubdetPM.fill(did, _currentLS, energy); + _cEnergyvsBX_SubdetPM.fill(did, bx, energy); + _cEnergyvsieta_Subdet.fill(did, energy); + _cEnergyvsiphi_SubdetPM.fill(did, energy); + _cTimingCutvsieta_Subdet.fill(did, timing); + _cTimingCutvsiphi_SubdetPM.fill(did, timing); + _cTimingCutvsBX_SubdetPM.fill(did, bx, timing); + _cOccupancyCutvsiphi_SubdetPM.fill(did); + _cOccupancyCutvsieta_Subdet.fill(did); + _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS); + if (_ptype != fOffline) { // hidefed2crate + _xUniHF.get(eid)++; + } + } + // ^^^ONLINE ONLY! + _cEnergy_depth.fill(did, energy); + _cTimingCut_SubdetPM.fill(did, timing); + _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing); + if (_ptype != fOffline) { // hidefed2crate + _cTimingCutvsLS_FED.fill(eid, _currentLS, timing); + } + _cOccupancyCut_depth.fill(did); + _cTimingCut_depth.fill(did, timing); + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) { + _cTimingCut_FEDVME.fill(eid, timing); + _cTimingCut_ElectronicsVME.fill(eid, timing); + _cOccupancyCut_FEDVME.fill(eid); + _cOccupancyCut_ElectronicsVME.fill(eid); + } else { + _cTimingCut_FEDuTCA.fill(eid, timing); + _cTimingCut_ElectronicsuTCA.fill(eid, timing); + _cOccupancyCut_FEDuTCA.fill(eid); + _cOccupancyCut_ElectronicsuTCA.fill(eid); + } + } + nChsHFCut++; + } + nChsHF++; + } + + if (rawidValid != 0) { + _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, nChsHF); + // ONLINE ONLY! + if (_ptype == fOnline) { + _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidValid), bx, nChsHFCut); + _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, nChsHFCut); + } + // ^^^ONLINE ONLY! + } + + // Loop over HFPreRecHits to get charge and charge asymmetry + if (_hfPreRecHitsAvailable) { + for (HFPreRecHitCollection::const_iterator it = cprehf->begin(); it != cprehf->end(); ++it) { + HcalDetId did = it->id(); + if (_filter_HF.filter(did)) { + continue; + } + std::pair chargeAsymmetry = it->chargeAsymmetry(0.); + std::pair chargeAsymmetryCut = it->chargeAsymmetry(20.); + + if (chargeAsymmetry.second) { + _cDAAsymmetryVsCharge_SubdetPM.fill(did, chargeAsymmetry.first, it->charge()); + } + if (chargeAsymmetryCut.second) { + _cDAAsymmetryMean_cut_depth.fill(did, chargeAsymmetryCut.first); + _cDAAsymmetry_cut_SubdetPM.fill(did, chargeAsymmetryCut.first); + } + } + } } -/* virtual */ void RecHitTask::beginLuminosityBlock(edm::LuminosityBlock const& - lb, edm::EventSetup const& es) -{ - DQTask::beginLuminosityBlock(lb, es); +/* virtual */ void RecHitTask::beginLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + DQTask::beginLuminosityBlock(lb, es); } -/* virtual */ void RecHitTask::endLuminosityBlock(edm::LuminosityBlock const& - lb, edm::EventSetup const& es) -{ - if (_ptype!=fOnline) - return; - - // - // GENERATE STATUS ONLY FOR ONLINE - // -// for (std::vector::const_iterator it=gids.begin(); -// it!=gids.end(); ++it) -// {} - - for (uintCompactMap::const_iterator it=_xUniHF.begin(); - it!=_xUniHF.end(); ++it) - { - uint32_t hash1 = it->first; - HcalElectronicsId eid1(hash1); - double x1 = it->second; - - for (uintCompactMap::const_iterator jt=_xUniHF.begin(); - jt!=_xUniHF.end(); ++jt) - { - if (jt==it) - continue; - double x2 = jt->second; - if (x2==0) - continue; - if (x1/x2<_thresh_unihf) - _xUni.get(eid1)++; - } - } - - if (_ptype != fOffline) { // hidefed2crate - for (std::vector::const_iterator it=_vhashFEDs.begin(); - it!=_vhashFEDs.end(); ++it) - { - flag::Flag fSum("RECO"); - HcalElectronicsId eid = HcalElectronicsId(*it); - - std::vector::const_iterator cit=std::find( - _vcdaqEids.begin(), _vcdaqEids.end(), *it); - if (cit==_vcdaqEids.end()) - { - // not @cDAQ - for (uint32_t iflag=0; iflag<_vflags.size(); iflag++) - _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), - int(flag::fNCDAQ)); - _cSummaryvsLS.setBinContent(eid, _currentLS, int(flag::fNCDAQ)); - continue; - } - - // FED is @cDAQ - if (hcaldqm::utilities::isFEDHF(eid) && (_runkeyVal==0 || _runkeyVal==4)) - { - if (_xUni.get(eid)>0) - _vflags[fUni]._state = flag::fPROBLEMATIC; - else - _vflags[fUni]._state = flag::fGOOD; - } - - if (_unknownIdsPresent) - _vflags[fUnknownIds]._state = flag::fBAD; - else - _vflags[fUnknownIds]._state = flag::fGOOD; - - int iflag=0; - for (std::vector::iterator ft=_vflags.begin(); - ft!=_vflags.end(); ++ft) - { - _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), - int(ft->_state)); - fSum+=(*ft); - iflag++; - - // reset after using - ft->reset(); - } - _cSummaryvsLS.setBinContent(eid, _currentLS, fSum._state); - } - _xUniHF.reset(); _xUni.reset(); - } - - // in the end always do the DQTask::endLumi - DQTask::endLuminosityBlock(lb, es); +/* virtual */ void RecHitTask::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + if (_ptype != fOnline) + return; + + // + // GENERATE STATUS ONLY FOR ONLINE + // + // for (std::vector::const_iterator it=gids.begin(); + // it!=gids.end(); ++it) + // {} + + for (uintCompactMap::const_iterator it = _xUniHF.begin(); it != _xUniHF.end(); ++it) { + uint32_t hash1 = it->first; + HcalElectronicsId eid1(hash1); + double x1 = it->second; + + for (uintCompactMap::const_iterator jt = _xUniHF.begin(); jt != _xUniHF.end(); ++jt) { + if (jt == it) + continue; + double x2 = jt->second; + if (x2 == 0) + continue; + if (x1 / x2 < _thresh_unihf) + _xUni.get(eid1)++; + } + } + + if (_ptype != fOffline) { // hidefed2crate + for (std::vector::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) { + flag::Flag fSum("RECO"); + HcalElectronicsId eid = HcalElectronicsId(*it); + + std::vector::const_iterator cit = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), *it); + if (cit == _vcdaqEids.end()) { + // not @cDAQ + for (uint32_t iflag = 0; iflag < _vflags.size(); iflag++) + _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), int(flag::fNCDAQ)); + _cSummaryvsLS.setBinContent(eid, _currentLS, int(flag::fNCDAQ)); + continue; + } + + // FED is @cDAQ + if (hcaldqm::utilities::isFEDHF(eid) && (_runkeyVal == 0 || _runkeyVal == 4)) { + if (_xUni.get(eid) > 0) + _vflags[fUni]._state = flag::fPROBLEMATIC; + else + _vflags[fUni]._state = flag::fGOOD; + } + + if (_unknownIdsPresent) + _vflags[fUnknownIds]._state = flag::fBAD; + else + _vflags[fUnknownIds]._state = flag::fGOOD; + + int iflag = 0; + for (std::vector::iterator ft = _vflags.begin(); ft != _vflags.end(); ++ft) { + _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), int(ft->_state)); + fSum += (*ft); + iflag++; + + // reset after using + ft->reset(); + } + _cSummaryvsLS.setBinContent(eid, _currentLS, fSum._state); + } + _xUniHF.reset(); + _xUni.reset(); + } + + // in the end always do the DQTask::endLumi + DQTask::endLuminosityBlock(lb, es); } DEFINE_FWK_MODULE(RecHitTask); - diff --git a/DQM/HcalTasks/plugins/TPComparisonTask.cc b/DQM/HcalTasks/plugins/TPComparisonTask.cc index e4fa33449e08e..37491e83d3111 100644 --- a/DQM/HcalTasks/plugins/TPComparisonTask.cc +++ b/DQM/HcalTasks/plugins/TPComparisonTask.cc @@ -3,276 +3,251 @@ using namespace hcaldqm; using namespace hcaldqm::constants; -TPComparisonTask::TPComparisonTask(edm::ParameterSet const& ps): - DQTask(ps) -{ - // tags and tokens - _tag1 = ps.getUntrackedParameter("tag1", - edm::InputTag("hcalDigis")); - _tag2 = ps.getUntrackedParameter("tag2", - edm::InputTag("vmeDigis")); - _tok1 = consumes(_tag1); - _tok2 = consumes(_tag2); - - // tmp flags - _skip1x1 = ps.getUntrackedParameter("skip1x1", true); +TPComparisonTask::TPComparisonTask(edm::ParameterSet const& ps) : DQTask(ps) { + // tags and tokens + _tag1 = ps.getUntrackedParameter("tag1", edm::InputTag("hcalDigis")); + _tag2 = ps.getUntrackedParameter("tag2", edm::InputTag("vmeDigis")); + _tok1 = consumes(_tag1); + _tok2 = consumes(_tag2); + + // tmp flags + _skip1x1 = ps.getUntrackedParameter("skip1x1", true); } -/* virtual */ void TPComparisonTask::bookHistograms(DQMStore::IBooker &ib, - edm::Run const& r, edm::EventSetup const& es) -{ - DQTask::bookHistograms(ib, r, es); - - // GET WHAT YOU NEED - edm::ESHandle dbs; - es.get().get(dbs); - edm::ESHandle item; - es.get().get("full", item); - _emap = item.product(); - if (_ptype != fOffline) { // hidefed2crate - std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); - std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); - std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); - } - std::vector vhashVME; - std::vector vhashuTCA; - vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); - vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vhashVME); - _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vhashuTCA); - - // INTIALIZE CONTAINERS - for (unsigned int i=0; i<4; i++) - { - _cEt_TTSubdet[i].initialize(_name, "Et", - hcaldqm::hashfunctions::fTTSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cFG_TTSubdet[i].initialize(_name, "FG", - hcaldqm::hashfunctions::fTTSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fFG), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fFG), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - } - _cEtall_TTSubdet.initialize(_name, "Et", - hcaldqm::hashfunctions::fTTSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - - if (_ptype != fOffline) { // hidefed2crate - _cMsn_FEDVME.initialize(_name, "Missing", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSLBSLBCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMsn_FEDuTCA.initialize(_name, "Missing", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCATPFiberChuTCATP), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cEtMsm_FEDVME.initialize(_name, "EtMsm", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSLBSLBCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cEtMsm_FEDuTCA.initialize(_name, "EtMsm", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCATPFiberChuTCATP), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cFGMsm_FEDVME.initialize(_name, "FGMsm", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSLBSLBCh), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cFGMsm_FEDuTCA.initialize(_name, "FGMsm", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCATPFiberChuTCATP), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - } - - _cMsnuTCA.initialize(_name, "Missing", - new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), - new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMsnVME.initialize(_name, "Missing", - new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), - new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cEtMsm.initialize(_name, "EtMsm", - new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), - new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cFGMsm.initialize(_name, "FGMsm", - new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), - new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - char aux[20]; - for (unsigned int i=0; i<4; i++) - { - sprintf(aux, "TS%d", i); - _cEt_TTSubdet[i].book(ib, _emap, _subsystem, aux); - _cFG_TTSubdet[i].book(ib, _emap, _subsystem, aux); - } - _cEtall_TTSubdet.book(ib, _emap, _subsystem); - if (_ptype != fOffline) { // hidefed2crate - _cMsn_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cEtMsm_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cFGMsm_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cMsn_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cEtMsm_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cFGMsm_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); - } - - _cMsnuTCA.book(ib, _subsystem, std::string("uTCA")); - _cMsnVME.book(ib, _subsystem, std::string("VME")); - _cEtMsm.book(ib, _subsystem); - _cFGMsm.book(ib, _subsystem); - - _ehashmapuTCA.initialize(_emap, hcaldqm::electronicsmap::fT2EHashMap, - _filter_VME); - _ehashmapVME.initialize(_emap, hcaldqm::electronicsmap::fT2EHashMap, - _filter_uTCA); -// _ehashmap.print(); -// _cMsn_depth.book(ib); -// _cEtMsm_depth.book(ib); -// _cFGMsm_depth.book(ib); +/* virtual */ void TPComparisonTask::bookHistograms(DQMStore::IBooker& ib, + edm::Run const& r, + edm::EventSetup const& es) { + DQTask::bookHistograms(ib, r, es); + + // GET WHAT YOU NEED + edm::ESHandle dbs; + es.get().get(dbs); + edm::ESHandle item; + es.get().get("full", item); + _emap = item.product(); + if (_ptype != fOffline) { // hidefed2crate + std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); + std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); + std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); + } + std::vector vhashVME; + std::vector vhashuTCA; + vhashVME.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); + vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vhashVME); + _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vhashuTCA); + + // INTIALIZE CONTAINERS + for (unsigned int i = 0; i < 4; i++) { + _cEt_TTSubdet[i].initialize(_name, + "Et", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cFG_TTSubdet[i].initialize(_name, + "FG", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fFG), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fFG), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + } + _cEtall_TTSubdet.initialize(_name, + "Et", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + + if (_ptype != fOffline) { // hidefed2crate + _cMsn_FEDVME.initialize(_name, + "Missing", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSLBSLBCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMsn_FEDuTCA.initialize(_name, + "Missing", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCATPFiberChuTCATP), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cEtMsm_FEDVME.initialize(_name, + "EtMsm", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSLBSLBCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cEtMsm_FEDuTCA.initialize(_name, + "EtMsm", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCATPFiberChuTCATP), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cFGMsm_FEDVME.initialize(_name, + "FGMsm", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSLBSLBCh), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cFGMsm_FEDuTCA.initialize(_name, + "FGMsm", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCATPFiberChuTCATP), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + } + + _cMsnuTCA.initialize(_name, + "Missing", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMsnVME.initialize(_name, + "Missing", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cEtMsm.initialize(_name, + "EtMsm", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cFGMsm.initialize(_name, + "FGMsm", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + char aux[20]; + for (unsigned int i = 0; i < 4; i++) { + sprintf(aux, "TS%d", i); + _cEt_TTSubdet[i].book(ib, _emap, _subsystem, aux); + _cFG_TTSubdet[i].book(ib, _emap, _subsystem, aux); + } + _cEtall_TTSubdet.book(ib, _emap, _subsystem); + if (_ptype != fOffline) { // hidefed2crate + _cMsn_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cEtMsm_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cFGMsm_FEDVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMsn_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cEtMsm_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cFGMsm_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem); + } + + _cMsnuTCA.book(ib, _subsystem, std::string("uTCA")); + _cMsnVME.book(ib, _subsystem, std::string("VME")); + _cEtMsm.book(ib, _subsystem); + _cFGMsm.book(ib, _subsystem); + + _ehashmapuTCA.initialize(_emap, hcaldqm::electronicsmap::fT2EHashMap, _filter_VME); + _ehashmapVME.initialize(_emap, hcaldqm::electronicsmap::fT2EHashMap, _filter_uTCA); + // _ehashmap.print(); + // _cMsn_depth.book(ib); + // _cEtMsm_depth.book(ib); + // _cFGMsm_depth.book(ib); } -/* virtual */ void TPComparisonTask::_resetMonitors(hcaldqm::UpdateFreq uf) -{ - DQTask::_resetMonitors(uf); +/* virtual */ void TPComparisonTask::_resetMonitors(hcaldqm::UpdateFreq uf) { DQTask::_resetMonitors(uf); } + +/* virtual */ void TPComparisonTask::_process(edm::Event const& e, edm::EventSetup const& es) { + edm::Handle coll1; + edm::Handle coll2; + + if (!e.getByToken(_tok1, coll1)) + _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available" + _tag1.label() + " " + _tag1.instance()); + if (!e.getByToken(_tok2, coll2)) + _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available" + _tag2.label() + " " + _tag2.instance()); + + // assume always coll1 is primary (uTCA) and coll2 is secondary(VME) + for (HcalTrigPrimDigiCollection::const_iterator it1 = coll1->begin(); it1 != coll1->end(); ++it1) { + // iterate thru utca collection + // get the same detid digi from vme collection + // if missing - fill vme missing + // else correlate + // tmp + if (_skip1x1) + if (it1->id().version() > 0) + continue; + // \tmp + + HcalTrigTowerDetId tid = it1->id(); + HcalTrigPrimDigiCollection::const_iterator it2 = coll2->find(HcalTrigTowerDetId(tid.ieta(), tid.iphi(), 0)); + HcalElectronicsId eid1 = HcalElectronicsId(_ehashmapuTCA.lookup(tid)); + HcalElectronicsId eid2 = HcalElectronicsId(_ehashmapVME.lookup(tid)); + + if (it2 == coll2->end()) { + // missing from VME collection + _cMsnVME.fill(tid); + if (_ptype != fOffline) { // hidefed2crate + _cMsn_FEDVME.fill(eid2); + } + for (int i = 0; i < it1->size(); i++) { + _cEtall_TTSubdet.fill(tid, it1->sample(i).compressedEt(), -2); + _cEt_TTSubdet[i].fill(tid, it1->sample(i).compressedEt(), -2); + } + } else + for (int i = 0; i < it1->size(); i++) { + _cEtall_TTSubdet.fill(tid, it1->sample(i).compressedEt(), it2->sample(i).compressedEt()); + _cEt_TTSubdet[i].fill(tid, it1->sample(i).compressedEt(), it2->sample(i).compressedEt()); + _cFG_TTSubdet[i].fill(tid, it1->sample(i).fineGrain(), it2->sample(i).fineGrain()); + if (it1->sample(i).compressedEt() != it2->sample(i).compressedEt()) { + if (_ptype != fOffline) { // hidefed2crate + _cEtMsm_FEDuTCA.fill(eid1); + _cEtMsm_FEDVME.fill(eid2); + } + _cEtMsm.fill(tid); + } + if (it1->sample(i).fineGrain() != it2->sample(i).fineGrain()) { + if (_ptype != fOffline) { // hidefed2crate + _cFGMsm_FEDuTCA.fill(eid1); + _cFGMsm_FEDVME.fill(eid2); + } + _cFGMsm.fill(tid); + } + } + } + for (HcalTrigPrimDigiCollection::const_iterator it2 = coll2->begin(); it2 != coll2->end(); ++it2) { + // itearte thru VME + // find utca tp digi by detid + // check if present of missing + HcalTrigTowerDetId tid = it2->id(); + if (_skip1x1) + if (tid.version() > 0) + continue; + + HcalTrigPrimDigiCollection::const_iterator it1 = coll1->find(HcalTrigTowerDetId(tid.ieta(), tid.iphi(), 0)); + if (it1 == coll1->end()) { + HcalElectronicsId eid1 = HcalElectronicsId(_ehashmapuTCA.lookup(tid)); + if (_ptype != fOffline) { // hidefed2crate + _cMsn_FEDuTCA.fill(eid1); + } + _cMsnuTCA.fill(tid); + for (int i = 0; i < it2->size(); i++) { + _cEtall_TTSubdet.fill(tid, -2, it2->sample(i).compressedEt()); + _cEt_TTSubdet[i].fill(tid, -2, it2->sample(i).compressedEt()); + } + } + } } -/* virtual */ void TPComparisonTask::_process(edm::Event const& e, - edm::EventSetup const& es) -{ - edm::Handle coll1; - edm::Handle coll2; - - if (!e.getByToken(_tok1, coll1)) - _logger.dqmthrow( - "Collection HcalTrigPrimDigiCollection isn't available" + - _tag1.label() + " " + _tag1.instance()); - if (!e.getByToken(_tok2, coll2)) - _logger.dqmthrow( - "Collection HcalTrigPrimDigiCollection isn't available" + - _tag2.label() + " " + _tag2.instance()); - - // assume always coll1 is primary (uTCA) and coll2 is secondary(VME) - for (HcalTrigPrimDigiCollection::const_iterator it1=coll1->begin(); - it1!=coll1->end(); ++it1) - { - // iterate thru utca collection - // get the same detid digi from vme collection - // if missing - fill vme missing - // else correlate - // tmp - if (_skip1x1) - if (it1->id().version()>0) - continue; - // \tmp - - HcalTrigTowerDetId tid = it1->id(); - HcalTrigPrimDigiCollection::const_iterator it2=coll2->find( - HcalTrigTowerDetId(tid.ieta(), tid.iphi(), 0)); - HcalElectronicsId eid1 = HcalElectronicsId( - _ehashmapuTCA.lookup(tid)); - HcalElectronicsId eid2 = HcalElectronicsId( - _ehashmapVME.lookup(tid)); - - if (it2==coll2->end()) - { - // missing from VME collection - _cMsnVME.fill(tid); - if (_ptype != fOffline) { // hidefed2crate - _cMsn_FEDVME.fill(eid2); - } - for (int i=0; isize(); i++) - { - _cEtall_TTSubdet.fill(tid, - it1->sample(i).compressedEt(), -2); - _cEt_TTSubdet[i].fill(tid, - it1->sample(i).compressedEt(), -2); - } - } - else - for (int i=0; isize(); i++) - { - _cEtall_TTSubdet.fill(tid, - it1->sample(i).compressedEt(), - it2->sample(i).compressedEt()); - _cEt_TTSubdet[i].fill(tid, - it1->sample(i).compressedEt(), - it2->sample(i).compressedEt()); - _cFG_TTSubdet[i].fill(tid, - it1->sample(i).fineGrain(), - it2->sample(i).fineGrain()); - if (it1->sample(i).compressedEt()!= - it2->sample(i).compressedEt()) - { - if (_ptype != fOffline) { // hidefed2crate - _cEtMsm_FEDuTCA.fill(eid1); - _cEtMsm_FEDVME.fill(eid2); - } - _cEtMsm.fill(tid); - } - if (it1->sample(i).fineGrain()!= - it2->sample(i).fineGrain()) - { - if (_ptype != fOffline) { // hidefed2crate - _cFGMsm_FEDuTCA.fill(eid1); - _cFGMsm_FEDVME.fill(eid2); - } - _cFGMsm.fill(tid); - } - } - } - for (HcalTrigPrimDigiCollection::const_iterator it2=coll2->begin(); - it2!=coll2->end(); ++it2) - { - // itearte thru VME - // find utca tp digi by detid - // check if present of missing - HcalTrigTowerDetId tid = it2->id(); - if (_skip1x1) - if (tid.version()>0) - continue; - - HcalTrigPrimDigiCollection::const_iterator it1=coll1->find( - HcalTrigTowerDetId(tid.ieta(), tid.iphi(), 0)); - if (it1==coll1->end()) - { - HcalElectronicsId eid1 = HcalElectronicsId( - _ehashmapuTCA.lookup(tid)); - if (_ptype != fOffline) { // hidefed2crate - _cMsn_FEDuTCA.fill(eid1); - } - _cMsnuTCA.fill(tid); - for (int i=0; isize(); i++) - { - _cEtall_TTSubdet.fill(tid, - -2, it2->sample(i).compressedEt()); - _cEt_TTSubdet[i].fill(tid, -2, it2->sample(i).compressedEt()); - } - } - } -} - -/* virtual */ void TPComparisonTask::endLuminosityBlock( - edm::LuminosityBlock const& lb, edm::EventSetup const& es) -{ - // in the end always - DQTask::endLuminosityBlock(lb, es); +/* virtual */ void TPComparisonTask::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + // in the end always + DQTask::endLuminosityBlock(lb, es); } DEFINE_FWK_MODULE(TPComparisonTask); - diff --git a/DQM/HcalTasks/plugins/TPTask.cc b/DQM/HcalTasks/plugins/TPTask.cc index 0a38e48f8ba59..cc9d69a584f98 100644 --- a/DQM/HcalTasks/plugins/TPTask.cc +++ b/DQM/HcalTasks/plugins/TPTask.cc @@ -1,656 +1,783 @@ #include "DQM/HcalTasks/interface/TPTask.h" -#include "DQM/L1TMonitor/interface/L1TStage2CaloLayer1.h" // For ComparisonHelper::zip - +#include "DQM/L1TMonitor/interface/L1TStage2CaloLayer1.h" // For ComparisonHelper::zip using namespace hcaldqm; using namespace hcaldqm::constants; -TPTask::TPTask(edm::ParameterSet const& ps): - DQTask(ps) -{ - _tagData = ps.getUntrackedParameter("tagData", - edm::InputTag("hcalDigis")); - _tagDataL1Rec = ps.getUntrackedParameter("tagDataL1Rec", - edm::InputTag("caloLayer1Digis")); - _tagEmul = ps.getUntrackedParameter("tagEmul", - edm::InputTag("emulDigis")); - _tagEmulNoTDCCut = ps.getUntrackedParameter("tagEmulNoTDCCut", - edm::InputTag("emulTPDigisNoTDCCut")); - - _tokData = consumes(_tagData); - _tokDataL1Rec = consumes(_tagDataL1Rec); - _tokEmul = consumes(_tagEmul); - _tokEmulNoTDCCut = consumes(_tagEmulNoTDCCut); - - _skip1x1 = ps.getUntrackedParameter("skip1x1", true); - _cutEt = ps.getUntrackedParameter("cutEt", 3); - _thresh_EtMsmRate_high = ps.getUntrackedParameter( - "thresh_EtMsmRate_high", 0.2); - _thresh_EtMsmRate_low = ps.getUntrackedParameter( - "thresh_EtMsmRate_low", 0.05); - _thresh_FGMsmRate_high = ps.getUntrackedParameter( - "thresh_FGMsmRate", 0.2); - _thresh_FGMsmRate_low = ps.getUntrackedParameter( - "thresh_FGMsmRate_low", 0.05); - _thresh_DataMsn = ps.getUntrackedParameter("thresh_DataMsn", - 0.1); - _thresh_EmulMsn = ps.getUntrackedParameter("thresh_EmulMsn"); - std::vector tmp = ps.getUntrackedParameter >("vFGBitsReady"); - for (uint32_t iii=0; iii("tagData", edm::InputTag("hcalDigis")); + _tagDataL1Rec = ps.getUntrackedParameter("tagDataL1Rec", edm::InputTag("caloLayer1Digis")); + _tagEmul = ps.getUntrackedParameter("tagEmul", edm::InputTag("emulDigis")); + _tagEmulNoTDCCut = ps.getUntrackedParameter("tagEmulNoTDCCut", edm::InputTag("emulTPDigisNoTDCCut")); + + _tokData = consumes(_tagData); + _tokDataL1Rec = consumes(_tagDataL1Rec); + _tokEmul = consumes(_tagEmul); + _tokEmulNoTDCCut = consumes(_tagEmulNoTDCCut); + + _skip1x1 = ps.getUntrackedParameter("skip1x1", true); + _cutEt = ps.getUntrackedParameter("cutEt", 3); + _thresh_EtMsmRate_high = ps.getUntrackedParameter("thresh_EtMsmRate_high", 0.2); + _thresh_EtMsmRate_low = ps.getUntrackedParameter("thresh_EtMsmRate_low", 0.05); + _thresh_FGMsmRate_high = ps.getUntrackedParameter("thresh_FGMsmRate", 0.2); + _thresh_FGMsmRate_low = ps.getUntrackedParameter("thresh_FGMsmRate_low", 0.05); + _thresh_DataMsn = ps.getUntrackedParameter("thresh_DataMsn", 0.1); + _thresh_EmulMsn = ps.getUntrackedParameter("thresh_EmulMsn"); + std::vector tmp = ps.getUntrackedParameter >("vFGBitsReady"); + for (uint32_t iii = 0; iii < constants::NUM_FGBITS; iii++) + _vFGBitsReady.push_back(tmp[iii]); + + _vflags.resize(nTPFlag); + _vflags[fEtMsm] = flag::Flag("EtMsm"); + _vflags[fDataMsn] = flag::Flag("DataMsn"); + _vflags[fEmulMsn] = flag::Flag("EmulMsn"); + _vflags[fUnknownIds] = flag::Flag("UnknownIds"); + if (_ptype == fOnline) { + _vflags[fSentRecL1Msm] = flag::Flag("uHTR-L1TMsm"); + } } -/* virtual */ void TPTask::bookHistograms(DQMStore::IBooker& ib, - edm::Run const& r, edm::EventSetup const& es) -{ - DQTask::bookHistograms(ib,r,es); - - // GET WHAT YOU NEED - edm::ESHandle dbs; - es.get().get(dbs); - _emap = dbs->getHcalMapping(); - std::vector vVME; - std::vector vuTCA; - std::vector depth0; - vVME.push_back(HcalElectronicsId(FIBERCH_MIN, - FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); - vuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vVME); - _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, - vuTCA); - depth0.push_back(HcalTrigTowerDetId(1, 1, 0).rawId()); - _filter_depth0.initialize(filter::fPreserver, hcaldqm::hashfunctions::fTTdepth, - depth0); - - // INITIALIZE FIRST - // Et/FG - _cEtData_TTSubdet.initialize(_name, "EtData", hcaldqm::hashfunctions::fTTSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_128), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cEtEmul_TTSubdet.initialize(_name, "EtEmul", hcaldqm::hashfunctions::fTTSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_128), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cEtCorr_TTSubdet.initialize(_name, "EtCorr", hcaldqm::hashfunctions::fTTSubdet, - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - for (uint8_t iii=0; iii vFEDs = hcaldqm::utilities::getFEDList(_emap); - std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); - std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); - // push the rawIds of each fed into the vector - // this vector is used at endlumi for online state generation - for (std::vector::const_iterator it=vFEDsVME.begin(); - it!=vFEDsVME.end(); ++it) - { - _vhashFEDs.push_back(HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, - SPIGOT_MIN, (*it)-FED_VME_MIN).rawId()); - } - for (std::vector::const_iterator it=vFEDsuTCA.begin(); - it!=vFEDsuTCA.end(); ++it) - { - std::pair cspair = hcaldqm::utilities::fed2crate(*it); - _vhashFEDs.push_back(HcalElectronicsId(cspair.first, - cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - } - _cEtData_ElectronicsVME.initialize(_name, "EtData", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256),0); - _cEtData_ElectronicsuTCA.initialize(_name, "EtData", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256),0); - _cEtEmul_ElectronicsVME.initialize(_name, "EtEmul", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256),0); - _cEtEmul_ElectronicsuTCA.initialize(_name, "EtEmul", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256),0); - // Occupancies - _cOccupancyData_ElectronicsVME.initialize(_name, "OccupancyData", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cOccupancyEmul_ElectronicsVME.initialize(_name, "OccupancyEmul", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cOccupancyData_ElectronicsuTCA.initialize(_name, "OccupancyData", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cOccupancyEmul_ElectronicsuTCA.initialize(_name, "OccupancyEmul", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - - _cOccupancyCutData_ElectronicsVME.initialize(_name, "OccupancyCutData", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cOccupancyCutEmul_ElectronicsVME.initialize(_name, "OccupancyCutEmul", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cOccupancyCutData_ElectronicsuTCA.initialize(_name, "OccupancyCutData", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - _cOccupancyCutEmul_ElectronicsuTCA.initialize(_name, "OccupancyCutEmul", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),0); - // Mismatches - _cEtMsm_ElectronicsVME.initialize(_name, "EtMsm", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cFGMsm_ElectronicsVME.initialize(_name, "FGMsm", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cEtMsm_ElectronicsuTCA.initialize(_name, "EtMsm", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cFGMsm_ElectronicsuTCA.initialize(_name, "FGMsm", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - - // Missing Data w.r.t. Emulator - _cMsnData_ElectronicsVME.initialize(_name, "MsnData", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMsnData_ElectronicsuTCA.initialize(_name, "MsnData", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMsnEmul_ElectronicsVME.initialize(_name, "MsnEmul", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cMsnEmul_ElectronicsuTCA.initialize(_name, "MsnEmul", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cEtCorrRatio_ElectronicsVME.initialize(_name, "EtCorrRatio", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsVME), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio_0to2),0); - _cEtCorrRatio_ElectronicsuTCA.initialize(_name, "EtCorrRatio", - hcaldqm::hashfunctions::fElectronics, - new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), - new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio_0to2),0); - if (_ptype == fOnline) { - _cSummaryvsLS_FED.initialize(_name, "SummaryvsLS", - hcaldqm::hashfunctions::fFED, - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::FlagQuantity(_vflags), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),0); - _cSummaryvsLS.initialize(_name, "SummaryvsLS", - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::FEDQuantity(vFEDs), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),0); - - _xEtMsm.initialize(hcaldqm::hashfunctions::fFED); - _xFGMsm.initialize(hcaldqm::hashfunctions::fFED); - _xNumCorr.initialize(hcaldqm::hashfunctions::fFED); - _xDataMsn.initialize(hcaldqm::hashfunctions::fFED); - _xDataTotal.initialize(hcaldqm::hashfunctions::fFED); - _xEmulMsn.initialize(hcaldqm::hashfunctions::fFED); - _xEmulTotal.initialize(hcaldqm::hashfunctions::fFED); - _xSentRecL1Msm.initialize(hcaldqm::hashfunctions::fFED); - } - } - - // BOOK HISTOGRAMS - char aux[20]; - for (unsigned int iii=0; iiisetLumiFlag(); +/* virtual */ void TPTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + DQTask::bookHistograms(ib, r, es); + + // GET WHAT YOU NEED + edm::ESHandle dbs; + es.get().get(dbs); + _emap = dbs->getHcalMapping(); + std::vector vVME; + std::vector vuTCA; + std::vector depth0; + vVME.push_back(HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); + vuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vVME); + _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vuTCA); + depth0.push_back(HcalTrigTowerDetId(1, 1, 0).rawId()); + _filter_depth0.initialize(filter::fPreserver, hcaldqm::hashfunctions::fTTdepth, depth0); + + // INITIALIZE FIRST + // Et/FG + _cEtData_TTSubdet.initialize(_name, + "EtData", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_128), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cEtEmul_TTSubdet.initialize(_name, + "EtEmul", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_128), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cEtCorr_TTSubdet.initialize(_name, + "EtCorr", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + for (uint8_t iii = 0; iii < constants::NUM_FGBITS; iii++) { + _cFGCorr_TTSubdet[iii].initialize(_name, + "FGCorr", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fFG), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fFG), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + } + + _cEtData_depthlike.initialize(_name, + "EtData", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256), + 0); + _cEtEmul_depthlike.initialize(_name, + "EtEmul", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256), + 0); + _cEtCutData_depthlike.initialize(_name, + "EtCutData", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256), + 0); + _cEtCutEmul_depthlike.initialize(_name, + "EtCutEmul", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256), + 0); + + // Occupancy + _cOccupancyData_depthlike.initialize(_name, + "OccupancyData", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cOccupancyEmul_depthlike.initialize(_name, + "OccupancyEmul", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cOccupancyCutData_depthlike.initialize(_name, + "OccupancyCutData", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cOccupancyCutEmul_depthlike.initialize(_name, + "OccupancyCutEmul", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + + // Mismatches + _cEtMsm_depthlike.initialize(_name, + "EtMsm", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cFGMsm_depthlike.initialize(_name, + "FGMsm", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + if (_ptype == fOnline) { + // Mismatches: sent vs received + _cEtMsm_uHTR_L1T_depthlike.initialize(_name, + "EtMsm_uHTR_L1T", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cEtMsm_uHTR_L1T_LS.initialize(_name, + "EtMsm_uHTR_L1T_LS", + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + } + + // Missing Data w.r.t. Emulator + _cMsnData_depthlike.initialize(_name, + "MsnData", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMsnEmul_depthlike.initialize(_name, + "MsnEmul", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cEtCorrRatio_depthlike.initialize(_name, + "EtCorrRatio", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio_0to2), + 0); + + _cOccupancyDatavsBX_TTSubdet.initialize(_name, + "OccupancyDatavsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyEmulvsBX_TTSubdet.initialize(_name, + "OccupancyEmulvsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCutDatavsBX_TTSubdet.initialize(_name, + "OccupancyCutDatavsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCutEmulvsBX_TTSubdet.initialize(_name, + "OccupancyCutEmulvsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + // INITIALIZE HISTOGRAMS to be used in Online only! + if (_ptype == fOnline) { + _cEtCorr2x3_TTSubdet.initialize(_name, + "EtCorr2x3", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cOccupancyData2x3_depthlike.initialize(_name, + "OccupancyData2x3", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta2x3), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cOccupancyEmul2x3_depthlike.initialize(_name, + "OccupancyEmul2x3", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta2x3), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cEtCutDatavsLS_TTSubdet.initialize(_name, + "EtCutDatavsLS", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), + 0); + _cEtCutEmulvsLS_TTSubdet.initialize(_name, + "EtCutEmulvsLS", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), + 0); + _cEtCutDatavsBX_TTSubdet.initialize(_name, + "EtCutDatavsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), + 0); + _cEtCutEmulvsBX_TTSubdet.initialize(_name, + "EtCutEmulvsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256), + 0); + _cEtCorrRatiovsLS_TTSubdet.initialize(_name, + "EtCorrRatiovsLS", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio_0to2), + 0); + _cEtCorrRatiovsBX_TTSubdet.initialize(_name, + "EtCorrRatiovsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio_0to2), + 0); + _cEtMsmRatiovsLS_TTSubdet.initialize(_name, + "EtMsmRatiovsLS", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio), + 0); + _cEtMsmRatiovsBX_TTSubdet.initialize(_name, + "EtMsmRatiovsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio), + 0); + _cEtMsmvsLS_TTSubdet.initialize(_name, + "EtMsmvsLS", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cEtMsmvsBX_TTSubdet.initialize(_name, + "EtMsmvsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMsnDatavsLS_TTSubdet.initialize(_name, + "MsnDatavsLS", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMsnCutDatavsLS_TTSubdet.initialize(_name, + "MsnCutDatavsLS", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMsnDatavsBX_TTSubdet.initialize(_name, + "MsnDatavsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMsnCutDatavsBX_TTSubdet.initialize(_name, + "MsnCutDatavsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMsnEmulvsLS_TTSubdet.initialize(_name, + "MsnEmulvsLS", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMsnCutEmulvsLS_TTSubdet.initialize(_name, + "MsnCutEmulvsLS", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMsnEmulvsBX_TTSubdet.initialize(_name, + "MsnEmulvsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMsnCutEmulvsBX_TTSubdet.initialize(_name, + "MsnCutEmulvsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyDatavsLS_TTSubdet.initialize(_name, + "OccupancyDatavsLS", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCutDatavsLS_TTSubdet.initialize(_name, + "OccupancyCutDatavsLS", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyDatavsBX_TTSubdet.initialize(_name, + "OccupancyDatavsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCutDatavsBX_TTSubdet.initialize(_name, + "OccupancyCutDatavsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyEmulvsLS_TTSubdet.initialize(_name, + "OccupancyEmulvsLS", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCutEmulvsLS_TTSubdet.initialize(_name, + "OccupancyCutEmulvsLS", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyEmulvsBX_TTSubdet.initialize(_name, + "OccupancyEmulvsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cOccupancyCutEmulvsBX_TTSubdet.initialize(_name, + "OccupancyCutEmulvsBX", + hcaldqm::hashfunctions::fTTSubdet, + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + _cOccupancy_HF_depth.initialize(_name, + "OccupancyDataHF_depth", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cOccupancyNoTDC_HF_depth.initialize(_name, + "OccupancyEmulHFNoTDC_depth", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cOccupancy_HF_ieta.initialize(_name, + "OccupancyDataHF_ieta", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0), + _cOccupancyNoTDC_HF_ieta.initialize(_name, + "OccupancyEmulHFNoTDC_ieta", + new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + } + + // FED-based containers + if (_ptype != fOffline) { // hidefed2crate + std::vector vFEDs = hcaldqm::utilities::getFEDList(_emap); + std::vector vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap); + std::vector vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap); + // push the rawIds of each fed into the vector + // this vector is used at endlumi for online state generation + for (std::vector::const_iterator it = vFEDsVME.begin(); it != vFEDsVME.end(); ++it) { + _vhashFEDs.push_back(HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, (*it) - FED_VME_MIN).rawId()); + } + for (std::vector::const_iterator it = vFEDsuTCA.begin(); it != vFEDsuTCA.end(); ++it) { + std::pair cspair = hcaldqm::utilities::fed2crate(*it); + _vhashFEDs.push_back(HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + } + _cEtData_ElectronicsVME.initialize(_name, + "EtData", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256), + 0); + _cEtData_ElectronicsuTCA.initialize(_name, + "EtData", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256), + 0); + _cEtEmul_ElectronicsVME.initialize(_name, + "EtEmul", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256), + 0); + _cEtEmul_ElectronicsuTCA.initialize(_name, + "EtEmul", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256), + 0); + // Occupancies + _cOccupancyData_ElectronicsVME.initialize(_name, + "OccupancyData", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cOccupancyEmul_ElectronicsVME.initialize(_name, + "OccupancyEmul", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cOccupancyData_ElectronicsuTCA.initialize(_name, + "OccupancyData", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cOccupancyEmul_ElectronicsuTCA.initialize(_name, + "OccupancyEmul", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + + _cOccupancyCutData_ElectronicsVME.initialize(_name, + "OccupancyCutData", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cOccupancyCutEmul_ElectronicsVME.initialize(_name, + "OccupancyCutEmul", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cOccupancyCutData_ElectronicsuTCA.initialize( + _name, + "OccupancyCutData", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + _cOccupancyCutEmul_ElectronicsuTCA.initialize( + _name, + "OccupancyCutEmul", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), + 0); + // Mismatches + _cEtMsm_ElectronicsVME.initialize(_name, + "EtMsm", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cFGMsm_ElectronicsVME.initialize(_name, + "FGMsm", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cEtMsm_ElectronicsuTCA.initialize(_name, + "EtMsm", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cFGMsm_ElectronicsuTCA.initialize(_name, + "FGMsm", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + + // Missing Data w.r.t. Emulator + _cMsnData_ElectronicsVME.initialize(_name, + "MsnData", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMsnData_ElectronicsuTCA.initialize(_name, + "MsnData", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMsnEmul_ElectronicsVME.initialize(_name, + "MsnEmul", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cMsnEmul_ElectronicsuTCA.initialize(_name, + "MsnEmul", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cEtCorrRatio_ElectronicsVME.initialize(_name, + "EtCorrRatio", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsVME), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSpigot), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio_0to2), + 0); + _cEtCorrRatio_ElectronicsuTCA.initialize(_name, + "EtCorrRatio", + hcaldqm::hashfunctions::fElectronics, + new hcaldqm::quantity::FEDQuantity(vFEDsuTCA), + new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio_0to2), + 0); + if (_ptype == fOnline) { + _cSummaryvsLS_FED.initialize(_name, + "SummaryvsLS", + hcaldqm::hashfunctions::fFED, + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::FlagQuantity(_vflags), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState), + 0); + _cSummaryvsLS.initialize(_name, + "SummaryvsLS", + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::FEDQuantity(vFEDs), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState), + 0); + + _xEtMsm.initialize(hcaldqm::hashfunctions::fFED); + _xFGMsm.initialize(hcaldqm::hashfunctions::fFED); + _xNumCorr.initialize(hcaldqm::hashfunctions::fFED); + _xDataMsn.initialize(hcaldqm::hashfunctions::fFED); + _xDataTotal.initialize(hcaldqm::hashfunctions::fFED); + _xEmulMsn.initialize(hcaldqm::hashfunctions::fFED); + _xEmulTotal.initialize(hcaldqm::hashfunctions::fFED); + _xSentRecL1Msm.initialize(hcaldqm::hashfunctions::fFED); + } + } + + // BOOK HISTOGRAMS + char aux[20]; + for (unsigned int iii = 0; iii < constants::NUM_FGBITS; iii++) { + sprintf(aux, "BIT%d", iii); + _cFGCorr_TTSubdet[iii].book(ib, _emap, _subsystem, aux); + } + _cEtData_TTSubdet.book(ib, _emap, _subsystem); + _cEtEmul_TTSubdet.book(ib, _emap, _subsystem); + _cEtCorr_TTSubdet.book(ib, _emap, _subsystem); + if (_ptype != fOffline) { // hidefed2crate + _cEtData_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cEtData_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cEtEmul_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cEtEmul_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + } + _cEtData_depthlike.book(ib, _subsystem); + _cEtEmul_depthlike.book(ib, _subsystem); + _cEtCutData_depthlike.book(ib, _subsystem); + _cEtCutEmul_depthlike.book(ib, _subsystem); + if (_ptype != fOffline) { // hidefed2crate + _cOccupancyData_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancyEmul_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancyData_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cOccupancyEmul_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cOccupancyCutData_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancyCutEmul_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cOccupancyCutData_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cOccupancyCutEmul_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + } + _cOccupancyData_depthlike.book(ib, _subsystem); + _cOccupancyEmul_depthlike.book(ib, _subsystem); + _cOccupancyCutData_depthlike.book(ib, _subsystem); + _cOccupancyCutEmul_depthlike.book(ib, _subsystem); + + _cEtCorrRatio_depthlike.book(ib, _subsystem); + _cEtMsm_depthlike.book(ib, _subsystem); + _cFGMsm_depthlike.book(ib, _subsystem); + _cMsnData_depthlike.book(ib, _subsystem); + _cMsnEmul_depthlike.book(ib, _subsystem); + + if (_ptype == fOnline) { + _cEtMsm_uHTR_L1T_depthlike.book(ib, _subsystem); + _cEtMsm_uHTR_L1T_LS.book(ib, _subsystem); + } + + if (_ptype != fOffline) { // hidefed2crate + _cEtMsm_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cEtMsm_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cFGMsm_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cFGMsm_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cMsnData_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMsnData_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cMsnEmul_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cMsnEmul_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cEtCorrRatio_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cEtCorrRatio_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + } + + // whatever has to go online only goes here + if (_ptype == fOnline) { + _cEtCorr2x3_TTSubdet.book(ib, _emap, _subsystem); + _cOccupancyData2x3_depthlike.book(ib, _subsystem); + _cOccupancyEmul2x3_depthlike.book(ib, _subsystem); + _cEtCutDatavsLS_TTSubdet.book(ib, _emap, _subsystem); + _cEtCutEmulvsLS_TTSubdet.book(ib, _emap, _subsystem); + _cEtCutDatavsBX_TTSubdet.book(ib, _emap, _subsystem); + _cEtCutEmulvsBX_TTSubdet.book(ib, _emap, _subsystem); + _cEtCorrRatiovsLS_TTSubdet.book(ib, _emap, _subsystem); + _cEtCorrRatiovsBX_TTSubdet.book(ib, _emap, _subsystem); + _cEtMsmvsLS_TTSubdet.book(ib, _emap, _subsystem); + _cEtMsmvsBX_TTSubdet.book(ib, _emap, _subsystem); + _cEtMsmRatiovsLS_TTSubdet.book(ib, _emap, _subsystem); + _cEtMsmRatiovsBX_TTSubdet.book(ib, _emap, _subsystem); + _cMsnDatavsLS_TTSubdet.book(ib, _emap, _subsystem); + _cMsnCutDatavsLS_TTSubdet.book(ib, _emap, _subsystem); + _cMsnDatavsBX_TTSubdet.book(ib, _emap, _subsystem); + _cMsnCutDatavsBX_TTSubdet.book(ib, _emap, _subsystem); + _cMsnEmulvsLS_TTSubdet.book(ib, _emap, _subsystem); + _cMsnCutEmulvsLS_TTSubdet.book(ib, _emap, _subsystem); + _cMsnEmulvsBX_TTSubdet.book(ib, _emap, _subsystem); + _cMsnCutEmulvsBX_TTSubdet.book(ib, _emap, _subsystem); + _cOccupancyDatavsBX_TTSubdet.book(ib, _emap, _subsystem); + _cOccupancyEmulvsBX_TTSubdet.book(ib, _emap, _subsystem); + _cOccupancyCutDatavsBX_TTSubdet.book(ib, _emap, _subsystem); + _cOccupancyCutEmulvsBX_TTSubdet.book(ib, _emap, _subsystem); + _cOccupancyDatavsLS_TTSubdet.book(ib, _emap, _subsystem); + _cOccupancyEmulvsLS_TTSubdet.book(ib, _emap, _subsystem); + _cOccupancyCutDatavsLS_TTSubdet.book(ib, _emap, _subsystem); + _cOccupancyCutEmulvsLS_TTSubdet.book(ib, _emap, _subsystem); + _cSummaryvsLS_FED.book(ib, _emap, _subsystem); + _cSummaryvsLS.book(ib, _subsystem); + + _xEtMsm.book(_emap); + _xFGMsm.book(_emap); + _xNumCorr.book(_emap); + _xDataMsn.book(_emap); + _xDataTotal.book(_emap); + _xEmulMsn.book(_emap); + _xEmulTotal.book(_emap); + _xSentRecL1Msm.book(_emap); + + _cOccupancy_HF_depth.book(ib, _subsystem); + _cOccupancyNoTDC_HF_depth.book(ib, _subsystem); + _cOccupancy_HF_ieta.book(ib, _subsystem); + _cOccupancyNoTDC_HF_ieta.book(ib, _subsystem); + } + + // initialize the hash map + _ehashmap.initialize(_emap, hcaldqm::electronicsmap::fT2EHashMap); + + // book the flag for unknown ids and the online guy as well + ib.setCurrentFolder(_subsystem + "/" + _name); + meUnknownIds1LS = ib.book1D("UnknownIds", "UnknownIds", 1, 0, 1); + _unknownIdsPresent = false; + meUnknownIds1LS->setLumiFlag(); } -/* virtual */ void TPTask::_resetMonitors(hcaldqm::UpdateFreq uf) -{ - DQTask::_resetMonitors(uf); - switch (uf) - { - case hcaldqm::f1LS: - _unknownIdsPresent = false; - break; - default : - break; - } +/* virtual */ void TPTask::_resetMonitors(hcaldqm::UpdateFreq uf) { + DQTask::_resetMonitors(uf); + switch (uf) { + case hcaldqm::f1LS: + _unknownIdsPresent = false; + break; + default: + break; + } } -/* virtual */ void TPTask::_process(edm::Event const& e, - edm::EventSetup const&) -{ - edm::Handle cdata; - edm::Handle cdataL1Rec; - edm::Handle cemul; - edm::Handle cemul_noTDCCut; - if (!e.getByToken(_tokData, cdata)) - _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available: " - + _tagData.label() + " " + _tagData.instance()); - if (_ptype == fOnline) { - if (!e.getByToken(_tokDataL1Rec, cdataL1Rec)) - _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available: " - + _tagDataL1Rec.label() + " " + _tagDataL1Rec.instance()); - } - if (!e.getByToken(_tokEmul, cemul)) - _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available: " - + _tagEmul.label() + " " + _tagEmul.instance()); - if (_ptype == fOnline) { - if (!e.getByToken(_tokEmulNoTDCCut, cemul_noTDCCut)) { - _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available: " - + _tagEmulNoTDCCut.label() + " " + _tagEmulNoTDCCut.instance()); - } - } - - // extract some info per event - int bx = e.bunchCrossing(); - - // some summaries... per event - int numHBHE(0), numHF(0), numCutHBHE(0), numCutHF(0); - int numCorrHBHE(0), numCorrHF(0); - int numMsmHBHE(0), numMsmHF(0); - int numMsnHBHE(0), numMsnHF(0), numMsnCutHBHE(0), numMsnCutHF(0); - - // for explanation see RecHit or Digi Tasks - uint32_t rawidHBHEValid = 0; - uint32_t rawidHFValid = 0; - - /* +/* virtual */ void TPTask::_process(edm::Event const& e, edm::EventSetup const&) { + edm::Handle cdata; + edm::Handle cdataL1Rec; + edm::Handle cemul; + edm::Handle cemul_noTDCCut; + if (!e.getByToken(_tokData, cdata)) + _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available: " + _tagData.label() + " " + + _tagData.instance()); + if (_ptype == fOnline) { + if (!e.getByToken(_tokDataL1Rec, cdataL1Rec)) + _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available: " + _tagDataL1Rec.label() + " " + + _tagDataL1Rec.instance()); + } + if (!e.getByToken(_tokEmul, cemul)) + _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available: " + _tagEmul.label() + " " + + _tagEmul.instance()); + if (_ptype == fOnline) { + if (!e.getByToken(_tokEmulNoTDCCut, cemul_noTDCCut)) { + _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available: " + _tagEmulNoTDCCut.label() + " " + + _tagEmulNoTDCCut.instance()); + } + } + + // extract some info per event + int bx = e.bunchCrossing(); + + // some summaries... per event + int numHBHE(0), numHF(0), numCutHBHE(0), numCutHF(0); + int numCorrHBHE(0), numCorrHF(0); + int numMsmHBHE(0), numMsmHF(0); + int numMsnHBHE(0), numMsnHF(0), numMsnCutHBHE(0), numMsnCutHF(0); + + // for explanation see RecHit or Digi Tasks + uint32_t rawidHBHEValid = 0; + uint32_t rawidHFValid = 0; + + /* * STEP1: * Loop over the data digis and * - do ... for all the data digis @@ -659,284 +786,242 @@ TPTask::TPTask(edm::ParameterSet const& ps): * --- compare soi FG * --- Do not fill anything for emulator Et!!! */ - for (HcalTrigPrimDigiCollection::const_iterator it=cdata->begin(); - it!=cdata->end(); ++it) - { - // Explicit check on the DetIds present in the Collection - HcalTrigTowerDetId tid = it->id(); - uint32_t rawid = _ehashmap.lookup(tid); - if (rawid==0) { - meUnknownIds1LS->Fill(1); - _unknownIdsPresent = true; - continue; - } - HcalElectronicsId const& eid(rawid); - if (tid.ietaAbs()>=29) - rawidHFValid = tid.rawId(); - else - rawidHBHEValid = tid.rawId(); - - // - // HF 2x3 TPs Treat theam separately and only for ONLINE! - // - if (tid.version()==0 && tid.ietaAbs()>=29) - { - // do this only for online processing - if (_ptype == fOnline) - { - _cOccupancyData2x3_depthlike.fill(tid); - HcalTrigPrimDigiCollection::const_iterator jt=cemul->find(tid); - if (jt!=cemul->end()) - _cEtCorr2x3_TTSubdet.fill(tid, it->SOI_compressedEt(), - jt->SOI_compressedEt()); - } - - // skip to the next tp digi - continue; - } - - // FROM THIS POINT, HBHE + 1x1 HF TPs - int soiEt_d = it->t0().compressedEt(); - int soiFG_d[constants::NUM_FGBITS]; - for (uint32_t ibit=0; ibitt0().fineGrain(ibit)?1:0; - tid.ietaAbs()>=29?numHF++:numHBHE++; - - // fill w/o a cut - _cEtData_TTSubdet.fill(tid, soiEt_d); - _cEtData_depthlike.fill(tid, soiEt_d); - _cOccupancyData_depthlike.fill(tid); - - if (_ptype == fOnline) { - if (tid.ietaAbs()>=29) { - if (soiEt_d > 0) { - _cOccupancy_HF_depth.fill(tid); - _cOccupancy_HF_ieta.fill(tid); - } - } - } - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - { - _cOccupancyData_ElectronicsVME.fill(eid); - _cEtData_ElectronicsVME.fill(eid, soiEt_d); - } - else - { - _cOccupancyData_ElectronicsuTCA.fill(eid); - _cEtData_ElectronicsuTCA.fill(eid, soiEt_d); - } - } - - // FILL w/a CUT - if (soiEt_d>_cutEt) - { - tid.ietaAbs()>=29?numCutHF++:numCutHBHE++; - _cOccupancyCutData_depthlike.fill(tid); - _cEtCutData_depthlike.fill(tid, soiEt_d); - - // ONLINE ONLY! - if (_ptype==fOnline) - { - _cEtCutDatavsLS_TTSubdet.fill(tid, _currentLS, soiEt_d); - _cEtCutDatavsBX_TTSubdet.fill(tid, bx, soiEt_d); - _xDataTotal.get(eid)++; - } - // ^^^ONLINE ONLY! - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - _cOccupancyCutData_ElectronicsVME.fill(eid); - else - _cOccupancyCutData_ElectronicsuTCA.fill(eid); - } - } - - // FIND the EMULATOR DIGI - HcalTrigPrimDigiCollection::const_iterator jt=cemul->find(tid); - if (jt!=cemul->end()) - { - // if PRESENT! - int soiEt_e = jt->SOI_compressedEt(); - int soiFG_e[constants::NUM_FGBITS]; - for (uint32_t ibit=0; ibitt0().fineGrain(ibit)?1:0; - // if both are zeroes => set 1 - double rEt = soiEt_d==0 && soiEt_e==0?1: - double(std::min(soiEt_d, soiEt_e))/ - double(std::max(soiEt_e, soiEt_d)); - - // ONLINE ONLY! - if (_ptype==fOnline) - { - _xNumCorr.get(eid)++; - tid.ietaAbs()>=29?numCorrHF++:numCorrHBHE++; - _cEtCorrRatiovsLS_TTSubdet.fill(tid, _currentLS, rEt); - _cEtCorrRatiovsBX_TTSubdet.fill(tid, bx, rEt); - } - // ^^^ONLINE ONLY! - - _cEtCorrRatio_depthlike.fill(tid, rEt); - _cEtCorr_TTSubdet.fill(tid, soiEt_d, soiEt_e); - for (uint32_t ibit=0; ibit=29?numMsmHF++:numMsmHBHE++; - _cEtMsm_depthlike.fill(tid); - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - _cEtMsm_ElectronicsVME.fill(eid); - else - _cEtMsm_ElectronicsuTCA.fill(eid); - } - if (_ptype==fOnline) - _xEtMsm.get(eid)++; - } - // if SOI FG are not equal - // fill mismatched. - // Do this comparison only for FG Bits that are commissioned - for (uint32_t ibit=0; ibit=29?numMsnHF++:numMsnHBHE++; - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - _cMsnEmul_ElectronicsVME.fill(eid); - else - _cMsnEmul_ElectronicsuTCA.fill(eid); - } - - if (soiEt_d>_cutEt) - { - tid.ietaAbs()>=29?numMsnCutHF++:numMsnCutHBHE++; - if (_ptype==fOnline) - _xEmulMsn.get(eid)++; - } - } - } - - if (_ptype == fOnline) { - for (HcalTrigPrimDigiCollection::const_iterator it=cemul_noTDCCut->begin(); it!=cemul_noTDCCut->end(); ++it) { - // Explicit check on the DetIds present in the Collection - HcalTrigTowerDetId tid = it->id(); - uint32_t rawid = _ehashmap.lookup(tid); - if (rawid==0) { - continue; - } - if (tid.version()==0 && tid.ietaAbs()>=29) - { - continue; - } - int soiEt_e = it->SOI_compressedEt(); - if (tid.ietaAbs() >= 29) { - if (soiEt_e > 0) { - _cOccupancyNoTDC_HF_depth.fill(tid); - _cOccupancyNoTDC_HF_ieta.fill(tid); - } - } - } - } - - if (rawidHFValid!=0 && rawidHBHEValid!=0) - { - // ONLINE ONLY! - if (_ptype==fOnline) - { - _cOccupancyDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, - numHBHE); - _cOccupancyDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, - numHF); - _cOccupancyCutDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - bx, numCutHBHE); - _cOccupancyCutDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, - numCutHF); - _cOccupancyDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - _currentLS, numHBHE); - _cOccupancyDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), - _currentLS,numHF); - _cOccupancyCutDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - _currentLS, numCutHBHE); - _cOccupancyCutDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), - _currentLS, numCutHF); - - _cEtMsmvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, - numMsmHBHE); - _cEtMsmvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, - numMsmHF); - _cEtMsmvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, - numMsmHBHE); - _cEtMsmvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, - numMsmHF); - - _cEtMsmRatiovsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - _currentLS, - double(numMsmHBHE)/double(numCorrHBHE)); - _cEtMsmRatiovsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), - _currentLS, - double(numMsmHF)/double(numCorrHF)); - _cEtMsmRatiovsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, - double(numMsmHBHE)/double(numCorrHBHE)); - _cEtMsmRatiovsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, - double(numMsmHF)/double(numCorrHF)); - - _cMsnEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - _currentLS, numMsnHBHE); - _cMsnEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), - _currentLS, numMsnHF); - _cMsnCutEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - _currentLS, numMsnCutHBHE); - _cMsnCutEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), - _currentLS, numMsnCutHF); - - _cMsnEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - bx, numMsnHBHE); - _cMsnEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), - bx, numMsnHF); - _cMsnCutEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - bx, numMsnCutHBHE); - _cMsnCutEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), - bx, numMsnCutHF); - } - } - - numHBHE=0; numHF=0; numCutHBHE=0; numCutHF=0; - numMsnHBHE=0; numMsnHF=0; numCutHBHE=0; numCutHF=0; - - // reset - rawidHBHEValid = 0; - rawidHFValid = 0; - - /* + for (HcalTrigPrimDigiCollection::const_iterator it = cdata->begin(); it != cdata->end(); ++it) { + // Explicit check on the DetIds present in the Collection + HcalTrigTowerDetId tid = it->id(); + uint32_t rawid = _ehashmap.lookup(tid); + if (rawid == 0) { + meUnknownIds1LS->Fill(1); + _unknownIdsPresent = true; + continue; + } + HcalElectronicsId const& eid(rawid); + if (tid.ietaAbs() >= 29) + rawidHFValid = tid.rawId(); + else + rawidHBHEValid = tid.rawId(); + + // + // HF 2x3 TPs Treat theam separately and only for ONLINE! + // + if (tid.version() == 0 && tid.ietaAbs() >= 29) { + // do this only for online processing + if (_ptype == fOnline) { + _cOccupancyData2x3_depthlike.fill(tid); + HcalTrigPrimDigiCollection::const_iterator jt = cemul->find(tid); + if (jt != cemul->end()) + _cEtCorr2x3_TTSubdet.fill(tid, it->SOI_compressedEt(), jt->SOI_compressedEt()); + } + + // skip to the next tp digi + continue; + } + + // FROM THIS POINT, HBHE + 1x1 HF TPs + int soiEt_d = it->t0().compressedEt(); + int soiFG_d[constants::NUM_FGBITS]; + for (uint32_t ibit = 0; ibit < constants::NUM_FGBITS; ibit++) + soiFG_d[ibit] = it->t0().fineGrain(ibit) ? 1 : 0; + tid.ietaAbs() >= 29 ? numHF++ : numHBHE++; + + // fill w/o a cut + _cEtData_TTSubdet.fill(tid, soiEt_d); + _cEtData_depthlike.fill(tid, soiEt_d); + _cOccupancyData_depthlike.fill(tid); + + if (_ptype == fOnline) { + if (tid.ietaAbs() >= 29) { + if (soiEt_d > 0) { + _cOccupancy_HF_depth.fill(tid); + _cOccupancy_HF_ieta.fill(tid); + } + } + } + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) { + _cOccupancyData_ElectronicsVME.fill(eid); + _cEtData_ElectronicsVME.fill(eid, soiEt_d); + } else { + _cOccupancyData_ElectronicsuTCA.fill(eid); + _cEtData_ElectronicsuTCA.fill(eid, soiEt_d); + } + } + + // FILL w/a CUT + if (soiEt_d > _cutEt) { + tid.ietaAbs() >= 29 ? numCutHF++ : numCutHBHE++; + _cOccupancyCutData_depthlike.fill(tid); + _cEtCutData_depthlike.fill(tid, soiEt_d); + + // ONLINE ONLY! + if (_ptype == fOnline) { + _cEtCutDatavsLS_TTSubdet.fill(tid, _currentLS, soiEt_d); + _cEtCutDatavsBX_TTSubdet.fill(tid, bx, soiEt_d); + _xDataTotal.get(eid)++; + } + // ^^^ONLINE ONLY! + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) + _cOccupancyCutData_ElectronicsVME.fill(eid); + else + _cOccupancyCutData_ElectronicsuTCA.fill(eid); + } + } + + // FIND the EMULATOR DIGI + HcalTrigPrimDigiCollection::const_iterator jt = cemul->find(tid); + if (jt != cemul->end()) { + // if PRESENT! + int soiEt_e = jt->SOI_compressedEt(); + int soiFG_e[constants::NUM_FGBITS]; + for (uint32_t ibit = 0; ibit < constants::NUM_FGBITS; ibit++) + soiFG_e[ibit] = jt->t0().fineGrain(ibit) ? 1 : 0; + // if both are zeroes => set 1 + double rEt = + soiEt_d == 0 && soiEt_e == 0 ? 1 : double(std::min(soiEt_d, soiEt_e)) / double(std::max(soiEt_e, soiEt_d)); + + // ONLINE ONLY! + if (_ptype == fOnline) { + _xNumCorr.get(eid)++; + tid.ietaAbs() >= 29 ? numCorrHF++ : numCorrHBHE++; + _cEtCorrRatiovsLS_TTSubdet.fill(tid, _currentLS, rEt); + _cEtCorrRatiovsBX_TTSubdet.fill(tid, bx, rEt); + } + // ^^^ONLINE ONLY! + + _cEtCorrRatio_depthlike.fill(tid, rEt); + _cEtCorr_TTSubdet.fill(tid, soiEt_d, soiEt_e); + for (uint32_t ibit = 0; ibit < constants::NUM_FGBITS; ibit++) + _cFGCorr_TTSubdet[ibit].fill(tid, soiFG_d[ibit], soiFG_e[ibit]); + // FILL w/o a CUT + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) { + _cEtCorrRatio_ElectronicsVME.fill(eid, rEt); + } else { + _cEtCorrRatio_ElectronicsuTCA.fill(eid, rEt); + } + } + + // if SOI Et are not equal + // fill mismatched + if (soiEt_d != soiEt_e) { + tid.ietaAbs() >= 29 ? numMsmHF++ : numMsmHBHE++; + _cEtMsm_depthlike.fill(tid); + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) + _cEtMsm_ElectronicsVME.fill(eid); + else + _cEtMsm_ElectronicsuTCA.fill(eid); + } + if (_ptype == fOnline) + _xEtMsm.get(eid)++; + } + // if SOI FG are not equal + // fill mismatched. + // Do this comparison only for FG Bits that are commissioned + for (uint32_t ibit = 0; ibit < constants::NUM_FGBITS; ibit++) + if (soiFG_d[ibit] != soiFG_e[ibit] && _vFGBitsReady[ibit]) { + _cFGMsm_depthlike.fill(tid); + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) + _cFGMsm_ElectronicsVME.fill(eid); + else + _cFGMsm_ElectronicsuTCA.fill(eid); + } + if (_ptype == fOnline) + _xFGMsm.get(eid)++; + } + } else { + // IF MISSING + _cEtCorr_TTSubdet.fill(tid, soiEt_d, -2); + _cMsnEmul_depthlike.fill(tid); + tid.ietaAbs() >= 29 ? numMsnHF++ : numMsnHBHE++; + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) + _cMsnEmul_ElectronicsVME.fill(eid); + else + _cMsnEmul_ElectronicsuTCA.fill(eid); + } + + if (soiEt_d > _cutEt) { + tid.ietaAbs() >= 29 ? numMsnCutHF++ : numMsnCutHBHE++; + if (_ptype == fOnline) + _xEmulMsn.get(eid)++; + } + } + } + + if (_ptype == fOnline) { + for (HcalTrigPrimDigiCollection::const_iterator it = cemul_noTDCCut->begin(); it != cemul_noTDCCut->end(); ++it) { + // Explicit check on the DetIds present in the Collection + HcalTrigTowerDetId tid = it->id(); + uint32_t rawid = _ehashmap.lookup(tid); + if (rawid == 0) { + continue; + } + if (tid.version() == 0 && tid.ietaAbs() >= 29) { + continue; + } + int soiEt_e = it->SOI_compressedEt(); + if (tid.ietaAbs() >= 29) { + if (soiEt_e > 0) { + _cOccupancyNoTDC_HF_depth.fill(tid); + _cOccupancyNoTDC_HF_ieta.fill(tid); + } + } + } + } + + if (rawidHFValid != 0 && rawidHBHEValid != 0) { + // ONLINE ONLY! + if (_ptype == fOnline) { + _cOccupancyDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numHBHE); + _cOccupancyDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numHF); + _cOccupancyCutDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numCutHBHE); + _cOccupancyCutDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numCutHF); + _cOccupancyDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numHBHE); + _cOccupancyDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numHF); + _cOccupancyCutDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numCutHBHE); + _cOccupancyCutDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numCutHF); + + _cEtMsmvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numMsmHBHE); + _cEtMsmvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numMsmHF); + _cEtMsmvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numMsmHBHE); + _cEtMsmvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numMsmHF); + + _cEtMsmRatiovsLS_TTSubdet.fill( + HcalTrigTowerDetId(rawidHBHEValid), _currentLS, double(numMsmHBHE) / double(numCorrHBHE)); + _cEtMsmRatiovsLS_TTSubdet.fill( + HcalTrigTowerDetId(rawidHFValid), _currentLS, double(numMsmHF) / double(numCorrHF)); + _cEtMsmRatiovsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, double(numMsmHBHE) / double(numCorrHBHE)); + _cEtMsmRatiovsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, double(numMsmHF) / double(numCorrHF)); + + _cMsnEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numMsnHBHE); + _cMsnEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numMsnHF); + _cMsnCutEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numMsnCutHBHE); + _cMsnCutEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numMsnCutHF); + + _cMsnEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numMsnHBHE); + _cMsnEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numMsnHF); + _cMsnCutEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numMsnCutHBHE); + _cMsnCutEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numMsnCutHF); + } + } + + numHBHE = 0; + numHF = 0; + numCutHBHE = 0; + numCutHF = 0; + numMsnHBHE = 0; + numMsnHF = 0; + numCutHBHE = 0; + numCutHF = 0; + + // reset + rawidHBHEValid = 0; + rawidHFValid = 0; + + /* * STEP2: * Loop over the emulator digis and * - do ... for all the emulator digis @@ -944,222 +1029,192 @@ TPTask::TPTask(edm::ParameterSet const& ps): * --- if found skip * --- if not found - fill the missing Data plot */ - for (HcalTrigPrimDigiCollection::const_iterator it=cemul->begin(); - it!=cemul->end(); ++it) - { - // Explicit check on the DetIds present in the Collection - HcalTrigTowerDetId tid = it->id(); - uint32_t rawid = _ehashmap.lookup(tid); - if (rawid==0) - {meUnknownIds1LS->Fill(1); _unknownIdsPresent = true; continue;} - HcalElectronicsId const& eid(rawid); - if (tid.ietaAbs()>=29) - rawidHFValid = tid.rawId(); - else - rawidHBHEValid = tid.rawId(); - - // HF 2x3 TPs. Only do it for Online!!! - if (tid.version()==0 && tid.ietaAbs()>=29) - { - // only do this for online processing - if (_ptype==fOnline) - _cOccupancyEmul2x3_depthlike.fill(tid); - continue; - } - int soiEt = it->SOI_compressedEt(); - - // FILL/INCREMENT w/o a CUT - tid.ietaAbs()>=29?numHF++:numHBHE++; - _cEtEmul_TTSubdet.fill(tid, soiEt); - _cEtEmul_depthlike.fill(tid, soiEt); - _cOccupancyEmul_depthlike.fill(tid); - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - { - _cOccupancyEmul_ElectronicsVME.fill(eid); - _cEtEmul_ElectronicsVME.fill(eid, soiEt); - } - else - { - _cOccupancyEmul_ElectronicsuTCA.fill(eid); - _cEtEmul_ElectronicsuTCA.fill(eid, soiEt); - } - } - - // FILL w/ a CUT - if (soiEt>_cutEt) - { - tid.ietaAbs()>=29?numCutHF++:numCutHBHE++; - _cOccupancyCutEmul_depthlike.fill(tid); - _cEtCutEmul_depthlike.fill(tid, soiEt); - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - _cOccupancyCutEmul_ElectronicsVME.fill(eid); - else - _cOccupancyCutEmul_ElectronicsuTCA.fill(eid); - } - - // ONLINE ONLY! - if (_ptype==fOnline) - { - _cEtCutEmulvsLS_TTSubdet.fill(tid, _currentLS, soiEt); - _cEtCutEmulvsBX_TTSubdet.fill(tid, bx, soiEt); - _xEmulTotal.get(eid)++; - } - // ^^^ONLINE ONLY! - } - - // Look for a data digi. - // Do not perform if the emulated digi is zero suppressed. - if(!(it->zsMarkAndPass())) { - HcalTrigPrimDigiCollection::const_iterator jt=cdata->find(tid); - if (jt==cdata->end()) - { - tid.ietaAbs()>=29?numMsnHF++:numMsnHBHE++; - _cEtCorr_TTSubdet.fill(tid, -2, soiEt); - _cMsnData_depthlike.fill(tid); - if (_ptype != fOffline) { // hidefed2crate - if (eid.isVMEid()) - _cMsnData_ElectronicsVME.fill(eid); - else - _cMsnData_ElectronicsuTCA.fill(eid); - } - if (soiEt>_cutEt) - { - tid.ietaAbs()>=29?numMsnCutHF++:numMsnCutHBHE++; - if (_ptype==fOnline) - _xDataMsn.get(eid)++; - } - } - } - } - - // ONLINE ONLY! - if (_ptype==fOnline) { - if (rawidHBHEValid != 0) { - _cOccupancyEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, - numHBHE); - _cOccupancyCutEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - bx, - numCutHBHE); - _cOccupancyEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - _currentLS, numHBHE); - _cOccupancyCutEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - _currentLS, numCutHBHE); - _cMsnDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - _currentLS, numMsnHBHE); - _cMsnCutDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - _currentLS, numMsnCutHBHE); - _cMsnDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - bx, numMsnHBHE); - _cMsnCutDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), - bx, numMsnCutHBHE); - } - if (rawidHFValid!=0) { - _cOccupancyEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, - numHF); - _cOccupancyCutEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, - numCutHF); - _cOccupancyEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), - _currentLS,numHF); - _cOccupancyCutEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), - _currentLS, numCutHF); - _cMsnDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), - _currentLS, numMsnHF); - _cMsnCutDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), - _currentLS, numMsnCutHF); - _cMsnDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), - bx, numMsnHF); - _cMsnCutDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), - bx, numMsnCutHF); - } - // ^^^ONLINE ONLY! - } - - if (_ptype == fOnline) { - // Compare the sent ("uHTR") and received (L1T "layer1") TPs - // This algorithm is copied from DQM/L1TMonitor/src/L1TStage2CaloLayer1.cc - // ...but it turns out to be extremely useful for detecting uHTR problems - _vTPDigis_SentRec.clear(); - ComparisonHelper::zip(cdata->begin(), cdata->end(), - cdataL1Rec->begin(), cdataL1Rec->end(), - std::inserter(_vTPDigis_SentRec, _vTPDigis_SentRec.begin()), - HcalTrigPrimDigiCollection::key_compare()); - - for ( const auto& tpPair : _vTPDigis_SentRec) { - // From here, literal copy pasta from L1T - const auto& sentTp = tpPair.first; - const auto& recdTp = tpPair.second; - const int ieta = sentTp.id().ieta(); - if ( abs(ieta) > 28 && sentTp.id().version() != 1 ) continue; - //const int iphi = sentTp.id().iphi(); - const bool towerMasked = recdTp.sample(0).raw() & (1<<13); - //const bool linkMasked = recdTp.sample(0).raw() & (1<<14); - const bool linkError = recdTp.sample(0).raw() & (1<<15); - - if ( towerMasked || linkError ) { - // Do not compare if known to be bad - continue; - } - const bool HetAgreement = sentTp.SOI_compressedEt() == recdTp.SOI_compressedEt(); - const bool Hfb1Agreement = sentTp.SOI_fineGrain() == recdTp.SOI_fineGrain(); - // Ignore minBias (FB2) bit if we receieve 0 ET, which means it is likely zero-suppressed on HCal readout side - const bool Hfb2Agreement = ( abs(ieta) < 29 ) ? true : (recdTp.SOI_compressedEt()==0 || (sentTp.SOI_fineGrain(1) == recdTp.SOI_fineGrain(1))); - if (!(HetAgreement && Hfb1Agreement && Hfb2Agreement)) { - HcalTrigTowerDetId tid = sentTp.id(); - uint32_t rawid = _ehashmap.lookup(tid); - if (rawid==0) { - continue; - } - HcalElectronicsId const& eid(rawid); - - _cEtMsm_uHTR_L1T_depthlike.fill(tid); - _cEtMsm_uHTR_L1T_LS.fill(_currentLS); - _xSentRecL1Msm.get(eid)++; - } - } - } + for (HcalTrigPrimDigiCollection::const_iterator it = cemul->begin(); it != cemul->end(); ++it) { + // Explicit check on the DetIds present in the Collection + HcalTrigTowerDetId tid = it->id(); + uint32_t rawid = _ehashmap.lookup(tid); + if (rawid == 0) { + meUnknownIds1LS->Fill(1); + _unknownIdsPresent = true; + continue; + } + HcalElectronicsId const& eid(rawid); + if (tid.ietaAbs() >= 29) + rawidHFValid = tid.rawId(); + else + rawidHBHEValid = tid.rawId(); + + // HF 2x3 TPs. Only do it for Online!!! + if (tid.version() == 0 && tid.ietaAbs() >= 29) { + // only do this for online processing + if (_ptype == fOnline) + _cOccupancyEmul2x3_depthlike.fill(tid); + continue; + } + int soiEt = it->SOI_compressedEt(); + + // FILL/INCREMENT w/o a CUT + tid.ietaAbs() >= 29 ? numHF++ : numHBHE++; + _cEtEmul_TTSubdet.fill(tid, soiEt); + _cEtEmul_depthlike.fill(tid, soiEt); + _cOccupancyEmul_depthlike.fill(tid); + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) { + _cOccupancyEmul_ElectronicsVME.fill(eid); + _cEtEmul_ElectronicsVME.fill(eid, soiEt); + } else { + _cOccupancyEmul_ElectronicsuTCA.fill(eid); + _cEtEmul_ElectronicsuTCA.fill(eid, soiEt); + } + } + + // FILL w/ a CUT + if (soiEt > _cutEt) { + tid.ietaAbs() >= 29 ? numCutHF++ : numCutHBHE++; + _cOccupancyCutEmul_depthlike.fill(tid); + _cEtCutEmul_depthlike.fill(tid, soiEt); + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) + _cOccupancyCutEmul_ElectronicsVME.fill(eid); + else + _cOccupancyCutEmul_ElectronicsuTCA.fill(eid); + } + + // ONLINE ONLY! + if (_ptype == fOnline) { + _cEtCutEmulvsLS_TTSubdet.fill(tid, _currentLS, soiEt); + _cEtCutEmulvsBX_TTSubdet.fill(tid, bx, soiEt); + _xEmulTotal.get(eid)++; + } + // ^^^ONLINE ONLY! + } + + // Look for a data digi. + // Do not perform if the emulated digi is zero suppressed. + if (!(it->zsMarkAndPass())) { + HcalTrigPrimDigiCollection::const_iterator jt = cdata->find(tid); + if (jt == cdata->end()) { + tid.ietaAbs() >= 29 ? numMsnHF++ : numMsnHBHE++; + _cEtCorr_TTSubdet.fill(tid, -2, soiEt); + _cMsnData_depthlike.fill(tid); + if (_ptype != fOffline) { // hidefed2crate + if (eid.isVMEid()) + _cMsnData_ElectronicsVME.fill(eid); + else + _cMsnData_ElectronicsuTCA.fill(eid); + } + if (soiEt > _cutEt) { + tid.ietaAbs() >= 29 ? numMsnCutHF++ : numMsnCutHBHE++; + if (_ptype == fOnline) + _xDataMsn.get(eid)++; + } + } + } + } + + // ONLINE ONLY! + if (_ptype == fOnline) { + if (rawidHBHEValid != 0) { + _cOccupancyEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numHBHE); + _cOccupancyCutEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numCutHBHE); + _cOccupancyEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numHBHE); + _cOccupancyCutEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numCutHBHE); + _cMsnDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numMsnHBHE); + _cMsnCutDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numMsnCutHBHE); + _cMsnDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numMsnHBHE); + _cMsnCutDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numMsnCutHBHE); + } + if (rawidHFValid != 0) { + _cOccupancyEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numHF); + _cOccupancyCutEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numCutHF); + _cOccupancyEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numHF); + _cOccupancyCutEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numCutHF); + _cMsnDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numMsnHF); + _cMsnCutDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numMsnCutHF); + _cMsnDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numMsnHF); + _cMsnCutDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numMsnCutHF); + } + // ^^^ONLINE ONLY! + } + + if (_ptype == fOnline) { + // Compare the sent ("uHTR") and received (L1T "layer1") TPs + // This algorithm is copied from DQM/L1TMonitor/src/L1TStage2CaloLayer1.cc + // ...but it turns out to be extremely useful for detecting uHTR problems + _vTPDigis_SentRec.clear(); + ComparisonHelper::zip(cdata->begin(), + cdata->end(), + cdataL1Rec->begin(), + cdataL1Rec->end(), + std::inserter(_vTPDigis_SentRec, _vTPDigis_SentRec.begin()), + HcalTrigPrimDigiCollection::key_compare()); + + for (const auto& tpPair : _vTPDigis_SentRec) { + // From here, literal copy pasta from L1T + const auto& sentTp = tpPair.first; + const auto& recdTp = tpPair.second; + const int ieta = sentTp.id().ieta(); + if (abs(ieta) > 28 && sentTp.id().version() != 1) + continue; + //const int iphi = sentTp.id().iphi(); + const bool towerMasked = recdTp.sample(0).raw() & (1 << 13); + //const bool linkMasked = recdTp.sample(0).raw() & (1<<14); + const bool linkError = recdTp.sample(0).raw() & (1 << 15); + + if (towerMasked || linkError) { + // Do not compare if known to be bad + continue; + } + const bool HetAgreement = sentTp.SOI_compressedEt() == recdTp.SOI_compressedEt(); + const bool Hfb1Agreement = sentTp.SOI_fineGrain() == recdTp.SOI_fineGrain(); + // Ignore minBias (FB2) bit if we receieve 0 ET, which means it is likely zero-suppressed on HCal readout side + const bool Hfb2Agreement = + (abs(ieta) < 29) ? true + : (recdTp.SOI_compressedEt() == 0 || (sentTp.SOI_fineGrain(1) == recdTp.SOI_fineGrain(1))); + if (!(HetAgreement && Hfb1Agreement && Hfb2Agreement)) { + HcalTrigTowerDetId tid = sentTp.id(); + uint32_t rawid = _ehashmap.lookup(tid); + if (rawid == 0) { + continue; + } + HcalElectronicsId const& eid(rawid); + + _cEtMsm_uHTR_L1T_depthlike.fill(tid); + _cEtMsm_uHTR_L1T_LS.fill(_currentLS); + _xSentRecL1Msm.get(eid)++; + } + } + } } -/* virtual */ void TPTask::beginLuminosityBlock(edm::LuminosityBlock const& lb, - edm::EventSetup const& es) -{ - DQTask::beginLuminosityBlock(lb, es); +/* virtual */ void TPTask::beginLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + DQTask::beginLuminosityBlock(lb, es); } -/* virtual */ void TPTask::endLuminosityBlock(edm::LuminosityBlock const& lb, - edm::EventSetup const& es) -{ - if (_ptype!=fOnline) - return; - - // - // GENERATE STATUS ONLY FOR ONLINE! - // - for (std::vector::const_iterator it=_vhashFEDs.begin(); - it!=_vhashFEDs.end(); ++it) - { - flag::Flag fSum("TP"); - HcalElectronicsId eid = HcalElectronicsId(*it); - - std::vector::const_iterator cit=std::find( - _vcdaqEids.begin(), _vcdaqEids.end(), *it); - if (cit==_vcdaqEids.end()) - { - // not @cDAQ - for (uint32_t iflag=0; iflag<_vflags.size(); iflag++) - _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), - int(flag::fNCDAQ)); - _cSummaryvsLS.setBinContent(eid, _currentLS, int(flag::fNCDAQ)); - continue; - } - - if (hcaldqm::utilities::isFEDHBHE(eid) || hcaldqm::utilities::isFEDHF(eid)) - { - // FED is @cDAQ - double etmsm = _xNumCorr.get(eid)>0? - double(_xEtMsm.get(eid))/double(_xNumCorr.get(eid)):0; - /* +/* virtual */ void TPTask::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + if (_ptype != fOnline) + return; + + // + // GENERATE STATUS ONLY FOR ONLINE! + // + for (std::vector::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) { + flag::Flag fSum("TP"); + HcalElectronicsId eid = HcalElectronicsId(*it); + + std::vector::const_iterator cit = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), *it); + if (cit == _vcdaqEids.end()) { + // not @cDAQ + for (uint32_t iflag = 0; iflag < _vflags.size(); iflag++) + _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), int(flag::fNCDAQ)); + _cSummaryvsLS.setBinContent(eid, _currentLS, int(flag::fNCDAQ)); + continue; + } + + if (hcaldqm::utilities::isFEDHBHE(eid) || hcaldqm::utilities::isFEDHF(eid)) { + // FED is @cDAQ + double etmsm = _xNumCorr.get(eid) > 0 ? double(_xEtMsm.get(eid)) / double(_xNumCorr.get(eid)) : 0; + /* * UNUSED VARS * double dmsm = _xDataTotal.get(eid)>0? double(_xDataMsn.get(eid))/double(_xDataTotal.get(eid)):0; @@ -1168,13 +1223,13 @@ TPTask::TPTask(edm::ParameterSet const& ps): double fgmsm = _xNumCorr.get(eid)>0? double(_xFGMsm.get(eid))/double(_xNumCorr.get(eid)):0; */ - if (etmsm>=_thresh_EtMsmRate_high) - _vflags[fEtMsm]._state = flag::fBAD; - else if (etmsm>=_thresh_EtMsmRate_low) - _vflags[fEtMsm]._state = flag::fPROBLEMATIC; - else - _vflags[fEtMsm]._state = flag::fGOOD; - /* + if (etmsm >= _thresh_EtMsmRate_high) + _vflags[fEtMsm]._state = flag::fBAD; + else if (etmsm >= _thresh_EtMsmRate_low) + _vflags[fEtMsm]._state = flag::fPROBLEMATIC; + else + _vflags[fEtMsm]._state = flag::fGOOD; + /* * DISABLE THESE FLAGS FOR ONLINE FOR NOW! if (dmsm>=_thresh_DataMsn) _vflags[fDataMsn]._state = flag::fBAD; @@ -1185,47 +1240,45 @@ TPTask::TPTask(edm::ParameterSet const& ps): else _vflags[fEmulMsn]._state = flag::fGOOD; */ - - if (_ptype == fOnline) { - if (_xSentRecL1Msm.get(eid) >= 1) { - _vflags[fSentRecL1Msm]._state = flag::fBAD; - } else { - _vflags[fSentRecL1Msm]._state = flag::fGOOD; - } - } - } - - if (_unknownIdsPresent) - _vflags[fUnknownIds]._state = flag::fBAD; - else - _vflags[fUnknownIds]._state = flag::fGOOD; - - - - int iflag=0; - for (std::vector::iterator ft=_vflags.begin(); - ft!=_vflags.end(); ++ft) - { - _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), - ft->_state); - fSum+=(*ft); - iflag++; - - // this is the MUST! - // reset after using this flag - ft->reset(); - } - _cSummaryvsLS.setBinContent(eid, _currentLS, int(fSum._state)); - } - - // reset... - _xEtMsm.reset(); _xFGMsm.reset(); _xNumCorr.reset(); - _xDataMsn.reset(); _xDataTotal.reset(); _xEmulMsn.reset(); - _xEmulTotal.reset(); - - // in the end always do the DQTask::endLumi - DQTask::endLuminosityBlock(lb, es); + + if (_ptype == fOnline) { + if (_xSentRecL1Msm.get(eid) >= 1) { + _vflags[fSentRecL1Msm]._state = flag::fBAD; + } else { + _vflags[fSentRecL1Msm]._state = flag::fGOOD; + } + } + } + + if (_unknownIdsPresent) + _vflags[fUnknownIds]._state = flag::fBAD; + else + _vflags[fUnknownIds]._state = flag::fGOOD; + + int iflag = 0; + for (std::vector::iterator ft = _vflags.begin(); ft != _vflags.end(); ++ft) { + _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), ft->_state); + fSum += (*ft); + iflag++; + + // this is the MUST! + // reset after using this flag + ft->reset(); + } + _cSummaryvsLS.setBinContent(eid, _currentLS, int(fSum._state)); + } + + // reset... + _xEtMsm.reset(); + _xFGMsm.reset(); + _xNumCorr.reset(); + _xDataMsn.reset(); + _xDataTotal.reset(); + _xEmulMsn.reset(); + _xEmulTotal.reset(); + + // in the end always do the DQTask::endLumi + DQTask::endLuminosityBlock(lb, es); } DEFINE_FWK_MODULE(TPTask); - diff --git a/DQM/HcalTasks/plugins/UMNioTask.cc b/DQM/HcalTasks/plugins/UMNioTask.cc index 7c689edbab8c1..1bf2b67c084bf 100644 --- a/DQM/HcalTasks/plugins/UMNioTask.cc +++ b/DQM/HcalTasks/plugins/UMNioTask.cc @@ -3,148 +3,136 @@ using namespace hcaldqm; using namespace hcaldqm::constants; -UMNioTask::UMNioTask(edm::ParameterSet const& ps): - DQTask(ps) -{ - _tagHBHE = ps.getUntrackedParameter("tagHBHE", - edm::InputTag("hcalDigis")); - _tagHO = ps.getUntrackedParameter("tagHO", - edm::InputTag("hcalDigis")); - _tagHF = ps.getUntrackedParameter("tagHF", - edm::InputTag("hcalDigis")); - _taguMN = ps.getUntrackedParameter("taguMN", - edm::InputTag("hcalDigis")); - - _tokHBHE = consumes(_tagHBHE); - _tokHO = consumes(_tagHO); - _tokHF = consumes(_tagHF); - _tokuMN = consumes(_taguMN); - - _lowHBHE = ps.getUntrackedParameter("lowHBHE", - 20); - _lowHO = ps.getUntrackedParameter("lowHO", - 20); - _lowHF = ps.getUntrackedParameter("lowHF", - 20); - - // push all the event types to monitor - whole range basically - // This corresponds to all enum values in hcaldqm::constants::OrbitGapType - for (uint32_t type=constants::tNull; type("tagHBHE", edm::InputTag("hcalDigis")); + _tagHO = ps.getUntrackedParameter("tagHO", edm::InputTag("hcalDigis")); + _tagHF = ps.getUntrackedParameter("tagHF", edm::InputTag("hcalDigis")); + _taguMN = ps.getUntrackedParameter("taguMN", edm::InputTag("hcalDigis")); + + _tokHBHE = consumes(_tagHBHE); + _tokHO = consumes(_tagHO); + _tokHF = consumes(_tagHF); + _tokuMN = consumes(_taguMN); + + _lowHBHE = ps.getUntrackedParameter("lowHBHE", 20); + _lowHO = ps.getUntrackedParameter("lowHO", 20); + _lowHF = ps.getUntrackedParameter("lowHF", 20); + + // push all the event types to monitor - whole range basically + // This corresponds to all enum values in hcaldqm::constants::OrbitGapType + for (uint32_t type = constants::tNull; type < constants::nOrbitGapType; type++) { + _eventtypes.push_back(type); + } } - -/* virtual */ void UMNioTask::bookHistograms(DQMStore::IBooker &ib, - edm::Run const& r, edm::EventSetup const& es) -{ - if (_ptype==fLocal) - if (r.runAuxiliary().run()==1) - return; - - DQTask::bookHistograms(ib, r, es); - - edm::ESHandle dbService; - es.get().get(dbService); - _emap = dbService->getHcalMapping(); - - _cEventType.initialize(_name, "EventType", - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::EventType(_eventtypes), - new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0); - _cTotalCharge.initialize(_name, "TotalCharge", - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::DetectorQuantity(quantity::fSubdetPM), - new hcaldqm::quantity::ValueQuantity(quantity::ffC_10000, true),0); - _cTotalChargeProfile.initialize(_name, "TotalChargeProfile", - new hcaldqm::quantity::LumiSection(_maxLS), - new hcaldqm::quantity::DetectorQuantity(quantity::fSubdetPM), - new hcaldqm::quantity::ValueQuantity(quantity::ffC_10000, true),0); - _cEventType.book(ib, _subsystem); - _cTotalCharge.book(ib, _subsystem); - _cTotalChargeProfile.book(ib, _subsystem); + +/* virtual */ void UMNioTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + if (_ptype == fLocal) + if (r.runAuxiliary().run() == 1) + return; + + DQTask::bookHistograms(ib, r, es); + + edm::ESHandle dbService; + es.get().get(dbService); + _emap = dbService->getHcalMapping(); + + _cEventType.initialize(_name, + "EventType", + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::EventType(_eventtypes), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); + _cTotalCharge.initialize(_name, + "TotalCharge", + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::DetectorQuantity(quantity::fSubdetPM), + new hcaldqm::quantity::ValueQuantity(quantity::ffC_10000, true), + 0); + _cTotalChargeProfile.initialize(_name, + "TotalChargeProfile", + new hcaldqm::quantity::LumiSection(_maxLS), + new hcaldqm::quantity::DetectorQuantity(quantity::fSubdetPM), + new hcaldqm::quantity::ValueQuantity(quantity::ffC_10000, true), + 0); + _cEventType.book(ib, _subsystem); + _cTotalCharge.book(ib, _subsystem); + _cTotalChargeProfile.book(ib, _subsystem); } int UMNioTask::getOrbitGapIndex(uint8_t eventType, uint32_t laserType) { - constants::OrbitGapType orbitGapType; - if (eventType == constants::EVENTTYPE_PEDESTAL) { - orbitGapType = tPedestal; - } else if (eventType == constants::EVENTTYPE_LED) { - orbitGapType = tLED; - } else if (eventType == constants::EVENTTYPE_LASER) { - switch (laserType) - { - //case tNull : return "Null"; - //case tHFRaddam : return "HFRaddam"; - case 3 : return tHBHEHPD; - case 4 : return tHO; - case 5 : return tHF; - //case tZDC : return "ZDC"; - case 7 : return tHEPMega; - case 8 : return tHEMMega; - case 9 : return tHBPMega; - case 10 : return tHBMMega; - //case tCRF : return "CRF"; - //case tCalib : return "Calib"; - //case tSafe : return "Safe"; - default : return tUnknown; - } - } - return (int)(std::find(_eventtypes.begin(), _eventtypes.end(), orbitGapType) - _eventtypes.begin()); + constants::OrbitGapType orbitGapType; + if (eventType == constants::EVENTTYPE_PEDESTAL) { + orbitGapType = tPedestal; + } else if (eventType == constants::EVENTTYPE_LED) { + orbitGapType = tLED; + } else if (eventType == constants::EVENTTYPE_LASER) { + switch (laserType) { + //case tNull : return "Null"; + //case tHFRaddam : return "HFRaddam"; + case 3: + return tHBHEHPD; + case 4: + return tHO; + case 5: + return tHF; + //case tZDC : return "ZDC"; + case 7: + return tHEPMega; + case 8: + return tHEMMega; + case 9: + return tHBPMega; + case 10: + return tHBMMega; + //case tCRF : return "CRF"; + //case tCalib : return "Calib"; + //case tSafe : return "Safe"; + default: + return tUnknown; + } + } + return (int)(std::find(_eventtypes.begin(), _eventtypes.end(), orbitGapType) - _eventtypes.begin()); } +/* virtual */ void UMNioTask::_process(edm::Event const& e, edm::EventSetup const& es) { + edm::Handle cumn; + if (!e.getByToken(_tokuMN, cumn)) + return; + + uint8_t eventType = cumn->eventType(); + uint32_t laserType = cumn->valueUserWord(0); + _cEventType.fill(_currentLS, getOrbitGapIndex(eventType, laserType)); + + // Compute the Total Charge in the Detector... + edm::Handle chbhe; + edm::Handle cho; + edm::Handle chf; + + if (!e.getByToken(_tokHBHE, chbhe)) + _logger.dqmthrow("Collection HBHEDigiCollection isn't available " + _tagHBHE.label() + " " + _tagHBHE.instance()); + if (!e.getByToken(_tokHO, cho)) + _logger.dqmthrow("Collection HODigiCollection isn't available " + _tagHO.label() + " " + _tagHO.instance()); + if (!e.getByToken(_tokHF, chf)) + _logger.dqmthrow("Collection HFDigiCollection isn't available " + _tagHF.label() + " " + _tagHF.instance()); -/* virtual */ void UMNioTask::_process(edm::Event const& e, - edm::EventSetup const& es) -{ - edm::Handle cumn; - if (!e.getByToken(_tokuMN, cumn)) - return; - - uint8_t eventType = cumn->eventType(); - uint32_t laserType = cumn->valueUserWord(0); - _cEventType.fill(_currentLS, getOrbitGapIndex(eventType, laserType)); - - // Compute the Total Charge in the Detector... - edm::Handle chbhe; - edm::Handle cho; - edm::Handle chf; - - if (!e.getByToken(_tokHBHE, chbhe)) - _logger.dqmthrow("Collection HBHEDigiCollection isn't available " - + _tagHBHE.label() + " " + _tagHBHE.instance()); - if (!e.getByToken(_tokHO, cho)) - _logger.dqmthrow("Collection HODigiCollection isn't available " - + _tagHO.label() + " " + _tagHO.instance()); - if (!e.getByToken(_tokHF, chf)) - _logger.dqmthrow("Collection HFDigiCollection isn't available " - + _tagHF.label() + " " + _tagHF.instance()); - - for (HBHEDigiCollection::const_iterator it=chbhe->begin(); - it!=chbhe->end(); ++it) - { - double sumQ = hcaldqm::utilities::sumQ(*it, 2.5, 0, it->size()-1); - _cTotalCharge.fill(it->id(), _currentLS, sumQ); - _cTotalChargeProfile.fill(it->id(), _currentLS, sumQ); - } - for (HODigiCollection::const_iterator it=cho->begin(); - it!=cho->end(); ++it) - { - double sumQ = hcaldqm::utilities::sumQ(*it, 8.5, 0, it->size()-1); - _cTotalCharge.fill(it->id(), _currentLS, sumQ); - _cTotalChargeProfile.fill(it->id(), _currentLS, sumQ); - } - for (HFDigiCollection::const_iterator it=chf->begin(); - it!=chf->end(); ++it) - { - double sumQ = hcaldqm::utilities::sumQ(*it, 2.5, 0, it->size()-1); - _cTotalCharge.fill(it->id(), _currentLS, sumQ); - _cTotalChargeProfile.fill(it->id(), _currentLS, sumQ); - } + for (HBHEDigiCollection::const_iterator it = chbhe->begin(); it != chbhe->end(); ++it) { + double sumQ = hcaldqm::utilities::sumQ(*it, 2.5, 0, it->size() - 1); + _cTotalCharge.fill(it->id(), _currentLS, sumQ); + _cTotalChargeProfile.fill(it->id(), _currentLS, sumQ); + } + for (HODigiCollection::const_iterator it = cho->begin(); it != cho->end(); ++it) { + double sumQ = hcaldqm::utilities::sumQ(*it, 8.5, 0, it->size() - 1); + _cTotalCharge.fill(it->id(), _currentLS, sumQ); + _cTotalChargeProfile.fill(it->id(), _currentLS, sumQ); + } + for (HFDigiCollection::const_iterator it = chf->begin(); it != chf->end(); ++it) { + double sumQ = hcaldqm::utilities::sumQ(*it, 2.5, 0, it->size() - 1); + _cTotalCharge.fill(it->id(), _currentLS, sumQ); + _cTotalChargeProfile.fill(it->id(), _currentLS, sumQ); + } } -/* virtual */ void UMNioTask::endLuminosityBlock(edm::LuminosityBlock const& lb, - edm::EventSetup const& es) -{ - DQTask::endLuminosityBlock(lb, es); +/* virtual */ void UMNioTask::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) { + DQTask::endLuminosityBlock(lb, es); } DEFINE_FWK_MODULE(UMNioTask); diff --git a/DQM/HcalTasks/plugins/ZDCQIE10Task.cc b/DQM/HcalTasks/plugins/ZDCQIE10Task.cc index 38ef442468f82..75835a484e9c8 100644 --- a/DQM/HcalTasks/plugins/ZDCQIE10Task.cc +++ b/DQM/HcalTasks/plugins/ZDCQIE10Task.cc @@ -1,126 +1,116 @@ #include "DQM/HcalTasks/interface/ZDCQIE10Task.h" -ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps) -{ - // tags - _tagQIE10 = ps.getUntrackedParameter("tagQIE10", - edm::InputTag("hcalDigis", "ZDC")); - _tokQIE10 = consumes(_tagQIE10); +ZDCQIE10Task::ZDCQIE10Task(edm::ParameterSet const& ps) { + // tags + _tagQIE10 = ps.getUntrackedParameter("tagQIE10", edm::InputTag("hcalDigis", "ZDC")); + _tokQIE10 = consumes(_tagQIE10); } -/* virtual */ void ZDCQIE10Task::bookHistograms(DQMStore::IBooker &ib, - edm::Run const& r, edm::EventSetup const& es) -{ - - ib.cd(); - - //book histos per channel - std::string histoname; - for ( int channel = 1; channel < 6; channel++ ) { - // EM Pos - HcalZDCDetId didp(HcalZDCDetId::EM, true, channel); - histoname = "EM_P_" + std::to_string(channel) + "_1"; - ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel"); - _cADC_EChannel[didp()] = ib.book1D( histoname.c_str(), histoname.c_str(), 256, 0, 256); - _cADC_EChannel[didp()]->setAxisTitle("ADC", 1); - _cADC_EChannel[didp()]->setAxisTitle("N", 2); - ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel"); - _cADC_vs_TS_EChannel[didp()] = ib.book1D( histoname.c_str(), histoname.c_str(), 10, 0, 10); - _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1); - _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2); - - // EM Minus - HcalZDCDetId didm(HcalZDCDetId::EM, false, channel); - histoname = "EM_M_" + std::to_string(channel) + "_1"; - ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel"); - _cADC_EChannel[didm()] = ib.book1D( histoname.c_str(), histoname.c_str(), 256, 0, 256); - _cADC_EChannel[didm()]->setAxisTitle("ADC", 1); - _cADC_EChannel[didm()]->setAxisTitle("N", 2); - ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel"); - _cADC_vs_TS_EChannel[didm()] = ib.book1D( histoname.c_str(), histoname.c_str(), 10, 0, 10); - _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1); - _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2); - } - - for ( int channel = 1; channel < 5; channel++ ) { - // HAD Pos - HcalZDCDetId didp(HcalZDCDetId::HAD, true, channel); - histoname = "HAD_P_" + std::to_string(channel) + "_" + std::to_string(channel+2); - ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel"); - _cADC_EChannel[didp()] = ib.book1D( histoname.c_str(), histoname.c_str(), 256, 0, 256); - _cADC_EChannel[didp()]->setAxisTitle("ADC", 1); - _cADC_EChannel[didp()]->setAxisTitle("N", 2); - ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel"); - _cADC_vs_TS_EChannel[didp()] = ib.book1D( histoname.c_str(), histoname.c_str(), 10, 0, 10); - _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1); - _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2); - - // HAD Minus - HcalZDCDetId didm(HcalZDCDetId::HAD, false, channel); - histoname = "HAD_M_" + std::to_string(channel) + "_" + std::to_string(channel+2); - ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel"); - _cADC_EChannel[didm()] = ib.book1D( histoname.c_str(), histoname.c_str(), 256, 0, 256); - _cADC_EChannel[didm()]->setAxisTitle("ADC", 1); - _cADC_EChannel[didm()]->setAxisTitle("N", 2); - ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel"); - _cADC_vs_TS_EChannel[didm()] = ib.book1D( histoname.c_str(), histoname.c_str(), 10, 0, 10); - _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1); - _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2); - } - - for ( int channel = 1; channel < 17; channel++ ) { - // RPD Pos - HcalZDCDetId didp(HcalZDCDetId::RPD, true, channel); - histoname = "RPD_P_" + std::to_string(channel) + "_2"; - ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel"); - _cADC_EChannel[didp()] = ib.book1D( histoname.c_str(), histoname.c_str(), 256, 0, 256); - _cADC_EChannel[didp()]->setAxisTitle("ADC", 1); - _cADC_EChannel[didp()]->setAxisTitle("N", 2); - ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel"); - _cADC_vs_TS_EChannel[didp()] = ib.book1D( histoname.c_str(), histoname.c_str(), 10, 0, 10); - _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1); - _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2); - - // RPD Minus - HcalZDCDetId didm(HcalZDCDetId::RPD, false, channel); - histoname = "RPD_M_" + std::to_string(channel) + "_2"; - ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel"); - _cADC_EChannel[didm()] = ib.book1D( histoname.c_str(), histoname.c_str(), 256, 0, 256); - _cADC_EChannel[didm()]->setAxisTitle("ADC", 1); - _cADC_EChannel[didm()]->setAxisTitle("N", 2); - ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel"); - _cADC_vs_TS_EChannel[didm()] = ib.book1D( histoname.c_str(), histoname.c_str(), 10, 0, 10); - _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1); - _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2); - } - +/* virtual */ void ZDCQIE10Task::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + ib.cd(); + + //book histos per channel + std::string histoname; + for (int channel = 1; channel < 6; channel++) { + // EM Pos + HcalZDCDetId didp(HcalZDCDetId::EM, true, channel); + histoname = "EM_P_" + std::to_string(channel) + "_1"; + ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel"); + _cADC_EChannel[didp()] = ib.book1D(histoname.c_str(), histoname.c_str(), 256, 0, 256); + _cADC_EChannel[didp()]->setAxisTitle("ADC", 1); + _cADC_EChannel[didp()]->setAxisTitle("N", 2); + ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel"); + _cADC_vs_TS_EChannel[didp()] = ib.book1D(histoname.c_str(), histoname.c_str(), 10, 0, 10); + _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1); + _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2); + + // EM Minus + HcalZDCDetId didm(HcalZDCDetId::EM, false, channel); + histoname = "EM_M_" + std::to_string(channel) + "_1"; + ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel"); + _cADC_EChannel[didm()] = ib.book1D(histoname.c_str(), histoname.c_str(), 256, 0, 256); + _cADC_EChannel[didm()]->setAxisTitle("ADC", 1); + _cADC_EChannel[didm()]->setAxisTitle("N", 2); + ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel"); + _cADC_vs_TS_EChannel[didm()] = ib.book1D(histoname.c_str(), histoname.c_str(), 10, 0, 10); + _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1); + _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2); + } + + for (int channel = 1; channel < 5; channel++) { + // HAD Pos + HcalZDCDetId didp(HcalZDCDetId::HAD, true, channel); + histoname = "HAD_P_" + std::to_string(channel) + "_" + std::to_string(channel + 2); + ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel"); + _cADC_EChannel[didp()] = ib.book1D(histoname.c_str(), histoname.c_str(), 256, 0, 256); + _cADC_EChannel[didp()]->setAxisTitle("ADC", 1); + _cADC_EChannel[didp()]->setAxisTitle("N", 2); + ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel"); + _cADC_vs_TS_EChannel[didp()] = ib.book1D(histoname.c_str(), histoname.c_str(), 10, 0, 10); + _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1); + _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2); + + // HAD Minus + HcalZDCDetId didm(HcalZDCDetId::HAD, false, channel); + histoname = "HAD_M_" + std::to_string(channel) + "_" + std::to_string(channel + 2); + ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel"); + _cADC_EChannel[didm()] = ib.book1D(histoname.c_str(), histoname.c_str(), 256, 0, 256); + _cADC_EChannel[didm()]->setAxisTitle("ADC", 1); + _cADC_EChannel[didm()]->setAxisTitle("N", 2); + ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel"); + _cADC_vs_TS_EChannel[didm()] = ib.book1D(histoname.c_str(), histoname.c_str(), 10, 0, 10); + _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1); + _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2); + } + + for (int channel = 1; channel < 17; channel++) { + // RPD Pos + HcalZDCDetId didp(HcalZDCDetId::RPD, true, channel); + histoname = "RPD_P_" + std::to_string(channel) + "_2"; + ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel"); + _cADC_EChannel[didp()] = ib.book1D(histoname.c_str(), histoname.c_str(), 256, 0, 256); + _cADC_EChannel[didp()]->setAxisTitle("ADC", 1); + _cADC_EChannel[didp()]->setAxisTitle("N", 2); + ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel"); + _cADC_vs_TS_EChannel[didp()] = ib.book1D(histoname.c_str(), histoname.c_str(), 10, 0, 10); + _cADC_vs_TS_EChannel[didp()]->setAxisTitle("TS", 1); + _cADC_vs_TS_EChannel[didp()]->setAxisTitle("sum ADC", 2); + + // RPD Minus + HcalZDCDetId didm(HcalZDCDetId::RPD, false, channel); + histoname = "RPD_M_" + std::to_string(channel) + "_2"; + ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_perChannel"); + _cADC_EChannel[didm()] = ib.book1D(histoname.c_str(), histoname.c_str(), 256, 0, 256); + _cADC_EChannel[didm()]->setAxisTitle("ADC", 1); + _cADC_EChannel[didm()]->setAxisTitle("N", 2); + ib.setCurrentFolder("Hcal/ZDCQIE10Task/ADC_vs_TS_perChannel"); + _cADC_vs_TS_EChannel[didm()] = ib.book1D(histoname.c_str(), histoname.c_str(), 10, 0, 10); + _cADC_vs_TS_EChannel[didm()]->setAxisTitle("TS", 1); + _cADC_vs_TS_EChannel[didm()]->setAxisTitle("sum ADC", 2); + } } - -/* virtual */ void ZDCQIE10Task::analyze(edm::Event const& e, edm::EventSetup const&) -{ - edm::Handle digis; - if (!e.getByToken(_tokQIE10, digis)) - edm::LogError("Collection QIE10DigiCollection for ZDC isn't available" - + _tagQIE10.label() + " " + _tagQIE10.instance()); - - for ( auto it = digis->begin(); it != digis->end(); it++ ) { - const QIE10DataFrame digi = static_cast(*it); - HcalZDCDetId const& did = digi.detid(); - - for ( int i = 0; i < digi.samples(); i++ ) { - // iter over all samples - if ( _cADC_EChannel.find( did()) != _cADC_EChannel.end() ) { - _cADC_EChannel[did()]->Fill(digi[i].adc()); - } - if ( _cADC_vs_TS_EChannel.find( did() ) != _cADC_vs_TS_EChannel.end() ) { - _cADC_vs_TS_EChannel[did()]->Fill(i, digi[i].adc()); - } - - } - } +/* virtual */ void ZDCQIE10Task::analyze(edm::Event const& e, edm::EventSetup const&) { + edm::Handle digis; + if (!e.getByToken(_tokQIE10, digis)) + edm::LogError("Collection QIE10DigiCollection for ZDC isn't available" + _tagQIE10.label() + " " + + _tagQIE10.instance()); + + for (auto it = digis->begin(); it != digis->end(); it++) { + const QIE10DataFrame digi = static_cast(*it); + HcalZDCDetId const& did = digi.detid(); + + for (int i = 0; i < digi.samples(); i++) { + // iter over all samples + if (_cADC_EChannel.find(did()) != _cADC_EChannel.end()) { + _cADC_EChannel[did()]->Fill(digi[i].adc()); + } + if (_cADC_vs_TS_EChannel.find(did()) != _cADC_vs_TS_EChannel.end()) { + _cADC_vs_TS_EChannel[did()]->Fill(i, digi[i].adc()); + } + } + } } - DEFINE_FWK_MODULE(ZDCQIE10Task); diff --git a/DQM/HcalTasks/plugins/ZDCTask.cc b/DQM/HcalTasks/plugins/ZDCTask.cc index 78435a4eb41e0..16e0dd81ee950 100644 --- a/DQM/HcalTasks/plugins/ZDCTask.cc +++ b/DQM/HcalTasks/plugins/ZDCTask.cc @@ -4,191 +4,207 @@ using namespace hcaldqm; using namespace hcaldqm::constants; -ZDCTask::ZDCTask(edm::ParameterSet const& ps) -{ - - // tags - _tagQIE10 = ps.getUntrackedParameter("tagQIE10", - edm::InputTag("hcalDigis")); - _tokQIE10 = consumes(_tagQIE10); - - // cuts - _cut = ps.getUntrackedParameter("cut", 50.0); - _ped = ps.getUntrackedParameter("ped", 4); +ZDCTask::ZDCTask(edm::ParameterSet const& ps) { + // tags + _tagQIE10 = ps.getUntrackedParameter("tagQIE10", edm::InputTag("hcalDigis")); + _tokQIE10 = consumes(_tagQIE10); + + // cuts + _cut = ps.getUntrackedParameter("cut", 50.0); + _ped = ps.getUntrackedParameter("ped", 4); } -/* virtual */ void ZDCTask::bookHistograms(DQMStore::IBooker &ib, - edm::Run const& r, edm::EventSetup const& es) -{ - - //############################## hardcode manually the zdc mapping ############################# - //############################# this follows from https://github.com/cms-sw/cmssw/blob/CMSSW_8_0_X/EventFilter/CastorRawToDigi/src/ZdcUnpacker.cc#L118 - //############################################################################################## - //////ZDC MAP for NEW data (2015 PbPb are newer) - //PZDC - std::map myEMap; - HcalElectronicsId eid = HcalElectronicsId(0, 1, 0, 3); - eid.setHTR(18, 8, 1); - myEMap[eid]=DetId(0x54000051);//PZDC EM1 - - eid = HcalElectronicsId(1, 1, 0, 3); - eid.setHTR(18, 8, 1); - myEMap[eid]=DetId(0x54000052);//PZDC EM2 - - eid = HcalElectronicsId(2, 1, 0, 3); - eid.setHTR(18, 8, 1); - myEMap[eid]=DetId(0x54000053);//PZDC EM3 - - eid = HcalElectronicsId(0, 2, 0, 3); - eid.setHTR(18, 8, 1); - myEMap[eid]=DetId(0x54000061);//PZDC HAD1 - - eid = HcalElectronicsId(1, 2, 0, 3); - eid.setHTR(18, 8, 1); - myEMap[eid]=DetId(0x54000054);//PZDC EM4 - - eid = HcalElectronicsId(2, 2, 0, 3); - eid.setHTR(18, 8, 1); - myEMap[eid]=DetId(0x54000055);//PZDC EM5 - - eid = HcalElectronicsId(0, 3, 0, 3); - eid.setHTR(18, 8, 1); - myEMap[eid]=DetId(0x54000062);//PZDC HAD2 - - eid = HcalElectronicsId(1, 3, 0, 3); - eid.setHTR(18, 8, 1); - myEMap[eid]=DetId(0x54000063);//PZDC HAD3 - - eid = HcalElectronicsId(2, 3, 0, 3); - eid.setHTR(18, 8, 1); - myEMap[eid]=DetId(0x54000064);//PZDC HAD4 - - //NZDC - eid = HcalElectronicsId(0,1,1,3); - eid.setHTR(18, 8, 0); - myEMap[eid]=DetId(0x54000011);//NZDC EM1 - - eid = HcalElectronicsId(1,1,1,3); - eid.setHTR(18, 8, 0); - myEMap[eid]=DetId(0x54000012);//NZDC EM2 - - eid = HcalElectronicsId(2,1,1,3); - eid.setHTR(18, 8, 0); - myEMap[eid]=DetId(0x54000013);//NZDC EM3 - - eid = HcalElectronicsId(0,2,1,3); - eid.setHTR(18, 8, 0); - myEMap[eid]=DetId(0x54000015);//NZDC EM5 - - eid = HcalElectronicsId(1,2,1,3); - eid.setHTR(18, 8, 0); - myEMap[eid]=DetId(0x54000021);//NZDC HAD1 - - eid = HcalElectronicsId(2,2,1,3); - eid.setHTR(18, 8, 0); - myEMap[eid]=DetId(0x54000014);//NZDC EM4 - - eid = HcalElectronicsId(0,3,1,3); - eid.setHTR(18, 8, 0); - myEMap[eid]=DetId(0x54000022);//NZDC HAD2 - - eid = HcalElectronicsId(1,3,1,3); - eid.setHTR(18, 8, 0); - myEMap[eid]=DetId(0x54000023);//NZDC HAD3 - - eid = HcalElectronicsId(2,3,1,3); - eid.setHTR(18, 8, 0); - myEMap[eid]=DetId(0x54000024);//NZDC HAD4 - //##################################### end hardcoding ################################### - - ib.cd(); - - //quantities for axis - hcaldqm::quantity::ValueQuantity xAxisShape(hcaldqm::quantity::fTiming_TS); - hcaldqm::quantity::ValueQuantity yAxisShape(hcaldqm::quantity::ffC_10000); - - hcaldqm::quantity::ValueQuantity xAxisADC(hcaldqm::quantity::fADC_128); - - //book histos per channel - for (std::map::const_iterator itr=myEMap.begin(); itr!=myEMap.end(); ++itr) - { - char histoname[300]; - - sprintf(histoname,"%d_%d_%d_%d",itr->first.fiberChanId(),itr->first.fiberIndex(),itr->first.spigot(),itr->first.dccid()); - - ib.setCurrentFolder("Hcal/ZDCTask/Shape_perChannel"); - _cShape_EChannel[histoname] = ib.bookProfile(histoname,histoname,xAxisShape.nbins(),xAxisShape.min(),xAxisShape.max(),yAxisShape.nbins(),yAxisShape.min(),yAxisShape.max()); - _cShape_EChannel[histoname]->setAxisTitle("Timing",1); - _cShape_EChannel[histoname]->setAxisTitle("fC QIE8",2); - - ib.setCurrentFolder("Hcal/ZDCTask/ADC_perChannel"); - _cADC_EChannel[histoname] = ib.book1D(histoname,histoname,xAxisADC.nbins(),xAxisADC.min(),xAxisADC.max()); - _cADC_EChannel[histoname]->getRootObject()->SetBit(BIT(hcaldqm::constants::BIT_OFFSET+hcaldqm::quantity::AxisType::fYAxis)); - _cADC_EChannel[histoname]->setAxisTitle("ADC QIE8",1); - - ib.setCurrentFolder("Hcal/ZDCTask/ADC_vs_TS_perChannel"); - _cADC_vs_TS_EChannel[histoname] = ib.book2D(histoname,histoname,xAxisShape.nbins(),xAxisShape.min(),xAxisShape.max(),xAxisADC.nbins(),xAxisADC.min(),xAxisADC.max()); - _cADC_vs_TS_EChannel[histoname]->getRootObject()->SetBit(BIT(hcaldqm::constants::BIT_OFFSET+hcaldqm::quantity::AxisType::fYAxis)); - _cADC_vs_TS_EChannel[histoname]->setAxisTitle("Timing",1); - _cADC_vs_TS_EChannel[histoname]->setAxisTitle("ADC QIE8",2); - - - } - - //book global histos - ib.setCurrentFolder("Hcal/ZDCTask"); - - _cShape = ib.bookProfile("Shape","Shape",xAxisShape.nbins(),xAxisShape.min(),xAxisShape.max(),yAxisShape.nbins(),yAxisShape.min(),yAxisShape.max()); - _cShape->setAxisTitle("Timing",1); - _cShape->setAxisTitle("fC QIE8",2); - - _cADC = ib.book1D("ADC","ADC",xAxisADC.nbins(),xAxisADC.min(),xAxisADC.max()); - _cADC->getRootObject()->SetBit(BIT(hcaldqm::constants::BIT_OFFSET+hcaldqm::quantity::AxisType::fYAxis)); - _cADC->setAxisTitle("ADC QIE8",1); - - _cADC_vs_TS = ib.book2D("ADC_vs_TS","ADC_vs_TS",xAxisShape.nbins(),xAxisShape.min(),xAxisShape.max(),xAxisADC.nbins(),xAxisADC.min(),xAxisADC.max()); - _cADC_vs_TS->getRootObject()->SetBit(BIT(hcaldqm::constants::BIT_OFFSET+hcaldqm::quantity::AxisType::fYAxis)); - _cADC_vs_TS->setAxisTitle("Timing",1); - _cADC_vs_TS->setAxisTitle("ADC QIE8",2); - +/* virtual */ void ZDCTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { + //############################## hardcode manually the zdc mapping ############################# + //############################# this follows from https://github.com/cms-sw/cmssw/blob/CMSSW_8_0_X/EventFilter/CastorRawToDigi/src/ZdcUnpacker.cc#L118 + //############################################################################################## + //////ZDC MAP for NEW data (2015 PbPb are newer) + //PZDC + std::map myEMap; + HcalElectronicsId eid = HcalElectronicsId(0, 1, 0, 3); + eid.setHTR(18, 8, 1); + myEMap[eid] = DetId(0x54000051); //PZDC EM1 + + eid = HcalElectronicsId(1, 1, 0, 3); + eid.setHTR(18, 8, 1); + myEMap[eid] = DetId(0x54000052); //PZDC EM2 + + eid = HcalElectronicsId(2, 1, 0, 3); + eid.setHTR(18, 8, 1); + myEMap[eid] = DetId(0x54000053); //PZDC EM3 + + eid = HcalElectronicsId(0, 2, 0, 3); + eid.setHTR(18, 8, 1); + myEMap[eid] = DetId(0x54000061); //PZDC HAD1 + + eid = HcalElectronicsId(1, 2, 0, 3); + eid.setHTR(18, 8, 1); + myEMap[eid] = DetId(0x54000054); //PZDC EM4 + + eid = HcalElectronicsId(2, 2, 0, 3); + eid.setHTR(18, 8, 1); + myEMap[eid] = DetId(0x54000055); //PZDC EM5 + + eid = HcalElectronicsId(0, 3, 0, 3); + eid.setHTR(18, 8, 1); + myEMap[eid] = DetId(0x54000062); //PZDC HAD2 + + eid = HcalElectronicsId(1, 3, 0, 3); + eid.setHTR(18, 8, 1); + myEMap[eid] = DetId(0x54000063); //PZDC HAD3 + + eid = HcalElectronicsId(2, 3, 0, 3); + eid.setHTR(18, 8, 1); + myEMap[eid] = DetId(0x54000064); //PZDC HAD4 + + //NZDC + eid = HcalElectronicsId(0, 1, 1, 3); + eid.setHTR(18, 8, 0); + myEMap[eid] = DetId(0x54000011); //NZDC EM1 + + eid = HcalElectronicsId(1, 1, 1, 3); + eid.setHTR(18, 8, 0); + myEMap[eid] = DetId(0x54000012); //NZDC EM2 + + eid = HcalElectronicsId(2, 1, 1, 3); + eid.setHTR(18, 8, 0); + myEMap[eid] = DetId(0x54000013); //NZDC EM3 + + eid = HcalElectronicsId(0, 2, 1, 3); + eid.setHTR(18, 8, 0); + myEMap[eid] = DetId(0x54000015); //NZDC EM5 + + eid = HcalElectronicsId(1, 2, 1, 3); + eid.setHTR(18, 8, 0); + myEMap[eid] = DetId(0x54000021); //NZDC HAD1 + + eid = HcalElectronicsId(2, 2, 1, 3); + eid.setHTR(18, 8, 0); + myEMap[eid] = DetId(0x54000014); //NZDC EM4 + + eid = HcalElectronicsId(0, 3, 1, 3); + eid.setHTR(18, 8, 0); + myEMap[eid] = DetId(0x54000022); //NZDC HAD2 + + eid = HcalElectronicsId(1, 3, 1, 3); + eid.setHTR(18, 8, 0); + myEMap[eid] = DetId(0x54000023); //NZDC HAD3 + + eid = HcalElectronicsId(2, 3, 1, 3); + eid.setHTR(18, 8, 0); + myEMap[eid] = DetId(0x54000024); //NZDC HAD4 + //##################################### end hardcoding ################################### + + ib.cd(); + + //quantities for axis + hcaldqm::quantity::ValueQuantity xAxisShape(hcaldqm::quantity::fTiming_TS); + hcaldqm::quantity::ValueQuantity yAxisShape(hcaldqm::quantity::ffC_10000); + + hcaldqm::quantity::ValueQuantity xAxisADC(hcaldqm::quantity::fADC_128); + + //book histos per channel + for (std::map::const_iterator itr = myEMap.begin(); itr != myEMap.end(); ++itr) { + char histoname[300]; + + sprintf(histoname, + "%d_%d_%d_%d", + itr->first.fiberChanId(), + itr->first.fiberIndex(), + itr->first.spigot(), + itr->first.dccid()); + + ib.setCurrentFolder("Hcal/ZDCTask/Shape_perChannel"); + _cShape_EChannel[histoname] = ib.bookProfile(histoname, + histoname, + xAxisShape.nbins(), + xAxisShape.min(), + xAxisShape.max(), + yAxisShape.nbins(), + yAxisShape.min(), + yAxisShape.max()); + _cShape_EChannel[histoname]->setAxisTitle("Timing", 1); + _cShape_EChannel[histoname]->setAxisTitle("fC QIE8", 2); + + ib.setCurrentFolder("Hcal/ZDCTask/ADC_perChannel"); + _cADC_EChannel[histoname] = ib.book1D(histoname, histoname, xAxisADC.nbins(), xAxisADC.min(), xAxisADC.max()); + _cADC_EChannel[histoname]->getRootObject()->SetBit( + BIT(hcaldqm::constants::BIT_OFFSET + hcaldqm::quantity::AxisType::fYAxis)); + _cADC_EChannel[histoname]->setAxisTitle("ADC QIE8", 1); + + ib.setCurrentFolder("Hcal/ZDCTask/ADC_vs_TS_perChannel"); + _cADC_vs_TS_EChannel[histoname] = ib.book2D(histoname, + histoname, + xAxisShape.nbins(), + xAxisShape.min(), + xAxisShape.max(), + xAxisADC.nbins(), + xAxisADC.min(), + xAxisADC.max()); + _cADC_vs_TS_EChannel[histoname]->getRootObject()->SetBit( + BIT(hcaldqm::constants::BIT_OFFSET + hcaldqm::quantity::AxisType::fYAxis)); + _cADC_vs_TS_EChannel[histoname]->setAxisTitle("Timing", 1); + _cADC_vs_TS_EChannel[histoname]->setAxisTitle("ADC QIE8", 2); + } + + //book global histos + ib.setCurrentFolder("Hcal/ZDCTask"); + + _cShape = ib.bookProfile("Shape", + "Shape", + xAxisShape.nbins(), + xAxisShape.min(), + xAxisShape.max(), + yAxisShape.nbins(), + yAxisShape.min(), + yAxisShape.max()); + _cShape->setAxisTitle("Timing", 1); + _cShape->setAxisTitle("fC QIE8", 2); + + _cADC = ib.book1D("ADC", "ADC", xAxisADC.nbins(), xAxisADC.min(), xAxisADC.max()); + _cADC->getRootObject()->SetBit(BIT(hcaldqm::constants::BIT_OFFSET + hcaldqm::quantity::AxisType::fYAxis)); + _cADC->setAxisTitle("ADC QIE8", 1); + + _cADC_vs_TS = ib.book2D("ADC_vs_TS", + "ADC_vs_TS", + xAxisShape.nbins(), + xAxisShape.min(), + xAxisShape.max(), + xAxisADC.nbins(), + xAxisADC.min(), + xAxisADC.max()); + _cADC_vs_TS->getRootObject()->SetBit(BIT(hcaldqm::constants::BIT_OFFSET + hcaldqm::quantity::AxisType::fYAxis)); + _cADC_vs_TS->setAxisTitle("Timing", 1); + _cADC_vs_TS->setAxisTitle("ADC QIE8", 2); } +/* virtual */ void ZDCTask::analyze(edm::Event const& e, edm::EventSetup const&) { + edm::Handle cqie10; + if (!e.getByToken(_tokQIE10, cqie10)) + edm::LogError("Collection ZDCDigiCollection isn't available" + _tagQIE10.label() + " " + _tagQIE10.instance()); -/* virtual */ void ZDCTask::analyze(edm::Event const& e, edm::EventSetup const&) -{ - edm::Handle cqie10; - if (!e.getByToken(_tokQIE10, cqie10)) - edm::LogError("Collection ZDCDigiCollection isn't available" - + _tagQIE10.label() + " " + _tagQIE10.instance()); + for (uint32_t i = 0; i < cqie10->size(); i++) { + ZDCDataFrame frame = static_cast((*cqie10)[i]); + HcalElectronicsId eid = frame.elecId(); + char histoname[300]; + sprintf(histoname, "%d_%d_%d_%d", eid.fiberChanId(), eid.fiberIndex(), eid.spigot(), eid.dccid()); - for (uint32_t i=0; isize(); i++) - { - ZDCDataFrame frame = static_cast((*cqie10)[i]); - HcalElectronicsId eid = frame.elecId(); + // compute the signal, ped subracted + //double q = hcaldqm::utilities::sumQ_v10(frame, constants::adc2fC[_ped], 0, frame.size()-1); - char histoname[300]; - sprintf(histoname,"%d_%d_%d_%d",eid.fiberChanId(),eid.fiberIndex(),eid.spigot(),eid.dccid()); - - // compute the signal, ped subracted - //double q = hcaldqm::utilities::sumQ_v10(frame, constants::adc2fC[_ped], 0, frame.size()-1); + // iterate thru all TS and fill + for (int j = 0; j < frame.size(); j++) { + _cShape_EChannel[histoname]->Fill(j, frame[j].nominal_fC()); + _cShape->Fill(j, frame[j].nominal_fC()); - // iterate thru all TS and fill - for (int j=0; jFill(j, frame[j].nominal_fC()); - _cShape->Fill(j, frame[j].nominal_fC()); + _cADC_EChannel[histoname]->Fill(frame[j].adc()); + _cADC->Fill(frame[j].adc()); - _cADC_EChannel[histoname]->Fill(frame[j].adc()); - _cADC->Fill(frame[j].adc()); - - _cADC_vs_TS_EChannel[histoname]->Fill(j,frame[j].adc()); - _cADC_vs_TS->Fill(j,frame[j].adc()); - - - } - } + _cADC_vs_TS_EChannel[histoname]->Fill(j, frame[j].adc()); + _cADC_vs_TS->Fill(j, frame[j].adc()); + } + } } - DEFINE_FWK_MODULE(ZDCTask); diff --git a/DQM/HcalTasks/src/DigiRunSummary.cc b/DQM/HcalTasks/src/DigiRunSummary.cc index b51fe081f91e3..540bc65f9164e 100644 --- a/DQM/HcalTasks/src/DigiRunSummary.cc +++ b/DQM/HcalTasks/src/DigiRunSummary.cc @@ -1,394 +1,374 @@ #include "DQM/HcalTasks/interface/DigiRunSummary.h" -namespace hcaldqm -{ - using namespace constants; - - DigiRunSummary::DigiRunSummary(std::string const& name, - std::string const& taskname, edm::ParameterSet const& ps) : - DQClient(name, taskname, ps), _booked(false) - { - _thresh_unihf = ps.getUntrackedParameter("thresh_unihf", - 0.2); - - std::vector vrefDigiSize = ps.getUntrackedParameter>("refDigiSize"); - _refDigiSize[HcalBarrel] = vrefDigiSize[0]; - _refDigiSize[HcalEndcap] = vrefDigiSize[1]; - _refDigiSize[HcalOuter] = vrefDigiSize[2]; - _refDigiSize[HcalForward] = vrefDigiSize[3]; - } - - /* virtual */ void DigiRunSummary::beginRun(edm::Run const& r, - edm::EventSetup const& es) - { - DQClient::beginRun(r,es); - - if (_ptype!=fOffline) - return; - - // INITIALIZE WHAT NEEDS TO BE INITIALIZE ONLY ONCE! - _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); - _vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); - _vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_VME.initialize(filter::fFilter, hashfunctions::fElectronics, - _vhashVME); // filter out VME - _filter_uTCA.initialize(filter::fFilter, hashfunctions::fElectronics, - _vhashuTCA); // filter out uTCA - _vhashFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _vhashFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _vhashFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _vhashFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN+6, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _vhashFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN+6, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _vhashFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN+6, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_FEDHF.initialize(filter::fPreserver, hashfunctions::fFED, - _vhashFEDHF); // preserve only HF FEDs - - _xDead.initialize(hashfunctions::fFED); - _xDigiSize.initialize(hashfunctions::fFED); - _xUni.initialize(hashfunctions::fFED); - _xUniHF.initialize(hashfunctions::fFEDSlot); - - _xDead.book(_emap); _xDigiSize.book(_emap); _xUniHF.book(_emap); - _xUni.book(_emap, _filter_FEDHF); - _xNChs.initialize(hashfunctions::fFED); - _xNChsNominal.initialize(hashfunctions::fFED); - _xNChs.book(_emap); _xNChsNominal.book(_emap); - - _cOccupancy_depth.initialize(_name, "Occupancy", - hashfunctions::fdepth, - new quantity::DetectorQuantity(quantity::fieta), - new quantity::DetectorQuantity(quantity::fiphi), - new quantity::ValueQuantity(quantity::fN),0); - - // GET THE NOMINAL NUMBER OF CHANNELS PER FED - std::vector gids = _emap->allPrecisionId(); - for (std::vector::const_iterator it=gids.begin(); - it!=gids.end(); ++it) - { - if (!it->isHcalDetId()) - continue; - HcalDetId did(it->rawId()); - HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); - _xNChsNominal.get(eid)++; - } - } - - /* +namespace hcaldqm { + using namespace constants; + + DigiRunSummary::DigiRunSummary(std::string const& name, std::string const& taskname, edm::ParameterSet const& ps) + : DQClient(name, taskname, ps), _booked(false) { + _thresh_unihf = ps.getUntrackedParameter("thresh_unihf", 0.2); + + std::vector vrefDigiSize = ps.getUntrackedParameter>("refDigiSize"); + _refDigiSize[HcalBarrel] = vrefDigiSize[0]; + _refDigiSize[HcalEndcap] = vrefDigiSize[1]; + _refDigiSize[HcalOuter] = vrefDigiSize[2]; + _refDigiSize[HcalForward] = vrefDigiSize[3]; + } + + /* virtual */ void DigiRunSummary::beginRun(edm::Run const& r, edm::EventSetup const& es) { + DQClient::beginRun(r, es); + + if (_ptype != fOffline) + return; + + // INITIALIZE WHAT NEEDS TO BE INITIALIZE ONLY ONCE! + _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); + _vhashVME.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); + _vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_VME.initialize(filter::fFilter, hashfunctions::fElectronics, + _vhashVME); // filter out VME + _filter_uTCA.initialize(filter::fFilter, hashfunctions::fElectronics, + _vhashuTCA); // filter out uTCA + _vhashFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _vhashFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _vhashFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _vhashFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _vhashFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _vhashFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_FEDHF.initialize(filter::fPreserver, hashfunctions::fFED, + _vhashFEDHF); // preserve only HF FEDs + + _xDead.initialize(hashfunctions::fFED); + _xDigiSize.initialize(hashfunctions::fFED); + _xUni.initialize(hashfunctions::fFED); + _xUniHF.initialize(hashfunctions::fFEDSlot); + + _xDead.book(_emap); + _xDigiSize.book(_emap); + _xUniHF.book(_emap); + _xUni.book(_emap, _filter_FEDHF); + _xNChs.initialize(hashfunctions::fFED); + _xNChsNominal.initialize(hashfunctions::fFED); + _xNChs.book(_emap); + _xNChsNominal.book(_emap); + + _cOccupancy_depth.initialize(_name, + "Occupancy", + hashfunctions::fdepth, + new quantity::DetectorQuantity(quantity::fieta), + new quantity::DetectorQuantity(quantity::fiphi), + new quantity::ValueQuantity(quantity::fN), + 0); + + // GET THE NOMINAL NUMBER OF CHANNELS PER FED + std::vector gids = _emap->allPrecisionId(); + for (std::vector::const_iterator it = gids.begin(); it != gids.end(); ++it) { + if (!it->isHcalDetId()) + continue; + HcalDetId did(it->rawId()); + HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); + _xNChsNominal.get(eid)++; + } + } + + /* * END LUMI. EVALUATE LUMI BASED FLAGS */ - /* virtual */ void DigiRunSummary::endLuminosityBlock(DQMStore::IBooker& ib, - DQMStore::IGetter& ig, edm::LuminosityBlock const& lb, - edm::EventSetup const& es) - { - DQClient::endLuminosityBlock(ib, ig, lb, es); - - if (_ptype!=fOffline) - return; - - LSSummary lssum; - lssum._LS=_currentLS; - - _xDigiSize.reset(); _xNChs.reset(); - - // INITIALIZE LUMI BASED HISTOGRAMS - Container2D cDigiSize_Crate, cOccupancy_depth; - cDigiSize_Crate.initialize(_taskname, "DigiSize", - hashfunctions::fCrate, - new quantity::ValueQuantity(quantity::fDigiSize), - new quantity::ValueQuantity(quantity::fN),0); - cOccupancy_depth.initialize(_taskname, "Occupancy", - hashfunctions::fdepth, - new quantity::DetectorQuantity(quantity::fieta), - new quantity::DetectorQuantity(quantity::fiphi), - new quantity::ValueQuantity(quantity::fN),0); - - // LOAD LUMI BASED HISTOGRAMS - cOccupancy_depth.load(ig, _emap, _subsystem); - cDigiSize_Crate.load(ig, _emap, _subsystem); - MonitorElement *meNumEvents = ig.get(_subsystem+ - "/RunInfo/NumberOfEvents"); - int numEvents = meNumEvents->getBinContent(1); - bool unknownIdsPresent = ig.get(_subsystem+"/" - +_taskname+"/UnknownIds")->getBinContent(1)>0; - - // book the Numer of Events - set axis extendable - if (!_booked) - { - ib.setCurrentFolder(_subsystem+"/"+_taskname); - _meNumEvents = ib.book1D("NumberOfEvents", "NumberOfEvents", - 1000, 1, 1001); // 1000 to start with - _meNumEvents->getTH1()->SetCanExtend(TH1::kXaxis); - - _cOccupancy_depth.book(ib, _emap, _subsystem); - _booked=true; - } - _meNumEvents->setBinContent(_currentLS, numEvents); - - // ANALYZE THIS LS for LS BASED FLAGS - std::vector gids = _emap->allPrecisionId(); - for (std::vector::const_iterator it=gids.begin(); - it!=gids.end(); ++it) - { - if (!it->isHcalDetId()) - continue; - - HcalDetId did = HcalDetId(it->rawId()); - HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); - - cOccupancy_depth.getBinContent(did)>0?_xNChs.get(eid)++: - _xNChs.get(eid)+=0; - _cOccupancy_depth.fill(did, cOccupancy_depth.getBinContent(did)); - // digi size - cDigiSize_Crate.getMean(eid)!= - _refDigiSize[did.subdet()]? - _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; - cDigiSize_Crate.getRMS(eid)!=0? - _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0; - } - - // GENERATE SUMMARY AND STORE IT - std::vector vtmpflags; - vtmpflags.resize(nLSFlags); - vtmpflags[fDigiSize]=flag::Flag("DigiSize"); - vtmpflags[fNChsHF]=flag::Flag("NChsHF"); - vtmpflags[fUnknownIds]=flag::Flag("UnknownIds"); - vtmpflags[fLED]=flag::Flag("LEDMisfire"); - for (std::vector::const_iterator it=_vhashCrates.begin(); - it!=_vhashCrates.end(); ++it) - { - HcalElectronicsId eid(*it); - HcalDetId did = HcalDetId(_emap->lookup(eid)); - - // reset all the tmp flags to fNA - // MUST DO IT NOW! AS NCDAQ MIGHT OVERWRITE IT! - for (std::vector::iterator ft=vtmpflags.begin(); - ft!=vtmpflags.end(); ++ft) - ft->reset(); - - if (_xDigiSize.get(eid)>0) - vtmpflags[fDigiSize]._state = flag::fBAD; - else - vtmpflags[fDigiSize]._state = flag::fGOOD; - - if (did.subdet() == HcalForward) - { - if (_xNChs.get(eid)!=_xNChsNominal.get(eid)) - vtmpflags[fNChsHF]._state = flag::fBAD; - else - vtmpflags[fNChsHF]._state = flag::fGOOD; - } else { - vtmpflags[fNChsHF]._state = flag::fNA; - } - if (unknownIdsPresent) - vtmpflags[fUnknownIds]._state = flag::fBAD; - else - vtmpflags[fUnknownIds]._state = flag::fGOOD; - - if ((did.subdet() == HcalBarrel) || (did.subdet() == HcalBarrel) || (did.subdet() == HcalBarrel) || (did.subdet() == HcalBarrel)) { - std::string ledHistName = _subsystem + "/" + _taskname + "/LED_CUCountvsLS/Subdet/"; - if (did.subdet() == HcalBarrel) { - ledHistName += "HB"; - } else if (did.subdet() == HcalEndcap) { - ledHistName += "HE"; - } else if (did.subdet() == HcalOuter) { - ledHistName += "HO"; - } else if (did.subdet() == HcalForward) { - ledHistName += "HF"; - } - MonitorElement* ledHist = ig.get(ledHistName); - if (ledHist) { - bool ledSignalPresent = (ledHist->getEntries() > 0); - if (ledSignalPresent) - vtmpflags[fLED]._state = flag::fBAD; - else - vtmpflags[fLED]._state = flag::fGOOD; - } else { - vtmpflags[fLED]._state = flag::fNA; - } - } else { - vtmpflags[fLED]._state = flag::fNA; - } - - - // push all the flags for this crate - lssum._vflags.push_back(vtmpflags); - } - - // push all the flags for all FEDs for this LS - _vflagsLS.push_back(lssum); - cDigiSize_Crate.reset(); - cOccupancy_depth.reset(); - } - - /* + /* virtual */ void DigiRunSummary::endLuminosityBlock(DQMStore::IBooker& ib, + DQMStore::IGetter& ig, + edm::LuminosityBlock const& lb, + edm::EventSetup const& es) { + DQClient::endLuminosityBlock(ib, ig, lb, es); + + if (_ptype != fOffline) + return; + + LSSummary lssum; + lssum._LS = _currentLS; + + _xDigiSize.reset(); + _xNChs.reset(); + + // INITIALIZE LUMI BASED HISTOGRAMS + Container2D cDigiSize_Crate, cOccupancy_depth; + cDigiSize_Crate.initialize(_taskname, + "DigiSize", + hashfunctions::fCrate, + new quantity::ValueQuantity(quantity::fDigiSize), + new quantity::ValueQuantity(quantity::fN), + 0); + cOccupancy_depth.initialize(_taskname, + "Occupancy", + hashfunctions::fdepth, + new quantity::DetectorQuantity(quantity::fieta), + new quantity::DetectorQuantity(quantity::fiphi), + new quantity::ValueQuantity(quantity::fN), + 0); + + // LOAD LUMI BASED HISTOGRAMS + cOccupancy_depth.load(ig, _emap, _subsystem); + cDigiSize_Crate.load(ig, _emap, _subsystem); + MonitorElement* meNumEvents = ig.get(_subsystem + "/RunInfo/NumberOfEvents"); + int numEvents = meNumEvents->getBinContent(1); + bool unknownIdsPresent = ig.get(_subsystem + "/" + _taskname + "/UnknownIds")->getBinContent(1) > 0; + + // book the Numer of Events - set axis extendable + if (!_booked) { + ib.setCurrentFolder(_subsystem + "/" + _taskname); + _meNumEvents = ib.book1D("NumberOfEvents", "NumberOfEvents", 1000, 1, 1001); // 1000 to start with + _meNumEvents->getTH1()->SetCanExtend(TH1::kXaxis); + + _cOccupancy_depth.book(ib, _emap, _subsystem); + _booked = true; + } + _meNumEvents->setBinContent(_currentLS, numEvents); + + // ANALYZE THIS LS for LS BASED FLAGS + std::vector gids = _emap->allPrecisionId(); + for (std::vector::const_iterator it = gids.begin(); it != gids.end(); ++it) { + if (!it->isHcalDetId()) + continue; + + HcalDetId did = HcalDetId(it->rawId()); + HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); + + cOccupancy_depth.getBinContent(did) > 0 ? _xNChs.get(eid)++ : _xNChs.get(eid) += 0; + _cOccupancy_depth.fill(did, cOccupancy_depth.getBinContent(did)); + // digi size + cDigiSize_Crate.getMean(eid) != _refDigiSize[did.subdet()] ? _xDigiSize.get(eid)++ : _xDigiSize.get(eid) += 0; + cDigiSize_Crate.getRMS(eid) != 0 ? _xDigiSize.get(eid)++ : _xDigiSize.get(eid) += 0; + } + + // GENERATE SUMMARY AND STORE IT + std::vector vtmpflags; + vtmpflags.resize(nLSFlags); + vtmpflags[fDigiSize] = flag::Flag("DigiSize"); + vtmpflags[fNChsHF] = flag::Flag("NChsHF"); + vtmpflags[fUnknownIds] = flag::Flag("UnknownIds"); + vtmpflags[fLED] = flag::Flag("LEDMisfire"); + for (std::vector::const_iterator it = _vhashCrates.begin(); it != _vhashCrates.end(); ++it) { + HcalElectronicsId eid(*it); + HcalDetId did = HcalDetId(_emap->lookup(eid)); + + // reset all the tmp flags to fNA + // MUST DO IT NOW! AS NCDAQ MIGHT OVERWRITE IT! + for (std::vector::iterator ft = vtmpflags.begin(); ft != vtmpflags.end(); ++ft) + ft->reset(); + + if (_xDigiSize.get(eid) > 0) + vtmpflags[fDigiSize]._state = flag::fBAD; + else + vtmpflags[fDigiSize]._state = flag::fGOOD; + + if (did.subdet() == HcalForward) { + if (_xNChs.get(eid) != _xNChsNominal.get(eid)) + vtmpflags[fNChsHF]._state = flag::fBAD; + else + vtmpflags[fNChsHF]._state = flag::fGOOD; + } else { + vtmpflags[fNChsHF]._state = flag::fNA; + } + if (unknownIdsPresent) + vtmpflags[fUnknownIds]._state = flag::fBAD; + else + vtmpflags[fUnknownIds]._state = flag::fGOOD; + + if ((did.subdet() == HcalBarrel) || (did.subdet() == HcalBarrel) || (did.subdet() == HcalBarrel) || + (did.subdet() == HcalBarrel)) { + std::string ledHistName = _subsystem + "/" + _taskname + "/LED_CUCountvsLS/Subdet/"; + if (did.subdet() == HcalBarrel) { + ledHistName += "HB"; + } else if (did.subdet() == HcalEndcap) { + ledHistName += "HE"; + } else if (did.subdet() == HcalOuter) { + ledHistName += "HO"; + } else if (did.subdet() == HcalForward) { + ledHistName += "HF"; + } + MonitorElement* ledHist = ig.get(ledHistName); + if (ledHist) { + bool ledSignalPresent = (ledHist->getEntries() > 0); + if (ledSignalPresent) + vtmpflags[fLED]._state = flag::fBAD; + else + vtmpflags[fLED]._state = flag::fGOOD; + } else { + vtmpflags[fLED]._state = flag::fNA; + } + } else { + vtmpflags[fLED]._state = flag::fNA; + } + + // push all the flags for this crate + lssum._vflags.push_back(vtmpflags); + } + + // push all the flags for all FEDs for this LS + _vflagsLS.push_back(lssum); + cDigiSize_Crate.reset(); + cOccupancy_depth.reset(); + } + + /* * End Job */ - /* virtual */ std::vector DigiRunSummary::endJob( - DQMStore::IBooker& ib, DQMStore::IGetter& ig) - { - if (_ptype!=fOffline) - return std::vector(); - - _xDead.reset(); _xUniHF.reset(); _xUni.reset(); - - // PREPARE LS AND RUN BASED FLAGS TO USE IT FOR BOOKING - std::vector vflagsPerLS; - std::vector vflagsPerRun; - vflagsPerLS.resize(nLSFlags); - vflagsPerRun.resize(nDigiFlag-nLSFlags+1); - vflagsPerLS[fDigiSize]=flag::Flag("DigiSize"); - vflagsPerLS[fNChsHF]=flag::Flag("NChsHF"); - vflagsPerLS[fUnknownIds]=flag::Flag("UnknownIds"); - vflagsPerLS[fLED]=flag::Flag("LEDMisfire"); - vflagsPerRun[fDigiSize]=flag::Flag("DigiSize"); - vflagsPerRun[fNChsHF]=flag::Flag("NChsHF"); - vflagsPerRun[fUniHF-nLSFlags+1]=flag::Flag("UniSlotHF"); - vflagsPerRun[fDead-nLSFlags+1]=flag::Flag("Dead"); - - // INITIALIZE SUMMARY CONTAINERS - ContainerSingle2D cSummaryvsLS; - Container2D cSummaryvsLS_Crate; - cSummaryvsLS.initialize(_name, "SummaryvsLS", - new quantity::LumiSection(_maxProcessedLS), - new quantity::CrateQuantity(_emap), - new quantity::ValueQuantity(quantity::fState),0); - cSummaryvsLS.book(ib, _subsystem); - cSummaryvsLS_Crate.initialize(_name, "SummaryvsLS", - hashfunctions::fCrate, - new quantity::LumiSection(_maxProcessedLS), - new quantity::FlagQuantity(vflagsPerLS), - new quantity::ValueQuantity(quantity::fState),0); - cSummaryvsLS_Crate.book(ib, _emap, _subsystem); - - // INITIALIZE CONTAINERS WE NEED TO LOAD or BOOK - Container2D cOccupancyCut_depth; - Container2D cDead_depth, cDead_Crate; - cOccupancyCut_depth.initialize(_taskname, "OccupancyCut", - hashfunctions::fdepth, - new quantity::DetectorQuantity(quantity::fieta), - new quantity::DetectorQuantity(quantity::fiphi), - new quantity::ValueQuantity(quantity::fN),0); - cDead_depth.initialize(_name, "Dead", - hashfunctions::fdepth, - new quantity::DetectorQuantity(quantity::fieta), - new quantity::DetectorQuantity(quantity::fiphi), - new quantity::ValueQuantity(quantity::fN),0); - cDead_Crate.initialize(_name, "Dead", - hashfunctions::fCrate, - new quantity::ElectronicsQuantity(quantity::fSpigot), - new quantity::ElectronicsQuantity(quantity::fFiberVMEFiberCh), - new quantity::ValueQuantity(quantity::fN),0); - - // LOAD - cOccupancyCut_depth.load(ig, _emap, _subsystem); - cDead_depth.book(ib, _emap, _subsystem); - cDead_Crate.book(ib, _emap, _subsystem); - - // ANALYZE RUN BASED QUANTITIES - std::vector gids = _emap->allPrecisionId(); - for (std::vector::const_iterator it=gids.begin(); - it!=gids.end(); ++it) - { - if (!it->isHcalDetId()) - continue; - - HcalDetId did = HcalDetId(it->rawId()); - HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); - - if (_cOccupancy_depth.getBinContent(did)<1) - { - _xDead.get(eid)++; - cDead_depth.fill(did); - cDead_Crate.fill(eid); - } - if (did.subdet()==HcalForward) - _xUniHF.get(eid)+=cOccupancyCut_depth.getBinContent(did); - } - // ANALYZE FOR HF SLOT UNIFORMITY - for (uintCompactMap::const_iterator it=_xUniHF.begin(); - it!=_xUniHF.end(); ++it) - { - uint32_t hash1 = it->first; - HcalElectronicsId eid1(hash1); - double x1 = it->second; - - for (uintCompactMap::const_iterator jt=_xUniHF.begin(); - jt!=_xUniHF.end(); ++jt) - { - if (jt==it) - continue; - - double x2 = jt->second; - if (x2==0) - continue; - if (x1/x2<_thresh_unihf) - _xUni.get(eid1)++; - } - } - - /* + /* virtual */ std::vector DigiRunSummary::endJob(DQMStore::IBooker& ib, DQMStore::IGetter& ig) { + if (_ptype != fOffline) + return std::vector(); + + _xDead.reset(); + _xUniHF.reset(); + _xUni.reset(); + + // PREPARE LS AND RUN BASED FLAGS TO USE IT FOR BOOKING + std::vector vflagsPerLS; + std::vector vflagsPerRun; + vflagsPerLS.resize(nLSFlags); + vflagsPerRun.resize(nDigiFlag - nLSFlags + 1); + vflagsPerLS[fDigiSize] = flag::Flag("DigiSize"); + vflagsPerLS[fNChsHF] = flag::Flag("NChsHF"); + vflagsPerLS[fUnknownIds] = flag::Flag("UnknownIds"); + vflagsPerLS[fLED] = flag::Flag("LEDMisfire"); + vflagsPerRun[fDigiSize] = flag::Flag("DigiSize"); + vflagsPerRun[fNChsHF] = flag::Flag("NChsHF"); + vflagsPerRun[fUniHF - nLSFlags + 1] = flag::Flag("UniSlotHF"); + vflagsPerRun[fDead - nLSFlags + 1] = flag::Flag("Dead"); + + // INITIALIZE SUMMARY CONTAINERS + ContainerSingle2D cSummaryvsLS; + Container2D cSummaryvsLS_Crate; + cSummaryvsLS.initialize(_name, + "SummaryvsLS", + new quantity::LumiSection(_maxProcessedLS), + new quantity::CrateQuantity(_emap), + new quantity::ValueQuantity(quantity::fState), + 0); + cSummaryvsLS.book(ib, _subsystem); + cSummaryvsLS_Crate.initialize(_name, + "SummaryvsLS", + hashfunctions::fCrate, + new quantity::LumiSection(_maxProcessedLS), + new quantity::FlagQuantity(vflagsPerLS), + new quantity::ValueQuantity(quantity::fState), + 0); + cSummaryvsLS_Crate.book(ib, _emap, _subsystem); + + // INITIALIZE CONTAINERS WE NEED TO LOAD or BOOK + Container2D cOccupancyCut_depth; + Container2D cDead_depth, cDead_Crate; + cOccupancyCut_depth.initialize(_taskname, + "OccupancyCut", + hashfunctions::fdepth, + new quantity::DetectorQuantity(quantity::fieta), + new quantity::DetectorQuantity(quantity::fiphi), + new quantity::ValueQuantity(quantity::fN), + 0); + cDead_depth.initialize(_name, + "Dead", + hashfunctions::fdepth, + new quantity::DetectorQuantity(quantity::fieta), + new quantity::DetectorQuantity(quantity::fiphi), + new quantity::ValueQuantity(quantity::fN), + 0); + cDead_Crate.initialize(_name, + "Dead", + hashfunctions::fCrate, + new quantity::ElectronicsQuantity(quantity::fSpigot), + new quantity::ElectronicsQuantity(quantity::fFiberVMEFiberCh), + new quantity::ValueQuantity(quantity::fN), + 0); + + // LOAD + cOccupancyCut_depth.load(ig, _emap, _subsystem); + cDead_depth.book(ib, _emap, _subsystem); + cDead_Crate.book(ib, _emap, _subsystem); + + // ANALYZE RUN BASED QUANTITIES + std::vector gids = _emap->allPrecisionId(); + for (std::vector::const_iterator it = gids.begin(); it != gids.end(); ++it) { + if (!it->isHcalDetId()) + continue; + + HcalDetId did = HcalDetId(it->rawId()); + HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); + + if (_cOccupancy_depth.getBinContent(did) < 1) { + _xDead.get(eid)++; + cDead_depth.fill(did); + cDead_Crate.fill(eid); + } + if (did.subdet() == HcalForward) + _xUniHF.get(eid) += cOccupancyCut_depth.getBinContent(did); + } + // ANALYZE FOR HF SLOT UNIFORMITY + for (uintCompactMap::const_iterator it = _xUniHF.begin(); it != _xUniHF.end(); ++it) { + uint32_t hash1 = it->first; + HcalElectronicsId eid1(hash1); + double x1 = it->second; + + for (uintCompactMap::const_iterator jt = _xUniHF.begin(); jt != _xUniHF.end(); ++jt) { + if (jt == it) + continue; + + double x2 = jt->second; + if (x2 == 0) + continue; + if (x1 / x2 < _thresh_unihf) + _xUni.get(eid1)++; + } + } + + /* * Iterate over each crate * Iterate over each LS Summary * Iterate over all flags * set... */ - // iterate over all crates - std::vector sumflags; - int icrate=0; - for (auto& it_crate : _vhashCrates) { - flag::Flag fSumRun("DIGI"); // summary flag for this FED - flag::Flag ffDead("Dead"); - flag::Flag ffUniSlotHF("UniSlotHF"); - HcalElectronicsId eid(it_crate); - HcalDetId did = HcalDetId(_emap->lookup(eid)); - - // ITERATE OVER EACH LS - for (std::vector::const_iterator itls=_vflagsLS.begin(); - itls!=_vflagsLS.end(); ++itls) - { - int iflag=0; - flag::Flag fSumLS("DIGI"); - for (std::vector::const_iterator ft= - itls->_vflags[icrate].begin(); ft!=itls->_vflags[icrate].end(); - ++ft) - { - cSummaryvsLS_Crate.setBinContent(eid, itls->_LS, int(iflag), ft->_state); - fSumLS+=(*ft); - iflag++; - } - cSummaryvsLS.setBinContent(eid, itls->_LS, fSumLS._state); - fSumRun+=fSumLS; - } - - // EVALUATE RUN BASED FLAGS - if (_xDead.get(eid)>0) - ffDead._state = flag::fBAD; - else - ffDead._state = flag::fGOOD; - if (did.subdet() == HcalForward) - { - if (_xUni.get(eid)>0) - ffUniSlotHF._state = flag::fBAD; - else - ffUniSlotHF._state = flag::fGOOD; - } - fSumRun+=ffDead+ffUniSlotHF; - - // push the summary flag for this FED for the Whole Run - sumflags.push_back(fSumRun); - - // increment fed - icrate++; - } - - return sumflags; - } -} + // iterate over all crates + std::vector sumflags; + int icrate = 0; + for (auto& it_crate : _vhashCrates) { + flag::Flag fSumRun("DIGI"); // summary flag for this FED + flag::Flag ffDead("Dead"); + flag::Flag ffUniSlotHF("UniSlotHF"); + HcalElectronicsId eid(it_crate); + HcalDetId did = HcalDetId(_emap->lookup(eid)); + + // ITERATE OVER EACH LS + for (std::vector::const_iterator itls = _vflagsLS.begin(); itls != _vflagsLS.end(); ++itls) { + int iflag = 0; + flag::Flag fSumLS("DIGI"); + for (std::vector::const_iterator ft = itls->_vflags[icrate].begin(); + ft != itls->_vflags[icrate].end(); + ++ft) { + cSummaryvsLS_Crate.setBinContent(eid, itls->_LS, int(iflag), ft->_state); + fSumLS += (*ft); + iflag++; + } + cSummaryvsLS.setBinContent(eid, itls->_LS, fSumLS._state); + fSumRun += fSumLS; + } + + // EVALUATE RUN BASED FLAGS + if (_xDead.get(eid) > 0) + ffDead._state = flag::fBAD; + else + ffDead._state = flag::fGOOD; + if (did.subdet() == HcalForward) { + if (_xUni.get(eid) > 0) + ffUniSlotHF._state = flag::fBAD; + else + ffUniSlotHF._state = flag::fGOOD; + } + fSumRun += ffDead + ffUniSlotHF; + + // push the summary flag for this FED for the Whole Run + sumflags.push_back(fSumRun); + + // increment fed + icrate++; + } + + return sumflags; + } +} // namespace hcaldqm diff --git a/DQM/HcalTasks/src/PedestalRunSummary.cc b/DQM/HcalTasks/src/PedestalRunSummary.cc index 23c13f1ef38fe..e243f20951853 100644 --- a/DQM/HcalTasks/src/PedestalRunSummary.cc +++ b/DQM/HcalTasks/src/PedestalRunSummary.cc @@ -1,29 +1,24 @@ #include "DQM/HcalTasks/interface/PedestalRunSummary.h" -namespace hcaldqm -{ - PedestalRunSummary::PedestalRunSummary(std::string const& name, - std::string const& taskname, edm::ParameterSet const& ps) : - DQClient(name, taskname, ps) - {} +namespace hcaldqm { + PedestalRunSummary::PedestalRunSummary(std::string const& name, + std::string const& taskname, + edm::ParameterSet const& ps) + : DQClient(name, taskname, ps) {} - /* virtual */ void PedestalRunSummary::beginRun(edm::Run const& r, - edm::EventSetup const& es) - { - DQClient::beginRun(r,es); - } + /* virtual */ void PedestalRunSummary::beginRun(edm::Run const& r, edm::EventSetup const& es) { + DQClient::beginRun(r, es); + } - /* virtual */ void PedestalRunSummary::endLuminosityBlock(DQMStore::IBooker& ib, - DQMStore::IGetter& ig, edm::LuminosityBlock const& lb, - edm::EventSetup const& es) - { - DQClient::endLuminosityBlock(ib, ig, lb, es); - } + /* virtual */ void PedestalRunSummary::endLuminosityBlock(DQMStore::IBooker& ib, + DQMStore::IGetter& ig, + edm::LuminosityBlock const& lb, + edm::EventSetup const& es) { + DQClient::endLuminosityBlock(ib, ig, lb, es); + } - /* virtual */ std::vector PedestalRunSummary::endJob( - DQMStore::IBooker& ib, DQMStore::IGetter& ig) - { - std::vector sumflags; - return sumflags; - } -} + /* virtual */ std::vector PedestalRunSummary::endJob(DQMStore::IBooker& ib, DQMStore::IGetter& ig) { + std::vector sumflags; + return sumflags; + } +} // namespace hcaldqm diff --git a/DQM/HcalTasks/src/RawRunSummary.cc b/DQM/HcalTasks/src/RawRunSummary.cc index 0bd989ea41301..f86babd649045 100644 --- a/DQM/HcalTasks/src/RawRunSummary.cc +++ b/DQM/HcalTasks/src/RawRunSummary.cc @@ -1,67 +1,73 @@ #include "DQM/HcalTasks/interface/RawRunSummary.h" -namespace hcaldqm -{ - using namespace constants; - RawRunSummary::RawRunSummary(std::string const& name, - std::string const& taskname, edm::ParameterSet const& ps) : - DQClient(name, taskname, ps), _booked(false) - {} - - /* virtual */ void RawRunSummary::beginRun(edm::Run const& r, - edm::EventSetup const& es) - { - DQClient::beginRun(r,es); - - if (_ptype!=fOffline) - return; - - // INITIALIZE WHAT NEEDS TO BE INITIALIZE ONLY ONCE! - _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); - _vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN, - constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); - _vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - _filter_VME.initialize(filter::fFilter, hashfunctions::fElectronics, - _vhashVME); // filter out VME - _filter_uTCA.initialize(filter::fFilter, hashfunctions::fElectronics, - _vhashuTCA); // filter out uTCA - - // INTIALIZE CONTAINERS ACTING AS HOLDERS OF RUN INFORAMTION - _cEvnMsm_ElectronicsVME.initialize(_name, "EvnMsm", - hashfunctions::fElectronics, - new quantity::FEDQuantity(_vFEDsVME), - new quantity::ElectronicsQuantity(quantity::fSpigot), - new quantity::ValueQuantity(quantity::fN),0); - _cBcnMsm_ElectronicsVME.initialize(_name, "BcnMsm", - hashfunctions::fElectronics, - new quantity::FEDQuantity(_vFEDsVME), - new quantity::ElectronicsQuantity(quantity::fSpigot), - new quantity::ValueQuantity(quantity::fN),0); - _cEvnMsm_ElectronicsuTCA.initialize(_name, "EvnMsm", - hashfunctions::fElectronics, - new quantity::FEDQuantity(_vFEDsuTCA), - new quantity::ElectronicsQuantity(quantity::fSlotuTCA), - new quantity::ValueQuantity(quantity::fN),0); - _cBcnMsm_ElectronicsuTCA.initialize(_name, "BcnMsm", - hashfunctions::fElectronics, - new quantity::FEDQuantity(_vFEDsuTCA), - new quantity::ElectronicsQuantity(quantity::fSlotuTCA), - new quantity::ValueQuantity(quantity::fN),0); - _cBadQuality_depth.initialize(_name, "BadQuality", - hashfunctions::fdepth, - new quantity::DetectorQuantity(quantity::fieta), - new quantity::DetectorQuantity(quantity::fiphi), - new quantity::ValueQuantity(quantity::fN),0); - - _xEvn.initialize(hashfunctions::fFED); - _xBcn.initialize(hashfunctions::fFED); - _xBadQ.initialize(hashfunctions::fFED); - // BOOK CONTAINERSXXX - _xEvn.book(_emap); _xBcn.book(_emap); _xBadQ.book(_emap); - } - - /* +namespace hcaldqm { + using namespace constants; + RawRunSummary::RawRunSummary(std::string const& name, std::string const& taskname, edm::ParameterSet const& ps) + : DQClient(name, taskname, ps), _booked(false) {} + + /* virtual */ void RawRunSummary::beginRun(edm::Run const& r, edm::EventSetup const& es) { + DQClient::beginRun(r, es); + + if (_ptype != fOffline) + return; + + // INITIALIZE WHAT NEEDS TO BE INITIALIZE ONLY ONCE! + _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); + _vhashVME.push_back( + HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId()); + _vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + _filter_VME.initialize(filter::fFilter, hashfunctions::fElectronics, + _vhashVME); // filter out VME + _filter_uTCA.initialize(filter::fFilter, hashfunctions::fElectronics, + _vhashuTCA); // filter out uTCA + + // INTIALIZE CONTAINERS ACTING AS HOLDERS OF RUN INFORAMTION + _cEvnMsm_ElectronicsVME.initialize(_name, + "EvnMsm", + hashfunctions::fElectronics, + new quantity::FEDQuantity(_vFEDsVME), + new quantity::ElectronicsQuantity(quantity::fSpigot), + new quantity::ValueQuantity(quantity::fN), + 0); + _cBcnMsm_ElectronicsVME.initialize(_name, + "BcnMsm", + hashfunctions::fElectronics, + new quantity::FEDQuantity(_vFEDsVME), + new quantity::ElectronicsQuantity(quantity::fSpigot), + new quantity::ValueQuantity(quantity::fN), + 0); + _cEvnMsm_ElectronicsuTCA.initialize(_name, + "EvnMsm", + hashfunctions::fElectronics, + new quantity::FEDQuantity(_vFEDsuTCA), + new quantity::ElectronicsQuantity(quantity::fSlotuTCA), + new quantity::ValueQuantity(quantity::fN), + 0); + _cBcnMsm_ElectronicsuTCA.initialize(_name, + "BcnMsm", + hashfunctions::fElectronics, + new quantity::FEDQuantity(_vFEDsuTCA), + new quantity::ElectronicsQuantity(quantity::fSlotuTCA), + new quantity::ValueQuantity(quantity::fN), + 0); + _cBadQuality_depth.initialize(_name, + "BadQuality", + hashfunctions::fdepth, + new quantity::DetectorQuantity(quantity::fieta), + new quantity::DetectorQuantity(quantity::fiphi), + new quantity::ValueQuantity(quantity::fN), + 0); + + _xEvn.initialize(hashfunctions::fFED); + _xBcn.initialize(hashfunctions::fFED); + _xBadQ.initialize(hashfunctions::fFED); + // BOOK CONTAINERSXXX + _xEvn.book(_emap); + _xBcn.book(_emap); + _xBadQ.book(_emap); + } + + /* * END OF LUMINOSITY HARVESTING * RAW FORMAT HAS ONLY LUMI BASED FLAGS! * THEREFORE STEPS ARE: @@ -69,250 +75,234 @@ namespace hcaldqm * 2) ANALYZE * 3) GENERATE SUMMARY FLAGS AND PUSH THEM */ - /* virtual */ void RawRunSummary::endLuminosityBlock(DQMStore::IBooker& ib, - DQMStore::IGetter& ig, edm::LuminosityBlock const& lb, - edm::EventSetup const& es) - { - DQClient::endLuminosityBlock(ib, ig, lb, es); - - if (_ptype!=fOffline) - return; - - // INITIALIZE WHAT YOU NEED - LSSummary lssum; // summary for this LS - lssum._LS = _currentLS; // set the LS - - // RESET CONTAINERS USED FOR ANALYSIS OF THIS LS - _xEvn.reset(); _xBcn.reset(); _xBadQ.reset(); - - // INITIALIZE LUMI BASED HISTOGRAMS - Container2D cEvnMsm_ElectronicsVME,cEvnMsm_ElectronicsuTCA; - Container2D cBcnMsm_ElectronicsVME,cBcnMsm_ElectronicsuTCA; - Container2D cBadQuality_depth; - cEvnMsm_ElectronicsVME.initialize(_taskname, "EvnMsm", - hashfunctions::fElectronics, - new quantity::FEDQuantity(_vFEDsVME), - new quantity::ElectronicsQuantity(quantity::fSpigot), - new quantity::ValueQuantity(quantity::fN),0); - cBcnMsm_ElectronicsVME.initialize(_taskname, "BcnMsm", - hashfunctions::fElectronics, - new quantity::FEDQuantity(_vFEDsVME), - new quantity::ElectronicsQuantity(quantity::fSpigot), - new quantity::ValueQuantity(quantity::fN),0); - cEvnMsm_ElectronicsuTCA.initialize(_taskname, "EvnMsm", - hashfunctions::fElectronics, - new quantity::FEDQuantity(_vFEDsuTCA), - new quantity::ElectronicsQuantity(quantity::fSlotuTCA), - new quantity::ValueQuantity(quantity::fN),0); - cBcnMsm_ElectronicsuTCA.initialize(_taskname, "BcnMsm", - hashfunctions::fElectronics, - new quantity::FEDQuantity(_vFEDsuTCA), - new quantity::ElectronicsQuantity(quantity::fSlotuTCA), - new quantity::ValueQuantity(quantity::fN),0); - cBadQuality_depth.initialize(_taskname, "BadQuality", - hashfunctions::fdepth, - new quantity::DetectorQuantity(quantity::fieta), - new quantity::DetectorQuantity(quantity::fiphi), - new quantity::ValueQuantity(quantity::fN),0); - - // LOAD LUMI BASED HISTOGRAMS - cEvnMsm_ElectronicsVME.load(ig, _emap, _filter_uTCA, _subsystem); - cBcnMsm_ElectronicsVME.load(ig, _emap, _filter_uTCA, _subsystem); - cEvnMsm_ElectronicsuTCA.load(ig, _emap, _filter_VME, _subsystem); - cBcnMsm_ElectronicsuTCA.load(ig, _emap, _filter_VME, _subsystem); - cBadQuality_depth.load(ig, _emap, _subsystem); - MonitorElement *meNumEvents = ig.get(_subsystem+ - "/RunInfo/NumberOfEvents"); - int numEvents = meNumEvents->getBinContent(1); - - // BOOK for the very first time - if (!_booked) - { - _cEvnMsm_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cBcnMsm_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); - _cEvnMsm_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cBcnMsm_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); - _cBadQuality_depth.book(ib, _emap, _subsystem); - _booked=true; - } - - // ANALYZE THIS LS - // iterate over all channels - std::vector gids = _emap->allPrecisionId(); - for (std::vector::const_iterator it=gids.begin(); - it!=gids.end(); ++it) - { - if (!it->isHcalDetId()) - continue; - HcalDetId did = HcalDetId(it->rawId()); - HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); - - _xBadQ.get(eid)+=cBadQuality_depth.getBinContent(did); - _cBadQuality_depth.fill(did, cBadQuality_depth.getBinContent(did)); - if (eid.isVMEid()) - { - _xEvn.get(eid)+=cEvnMsm_ElectronicsVME.getBinContent(eid); - _xBcn.get(eid)+=cBcnMsm_ElectronicsVME.getBinContent(eid); - - _cEvnMsm_ElectronicsVME.fill(eid, - cEvnMsm_ElectronicsVME.getBinContent(eid)); - _cBcnMsm_ElectronicsVME.fill(eid, - cBcnMsm_ElectronicsVME.getBinContent(eid)); - } - else - { - _xEvn.get(eid)+=cEvnMsm_ElectronicsuTCA.getBinContent(eid); - _xBcn.get(eid)+=cBcnMsm_ElectronicsuTCA.getBinContent(eid); - - _cEvnMsm_ElectronicsuTCA.fill(eid, - cEvnMsm_ElectronicsuTCA.getBinContent(eid)); - _cBcnMsm_ElectronicsuTCA.fill(eid, - cBcnMsm_ElectronicsuTCA.getBinContent(eid)); - } - } - - - // GENERATE THE SUMMARY FOR THIS LS AND STORE IT - std::vector vtmpflags; // tmp summary flags vector - vtmpflags.resize(nRawFlag); - vtmpflags[fEvnMsm]=flag::Flag("EvnMsm"); - vtmpflags[fBcnMsm]=flag::Flag("BcnMsm"); - vtmpflags[fBadQ]=flag::Flag("BadQ"); - for (std::vector::const_iterator it=_vhashFEDs.begin(); - it!=_vhashFEDs.end(); ++it) - { - HcalElectronicsId eid(*it); - - // reset all the tmp flags to fNA - // MUST DO IT NOW! AS NCDAQ MIGHT OVERWRITE IT! - for (std::vector::iterator ft=vtmpflags.begin(); - ft!=vtmpflags.end(); ++ft) - ft->reset(); - - // check if this FED was @cDAQ - std::vector::const_iterator cit=std::find( - _vcdaqEids.begin(), _vcdaqEids.end(), *it); - if (cit==_vcdaqEids.end()) - { - // was not @cDAQ, set all the flags for this FED as fNCDAQ - for (std::vector::iterator ft=vtmpflags.begin(); - ft!=vtmpflags.end(); ++ft) - ft->_state = flag::fNCDAQ; - - // push all the flags for this FED - // IMPORTANT!!! - lssum._vflags.push_back(vtmpflags); - continue; - } - - // here only if was registered at cDAQ - if (utilities::isFEDHBHE(eid) || utilities::isFEDHF(eid) || - utilities::isFEDHO(eid)) - { - if (_xEvn.get(eid)>0) - vtmpflags[fEvnMsm]._state = flag::fBAD; - else - vtmpflags[fEvnMsm]._state = flag::fGOOD; - if (_xBcn.get(eid)>0) - vtmpflags[fBcnMsm]._state = flag::fBAD; - else - vtmpflags[fBcnMsm]._state = flag::fGOOD; - if (double(_xBadQ.get(eid))>double(12*numEvents)) - vtmpflags[fBadQ]._state = flag::fBAD; - else if (_xBadQ.get(eid)>0) - vtmpflags[fBadQ]._state = flag::fPROBLEMATIC; - else - vtmpflags[fBadQ]._state = flag::fGOOD; - } - - // push all the flags for this FED - lssum._vflags.push_back(vtmpflags); - } - - // push all flags for all FEDs for this LS - _vflagsLS.push_back(lssum); - } - - /* + /* virtual */ void RawRunSummary::endLuminosityBlock(DQMStore::IBooker& ib, + DQMStore::IGetter& ig, + edm::LuminosityBlock const& lb, + edm::EventSetup const& es) { + DQClient::endLuminosityBlock(ib, ig, lb, es); + + if (_ptype != fOffline) + return; + + // INITIALIZE WHAT YOU NEED + LSSummary lssum; // summary for this LS + lssum._LS = _currentLS; // set the LS + + // RESET CONTAINERS USED FOR ANALYSIS OF THIS LS + _xEvn.reset(); + _xBcn.reset(); + _xBadQ.reset(); + + // INITIALIZE LUMI BASED HISTOGRAMS + Container2D cEvnMsm_ElectronicsVME, cEvnMsm_ElectronicsuTCA; + Container2D cBcnMsm_ElectronicsVME, cBcnMsm_ElectronicsuTCA; + Container2D cBadQuality_depth; + cEvnMsm_ElectronicsVME.initialize(_taskname, + "EvnMsm", + hashfunctions::fElectronics, + new quantity::FEDQuantity(_vFEDsVME), + new quantity::ElectronicsQuantity(quantity::fSpigot), + new quantity::ValueQuantity(quantity::fN), + 0); + cBcnMsm_ElectronicsVME.initialize(_taskname, + "BcnMsm", + hashfunctions::fElectronics, + new quantity::FEDQuantity(_vFEDsVME), + new quantity::ElectronicsQuantity(quantity::fSpigot), + new quantity::ValueQuantity(quantity::fN), + 0); + cEvnMsm_ElectronicsuTCA.initialize(_taskname, + "EvnMsm", + hashfunctions::fElectronics, + new quantity::FEDQuantity(_vFEDsuTCA), + new quantity::ElectronicsQuantity(quantity::fSlotuTCA), + new quantity::ValueQuantity(quantity::fN), + 0); + cBcnMsm_ElectronicsuTCA.initialize(_taskname, + "BcnMsm", + hashfunctions::fElectronics, + new quantity::FEDQuantity(_vFEDsuTCA), + new quantity::ElectronicsQuantity(quantity::fSlotuTCA), + new quantity::ValueQuantity(quantity::fN), + 0); + cBadQuality_depth.initialize(_taskname, + "BadQuality", + hashfunctions::fdepth, + new quantity::DetectorQuantity(quantity::fieta), + new quantity::DetectorQuantity(quantity::fiphi), + new quantity::ValueQuantity(quantity::fN), + 0); + + // LOAD LUMI BASED HISTOGRAMS + cEvnMsm_ElectronicsVME.load(ig, _emap, _filter_uTCA, _subsystem); + cBcnMsm_ElectronicsVME.load(ig, _emap, _filter_uTCA, _subsystem); + cEvnMsm_ElectronicsuTCA.load(ig, _emap, _filter_VME, _subsystem); + cBcnMsm_ElectronicsuTCA.load(ig, _emap, _filter_VME, _subsystem); + cBadQuality_depth.load(ig, _emap, _subsystem); + MonitorElement* meNumEvents = ig.get(_subsystem + "/RunInfo/NumberOfEvents"); + int numEvents = meNumEvents->getBinContent(1); + + // BOOK for the very first time + if (!_booked) { + _cEvnMsm_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cBcnMsm_ElectronicsVME.book(ib, _emap, _filter_uTCA, _subsystem); + _cEvnMsm_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cBcnMsm_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem); + _cBadQuality_depth.book(ib, _emap, _subsystem); + _booked = true; + } + + // ANALYZE THIS LS + // iterate over all channels + std::vector gids = _emap->allPrecisionId(); + for (std::vector::const_iterator it = gids.begin(); it != gids.end(); ++it) { + if (!it->isHcalDetId()) + continue; + HcalDetId did = HcalDetId(it->rawId()); + HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did)); + + _xBadQ.get(eid) += cBadQuality_depth.getBinContent(did); + _cBadQuality_depth.fill(did, cBadQuality_depth.getBinContent(did)); + if (eid.isVMEid()) { + _xEvn.get(eid) += cEvnMsm_ElectronicsVME.getBinContent(eid); + _xBcn.get(eid) += cBcnMsm_ElectronicsVME.getBinContent(eid); + + _cEvnMsm_ElectronicsVME.fill(eid, cEvnMsm_ElectronicsVME.getBinContent(eid)); + _cBcnMsm_ElectronicsVME.fill(eid, cBcnMsm_ElectronicsVME.getBinContent(eid)); + } else { + _xEvn.get(eid) += cEvnMsm_ElectronicsuTCA.getBinContent(eid); + _xBcn.get(eid) += cBcnMsm_ElectronicsuTCA.getBinContent(eid); + + _cEvnMsm_ElectronicsuTCA.fill(eid, cEvnMsm_ElectronicsuTCA.getBinContent(eid)); + _cBcnMsm_ElectronicsuTCA.fill(eid, cBcnMsm_ElectronicsuTCA.getBinContent(eid)); + } + } + + // GENERATE THE SUMMARY FOR THIS LS AND STORE IT + std::vector vtmpflags; // tmp summary flags vector + vtmpflags.resize(nRawFlag); + vtmpflags[fEvnMsm] = flag::Flag("EvnMsm"); + vtmpflags[fBcnMsm] = flag::Flag("BcnMsm"); + vtmpflags[fBadQ] = flag::Flag("BadQ"); + for (std::vector::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) { + HcalElectronicsId eid(*it); + + // reset all the tmp flags to fNA + // MUST DO IT NOW! AS NCDAQ MIGHT OVERWRITE IT! + for (std::vector::iterator ft = vtmpflags.begin(); ft != vtmpflags.end(); ++ft) + ft->reset(); + + // check if this FED was @cDAQ + std::vector::const_iterator cit = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), *it); + if (cit == _vcdaqEids.end()) { + // was not @cDAQ, set all the flags for this FED as fNCDAQ + for (std::vector::iterator ft = vtmpflags.begin(); ft != vtmpflags.end(); ++ft) + ft->_state = flag::fNCDAQ; + + // push all the flags for this FED + // IMPORTANT!!! + lssum._vflags.push_back(vtmpflags); + continue; + } + + // here only if was registered at cDAQ + if (utilities::isFEDHBHE(eid) || utilities::isFEDHF(eid) || utilities::isFEDHO(eid)) { + if (_xEvn.get(eid) > 0) + vtmpflags[fEvnMsm]._state = flag::fBAD; + else + vtmpflags[fEvnMsm]._state = flag::fGOOD; + if (_xBcn.get(eid) > 0) + vtmpflags[fBcnMsm]._state = flag::fBAD; + else + vtmpflags[fBcnMsm]._state = flag::fGOOD; + if (double(_xBadQ.get(eid)) > double(12 * numEvents)) + vtmpflags[fBadQ]._state = flag::fBAD; + else if (_xBadQ.get(eid) > 0) + vtmpflags[fBadQ]._state = flag::fPROBLEMATIC; + else + vtmpflags[fBadQ]._state = flag::fGOOD; + } + + // push all the flags for this FED + lssum._vflags.push_back(vtmpflags); + } + + // push all flags for all FEDs for this LS + _vflagsLS.push_back(lssum); + } + + /* * END JOB * BOOK THE SUMMARY CONTAINERS, SET THE FLAGS * RETURN THE LIST OF FLAGS FOR THIS DATATIER */ - /* virtual */ std::vector RawRunSummary::endJob( - DQMStore::IBooker& ib, DQMStore::IGetter& ig) - { - - if (_ptype!=fOffline) - return std::vector(); - - - // PREPARE LS BASED FLAGS to use it for booking - std::vector vflagsLS; - vflagsLS.resize(nRawFlag); - vflagsLS[fEvnMsm]=flag::Flag("EvnMsm"); - vflagsLS[fBcnMsm]=flag::Flag("BcnMsm"); - vflagsLS[fBadQ]=flag::Flag("BadQ"); - - - // INITIALIZE AND BOOK SUMMARY CONTAINERS - ContainerSingle2D cSummaryvsLS; // summary per FED: flag vs LS - Container2D cSummaryvsLS_FED; // LS based flags vs LS for each FED - cSummaryvsLS.initialize(_name, "SummaryvsLS", - new quantity::LumiSection(_maxProcessedLS), - new quantity::FEDQuantity(_vFEDs), - new quantity::ValueQuantity(quantity::fState),0); - cSummaryvsLS_FED.initialize(_name, "SummaryvsLS", - hashfunctions::fFED, - new quantity::LumiSection(_maxProcessedLS), - new quantity::FlagQuantity(vflagsLS), - new quantity::ValueQuantity(quantity::fState),0); - cSummaryvsLS_FED.book(ib, _emap, _subsystem); - cSummaryvsLS.book(ib, _subsystem); - - /* + /* virtual */ std::vector RawRunSummary::endJob(DQMStore::IBooker& ib, DQMStore::IGetter& ig) { + if (_ptype != fOffline) + return std::vector(); + + // PREPARE LS BASED FLAGS to use it for booking + std::vector vflagsLS; + vflagsLS.resize(nRawFlag); + vflagsLS[fEvnMsm] = flag::Flag("EvnMsm"); + vflagsLS[fBcnMsm] = flag::Flag("BcnMsm"); + vflagsLS[fBadQ] = flag::Flag("BadQ"); + + // INITIALIZE AND BOOK SUMMARY CONTAINERS + ContainerSingle2D cSummaryvsLS; // summary per FED: flag vs LS + Container2D cSummaryvsLS_FED; // LS based flags vs LS for each FED + cSummaryvsLS.initialize(_name, + "SummaryvsLS", + new quantity::LumiSection(_maxProcessedLS), + new quantity::FEDQuantity(_vFEDs), + new quantity::ValueQuantity(quantity::fState), + 0); + cSummaryvsLS_FED.initialize(_name, + "SummaryvsLS", + hashfunctions::fFED, + new quantity::LumiSection(_maxProcessedLS), + new quantity::FlagQuantity(vflagsLS), + new quantity::ValueQuantity(quantity::fState), + 0); + cSummaryvsLS_FED.book(ib, _emap, _subsystem); + cSummaryvsLS.book(ib, _subsystem); + + /* * Iterate over each FED * Iterate over each LS SUmmary * Iterate over all flags * set... */ - std::vector sumflags; // flag per FED - int ifed=0; - for (std::vector::const_iterator it=_vhashFEDs.begin(); - it!=_vhashFEDs.end(); ++it) - { - flag::Flag fSumRun("RAW"); // summary flag for this FED - HcalElectronicsId eid(*it); - - // ITERATE OVER EACH LS - for (std::vector::const_iterator itls=_vflagsLS.begin(); - itls!=_vflagsLS.end(); ++itls) - { - // fill histograms per LS - int iflag=0; - flag::Flag fSumLS("RAW"); - for (std::vector::const_iterator ft= - itls->_vflags[ifed].begin(); ft!=itls->_vflags[ifed].end(); - ++ft) - { - // Flag vs LS per FEd - cSummaryvsLS_FED.setBinContent(eid, itls->_LS, int(iflag), - ft->_state); - fSumLS+=(*ft); - iflag++; - } - // FED vs LS - cSummaryvsLS.setBinContent(eid, itls->_LS, fSumLS._state); - fSumRun+=fSumLS; - } - - // push the summary flag for this FED for the whole RUN - sumflags.push_back(fSumRun); - - // increment the fed counter - ifed++; - } - - return sumflags; - } -} + std::vector sumflags; // flag per FED + int ifed = 0; + for (std::vector::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) { + flag::Flag fSumRun("RAW"); // summary flag for this FED + HcalElectronicsId eid(*it); + + // ITERATE OVER EACH LS + for (std::vector::const_iterator itls = _vflagsLS.begin(); itls != _vflagsLS.end(); ++itls) { + // fill histograms per LS + int iflag = 0; + flag::Flag fSumLS("RAW"); + for (std::vector::const_iterator ft = itls->_vflags[ifed].begin(); ft != itls->_vflags[ifed].end(); + ++ft) { + // Flag vs LS per FEd + cSummaryvsLS_FED.setBinContent(eid, itls->_LS, int(iflag), ft->_state); + fSumLS += (*ft); + iflag++; + } + // FED vs LS + cSummaryvsLS.setBinContent(eid, itls->_LS, fSumLS._state); + fSumRun += fSumLS; + } + + // push the summary flag for this FED for the whole RUN + sumflags.push_back(fSumRun); + + // increment the fed counter + ifed++; + } + + return sumflags; + } +} // namespace hcaldqm diff --git a/DQM/HcalTasks/src/RecoRunSummary.cc b/DQM/HcalTasks/src/RecoRunSummary.cc index d8b0c044fefb1..bfa10282504f3 100644 --- a/DQM/HcalTasks/src/RecoRunSummary.cc +++ b/DQM/HcalTasks/src/RecoRunSummary.cc @@ -1,192 +1,169 @@ #include "DQM/HcalTasks/interface/RecoRunSummary.h" -namespace hcaldqm -{ - using namespace constants; - - RecoRunSummary::RecoRunSummary(std::string const& name, - std::string const& taskname, edm::ParameterSet const& ps) : - DQClient(name, taskname, ps) - { - _thresh_unihf = ps.getUntrackedParameter("thresh_unihf", - 0.2); - _thresh_tcds = ps.getUntrackedParameter("thresh_tcds", - 1.5); - } - - /* virtual */ void RecoRunSummary::beginRun(edm::Run const& r, - edm::EventSetup const& es) - { - DQClient::beginRun(r,es); - } - - /* +namespace hcaldqm { + using namespace constants; + + RecoRunSummary::RecoRunSummary(std::string const& name, std::string const& taskname, edm::ParameterSet const& ps) + : DQClient(name, taskname, ps) { + _thresh_unihf = ps.getUntrackedParameter("thresh_unihf", 0.2); + _thresh_tcds = ps.getUntrackedParameter("thresh_tcds", 1.5); + } + + /* virtual */ void RecoRunSummary::beginRun(edm::Run const& r, edm::EventSetup const& es) { + DQClient::beginRun(r, es); + } + + /* * */ - /* virtual */ void RecoRunSummary::endLuminosityBlock(DQMStore::IBooker& ib, - DQMStore::IGetter& ig, edm::LuminosityBlock const& lb, - edm::EventSetup const& es) - { - DQClient::endLuminosityBlock(ib, ig, lb, es); - } - - /* + /* virtual */ void RecoRunSummary::endLuminosityBlock(DQMStore::IBooker& ib, + DQMStore::IGetter& ig, + edm::LuminosityBlock const& lb, + edm::EventSetup const& es) { + DQClient::endLuminosityBlock(ib, ig, lb, es); + } + + /* * */ - /* virtual */ std::vector RecoRunSummary::endJob( - DQMStore::IBooker& ib, DQMStore::IGetter& ig) - { - - if (_ptype!=fOffline) - return std::vector(); - - // FILTERS, some useful vectors, hash maps - std::vector vhashCrateHF; - vhashCrateHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vhashCrateHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - vhashCrateHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN, - FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); - filter::HashFilter filter_CrateHF; - filter_CrateHF.initialize(filter::fPreserver, hashfunctions::fCrate, - vhashCrateHF); // preserve only HF crates - electronicsmap::ElectronicsMap ehashmap; - ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); - bool tcdsshift = false; - std::vector vflags; vflags.resize(nRecoFlag); - vflags[fUniSlotHF]=flag::Flag("UniSlotHF"); - vflags[fTCDS]=flag::Flag("TCDS"); - - - // INITIALIZE - Container2D cOccupancy_depth, cOccupancyCut_depth; - ContainerSingle2D cSummary; - Container1D cTimingCut_HBHEPartition; - ContainerXXX xUniHF, xUni; - xUni.initialize(hashfunctions::fCrate); - xUniHF.initialize(hashfunctions::fCrateSlot); - cOccupancy_depth.initialize(_taskname, "Occupancy", - hashfunctions::fdepth, - new quantity::DetectorQuantity(quantity::fieta), - new quantity::DetectorQuantity(quantity::fiphi), - new quantity::ValueQuantity(quantity::fN),0); - cOccupancyCut_depth.initialize(_taskname, "OccupancyCut", - hashfunctions::fdepth, - new quantity::DetectorQuantity(quantity::fieta), - new quantity::DetectorQuantity(quantity::fiphi), - new quantity::ValueQuantity(quantity::fN),0); - cTimingCut_HBHEPartition.initialize(_taskname, "TimingCut", - hashfunctions::fHBHEPartition, - new quantity::ValueQuantity(quantity::fTiming_ns), - new quantity::ValueQuantity(quantity::fN),0); - - cSummary.initialize(_name, "Summary", - new quantity::CrateQuantity(_emap), - new quantity::FlagQuantity(vflags), - new quantity::ValueQuantity(quantity::fState),0); - - // BOOK - xUniHF.book(_emap, filter_CrateHF); - - - // LOAD - cOccupancy_depth.load(ig, _emap, _subsystem); - cOccupancyCut_depth.load(ig, _emap, _subsystem); - cTimingCut_HBHEPartition.book(ib, _emap, _subsystem); - cSummary.book(ib, _subsystem); - - // iterate over all channels - std::vector gids = _emap->allPrecisionId(); - for (std::vector::const_iterator it=gids.begin(); - it!=gids.end(); ++it) - { - if (!it->isHcalDetId()) - continue; - - HcalDetId did(it->rawId()); - HcalElectronicsId eid = HcalElectronicsId(ehashmap.lookup(did)); - - if (did.subdet()==HcalForward) - xUniHF.get(eid)+=cOccupancyCut_depth.getBinContent(did); - } - - - // iphi/slot HF non uniformity - for (doubleCompactMap::const_iterator it=xUniHF.begin(); - it!=xUniHF.end(); ++it) - { - uint32_t hash1 = it->first; - HcalElectronicsId eid1(hash1); - double x1 = it->second; - for (doubleCompactMap::const_iterator jt=xUniHF.begin(); - jt!=xUniHF.end(); ++jt) - { - if (jt==it) - continue; - - double x2 = jt->second; - if (x2==0) - continue; - if (x1/x2<_thresh_unihf) - xUni.get(eid1)++; - } - } - - - // TCDS shift - double a = cTimingCut_HBHEPartition.getMean( - HcalDetId(HcalBarrel,1,5,1)); - double b = cTimingCut_HBHEPartition.getMean( - HcalDetId(HcalBarrel,1,30,1)); - double c = cTimingCut_HBHEPartition.getMean( - HcalDetId(HcalBarrel,1,55,1)); - double dab = fabs(a-b); - double dac = fabs(a-c); - double dbc = fabs(b-c); - if (dab>=_thresh_tcds || dac>=_thresh_tcds || dbc>=_thresh_tcds) - tcdsshift = true; - - // summary flags - std::vector sumflags; - int icrate=0; - for (std::vector::const_iterator it=_vhashCrates.begin(); - it!=_vhashCrates.end(); ++it) - { - flag::Flag fSum("RECO"); - HcalElectronicsId eid(*it); - HcalDetId did = HcalDetId(_emap->lookup(eid)); - - // registered @cDAQ - if (did.subdet() == HcalBarrel || did.subdet() == HcalEndcap) - { - if (tcdsshift) - vflags[fTCDS]._state = flag::fBAD; - else - vflags[fTCDS]._state = flag::fGOOD; - } - if (did.subdet() == HcalForward) - { - if (xUni.get(eid)>0) - vflags[fUniSlotHF]._state = flag::fBAD; - else - vflags[fUniSlotHF]._state = flag::fGOOD; - } - - // combine - int iflag=0; - for (std::vector::iterator ft=vflags.begin(); - ft!=vflags.end(); ++ft) - { - cSummary.setBinContent(eid, iflag, ft->_state); - fSum+=(*ft); - iflag++; - ft->reset(); - } - sumflags.push_back(fSum); - icrate++; - } - - return sumflags; - } -} + /* virtual */ std::vector RecoRunSummary::endJob(DQMStore::IBooker& ib, DQMStore::IGetter& ig) { + if (_ptype != fOffline) + return std::vector(); + + // FILTERS, some useful vectors, hash maps + std::vector vhashCrateHF; + vhashCrateHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vhashCrateHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + vhashCrateHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId()); + filter::HashFilter filter_CrateHF; + filter_CrateHF.initialize(filter::fPreserver, hashfunctions::fCrate, + vhashCrateHF); // preserve only HF crates + electronicsmap::ElectronicsMap ehashmap; + ehashmap.initialize(_emap, electronicsmap::fD2EHashMap); + bool tcdsshift = false; + std::vector vflags; + vflags.resize(nRecoFlag); + vflags[fUniSlotHF] = flag::Flag("UniSlotHF"); + vflags[fTCDS] = flag::Flag("TCDS"); + + // INITIALIZE + Container2D cOccupancy_depth, cOccupancyCut_depth; + ContainerSingle2D cSummary; + Container1D cTimingCut_HBHEPartition; + ContainerXXX xUniHF, xUni; + xUni.initialize(hashfunctions::fCrate); + xUniHF.initialize(hashfunctions::fCrateSlot); + cOccupancy_depth.initialize(_taskname, + "Occupancy", + hashfunctions::fdepth, + new quantity::DetectorQuantity(quantity::fieta), + new quantity::DetectorQuantity(quantity::fiphi), + new quantity::ValueQuantity(quantity::fN), + 0); + cOccupancyCut_depth.initialize(_taskname, + "OccupancyCut", + hashfunctions::fdepth, + new quantity::DetectorQuantity(quantity::fieta), + new quantity::DetectorQuantity(quantity::fiphi), + new quantity::ValueQuantity(quantity::fN), + 0); + cTimingCut_HBHEPartition.initialize(_taskname, + "TimingCut", + hashfunctions::fHBHEPartition, + new quantity::ValueQuantity(quantity::fTiming_ns), + new quantity::ValueQuantity(quantity::fN), + 0); + + cSummary.initialize(_name, + "Summary", + new quantity::CrateQuantity(_emap), + new quantity::FlagQuantity(vflags), + new quantity::ValueQuantity(quantity::fState), + 0); + + // BOOK + xUniHF.book(_emap, filter_CrateHF); + + // LOAD + cOccupancy_depth.load(ig, _emap, _subsystem); + cOccupancyCut_depth.load(ig, _emap, _subsystem); + cTimingCut_HBHEPartition.book(ib, _emap, _subsystem); + cSummary.book(ib, _subsystem); + + // iterate over all channels + std::vector gids = _emap->allPrecisionId(); + for (std::vector::const_iterator it = gids.begin(); it != gids.end(); ++it) { + if (!it->isHcalDetId()) + continue; + + HcalDetId did(it->rawId()); + HcalElectronicsId eid = HcalElectronicsId(ehashmap.lookup(did)); + + if (did.subdet() == HcalForward) + xUniHF.get(eid) += cOccupancyCut_depth.getBinContent(did); + } + + // iphi/slot HF non uniformity + for (doubleCompactMap::const_iterator it = xUniHF.begin(); it != xUniHF.end(); ++it) { + uint32_t hash1 = it->first; + HcalElectronicsId eid1(hash1); + double x1 = it->second; + for (doubleCompactMap::const_iterator jt = xUniHF.begin(); jt != xUniHF.end(); ++jt) { + if (jt == it) + continue; + + double x2 = jt->second; + if (x2 == 0) + continue; + if (x1 / x2 < _thresh_unihf) + xUni.get(eid1)++; + } + } + + // TCDS shift + double a = cTimingCut_HBHEPartition.getMean(HcalDetId(HcalBarrel, 1, 5, 1)); + double b = cTimingCut_HBHEPartition.getMean(HcalDetId(HcalBarrel, 1, 30, 1)); + double c = cTimingCut_HBHEPartition.getMean(HcalDetId(HcalBarrel, 1, 55, 1)); + double dab = fabs(a - b); + double dac = fabs(a - c); + double dbc = fabs(b - c); + if (dab >= _thresh_tcds || dac >= _thresh_tcds || dbc >= _thresh_tcds) + tcdsshift = true; + + // summary flags + std::vector sumflags; + int icrate = 0; + for (std::vector::const_iterator it = _vhashCrates.begin(); it != _vhashCrates.end(); ++it) { + flag::Flag fSum("RECO"); + HcalElectronicsId eid(*it); + HcalDetId did = HcalDetId(_emap->lookup(eid)); + + // registered @cDAQ + if (did.subdet() == HcalBarrel || did.subdet() == HcalEndcap) { + if (tcdsshift) + vflags[fTCDS]._state = flag::fBAD; + else + vflags[fTCDS]._state = flag::fGOOD; + } + if (did.subdet() == HcalForward) { + if (xUni.get(eid) > 0) + vflags[fUniSlotHF]._state = flag::fBAD; + else + vflags[fUniSlotHF]._state = flag::fGOOD; + } + + // combine + int iflag = 0; + for (std::vector::iterator ft = vflags.begin(); ft != vflags.end(); ++ft) { + cSummary.setBinContent(eid, iflag, ft->_state); + fSum += (*ft); + iflag++; + ft->reset(); + } + sumflags.push_back(fSum); + icrate++; + } + + return sumflags; + } +} // namespace hcaldqm diff --git a/DQM/HcalTasks/src/TPRunSummary.cc b/DQM/HcalTasks/src/TPRunSummary.cc index 91fa440e93042..dd56320278da8 100644 --- a/DQM/HcalTasks/src/TPRunSummary.cc +++ b/DQM/HcalTasks/src/TPRunSummary.cc @@ -1,174 +1,171 @@ #include "DQM/HcalTasks/interface/TPRunSummary.h" -namespace hcaldqm -{ - using namespace constants; - TPRunSummary::TPRunSummary(std::string const& name, - std::string const& taskname, edm::ParameterSet const& ps) : - DQClient(name, taskname, ps) - { - _thresh_EtMsmRate_high = ps.getUntrackedParameter( - "thresh_EtMsmRate_high", 0.2); - _thresh_EtMsmRate_low = ps.getUntrackedParameter( - "thresh_EtMsmRate_low", 0.05); - _thresh_FGMsmRate_high = ps.getUntrackedParameter( - "thresh_FGMsmRate_high", 0.2); - _thresh_FGMsmRate_low = ps.getUntrackedParameter( - "thresh_FGMsmRate_low", 0.05); - } - - /* virtual */ void TPRunSummary::beginRun(edm::Run const& r, - edm::EventSetup const& es) - { - DQClient::beginRun(r,es); - } - - /* virtual */ void TPRunSummary::endLuminosityBlock(DQMStore::IBooker& ib, - DQMStore::IGetter& ig, edm::LuminosityBlock const& lb, - edm::EventSetup const& es) - { - DQClient::endLuminosityBlock(ib, ig, lb, es); - } - - /* virtual */ std::vector TPRunSummary::endJob( - DQMStore::IBooker& ib, DQMStore::IGetter& ig) - { - // hahs maps - electronicsmap::ElectronicsMap ehashmap; - ehashmap.initialize(_emap, electronicsmap::fT2EHashMap); - std::vector vflags; vflags.resize(nTPFlag); - vflags[fEtMsm]=flag::Flag("EtMsm"); - vflags[fFGMsm]=flag::Flag("FGMsm"); - - // INITIALIZE - ContainerSingle2D cOccupancyData_depthlike, cOccupancyEmul_depthlike; - ContainerSingle2D cEtMsm_depthlike, cFGMsm_depthlike, - cEtCorrRatio_depthlike; - ContainerSingle2D cSummary; - ContainerXXX xDeadD, xDeadE, xEtMsm, xFGMsm; - ContainerXXX xNumCorr; - xDeadD.initialize(hashfunctions::fCrate); - xDeadE.initialize(hashfunctions::fCrate); - xEtMsm.initialize(hashfunctions::fCrate); - xFGMsm.initialize(hashfunctions::fCrate); - xNumCorr.initialize(hashfunctions::fCrate); - cOccupancyData_depthlike.initialize(_taskname, "OccupancyData", - new quantity::TrigTowerQuantity(quantity::fTTieta), - new quantity::TrigTowerQuantity(quantity::fTTiphi), - new quantity::ValueQuantity(quantity::fN, true),0); - cOccupancyEmul_depthlike.initialize(_taskname, "OccupancyEmul", - new quantity::TrigTowerQuantity(quantity::fTTieta), - new quantity::TrigTowerQuantity(quantity::fTTiphi), - new quantity::ValueQuantity(quantity::fN, true),0); - cEtMsm_depthlike.initialize(_taskname, "EtMsm", - new quantity::TrigTowerQuantity(quantity::fTTieta), - new quantity::TrigTowerQuantity(quantity::fTTiphi), - new quantity::ValueQuantity(quantity::fN),0); - cFGMsm_depthlike.initialize(_taskname, "FGMsm", - new quantity::TrigTowerQuantity(quantity::fTTieta), - new quantity::TrigTowerQuantity(quantity::fTTiphi), - new quantity::ValueQuantity(quantity::fN),0); - cEtCorrRatio_depthlike.initialize(_taskname, "EtCorrRatio", - new quantity::TrigTowerQuantity(quantity::fTTieta), - new quantity::TrigTowerQuantity(quantity::fTTiphi), - new quantity::ValueQuantity(quantity::fRatio_0to2),0); - _cEtMsmFraction_depthlike.initialize(_taskname, "EtMsmFraction", - new quantity::TrigTowerQuantity(quantity::fTTieta), - new quantity::TrigTowerQuantity(quantity::fTTiphi), - new quantity::ValueQuantity(quantity::fRatio_0to2),0); - _cFGMsmFraction_depthlike.initialize(_taskname, "FGMsmFraction", - new quantity::TrigTowerQuantity(quantity::fTTieta), - new quantity::TrigTowerQuantity(quantity::fTTiphi), - new quantity::ValueQuantity(quantity::fRatio_0to2),0); - cSummary.initialize(_name, "Summary", - new quantity::CrateQuantity(_emap), - new quantity::FlagQuantity(vflags), - new quantity::ValueQuantity(quantity::fState),0); - - // BOOK - xDeadD.book(_emap); xDeadE.book(_emap); xEtMsm.book(_emap); - xFGMsm.book(_emap); xNumCorr.book(_emap); - - // LOAD - cOccupancyData_depthlike.load(ig, _subsystem); - cOccupancyEmul_depthlike.load(ig, _subsystem); - cEtMsm_depthlike.load(ig, _subsystem); - cFGMsm_depthlike.load(ig, _subsystem); - cEtCorrRatio_depthlike.load(ig, _subsystem); - _cEtMsmFraction_depthlike.book(ib, _subsystem); - _cFGMsmFraction_depthlike.book(ib, _subsystem); - cSummary.book(ib, _subsystem); - - // iterate - std::vector tids = _emap->allTriggerId(); - for (std::vector::const_iterator it=tids.begin(); - it!=tids.end(); ++it) - { - // skip 2x3 - HcalTrigTowerDetId tid = HcalTrigTowerDetId(*it); - if (tid.version()==0 && tid.ietaAbs()>=29) - continue; - - // do the comparison if there are channels that were correlated - // both had emul and data tps - if (cEtCorrRatio_depthlike.getBinEntries(tid)>0) - { - HcalElectronicsId eid=HcalElectronicsId(ehashmap.lookup(*it)); - - double numetmsm = cEtMsm_depthlike.getBinContent(tid); - double numfgmsm = cFGMsm_depthlike.getBinContent(tid); - double numcorr = cEtCorrRatio_depthlike.getBinEntries(tid); - - xEtMsm.get(eid) += numetmsm; - xFGMsm.get(eid) += numfgmsm; - xNumCorr.get(eid) += numcorr; - - _cEtMsmFraction_depthlike.setBinContent(tid, - numetmsm/numcorr); - _cFGMsmFraction_depthlike.setBinContent(tid, - numfgmsm/numcorr); - } - } - - std::vector sumflags; - for (auto& it_hashcrate : _vhashCrates) { - flag::Flag fSum("TP"); - HcalElectronicsId eid(it_hashcrate); - HcalDetId did = HcalDetId(_emap->lookup(eid)); - - if (did.subdet() == HcalBarrel || did.subdet() == HcalEndcap || did.subdet() == HcalForward) { - double etmsmfr = xNumCorr.get(eid)>0? - double(xEtMsm.get(eid))/double(xNumCorr.get(eid)):0; - double fgmsmfr = xNumCorr.get(eid)>0? - double(xFGMsm.get(eid))/double(xNumCorr.get(eid)):0; - - if (etmsmfr>=_thresh_EtMsmRate_high) - vflags[fEtMsm]._state = flag::fBAD; - else if (etmsmfr>=_thresh_EtMsmRate_low) - vflags[fEtMsm]._state = flag::fPROBLEMATIC; - else - vflags[fEtMsm]._state = flag::fGOOD; - if (fgmsmfr>=_thresh_FGMsmRate_high) - vflags[fFGMsm]._state = flag::fBAD; - else if (fgmsmfr>=_thresh_FGMsmRate_low) - vflags[fFGMsm]._state = flag::fPROBLEMATIC; - else - vflags[fFGMsm]._state = flag::fGOOD; - } - - // combine - int iflag=0; - for (std::vector::iterator ft=vflags.begin(); - ft!=vflags.end(); ++ft) - { - cSummary.setBinContent(eid, iflag, ft->_state); - fSum+=(*ft); - iflag++; - ft->reset(); - } - sumflags.push_back(fSum); - } - - return sumflags; - } -} +namespace hcaldqm { + using namespace constants; + TPRunSummary::TPRunSummary(std::string const& name, std::string const& taskname, edm::ParameterSet const& ps) + : DQClient(name, taskname, ps) { + _thresh_EtMsmRate_high = ps.getUntrackedParameter("thresh_EtMsmRate_high", 0.2); + _thresh_EtMsmRate_low = ps.getUntrackedParameter("thresh_EtMsmRate_low", 0.05); + _thresh_FGMsmRate_high = ps.getUntrackedParameter("thresh_FGMsmRate_high", 0.2); + _thresh_FGMsmRate_low = ps.getUntrackedParameter("thresh_FGMsmRate_low", 0.05); + } + + /* virtual */ void TPRunSummary::beginRun(edm::Run const& r, edm::EventSetup const& es) { DQClient::beginRun(r, es); } + + /* virtual */ void TPRunSummary::endLuminosityBlock(DQMStore::IBooker& ib, + DQMStore::IGetter& ig, + edm::LuminosityBlock const& lb, + edm::EventSetup const& es) { + DQClient::endLuminosityBlock(ib, ig, lb, es); + } + + /* virtual */ std::vector TPRunSummary::endJob(DQMStore::IBooker& ib, DQMStore::IGetter& ig) { + // hahs maps + electronicsmap::ElectronicsMap ehashmap; + ehashmap.initialize(_emap, electronicsmap::fT2EHashMap); + std::vector vflags; + vflags.resize(nTPFlag); + vflags[fEtMsm] = flag::Flag("EtMsm"); + vflags[fFGMsm] = flag::Flag("FGMsm"); + + // INITIALIZE + ContainerSingle2D cOccupancyData_depthlike, cOccupancyEmul_depthlike; + ContainerSingle2D cEtMsm_depthlike, cFGMsm_depthlike, cEtCorrRatio_depthlike; + ContainerSingle2D cSummary; + ContainerXXX xDeadD, xDeadE, xEtMsm, xFGMsm; + ContainerXXX xNumCorr; + xDeadD.initialize(hashfunctions::fCrate); + xDeadE.initialize(hashfunctions::fCrate); + xEtMsm.initialize(hashfunctions::fCrate); + xFGMsm.initialize(hashfunctions::fCrate); + xNumCorr.initialize(hashfunctions::fCrate); + cOccupancyData_depthlike.initialize(_taskname, + "OccupancyData", + new quantity::TrigTowerQuantity(quantity::fTTieta), + new quantity::TrigTowerQuantity(quantity::fTTiphi), + new quantity::ValueQuantity(quantity::fN, true), + 0); + cOccupancyEmul_depthlike.initialize(_taskname, + "OccupancyEmul", + new quantity::TrigTowerQuantity(quantity::fTTieta), + new quantity::TrigTowerQuantity(quantity::fTTiphi), + new quantity::ValueQuantity(quantity::fN, true), + 0); + cEtMsm_depthlike.initialize(_taskname, + "EtMsm", + new quantity::TrigTowerQuantity(quantity::fTTieta), + new quantity::TrigTowerQuantity(quantity::fTTiphi), + new quantity::ValueQuantity(quantity::fN), + 0); + cFGMsm_depthlike.initialize(_taskname, + "FGMsm", + new quantity::TrigTowerQuantity(quantity::fTTieta), + new quantity::TrigTowerQuantity(quantity::fTTiphi), + new quantity::ValueQuantity(quantity::fN), + 0); + cEtCorrRatio_depthlike.initialize(_taskname, + "EtCorrRatio", + new quantity::TrigTowerQuantity(quantity::fTTieta), + new quantity::TrigTowerQuantity(quantity::fTTiphi), + new quantity::ValueQuantity(quantity::fRatio_0to2), + 0); + _cEtMsmFraction_depthlike.initialize(_taskname, + "EtMsmFraction", + new quantity::TrigTowerQuantity(quantity::fTTieta), + new quantity::TrigTowerQuantity(quantity::fTTiphi), + new quantity::ValueQuantity(quantity::fRatio_0to2), + 0); + _cFGMsmFraction_depthlike.initialize(_taskname, + "FGMsmFraction", + new quantity::TrigTowerQuantity(quantity::fTTieta), + new quantity::TrigTowerQuantity(quantity::fTTiphi), + new quantity::ValueQuantity(quantity::fRatio_0to2), + 0); + cSummary.initialize(_name, + "Summary", + new quantity::CrateQuantity(_emap), + new quantity::FlagQuantity(vflags), + new quantity::ValueQuantity(quantity::fState), + 0); + + // BOOK + xDeadD.book(_emap); + xDeadE.book(_emap); + xEtMsm.book(_emap); + xFGMsm.book(_emap); + xNumCorr.book(_emap); + + // LOAD + cOccupancyData_depthlike.load(ig, _subsystem); + cOccupancyEmul_depthlike.load(ig, _subsystem); + cEtMsm_depthlike.load(ig, _subsystem); + cFGMsm_depthlike.load(ig, _subsystem); + cEtCorrRatio_depthlike.load(ig, _subsystem); + _cEtMsmFraction_depthlike.book(ib, _subsystem); + _cFGMsmFraction_depthlike.book(ib, _subsystem); + cSummary.book(ib, _subsystem); + + // iterate + std::vector tids = _emap->allTriggerId(); + for (std::vector::const_iterator it = tids.begin(); it != tids.end(); ++it) { + // skip 2x3 + HcalTrigTowerDetId tid = HcalTrigTowerDetId(*it); + if (tid.version() == 0 && tid.ietaAbs() >= 29) + continue; + + // do the comparison if there are channels that were correlated + // both had emul and data tps + if (cEtCorrRatio_depthlike.getBinEntries(tid) > 0) { + HcalElectronicsId eid = HcalElectronicsId(ehashmap.lookup(*it)); + + double numetmsm = cEtMsm_depthlike.getBinContent(tid); + double numfgmsm = cFGMsm_depthlike.getBinContent(tid); + double numcorr = cEtCorrRatio_depthlike.getBinEntries(tid); + + xEtMsm.get(eid) += numetmsm; + xFGMsm.get(eid) += numfgmsm; + xNumCorr.get(eid) += numcorr; + + _cEtMsmFraction_depthlike.setBinContent(tid, numetmsm / numcorr); + _cFGMsmFraction_depthlike.setBinContent(tid, numfgmsm / numcorr); + } + } + + std::vector sumflags; + for (auto& it_hashcrate : _vhashCrates) { + flag::Flag fSum("TP"); + HcalElectronicsId eid(it_hashcrate); + HcalDetId did = HcalDetId(_emap->lookup(eid)); + + if (did.subdet() == HcalBarrel || did.subdet() == HcalEndcap || did.subdet() == HcalForward) { + double etmsmfr = xNumCorr.get(eid) > 0 ? double(xEtMsm.get(eid)) / double(xNumCorr.get(eid)) : 0; + double fgmsmfr = xNumCorr.get(eid) > 0 ? double(xFGMsm.get(eid)) / double(xNumCorr.get(eid)) : 0; + + if (etmsmfr >= _thresh_EtMsmRate_high) + vflags[fEtMsm]._state = flag::fBAD; + else if (etmsmfr >= _thresh_EtMsmRate_low) + vflags[fEtMsm]._state = flag::fPROBLEMATIC; + else + vflags[fEtMsm]._state = flag::fGOOD; + if (fgmsmfr >= _thresh_FGMsmRate_high) + vflags[fFGMsm]._state = flag::fBAD; + else if (fgmsmfr >= _thresh_FGMsmRate_low) + vflags[fFGMsm]._state = flag::fPROBLEMATIC; + else + vflags[fFGMsm]._state = flag::fGOOD; + } + + // combine + int iflag = 0; + for (std::vector::iterator ft = vflags.begin(); ft != vflags.end(); ++ft) { + cSummary.setBinContent(eid, iflag, ft->_state); + fSum += (*ft); + iflag++; + ft->reset(); + } + sumflags.push_back(fSum); + } + + return sumflags; + } +} // namespace hcaldqm diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1RecHits.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1RecHits.cc index 4bb45ef1a70be..8e379069cdd47 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1RecHits.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1RecHits.cc @@ -24,22 +24,12 @@ namespace { -class SiPixelPhase1RecHits final : public SiPixelPhase1Base { - enum { - NRECHITS, - CLUST_X, - CLUST_Y, - ERROR_X, - ERROR_Y, - POS, - CLUSTER_PROB, - NONEDGE, - NOTHERBAD - }; + class SiPixelPhase1RecHits final : public SiPixelPhase1Base { + enum { NRECHITS, CLUST_X, CLUST_Y, ERROR_X, ERROR_Y, POS, CLUSTER_PROB, NONEDGE, NOTHERBAD }; public: - explicit SiPixelPhase1RecHits(const edm::ParameterSet& conf); - void analyze(const edm::Event&, const edm::EventSetup&) override; + explicit SiPixelPhase1RecHits(const edm::ParameterSet& conf); + void analyze(const edm::Event&, const edm::EventSetup&) override; private: edm::EDGetTokenT srcToken_; @@ -47,130 +37,137 @@ class SiPixelPhase1RecHits final : public SiPixelPhase1Base { bool onlyValid_; bool applyVertexCut_; -}; + }; -SiPixelPhase1RecHits::SiPixelPhase1RecHits(const edm::ParameterSet& iConfig) : - SiPixelPhase1Base(iConfig) -{ - srcToken_ = consumes(iConfig.getParameter("src")); + SiPixelPhase1RecHits::SiPixelPhase1RecHits(const edm::ParameterSet& iConfig) : SiPixelPhase1Base(iConfig) { + srcToken_ = consumes(iConfig.getParameter("src")); - offlinePrimaryVerticesToken_ = consumes(std::string("offlinePrimaryVertices")); + offlinePrimaryVerticesToken_ = consumes(std::string("offlinePrimaryVertices")); - onlyValid_=iConfig.getParameter("onlyValidHits"); + onlyValid_ = iConfig.getParameter("onlyValidHits"); + + applyVertexCut_ = iConfig.getUntrackedParameter("VertexCut", true); + } - applyVertexCut_=iConfig.getUntrackedParameter("VertexCut",true); + void SiPixelPhase1RecHits::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + if (!checktrigger(iEvent, iSetup, DCS)) + return; -} + edm::ESHandle tracker; + iSetup.get().get(tracker); + assert(tracker.isValid()); -void SiPixelPhase1RecHits::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - if( !checktrigger(iEvent,iSetup,DCS) ) return; + edm::Handle tracks; + iEvent.getByToken(srcToken_, tracks); + if (!tracks.isValid()) + return; - edm::ESHandle tracker; - iSetup.get().get(tracker); - assert(tracker.isValid()); + edm::Handle vertices; + iEvent.getByToken(offlinePrimaryVerticesToken_, vertices); - edm::Handle tracks; - iEvent.getByToken( srcToken_, tracks); - if (!tracks.isValid()) return; + if (applyVertexCut_ && (!vertices.isValid() || vertices->empty())) + return; - edm::Handle vertices; - iEvent.getByToken(offlinePrimaryVerticesToken_, vertices); + for (auto const& track : *tracks) { + if (applyVertexCut_ && + (track.pt() < 0.75 || std::abs(track.dxy(vertices->at(0).position())) > 5 * track.dxyError())) + continue; - if (applyVertexCut_ && (!vertices.isValid() || vertices->empty())) return; + bool isBpixtrack = false, isFpixtrack = false; + auto const& trajParams = track.extra()->trajParams(); + auto hb = track.recHitsBegin(); + for (unsigned int h = 0; h < track.recHitsSize(); h++) { + auto hit = *(hb + h); + if (!trackerHitRTTI::isFromDet(*hit)) + continue; - for (auto const & track : *tracks) { + DetId id = hit->geographicalId(); + uint32_t subdetid = (id.subdetId()); - if (applyVertexCut_ && (track.pt() < 0.75 || std::abs( track.dxy(vertices->at(0).position()) ) > 5*track.dxyError())) continue; + if (subdetid == PixelSubdetector::PixelBarrel) + isBpixtrack = true; + if (subdetid == PixelSubdetector::PixelEndcap) + isFpixtrack = true; + } - bool isBpixtrack = false, isFpixtrack = false; + if (!isBpixtrack && !isFpixtrack) + continue; - auto const & trajParams = track.extra()->trajParams(); - auto hb = track.recHitsBegin(); - for(unsigned int h=0;hgeographicalId(); - uint32_t subdetid = (id.subdetId()); + // then, look at each hit + for (unsigned int h = 0; h < track.recHitsSize(); h++) { + auto rechit = *(hb + h); - if (subdetid == PixelSubdetector::PixelBarrel) isBpixtrack = true; - if (subdetid == PixelSubdetector::PixelEndcap) isFpixtrack = true; - } + if (!trackerHitRTTI::isFromDet(*rechit)) + continue; - if (!isBpixtrack && !isFpixtrack) continue; + //continue if not a Pixel recHit + DetId id = rechit->geographicalId(); + uint32_t subdetid = (id.subdetId()); - // then, look at each hit - for(unsigned int h=0;hgeographicalId(); - uint32_t subdetid = (id.subdetId()); + bool isHitValid = rechit->getType() == TrackingRecHit::valid; + if (onlyValid_ && !isHitValid) + continue; //useful to run on cosmics where the TrackEfficiency plugin is not used - if ( subdetid != PixelSubdetector::PixelBarrel - && subdetid != PixelSubdetector::PixelEndcap) continue; + const SiPixelRecHit* prechit = dynamic_cast( + rechit); //to be used to get the associated cluster and the cluster probability - bool isHitValid = rechit->getType()==TrackingRecHit::valid; - if (onlyValid_ && !isHitValid) continue; //useful to run on cosmics where the TrackEfficiency plugin is not used + int sizeX = 0, sizeY = 0; - const SiPixelRecHit* prechit = dynamic_cast(rechit);//to be used to get the associated cluster and the cluster probability + if (isHitValid) { + SiPixelRecHit::ClusterRef const& clust = prechit->cluster(); + sizeX = (*clust).sizeX(); + sizeY = (*clust).sizeY(); + } - int sizeX=0, sizeY=0; + const PixelGeomDetUnit* geomdetunit = dynamic_cast(tracker->idToDet(id)); + const PixelTopology& topol = geomdetunit->specificTopology(); - if (isHitValid){ - SiPixelRecHit::ClusterRef const& clust = prechit->cluster(); - sizeX = (*clust).sizeX(); - sizeY = (*clust).sizeY(); - } + LocalPoint lp = trajParams[h].position(); + MeasurementPoint mp = topol.measurementPosition(lp); - const PixelGeomDetUnit* geomdetunit = dynamic_cast ( tracker->idToDet(id) ); - const PixelTopology& topol = geomdetunit->specificTopology(); - - LocalPoint lp = trajParams[h].position(); - MeasurementPoint mp = topol.measurementPosition(lp); - - int row = (int) mp.x(); - int col = (int) mp.y(); - - float rechit_x = lp.x(); - float rechit_y = lp.y(); - - LocalError lerr = rechit->localPositionError(); - float lerr_x = sqrt(lerr.xx()); - float lerr_y = sqrt(lerr.yy()); - - histo[NRECHITS].fill(id, &iEvent, col, row); //in general a inclusive counter of missing/valid/inactive hits - if(prechit->isOnEdge()) histo[NONEDGE].fill(id, &iEvent, col, row); - if(prechit->hasBadPixels()) histo[NOTHERBAD].fill(id, &iEvent, col, row); - - if (isHitValid){ - histo[CLUST_X].fill(sizeX, id, &iEvent, col, row); - histo[CLUST_Y].fill(sizeY, id, &iEvent, col, row); - } + int row = (int)mp.x(); + int col = (int)mp.y(); - histo[ERROR_X].fill(lerr_x, id, &iEvent); - histo[ERROR_Y].fill(lerr_y, id, &iEvent); + float rechit_x = lp.x(); + float rechit_y = lp.y(); - histo[POS].fill(rechit_x, rechit_y, id, &iEvent); - - if (isHitValid){ - double clusterProbability= prechit->clusterProbability(0); - if (clusterProbability > 0) - histo[CLUSTER_PROB].fill(log10(clusterProbability), id, &iEvent); + LocalError lerr = rechit->localPositionError(); + float lerr_x = sqrt(lerr.xx()); + float lerr_y = sqrt(lerr.yy()); + + histo[NRECHITS].fill(id, &iEvent, col, row); //in general a inclusive counter of missing/valid/inactive hits + if (prechit->isOnEdge()) + histo[NONEDGE].fill(id, &iEvent, col, row); + if (prechit->hasBadPixels()) + histo[NOTHERBAD].fill(id, &iEvent, col, row); + + if (isHitValid) { + histo[CLUST_X].fill(sizeX, id, &iEvent, col, row); + histo[CLUST_Y].fill(sizeY, id, &iEvent, col, row); + } + + histo[ERROR_X].fill(lerr_x, id, &iEvent); + histo[ERROR_Y].fill(lerr_y, id, &iEvent); + + histo[POS].fill(rechit_x, rechit_y, id, &iEvent); + + if (isHitValid) { + double clusterProbability = prechit->clusterProbability(0); + if (clusterProbability > 0) + histo[CLUSTER_PROB].fill(log10(clusterProbability), id, &iEvent); + } } } - } - histo[NRECHITS].executePerEventHarvesting(&iEvent); - histo[NONEDGE].executePerEventHarvesting(&iEvent); - histo[NOTHERBAD].executePerEventHarvesting(&iEvent); -} + histo[NRECHITS].executePerEventHarvesting(&iEvent); + histo[NONEDGE].executePerEventHarvesting(&iEvent); + histo[NOTHERBAD].executePerEventHarvesting(&iEvent); + } -} //namespace +} //namespace DEFINE_FWK_MODULE(SiPixelPhase1RecHits); - diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc index b780fafa1b30e..e3a9b4d143b85 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackClusters.cc @@ -34,266 +34,269 @@ namespace { -class SiPixelPhase1TrackClusters final : public SiPixelPhase1Base { -enum { - ON_TRACK_CHARGE, - ON_TRACK_BIGPIXELCHARGE, - ON_TRACK_NOTBIGPIXELCHARGE, - ON_TRACK_SIZE, - ON_TRACK_SHAPE, - ON_TRACK_NCLUSTERS, - ON_TRACK_POSITIONB, - ON_TRACK_POSITIONF, - DIGIS_HITMAP_ON_TRACK, - ON_TRACK_NDIGIS, - - NTRACKS, - NTRACKS_INVOLUME, - - SIZE_VS_ETA_ON_TRACK_OUTER, - SIZE_VS_ETA_ON_TRACK_INNER, - ON_TRACK_CHARGE_OUTER, - ON_TRACK_CHARGE_INNER, - - ON_TRACK_SHAPE_OUTER, - ON_TRACK_SHAPE_INNER, - - ON_TRACK_SIZE_X_OUTER, - ON_TRACK_SIZE_X_INNER, - ON_TRACK_SIZE_X_F, - ON_TRACK_SIZE_Y_OUTER, - ON_TRACK_SIZE_Y_INNER, - ON_TRACK_SIZE_Y_F, - - ON_TRACK_SIZE_XY_OUTER, - ON_TRACK_SIZE_XY_INNER, - ON_TRACK_SIZE_XY_F, - CHARGE_VS_SIZE_ON_TRACK, - - ENUM_SIZE -}; - -public: - explicit SiPixelPhase1TrackClusters(const edm::ParameterSet& conf); - void analyze(const edm::Event&, const edm::EventSetup&) override; - -private: - const bool applyVertexCut_; - - edm::EDGetTokenT tracksToken_; - edm::EDGetTokenT offlinePrimaryVerticesToken_; - edm::EDGetTokenT pixelClusterShapeCacheToken_; -}; - -SiPixelPhase1TrackClusters::SiPixelPhase1TrackClusters(const edm::ParameterSet& iConfig) : - SiPixelPhase1Base(iConfig), - applyVertexCut_(iConfig.getUntrackedParameter("VertexCut", true)) -{ - tracksToken_ = consumes(iConfig.getParameter("tracks")); - - offlinePrimaryVerticesToken_ = applyVertexCut_ ? - consumes(iConfig.getParameter("vertices")) : - edm::EDGetTokenT(); - - pixelClusterShapeCacheToken_ = consumes(iConfig.getParameter("clusterShapeCache")); -} - -void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - if( !checktrigger(iEvent, iSetup, DCS) ) return; - - if (histo.size() != ENUM_SIZE) { - edm::LogError("SiPixelPhase1TrackClusters") << "incompatible configuration " << histo.size() - << "!=" << ENUM_SIZE << std::endl; - return; + class SiPixelPhase1TrackClusters final : public SiPixelPhase1Base { + enum { + ON_TRACK_CHARGE, + ON_TRACK_BIGPIXELCHARGE, + ON_TRACK_NOTBIGPIXELCHARGE, + ON_TRACK_SIZE, + ON_TRACK_SHAPE, + ON_TRACK_NCLUSTERS, + ON_TRACK_POSITIONB, + ON_TRACK_POSITIONF, + DIGIS_HITMAP_ON_TRACK, + ON_TRACK_NDIGIS, + + NTRACKS, + NTRACKS_INVOLUME, + + SIZE_VS_ETA_ON_TRACK_OUTER, + SIZE_VS_ETA_ON_TRACK_INNER, + ON_TRACK_CHARGE_OUTER, + ON_TRACK_CHARGE_INNER, + + ON_TRACK_SHAPE_OUTER, + ON_TRACK_SHAPE_INNER, + + ON_TRACK_SIZE_X_OUTER, + ON_TRACK_SIZE_X_INNER, + ON_TRACK_SIZE_X_F, + ON_TRACK_SIZE_Y_OUTER, + ON_TRACK_SIZE_Y_INNER, + ON_TRACK_SIZE_Y_F, + + ON_TRACK_SIZE_XY_OUTER, + ON_TRACK_SIZE_XY_INNER, + ON_TRACK_SIZE_XY_F, + CHARGE_VS_SIZE_ON_TRACK, + + ENUM_SIZE + }; + + public: + explicit SiPixelPhase1TrackClusters(const edm::ParameterSet& conf); + void analyze(const edm::Event&, const edm::EventSetup&) override; + + private: + const bool applyVertexCut_; + + edm::EDGetTokenT tracksToken_; + edm::EDGetTokenT offlinePrimaryVerticesToken_; + edm::EDGetTokenT pixelClusterShapeCacheToken_; + }; + + SiPixelPhase1TrackClusters::SiPixelPhase1TrackClusters(const edm::ParameterSet& iConfig) + : SiPixelPhase1Base(iConfig), applyVertexCut_(iConfig.getUntrackedParameter("VertexCut", true)) { + tracksToken_ = consumes(iConfig.getParameter("tracks")); + + offlinePrimaryVerticesToken_ = + applyVertexCut_ ? consumes(iConfig.getParameter("vertices")) + : edm::EDGetTokenT(); + + pixelClusterShapeCacheToken_ = + consumes(iConfig.getParameter("clusterShapeCache")); } - // get geometry - edm::ESHandle tracker; - iSetup.get().get(tracker); - assert(tracker.isValid()); + void SiPixelPhase1TrackClusters::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + if (!checktrigger(iEvent, iSetup, DCS)) + return; - edm::ESHandle tTopoHandle; - iSetup.get().get(tTopoHandle); - auto const & tkTpl = *tTopoHandle; - - edm::ESHandle shapeFilterH; - iSetup.get().get("ClusterShapeHitFilter", shapeFilterH); - auto const & shapeFilter = *shapeFilterH; - - edm::Handle vertices; - if(applyVertexCut_) { - iEvent.getByToken(offlinePrimaryVerticesToken_, vertices); - if (!vertices.isValid() || vertices->empty()) return; - } - - //get the map - edm::Handle tracks; - iEvent.getByToken(tracksToken_, tracks); - - if ( !tracks.isValid() ) { - edm::LogWarning("SiPixelPhase1TrackClusters") << "track collection is not valid"; - return; - } - - edm::Handle pixelClusterShapeCacheH; - iEvent.getByToken(pixelClusterShapeCacheToken_, pixelClusterShapeCacheH); - if ( !pixelClusterShapeCacheH.isValid() ) { - edm::LogWarning("SiPixelPhase1TrackClusters") << "PixelClusterShapeCache collection is not valid"; - return; - } - auto const & pixelClusterShapeCache = *pixelClusterShapeCacheH; - - for (auto const & track : *tracks) { - - if (applyVertexCut_ && - (track.pt() < 0.75 || std::abs( track.dxy((*vertices)[0].position()) ) > 5 * track.dxyError())) continue; - - bool isBpixtrack = false, isFpixtrack = false, crossesPixVol = false; - - // find out whether track crosses pixel fiducial volume (for cosmic tracks) - auto d0 = track.d0(), dz = track.dz(); - if (std::abs(d0) < 15 && std::abs(dz) < 50) crossesPixVol = true; - - auto etatk = track.eta(); - - auto const & trajParams = track.extra()->trajParams(); - assert(trajParams.size()==track.recHitsSize()); - auto hb = track.recHitsBegin(); - - for (unsigned int h = 0; h < track.recHitsSize(); h++){ - - auto hit = *(hb + h); - if (!hit->isValid()) continue; - auto id = hit->geographicalId(); - - // check that we are in the pixel - auto subdetid = (id.subdetId()); - if (subdetid == PixelSubdetector::PixelBarrel) isBpixtrack = true; - if (subdetid == PixelSubdetector::PixelEndcap) isFpixtrack = true; - if (subdetid != PixelSubdetector::PixelBarrel && subdetid != PixelSubdetector::PixelEndcap) continue; - bool iAmBarrel = subdetid == PixelSubdetector::PixelBarrel; - - // PXB_L4 IS IN THE OTHER WAY - // CAN BE XORed BUT LETS KEEP THINGS SIMPLE - bool iAmOuter = ((tkTpl.pxbLadder(id) % 2 == 1) && tkTpl.pxbLayer(id) != 4) || - ((tkTpl.pxbLadder(id) % 2 != 1) && tkTpl.pxbLayer(id) == 4); + if (histo.size() != ENUM_SIZE) { + edm::LogError("SiPixelPhase1TrackClusters") + << "incompatible configuration " << histo.size() << "!=" << ENUM_SIZE << std::endl; + return; + } - auto pixhit = dynamic_cast(hit->hit()); - if (!pixhit) continue; + // get geometry + edm::ESHandle tracker; + iSetup.get().get(tracker); + assert(tracker.isValid()); - auto geomdetunit = dynamic_cast(pixhit->detUnit()); - auto const & topol = geomdetunit->specificTopology(); + edm::ESHandle tTopoHandle; + iSetup.get().get(tTopoHandle); + auto const& tkTpl = *tTopoHandle; - // get the cluster - auto clustp = pixhit->cluster(); - if (clustp.isNull()) continue; - auto const & cluster = *clustp; - const std::vector pixelsVec = cluster.pixels(); - for (unsigned int i = 0; i < pixelsVec.size(); ++i) { + edm::ESHandle shapeFilterH; + iSetup.get().get("ClusterShapeHitFilter", shapeFilterH); + auto const& shapeFilter = *shapeFilterH; - float pixx = pixelsVec[i].x; // index as float=iteger, row index - float pixy = pixelsVec[i].y; // same, col index + edm::Handle vertices; + if (applyVertexCut_) { + iEvent.getByToken(offlinePrimaryVerticesToken_, vertices); + if (!vertices.isValid() || vertices->empty()) + return; + } - bool bigInX = topol.isItBigPixelInX(int(pixx)); - bool bigInY = topol.isItBigPixelInY(int(pixy)); - float pixel_charge = pixelsVec[i].adc; + //get the map + edm::Handle tracks; + iEvent.getByToken(tracksToken_, tracks); - if (bigInX==true || bigInY==true) { - histo[ON_TRACK_BIGPIXELCHARGE].fill(pixel_charge, id, &iEvent); - } - else { - histo[ON_TRACK_NOTBIGPIXELCHARGE].fill(pixel_charge, id, &iEvent); + if (!tracks.isValid()) { + edm::LogWarning("SiPixelPhase1TrackClusters") << "track collection is not valid"; + return; + } + edm::Handle pixelClusterShapeCacheH; + iEvent.getByToken(pixelClusterShapeCacheToken_, pixelClusterShapeCacheH); + if (!pixelClusterShapeCacheH.isValid()) { + edm::LogWarning("SiPixelPhase1TrackClusters") << "PixelClusterShapeCache collection is not valid"; + return; + } + auto const& pixelClusterShapeCache = *pixelClusterShapeCacheH; + + for (auto const& track : *tracks) { + if (applyVertexCut_ && + (track.pt() < 0.75 || std::abs(track.dxy((*vertices)[0].position())) > 5 * track.dxyError())) + continue; + + bool isBpixtrack = false, isFpixtrack = false, crossesPixVol = false; + + // find out whether track crosses pixel fiducial volume (for cosmic tracks) + auto d0 = track.d0(), dz = track.dz(); + if (std::abs(d0) < 15 && std::abs(dz) < 50) + crossesPixVol = true; + + auto etatk = track.eta(); + + auto const& trajParams = track.extra()->trajParams(); + assert(trajParams.size() == track.recHitsSize()); + auto hb = track.recHitsBegin(); + + for (unsigned int h = 0; h < track.recHitsSize(); h++) { + auto hit = *(hb + h); + if (!hit->isValid()) + continue; + auto id = hit->geographicalId(); + + // check that we are in the pixel + auto subdetid = (id.subdetId()); + if (subdetid == PixelSubdetector::PixelBarrel) + isBpixtrack = true; + if (subdetid == PixelSubdetector::PixelEndcap) + isFpixtrack = true; + if (subdetid != PixelSubdetector::PixelBarrel && subdetid != PixelSubdetector::PixelEndcap) + continue; + bool iAmBarrel = subdetid == PixelSubdetector::PixelBarrel; + + // PXB_L4 IS IN THE OTHER WAY + // CAN BE XORed BUT LETS KEEP THINGS SIMPLE + bool iAmOuter = ((tkTpl.pxbLadder(id) % 2 == 1) && tkTpl.pxbLayer(id) != 4) || + ((tkTpl.pxbLadder(id) % 2 != 1) && tkTpl.pxbLayer(id) == 4); + + auto pixhit = dynamic_cast(hit->hit()); + if (!pixhit) + continue; + + auto geomdetunit = dynamic_cast(pixhit->detUnit()); + auto const& topol = geomdetunit->specificTopology(); + + // get the cluster + auto clustp = pixhit->cluster(); + if (clustp.isNull()) + continue; + auto const& cluster = *clustp; + const std::vector pixelsVec = cluster.pixels(); + for (unsigned int i = 0; i < pixelsVec.size(); ++i) { + float pixx = pixelsVec[i].x; // index as float=iteger, row index + float pixy = pixelsVec[i].y; // same, col index + + bool bigInX = topol.isItBigPixelInX(int(pixx)); + bool bigInY = topol.isItBigPixelInY(int(pixy)); + float pixel_charge = pixelsVec[i].adc; + + if (bigInX == true || bigInY == true) { + histo[ON_TRACK_BIGPIXELCHARGE].fill(pixel_charge, id, &iEvent); + } else { + histo[ON_TRACK_NOTBIGPIXELCHARGE].fill(pixel_charge, id, &iEvent); + } + } // End loop over pixels + auto const& ltp = trajParams[h]; + + auto localDir = ltp.momentum() / ltp.momentum().mag(); + + // correct charge for track impact angle + auto charge = cluster.charge() * ltp.absdz(); + + auto clustgp = pixhit->globalPosition(); // from rechit + + int part; + ClusterData::ArrayType meas; + std::pair pred; + if (shapeFilter.getSizes(*pixhit, localDir, pixelClusterShapeCache, part, meas, pred)) { + auto shape = shapeFilter.isCompatible(*pixhit, localDir, pixelClusterShapeCache); + unsigned shapeVal = (shape ? 1 : 0); + + if (iAmBarrel) { + if (iAmOuter) { + histo[ON_TRACK_SIZE_X_OUTER].fill(pred.first, cluster.sizeX(), id, &iEvent); + histo[ON_TRACK_SIZE_Y_OUTER].fill(pred.second, cluster.sizeY(), id, &iEvent); + histo[ON_TRACK_SIZE_XY_OUTER].fill(cluster.sizeY(), cluster.sizeX(), id, &iEvent); + + histo[ON_TRACK_SHAPE_OUTER].fill(shapeVal, id, &iEvent); + } else { + histo[ON_TRACK_SIZE_X_INNER].fill(pred.first, cluster.sizeX(), id, &iEvent); + histo[ON_TRACK_SIZE_Y_INNER].fill(pred.second, cluster.sizeY(), id, &iEvent); + histo[ON_TRACK_SIZE_XY_INNER].fill(cluster.sizeY(), cluster.sizeX(), id, &iEvent); + + histo[ON_TRACK_SHAPE_INNER].fill(shapeVal, id, &iEvent); + } + } else { + histo[ON_TRACK_SIZE_X_F].fill(pred.first, cluster.sizeX(), id, &iEvent); + histo[ON_TRACK_SIZE_Y_F].fill(pred.second, cluster.sizeY(), id, &iEvent); + histo[ON_TRACK_SIZE_XY_F].fill(cluster.sizeY(), cluster.sizeX(), id, &iEvent); + } + histo[ON_TRACK_SHAPE].fill(shapeVal, id, &iEvent); } - } // End loop over pixels - auto const & ltp = trajParams[h]; - - auto localDir = ltp.momentum() / ltp.momentum().mag(); - - // correct charge for track impact angle - auto charge = cluster.charge() * ltp.absdz(); - - auto clustgp = pixhit->globalPosition(); // from rechit - - int part; - ClusterData::ArrayType meas; - std::pair pred; - if(shapeFilter.getSizes(*pixhit, localDir, pixelClusterShapeCache, part, meas, pred)) { - auto shape = shapeFilter.isCompatible(*pixhit, localDir, pixelClusterShapeCache); - unsigned shapeVal = (shape ? 1 : 0); - - if (iAmBarrel) { - if(iAmOuter) { - histo[ON_TRACK_SIZE_X_OUTER].fill(pred.first, cluster.sizeX(), id, &iEvent); - histo[ON_TRACK_SIZE_Y_OUTER].fill(pred.second, cluster.sizeY(), id, &iEvent); - histo[ON_TRACK_SIZE_XY_OUTER].fill(cluster.sizeY(), cluster.sizeX(), id, &iEvent); - - histo[ON_TRACK_SHAPE_OUTER].fill(shapeVal, id, &iEvent); - } else { - histo[ON_TRACK_SIZE_X_INNER].fill(pred.first, cluster.sizeX(), id, &iEvent); - histo[ON_TRACK_SIZE_Y_INNER].fill(pred.second, cluster.sizeY(), id, &iEvent); - histo[ON_TRACK_SIZE_XY_INNER].fill(cluster.sizeY(), cluster.sizeX(), id, &iEvent); - - histo[ON_TRACK_SHAPE_INNER].fill(shapeVal, id, &iEvent); - } - } else { - histo[ON_TRACK_SIZE_X_F].fill(pred.first, cluster.sizeX(), id, &iEvent); - histo[ON_TRACK_SIZE_Y_F].fill(pred.second, cluster.sizeY(), id, &iEvent); - histo[ON_TRACK_SIZE_XY_F].fill(cluster.sizeY(), cluster.sizeX(), id, &iEvent); - } - histo[ON_TRACK_SHAPE].fill(shapeVal, id, &iEvent); - } - for (int i = 0; i < cluster.size(); i++){ - SiPixelCluster::Pixel const & vecipxl = cluster.pixel(i); + for (int i = 0; i < cluster.size(); i++) { + SiPixelCluster::Pixel const& vecipxl = cluster.pixel(i); histo[DIGIS_HITMAP_ON_TRACK].fill(id, &iEvent, vecipxl.y, vecipxl.x); - histo[ON_TRACK_NDIGIS].fill(id, &iEvent); - } + histo[ON_TRACK_NDIGIS].fill(id, &iEvent); + } - histo[ON_TRACK_NCLUSTERS].fill(id, &iEvent); - histo[ON_TRACK_CHARGE].fill(charge, id, &iEvent); - histo[ON_TRACK_SIZE].fill(cluster.size(), id, &iEvent); + histo[ON_TRACK_NCLUSTERS].fill(id, &iEvent); + histo[ON_TRACK_CHARGE].fill(charge, id, &iEvent); + histo[ON_TRACK_SIZE].fill(cluster.size(), id, &iEvent); - histo[ON_TRACK_POSITIONB].fill(clustgp.z(), clustgp.phi(), id, &iEvent); - histo[ON_TRACK_POSITIONF].fill(clustgp.x(), clustgp.y(), id, &iEvent); + histo[ON_TRACK_POSITIONB].fill(clustgp.z(), clustgp.phi(), id, &iEvent); + histo[ON_TRACK_POSITIONF].fill(clustgp.x(), clustgp.y(), id, &iEvent); - histo[CHARGE_VS_SIZE_ON_TRACK].fill(cluster.size(), charge, id, &iEvent); + histo[CHARGE_VS_SIZE_ON_TRACK].fill(cluster.size(), charge, id, &iEvent); - if (iAmBarrel) // Avoid mistakes even if specification < should > handle it - { - if(iAmOuter) { - histo[SIZE_VS_ETA_ON_TRACK_OUTER].fill(etatk, cluster.sizeY(), id, &iEvent); - histo[ON_TRACK_CHARGE_OUTER].fill(charge, id, &iEvent); - } else { - histo[SIZE_VS_ETA_ON_TRACK_INNER].fill(etatk, cluster.sizeY(), id, &iEvent); - histo[ON_TRACK_CHARGE_INNER].fill(charge, id, &iEvent); + if (iAmBarrel) // Avoid mistakes even if specification < should > handle it + { + if (iAmOuter) { + histo[SIZE_VS_ETA_ON_TRACK_OUTER].fill(etatk, cluster.sizeY(), id, &iEvent); + histo[ON_TRACK_CHARGE_OUTER].fill(charge, id, &iEvent); + } else { + histo[SIZE_VS_ETA_ON_TRACK_INNER].fill(etatk, cluster.sizeY(), id, &iEvent); + histo[ON_TRACK_CHARGE_INNER].fill(charge, id, &iEvent); + } } } - } - - // statistics on tracks - histo[NTRACKS].fill(1, DetId(0), &iEvent); - if (isBpixtrack || isFpixtrack) - histo[NTRACKS].fill(2, DetId(0), &iEvent); - if (isBpixtrack) - histo[NTRACKS].fill(3, DetId(0), &iEvent); - if (isFpixtrack) - histo[NTRACKS].fill(4, DetId(0), &iEvent); - if (crossesPixVol) { + // statistics on tracks + histo[NTRACKS].fill(1, DetId(0), &iEvent); if (isBpixtrack || isFpixtrack) - histo[NTRACKS_INVOLUME].fill(1, DetId(0), &iEvent); - else - histo[NTRACKS_INVOLUME].fill(0, DetId(0), &iEvent); + histo[NTRACKS].fill(2, DetId(0), &iEvent); + if (isBpixtrack) + histo[NTRACKS].fill(3, DetId(0), &iEvent); + if (isFpixtrack) + histo[NTRACKS].fill(4, DetId(0), &iEvent); + + if (crossesPixVol) { + if (isBpixtrack || isFpixtrack) + histo[NTRACKS_INVOLUME].fill(1, DetId(0), &iEvent); + else + histo[NTRACKS_INVOLUME].fill(0, DetId(0), &iEvent); + } } - } - histo[ON_TRACK_NCLUSTERS].executePerEventHarvesting(&iEvent); - histo[ON_TRACK_NDIGIS].executePerEventHarvesting(&iEvent); -} - -} // namespace + histo[ON_TRACK_NCLUSTERS].executePerEventHarvesting(&iEvent); + histo[ON_TRACK_NDIGIS].executePerEventHarvesting(&iEvent); + } +} // namespace #include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(SiPixelPhase1TrackClusters); diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackEfficiency.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackEfficiency.cc index 728cfb67182ba..e5b76b2d38e05 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackEfficiency.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackEfficiency.cc @@ -24,7 +24,7 @@ #include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/VertexReco/interface/VertexFwd.h" #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h" -#include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" +#include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" #include "RecoTracker/MeasurementDet/interface/MeasurementTrackerEvent.h" #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimatorBase.h" #include "TrackingTools/Records/interface/TrackingComponentsRecord.h" @@ -37,296 +37,316 @@ #include "TrackingTools/MeasurementDet/interface/LayerMeasurements.h" #include "RecoLocalTracker/ClusterParameterEstimator/interface/PixelClusterParameterEstimator.h" - ///commnet namespace { -class SiPixelPhase1TrackEfficiency final : public SiPixelPhase1Base { - enum { - VALID, - MISSING, - INACTIVE, - EFFICIENCY, - VERTICES - }; + class SiPixelPhase1TrackEfficiency final : public SiPixelPhase1Base { + enum { VALID, MISSING, INACTIVE, EFFICIENCY, VERTICES }; public: - explicit SiPixelPhase1TrackEfficiency(const edm::ParameterSet& conf); - void analyze(const edm::Event&, const edm::EventSetup&) override; + explicit SiPixelPhase1TrackEfficiency(const edm::ParameterSet& conf); + void analyze(const edm::Event&, const edm::EventSetup&) override; private: - edm::EDGetTokenT > clustersToken_; - edm::EDGetTokenT tracksToken_; - edm::EDGetTokenT vtxToken_; - edm::EDGetTokenT trajTrackCollectionToken_; - edm::EDGetTokenT tracker_; //new - bool applyVertexCut_; - - const TrackerTopology* trackerTopology_; - const Propagator* trackerPropagator_; - const MeasurementEstimator* chi2MeasurementEstimator_; -}; - -SiPixelPhase1TrackEfficiency::SiPixelPhase1TrackEfficiency(const edm::ParameterSet& iConfig) : - SiPixelPhase1Base(iConfig)//, - { - tracker_ = consumes(iConfig.getParameter("tracker")); - tracksToken_ = consumes(iConfig.getParameter("tracks")); - vtxToken_ = consumes(iConfig.getParameter("primaryvertices")); - applyVertexCut_=iConfig.getUntrackedParameter("VertexCut",true); - trajTrackCollectionToken_ = consumes(iConfig.getParameter("trajectoryInput")); clustersToken_=consumes >(iConfig.getParameter("clusters")); -} - -void SiPixelPhase1TrackEfficiency::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - if( !checktrigger(iEvent,iSetup,DCS) ) return; - - // get geometry - edm::ESHandle tracker; - iSetup.get().get(tracker); - assert(tracker.isValid()); - - // get primary vertex - edm::Handle vertices; - iEvent.getByToken( vtxToken_, vertices); - - // TrackerTopology for module informations - edm::ESHandle trackerTopologyHandle; - iSetup.get().get(trackerTopologyHandle); - trackerTopology_ = trackerTopologyHandle.product(); - - // Tracker propagator for propagating tracks to other layers - edm::ESHandle propagatorHandle; - iSetup.get().get("PropagatorWithMaterial", propagatorHandle); - std::unique_ptr propagatorUniquePtr(propagatorHandle.product() -> clone()); - trackerPropagator_ = propagatorUniquePtr.get(); - const_cast(trackerPropagator_) -> setPropagationDirection(oppositeToMomentum); - - // Measurement estimator - edm::ESHandle chi2MeasurementEstimatorHandle; - iSetup.get().get("Chi2", chi2MeasurementEstimatorHandle); - chi2MeasurementEstimator_ = chi2MeasurementEstimatorHandle.product(); - - //Tracker - edm::Handle trackerMeas; - iEvent.getByToken(tracker_, trackerMeas); - - edm::ESHandle measurementTrackerHandle; - iSetup.get().get(measurementTrackerHandle); - - //vertices - if (!vertices.isValid()) return; - histo[VERTICES].fill(vertices->size(),DetId(0),&iEvent); - if (applyVertexCut_ && vertices->empty()) return; - - // should be used for weird cuts - //const auto primaryVertex = vertices->at(0); - - // get the map - edm::Handle tracks; - iEvent.getByToken( tracksToken_, tracks); - if (!tracks.isValid()) return; - - //new - edm::Handle trajTrackCollectionHandle; - iEvent.getByToken(trajTrackCollectionToken_, trajTrackCollectionHandle); - if (!trajTrackCollectionHandle.isValid()) return; - - //Access Pixel Clusters - edm::Handle< edmNew::DetSetVector > siPixelClusters; - iEvent.getByToken(clustersToken_, siPixelClusters); - if(!siPixelClusters.isValid()) return; -// - - edm::ESHandle cpEstimator; - iSetup.get().get("PixelCPEGeneric", cpEstimator); - if(!cpEstimator.isValid()) return; - - const PixelClusterParameterEstimator &cpe(*cpEstimator); - const TrackerGeometry *tkgeom=&(*tracker); - -////////////////////////////////////////////////////////////////////////////////////////// - - // Hp cut - int TRACK_QUALITY_HIGH_PURITY_BIT = 2; - int TRACK_QUALITY_HIGH_PURITY_MASK = 1 << TRACK_QUALITY_HIGH_PURITY_BIT; - - // Pt cut - float TRACK_PT_CUT_VAL = 1.0f; - - // Nstrip cut - int TRACK_NSTRIP_CUT_VAL = 10; - - //D0 - std::array TRACK_D0_CUT_BARREL_VAL = {{0.01f, 0.02f, 0.02f, 0.02f}}; - float TRACK_D0_CUT_FORWARD_VAL = 0.05f; - - //Dz - float TRACK_DZ_CUT_BARREL_VAL = 0.01f; - float TRACK_DZ_CUT_FORWARD_VAL = 0.5f; - - bool isBpixtrack = false, isFpixtrack = false; - int nStripHits = 0; - int nBpixL1Hits = 0; - int nBpixL2Hits = 0; - int nBpixL3Hits = 0; - int nBpixL4Hits = 0; - int nFpixD1Hits = 0; - int nFpixD2Hits = 0; - int nFpixD3Hits = 0; - bool passcuts = true; - bool passcuts_hit = true; - - - TrajectoryStateOnSurface tsosPXB2; - bool valid_layerFrom = false; - - - const GeometricSearchTracker * gst_ = trackerMeas->geometricSearchTracker(); - const auto *pxbLayer1_ = gst_->pixelBarrelLayers().front(); - const LayerMeasurements* theLayerMeasurements_ = new LayerMeasurements(*measurementTrackerHandle, *trackerMeas); - - std::vector expTrajMeasurements; - std::vector> eff_pxb1_vector; - - - for(const auto &pair: *trajTrackCollectionHandle) { - const edm::Ref> traj = pair.key; - const reco::TrackRef track = pair.val; - - expTrajMeasurements.clear(); - eff_pxb1_vector.clear(); - //this cut is needed to be consisten with residuals calculation - if (applyVertexCut_ && (track->pt() < 0.75 || std::abs( track->dxy(vertices->at(0).position()) ) > 5*track->dxyError())) continue; - - isBpixtrack = false, isFpixtrack = false; - nStripHits = 0; - nBpixL1Hits = 0; - nBpixL2Hits = 0; - nBpixL3Hits = 0; - nBpixL4Hits = 0; - nFpixD1Hits = 0; - nFpixD2Hits = 0; - nFpixD3Hits = 0; - passcuts = true; - passcuts_hit = true; - - // first, look at the full track to see whether it is good - // auto const & trajParams = track.extra()->trajParams(); - - - - auto hb = track->recHitsBegin(); - for(unsigned int h=0;hrecHitsSize();h++){ - - auto hit = *(hb+h); - if(!hit->isValid()) continue; - - DetId id = hit->geographicalId(); - uint32_t subdetid = (id.subdetId()); - - //Check the location of valid hit - if (subdetid == PixelSubdetector::PixelBarrel && hit->isValid()) - { - isBpixtrack = true; - if(trackerTopology_ -> pxbLayer(id) == 1) nBpixL1Hits++; - if(trackerTopology_ -> pxbLayer(id) == 2) nBpixL2Hits++; - if(trackerTopology_ -> pxbLayer(id) == 3) nBpixL3Hits++; - if(trackerTopology_ -> pxbLayer(id) == 4) nBpixL4Hits++; - } - if (subdetid == PixelSubdetector::PixelEndcap && hit->isValid()) - { - isFpixtrack = true; - if(trackerTopology_ -> pxfDisk(id) == 1) nFpixD1Hits++; - if(trackerTopology_ -> pxfDisk(id) == 2) nFpixD2Hits++; - if(trackerTopology_ -> pxfDisk(id) == 3) nFpixD3Hits++; - } - - // count strip hits - if(subdetid==StripSubdetector::TIB) nStripHits++; - if(subdetid==StripSubdetector::TOB) nStripHits++; - if(subdetid==StripSubdetector::TID) nStripHits++; - if(subdetid==StripSubdetector::TEC) nStripHits++; - - // check that we are in the pixel - // if (subdetid == PixelSubdetector::PixelBarrel) isBpixtrack = true; - // if (subdetid == PixelSubdetector::PixelEndcap) isFpixtrack = true; - } - - if (!isBpixtrack && !isFpixtrack) continue; - + edm::EDGetTokenT> clustersToken_; + edm::EDGetTokenT tracksToken_; + edm::EDGetTokenT vtxToken_; + edm::EDGetTokenT trajTrackCollectionToken_; + edm::EDGetTokenT tracker_; //new + bool applyVertexCut_; + + const TrackerTopology* trackerTopology_; + const Propagator* trackerPropagator_; + const MeasurementEstimator* chi2MeasurementEstimator_; + }; + + SiPixelPhase1TrackEfficiency::SiPixelPhase1TrackEfficiency(const edm::ParameterSet& iConfig) + : SiPixelPhase1Base(iConfig) //, + { + tracker_ = consumes(iConfig.getParameter("tracker")); + tracksToken_ = consumes(iConfig.getParameter("tracks")); + vtxToken_ = consumes(iConfig.getParameter("primaryvertices")); + applyVertexCut_ = iConfig.getUntrackedParameter("VertexCut", true); + trajTrackCollectionToken_ = + consumes(iConfig.getParameter("trajectoryInput")); + clustersToken_ = consumes>(iConfig.getParameter("clusters")); + } + + void SiPixelPhase1TrackEfficiency::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + if (!checktrigger(iEvent, iSetup, DCS)) + return; + + // get geometry + edm::ESHandle tracker; + iSetup.get().get(tracker); + assert(tracker.isValid()); + + // get primary vertex + edm::Handle vertices; + iEvent.getByToken(vtxToken_, vertices); + + // TrackerTopology for module informations + edm::ESHandle trackerTopologyHandle; + iSetup.get().get(trackerTopologyHandle); + trackerTopology_ = trackerTopologyHandle.product(); + + // Tracker propagator for propagating tracks to other layers + edm::ESHandle propagatorHandle; + iSetup.get().get("PropagatorWithMaterial", propagatorHandle); + std::unique_ptr propagatorUniquePtr(propagatorHandle.product()->clone()); + trackerPropagator_ = propagatorUniquePtr.get(); + const_cast(trackerPropagator_)->setPropagationDirection(oppositeToMomentum); + + // Measurement estimator + edm::ESHandle chi2MeasurementEstimatorHandle; + iSetup.get().get("Chi2", chi2MeasurementEstimatorHandle); + chi2MeasurementEstimator_ = chi2MeasurementEstimatorHandle.product(); + + //Tracker + edm::Handle trackerMeas; + iEvent.getByToken(tracker_, trackerMeas); + + edm::ESHandle measurementTrackerHandle; + iSetup.get().get(measurementTrackerHandle); + + //vertices + if (!vertices.isValid()) + return; + histo[VERTICES].fill(vertices->size(), DetId(0), &iEvent); + if (applyVertexCut_ && vertices->empty()) + return; + + // should be used for weird cuts + //const auto primaryVertex = vertices->at(0); + + // get the map + edm::Handle tracks; + iEvent.getByToken(tracksToken_, tracks); + if (!tracks.isValid()) + return; + + //new + edm::Handle trajTrackCollectionHandle; + iEvent.getByToken(trajTrackCollectionToken_, trajTrackCollectionHandle); + if (!trajTrackCollectionHandle.isValid()) + return; + + //Access Pixel Clusters + edm::Handle> siPixelClusters; + iEvent.getByToken(clustersToken_, siPixelClusters); + if (!siPixelClusters.isValid()) + return; + // + + edm::ESHandle cpEstimator; + iSetup.get().get("PixelCPEGeneric", cpEstimator); + if (!cpEstimator.isValid()) + return; + + const PixelClusterParameterEstimator& cpe(*cpEstimator); + const TrackerGeometry* tkgeom = &(*tracker); + + ////////////////////////////////////////////////////////////////////////////////////////// + // Hp cut - if(!((track->qualityMask() & TRACK_QUALITY_HIGH_PURITY_MASK) >> TRACK_QUALITY_HIGH_PURITY_BIT)) passcuts = false; + int TRACK_QUALITY_HIGH_PURITY_BIT = 2; + int TRACK_QUALITY_HIGH_PURITY_MASK = 1 << TRACK_QUALITY_HIGH_PURITY_BIT; // Pt cut - if(!(TRACK_PT_CUT_VAL < track->pt())) passcuts = false; + float TRACK_PT_CUT_VAL = 1.0f; // Nstrip cut - if(!(TRACK_NSTRIP_CUT_VAL < nStripHits)) passcuts = false; - + int TRACK_NSTRIP_CUT_VAL = 10; + + //D0 + std::array TRACK_D0_CUT_BARREL_VAL = {{0.01f, 0.02f, 0.02f, 0.02f}}; + float TRACK_D0_CUT_FORWARD_VAL = 0.05f; + + //Dz + float TRACK_DZ_CUT_BARREL_VAL = 0.01f; + float TRACK_DZ_CUT_FORWARD_VAL = 0.5f; + + bool isBpixtrack = false, isFpixtrack = false; + int nStripHits = 0; + int nBpixL1Hits = 0; + int nBpixL2Hits = 0; + int nBpixL3Hits = 0; + int nBpixL4Hits = 0; + int nFpixD1Hits = 0; + int nFpixD2Hits = 0; + int nFpixD3Hits = 0; + bool passcuts = true; + bool passcuts_hit = true; + + TrajectoryStateOnSurface tsosPXB2; + bool valid_layerFrom = false; + + const GeometricSearchTracker* gst_ = trackerMeas->geometricSearchTracker(); + const auto* pxbLayer1_ = gst_->pixelBarrelLayers().front(); + const LayerMeasurements* theLayerMeasurements_ = new LayerMeasurements(*measurementTrackerHandle, *trackerMeas); + + std::vector expTrajMeasurements; + std::vector> eff_pxb1_vector; + + for (const auto& pair : *trajTrackCollectionHandle) { + const edm::Ref> traj = pair.key; + const reco::TrackRef track = pair.val; + + expTrajMeasurements.clear(); + eff_pxb1_vector.clear(); + //this cut is needed to be consisten with residuals calculation + if (applyVertexCut_ && + (track->pt() < 0.75 || std::abs(track->dxy(vertices->at(0).position())) > 5 * track->dxyError())) + continue; + + isBpixtrack = false, isFpixtrack = false; + nStripHits = 0; + nBpixL1Hits = 0; + nBpixL2Hits = 0; + nBpixL3Hits = 0; + nBpixL4Hits = 0; + nFpixD1Hits = 0; + nFpixD2Hits = 0; + nFpixD3Hits = 0; + passcuts = true; + passcuts_hit = true; + + // first, look at the full track to see whether it is good + // auto const & trajParams = track.extra()->trajParams(); + + auto hb = track->recHitsBegin(); + for (unsigned int h = 0; h < track->recHitsSize(); h++) { + auto hit = *(hb + h); + if (!hit->isValid()) + continue; + + DetId id = hit->geographicalId(); + uint32_t subdetid = (id.subdetId()); + + //Check the location of valid hit + if (subdetid == PixelSubdetector::PixelBarrel && hit->isValid()) { + isBpixtrack = true; + if (trackerTopology_->pxbLayer(id) == 1) + nBpixL1Hits++; + if (trackerTopology_->pxbLayer(id) == 2) + nBpixL2Hits++; + if (trackerTopology_->pxbLayer(id) == 3) + nBpixL3Hits++; + if (trackerTopology_->pxbLayer(id) == 4) + nBpixL4Hits++; + } + if (subdetid == PixelSubdetector::PixelEndcap && hit->isValid()) { + isFpixtrack = true; + if (trackerTopology_->pxfDisk(id) == 1) + nFpixD1Hits++; + if (trackerTopology_->pxfDisk(id) == 2) + nFpixD2Hits++; + if (trackerTopology_->pxfDisk(id) == 3) + nFpixD3Hits++; + } - // then, look at each hit - for(unsigned int h=0;hrecHitsSize();h++){ - - passcuts_hit=true; - auto hit = *(hb+h); + // count strip hits + if (subdetid == StripSubdetector::TIB) + nStripHits++; + if (subdetid == StripSubdetector::TOB) + nStripHits++; + if (subdetid == StripSubdetector::TID) + nStripHits++; + if (subdetid == StripSubdetector::TEC) + nStripHits++; + + // check that we are in the pixel + // if (subdetid == PixelSubdetector::PixelBarrel) isBpixtrack = true; + // if (subdetid == PixelSubdetector::PixelEndcap) isFpixtrack = true; + } - DetId id = hit->geographicalId(); - uint32_t subdetid = (id.subdetId()); - if ( subdetid != PixelSubdetector::PixelBarrel - && subdetid != PixelSubdetector::PixelEndcap) continue; + if (!isBpixtrack && !isFpixtrack) + continue; - bool isHitValid = hit->getType()==TrackingRecHit::valid; - bool isHitMissing = hit->getType()==TrackingRecHit::missing; - bool isHitInactive = hit->getType()==TrackingRecHit::inactive; - - - //D0 - if(subdetid == PixelSubdetector::PixelBarrel) - { if(!((std::abs( track->dxy(vertices->at(0).position()) ) * -1.0) < TRACK_D0_CUT_BARREL_VAL[trackerTopology_ -> pxbLayer(id) -1])) passcuts_hit = false;} - if(subdetid == PixelSubdetector::PixelEndcap) - { if(!((std::abs( track->dxy(vertices->at(0).position()) ) * -1.0) < TRACK_D0_CUT_FORWARD_VAL)) passcuts_hit = false;} + // Hp cut + if (!((track->qualityMask() & TRACK_QUALITY_HIGH_PURITY_MASK) >> TRACK_QUALITY_HIGH_PURITY_BIT)) + passcuts = false; - - //Dz - if(subdetid == PixelSubdetector::PixelBarrel) - { if(!(std::abs( track->dz(vertices->at(0).position())) < TRACK_DZ_CUT_BARREL_VAL)) passcuts_hit = false;} - if(subdetid == PixelSubdetector::PixelEndcap) - { if(!(std::abs( track->dz(vertices->at(0).position())) < TRACK_DZ_CUT_FORWARD_VAL)) passcuts_hit = false;} - - - - // Pixhit cut - if(subdetid == PixelSubdetector::PixelBarrel) - { - if(trackerTopology_ -> pxbLayer(id) == 1) if(!( - (nBpixL2Hits > 0 && nBpixL3Hits > 0 && nBpixL4Hits > 0) || - (nBpixL2Hits > 0 && nBpixL3Hits > 0 && nFpixD1Hits > 0) || - (nBpixL2Hits > 0 && nFpixD1Hits > 0 && nFpixD2Hits > 0) || - (nFpixD1Hits > 0 && nFpixD2Hits > 0 && nFpixD3Hits > 0))) passcuts_hit = false; - if(trackerTopology_ -> pxbLayer(id) == 2) if(!( - (nBpixL1Hits > 0 && nBpixL3Hits > 0 && nBpixL4Hits > 0) || - (nBpixL1Hits > 0 && nBpixL3Hits > 0 && nFpixD1Hits > 0) || - (nBpixL1Hits > 0 && nFpixD1Hits > 0 && nFpixD2Hits > 0))) passcuts_hit = false; - if(trackerTopology_ -> pxbLayer(id) == 3) if(!( - (nBpixL1Hits > 0 && nBpixL2Hits > 0 && nBpixL4Hits > 0) || - (nBpixL1Hits > 0 && nBpixL2Hits > 0 && nFpixD1Hits > 0))) passcuts_hit = false; - if(trackerTopology_ -> pxbLayer(id) == 4) if(!( - (nBpixL1Hits > 0 && nBpixL2Hits > 0 && nBpixL3Hits > 0))) passcuts_hit = false; - } - if(subdetid == PixelSubdetector::PixelEndcap) - { - if(trackerTopology_ -> pxfDisk(id) == 1) if(!( - (nBpixL1Hits > 0 && nBpixL2Hits > 0 && nBpixL3Hits > 0) || - (nBpixL1Hits > 0 && nBpixL2Hits > 0 && nFpixD2Hits > 0) || - (nBpixL1Hits > 0 && nFpixD2Hits > 0 && nFpixD3Hits > 0))) passcuts_hit = false; - if(trackerTopology_ -> pxfDisk(id) == 2) if(!( - (nBpixL1Hits > 0 && nBpixL2Hits > 0 && nFpixD1Hits > 0) || - (nBpixL1Hits > 0 && nFpixD1Hits > 0 && nFpixD3Hits > 0))) passcuts_hit = false; - if(trackerTopology_ -> pxfDisk(id) == 3) if(!( - (nBpixL1Hits > 0 && nFpixD1Hits > 0 && nFpixD2Hits > 0))) passcuts_hit = false; - } - /* + // Pt cut + if (!(TRACK_PT_CUT_VAL < track->pt())) + passcuts = false; + + // Nstrip cut + if (!(TRACK_NSTRIP_CUT_VAL < nStripHits)) + passcuts = false; + + // then, look at each hit + for (unsigned int h = 0; h < track->recHitsSize(); h++) { + passcuts_hit = true; + auto hit = *(hb + h); + + DetId id = hit->geographicalId(); + uint32_t subdetid = (id.subdetId()); + if (subdetid != PixelSubdetector::PixelBarrel && subdetid != PixelSubdetector::PixelEndcap) + continue; + + bool isHitValid = hit->getType() == TrackingRecHit::valid; + bool isHitMissing = hit->getType() == TrackingRecHit::missing; + bool isHitInactive = hit->getType() == TrackingRecHit::inactive; + + //D0 + if (subdetid == PixelSubdetector::PixelBarrel) { + if (!((std::abs(track->dxy(vertices->at(0).position())) * -1.0) < + TRACK_D0_CUT_BARREL_VAL[trackerTopology_->pxbLayer(id) - 1])) + passcuts_hit = false; + } + if (subdetid == PixelSubdetector::PixelEndcap) { + if (!((std::abs(track->dxy(vertices->at(0).position())) * -1.0) < TRACK_D0_CUT_FORWARD_VAL)) + passcuts_hit = false; + } + + //Dz + if (subdetid == PixelSubdetector::PixelBarrel) { + if (!(std::abs(track->dz(vertices->at(0).position())) < TRACK_DZ_CUT_BARREL_VAL)) + passcuts_hit = false; + } + if (subdetid == PixelSubdetector::PixelEndcap) { + if (!(std::abs(track->dz(vertices->at(0).position())) < TRACK_DZ_CUT_FORWARD_VAL)) + passcuts_hit = false; + } + + // Pixhit cut + if (subdetid == PixelSubdetector::PixelBarrel) { + if (trackerTopology_->pxbLayer(id) == 1) + if (!((nBpixL2Hits > 0 && nBpixL3Hits > 0 && nBpixL4Hits > 0) || + (nBpixL2Hits > 0 && nBpixL3Hits > 0 && nFpixD1Hits > 0) || + (nBpixL2Hits > 0 && nFpixD1Hits > 0 && nFpixD2Hits > 0) || + (nFpixD1Hits > 0 && nFpixD2Hits > 0 && nFpixD3Hits > 0))) + passcuts_hit = false; + if (trackerTopology_->pxbLayer(id) == 2) + if (!((nBpixL1Hits > 0 && nBpixL3Hits > 0 && nBpixL4Hits > 0) || + (nBpixL1Hits > 0 && nBpixL3Hits > 0 && nFpixD1Hits > 0) || + (nBpixL1Hits > 0 && nFpixD1Hits > 0 && nFpixD2Hits > 0))) + passcuts_hit = false; + if (trackerTopology_->pxbLayer(id) == 3) + if (!((nBpixL1Hits > 0 && nBpixL2Hits > 0 && nBpixL4Hits > 0) || + (nBpixL1Hits > 0 && nBpixL2Hits > 0 && nFpixD1Hits > 0))) + passcuts_hit = false; + if (trackerTopology_->pxbLayer(id) == 4) + if (!((nBpixL1Hits > 0 && nBpixL2Hits > 0 && nBpixL3Hits > 0))) + passcuts_hit = false; + } + if (subdetid == PixelSubdetector::PixelEndcap) { + if (trackerTopology_->pxfDisk(id) == 1) + if (!((nBpixL1Hits > 0 && nBpixL2Hits > 0 && nBpixL3Hits > 0) || + (nBpixL1Hits > 0 && nBpixL2Hits > 0 && nFpixD2Hits > 0) || + (nBpixL1Hits > 0 && nFpixD2Hits > 0 && nFpixD3Hits > 0))) + passcuts_hit = false; + if (trackerTopology_->pxfDisk(id) == 2) + if (!((nBpixL1Hits > 0 && nBpixL2Hits > 0 && nFpixD1Hits > 0) || + (nBpixL1Hits > 0 && nFpixD1Hits > 0 && nFpixD3Hits > 0))) + passcuts_hit = false; + if (trackerTopology_->pxfDisk(id) == 3) + if (!((nBpixL1Hits > 0 && nFpixD1Hits > 0 && nFpixD2Hits > 0))) + passcuts_hit = false; + } + /* //Fiducial Cut - will work on it later const SiPixelRecHit* pixhit = dynamic_cast(hit); const PixelGeomDetUnit* geomdetunit = dynamic_cast ( tracker->idToDet(id) ); @@ -347,246 +367,231 @@ void SiPixelPhase1TrackEfficiency::analyze(const edm::Event& iEvent, const edm:: if (!((col < (centercol + 10)) && (col > (centercol - 10)) && (row < (centerrow + 10)) && (row > (centerrow -10 )))) passcuts_hit = false; */ - - if (passcuts_hit ==true && passcuts){ - - if ( !(subdetid == PixelSubdetector::PixelBarrel && trackerTopology_ -> pxbLayer(id) == 1) ){ - - if (isHitValid) { - histo[VALID].fill(id, &iEvent); - histo[EFFICIENCY].fill(1, id, &iEvent); - } - if (isHitMissing) { - histo[MISSING].fill(id, &iEvent); - histo[EFFICIENCY].fill(0, id, &iEvent); - } - if (isHitInactive) { - histo[INACTIVE].fill(id, &iEvent); - } - } - - } - - } - - - - ///////////////////////////////////////////////layer 1 specific here///////////////////////////////////////////////////////////////////// - valid_layerFrom = false; - - //propagation only from PXB2 and PXD1, more cuts later - for (const auto &tm : traj->measurements()) { + if (passcuts_hit == true && passcuts) { + if (!(subdetid == PixelSubdetector::PixelBarrel && trackerTopology_->pxbLayer(id) == 1)) { + if (isHitValid) { + histo[VALID].fill(id, &iEvent); + histo[EFFICIENCY].fill(1, id, &iEvent); + } + if (isHitMissing) { + histo[MISSING].fill(id, &iEvent); + histo[EFFICIENCY].fill(0, id, &iEvent); + } + if (isHitInactive) { + histo[INACTIVE].fill(id, &iEvent); + } + } + } + } + + ///////////////////////////////////////////////layer 1 specific here///////////////////////////////////////////////////////////////////// + valid_layerFrom = false; + + //propagation only from PXB2 and PXD1, more cuts later + for (const auto& tm : traj->measurements()) { if (tm.recHit().get() && tm.recHitR().isValid()) { - DetId where = tm.recHitR().geographicalId(); - int source_det = where.subdetId(); - - if (source_det == PixelSubdetector::SubDetector::PixelBarrel){ - int source_layer = trackerTopology_ -> pxbLayer(where); - if (source_layer==2){ - if (tm.updatedState().isValid()) {tsosPXB2 = tm.updatedState(); valid_layerFrom=true;} - } - } - - if (source_det == PixelSubdetector::SubDetector::PixelEndcap){ - int source_layer = trackerTopology_ -> pxfDisk(where); - if (source_layer==1){ - if (tm.updatedState().isValid()) {tsosPXB2 = tm.updatedState(); valid_layerFrom=true;} - - } - } + DetId where = tm.recHitR().geographicalId(); + int source_det = where.subdetId(); + + if (source_det == PixelSubdetector::SubDetector::PixelBarrel) { + int source_layer = trackerTopology_->pxbLayer(where); + if (source_layer == 2) { + if (tm.updatedState().isValid()) { + tsosPXB2 = tm.updatedState(); + valid_layerFrom = true; + } + } + } + + if (source_det == PixelSubdetector::SubDetector::PixelEndcap) { + int source_layer = trackerTopology_->pxfDisk(where); + if (source_layer == 1) { + if (tm.updatedState().isValid()) { + tsosPXB2 = tm.updatedState(); + valid_layerFrom = true; + } + } + } + } + } //uodated tsosPXB2 here + + if (!valid_layerFrom) + continue; + if (!tsosPXB2.isValid()) + continue; + + //propagation A: Calculate the efficiency by the distance to the closest cluster + expTrajMeasurements = + theLayerMeasurements_->measurements(*pxbLayer1_, tsosPXB2, *trackerPropagator_, *chi2MeasurementEstimator_); + auto compDets = pxbLayer1_->compatibleDets(tsosPXB2, *trackerPropagator_, *chi2MeasurementEstimator_); + std::pair eff_map; + bool valid = false; + bool missing = false; + passcuts_hit = true; + + //Fiducial Cut, only calculate the efficiency of the central pixels + for (uint p = 0; p < expTrajMeasurements.size(); p++) { + TrajectoryMeasurement pxb1TM(expTrajMeasurements[p]); + const auto& pxb1Hit = pxb1TM.recHit(); + int detidHit = pxb1Hit->geographicalId(); + if (detidHit == 0) + continue; + + const SiPixelRecHit* pixhit = dynamic_cast(pxb1Hit->hit()); + const PixelGeomDetUnit* geomdetunit = dynamic_cast(tracker->idToDet(detidHit)); + const PixelTopology& topol = geomdetunit->specificTopology(); + + LocalPoint lp; + if (pixhit) { + lp = pixhit->localPosition(); } - } //uodated tsosPXB2 here - - - - if (!valid_layerFrom) continue; - if (!tsosPXB2.isValid()) continue; - - - - //propagation A: Calculate the efficiency by the distance to the closest cluster - expTrajMeasurements = theLayerMeasurements_->measurements(*pxbLayer1_, tsosPXB2, *trackerPropagator_, *chi2MeasurementEstimator_); - auto compDets = pxbLayer1_->compatibleDets(tsosPXB2, *trackerPropagator_, *chi2MeasurementEstimator_); - std::pair eff_map; - bool valid = false; - bool missing = false; - passcuts_hit = true; - - - //Fiducial Cut, only calculate the efficiency of the central pixels - for(uint p=0; pgeographicalId(); - if (detidHit==0) continue; - - const SiPixelRecHit* pixhit = dynamic_cast(pxb1Hit->hit()); - const PixelGeomDetUnit* geomdetunit = dynamic_cast ( tracker->idToDet(detidHit) ); - const PixelTopology& topol = geomdetunit->specificTopology(); - LocalPoint lp; - if (pixhit) { - lp = pixhit->localPosition(); + MeasurementPoint mp = topol.measurementPosition(lp); + int row = (int)mp.x() % 80; + int col = (int)mp.y() % 52; + + int centerrow = 40; + int centercol = 26; + + if (!((col < (centercol + 10)) && (col > (centercol - 10)) && (row < (centerrow + 10)) && + (row > (centerrow - 10)))) + passcuts_hit = false; + + //Access the distance to the closest cluster + for (const auto& detAndState : compDets) { + const auto& pXb1_lpos = detAndState.second.localPosition(); + int detid = detAndState.first->geographicalId().rawId(); + for (edmNew::DetSetVector::const_iterator iter_cl = siPixelClusters->begin(); + iter_cl != siPixelClusters->end(); + iter_cl++) { + DetId detId(iter_cl->id()); + float minD[2]; + minD[0] = minD[1] = 10000.; + if (detId.rawId() != detAndState.first->geographicalId().rawId()) + continue; + if (pxb1Hit->geographicalId().rawId() != detAndState.first->geographicalId().rawId()) + continue; + const PixelGeomDetUnit* pixdet = (const PixelGeomDetUnit*)tkgeom->idToDetUnit(detId); + edmNew::DetSet::const_iterator itCluster = iter_cl->begin(); + if (passcuts_hit) { + for (; itCluster != iter_cl->end(); ++itCluster) { + LocalPoint lp(itCluster->x(), itCluster->y(), 0.); + PixelClusterParameterEstimator::ReturnType params = cpe.getParameters(*itCluster, *pixdet); + lp = std::get<0>(params); + + float Xdist = abs(lp.x() - pXb1_lpos.x()); + float Ydist = abs(lp.y() - pXb1_lpos.y()); + if (Xdist < minD[0]) { + minD[0] = Xdist; + } + if (Ydist < minD[1]) { + minD[1] = Ydist; + } + } + + if ((minD[0] < 0.02) && (minD[1] < 0.02)) { + valid = true; + missing = false; + + } else { + missing = true; + valid = false; + } + } + } + + //cuts: exactly the same as for other hits but assuming PXB1 + + //D0 + if (!((std::abs(track->dxy(vertices->at(0).position())) * -1.0) < + TRACK_D0_CUT_BARREL_VAL[trackerTopology_->pxbLayer(detid) - 1])) + passcuts_hit = false; + //Dz + if (!(std::abs(track->dz(vertices->at(0).position())) < TRACK_DZ_CUT_BARREL_VAL)) + passcuts_hit = false; + // Pixhit cut + if (!((nBpixL2Hits > 0 && nBpixL3Hits > 0 && nBpixL4Hits > 0) || + (nBpixL2Hits > 0 && nBpixL3Hits > 0 && nFpixD1Hits > 0) || + (nBpixL2Hits > 0 && nFpixD1Hits > 0 && nFpixD2Hits > 0) || + (nFpixD1Hits > 0 && nFpixD2Hits > 0 && nFpixD3Hits > 0))) + passcuts_hit = false; + bool found_det = false; + + if (passcuts && passcuts_hit) { + for (unsigned int i_eff = 0; i_eff < eff_pxb1_vector.size(); i_eff++) { + //in case found hit in the same det, take only the valid hit + if (eff_pxb1_vector[i_eff].first == detid) { + found_det = true; + if (eff_pxb1_vector[i_eff].second[0] == false && valid == true) { + eff_pxb1_vector[i_eff].second[0] = valid; + eff_pxb1_vector[i_eff].second[1] = missing; + } + } + } + if (!found_det) { + eff_map.first = detid; + eff_map.second[0] = valid; + eff_map.second[1] = missing; + eff_pxb1_vector.push_back(eff_map); + } + } + } } - MeasurementPoint mp = topol.measurementPosition(lp); - int row = (int) mp.x() % 80; - int col = (int) mp.y() % 52; + //propagation B: filling inactive hits + + for (uint p = 0; p < expTrajMeasurements.size(); p++) { + TrajectoryMeasurement pxb1TM(expTrajMeasurements[p]); + const auto& pxb1Hit = pxb1TM.recHit(); + bool inactive = (pxb1Hit->getType() == TrackingRecHit::inactive); + int detid = pxb1Hit->geographicalId(); + bool found_det = false; + + if (passcuts && passcuts_hit) { + for (unsigned int i_eff = 0; i_eff < eff_pxb1_vector.size(); i_eff++) { + //in case found hit in the same det, take only the valid hit + if (eff_pxb1_vector[i_eff].first == detid) { + found_det = true; + if (eff_pxb1_vector[i_eff].second[0] == false && valid == true) { + eff_pxb1_vector[i_eff].second[2] = inactive; + } + } + } + + //if no other hit in det + if (!found_det) { + eff_map.first = detid; + eff_map.second[2] = inactive; + eff_pxb1_vector.push_back(eff_map); + } + } - int centerrow = 40; - int centercol = 26; + } //traj loop - if (!((col < (centercol + 10)) && (col > (centercol - 10)) && (row < (centerrow + 10)) && (row > (centerrow - 10 )))) passcuts_hit = false; - + if (eff_pxb1_vector.size() == 1) { + //eff map is filled -> decide what to do for double hits, ie eff_pxb1_vector.size>1 ... if 1 just use MISSING and VALID as usual - //Access the distance to the closest cluster - for (const auto & detAndState : compDets) { - - const auto & pXb1_lpos = detAndState.second.localPosition(); - int detid = detAndState.first->geographicalId().rawId(); - for (edmNew::DetSetVector::const_iterator iter_cl=siPixelClusters->begin(); iter_cl!=siPixelClusters->end(); iter_cl++ ){ - DetId detId(iter_cl->id()); - float minD[2]; minD[0]=minD[1]=10000.; - if(detId.rawId()!=detAndState.first->geographicalId().rawId()) continue; - if(pxb1Hit->geographicalId().rawId()!=detAndState.first->geographicalId().rawId()) continue; - const PixelGeomDetUnit *pixdet=(const PixelGeomDetUnit*) tkgeom->idToDetUnit(detId); - edmNew::DetSet::const_iterator itCluster=iter_cl->begin(); - if (passcuts_hit){ - for( ; itCluster!=iter_cl->end(); ++itCluster){ - - LocalPoint lp(itCluster->x(), itCluster->y(), 0.); - PixelClusterParameterEstimator::ReturnType params=cpe.getParameters(*itCluster,*pixdet); - lp=std::get<0>(params); - - float Xdist = abs(lp.x()-pXb1_lpos.x()); - float Ydist = abs(lp.y()-pXb1_lpos.y()); - if(Xdistdxy(vertices->at(0).position()) ) * -1.0) < TRACK_D0_CUT_BARREL_VAL[trackerTopology_ -> pxbLayer(detid) -1])) passcuts_hit = false; - //Dz - if(!(std::abs( track->dz(vertices->at(0).position())) < TRACK_DZ_CUT_BARREL_VAL)) passcuts_hit = false; - // Pixhit cut - if(!((nBpixL2Hits > 0 && nBpixL3Hits > 0 && nBpixL4Hits > 0) || (nBpixL2Hits > 0 && nBpixL3Hits > 0 && nFpixD1Hits > 0) || - (nBpixL2Hits > 0 && nFpixD1Hits > 0 && nFpixD2Hits > 0) || (nFpixD1Hits > 0 && nFpixD2Hits > 0 && nFpixD3Hits > 0))) passcuts_hit = false; - bool found_det = false; - - if (passcuts && passcuts_hit){ - for (unsigned int i_eff=0; i_effgetType()==TrackingRecHit::inactive); - int detid= pxb1Hit->geographicalId(); - bool found_det = false; - - if (passcuts && passcuts_hit){ - for (unsigned int i_eff=0; i_eff decide what to do for double hits, ie eff_pxb1_vector.size>1 ... if 1 just use MISSING and VALID as usual - - if (eff_pxb1_vector[0].second[0]) { - histo[VALID].fill(eff_pxb1_vector[0].first, &iEvent); - histo[EFFICIENCY].fill(1, eff_pxb1_vector[0].first, &iEvent); - - } - if (eff_pxb1_vector[0].second[1]) { - histo[MISSING].fill(eff_pxb1_vector[0].first, &iEvent); - histo[EFFICIENCY].fill(0, eff_pxb1_vector[0].first, &iEvent); - - } - - if (eff_pxb1_vector[0].second[2]) { - histo[INACTIVE].fill(eff_pxb1_vector[0].first, &iEvent); - + if (eff_pxb1_vector[0].second[0]) { + histo[VALID].fill(eff_pxb1_vector[0].first, &iEvent); + histo[EFFICIENCY].fill(1, eff_pxb1_vector[0].first, &iEvent); + } + if (eff_pxb1_vector[0].second[1]) { + histo[MISSING].fill(eff_pxb1_vector[0].first, &iEvent); + histo[EFFICIENCY].fill(0, eff_pxb1_vector[0].first, &iEvent); + } + + if (eff_pxb1_vector[0].second[2]) { + histo[INACTIVE].fill(eff_pxb1_vector[0].first, &iEvent); + } } - - } - - }//trajTrackHandle - - - histo[VALID ].executePerEventHarvesting(&iEvent); - histo[MISSING ].executePerEventHarvesting(&iEvent); - histo[INACTIVE].executePerEventHarvesting(&iEvent); -} - -} // namespace - -DEFINE_FWK_MODULE(SiPixelPhase1TrackEfficiency); + + } //trajTrackHandle + + histo[VALID].executePerEventHarvesting(&iEvent); + histo[MISSING].executePerEventHarvesting(&iEvent); + histo[INACTIVE].executePerEventHarvesting(&iEvent); + } + +} // namespace + +DEFINE_FWK_MODULE(SiPixelPhase1TrackEfficiency); diff --git a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackResiduals.cc b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackResiduals.cc index b079f5ad420ac..6fa36834f64a7 100644 --- a/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackResiduals.cc +++ b/DQM/SiPixelPhase1Track/plugins/SiPixelPhase1TrackResiduals.cc @@ -22,85 +22,77 @@ namespace { -class SiPixelPhase1TrackResiduals final : public SiPixelPhase1Base { - enum { - RESIDUAL_X, - RESIDUAL_Y, - RESONEDGE_X, - RESONEDGE_Y, - RESOTHERBAD_X, - RESOTHERBAD_Y - }; + class SiPixelPhase1TrackResiduals final : public SiPixelPhase1Base { + enum { RESIDUAL_X, RESIDUAL_Y, RESONEDGE_X, RESONEDGE_Y, RESOTHERBAD_X, RESOTHERBAD_Y }; public: - explicit SiPixelPhase1TrackResiduals(const edm::ParameterSet& conf); - void analyze(const edm::Event&, const edm::EventSetup&) override; + explicit SiPixelPhase1TrackResiduals(const edm::ParameterSet& conf); + void analyze(const edm::Event&, const edm::EventSetup&) override; private: - TrackerValidationVariables validator; - edm::EDGetTokenT offlinePrimaryVerticesToken_; - - bool applyVertexCut_; -}; - -SiPixelPhase1TrackResiduals::SiPixelPhase1TrackResiduals(const edm::ParameterSet& iConfig) : - SiPixelPhase1Base(iConfig), - validator(iConfig, consumesCollector()) -{ - - applyVertexCut_=iConfig.getUntrackedParameter("VertexCut",true); - - offlinePrimaryVerticesToken_= consumes(iConfig.getParameter("vertices")); - -} - -void SiPixelPhase1TrackResiduals::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - if( !checktrigger(iEvent,iSetup,DCS) ) return; - - edm::ESHandle tracker; - iSetup.get().get(tracker); - assert(tracker.isValid()); - - edm::Handle vertices; - if(applyVertexCut_) { - iEvent.getByToken(offlinePrimaryVerticesToken_, vertices); - if (!vertices.isValid() || vertices->empty()) return; + TrackerValidationVariables validator; + edm::EDGetTokenT offlinePrimaryVerticesToken_; + + bool applyVertexCut_; + }; + + SiPixelPhase1TrackResiduals::SiPixelPhase1TrackResiduals(const edm::ParameterSet& iConfig) + : SiPixelPhase1Base(iConfig), validator(iConfig, consumesCollector()) { + applyVertexCut_ = iConfig.getUntrackedParameter("VertexCut", true); + + offlinePrimaryVerticesToken_ = consumes(iConfig.getParameter("vertices")); } - std::vector vtracks; - - validator.fillTrackQuantities(iEvent, iSetup, - // tell the validator to only look at good tracks - [&](const reco::Track& track) -> bool { - return (!applyVertexCut_ || (track.pt() > 0.75 - && std::abs( track.dxy(vertices->at(0).position()) ) < 5*track.dxyError())) ; - }, vtracks); - - for (auto& track : vtracks) { - for (auto& it : track.hits) { - auto id = DetId(it.rawDetId); - auto isPixel = id.subdetId() == 1 || id.subdetId() == 2; - if (!isPixel) continue; - - histo[RESIDUAL_X].fill(it.resXprime, id, &iEvent); - histo[RESIDUAL_Y].fill(it.resYprime, id, &iEvent); - - if(it.isOnEdgePixel){ - histo[RESONEDGE_X].fill(it.resXprime, id, &iEvent); - histo[RESONEDGE_Y].fill(it.resYprime, id, &iEvent); - } + void SiPixelPhase1TrackResiduals::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + if (!checktrigger(iEvent, iSetup, DCS)) + return; - if(it.isOtherBadPixel){ - histo[RESOTHERBAD_X].fill(it.resXprime, id, &iEvent); - histo[RESOTHERBAD_Y].fill(it.resYprime, id, &iEvent); - } + edm::ESHandle tracker; + iSetup.get().get(tracker); + assert(tracker.isValid()); + edm::Handle vertices; + if (applyVertexCut_) { + iEvent.getByToken(offlinePrimaryVerticesToken_, vertices); + if (!vertices.isValid() || vertices->empty()) + return; } - } -} + std::vector vtracks; + + validator.fillTrackQuantities( + iEvent, + iSetup, + // tell the validator to only look at good tracks + [&](const reco::Track& track) -> bool { + return (!applyVertexCut_ || + (track.pt() > 0.75 && std::abs(track.dxy(vertices->at(0).position())) < 5 * track.dxyError())); + }, + vtracks); + + for (auto& track : vtracks) { + for (auto& it : track.hits) { + auto id = DetId(it.rawDetId); + auto isPixel = id.subdetId() == 1 || id.subdetId() == 2; + if (!isPixel) + continue; + + histo[RESIDUAL_X].fill(it.resXprime, id, &iEvent); + histo[RESIDUAL_Y].fill(it.resYprime, id, &iEvent); + + if (it.isOnEdgePixel) { + histo[RESONEDGE_X].fill(it.resXprime, id, &iEvent); + histo[RESONEDGE_Y].fill(it.resYprime, id, &iEvent); + } + + if (it.isOtherBadPixel) { + histo[RESOTHERBAD_X].fill(it.resXprime, id, &iEvent); + histo[RESOTHERBAD_Y].fill(it.resYprime, id, &iEvent); + } + } + } + } -} // namespace +} // namespace DEFINE_FWK_MODULE(SiPixelPhase1TrackResiduals); - diff --git a/DQM/SiStripCommissioningClients/interface/ApvTimingHistograms.h b/DQM/SiStripCommissioningClients/interface/ApvTimingHistograms.h index f43196cf78571..6f8254ba8b483 100644 --- a/DQM/SiStripCommissioningClients/interface/ApvTimingHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/ApvTimingHistograms.h @@ -6,15 +6,11 @@ class DQMStore; class ApvTimingHistograms : public virtual CommissioningHistograms { - - public: - - ApvTimingHistograms( const edm::ParameterSet& pset, DQMStore* ); +public: + ApvTimingHistograms(const edm::ParameterSet& pset, DQMStore*); ~ApvTimingHistograms() override; - - void histoAnalysis( bool debug ) override; - -}; -#endif // DQM_SiStripCommissioningClients_ApvTimingHistograms_H + void histoAnalysis(bool debug) override; +}; +#endif // DQM_SiStripCommissioningClients_ApvTimingHistograms_H diff --git a/DQM/SiStripCommissioningClients/interface/CalibrationHistograms.h b/DQM/SiStripCommissioningClients/interface/CalibrationHistograms.h index 0e3a6f5a33198..d0e90a1fc66cc 100644 --- a/DQM/SiStripCommissioningClients/interface/CalibrationHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/CalibrationHistograms.h @@ -3,33 +3,24 @@ #include "DQM/SiStripCommissioningClients/interface/CommissioningHistograms.h" - class DQMStore; class CalibrationHistograms : virtual public CommissioningHistograms { - - public: - - CalibrationHistograms( const edm::ParameterSet& pset, - DQMStore*, - const sistrip::RunType& task = sistrip::CALIBRATION ); +public: + CalibrationHistograms(const edm::ParameterSet& pset, DQMStore*, const sistrip::RunType& task = sistrip::CALIBRATION); ~CalibrationHistograms() override; - - void histoAnalysis( bool debug ) override; - void printAnalyses() override; // override + void histoAnalysis(bool debug) override; - void save( std::string& filename, - uint32_t run_number = 0, - std::string partitionName = ""); + void printAnalyses() override; // override - private: + void save(std::string& filename, uint32_t run_number = 0, std::string partitionName = ""); +private: // Needed for the calibration-scan analysis float targetRiseTime_; float targetDecayTime_; bool tuneSimultaneously_; }; -#endif // DQM_SiStripCommissioningClients_CalibrationHistograms_H - +#endif // DQM_SiStripCommissioningClients_CalibrationHistograms_H diff --git a/DQM/SiStripCommissioningClients/interface/CommissioningHistograms.h b/DQM/SiStripCommissioningClients/interface/CommissioningHistograms.h index 1388773bbf3ff..db700ab812e90 100644 --- a/DQM/SiStripCommissioningClients/interface/CommissioningHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/CommissioningHistograms.h @@ -23,147 +23,133 @@ class MonitorElement; class CommissioningAnalysis; class CommissioningHistograms { - - public: - +public: // ---------- con(de)structors ---------- - - CommissioningHistograms( const edm::ParameterSet& pset, - DQMStore* const, - const sistrip::RunType& ); + + CommissioningHistograms(const edm::ParameterSet& pset, DQMStore* const, const sistrip::RunType&); // MAKE PRIVATE - CommissioningHistograms(); // private constructor + CommissioningHistograms(); // private constructor virtual ~CommissioningHistograms(); - virtual void configure( const edm::ParameterSet&, const edm::EventSetup& ) { } + virtual void configure(const edm::ParameterSet&, const edm::EventSetup&) {} // ---------- histogram container class ---------- - + class Histo { public: - Histo( const std::string& title, - MonitorElement* const me, - MonitorElement* const cme ) - : title_(title), me_(me), cme_(cme) {;} - Histo() : title_(""), me_(nullptr), cme_(nullptr) {;} - void print( std::stringstream& ) const; + Histo(const std::string& title, MonitorElement* const me, MonitorElement* const cme) + : title_(title), me_(me), cme_(cme) { + ; + } + Histo() : title_(""), me_(nullptr), cme_(nullptr) { ; } + void print(std::stringstream&) const; std::string title_; MonitorElement* me_; MonitorElement* cme_; }; - + // ---------- typedefs ---------- - - typedef std::map Analyses; + + typedef std::map Analyses; typedef Analyses::iterator Analysis; - - typedef SummaryPlotFactory Factory; + + typedef SummaryPlotFactory Factory; typedef std::vector Histos; - - typedef std::map HistosMap; - - typedef std::map FedToFecMap; + + typedef std::map HistosMap; + + typedef std::map FedToFecMap; // ---------- histogram "actions" ---------- - - static uint32_t runNumber( DQMStore* const, - const std::vector& ); - - static sistrip::RunType runType( DQMStore* const, - const std::vector& ); - + + static uint32_t runNumber(DQMStore* const, const std::vector&); + + static sistrip::RunType runType(DQMStore* const, const std::vector&); + /** Extracts custom information from list of MonitorElements. */ - static void copyCustomInformation( DQMStore* const, - const std::vector& ); - - void extractHistograms( const std::vector& ); + static void copyCustomInformation(DQMStore* const, const std::vector&); + + void extractHistograms(const std::vector&); // DEPRECATE - void createCollations( const std::vector& ); + void createCollations(const std::vector&); - virtual void histoAnalysis( bool debug ); + virtual void histoAnalysis(bool debug); virtual void printAnalyses(); virtual void printSummary(); - - virtual void createSummaryHisto( const sistrip::Monitorable&, - const sistrip::Presentation&, - const std::string& top_level_dir, - const sistrip::Granularity& ); - - void remove( std::string pattern = "" ); - - - void save( std::string& filename, - uint32_t run_number = 0, - std::string partitionName = ""); + + virtual void createSummaryHisto(const sistrip::Monitorable&, + const sistrip::Presentation&, + const std::string& top_level_dir, + const sistrip::Granularity&); + + void remove(std::string pattern = ""); + + void save(std::string& filename, uint32_t run_number = 0, std::string partitionName = ""); // ---------- protected methods ---------- - - protected: +protected: inline const sistrip::RunType& task() const; - + inline DQMStore* const bei() const; - + Analyses& data(bool getMaskedData = false); - + inline Factory* const factory(); - + inline const HistosMap& histos() const; - + inline const FedToFecMap& mapping() const; - + inline const edm::ParameterSet& pset() const; - TH1* histogram( const sistrip::Monitorable&, - const sistrip::Presentation&, - const sistrip::View&, - const std::string& directory, - const uint32_t& xbins, - const float& xlow = 1. * sistrip::invalid_, - const float& xhigh = 1. * sistrip::invalid_ ); - + TH1* histogram(const sistrip::Monitorable&, + const sistrip::Presentation&, + const sistrip::View&, + const std::string& directory, + const uint32_t& xbins, + const float& xlow = 1. * sistrip::invalid_, + const float& xhigh = 1. * sistrip::invalid_); + void printHistosMap(); void clearHistosMap(); // ---------- private member data ---------- - protected: - +protected: std::unique_ptr factory_; - - private: - + +private: sistrip::RunType task_; - + DQMStore* bei_; - + Analyses data_; - + HistosMap histos_; - + FedToFecMap mapping_; edm::ParameterSet pset_; bool mask_; - std::vector fedMaskVector_; - std::vector fecMaskVector_; - std::vector ringVector_; - std::vector ccuVector_; - std::vector i2cChanVector_; - std::vector lldChanVector_; - - Analyses dataWithMask_; - bool dataWithMaskCached_; - + std::vector fedMaskVector_; + std::vector fecMaskVector_; + std::vector ringVector_; + std::vector ccuVector_; + std::vector i2cChanVector_; + std::vector lldChanVector_; + + Analyses dataWithMask_; + bool dataWithMaskCached_; }; // ---------- inline methods ---------- @@ -175,4 +161,4 @@ const CommissioningHistograms::HistosMap& CommissioningHistograms::histos() cons const CommissioningHistograms::FedToFecMap& CommissioningHistograms::mapping() const { return mapping_; } const edm::ParameterSet& CommissioningHistograms::pset() const { return pset_; } -#endif // DQM_SiStripCommissioningClients_CommissioningHistograms_H +#endif // DQM_SiStripCommissioningClients_CommissioningHistograms_H diff --git a/DQM/SiStripCommissioningClients/interface/DaqScopeModeHistograms.h b/DQM/SiStripCommissioningClients/interface/DaqScopeModeHistograms.h index f2c045b14d435..42af8f43ba16b 100644 --- a/DQM/SiStripCommissioningClients/interface/DaqScopeModeHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/DaqScopeModeHistograms.h @@ -6,16 +6,13 @@ class DQMStore; class DaqScopeModeHistograms : public virtual CommissioningHistograms { - - public: - - DaqScopeModeHistograms( const edm::ParameterSet& pset, DQMStore* ); +public: + DaqScopeModeHistograms(const edm::ParameterSet& pset, DQMStore*); ~DaqScopeModeHistograms() override; - - void histoAnalysis( bool debug ) override; - void printAnalyses() override; // override + void histoAnalysis(bool debug) override; + void printAnalyses() override; // override }; -#endif // DQM_SiStripCommissioningClients_DaqScopeModeHistograms_H +#endif // DQM_SiStripCommissioningClients_DaqScopeModeHistograms_H diff --git a/DQM/SiStripCommissioningClients/interface/FastFedCablingHistograms.h b/DQM/SiStripCommissioningClients/interface/FastFedCablingHistograms.h index 1ea64ef53844b..f7d6bb4466bbe 100644 --- a/DQM/SiStripCommissioningClients/interface/FastFedCablingHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/FastFedCablingHistograms.h @@ -6,19 +6,15 @@ class DQMStore; class FastFedCablingHistograms : public virtual CommissioningHistograms { - - public: - - FastFedCablingHistograms( const edm::ParameterSet& pset, DQMStore* ); +public: + FastFedCablingHistograms(const edm::ParameterSet& pset, DQMStore*); ~FastFedCablingHistograms() override; - - void histoAnalysis( bool debug ) override; - void printAnalyses() override; // override + void histoAnalysis(bool debug) override; - void printSummary() override; // override + void printAnalyses() override; // override + void printSummary() override; // override }; -#endif // DQM_SiStripCommissioningClients_FastFedCablingHistograms_H - +#endif // DQM_SiStripCommissioningClients_FastFedCablingHistograms_H diff --git a/DQM/SiStripCommissioningClients/interface/FedCablingHistograms.h b/DQM/SiStripCommissioningClients/interface/FedCablingHistograms.h index 819b5b6e4eb67..d75e2a0db9abc 100644 --- a/DQM/SiStripCommissioningClients/interface/FedCablingHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/FedCablingHistograms.h @@ -5,39 +5,32 @@ #include "DQM/SiStripCommissioningSummary/interface/FedCablingSummaryFactory.h" #include "CondFormats/SiStripObjects/interface/FedCablingAnalysis.h" - class DQMStore; class FedCablingHistograms : virtual public CommissioningHistograms { - - public: - - FedCablingHistograms( const edm::ParameterSet& pset, DQMStore* ); +public: + FedCablingHistograms(const edm::ParameterSet& pset, DQMStore*); ~FedCablingHistograms() override; - + typedef SummaryPlotFactory Factory; - typedef std::map Analyses; + typedef std::map Analyses; /** */ - void histoAnalysis( bool debug ) override; + void histoAnalysis(bool debug) override; /** */ void printAnalyses() override; - + /** */ - void createSummaryHisto( const sistrip::Monitorable&, - const sistrip::Presentation&, - const std::string& top_level_dir, - const sistrip::Granularity& ) override; - - protected: - + void createSummaryHisto(const sistrip::Monitorable&, + const sistrip::Presentation&, + const std::string& top_level_dir, + const sistrip::Granularity&) override; + +protected: Analyses data_; - - std::unique_ptr factory_; + std::unique_ptr factory_; }; -#endif // DQM_SiStripCommissioningClients_FedCablingHistograms_H - - +#endif // DQM_SiStripCommissioningClients_FedCablingHistograms_H diff --git a/DQM/SiStripCommissioningClients/interface/FedTimingHistograms.h b/DQM/SiStripCommissioningClients/interface/FedTimingHistograms.h index 2fa86a9b53f13..9c752fe742667 100644 --- a/DQM/SiStripCommissioningClients/interface/FedTimingHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/FedTimingHistograms.h @@ -5,38 +5,32 @@ #include "DQM/SiStripCommissioningSummary/interface/FedTimingSummaryFactory.h" #include "CondFormats/SiStripObjects/interface/FedTimingAnalysis.h" - class FedTimingHistograms : public CommissioningHistograms { - - public: - - FedTimingHistograms( const edm::ParameterSet& pset, DQMStore* ); +public: + FedTimingHistograms(const edm::ParameterSet& pset, DQMStore*); ~FedTimingHistograms() override; typedef SummaryHistogramFactory Factory; - - /** */ - void histoAnalysis( bool debug ) override; /** */ - void createSummaryHisto( const sistrip::Monitorable&, - const sistrip::Presentation&, - const std::string& top_level_dir, - const sistrip::Granularity& ) override; + void histoAnalysis(bool debug) override; - protected: + /** */ + void createSummaryHisto(const sistrip::Monitorable&, + const sistrip::Presentation&, + const std::string& top_level_dir, + const sistrip::Granularity&) override; - std::map data_; +protected: + std::map data_; std::unique_ptr factory_; - + const float optimumSamplingPoint_; float minDelay_; - float maxDelay_; + float maxDelay_; uint32_t deviceWithMinDelay_; uint32_t deviceWithMaxDelay_; - }; -#endif // DQM_SiStripCommissioningClients_FedTimingHistograms_H - +#endif // DQM_SiStripCommissioningClients_FedTimingHistograms_H diff --git a/DQM/SiStripCommissioningClients/interface/NoiseHistograms.h b/DQM/SiStripCommissioningClients/interface/NoiseHistograms.h index 3a2c0cc5bce47..a1e0059286e23 100644 --- a/DQM/SiStripCommissioningClients/interface/NoiseHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/NoiseHistograms.h @@ -6,16 +6,13 @@ class DQMStore; class NoiseHistograms : public virtual CommissioningHistograms { - - public: - - NoiseHistograms( const edm::ParameterSet& pset, DQMStore* ); +public: + NoiseHistograms(const edm::ParameterSet& pset, DQMStore*); ~NoiseHistograms() override; - - void histoAnalysis( bool debug ) override; - void printAnalyses() override; // override + void histoAnalysis(bool debug) override; + void printAnalyses() override; // override }; -#endif // DQM_SiStripCommissioningClients_NoiseHistograms_H +#endif // DQM_SiStripCommissioningClients_NoiseHistograms_H diff --git a/DQM/SiStripCommissioningClients/interface/OptoScanHistograms.h b/DQM/SiStripCommissioningClients/interface/OptoScanHistograms.h index 15eda41d876b6..97122890cda09 100644 --- a/DQM/SiStripCommissioningClients/interface/OptoScanHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/OptoScanHistograms.h @@ -6,18 +6,13 @@ class DQMStore; class OptoScanHistograms : public virtual CommissioningHistograms { - - public: - - OptoScanHistograms( const edm::ParameterSet& pset, DQMStore* ); +public: + OptoScanHistograms(const edm::ParameterSet& pset, DQMStore*); ~OptoScanHistograms() override; - - void histoAnalysis( bool debug ) override; - void printAnalyses() override; // override + void histoAnalysis(bool debug) override; + void printAnalyses() override; // override }; -#endif // DQM_SiStripCommissioningClients_OptoScanHistograms_H - - +#endif // DQM_SiStripCommissioningClients_OptoScanHistograms_H diff --git a/DQM/SiStripCommissioningClients/interface/PedestalsHistograms.h b/DQM/SiStripCommissioningClients/interface/PedestalsHistograms.h index 1d70129f7c885..c31ce2498d2f3 100644 --- a/DQM/SiStripCommissioningClients/interface/PedestalsHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/PedestalsHistograms.h @@ -6,16 +6,13 @@ class DQMStore; class PedestalsHistograms : public virtual CommissioningHistograms { - - public: - - PedestalsHistograms( const edm::ParameterSet& pset, DQMStore* ); +public: + PedestalsHistograms(const edm::ParameterSet& pset, DQMStore*); ~PedestalsHistograms() override; - - void histoAnalysis( bool debug ) override; - void printAnalyses() override; // override + void histoAnalysis(bool debug) override; + void printAnalyses() override; // override }; -#endif // DQM_SiStripCommissioningClients_PedestalsHistograms_H +#endif // DQM_SiStripCommissioningClients_PedestalsHistograms_H diff --git a/DQM/SiStripCommissioningClients/interface/PedsFullNoiseHistograms.h b/DQM/SiStripCommissioningClients/interface/PedsFullNoiseHistograms.h index 25525e7dada6b..992f31bf84c3d 100644 --- a/DQM/SiStripCommissioningClients/interface/PedsFullNoiseHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/PedsFullNoiseHistograms.h @@ -6,16 +6,13 @@ class DQMStore; class PedsFullNoiseHistograms : public virtual CommissioningHistograms { +public: + PedsFullNoiseHistograms(const edm::ParameterSet& pset, DQMStore*); + ~PedsFullNoiseHistograms() override; - public: - - PedsFullNoiseHistograms( const edm::ParameterSet& pset, DQMStore* ); - ~PedsFullNoiseHistograms() override; - - void histoAnalysis( bool debug ) override; - - void printAnalyses() override; // override + void histoAnalysis(bool debug) override; + void printAnalyses() override; // override }; -#endif // DQM_SiStripCommissioningClients_PedsFullNoiseHistograms_H +#endif // DQM_SiStripCommissioningClients_PedsFullNoiseHistograms_H diff --git a/DQM/SiStripCommissioningClients/interface/PedsOnlyHistograms.h b/DQM/SiStripCommissioningClients/interface/PedsOnlyHistograms.h index 28aadec8f9faa..0861b9633d026 100644 --- a/DQM/SiStripCommissioningClients/interface/PedsOnlyHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/PedsOnlyHistograms.h @@ -6,16 +6,13 @@ class DQMStore; class PedsOnlyHistograms : public virtual CommissioningHistograms { - - public: - - PedsOnlyHistograms( const edm::ParameterSet& pset, DQMStore* ); +public: + PedsOnlyHistograms(const edm::ParameterSet& pset, DQMStore*); ~PedsOnlyHistograms() override; - - void histoAnalysis( bool debug ) override; - void printAnalyses() override; // override + void histoAnalysis(bool debug) override; + void printAnalyses() override; // override }; -#endif // DQM_SiStripCommissioningClients_PedsOnlyHistograms_H +#endif // DQM_SiStripCommissioningClients_PedsOnlyHistograms_H diff --git a/DQM/SiStripCommissioningClients/interface/SamplingHistograms.h b/DQM/SiStripCommissioningClients/interface/SamplingHistograms.h index 491f04c921de1..883803c7b9142 100644 --- a/DQM/SiStripCommissioningClients/interface/SamplingHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/SamplingHistograms.h @@ -8,23 +8,18 @@ class DQMStore; class SamplingHistograms : virtual public CommissioningHistograms { - - public: - - SamplingHistograms( const edm::ParameterSet& pset, DQMStore*, const sistrip::RunType& task = sistrip::APV_LATENCY ); +public: + SamplingHistograms(const edm::ParameterSet& pset, DQMStore*, const sistrip::RunType& task = sistrip::APV_LATENCY); ~SamplingHistograms() override; - - void histoAnalysis( bool debug ) override; - void configure( const edm::ParameterSet&, const edm::EventSetup& ) override; + void histoAnalysis(bool debug) override; + + void configure(const edm::ParameterSet&, const edm::EventSetup&) override; - private: - +private: float sOnCut_; int latencyCode_; - }; -#endif // DQM_SiStripCommissioningClients_SamplingHistograms_H - +#endif // DQM_SiStripCommissioningClients_SamplingHistograms_H diff --git a/DQM/SiStripCommissioningClients/interface/SiStripCommissioningOfflineClient.h b/DQM/SiStripCommissioningClients/interface/SiStripCommissioningOfflineClient.h index 708dd31f9e68f..6a6baf3a2196e 100644 --- a/DQM/SiStripCommissioningClients/interface/SiStripCommissioningOfflineClient.h +++ b/DQM/SiStripCommissioningClients/interface/SiStripCommissioningOfflineClient.h @@ -27,33 +27,29 @@ class TH1; creates summary histograms. */ class SiStripCommissioningOfflineClient : public edm::EDAnalyzer { - - public: - - SiStripCommissioningOfflineClient( const edm::ParameterSet& ); +public: + SiStripCommissioningOfflineClient(const edm::ParameterSet&); ~SiStripCommissioningOfflineClient() override; - - void beginRun( const edm::Run&, const edm::EventSetup& ) override; - void analyze( const edm::Event&, const edm::EventSetup& ) override; + + void beginRun(const edm::Run&, const edm::EventSetup&) override; + void analyze(const edm::Event&, const edm::EventSetup&) override; void endJob() override; - - protected: - virtual void createHistos( const edm::ParameterSet&, const edm::EventSetup& ); - virtual void uploadToConfigDb() {;} - virtual void setInputFiles( std::vector&, const std::string, const std::string, uint32_t, bool ); - - protected: +protected: + virtual void createHistos(const edm::ParameterSet&, const edm::EventSetup&); + virtual void uploadToConfigDb() { ; } + virtual void setInputFiles(std::vector&, const std::string, const std::string, uint32_t, bool); - /** DQMStore object. */ +protected: + /** DQMStore object. */ DQMStore* bei_; - + /** Action "executor" */ CommissioningHistograms* histos_; - + /** Input .root file. */ std::vector inputFiles_; - + /** Output .root file. */ std::string outputFileName_; @@ -62,13 +58,13 @@ class SiStripCommissioningOfflineClient : public edm::EDAnalyzer { /** */ bool analyzeHistos_; - + /** Input .xml file. */ std::string xmlFile_; /** Flag. */ bool createSummaryPlots_; - + /** */ bool clientHistos_; @@ -77,29 +73,27 @@ class SiStripCommissioningOfflineClient : public edm::EDAnalyzer { /** Commissioning runType. */ sistrip::RunType runType_; - + /** Run number. */ uint32_t runNumber_; /** Partition Name */ - std::string partitionName_ ; + std::string partitionName_; /** */ typedef std::vector Histos; /** */ - typedef std::map HistosMap; + typedef std::map HistosMap; /** Map containing commissioning histograms. */ HistosMap map_; - + /** SummaryPlot objects. */ std::vector plots_; /** */ edm::ParameterSet parameters_; - }; -#endif // DQM_SiStripCommissioningClients_SiStripCommissioningOfflineClient_H - +#endif // DQM_SiStripCommissioningClients_SiStripCommissioningOfflineClient_H diff --git a/DQM/SiStripCommissioningClients/interface/SiStripTFile.h b/DQM/SiStripCommissioningClients/interface/SiStripTFile.h index fe70ed51f672e..abee815d808fe 100644 --- a/DQM/SiStripCommissioningClients/interface/SiStripTFile.h +++ b/DQM/SiStripCommissioningClients/interface/SiStripTFile.h @@ -2,7 +2,7 @@ #ifndef DQM_SiStripCommissioningClients_SiStripTFile_H #define DQM_SiStripCommissioningClients_SiStripTFile_H -#include "DataFormats/SiStripCommon/interface/SiStripConstants.h" +#include "DataFormats/SiStripCommon/interface/SiStripConstants.h" #include "TFile.h" #include #include @@ -19,48 +19,43 @@ class TH1; navigation of TFiles containing DQM histograms. */ class SiStripTFile : public TFile { - - public: - +public: // -------------------- Constructors, destructors, typedefs -------------------- - + /** Constructor */ - SiStripTFile( const char* fname, - Option_t* option = "UPDATE", - const char* ftitle = "", - Int_t compress = 1 ); - + SiStripTFile(const char* fname, Option_t* option = "UPDATE", const char* ftitle = "", Int_t compress = 1); + /** Destructor */ ~SiStripTFile() override; - + /** */ typedef std::vector Histos; /** */ - typedef std::map< std::string, Histos > HistosMap; - + typedef std::map HistosMap; + // -------------------- Public interface -------------------- - + /** Formats the commissioning file with the correct "top-level" directory structure. Inserts string defining commissioning RunType in sistrip::root_ directory */ - TDirectory* setDQMFormat( sistrip::RunType, sistrip::View ); - + TDirectory* setDQMFormat(sistrip::RunType, sistrip::View); + /** Checks file complies with DQM format requirements. If so, updates record directory "top-level" directory structure and of readout view and commissioning RunType. */ TDirectory* readDQMFormat(); - + /** Checks to see if the file complies with DQM format requirements. */ bool queryDQMFormat(); - + /** Returns the "top" directory (describing the readout view) */ TDirectory* top(); - + /** Returns the dqm directory */ TDirectory* dqmTop(); - + /** Returns the sistrip::root_ directory */ TDirectory* sistripTop(); @@ -74,17 +69,16 @@ class SiStripTFile : public TFile { void addDevice(unsigned int key); /** Adds a path to the file. Any directories within the path that already exist are not recreated.*/ - TDirectory* addPath( const std::string& ); + TDirectory* addPath(const std::string&); /** Finds TH1 histograms, iterating through sub-directories. Fills a map, indexed by the histogram path. */ - void findHistos(TDirectory*, std::map< std::string, std::vector >*); + void findHistos(TDirectory*, std::map >*); /** Finds histos and sub-dirs found within given directory. Updates map with found histos, indexed by dir path. */ - void dirContent(TDirectory*, std::vector*, std::map< std::string, std::vector >*); - - private: + void dirContent(TDirectory*, std::vector*, std::map >*); +private: /** RunType */ sistrip::RunType runType_; @@ -102,7 +96,6 @@ class SiStripTFile : public TFile { /** True if dqmFormat() operation has been performed */ bool dqmFormat_; - }; -#endif // DQM_SiStripCommissioningClients_SiStripTFile_H +#endif // DQM_SiStripCommissioningClients_SiStripTFile_H diff --git a/DQM/SiStripCommissioningClients/interface/SummaryPlotXmlParser.h b/DQM/SiStripCommissioningClients/interface/SummaryPlotXmlParser.h index 58cc4ab3e9961..a7ada0a37990b 100644 --- a/DQM/SiStripCommissioningClients/interface/SummaryPlotXmlParser.h +++ b/DQM/SiStripCommissioningClients/interface/SummaryPlotXmlParser.h @@ -14,7 +14,7 @@ class SummaryPlotXmlParser; /** Debug information. */ -std::ostream& operator<< ( std::ostream&, const SummaryPlotXmlParser& ); +std::ostream& operator<<(std::ostream&, const SummaryPlotXmlParser&); /** @class SummaryPlotXmlParser @@ -23,34 +23,31 @@ std::ostream& operator<< ( std::ostream&, const SummaryPlotXmlParser& ); @brief Parses the "summary plot" xml configuration file */ class SummaryPlotXmlParser : public DQMParserBase { - - public: - +public: // ---------- Co(de)nstructors and consts ---------- /** Default constructor. */ SummaryPlotXmlParser(); /** Default destructor. */ - ~SummaryPlotXmlParser() override {;} - + ~SummaryPlotXmlParser() override { ; } + // ---------- Public interface ---------- - + /** Fill the map with the required tag/names and values */ - void parseXML( const std::string& xml_file ); - + void parseXML(const std::string& xml_file); + /** Returns SummaryPlot objects for given commissioning task. */ - std::vector summaryPlots( const sistrip::RunType& ); - + std::vector summaryPlots(const sistrip::RunType&); + /** Debug print method. */ - void print( std::stringstream& ) const; - - private: + void print(std::stringstream&) const; +private: // ---------- Private member data ---------- /** Container holding the SummaryPlot objects. */ - std::map< sistrip::RunType, std::vector > plots_; + std::map > plots_; // RunType tags and attributes static const std::string rootTag_; @@ -64,10 +61,6 @@ class SummaryPlotXmlParser : public DQMParserBase { static const std::string viewAttr_; static const std::string levelAttr_; static const std::string granularityAttr_; - }; -#endif // DQM_SiStripCommissioningClients_SummaryPlotXmlParser_H - - - +#endif // DQM_SiStripCommissioningClients_SummaryPlotXmlParser_H diff --git a/DQM/SiStripCommissioningClients/interface/VpspScanHistograms.h b/DQM/SiStripCommissioningClients/interface/VpspScanHistograms.h index d86d777c46e86..c4b41ce3d3bc2 100644 --- a/DQM/SiStripCommissioningClients/interface/VpspScanHistograms.h +++ b/DQM/SiStripCommissioningClients/interface/VpspScanHistograms.h @@ -6,18 +6,13 @@ class DQMStore; class VpspScanHistograms : public virtual CommissioningHistograms { - - public: - - VpspScanHistograms( const edm::ParameterSet& pset, DQMStore* ); +public: + VpspScanHistograms(const edm::ParameterSet& pset, DQMStore*); ~VpspScanHistograms() override; - - void histoAnalysis( bool debug ) override; - void printAnalyses() override; // override + void histoAnalysis(bool debug) override; + void printAnalyses() override; // override }; -#endif // DQM_SiStripCommissioningClients_VpspScanHistograms_H - - +#endif // DQM_SiStripCommissioningClients_VpspScanHistograms_H diff --git a/DQM/SiStripCommissioningClients/plugins/module.cc b/DQM/SiStripCommissioningClients/plugins/module.cc index 47b30d6ef9fae..96329425e0162 100644 --- a/DQM/SiStripCommissioningClients/plugins/module.cc +++ b/DQM/SiStripCommissioningClients/plugins/module.cc @@ -1,6 +1,4 @@ #include "FWCore/Framework/interface/MakerMacros.h" - #include "DQM/SiStripCommissioningClients/interface/SiStripCommissioningOfflineClient.h" DEFINE_FWK_MODULE(SiStripCommissioningOfflineClient); - diff --git a/DQM/SiStripCommissioningClients/src/ApvTimingHistograms.cc b/DQM/SiStripCommissioningClients/src/ApvTimingHistograms.cc index a1061345e2291..25563bef68c8b 100644 --- a/DQM/SiStripCommissioningClients/src/ApvTimingHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/ApvTimingHistograms.cc @@ -9,191 +9,160 @@ #include #include #include - + using namespace std; using namespace sistrip; // ----------------------------------------------------------------------------- /** */ -ApvTimingHistograms::ApvTimingHistograms( const edm::ParameterSet& pset, - DQMStore* bei ) - : CommissioningHistograms( pset.getParameter("ApvTimingParameters"), - bei, - sistrip::APV_TIMING ) -{ - factory_ = unique_ptr( new ApvTimingSummaryFactory ); - LogTrace(mlDqmClient_) - << "[ApvTimingHistograms::" << __func__ << "]" - << " Constructing object..."; +ApvTimingHistograms::ApvTimingHistograms(const edm::ParameterSet& pset, DQMStore* bei) + : CommissioningHistograms(pset.getParameter("ApvTimingParameters"), bei, sistrip::APV_TIMING) { + factory_ = unique_ptr(new ApvTimingSummaryFactory); + LogTrace(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]" + << " Constructing object..."; } // ----------------------------------------------------------------------------- /** */ ApvTimingHistograms::~ApvTimingHistograms() { - LogTrace(mlDqmClient_) - << "[ApvTimingHistograms::" << __func__ << "]" - << " Destructing object..."; + LogTrace(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]" + << " Destructing object..."; } -// ----------------------------------------------------------------------------- -/** */ -void ApvTimingHistograms::histoAnalysis( bool debug ) { - LogTrace(mlDqmClient_) - << "[ApvTimingHistograms::" << __func__ << "]"; +// ----------------------------------------------------------------------------- +/** */ +void ApvTimingHistograms::histoAnalysis(bool debug) { + LogTrace(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]"; // Some initialisation uint16_t valid = 0; HistosMap::const_iterator iter; Analyses::iterator ianal; - std::map errors; - + std::map errors; + // Clear map holding analysis objects - for ( ianal = data().begin(); ianal != data().end(); ianal++ ) { - if ( ianal->second ) { delete ianal->second; } - } + for (ianal = data().begin(); ianal != data().end(); ianal++) { + if (ianal->second) { + delete ianal->second; + } + } data().clear(); - + // Reset minimum / maximum delays - float time_min = 1. * sistrip::invalid_; + float time_min = 1. * sistrip::invalid_; float time_max = -1. * sistrip::invalid_; uint32_t device_min = sistrip::invalid_; uint32_t device_max = sistrip::invalid_; - + // Iterate through map containing histograms - for ( iter = histos().begin(); - iter != histos().end(); iter++ ) { - + for (iter = histos().begin(); iter != histos().end(); iter++) { // Check vector of histos is not empty - if ( iter->second.empty() ) { - edm::LogWarning(mlDqmClient_) - << "[ApvTimingHistograms::" << __func__ << "]" - << " Zero histograms found!"; + if (iter->second.empty()) { + edm::LogWarning(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]" + << " Zero histograms found!"; continue; } - + // Retrieve pointers to histos std::vector profs; - Histos::const_iterator ihis = iter->second.begin(); - for ( ; ihis != iter->second.end(); ihis++ ) { - TProfile* prof = ExtractTObject().extract( (*ihis)->me_ ); - if ( prof ) { profs.push_back(prof); } - } - + Histos::const_iterator ihis = iter->second.begin(); + for (; ihis != iter->second.end(); ihis++) { + TProfile* prof = ExtractTObject().extract((*ihis)->me_); + if (prof) { + profs.push_back(prof); + } + } + // Perform histo analysis - ApvTimingAnalysis* anal = new ApvTimingAnalysis( iter->first ); - ApvTimingAlgorithm algo( this->pset(), anal ); - algo.analysis( profs ); - data()[iter->first] = anal; + ApvTimingAnalysis* anal = new ApvTimingAnalysis(iter->first); + ApvTimingAlgorithm algo(this->pset(), anal); + algo.analysis(profs); + data()[iter->first] = anal; // Check if tick mark found - if ( !anal->foundTickMark() ) { continue; } - + if (!anal->foundTickMark()) { + continue; + } + // Find maximum time - if ( anal->time() > time_max ) { - time_max = anal->time(); + if (anal->time() > time_max) { + time_max = anal->time(); device_max = iter->first; } - + // Find minimum time - if ( anal->time() < time_min ) { - time_min = anal->time(); + if (anal->time() < time_min) { + time_min = anal->time(); device_min = iter->first; } - } - + // Adjust maximum (and minimum) delay(s) to find optimum sampling point(s) - if ( time_max > sistrip::valid_ || - time_max < -1.*sistrip::valid_ ) { - - edm::LogWarning(mlDqmClient_) - << "[ApvTimingHistograms::" << __func__ << "]" - << " Unable to set maximum time! Found unexpected value: " - << time_max; - + if (time_max > sistrip::valid_ || time_max < -1. * sistrip::valid_) { + edm::LogWarning(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]" + << " Unable to set maximum time! Found unexpected value: " << time_max; + } else { - - SiStripFecKey min( device_min ); - edm::LogVerbatim(mlDqmClient_) - << "[ApvTimingHistograms::" << __func__ << "]" - << " Crate/FEC/Ring/CCU/module/channel: " - << min.fecCrate() << "/" - << min.fecSlot() << "/" - << min.fecRing() << "/" - << min.ccuAddr() << "/" - << min.ccuChan() << "/" - << min.lldChan() - << " has minimum time for tick mark rising edge [ns]: " << time_min; - - SiStripFecKey max( device_max ); - edm::LogVerbatim(mlDqmClient_) - << "[ApvTimingHistograms::" << __func__ << "]" - << " Crate/FEC/Ring/CCU/module/channel: " - << max.fecCrate() << "/" - << max.fecSlot() << "/" - << max.fecRing() << "/" - << max.ccuAddr() << "/" - << max.ccuChan() << "/" - << max.lldChan() - << " has maximum time for tick mark rising edge [ns]: " << time_max; - - edm::LogVerbatim(mlDqmClient_) - << "[ApvTimingHistograms::" << __func__ << "]" - << " Difference b/w minimum and maximum times" - << " for tick mark rising edges [ns] is: " << ( time_max - time_min ); + SiStripFecKey min(device_min); + edm::LogVerbatim(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]" + << " Crate/FEC/Ring/CCU/module/channel: " << min.fecCrate() << "/" << min.fecSlot() + << "/" << min.fecRing() << "/" << min.ccuAddr() << "/" << min.ccuChan() << "/" + << min.lldChan() << " has minimum time for tick mark rising edge [ns]: " << time_min; + SiStripFecKey max(device_max); + edm::LogVerbatim(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]" + << " Crate/FEC/Ring/CCU/module/channel: " << max.fecCrate() << "/" << max.fecSlot() + << "/" << max.fecRing() << "/" << max.ccuAddr() << "/" << max.ccuChan() << "/" + << max.lldChan() << " has maximum time for tick mark rising edge [ns]: " << time_max; + + edm::LogVerbatim(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]" + << " Difference b/w minimum and maximum times" + << " for tick mark rising edges [ns] is: " << (time_max - time_min); } - + // Set reference time for all analysis objects - for ( ianal = data().begin(); ianal != data().end(); ianal++ ) { + for (ianal = data().begin(); ianal != data().end(); ianal++) { ApvTimingAnalysis* anal = dynamic_cast(ianal->second); - if ( !anal ) { continue; } - anal->refTime( time_max, this->pset().getParameter("TargetDelay") ); - if ( anal->isValid() ) { valid++; } - if ( !anal->getErrorCodes().empty() ) { + if (!anal) { + continue; + } + anal->refTime(time_max, this->pset().getParameter("TargetDelay")); + if (anal->isValid()) { + valid++; + } + if (!anal->getErrorCodes().empty()) { errors[anal->getErrorCodes()[0]]++; } } - if ( !histos().empty() ) { - edm::LogVerbatim(mlDqmClient_) - << "[ApvTimingHistograms::" << __func__ << "]" - << " Analyzed histograms for " << histos().size() - << " FED channels, of which " << valid - << " (" << 100 * valid / histos().size() - << "%) are valid."; + if (!histos().empty()) { + edm::LogVerbatim(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]" + << " Analyzed histograms for " << histos().size() << " FED channels, of which " + << valid << " (" << 100 * valid / histos().size() << "%) are valid."; } else { - edm::LogWarning(mlDqmClient_) - << "[ApvTimingHistograms::" << __func__ << "]" - << " No histograms to analyze!"; + edm::LogWarning(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]" + << " No histograms to analyze!"; } - if ( !histos().empty() ) { - edm::LogVerbatim(mlDqmClient_) - << "[ApvTimingHistograms::" << __func__ << "]" - << " Analyzed histograms for " << histos().size() - << " FED channels, of which " << valid - << " (" << 100 * valid / histos().size() - << "%) are valid."; - if ( !errors.empty() ) { + if (!histos().empty()) { + edm::LogVerbatim(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]" + << " Analyzed histograms for " << histos().size() << " FED channels, of which " + << valid << " (" << 100 * valid / histos().size() << "%) are valid."; + if (!errors.empty()) { uint16_t count = 0; std::stringstream ss; ss << std::endl; - std::map::const_iterator ii; - for ( ii = errors.begin(); ii != errors.end(); ++ii ) { - ss << " " << ii->first << ": " << ii->second << std::endl; - count += ii->second; + std::map::const_iterator ii; + for (ii = errors.begin(); ii != errors.end(); ++ii) { + ss << " " << ii->first << ": " << ii->second << std::endl; + count += ii->second; } - edm::LogWarning(mlDqmClient_) - << "[ApvTimingHistograms::" << __func__ << "]" - << " Found " << count << " errors (" - << 100 * count / histos().size() << "%): " - << ss.str(); + edm::LogWarning(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]" + << " Found " << count << " errors (" << 100 * count / histos().size() + << "%): " << ss.str(); } } else { - edm::LogWarning(mlDqmClient_) - << "[ApvTimingHistograms::" << __func__ << "]" - << " No histograms to analyze!"; + edm::LogWarning(mlDqmClient_) << "[ApvTimingHistograms::" << __func__ << "]" + << " No histograms to analyze!"; } - } diff --git a/DQM/SiStripCommissioningClients/src/CalibrationHistograms.cc b/DQM/SiStripCommissioningClients/src/CalibrationHistograms.cc index 225721d66060e..d935b6abc0455 100644 --- a/DQM/SiStripCommissioningClients/src/CalibrationHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/CalibrationHistograms.cc @@ -23,91 +23,90 @@ using namespace sistrip; // ----------------------------------------------------------------------------- /** */ -CalibrationHistograms::CalibrationHistograms( const edm::ParameterSet& pset, - DQMStore* bei, - const sistrip::RunType& task ) - : CommissioningHistograms(pset.getParameter("CalibrationParameters"),bei,task){ - - LogTrace(mlDqmClient_) - << "[CalibrationHistograms::" << __func__ << "]" - << " Constructing object..."; - - if(task == sistrip::CALIBRATION_SCAN or task == sistrip::CALIBRATION_SCAN_DECO) - factory_ = auto_ptr( new CalibrationScanSummaryFactory ); - else - factory_ = auto_ptr( new CalibrationSummaryFactory ); +CalibrationHistograms::CalibrationHistograms(const edm::ParameterSet& pset, DQMStore* bei, const sistrip::RunType& task) + : CommissioningHistograms(pset.getParameter("CalibrationParameters"), bei, task) { + LogTrace(mlDqmClient_) << "[CalibrationHistograms::" << __func__ << "]" + << " Constructing object..."; - targetRiseTime_ = this->pset().existsAs("targetRiseTime") ? this->pset().getParameter("targetRiseTime") : 50; - targetDecayTime_ = this->pset().existsAs("targetDecayTime") ? this->pset().getParameter("targetDecayTime") : 125; - tuneSimultaneously_ = this->pset().existsAs("tuneSimultaneously") ? this->pset().getParameter("tuneSimultaneously") : false; + if (task == sistrip::CALIBRATION_SCAN or task == sistrip::CALIBRATION_SCAN_DECO) + factory_ = auto_ptr(new CalibrationScanSummaryFactory); + else + factory_ = auto_ptr(new CalibrationSummaryFactory); + + targetRiseTime_ = + this->pset().existsAs("targetRiseTime") ? this->pset().getParameter("targetRiseTime") : 50; + targetDecayTime_ = + this->pset().existsAs("targetDecayTime") ? this->pset().getParameter("targetDecayTime") : 125; + tuneSimultaneously_ = + this->pset().existsAs("tuneSimultaneously") ? this->pset().getParameter("tuneSimultaneously") : false; } // ----------------------------------------------------------------------------- /** */ CalibrationHistograms::~CalibrationHistograms() { - LogTrace(mlDqmClient_) - << "[CalibrationHistograms::" << __func__ << "]" - << " Deleting object..."; + LogTrace(mlDqmClient_) << "[CalibrationHistograms::" << __func__ << "]" + << " Deleting object..."; } -// ----------------------------------------------------------------------------- -/** */ -void CalibrationHistograms::histoAnalysis( bool debug ) { - +// ----------------------------------------------------------------------------- +/** */ +void CalibrationHistograms::histoAnalysis(bool debug) { // Clear map holding analysis objects Analyses::iterator ianal; - for ( ianal = data().begin(); ianal != data().end(); ianal++ ) { - if ( ianal->second ) { delete ianal->second; } + for (ianal = data().begin(); ianal != data().end(); ianal++) { + if (ianal->second) { + delete ianal->second; + } } data().clear(); - + // Iterate through map containing vectors of profile histograms HistosMap::const_iterator iter = histos().begin(); // One entry for each LLD channel --> differnt thousand entries - for ( ; iter != histos().end(); iter++ ) { - if ( iter->second.empty() ) { - edm::LogWarning(mlDqmClient_) - << "[CalibrationHistograms::" << __func__ << "]" - << " Zero collation histograms found!"; + for (; iter != histos().end(); iter++) { + if (iter->second.empty()) { + edm::LogWarning(mlDqmClient_) << "[CalibrationHistograms::" << __func__ << "]" + << " Zero collation histograms found!"; continue; } - + // Retrieve pointers to 1D histos for this FED channel --> all strips in the fiber = 256 vector profs; Histos::const_iterator ihis = iter->second.begin(); - for ( ; ihis != iter->second.end(); ihis++ ) { - TH1F* prof = ExtractTObject().extract( (*ihis)->me_ ); - if ( prof ) { profs.push_back(prof); } - } - - // Perform histo analysis + for (; ihis != iter->second.end(); ihis++) { + TH1F* prof = ExtractTObject().extract((*ihis)->me_); + if (prof) { + profs.push_back(prof); + } + } + + // Perform histo analysis bool isdeconv = false; - if(task() == sistrip::CALIBRATION_DECO or task() == sistrip::CALIBRATION_SCAN_DECO) + if (task() == sistrip::CALIBRATION_DECO or task() == sistrip::CALIBRATION_SCAN_DECO) isdeconv = true; - if(task() == sistrip::CALIBRATION_SCAN or task() == sistrip::CALIBRATION_SCAN_DECO){ - CalibrationScanAnalysis* anal = new CalibrationScanAnalysis(iter->first,isdeconv); - CalibrationScanAlgorithm algo( this->pset(), anal ); - algo.analysis( profs ); - data()[iter->first] = anal; + if (task() == sistrip::CALIBRATION_SCAN or task() == sistrip::CALIBRATION_SCAN_DECO) { + CalibrationScanAnalysis* anal = new CalibrationScanAnalysis(iter->first, isdeconv); + CalibrationScanAlgorithm algo(this->pset(), anal); + algo.analysis(profs); + data()[iter->first] = anal; // tune the parameters for this a given target - for(int iapv = 0; iapv < 2; iapv++){ - if(tuneSimultaneously_) - algo.tuneSimultaneously(iapv,targetRiseTime_,targetDecayTime_); - else - algo.tuneIndependently(iapv,targetRiseTime_,targetDecayTime_); - algo.fillTunedObservables(iapv); - } + for (int iapv = 0; iapv < 2; iapv++) { + if (tuneSimultaneously_) + algo.tuneSimultaneously(iapv, targetRiseTime_, targetDecayTime_); + else + algo.tuneIndependently(iapv, targetRiseTime_, targetDecayTime_); + algo.fillTunedObservables(iapv); + } + } else { + CalibrationAnalysis* anal = new CalibrationAnalysis(iter->first, isdeconv); + CalibrationAlgorithm algo(this->pset(), anal); + algo.analysis(profs); + data()[iter->first] = anal; } - else{ - CalibrationAnalysis* anal = new CalibrationAnalysis( iter->first,isdeconv); - CalibrationAlgorithm algo( this->pset(), anal ); - algo.analysis( profs ); - data()[iter->first] = anal; - } - } + } } // ----------------------------------------------------------------------------- @@ -115,127 +114,122 @@ void CalibrationHistograms::histoAnalysis( bool debug ) { void CalibrationHistograms::printAnalyses() { Analyses::iterator ianal = data().begin(); Analyses::iterator janal = data().end(); - for ( ; ianal != janal; ++ianal ) { - if ( ianal->second ) { + for (; ianal != janal; ++ianal) { + if (ianal->second) { std::stringstream ss; - ianal->second->print( ss,0 ); - ianal->second->print( ss,1 ); - if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str(); - } else { edm::LogWarning(mlDqmClient_) << ss.str(); } + ianal->second->print(ss, 0); + ianal->second->print(ss, 1); + if (ianal->second->isValid()) { + LogTrace(mlDqmClient_) << ss.str(); + } else { + edm::LogWarning(mlDqmClient_) << ss.str(); + } } } } - -//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- /** */ -void CalibrationHistograms::save( std::string& path, - uint32_t run_number, - std::string partitionName) { - - // Construct path and filename +void CalibrationHistograms::save(std::string& path, uint32_t run_number, std::string partitionName) { + // Construct path and filename std::stringstream ss; - if ( !path.empty() ) { // create with a specific outputName + if (!path.empty()) { // create with a specific outputName ss << path; - if ( ss.str().find(".root") == std::string::npos ) { ss << ".root"; } + if (ss.str().find(".root") == std::string::npos) { + ss << ".root"; + } } else { - - // Retrieve SCRATCH directory + // Retrieve SCRATCH directory std::string scratch = "SCRATCH"; std::string dir = ""; - if ( getenv(scratch.c_str()) != nullptr ) { + if (getenv(scratch.c_str()) != nullptr) { dir = getenv(scratch.c_str()); } - // Add directory path - if ( !dir.empty() ) { ss << dir << "/"; } - else { ss << "/tmp/"; } + // Add directory path + if (!dir.empty()) { + ss << dir << "/"; + } else { + ss << "/tmp/"; + } - // Add filename with run number and ".root" extension - if(partitionName.empty()) - ss << sistrip::dqmClientFileName_ << "_" - << std::setfill('0') << std::setw(8) << run_number - << ".root"; + // Add filename with run number and ".root" extension + if (partitionName.empty()) + ss << sistrip::dqmClientFileName_ << "_" << std::setfill('0') << std::setw(8) << run_number << ".root"; else - ss << sistrip::dqmClientFileName_ << "_" << partitionName << "_" - << std::setfill('0') << std::setw(8) << run_number - << ".root"; + ss << sistrip::dqmClientFileName_ << "_" << partitionName << "_" << std::setfill('0') << std::setw(8) + << run_number << ".root"; } - - // Save file with appropriate filename - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Saving histograms to root file" - << " (This may take some time!)"; + + // Save file with appropriate filename + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Saving histograms to root file" + << " (This may take some time!)"; path = ss.str(); - bei()->save( path, sistrip::collate_ ); - edm::LogVerbatim(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Saved histograms to root file \"" - << ss.str() << "\"!"; - - // In case of calibration-scan, add also the TGraphs - // re-open the file - TFile* outputFile = TFile::Open(path.c_str(),"UPDATE"); + bei()->save(path, sistrip::collate_); + edm::LogVerbatim(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Saved histograms to root file \"" << ss.str() << "\"!"; + + // In case of calibration-scan, add also the TGraphs + // re-open the file + TFile* outputFile = TFile::Open(path.c_str(), "UPDATE"); outputFile->cd(); - - // get all sub-dirs + + // get all sub-dirs std::vector contents; - bei()->getContents( contents ); + bei()->getContents(contents); + + TMultiGraph* graph_isha = new TMultiGraph("riseTime_vs_isha", ""); + TMultiGraph* graph_vfs = new TMultiGraph("decayTime_vs_vfs", ""); - TMultiGraph* graph_isha = new TMultiGraph("riseTime_vs_isha",""); - TMultiGraph* graph_vfs = new TMultiGraph("decayTime_vs_vfs",""); - bool save_graph_isha = false; - bool save_graph_vfs = false; - - // loop on the analysis objects which are storing all relevant results + bool save_graph_vfs = false; + + // loop on the analysis objects which are storing all relevant results Analyses::iterator ianal = data().begin(); Analyses::iterator janal = data().end(); - for ( ; ianal != janal; ++ianal ) { - if ( ianal->second ) { - - CalibrationScanAnalysis* anal = dynamic_cast (ianal->second); + for (; ianal != janal; ++ianal) { + if (ianal->second) { + CalibrationScanAnalysis* anal = dynamic_cast(ianal->second); SiStripFecKey feckey = anal->fecKey(); TString directory; - for(auto content : contents){ - std::vector tokens; - std::string token; - std::istringstream tokenStream(content); - while (std::getline(tokenStream, token,':')){ - tokens.push_back(token); - } - directory = Form("%s",tokens.at(0).c_str()); - if(directory.Contains(Form("FecCrate%d",feckey.fecCrate())) and - directory.Contains(Form("FecRing%d",feckey.fecRing())) and - directory.Contains(Form("FecSlot%d",feckey.fecSlot())) and - directory.Contains(Form("CcuAddr%d",feckey.ccuAddr())) and - directory.Contains(Form("CcuChan%d",feckey.ccuChan()))) - break; + for (auto content : contents) { + std::vector tokens; + std::string token; + std::istringstream tokenStream(content); + while (std::getline(tokenStream, token, ':')) { + tokens.push_back(token); + } + directory = Form("%s", tokens.at(0).c_str()); + if (directory.Contains(Form("FecCrate%d", feckey.fecCrate())) and + directory.Contains(Form("FecRing%d", feckey.fecRing())) and + directory.Contains(Form("FecSlot%d", feckey.fecSlot())) and + directory.Contains(Form("CcuAddr%d", feckey.ccuAddr())) and + directory.Contains(Form("CcuChan%d", feckey.ccuChan()))) + break; } - - outputFile->cd("DQMData/"+directory); - for(size_t igraph = 0 ; igraph < anal->decayTimeVsVFS().size(); igraph++){ - graph_vfs->Add(anal->decayTimeVsVFS()[igraph]); - anal->decayTimeVsVFS()[igraph]->Write(); - save_graph_vfs = true; - } + outputFile->cd("DQMData/" + directory); - for(size_t igraph = 0 ; igraph < anal->riseTimeVsISHA().size(); igraph++){ - graph_isha->Add(anal->riseTimeVsISHA()[igraph]); - anal->riseTimeVsISHA()[igraph]->Write(); - save_graph_isha = true; - } + for (size_t igraph = 0; igraph < anal->decayTimeVsVFS().size(); igraph++) { + graph_vfs->Add(anal->decayTimeVsVFS()[igraph]); + anal->decayTimeVsVFS()[igraph]->Write(); + save_graph_vfs = true; + } - for(size_t igraph = 0 ; igraph < anal->riseTimeVsISHAVsVFS().size(); igraph++) - anal->riseTimeVsISHAVsVFS()[igraph]->Write(); + for (size_t igraph = 0; igraph < anal->riseTimeVsISHA().size(); igraph++) { + graph_isha->Add(anal->riseTimeVsISHA()[igraph]); + anal->riseTimeVsISHA()[igraph]->Write(); + save_graph_isha = true; + } + for (size_t igraph = 0; igraph < anal->riseTimeVsISHAVsVFS().size(); igraph++) + anal->riseTimeVsISHAVsVFS()[igraph]->Write(); - for(size_t igraph = 0 ; igraph < anal->decayTimeVsISHAVsVFS().size(); igraph++) - anal->decayTimeVsISHAVsVFS()[igraph]->Write(); + for (size_t igraph = 0; igraph < anal->decayTimeVsISHAVsVFS().size(); igraph++) + anal->decayTimeVsISHAVsVFS()[igraph]->Write(); outputFile->cd(); } @@ -244,11 +238,10 @@ void CalibrationHistograms::save( std::string& path, outputFile->cd(); outputFile->cd("DQMData/Collate/SiStrip/ControlView"); - - if(save_graph_isha) + if (save_graph_isha) graph_isha->Write("riseTime_vs_isha"); - if(save_graph_vfs) + if (save_graph_vfs) graph_vfs->Write("decayTime_vs_vfs"); outputFile->Close(); -} +} diff --git a/DQM/SiStripCommissioningClients/src/CommissioningHistograms.cc b/DQM/SiStripCommissioningClients/src/CommissioningHistograms.cc index 6ee1d1d39cdd7..6c1e40ff2fe9a 100644 --- a/DQM/SiStripCommissioningClients/src/CommissioningHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/CommissioningHistograms.cc @@ -11,302 +11,279 @@ using namespace std; using namespace sistrip; - // ----------------------------------------------------------------------------- /** */ -CommissioningHistograms::CommissioningHistograms( const edm::ParameterSet& pset, - DQMStore* bei, - const sistrip::RunType& task ) - : factory_(nullptr), - task_(task), - bei_(bei), - data_(), - histos_(), - pset_(pset), - mask_(pset.existsAs("vetoModules")?pset.getParameter("vetoModules"):true), - fedMaskVector_(pset.existsAs >("fedMaskVector")?pset.getParameter >("fedMaskVector"):std::vector()), - fecMaskVector_(pset.existsAs >("fecMaskVector")?pset.getParameter >("fecMaskVector"):std::vector()), - ringVector_(pset.existsAs >("ringVector")?pset.getParameter >("ringVector"):std::vector()), - ccuVector_(pset.existsAs >("ccuVector")?pset.getParameter >("ccuVector"):std::vector()), - i2cChanVector_(pset.existsAs >("i2cChanVector")?pset.getParameter >("i2cChanVector"):std::vector()), - lldChanVector_(pset.existsAs >("lldChanVector")?pset.getParameter >("lldChanVector"):std::vector()), - dataWithMask_(), - dataWithMaskCached_(false) -{ - LogTrace(mlDqmClient_) - << "[" << __PRETTY_FUNCTION__ << "]" - << " Constructing object..."; +CommissioningHistograms::CommissioningHistograms(const edm::ParameterSet& pset, + DQMStore* bei, + const sistrip::RunType& task) + : factory_(nullptr), + task_(task), + bei_(bei), + data_(), + histos_(), + pset_(pset), + mask_(pset.existsAs("vetoModules") ? pset.getParameter("vetoModules") : true), + fedMaskVector_(pset.existsAs >("fedMaskVector") + ? pset.getParameter >("fedMaskVector") + : std::vector()), + fecMaskVector_(pset.existsAs >("fecMaskVector") + ? pset.getParameter >("fecMaskVector") + : std::vector()), + ringVector_(pset.existsAs >("ringVector") + ? pset.getParameter >("ringVector") + : std::vector()), + ccuVector_(pset.existsAs >("ccuVector") + ? pset.getParameter >("ccuVector") + : std::vector()), + i2cChanVector_(pset.existsAs >("i2cChanVector") + ? pset.getParameter >("i2cChanVector") + : std::vector()), + lldChanVector_(pset.existsAs >("lldChanVector") + ? pset.getParameter >("lldChanVector") + : std::vector()), + dataWithMask_(), + dataWithMaskCached_(false) { + LogTrace(mlDqmClient_) << "[" << __PRETTY_FUNCTION__ << "]" + << " Constructing object..."; // DQMStore - if ( !bei_ ) { - edm::LogError(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " NULL pointer to DQMStore!"; + if (!bei_) { + edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " NULL pointer to DQMStore!"; } - + clearHistosMap(); } // ----------------------------------------------------------------------------- /** */ -CommissioningHistograms::CommissioningHistograms() - : factory_(nullptr), - task_(sistrip::UNDEFINED_RUN_TYPE), - bei_(nullptr), - data_(), - histos_(), - mask_(true), - dataWithMask_(), - dataWithMaskCached_(false){ - - LogTrace(mlDqmClient_) - << "[" << __PRETTY_FUNCTION__ << "]" - << " Constructing object..."; +CommissioningHistograms::CommissioningHistograms() + : factory_(nullptr), + task_(sistrip::UNDEFINED_RUN_TYPE), + bei_(nullptr), + data_(), + histos_(), + mask_(true), + dataWithMask_(), + dataWithMaskCached_(false) { + LogTrace(mlDqmClient_) << "[" << __PRETTY_FUNCTION__ << "]" + << " Constructing object..."; } // ----------------------------------------------------------------------------- /** */ CommissioningHistograms::~CommissioningHistograms() { - LogTrace(mlDqmClient_) - << "[" << __PRETTY_FUNCTION__ << "]" - << " Destructing object..."; + LogTrace(mlDqmClient_) << "[" << __PRETTY_FUNCTION__ << "]" + << " Destructing object..."; clearHistosMap(); //@@ do not delete BEI ptrs! } // ----------------------------------------------------------------------------- /** */ -void CommissioningHistograms::Histo::print( std::stringstream& ss ) const { +void CommissioningHistograms::Histo::print(std::stringstream& ss) const { ss << " [Histo::" << __func__ << "]" << std::endl << " Histogram title : " << title_ << std::endl - << " MonitorElement* : 0x" - << std::hex - << std::setw(8) << std::setfill('0') << me_ << std::endl - << std::dec - << " CollateME* : 0x" - << std::hex - << std::setw(8) << std::setfill('0') << cme_ << std::endl + << " MonitorElement* : 0x" << std::hex << std::setw(8) << std::setfill('0') << me_ << std::endl + << std::dec << " CollateME* : 0x" << std::hex << std::setw(8) << std::setfill('0') << cme_ << std::endl << std::dec; } // ----------------------------------------------------------------------------- // -uint32_t CommissioningHistograms::runNumber( DQMStore* const bei, - const std::vector& contents ) { - +uint32_t CommissioningHistograms::runNumber(DQMStore* const bei, const std::vector& contents) { // Check if histograms present - if ( contents.empty() ) { - edm::LogError(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Found no histograms!"; - return 0; + if (contents.empty()) { + edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Found no histograms!"; + return 0; } - + // Iterate through added contents std::vector::const_iterator istr = contents.begin(); - while ( istr != contents.end() ) { - - // Extract source directory path - std::string source_dir = istr->substr( 0, istr->find(":") ); - + while (istr != contents.end()) { + // Extract source directory path + std::string source_dir = istr->substr(0, istr->find(":")); + // Generate corresponding client path (removing trailing "/") - SiStripFecKey path( source_dir ); + SiStripFecKey path(source_dir); std::string client_dir = path.path(); - std::string slash = client_dir.substr( client_dir.size()-1, 1 ); - if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); } + std::string slash = client_dir.substr(client_dir.size() - 1, 1); + if (slash == sistrip::dir_) { + client_dir = client_dir.substr(0, client_dir.size() - 1); + } client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir; - + // Iterate though MonitorElements from source directory - std::vector me_list = bei->getContents( source_dir ); - std::vector::iterator ime = me_list.begin(); - for ( ; ime != me_list.end(); ime++ ) { - - if ( !(*ime) ) { - edm::LogError(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " NULL pointer to MonitorElement!"; - continue; + std::vector me_list = bei->getContents(source_dir); + std::vector::iterator ime = me_list.begin(); + for (; ime != me_list.end(); ime++) { + if (!(*ime)) { + edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " NULL pointer to MonitorElement!"; + continue; } // Search for run type in string std::string title = (*ime)->getName(); - std::string::size_type pos = title.find( sistrip::runNumber_ ); - - // Extract run number from string - if ( pos != std::string::npos ) { - std::string value = title.substr( pos+sizeof(sistrip::runNumber_) , std::string::npos ); - if ( !value.empty() ) { - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Found string \"" << title.substr(pos,std::string::npos) - << "\" with value \"" << value << "\""; - if ( !(bei->get(client_dir+"/"+title.substr(pos,std::string::npos))) ) { - bei->setCurrentFolder(client_dir); - bei->bookString( title.substr(pos,std::string::npos), value ); - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Booked string \"" << title.substr(pos,std::string::npos) - << "\" in directory \"" << client_dir << "\""; - } - uint32_t run; - std::stringstream ss; - ss << value; - ss >> std::dec >> run; - return run; - } + std::string::size_type pos = title.find(sistrip::runNumber_); + + // Extract run number from string + if (pos != std::string::npos) { + std::string value = title.substr(pos + sizeof(sistrip::runNumber_), std::string::npos); + if (!value.empty()) { + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Found string \"" << title.substr(pos, std::string::npos) << "\" with value \"" + << value << "\""; + if (!(bei->get(client_dir + "/" + title.substr(pos, std::string::npos)))) { + bei->setCurrentFolder(client_dir); + bei->bookString(title.substr(pos, std::string::npos), value); + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Booked string \"" << title.substr(pos, std::string::npos) + << "\" in directory \"" << client_dir << "\""; + } + uint32_t run; + std::stringstream ss; + ss << value; + ss >> std::dec >> run; + return run; + } } - } istr++; - } return 0; } // ----------------------------------------------------------------------------- /** Extract run type string from "added contents". */ -sistrip::RunType CommissioningHistograms::runType( DQMStore* const bei, - const std::vector& contents ) { - +sistrip::RunType CommissioningHistograms::runType(DQMStore* const bei, const std::vector& contents) { // Check if histograms present - if ( contents.empty() ) { - edm::LogError(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Found no histograms!"; - return sistrip::UNKNOWN_RUN_TYPE; + if (contents.empty()) { + edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Found no histograms!"; + return sistrip::UNKNOWN_RUN_TYPE; } - + // Iterate through added contents std::vector::const_iterator istr = contents.begin(); - while ( istr != contents.end() ) { - - // Extract source directory path - std::string source_dir = istr->substr( 0, istr->find(":") ); + while (istr != contents.end()) { + // Extract source directory path + std::string source_dir = istr->substr(0, istr->find(":")); // Generate corresponding client path (removing trailing "/") - SiStripFecKey path( source_dir ); + SiStripFecKey path(source_dir); std::string client_dir = path.path(); - std::string slash = client_dir.substr( client_dir.size()-1, 1 ); - if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); } + std::string slash = client_dir.substr(client_dir.size() - 1, 1); + if (slash == sistrip::dir_) { + client_dir = client_dir.substr(0, client_dir.size() - 1); + } client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir; - + // Iterate though MonitorElements from source directory - std::vector me_list = bei->getContents( source_dir ); + std::vector me_list = bei->getContents(source_dir); - if ( me_list.empty() ) { - edm::LogError(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " No MonitorElements found in dir " << source_dir; + if (me_list.empty()) { + edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " No MonitorElements found in dir " << source_dir; return sistrip::UNKNOWN_RUN_TYPE; } - std::vector::iterator ime = me_list.begin(); - for ( ; ime != me_list.end(); ime++ ) { - - if ( !(*ime) ) { - edm::LogError(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " NULL pointer to MonitorElement!"; - continue; + std::vector::iterator ime = me_list.begin(); + for (; ime != me_list.end(); ime++) { + if (!(*ime)) { + edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " NULL pointer to MonitorElement!"; + continue; } // Search for run type in string std::string title = (*ime)->getName(); - std::string::size_type pos = title.find( sistrip::taskId_ ); - - // Extract commissioning task from string - if ( pos != std::string::npos ) { - std::string value = title.substr( pos+sizeof(sistrip::taskId_) , std::string::npos ); - if ( !value.empty() ) { - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Found string \"" << title.substr(pos,std::string::npos) - << "\" with value \"" << value << "\""; - if ( !(bei->get(client_dir+sistrip::dir_+title.substr(pos,std::string::npos))) ) { - bei->setCurrentFolder(client_dir); - bei->bookString( title.substr(pos,std::string::npos), value ); - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Booked string \"" << title.substr(pos,std::string::npos) - << "\" in directory \"" << client_dir << "\""; - } - return SiStripEnumsAndStrings::runType( value ); - } + std::string::size_type pos = title.find(sistrip::taskId_); + + // Extract commissioning task from string + if (pos != std::string::npos) { + std::string value = title.substr(pos + sizeof(sistrip::taskId_), std::string::npos); + if (!value.empty()) { + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Found string \"" << title.substr(pos, std::string::npos) << "\" with value \"" + << value << "\""; + if (!(bei->get(client_dir + sistrip::dir_ + title.substr(pos, std::string::npos)))) { + bei->setCurrentFolder(client_dir); + bei->bookString(title.substr(pos, std::string::npos), value); + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Booked string \"" << title.substr(pos, std::string::npos) + << "\" in directory \"" << client_dir << "\""; + } + return SiStripEnumsAndStrings::runType(value); + } } - } istr++; - } - edm::LogError(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Unable to extract RunType!"; + edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Unable to extract RunType!"; return sistrip::UNKNOWN_RUN_TYPE; - } // ----------------------------------------------------------------------------- // -void CommissioningHistograms::copyCustomInformation( DQMStore* const bei, - const std::vector& contents ) { - +void CommissioningHistograms::copyCustomInformation(DQMStore* const bei, const std::vector& contents) { // Check if histograms present - if ( contents.empty() ) { - edm::LogWarning(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Found no histograms!"; + if (contents.empty()) { + edm::LogWarning(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Found no histograms!"; return; } - + // Iterate through added contents std::vector::const_iterator istr = contents.begin(); - while ( istr != contents.end() ) { - + while (istr != contents.end()) { // Extract source directory path - std::string source_dir = istr->substr( 0, istr->find(":") ); + std::string source_dir = istr->substr(0, istr->find(":")); // Generate corresponding client path (removing trailing "/") - SiStripFecKey path( source_dir ); + SiStripFecKey path(source_dir); std::string client_dir = path.path(); - std::string slash = client_dir.substr( client_dir.size()-1, 1 ); - if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); } + std::string slash = client_dir.substr(client_dir.size() - 1, 1); + if (slash == sistrip::dir_) { + client_dir = client_dir.substr(0, client_dir.size() - 1); + } // Iterate though MonitorElements from source directory - std::vector me_list = bei->getContents( source_dir ); + std::vector me_list = bei->getContents(source_dir); std::vector::iterator ime = me_list.begin(); - for ( ; ime != me_list.end(); ime++ ) { - - if ( !(*ime) ) { - edm::LogWarning(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " NULL pointer to MonitorElement!"; - continue; + for (; ime != me_list.end(); ime++) { + if (!(*ime)) { + edm::LogWarning(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " NULL pointer to MonitorElement!"; + continue; } // Search for calchan, isha or vfs - if((*ime)->kind()==MonitorElement::DQM_KIND_INT) { + if ((*ime)->kind() == MonitorElement::DQM_KIND_INT) { std::string title = (*ime)->getName(); std::string::size_type pos = title.find("calchan"); - if( pos == std::string::npos ) pos = title.find("isha"); - if( pos == std::string::npos ) pos = title.find("vfs"); - if( pos != std::string::npos ) { + if (pos == std::string::npos) + pos = title.find("isha"); + if (pos == std::string::npos) + pos = title.find("vfs"); + if (pos != std::string::npos) { int value = (*ime)->getIntValue(); - if ( value>=0 ) { + if (value >= 0) { edm::LogVerbatim(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Found \"" << title.substr(pos,std::string::npos) - << "\" with value \"" << value << "\""; - if ( !(bei->get(client_dir+"/"+title.substr(pos,std::string::npos))) ) { - bei->setCurrentFolder(client_dir); - bei->bookInt( title.substr(pos,std::string::npos))->Fill(value); - edm::LogVerbatim(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Booked \"" << title.substr(pos,std::string::npos) - << "\" in directory \"" << client_dir << "\""; - } - } + << "[CommissioningHistograms::" << __func__ << "]" + << " Found \"" << title.substr(pos, std::string::npos) << "\" with value \"" << value << "\""; + if (!(bei->get(client_dir + "/" + title.substr(pos, std::string::npos)))) { + bei->setCurrentFolder(client_dir); + bei->bookInt(title.substr(pos, std::string::npos))->Fill(value); + edm::LogVerbatim(mlDqmClient_) + << "[CommissioningHistograms::" << __func__ << "]" + << " Booked \"" << title.substr(pos, std::string::npos) << "\" in directory \"" << client_dir << "\""; + } + } } } } @@ -317,176 +294,171 @@ void CommissioningHistograms::copyCustomInformation( DQMStore* const bei, // ----------------------------------------------------------------------------- /** */ -void CommissioningHistograms::extractHistograms( const std::vector& contents ) { - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Extracting available histograms..."; - +void CommissioningHistograms::extractHistograms(const std::vector& contents) { + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Extracting available histograms..."; + // Check pointer - if ( !bei_ ) { - edm::LogError(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " NULL pointer to DQMStore!"; + if (!bei_) { + edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " NULL pointer to DQMStore!"; return; } - + // Check list of histograms - if ( contents.empty() ) { - edm::LogError(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Empty contents vector!"; - return; + if (contents.empty()) { + edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Empty contents vector!"; + return; } - + // Iterate through list of histograms std::vector::const_iterator idir; - for ( idir = contents.begin(); idir != contents.end(); idir++ ) { - + for (idir = contents.begin(); idir != contents.end(); idir++) { // Ignore "DQM source" directories if looking in client file - if ( idir->find(sistrip::collate_) == std::string::npos ) { continue; } - - // Extract source directory path - std::string source_dir = idir->substr( 0, idir->find(":") ); + if (idir->find(sistrip::collate_) == std::string::npos) { + continue; + } + + // Extract source directory path + std::string source_dir = idir->substr(0, idir->find(":")); // Extract view and create key - sistrip::View view = SiStripEnumsAndStrings::view( source_dir ); + sistrip::View view = SiStripEnumsAndStrings::view(source_dir); SiStripKey path; - if ( view == sistrip::CONTROL_VIEW ) { path = SiStripFecKey( source_dir ); } - else if ( view == sistrip::READOUT_VIEW ) { path = SiStripFedKey( source_dir ); } - else if ( view == sistrip::DETECTOR_VIEW ) { path = SiStripDetKey( source_dir ); } - else { path = SiStripKey(); } - + if (view == sistrip::CONTROL_VIEW) { + path = SiStripFecKey(source_dir); + } else if (view == sistrip::READOUT_VIEW) { + path = SiStripFedKey(source_dir); + } else if (view == sistrip::DETECTOR_VIEW) { + path = SiStripDetKey(source_dir); + } else { + path = SiStripKey(); + } + // Check path is valid - if ( path.granularity() == sistrip::UNKNOWN_GRAN || - path.granularity() == sistrip::UNDEFINED_GRAN ) { - continue; + if (path.granularity() == sistrip::UNKNOWN_GRAN || path.granularity() == sistrip::UNDEFINED_GRAN) { + continue; } - + // Generate corresponding client path (removing trailing "/") std::string client_dir(sistrip::undefinedView_); - if ( view == sistrip::CONTROL_VIEW ) { client_dir = SiStripFecKey( path.key() ).path(); } - else if ( view == sistrip::READOUT_VIEW ) { client_dir = SiStripFedKey( path.key() ).path(); } - else if ( view == sistrip::DETECTOR_VIEW ) { client_dir = SiStripDetKey( path.key() ).path(); } - else { client_dir = SiStripKey( path.key() ).path(); } - std::string slash = client_dir.substr( client_dir.size()-1, 1 ); - if ( slash == sistrip::dir_ ) { client_dir = client_dir.substr( 0, client_dir.size()-1 ); } + if (view == sistrip::CONTROL_VIEW) { + client_dir = SiStripFecKey(path.key()).path(); + } else if (view == sistrip::READOUT_VIEW) { + client_dir = SiStripFedKey(path.key()).path(); + } else if (view == sistrip::DETECTOR_VIEW) { + client_dir = SiStripDetKey(path.key()).path(); + } else { + client_dir = SiStripKey(path.key()).path(); + } + std::string slash = client_dir.substr(client_dir.size() - 1, 1); + if (slash == sistrip::dir_) { + client_dir = client_dir.substr(0, client_dir.size() - 1); + } client_dir = std::string(sistrip::collate_) + sistrip::dir_ + client_dir; // Retrieve MonitorElements from source directory - std::vector me_list = bei_->getContents( source_dir ); + std::vector me_list = bei_->getContents(source_dir); // Iterate though MonitorElements and create CMEs - std::vector::iterator ime = me_list.begin(); - for ( ; ime != me_list.end(); ime++ ) { - + std::vector::iterator ime = me_list.begin(); + for (; ime != me_list.end(); ime++) { // Retrieve histogram title - SiStripHistoTitle title( (*ime)->getName() ); + SiStripHistoTitle title((*ime)->getName()); // Check histogram type //if ( title.histoType() != sistrip::EXPERT_HISTO ) { continue; } // Check granularity uint16_t channel = sistrip::invalid_; - if ( title.granularity() == sistrip::APV ) { - channel = SiStripFecKey::lldChan( title.channel() ); - } else if ( title.granularity() == sistrip::UNKNOWN_GRAN || - title.granularity() == sistrip::UNDEFINED_GRAN ) { - std::stringstream ss; - ss << "[CommissioningHistograms::" << __func__ << "]" - << " Unexpected granularity for histogram title: " - << std::endl << title - << " found in path " - << std::endl << path; - edm::LogError(mlDqmClient_) << ss.str(); + if (title.granularity() == sistrip::APV) { + channel = SiStripFecKey::lldChan(title.channel()); + } else if (title.granularity() == sistrip::UNKNOWN_GRAN || title.granularity() == sistrip::UNDEFINED_GRAN) { + std::stringstream ss; + ss << "[CommissioningHistograms::" << __func__ << "]" + << " Unexpected granularity for histogram title: " << std::endl + << title << " found in path " << std::endl + << path; + edm::LogError(mlDqmClient_) << ss.str(); } else { - channel = title.channel(); + channel = title.channel(); } - // Build key + // Build key uint32_t key = sistrip::invalid32_; - if ( view == sistrip::CONTROL_VIEW ) { - - // for all runs except cabling - SiStripFecKey temp( path.key() ); - key = SiStripFecKey( temp.fecCrate(), - temp.fecSlot(), - temp.fecRing(), - temp.ccuAddr(), - temp.ccuChan(), - channel ).key(); - mapping_[title.keyValue()] = key; - - } else if ( view == sistrip::READOUT_VIEW ) { - - // for cabling run - key = SiStripFedKey( path.key() ).key(); - uint32_t temp = SiStripFecKey( sistrip::invalid_, - sistrip::invalid_, - sistrip::invalid_, - sistrip::invalid_, - sistrip::invalid_, - channel ).key(); // just record lld channel - mapping_[title.keyValue()] = temp; - - } else if ( view == sistrip::DETECTOR_VIEW ) { - - SiStripDetKey temp( path.key() ); - key = SiStripDetKey( temp.partition() ).key(); - mapping_[title.keyValue()] = key; - - } else { key = SiStripKey( path.key() ).key(); } - + if (view == sistrip::CONTROL_VIEW) { + // for all runs except cabling + SiStripFecKey temp(path.key()); + key = SiStripFecKey(temp.fecCrate(), temp.fecSlot(), temp.fecRing(), temp.ccuAddr(), temp.ccuChan(), channel) + .key(); + mapping_[title.keyValue()] = key; + + } else if (view == sistrip::READOUT_VIEW) { + // for cabling run + key = SiStripFedKey(path.key()).key(); + uint32_t temp = SiStripFecKey(sistrip::invalid_, + sistrip::invalid_, + sistrip::invalid_, + sistrip::invalid_, + sistrip::invalid_, + channel) + .key(); // just record lld channel + mapping_[title.keyValue()] = temp; + + } else if (view == sistrip::DETECTOR_VIEW) { + SiStripDetKey temp(path.key()); + key = SiStripDetKey(temp.partition()).key(); + mapping_[title.keyValue()] = key; + + } else { + key = SiStripKey(path.key()).key(); + } + // Find CME in histos map Histo* histo = nullptr; - HistosMap::iterator ihistos = histos_.find( key ); - if ( ihistos != histos_.end() ) { - Histos::iterator ihis = ihistos->second.begin(); - while ( !histo && ihis < ihistos->second.end() ) { - if ( (*ime)->getName() == (*ihis)->title_ ) { histo = *ihis; } - ihis++; - } + HistosMap::iterator ihistos = histos_.find(key); + if (ihistos != histos_.end()) { + Histos::iterator ihis = ihistos->second.begin(); + while (!histo && ihis < ihistos->second.end()) { + if ((*ime)->getName() == (*ihis)->title_) { + histo = *ihis; + } + ihis++; + } } // Create CollateME if it doesn't exist - if ( !histo ) { - - histos_[key].push_back( new Histo() ); - histo = histos_[key].back(); - histo->title_ = (*ime)->getName(); - - // If histogram present in client directory, add to map - if ( source_dir.find(sistrip::collate_) != std::string::npos ) { - histo->me_ = bei_->get( client_dir +"/"+(*ime)->getName() ); - if ( !histo->me_ ) { - edm::LogError(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " NULL pointer to MonitorElement!"; - } - } - + if (!histo) { + histos_[key].push_back(new Histo()); + histo = histos_[key].back(); + histo->title_ = (*ime)->getName(); + + // If histogram present in client directory, add to map + if (source_dir.find(sistrip::collate_) != std::string::npos) { + histo->me_ = bei_->get(client_dir + "/" + (*ime)->getName()); + if (!histo->me_) { + edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " NULL pointer to MonitorElement!"; + } + } } - } - } - + //printHistosMap(); - - edm::LogVerbatim(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Found histograms for " << histos_.size() - << " structures in cached histogram map!"; - -} + edm::LogVerbatim(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Found histograms for " << histos_.size() + << " structures in cached histogram map!"; +} // ----------------------------------------------------------------------------- /** */ -void CommissioningHistograms::histoAnalysis( bool debug ) { - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " (Derived) implementation to come..."; +void CommissioningHistograms::histoAnalysis(bool debug) { + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " (Derived) implementation to come..."; } // ----------------------------------------------------------------------------- @@ -494,12 +466,15 @@ void CommissioningHistograms::histoAnalysis( bool debug ) { void CommissioningHistograms::printAnalyses() { Analyses::iterator ianal = data().begin(); Analyses::iterator janal = data().end(); - for ( ; ianal != janal; ++ianal ) { - if ( ianal->second ) { + for (; ianal != janal; ++ianal) { + if (ianal->second) { std::stringstream ss; - ianal->second->print( ss ); - if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str(); - } else { edm::LogWarning(mlDqmClient_) << ss.str(); } + ianal->second->print(ss); + if (ianal->second->isValid()) { + LogTrace(mlDqmClient_) << ss.str(); + } else { + edm::LogWarning(mlDqmClient_) << ss.str(); + } } } } @@ -507,50 +482,55 @@ void CommissioningHistograms::printAnalyses() { // ----------------------------------------------------------------------------- /** */ void CommissioningHistograms::printSummary() { - std::stringstream good; std::stringstream bad; - + Analyses::iterator ianal = data().begin(); Analyses::iterator janal = data().end(); - for ( ; ianal != janal; ++ianal ) { - if ( ianal->second ) { - if ( ianal->second->isValid() ) { ianal->second->summary( good ); } - else { ianal->second->summary( bad ); } + for (; ianal != janal; ++ianal) { + if (ianal->second) { + if (ianal->second->isValid()) { + ianal->second->summary(good); + } else { + ianal->second->summary(bad); + } } } - if ( good.str().empty() ) { good << "None found!"; } - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Printing summary of good analyses:" << "\n" - << good.str(); - - if ( bad.str().empty() ) { return; } //@@ bad << "None found!"; } - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Printing summary of bad analyses:" << "\n" - << bad.str(); - + if (good.str().empty()) { + good << "None found!"; + } + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Printing summary of good analyses:" + << "\n" + << good.str(); + + if (bad.str().empty()) { + return; + } //@@ bad << "None found!"; } + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Printing summary of bad analyses:" + << "\n" + << bad.str(); } // ----------------------------------------------------------------------------- /** */ void CommissioningHistograms::printHistosMap() { - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Printing histogram map, which has " - << histos_.size() << " entries..."; + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Printing histogram map, which has " << histos_.size() << " entries..."; HistosMap::const_iterator ihistos = histos_.begin(); - for ( ; ihistos != histos_.end(); ihistos++ ) { + for (; ihistos != histos_.end(); ihistos++) { std::stringstream ss; - ss << " Found " << ihistos->second.size() - << " histogram(s) for key: " << std::endl + ss << " Found " << ihistos->second.size() << " histogram(s) for key: " << std::endl << SiStripFedKey(ihistos->first) << std::endl; Histos::const_iterator ihisto = ihistos->second.begin(); - for ( ; ihisto != ihistos->second.end(); ihisto++ ) { - if ( *ihisto ) { (*ihisto)->print(ss); } - else { ss << " NULL pointer to Histo object!"; } + for (; ihisto != ihistos->second.end(); ihisto++) { + if (*ihisto) { + (*ihisto)->print(ss); + } else { + ss << " NULL pointer to Histo object!"; + } } LogTrace(mlDqmClient_) << ss.str(); } @@ -559,14 +539,15 @@ void CommissioningHistograms::printHistosMap() { // ----------------------------------------------------------------------------- /** */ void CommissioningHistograms::clearHistosMap() { - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Clearing histogram map..."; + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Clearing histogram map..."; HistosMap::iterator ihistos = histos_.begin(); - for ( ; ihistos != histos_.end(); ihistos++ ) { + for (; ihistos != histos_.end(); ihistos++) { Histos::iterator ihisto = ihistos->second.begin(); - for ( ; ihisto != ihistos->second.end(); ihisto++ ) { - if ( *ihisto ) { delete *ihisto; } + for (; ihisto != ihistos->second.end(); ihisto++) { + if (*ihisto) { + delete *ihisto; + } } ihistos->second.clear(); } @@ -575,273 +556,247 @@ void CommissioningHistograms::clearHistosMap() { // ----------------------------------------------------------------------------- /** */ -void CommissioningHistograms::createSummaryHisto( const sistrip::Monitorable& mon, - const sistrip::Presentation& pres, - const std::string& dir, - const sistrip::Granularity& gran ) { - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]"; - - // Check view +void CommissioningHistograms::createSummaryHisto(const sistrip::Monitorable& mon, + const sistrip::Presentation& pres, + const std::string& dir, + const sistrip::Granularity& gran) { + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]"; + + // Check view sistrip::View view = SiStripEnumsAndStrings::view(dir); - if ( view == sistrip::UNKNOWN_VIEW ) { return; } - + if (view == sistrip::UNKNOWN_VIEW) { + return; + } + // Analyze histograms - if ( data().empty() ) { histoAnalysis( false ); } + if (data().empty()) { + histoAnalysis(false); + } // Check - if ( data().empty() ) { - edm::LogError(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " No analyses generated!"; + if (data().empty()) { + edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " No analyses generated!"; return; } - + // Extract data to be histogrammed - uint32_t xbins = factory()->init( mon, pres, view, dir, gran, data() ); - + uint32_t xbins = factory()->init(mon, pres, view, dir, gran, data()); + // Only create histograms if entries are found! - if ( !xbins ) { return; } - + if (!xbins) { + return; + } + // Create summary histogram (if it doesn't already exist) TH1* summary = nullptr; - if ( pres != sistrip::HISTO_1D ) { summary = histogram( mon, pres, view, dir, xbins ); } - else { summary = histogram( mon, pres, view, dir, sistrip::FED_ADC_RANGE, 0., sistrip::FED_ADC_RANGE*1. ); } - + if (pres != sistrip::HISTO_1D) { + summary = histogram(mon, pres, view, dir, xbins); + } else { + summary = histogram(mon, pres, view, dir, sistrip::FED_ADC_RANGE, 0., sistrip::FED_ADC_RANGE * 1.); + } + // Fill histogram with data - factory()->fill( *summary ); - + factory()->fill(*summary); } // ----------------------------------------------------------------------------- /** */ -void CommissioningHistograms::remove( std::string pattern ) { - - if ( !bei_ ) { - edm::LogError(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " NULL pointer to DQMStore!"; +void CommissioningHistograms::remove(std::string pattern) { + if (!bei_) { + edm::LogError(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " NULL pointer to DQMStore!"; return; } - + bei_->setVerbose(0); - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Removing histograms..."; - - if ( !pattern.empty() ) { - - if ( bei_->dirExists(pattern) ) { - bei_->rmdir(pattern); + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Removing histograms..."; + + if (!pattern.empty()) { + if (bei_->dirExists(pattern)) { + bei_->rmdir(pattern); } - - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Removing directories (and MonitorElements" - << " therein) that match the pattern \"" - << pattern << "\""; - + + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Removing directories (and MonitorElements" + << " therein) that match the pattern \"" << pattern << "\""; + } else { - bei_->cd(); - bei_->removeContents(); - - if( bei_->dirExists("Collector") ) { + bei_->removeContents(); + + if (bei_->dirExists("Collector")) { bei_->rmdir("Collector"); } - if( bei_->dirExists("EvF") ) { + if (bei_->dirExists("EvF")) { bei_->rmdir("EvF"); } - if( bei_->dirExists("SiStrip") ) { + if (bei_->dirExists("SiStrip")) { bei_->rmdir("SiStrip"); } - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Removing \"DQM source\" directories (and MonitorElements therein)"; - + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Removing \"DQM source\" directories (and MonitorElements therein)"; } - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Removed histograms!"; + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Removed histograms!"; bei_->setVerbose(1); - } // ----------------------------------------------------------------------------- /** */ -void CommissioningHistograms::save( std::string& path, - uint32_t run_number, - std::string partitionName) { - +void CommissioningHistograms::save(std::string& path, uint32_t run_number, std::string partitionName) { // Construct path and filename - std::stringstream ss; + std::stringstream ss; - if ( !path.empty() ) { - - ss << path; - if ( ss.str().find(".root") == std::string::npos ) { ss << ".root"; } + if (!path.empty()) { + ss << path; + if (ss.str().find(".root") == std::string::npos) { + ss << ".root"; + } } else { - // Retrieve SCRATCH directory std::string scratch = "SCRATCH"; std::string dir = ""; - if ( getenv(scratch.c_str()) != nullptr ) { - dir = getenv(scratch.c_str()); + if (getenv(scratch.c_str()) != nullptr) { + dir = getenv(scratch.c_str()); } - - // Add directory path - if ( !dir.empty() ) { ss << dir << "/"; } - else { ss << "/tmp/"; } - - // Add filename with run number and ".root" extension - if(partitionName.empty()) - ss << sistrip::dqmClientFileName_ << "_" - << std::setfill('0') << std::setw(8) << run_number - << ".root"; + + // Add directory path + if (!dir.empty()) { + ss << dir << "/"; + } else { + ss << "/tmp/"; + } + + // Add filename with run number and ".root" extension + if (partitionName.empty()) + ss << sistrip::dqmClientFileName_ << "_" << std::setfill('0') << std::setw(8) << run_number << ".root"; else - ss << sistrip::dqmClientFileName_ << "_" << partitionName << "_" - << std::setfill('0') << std::setw(8) << run_number - << ".root"; - + ss << sistrip::dqmClientFileName_ << "_" << partitionName << "_" << std::setfill('0') << std::setw(8) + << run_number << ".root"; } - + // Save file with appropriate filename - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Saving histograms to root file" - << " (This may take some time!)"; + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Saving histograms to root file" + << " (This may take some time!)"; path = ss.str(); - bei_->save( path, sistrip::collate_ ); - edm::LogVerbatim(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Saved histograms to root file \"" - << ss.str() << "\"!"; - + bei_->save(path, sistrip::collate_); + edm::LogVerbatim(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Saved histograms to root file \"" << ss.str() << "\"!"; } // ----------------------------------------------------------------------------- -// -TH1* CommissioningHistograms::histogram( const sistrip::Monitorable& mon, - const sistrip::Presentation& pres, - const sistrip::View& view, - const std::string& directory, - const uint32_t& xbins, - const float& xlow, - const float& xhigh ) { - - // Remember pwd +// +TH1* CommissioningHistograms::histogram(const sistrip::Monitorable& mon, + const sistrip::Presentation& pres, + const sistrip::View& view, + const std::string& directory, + const uint32_t& xbins, + const float& xlow, + const float& xhigh) { + // Remember pwd std::string pwd = bei_->pwd(); - bei_->setCurrentFolder( std::string(sistrip::collate_) + sistrip::dir_ + directory ); - - // Construct histogram name - std::string name = SummaryGenerator::name( task_, mon, pres, view, directory ); - + bei_->setCurrentFolder(std::string(sistrip::collate_) + sistrip::dir_ + directory); + + // Construct histogram name + std::string name = SummaryGenerator::name(task_, mon, pres, view, directory); + // Check if summary plot already exists and remove - MonitorElement* me = bei_->get( bei_->pwd() + "/" + name ); - if ( me ) { - bei_->removeElement( name ); + MonitorElement* me = bei_->get(bei_->pwd() + "/" + name); + if (me) { + bei_->removeElement(name); me = nullptr; - } - + } + // Create summary plot - float high = static_cast( xbins ); - if ( pres == sistrip::HISTO_1D ) { - if ( xlow < 1. * sistrip::valid_ && - xhigh < 1. * sistrip::valid_ ) { - me = bei_->book1D( name, name, xbins, xlow, xhigh ); + float high = static_cast(xbins); + if (pres == sistrip::HISTO_1D) { + if (xlow < 1. * sistrip::valid_ && xhigh < 1. * sistrip::valid_) { + me = bei_->book1D(name, name, xbins, xlow, xhigh); } else { - me = bei_->book1D( name, name, xbins, 0., high ); + me = bei_->book1D(name, name, xbins, 0., high); } - } else if ( pres == sistrip::HISTO_2D_SUM ) { - me = bei_->book1D( name, name, - xbins, 0., high ); - } else if ( pres == sistrip::HISTO_2D_SCATTER ) { - me = bei_->book2D( name, name, xbins, 0., high, - sistrip::FED_ADC_RANGE+1, - 0., - sistrip::FED_ADC_RANGE*1. ); - } else if ( pres == sistrip::PROFILE_1D ) { - me = bei_->bookProfile( name, name, xbins, 0., high, - sistrip::FED_ADC_RANGE+1, - 0., - sistrip::FED_ADC_RANGE*1. ); - } else { - me = nullptr; - edm::LogWarning(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Unexpected presentation \"" - << SiStripEnumsAndStrings::presentation( pres ) - << "\" Unable to create summary plot!"; + } else if (pres == sistrip::HISTO_2D_SUM) { + me = bei_->book1D(name, name, xbins, 0., high); + } else if (pres == sistrip::HISTO_2D_SCATTER) { + me = bei_->book2D(name, name, xbins, 0., high, sistrip::FED_ADC_RANGE + 1, 0., sistrip::FED_ADC_RANGE * 1.); + } else if (pres == sistrip::PROFILE_1D) { + me = bei_->bookProfile(name, name, xbins, 0., high, sistrip::FED_ADC_RANGE + 1, 0., sistrip::FED_ADC_RANGE * 1.); + } else { + me = nullptr; + edm::LogWarning(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Unexpected presentation \"" << SiStripEnumsAndStrings::presentation(pres) + << "\" Unable to create summary plot!"; } - + // Check pointer - if ( me ) { - LogTrace(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Created summary plot with name \"" << me->getName() - << "\" in directory \"" - << bei_->pwd() << "\"!"; + if (me) { + LogTrace(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Created summary plot with name \"" << me->getName() << "\" in directory \"" + << bei_->pwd() << "\"!"; } else { - edm::LogWarning(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " NULL pointer to MonitorElement!" - << " Unable to create summary plot!"; + edm::LogWarning(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " NULL pointer to MonitorElement!" + << " Unable to create summary plot!"; } - + // Extract root object - TH1* summary = ExtractTObject().extract( me ); - if ( !summary ) { - edm::LogWarning(mlDqmClient_) - << "[CommissioningHistograms::" << __func__ << "]" - << " Unable to extract root object!" - << " Returning NULL pointer!"; + TH1* summary = ExtractTObject().extract(me); + if (!summary) { + edm::LogWarning(mlDqmClient_) << "[CommissioningHistograms::" << __func__ << "]" + << " Unable to extract root object!" + << " Returning NULL pointer!"; } - + // Return to pwd - bei_->setCurrentFolder( pwd ); - + bei_->setCurrentFolder(pwd); + return summary; - } -CommissioningHistograms::Analyses& CommissioningHistograms::data(bool getMaskedData) { - if (!getMaskedData) return data_; +CommissioningHistograms::Analyses& CommissioningHistograms::data(bool getMaskedData) { + if (!getMaskedData) + return data_; else { - if (dataWithMaskCached_) return dataWithMask_; + if (dataWithMaskCached_) + return dataWithMask_; else { Analyses::iterator ianal = data_.begin(); Analyses::iterator janal = data_.end(); - for ( ; ianal != janal; ++ianal ) { - CommissioningAnalysis* anal = ianal->second; - SiStripFedKey fedkey = anal->fedKey(); - SiStripFecKey feckey = anal->fecKey(); - bool maskThisAnal_ = false; - for (std::size_t i = 0; i < fedMaskVector_.size(); i++) { - if (fedkey.fedId() == fedMaskVector_[i]) maskThisAnal_ = true; - } - for (std::size_t i = 0; i < fecMaskVector_.size(); i++) { - if (fecMaskVector_.size() != ringVector_.size() || fecMaskVector_.size() != ccuVector_.size() || fecMaskVector_.size() != i2cChanVector_.size() || fecMaskVector_.size() != lldChanVector_.size()) { - continue; - } - if (feckey.fecSlot() == fecMaskVector_[i] && - feckey.fecRing() == ringVector_[i] && - feckey.ccuAddr() == ccuVector_[i] && - feckey.ccuChan() == i2cChanVector_[i] && - feckey.lldChan() == lldChanVector_[i]) { - maskThisAnal_ = true; - } - } - if (mask_ && !maskThisAnal_) dataWithMask_[ianal->first] = ianal->second; - else if (!mask_ && maskThisAnal_) dataWithMask_[ianal->first] = ianal->second; + for (; ianal != janal; ++ianal) { + CommissioningAnalysis* anal = ianal->second; + SiStripFedKey fedkey = anal->fedKey(); + SiStripFecKey feckey = anal->fecKey(); + bool maskThisAnal_ = false; + for (std::size_t i = 0; i < fedMaskVector_.size(); i++) { + if (fedkey.fedId() == fedMaskVector_[i]) + maskThisAnal_ = true; + } + for (std::size_t i = 0; i < fecMaskVector_.size(); i++) { + if (fecMaskVector_.size() != ringVector_.size() || fecMaskVector_.size() != ccuVector_.size() || + fecMaskVector_.size() != i2cChanVector_.size() || fecMaskVector_.size() != lldChanVector_.size()) { + continue; + } + if (feckey.fecSlot() == fecMaskVector_[i] && feckey.fecRing() == ringVector_[i] && + feckey.ccuAddr() == ccuVector_[i] && feckey.ccuChan() == i2cChanVector_[i] && + feckey.lldChan() == lldChanVector_[i]) { + maskThisAnal_ = true; + } + } + if (mask_ && !maskThisAnal_) + dataWithMask_[ianal->first] = ianal->second; + else if (!mask_ && maskThisAnal_) + dataWithMask_[ianal->first] = ianal->second; } dataWithMaskCached_ = true; return dataWithMask_; - } + } } } - diff --git a/DQM/SiStripCommissioningClients/src/DaqScopeModeHistograms.cc b/DQM/SiStripCommissioningClients/src/DaqScopeModeHistograms.cc index 9125c8b66902e..53016a1c5d619 100644 --- a/DQM/SiStripCommissioningClients/src/DaqScopeModeHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/DaqScopeModeHistograms.cc @@ -9,131 +9,120 @@ #include #include #include - + using namespace std; using namespace sistrip; // ----------------------------------------------------------------------------- /** */ -DaqScopeModeHistograms::DaqScopeModeHistograms( const edm::ParameterSet& pset, - DQMStore* bei ) - : CommissioningHistograms( pset.getParameter("DaqScopeModeParameters"), - bei, - sistrip::DAQ_SCOPE_MODE ) -{ - - factory_ = unique_ptr( new DaqScopeModeSummaryFactory ); - LogTrace(mlDqmClient_) - << "[DaqScopeModeHistograms::" << __func__ << "]" - << " Constructing object..."; - +DaqScopeModeHistograms::DaqScopeModeHistograms(const edm::ParameterSet& pset, DQMStore* bei) + : CommissioningHistograms( + pset.getParameter("DaqScopeModeParameters"), bei, sistrip::DAQ_SCOPE_MODE) { + factory_ = unique_ptr(new DaqScopeModeSummaryFactory); + LogTrace(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]" + << " Constructing object..."; } // ----------------------------------------------------------------------------- /** */ DaqScopeModeHistograms::~DaqScopeModeHistograms() { - LogTrace(mlDqmClient_) - << "[DaqScopeModeHistograms::" << __func__ << "]" - << " Destructing object..."; + LogTrace(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]" + << " Destructing object..."; } -// ----------------------------------------------------------------------------- -/** */ -void DaqScopeModeHistograms::histoAnalysis( bool debug ) { - - LogTrace(mlDqmClient_) - << "[DaqScopeModeHistograms::" << __func__ << "]"; +// ----------------------------------------------------------------------------- +/** */ +void DaqScopeModeHistograms::histoAnalysis(bool debug) { + LogTrace(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]"; - // Some initialisation + // Some initialisation uint16_t valid = 0; HistosMap::const_iterator iter; Analyses::iterator ianal; - std::map errors; + std::map errors; - // Clear map holding analysis objects - for ( ianal = data().begin(); ianal != data().end(); ianal++ ) { - if ( ianal->second ) { delete ianal->second; } + // Clear map holding analysis objects + for (ianal = data().begin(); ianal != data().end(); ianal++) { + if (ianal->second) { + delete ianal->second; + } } data().clear(); - // Iterate through map containing histograms - for ( iter = histos().begin(); - iter != histos().end(); iter++ ) { - - // Check vector of histos is not empty - if ( iter->second.empty() ) { - edm::LogWarning(mlDqmClient_) - << "[DaqScopeModeHistograms::" << __func__ << "]" - << " Zero histograms found!"; + // Iterate through map containing histograms + for (iter = histos().begin(); iter != histos().end(); iter++) { + // Check vector of histos is not empty + if (iter->second.empty()) { + edm::LogWarning(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]" + << " Zero histograms found!"; continue; } - - // Retrieve pointers to profile histos + + // Retrieve pointers to profile histos std::vector profs; Histos::const_iterator ihis = iter->second.begin(); - for ( ; ihis != iter->second.end(); ihis++ ) { - TProfile* prof = ExtractTObject().extract( (*ihis)->me_ ); - if ( prof ){profs.push_back(prof);} - if (!prof ){ + for (; ihis != iter->second.end(); ihis++) { + TProfile* prof = ExtractTObject().extract((*ihis)->me_); + if (prof) { + profs.push_back(prof); + } + if (!prof) { TH1F* prof = ExtractTObject().extract((*ihis)->me_); profs.push_back(prof); } } - // Perform histo analysis - DaqScopeModeAnalysis* anal = new DaqScopeModeAnalysis( iter->first ); - DaqScopeModeAlgorithm algo( this->pset(), anal ); - algo.analysis( profs ); + // Perform histo analysis + DaqScopeModeAnalysis* anal = new DaqScopeModeAnalysis(iter->first); + DaqScopeModeAlgorithm algo(this->pset(), anal); + algo.analysis(profs); data()[iter->first] = anal; - - if ( anal->isValid() ) { valid++; } - if ( !anal->getErrorCodes().empty() ) { + + if (anal->isValid()) { + valid++; + } + if (!anal->getErrorCodes().empty()) { errors[anal->getErrorCodes()[0]]++; } } - - if ( !histos().empty() ) { - edm::LogVerbatim(mlDqmClient_) - << "[DaqScopeModeHistograms::" << __func__ << "]" - << " Analyzed histograms for " << histos().size() - << " FED channels, of which " << valid - << " (" << 100 * valid / histos().size() - << "%) are valid."; - if ( !errors.empty() ) { + + if (!histos().empty()) { + edm::LogVerbatim(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]" + << " Analyzed histograms for " << histos().size() << " FED channels, of which " + << valid << " (" << 100 * valid / histos().size() << "%) are valid."; + if (!errors.empty()) { uint16_t count = 0; std::stringstream ss; ss << std::endl; - std::map::const_iterator ii; - for ( ii = errors.begin(); ii != errors.end(); ++ii ) { - ss << " " << ii->first << ": " << ii->second << std::endl; - count += ii->second; + std::map::const_iterator ii; + for (ii = errors.begin(); ii != errors.end(); ++ii) { + ss << " " << ii->first << ": " << ii->second << std::endl; + count += ii->second; } - edm::LogWarning(mlDqmClient_) - << "[DaqScopeModeHistograms::" << __func__ << "]" - << " Found " << count << " errors (" - << 100 * count / histos().size() << "%): " - << ss.str(); - } + edm::LogWarning(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]" + << " Found " << count << " errors (" << 100 * count / histos().size() + << "%): " << ss.str(); + } } else { - edm::LogWarning(mlDqmClient_) - << "[DaqScopeModeHistograms::" << __func__ << "]" - << " No histograms to analyze!"; + edm::LogWarning(mlDqmClient_) << "[DaqScopeModeHistograms::" << __func__ << "]" + << " No histograms to analyze!"; } } -// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- void DaqScopeModeHistograms::printAnalyses() { Analyses::iterator ianal = data().begin(); Analyses::iterator janal = data().end(); - for ( ; ianal != janal; ++ianal ) { - if ( ianal->second ) { + for (; ianal != janal; ++ianal) { + if (ianal->second) { std::stringstream ss; - ianal->second->print( ss, 1 ); - ianal->second->print( ss, 2 ); - if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str(); + ianal->second->print(ss, 1); + ianal->second->print(ss, 2); + if (ianal->second->isValid()) { + LogTrace(mlDqmClient_) << ss.str(); + } else { + edm::LogWarning(mlDqmClient_) << ss.str(); } - else { edm::LogWarning(mlDqmClient_) << ss.str(); } } } } - diff --git a/DQM/SiStripCommissioningClients/src/FastFedCablingHistograms.cc b/DQM/SiStripCommissioningClients/src/FastFedCablingHistograms.cc index 4a035301b60f9..265ca91cb5bf2 100644 --- a/DQM/SiStripCommissioningClients/src/FastFedCablingHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/FastFedCablingHistograms.cc @@ -15,105 +15,96 @@ using namespace sistrip; // ----------------------------------------------------------------------------- /** */ -FastFedCablingHistograms::FastFedCablingHistograms( const edm::ParameterSet& pset, - DQMStore* bei ) - : CommissioningHistograms( pset.getParameter("FastFedCablingParameters"), - bei, - sistrip::FAST_CABLING ) -{ - factory_ = unique_ptr( new FastFedCablingSummaryFactory ); - LogTrace(mlDqmClient_) - << "[FastFedCablingHistograms::" << __func__ << "]" - << " Constructing object..."; +FastFedCablingHistograms::FastFedCablingHistograms(const edm::ParameterSet& pset, DQMStore* bei) + : CommissioningHistograms( + pset.getParameter("FastFedCablingParameters"), bei, sistrip::FAST_CABLING) { + factory_ = unique_ptr(new FastFedCablingSummaryFactory); + LogTrace(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]" + << " Constructing object..."; } // ----------------------------------------------------------------------------- /** */ FastFedCablingHistograms::~FastFedCablingHistograms() { - LogTrace(mlDqmClient_) - << "[FastFedCablingHistograms::" << __func__ << "]" - << " Destructing object..."; + LogTrace(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]" + << " Destructing object..."; } -// ----------------------------------------------------------------------------- -/** */ -void FastFedCablingHistograms::histoAnalysis( bool debug ) { - LogTrace(mlDqmClient_) - << "[FastFedCablingHistograms::" << __func__ << "]"; +// ----------------------------------------------------------------------------- +/** */ +void FastFedCablingHistograms::histoAnalysis(bool debug) { + LogTrace(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]"; // Some initialisation uint16_t valid = 0; HistosMap::const_iterator iter; Analyses::iterator ianal; - std::map errors; - + std::map errors; + // Clear map holding analysis objects - for ( ianal = data().begin(); ianal != data().end(); ianal++ ) { - if ( ianal->second ) { delete ianal->second; } - } + for (ianal = data().begin(); ianal != data().end(); ianal++) { + if (ianal->second) { + delete ianal->second; + } + } data().clear(); - + // Iterate through map containing histograms - for ( iter = histos().begin(); - iter != histos().end(); iter++ ) { - + for (iter = histos().begin(); iter != histos().end(); iter++) { // Check vector of histos is not empty - if ( iter->second.empty() ) { - edm::LogWarning(mlDqmClient_) - << "[FastFedCablingHistograms::" << __func__ << "]" - << " Zero histograms found!"; + if (iter->second.empty()) { + edm::LogWarning(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]" + << " Zero histograms found!"; continue; } - + // Retrieve pointers to histos std::vector profs; - Histos::const_iterator ihis = iter->second.begin(); - for ( ; ihis != iter->second.end(); ihis++ ) { - TProfile* prof = ExtractTObject().extract( (*ihis)->me_ ); - if ( prof ) { profs.push_back(prof); } - } - + Histos::const_iterator ihis = iter->second.begin(); + for (; ihis != iter->second.end(); ihis++) { + TProfile* prof = ExtractTObject().extract((*ihis)->me_); + if (prof) { + profs.push_back(prof); + } + } + // Perform histo analysis - FastFedCablingAnalysis* anal = new FastFedCablingAnalysis( iter->first ); - FastFedCablingAlgorithm algo( this->pset(), anal ); - FedToFecMap::const_iterator ifed = mapping().find( iter->first ); - if ( ifed != mapping().end() ) { anal->fecKey( ifed->second ); } - algo.analysis( profs ); - data()[iter->first] = anal; - if ( anal->isValid() ) { valid++; } - if ( !anal->getErrorCodes().empty() ) { + FastFedCablingAnalysis* anal = new FastFedCablingAnalysis(iter->first); + FastFedCablingAlgorithm algo(this->pset(), anal); + FedToFecMap::const_iterator ifed = mapping().find(iter->first); + if (ifed != mapping().end()) { + anal->fecKey(ifed->second); + } + algo.analysis(profs); + data()[iter->first] = anal; + if (anal->isValid()) { + valid++; + } + if (!anal->getErrorCodes().empty()) { errors[anal->getErrorCodes()[0]]++; } - } - - if ( !histos().empty() ) { - edm::LogVerbatim(mlDqmClient_) - << "[FastFedCablingHistograms::" << __func__ << "]" - << " Analyzed histograms for " << histos().size() - << " FED channels, of which " << valid - << " (" << 100 * valid / histos().size() - << "%) are valid."; - if ( !errors.empty() ) { + + if (!histos().empty()) { + edm::LogVerbatim(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]" + << " Analyzed histograms for " << histos().size() << " FED channels, of which " + << valid << " (" << 100 * valid / histos().size() << "%) are valid."; + if (!errors.empty()) { uint16_t count = 0; std::stringstream ss; ss << std::endl; - std::map::const_iterator ii; - for ( ii = errors.begin(); ii != errors.end(); ++ii ) { - ss << " " << ii->first << ": " << ii->second << std::endl; - count += ii->second; + std::map::const_iterator ii; + for (ii = errors.begin(); ii != errors.end(); ++ii) { + ss << " " << ii->first << ": " << ii->second << std::endl; + count += ii->second; } - edm::LogWarning(mlDqmClient_) - << "[FastFedCablingHistograms::" << __func__ << "]" - << " Found " << count << " error strings: " - << ss.str(); + edm::LogWarning(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]" + << " Found " << count << " error strings: " << ss.str(); } } else { - edm::LogWarning(mlDqmClient_) - << "[FastFedCablingHistograms::" << __func__ << "]" - << " No histograms to analyze!"; + edm::LogWarning(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]" + << " No histograms to analyze!"; } - } // ----------------------------------------------------------------------------- @@ -121,64 +112,60 @@ void FastFedCablingHistograms::histoAnalysis( bool debug ) { void FastFedCablingHistograms::printAnalyses() { Analyses::iterator ianal = data().begin(); Analyses::iterator janal = data().end(); - for ( ; ianal != janal; ++ianal ) { - - FastFedCablingAnalysis* anal = dynamic_cast( ianal->second ); - if ( !anal ) { - edm::LogError(mlDqmClient_) - << "[FastFedCablingHistograms::" << __func__ << "]" - << " NULL pointer to analysis object!"; - continue; + for (; ianal != janal; ++ianal) { + FastFedCablingAnalysis* anal = dynamic_cast(ianal->second); + if (!anal) { + edm::LogError(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]" + << " NULL pointer to analysis object!"; + continue; } std::stringstream ss; - anal->print( ss ); - if ( anal->isValid() && - !(anal->isDirty()) && - !(anal->badTrimDac()) ) { LogTrace(mlDqmClient_) << ss.str(); - } else { edm::LogWarning(mlDqmClient_) << ss.str(); } - + anal->print(ss); + if (anal->isValid() && !(anal->isDirty()) && !(anal->badTrimDac())) { + LogTrace(mlDqmClient_) << ss.str(); + } else { + edm::LogWarning(mlDqmClient_) << ss.str(); + } } - } // ----------------------------------------------------------------------------- /** */ void FastFedCablingHistograms::printSummary() { - std::stringstream good; std::stringstream bad; - + Analyses::iterator ianal = data().begin(); Analyses::iterator janal = data().end(); - for ( ; ianal != janal; ++ianal ) { - - FastFedCablingAnalysis* anal = dynamic_cast( ianal->second ); - if ( !anal ) { - edm::LogError(mlDqmClient_) - << "[FastFedCablingHistograms::" << __func__ << "]" - << " NULL pointer to analysis object!"; - continue; + for (; ianal != janal; ++ianal) { + FastFedCablingAnalysis* anal = dynamic_cast(ianal->second); + if (!anal) { + edm::LogError(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]" + << " NULL pointer to analysis object!"; + continue; } - if ( anal->isValid() && - !(anal->isDirty()) && - !(anal->badTrimDac()) ) { - anal->summary( good ); - } else { anal->summary( bad ); } - + if (anal->isValid() && !(anal->isDirty()) && !(anal->badTrimDac())) { + anal->summary(good); + } else { + anal->summary(bad); + } } - if ( good.str().empty() ) { good << "None found!"; } - LogTrace(mlDqmClient_) - << "[FastFedCablingHistograms::" << __func__ << "]" - << " Printing summary of good analyses:" << "\n" - << good.str(); - - if ( bad.str().empty() ) { return; } //@@ bad << "None found!"; } - LogTrace(mlDqmClient_) - << "[FastFedCablingHistograms::" << __func__ << "]" - << " Printing summary of bad analyses:" << "\n" - << bad.str(); - + if (good.str().empty()) { + good << "None found!"; + } + LogTrace(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]" + << " Printing summary of good analyses:" + << "\n" + << good.str(); + + if (bad.str().empty()) { + return; + } //@@ bad << "None found!"; } + LogTrace(mlDqmClient_) << "[FastFedCablingHistograms::" << __func__ << "]" + << " Printing summary of bad analyses:" + << "\n" + << bad.str(); } diff --git a/DQM/SiStripCommissioningClients/src/FedCablingHistograms.cc b/DQM/SiStripCommissioningClients/src/FedCablingHistograms.cc index e79793722a459..ab00158db93d7 100644 --- a/DQM/SiStripCommissioningClients/src/FedCablingHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/FedCablingHistograms.cc @@ -16,128 +16,119 @@ using namespace sistrip; // ----------------------------------------------------------------------------- /** */ -FedCablingHistograms::FedCablingHistograms( const edm::ParameterSet& pset, - DQMStore* bei ) - : CommissioningHistograms( pset.getParameter("FedCablingParameters"), - bei, - sistrip::FED_CABLING ), - factory_( new Factory ) -{ - LogTrace(mlDqmClient_) - << "[FedCablingHistograms::" << __func__ << "]" - << " Constructing object..."; +FedCablingHistograms::FedCablingHistograms(const edm::ParameterSet& pset, DQMStore* bei) + : CommissioningHistograms(pset.getParameter("FedCablingParameters"), bei, sistrip::FED_CABLING), + factory_(new Factory) { + LogTrace(mlDqmClient_) << "[FedCablingHistograms::" << __func__ << "]" + << " Constructing object..."; } // ----------------------------------------------------------------------------- /** */ FedCablingHistograms::~FedCablingHistograms() { - LogTrace(mlDqmClient_) - << "[FedCablingHistograms::" << __func__ << "]" - << " Destructing object..."; + LogTrace(mlDqmClient_) << "[FedCablingHistograms::" << __func__ << "]" + << " Destructing object..."; } -// ----------------------------------------------------------------------------- -/** */ -void FedCablingHistograms::histoAnalysis( bool debug ) { - LogTrace(mlDqmClient_) - << "[FedCablingHistograms::" << __func__ << "]"; +// ----------------------------------------------------------------------------- +/** */ +void FedCablingHistograms::histoAnalysis(bool debug) { + LogTrace(mlDqmClient_) << "[FedCablingHistograms::" << __func__ << "]"; uint16_t valid = 0; HistosMap::const_iterator iter; Analyses::iterator ianal; - + // Clear map holding analysis objects - for ( ianal = data_.begin(); ianal != data_.end(); ianal++ ) { - if ( ianal->second ) { delete ianal->second; } - } + for (ianal = data_.begin(); ianal != data_.end(); ianal++) { + if (ianal->second) { + delete ianal->second; + } + } data_.clear(); - + // Iterate through map containing histograms - for ( iter = histos().begin(); - iter != histos().end(); iter++ ) { - + for (iter = histos().begin(); iter != histos().end(); iter++) { // Check vector of histos is not empty - if ( iter->second.empty() ) { - edm::LogWarning(mlDqmClient_) - << "[FedCablingHistograms::" << __func__ << "]" - << " Zero histograms found!"; + if (iter->second.empty()) { + edm::LogWarning(mlDqmClient_) << "[FedCablingHistograms::" << __func__ << "]" + << " Zero histograms found!"; continue; } - + // Retrieve pointers to histos std::vector profs; - Histos::const_iterator ihis = iter->second.begin(); - for ( ; ihis != iter->second.end(); ihis++ ) { - TProfile* prof = ExtractTObject().extract( (*ihis)->me_ ); - if ( prof ) { profs.push_back(prof); } - } - + Histos::const_iterator ihis = iter->second.begin(); + for (; ihis != iter->second.end(); ihis++) { + TProfile* prof = ExtractTObject().extract((*ihis)->me_); + if (prof) { + profs.push_back(prof); + } + } + // Perform histo analysis - FedCablingAnalysis* anal = new FedCablingAnalysis( iter->first ); - FedCablingAlgorithm algo( this->pset(), anal ); - algo.analysis( profs ); - data_[iter->first] = anal; - if ( anal->isValid() ) { valid++; } - + FedCablingAnalysis* anal = new FedCablingAnalysis(iter->first); + FedCablingAlgorithm algo(this->pset(), anal); + algo.analysis(profs); + data_[iter->first] = anal; + if (anal->isValid()) { + valid++; + } } - - if ( !histos().empty() ) { - edm::LogVerbatim(mlDqmClient_) - << "[FedCablingHistograms::" << __func__ << "]" - << " Analyzed histograms for " << histos().size() - << " FED channels, of which " << valid - << " (" << 100 * valid / histos().size() - << "%) are valid."; + + if (!histos().empty()) { + edm::LogVerbatim(mlDqmClient_) << "[FedCablingHistograms::" << __func__ << "]" + << " Analyzed histograms for " << histos().size() << " FED channels, of which " + << valid << " (" << 100 * valid / histos().size() << "%) are valid."; } else { - edm::LogWarning(mlDqmClient_) - << "[FedCablingHistograms::" << __func__ << "]" - << " No histograms to analyze!"; + edm::LogWarning(mlDqmClient_) << "[FedCablingHistograms::" << __func__ << "]" + << " No histograms to analyze!"; } - } -// ----------------------------------------------------------------------------- -/** */ +// ----------------------------------------------------------------------------- +/** */ void FedCablingHistograms::printAnalyses() { Analyses::iterator ianal = data_.begin(); Analyses::iterator janal = data_.end(); - for ( ; ianal != janal; ++ianal ) { - if ( ianal->second ) { + for (; ianal != janal; ++ianal) { + if (ianal->second) { std::stringstream ss; - ianal->second->print( ss ); - if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str(); - } else { edm::LogWarning(mlDqmClient_) << ss.str(); } + ianal->second->print(ss); + if (ianal->second->isValid()) { + LogTrace(mlDqmClient_) << ss.str(); + } else { + edm::LogWarning(mlDqmClient_) << ss.str(); + } } } } // ----------------------------------------------------------------------------- /** */ -void FedCablingHistograms::createSummaryHisto( const sistrip::Monitorable& histo, - const sistrip::Presentation& type, - const std::string& dir, - const sistrip::Granularity& gran ) { - LogTrace(mlDqmClient_) - << "[FedCablingHistograms::" << __func__ << "]"; - - // Check view +void FedCablingHistograms::createSummaryHisto(const sistrip::Monitorable& histo, + const sistrip::Presentation& type, + const std::string& dir, + const sistrip::Granularity& gran) { + LogTrace(mlDqmClient_) << "[FedCablingHistograms::" << __func__ << "]"; + + // Check view sistrip::View view = SiStripEnumsAndStrings::view(dir); - if ( view == sistrip::UNKNOWN_VIEW ) { return; } - + if (view == sistrip::UNKNOWN_VIEW) { + return; + } + // Analyze histograms if not done already - if ( data_.empty() ) { histoAnalysis( false ); } - + if (data_.empty()) { + histoAnalysis(false); + } + // Extract data to be histogrammed - uint32_t xbins = factory_->init( histo, type, view, dir, gran, data_ ); - + uint32_t xbins = factory_->init(histo, type, view, dir, gran, data_); + // Create summary histogram (if it doesn't already exist) - TH1* summary = histogram( histo, type, view, dir, xbins ); + TH1* summary = histogram(histo, type, view, dir, xbins); // Fill histogram with data - factory_->fill( *summary ); - + factory_->fill(*summary); } - - - - diff --git a/DQM/SiStripCommissioningClients/src/FedTimingHistograms.cc b/DQM/SiStripCommissioningClients/src/FedTimingHistograms.cc index 95547be26e349..99224fe576cef 100644 --- a/DQM/SiStripCommissioningClients/src/FedTimingHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/FedTimingHistograms.cc @@ -11,161 +11,144 @@ using namespace std; // ----------------------------------------------------------------------------- /** */ -FedTimingHistograms::FedTimingHistograms( const edm::ParameterSet& pset, - DQMStore* bei ) - : CommissioningHistograms( pset.getParameter("FedTimingParameters"), - bei, - sistrip::FED_TIMING ), - factory_( new Factory ), - optimumSamplingPoint_(15.), - minDelay_(sistrip::invalid_), - maxDelay_(-1.*sistrip::invalid_), - deviceWithMinDelay_(sistrip::invalid_), - deviceWithMaxDelay_(sistrip::invalid_) -{ +FedTimingHistograms::FedTimingHistograms(const edm::ParameterSet& pset, DQMStore* bei) + : CommissioningHistograms(pset.getParameter("FedTimingParameters"), bei, sistrip::FED_TIMING), + factory_(new Factory), + optimumSamplingPoint_(15.), + minDelay_(sistrip::invalid_), + maxDelay_(-1. * sistrip::invalid_), + deviceWithMinDelay_(sistrip::invalid_), + deviceWithMaxDelay_(sistrip::invalid_) { cout << "[" << __PRETTY_FUNCTION__ << "]" << " Created object for APV TIMING histograms" << endl; } // ----------------------------------------------------------------------------- /** */ -FedTimingHistograms::~FedTimingHistograms() { - cout << "[" << __PRETTY_FUNCTION__ << "]" << endl; -} +FedTimingHistograms::~FedTimingHistograms() { cout << "[" << __PRETTY_FUNCTION__ << "]" << endl; } -// ----------------------------------------------------------------------------- -/** */ -void FedTimingHistograms::histoAnalysis( bool debug ) { - +// ----------------------------------------------------------------------------- +/** */ +void FedTimingHistograms::histoAnalysis(bool debug) { // Clear std::map holding analysis objects data_.clear(); // Reset minimum / maximum delays - float time_min = 1. * sistrip::invalid_; + float time_min = 1. * sistrip::invalid_; float time_max = -1. * sistrip::invalid_; uint32_t device_min = sistrip::invalid_; uint32_t device_max = sistrip::invalid_; - -// // Iterate through std::map containing std::vectors of profile histograms -// CollationsMap::const_iterator iter = collations().begin(); -// for ( ; iter != collations().end(); iter++ ) { - -// // Check std::vector of histos is not empty (should be 2 histos) -// if ( iter->second.empty() ) { -// cerr << "[" << __PRETTY_FUNCTION__ << "]" -// << " Zero collation histograms found!" << endl; -// continue; -// } - -// // Retrieve pointers to profile histos for this FED channel -// std::vector profs; -// Collations::const_iterator ihis = iter->second.begin(); -// for ( ; ihis != iter->second.end(); ihis++ ) { -// OBSOLETE!!! -// TProfile* prof = ExtractTObject().extract( mui()->get( ihis->first ) ); -// if ( prof ) { profs.push_back(prof); } -// } - -// // Perform histo analysis -// FedTimingAnalysis anal( iter->first ); -// FedTimingAlgorithm algo( &anal ); -// algo.analysis( profs ); -// data_[iter->first] = anal; - -// // Check tick height is valid -// if ( anal.height() < 100. ) { -// cerr << "[" << __PRETTY_FUNCTION__ << "]" -// << " Tick mark height too small: " << anal.height() << endl; -// continue; -// } - -// // Check time of rising edge -// if ( anal.time() > sistrip::maximum_ ) { continue; } - -// // Find maximum time -// if ( anal.time() > time_max ) { -// time_max = anal.time(); -// device_max = iter->first; -// } - -// // Find minimum time -// if ( anal.time() < time_min ) { -// time_min = anal.time(); -// device_min = iter->first; -// } - -// } - -// cout << "[" << __PRETTY_FUNCTION__ << "]" -// << " Analyzed histograms for " -// << collations().size() -// << " FED channels" << endl; + + // // Iterate through std::map containing std::vectors of profile histograms + // CollationsMap::const_iterator iter = collations().begin(); + // for ( ; iter != collations().end(); iter++ ) { + + // // Check std::vector of histos is not empty (should be 2 histos) + // if ( iter->second.empty() ) { + // cerr << "[" << __PRETTY_FUNCTION__ << "]" + // << " Zero collation histograms found!" << endl; + // continue; + // } + + // // Retrieve pointers to profile histos for this FED channel + // std::vector profs; + // Collations::const_iterator ihis = iter->second.begin(); + // for ( ; ihis != iter->second.end(); ihis++ ) { + // OBSOLETE!!! + // TProfile* prof = ExtractTObject().extract( mui()->get( ihis->first ) ); + // if ( prof ) { profs.push_back(prof); } + // } + + // // Perform histo analysis + // FedTimingAnalysis anal( iter->first ); + // FedTimingAlgorithm algo( &anal ); + // algo.analysis( profs ); + // data_[iter->first] = anal; + + // // Check tick height is valid + // if ( anal.height() < 100. ) { + // cerr << "[" << __PRETTY_FUNCTION__ << "]" + // << " Tick mark height too small: " << anal.height() << endl; + // continue; + // } + + // // Check time of rising edge + // if ( anal.time() > sistrip::maximum_ ) { continue; } + + // // Find maximum time + // if ( anal.time() > time_max ) { + // time_max = anal.time(); + // device_max = iter->first; + // } + + // // Find minimum time + // if ( anal.time() < time_min ) { + // time_min = anal.time(); + // device_min = iter->first; + // } + + // } + + // cout << "[" << __PRETTY_FUNCTION__ << "]" + // << " Analyzed histograms for " + // << collations().size() + // << " FED channels" << endl; // Adjust maximum (and minimum) delay(s) to find optimum sampling point(s) - if ( time_max > sistrip::maximum_ || - time_max < -1.*sistrip::maximum_ ) { + if (time_max > sistrip::maximum_ || time_max < -1. * sistrip::maximum_) { cerr << "[" << __PRETTY_FUNCTION__ << "]" - << " Unable to set maximum time! Found unexpected value: " - << time_max << endl; - return; + << " Unable to set maximum time! Found unexpected value: " << time_max << endl; + return; } - - SiStripFecKey max( device_max ); - cout << " Device (FEC/slot/ring/CCU/module/channel) " - << max.fecCrate() << "/" - << max.fecSlot() << "/" - << max.fecRing() << "/" - << max.ccuAddr() << "/" - << max.ccuChan() << "/" + + SiStripFecKey max(device_max); + cout << " Device (FEC/slot/ring/CCU/module/channel) " << max.fecCrate() << "/" << max.fecSlot() << "/" + << max.fecRing() << "/" << max.ccuAddr() << "/" << max.ccuChan() << "/" << " has maximum delay (rising edge) [ns]:" << time_max << endl; - - SiStripFecKey min( device_min ); - cout << " Device (FEC/slot/ring/CCU/module/channel): " - << min.fecCrate() << "/" - << min.fecSlot() << "/" - << min.fecRing() << "/" - << min.ccuAddr() << "/" - << min.ccuChan() << "/" + + SiStripFecKey min(device_min); + cout << " Device (FEC/slot/ring/CCU/module/channel): " << min.fecCrate() << "/" << min.fecSlot() << "/" + << min.fecRing() << "/" << min.ccuAddr() << "/" << min.ccuChan() << "/" << " has minimum delay (rising edge) [ns]:" << time_min << endl; - + // Set maximum time for all analysis objects - std::map::iterator ianal = data_.begin(); - for ( ; ianal != data_.end(); ianal++ ) { - ianal->second.max( time_max ); + std::map::iterator ianal = data_.begin(); + for (; ianal != data_.end(); ianal++) { + ianal->second.max(time_max); static uint16_t cntr = 0; - if ( debug ) { + if (debug) { std::stringstream ss; - ianal->second.print( ss ); + ianal->second.print(ss); cout << ss.str() << endl; cntr++; } } - } // ----------------------------------------------------------------------------- /** */ -void FedTimingHistograms::createSummaryHisto( const sistrip::Monitorable& histo, - const sistrip::Presentation& type, - const std::string& directory, - const sistrip::Granularity& gran ) { - cout << "[" << __PRETTY_FUNCTION__ <<"]" << endl; - - // Check view +void FedTimingHistograms::createSummaryHisto(const sistrip::Monitorable& histo, + const sistrip::Presentation& type, + const std::string& directory, + const sistrip::Granularity& gran) { + cout << "[" << __PRETTY_FUNCTION__ << "]" << endl; + + // Check view sistrip::View view = SiStripEnumsAndStrings::view(directory); - if ( view == sistrip::UNKNOWN_VIEW ) { return; } - + if (view == sistrip::UNKNOWN_VIEW) { + return; + } + // Analyze histograms - histoAnalysis( false ); + histoAnalysis(false); // Extract data to be histogrammed - factory_->init( histo, type, view, directory, gran ); - uint32_t xbins = factory_->extract( data_ ); + factory_->init(histo, type, view, directory, gran); + uint32_t xbins = factory_->extract(data_); // Create summary histogram (if it doesn't already exist) - TH1* summary = histogram( histo, type, view, directory, xbins ); + TH1* summary = histogram(histo, type, view, directory, xbins); // Fill histogram with data - factory_->fill( *summary ); - + factory_->fill(*summary); } diff --git a/DQM/SiStripCommissioningClients/src/NoiseHistograms.cc b/DQM/SiStripCommissioningClients/src/NoiseHistograms.cc index 4989da0512e1f..7482065a12f1d 100644 --- a/DQM/SiStripCommissioningClients/src/NoiseHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/NoiseHistograms.cc @@ -15,121 +15,112 @@ using namespace sistrip; // ----------------------------------------------------------------------------- /** */ -NoiseHistograms::NoiseHistograms( const edm::ParameterSet& pset, - DQMStore* bei ) - : CommissioningHistograms( pset.getParameter("NoiseParameters"), - bei, - sistrip::NOISE ) -{ - factory_ = unique_ptr( new NoiseSummaryFactory ); - LogTrace(mlDqmClient_) - << "[NoiseHistograms::" << __func__ << "]" - << " Constructing object..."; +NoiseHistograms::NoiseHistograms(const edm::ParameterSet& pset, DQMStore* bei) + : CommissioningHistograms(pset.getParameter("NoiseParameters"), bei, sistrip::NOISE) { + factory_ = unique_ptr(new NoiseSummaryFactory); + LogTrace(mlDqmClient_) << "[NoiseHistograms::" << __func__ << "]" + << " Constructing object..."; } // ----------------------------------------------------------------------------- /** */ NoiseHistograms::~NoiseHistograms() { - LogTrace(mlDqmClient_) - << "[NoiseHistograms::" << __func__ << "]" - << " Destructing object..."; + LogTrace(mlDqmClient_) << "[NoiseHistograms::" << __func__ << "]" + << " Destructing object..."; } -// ----------------------------------------------------------------------------- -/** */ -void NoiseHistograms::histoAnalysis( bool debug ) { - LogTrace(mlDqmClient_) - << "[NoiseHistograms::" << __func__ << "]"; +// ----------------------------------------------------------------------------- +/** */ +void NoiseHistograms::histoAnalysis(bool debug) { + LogTrace(mlDqmClient_) << "[NoiseHistograms::" << __func__ << "]"; // Some initialisation uint16_t valid = 0; HistosMap::const_iterator iter; Analyses::iterator ianal; - std::map errors; + std::map errors; // Clear map holding analysis objects - for ( ianal = data().begin(); ianal != data().end(); ianal++ ) { - if ( ianal->second ) { delete ianal->second; } - } + for (ianal = data().begin(); ianal != data().end(); ianal++) { + if (ianal->second) { + delete ianal->second; + } + } data().clear(); - + // Iterate through map containing histograms - for ( iter = histos().begin(); - iter != histos().end(); iter++ ) { - + for (iter = histos().begin(); iter != histos().end(); iter++) { // Check vector of histos is not empty - if ( iter->second.empty() ) { - edm::LogWarning(mlDqmClient_) - << "[NoiseHistograms::" << __func__ << "]" - << " Zero histograms found!"; + if (iter->second.empty()) { + edm::LogWarning(mlDqmClient_) << "[NoiseHistograms::" << __func__ << "]" + << " Zero histograms found!"; continue; } - + // Retrieve pointers to profile histos std::vector profs; - Histos::const_iterator ihis = iter->second.begin(); - for ( ; ihis != iter->second.end(); ihis++ ) { - TProfile* prof = ExtractTObject().extract( (*ihis)->me_ ); - if ( prof ) { profs.push_back(prof); } + Histos::const_iterator ihis = iter->second.begin(); + for (; ihis != iter->second.end(); ihis++) { + TProfile* prof = ExtractTObject().extract((*ihis)->me_); + if (prof) { + profs.push_back(prof); + } //@@ Common mode histos?... //TH1F* his = ExtractTObject().extract( (*ihis)->me_ ); //if ( his ) { profs.push_back(his); } } - + // Perform histo analysis - NoiseAnalysis* anal = new NoiseAnalysis( iter->first ); - NoiseAlgorithm algo( this->pset(), anal ); - algo.analysis( profs ); - data()[iter->first] = anal; - if ( anal->isValid() ) { valid++; } - if ( !anal->getErrorCodes().empty() ) { + NoiseAnalysis* anal = new NoiseAnalysis(iter->first); + NoiseAlgorithm algo(this->pset(), anal); + algo.analysis(profs); + data()[iter->first] = anal; + if (anal->isValid()) { + valid++; + } + if (!anal->getErrorCodes().empty()) { errors[anal->getErrorCodes()[0]]++; } - } - - if ( !histos().empty() ) { - edm::LogVerbatim(mlDqmClient_) - << "[NoiseHistograms::" << __func__ << "]" - << " Analyzed histograms for " << histos().size() - << " FED channels, of which " << valid - << " (" << 100 * valid / histos().size() - << "%) are valid."; - if ( !errors.empty() ) { + + if (!histos().empty()) { + edm::LogVerbatim(mlDqmClient_) << "[NoiseHistograms::" << __func__ << "]" + << " Analyzed histograms for " << histos().size() << " FED channels, of which " + << valid << " (" << 100 * valid / histos().size() << "%) are valid."; + if (!errors.empty()) { uint16_t count = 0; std::stringstream ss; ss << std::endl; - std::map::const_iterator ii; - for ( ii = errors.begin(); ii != errors.end(); ++ii ) { - ss << " " << ii->first << ": " << ii->second << std::endl; - count += ii->second; + std::map::const_iterator ii; + for (ii = errors.begin(); ii != errors.end(); ++ii) { + ss << " " << ii->first << ": " << ii->second << std::endl; + count += ii->second; } - edm::LogWarning(mlDqmClient_) - << "[NoiseHistograms::" << __func__ << "]" - << " Found " << count << " errors (" - << 100 * count / histos().size() << "%): " - << ss.str(); + edm::LogWarning(mlDqmClient_) << "[NoiseHistograms::" << __func__ << "]" + << " Found " << count << " errors (" << 100 * count / histos().size() + << "%): " << ss.str(); } } else { - edm::LogWarning(mlDqmClient_) - << "[NoiseHistograms::" << __func__ << "]" - << " No histograms to analyze!"; + edm::LogWarning(mlDqmClient_) << "[NoiseHistograms::" << __func__ << "]" + << " No histograms to analyze!"; } - } -// ----------------------------------------------------------------------------- -/** */ +// ----------------------------------------------------------------------------- +/** */ void NoiseHistograms::printAnalyses() { Analyses::iterator ianal = data().begin(); Analyses::iterator janal = data().end(); - for ( ; ianal != janal; ++ianal ) { - if ( ianal->second ) { + for (; ianal != janal; ++ianal) { + if (ianal->second) { std::stringstream ss; - ianal->second->print( ss, 1 ); - ianal->second->print( ss, 2 ); - if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str(); - } else { edm::LogWarning(mlDqmClient_) << ss.str(); } + ianal->second->print(ss, 1); + ianal->second->print(ss, 2); + if (ianal->second->isValid()) { + LogTrace(mlDqmClient_) << ss.str(); + } else { + edm::LogWarning(mlDqmClient_) << ss.str(); + } } } } diff --git a/DQM/SiStripCommissioningClients/src/OptoScanHistograms.cc b/DQM/SiStripCommissioningClients/src/OptoScanHistograms.cc index bdebbc54b9b4c..bc649fd9b7a12 100644 --- a/DQM/SiStripCommissioningClients/src/OptoScanHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/OptoScanHistograms.cc @@ -15,117 +15,101 @@ using namespace sistrip; // ----------------------------------------------------------------------------- /** */ -OptoScanHistograms::OptoScanHistograms( const edm::ParameterSet& pset, - DQMStore* bei ) - : CommissioningHistograms( pset.getParameter("OptoScanParameters"), - bei, - sistrip::OPTO_SCAN ) -{ - factory_ = unique_ptr( new OptoScanSummaryFactory ); - LogTrace(mlDqmClient_) - << "[OptoScanHistograms::" << __func__ << "]" - << " Constructing object..."; +OptoScanHistograms::OptoScanHistograms(const edm::ParameterSet& pset, DQMStore* bei) + : CommissioningHistograms(pset.getParameter("OptoScanParameters"), bei, sistrip::OPTO_SCAN) { + factory_ = unique_ptr(new OptoScanSummaryFactory); + LogTrace(mlDqmClient_) << "[OptoScanHistograms::" << __func__ << "]" + << " Constructing object..."; } // ----------------------------------------------------------------------------- /** */ OptoScanHistograms::~OptoScanHistograms() { - LogTrace(mlDqmClient_) - << "[OptoScanHistograms::" << __func__ << "]" - << " Denstructing object..."; + LogTrace(mlDqmClient_) << "[OptoScanHistograms::" << __func__ << "]" + << " Denstructing object..."; } -// ----------------------------------------------------------------------------- -/** */ -void OptoScanHistograms::histoAnalysis( bool debug ) { - LogTrace(mlDqmClient_) - << "[OptoScanHistograms::" << __func__ << "]"; +// ----------------------------------------------------------------------------- +/** */ +void OptoScanHistograms::histoAnalysis(bool debug) { + LogTrace(mlDqmClient_) << "[OptoScanHistograms::" << __func__ << "]"; // Some initialisation uint16_t valid = 0; HistosMap::const_iterator iter; Analyses::iterator ianal; - std::map errors; - + std::map errors; + // Clear map holding analysis objects - for ( ianal = data().begin(); ianal != data().end(); ianal++ ) { - if ( ianal->second ) { delete ianal->second; } - } + for (ianal = data().begin(); ianal != data().end(); ianal++) { + if (ianal->second) { + delete ianal->second; + } + } data().clear(); - + // Iterate through map containing histograms - for ( iter = histos().begin(); - iter != histos().end(); iter++ ) { - + for (iter = histos().begin(); iter != histos().end(); iter++) { // Check vector of histos is not empty - if ( iter->second.empty() ) { - edm::LogWarning(mlDqmClient_) - << "[OptoScanHistograms::" << __func__ << "]" - << " Zero histograms found!"; + if (iter->second.empty()) { + edm::LogWarning(mlDqmClient_) << "[OptoScanHistograms::" << __func__ << "]" + << " Zero histograms found!"; continue; } - + // Retrieve pointers to histos std::vector profs; - Histos::const_iterator ihis = iter->second.begin(); - for ( ; ihis != iter->second.end(); ihis++ ) { - TProfile* prof = ExtractTObject().extract( (*ihis)->me_ ); - if ( prof ) { profs.push_back(prof); } - } + Histos::const_iterator ihis = iter->second.begin(); + for (; ihis != iter->second.end(); ihis++) { + TProfile* prof = ExtractTObject().extract((*ihis)->me_); + if (prof) { + profs.push_back(prof); + } + } // Perform histo analysis - OptoScanAnalysis* anal = new OptoScanAnalysis( iter->first ); - OptoScanAlgorithm algo( this->pset(), anal ); - algo.analysis( profs ); - data()[iter->first] = anal; - if ( anal->isValid() ) { valid++; } - if ( !anal->getErrorCodes().empty() ) { + OptoScanAnalysis* anal = new OptoScanAnalysis(iter->first); + OptoScanAlgorithm algo(this->pset(), anal); + algo.analysis(profs); + data()[iter->first] = anal; + if (anal->isValid()) { + valid++; + } + if (!anal->getErrorCodes().empty()) { errors[anal->getErrorCodes()[0]]++; } - } - - if ( !histos().empty() ) { - edm::LogVerbatim(mlDqmClient_) - << "[OptoScanHistograms::" << __func__ << "]" - << " Analyzed histograms for " << histos().size() - << " FED channels, of which " << valid - << " (" << 100 * valid / histos().size() - << "%) are valid."; + + if (!histos().empty()) { + edm::LogVerbatim(mlDqmClient_) << "[OptoScanHistograms::" << __func__ << "]" + << " Analyzed histograms for " << histos().size() << " FED channels, of which " + << valid << " (" << 100 * valid / histos().size() << "%) are valid."; } else { - edm::LogWarning(mlDqmClient_) - << "[OptoScanHistograms::" << __func__ << "]" - << " No histograms to analyze!"; + edm::LogWarning(mlDqmClient_) << "[OptoScanHistograms::" << __func__ << "]" + << " No histograms to analyze!"; } - if ( !histos().empty() ) { - edm::LogVerbatim(mlDqmClient_) - << "[OptoScanHistograms::" << __func__ << "]" - << " Analyzed histograms for " << histos().size() - << " FED channels, of which " << valid - << " (" << 100 * valid / histos().size() - << "%) are valid."; - if ( !errors.empty() ) { + if (!histos().empty()) { + edm::LogVerbatim(mlDqmClient_) << "[OptoScanHistograms::" << __func__ << "]" + << " Analyzed histograms for " << histos().size() << " FED channels, of which " + << valid << " (" << 100 * valid / histos().size() << "%) are valid."; + if (!errors.empty()) { uint16_t count = 0; std::stringstream ss; ss << std::endl; - std::map::const_iterator ii; - for ( ii = errors.begin(); ii != errors.end(); ++ii ) { - ss << " " << ii->first << ": " << ii->second << std::endl; - count += ii->second; + std::map::const_iterator ii; + for (ii = errors.begin(); ii != errors.end(); ++ii) { + ss << " " << ii->first << ": " << ii->second << std::endl; + count += ii->second; } - edm::LogWarning(mlDqmClient_) - << "[OptoScanHistograms::" << __func__ << "]" - << " Found " << count << " errors (" - << 100 * count / histos().size() << "%): " - << ss.str(); + edm::LogWarning(mlDqmClient_) << "[OptoScanHistograms::" << __func__ << "]" + << " Found " << count << " errors (" << 100 * count / histos().size() + << "%): " << ss.str(); } } else { - edm::LogWarning(mlDqmClient_) - << "[OptoScanHistograms::" << __func__ << "]" - << " No histograms to analyze!"; + edm::LogWarning(mlDqmClient_) << "[OptoScanHistograms::" << __func__ << "]" + << " No histograms to analyze!"; } - } // ----------------------------------------------------------------------------- @@ -133,20 +117,19 @@ void OptoScanHistograms::histoAnalysis( bool debug ) { void OptoScanHistograms::printAnalyses() { Analyses::iterator ianal = data().begin(); Analyses::iterator janal = data().end(); - for ( ; ianal != janal; ++ianal ) { - if ( ianal->second ) { + for (; ianal != janal; ++ianal) { + if (ianal->second) { std::stringstream ss; - if ( ianal->second->isValid() ) { - ianal->second->print( ss ); - LogTrace(mlDqmClient_) << ss.str(); + if (ianal->second->isValid()) { + ianal->second->print(ss); + LogTrace(mlDqmClient_) << ss.str(); } else { - ianal->second->print( ss, 0 ); - ianal->second->print( ss, 1 ); - ianal->second->print( ss, 2 ); - ianal->second->print( ss, 3 ); - edm::LogWarning(mlDqmClient_) << ss.str(); + ianal->second->print(ss, 0); + ianal->second->print(ss, 1); + ianal->second->print(ss, 2); + ianal->second->print(ss, 3); + edm::LogWarning(mlDqmClient_) << ss.str(); } } } } - diff --git a/DQM/SiStripCommissioningClients/src/PedestalsHistograms.cc b/DQM/SiStripCommissioningClients/src/PedestalsHistograms.cc index 05d486834b68a..e2fe00ab1554b 100644 --- a/DQM/SiStripCommissioningClients/src/PedestalsHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/PedestalsHistograms.cc @@ -15,121 +15,112 @@ using namespace sistrip; // ----------------------------------------------------------------------------- /** */ -PedestalsHistograms::PedestalsHistograms( const edm::ParameterSet& pset, - DQMStore* bei ) - : CommissioningHistograms( pset.getParameter("PedestalsParameters"), - bei, - sistrip::PEDESTALS ) -{ - factory_ = unique_ptr( new PedestalsSummaryFactory ); - LogTrace(mlDqmClient_) - << "[PedestalsHistograms::" << __func__ << "]" - << " Constructing object..."; +PedestalsHistograms::PedestalsHistograms(const edm::ParameterSet& pset, DQMStore* bei) + : CommissioningHistograms(pset.getParameter("PedestalsParameters"), bei, sistrip::PEDESTALS) { + factory_ = unique_ptr(new PedestalsSummaryFactory); + LogTrace(mlDqmClient_) << "[PedestalsHistograms::" << __func__ << "]" + << " Constructing object..."; } // ----------------------------------------------------------------------------- /** */ PedestalsHistograms::~PedestalsHistograms() { - LogTrace(mlDqmClient_) - << "[PedestalsHistograms::" << __func__ << "]" - << " Destructing object..."; + LogTrace(mlDqmClient_) << "[PedestalsHistograms::" << __func__ << "]" + << " Destructing object..."; } -// ----------------------------------------------------------------------------- -/** */ -void PedestalsHistograms::histoAnalysis( bool debug ) { - LogTrace(mlDqmClient_) - << "[PedestalsHistograms::" << __func__ << "]"; +// ----------------------------------------------------------------------------- +/** */ +void PedestalsHistograms::histoAnalysis(bool debug) { + LogTrace(mlDqmClient_) << "[PedestalsHistograms::" << __func__ << "]"; // Some initialisation uint16_t valid = 0; HistosMap::const_iterator iter; Analyses::iterator ianal; - std::map errors; + std::map errors; // Clear map holding analysis objects - for ( ianal = data().begin(); ianal != data().end(); ianal++ ) { - if ( ianal->second ) { delete ianal->second; } - } + for (ianal = data().begin(); ianal != data().end(); ianal++) { + if (ianal->second) { + delete ianal->second; + } + } data().clear(); - + // Iterate through map containing histograms - for ( iter = histos().begin(); - iter != histos().end(); iter++ ) { - + for (iter = histos().begin(); iter != histos().end(); iter++) { // Check vector of histos is not empty - if ( iter->second.empty() ) { - edm::LogWarning(mlDqmClient_) - << "[PedestalsHistograms::" << __func__ << "]" - << " Zero histograms found!"; + if (iter->second.empty()) { + edm::LogWarning(mlDqmClient_) << "[PedestalsHistograms::" << __func__ << "]" + << " Zero histograms found!"; continue; } - + // Retrieve pointers to profile histos std::vector profs; - Histos::const_iterator ihis = iter->second.begin(); - for ( ; ihis != iter->second.end(); ihis++ ) { - TProfile* prof = ExtractTObject().extract( (*ihis)->me_ ); - if ( prof ) { profs.push_back(prof); } + Histos::const_iterator ihis = iter->second.begin(); + for (; ihis != iter->second.end(); ihis++) { + TProfile* prof = ExtractTObject().extract((*ihis)->me_); + if (prof) { + profs.push_back(prof); + } //@@ Common mode histos?... //TH1F* his = ExtractTObject().extract( (*ihis)->me_ ); //if ( his ) { profs.push_back(his); } } - + // Perform histo analysis - PedestalsAnalysis* anal = new PedestalsAnalysis( iter->first ); - PedestalsAlgorithm algo( this->pset(), anal ); - algo.analysis( profs ); - data()[iter->first] = anal; - if ( anal->isValid() ) { valid++; } - if ( !anal->getErrorCodes().empty() ) { + PedestalsAnalysis* anal = new PedestalsAnalysis(iter->first); + PedestalsAlgorithm algo(this->pset(), anal); + algo.analysis(profs); + data()[iter->first] = anal; + if (anal->isValid()) { + valid++; + } + if (!anal->getErrorCodes().empty()) { errors[anal->getErrorCodes()[0]]++; } - } - - if ( !histos().empty() ) { - edm::LogVerbatim(mlDqmClient_) - << "[PedestalsHistograms::" << __func__ << "]" - << " Analyzed histograms for " << histos().size() - << " FED channels, of which " << valid - << " (" << 100 * valid / histos().size() - << "%) are valid."; - if ( !errors.empty() ) { + + if (!histos().empty()) { + edm::LogVerbatim(mlDqmClient_) << "[PedestalsHistograms::" << __func__ << "]" + << " Analyzed histograms for " << histos().size() << " FED channels, of which " + << valid << " (" << 100 * valid / histos().size() << "%) are valid."; + if (!errors.empty()) { uint16_t count = 0; std::stringstream ss; ss << std::endl; - std::map::const_iterator ii; - for ( ii = errors.begin(); ii != errors.end(); ++ii ) { - ss << " " << ii->first << ": " << ii->second << std::endl; - count += ii->second; + std::map::const_iterator ii; + for (ii = errors.begin(); ii != errors.end(); ++ii) { + ss << " " << ii->first << ": " << ii->second << std::endl; + count += ii->second; } - edm::LogWarning(mlDqmClient_) - << "[PedestalsHistograms::" << __func__ << "]" - << " Found " << count << " errors (" - << 100 * count / histos().size() << "%): " - << ss.str(); + edm::LogWarning(mlDqmClient_) << "[PedestalsHistograms::" << __func__ << "]" + << " Found " << count << " errors (" << 100 * count / histos().size() + << "%): " << ss.str(); } } else { - edm::LogWarning(mlDqmClient_) - << "[PedestalsHistograms::" << __func__ << "]" - << " No histograms to analyze!"; + edm::LogWarning(mlDqmClient_) << "[PedestalsHistograms::" << __func__ << "]" + << " No histograms to analyze!"; } - } -// ----------------------------------------------------------------------------- -/** */ +// ----------------------------------------------------------------------------- +/** */ void PedestalsHistograms::printAnalyses() { Analyses::iterator ianal = data().begin(); Analyses::iterator janal = data().end(); - for ( ; ianal != janal; ++ianal ) { - if ( ianal->second ) { + for (; ianal != janal; ++ianal) { + if (ianal->second) { std::stringstream ss; - ianal->second->print( ss, 1 ); - ianal->second->print( ss, 2 ); - if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str(); - } else { edm::LogWarning(mlDqmClient_) << ss.str(); } + ianal->second->print(ss, 1); + ianal->second->print(ss, 2); + if (ianal->second->isValid()) { + LogTrace(mlDqmClient_) << ss.str(); + } else { + edm::LogWarning(mlDqmClient_) << ss.str(); + } } } } diff --git a/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc b/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc index 7bd17f62a3650..36d40ebbdbdf9 100644 --- a/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/PedsFullNoiseHistograms.cc @@ -15,136 +15,125 @@ using namespace sistrip; // ----------------------------------------------------------------------------- /** */ -PedsFullNoiseHistograms::PedsFullNoiseHistograms( const edm::ParameterSet& pset, - DQMStore* bei ) - : CommissioningHistograms( pset.getParameter("PedsFullNoiseParameters"), - bei, - sistrip::PEDS_FULL_NOISE ) -{ - - factory_ = unique_ptr( new PedsFullNoiseSummaryFactory ); - LogTrace(mlDqmClient_) - << "[PedsFullNoiseHistograms::" << __func__ << "]" - << " Constructing object..."; +PedsFullNoiseHistograms::PedsFullNoiseHistograms(const edm::ParameterSet& pset, DQMStore* bei) + : CommissioningHistograms( + pset.getParameter("PedsFullNoiseParameters"), bei, sistrip::PEDS_FULL_NOISE) { + factory_ = unique_ptr(new PedsFullNoiseSummaryFactory); + LogTrace(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]" + << " Constructing object..."; } // ----------------------------------------------------------------------------- /** */ PedsFullNoiseHistograms::~PedsFullNoiseHistograms() { - LogTrace(mlDqmClient_) - << "[PedsFullNoiseHistograms::" << __func__ << "]" - << " Destructing object..."; + LogTrace(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]" + << " Destructing object..."; } -// ----------------------------------------------------------------------------- -/** */ -void PedsFullNoiseHistograms::histoAnalysis( bool debug ) { - - LogTrace(mlDqmClient_) - << "[PedsFullNoiseHistograms::" << __func__ << "]"; +// ----------------------------------------------------------------------------- +/** */ +void PedsFullNoiseHistograms::histoAnalysis(bool debug) { + LogTrace(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]"; // Some initialisation uint16_t valid = 0; HistosMap::const_iterator iter; Analyses::iterator ianal; - std::map errors; + std::map errors; // Clear map holding analysis objects - for ( ianal = data().begin(); ianal != data().end(); ianal++ ) { - if ( ianal->second ) { delete ianal->second; } - } + for (ianal = data().begin(); ianal != data().end(); ianal++) { + if (ianal->second) { + delete ianal->second; + } + } data().clear(); // Iterate through map containing histograms long int ichannel = 0; long int nchannel = histos().size(); - for ( iter = histos().begin(); - iter != histos().end(); iter++ ) { - + for (iter = histos().begin(); iter != histos().end(); iter++) { // Check vector of histos is not empty - if ( iter->second.empty() ) { - edm::LogWarning(mlDqmClient_) - << "[PedsFullNoiseHistograms::" << __func__ << "]" - << " Zero histograms found!"; + if (iter->second.empty()) { + edm::LogWarning(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]" + << " Zero histograms found!"; continue; } - + // Retrieve pointers to peds and noise histos std::vector hists; - Histos::const_iterator ihis = iter->second.begin(); + Histos::const_iterator ihis = iter->second.begin(); - for ( ; ihis != iter->second.end(); ihis++ ) { + for (; ihis != iter->second.end(); ihis++) { // pedestal and noise 1D profiles - TProfile* prof = ExtractTObject().extract( (*ihis)->me_ ); - if ( prof ) { hists.push_back(prof); + TProfile* prof = ExtractTObject().extract((*ihis)->me_); + if (prof) { + hists.push_back(prof); } // 2D noise histograms - TH2S * his2D = ExtractTObject().extract( (*ihis)->me_ ); - if ( his2D ) { - hists.push_back(his2D); } + TH2S* his2D = ExtractTObject().extract((*ihis)->me_); + if (his2D) { + hists.push_back(his2D); + } } - if(ichannel % 100 == 0) - edm::LogVerbatim(mlDqmClient_) - << "[PedsFullNoiseHistograms::" << __func__ << "]" - << " Analyzing channel " << ichannel << " out of "<first ); - PedsFullNoiseAlgorithm algo( this->pset(), anal ); - algo.analysis( hists ); + PedsFullNoiseAnalysis* anal = new PedsFullNoiseAnalysis(iter->first); + PedsFullNoiseAlgorithm algo(this->pset(), anal); + algo.analysis(hists); - data()[iter->first] = anal; - if (anal->isValid() ) { valid++; } - if (!anal->getErrorCodes().empty() ) { + data()[iter->first] = anal; + if (anal->isValid()) { + valid++; + } + if (!anal->getErrorCodes().empty()) { errors[anal->getErrorCodes()[0]]++; - } - + } } - if ( !histos().empty() ) { - edm::LogVerbatim(mlDqmClient_) - << "[PedsFullNoiseHistograms::" << __func__ << "]" - << " Analyzed histograms for " << histos().size() - << " FED channels, of which " << valid - << " (" << 100 * valid / histos().size() - << "%) are valid."; - if ( !errors.empty() ) { + if (!histos().empty()) { + edm::LogVerbatim(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]" + << " Analyzed histograms for " << histos().size() << " FED channels, of which " + << valid << " (" << 100 * valid / histos().size() << "%) are valid."; + if (!errors.empty()) { uint16_t count = 0; std::stringstream ss; ss << std::endl; - std::map::const_iterator ii; - for ( ii = errors.begin(); ii != errors.end(); ++ii ) { - ss << " " << ii->first << ": " << ii->second << std::endl; - count += ii->second; + std::map::const_iterator ii; + for (ii = errors.begin(); ii != errors.end(); ++ii) { + ss << " " << ii->first << ": " << ii->second << std::endl; + count += ii->second; } - edm::LogWarning(mlDqmClient_) - << "[PedsFullNoiseHistograms::" << __func__ << "]" - << " Found " << count << " errors (" - << 100 * count / histos().size() << "%): " - << ss.str(); + edm::LogWarning(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]" + << " Found " << count << " errors (" << 100 * count / histos().size() + << "%): " << ss.str(); } } else { - edm::LogWarning(mlDqmClient_) - << "[PedsFullNoiseHistograms::" << __func__ << "]" - << " No histograms to analyze!"; - } - + edm::LogWarning(mlDqmClient_) << "[PedsFullNoiseHistograms::" << __func__ << "]" + << " No histograms to analyze!"; + } } - -// ----------------------------------------------------------------------------- -/** */ + +// ----------------------------------------------------------------------------- +/** */ void PedsFullNoiseHistograms::printAnalyses() { Analyses::iterator ianal = data().begin(); Analyses::iterator janal = data().end(); - for ( ; ianal != janal; ++ianal ) { - if ( ianal->second ) { + for (; ianal != janal; ++ianal) { + if (ianal->second) { std::stringstream ss; - ianal->second->print( ss, 1 ); - ianal->second->print( ss, 2 ); - if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str(); - } else { edm::LogWarning(mlDqmClient_) << ss.str(); } + ianal->second->print(ss, 1); + ianal->second->print(ss, 2); + if (ianal->second->isValid()) { + LogTrace(mlDqmClient_) << ss.str(); + } else { + edm::LogWarning(mlDqmClient_) << ss.str(); + } } } } diff --git a/DQM/SiStripCommissioningClients/src/PedsOnlyHistograms.cc b/DQM/SiStripCommissioningClients/src/PedsOnlyHistograms.cc index 65231a92c970f..eaf31ca15001e 100644 --- a/DQM/SiStripCommissioningClients/src/PedsOnlyHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/PedsOnlyHistograms.cc @@ -15,121 +15,112 @@ using namespace sistrip; // ----------------------------------------------------------------------------- /** */ -PedsOnlyHistograms::PedsOnlyHistograms( const edm::ParameterSet& pset, - DQMStore* bei ) - : CommissioningHistograms( pset.getParameter("PedsOnlyParameters"), - bei, - sistrip::PEDS_ONLY ) -{ - factory_ = unique_ptr( new PedsOnlySummaryFactory ); - LogTrace(mlDqmClient_) - << "[PedsOnlyHistograms::" << __func__ << "]" - << " Constructing object..."; +PedsOnlyHistograms::PedsOnlyHistograms(const edm::ParameterSet& pset, DQMStore* bei) + : CommissioningHistograms(pset.getParameter("PedsOnlyParameters"), bei, sistrip::PEDS_ONLY) { + factory_ = unique_ptr(new PedsOnlySummaryFactory); + LogTrace(mlDqmClient_) << "[PedsOnlyHistograms::" << __func__ << "]" + << " Constructing object..."; } // ----------------------------------------------------------------------------- /** */ PedsOnlyHistograms::~PedsOnlyHistograms() { - LogTrace(mlDqmClient_) - << "[PedsOnlyHistograms::" << __func__ << "]" - << " Destructing object..."; + LogTrace(mlDqmClient_) << "[PedsOnlyHistograms::" << __func__ << "]" + << " Destructing object..."; } -// ----------------------------------------------------------------------------- -/** */ -void PedsOnlyHistograms::histoAnalysis( bool debug ) { - LogTrace(mlDqmClient_) - << "[PedsOnlyHistograms::" << __func__ << "]"; +// ----------------------------------------------------------------------------- +/** */ +void PedsOnlyHistograms::histoAnalysis(bool debug) { + LogTrace(mlDqmClient_) << "[PedsOnlyHistograms::" << __func__ << "]"; // Some initialisation uint16_t valid = 0; HistosMap::const_iterator iter; Analyses::iterator ianal; - std::map errors; + std::map errors; // Clear map holding analysis objects - for ( ianal = data().begin(); ianal != data().end(); ianal++ ) { - if ( ianal->second ) { delete ianal->second; } - } + for (ianal = data().begin(); ianal != data().end(); ianal++) { + if (ianal->second) { + delete ianal->second; + } + } data().clear(); - + // Iterate through map containing histograms - for ( iter = histos().begin(); - iter != histos().end(); iter++ ) { - + for (iter = histos().begin(); iter != histos().end(); iter++) { // Check vector of histos is not empty - if ( iter->second.empty() ) { - edm::LogWarning(mlDqmClient_) - << "[PedsOnlyHistograms::" << __func__ << "]" - << " Zero histograms found!"; + if (iter->second.empty()) { + edm::LogWarning(mlDqmClient_) << "[PedsOnlyHistograms::" << __func__ << "]" + << " Zero histograms found!"; continue; } - + // Retrieve pointers to profile histos std::vector profs; - Histos::const_iterator ihis = iter->second.begin(); - for ( ; ihis != iter->second.end(); ihis++ ) { - TProfile* prof = ExtractTObject().extract( (*ihis)->me_ ); - if ( prof ) { profs.push_back(prof); } + Histos::const_iterator ihis = iter->second.begin(); + for (; ihis != iter->second.end(); ihis++) { + TProfile* prof = ExtractTObject().extract((*ihis)->me_); + if (prof) { + profs.push_back(prof); + } //@@ Common mode histos?... //TH1F* his = ExtractTObject().extract( (*ihis)->me_ ); //if ( his ) { profs.push_back(his); } } - + // Perform histo analysis - PedsOnlyAnalysis* anal = new PedsOnlyAnalysis( iter->first ); - PedsOnlyAlgorithm algo( this->pset(), anal ); - algo.analysis( profs ); - data()[iter->first] = anal; - if ( anal->isValid() ) { valid++; } - if ( !anal->getErrorCodes().empty() ) { + PedsOnlyAnalysis* anal = new PedsOnlyAnalysis(iter->first); + PedsOnlyAlgorithm algo(this->pset(), anal); + algo.analysis(profs); + data()[iter->first] = anal; + if (anal->isValid()) { + valid++; + } + if (!anal->getErrorCodes().empty()) { errors[anal->getErrorCodes()[0]]++; } - } - - if ( !histos().empty() ) { - edm::LogVerbatim(mlDqmClient_) - << "[PedsOnlyHistograms::" << __func__ << "]" - << " Analyzed histograms for " << histos().size() - << " FED channels, of which " << valid - << " (" << 100 * valid / histos().size() - << "%) are valid."; - if ( !errors.empty() ) { + + if (!histos().empty()) { + edm::LogVerbatim(mlDqmClient_) << "[PedsOnlyHistograms::" << __func__ << "]" + << " Analyzed histograms for " << histos().size() << " FED channels, of which " + << valid << " (" << 100 * valid / histos().size() << "%) are valid."; + if (!errors.empty()) { uint16_t count = 0; std::stringstream ss; ss << std::endl; - std::map::const_iterator ii; - for ( ii = errors.begin(); ii != errors.end(); ++ii ) { - ss << " " << ii->first << ": " << ii->second << std::endl; - count += ii->second; + std::map::const_iterator ii; + for (ii = errors.begin(); ii != errors.end(); ++ii) { + ss << " " << ii->first << ": " << ii->second << std::endl; + count += ii->second; } - edm::LogWarning(mlDqmClient_) - << "[PedsOnlyHistograms::" << __func__ << "]" - << " Found " << count << " errors (" - << 100 * count / histos().size() << "%): " - << ss.str(); + edm::LogWarning(mlDqmClient_) << "[PedsOnlyHistograms::" << __func__ << "]" + << " Found " << count << " errors (" << 100 * count / histos().size() + << "%): " << ss.str(); } } else { - edm::LogWarning(mlDqmClient_) - << "[PedsOnlyHistograms::" << __func__ << "]" - << " No histograms to analyze!"; + edm::LogWarning(mlDqmClient_) << "[PedsOnlyHistograms::" << __func__ << "]" + << " No histograms to analyze!"; } - } -// ----------------------------------------------------------------------------- -/** */ +// ----------------------------------------------------------------------------- +/** */ void PedsOnlyHistograms::printAnalyses() { Analyses::iterator ianal = data().begin(); Analyses::iterator janal = data().end(); - for ( ; ianal != janal; ++ianal ) { - if ( ianal->second ) { + for (; ianal != janal; ++ianal) { + if (ianal->second) { std::stringstream ss; - ianal->second->print( ss, 1 ); - ianal->second->print( ss, 2 ); - if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str(); - } else { edm::LogWarning(mlDqmClient_) << ss.str(); } + ianal->second->print(ss, 1); + ianal->second->print(ss, 2); + if (ianal->second->isValid()) { + LogTrace(mlDqmClient_) << ss.str(); + } else { + edm::LogWarning(mlDqmClient_) << ss.str(); + } } } } diff --git a/DQM/SiStripCommissioningClients/src/SamplingHistograms.cc b/DQM/SiStripCommissioningClients/src/SamplingHistograms.cc index 3db9b8225f079..3f7ad319dadfb 100644 --- a/DQM/SiStripCommissioningClients/src/SamplingHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/SamplingHistograms.cc @@ -10,84 +10,76 @@ #include #include #include "TProfile.h" - + using namespace std; using namespace sistrip; // ----------------------------------------------------------------------------- /** */ -SamplingHistograms::SamplingHistograms( const edm::ParameterSet& pset, - DQMStore* bei, - const sistrip::RunType& task ) - : CommissioningHistograms( pset.getParameter("SamplingParameters"), - bei, - task ), - sOnCut_(3) -{ - LogTrace(mlDqmClient_) - << "[SamplingHistograms::" << __func__ << "]" - << " Constructing object..."; - factory_ = unique_ptr( new SamplingSummaryFactory ); +SamplingHistograms::SamplingHistograms(const edm::ParameterSet& pset, DQMStore* bei, const sistrip::RunType& task) + : CommissioningHistograms(pset.getParameter("SamplingParameters"), bei, task), sOnCut_(3) { + LogTrace(mlDqmClient_) << "[SamplingHistograms::" << __func__ << "]" + << " Constructing object..."; + factory_ = unique_ptr(new SamplingSummaryFactory); // retreive the latency code from the root file std::string dataPath = std::string(sistrip::collate_) + "/" + sistrip::root_ + "/latencyCode"; MonitorElement* codeElement = bei->get(dataPath); - if(codeElement) latencyCode_ = codeElement->getIntValue() ; - else latencyCode_ = 0; + if (codeElement) + latencyCode_ = codeElement->getIntValue(); + else + latencyCode_ = 0; } // ----------------------------------------------------------------------------- /** */ SamplingHistograms::~SamplingHistograms() { - LogTrace(mlDqmClient_) - << "[SamplingHistograms::" << __func__ << "]" - << " Deleting object..."; + LogTrace(mlDqmClient_) << "[SamplingHistograms::" << __func__ << "]" + << " Deleting object..."; } -// ----------------------------------------------------------------------------- -/** */ -void SamplingHistograms::histoAnalysis( bool debug ) { - +// ----------------------------------------------------------------------------- +/** */ +void SamplingHistograms::histoAnalysis(bool debug) { // Clear map holding analysis objects Analyses::iterator ianal; - for ( ianal = data().begin(); ianal != data().end(); ianal++ ) { - if ( ianal->second ) { delete ianal->second; } + for (ianal = data().begin(); ianal != data().end(); ianal++) { + if (ianal->second) { + delete ianal->second; + } } data().clear(); - + // Iterate through map containing vectors of profile histograms HistosMap::const_iterator iter = histos().begin(); - for ( ; iter != histos().end(); iter++ ) { + for (; iter != histos().end(); iter++) { // Check vector of histos is not empty (should be 1 histo) - if ( iter->second.empty() ) { - edm::LogWarning(mlDqmClient_) - << "[SamplingHistograms::" << __func__ << "]" - << " Zero collation histograms found!"; + if (iter->second.empty()) { + edm::LogWarning(mlDqmClient_) << "[SamplingHistograms::" << __func__ << "]" + << " Zero collation histograms found!"; continue; } - - // Retrieve pointers to profile histos for this FED channel + + // Retrieve pointers to profile histos for this FED channel vector profs; Histos::const_iterator ihis = iter->second.begin(); - for ( ; ihis != iter->second.end(); ihis++ ) { - TProfile* prof = ExtractTObject().extract( (*ihis)->me_ ); - if ( prof ) { profs.push_back(prof); } - } - + for (; ihis != iter->second.end(); ihis++) { + TProfile* prof = ExtractTObject().extract((*ihis)->me_); + if (prof) { + profs.push_back(prof); + } + } + // Perform histo analysis - SamplingAnalysis* anal = new SamplingAnalysis( iter->first ); + SamplingAnalysis* anal = new SamplingAnalysis(iter->first); anal->setSoNcut(sOnCut_); - SamplingAlgorithm algo( this->pset(), anal, latencyCode_ ); - algo.analysis( profs ); - data()[iter->first] = anal; - + SamplingAlgorithm algo(this->pset(), anal, latencyCode_); + algo.analysis(profs); + data()[iter->first] = anal; } - } -void SamplingHistograms::configure( const edm::ParameterSet& pset, const edm::EventSetup& ) -{ - //TODO: should use the parameter set. Why is this crashing ??? -// sOnCut_ = pset.getParameter("SignalToNoiseCut"); - sOnCut_ = 3.; +void SamplingHistograms::configure(const edm::ParameterSet& pset, const edm::EventSetup&) { + //TODO: should use the parameter set. Why is this crashing ??? + // sOnCut_ = pset.getParameter("SignalToNoiseCut"); + sOnCut_ = 3.; } - diff --git a/DQM/SiStripCommissioningClients/src/SiStripCommissioningOfflineClient.cc b/DQM/SiStripCommissioningClients/src/SiStripCommissioningOfflineClient.cc index 5ddb990c57e62..b262a200063fb 100644 --- a/DQM/SiStripCommissioningClients/src/SiStripCommissioningOfflineClient.cc +++ b/DQM/SiStripCommissioningClients/src/SiStripCommissioningOfflineClient.cc @@ -33,458 +33,425 @@ using namespace sistrip; // ----------------------------------------------------------------------------- -// -SiStripCommissioningOfflineClient::SiStripCommissioningOfflineClient( const edm::ParameterSet& pset ) - : bei_( edm::Service().operator->() ), - histos_(nullptr), - //inputFiles_( pset.getUntrackedParameter< std::vector >( "InputRootFiles", std::vector() ) ), - outputFileName_( pset.getUntrackedParameter( "OutputRootFile", "" ) ), - collateHistos_( !pset.getUntrackedParameter( "UseClientFile", false ) ), - analyzeHistos_( pset.getUntrackedParameter( "AnalyzeHistos", true ) ), - xmlFile_( (pset.getUntrackedParameter( "SummaryXmlFile", edm::FileInPath() )).fullPath() ), - createSummaryPlots_( false ), - clientHistos_( false ), - uploadToDb_( false ), - runType_(sistrip::UNKNOWN_RUN_TYPE), - runNumber_(0), - partitionName_(pset.existsAs("PartitionName") ? pset.getParameter("PartitionName") : ""), - map_(), - plots_(), - parameters_(pset) -{ - LogTrace(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Constructing object..."; - setInputFiles( inputFiles_, - pset.getUntrackedParameter( "FilePath" ), - pset.existsAs("PartitionName") ? pset.getParameter("PartitionName") : "", - pset.getUntrackedParameter("RunNumber"), - collateHistos_ ); +// +SiStripCommissioningOfflineClient::SiStripCommissioningOfflineClient(const edm::ParameterSet& pset) + : bei_(edm::Service().operator->()), + histos_(nullptr), + //inputFiles_( pset.getUntrackedParameter< std::vector >( "InputRootFiles", std::vector() ) ), + outputFileName_(pset.getUntrackedParameter("OutputRootFile", "")), + collateHistos_(!pset.getUntrackedParameter("UseClientFile", false)), + analyzeHistos_(pset.getUntrackedParameter("AnalyzeHistos", true)), + xmlFile_((pset.getUntrackedParameter("SummaryXmlFile", edm::FileInPath())).fullPath()), + createSummaryPlots_(false), + clientHistos_(false), + uploadToDb_(false), + runType_(sistrip::UNKNOWN_RUN_TYPE), + runNumber_(0), + partitionName_(pset.existsAs("PartitionName") ? pset.getParameter("PartitionName") + : ""), + map_(), + plots_(), + parameters_(pset) { + LogTrace(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Constructing object..."; + setInputFiles(inputFiles_, + pset.getUntrackedParameter("FilePath"), + pset.existsAs("PartitionName") ? pset.getParameter("PartitionName") : "", + pset.getUntrackedParameter("RunNumber"), + collateHistos_); } // ----------------------------------------------------------------------------- -// +// SiStripCommissioningOfflineClient::~SiStripCommissioningOfflineClient() { - LogTrace(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Destructing object..."; + LogTrace(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Destructing object..."; } // ----------------------------------------------------------------------------- -// -void SiStripCommissioningOfflineClient::beginRun( const edm::Run& run, const edm::EventSetup& setup ) { - LogTrace(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Analyzing root file(s)..."; +// +void SiStripCommissioningOfflineClient::beginRun(const edm::Run& run, const edm::EventSetup& setup) { + LogTrace(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Analyzing root file(s)..."; // Check for null pointer - if ( !bei_ ) { - edm::LogError(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " NULL pointer to DQMStore!" - << " Aborting..."; + if (!bei_) { + edm::LogError(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " NULL pointer to DQMStore!" + << " Aborting..."; return; } bei_->setVerbose(0); // Check if .root file can be opened std::vector::const_iterator ifile = inputFiles_.begin(); - for ( ; ifile != inputFiles_.end(); ifile++ ) { + for (; ifile != inputFiles_.end(); ifile++) { std::ifstream root_file; - root_file.open( ifile->c_str() ); - if( !root_file.is_open() ) { - edm::LogError(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " The input root file \"" << *ifile - << "\" could not be opened!" - << " Please check the path and filename!"; - } else { - root_file.close(); + root_file.open(ifile->c_str()); + if (!root_file.is_open()) { + edm::LogError(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " The input root file \"" << *ifile << "\" could not be opened!" + << " Please check the path and filename!"; + } else { + root_file.close(); std::string::size_type found = ifile->find(sistrip::dqmClientFileName_); - if ( found != std::string::npos && clientHistos_ ) { - edm::LogError(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " The input root files appear to be a mixture" - << " of \"Source\" and \"Client\" files!" - << " Aborting..."; - return; + if (found != std::string::npos && clientHistos_) { + edm::LogError(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " The input root files appear to be a mixture" + << " of \"Source\" and \"Client\" files!" + << " Aborting..."; + return; } - if ( found != std::string::npos && inputFiles_.size() != 1 ) { - edm::LogError(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " There appear to be multiple input \"Client\" root files!" - << " Aborting..."; - return; + if (found != std::string::npos && inputFiles_.size() != 1) { + edm::LogError(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " There appear to be multiple input \"Client\" root files!" + << " Aborting..."; + return; + } + if (found != std::string::npos) { + clientHistos_ = true; } - if ( found != std::string::npos ) { clientHistos_ = true; } } } - if ( clientHistos_ && inputFiles_.size() == 1 ) { - edm::LogVerbatim(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Collated histograms found in input root file \"" - << inputFiles_[0] << "\""; + if (clientHistos_ && inputFiles_.size() == 1) { + edm::LogVerbatim(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Collated histograms found in input root file \"" << inputFiles_[0] << "\""; } - + // Check if .xml file can be opened - if ( !xmlFile_.empty() ) { + if (!xmlFile_.empty()) { std::ifstream xml_file; - xml_file.open( xmlFile_.c_str() ); - if( !xml_file.is_open() ) { - edm::LogError(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " The SummaryPlot XML file \"" << xmlFile_ - << "\" could not be opened!" - << " Please check the path and filename!" - << " Aborting..."; + xml_file.open(xmlFile_.c_str()); + if (!xml_file.is_open()) { + edm::LogError(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " The SummaryPlot XML file \"" << xmlFile_ << "\" could not be opened!" + << " Please check the path and filename!" + << " Aborting..."; return; - } else { + } else { createSummaryPlots_ = true; - xml_file.close(); + xml_file.close(); } } // Open root file(s) and create ME's - if ( inputFiles_.empty() ) { - edm::LogError(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " No input root files specified!"; + if (inputFiles_.empty()) { + edm::LogError(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " No input root files specified!"; return; } - edm::LogVerbatim(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Opening root files. This may take some time!..."; + edm::LogVerbatim(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Opening root files. This may take some time!..."; std::vector::const_iterator jfile = inputFiles_.begin(); - for ( ; jfile != inputFiles_.end(); jfile++ ) { - LogTrace(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Opening root file \"" << *jfile - << "\"... (This may take some time.)"; - if ( clientHistos_ ) { - bei_->open( *jfile, false, sistrip::collate_, "" ); - } else { - bei_->open( *jfile, false, "SiStrip", sistrip::collate_ ); + for (; jfile != inputFiles_.end(); jfile++) { + LogTrace(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Opening root file \"" << *jfile << "\"... (This may take some time.)"; + if (clientHistos_) { + bei_->open(*jfile, false, sistrip::collate_, ""); + } else { + bei_->open(*jfile, false, "SiStrip", sistrip::collate_); } - LogTrace(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Opened root file \"" << *jfile << "\"!"; + LogTrace(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Opened root file \"" << *jfile << "\"!"; } - edm::LogVerbatim(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Opened " << inputFiles_.size() << " root files!"; - + edm::LogVerbatim(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Opened " << inputFiles_.size() << " root files!"; + // Retrieve list of histograms std::vector contents; - bei_->getContents( contents ); - + bei_->getContents(contents); + // If using client file, remove "source" histograms from list - if ( clientHistos_ ) { + if (clientHistos_) { std::vector temp; std::vector::iterator istr = contents.begin(); - for ( ; istr != contents.end(); istr++ ) { - if ( istr->find(sistrip::collate_) != std::string::npos ) { - temp.push_back( *istr ); + for (; istr != contents.end(); istr++) { + if (istr->find(sistrip::collate_) != std::string::npos) { + temp.push_back(*istr); } } contents.clear(); contents = temp; } - + // Some debug - LogTrace(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Found " << contents.size() - << " directories containing MonitorElements"; - + LogTrace(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Found " << contents.size() << " directories containing MonitorElements"; + // Some more debug if (false) { std::stringstream ss; ss << "[SiStripCommissioningOfflineClient::" << __func__ << "]" << " Directories found: " << std::endl; std::vector::iterator istr = contents.begin(); - for ( ; istr != contents.end(); istr++ ) { ss << " " << *istr << std::endl; } + for (; istr != contents.end(); istr++) { + ss << " " << *istr << std::endl; + } LogTrace(mlDqmClient_) << ss.str(); } - + // Extract run type from contents - runType_ = CommissioningHistograms::runType( bei_, contents ); - + runType_ = CommissioningHistograms::runType(bei_, contents); + // Extract run number from contents - runNumber_ = CommissioningHistograms::runNumber( bei_, contents ); + runNumber_ = CommissioningHistograms::runNumber(bei_, contents); // Copy custom information to the collated structure - CommissioningHistograms::copyCustomInformation( bei_, contents ); + CommissioningHistograms::copyCustomInformation(bei_, contents); // Check runType - if ( runType_ == sistrip::UNKNOWN_RUN_TYPE ) { - edm::LogError(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Unknown commissioning runType: " - << SiStripEnumsAndStrings::runType( runType_ ) - << " and run number is " << runNumber_; + if (runType_ == sistrip::UNKNOWN_RUN_TYPE) { + edm::LogError(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Unknown commissioning runType: " << SiStripEnumsAndStrings::runType(runType_) + << " and run number is " << runNumber_; return; } else { - edm::LogVerbatim(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Run type is " - << SiStripEnumsAndStrings::runType( runType_ ) - << " and run number is " << runNumber_; + edm::LogVerbatim(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Run type is " << SiStripEnumsAndStrings::runType(runType_) + << " and run number is " << runNumber_; } - + // Open and parse "summary plot" xml file - if ( createSummaryPlots_ ) { - edm::LogVerbatim(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Parsing summary plot XML file..."; + if (createSummaryPlots_) { + edm::LogVerbatim(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Parsing summary plot XML file..."; SummaryPlotXmlParser xml_file; xml_file.parseXML(xmlFile_); plots_ = xml_file.summaryPlots(runType_); - edm::LogVerbatim(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Parsed summary plot XML file and found " - << plots_.size() << " plots defined!"; + edm::LogVerbatim(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Parsed summary plot XML file and found " << plots_.size() << " plots defined!"; } else { - edm::LogWarning(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Null string for SummaryPlotXmlFile!" - << " No summary plots will be created!"; + edm::LogWarning(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Null string for SummaryPlotXmlFile!" + << " No summary plots will be created!"; } - + // Some debug std::stringstream ss; - ss << "[SiStripCommissioningOfflineClient::" << __func__ << "]" << std::endl - << " Input root files : "; - if ( inputFiles_.empty() ) { ss << "(none)"; } - else { + ss << "[SiStripCommissioningOfflineClient::" << __func__ << "]" << std::endl << " Input root files : "; + if (inputFiles_.empty()) { + ss << "(none)"; + } else { std::vector::const_iterator ifile = inputFiles_.begin(); - for ( ; ifile != inputFiles_.end(); ifile++ ) { - if ( ifile != inputFiles_.begin() ) { - ss << std::setw(25) << std::setfill(' ') << ": "; + for (; ifile != inputFiles_.end(); ifile++) { + if (ifile != inputFiles_.begin()) { + ss << std::setw(25) << std::setfill(' ') << ": "; } - ss << "\"" << *ifile << "\"" << std::endl; + ss << "\"" << *ifile << "\"" << std::endl; } } - ss << " Run type : \"" - << SiStripEnumsAndStrings::runType( runType_ ) << "\"" << std::endl + ss << " Run type : \"" << SiStripEnumsAndStrings::runType(runType_) << "\"" << std::endl << " Run number : " << runNumber_ << std::endl << " Summary plot XML file : "; - if ( xmlFile_.empty() ) { ss << "(none)"; } - else { ss << "\"" << xmlFile_ << "\""; } + if (xmlFile_.empty()) { + ss << "(none)"; + } else { + ss << "\"" << xmlFile_ << "\""; + } edm::LogVerbatim(mlDqmClient_) << ss.str(); // Virtual method that creates CommissioningHistogram object - LogTrace(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Creating CommissioningHistogram object..."; - createHistos(parameters_, setup); - if ( histos_ ) { - LogTrace(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Created CommissioningHistogram object!"; + LogTrace(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Creating CommissioningHistogram object..."; + createHistos(parameters_, setup); + if (histos_) { + LogTrace(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Created CommissioningHistogram object!"; } else { - edm::LogError(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " NULL pointer to CommissioningHistogram object!" - << " Aborting..."; + edm::LogError(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " NULL pointer to CommissioningHistogram object!" + << " Aborting..."; return; } - + // Perform collation - if ( histos_ ) { - histos_->extractHistograms( contents ); + if (histos_) { + histos_->extractHistograms(contents); } - + // Perform analysis - if ( analyzeHistos_ ) { - LogTrace(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Analyzing histograms..."; - if ( histos_ ) { histos_->histoAnalysis( true ); } - LogTrace(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Analyzed histograms!"; + if (analyzeHistos_) { + LogTrace(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Analyzing histograms..."; + if (histos_) { + histos_->histoAnalysis(true); + } + LogTrace(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Analyzed histograms!"; } else { - edm::LogWarning(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " No histogram analysis performed!"; + edm::LogWarning(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " No histogram analysis performed!"; } - + // Create summary plots - if ( createSummaryPlots_ ) { - edm::LogVerbatim(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Generating summary plots..."; - std::vector::const_iterator iplot = plots_.begin(); - for ( ; iplot != plots_.end(); iplot++ ) { - if ( histos_ ) { - histos_->createSummaryHisto( iplot->monitorable(), - iplot->presentation(), - iplot->level(), - iplot->granularity() ); + if (createSummaryPlots_) { + edm::LogVerbatim(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Generating summary plots..."; + std::vector::const_iterator iplot = plots_.begin(); + for (; iplot != plots_.end(); iplot++) { + if (histos_) { + histos_->createSummaryHisto(iplot->monitorable(), iplot->presentation(), iplot->level(), iplot->granularity()); } } - edm::LogVerbatim(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Generated summary plots!"; + edm::LogVerbatim(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Generated summary plots!"; } else { - edm::LogWarning(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " No summary plots generated!"; + edm::LogWarning(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " No summary plots generated!"; } - + // Save client root file - if ( histos_ ) { - bool save = parameters_.getUntrackedParameter( "SaveClientFile", true ); - if(save){ - if(runType_ != sistrip::CALIBRATION_SCAN and runType_ != sistrip::CALIBRATION_SCAN_DECO){ - if(runType_ != sistrip::DAQ_SCOPE_MODE) - histos_->save( outputFileName_, runNumber_ ); - else - histos_->save( outputFileName_, runNumber_, partitionName_); + if (histos_) { + bool save = parameters_.getUntrackedParameter("SaveClientFile", true); + if (save) { + if (runType_ != sistrip::CALIBRATION_SCAN and runType_ != sistrip::CALIBRATION_SCAN_DECO) { + if (runType_ != sistrip::DAQ_SCOPE_MODE) + histos_->save(outputFileName_, runNumber_); + else + histos_->save(outputFileName_, runNumber_, partitionName_); + } else { + CalibrationHistograms* histo = dynamic_cast(histos_); + histo->save(outputFileName_, runNumber_); } - else{ - CalibrationHistograms* histo = dynamic_cast(histos_); - histo->save( outputFileName_, runNumber_ ); - } - } - else { - edm::LogVerbatim(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Client file not saved!"; + } else { + edm::LogVerbatim(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Client file not saved!"; } } - + // Virtual method to trigger the database upload uploadToConfigDb(); - + // Print analyses - if ( histos_ ) { - histos_->printAnalyses(); - histos_->printSummary(); + if (histos_) { + histos_->printAnalyses(); + histos_->printSummary(); } - + // Remove all ME/CME objects - if ( histos_ ) { histos_->remove(); } - - edm::LogVerbatim(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Finished analyzing root file(s)..."; - + if (histos_) { + histos_->remove(); + } + + edm::LogVerbatim(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Finished analyzing root file(s)..."; } - + // ----------------------------------------------------------------------------- -// -void SiStripCommissioningOfflineClient::analyze( const edm::Event& event, - const edm::EventSetup& setup ) { - if ( !(event.id().event()%10) ) { - LogTrace(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Empty event loop! User can kill job..."; +// +void SiStripCommissioningOfflineClient::analyze(const edm::Event& event, const edm::EventSetup& setup) { + if (!(event.id().event() % 10)) { + LogTrace(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Empty event loop! User can kill job..."; } } // ----------------------------------------------------------------------------- -// +// void SiStripCommissioningOfflineClient::endJob() {} // ----------------------------------------------------------------------------- -// -void SiStripCommissioningOfflineClient::createHistos( const edm::ParameterSet& pset, const edm::EventSetup& setup ) { - +// +void SiStripCommissioningOfflineClient::createHistos(const edm::ParameterSet& pset, const edm::EventSetup& setup) { // Check pointer - if ( histos_ ) { - edm::LogError(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " CommissioningHistogram object already exists!" - << " Aborting..."; + if (histos_) { + edm::LogError(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " CommissioningHistogram object already exists!" + << " Aborting..."; return; - } - + } + // Check pointer to BEI - if ( !bei_ ) { - edm::LogError(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " NULL pointer to DQMStore!"; + if (!bei_) { + edm::LogError(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " NULL pointer to DQMStore!"; return; } - // Create "commissioning histograms" object - if ( runType_ == sistrip::FAST_CABLING ) { histos_ = new FastFedCablingHistograms( pset, bei_ ); } - else if ( runType_ == sistrip::FED_CABLING ) { histos_ = new FedCablingHistograms( pset, bei_ ); } - else if ( runType_ == sistrip::APV_TIMING ) { histos_ = new ApvTimingHistograms( pset, bei_ ); } - else if ( runType_ == sistrip::OPTO_SCAN ) { histos_ = new OptoScanHistograms( pset, bei_ ); } - else if ( runType_ == sistrip::VPSP_SCAN ) { histos_ = new VpspScanHistograms( pset, bei_ ); } - else if ( runType_ == sistrip::PEDESTALS ) { histos_ = new PedestalsHistograms( pset, bei_ ); } - else if ( runType_ == sistrip::PEDS_FULL_NOISE ) { histos_ = new PedsFullNoiseHistograms( pset, bei_ ); } - else if ( runType_ == sistrip::PEDS_ONLY ) { histos_ = new PedsOnlyHistograms( pset, bei_ ); } - else if ( runType_ == sistrip::NOISE ) { histos_ = new NoiseHistograms( pset, bei_ ); } - else if ( runType_ == sistrip::APV_LATENCY || - runType_ == sistrip::FINE_DELAY ) { histos_ = new SamplingHistograms( pset, bei_,runType_ ); } - else if ( runType_ == sistrip::CALIBRATION || - runType_ == sistrip::CALIBRATION_DECO || - runType_ == sistrip::CALIBRATION_SCAN || - runType_ == sistrip::CALIBRATION_SCAN_DECO) { histos_ = new CalibrationHistograms( pset, bei_,runType_ ); } - else if ( runType_ == sistrip::DAQ_SCOPE_MODE) { histos_ = new DaqScopeModeHistograms( pset, bei_);} - else if ( runType_ == sistrip::UNDEFINED_RUN_TYPE ) { - histos_ = nullptr; - edm::LogError(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Undefined run type!"; + // Create "commissioning histograms" object + if (runType_ == sistrip::FAST_CABLING) { + histos_ = new FastFedCablingHistograms(pset, bei_); + } else if (runType_ == sistrip::FED_CABLING) { + histos_ = new FedCablingHistograms(pset, bei_); + } else if (runType_ == sistrip::APV_TIMING) { + histos_ = new ApvTimingHistograms(pset, bei_); + } else if (runType_ == sistrip::OPTO_SCAN) { + histos_ = new OptoScanHistograms(pset, bei_); + } else if (runType_ == sistrip::VPSP_SCAN) { + histos_ = new VpspScanHistograms(pset, bei_); + } else if (runType_ == sistrip::PEDESTALS) { + histos_ = new PedestalsHistograms(pset, bei_); + } else if (runType_ == sistrip::PEDS_FULL_NOISE) { + histos_ = new PedsFullNoiseHistograms(pset, bei_); + } else if (runType_ == sistrip::PEDS_ONLY) { + histos_ = new PedsOnlyHistograms(pset, bei_); + } else if (runType_ == sistrip::NOISE) { + histos_ = new NoiseHistograms(pset, bei_); + } else if (runType_ == sistrip::APV_LATENCY || runType_ == sistrip::FINE_DELAY) { + histos_ = new SamplingHistograms(pset, bei_, runType_); + } else if (runType_ == sistrip::CALIBRATION || runType_ == sistrip::CALIBRATION_DECO || + runType_ == sistrip::CALIBRATION_SCAN || runType_ == sistrip::CALIBRATION_SCAN_DECO) { + histos_ = new CalibrationHistograms(pset, bei_, runType_); + } else if (runType_ == sistrip::DAQ_SCOPE_MODE) { + histos_ = new DaqScopeModeHistograms(pset, bei_); + } else if (runType_ == sistrip::UNDEFINED_RUN_TYPE) { + histos_ = nullptr; + edm::LogError(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Undefined run type!"; return; - } else if ( runType_ == sistrip::UNKNOWN_RUN_TYPE ) { + } else if (runType_ == sistrip::UNKNOWN_RUN_TYPE) { histos_ = nullptr; - edm::LogError(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Unknown run type!"; + edm::LogError(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Unknown run type!"; return; } - histos_->configure(pset,setup); + histos_->configure(pset, setup); } // ----------------------------------------------------------------------------- -// -void SiStripCommissioningOfflineClient::setInputFiles( std::vector& files, - const std::string path, - const std::string partitionName, - uint32_t run_number, - bool collate_histos ) { - +// +void SiStripCommissioningOfflineClient::setInputFiles(std::vector& files, + const std::string path, + const std::string partitionName, + uint32_t run_number, + bool collate_histos) { std::string runStr; std::stringstream ss; ss << std::setfill('0') << std::setw(8) << run_number; runStr = ss.str(); - + std::string nameStr = ""; - if ( !collate_histos ) { nameStr = "SiStripCommissioningClient_"; } - else { nameStr = "SiStripCommissioningSource_"; } + if (!collate_histos) { + nameStr = "SiStripCommissioningClient_"; + } else { + nameStr = "SiStripCommissioningSource_"; + } LogTrace("TEST") << " runStr " << runStr; // Open directory DIR* dp; struct dirent* dirp; - if ( (dp = opendir(path.c_str())) == nullptr ) { - edm::LogError(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " Error locating directory \"" << path - << "\". No such directory!"; + if ((dp = opendir(path.c_str())) == nullptr) { + edm::LogError(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " Error locating directory \"" << path << "\". No such directory!"; return; } // Find compatible files - while ( (dirp = readdir(dp)) != nullptr ) { + while ((dirp = readdir(dp)) != nullptr) { std::string fileName(dirp->d_name); - bool goodName = ( fileName.find(nameStr) != std::string::npos ); - bool goodRun = ( fileName.find(runStr) != std::string::npos ); - bool rootFile = ( fileName.find(".root") != std::string::npos ); + bool goodName = (fileName.find(nameStr) != std::string::npos); + bool goodRun = (fileName.find(runStr) != std::string::npos); + bool rootFile = (fileName.find(".root") != std::string::npos); bool goodPartition = true; - if(not partitionName.empty()){ - goodPartition = ( fileName.find(partitionName) != std::string::npos ); + if (not partitionName.empty()) { + goodPartition = (fileName.find(partitionName) != std::string::npos); } //bool rootFile = ( fileName.rfind(".root",5) == fileName.size()-5 ); - if ( goodName && goodRun && rootFile && goodPartition ){ + if (goodName && goodRun && rootFile && goodPartition) { std::string entry = path; entry += "/"; entry += fileName; @@ -493,20 +460,19 @@ void SiStripCommissioningOfflineClient::setInputFiles( std::vector& } closedir(dp); - // Some debug - if ( !collate_histos && files.size() > 1 ) { + // Some debug + if (!collate_histos && files.size() > 1) { std::stringstream ss; ss << "[SiStripCommissioningOfflineClient::" << __func__ << "]" << " Found more than one client file!"; std::vector::const_iterator ifile = files.begin(); std::vector::const_iterator jfile = files.end(); - for ( ; ifile != jfile; ++ifile ) { ss << std::endl << *ifile; } + for (; ifile != jfile; ++ifile) { + ss << std::endl << *ifile; + } edm::LogError(mlDqmClient_) << ss.str(); - } else if ( files.empty() ) { - edm::LogError(mlDqmClient_) - << "[SiStripCommissioningOfflineClient::" << __func__ << "]" - << " No input files found!" ; + } else if (files.empty()) { + edm::LogError(mlDqmClient_) << "[SiStripCommissioningOfflineClient::" << __func__ << "]" + << " No input files found!"; } - } - diff --git a/DQM/SiStripCommissioningClients/src/SiStripTFile.cc b/DQM/SiStripCommissioningClients/src/SiStripTFile.cc index fba16c06580d9..a6d92d08abd58 100644 --- a/DQM/SiStripCommissioningClients/src/SiStripTFile.cc +++ b/DQM/SiStripCommissioningClients/src/SiStripTFile.cc @@ -1,7 +1,7 @@ #include "DQM/SiStripCommissioningClients/interface/SiStripTFile.h" #include "DataFormats/SiStripCommon/interface/SiStripEnumsAndStrings.h" -#include "DataFormats/SiStripCommon/interface/SiStripFecKey.h" +#include "DataFormats/SiStripCommon/interface/SiStripFecKey.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "TDirectory.h" #include "TH1.h" @@ -11,151 +11,143 @@ using namespace sistrip; //----------------------------------------------------------------------------- -SiStripTFile::SiStripTFile( const char* fname, - Option_t* option, - const char* ftitle, - Int_t compress ) : - TFile(fname,option,ftitle,compress), - runType_(sistrip::UNKNOWN_RUN_TYPE), - view_(sistrip::UNKNOWN_VIEW), - top_(gDirectory), - dqmTop_(nullptr), - sistripTop_(nullptr), - dqmFormat_(false) -{ +SiStripTFile::SiStripTFile(const char* fname, Option_t* option, const char* ftitle, Int_t compress) + : TFile(fname, option, ftitle, compress), + runType_(sistrip::UNKNOWN_RUN_TYPE), + view_(sistrip::UNKNOWN_VIEW), + top_(gDirectory), + dqmTop_(nullptr), + sistripTop_(nullptr), + dqmFormat_(false) { readDQMFormat(); } //----------------------------------------------------------------------------- -SiStripTFile::~SiStripTFile() {;} +SiStripTFile::~SiStripTFile() { ; } //----------------------------------------------------------------------------- -TDirectory* SiStripTFile::setDQMFormat( sistrip::RunType run_type, - sistrip::View view) { - +TDirectory* SiStripTFile::setDQMFormat(sistrip::RunType run_type, sistrip::View view) { view_ = view; runType_ = run_type; - + if (view == sistrip::CONTROL_VIEW) { std::stringstream ss(""); ss << sistrip::dqmRoot_ << sistrip::dir_ << sistrip::root_ << sistrip::dir_ << sistrip::controlView_; - top_ = addPath( ss.str() ); + top_ = addPath(ss.str()); dqmTop_ = GetDirectory(sistrip::dqmRoot_); sistripTop_ = dqmTop_->GetDirectory(sistrip::root_); dqmFormat_ = true; - + //TNamed defining commissioning runType std::stringstream run_type_label; std::stringstream run_type_title; run_type_label << sistrip::taskId_ << sistrip::sep_ << SiStripEnumsAndStrings::runType(runType_); run_type_title << "s=" << SiStripEnumsAndStrings::runType(runType_); - TNamed run_type_description(run_type_label.str().c_str(),run_type_title.str().c_str()); + TNamed run_type_description(run_type_label.str().c_str(), run_type_title.str().c_str()); sistripTop_->WriteTObject(&run_type_description); } else { - edm::LogWarning(mlDqmClient_) - << "[CommissioningFile::setDQMFormat]: Currently only implemented for Control View." - << std::endl; + edm::LogWarning(mlDqmClient_) << "[CommissioningFile::setDQMFormat]: Currently only implemented for Control View." + << std::endl; return nullptr; } - + return top_; } //----------------------------------------------------------------------------- TDirectory* SiStripTFile::readDQMFormat() { - //check directory structure and find readout view dqmTop_ = GetDirectory(sistrip::dqmRoot_); - if (dqmTop_) sistripTop_ = dqmTop_->GetDirectory(sistrip::root_); - if (sistripTop_) top_ = sistripTop_->GetDirectory(sistrip::controlView_); - if (top_!=gDirectory) view_ = sistrip::CONTROL_VIEW; - + if (dqmTop_) + sistripTop_ = dqmTop_->GetDirectory(sistrip::root_); + if (sistripTop_) + top_ = sistripTop_->GetDirectory(sistrip::controlView_); + if (top_ != gDirectory) + view_ = sistrip::CONTROL_VIEW; + //does file conform with DQM Format requirements? if (dqmTop_ && sistripTop_ && top_) { - dqmFormat_ = true;} - + dqmFormat_ = true; + } + // Search for commissioning run_type if (sistripTop_) { TList* keylist = sistripTop_->GetListOfKeys(); if (keylist) { - TObject* obj = keylist->First(); //the object + TObject* obj = keylist->First(); //the object if (obj) { bool loop = true; - while (loop) { - if (obj == keylist->Last()) {loop = false;} - if ( std::string(obj->GetName()).find(sistrip::taskId_) != std::string::npos ) { - runType_ = SiStripEnumsAndStrings::runType( std::string(obj->GetTitle()).substr(2,std::string::npos) ); - // cout << " name: " << std::string(obj->GetName()) - // << " title: " << std::string(obj->GetTitle()) - // << " runType: " << SiStripEnumsAndStrings::runType( runType_ ) - // << std::endl; + while (loop) { + if (obj == keylist->Last()) { + loop = false; + } + if (std::string(obj->GetName()).find(sistrip::taskId_) != std::string::npos) { + runType_ = SiStripEnumsAndStrings::runType(std::string(obj->GetTitle()).substr(2, std::string::npos)); + // cout << " name: " << std::string(obj->GetName()) + // << " title: " << std::string(obj->GetTitle()) + // << " runType: " << SiStripEnumsAndStrings::runType( runType_ ) + // << std::endl; } obj = keylist->After(obj); } } } - } + } return top_; } //----------------------------------------------------------------------------- -bool SiStripTFile::queryDQMFormat() { - return dqmFormat_; -} +bool SiStripTFile::queryDQMFormat() { return dqmFormat_; } //----------------------------------------------------------------------------- -TDirectory* SiStripTFile::top() { - return top_;} +TDirectory* SiStripTFile::top() { return top_; } //----------------------------------------------------------------------------- TDirectory* SiStripTFile::dqmTop() { if (!dqmFormat_) { - edm::LogWarning(mlDqmClient_) - << "[SiStripTFile::dqm]: Error requested dqm directory when not in dqm format." - << std::endl; + edm::LogWarning(mlDqmClient_) << "[SiStripTFile::dqm]: Error requested dqm directory when not in dqm format." + << std::endl; return nullptr; } - return dqmTop_;} - + return dqmTop_; +} //----------------------------------------------------------------------------- TDirectory* SiStripTFile::sistripTop() { if (!dqmFormat_) { - edm::LogWarning(mlDqmClient_) - << "[SiStripTFile::dqm]: Error requested dqm directory when not in dqm format." - << std::endl; + edm::LogWarning(mlDqmClient_) << "[SiStripTFile::dqm]: Error requested dqm directory when not in dqm format." + << std::endl; return nullptr; } - return sistripTop_;} + return sistripTop_; +} //----------------------------------------------------------------------------- -sistrip::RunType& SiStripTFile::runType() { - return runType_;} +sistrip::RunType& SiStripTFile::runType() { return runType_; } //----------------------------------------------------------------------------- -sistrip::View& SiStripTFile::View() { - return view_;} +sistrip::View& SiStripTFile::View() { return view_; } //----------------------------------------------------------------------------- void SiStripTFile::addDevice(unsigned int key) { - if (view_ == sistrip::CONTROL_VIEW) { - if (!dqmFormat_) setDQMFormat(sistrip::UNKNOWN_RUN_TYPE, sistrip::CONTROL_VIEW); + if (!dqmFormat_) + setDQMFormat(sistrip::UNKNOWN_RUN_TYPE, sistrip::CONTROL_VIEW); SiStripFecKey control_path(key); const std::string& directory_path = control_path.path(); cd(sistrip::dqmRoot_); @@ -163,66 +155,69 @@ void SiStripTFile::addDevice(unsigned int key) { } else { - edm::LogWarning(mlDqmClient_) - << "[CommissioningFile::addDevice]: Currently only implemented for Control View." - << std::endl; + edm::LogWarning(mlDqmClient_) << "[CommissioningFile::addDevice]: Currently only implemented for Control View." + << std::endl; } - } //----------------------------------------------------------------------------- -TDirectory* SiStripTFile::addPath( const std::string& path ) { - -// std::string path = dir; -// std::string root = sistrip::dqmRoot_+"/"+sistrip::root_+"/"; -// if ( path.find( root ) == std::string::npos ) { -// cerr << "Did not find \"" << root << "\" root in path: " << dir; -// path = root + dir; -// } - - std::vector directories; directories.reserve(10); +TDirectory* SiStripTFile::addPath(const std::string& path) { + // std::string path = dir; + // std::string root = sistrip::dqmRoot_+"/"+sistrip::root_+"/"; + // if ( path.find( root ) == std::string::npos ) { + // cerr << "Did not find \"" << root << "\" root in path: " << dir; + // path = root + dir; + // } + + std::vector directories; + directories.reserve(10); //fill std::vector std::string::const_iterator it, previous_dir, latest_dir; if (*(path.begin()) == std::string(sistrip::dir_)) { - it = previous_dir = latest_dir = path.begin();} - else {it = previous_dir = latest_dir = path.begin()-1;} + it = previous_dir = latest_dir = path.begin(); + } else { + it = previous_dir = latest_dir = path.begin() - 1; + } while (it != path.end()) { it++; if (*it == std::string(sistrip::dir_)) { - previous_dir = latest_dir; + previous_dir = latest_dir; latest_dir = it; - directories.push_back(std::string(previous_dir+1, latest_dir)); + directories.push_back(std::string(previous_dir + 1, latest_dir)); } } - if (latest_dir != (path.end()-1)) { - directories.push_back(std::string(latest_dir+1, path.end()));} - + if (latest_dir != (path.end() - 1)) { + directories.push_back(std::string(latest_dir + 1, path.end())); + } + //update file TDirectory* child = gDirectory; for (std::vector::const_iterator dir = directories.begin(); dir != directories.end(); dir++) { if (!dynamic_cast(child->Get(dir->c_str()))) { child = child->mkdir(dir->c_str()); - child->cd();} - else {child->Cd(dir->c_str()); child = gDirectory;} + child->cd(); + } else { + child->Cd(dir->c_str()); + child = gDirectory; + } } return child; } //----------------------------------------------------------------------------- -void SiStripTFile::findHistos( TDirectory* dir, std::map< std::string, std::vector >* histos ) { - - std::vector< TDirectory* > dirs; +void SiStripTFile::findHistos(TDirectory* dir, std::map >* histos) { + std::vector dirs; dirs.reserve(20000); dirs.push_back(dir); //loop through all directories and record tprofiles (matching label taskId_) contained within them. - while ( !dirs.empty() ) { + while (!dirs.empty()) { dirContent(dirs[0], &dirs, histos); dirs.erase(dirs.begin()); } @@ -230,41 +225,42 @@ void SiStripTFile::findHistos( TDirectory* dir, std::map< std::string, std::vect //----------------------------------------------------------------------------- - -void SiStripTFile::dirContent(TDirectory* dir, - std::vector* dirs, - std::map< std::string, std::vector >* histos ) { - +void SiStripTFile::dirContent(TDirectory* dir, + std::vector* dirs, + std::map >* histos) { TList* keylist = dir->GetListOfKeys(); if (keylist) { + TObject* obj = keylist->First(); // the object (dir or histo) - TObject* obj = keylist->First(); // the object (dir or histo) - - if ( obj ) { + if (obj) { bool loop = true; - while (loop) { - if (obj == keylist->Last()) {loop = false;} - - if (dynamic_cast(dir->Get(obj->GetName()))) { - TDirectory* child = dynamic_cast(dir->Get(obj->GetName())); - - //update record of directories - dirs->push_back(child); - } - - TH1* his = dynamic_cast( dir->Get(obj->GetName()) ); - if ( his ) { - bool found = false; - std::vector::iterator ihis = (*histos)[std::string(dir->GetPath())].begin(); - for ( ; ihis != (*histos)[std::string(dir->GetPath())].end(); ihis++ ) { - if ( (*ihis)->GetName() == his->GetName() ) { found = true; } - } - if ( !found ) { (*histos)[std::string(dir->GetPath())].push_back(his); } - } - obj = keylist->After(obj); + while (loop) { + if (obj == keylist->Last()) { + loop = false; + } + + if (dynamic_cast(dir->Get(obj->GetName()))) { + TDirectory* child = dynamic_cast(dir->Get(obj->GetName())); + + //update record of directories + dirs->push_back(child); + } + + TH1* his = dynamic_cast(dir->Get(obj->GetName())); + if (his) { + bool found = false; + std::vector::iterator ihis = (*histos)[std::string(dir->GetPath())].begin(); + for (; ihis != (*histos)[std::string(dir->GetPath())].end(); ihis++) { + if ((*ihis)->GetName() == his->GetName()) { + found = true; + } + } + if (!found) { + (*histos)[std::string(dir->GetPath())].push_back(his); + } + } + obj = keylist->After(obj); } } } - } - diff --git a/DQM/SiStripCommissioningClients/src/SummaryPlotXmlParser.cc b/DQM/SiStripCommissioningClients/src/SummaryPlotXmlParser.cc index d14af794ffa91..2e4ea33e500e3 100644 --- a/DQM/SiStripCommissioningClients/src/SummaryPlotXmlParser.cc +++ b/DQM/SiStripCommissioningClients/src/SummaryPlotXmlParser.cc @@ -22,174 +22,162 @@ const std::string SummaryPlotXmlParser::granularityAttr_ = "granularity"; // SummaryPlotXmlParser::SummaryPlotXmlParser() { plots_.clear(); - try { cms::concurrency::xercesInitialize(); } - catch ( const XMLException &f ) { - throw( std::runtime_error("Standard pool exception : Fatal Error on pool::TrivialFileCatalog") ); + try { + cms::concurrency::xercesInitialize(); + } catch (const XMLException& f) { + throw(std::runtime_error("Standard pool exception : Fatal Error on pool::TrivialFileCatalog")); } } // ----------------------------------------------------------------------------- // -std::vector SummaryPlotXmlParser::summaryPlots( const sistrip::RunType& run_type ) { - if( plots_.empty() ) { - edm::LogWarning(mlDqmClient_) - << "[SummaryPlotXmlParser" << __func__ << "]" - << " You have not called the parseXML function," - << " or your XML file is erronious" << std::endl; +std::vector SummaryPlotXmlParser::summaryPlots(const sistrip::RunType& run_type) { + if (plots_.empty()) { + edm::LogWarning(mlDqmClient_) << "[SummaryPlotXmlParser" << __func__ << "]" + << " You have not called the parseXML function," + << " or your XML file is erronious" << std::endl; } - if( plots_.find( run_type ) != plots_.end() ) { + if (plots_.find(run_type) != plots_.end()) { return plots_[run_type]; - } else { return std::vector(); } - + } else { + return std::vector(); + } } // ----------------------------------------------------------------------------- // -void SummaryPlotXmlParser::parseXML( const std::string& f ) { - +void SummaryPlotXmlParser::parseXML(const std::string& f) { plots_.clear(); - - try { + try { // Create parser and open XML document getDocument(f); - + // Retrieve root element DOMElement* root = this->doc()->getDocumentElement(); - if( !root ) { + if (!root) { std::stringstream ss; ss << "[SummaryPlotXmlParser::" << __func__ << "]" - << " Unable to find any elements!" - << " Empty xml document?..."; - throw( std::runtime_error( ss.str() ) ); + << " Unable to find any elements!" + << " Empty xml document?..."; + throw(std::runtime_error(ss.str())); } // Check on "root" tag - if( !XMLString::equals( root->getTagName(), XMLString::transcode(rootTag_.c_str()) ) ) { + if (!XMLString::equals(root->getTagName(), XMLString::transcode(rootTag_.c_str()))) { std::stringstream ss; ss << "[SummaryPlotXmlParser::" << __func__ << "]" - << " Did not find \"" << rootTag_ << "\" tag! " - << " Tag name is " - << XMLString::transcode(root->getNodeName()); + << " Did not find \"" << rootTag_ << "\" tag! " + << " Tag name is " << XMLString::transcode(root->getNodeName()); edm::LogWarning(mlDqmClient_) << ss.str(); return; } - + // Retrieve nodes in xml document DOMNodeList* nodes = root->getChildNodes(); - if ( nodes->getLength() == 0 ) { + if (nodes->getLength() == 0) { std::stringstream ss; ss << "[SummaryPlotXmlParser::" << __func__ << "]" - << " Unable to find any children nodes!" - << " Empty xml document?..."; - throw( std::runtime_error( ss.str() ) ); + << " Unable to find any children nodes!" + << " Empty xml document?..."; + throw(std::runtime_error(ss.str())); return; } -// LogTrace(mlDqmClient_) -// << "[SummaryPlotXmlParser::" << __func__ << "]" -// << " Found \"" << rootTag_ << "\" tag!"; - -// LogTrace(mlDqmClient_) -// << "[SummaryPlotXmlParser::" << __func__ << "]" -// << " Found " << nodes->getLength() -// << " children nodes!"; - - // Iterate through nodes - for( XMLSize_t inode = 0; inode < nodes->getLength(); ++inode ) { + // LogTrace(mlDqmClient_) + // << "[SummaryPlotXmlParser::" << __func__ << "]" + // << " Found \"" << rootTag_ << "\" tag!"; + + // LogTrace(mlDqmClient_) + // << "[SummaryPlotXmlParser::" << __func__ << "]" + // << " Found " << nodes->getLength() + // << " children nodes!"; + // Iterate through nodes + for (XMLSize_t inode = 0; inode < nodes->getLength(); ++inode) { // Check on whether node is element DOMNode* node = nodes->item(inode); - if( node->getNodeType() && - node->getNodeType() == DOMNode::ELEMENT_NODE ) { - - DOMElement* element = dynamic_cast( node ); - if ( !element ) { continue; } - - if( XMLString::equals( element->getTagName(), - XMLString::transcode(runTypeTag_.c_str()) ) ) { - - const XMLCh* attr = element->getAttribute( XMLString::transcode(runTypeAttr_.c_str()) ); - sistrip::RunType run_type = SiStripEnumsAndStrings::runType( XMLString::transcode(attr) ); - -// std::stringstream ss; -// ss << "[SummaryPlotXmlParser::" << __func__ << "]" -// << " Found \"" << runTypeTag_ << "\" tag!" << std::endl -// << " with tag name \"" << XMLString::transcode(element->getNodeName()) << "\"" << std::endl -// << " and attr \"" << runTypeAttr_ << "\" with value \"" << XMLString::transcode(attr) << "\""; -// LogTrace(mlDqmClient_) << ss.str(); - - // Retrieve nodes in xml document - DOMNodeList* children = node->getChildNodes(); - if ( nodes->getLength() == 0 ) { - std::stringstream ss; - ss << "[SummaryPlotXmlParser::" << __func__ << "]" - << " Unable to find any children nodes!" - << " Empty xml document?..."; - throw( std::runtime_error( ss.str() ) ); - return; - } - - // Iterate through nodes - for( XMLSize_t jnode = 0; jnode < children->getLength(); ++jnode ) { - - // Check on whether node is element - DOMNode* child = children->item(jnode); - if( child->getNodeType() && - child->getNodeType() == DOMNode::ELEMENT_NODE ) { - - DOMElement* elem = dynamic_cast( child ); - if ( !elem ) { continue; } - - if( XMLString::equals( elem->getTagName(), - XMLString::transcode(summaryPlotTag_.c_str()) ) ) { - - const XMLCh* mon = elem->getAttribute( XMLString::transcode(monitorableAttr_.c_str()) ); - const XMLCh* pres = elem->getAttribute( XMLString::transcode(presentationAttr_.c_str()) ); - const XMLCh* level = elem->getAttribute( XMLString::transcode(levelAttr_.c_str()) ); - const XMLCh* gran = elem->getAttribute( XMLString::transcode(granularityAttr_.c_str()) ); - - SummaryPlot plot( XMLString::transcode(mon), - XMLString::transcode(pres), - XMLString::transcode(gran), - XMLString::transcode(level) ); - plots_[run_type].push_back( plot ); - -// std::stringstream ss; -// ss << "[SummaryPlotXmlParser::" << __func__ << "]" -// << " Found \"" << summaryPlotTag_ << "\" tag!" << std::endl -// << " with tag name \"" << XMLString::transcode(elem->getNodeName()) << "\"" << std::endl -// << " and attr \"" << monitorableAttr_ << "\" with value \"" << XMLString::transcode(mon) << "\"" << std::endl -// << " and attr \"" << presentationAttr_ << "\" with value \"" << XMLString::transcode(pres) << "\"" << std::endl -// //<< " and attr \"" << viewAttr_ << "\" with value \"" << XMLString::transcode(view) << "\"" << std::endl -// << " and attr \"" << levelAttr_ << "\" with value \"" << XMLString::transcode(level) << "\"" << std::endl -// << " and attr \"" << granularityAttr_ << "\" with value \"" << XMLString::transcode(gran) << "\""; -// LogTrace(mlDqmClient_) << ss.str(); - - // Update SummaryPlot object and push back into map - - } - } - } - - } + if (node->getNodeType() && node->getNodeType() == DOMNode::ELEMENT_NODE) { + DOMElement* element = dynamic_cast(node); + if (!element) { + continue; + } + + if (XMLString::equals(element->getTagName(), XMLString::transcode(runTypeTag_.c_str()))) { + const XMLCh* attr = element->getAttribute(XMLString::transcode(runTypeAttr_.c_str())); + sistrip::RunType run_type = SiStripEnumsAndStrings::runType(XMLString::transcode(attr)); + + // std::stringstream ss; + // ss << "[SummaryPlotXmlParser::" << __func__ << "]" + // << " Found \"" << runTypeTag_ << "\" tag!" << std::endl + // << " with tag name \"" << XMLString::transcode(element->getNodeName()) << "\"" << std::endl + // << " and attr \"" << runTypeAttr_ << "\" with value \"" << XMLString::transcode(attr) << "\""; + // LogTrace(mlDqmClient_) << ss.str(); + + // Retrieve nodes in xml document + DOMNodeList* children = node->getChildNodes(); + if (nodes->getLength() == 0) { + std::stringstream ss; + ss << "[SummaryPlotXmlParser::" << __func__ << "]" + << " Unable to find any children nodes!" + << " Empty xml document?..."; + throw(std::runtime_error(ss.str())); + return; + } + + // Iterate through nodes + for (XMLSize_t jnode = 0; jnode < children->getLength(); ++jnode) { + // Check on whether node is element + DOMNode* child = children->item(jnode); + if (child->getNodeType() && child->getNodeType() == DOMNode::ELEMENT_NODE) { + DOMElement* elem = dynamic_cast(child); + if (!elem) { + continue; + } + + if (XMLString::equals(elem->getTagName(), XMLString::transcode(summaryPlotTag_.c_str()))) { + const XMLCh* mon = elem->getAttribute(XMLString::transcode(monitorableAttr_.c_str())); + const XMLCh* pres = elem->getAttribute(XMLString::transcode(presentationAttr_.c_str())); + const XMLCh* level = elem->getAttribute(XMLString::transcode(levelAttr_.c_str())); + const XMLCh* gran = elem->getAttribute(XMLString::transcode(granularityAttr_.c_str())); + + SummaryPlot plot(XMLString::transcode(mon), + XMLString::transcode(pres), + XMLString::transcode(gran), + XMLString::transcode(level)); + plots_[run_type].push_back(plot); + + // std::stringstream ss; + // ss << "[SummaryPlotXmlParser::" << __func__ << "]" + // << " Found \"" << summaryPlotTag_ << "\" tag!" << std::endl + // << " with tag name \"" << XMLString::transcode(elem->getNodeName()) << "\"" << std::endl + // << " and attr \"" << monitorableAttr_ << "\" with value \"" << XMLString::transcode(mon) << "\"" << std::endl + // << " and attr \"" << presentationAttr_ << "\" with value \"" << XMLString::transcode(pres) << "\"" << std::endl + // //<< " and attr \"" << viewAttr_ << "\" with value \"" << XMLString::transcode(view) << "\"" << std::endl + // << " and attr \"" << levelAttr_ << "\" with value \"" << XMLString::transcode(level) << "\"" << std::endl + // << " and attr \"" << granularityAttr_ << "\" with value \"" << XMLString::transcode(gran) << "\""; + // LogTrace(mlDqmClient_) << ss.str(); + + // Update SummaryPlot object and push back into map + } + } + } + } } } - } - catch( XMLException& e ) { + } catch (XMLException& e) { char* message = XMLString::transcode(e.getMessage()); std::ostringstream ss; ss << "[SummaryPlotXmlParser::" << __func__ << "]" << " Error parsing file: " << message << std::flush; - XMLString::release( &message ); + XMLString::release(&message); } - } // ----------------------------------------------------------------------------- // -std::ostream& operator<< ( std::ostream& os, const SummaryPlotXmlParser& parser ) { +std::ostream& operator<<(std::ostream& os, const SummaryPlotXmlParser& parser) { std::stringstream ss; parser.print(ss); os << ss.str(); @@ -197,23 +185,21 @@ std::ostream& operator<< ( std::ostream& os, const SummaryPlotXmlParser& parser } // ----------------------------------------------------------------------------- -// -void SummaryPlotXmlParser::print( std::stringstream& ss ) const { - ss << "[SummaryPlotXmlParser::SummaryPlot::" << __func__ << "]" +// +void SummaryPlotXmlParser::print(std::stringstream& ss) const { + ss << "[SummaryPlotXmlParser::SummaryPlot::" << __func__ << "]" << " Dumping contents of parsed XML file: " << std::endl; using namespace sistrip; typedef std::vector Plots; - std::map::const_iterator irun = plots_.begin(); - for ( ; irun != plots_.end(); irun++ ) { - ss << " RunType=\"" - << SiStripEnumsAndStrings::runType( irun->first ) - << "\"" << std::endl; - if ( irun->second.empty() ) { + std::map::const_iterator irun = plots_.begin(); + for (; irun != plots_.end(); irun++) { + ss << " RunType=\"" << SiStripEnumsAndStrings::runType(irun->first) << "\"" << std::endl; + if (irun->second.empty()) { ss << " No summary plots for this RunType!"; } else { Plots::const_iterator iplot = irun->second.begin(); - for ( ; iplot != irun->second.end(); iplot++ ) { - ss << *iplot << std::endl; + for (; iplot != irun->second.end(); iplot++) { + ss << *iplot << std::endl; } } } diff --git a/DQM/SiStripCommissioningClients/src/VpspScanHistograms.cc b/DQM/SiStripCommissioningClients/src/VpspScanHistograms.cc index adbc0110f490e..d3877b1958a7d 100644 --- a/DQM/SiStripCommissioningClients/src/VpspScanHistograms.cc +++ b/DQM/SiStripCommissioningClients/src/VpspScanHistograms.cc @@ -15,104 +15,92 @@ using namespace sistrip; // ----------------------------------------------------------------------------- /** */ -VpspScanHistograms::VpspScanHistograms( const edm::ParameterSet& pset, - DQMStore* bei ) - : CommissioningHistograms( pset.getParameter("VpspScanParameters"), - bei, - sistrip::VPSP_SCAN ) -{ - factory_ = unique_ptr( new VpspScanSummaryFactory ); - LogTrace(mlDqmClient_) - << "[VpspScanHistograms::" << __func__ << "]" - << " Constructing object..."; +VpspScanHistograms::VpspScanHistograms(const edm::ParameterSet& pset, DQMStore* bei) + : CommissioningHistograms(pset.getParameter("VpspScanParameters"), bei, sistrip::VPSP_SCAN) { + factory_ = unique_ptr(new VpspScanSummaryFactory); + LogTrace(mlDqmClient_) << "[VpspScanHistograms::" << __func__ << "]" + << " Constructing object..."; } // ----------------------------------------------------------------------------- /** */ VpspScanHistograms::~VpspScanHistograms() { - LogTrace(mlDqmClient_) - << "[VpspScanHistograms::" << __func__ << "]" - << " Denstructing object..."; + LogTrace(mlDqmClient_) << "[VpspScanHistograms::" << __func__ << "]" + << " Denstructing object..."; } -// ----------------------------------------------------------------------------- -/** */ -void VpspScanHistograms::histoAnalysis( bool debug ) { - LogTrace(mlDqmClient_) - << "[VpspScanHistograms::" << __func__ << "]"; - +// ----------------------------------------------------------------------------- +/** */ +void VpspScanHistograms::histoAnalysis(bool debug) { + LogTrace(mlDqmClient_) << "[VpspScanHistograms::" << __func__ << "]"; + // Some initialisation uint16_t valid = 0; HistosMap::const_iterator iter; Analyses::iterator ianal; - std::map errors; - + std::map errors; + // Clear map holding analysis objects - for ( ianal = data().begin(); ianal != data().end(); ianal++ ) { - if ( ianal->second ) { delete ianal->second; } - } + for (ianal = data().begin(); ianal != data().end(); ianal++) { + if (ianal->second) { + delete ianal->second; + } + } data().clear(); - + // Iterate through map containing histograms - for ( iter = histos().begin(); - iter != histos().end(); iter++ ) { - + for (iter = histos().begin(); iter != histos().end(); iter++) { // Check vector of histos is not empty - if ( iter->second.empty() ) { - edm::LogWarning(mlDqmClient_) - << "[VpspScanHistograms::" << __func__ << "]" - << " Zero histograms found!" << endl; + if (iter->second.empty()) { + edm::LogWarning(mlDqmClient_) << "[VpspScanHistograms::" << __func__ << "]" + << " Zero histograms found!" << endl; continue; } - - // Retrieve pointers to profile histos for this FED channel + + // Retrieve pointers to profile histos for this FED channel std::vector profs; - Histos::const_iterator ihis = iter->second.begin(); - for ( ; ihis != iter->second.end(); ihis++ ) { - TProfile* prof = ExtractTObject().extract( (*ihis)->me_ ); - if ( prof ) { profs.push_back(prof); } - } + Histos::const_iterator ihis = iter->second.begin(); + for (; ihis != iter->second.end(); ihis++) { + TProfile* prof = ExtractTObject().extract((*ihis)->me_); + if (prof) { + profs.push_back(prof); + } + } // Perform histo analysis - VpspScanAnalysis* anal = new VpspScanAnalysis( iter->first ); - VpspScanAlgorithm algo( this->pset(), anal ); - algo.analysis( profs ); - data()[iter->first] = anal; - if ( anal->isValid() ) { valid++; } - if ( !anal->getErrorCodes().empty() ) { + VpspScanAnalysis* anal = new VpspScanAnalysis(iter->first); + VpspScanAlgorithm algo(this->pset(), anal); + algo.analysis(profs); + data()[iter->first] = anal; + if (anal->isValid()) { + valid++; + } + if (!anal->getErrorCodes().empty()) { errors[anal->getErrorCodes()[0]]++; } - } - - if ( !histos().empty() ) { - edm::LogVerbatim(mlDqmClient_) - << "[VpspScanHistograms::" << __func__ << "]" - << " Analyzed histograms for " << histos().size() - << " FED channels, of which " << valid - << " (" << 100 * valid / histos().size() - << "%) are valid."; - if ( !errors.empty() ) { + + if (!histos().empty()) { + edm::LogVerbatim(mlDqmClient_) << "[VpspScanHistograms::" << __func__ << "]" + << " Analyzed histograms for " << histos().size() << " FED channels, of which " + << valid << " (" << 100 * valid / histos().size() << "%) are valid."; + if (!errors.empty()) { uint16_t count = 0; std::stringstream ss; ss << std::endl; - std::map::const_iterator ii; - for ( ii = errors.begin(); ii != errors.end(); ++ii ) { - ss << " " << ii->first << ": " << ii->second << std::endl; - count += ii->second; + std::map::const_iterator ii; + for (ii = errors.begin(); ii != errors.end(); ++ii) { + ss << " " << ii->first << ": " << ii->second << std::endl; + count += ii->second; } - edm::LogWarning(mlDqmClient_) - << "[VpspScanHistograms::" << __func__ << "]" - << " Found " << count << " errors (" - << 100 * count / histos().size() << "%): " - << ss.str(); + edm::LogWarning(mlDqmClient_) << "[VpspScanHistograms::" << __func__ << "]" + << " Found " << count << " errors (" << 100 * count / histos().size() + << "%): " << ss.str(); } } else { - edm::LogWarning(mlDqmClient_) - << "[VpspScanHistograms::" << __func__ << "]" - << " No histograms to analyze!"; + edm::LogWarning(mlDqmClient_) << "[VpspScanHistograms::" << __func__ << "]" + << " No histograms to analyze!"; } - } // ----------------------------------------------------------------------------- @@ -120,13 +108,16 @@ void VpspScanHistograms::histoAnalysis( bool debug ) { void VpspScanHistograms::printAnalyses() { Analyses::iterator ianal = data().begin(); Analyses::iterator janal = data().end(); - for ( ; ianal != janal; ++ianal ) { - if ( ianal->second ) { + for (; ianal != janal; ++ianal) { + if (ianal->second) { std::stringstream ss; - ianal->second->print( ss, 1 ); - ianal->second->print( ss, 2 ); - if ( ianal->second->isValid() ) { LogTrace(mlDqmClient_) << ss.str(); - } else { edm::LogWarning(mlDqmClient_) << ss.str(); } + ianal->second->print(ss, 1); + ianal->second->print(ss, 2); + if (ianal->second->isValid()) { + LogTrace(mlDqmClient_) << ss.str(); + } else { + edm::LogWarning(mlDqmClient_) << ss.str(); + } } } } diff --git a/DQM/SiStripMonitorHardware/interface/CMHistograms.hh b/DQM/SiStripMonitorHardware/interface/CMHistograms.hh index 2edc466b2700a..0a3842e8790be 100644 --- a/DQM/SiStripMonitorHardware/interface/CMHistograms.hh +++ b/DQM/SiStripMonitorHardware/interface/CMHistograms.hh @@ -2,7 +2,7 @@ // // Package: DQM/SiStripMonitorHardware // Class: CMHistograms -// +// /**\class CMHistograms DQM/SiStripMonitorHardware/interface/CMHistograms.hh Description: DQM source application to produce CM monitoring histograms for SiStrip data @@ -26,49 +26,42 @@ #include "DQM/SiStripMonitorHardware/interface/HistogramBase.hh" -class CMHistograms: public HistogramBase { - +class CMHistograms : public HistogramBase { public: - struct CMvalues { unsigned int ChannelID; //bool IsShot; //uint16_t Length; - std::pair Medians; + std::pair Medians; //std::pair ShotMedians; - std::pair PreviousMedians; + std::pair PreviousMedians; }; CMHistograms(); ~CMHistograms() override; - + //initialise histograms - void initialise(const edm::ParameterSet& iConfig, - std::ostringstream* pDebugStream - ) override; + void initialise(const edm::ParameterSet& iConfig, std::ostringstream* pDebugStream) override; void fillHistograms(const std::vector& aVec, float aTime, unsigned int aFedId); - - //book the top level histograms - void bookTopLevelHistograms(DQMStore::IBooker &, const TkDetMap*); + //book the top level histograms + void bookTopLevelHistograms(DQMStore::IBooker&, const TkDetMap*); //book individual FED histograms or book all FED level histograms at once - void bookFEDHistograms(DQMStore::IBooker & , unsigned int fedId); + void bookFEDHistograms(DQMStore::IBooker&, unsigned int fedId); //void bookFEDHistograms(unsigned int fedId, unsigned int aCategory); - void bookChannelsHistograms(DQMStore::IBooker & , unsigned int fedId); + void bookChannelsHistograms(DQMStore::IBooker&, unsigned int fedId); - void bookAllFEDHistograms(DQMStore::IBooker &); + void bookAllFEDHistograms(DQMStore::IBooker&); - bool tkHistoMapEnabled(unsigned int aIndex=0) override; + bool tkHistoMapEnabled(unsigned int aIndex = 0) override; - TkHistoMap * tkHistoMapPointer(unsigned int aIndex=0) override; + TkHistoMap* tkHistoMapPointer(unsigned int aIndex = 0) override; protected: - private: - //has individual FED histogram been booked? (index is FedId) std::vector histosBooked_; @@ -92,13 +85,11 @@ private: HistogramConfig medianperChannel_; HistogramConfig medianAPV0minusAPV1perChannel_; - std::map medianAPV1vsAPV0perFEDMap_; - std::map medianAPV0minusAPV1perFEDMap_; - std::map > medianperChannelMap_; - std::map > medianAPV0minusAPV1perChannelMap_; - -};//class - + std::map medianAPV1vsAPV0perFEDMap_; + std::map medianAPV0minusAPV1perFEDMap_; + std::map > medianperChannelMap_; + std::map > medianAPV0minusAPV1perChannelMap_; +}; //class -#endif //DQM_SiStripMonitorHardware_CMHistograms_HH +#endif //DQM_SiStripMonitorHardware_CMHistograms_HH diff --git a/DQM/SiStripMonitorHardware/interface/FEDErrors.hh b/DQM/SiStripMonitorHardware/interface/FEDErrors.hh index b1f6a69247adc..2e1ae85671b3b 100644 --- a/DQM/SiStripMonitorHardware/interface/FEDErrors.hh +++ b/DQM/SiStripMonitorHardware/interface/FEDErrors.hh @@ -33,9 +33,7 @@ class TkHistoMap; class TrackerTopology; class FEDErrors { - public: - struct FEDCounters { unsigned int nFEDErrors; unsigned int nDAQProblems; @@ -99,7 +97,7 @@ public: bool IsActive; bool Unlocked; bool OutOfSync; - bool operator <(const ChannelLevelErrors & aErr) const; + bool operator<(const ChannelLevelErrors& aErr) const; }; struct APVLevelErrors { @@ -111,10 +109,9 @@ public: bool APVError; bool APVAddressError; - bool operator <(const APVLevelErrors & aErr) const; + bool operator<(const APVLevelErrors& aErr) const; }; - struct LumiErrors { std::vector nTotal; std::vector nErrors; @@ -133,9 +130,9 @@ public: void initialiseEvent(); void initialiseFED(const unsigned int aFedID, - const SiStripFedCabling* aCabling, + const SiStripFedCabling* aCabling, const TrackerTopology* tTopo, - bool initVars = true); + bool initVars = true); //return false if no data, with or without cabled channels. bool checkDataPresent(const FEDRawData& aFedData); @@ -145,52 +142,47 @@ public: //return true if there were no errors at the level they are analysing //ie analyze FED returns true if there were no FED level errors which prevent the whole FED being unpacked - bool fillFatalFEDErrors(const FEDRawData& aFedData, - const unsigned int aPrintDebug); + bool fillFatalFEDErrors(const FEDRawData& aFedData, const unsigned int aPrintDebug); //expensive check: fatal but kept separate bool fillCorruptBuffer(const sistrip::FEDBuffer* aBuffer); //FE/Channel check: rate of channels with error (only considering connected channels) - float fillNonFatalFEDErrors(const sistrip::FEDBuffer* aBuffer, - const SiStripFedCabling* aCabling = nullptr); + float fillNonFatalFEDErrors(const sistrip::FEDBuffer* aBuffer, const SiStripFedCabling* aCabling = nullptr); //fill errors: define the order of importance. bool fillFEDErrors(const FEDRawData& aFedData, - bool & aFullDebug, - const unsigned int aPrintDebug, - unsigned int & aCounterMonitoring, - unsigned int & aCounterUnpacker, - const bool aDoMeds, - MonitorElement *aMedianHist0, - MonitorElement *aMedianHist1, - const bool aDoFEMaj, - std::vector > > & aFeMajFrac - ); + bool& aFullDebug, + const unsigned int aPrintDebug, + unsigned int& aCounterMonitoring, + unsigned int& aCounterUnpacker, + const bool aDoMeds, + MonitorElement* aMedianHist0, + MonitorElement* aMedianHist1, + const bool aDoFEMaj, + std::vector > >& aFeMajFrac); bool fillFEErrors(const sistrip::FEDBuffer* aBuffer, - const bool aDoFEMaj, - std::vector > > & aFeMajFrac); + const bool aDoFEMaj, + std::vector > >& aFeMajFrac); bool fillChannelErrors(const sistrip::FEDBuffer* aBuffer, - bool & aFullDebug, - const unsigned int aPrintDebug, - unsigned int & aCounterMonitoring, - unsigned int & aCounterUnpacker, - const bool aDoMeds, - MonitorElement *aMedianHist0, - MonitorElement *aMedianHist1 - ); + bool& aFullDebug, + const unsigned int aPrintDebug, + unsigned int& aCounterMonitoring, + unsigned int& aCounterUnpacker, + const bool aDoMeds, + MonitorElement* aMedianHist0, + MonitorElement* aMedianHist1); //1--Add all channels of a FED if anyFEDErrors or corruptBuffer //2--if aFillAll = true, add all channels anyway with 0 if no errors, so TkHistoMap is filled for all valid channels ... void fillBadChannelList(const bool doTkHistoMap, - TkHistoMap *aTkMapPointer, - MonitorElement *aFedIdVsApvId, - unsigned int & aNBadChannels, - unsigned int & aNBadActiveChannels, - unsigned int & aNBadChannels_perFEDID - ); + TkHistoMap* aTkMapPointer, + MonitorElement* aFedIdVsApvId, + unsigned int& aNBadChannels, + unsigned int& aNBadActiveChannels, + unsigned int& aNBadChannels_perFEDID); void fillEventProperties(long long dbx); @@ -208,59 +200,54 @@ public: const unsigned int fedID(); - FEDCounters & getFEDErrorsCounters(); + FEDCounters& getFEDErrorsCounters(); - ChannelCounters & getChannelErrorsCounters(); + ChannelCounters& getChannelErrorsCounters(); - FECounters & getFEErrorsCounters(); + FECounters& getFEErrorsCounters(); - FEDLevelErrors & getFEDLevelErrors(); + FEDLevelErrors& getFEDLevelErrors(); - EventProperties & getEventProperties(); + EventProperties& getEventProperties(); - std::vector & getFELevelErrors(); + std::vector& getFELevelErrors(); - std::vector & getChannelLevelErrors(); + std::vector& getChannelLevelErrors(); - std::vector & getAPVLevelErrors(); + std::vector& getAPVLevelErrors(); - std::vector > & getBadChannels(); + std::vector >& getBadChannels(); - const LumiErrors & getLumiErrors(); + const LumiErrors& getLumiErrors(); - void addBadFE(const FELevelErrors & aFE); + void addBadFE(const FELevelErrors& aFE); - void addBadChannel(const ChannelLevelErrors & aChannel); + void addBadChannel(const ChannelLevelErrors& aChannel); - void addBadAPV(const APVLevelErrors & aAPV, bool & aFirst); + void addBadAPV(const APVLevelErrors& aAPV, bool& aFirst); void incrementFEDCounters(); - void incrementChannelCounters(const FEDErrors::ChannelLevelErrors & aChannel); - - void incrementAPVCounters(const FEDErrors::APVLevelErrors & aAPV); + void incrementChannelCounters(const FEDErrors::ChannelLevelErrors& aChannel); - void print(const FEDCounters & aFEDCounter, std::ostream & aOs = std::cout); - void print(const FECounters & aFECounter, std::ostream & aOs = std::cout); - void print(const FEDLevelErrors & aFEDErr, std::ostream & aOs = std::cout); - void print(const FELevelErrors & aFEErr, std::ostream & aOs = std::cout); - void print(const ChannelLevelErrors & aErr, std::ostream & aOs = std::cout); - void print(const APVLevelErrors & aErr, std::ostream & aOs = std::cout); + void incrementAPVCounters(const FEDErrors::APVLevelErrors& aAPV); + void print(const FEDCounters& aFEDCounter, std::ostream& aOs = std::cout); + void print(const FECounters& aFECounter, std::ostream& aOs = std::cout); + void print(const FEDLevelErrors& aFEDErr, std::ostream& aOs = std::cout); + void print(const FELevelErrors& aFEErr, std::ostream& aOs = std::cout); + void print(const ChannelLevelErrors& aErr, std::ostream& aOs = std::cout); + void print(const APVLevelErrors& aErr, std::ostream& aOs = std::cout); protected: - private: - - void incrementLumiErrors(const bool hasError, - const unsigned int aSubDet); - + void incrementLumiErrors(const bool hasError, const unsigned int aSubDet); void processDet(const uint32_t aPrevId, - const uint16_t aPrevTot, - const bool doTkHistoMap, - uint16_t & nBad, - TkHistoMap *aTkMapPointer); + const uint16_t aPrevTot, + const bool doTkHistoMap, + uint16_t& nBad, + TkHistoMap* aTkMapPointer); unsigned int fedID_; @@ -278,7 +265,7 @@ private: std::vector feErrors_; std::vector chErrorsDetailed_; std::vector apvErrors_; - std::vector > chErrors_; + std::vector > chErrors_; bool failUnpackerFEDCheck_; @@ -286,7 +273,6 @@ private: EventProperties eventProp_; -};//class - +}; //class -#endif //DQM_SiStripMonitorHardware_FEDErrors_HH +#endif //DQM_SiStripMonitorHardware_FEDErrors_HH diff --git a/DQM/SiStripMonitorHardware/interface/FEDHistograms.hh b/DQM/SiStripMonitorHardware/interface/FEDHistograms.hh index d730ddd81c329..d29ff2e3bea9d 100644 --- a/DQM/SiStripMonitorHardware/interface/FEDHistograms.hh +++ b/DQM/SiStripMonitorHardware/interface/FEDHistograms.hh @@ -28,93 +28,68 @@ #include "DQM/SiStripMonitorHardware/interface/HistogramBase.hh" #include "DQM/SiStripMonitorHardware/interface/FEDErrors.hh" -class FEDHistograms: public HistogramBase { - +class FEDHistograms : public HistogramBase { public: - FEDHistograms(); ~FEDHistograms() override; //initialise histograms - void initialise(const edm::ParameterSet& iConfig, - std::ostringstream* pDebugStream - ) override; - - void fillCountersHistograms(const FEDErrors::FEDCounters & aFedLevelCounters, - const FEDErrors::ChannelCounters & aChLevelCounters, - const unsigned int aMaxSize, - const double aTime); - - void fillFEDHistograms(FEDErrors & aFedError, - const unsigned int aEvtSize, - bool lFullDebug, - const double aLumiSection, - unsigned int & NumBadChannels_perFEDID - ); + void initialise(const edm::ParameterSet &iConfig, std::ostringstream *pDebugStream) override; + + void fillCountersHistograms(const FEDErrors::FEDCounters &aFedLevelCounters, + const FEDErrors::ChannelCounters &aChLevelCounters, + const unsigned int aMaxSize, + const double aTime); + + void fillFEDHistograms(FEDErrors &aFedError, + const unsigned int aEvtSize, + bool lFullDebug, + const double aLumiSection, + unsigned int &NumBadChannels_perFEDID); void fillFEHistograms(const unsigned int aFedId, - const FEDErrors::FELevelErrors & aFeLevelErrors, - const FEDErrors::EventProperties & aEventProp - ); + const FEDErrors::FELevelErrors &aFeLevelErrors, + const FEDErrors::EventProperties &aEventProp); - void fillChannelsHistograms(const unsigned int aFedId, - const FEDErrors::ChannelLevelErrors & aChErr, - bool fullDebug - ); + void fillChannelsHistograms(const unsigned int aFedId, const FEDErrors::ChannelLevelErrors &aChErr, bool fullDebug); - void fillAPVsHistograms(const unsigned int aFedId, - const FEDErrors::APVLevelErrors & aAPVErr, - bool fullDebug - ); + void fillAPVsHistograms(const unsigned int aFedId, const FEDErrors::APVLevelErrors &aAPVErr, bool fullDebug); - void fillMajorityHistograms(const unsigned int aPart, - const float aValue, - const std::vector & aFedIdVec); + void fillMajorityHistograms(const unsigned int aPart, const float aValue, const std::vector &aFedIdVec); bool feMajHistosEnabled(); - void fillLumiHistograms(const FEDErrors::LumiErrors & aLumErr); + void fillLumiHistograms(const FEDErrors::LumiErrors &aLumErr); bool cmHistosEnabled(); - //book the top level histograms - void bookTopLevelHistograms(DQMStore::IBooker &, const TkDetMap*, std::string topFolderName = "SiStrip"); + //book the top level histograms + void bookTopLevelHistograms(DQMStore::IBooker &, const TkDetMap *, std::string topFolderName = "SiStrip"); //book individual FED histograms or book all FED level histograms at once - void bookFEDHistograms(DQMStore::IBooker & , unsigned int fedId, - bool fullDebugMode = false - ); + void bookFEDHistograms(DQMStore::IBooker &, unsigned int fedId, bool fullDebugMode = false); - void bookAllFEDHistograms(DQMStore::IBooker & , bool); + void bookAllFEDHistograms(DQMStore::IBooker &, bool); - bool tkHistoMapEnabled(unsigned int aIndex=0) override; + bool tkHistoMapEnabled(unsigned int aIndex = 0) override; - TkHistoMap * tkHistoMapPointer(unsigned int aIndex=0) override; + TkHistoMap *tkHistoMapPointer(unsigned int aIndex = 0) override; MonitorElement *cmHistPointer(bool aApv1); MonitorElement *getFedvsAPVpointer(); protected: - private: - //counting histograms (histogram of number of problems per event) HistogramConfig fedEventSize_; HistogramConfig fedMaxEventSizevsTime_; - HistogramConfig nFEDErrors_, - nFEDDAQProblems_, - nFEDsWithFEProblems_, - nFEDCorruptBuffers_, - nBadChannelStatusBits_, - nBadActiveChannelStatusBits_, - nUnconnectedChannels_, - nFEDsWithFEOverflows_, - nFEDsWithFEBadMajorityAddresses_, - nFEDsWithMissingFEs_; + HistogramConfig nFEDErrors_, nFEDDAQProblems_, nFEDsWithFEProblems_, nFEDCorruptBuffers_, nBadChannelStatusBits_, + nBadActiveChannelStatusBits_, nUnconnectedChannels_, nFEDsWithFEOverflows_, nFEDsWithFEBadMajorityAddresses_, + nFEDsWithMissingFEs_; HistogramConfig nFEDErrorsvsTime_; HistogramConfig fedErrorsVsIdVsLumi_; @@ -140,29 +115,11 @@ private: HistogramConfig nOutOfSyncvsTime_; //top level histograms - HistogramConfig anyFEDErrors_, - anyDAQProblems_, - corruptBuffers_, - invalidBuffers_, - badIDs_, - badChannelStatusBits_, - badActiveChannelStatusBits_, - badDAQCRCs_, - badFEDCRCs_, - badDAQPacket_, - dataMissing_, - dataPresent_, - feOverflows_, - badMajorityAddresses_, - badMajorityInPartition_, - feMissing_, - anyFEProblems_, - fedIdVsApvId_; - - HistogramConfig feTimeDiffTIB_, - feTimeDiffTOB_, - feTimeDiffTECB_, - feTimeDiffTECF_; + HistogramConfig anyFEDErrors_, anyDAQProblems_, corruptBuffers_, invalidBuffers_, badIDs_, badChannelStatusBits_, + badActiveChannelStatusBits_, badDAQCRCs_, badFEDCRCs_, badDAQPacket_, dataMissing_, dataPresent_, feOverflows_, + badMajorityAddresses_, badMajorityInPartition_, feMissing_, anyFEProblems_, fedIdVsApvId_; + + HistogramConfig feTimeDiffTIB_, feTimeDiffTOB_, feTimeDiffTECB_, feTimeDiffTECF_; HistogramConfig feTimeDiffvsDBX_; @@ -177,42 +134,28 @@ private: HistogramConfig medianAPV0_; HistogramConfig medianAPV1_; - HistogramConfig feOverflowDetailed_, - badMajorityAddressDetailed_, - feMissingDetailed_; + HistogramConfig feOverflowDetailed_, badMajorityAddressDetailed_, feMissingDetailed_; - HistogramConfig badStatusBitsDetailed_, - apvErrorDetailed_, - apvAddressErrorDetailed_, - unlockedDetailed_, - outOfSyncDetailed_; + HistogramConfig badStatusBitsDetailed_, apvErrorDetailed_, apvAddressErrorDetailed_, unlockedDetailed_, + outOfSyncDetailed_; //FED level histograms - std::map feOverflowDetailedMap_, - badMajorityAddressDetailedMap_, - feMissingDetailedMap_; - - std::map badStatusBitsDetailedMap_, - apvErrorDetailedMap_, - apvAddressErrorDetailedMap_, - unlockedDetailedMap_, - outOfSyncDetailedMap_; + std::map feOverflowDetailedMap_, badMajorityAddressDetailedMap_, + feMissingDetailedMap_; + std::map badStatusBitsDetailedMap_, apvErrorDetailedMap_, apvAddressErrorDetailedMap_, + unlockedDetailedMap_, outOfSyncDetailedMap_; HistogramConfig fedErrorsVsId_; //has individual FED histogram been booked? (index is FedId) - std::vector histosBooked_, - debugHistosBooked_; + std::vector histosBooked_, debugHistosBooked_; HistogramConfig tkMapConfig_; std::unique_ptr tkmapFED_; HistogramConfig lumiErrorFraction_; +}; //class -};//class - - - -#endif //DQM_SiStripMonitorHardware_FEDHistograms_HH +#endif //DQM_SiStripMonitorHardware_FEDHistograms_HH diff --git a/DQM/SiStripMonitorHardware/interface/HistogramBase.hh b/DQM/SiStripMonitorHardware/interface/HistogramBase.hh index c8b4e10c266d3..feb6cbbc5f1d0 100644 --- a/DQM/SiStripMonitorHardware/interface/HistogramBase.hh +++ b/DQM/SiStripMonitorHardware/interface/HistogramBase.hh @@ -26,9 +26,7 @@ #include "DQMServices/Core/interface/MonitorElement.h" class HistogramBase { - public: - struct HistogramConfig { HistogramConfig() : globalswitchon(true) {} MonitorElement* monitorEle; @@ -39,156 +37,135 @@ public: bool globalswitchon; }; - virtual ~HistogramBase(){}; //initialise histograms //make it pure abstract: implementation in derived class. - virtual void initialise(const edm::ParameterSet& iConfig, - std::ostringstream* pDebugStream - ) = 0; + virtual void initialise(const edm::ParameterSet& iConfig, std::ostringstream* pDebugStream) = 0; //fill a histogram if the pointer is not NULL (ie if it has been booked) - static void fillHistogram(HistogramConfig & histogram, - double value, - double weight=1. - ); + static void fillHistogram(HistogramConfig& histogram, double value, double weight = 1.); //fill a histogram if the pointer is not NULL (ie if it has been booked) - static void fillHistogram(MonitorElement* histogram, - double value, - double weight=1. - ); + static void fillHistogram(MonitorElement* histogram, double value, double weight = 1.); //fill a 2D profile trend histogram if the pointer is not NULL (ie if it has been booked) - static void fillHistogram2D(HistogramConfig & histogram, - double value, - double trendVar, - double weight=1. - ); + static void fillHistogram2D(HistogramConfig& histogram, double value, double trendVar, double weight = 1.); //fill tkHistoMap of percentage of bad channels per module - static void fillTkHistoMap(TkHistoMap *aMap, - uint32_t & detid, - float value - ); + static void fillTkHistoMap(TkHistoMap* aMap, uint32_t& detid, float value); //if one of more histo map, return name and pointer - virtual bool tkHistoMapEnabled(unsigned int aIndex=0) = 0; + virtual bool tkHistoMapEnabled(unsigned int aIndex = 0) = 0; - virtual TkHistoMap * tkHistoMapPointer(unsigned int aIndex=0) = 0; + virtual TkHistoMap* tkHistoMapPointer(unsigned int aIndex = 0) = 0; //load the config for a histogram from PSet called HistogramConfig (writes a debug message to stream if pointer is non-NULL) - void getConfigForHistogram(HistogramConfig & aConfig, - const std::string& configName, - const edm::ParameterSet& psetContainingConfigPSet, - std::ostringstream* pDebugStream - ); + void getConfigForHistogram(HistogramConfig& aConfig, + const std::string& configName, + const edm::ParameterSet& psetContainingConfigPSet, + std::ostringstream* pDebugStream); //book an individual hiostogram if enabled in config - void bookHistogram(DQMStore::IBooker & , HistogramConfig & aConfig, - const std::string& name, - const std::string& title, - const unsigned int nBins, - const double min, - const double max, - const std::string& xAxisTitle - ); + void bookHistogram(DQMStore::IBooker&, + HistogramConfig& aConfig, + const std::string& name, + const std::string& title, + const unsigned int nBins, + const double min, + const double max, + const std::string& xAxisTitle); //book an individual hiostogram if enabled in config - void bookHistogram(DQMStore::IBooker & , HistogramConfig & aConfig, - MonitorElement* & aHist, - const std::string& name, - const std::string& title, - const unsigned int nBins, - const double min, - const double max, - const std::string& xAxisTitle - ); + void bookHistogram(DQMStore::IBooker&, + HistogramConfig& aConfig, + MonitorElement*& aHist, + const std::string& name, + const std::string& title, + const unsigned int nBins, + const double min, + const double max, + const std::string& xAxisTitle); //book an individual hiostogram if enabled in config - void book2DHistogram(DQMStore::IBooker & , HistogramConfig & aConfig, - const std::string& name, - const std::string& title, - const unsigned int nBins, - const double min, - const double max, - const unsigned int nBinsY, - const double minY, - const double maxY, - const std::string& xAxisTitle, - const std::string& yAxisTitle - ); + void book2DHistogram(DQMStore::IBooker&, + HistogramConfig& aConfig, + const std::string& name, + const std::string& title, + const unsigned int nBins, + const double min, + const double max, + const unsigned int nBinsY, + const double minY, + const double maxY, + const std::string& xAxisTitle, + const std::string& yAxisTitle); //book an individual hiostogram if enabled in config - void book2DHistogram(DQMStore::IBooker & , HistogramConfig & aConfig, - MonitorElement* & aHist, - const std::string& name, - const std::string& title, - const unsigned int nBins, - const double min, - const double max, - const unsigned int nBinsY, - const double minY, - const double maxY, - const std::string& xAxisTitle, - const std::string& yAxisTitle - ); + void book2DHistogram(DQMStore::IBooker&, + HistogramConfig& aConfig, + MonitorElement*& aHist, + const std::string& name, + const std::string& title, + const unsigned int nBins, + const double min, + const double max, + const unsigned int nBinsY, + const double minY, + const double maxY, + const std::string& xAxisTitle, + const std::string& yAxisTitle); //same but using binning from config - void bookHistogram(DQMStore::IBooker & , HistogramConfig & aConfig, - const std::string& name, - const std::string& title, - const std::string& xAxisTitle - ); - - void bookProfile(DQMStore::IBooker & , HistogramConfig & aConfig, - const std::string& name, - const std::string& title, - const unsigned int nBins, - const double min, - const double max, - const double minY, - const double maxY, - const std::string& xAxisTitle, - const std::string& yAxisTitle - ); - - void bookProfile(DQMStore::IBooker & , HistogramConfig & aConfig, - const std::string& name, - const std::string& title, - const double minY, - const double maxY, - const std::string& xAxisTitle, - const std::string& yAxisTitle - ); - void bookProfile2D(DQMStore::IBooker & , HistogramConfig & aConfig, - const std::string& name, - const std::string& title, - const unsigned int nBinsx, - const double xmin, - const double xmax, - const unsigned int nBinsy, - const double ymin, - const double ymax, - const std::string& xAxisTitle, - const std::string& yAxisTitle - ); - - void bookProfile2D(DQMStore::IBooker & , HistogramConfig & aConfig, - const std::string& name, - const std::string& title, - const unsigned int nBinsy, - const double ymin, - const double ymax, - const std::string& xAxisTitle, - const std::string& yAxisTitle - ); -protected: - + void bookHistogram(DQMStore::IBooker&, + HistogramConfig& aConfig, + const std::string& name, + const std::string& title, + const std::string& xAxisTitle); + + void bookProfile(DQMStore::IBooker&, + HistogramConfig& aConfig, + const std::string& name, + const std::string& title, + const unsigned int nBins, + const double min, + const double max, + const double minY, + const double maxY, + const std::string& xAxisTitle, + const std::string& yAxisTitle); + + void bookProfile(DQMStore::IBooker&, + HistogramConfig& aConfig, + const std::string& name, + const std::string& title, + const double minY, + const double maxY, + const std::string& xAxisTitle, + const std::string& yAxisTitle); + void bookProfile2D(DQMStore::IBooker&, + HistogramConfig& aConfig, + const std::string& name, + const std::string& title, + const unsigned int nBinsx, + const double xmin, + const double xmax, + const unsigned int nBinsy, + const double ymin, + const double ymax, + const std::string& xAxisTitle, + const std::string& yAxisTitle); + + void bookProfile2D(DQMStore::IBooker&, + HistogramConfig& aConfig, + const std::string& name, + const std::string& title, + const unsigned int nBinsy, + const double ymin, + const double ymax, + const std::string& xAxisTitle, + const std::string& yAxisTitle); +protected: private: +}; //class -};//class - - - -#endif //DQM_SiStripMonitorHardware_HistogramBase_HH +#endif //DQM_SiStripMonitorHardware_HistogramBase_HH diff --git a/DQM/SiStripMonitorHardware/interface/SPYHistograms.h b/DQM/SiStripMonitorHardware/interface/SPYHistograms.h index 5f97cbb53792b..531bba3449b01 100644 --- a/DQM/SiStripMonitorHardware/interface/SPYHistograms.h +++ b/DQM/SiStripMonitorHardware/interface/SPYHistograms.h @@ -11,35 +11,33 @@ #include "DQM/SiStripMonitorHardware/interface/SiStripSpyUtilities.h" #include "DQM/SiStripMonitorHardware/interface/HistogramBase.hh" -class SPYHistograms: public HistogramBase { - - public: - +class SPYHistograms : public HistogramBase { +public: struct Trends { - unsigned int meanDigitalLow; // digitalLow averaged over all channels + unsigned int meanDigitalLow; // digitalLow averaged over all channels }; struct ErrorCounters { - unsigned int nNoData; //max=min=0 - unsigned int nLowRange; // max-min < min value to tune - unsigned int nHighRange; // max-min > max value to tune - unsigned int nMinZero; // min = 0 - unsigned int nMaxSat; //max = 1023 - unsigned int nLowPb; //min < min value to tune but > 0 - unsigned int nHighPb; //max > max value to tune but < 1023 - unsigned int nOOS;//header+trailer found with right distance between them but not in expected position - // or header found above 16 (no trailer found) - // or 2*2-high separated by 70 samples found (last in right position...) + unsigned int nNoData; //max=min=0 + unsigned int nLowRange; // max-min < min value to tune + unsigned int nHighRange; // max-min > max value to tune + unsigned int nMinZero; // min = 0 + unsigned int nMaxSat; //max = 1023 + unsigned int nLowPb; //min < min value to tune but > 0 + unsigned int nHighPb; //max > max value to tune but < 1023 + unsigned int nOOS; //header+trailer found with right distance between them but not in expected position + // or header found above 16 (no trailer found) + // or 2*2-high separated by 70 samples found (last in right position...) unsigned int nOtherPbs; - unsigned int nAPVError;//number of APVs with error bit 0 - unsigned int nAPVAddressError;//number of APV pairs with different APV addresses - unsigned int nNegPeds;//ped subtr value = 0 + unsigned int nAPVError; //number of APVs with error bit 0 + unsigned int nAPVAddressError; //number of APV pairs with different APV addresses + unsigned int nNegPeds; //ped subtr value = 0 }; //helper structs to fill histograms struct Errors { bool hasNoData; - bool hasLowRange; + bool hasLowRange; bool hasHighRange; bool hasMinZero; bool hasMaxSat; @@ -55,47 +53,38 @@ class SPYHistograms: public HistogramBase { }; SPYHistograms(); - + ~SPYHistograms() override; - + //initialise histograms - void initialise(const edm::ParameterSet& iConfig, - std::ostringstream* pDebugStream - ) override; + void initialise(const edm::ParameterSet& iConfig, std::ostringstream* pDebugStream) override; //book the top level histograms - void bookTopLevelHistograms(DQMStore::IBooker &, const TkDetMap*); + void bookTopLevelHistograms(DQMStore::IBooker&, const TkDetMap*); //book individual FED histograms or book all FED level histograms at once - void bookFEDHistograms(DQMStore::IBooker & , const unsigned int fedId, - const Errors & aErr, - bool doAll = false); + void bookFEDHistograms(DQMStore::IBooker&, const unsigned int fedId, const Errors& aErr, bool doAll = false); - void bookAllFEDHistograms(DQMStore::IBooker &); + void bookAllFEDHistograms(DQMStore::IBooker&); - void fillCountersHistograms(const ErrorCounters & aCounter, const double aTime); + void fillCountersHistograms(const ErrorCounters& aCounter, const double aTime); - void fillGainHistograms(const Trends & aTrendElement, const double aTime); + void fillGainHistograms(const Trends& aTrendElement, const double aTime); - void fillFEDHistograms(const Errors & aErr, const unsigned int aFedId); + void fillFEDHistograms(const Errors& aErr, const unsigned int aFedId); - void fillDetailedHistograms(const Errors & aErr, - const sistrip::SpyUtilities::Frame & aFrame, - const unsigned int aFedId, - const unsigned int aFedChannel); + void fillDetailedHistograms(const Errors& aErr, + const sistrip::SpyUtilities::Frame& aFrame, + const unsigned int aFedId, + const unsigned int aFedChannel); - bool tkHistoMapEnabled(unsigned int aIndex=0) override{ - return false; - }; + bool tkHistoMapEnabled(unsigned int aIndex = 0) override { return false; }; - TkHistoMap * tkHistoMapPointer(unsigned int aIndex=0) override{ - return nullptr; -}; + TkHistoMap* tkHistoMapPointer(unsigned int aIndex = 0) override { return nullptr; }; - protected: - - private: - //histos +protected: +private: + //histos //counting histograms (histogram of number of problems per event) HistogramConfig nNoData_; @@ -126,7 +115,7 @@ class SPYHistograms: public HistogramBase { HistogramConfig nNegativePedsvsTime_; HistogramConfig meanDigitalLowvsTime_; - //top level histograms + //top level histograms HistogramConfig noData_; HistogramConfig lowRange_; HistogramConfig highRange_; @@ -145,48 +134,43 @@ class SPYHistograms: public HistogramBase { HistogramConfig frameMax_; HistogramConfig baseline_; - //FED level histograms - HistogramConfig noDataDetailed_; - HistogramConfig lowRangeDetailed_; - HistogramConfig highRangeDetailed_; - HistogramConfig minZeroDetailed_; - HistogramConfig maxSatDetailed_; - HistogramConfig lowPbDetailed_; - HistogramConfig highPbDetailed_; - HistogramConfig outOfSyncDetailed_; - HistogramConfig otherPbsDetailed_; - HistogramConfig apvErrorBitDetailed_; - HistogramConfig apvAddressErrorDetailed_; - HistogramConfig negativePedsDetailed_; - - HistogramConfig positionOfFirstHeaderBitDetailed_; - HistogramConfig positionOfFirstTrailerBitDetailed_; - HistogramConfig distanceHeaderTrailerDetailed_; - - std::map noDataDetailedMap_; - std::map lowRangeDetailedMap_; - std::map highRangeDetailedMap_; - std::map minZeroDetailedMap_; - std::map maxSatDetailedMap_; - std::map lowPbDetailedMap_; - std::map highPbDetailedMap_; - std::map outOfSyncDetailedMap_; - std::map otherPbsDetailedMap_; - std::map apvErrorBitDetailedMap_; - std::map apvAddressErrorDetailedMap_; - std::map negativePedsDetailedMap_; - - std::map positionOfFirstHeaderBitDetailedMap_; - std::map positionOfFirstTrailerBitDetailedMap_; - std::map distanceHeaderTrailerDetailedMap_; + HistogramConfig noDataDetailed_; + HistogramConfig lowRangeDetailed_; + HistogramConfig highRangeDetailed_; + HistogramConfig minZeroDetailed_; + HistogramConfig maxSatDetailed_; + HistogramConfig lowPbDetailed_; + HistogramConfig highPbDetailed_; + HistogramConfig outOfSyncDetailed_; + HistogramConfig otherPbsDetailed_; + HistogramConfig apvErrorBitDetailed_; + HistogramConfig apvAddressErrorDetailed_; + HistogramConfig negativePedsDetailed_; + + HistogramConfig positionOfFirstHeaderBitDetailed_; + HistogramConfig positionOfFirstTrailerBitDetailed_; + HistogramConfig distanceHeaderTrailerDetailed_; + + std::map noDataDetailedMap_; + std::map lowRangeDetailedMap_; + std::map highRangeDetailedMap_; + std::map minZeroDetailedMap_; + std::map maxSatDetailedMap_; + std::map lowPbDetailedMap_; + std::map highPbDetailedMap_; + std::map outOfSyncDetailedMap_; + std::map otherPbsDetailedMap_; + std::map apvErrorBitDetailedMap_; + std::map apvAddressErrorDetailedMap_; + std::map negativePedsDetailedMap_; + + std::map positionOfFirstHeaderBitDetailedMap_; + std::map positionOfFirstTrailerBitDetailedMap_; + std::map distanceHeaderTrailerDetailedMap_; std::vector histosBooked_; -};//class - - - -#endif //DQM_SiStripMonitorHardware_SPYHistograms_HH - +}; //class +#endif //DQM_SiStripMonitorHardware_SPYHistograms_HH diff --git a/DQM/SiStripMonitorHardware/interface/SiStripFEDEmulator.h b/DQM/SiStripMonitorHardware/interface/SiStripFEDEmulator.h index 849157254b9b9..78b3c9a3dd174 100644 --- a/DQM/SiStripMonitorHardware/interface/SiStripFEDEmulator.h +++ b/DQM/SiStripMonitorHardware/interface/SiStripFEDEmulator.h @@ -33,48 +33,44 @@ namespace sistrip { class FEDEmulator { - public: FEDEmulator(); ~FEDEmulator(); void initialise(const bool byModule); - void initialiseModule(const uint32_t aDetId, - const uint32_t aNPairs, - const uint32_t aPair); + void initialiseModule(const uint32_t aDetId, const uint32_t aNPairs, const uint32_t aPair); - void retrievePedestals(const edm::ESHandle & aHandle); - void retrieveNoises(const edm::ESHandle & aHandle); + void retrievePedestals(const edm::ESHandle& aHandle); + void retrieveNoises(const edm::ESHandle& aHandle); - void subtractPedestals(const edm::DetSetVector::const_iterator & inputChannel, - std::vector & pedsDetSetData, - std::vector & noiseDetSetData, - std::vector & pedSubtrDetSetData, - std::vector & medsDetSetData, - const bool fillApvsForCM); + void subtractPedestals(const edm::DetSetVector::const_iterator& inputChannel, + std::vector& pedsDetSetData, + std::vector& noiseDetSetData, + std::vector& pedSubtrDetSetData, + std::vector& medsDetSetData, + const bool fillApvsForCM); - void subtractCM(const std::vector & pedSubtrDetSetData, - std::vector & cmSubtrDetSetData); + void subtractCM(const std::vector& pedSubtrDetSetData, + std::vector& cmSubtrDetSetData); - void zeroSuppress(const std::vector & cmSubtrDetSetData, - edm::DetSet & zsDetSetData, - const std::unique_ptr & algorithms); + void zeroSuppress(const std::vector& cmSubtrDetSetData, + edm::DetSet& zsDetSetData, + const std::unique_ptr& algorithms); uint32_t fedIndex(const uint16_t aFedChannel); - void fillPeds(const edm::DetSetVector::const_iterator & peds); - void fillNoises(const edm::DetSetVector::const_iterator & noise); + void fillPeds(const edm::DetSetVector::const_iterator& peds); + void fillNoises(const edm::DetSetVector::const_iterator& noise); - void fillMedians(const std::map >::const_iterator & meds); + void fillMedians(const std::map >::const_iterator& meds); - void print(std::ostream & aOs); - void printPeds(std::ostream & aOs); - void printNoises(std::ostream & aOs); - void printMeds(std::ostream & aOs); + void print(std::ostream& aOs); + void printPeds(std::ostream& aOs); + void printNoises(std::ostream& aOs); + void printMeds(std::ostream& aOs); private: - static const char* messageLabel_; bool byModule_; @@ -90,10 +86,7 @@ namespace sistrip { std::vector noises_; std::vector medians_; + }; //class FEDEmulator - - - };//class FEDEmulator - -}//namespace sistrip -#endif//DQM_SiStripMonitorHardware_SiStripFEDEmulator_H +} //namespace sistrip +#endif //DQM_SiStripMonitorHardware_SiStripFEDEmulator_H diff --git a/DQM/SiStripMonitorHardware/interface/SiStripFEDSpyBuffer.h b/DQM/SiStripMonitorHardware/interface/SiStripFEDSpyBuffer.h index 3a08fb01891d3..74d5eeeaf75a5 100644 --- a/DQM/SiStripMonitorHardware/interface/SiStripFEDSpyBuffer.h +++ b/DQM/SiStripMonitorHardware/interface/SiStripFEDSpyBuffer.h @@ -11,32 +11,32 @@ namespace sistrip { // // Constants // - + static const uint16_t FEDCH_PER_DELAY_CHIP = 4; - static const uint16_t DELAY_CHIPS_PER_FED = FEDCH_PER_FED/FEDCH_PER_DELAY_CHIP; - static const uint16_t SPY_DELAY_CHIP_PAYLOAD_SIZE_IN_BYTES = 376*4; // 376 32bit words - static const uint16_t SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES = SPY_DELAY_CHIP_PAYLOAD_SIZE_IN_BYTES+8; // Extra 8 bytes for counters - static const uint16_t SPY_DELAYCHIP_DATA_OFFSET_IN_BITS = 44; // Offset to start of data + static const uint16_t DELAY_CHIPS_PER_FED = FEDCH_PER_FED / FEDCH_PER_DELAY_CHIP; + static const uint16_t SPY_DELAY_CHIP_PAYLOAD_SIZE_IN_BYTES = 376 * 4; // 376 32bit words + static const uint16_t SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES = + SPY_DELAY_CHIP_PAYLOAD_SIZE_IN_BYTES + 8; // Extra 8 bytes for counters + static const uint16_t SPY_DELAYCHIP_DATA_OFFSET_IN_BITS = 44; // Offset to start of data //static const uint16_t SPY_SAMPLES_PER_CHANNEL = ( (SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES * 8) - SPY_DELAYCHIP_DATA_OFFSET_IN_BITS ) / 10 / FEDCH_PER_DELAY_CHIP; // TW Dirty hack to lose the 3 samples from the end that screw things up... static const uint16_t SPY_SAMPLES_PER_CHANNEL = 298; static const uint16_t SPY_BUFFER_SIZE_IN_BYTES = SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES * DELAY_CHIPS_PER_FED + 40; // Delaychip data + 8 bytes header for counters + 8 bytes for word with delay chip enable bits // + 16 bytes for DAQ header and trailer - + // // Class definitions // //class representing spy channel buffers - class FEDSpyBuffer : public FEDBufferBase - { + class FEDSpyBuffer : public FEDBufferBase { public: //construct from buffer FEDSpyBuffer(const uint8_t* fedBuffer, const size_t fedBufferSize); ~FEDSpyBuffer() override; void print(std::ostream& os) const override; - + //get the run number from the corresponding global run uint32_t globalRunNumber() const; //get the L1 ID stored in the spy header @@ -47,32 +47,33 @@ namespace sistrip { uint32_t delayChipL1ID(const uint8_t delayChip) const; //get the total event count after reading a given delay chip uint32_t delayChipTotalEventCount(const uint8_t delayChip) const; - + //checks that a delay chip is complete i.e. that it all came from the same event bool delayChipGood(const uint8_t delayChip) const; //checks that a channel is usable (i.e. that the delay chip it is on is good) bool channelGood(const uint8_t internalFEDannelNum) const override; + private: //mapping of channel index to position in data static const uint8_t channelPositionsInData_[FEDCH_PER_DELAY_CHIP]; - + //setup the channel objects void findChannels(); - + const uint8_t* payloadPointer_; uint16_t payloadLength_; uint8_t versionId_; }; - class FEDSpyChannelUnpacker - { + class FEDSpyChannelUnpacker { public: explicit FEDSpyChannelUnpacker(const FEDChannel& channel); uint16_t sampleNumber() const; uint16_t adc() const; bool hasData() const; - FEDSpyChannelUnpacker& operator ++ (); - FEDSpyChannelUnpacker& operator ++ (int); + FEDSpyChannelUnpacker& operator++(); + FEDSpyChannelUnpacker& operator++(int); + private: const uint32_t* data_; size_t currentOffset_; @@ -87,36 +88,27 @@ namespace sistrip { //FEDSpyChannelUnpacker inline FEDSpyChannelUnpacker::FEDSpyChannelUnpacker(const FEDChannel& channel) - : data_(reinterpret_cast(channel.data())), - currentOffset_(channel.offset()), - currentSample_(0), - valuesLeft_(channel.length()) - { - } + : data_(reinterpret_cast(channel.data())), + currentOffset_(channel.offset()), + currentSample_(0), + valuesLeft_(channel.length()) {} - inline uint16_t FEDSpyChannelUnpacker::sampleNumber() const - { - return currentSample_; - } + inline uint16_t FEDSpyChannelUnpacker::sampleNumber() const { return currentSample_; } - inline bool FEDSpyChannelUnpacker::hasData() const - { - return (valuesLeft_ != 0); - } + inline bool FEDSpyChannelUnpacker::hasData() const { return (valuesLeft_ != 0); } - inline FEDSpyChannelUnpacker& FEDSpyChannelUnpacker::operator ++ () - { - currentOffset_ += FEDCH_PER_DELAY_CHIP*10; + inline FEDSpyChannelUnpacker& FEDSpyChannelUnpacker::operator++() { + currentOffset_ += FEDCH_PER_DELAY_CHIP * 10; currentSample_++; valuesLeft_--; return (*this); } - - inline FEDSpyChannelUnpacker& FEDSpyChannelUnpacker::operator ++ (int) - { - ++(*this); return *this; + + inline FEDSpyChannelUnpacker& FEDSpyChannelUnpacker::operator++(int) { + ++(*this); + return *this; } -} +} // namespace sistrip -#endif //ndef DQM_SiStripMonitorHardware_SiStripFEDSpyBuffer_H +#endif //ndef DQM_SiStripMonitorHardware_SiStripFEDSpyBuffer_H diff --git a/DQM/SiStripMonitorHardware/interface/SiStripSpyDigiConverter.h b/DQM/SiStripMonitorHardware/interface/SiStripSpyDigiConverter.h index 3bf40ae7e4c1f..d45a2364e1cf4 100644 --- a/DQM/SiStripMonitorHardware/interface/SiStripSpyDigiConverter.h +++ b/DQM/SiStripMonitorHardware/interface/SiStripSpyDigiConverter.h @@ -14,56 +14,54 @@ class SiStripFedCabling; namespace sistrip { - - /*! \brief Converts scope mode like digis into virgin raw like digis by: + + /*! \brief Converts scope mode like digis into virgin raw like digis by: * -extracting the frame payload, * -reordering to physical order and * -merging the DetSets indexed by FedKey to DetSets indexed by DetId * * */ - class SpyDigiConverter - { - public: - typedef edm::DetSetVector DSVRawDigis; - - //all methods are static so no instances are needed but allow anyway - SpyDigiConverter() {} - ~SpyDigiConverter() {} - - /*! \brief Extract frames from the scope digis. + class SpyDigiConverter { + public: + typedef edm::DetSetVector DSVRawDigis; + + //all methods are static so no instances are needed but allow anyway + SpyDigiConverter() {} + ~SpyDigiConverter() {} + + /*! \brief Extract frames from the scope digis. * * If pAPVAddress is set, the map is filled with a map from FedKey to APVAddress. * minAllowedRange is the min allowed range of digis when determine the threshold. */ - static std::unique_ptr extractPayloadDigis(const DSVRawDigis * inputScopeDigis, - std::vector * pAPVAddresses, - const bool discardDigisWithAPVAddrErr, - const sistrip::SpyUtilities::FrameQuality & aQuality, - const uint16_t expectedPos); - - /* \brief Reorder from readout order to physical order */ - static std::unique_ptr reorderDigis(const DSVRawDigis* inputPayloadDigis); - - /* \brief Merge channel digis into modules. */ - static std::unique_ptr mergeModuleChannels(const DSVRawDigis* inputPhysicalOrderChannelDigis, const SiStripFedCabling& cabling); + static std::unique_ptr extractPayloadDigis(const DSVRawDigis* inputScopeDigis, + std::vector* pAPVAddresses, + const bool discardDigisWithAPVAddrErr, + const sistrip::SpyUtilities::FrameQuality& aQuality, + const uint16_t expectedPos); + + /* \brief Reorder from readout order to physical order */ + static std::unique_ptr reorderDigis(const DSVRawDigis* inputPayloadDigis); + + /* \brief Merge channel digis into modules. */ + static std::unique_ptr mergeModuleChannels(const DSVRawDigis* inputPhysicalOrderChannelDigis, + const SiStripFedCabling& cabling); + private: + typedef DSVRawDigis::detset DetSetRawDigis; - private: - typedef DSVRawDigis::detset DetSetRawDigis; + static void processFED(const uint16_t aPreviousFedId, + const bool discardDigisWithAPVAddrErr, + std::vector* pAPVAddresses, + std::vector& outputData, + std::vector& aAddrVec, + std::vector& aHeaderBitVec, + std::vector& aTrailBitVec, + std::vector& aFedScopeDigis); - static void processFED(const uint16_t aPreviousFedId, - const bool discardDigisWithAPVAddrErr, - std::vector * pAPVAddresses, - std::vector & outputData, - std::vector & aAddrVec, - std::vector & aHeaderBitVec, - std::vector & aTrailBitVec, - std::vector & aFedScopeDigis - ); + }; // end of SpyDigiConverter class. - }; // end of SpyDigiConverter class. - -} // end of sistrip namespace. +} // namespace sistrip -#endif // DQM_SiStripMonitorHardware_SiStripSpyDigiConverter_H +#endif // DQM_SiStripMonitorHardware_SiStripSpyDigiConverter_H diff --git a/DQM/SiStripMonitorHardware/interface/SiStripSpyEventMatcher.h b/DQM/SiStripMonitorHardware/interface/SiStripSpyEventMatcher.h index 34bf9b9557f8a..a0252bd3fe932 100644 --- a/DQM/SiStripMonitorHardware/interface/SiStripSpyEventMatcher.h +++ b/DQM/SiStripMonitorHardware/interface/SiStripSpyEventMatcher.h @@ -19,175 +19,184 @@ class FEDRawDataCollection; class SiStripRawDigi; namespace edm { - template class DetSetVector; - template struct DetSet; + template + class DetSetVector; + template + struct DetSet; class EventID; class ParameterSet; -} +} // namespace edm class SiStripFedCabling; namespace sistrip { - - class SpyEventMatcher - { + + class SpyEventMatcher { + public: + class SpyDataCollections { + public: + std::unique_ptr rawData; + std::unique_ptr > totalEventCounters; + std::unique_ptr > l1aCounters; + std::unique_ptr > apvAddresses; + std::unique_ptr > scopeDigis; + std::unique_ptr > payloadDigis; + std::unique_ptr > reorderedDigis; + std::unique_ptr > virginRawDigis; + SpyDataCollections(); + //NB. This will remove all elements in the containers pasted in. It does not copy the data. + SpyDataCollections(FEDRawDataCollection& theRawData, + std::vector& theTotalEventCounters, + std::vector& theL1ACounters, + std::vector& theAPVAddresses, + std::vector >* theScopeDigisVector, + std::vector >* thePayloadDigisVector, + std::vector >* theReorderedDigisVector, + std::vector >* theVirginRawDigisVector); + }; + struct MatchingOutput { + explicit MatchingOutput(FEDRawDataCollection& outputRawData); + FEDRawDataCollection& outputRawData_; + std::vector outputTotalEventCounters_; + std::vector outputL1ACounters_; + std::vector outputAPVAddresses_; + boost::shared_ptr > > outputScopeDigisVector_; + boost::shared_ptr > > outputPayloadDigisVector_; + boost::shared_ptr > > outputReorderedDigisVector_; + boost::shared_ptr > > outputVirginRawDigisVector_; + std::set alreadyMergedFeds_; + }; + + typedef edm::EventID EventID; + typedef std::set SpyEventList; + + SpyEventMatcher(const edm::ParameterSet& config); + virtual ~SpyEventMatcher(); + //set up the internal map of eventID, to apvAddress + void initialize(); + //check if there is any data for an event. Returns NULL if not or a pointer to a list of matches if they exist + const SpyEventList* matchesForEvent(const uint32_t eventId, const uint8_t apvAddress) const; + //get data for matching FEDs (non-const because reading events from the source modifies it) + void getMatchedCollections(const uint32_t eventId, + const uint8_t apvAddress, + const SpyEventList* matchingEvents, + const SiStripFedCabling& cabling, + SpyDataCollections& collectionsToCreate); + //helper for getMatchedCollections() + void getCollections(const edm::EventPrincipal& event, + const uint32_t eventId, + const uint8_t apvAddress, + const SiStripFedCabling& cabling, + MatchingOutput& matchingOutput); + + private: + class EventKey { + public: + EventKey(const uint32_t eventId, const uint8_t apvAddress); + uint32_t eventId() const { return eventId_; } + uint8_t apvAddress() const { return apvAddress_; } + bool operator<(const EventKey& rhs) const; + + private: + uint32_t eventId_; + uint8_t apvAddress_; + }; + typedef std::vector Counters; + //class to wrap counters that can take ownership of them or not. + //It behaves like the counters themself but, it actualy holds a pointer to them and dletes them if necessary + class CountersWrapper { public: - class SpyDataCollections - { - public: - std::unique_ptr< FEDRawDataCollection > rawData; - std::unique_ptr< std::vector > totalEventCounters; - std::unique_ptr< std::vector > l1aCounters; - std::unique_ptr< std::vector > apvAddresses; - std::unique_ptr< edm::DetSetVector > scopeDigis; - std::unique_ptr< edm::DetSetVector > payloadDigis; - std::unique_ptr< edm::DetSetVector > reorderedDigis; - std::unique_ptr< edm::DetSetVector > virginRawDigis; - SpyDataCollections(); - //NB. This will remove all elements in the containers pasted in. It does not copy the data. - SpyDataCollections(FEDRawDataCollection& theRawData, - std::vector& theTotalEventCounters, - std::vector& theL1ACounters, - std::vector& theAPVAddresses, - std::vector< edm::DetSet >* theScopeDigisVector, - std::vector< edm::DetSet >* thePayloadDigisVector, - std::vector< edm::DetSet >* theReorderedDigisVector, - std::vector< edm::DetSet >* theVirginRawDigisVector); - }; - struct MatchingOutput - { - explicit MatchingOutput(FEDRawDataCollection& outputRawData); - FEDRawDataCollection& outputRawData_; - std::vector outputTotalEventCounters_; - std::vector outputL1ACounters_; - std::vector outputAPVAddresses_; - boost::shared_ptr< std::vector< edm::DetSet > > outputScopeDigisVector_; - boost::shared_ptr< std::vector< edm::DetSet > > outputPayloadDigisVector_; - boost::shared_ptr< std::vector< edm::DetSet > > outputReorderedDigisVector_; - boost::shared_ptr< std::vector< edm::DetSet > > outputVirginRawDigisVector_; - std::set alreadyMergedFeds_; - }; - - typedef edm::EventID EventID; - typedef std::set SpyEventList; - - SpyEventMatcher(const edm::ParameterSet& config); - virtual ~SpyEventMatcher(); - //set up the internal map of eventID, to apvAddress - void initialize(); - //check if there is any data for an event. Returns NULL if not or a pointer to a list of matches if they exist - const SpyEventList* matchesForEvent(const uint32_t eventId, const uint8_t apvAddress) const; - //get data for matching FEDs (non-const because reading events from the source modifies it) - void getMatchedCollections(const uint32_t eventId, const uint8_t apvAddress, const SpyEventList* matchingEvents, - const SiStripFedCabling& cabling, SpyDataCollections& collectionsToCreate); - //helper for getMatchedCollections() - void getCollections(const edm::EventPrincipal& event, const uint32_t eventId, - const uint8_t apvAddress, const SiStripFedCabling& cabling, - MatchingOutput& matchingOutput); + CountersWrapper(const Counters* theCounters); + CountersWrapper(Counters* theCounters, const bool takeOwnership); + ~CountersWrapper(); + const Counters::value_type operator[](const size_t i) const { return (*pConst)[i]; }; + const Counters::value_type at(const size_t i) const { return pConst->at(i); }; + Counters::const_iterator begin() const { return pConst->begin(); } + Counters::const_iterator end() const { return pConst->end(); } private: - class EventKey - { - public: - EventKey(const uint32_t eventId, const uint8_t apvAddress); - uint32_t eventId() const { return eventId_; } - uint8_t apvAddress() const { return apvAddress_; } - bool operator < (const EventKey& rhs) const; - private: - uint32_t eventId_; - uint8_t apvAddress_; - }; - typedef std::vector Counters; - //class to wrap counters that can take ownership of them or not. - //It behaves like the counters themself but, it actualy holds a pointer to them and dletes them if necessary - class CountersWrapper - { - public: - CountersWrapper(const Counters* theCounters); - CountersWrapper(Counters* theCounters, const bool takeOwnership); - ~CountersWrapper(); - const Counters::value_type operator [] (const size_t i) const { return (*pConst)[i]; }; - const Counters::value_type at(const size_t i) const { return pConst->at(i); }; - Counters::const_iterator begin() const { return pConst->begin(); } - Counters::const_iterator end() const { return pConst->end(); } - private: - const Counters* pConst; - Counters* p; - bool deleteP; - }; - typedef boost::shared_ptr CountersPtr; - - //source for spy events - typedef edm::VectorInputSource Source; - //reference counted pointer to an event - - std::unique_ptr constructSource(const edm::ParameterSet& sourceConfig); - void addNextEventToMap(const edm::EventPrincipal& nextSpyEvent); - template static const T* getProduct(const edm::EventPrincipal& event, const edm::InputTag& tag); - static CountersPtr getCounters(const edm::EventPrincipal& event, const edm::InputTag& tag, const bool mapKeyIsByFedID = true); - void operator()(const edm::EventPrincipal& event); - static void findMatchingFeds(const uint32_t eventId, const uint8_t apvAddress, - CountersPtr totalEventCounters, - CountersPtr l1aCounters, - CountersPtr apvAddresses, - std::set& matchingFeds); - static void mergeMatchingData(const std::set& matchingFeds, - const FEDRawDataCollection& inputRawData, - CountersPtr inputTotalEventCounters, - CountersPtr inputL1ACounters, - CountersPtr inputAPVAddresses, - const edm::DetSetVector* inputScopeDigis, - const edm::DetSetVector* inputPayloadDigis, - const edm::DetSetVector* inputReorderedDigis, - const edm::DetSetVector* inputVirginRawDigis, - FEDRawDataCollection& outputRawData, - std::vector& outputTotalEventCounters, - std::vector& outputL1ACounters, - std::vector& outputAPVAddresses, - std::vector< edm::DetSet >* outputScopeDigisVector, - std::vector< edm::DetSet >* outputPayloadDigisVector, - std::vector< edm::DetSet >* outputReorderedDigisVector, - std::vector< edm::DetSet >* outputVirginRawDigisVector, - const SiStripFedCabling& cabling); - - std::map eventMatches_; - edm::InputTag rawDataTag_; - edm::InputTag totalEventCountersTag_; - edm::InputTag l1aCountersTag_; - edm::InputTag apvAddressesTag_; - edm::InputTag scopeDigisTag_; - edm::InputTag payloadDigisTag_; - edm::InputTag reorderedDigisTag_; - edm::InputTag virginRawDigisTag_; - uint32_t counterDiffMax_; - std::shared_ptr productRegistry_; - std::unique_ptr const source_; - std::unique_ptr processConfiguration_; - std::unique_ptr eventPrincipal_; - static const char* mlLabel_; + const Counters* pConst; + Counters* p; + bool deleteP; + }; + typedef boost::shared_ptr CountersPtr; + + //source for spy events + typedef edm::VectorInputSource Source; + //reference counted pointer to an event + + std::unique_ptr constructSource(const edm::ParameterSet& sourceConfig); + void addNextEventToMap(const edm::EventPrincipal& nextSpyEvent); + template + static const T* getProduct(const edm::EventPrincipal& event, const edm::InputTag& tag); + static CountersPtr getCounters(const edm::EventPrincipal& event, + const edm::InputTag& tag, + const bool mapKeyIsByFedID = true); + void operator()(const edm::EventPrincipal& event); + static void findMatchingFeds(const uint32_t eventId, + const uint8_t apvAddress, + CountersPtr totalEventCounters, + CountersPtr l1aCounters, + CountersPtr apvAddresses, + std::set& matchingFeds); + static void mergeMatchingData(const std::set& matchingFeds, + const FEDRawDataCollection& inputRawData, + CountersPtr inputTotalEventCounters, + CountersPtr inputL1ACounters, + CountersPtr inputAPVAddresses, + const edm::DetSetVector* inputScopeDigis, + const edm::DetSetVector* inputPayloadDigis, + const edm::DetSetVector* inputReorderedDigis, + const edm::DetSetVector* inputVirginRawDigis, + FEDRawDataCollection& outputRawData, + std::vector& outputTotalEventCounters, + std::vector& outputL1ACounters, + std::vector& outputAPVAddresses, + std::vector >* outputScopeDigisVector, + std::vector >* outputPayloadDigisVector, + std::vector >* outputReorderedDigisVector, + std::vector >* outputVirginRawDigisVector, + const SiStripFedCabling& cabling); + + std::map eventMatches_; + edm::InputTag rawDataTag_; + edm::InputTag totalEventCountersTag_; + edm::InputTag l1aCountersTag_; + edm::InputTag apvAddressesTag_; + edm::InputTag scopeDigisTag_; + edm::InputTag payloadDigisTag_; + edm::InputTag reorderedDigisTag_; + edm::InputTag virginRawDigisTag_; + uint32_t counterDiffMax_; + std::shared_ptr productRegistry_; + std::unique_ptr const source_; + std::unique_ptr processConfiguration_; + std::unique_ptr eventPrincipal_; + static const char* mlLabel_; }; - - template const T* SpyEventMatcher::getProduct(const edm::EventPrincipal& event, const edm::InputTag& tag) - { + + template + const T* SpyEventMatcher::getProduct(const edm::EventPrincipal& event, const edm::InputTag& tag) { LogDebug(mlLabel_) << "Retrieving product " << tag; // Note: The third argument to getProductByTag can be a nullptr // as long as unscheduled execution of an EDProducer cannot occur // as a result of this function call (and with the current implementation // of SpyEventMatcher unscheduled execution never happens). - const std::shared_ptr< const edm::Wrapper > productWrapper = edm::getProductByTag(event,tag,nullptr); + const std::shared_ptr > productWrapper = edm::getProductByTag(event, tag, nullptr); if (productWrapper) { return productWrapper->product(); } else { return nullptr; } } - - inline bool SpyEventMatcher::EventKey::operator < (const SpyEventMatcher::EventKey& rhs) const - { - return ( (this->eventId_eventId_==rhs.eventId_) && (this->apvAddress_eventId_ < rhs.eventId_) + ? true + : (((this->eventId_ == rhs.eventId_) && (this->apvAddress_ < rhs.apvAddress_)) ? true : false)); } - -} -#endif //ndef DQM_SiStripMonitorHardware_SiStripSpyEventMatcher_H +} // namespace sistrip + +#endif //ndef DQM_SiStripMonitorHardware_SiStripSpyEventMatcher_H -#endif //SiStripMonitorHardware_BuildEventMatchingCode +#endif //SiStripMonitorHardware_BuildEventMatchingCode diff --git a/DQM/SiStripMonitorHardware/interface/SiStripSpyUnpacker.h b/DQM/SiStripMonitorHardware/interface/SiStripSpyUnpacker.h index b14d004fe1be9..56317ff3b5bd1 100644 --- a/DQM/SiStripMonitorHardware/interface/SiStripSpyUnpacker.h +++ b/DQM/SiStripMonitorHardware/interface/SiStripSpyUnpacker.h @@ -7,7 +7,7 @@ #include "boost/cstdint.hpp" #include #include - + // Other classes class FEDRawDataCollection; class FEDRawData; @@ -15,8 +15,8 @@ class SiStripRawDigi; class SiStripFedCabling; namespace sistrip { - - /*! \brief Unpacks spy channel data into scope mode-like digis + + /*! \brief Unpacks spy channel data into scope mode-like digis * @author Nick Cripps * @date Autumn 2009 * @@ -28,32 +28,33 @@ namespace sistrip { * ------ A.-M. Magnan, 25/02/10: add run number to the event * ------ A.-M. Magnan, 13/01/10: change Counters map to be keyed by fedid */ - class SpyUnpacker - { - public: - typedef edm::DetSetVector RawDigis; - typedef std::vector Counters; - - SpyUnpacker(const bool allowIncompleteEvents); //!< Constructor. - ~SpyUnpacker(); //!< Destructor. - - /*! \brief Creates the scope mode digis for the supplied FED IDs or detIds and stores event counters. + class SpyUnpacker { + public: + typedef edm::DetSetVector RawDigis; + typedef std::vector Counters; + + SpyUnpacker(const bool allowIncompleteEvents); //!< Constructor. + ~SpyUnpacker(); //!< Destructor. + + /*! \brief Creates the scope mode digis for the supplied FED IDs or detIds and stores event counters. * * If FED IDs are supplied (useFedId=true), unpacks all channels found in the cabling with data. * If an empty vector of IDs is supplied, it unpacks all it can find in the FEDRawDataCollection. */ - void createDigis( const SiStripFedCabling&, - const FEDRawDataCollection&, RawDigis* pDigis, - const std::vector & ids, - Counters * pTotalEventCounts, - Counters * pL1ACounts, - uint32_t * aRunRef); - private: - // Configuration - const bool allowIncompleteEvents_; - - }; // end of SpyUnpacker class. - -} // end of sistrip namespace. - -#endif // DQM_SiStripMonitorHardware_SiStripSpyUnpacker_H + void createDigis(const SiStripFedCabling&, + const FEDRawDataCollection&, + RawDigis* pDigis, + const std::vector& ids, + Counters* pTotalEventCounts, + Counters* pL1ACounts, + uint32_t* aRunRef); + + private: + // Configuration + const bool allowIncompleteEvents_; + + }; // end of SpyUnpacker class. + +} // namespace sistrip + +#endif // DQM_SiStripMonitorHardware_SiStripSpyUnpacker_H diff --git a/DQM/SiStripMonitorHardware/interface/SiStripSpyUtilities.h b/DQM/SiStripMonitorHardware/interface/SiStripSpyUtilities.h index d8a6c4bca929a..b30697466031f 100644 --- a/DQM/SiStripMonitorHardware/interface/SiStripSpyUtilities.h +++ b/DQM/SiStripMonitorHardware/interface/SiStripSpyUtilities.h @@ -1,7 +1,6 @@ #ifndef DQM_SiStripMonitorHardware_SiStripSpyUtilities_H #define DQM_SiStripMonitorHardware_SiStripSpyUtilities_H - // Standard includes. //#include #include @@ -21,11 +20,9 @@ class EventSetup; namespace sistrip { - - class SpyUtilities - { - public: + class SpyUtilities { + public: struct Frame { uint32_t detId; uint16_t digitalLow; @@ -33,8 +30,8 @@ namespace sistrip { uint16_t firstHeaderBit; uint16_t firstTrailerBit; float baseline; - std::pair apvErrorBit; - std::pair apvAddress; + std::pair apvErrorBit; + std::pair apvAddress; }; struct FrameQuality { @@ -50,62 +47,55 @@ namespace sistrip { ~SpyUtilities(); //get cabling for an eventSetup: internal counter to see if cabling has changed. - const SiStripFedCabling* getCabling( const edm::EventSetup& ); //!< Updates the cabling object from the DB. - const SiStripDetCabling* getDetCabling( const edm::EventSetup& ); //!< Updates the det cabling object from the DB. + const SiStripFedCabling* getCabling(const edm::EventSetup&); //!< Updates the cabling object from the DB. + const SiStripDetCabling* getDetCabling(const edm::EventSetup&); //!< Updates the det cabling object from the DB. edm::ESHandle getPedestalHandle(const edm::EventSetup& eventSetup); edm::ESHandle getNoiseHandle(const edm::EventSetup& eventSetup); - + //fill variables from frame - static const Frame extractFrameInfo(const edm::DetSetVector::detset & channelDigis, - bool aPrintDebug=false); + static const Frame extractFrameInfo(const edm::DetSetVector::detset& channelDigis, + bool aPrintDebug = false); - static void getMajorityHeader(const edm::DetSetVector * aInputDigis, - uint16_t & firstHeaderBit, - bool printResult=true); + static void getMajorityHeader(const edm::DetSetVector* aInputDigis, + uint16_t& firstHeaderBit, + bool printResult = true); //check frame is valid - static const bool isValid(const Frame & aFrame, - const FrameQuality & aQuality, - const uint16_t aExpectedPos); + static const bool isValid(const Frame& aFrame, const FrameQuality& aQuality, const uint16_t aExpectedPos); //extract range, threshold and apvAddress - static const uint16_t range(const Frame & aFrame); + static const uint16_t range(const Frame& aFrame); - static const uint16_t threshold(const Frame & aFrame); + static const uint16_t threshold(const Frame& aFrame); - static const uint8_t extractAPVaddress(const Frame & aFrame); + static const uint8_t extractAPVaddress(const Frame& aFrame); //find position of the first header and trailer bit - static const uint16_t findHeaderBits(const edm::DetSetVector::detset & channelDigis, - const uint16_t threshold); + static const uint16_t findHeaderBits(const edm::DetSetVector::detset& channelDigis, + const uint16_t threshold); - static const uint16_t findTrailerBits(const edm::DetSetVector::detset & channelDigis, - const uint16_t threshold); + static const uint16_t findTrailerBits(const edm::DetSetVector::detset& channelDigis, + const uint16_t threshold); //find both APV addresses and error bits - static const std::pair - findAPVErrorBits(const edm::DetSetVector::detset & channelDigis, - const uint16_t threshold, - const uint16_t aFirstBits); + static const std::pair findAPVErrorBits(const edm::DetSetVector::detset& channelDigis, + const uint16_t threshold, + const uint16_t aFirstBits); - static const std::pair - findAPVAddresses(const edm::DetSetVector::detset & channelDigis, - const uint16_t threshold, - const uint16_t aFirstBits); + static const std::pair findAPVAddresses( + const edm::DetSetVector::detset& channelDigis, + const uint16_t threshold, + const uint16_t aFirstBits); - static std::string print(const Frame & aFrame, - std::string aErr); + static std::string print(const Frame& aFrame, std::string aErr); - static void fedIndex(uint32_t aFedIndex, - uint16_t & aFedId, - uint16_t & aFedChannel); + static void fedIndex(uint32_t aFedIndex, uint16_t& aFedId, uint16_t& aFedChannel); - static std::pair findMajorityValue(std::vector & values, - const uint16_t aFedId = 0); + static std::pair findMajorityValue(std::vector& values, const uint16_t aFedId = 0); - static void fillFEDMajorities(const std::map& channelValues, - std::vector & fedMajoritiesToFill); + static void fillFEDMajorities(const std::map& channelValues, + std::vector& fedMajoritiesToFill); private: // Cabling @@ -123,9 +113,8 @@ namespace sistrip { //used to see if the noises have changed. uint32_t noiseCacheId_; edm::ESHandle noiseHandle_; - }; - -} -#endif // DQM_SiStripMonitorHardware_SiStripSpyUtilities_H +} // namespace sistrip + +#endif // DQM_SiStripMonitorHardware_SiStripSpyUtilities_H diff --git a/DQM/SiStripMonitorHardware/src/BuildTrackerMap.cc b/DQM/SiStripMonitorHardware/src/BuildTrackerMap.cc index 6cb7f2c0a4e64..b555fcdd385b6 100644 --- a/DQM/SiStripMonitorHardware/src/BuildTrackerMap.cc +++ b/DQM/SiStripMonitorHardware/src/BuildTrackerMap.cc @@ -3,7 +3,7 @@ // // Package: DQM/SiStripMonitorHardware // Class: BuildTrackerMapPlugin -// +// /**\class BuildTrackerMapPlugin BuildTrackerMap.cc DQM/SiStripMonitorHardware/plugins/BuildTrackerMap.cc Description: DQM source application to monitor common mode for SiStrip data @@ -44,7 +44,7 @@ #include "CommonTools/TrackerMap/interface/TmModule.h" #include "CommonTools/TrackerMap/interface/TmApvPair.h" -#include "DQM/SiStripCommon/interface/TkHistoMap.h" +#include "DQM/SiStripCommon/interface/TkHistoMap.h" #include "DQMServices/Core/interface/DQMStore.h" @@ -52,26 +52,22 @@ // Class declaration // -class BuildTrackerMapPlugin : public edm::EDAnalyzer -{ - public: - +class BuildTrackerMapPlugin : public edm::EDAnalyzer { +public: explicit BuildTrackerMapPlugin(const edm::ParameterSet&); ~BuildTrackerMapPlugin() override {} - private: + +private: void beginJob() override; void analyze(const edm::Event&, const edm::EventSetup&) override; void endJob() override; void read(bool aMechView, - std::string aFile, + std::string aFile, const TkDetMap* tkDetMap, - std::vector> & aTkMapVec, - std::vector & aValidVec); - void subtractMap(TkHistoMap* aResult, - const TkHistoMap* aSubtr); - - + std::vector>& aTkMapVec, + std::vector& aValidVec); + void subtractMap(TkHistoMap* aResult, const TkHistoMap* aSubtr); //input file names std::string fileName_; @@ -98,41 +94,34 @@ class BuildTrackerMapPlugin : public edm::EDAnalyzer edm::ParameterSet pset_; std::vector tkmap_; - }; - // // Constructors and destructor // BuildTrackerMapPlugin::BuildTrackerMapPlugin(const edm::ParameterSet& iConfig) - : fileName_(iConfig.getUntrackedParameter("InputFileName","DQMStore.root")), - mechanicalView_(iConfig.getUntrackedParameter("MechanicalView",true)), - folderName_(iConfig.getUntrackedParameter("HistogramFolderName","DQMData/")), - printDebug_(iConfig.getUntrackedParameter("PrintDebugMessages",1)), - doDiff_(iConfig.getUntrackedParameter("DoDifference",false)), - fileNameDiff_(iConfig.getUntrackedParameter("InputFileNameForDiff","DQMStore.root")), - tkHistoMapNameVec_(iConfig.getUntrackedParameter >("TkHistoMapNameVec")), - minVal_(iConfig.getUntrackedParameter >("MinValueVec")), - maxVal_(iConfig.getUntrackedParameter >("MaxValueVec")), - pset_(iConfig.getParameter("TkmapParameters")) -{ - - - -// for (unsigned int i(0); i<34; i++){ -// if (i<4) histName_[i] << "TIB/layer_" << i+1 << "/" << tkDetMapName_ << "_TIB_L" << i+1; -// else if (i<7) histName_[i] << "TID/side_1/wheel_" << i-3 << "/" << tkDetMapName_ << "_TIDM_D" << i-3; -// else if (i<10) histName_[i] << "TID/side_2/wheel_" << i-6 << "/" << tkDetMapName_ << "_TIDP_D" << i-6; -// else if (i<16) histName_[i] << "TOB/layer_" << i-9 << "/" << tkDetMapName_ << "_TOB_L" << i-9; -// else if (i<25) histName_[i] << "TEC/side_1/wheel_" << i-15 << "/" << tkDetMapName_ << "_TECM_W" << i-15; -// else if (i<34) histName_[i] << "TEC/side_2/wheel_" << i-24 << "/" << tkDetMapName_ << "_TECP_W" << i-24; - -// std::cout << "histName[" << i << "] =" << histName_[i] << std::endl; - -// } - + : fileName_(iConfig.getUntrackedParameter("InputFileName", "DQMStore.root")), + mechanicalView_(iConfig.getUntrackedParameter("MechanicalView", true)), + folderName_(iConfig.getUntrackedParameter("HistogramFolderName", "DQMData/")), + printDebug_(iConfig.getUntrackedParameter("PrintDebugMessages", 1)), + doDiff_(iConfig.getUntrackedParameter("DoDifference", false)), + fileNameDiff_(iConfig.getUntrackedParameter("InputFileNameForDiff", "DQMStore.root")), + tkHistoMapNameVec_(iConfig.getUntrackedParameter>("TkHistoMapNameVec")), + minVal_(iConfig.getUntrackedParameter>("MinValueVec")), + maxVal_(iConfig.getUntrackedParameter>("MaxValueVec")), + pset_(iConfig.getParameter("TkmapParameters")) { + // for (unsigned int i(0); i<34; i++){ + // if (i<4) histName_[i] << "TIB/layer_" << i+1 << "/" << tkDetMapName_ << "_TIB_L" << i+1; + // else if (i<7) histName_[i] << "TID/side_1/wheel_" << i-3 << "/" << tkDetMapName_ << "_TIDM_D" << i-3; + // else if (i<10) histName_[i] << "TID/side_2/wheel_" << i-6 << "/" << tkDetMapName_ << "_TIDP_D" << i-6; + // else if (i<16) histName_[i] << "TOB/layer_" << i-9 << "/" << tkDetMapName_ << "_TOB_L" << i-9; + // else if (i<25) histName_[i] << "TEC/side_1/wheel_" << i-15 << "/" << tkDetMapName_ << "_TECM_W" << i-15; + // else if (i<34) histName_[i] << "TEC/side_2/wheel_" << i-24 << "/" << tkDetMapName_ << "_TECP_W" << i-24; + + // std::cout << "histName[" << i << "] =" << histName_[i] << std::endl; + + // } } // @@ -141,218 +130,201 @@ BuildTrackerMapPlugin::BuildTrackerMapPlugin(const edm::ParameterSet& iConfig) /*Check that is possible to load in tkhistomaps histograms already stored in a DQM root file (if the folder and name are known)*/ void BuildTrackerMapPlugin::read(bool aMechView, - std::string aFile, + std::string aFile, const TkDetMap* tkDetMap, - std::vector>& aTkMapVec, - std::vector& aValidVec) -{ - - DQMStore * lDqmStore = edm::Service().operator->(); - lDqmStore->open(aFile); + std::vector>& aTkMapVec, + std::vector& aValidVec) { + DQMStore* lDqmStore = edm::Service().operator->(); + lDqmStore->open(aFile); unsigned int nHists = tkHistoMapNameVec_.size(); aTkMapVec.reserve(nHists); aValidVec.reserve(nHists); std::string dirName = folderName_; - if (dirName == "") { + if (dirName.empty()) { dirName += "Run "; - dirName += aFile.substr(aFile.find_last_of("_")+5,6); + dirName += aFile.substr(aFile.find_last_of("_") + 5, 6); dirName += "/SiStrip/Run summary"; std::cout << " -- DirName = " << dirName << std::endl; - } + } //lDqmStore->setCurrentFolder(dirName); //lDqmStore->showDirStructure(); - - unsigned int nFailTot=0; - unsigned int nTotTot = 0; - for (unsigned int i(0); i tkHistoMap{new TkHistoMap(tkDetMap)}; - tkHistoMap->loadTkHistoMap(dirName,tkHistoMapNameVec_.at(i),aMechView); - + tkHistoMap->loadTkHistoMap(dirName, tkHistoMapNameVec_.at(i), aMechView); + std::vector& lMaps = tkHistoMap->getAllMaps(); std::cout << " -- map " << i << ", nHistos = " << lMaps.size() << std::endl; - unsigned int nFail=0; - unsigned int nTot=0; - - for (unsigned int im(0); im1 -// unsigned int lHistoNumber = 35; -// TkDetMap lTkDetMap; -// std::ofstream list,listRms0,listRms1; -// list.open("./cmBadModuleList.dat",std::ios::out); -// listRms0.open("./cmBadModuleList_rms0.dat",std::ios::out); -// listRms1.open("./cmBadModuleList_rms1.dat",std::ios::out); -// if (!list || !listRms0 || !listRms1) { -// std::cout << "Warning, can't open output file to write bad module list !" << std::endl; -// exit(1); -// } - -// TCanvas *lCan = new TCanvas("lCan","",1); -// TH1F *p_deltaMean = new TH1F("p_deltaMean",";CM_{mean}(APV0)-CM_{mean}(APV1)",500,-2,2); -// TH1F *p_deltaRMS = new TH1F("p_deltaRMS",";CM_{RMS}(APV0)-CM_{RMS}(APV1)",500,0,3); -// TH1F *p_MeanAPV0 = new TH1F("p_MeanAPV0",";CM_{mean}(APV0)",500,100,140); -// //TH1F *p_MeanAPV1 = new TH1F("p_MeanAPV1",";CM_{mean}(APV1)",500,100,140); -// TH1F *p_RMSAPV0 = new TH1F("p_RMSAPV0",";CM_{RMS}(APV0)",500,0,10); -// //TH1F *p_RMSAPV1 = new TH1F("p_RMSAPV1",";CM_{RMS}(APV1)",500,0,10); - - - -// gStyle->SetOptStat(1111111); - -// for(unsigned int layer=1;layer dets; -// lTkDetMap.getDetsForLayer(layer,dets); -// for(size_t i=0;i0){ -// //if(tkHistoMap[5]->getEntries(dets[i])>0 && tkHistoMap[5]->getValue(dets[i])) { -// if(nHists > 3){ -// if (tkHistoMap[3]->getValue(dets[i]) > 1) { -// list << dets[i] << " " << tkHistoMap[3]->getValue(dets[i]) << std::endl; -// } -// p_deltaRMS->Fill(tkHistoMap[3]->getValue(dets[i])); -// } -// p_MeanAPV0->Fill(tkHistoMap[0]->getValue(dets[i])); -// //p_MeanAPV1->Fill(tkHistoMap[1]->getValue(dets[i])); -// p_RMSAPV0->Fill(tkHistoMap[1]->getValue(dets[i])); -// if (tkHistoMap[1]->getValue(dets[i]) > 2) -// listRms0 << dets[i] << " " << tkHistoMap[1]->getValue(dets[i]) << std::endl; -// //p_RMSAPV1->Fill(tkHistoMap[3]->getValue(dets[i])); -// //if (tkHistoMap[3]->getValue(dets[i]) > 2) -// //listRms1 << dets[i] << " " << tkHistoMap[3]->getValue(dets[i]) << std::endl; - -// if(nHists > 2) p_deltaMean->Fill(tkHistoMap[2]->getValue(dets[i])); -// } -// } -// } -// list.close(); -// listRms0.close(); -// listRms1.close(); - -// lCan->cd(); -// p_deltaRMS->Draw(); -// //lCan->Print("./deltaRMStotal.png"); -// lCan->Print("./deltaRMStotal.C"); - -// p_deltaMean->Draw(); -// lCan->Update(); -// lCan->Print("./deltaMeantotal.C"); - -// TPaveStats *statBox[2] = {0,0}; -// statBox[0] = (TPaveStats*)p_MeanAPV0->FindObject("stats"); -// //statBox[1] = (TPaveStats*)p_MeanAPV1->FindObject("stats"); - -// p_MeanAPV0->Draw(); -// //p_MeanAPV1->SetLineColor(2); -// //p_MeanAPV1->Draw("same"); -// if (statBox[0]) statBox[0]->Draw("same"); -// if (statBox[1]) { -// statBox[1]->SetLineColor(2); -// statBox[1]->SetTextColor(2); -// statBox[1]->Draw("same"); -// } -// lCan->Update(); -// lCan->Print("./meanAPVstotal.C"); - -// statBox[0] = (TPaveStats*)p_RMSAPV0->FindObject("stats"); -// //statBox[1] = (TPaveStats*)p_RMSAPV1->FindObject("stats"); - -// p_RMSAPV0->Draw(); -// //p_RMSAPV1->SetLineColor(2); -// //p_RMSAPV1->Draw("same"); -// if (statBox[0]) statBox[0]->Draw("same"); -// if (statBox[1]) { -// statBox[1]->SetLineColor(2); -// statBox[1]->SetTextColor(2); -// statBox[1]->Draw("same"); -// } -// lCan->Update(); -// lCan->Print("./rmsAPVstotal.C"); - - + // //get list of detid for which |deltaRMS(APV0-APV1)|>1 + // unsigned int lHistoNumber = 35; + // TkDetMap lTkDetMap; + // std::ofstream list,listRms0,listRms1; + // list.open("./cmBadModuleList.dat",std::ios::out); + // listRms0.open("./cmBadModuleList_rms0.dat",std::ios::out); + // listRms1.open("./cmBadModuleList_rms1.dat",std::ios::out); + // if (!list || !listRms0 || !listRms1) { + // std::cout << "Warning, can't open output file to write bad module list !" << std::endl; + // exit(1); + // } + + // TCanvas *lCan = new TCanvas("lCan","",1); + // TH1F *p_deltaMean = new TH1F("p_deltaMean",";CM_{mean}(APV0)-CM_{mean}(APV1)",500,-2,2); + // TH1F *p_deltaRMS = new TH1F("p_deltaRMS",";CM_{RMS}(APV0)-CM_{RMS}(APV1)",500,0,3); + // TH1F *p_MeanAPV0 = new TH1F("p_MeanAPV0",";CM_{mean}(APV0)",500,100,140); + // //TH1F *p_MeanAPV1 = new TH1F("p_MeanAPV1",";CM_{mean}(APV1)",500,100,140); + // TH1F *p_RMSAPV0 = new TH1F("p_RMSAPV0",";CM_{RMS}(APV0)",500,0,10); + // //TH1F *p_RMSAPV1 = new TH1F("p_RMSAPV1",";CM_{RMS}(APV1)",500,0,10); + + // gStyle->SetOptStat(1111111); + + // for(unsigned int layer=1;layer dets; + // lTkDetMap.getDetsForLayer(layer,dets); + // for(size_t i=0;i0){ + // //if(tkHistoMap[5]->getEntries(dets[i])>0 && tkHistoMap[5]->getValue(dets[i])) { + // if(nHists > 3){ + // if (tkHistoMap[3]->getValue(dets[i]) > 1) { + // list << dets[i] << " " << tkHistoMap[3]->getValue(dets[i]) << std::endl; + // } + // p_deltaRMS->Fill(tkHistoMap[3]->getValue(dets[i])); + // } + // p_MeanAPV0->Fill(tkHistoMap[0]->getValue(dets[i])); + // //p_MeanAPV1->Fill(tkHistoMap[1]->getValue(dets[i])); + // p_RMSAPV0->Fill(tkHistoMap[1]->getValue(dets[i])); + // if (tkHistoMap[1]->getValue(dets[i]) > 2) + // listRms0 << dets[i] << " " << tkHistoMap[1]->getValue(dets[i]) << std::endl; + // //p_RMSAPV1->Fill(tkHistoMap[3]->getValue(dets[i])); + // //if (tkHistoMap[3]->getValue(dets[i]) > 2) + // //listRms1 << dets[i] << " " << tkHistoMap[3]->getValue(dets[i]) << std::endl; + + // if(nHists > 2) p_deltaMean->Fill(tkHistoMap[2]->getValue(dets[i])); + // } + // } + // } + // list.close(); + // listRms0.close(); + // listRms1.close(); + + // lCan->cd(); + // p_deltaRMS->Draw(); + // //lCan->Print("./deltaRMStotal.png"); + // lCan->Print("./deltaRMStotal.C"); + + // p_deltaMean->Draw(); + // lCan->Update(); + // lCan->Print("./deltaMeantotal.C"); + + // TPaveStats *statBox[2] = {0,0}; + // statBox[0] = (TPaveStats*)p_MeanAPV0->FindObject("stats"); + // //statBox[1] = (TPaveStats*)p_MeanAPV1->FindObject("stats"); + + // p_MeanAPV0->Draw(); + // //p_MeanAPV1->SetLineColor(2); + // //p_MeanAPV1->Draw("same"); + // if (statBox[0]) statBox[0]->Draw("same"); + // if (statBox[1]) { + // statBox[1]->SetLineColor(2); + // statBox[1]->SetTextColor(2); + // statBox[1]->Draw("same"); + // } + // lCan->Update(); + // lCan->Print("./meanAPVstotal.C"); + + // statBox[0] = (TPaveStats*)p_RMSAPV0->FindObject("stats"); + // //statBox[1] = (TPaveStats*)p_RMSAPV1->FindObject("stats"); + + // p_RMSAPV0->Draw(); + // //p_RMSAPV1->SetLineColor(2); + // //p_RMSAPV1->Draw("same"); + // if (statBox[0]) statBox[0]->Draw("same"); + // if (statBox[1]) { + // statBox[1]->SetLineColor(2); + // statBox[1]->SetTextColor(2); + // statBox[1]->Draw("same"); + // } + // lCan->Update(); + // lCan->Print("./rmsAPVstotal.C"); } - // ------------ method called to for each event ------------ -void -BuildTrackerMapPlugin::analyze(const edm::Event& iEvent, - const edm::EventSetup& iSetup) -{ - +void BuildTrackerMapPlugin::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { static bool firstEvent = true; edm::ESHandle fedcabling; - iSetup.get().get(fedcabling ); - + iSetup.get().get(fedcabling); + edm::ESHandle tTopoHandle; iSetup.get().get(tTopoHandle); const TrackerTopology* const tTopo = tTopoHandle.product(); - if ( tkHistoMapVec_.empty() && ( ! tkHistoMapNameVec_.empty() ) ) { + if (tkHistoMapVec_.empty() && (!tkHistoMapNameVec_.empty())) { edm::ESHandle tkDetMapHandle; iSetup.get().get(tkDetMapHandle); const TkDetMap* tkDetMap = tkDetMapHandle.product(); read(mechanicalView_, fileName_, tkDetMap, tkHistoMapVec_, isValidMap_); - if (doDiff_) read(mechanicalView_, fileNameDiff_, tkDetMap, tkHistoMapVecDiff_, isValidMapDiff_); + if (doDiff_) + read(mechanicalView_, fileNameDiff_, tkDetMap, tkHistoMapVecDiff_, isValidMapDiff_); } if (firstEvent) { - for (unsigned int i(0); isetPalette(1); lTkMap->showPalette(true); if (!tkHistoMapVec_.at(i) || !isValidMap_.at(i)) { @@ -377,41 +348,27 @@ BuildTrackerMapPlugin::endJob() //to print all figures to create fancy view //lTkMap->printall(true,0,255,tkHistoMapNameVec_.at(i)); - lTkMap->save(true, - minVal_.at(i), - maxVal_.at(i), - tkHistoMapNameVec_.at(i)+std::string(".png")); - lTkMap->save_as_fedtrackermap(true, - minVal_.at(i), - maxVal_.at(i), - tkHistoMapNameVec_.at(i)+std::string("_FED.png")); - + lTkMap->save(true, minVal_.at(i), maxVal_.at(i), tkHistoMapNameVec_.at(i) + std::string(".png")); + lTkMap->save_as_fedtrackermap( + true, minVal_.at(i), maxVal_.at(i), tkHistoMapNameVec_.at(i) + std::string("_FED.png")); } - } - -void BuildTrackerMapPlugin::subtractMap(TkHistoMap* aResult, const TkHistoMap* aSubtr) -{ - +void BuildTrackerMapPlugin::subtractMap(TkHistoMap* aResult, const TkHistoMap* aSubtr) { std::vector& lMaps = aResult->getAllMaps(); const std::vector& lMapsDiff = aSubtr->getAllMaps(); - assert(lMaps.size() == lMapsDiff.size()); + assert(lMaps.size() == lMapsDiff.size()); - for (unsigned int im(0); imgetTProfile2D())->Add(lMapsDiff[im]->getTProfile2D(),-1); - } + for (unsigned int im(0); im < lMaps.size(); im++) { + if (!lMaps[im] || !lMapsDiff[im]) { + std::cout << " -- Failed to get element " << im << " for maps." << std::endl; + } else { + (lMaps[im]->getTProfile2D())->Add(lMapsDiff[im]->getTProfile2D(), -1); } - + } } - - // Define as a plug-in // diff --git a/DQM/SiStripMonitorHardware/src/CMHistograms.cc b/DQM/SiStripMonitorHardware/src/CMHistograms.cc index 80b69bbc5fb82..8b6a61d55ff8a 100644 --- a/DQM/SiStripMonitorHardware/src/CMHistograms.cc +++ b/DQM/SiStripMonitorHardware/src/CMHistograms.cc @@ -4,252 +4,261 @@ #include "DQM/SiStripMonitorHardware/interface/CMHistograms.hh" - - -CMHistograms::CMHistograms() -{ - for (unsigned int i(0); i<500; i++){ +CMHistograms::CMHistograms() { + for (unsigned int i(0); i < 500; i++) { doFed_[i] = false; } - } -CMHistograms::~CMHistograms() -{ -} - -void CMHistograms::initialise(const edm::ParameterSet& iConfig, - std::ostringstream* pDebugStream - ) -{ - getConfigForHistogram(medianAPV1vsAPV0_,"MedianAPV1vsAPV0",iConfig,pDebugStream); - getConfigForHistogram(medianAPV0minusAPV1_,"MedianAPV0minusAPV1",iConfig,pDebugStream); +CMHistograms::~CMHistograms() {} - getConfigForHistogram(meanCMPerFedvsFedId_,"MeanCMPerFedvsFedId",iConfig,pDebugStream); - getConfigForHistogram(meanCMPerFedvsTime_,"MeanCMPerFedvsTime",iConfig,pDebugStream); - getConfigForHistogram(variationsPerFedvsFedId_,"VariationsPerFedvsFedId",iConfig,pDebugStream); - getConfigForHistogram(variationsPerFedvsTime_,"VariationsPerFedvsTime",iConfig,pDebugStream); +void CMHistograms::initialise(const edm::ParameterSet& iConfig, std::ostringstream* pDebugStream) { + getConfigForHistogram(medianAPV1vsAPV0_, "MedianAPV1vsAPV0", iConfig, pDebugStream); + getConfigForHistogram(medianAPV0minusAPV1_, "MedianAPV0minusAPV1", iConfig, pDebugStream); - getConfigForHistogram(medianAPV1vsAPV0perFED_,"MedianAPV1vsAPV0perFED",iConfig,pDebugStream); - getConfigForHistogram(medianAPV0minusAPV1perFED_,"MedianAPV0minusAPV1perFED",iConfig,pDebugStream); + getConfigForHistogram(meanCMPerFedvsFedId_, "MeanCMPerFedvsFedId", iConfig, pDebugStream); + getConfigForHistogram(meanCMPerFedvsTime_, "MeanCMPerFedvsTime", iConfig, pDebugStream); + getConfigForHistogram(variationsPerFedvsFedId_, "VariationsPerFedvsFedId", iConfig, pDebugStream); + getConfigForHistogram(variationsPerFedvsTime_, "VariationsPerFedvsTime", iConfig, pDebugStream); - getConfigForHistogram(medianperChannel_,"MedianperChannel",iConfig,pDebugStream); - getConfigForHistogram(medianAPV0minusAPV1perChannel_,"MedianAPV0minusAPV1perChannel",iConfig,pDebugStream); + getConfigForHistogram(medianAPV1vsAPV0perFED_, "MedianAPV1vsAPV0perFED", iConfig, pDebugStream); + getConfigForHistogram(medianAPV0minusAPV1perFED_, "MedianAPV0minusAPV1perFED", iConfig, pDebugStream); - - getConfigForHistogram(tkMapConfig_,"TkHistoMap",iConfig,pDebugStream); + getConfigForHistogram(medianperChannel_, "MedianperChannel", iConfig, pDebugStream); + getConfigForHistogram(medianAPV0minusAPV1perChannel_, "MedianAPV0minusAPV1perChannel", iConfig, pDebugStream); - if (iConfig.exists("FedIdVec")){ + getConfigForHistogram(tkMapConfig_, "TkHistoMap", iConfig, pDebugStream); + + if (iConfig.exists("FedIdVec")) { std::vector lIdVec = iConfig.getUntrackedParameter >("FedIdVec"); - for (unsigned int i(0); i& aVec, float aTime, unsigned int aFedId) -{ +void CMHistograms::fillHistograms(const std::vector& aVec, float aTime, unsigned int aFedId) { float lMean = 0; float lPrevMean = 0; - for (unsigned iEle(0); iEle= 1024 || lVal.Medians.second >= 1024) { - std::cout << "----- WARNING ! New max found: " << lVal.Medians.first << " " << lVal.Medians.second << " " << __FILE__ << " " << __LINE__ << std::endl; + std::cout << "----- WARNING ! New max found: " << lVal.Medians.first << " " << lVal.Medians.second << " " + << __FILE__ << " " << __LINE__ << std::endl; } - fillHistogram(medianAPV1vsAPV0_,lVal.Medians.first,lVal.Medians.second); - fillHistogram(medianAPV0minusAPV1_,lVal.Medians.first-lVal.Medians.second); + fillHistogram(medianAPV1vsAPV0_, lVal.Medians.first, lVal.Medians.second); + fillHistogram(medianAPV0minusAPV1_, lVal.Medians.first - lVal.Medians.second); lMean += lVal.Medians.first + lVal.Medians.second; lPrevMean += lVal.PreviousMedians.first + lVal.PreviousMedians.second; if (doFed_[aFedId]) { - fillHistogram(medianAPV1vsAPV0perFEDMap_[aFedId],lVal.Medians.first,lVal.Medians.second); - fillHistogram(medianAPV0minusAPV1perFEDMap_[aFedId],lVal.Medians.first-lVal.Medians.second); - fillHistogram(medianperChannelMap_[aFedId][lVal.ChannelID],lVal.Medians.first); - fillHistogram(medianAPV0minusAPV1perChannelMap_[aFedId][lVal.ChannelID],lVal.Medians.first-lVal.Medians.second); + fillHistogram(medianAPV1vsAPV0perFEDMap_[aFedId], lVal.Medians.first, lVal.Medians.second); + fillHistogram(medianAPV0minusAPV1perFEDMap_[aFedId], lVal.Medians.first - lVal.Medians.second); + fillHistogram(medianperChannelMap_[aFedId][lVal.ChannelID], lVal.Medians.first); + fillHistogram(medianAPV0minusAPV1perChannelMap_[aFedId][lVal.ChannelID], + lVal.Medians.first - lVal.Medians.second); } - }//loop on elements + } //loop on elements if (!aVec.empty()) { - lMean = lMean / (2*aVec.size()); - lPrevMean = lPrevMean / (2*aVec.size()); + lMean = lMean / (2 * aVec.size()); + lPrevMean = lPrevMean / (2 * aVec.size()); } - fillHistogram(meanCMPerFedvsFedId_,aFedId,lMean); - fillHistogram(meanCMPerFedvsTime_,aTime,lMean); - fillHistogram(variationsPerFedvsFedId_,aFedId,lMean-lPrevMean); - fillHistogram(variationsPerFedvsTime_,aTime,lMean-lPrevMean); - - + fillHistogram(meanCMPerFedvsFedId_, aFedId, lMean); + fillHistogram(meanCMPerFedvsTime_, aTime, lMean); + fillHistogram(variationsPerFedvsFedId_, aFedId, lMean - lPrevMean); + fillHistogram(variationsPerFedvsTime_, aTime, lMean - lPrevMean); } - -void CMHistograms::bookTopLevelHistograms(DQMStore::IBooker & ibooker, const TkDetMap* tkDetMap) -{ +void CMHistograms::bookTopLevelHistograms(DQMStore::IBooker& ibooker, const TkDetMap* tkDetMap) { //book FED level histograms //get FED IDs //const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID; const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID; - histosBooked_.resize(siStripFedIdMax+1,false); + histosBooked_.resize(siStripFedIdMax + 1, false); - std::string lDir = ibooker.pwd()+"/"; + std::string lDir = ibooker.pwd() + "/"; ibooker.cd(lDir); ibooker.setCurrentFolder(lDir); - book2DHistogram(ibooker , medianAPV1vsAPV0_, - "MedianAPV1vsAPV0", - "median APV1 vs APV0", - 250,0,1024,250,0,1024, - "median APV0","median APV1"); - - bookHistogram(ibooker, medianAPV0minusAPV1_, - "MedianAPV0minusAPV1", - "median APV0 - median APV1", - 500,-500,500, - "median APV0 - median APV1"); - - - bookProfile(ibooker , meanCMPerFedvsFedId_, - "MeanCMPerFedvsFedId", - " vs fedID", - 440,50,490,-1000,1000, - "fedID","^{FED}"); - - bookProfile(ibooker , meanCMPerFedvsTime_, - "MeanCMPerFedvsTime", - " vs time", - 0,1000, - "Time","^{FED}"); - - - bookProfile(ibooker , variationsPerFedvsFedId_, - "VariationsPerFedvsFedId", - " vs fedID", - 440,50,490,-1000,1000, - "fedID","^{FED}_{t}-^{FED}_{t-1}"); - - bookProfile(ibooker , variationsPerFedvsTime_, - "VariationsPerFedvsTime", - " vs time", - 0,1000, - "Time","^{FED}_{t}-^{FED}_{t-1}"); - - - + book2DHistogram(ibooker, + medianAPV1vsAPV0_, + "MedianAPV1vsAPV0", + "median APV1 vs APV0", + 250, + 0, + 1024, + 250, + 0, + 1024, + "median APV0", + "median APV1"); + + bookHistogram(ibooker, + medianAPV0minusAPV1_, + "MedianAPV0minusAPV1", + "median APV0 - median APV1", + 500, + -500, + 500, + "median APV0 - median APV1"); + + bookProfile(ibooker, + meanCMPerFedvsFedId_, + "MeanCMPerFedvsFedId", + " vs fedID", + 440, + 50, + 490, + -1000, + 1000, + "fedID", + "^{FED}"); + + bookProfile(ibooker, meanCMPerFedvsTime_, "MeanCMPerFedvsTime", " vs time", 0, 1000, "Time", "^{FED}"); + + bookProfile(ibooker, + variationsPerFedvsFedId_, + "VariationsPerFedvsFedId", + " vs fedID", + 440, + 50, + 490, + -1000, + 1000, + "fedID", + "^{FED}_{t}-^{FED}_{t-1}"); + + bookProfile(ibooker, + variationsPerFedvsTime_, + "VariationsPerFedvsTime", + " vs time", + 0, + 1000, + "Time", + "^{FED}_{t}-^{FED}_{t-1}"); + ibooker.cd(lDir); - + //book map after, as it creates a new folder... - if (tkMapConfig_.enabled){ - tkmapCM_[0] = std::make_unique(tkDetMap, "SiStrip/TkHisto","TkHMap_MeanCMAPV",0.,true); - tkmapCM_[1] = std::make_unique(tkDetMap, "SiStrip/TkHisto","TkHMap_RmsCMAPV",0.,true); - tkmapCM_[2] = std::make_unique(tkDetMap, "SiStrip/TkHisto","TkHMap_MeanCMAPV0minusAPV1",-500.,true); - tkmapCM_[3] = std::make_unique(tkDetMap, "SiStrip/TkHisto","TkHMap_RmsCMAPV0minusAPV1",-500.,true); - } - else { + if (tkMapConfig_.enabled) { + tkmapCM_[0] = std::make_unique(tkDetMap, "SiStrip/TkHisto", "TkHMap_MeanCMAPV", 0., true); + tkmapCM_[1] = std::make_unique(tkDetMap, "SiStrip/TkHisto", "TkHMap_RmsCMAPV", 0., true); + tkmapCM_[2] = std::make_unique(tkDetMap, "SiStrip/TkHisto", "TkHMap_MeanCMAPV0minusAPV1", -500., true); + tkmapCM_[3] = std::make_unique(tkDetMap, "SiStrip/TkHisto", "TkHMap_RmsCMAPV0minusAPV1", -500., true); + } else { tkmapCM_[0] = nullptr; tkmapCM_[1] = nullptr; tkmapCM_[2] = nullptr; tkmapCM_[3] = nullptr; } - for ( unsigned int i = sistrip::FED_ID_MIN; i <= sistrip::FED_ID_MAX; i++ ) + for (unsigned int i = sistrip::FED_ID_MIN; i <= sistrip::FED_ID_MAX; i++) if (doFed_[i]) - bookFEDHistograms(ibooker , i); + bookFEDHistograms(ibooker, i); } - -void CMHistograms::bookFEDHistograms(DQMStore::IBooker & ibooker, unsigned int fedId) -{ +void CMHistograms::bookFEDHistograms(DQMStore::IBooker& ibooker, unsigned int fedId) { if (!histosBooked_[fedId]) { //will do that only once - SiStripFedKey fedKey(fedId,0,0,0); + SiStripFedKey fedKey(fedId, 0, 0, 0); std::stringstream fedIdStream; fedIdStream << fedId; ibooker.setCurrentFolder(fedKey.path()); - - book2DHistogram(ibooker , medianAPV1vsAPV0perFED_, - medianAPV1vsAPV0perFEDMap_[fedId], - "MedianAPV1vsAPV0forFED"+fedIdStream.str(), - "median APV1 vs APV0 for FED "+fedIdStream.str(), - 250,0,500,250,0,500, - "APV0","APV1"); - - bookHistogram(ibooker , medianAPV0minusAPV1perFED_, - medianAPV0minusAPV1perFEDMap_[fedId], - "MedianAPV0minusAPV1forFED"+fedIdStream.str(), - "median APV0 - median APV1 for FED "+fedIdStream.str(), - 500,-500,500, - "#Delta(medians)"); - - - bookChannelsHistograms(ibooker , fedId); + + book2DHistogram(ibooker, + medianAPV1vsAPV0perFED_, + medianAPV1vsAPV0perFEDMap_[fedId], + "MedianAPV1vsAPV0forFED" + fedIdStream.str(), + "median APV1 vs APV0 for FED " + fedIdStream.str(), + 250, + 0, + 500, + 250, + 0, + 500, + "APV0", + "APV1"); + + bookHistogram(ibooker, + medianAPV0minusAPV1perFED_, + medianAPV0minusAPV1perFEDMap_[fedId], + "MedianAPV0minusAPV1forFED" + fedIdStream.str(), + "median APV0 - median APV1 for FED " + fedIdStream.str(), + 500, + -500, + 500, + "#Delta(medians)"); + + bookChannelsHistograms(ibooker, fedId); histosBooked_[fedId] = true; } } -void CMHistograms::bookChannelsHistograms(DQMStore::IBooker & ibooker , unsigned int fedId) -{ - SiStripFedKey fedKey(fedId,0,0,0); +void CMHistograms::bookChannelsHistograms(DQMStore::IBooker& ibooker, unsigned int fedId) { + SiStripFedKey fedKey(fedId, 0, 0, 0); std::stringstream fedIdStream; fedIdStream << fedId; ibooker.setCurrentFolder(fedKey.path()); - medianperChannelMap_[fedId].resize(sistrip::FEDCH_PER_FED,nullptr); - medianAPV0minusAPV1perChannelMap_[fedId].resize(sistrip::FEDCH_PER_FED,nullptr); - - for (unsigned int iCh(0); iCh < sistrip::FEDCH_PER_FED; iCh++){ + medianperChannelMap_[fedId].resize(sistrip::FEDCH_PER_FED, nullptr); + medianAPV0minusAPV1perChannelMap_[fedId].resize(sistrip::FEDCH_PER_FED, nullptr); - std::ostringstream lName0,lTitle0,lName1,lTitle1,lName2,lTitle2; + for (unsigned int iCh(0); iCh < sistrip::FEDCH_PER_FED; iCh++) { + std::ostringstream lName0, lTitle0, lName1, lTitle1, lName2, lTitle2; lName0 << "MedianForFed" << fedId << "Channel" << iCh; - lTitle0 << "Median for FED/Ch " << fedId << "/" << iCh ; + lTitle0 << "Median for FED/Ch " << fedId << "/" << iCh; lName2 << "MedianAPV0minusAPV1ForFed" << fedId << "Channel" << iCh; - lTitle2 << "Median APV0-APV1 for FED/Ch " << fedId << "/" << iCh ; - - bookHistogram(ibooker , medianperChannel_, - medianperChannelMap_[fedId][iCh], - lName0.str(), - lTitle0.str(), - 250,0,500, - "median APVs"); - - - bookHistogram(ibooker , medianAPV0minusAPV1perChannel_, - medianAPV0minusAPV1perChannelMap_[fedId][iCh], - lName2.str(), - lTitle2.str(), - 250,-500,500, - "median APV0-APV1"); - + lTitle2 << "Median APV0-APV1 for FED/Ch " << fedId << "/" << iCh; + + bookHistogram(ibooker, + medianperChannel_, + medianperChannelMap_[fedId][iCh], + lName0.str(), + lTitle0.str(), + 250, + 0, + 500, + "median APVs"); + + bookHistogram(ibooker, + medianAPV0minusAPV1perChannel_, + medianAPV0minusAPV1perChannelMap_[fedId][iCh], + lName2.str(), + lTitle2.str(), + 250, + -500, + 500, + "median APV0-APV1"); } - } -void CMHistograms::bookAllFEDHistograms(DQMStore::IBooker & ibooker) -{ +void CMHistograms::bookAllFEDHistograms(DQMStore::IBooker& ibooker) { //get FED IDs const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID; const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID; //book them for (unsigned int iFed = siStripFedIdMin; iFed <= siStripFedIdMax; iFed++) { - bookFEDHistograms(ibooker , iFed); + bookFEDHistograms(ibooker, iFed); } } -bool CMHistograms::tkHistoMapEnabled(unsigned int aIndex){ - return tkMapConfig_.enabled; -} +bool CMHistograms::tkHistoMapEnabled(unsigned int aIndex) { return tkMapConfig_.enabled; } -TkHistoMap * CMHistograms::tkHistoMapPointer(unsigned int aIndex){ +TkHistoMap* CMHistograms::tkHistoMapPointer(unsigned int aIndex) { assert(aIndex < 4); return tkmapCM_[aIndex].get(); } diff --git a/DQM/SiStripMonitorHardware/src/FEDErrors.cc b/DQM/SiStripMonitorHardware/src/FEDErrors.cc index d86f1f6aa25bd..30fcde008554f 100644 --- a/DQM/SiStripMonitorHardware/src/FEDErrors.cc +++ b/DQM/SiStripMonitorHardware/src/FEDErrors.cc @@ -11,25 +11,20 @@ #include "DQM/SiStripMonitorHardware/interface/FEDErrors.hh" #include "DQM/SiStripCommon/interface/TkHistoMap.h" - -FEDErrors::FEDErrors() -{ +FEDErrors::FEDErrors() { //initialiseLumiBlock(); initialiseEvent(); } -FEDErrors::~FEDErrors() -{ - -} +FEDErrors::~FEDErrors() {} void FEDErrors::initialiseLumiBlock() { lumiErr_.nTotal.clear(); lumiErr_.nErrors.clear(); //6 subdetectors: //TECB,TECF,TIB,TIDB,TIDF,TOB - lumiErr_.nTotal.resize(6,0); - lumiErr_.nErrors.resize(6,0); + lumiErr_.nTotal.resize(6, 0); + lumiErr_.nErrors.resize(6, 0); } void FEDErrors::initialiseEvent() { @@ -88,16 +83,13 @@ void FEDErrors::initialiseEvent() { chErrors_.clear(); - eventProp_.deltaBX=0; + eventProp_.deltaBX = 0; } - - void FEDErrors::initialiseFED(const unsigned int aFedID, - const SiStripFedCabling* aCabling, + const SiStripFedCabling* aCabling, const TrackerTopology* tTopo, - const bool initVars) -{ + const bool initVars) { fedID_ = aFedID; failUnpackerFEDCheck_ = false; @@ -106,65 +98,58 @@ void FEDErrors::initialiseFED(const unsigned int aFedID, //and has a valid ID, the subdet value will be changed to the right //one. if (initVars) { + subDetId_.resize(sistrip::FEUNITS_PER_FED, 0); - subDetId_.resize(sistrip::FEUNITS_PER_FED,0); - - connected_.resize(sistrip::FEDCH_PER_FED,false); - detid_.resize(sistrip::FEDCH_PER_FED,0); - nChInModule_.resize(sistrip::FEDCH_PER_FED,0); - - for (unsigned int iCh = 0; - iCh < sistrip::FEDCH_PER_FED; - iCh++) { + connected_.resize(sistrip::FEDCH_PER_FED, false); + detid_.resize(sistrip::FEDCH_PER_FED, 0); + nChInModule_.resize(sistrip::FEDCH_PER_FED, 0); - const FedChannelConnection & lConnection = aCabling->fedConnection(fedID_,iCh); + for (unsigned int iCh = 0; iCh < sistrip::FEDCH_PER_FED; iCh++) { + const FedChannelConnection& lConnection = aCabling->fedConnection(fedID_, iCh); connected_[iCh] = lConnection.isConnected(); detid_[iCh] = lConnection.detId(); nChInModule_[iCh] = lConnection.nApvPairs(); - unsigned short lFeNumber = static_cast(iCh/sistrip::FEDCH_PER_FEUNIT); + unsigned short lFeNumber = static_cast(iCh / sistrip::FEDCH_PER_FEUNIT); unsigned int lDetid = detid_[iCh]; if (lDetid && lDetid != sistrip::invalid32_ && connected_[iCh]) { - unsigned int lSubid = 6; - // 3=TIB, 4=TID, 5=TOB, 6=TEC (TECB here) - switch(DetId(lDetid).subdetId()) { - case 3: - lSubid = 2; //TIB - break; - - case 4: - { - - if (tTopo->tidSide(lDetid) == 2) lSubid = 4; //TIDF - else lSubid = 3; //TIDB - break; - } - - case 5: - lSubid = 5; //TOB - break; - - case 6: - { - - if (tTopo->tecSide(lDetid) == 2) lSubid = 1; //TECF - else lSubid = 0; //TECB - break; - } - - default: - lSubid = 6; - break; - - } - subDetId_[lFeNumber] = lSubid; - //if (iCh%12==0) std::cout << fedID_ << " " << lFeNumber << " " << subDetId_[lFeNumber] << std::endl; - + unsigned int lSubid = 6; + // 3=TIB, 4=TID, 5=TOB, 6=TEC (TECB here) + switch (DetId(lDetid).subdetId()) { + case 3: + lSubid = 2; //TIB + break; + + case 4: { + if (tTopo->tidSide(lDetid) == 2) + lSubid = 4; //TIDF + else + lSubid = 3; //TIDB + break; + } + + case 5: + lSubid = 5; //TOB + break; + + case 6: { + if (tTopo->tecSide(lDetid) == 2) + lSubid = 1; //TECF + else + lSubid = 0; //TECB + break; + } + + default: + lSubid = 6; + break; + } + subDetId_[lFeNumber] = lSubid; + //if (iCh%12==0) std::cout << fedID_ << " " << lFeNumber << " " << subDetId_[lFeNumber] << std::endl; } } - feCounter_.nFEOverflows = 0; feCounter_.nFEBadMajorityAddresses = 0; feCounter_.nFEMissing = 0; @@ -194,17 +179,13 @@ void FEDErrors::initialiseFED(const unsigned int aFedID, } } -bool FEDErrors::checkDataPresent(const FEDRawData& aFedData) -{ - +bool FEDErrors::checkDataPresent(const FEDRawData& aFedData) { if (!aFedData.size() || !aFedData.data()) { - for (unsigned int iCh = 0; - iCh < sistrip::FEDCH_PER_FED; - iCh++) { - if (connected_[iCh]){ - fedErrors_.HasCabledChannels = true; - fedErrors_.DataMissing = true; - return false; + for (unsigned int iCh = 0; iCh < sistrip::FEDCH_PER_FED; iCh++) { + if (connected_[iCh]) { + fedErrors_.HasCabledChannels = true; + fedErrors_.DataMissing = true; + return false; } } fedErrors_.DataMissing = true; @@ -212,32 +193,22 @@ bool FEDErrors::checkDataPresent(const FEDRawData& aFedData) return false; } else { fedErrors_.DataPresent = true; - for (unsigned int iCh = 0; - iCh < sistrip::FEDCH_PER_FED; - iCh++) { - if (connected_[iCh]){ - fedErrors_.HasCabledChannels = true; - break; + for (unsigned int iCh = 0; iCh < sistrip::FEDCH_PER_FED; iCh++) { + if (connected_[iCh]) { + fedErrors_.HasCabledChannels = true; + break; } } return true; } - } -bool FEDErrors::failUnpackerFEDCheck() -{ - return failUnpackerFEDCheck_; -} - - -bool FEDErrors::fillFatalFEDErrors(const FEDRawData& aFedData, - const unsigned int aPrintDebug) -{ +bool FEDErrors::failUnpackerFEDCheck() { return failUnpackerFEDCheck_; } +bool FEDErrors::fillFatalFEDErrors(const FEDRawData& aFedData, const unsigned int aPrintDebug) { std::unique_ptr bufferBase; try { - bufferBase.reset(new sistrip::FEDBufferBase(aFedData.data(),aFedData.size())); + bufferBase.reset(new sistrip::FEDBufferBase(aFedData.data(), aFedData.size())); } catch (const cms::Exception& e) { fedErrors_.InvalidBuffers = true; failUnpackerFEDCheck_ = true; @@ -271,13 +242,12 @@ bool FEDErrors::fillFatalFEDErrors(const FEDRawData& aFedData, //now do checks on header //check that tracker special header is consistent - if ( !(bufferBase->checkBufferFormat() && - bufferBase->checkHeaderType() && - bufferBase->checkReadoutMode()) ) { + if (!(bufferBase->checkBufferFormat() && bufferBase->checkHeaderType() && bufferBase->checkReadoutMode())) { failUnpackerFEDCheck_ = true; fedErrors_.InvalidBuffers = true; //do not return false if debug printout of the buffer done below... - if (!printDebug() || aPrintDebug<3 ) return false; + if (!printDebug() || aPrintDebug < 3) + return false; } //FE unit overflows @@ -285,131 +255,121 @@ bool FEDErrors::fillFatalFEDErrors(const FEDRawData& aFedData, failUnpackerFEDCheck_ = true; fedErrors_.FEsOverflow = true; //do not return false if debug printout of the buffer done below... - if (!printDebug() || aPrintDebug<3 ) return false; + if (!printDebug() || aPrintDebug < 3) + return false; } return true; - } -bool FEDErrors::fillCorruptBuffer(const sistrip::FEDBuffer* aBuffer) -{ +bool FEDErrors::fillCorruptBuffer(const sistrip::FEDBuffer* aBuffer) { //corrupt buffer checks - if (!(aBuffer->checkChannelLengthsMatchBufferLength() && - aBuffer->checkChannelPacketCodes() && - aBuffer->checkFEUnitLengths())) { + if (!(aBuffer->checkChannelLengthsMatchBufferLength() && aBuffer->checkChannelPacketCodes() && + aBuffer->checkFEUnitLengths())) { fedErrors_.CorruptBuffer = true; return false; } return true; - } -float FEDErrors::fillNonFatalFEDErrors(const sistrip::FEDBuffer* aBuffer, - const SiStripFedCabling* aCabling) -{ +float FEDErrors::fillNonFatalFEDErrors(const sistrip::FEDBuffer* aBuffer, const SiStripFedCabling* aCabling) { unsigned int lBadChans = 0; unsigned int lTotChans = 0; - for (unsigned int iCh = 0; iCh < sistrip::FEDCH_PER_FED; iCh++) {//loop on channels + for (unsigned int iCh = 0; iCh < sistrip::FEDCH_PER_FED; iCh++) { //loop on channels bool lIsConnected = false; if (aCabling) { - const FedChannelConnection & lConnection = aCabling->fedConnection(fedID_,iCh); + const FedChannelConnection& lConnection = aCabling->fedConnection(fedID_, iCh); lIsConnected = lConnection.isConnected(); - } - else lIsConnected = connected_[iCh]; + } else + lIsConnected = connected_[iCh]; - if (!lIsConnected) continue; + if (!lIsConnected) + continue; lTotChans++; - if (!aBuffer->channelGood(iCh, true)) lBadChans++; + if (!aBuffer->channelGood(iCh, true)) + lBadChans++; } - return static_cast(lBadChans*1.0/lTotChans); + return static_cast(lBadChans * 1.0 / lTotChans); } - bool FEDErrors::fillFEDErrors(const FEDRawData& aFedData, - bool & aFullDebug, - const unsigned int aPrintDebug, - unsigned int & aCounterMonitoring, - unsigned int & aCounterUnpacker, - const bool aDoMeds, - MonitorElement *aMedianHist0, - MonitorElement *aMedianHist1, - const bool aDoFEMaj, - std::vector > > & aFeMajFrac - ) -{ + bool& aFullDebug, + const unsigned int aPrintDebug, + unsigned int& aCounterMonitoring, + unsigned int& aCounterUnpacker, + const bool aDoMeds, + MonitorElement* aMedianHist0, + MonitorElement* aMedianHist1, + const bool aDoFEMaj, + std::vector > >& aFeMajFrac) { //try to construct the basic buffer object (do not check payload) //if this fails then count it as an invalid buffer and stop checks since we can't understand things like buffer ordering - if (!fillFatalFEDErrors(aFedData,aPrintDebug)) return false; + if (!fillFatalFEDErrors(aFedData, aPrintDebug)) + return false; //need to construct full object to go any further std::unique_ptr buffer; - buffer.reset(new sistrip::FEDBuffer(aFedData.data(),aFedData.size(),true)); + buffer.reset(new sistrip::FEDBuffer(aFedData.data(), aFedData.size(), true)); //fill remaining unpackerFEDcheck - if (!buffer->checkChannelLengths()) failUnpackerFEDCheck_= true; + if (!buffer->checkChannelLengths()) + failUnpackerFEDCheck_ = true; //payload checks, only if none of the above error occured if (!this->anyFEDErrors()) { - bool lCorruptCheck = fillCorruptBuffer(buffer.get()); - if (aPrintDebug>1 && !lCorruptCheck) { + if (aPrintDebug > 1 && !lCorruptCheck) { edm::LogWarning("SiStripMonitorHardware") - << "CorruptBuffer check failed for FED " << fedID_ - << std::endl - << " -- buffer->checkChannelLengthsMatchBufferLength() = " << buffer->checkChannelLengthsMatchBufferLength() - << std::endl - << " -- buffer->checkChannelPacketCodes() = " << buffer->checkChannelPacketCodes() - << std::endl - << " -- buffer->checkFEUnitLengths() = " << buffer->checkFEUnitLengths() - << std::endl; + << "CorruptBuffer check failed for FED " << fedID_ << std::endl + << " -- buffer->checkChannelLengthsMatchBufferLength() = " << buffer->checkChannelLengthsMatchBufferLength() + << std::endl + << " -- buffer->checkChannelPacketCodes() = " << buffer->checkChannelPacketCodes() << std::endl + << " -- buffer->checkFEUnitLengths() = " << buffer->checkFEUnitLengths() << std::endl; } //corruptBuffer concerns the payload: header info should still be reliable... //so analyze FE and channels to fill histograms. //fe check... - fillFEErrors(buffer.get(),aDoFEMaj,aFeMajFrac); + fillFEErrors(buffer.get(), aDoFEMaj, aFeMajFrac); //channel checks fillChannelErrors(buffer.get(), - aFullDebug, - aPrintDebug, - aCounterMonitoring, - aCounterUnpacker, - aDoMeds, - aMedianHist0, - aMedianHist1 - ); - + aFullDebug, + aPrintDebug, + aCounterMonitoring, + aCounterUnpacker, + aDoMeds, + aMedianHist0, + aMedianHist1); } - - if (printDebug() && aPrintDebug>2) { + if (printDebug() && aPrintDebug > 2) { const sistrip::FEDBufferBase* debugBuffer = nullptr; - if (buffer.get()) debugBuffer = buffer.get(); + if (buffer.get()) + debugBuffer = buffer.get(); //else if (bufferBase.get()) debugBuffer = bufferBase.get(); if (debugBuffer) { - std::vector & lChVec = getAPVLevelErrors(); + std::vector& lChVec = getAPVLevelErrors(); std::ostringstream debugStream; if (!lChVec.empty()) { - std::sort(lChVec.begin(),lChVec.end()); + std::sort(lChVec.begin(), lChVec.end()); debugStream << "[FEDErrors] Cabled channels which had errors: "; for (unsigned int iBadCh(0); iBadCh < lChVec.size(); iBadCh++) { - print(lChVec[iBadCh],debugStream); + print(lChVec[iBadCh], debugStream); } debugStream << std::endl; debugStream << "[FEDErrors] Active (have been locked in at least one event) cabled channels which had errors: "; - for (unsigned int iBadCh(0); iBadCh < lChVec.size(); iBadCh++) { - if ((lChVec[iBadCh]).IsActive) print(lChVec[iBadCh],debugStream); + for (unsigned int iBadCh(0); iBadCh < lChVec.size(); iBadCh++) { + if ((lChVec[iBadCh]).IsActive) + print(lChVec[iBadCh], debugStream); } - } debugStream << (*debugBuffer) << std::endl; debugBuffer->dump(debugStream); @@ -423,14 +383,12 @@ bool FEDErrors::fillFEDErrors(const FEDRawData& aFedData, } bool FEDErrors::fillFEErrors(const sistrip::FEDBuffer* aBuffer, - const bool aDoFEMaj, - std::vector > > & aFeMajFrac) -{ + const bool aDoFEMaj, + std::vector > >& aFeMajFrac) { bool foundOverflow = false; bool foundBadMajority = false; bool foundMissing = false; for (unsigned int iFE = 0; iFE < sistrip::FEUNITS_PER_FED; iFE++) { - FEDErrors::FELevelErrors lFeErr; lFeErr.FeID = iFE; lFeErr.SubDetID = subDetId_[iFE]; @@ -443,13 +401,14 @@ bool FEDErrors::fillFEErrors(const sistrip::FEDBuffer* aBuffer, //check for cabled channels bool hasCabledChannels = false; for (unsigned int feUnitCh = 0; feUnitCh < sistrip::FEDCH_PER_FEUNIT; feUnitCh++) { - if (connected_[iFE*sistrip::FEDCH_PER_FEUNIT+feUnitCh]) { + if (connected_[iFE * sistrip::FEDCH_PER_FEUNIT + feUnitCh]) { hasCabledChannels = true; break; } } - if (!hasCabledChannels) continue; + if (!hasCabledChannels) + continue; if (aBuffer->feOverflow(iFE)) { lFeErr.Overflow = true; @@ -458,7 +417,8 @@ bool FEDErrors::fillFEErrors(const sistrip::FEDBuffer* aBuffer, //if FE overflowed then address isn't valid continue; } - if (!aBuffer->feEnabled(iFE)) continue; + if (!aBuffer->feEnabled(iFE)) + continue; //check for missing data if (!aBuffer->fePresent(iFE)) { @@ -474,7 +434,7 @@ bool FEDErrors::fillFEErrors(const sistrip::FEDBuffer* aBuffer, //second is comparing explicitely the FE majAddress with the APVe address. //!aBuffer->checkFEUnitAPVAddresses(): for all FE's.... //want to do it only for this FE... do it directly with the time difference. - if (aBuffer->majorityAddressErrorForFEUnit(iFE)){ + if (aBuffer->majorityAddressErrorForFEUnit(iFE)) { lFeErr.BadMajorityAddress = true; foundBadMajority = true; //no continue to fill the timeDifference. @@ -514,66 +474,60 @@ bool FEDErrors::fillFEErrors(const sistrip::FEDBuffer* aBuffer, lFeErr.Apve = aBuffer->apveAddress(); - if (debugHeader){ - + if (debugHeader) { lFeErr.FeMaj = debugHeader->feUnitMajorityAddress(iFE); - if (aDoFEMaj){ - if (lFeErr.SubDetID == 2 || lFeErr.SubDetID == 3 || lFeErr.SubDetID == 4) - aFeMajFrac[0].push_back(std::pair(fedID_,lFeErr.FeMaj)); - else if (lFeErr.SubDetID == 5) - aFeMajFrac[1].push_back(std::pair(fedID_,lFeErr.FeMaj)); - else if (lFeErr.SubDetID == 0) - aFeMajFrac[2].push_back(std::pair(fedID_,lFeErr.FeMaj)); - else if (lFeErr.SubDetID == 1) - aFeMajFrac[3].push_back(std::pair(fedID_,lFeErr.FeMaj)); + if (aDoFEMaj) { + if (lFeErr.SubDetID == 2 || lFeErr.SubDetID == 3 || lFeErr.SubDetID == 4) + aFeMajFrac[0].push_back(std::pair(fedID_, lFeErr.FeMaj)); + else if (lFeErr.SubDetID == 5) + aFeMajFrac[1].push_back(std::pair(fedID_, lFeErr.FeMaj)); + else if (lFeErr.SubDetID == 0) + aFeMajFrac[2].push_back(std::pair(fedID_, lFeErr.FeMaj)); + else if (lFeErr.SubDetID == 1) + aFeMajFrac[3].push_back(std::pair(fedID_, lFeErr.FeMaj)); } - - if (aBuffer->apveAddress()){ - lFeErr.TimeDifference = //0; - static_cast(sistrip::FEDAddressConversion::timeLocation(debugHeader->feUnitMajorityAddress(iFE)))-static_cast(sistrip::FEDAddressConversion::timeLocation(aBuffer->apveAddress())); - //aBuffer->apveAddress(), debugHeader->feUnitMajorityAddress(iFE) - //FEDAddressConversion::timeLocation(const uint8_t aPipelineAddress) + if (aBuffer->apveAddress()) { + lFeErr.TimeDifference = //0; + static_cast( + sistrip::FEDAddressConversion::timeLocation(debugHeader->feUnitMajorityAddress(iFE))) - + static_cast(sistrip::FEDAddressConversion::timeLocation(aBuffer->apveAddress())); + //aBuffer->apveAddress(), debugHeader->feUnitMajorityAddress(iFE) + //FEDAddressConversion::timeLocation(const uint8_t aPipelineAddress) } } - if (foundBadMajority || lFeErr.TimeDifference != 0){ + if (foundBadMajority || lFeErr.TimeDifference != 0) { addBadFE(lFeErr); - - // LogDebug("SiStripMonitorHardware") << " -- Problem found with FE maj address :" << std::endl -// << " --- FED = " << fedID_ -// << ", iFE = " << iFE << std::endl -// << " --- aBuffer->apveAddress() = " << static_cast(aBuffer->apveAddress()) -// << std::endl -// << " --- debugHeader->feUnitMajorityAddress(iFE) " << static_cast(debugHeader->feUnitMajorityAddress(iFE))<< std::endl -// << " --- timeLoc(feUnitMajAddr) = " -// << static_cast(sistrip::FEDAddressConversion::timeLocation(debugHeader->feUnitMajorityAddress(iFE)))<< std::endl -// << " --- timeLoc(apveAddr) = " -// << static_cast(sistrip::FEDAddressConversion::timeLocation(aBuffer->apveAddress())) << std::endl -// << " --- aBuffer->checkFEUnitAPVAddresses() = " -// << aBuffer->checkFEUnitAPVAddresses() -// << std::endl; - - + // LogDebug("SiStripMonitorHardware") << " -- Problem found with FE maj address :" << std::endl + // << " --- FED = " << fedID_ + // << ", iFE = " << iFE << std::endl + // << " --- aBuffer->apveAddress() = " << static_cast(aBuffer->apveAddress()) + // << std::endl + // << " --- debugHeader->feUnitMajorityAddress(iFE) " << static_cast(debugHeader->feUnitMajorityAddress(iFE))<< std::endl + // << " --- timeLoc(feUnitMajAddr) = " + // << static_cast(sistrip::FEDAddressConversion::timeLocation(debugHeader->feUnitMajorityAddress(iFE)))<< std::endl + // << " --- timeLoc(apveAddr) = " + // << static_cast(sistrip::FEDAddressConversion::timeLocation(aBuffer->apveAddress())) << std::endl + // << " --- aBuffer->checkFEUnitAPVAddresses() = " + // << aBuffer->checkFEUnitAPVAddresses() + // << std::endl; } - } return !(foundOverflow || foundMissing || foundBadMajority); } bool FEDErrors::fillChannelErrors(const sistrip::FEDBuffer* aBuffer, - bool & aFullDebug, - const unsigned int aPrintDebug, - unsigned int & aCounterMonitoring, - unsigned int & aCounterUnpacker, - const bool aDoMeds, - MonitorElement *aMedianHist0, - MonitorElement *aMedianHist1 - ) -{ + bool& aFullDebug, + const unsigned int aPrintDebug, + unsigned int& aCounterMonitoring, + unsigned int& aCounterUnpacker, + const bool aDoMeds, + MonitorElement* aMedianHist0, + MonitorElement* aMedianHist1) { bool foundError = false; const sistrip::FEDFEHeader* header = aBuffer->feHeader(); @@ -587,12 +541,11 @@ bool FEDErrors::fillChannelErrors(const sistrip::FEDBuffer* aBuffer, //so only corruptBuffer+FE check are useful. bool lPassedMonitoringFEDcheck = !fedErrors_.CorruptBuffer; - for (unsigned int iCh = 0; iCh < sistrip::FEDCH_PER_FED; iCh++) {//loop on channels + for (unsigned int iCh = 0; iCh < sistrip::FEDCH_PER_FED; iCh++) { //loop on channels bool lFailUnpackerChannelCheck = (!aBuffer->channelGood(iCh, true) && connected_[iCh]) || failUnpackerFEDCheck_; bool lFailMonitoringChannelCheck = !lPassedMonitoringFEDcheck && connected_[iCh]; - FEDErrors::ChannelLevelErrors lChErr; lChErr.ChannelID = iCh; lChErr.Connected = connected_[iCh]; @@ -604,180 +557,173 @@ bool FEDErrors::fillChannelErrors(const sistrip::FEDBuffer* aBuffer, //to fill histo with unconnected channels addBadChannel(lChErr); foundError = true; - } - else {//if channel connected - if (!aBuffer->feGood(static_cast(iCh/sistrip::FEDCH_PER_FEUNIT))) { - lFailMonitoringChannelCheck = true; - foundError = true; - } - else {//if FE good - - bool apvBad[2] = {false,false}; - sistrip::FEDChannelStatus lStatus = sistrip::CHANNEL_STATUS_NO_PROBLEMS; - //CHANNEL_STATUS_NO_PROBLEMS - //CHANNEL_STATUS_LOCKED - //CHANNEL_STATUS_IN_SYNC - //CHANNEL_STATUS_APV1_ADDRESS_GOOD - //CHANNEL_STATUS_APV1_NO_ERROR_BIT - //CHANNEL_STATUS_APV0_ADDRESS_GOOD - //CHANNEL_STATUS_APV0_NO_ERROR_BIT - - if (debugHeader) { - lStatus = debugHeader->getChannelStatus(iCh); - apvBad[0] = - !(lStatus & sistrip::CHANNEL_STATUS_LOCKED) || - !(lStatus & sistrip::CHANNEL_STATUS_IN_SYNC) || - !(lStatus & sistrip::CHANNEL_STATUS_APV0_ADDRESS_GOOD) || - !(lStatus & sistrip::CHANNEL_STATUS_APV0_NO_ERROR_BIT); - apvBad[1] = - !(lStatus & sistrip::CHANNEL_STATUS_LOCKED) || - !(lStatus & sistrip::CHANNEL_STATUS_IN_SYNC) || - !(lStatus & sistrip::CHANNEL_STATUS_APV1_ADDRESS_GOOD) || - !(lStatus & sistrip::CHANNEL_STATUS_APV1_NO_ERROR_BIT); - //if (!debugHeader->unlocked(iCh)) { - if (lStatus & sistrip::CHANNEL_STATUS_LOCKED) { - lChErr.IsActive = true; - if (lStatus == sistrip::CHANNEL_STATUS_NO_PROBLEMS) continue; - //if (debugHeader->outOfSyncFromBit(iCh)) { - if (!(lStatus & sistrip::CHANNEL_STATUS_IN_SYNC)) { - lChErr.OutOfSync = true; - } - } - else { - lChErr.Unlocked = true; - } - } else { - //if (header->checkChannelStatusBits(iCh)) activeChannel = true; - apvBad[0] = !header->checkStatusBits(iCh,0); - apvBad[1] = !header->checkStatusBits(iCh,1); - if (!apvBad[0] && !apvBad[1]) { - lChErr.IsActive = true; - continue; - } - } - - if (lChErr.Unlocked || lChErr.OutOfSync) addBadChannel(lChErr); - - //std::ostringstream lMode; - //lMode << aBuffer->readoutMode(); - - bool lFirst = true; - - for (unsigned int iAPV = 0; iAPV < 2; iAPV++) {//loop on APVs - - FEDErrors::APVLevelErrors lAPVErr; - lAPVErr.APVID = 2*iCh+iAPV; - lAPVErr.ChannelID = iCh; - lAPVErr.Connected = connected_[iCh]; - lAPVErr.IsActive = lChErr.IsActive; - lAPVErr.APVStatusBit = false; - lAPVErr.APVError = false; - lAPVErr.APVAddressError = false; - - //if (!header->checkStatusBits(iCh,iAPV)){ - if (apvBad[iAPV]) { - lFailMonitoringChannelCheck = true; - lAPVErr.APVStatusBit = true; - foundError = true; - } - - if (debugHeader && !lChErr.Unlocked && !lChErr.OutOfSync) { - //if (debugHeader->apvErrorFromBit(iCh,iAPV)) { - if ( (iAPV==0 && !(lStatus & sistrip::CHANNEL_STATUS_APV0_NO_ERROR_BIT)) || - (iAPV==1 && !(lStatus & sistrip::CHANNEL_STATUS_APV1_NO_ERROR_BIT))) { - lAPVErr.APVError = true; - } - //if (debugHeader->apvAddressErrorFromBit(iCh,iAPV)) { - if ((iAPV==0 && !(lStatus & sistrip::CHANNEL_STATUS_APV0_ADDRESS_GOOD)) || - (iAPV==1 && !(lStatus & sistrip::CHANNEL_STATUS_APV1_ADDRESS_GOOD))) { - lAPVErr.APVAddressError = true; - } - } - - if ( lAPVErr.APVStatusBit || - lAPVErr.APVError || - lAPVErr.APVAddressError - ) addBadAPV(lAPVErr, lFirst); - }//loop on APVs - - }//if FE good - }//if connected - - - if (lFailUnpackerChannelCheck != lFailMonitoringChannelCheck && connected_[iCh]){ - if (aPrintDebug>1) { - std::ostringstream debugStream; - debugStream << "[FEDErrors] ------ WARNING: FED " << fedID_ << ", channel " << iCh - << ", isConnected = " << connected_[iCh] << std::endl - << "[FEDErrors] --------- Monitoring Channel check " ; - if (lFailMonitoringChannelCheck) debugStream << "failed." << std::endl; - else debugStream << "passed." << std::endl ; - debugStream << "[FEDErrors] --------- Unpacker Channel check " ; - if (lFailUnpackerChannelCheck) debugStream << "failed." << std::endl; - else debugStream << "passed." << std::endl; - debugStream << "[FEDErrors] --------- fegood = " - << aBuffer->feGood(static_cast(iCh/sistrip::FEDCH_PER_FEUNIT)) - << std::endl - << "[FEDErrors] --------- unpacker FED check = " << failUnpackerFEDCheck_ << std::endl; - edm::LogError("SiStripMonitorHardware") << debugStream.str(); + } else { //if channel connected + if (!aBuffer->feGood(static_cast(iCh / sistrip::FEDCH_PER_FEUNIT))) { + lFailMonitoringChannelCheck = true; + foundError = true; + } else { //if FE good + + bool apvBad[2] = {false, false}; + sistrip::FEDChannelStatus lStatus = sistrip::CHANNEL_STATUS_NO_PROBLEMS; + //CHANNEL_STATUS_NO_PROBLEMS + //CHANNEL_STATUS_LOCKED + //CHANNEL_STATUS_IN_SYNC + //CHANNEL_STATUS_APV1_ADDRESS_GOOD + //CHANNEL_STATUS_APV1_NO_ERROR_BIT + //CHANNEL_STATUS_APV0_ADDRESS_GOOD + //CHANNEL_STATUS_APV0_NO_ERROR_BIT + + if (debugHeader) { + lStatus = debugHeader->getChannelStatus(iCh); + apvBad[0] = !(lStatus & sistrip::CHANNEL_STATUS_LOCKED) || !(lStatus & sistrip::CHANNEL_STATUS_IN_SYNC) || + !(lStatus & sistrip::CHANNEL_STATUS_APV0_ADDRESS_GOOD) || + !(lStatus & sistrip::CHANNEL_STATUS_APV0_NO_ERROR_BIT); + apvBad[1] = !(lStatus & sistrip::CHANNEL_STATUS_LOCKED) || !(lStatus & sistrip::CHANNEL_STATUS_IN_SYNC) || + !(lStatus & sistrip::CHANNEL_STATUS_APV1_ADDRESS_GOOD) || + !(lStatus & sistrip::CHANNEL_STATUS_APV1_NO_ERROR_BIT); + //if (!debugHeader->unlocked(iCh)) { + if (lStatus & sistrip::CHANNEL_STATUS_LOCKED) { + lChErr.IsActive = true; + if (lStatus == sistrip::CHANNEL_STATUS_NO_PROBLEMS) + continue; + //if (debugHeader->outOfSyncFromBit(iCh)) { + if (!(lStatus & sistrip::CHANNEL_STATUS_IN_SYNC)) { + lChErr.OutOfSync = true; + } + } else { + lChErr.Unlocked = true; + } + } else { + //if (header->checkChannelStatusBits(iCh)) activeChannel = true; + apvBad[0] = !header->checkStatusBits(iCh, 0); + apvBad[1] = !header->checkStatusBits(iCh, 1); + if (!apvBad[0] && !apvBad[1]) { + lChErr.IsActive = true; + continue; + } + } + + if (lChErr.Unlocked || lChErr.OutOfSync) + addBadChannel(lChErr); + + //std::ostringstream lMode; + //lMode << aBuffer->readoutMode(); + + bool lFirst = true; + + for (unsigned int iAPV = 0; iAPV < 2; iAPV++) { //loop on APVs + + FEDErrors::APVLevelErrors lAPVErr; + lAPVErr.APVID = 2 * iCh + iAPV; + lAPVErr.ChannelID = iCh; + lAPVErr.Connected = connected_[iCh]; + lAPVErr.IsActive = lChErr.IsActive; + lAPVErr.APVStatusBit = false; + lAPVErr.APVError = false; + lAPVErr.APVAddressError = false; + + //if (!header->checkStatusBits(iCh,iAPV)){ + if (apvBad[iAPV]) { + lFailMonitoringChannelCheck = true; + lAPVErr.APVStatusBit = true; + foundError = true; + } + + if (debugHeader && !lChErr.Unlocked && !lChErr.OutOfSync) { + //if (debugHeader->apvErrorFromBit(iCh,iAPV)) { + if ((iAPV == 0 && !(lStatus & sistrip::CHANNEL_STATUS_APV0_NO_ERROR_BIT)) || + (iAPV == 1 && !(lStatus & sistrip::CHANNEL_STATUS_APV1_NO_ERROR_BIT))) { + lAPVErr.APVError = true; + } + //if (debugHeader->apvAddressErrorFromBit(iCh,iAPV)) { + if ((iAPV == 0 && !(lStatus & sistrip::CHANNEL_STATUS_APV0_ADDRESS_GOOD)) || + (iAPV == 1 && !(lStatus & sistrip::CHANNEL_STATUS_APV1_ADDRESS_GOOD))) { + lAPVErr.APVAddressError = true; + } + } + + if (lAPVErr.APVStatusBit || lAPVErr.APVError || lAPVErr.APVAddressError) + addBadAPV(lAPVErr, lFirst); + } //loop on APVs + + } //if FE good + } //if connected + + if (lFailUnpackerChannelCheck != lFailMonitoringChannelCheck && connected_[iCh]) { + if (aPrintDebug > 1) { + std::ostringstream debugStream; + debugStream << "[FEDErrors] ------ WARNING: FED " << fedID_ << ", channel " << iCh + << ", isConnected = " << connected_[iCh] << std::endl + << "[FEDErrors] --------- Monitoring Channel check "; + if (lFailMonitoringChannelCheck) + debugStream << "failed." << std::endl; + else + debugStream << "passed." << std::endl; + debugStream << "[FEDErrors] --------- Unpacker Channel check "; + if (lFailUnpackerChannelCheck) + debugStream << "failed." << std::endl; + else + debugStream << "passed." << std::endl; + debugStream << "[FEDErrors] --------- fegood = " + << aBuffer->feGood(static_cast(iCh / sistrip::FEDCH_PER_FEUNIT)) << std::endl + << "[FEDErrors] --------- unpacker FED check = " << failUnpackerFEDCheck_ << std::endl; + edm::LogError("SiStripMonitorHardware") << debugStream.str(); } - if (lFailMonitoringChannelCheck) aCounterMonitoring++; - if (lFailUnpackerChannelCheck) aCounterUnpacker++; + if (lFailMonitoringChannelCheck) + aCounterMonitoring++; + if (lFailUnpackerChannelCheck) + aCounterUnpacker++; } if (lMedValid && !foundError && lPassedMonitoringFEDcheck && aDoMeds) { //get CM values - const sistrip::FEDChannel & lChannel = aBuffer->channel(iCh); - - HistogramBase::fillHistogram(aMedianHist0, - lChannel.cmMedian(0)); - HistogramBase::fillHistogram(aMedianHist1, - lChannel.cmMedian(1)); + const sistrip::FEDChannel& lChannel = aBuffer->channel(iCh); + HistogramBase::fillHistogram(aMedianHist0, lChannel.cmMedian(0)); + HistogramBase::fillHistogram(aMedianHist1, lChannel.cmMedian(1)); } - }//loop on channels + } //loop on channels return !foundError; } void FEDErrors::fillBadChannelList(const bool doTkHistoMap, - TkHistoMap *aTkMapPointer, - MonitorElement *aFedIdVsApvId, - unsigned int & aNBadChannels, - unsigned int & aNBadActiveChannels, - unsigned int & aNBadChannels_perFEDID) -{ - + TkHistoMap* aTkMapPointer, + MonitorElement* aFedIdVsApvId, + unsigned int& aNBadChannels, + unsigned int& aNBadActiveChannels, + unsigned int& aNBadChannels_perFEDID) { uint32_t lPrevId = 0; uint16_t nBad = 0; uint16_t lPrevTot = 0; bool hasBeenProcessed = false; bool lFailFED = failMonitoringFEDCheck(); - for (unsigned int iCh = 0; - iCh < sistrip::FEDCH_PER_FED; - iCh++) {//loop on channels + for (unsigned int iCh = 0; iCh < sistrip::FEDCH_PER_FED; iCh++) { //loop on channels - if (!connected_[iCh]) continue; - if (!detid_[iCh] || detid_[iCh] == sistrip::invalid32_) continue; + if (!connected_[iCh]) + continue; + if (!detid_[iCh] || detid_[iCh] == sistrip::invalid32_) + continue; - if (lPrevId==0) { + if (lPrevId == 0) { lPrevId = detid_[iCh]; lPrevTot = nChInModule_[iCh]; } - unsigned int feNumber = static_cast(iCh/sistrip::FEDCH_PER_FEUNIT); + unsigned int feNumber = static_cast(iCh / sistrip::FEDCH_PER_FEUNIT); bool isBadFE = false; bool isMissingFE = false; //feErrors vector of FE 0 - 7, each FE has channels 0 -11, 12 .. - ,... - 96 - for (unsigned int badfe(0); badfe= lumiErr_.nTotal.size()) { - edm::LogError("SiStripMonitorHardware") << " -- FED " << fedID_ - << ", invalid subdetid : " << aSubDet - << ", size of lumiErr : " - << lumiErr_.nTotal.size() - << std::endl; - } - else { - if (hasError) lumiErr_.nErrors[aSubDet]++; + edm::LogError("SiStripMonitorHardware") << " -- FED " << fedID_ << ", invalid subdetid : " << aSubDet + << ", size of lumiErr : " << lumiErr_.nTotal.size() << std::endl; + } else { + if (hasError) + lumiErr_.nErrors[aSubDet]++; lumiErr_.nTotal[aSubDet]++; } } void FEDErrors::processDet(const uint32_t aPrevId, - const uint16_t aPrevTot, - const bool doTkHistoMap, - uint16_t & nBad, - TkHistoMap *aTkMapPointer - ) -{ - if (aPrevTot < nBad){ - edm::LogError("SiStripMonitorHardware") << " -- Number of bad channels in det " << aPrevId - << " = " << nBad - << ", total number of pairs for this det = " << aPrevTot - << std::endl; + const uint16_t aPrevTot, + const bool doTkHistoMap, + uint16_t& nBad, + TkHistoMap* aTkMapPointer) { + if (aPrevTot < nBad) { + edm::LogError("SiStripMonitorHardware") << " -- Number of bad channels in det " << aPrevId << " = " << nBad + << ", total number of pairs for this det = " << aPrevTot << std::endl; } //tkHistoMap takes a uint & as argument uint32_t lDetid = aPrevId; if (aPrevTot != 0 && doTkHistoMap && aTkMapPointer) - HistogramBase::fillTkHistoMap(aTkMapPointer,lDetid,static_cast(nBad)/aPrevTot); + HistogramBase::fillTkHistoMap(aTkMapPointer, lDetid, static_cast(nBad) / aPrevTot); - nBad=0; + nBad = 0; } +const bool FEDErrors::failMonitoringFEDCheck() { return (anyFEDErrors() || fedErrors_.CorruptBuffer); } -const bool FEDErrors::failMonitoringFEDCheck() -{ - return ( anyFEDErrors() || - fedErrors_.CorruptBuffer - ); +const bool FEDErrors::anyDAQProblems() { + return (fedErrors_.DataMissing || fedErrors_.InvalidBuffers || fedErrors_.BadFEDCRCs || fedErrors_.BadDAQCRCs || + fedErrors_.BadIDs || fedErrors_.BadDAQPacket); } -const bool FEDErrors::anyDAQProblems() -{ - return ( fedErrors_.DataMissing || - fedErrors_.InvalidBuffers || - fedErrors_.BadFEDCRCs || - fedErrors_.BadDAQCRCs || - fedErrors_.BadIDs || - fedErrors_.BadDAQPacket - ); +const bool FEDErrors::anyFEDErrors() { + return (fedErrors_.InvalidBuffers || fedErrors_.BadFEDCRCs || fedErrors_.BadDAQCRCs || fedErrors_.BadIDs || + fedErrors_.BadDAQPacket || fedErrors_.FEsOverflow); } -const bool FEDErrors::anyFEDErrors() -{ - return ( fedErrors_.InvalidBuffers || - fedErrors_.BadFEDCRCs || - fedErrors_.BadDAQCRCs || - fedErrors_.BadIDs || - fedErrors_.BadDAQPacket || - fedErrors_.FEsOverflow - ); +const bool FEDErrors::anyFEProblems() { + return (fedErrors_.FEsOverflow || fedErrors_.FEsMissing || fedErrors_.FEsBadMajorityAddress); } -const bool FEDErrors::anyFEProblems() -{ - return ( fedErrors_.FEsOverflow || - fedErrors_.FEsMissing || - fedErrors_.FEsBadMajorityAddress - ); +const bool FEDErrors::printDebug() { + return (anyFEDErrors() || anyFEProblems() || fedErrors_.CorruptBuffer || fedErrors_.BadChannelStatusBit); } -const bool FEDErrors::printDebug() -{ - return ( anyFEDErrors() || - anyFEProblems() || - fedErrors_.CorruptBuffer || - fedErrors_.BadChannelStatusBit - ); +const unsigned int FEDErrors::fedID() { return fedID_; } -} +FEDErrors::FEDCounters& FEDErrors::getFEDErrorsCounters() { return lFedCounter_; } -const unsigned int FEDErrors::fedID(){ - return fedID_; -} +FEDErrors::ChannelCounters& FEDErrors::getChannelErrorsCounters() { return lChCounter_; } +FEDErrors::FECounters& FEDErrors::getFEErrorsCounters() { return feCounter_; } -FEDErrors::FEDCounters & FEDErrors::getFEDErrorsCounters() -{ - return lFedCounter_; -} +FEDErrors::FEDLevelErrors& FEDErrors::getFEDLevelErrors() { return fedErrors_; } -FEDErrors::ChannelCounters & FEDErrors::getChannelErrorsCounters() -{ - return lChCounter_; -} +FEDErrors::EventProperties& FEDErrors::getEventProperties() { return eventProp_; } -FEDErrors::FECounters & FEDErrors::getFEErrorsCounters() -{ - return feCounter_; -} +std::vector& FEDErrors::getFELevelErrors() { return feErrors_; } -FEDErrors::FEDLevelErrors & FEDErrors::getFEDLevelErrors() -{ - return fedErrors_; -} +std::vector& FEDErrors::getChannelLevelErrors() { return chErrorsDetailed_; } -FEDErrors::EventProperties & FEDErrors::getEventProperties() -{ - return eventProp_; -} +std::vector& FEDErrors::getAPVLevelErrors() { return apvErrors_; } -std::vector & FEDErrors::getFELevelErrors() -{ - return feErrors_; -} +std::vector >& FEDErrors::getBadChannels() { return chErrors_; } -std::vector & FEDErrors::getChannelLevelErrors() -{ - return chErrorsDetailed_; -} - -std::vector & FEDErrors::getAPVLevelErrors() -{ - return apvErrors_; -} +const FEDErrors::LumiErrors& FEDErrors::getLumiErrors() { return lumiErr_; } -std::vector > & FEDErrors::getBadChannels() -{ - return chErrors_; -} - -const FEDErrors::LumiErrors & FEDErrors::getLumiErrors(){ - return lumiErr_; -} - -void FEDErrors::addBadFE(const FEDErrors::FELevelErrors & aFE) -{ - if (aFE.Overflow) { +void FEDErrors::addBadFE(const FEDErrors::FELevelErrors& aFE) { + if (aFE.Overflow) { fedErrors_.FEsOverflow = true; (feCounter_.nFEOverflows)++; - } - else if (aFE.Missing) { + } else if (aFE.Missing) { fedErrors_.FEsMissing = true; (feCounter_.nFEMissing)++; feErrors_.push_back(aFE); - } - else if (aFE.BadMajorityAddress) { + } else if (aFE.BadMajorityAddress) { fedErrors_.FEsBadMajorityAddress = true; (feCounter_.nFEBadMajorityAddresses)++; feErrors_.push_back(aFE); - } - else if (aFE.TimeDifference != 0) { + } else if (aFE.TimeDifference != 0) { feErrors_.push_back(aFE); } } -void FEDErrors::addBadChannel(const FEDErrors::ChannelLevelErrors & aChannel) -{ - if (aChannel.Connected) chErrorsDetailed_.push_back(aChannel); +void FEDErrors::addBadChannel(const FEDErrors::ChannelLevelErrors& aChannel) { + if (aChannel.Connected) + chErrorsDetailed_.push_back(aChannel); incrementChannelCounters(aChannel); } -void FEDErrors::addBadAPV(const FEDErrors::APVLevelErrors & aAPV, bool & aFirst) -{ +void FEDErrors::addBadAPV(const FEDErrors::APVLevelErrors& aAPV, bool& aFirst) { apvErrors_.push_back(aAPV); incrementAPVCounters(aAPV); if (aAPV.APVStatusBit && aFirst) { fedErrors_.BadChannelStatusBit = true; lFedCounter_.nBadChannels++; - chErrors_.push_back(std::pair(aAPV.ChannelID,aAPV.IsActive)); + chErrors_.push_back(std::pair(aAPV.ChannelID, aAPV.IsActive)); if (aAPV.IsActive) { //print(aAPV); fedErrors_.BadActiveChannelStatusBit = true; @@ -1043,79 +905,64 @@ void FEDErrors::addBadAPV(const FEDErrors::APVLevelErrors & aAPV, bool & aFirst) } } - -void FEDErrors::incrementFEDCounters() -{ - if (fedErrors_.InvalidBuffers || - fedErrors_.BadFEDCRCs || - fedErrors_.BadDAQCRCs || - fedErrors_.BadIDs || - fedErrors_.BadDAQPacket - ) { +void FEDErrors::incrementFEDCounters() { + if (fedErrors_.InvalidBuffers || fedErrors_.BadFEDCRCs || fedErrors_.BadDAQCRCs || fedErrors_.BadIDs || + fedErrors_.BadDAQPacket) { lFedCounter_.nDAQProblems++; lFedCounter_.nFEDErrors++; } //FElevel errors - if (fedErrors_.FEsOverflow){ + if (fedErrors_.FEsOverflow) { lFedCounter_.nFEDsWithFEOverflows++; - } - else if (fedErrors_.FEsMissing){ + } else if (fedErrors_.FEsMissing) { lFedCounter_.nFEDsWithMissingFEs++; - } - else if (fedErrors_.FEsBadMajorityAddress){ + } else if (fedErrors_.FEsBadMajorityAddress) { lFedCounter_.nFEDsWithFEBadMajorityAddresses++; } - if (fedErrors_.FEsOverflow || - fedErrors_.FEsBadMajorityAddress || - fedErrors_.FEsMissing - ){ + if (fedErrors_.FEsOverflow || fedErrors_.FEsBadMajorityAddress || fedErrors_.FEsMissing) { lFedCounter_.nFEDsWithFEProblems++; lFedCounter_.nFEDErrors++; - } - else if (fedErrors_.CorruptBuffer) { + } else if (fedErrors_.CorruptBuffer) { lFedCounter_.nCorruptBuffers++; lFedCounter_.nFEDErrors++; } - - } - -void FEDErrors::incrementChannelCounters(const FEDErrors::ChannelLevelErrors & aChannel) -{ - if (aChannel.Unlocked && aChannel.Connected) lChCounter_.nUnlocked++; - if (aChannel.OutOfSync && aChannel.Connected) lChCounter_.nOutOfSync++; - if (!aChannel.Connected) lChCounter_.nNotConnected++; +void FEDErrors::incrementChannelCounters(const FEDErrors::ChannelLevelErrors& aChannel) { + if (aChannel.Unlocked && aChannel.Connected) + lChCounter_.nUnlocked++; + if (aChannel.OutOfSync && aChannel.Connected) + lChCounter_.nOutOfSync++; + if (!aChannel.Connected) + lChCounter_.nNotConnected++; } -void FEDErrors::incrementAPVCounters(const FEDErrors::APVLevelErrors & aAPV) -{ - if (aAPV.Connected && aAPV.IsActive){ - if (aAPV.APVStatusBit) lChCounter_.nAPVStatusBit++; - if (aAPV.APVAddressError) lChCounter_.nAPVAddressError++; - if (aAPV.APVError) lChCounter_.nAPVError++; +void FEDErrors::incrementAPVCounters(const FEDErrors::APVLevelErrors& aAPV) { + if (aAPV.Connected && aAPV.IsActive) { + if (aAPV.APVStatusBit) + lChCounter_.nAPVStatusBit++; + if (aAPV.APVAddressError) + lChCounter_.nAPVAddressError++; + if (aAPV.APVError) + lChCounter_.nAPVError++; } } - -bool FEDErrors::ChannelLevelErrors::operator <(const FEDErrors::ChannelLevelErrors & aErr) const{ - if (this->ChannelID < aErr.ChannelID) return true; +bool FEDErrors::ChannelLevelErrors::operator<(const FEDErrors::ChannelLevelErrors& aErr) const { + if (this->ChannelID < aErr.ChannelID) + return true; return false; } - - -bool FEDErrors::APVLevelErrors::operator <(const FEDErrors::APVLevelErrors & aErr) const{ - if (this->ChannelID < aErr.ChannelID) return true; +bool FEDErrors::APVLevelErrors::operator<(const FEDErrors::APVLevelErrors& aErr) const { + if (this->ChannelID < aErr.ChannelID) + return true; return false; } - -void FEDErrors::print(const FEDErrors::FEDCounters & aFEDCounter, std::ostream & aOs) -{ - +void FEDErrors::print(const FEDErrors::FEDCounters& aFEDCounter, std::ostream& aOs) { aOs << std::endl; aOs << "[FEDErrors]============================================" << std::endl << "[FEDErrors]==== Printing FEDCounters information : ====" << std::endl @@ -1127,18 +974,15 @@ void FEDErrors::print(const FEDErrors::FEDCounters & aFEDCounter, std::ostream & << "[FEDErrors]======== nBadChannels = " << aFEDCounter.nBadChannels << std::endl << "[FEDErrors]======== nBadActiveChannels = " << aFEDCounter.nBadActiveChannels << std::endl << "[FEDErrors]======== nFEDsWithFEOverflows = " << aFEDCounter.nFEDsWithFEOverflows << std::endl - << "[FEDErrors]======== nFEDsWithFEBadMajorityAddresses = " << aFEDCounter.nFEDsWithFEBadMajorityAddresses << std::endl + << "[FEDErrors]======== nFEDsWithFEBadMajorityAddresses = " << aFEDCounter.nFEDsWithFEBadMajorityAddresses + << std::endl << "[FEDErrors]======== nFEDsWithMissingFEs = " << aFEDCounter.nFEDsWithMissingFEs << std::endl << "[FEDErrors]======== nTotalBadChannels = " << aFEDCounter.nTotalBadChannels << std::endl << "[FEDErrors]======== nTotalBadActiveChannels = " << aFEDCounter.nTotalBadActiveChannels << std::endl << "[FEDErrors]============================================" << std::endl; - - } -void FEDErrors::print(const FEDErrors::FECounters & aFECounter, std::ostream & aOs) -{ - +void FEDErrors::print(const FEDErrors::FECounters& aFECounter, std::ostream& aOs) { aOs << std::endl; aOs << "[FEDErrors]============================================" << std::endl << "[FEDErrors]==== Printing FECounters information : ====" << std::endl @@ -1147,13 +991,9 @@ void FEDErrors::print(const FEDErrors::FECounters & aFECounter, std::ostream & a << "[FEDErrors]======== nFEBadMajorityAddresses = " << aFECounter.nFEBadMajorityAddresses << std::endl << "[FEDErrors]======== nFEMissing = " << aFECounter.nFEMissing << std::endl << "[FEDErrors]============================================" << std::endl; - - } -void FEDErrors::print(const FEDErrors::FEDLevelErrors & aFEDErr, std::ostream & aOs) -{ - +void FEDErrors::print(const FEDErrors::FEDLevelErrors& aFEDErr, std::ostream& aOs) { aOs << std::endl; aOs << "[FEDErrors]============================================" << std::endl << "[FEDErrors]==== Printing FED errors information : ====" << std::endl @@ -1170,13 +1010,10 @@ void FEDErrors::print(const FEDErrors::FEDLevelErrors & aFEDErr, std::ostream & << "[FEDErrors]======== FEOverflows = " << aFEDErr.FEsOverflow << std::endl << "[FEDErrors]======== FEMissing = " << aFEDErr.FEsMissing << std::endl << "[FEDErrors]======== BadMajorityAddresses = " << aFEDErr.FEsBadMajorityAddress << std::endl - << "[FEDErrors]============================================" << std::endl; - + << "[FEDErrors]============================================" << std::endl; } -void FEDErrors::print(const FEDErrors::FELevelErrors & aErr, std::ostream & aOs) -{ - +void FEDErrors::print(const FEDErrors::FELevelErrors& aErr, std::ostream& aOs) { aOs << std::endl; aOs << "[FEDErrors]============================================" << std::endl << "[FEDErrors]==== Printing FE errors information : ====" << std::endl @@ -1188,16 +1025,14 @@ void FEDErrors::print(const FEDErrors::FELevelErrors & aErr, std::ostream & aOs) << "[FEDErrors]======== BadMajorityAddresses = " << aErr.BadMajorityAddress << std::endl << "[FEDErrors]======== TimeDifference = " << aErr.TimeDifference << std::endl << "[FEDErrors]============================================" << std::endl; - } -void FEDErrors::print(const FEDErrors::ChannelLevelErrors & aErr, std::ostream & aOs) -{ +void FEDErrors::print(const FEDErrors::ChannelLevelErrors& aErr, std::ostream& aOs) { aOs << std::endl; aOs << "[FEDErrors]=================================================" << std::endl << "[FEDErrors]==== Printing channel errors information : ====" << std::endl << "[FEDErrors]=================================================" << std::endl - << "[FEDErrors]============ Channel #" << aErr.ChannelID << std::endl + << "[FEDErrors]============ Channel #" << aErr.ChannelID << std::endl << "[FEDErrors]============ connected = " << aErr.Connected << std::endl << "[FEDErrors]============ isActive = " << aErr.IsActive << std::endl << "[FEDErrors]============ Unlocked = " << aErr.Unlocked << std::endl @@ -1205,15 +1040,13 @@ void FEDErrors::print(const FEDErrors::ChannelLevelErrors & aErr, std::ostream & << "[FEDErrors]=================================================" << std::endl; } - -void FEDErrors::print(const FEDErrors::APVLevelErrors & aErr, std::ostream & aOs) -{ +void FEDErrors::print(const FEDErrors::APVLevelErrors& aErr, std::ostream& aOs) { aOs << std::endl; aOs << "[FEDErrors]=================================================" << std::endl << "[FEDErrors]==== Printing APV errors information : ====" << std::endl << "[FEDErrors]=================================================" << std::endl - << "[FEDErrors]============ APV #" << aErr.APVID << std::endl - << "[FEDErrors]============ Channel #" << aErr.ChannelID << std::endl + << "[FEDErrors]============ APV #" << aErr.APVID << std::endl + << "[FEDErrors]============ Channel #" << aErr.ChannelID << std::endl << "[FEDErrors]============ connected = " << aErr.Connected << std::endl << "[FEDErrors]============ isActive = " << aErr.IsActive << std::endl << "[FEDErrors]============ APVStatusBit = " << aErr.APVStatusBit << std::endl diff --git a/DQM/SiStripMonitorHardware/src/FEDHistograms.cc b/DQM/SiStripMonitorHardware/src/FEDHistograms.cc index e3a3fc412251b..010df0e4119b8 100644 --- a/DQM/SiStripMonitorHardware/src/FEDHistograms.cc +++ b/DQM/SiStripMonitorHardware/src/FEDHistograms.cc @@ -4,268 +4,246 @@ #include "DQM/SiStripMonitorHardware/interface/FEDHistograms.hh" - - -FEDHistograms::FEDHistograms() -{ +FEDHistograms::FEDHistograms() {} + +FEDHistograms::~FEDHistograms() {} + +void FEDHistograms::initialise(const edm::ParameterSet& iConfig, std::ostringstream* pDebugStream) { + getConfigForHistogram(fedEventSize_, "FedEventSize", iConfig, pDebugStream); + getConfigForHistogram(fedMaxEventSizevsTime_, "FedMaxEventSizevsTime", iConfig, pDebugStream); + + getConfigForHistogram(dataPresent_, "DataPresent", iConfig, pDebugStream); + getConfigForHistogram(anyFEDErrors_, "AnyFEDErrors", iConfig, pDebugStream); + getConfigForHistogram(anyDAQProblems_, "AnyDAQProblems", iConfig, pDebugStream); + getConfigForHistogram(anyFEProblems_, "AnyFEProblems", iConfig, pDebugStream); + getConfigForHistogram(corruptBuffers_, "CorruptBuffers", iConfig, pDebugStream); + getConfigForHistogram(badChannelStatusBits_, "BadChannelStatusBits", iConfig, pDebugStream); + getConfigForHistogram(badActiveChannelStatusBits_, "BadActiveChannelStatusBits", iConfig, pDebugStream); + + getConfigForHistogram(feOverflows_, "FEOverflows", iConfig, pDebugStream); + getConfigForHistogram(feMissing_, "FEMissing", iConfig, pDebugStream); + getConfigForHistogram(badMajorityAddresses_, "BadMajorityAddresses", iConfig, pDebugStream); + getConfigForHistogram(badMajorityInPartition_, "BadMajorityInPartition", iConfig, pDebugStream); + getConfigForHistogram(feMajFracTIB_, "FeMajFracTIB", iConfig, pDebugStream); + getConfigForHistogram(feMajFracTOB_, "FeMajFracTOB", iConfig, pDebugStream); + getConfigForHistogram(feMajFracTECB_, "FeMajFracTECB", iConfig, pDebugStream); + getConfigForHistogram(feMajFracTECF_, "FeMajFracTECF", iConfig, pDebugStream); + + getConfigForHistogram(dataMissing_, "DataMissing", iConfig, pDebugStream); + getConfigForHistogram(badIDs_, "BadIDs", iConfig, pDebugStream); + getConfigForHistogram(badDAQPacket_, "BadDAQPacket", iConfig, pDebugStream); + getConfigForHistogram(invalidBuffers_, "InvalidBuffers", iConfig, pDebugStream); + getConfigForHistogram(badDAQCRCs_, "BadDAQCRCs", iConfig, pDebugStream); + getConfigForHistogram(badFEDCRCs_, "BadFEDCRCs", iConfig, pDebugStream); + + getConfigForHistogram(feOverflowDetailed_, "FEOverflowsDetailed", iConfig, pDebugStream); + getConfigForHistogram(feMissingDetailed_, "FEMissingDetailed", iConfig, pDebugStream); + getConfigForHistogram(badMajorityAddressDetailed_, "BadMajorityAddressesDetailed", iConfig, pDebugStream); + getConfigForHistogram(badStatusBitsDetailed_, "BadAPVStatusBitsDetailed", iConfig, pDebugStream); + getConfigForHistogram(apvErrorDetailed_, "APVErrorBitsDetailed", iConfig, pDebugStream); + getConfigForHistogram(apvAddressErrorDetailed_, "APVAddressErrorBitsDetailed", iConfig, pDebugStream); + getConfigForHistogram(unlockedDetailed_, "UnlockedBitsDetailed", iConfig, pDebugStream); + getConfigForHistogram(outOfSyncDetailed_, "OOSBitsDetailed", iConfig, pDebugStream); + + getConfigForHistogram(nFEDErrors_, "nFEDErrors", iConfig, pDebugStream); + getConfigForHistogram(nFEDDAQProblems_, "nFEDDAQProblems", iConfig, pDebugStream); + getConfigForHistogram(nFEDsWithFEProblems_, "nFEDsWithFEProblems", iConfig, pDebugStream); + getConfigForHistogram(nFEDCorruptBuffers_, "nFEDCorruptBuffers", iConfig, pDebugStream); + getConfigForHistogram(nBadChannelStatusBits_, "nBadChannelStatusBits", iConfig, pDebugStream); + getConfigForHistogram(nBadActiveChannelStatusBits_, "nBadActiveChannelStatusBits", iConfig, pDebugStream); + getConfigForHistogram(nFEDsWithFEOverflows_, "nFEDsWithFEOverflows", iConfig, pDebugStream); + getConfigForHistogram(nFEDsWithMissingFEs_, "nFEDsWithMissingFEs", iConfig, pDebugStream); + getConfigForHistogram(nFEDsWithFEBadMajorityAddresses_, "nFEDsWithFEBadMajorityAddresses", iConfig, pDebugStream); + + getConfigForHistogram(nFEDErrorsvsTime_, "nFEDErrorsvsTime", iConfig, pDebugStream); + getConfigForHistogram(fedErrorsVsIdVsLumi_, "fedErrorsVsIdVsLumi", iConfig, pDebugStream); + getConfigForHistogram(nFEDCorruptBuffersvsTime_, "nFEDCorruptBuffersvsTime", iConfig, pDebugStream); + getConfigForHistogram(nFEDsWithFEProblemsvsTime_, "nFEDsWithFEProblemsvsTime", iConfig, pDebugStream); + + getConfigForHistogram(nUnconnectedChannels_, "nUnconnectedChannels", iConfig, pDebugStream); + + getConfigForHistogram(nTotalBadChannels_, "nTotalBadChannels", iConfig, pDebugStream); + getConfigForHistogram(nTotalBadActiveChannels_, "nTotalBadActiveChannels", iConfig, pDebugStream); + + getConfigForHistogram(nTotalBadChannelsvsTime_, "nTotalBadChannelsvsTime", iConfig, pDebugStream); + getConfigForHistogram(nTotalBadActiveChannelsvsTime_, "nTotalBadActiveChannelsvsTime", iConfig, pDebugStream); + + getConfigForHistogram(nAPVStatusBit_, "nAPVStatusBit", iConfig, pDebugStream); + getConfigForHistogram(nAPVError_, "nAPVError", iConfig, pDebugStream); + getConfigForHistogram(nAPVAddressError_, "nAPVAddressError", iConfig, pDebugStream); + getConfigForHistogram(nUnlocked_, "nUnlocked", iConfig, pDebugStream); + getConfigForHistogram(nOutOfSync_, "nOutOfSync", iConfig, pDebugStream); + + getConfigForHistogram(nAPVStatusBitvsTime_, "nAPVStatusBitvsTime", iConfig, pDebugStream); + getConfigForHistogram(nAPVErrorvsTime_, "nAPVErrorvsTime", iConfig, pDebugStream); + getConfigForHistogram(nAPVAddressErrorvsTime_, "nAPVAddressErrorvsTime", iConfig, pDebugStream); + getConfigForHistogram(nUnlockedvsTime_, "nUnlockedvsTime", iConfig, pDebugStream); + getConfigForHistogram(nOutOfSyncvsTime_, "nOutOfSyncvsTime", iConfig, pDebugStream); + + getConfigForHistogram(tkMapConfig_, "TkHistoMap", iConfig, pDebugStream); + + getConfigForHistogram(feTimeDiffTIB_, "FETimeDiffTIB", iConfig, pDebugStream); + getConfigForHistogram(feTimeDiffTOB_, "FETimeDiffTOB", iConfig, pDebugStream); + getConfigForHistogram(feTimeDiffTECB_, "FETimeDiffTECB", iConfig, pDebugStream); + getConfigForHistogram(feTimeDiffTECF_, "FETimeDiffTECF", iConfig, pDebugStream); + + getConfigForHistogram(feTimeDiffvsDBX_, "FETimeDiffvsDBX", iConfig, pDebugStream); + + getConfigForHistogram(apveAddress_, "ApveAddress", iConfig, pDebugStream); + getConfigForHistogram(feMajAddress_, "FeMajAddress", iConfig, pDebugStream); + + getConfigForHistogram(medianAPV0_, "MedianAPV0", iConfig, pDebugStream); + getConfigForHistogram(medianAPV1_, "MedianAPV1", iConfig, pDebugStream); + + getConfigForHistogram(lumiErrorFraction_, "ErrorFractionByLumiBlock", iConfig, pDebugStream); + + getConfigForHistogram(fedIdVsApvId_, "FedIdVsApvId", iConfig, pDebugStream); + + getConfigForHistogram(fedErrorsVsId_, "FedErrorsVsId", iConfig, pDebugStream); } -FEDHistograms::~FEDHistograms() -{ +void FEDHistograms::fillCountersHistograms(const FEDErrors::FEDCounters& fedLevelCounters, + const FEDErrors::ChannelCounters& chLevelCounters, + const unsigned int aMaxSize, + const double aTime) { + fillHistogram(fedMaxEventSizevsTime_, aTime, aMaxSize); + + fillHistogram(nFEDErrors_, fedLevelCounters.nFEDErrors); + fillHistogram(nFEDDAQProblems_, fedLevelCounters.nDAQProblems); + fillHistogram(nFEDsWithFEProblems_, fedLevelCounters.nFEDsWithFEProblems); + fillHistogram(nFEDCorruptBuffers_, fedLevelCounters.nCorruptBuffers); + fillHistogram(nFEDsWithFEOverflows_, fedLevelCounters.nFEDsWithFEOverflows); + fillHistogram(nFEDsWithFEBadMajorityAddresses_, fedLevelCounters.nFEDsWithFEBadMajorityAddresses); + fillHistogram(nFEDsWithMissingFEs_, fedLevelCounters.nFEDsWithMissingFEs); + fillHistogram(nBadChannelStatusBits_, fedLevelCounters.nBadChannels); + fillHistogram(nBadActiveChannelStatusBits_, fedLevelCounters.nBadActiveChannels); + + fillHistogram(nFEDErrorsvsTime_, aTime, fedLevelCounters.nFEDErrors); + fillHistogram(nFEDCorruptBuffersvsTime_, aTime, fedLevelCounters.nCorruptBuffers); + fillHistogram(nFEDsWithFEProblemsvsTime_, aTime, fedLevelCounters.nFEDsWithFEProblems); + + fillHistogram(nUnconnectedChannels_, chLevelCounters.nNotConnected); + + fillHistogram(nTotalBadChannels_, fedLevelCounters.nTotalBadChannels); + fillHistogram(nTotalBadActiveChannels_, fedLevelCounters.nTotalBadActiveChannels); + + fillHistogram(nTotalBadChannelsvsTime_, aTime, fedLevelCounters.nTotalBadChannels); + fillHistogram(nTotalBadActiveChannelsvsTime_, aTime, fedLevelCounters.nTotalBadActiveChannels); + + fillHistogram(nAPVStatusBit_, chLevelCounters.nAPVStatusBit); + fillHistogram(nAPVError_, chLevelCounters.nAPVError); + fillHistogram(nAPVAddressError_, chLevelCounters.nAPVAddressError); + fillHistogram(nUnlocked_, chLevelCounters.nUnlocked); + fillHistogram(nOutOfSync_, chLevelCounters.nOutOfSync); + + fillHistogram(nAPVStatusBitvsTime_, aTime, chLevelCounters.nAPVStatusBit); + fillHistogram(nAPVErrorvsTime_, aTime, chLevelCounters.nAPVError); + fillHistogram(nAPVAddressErrorvsTime_, aTime, chLevelCounters.nAPVAddressError); + fillHistogram(nUnlockedvsTime_, aTime, chLevelCounters.nUnlocked); + fillHistogram(nOutOfSyncvsTime_, aTime, chLevelCounters.nOutOfSync); } -void FEDHistograms::initialise(const edm::ParameterSet& iConfig, - std::ostringstream* pDebugStream - ) -{ - - getConfigForHistogram(fedEventSize_,"FedEventSize",iConfig,pDebugStream); - getConfigForHistogram(fedMaxEventSizevsTime_,"FedMaxEventSizevsTime",iConfig,pDebugStream); - - getConfigForHistogram(dataPresent_,"DataPresent",iConfig,pDebugStream); - getConfigForHistogram(anyFEDErrors_,"AnyFEDErrors",iConfig,pDebugStream); - getConfigForHistogram(anyDAQProblems_,"AnyDAQProblems",iConfig,pDebugStream); - getConfigForHistogram(anyFEProblems_,"AnyFEProblems",iConfig,pDebugStream); - getConfigForHistogram(corruptBuffers_,"CorruptBuffers",iConfig,pDebugStream); - getConfigForHistogram(badChannelStatusBits_,"BadChannelStatusBits",iConfig,pDebugStream); - getConfigForHistogram(badActiveChannelStatusBits_,"BadActiveChannelStatusBits",iConfig,pDebugStream); - - getConfigForHistogram(feOverflows_,"FEOverflows",iConfig,pDebugStream); - getConfigForHistogram(feMissing_,"FEMissing",iConfig,pDebugStream); - getConfigForHistogram(badMajorityAddresses_,"BadMajorityAddresses",iConfig,pDebugStream); - getConfigForHistogram(badMajorityInPartition_,"BadMajorityInPartition",iConfig,pDebugStream); - getConfigForHistogram(feMajFracTIB_,"FeMajFracTIB",iConfig,pDebugStream); - getConfigForHistogram(feMajFracTOB_,"FeMajFracTOB",iConfig,pDebugStream); - getConfigForHistogram(feMajFracTECB_,"FeMajFracTECB",iConfig,pDebugStream); - getConfigForHistogram(feMajFracTECF_,"FeMajFracTECF",iConfig,pDebugStream); - - getConfigForHistogram(dataMissing_,"DataMissing",iConfig,pDebugStream); - getConfigForHistogram(badIDs_,"BadIDs",iConfig,pDebugStream); - getConfigForHistogram(badDAQPacket_,"BadDAQPacket",iConfig,pDebugStream); - getConfigForHistogram(invalidBuffers_,"InvalidBuffers",iConfig,pDebugStream); - getConfigForHistogram(badDAQCRCs_,"BadDAQCRCs",iConfig,pDebugStream); - getConfigForHistogram(badFEDCRCs_,"BadFEDCRCs",iConfig,pDebugStream); - - getConfigForHistogram(feOverflowDetailed_,"FEOverflowsDetailed",iConfig,pDebugStream); - getConfigForHistogram(feMissingDetailed_,"FEMissingDetailed",iConfig,pDebugStream); - getConfigForHistogram(badMajorityAddressDetailed_,"BadMajorityAddressesDetailed",iConfig,pDebugStream); - getConfigForHistogram(badStatusBitsDetailed_,"BadAPVStatusBitsDetailed",iConfig,pDebugStream); - getConfigForHistogram(apvErrorDetailed_,"APVErrorBitsDetailed",iConfig,pDebugStream); - getConfigForHistogram(apvAddressErrorDetailed_,"APVAddressErrorBitsDetailed",iConfig,pDebugStream); - getConfigForHistogram(unlockedDetailed_,"UnlockedBitsDetailed",iConfig,pDebugStream); - getConfigForHistogram(outOfSyncDetailed_,"OOSBitsDetailed",iConfig,pDebugStream); - - getConfigForHistogram(nFEDErrors_,"nFEDErrors",iConfig,pDebugStream); - getConfigForHistogram(nFEDDAQProblems_,"nFEDDAQProblems",iConfig,pDebugStream); - getConfigForHistogram(nFEDsWithFEProblems_,"nFEDsWithFEProblems",iConfig,pDebugStream); - getConfigForHistogram(nFEDCorruptBuffers_,"nFEDCorruptBuffers",iConfig,pDebugStream); - getConfigForHistogram(nBadChannelStatusBits_,"nBadChannelStatusBits",iConfig,pDebugStream); - getConfigForHistogram(nBadActiveChannelStatusBits_,"nBadActiveChannelStatusBits",iConfig,pDebugStream); - getConfigForHistogram(nFEDsWithFEOverflows_,"nFEDsWithFEOverflows",iConfig,pDebugStream); - getConfigForHistogram(nFEDsWithMissingFEs_,"nFEDsWithMissingFEs",iConfig,pDebugStream); - getConfigForHistogram(nFEDsWithFEBadMajorityAddresses_,"nFEDsWithFEBadMajorityAddresses",iConfig,pDebugStream); - - getConfigForHistogram(nFEDErrorsvsTime_,"nFEDErrorsvsTime",iConfig,pDebugStream); - getConfigForHistogram(fedErrorsVsIdVsLumi_,"fedErrorsVsIdVsLumi",iConfig,pDebugStream); - getConfigForHistogram(nFEDCorruptBuffersvsTime_,"nFEDCorruptBuffersvsTime",iConfig,pDebugStream); - getConfigForHistogram(nFEDsWithFEProblemsvsTime_,"nFEDsWithFEProblemsvsTime",iConfig,pDebugStream); - - getConfigForHistogram(nUnconnectedChannels_,"nUnconnectedChannels",iConfig,pDebugStream); - - getConfigForHistogram(nTotalBadChannels_,"nTotalBadChannels",iConfig,pDebugStream); - getConfigForHistogram(nTotalBadActiveChannels_,"nTotalBadActiveChannels",iConfig,pDebugStream); - - getConfigForHistogram(nTotalBadChannelsvsTime_,"nTotalBadChannelsvsTime",iConfig,pDebugStream); - getConfigForHistogram(nTotalBadActiveChannelsvsTime_,"nTotalBadActiveChannelsvsTime",iConfig,pDebugStream); - - getConfigForHistogram(nAPVStatusBit_,"nAPVStatusBit",iConfig,pDebugStream); - getConfigForHistogram(nAPVError_,"nAPVError",iConfig,pDebugStream); - getConfigForHistogram(nAPVAddressError_,"nAPVAddressError",iConfig,pDebugStream); - getConfigForHistogram(nUnlocked_,"nUnlocked",iConfig,pDebugStream); - getConfigForHistogram(nOutOfSync_,"nOutOfSync",iConfig,pDebugStream); - - getConfigForHistogram(nAPVStatusBitvsTime_,"nAPVStatusBitvsTime",iConfig,pDebugStream); - getConfigForHistogram(nAPVErrorvsTime_,"nAPVErrorvsTime",iConfig,pDebugStream); - getConfigForHistogram(nAPVAddressErrorvsTime_,"nAPVAddressErrorvsTime",iConfig,pDebugStream); - getConfigForHistogram(nUnlockedvsTime_,"nUnlockedvsTime",iConfig,pDebugStream); - getConfigForHistogram(nOutOfSyncvsTime_,"nOutOfSyncvsTime",iConfig,pDebugStream); - - getConfigForHistogram(tkMapConfig_,"TkHistoMap",iConfig,pDebugStream); - - getConfigForHistogram(feTimeDiffTIB_,"FETimeDiffTIB",iConfig,pDebugStream); - getConfigForHistogram(feTimeDiffTOB_,"FETimeDiffTOB",iConfig,pDebugStream); - getConfigForHistogram(feTimeDiffTECB_,"FETimeDiffTECB",iConfig,pDebugStream); - getConfigForHistogram(feTimeDiffTECF_,"FETimeDiffTECF",iConfig,pDebugStream); - - getConfigForHistogram(feTimeDiffvsDBX_,"FETimeDiffvsDBX",iConfig,pDebugStream); - - getConfigForHistogram(apveAddress_,"ApveAddress",iConfig,pDebugStream); - getConfigForHistogram(feMajAddress_,"FeMajAddress",iConfig,pDebugStream); - - getConfigForHistogram(medianAPV0_,"MedianAPV0",iConfig,pDebugStream); - getConfigForHistogram(medianAPV1_,"MedianAPV1",iConfig,pDebugStream); - - getConfigForHistogram(lumiErrorFraction_,"ErrorFractionByLumiBlock",iConfig,pDebugStream); - - getConfigForHistogram(fedIdVsApvId_,"FedIdVsApvId",iConfig,pDebugStream); - - getConfigForHistogram(fedErrorsVsId_,"FedErrorsVsId",iConfig,pDebugStream); -} - -void FEDHistograms::fillCountersHistograms(const FEDErrors::FEDCounters & fedLevelCounters, - const FEDErrors::ChannelCounters & chLevelCounters, - const unsigned int aMaxSize, - const double aTime ) -{ - fillHistogram(fedMaxEventSizevsTime_,aTime,aMaxSize); - - fillHistogram(nFEDErrors_,fedLevelCounters.nFEDErrors); - fillHistogram(nFEDDAQProblems_,fedLevelCounters.nDAQProblems); - fillHistogram(nFEDsWithFEProblems_,fedLevelCounters.nFEDsWithFEProblems); - fillHistogram(nFEDCorruptBuffers_,fedLevelCounters.nCorruptBuffers); - fillHistogram(nFEDsWithFEOverflows_,fedLevelCounters.nFEDsWithFEOverflows); - fillHistogram(nFEDsWithFEBadMajorityAddresses_,fedLevelCounters.nFEDsWithFEBadMajorityAddresses); - fillHistogram(nFEDsWithMissingFEs_,fedLevelCounters.nFEDsWithMissingFEs); - fillHistogram(nBadChannelStatusBits_,fedLevelCounters.nBadChannels); - fillHistogram(nBadActiveChannelStatusBits_,fedLevelCounters.nBadActiveChannels); - - fillHistogram(nFEDErrorsvsTime_,aTime,fedLevelCounters.nFEDErrors); - fillHistogram(nFEDCorruptBuffersvsTime_,aTime,fedLevelCounters.nCorruptBuffers); - fillHistogram(nFEDsWithFEProblemsvsTime_,aTime,fedLevelCounters.nFEDsWithFEProblems); - - fillHistogram(nUnconnectedChannels_,chLevelCounters.nNotConnected); - - fillHistogram(nTotalBadChannels_,fedLevelCounters.nTotalBadChannels); - fillHistogram(nTotalBadActiveChannels_,fedLevelCounters.nTotalBadActiveChannels); - - fillHistogram(nTotalBadChannelsvsTime_,aTime,fedLevelCounters.nTotalBadChannels); - fillHistogram(nTotalBadActiveChannelsvsTime_,aTime,fedLevelCounters.nTotalBadActiveChannels); - - fillHistogram(nAPVStatusBit_,chLevelCounters.nAPVStatusBit); - fillHistogram(nAPVError_,chLevelCounters.nAPVError); - fillHistogram(nAPVAddressError_,chLevelCounters.nAPVAddressError); - fillHistogram(nUnlocked_,chLevelCounters.nUnlocked); - fillHistogram(nOutOfSync_,chLevelCounters.nOutOfSync); - - fillHistogram(nAPVStatusBitvsTime_,aTime,chLevelCounters.nAPVStatusBit); - fillHistogram(nAPVErrorvsTime_,aTime,chLevelCounters.nAPVError); - fillHistogram(nAPVAddressErrorvsTime_,aTime,chLevelCounters.nAPVAddressError); - fillHistogram(nUnlockedvsTime_,aTime,chLevelCounters.nUnlocked); - fillHistogram(nOutOfSyncvsTime_,aTime,chLevelCounters.nOutOfSync); - -} - -void FEDHistograms::fillFEDHistograms(FEDErrors & aFedErr, - const unsigned int aEvtSize, - bool lFullDebug, - const double aLumiSection, - unsigned int & NumBadChannels_perFEDID - ) -{ - const FEDErrors::FEDLevelErrors & lFedLevelErrors = aFedErr.getFEDLevelErrors(); +void FEDHistograms::fillFEDHistograms(FEDErrors& aFedErr, + const unsigned int aEvtSize, + bool lFullDebug, + const double aLumiSection, + unsigned int& NumBadChannels_perFEDID) { + const FEDErrors::FEDLevelErrors& lFedLevelErrors = aFedErr.getFEDLevelErrors(); const unsigned int lFedId = aFedErr.fedID(); - fillHistogram(fedEventSize_,lFedId,aEvtSize); + fillHistogram(fedEventSize_, lFedId, aEvtSize); - if (lFedLevelErrors.DataPresent) fillHistogram(dataPresent_,lFedId); + if (lFedLevelErrors.DataPresent) + fillHistogram(dataPresent_, lFedId); if (lFedLevelErrors.HasCabledChannels && lFedLevelErrors.DataMissing) { - fillHistogram(dataMissing_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,1); + fillHistogram(dataMissing_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 1); } if (lFedLevelErrors.InvalidBuffers) { - fillHistogram(invalidBuffers_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,2); - } - else if (lFedLevelErrors.CorruptBuffer) { - fillHistogram(corruptBuffers_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,3); - } - else if (lFedLevelErrors.BadFEDCRCs) { - fillHistogram(badFEDCRCs_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,4); - } - else if (lFedLevelErrors.BadDAQCRCs) { - fillHistogram(badDAQCRCs_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,5); - } - else if (lFedLevelErrors.BadIDs) { - fillHistogram(badIDs_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,6); - } - else if (lFedLevelErrors.BadDAQPacket) { - fillHistogram(badDAQPacket_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,7); + fillHistogram(invalidBuffers_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 2); + } else if (lFedLevelErrors.CorruptBuffer) { + fillHistogram(corruptBuffers_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 3); + } else if (lFedLevelErrors.BadFEDCRCs) { + fillHistogram(badFEDCRCs_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 4); + } else if (lFedLevelErrors.BadDAQCRCs) { + fillHistogram(badDAQCRCs_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 5); + } else if (lFedLevelErrors.BadIDs) { + fillHistogram(badIDs_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 6); + } else if (lFedLevelErrors.BadDAQPacket) { + fillHistogram(badDAQPacket_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 7); } if (aFedErr.anyFEDErrors()) { - fillHistogram(anyFEDErrors_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,8); + fillHistogram(anyFEDErrors_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 8); } if (lFedLevelErrors.HasCabledChannels && aFedErr.anyDAQProblems()) { - fillHistogram(anyDAQProblems_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,9); + fillHistogram(anyDAQProblems_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 9); } if (aFedErr.anyFEProblems()) { - fillHistogram(anyFEProblems_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,10); + fillHistogram(anyFEProblems_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 10); } if (lFedLevelErrors.FEsOverflow) { - fillHistogram(feOverflows_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,11); + fillHistogram(feOverflows_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 11); } if (lFedLevelErrors.FEsMissing) { - fillHistogram(feMissing_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,12); + fillHistogram(feMissing_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 12); } if (lFedLevelErrors.FEsBadMajorityAddress) { - fillHistogram(badMajorityAddresses_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,13); + fillHistogram(badMajorityAddresses_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 13); } if (lFedLevelErrors.BadChannelStatusBit) { - fillHistogram(badChannelStatusBits_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,14); + fillHistogram(badChannelStatusBits_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 14); } if (lFedLevelErrors.BadActiveChannelStatusBit) { - fillHistogram(badActiveChannelStatusBits_,lFedId); - fillHistogram(fedErrorsVsId_,lFedId,15); + fillHistogram(badActiveChannelStatusBits_, lFedId); + fillHistogram(fedErrorsVsId_, lFedId, 15); } - std::vector & lFeVec = aFedErr.getFELevelErrors(); + std::vector& lFeVec = aFedErr.getFELevelErrors(); - for (unsigned int iFe(0); iFe & lChVec = aFedErr.getChannelLevelErrors(); - for (unsigned int iCh(0); iCh < lChVec.size(); iCh++){ - fillChannelsHistograms(lFedId,lChVec[iCh],lFullDebug); + std::vector& lChVec = aFedErr.getChannelLevelErrors(); + for (unsigned int iCh(0); iCh < lChVec.size(); iCh++) { + fillChannelsHistograms(lFedId, lChVec[iCh], lFullDebug); } - std::vector & lAPVVec = aFedErr.getAPVLevelErrors(); - for (unsigned int iApv(0); iApv < lAPVVec.size(); iApv++){ - fillAPVsHistograms(lFedId,lAPVVec[iApv],lFullDebug); + std::vector& lAPVVec = aFedErr.getAPVLevelErrors(); + for (unsigned int iApv(0); iApv < lAPVVec.size(); iApv++) { + fillAPVsHistograms(lFedId, lAPVVec[iApv], lFullDebug); } double numChannelLevelErrors = 0; - if(fedErrorsVsIdVsLumi_.globalswitchon){ - numChannelLevelErrors = double(lChVec.size()); - fillHistogram2D(fedErrorsVsIdVsLumi_,aLumiSection,lFedId,numChannelLevelErrors); + if (fedErrorsVsIdVsLumi_.globalswitchon) { + numChannelLevelErrors = double(lChVec.size()); + fillHistogram2D(fedErrorsVsIdVsLumi_, aLumiSection, lFedId, numChannelLevelErrors); } - - } - - //fill a histogram if the pointer is not NULL (ie if it has been booked) void FEDHistograms::fillFEHistograms(const unsigned int aFedId, - const FEDErrors::FELevelErrors & aFeLevelErrors, const FEDErrors::EventProperties & aEventProp ) -{ + const FEDErrors::FELevelErrors& aFeLevelErrors, + const FEDErrors::EventProperties& aEventProp) { const unsigned short lFeId = aFeLevelErrors.FeID; /* if ( (feOverflowDetailed_.enabled && aFeLevelErrors.Overflow) || @@ -274,31 +252,35 @@ void FEDHistograms::fillFEHistograms(const unsigned int aFedId, ) bookFEDHistograms(aFedId); */ - if (aFeLevelErrors.Overflow) fillHistogram(feOverflowDetailedMap_[aFedId],lFeId); - else if (aFeLevelErrors.Missing) fillHistogram(feMissingDetailedMap_[aFedId],lFeId); - else if (aFeLevelErrors.BadMajorityAddress) fillHistogram(badMajorityAddressDetailedMap_[aFedId],lFeId); - + if (aFeLevelErrors.Overflow) + fillHistogram(feOverflowDetailedMap_[aFedId], lFeId); + else if (aFeLevelErrors.Missing) + fillHistogram(feMissingDetailedMap_[aFedId], lFeId); + else if (aFeLevelErrors.BadMajorityAddress) + fillHistogram(badMajorityAddressDetailedMap_[aFedId], lFeId); if (aFeLevelErrors.TimeDifference != 0) { if (aFeLevelErrors.SubDetID == 2 || aFeLevelErrors.SubDetID == 3 || aFeLevelErrors.SubDetID == 4) - fillHistogram(feTimeDiffTIB_,aFeLevelErrors.TimeDifference); + fillHistogram(feTimeDiffTIB_, aFeLevelErrors.TimeDifference); else if (aFeLevelErrors.SubDetID == 5) - fillHistogram(feTimeDiffTOB_,aFeLevelErrors.TimeDifference); + fillHistogram(feTimeDiffTOB_, aFeLevelErrors.TimeDifference); else if (aFeLevelErrors.SubDetID == 0) - fillHistogram(feTimeDiffTECB_,aFeLevelErrors.TimeDifference); + fillHistogram(feTimeDiffTECB_, aFeLevelErrors.TimeDifference); else if (aFeLevelErrors.SubDetID == 1) - fillHistogram(feTimeDiffTECF_,aFeLevelErrors.TimeDifference); - fillHistogram(feTimeDiffvsDBX_,aEventProp.deltaBX,aFeLevelErrors.TimeDifference < 0 ? aFeLevelErrors.TimeDifference+192 : aFeLevelErrors.TimeDifference ); - fillHistogram(apveAddress_,aFeLevelErrors.Apve); - fillHistogram(feMajAddress_,aFeLevelErrors.FeMaj); + fillHistogram(feTimeDiffTECF_, aFeLevelErrors.TimeDifference); + fillHistogram( + feTimeDiffvsDBX_, + aEventProp.deltaBX, + aFeLevelErrors.TimeDifference < 0 ? aFeLevelErrors.TimeDifference + 192 : aFeLevelErrors.TimeDifference); + fillHistogram(apveAddress_, aFeLevelErrors.Apve); + fillHistogram(feMajAddress_, aFeLevelErrors.FeMaj); } } //fill a histogram if the pointer is not NULL (ie if it has been booked) void FEDHistograms::fillChannelsHistograms(const unsigned int aFedId, - const FEDErrors::ChannelLevelErrors & aChErr, - bool fullDebug) -{ + const FEDErrors::ChannelLevelErrors& aChErr, + bool fullDebug) { unsigned int lChId = aChErr.ChannelID; /* if ( (unlockedDetailed_.enabled && aChErr.Unlocked) || @@ -307,18 +289,16 @@ void FEDHistograms::fillChannelsHistograms(const unsigned int aFedId, bookFEDHistograms(aFedId,fullDebug); */ if (aChErr.Unlocked) { - fillHistogram(unlockedDetailedMap_[aFedId],lChId); + fillHistogram(unlockedDetailedMap_[aFedId], lChId); } if (aChErr.OutOfSync) { - fillHistogram(outOfSyncDetailedMap_[aFedId],lChId); + fillHistogram(outOfSyncDetailedMap_[aFedId], lChId); } } - void FEDHistograms::fillAPVsHistograms(const unsigned int aFedId, - const FEDErrors::APVLevelErrors & aAPVErr, - bool fullDebug) -{ + const FEDErrors::APVLevelErrors& aAPVErr, + bool fullDebug) { unsigned int lChId = aAPVErr.APVID; /* if ( (badStatusBitsDetailed_.enabled && aAPVErr.APVStatusBit) || @@ -327,111 +307,127 @@ void FEDHistograms::fillAPVsHistograms(const unsigned int aFedId, ) bookFEDHistograms(aFedId,fullDebug); */ - if (aAPVErr.APVStatusBit) fillHistogram(badStatusBitsDetailedMap_[aFedId],lChId); - if (aAPVErr.APVError) fillHistogram(apvErrorDetailedMap_[aFedId],lChId); - if (aAPVErr.APVAddressError) fillHistogram(apvAddressErrorDetailedMap_[aFedId],lChId); + if (aAPVErr.APVStatusBit) + fillHistogram(badStatusBitsDetailedMap_[aFedId], lChId); + if (aAPVErr.APVError) + fillHistogram(apvErrorDetailedMap_[aFedId], lChId); + if (aAPVErr.APVAddressError) + fillHistogram(apvAddressErrorDetailedMap_[aFedId], lChId); } void FEDHistograms::fillMajorityHistograms(const unsigned int aPart, - const float aValue, - const std::vector & aFedIdVec){ - if (aPart==0) fillHistogram(feMajFracTIB_,aValue); - else if (aPart==1) fillHistogram(feMajFracTOB_,aValue); - else if (aPart==2) fillHistogram(feMajFracTECB_,aValue); - else if (aPart==3) fillHistogram(feMajFracTECF_,aValue); - - for (unsigned int iFed(0); iFed& aFedIdVec) { + if (aPart == 0) + fillHistogram(feMajFracTIB_, aValue); + else if (aPart == 1) + fillHistogram(feMajFracTOB_, aValue); + else if (aPart == 2) + fillHistogram(feMajFracTECB_, aValue); + else if (aPart == 3) + fillHistogram(feMajFracTECF_, aValue); + + for (unsigned int iFed(0); iFed < aFedIdVec.size(); ++iFed) { + fillHistogram(badMajorityInPartition_, aFedIdVec[iFed]); } - } -bool FEDHistograms::feMajHistosEnabled(){ - return ( feMajFracTIB_.enabled || - feMajFracTOB_.enabled || - feMajFracTECB_.enabled || - feMajFracTECF_.enabled || - badMajorityInPartition_.enabled ); +bool FEDHistograms::feMajHistosEnabled() { + return (feMajFracTIB_.enabled || feMajFracTOB_.enabled || feMajFracTECB_.enabled || feMajFracTECF_.enabled || + badMajorityInPartition_.enabled); } -void FEDHistograms::fillLumiHistograms(const FEDErrors::LumiErrors & aLumErr){ +void FEDHistograms::fillLumiHistograms(const FEDErrors::LumiErrors& aLumErr) { if (lumiErrorFraction_.enabled && lumiErrorFraction_.monitorEle) { lumiErrorFraction_.monitorEle->Reset(); - for (unsigned int iD(0); iD 0) fillHistogram(lumiErrorFraction_,iD+1,static_cast(aLumErr.nErrors[iD])/aLumErr.nTotal[iD]); + for (unsigned int iD(0); iD < aLumErr.nTotal.size(); iD++) { + if (aLumErr.nTotal[iD] > 0) + fillHistogram(lumiErrorFraction_, iD + 1, static_cast(aLumErr.nErrors[iD]) / aLumErr.nTotal[iD]); } } } +bool FEDHistograms::cmHistosEnabled() { return (medianAPV0_.enabled || medianAPV1_.enabled); } - -bool FEDHistograms::cmHistosEnabled() { - return (medianAPV0_.enabled || medianAPV1_.enabled); -} - -MonitorElement * FEDHistograms::cmHistPointer(bool aApv1) -{ - if (!aApv1) return medianAPV0_.monitorEle; - else return medianAPV1_.monitorEle; +MonitorElement* FEDHistograms::cmHistPointer(bool aApv1) { + if (!aApv1) + return medianAPV0_.monitorEle; + else + return medianAPV1_.monitorEle; } -MonitorElement * FEDHistograms::getFedvsAPVpointer() -{ - return fedIdVsApvId_.monitorEle; -} +MonitorElement* FEDHistograms::getFedvsAPVpointer() { return fedIdVsApvId_.monitorEle; } -void FEDHistograms::bookTopLevelHistograms(DQMStore::IBooker & ibooker, const TkDetMap* tkDetMap, std::string topFolderName) -{ +void FEDHistograms::bookTopLevelHistograms(DQMStore::IBooker& ibooker, + const TkDetMap* tkDetMap, + std::string topFolderName) { //get FED IDs const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID; const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID; //book FED level histograms - histosBooked_.resize(siStripFedIdMax+1,false); - debugHistosBooked_.resize(siStripFedIdMax+1,false); + histosBooked_.resize(siStripFedIdMax + 1, false); + debugHistosBooked_.resize(siStripFedIdMax + 1, false); //book histos - bookProfile(ibooker , fedEventSize_, - "FedEventSize", - "Average FED buffer Size (B) per Event", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5, - 0, - 42241, //total number of channels - "FED-ID", - " (B)" - ); - - - bookHistogram(ibooker , dataPresent_,"DataPresent", - "Number of events where the data from a FED is seen", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - bookHistogram(ibooker , nTotalBadChannels_, - "nTotalBadChannels", - "Number of channels with any error", - "Total # bad enabled channels"); - - bookHistogram(ibooker , nTotalBadActiveChannels_, - "nTotalBadActiveChannels", - "Number of active channels with any error", - "Total # bad active channels"); - - book2DHistogram(ibooker , fedIdVsApvId_, - "FedIdVsApvId", - "Any error per APV per event", - 192, 0 , 192, - 440, 50, 490, - "APV-ID", - "FED-ID"); - - book2DHistogram( ibooker , fedErrorsVsId_,"FEDErrorsVsId", - "FED Errors vs ID", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin,siStripFedIdMax+1, - 15, - 1,16, "FED ID" , "Error Type"); + bookProfile(ibooker, + fedEventSize_, + "FedEventSize", + "Average FED buffer Size (B) per Event", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + 0, + 42241, //total number of channels + "FED-ID", + " (B)"); + + bookHistogram(ibooker, + dataPresent_, + "DataPresent", + "Number of events where the data from a FED is seen", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + nTotalBadChannels_, + "nTotalBadChannels", + "Number of channels with any error", + "Total # bad enabled channels"); + + bookHistogram(ibooker, + nTotalBadActiveChannels_, + "nTotalBadActiveChannels", + "Number of active channels with any error", + "Total # bad active channels"); + + book2DHistogram(ibooker, + fedIdVsApvId_, + "FedIdVsApvId", + "Any error per APV per event", + 192, + 0, + 192, + 440, + 50, + 490, + "APV-ID", + "FED-ID"); + + book2DHistogram(ibooker, + fedErrorsVsId_, + "FEDErrorsVsId", + "FED Errors vs ID", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin, + siStripFedIdMax + 1, + 15, + 1, + 16, + "FED ID", + "Error Type"); fedErrorsVsId_.monitorEle->setBinLabel(1, "Data Missing", 2); fedErrorsVsId_.monitorEle->setBinLabel(2, "Invalid Buffers", 2); fedErrorsVsId_.monitorEle->setBinLabel(3, "Corrupt Buffers", 2); @@ -450,371 +446,463 @@ void FEDHistograms::bookTopLevelHistograms(DQMStore::IBooker & ibooker, const Tk const std::string lBaseDir = ibooker.pwd(); - ibooker.setCurrentFolder(lBaseDir+"/FED"); - - bookHistogram(ibooker , nFEDErrors_, - "nFEDErrors", - "Number of FEDs with errors (FED or FE Level) per event", - "# FEDErrors"); - - bookHistogram(ibooker , nFEDDAQProblems_, - "nFEDDAQProblems", - "Number of FEDs with DAQ problems per event", - "# FEDDAQProblems"); - - bookHistogram(ibooker , nFEDsWithFEProblems_, - "nFEDsWithFEProblems", - "Number of FEDs with FE problems per event", - "# FEDs with FE problems"); - - bookHistogram(ibooker , nFEDCorruptBuffers_, - "nFEDCorruptBuffers", - "Number of FEDs with corrupt buffers per event", - "# FEDs with corrupt buffer"); - - ibooker.setCurrentFolder(lBaseDir+"/FED/VsId"); - - bookHistogram(ibooker , dataMissing_,"DataMissing", - "Number of events where the data from a FED with cabled channels is missing", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - bookHistogram(ibooker , anyFEDErrors_,"AnyFEDErrors", - "Number of buffers with any FED error (excluding bad channel status bits, FE problems except overflows) per FED", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - bookHistogram(ibooker , corruptBuffers_,"CorruptBuffers", - "Number of corrupt FED buffers per FED", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - bookHistogram(ibooker , invalidBuffers_,"InvalidBuffers", - "Number of invalid FED buffers per FED", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - bookHistogram(ibooker , anyDAQProblems_,"AnyDAQProblems", - "Number of buffers with any problems flagged in DAQ header (including CRC)", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - bookHistogram(ibooker , badIDs_,"BadIDs", - "Number of buffers with non-SiStrip source IDs in DAQ header", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - bookHistogram(ibooker , badDAQCRCs_,"BadDAQCRCs", - "Number of buffers with bad CRCs from the DAQ", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - bookHistogram(ibooker , badFEDCRCs_,"BadFEDCRCs", - "Number of buffers with bad CRCs from the FED", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - bookHistogram(ibooker , badDAQPacket_,"BadDAQPacket", - "Number of buffers with (non-CRC) problems flagged in DAQ header/trailer", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - ibooker.setCurrentFolder(lBaseDir+"/FE"); - - bookHistogram(ibooker , nFEDsWithFEOverflows_, - "nFEDsWithFEOverflows", - "Number FEDs with FE units which overflowed per event", - "# FEDs with FE overflows"); - - bookHistogram(ibooker , nFEDsWithFEBadMajorityAddresses_, - "nFEDsWithFEBadMajorityAddresses", - "Number of FEDs with FE units with a bad majority address per event", - "# FEDs with bad address"); - - bookHistogram(ibooker , nFEDsWithMissingFEs_, - "nFEDsWithMissingFEs", - "Number of FEDs with missing FE unit payloads per event", - "# FEDs with missing FEs"); - - bookHistogram(ibooker , feMajFracTIB_,"FeMajFracTIB", - "Fraction of FEs matching majority address in TIB partition", - 101,0,1.01,"n(majAddrFE)/n(totFE)"); - - bookHistogram(ibooker , feMajFracTOB_,"FeMajFracTOB", - "Fraction of FEs matching majority address in TOB partition", - 101,0,1.01,"n(majAddrFE)/n(totFE)"); - - bookHistogram(ibooker , feMajFracTECB_,"FeMajFracTECB", - "Fraction of FEs matching majority address in TECB partition", - 101,0,1.01,"n(majAddrFE)/n(totFE)"); - - bookHistogram(ibooker , feMajFracTECF_,"FeMajFracTECF", - "Fraction of FEs matching majority address in TECF partition", - 101,0,1.01,"n(majAddrFE)/n(totFE)"); - - - ibooker.setCurrentFolder(lBaseDir+"/FE/APVe"); - - bookHistogram(ibooker , feTimeDiffTIB_,"FETimeDiffTIB", - "(TimeLoc FE - TimeLoc APVe) for TIB/TID, when different", - 401, - -200,201,"#Delta_{TimeLoc}(FE-APVe)"); - - bookHistogram(ibooker , feTimeDiffTOB_,"FETimeDiffTOB", - "(TimeLoc FE - TimeLoc APVe) for TOB, when different", - 401, - -200,201,"#Delta_{TimeLoc}(FE-APVe)"); - - bookHistogram(ibooker , feTimeDiffTECB_,"FETimeDiffTECB", - "(TimeLoc FE - TimeLoc APVe) for TECB, when different", - 401, - -200,201,"#Delta_{TimeLoc}(FE-APVe)"); - - bookHistogram(ibooker , feTimeDiffTECF_,"FETimeDiffTECF", - "(TimeLoc FE - TimeLoc APVe) for TECF, when different", - 401, - -200,201,"#Delta_{TimeLoc}(FE-APVe)"); - - book2DHistogram( ibooker , feTimeDiffvsDBX_,"FETimeDiffvsDBX", - "(TimeLoc FE - TimeLoc APVe) vs DBX, when different", - 2000,-0.5, 1999.5, - 201, - 0,201,"DeltaBX","#Delta_{TimeLoc}(FE-APVe)"); - - - bookHistogram(ibooker , apveAddress_,"ApveAddress", - "apve Address", - 256,0,256, - "apveAddress"); - - bookHistogram(ibooker , feMajAddress_,"FeMajAddress", - "FE Majority Address", - 256,0,256, - "feMajAddress"); - - - ibooker.setCurrentFolder(lBaseDir+"/FE/VsId"); - - bookHistogram(ibooker , anyFEProblems_,"AnyFEProblems", - "Number of buffers with any FE unit problems", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - bookHistogram(ibooker , feOverflows_,"FEOverflows", - "Number of buffers with one or more FE overflow", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - bookHistogram(ibooker , badMajorityAddresses_,"BadMajorityAddresses", - "Number of buffers with one or more FE with a bad majority APV address", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - bookHistogram(ibooker , badMajorityInPartition_,"BadMajorityInPartition", - "Number of buffers with >=1 FE with FEaddress != majority in partition", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - bookHistogram(ibooker , feMissing_,"FEMissing", - "Number of buffers with one or more FE unit payload missing", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - - ibooker.setCurrentFolder(lBaseDir+"/Fiber"); - - bookHistogram(ibooker , nBadChannelStatusBits_, - "nBadChannelStatusBits", - "Number of channels with bad status bits per event", - "# bad enabled channels"); - - bookHistogram(ibooker , nBadActiveChannelStatusBits_, - "nBadActiveChannelStatusBits", - "Number of active channels with bad status bits per event", - "# bad active channels"); - - bookHistogram(ibooker , nUnlocked_, - "nUnlocked", - "Number of channels Unlocked per event", - "# channels unlocked"); - - bookHistogram(ibooker , nOutOfSync_, - "nOutOfSync", - "Number of channels OutOfSync per event", - "# channels out-of-sync"); - - bookHistogram(ibooker , nUnconnectedChannels_, - "nUnconnectedChannels", - "Number of channels not connected per event", - "# unconnected channels"); - - ibooker.setCurrentFolder(lBaseDir+"/Fiber/VsId"); - - bookHistogram(ibooker , badChannelStatusBits_,"BadChannelStatusBits", - "Number of buffers with one or more enabled channel with bad status bits", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - bookHistogram(ibooker , badActiveChannelStatusBits_,"BadActiveChannelStatusBits", - "Number of buffers with one or more active channel with bad status bits", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5,"FED-ID"); - - ibooker.setCurrentFolder(lBaseDir+"/APV"); - - bookHistogram(ibooker , medianAPV0_,"MedianAPV0", - "Median APV0", - "medianAPV0"); - - bookHistogram(ibooker , medianAPV1_,"MedianAPV1", - "Median APV1", - "MedianAPV1"); - - bookHistogram(ibooker , nAPVStatusBit_, - "nAPVStatusBit", - "Number of APVs with APVStatusBit error per event", - "# APVs with APVStatusBit error"); - - bookHistogram(ibooker , nAPVError_, - "nAPVError", - "Number of APVs with APVError per event", - "#APVs with APVError"); - - bookHistogram(ibooker , nAPVAddressError_, - "nAPVAddressError", - "Number of APVs with APVAddressError per event", - "#APVs with APVAddressError"); - - - ibooker.setCurrentFolder(lBaseDir+"/Trends"); - - bookProfile( ibooker , fedMaxEventSizevsTime_, - "FedMaxEventSizevsTime", - "Max FED buffer Size (B) per Event vs time", - 0, - 42241, //total number of channels - "Time", - "Max FED buffer Size (B)" - ); - - bookProfile( ibooker , nTotalBadChannelsvsTime_, - "nTotalBadChannelsvsTime", - "Number of channels with any error vs time", - 0, - 42241, //total number of channels - "Time", - "Total # bad enabled channels" - ); - - - bookProfile( ibooker , nTotalBadActiveChannelsvsTime_, - "nTotalBadActiveChannelsvsTime", - "Number of active channels with any error vs time", - 0, - 42241, //total number of channels - "Time", - "Total # bad active channels" - ); - - ibooker.setCurrentFolder(lBaseDir+"/Trends/FED"); - - if(fedErrorsVsIdVsLumi_.globalswitchon){ - bookProfile2D( ibooker , fedErrorsVsIdVsLumi_, - "fedErrorsVsIdVsLumi", - "Total number of errors per FED ID per lumi section", - 440,//# FED IDS - 49.5,// Lowest FED ID - 489.5,// Highest FED ID - "Lumi. Section", - "FED ID" - ); - } - - bookProfile( ibooker , nFEDErrorsvsTime_, - "nFEDErrorsvsTime", - "Number of FEDs with any error vs time", - 0, - 42241, //total number of channels - "Time", - "# FEDErrors" - ); - - bookProfile( ibooker , nFEDCorruptBuffersvsTime_, - "nFEDCorruptBuffersvsTime", - "Number of FEDs with corrupt buffer vs time", - 0, - 42241, //total number of channels - "Time", - "# FEDCorruptBuffer" - ); - - ibooker.setCurrentFolder(lBaseDir+"/Trends/FE"); - - bookProfile( ibooker , nFEDsWithFEProblemsvsTime_, - "nFEDsWithFEProblemsvsTime", - "Number of FEDs with any FE error vs time", - 0, - 42241, //total number of channels - "Time", - "# FEDsWithFEProblems" - ); - - ibooker.setCurrentFolder(lBaseDir+"/Trends/Fiber"); - - bookProfile( ibooker , nUnlockedvsTime_, - "nUnlockedvsTime", - "Number of channels Unlocked vs time", - 0, - 42241, //total number of channels - "Time", - "# channels unlocked " - ); - - bookProfile( ibooker , nOutOfSyncvsTime_, - "nOutOfSyncvsTime", - "Number of channels OutOfSync vs time", - 0, - 42241, //total number of channels - "Time", - "# channels out-of-sync" - ); - - ibooker.setCurrentFolder(lBaseDir+"/Trends/APV"); - - bookProfile( ibooker , nAPVStatusBitvsTime_, - "nAPVStatusBitvsTime", - "Number of APVs with APVStatusBit error vs time", - 0, - 42241, //total number of channels - "Time", - "# APVs with APVStatusBit error" - ); - - bookProfile( ibooker , nAPVErrorvsTime_, - "nAPVErrorvsTime", - "Number of APVs with APVError vs time", - 0, - 42241, //total number of channels - "Time", - "# APVs with APVError" - ); - - bookProfile( ibooker , nAPVAddressErrorvsTime_, - "nAPVAddressErrorvsTime", - "Number of APVs with APVAddressError vs time", - 0, - 42241, //total number of channels - "Time", - "# APVs with APVAddressError" - ); - - ibooker.setCurrentFolder(lBaseDir+"/PerLumiSection"); - - bookHistogram(ibooker , lumiErrorFraction_, - "lumiErrorFraction", - "Fraction of error per lumi section vs subdetector", - 6,0.5,6.5, - "SubDetId"); + ibooker.setCurrentFolder(lBaseDir + "/FED"); + + bookHistogram( + ibooker, nFEDErrors_, "nFEDErrors", "Number of FEDs with errors (FED or FE Level) per event", "# FEDErrors"); + + bookHistogram( + ibooker, nFEDDAQProblems_, "nFEDDAQProblems", "Number of FEDs with DAQ problems per event", "# FEDDAQProblems"); + + bookHistogram(ibooker, + nFEDsWithFEProblems_, + "nFEDsWithFEProblems", + "Number of FEDs with FE problems per event", + "# FEDs with FE problems"); + + bookHistogram(ibooker, + nFEDCorruptBuffers_, + "nFEDCorruptBuffers", + "Number of FEDs with corrupt buffers per event", + "# FEDs with corrupt buffer"); + + ibooker.setCurrentFolder(lBaseDir + "/FED/VsId"); + + bookHistogram(ibooker, + dataMissing_, + "DataMissing", + "Number of events where the data from a FED with cabled channels is missing", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram( + ibooker, + anyFEDErrors_, + "AnyFEDErrors", + "Number of buffers with any FED error (excluding bad channel status bits, FE problems except overflows) per FED", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + corruptBuffers_, + "CorruptBuffers", + "Number of corrupt FED buffers per FED", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + invalidBuffers_, + "InvalidBuffers", + "Number of invalid FED buffers per FED", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + anyDAQProblems_, + "AnyDAQProblems", + "Number of buffers with any problems flagged in DAQ header (including CRC)", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + badIDs_, + "BadIDs", + "Number of buffers with non-SiStrip source IDs in DAQ header", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + badDAQCRCs_, + "BadDAQCRCs", + "Number of buffers with bad CRCs from the DAQ", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + badFEDCRCs_, + "BadFEDCRCs", + "Number of buffers with bad CRCs from the FED", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + badDAQPacket_, + "BadDAQPacket", + "Number of buffers with (non-CRC) problems flagged in DAQ header/trailer", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + ibooker.setCurrentFolder(lBaseDir + "/FE"); + + bookHistogram(ibooker, + nFEDsWithFEOverflows_, + "nFEDsWithFEOverflows", + "Number FEDs with FE units which overflowed per event", + "# FEDs with FE overflows"); + + bookHistogram(ibooker, + nFEDsWithFEBadMajorityAddresses_, + "nFEDsWithFEBadMajorityAddresses", + "Number of FEDs with FE units with a bad majority address per event", + "# FEDs with bad address"); + + bookHistogram(ibooker, + nFEDsWithMissingFEs_, + "nFEDsWithMissingFEs", + "Number of FEDs with missing FE unit payloads per event", + "# FEDs with missing FEs"); + + bookHistogram(ibooker, + feMajFracTIB_, + "FeMajFracTIB", + "Fraction of FEs matching majority address in TIB partition", + 101, + 0, + 1.01, + "n(majAddrFE)/n(totFE)"); + + bookHistogram(ibooker, + feMajFracTOB_, + "FeMajFracTOB", + "Fraction of FEs matching majority address in TOB partition", + 101, + 0, + 1.01, + "n(majAddrFE)/n(totFE)"); + + bookHistogram(ibooker, + feMajFracTECB_, + "FeMajFracTECB", + "Fraction of FEs matching majority address in TECB partition", + 101, + 0, + 1.01, + "n(majAddrFE)/n(totFE)"); + + bookHistogram(ibooker, + feMajFracTECF_, + "FeMajFracTECF", + "Fraction of FEs matching majority address in TECF partition", + 101, + 0, + 1.01, + "n(majAddrFE)/n(totFE)"); + + ibooker.setCurrentFolder(lBaseDir + "/FE/APVe"); + + bookHistogram(ibooker, + feTimeDiffTIB_, + "FETimeDiffTIB", + "(TimeLoc FE - TimeLoc APVe) for TIB/TID, when different", + 401, + -200, + 201, + "#Delta_{TimeLoc}(FE-APVe)"); + + bookHistogram(ibooker, + feTimeDiffTOB_, + "FETimeDiffTOB", + "(TimeLoc FE - TimeLoc APVe) for TOB, when different", + 401, + -200, + 201, + "#Delta_{TimeLoc}(FE-APVe)"); + + bookHistogram(ibooker, + feTimeDiffTECB_, + "FETimeDiffTECB", + "(TimeLoc FE - TimeLoc APVe) for TECB, when different", + 401, + -200, + 201, + "#Delta_{TimeLoc}(FE-APVe)"); + + bookHistogram(ibooker, + feTimeDiffTECF_, + "FETimeDiffTECF", + "(TimeLoc FE - TimeLoc APVe) for TECF, when different", + 401, + -200, + 201, + "#Delta_{TimeLoc}(FE-APVe)"); + + book2DHistogram(ibooker, + feTimeDiffvsDBX_, + "FETimeDiffvsDBX", + "(TimeLoc FE - TimeLoc APVe) vs DBX, when different", + 2000, + -0.5, + 1999.5, + 201, + 0, + 201, + "DeltaBX", + "#Delta_{TimeLoc}(FE-APVe)"); + + bookHistogram(ibooker, apveAddress_, "ApveAddress", "apve Address", 256, 0, 256, "apveAddress"); + + bookHistogram(ibooker, feMajAddress_, "FeMajAddress", "FE Majority Address", 256, 0, 256, "feMajAddress"); + + ibooker.setCurrentFolder(lBaseDir + "/FE/VsId"); + + bookHistogram(ibooker, + anyFEProblems_, + "AnyFEProblems", + "Number of buffers with any FE unit problems", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + feOverflows_, + "FEOverflows", + "Number of buffers with one or more FE overflow", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + badMajorityAddresses_, + "BadMajorityAddresses", + "Number of buffers with one or more FE with a bad majority APV address", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + badMajorityInPartition_, + "BadMajorityInPartition", + "Number of buffers with >=1 FE with FEaddress != majority in partition", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + feMissing_, + "FEMissing", + "Number of buffers with one or more FE unit payload missing", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + ibooker.setCurrentFolder(lBaseDir + "/Fiber"); + + bookHistogram(ibooker, + nBadChannelStatusBits_, + "nBadChannelStatusBits", + "Number of channels with bad status bits per event", + "# bad enabled channels"); + + bookHistogram(ibooker, + nBadActiveChannelStatusBits_, + "nBadActiveChannelStatusBits", + "Number of active channels with bad status bits per event", + "# bad active channels"); + + bookHistogram(ibooker, nUnlocked_, "nUnlocked", "Number of channels Unlocked per event", "# channels unlocked"); + + bookHistogram(ibooker, nOutOfSync_, "nOutOfSync", "Number of channels OutOfSync per event", "# channels out-of-sync"); + + bookHistogram(ibooker, + nUnconnectedChannels_, + "nUnconnectedChannels", + "Number of channels not connected per event", + "# unconnected channels"); + + ibooker.setCurrentFolder(lBaseDir + "/Fiber/VsId"); + + bookHistogram(ibooker, + badChannelStatusBits_, + "BadChannelStatusBits", + "Number of buffers with one or more enabled channel with bad status bits", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + badActiveChannelStatusBits_, + "BadActiveChannelStatusBits", + "Number of buffers with one or more active channel with bad status bits", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + ibooker.setCurrentFolder(lBaseDir + "/APV"); + + bookHistogram(ibooker, medianAPV0_, "MedianAPV0", "Median APV0", "medianAPV0"); + + bookHistogram(ibooker, medianAPV1_, "MedianAPV1", "Median APV1", "MedianAPV1"); + + bookHistogram(ibooker, + nAPVStatusBit_, + "nAPVStatusBit", + "Number of APVs with APVStatusBit error per event", + "# APVs with APVStatusBit error"); + + bookHistogram(ibooker, nAPVError_, "nAPVError", "Number of APVs with APVError per event", "#APVs with APVError"); + + bookHistogram(ibooker, + nAPVAddressError_, + "nAPVAddressError", + "Number of APVs with APVAddressError per event", + "#APVs with APVAddressError"); + + ibooker.setCurrentFolder(lBaseDir + "/Trends"); + + bookProfile(ibooker, + fedMaxEventSizevsTime_, + "FedMaxEventSizevsTime", + "Max FED buffer Size (B) per Event vs time", + 0, + 42241, //total number of channels + "Time", + "Max FED buffer Size (B)"); + + bookProfile(ibooker, + nTotalBadChannelsvsTime_, + "nTotalBadChannelsvsTime", + "Number of channels with any error vs time", + 0, + 42241, //total number of channels + "Time", + "Total # bad enabled channels"); + + bookProfile(ibooker, + nTotalBadActiveChannelsvsTime_, + "nTotalBadActiveChannelsvsTime", + "Number of active channels with any error vs time", + 0, + 42241, //total number of channels + "Time", + "Total # bad active channels"); + + ibooker.setCurrentFolder(lBaseDir + "/Trends/FED"); + + if (fedErrorsVsIdVsLumi_.globalswitchon) { + bookProfile2D(ibooker, + fedErrorsVsIdVsLumi_, + "fedErrorsVsIdVsLumi", + "Total number of errors per FED ID per lumi section", + 440, //# FED IDS + 49.5, // Lowest FED ID + 489.5, // Highest FED ID + "Lumi. Section", + "FED ID"); + } + + bookProfile(ibooker, + nFEDErrorsvsTime_, + "nFEDErrorsvsTime", + "Number of FEDs with any error vs time", + 0, + 42241, //total number of channels + "Time", + "# FEDErrors"); + + bookProfile(ibooker, + nFEDCorruptBuffersvsTime_, + "nFEDCorruptBuffersvsTime", + "Number of FEDs with corrupt buffer vs time", + 0, + 42241, //total number of channels + "Time", + "# FEDCorruptBuffer"); + + ibooker.setCurrentFolder(lBaseDir + "/Trends/FE"); + + bookProfile(ibooker, + nFEDsWithFEProblemsvsTime_, + "nFEDsWithFEProblemsvsTime", + "Number of FEDs with any FE error vs time", + 0, + 42241, //total number of channels + "Time", + "# FEDsWithFEProblems"); + + ibooker.setCurrentFolder(lBaseDir + "/Trends/Fiber"); + + bookProfile(ibooker, + nUnlockedvsTime_, + "nUnlockedvsTime", + "Number of channels Unlocked vs time", + 0, + 42241, //total number of channels + "Time", + "# channels unlocked "); + + bookProfile(ibooker, + nOutOfSyncvsTime_, + "nOutOfSyncvsTime", + "Number of channels OutOfSync vs time", + 0, + 42241, //total number of channels + "Time", + "# channels out-of-sync"); + + ibooker.setCurrentFolder(lBaseDir + "/Trends/APV"); + + bookProfile(ibooker, + nAPVStatusBitvsTime_, + "nAPVStatusBitvsTime", + "Number of APVs with APVStatusBit error vs time", + 0, + 42241, //total number of channels + "Time", + "# APVs with APVStatusBit error"); + + bookProfile(ibooker, + nAPVErrorvsTime_, + "nAPVErrorvsTime", + "Number of APVs with APVError vs time", + 0, + 42241, //total number of channels + "Time", + "# APVs with APVError"); + + bookProfile(ibooker, + nAPVAddressErrorvsTime_, + "nAPVAddressErrorvsTime", + "Number of APVs with APVAddressError vs time", + 0, + 42241, //total number of channels + "Time", + "# APVs with APVAddressError"); + + ibooker.setCurrentFolder(lBaseDir + "/PerLumiSection"); + + bookHistogram(ibooker, + lumiErrorFraction_, + "lumiErrorFraction", + "Fraction of error per lumi section vs subdetector", + 6, + 0.5, + 6.5, + "SubDetId"); //Set special property for lumi ME if (lumiErrorFraction_.enabled && lumiErrorFraction_.monitorEle) { @@ -828,103 +916,114 @@ void FEDHistograms::bookTopLevelHistograms(DQMStore::IBooker & ibooker, const Tk } //book map after, as it creates a new folder... - if (tkMapConfig_.enabled){ - tkmapFED_ = std::make_unique(tkDetMap, topFolderName,"TkHMap_FractionOfBadChannels",0.,true); - } - else tkmapFED_ = nullptr; - + if (tkMapConfig_.enabled) { + tkmapFED_ = std::make_unique(tkDetMap, topFolderName, "TkHMap_FractionOfBadChannels", 0., true); + } else + tkmapFED_ = nullptr; } -void FEDHistograms::bookFEDHistograms(DQMStore::IBooker & ibooker , unsigned int fedId, - bool fullDebugMode - ) -{ - - +void FEDHistograms::bookFEDHistograms(DQMStore::IBooker& ibooker, unsigned int fedId, bool fullDebugMode) { if (!histosBooked_[fedId]) { - - //will do that only once - SiStripFedKey fedKey(fedId,0,0,0); + SiStripFedKey fedKey(fedId, 0, 0, 0); std::stringstream fedIdStream; fedIdStream << fedId; ibooker.setCurrentFolder(fedKey.path()); - bookHistogram(ibooker , feOverflowDetailed_, - feOverflowDetailedMap_[fedId], - "FEOverflowsForFED"+fedIdStream.str(), - "FE overflows per FE unit for FED ID "+fedIdStream.str(), - sistrip::FEUNITS_PER_FED,0,sistrip::FEUNITS_PER_FED, - "FE-Index"); - bookHistogram(ibooker , badMajorityAddressDetailed_, - badMajorityAddressDetailedMap_[fedId], - "BadMajorityAddressesForFED"+fedIdStream.str(), - "Bad majority APV addresses per FE unit for FED ID "+fedIdStream.str(), - sistrip::FEUNITS_PER_FED,0,sistrip::FEUNITS_PER_FED, - "FE-Index"); - bookHistogram(ibooker , feMissingDetailed_, - feMissingDetailedMap_[fedId], - "FEMissingForFED"+fedIdStream.str(), - "Buffers with FE Unit payload missing per FE unit for FED ID "+fedIdStream.str(), - sistrip::FEUNITS_PER_FED,0,sistrip::FEUNITS_PER_FED, - "FE-Index"); - bookHistogram(ibooker , badStatusBitsDetailed_, - badStatusBitsDetailedMap_[fedId], - "BadAPVStatusBitsForFED"+fedIdStream.str(), - "Bad apv status bits for FED ID "+fedIdStream.str(), - sistrip::APVS_PER_FED,0,sistrip::APVS_PER_FED, - "APV-Index"); - histosBooked_[fedId] = true; + bookHistogram(ibooker, + feOverflowDetailed_, + feOverflowDetailedMap_[fedId], + "FEOverflowsForFED" + fedIdStream.str(), + "FE overflows per FE unit for FED ID " + fedIdStream.str(), + sistrip::FEUNITS_PER_FED, + 0, + sistrip::FEUNITS_PER_FED, + "FE-Index"); + bookHistogram(ibooker, + badMajorityAddressDetailed_, + badMajorityAddressDetailedMap_[fedId], + "BadMajorityAddressesForFED" + fedIdStream.str(), + "Bad majority APV addresses per FE unit for FED ID " + fedIdStream.str(), + sistrip::FEUNITS_PER_FED, + 0, + sistrip::FEUNITS_PER_FED, + "FE-Index"); + bookHistogram(ibooker, + feMissingDetailed_, + feMissingDetailedMap_[fedId], + "FEMissingForFED" + fedIdStream.str(), + "Buffers with FE Unit payload missing per FE unit for FED ID " + fedIdStream.str(), + sistrip::FEUNITS_PER_FED, + 0, + sistrip::FEUNITS_PER_FED, + "FE-Index"); + bookHistogram(ibooker, + badStatusBitsDetailed_, + badStatusBitsDetailedMap_[fedId], + "BadAPVStatusBitsForFED" + fedIdStream.str(), + "Bad apv status bits for FED ID " + fedIdStream.str(), + sistrip::APVS_PER_FED, + 0, + sistrip::APVS_PER_FED, + "APV-Index"); + histosBooked_[fedId] = true; } if (fullDebugMode && !debugHistosBooked_[fedId]) { //will do that only once - SiStripFedKey fedKey(fedId,0,0,0); + SiStripFedKey fedKey(fedId, 0, 0, 0); std::stringstream fedIdStream; fedIdStream << fedId; ibooker.setCurrentFolder(fedKey.path()); - bookHistogram(ibooker , apvErrorDetailed_, - apvErrorDetailedMap_[fedId], - "APVErrorBitsForFED"+fedIdStream.str(), - "APV errors for FED ID "+fedIdStream.str(), - sistrip::APVS_PER_FED,0,sistrip::APVS_PER_FED, - "APV-Index"); - bookHistogram(ibooker , apvAddressErrorDetailed_, - apvAddressErrorDetailedMap_[fedId], - "APVAddressErrorBitsForFED"+fedIdStream.str(), - "Wrong APV address errors for FED ID "+fedIdStream.str(), - sistrip::APVS_PER_FED,0,sistrip::APVS_PER_FED, - "APV-Index"); - bookHistogram(ibooker , unlockedDetailed_, - unlockedDetailedMap_[fedId], - "UnlockedBitsForFED"+fedIdStream.str(), - "Unlocked channels for FED ID "+fedIdStream.str(), - sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED, - "Channel-Index"); - bookHistogram(ibooker , outOfSyncDetailed_, - outOfSyncDetailedMap_[fedId], - "OOSBitsForFED"+fedIdStream.str(), - "Out of sync channels for FED ID "+fedIdStream.str(), - sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED, - "Channel-Index"); + bookHistogram(ibooker, + apvErrorDetailed_, + apvErrorDetailedMap_[fedId], + "APVErrorBitsForFED" + fedIdStream.str(), + "APV errors for FED ID " + fedIdStream.str(), + sistrip::APVS_PER_FED, + 0, + sistrip::APVS_PER_FED, + "APV-Index"); + bookHistogram(ibooker, + apvAddressErrorDetailed_, + apvAddressErrorDetailedMap_[fedId], + "APVAddressErrorBitsForFED" + fedIdStream.str(), + "Wrong APV address errors for FED ID " + fedIdStream.str(), + sistrip::APVS_PER_FED, + 0, + sistrip::APVS_PER_FED, + "APV-Index"); + bookHistogram(ibooker, + unlockedDetailed_, + unlockedDetailedMap_[fedId], + "UnlockedBitsForFED" + fedIdStream.str(), + "Unlocked channels for FED ID " + fedIdStream.str(), + sistrip::FEDCH_PER_FED, + 0, + sistrip::FEDCH_PER_FED, + "Channel-Index"); + bookHistogram(ibooker, + outOfSyncDetailed_, + outOfSyncDetailedMap_[fedId], + "OOSBitsForFED" + fedIdStream.str(), + "Out of sync channels for FED ID " + fedIdStream.str(), + sistrip::FEDCH_PER_FED, + 0, + sistrip::FEDCH_PER_FED, + "Channel-Index"); debugHistosBooked_[fedId] = true; } } -void FEDHistograms::bookAllFEDHistograms(DQMStore::IBooker & ibooker , bool fullDebugMode ) -{ +void FEDHistograms::bookAllFEDHistograms(DQMStore::IBooker& ibooker, bool fullDebugMode) { //get FED IDs const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID; const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID; //book them for (unsigned int iFed = siStripFedIdMin; iFed <= siStripFedIdMax; iFed++) - bookFEDHistograms(ibooker , iFed, fullDebugMode); + bookFEDHistograms(ibooker, iFed, fullDebugMode); } -bool FEDHistograms::tkHistoMapEnabled(unsigned int aIndex){ - return tkMapConfig_.enabled; -} +bool FEDHistograms::tkHistoMapEnabled(unsigned int aIndex) { return tkMapConfig_.enabled; } -TkHistoMap * FEDHistograms::tkHistoMapPointer(unsigned int aIndex){ - return tkmapFED_.get(); -} +TkHistoMap* FEDHistograms::tkHistoMapPointer(unsigned int aIndex) { return tkmapFED_.get(); } diff --git a/DQM/SiStripMonitorHardware/src/HistogramBase.cc b/DQM/SiStripMonitorHardware/src/HistogramBase.cc index 57d7ced8984a0..9feedbc0eed0e 100644 --- a/DQM/SiStripMonitorHardware/src/HistogramBase.cc +++ b/DQM/SiStripMonitorHardware/src/HistogramBase.cc @@ -4,309 +4,242 @@ #include "DQM/SiStripMonitorHardware/interface/HistogramBase.hh" - - -void HistogramBase::fillHistogram(HistogramConfig & histogram, - double value, - double weight) -{ - if (histogram.monitorEle) histogram.monitorEle->Fill(value,weight); +void HistogramBase::fillHistogram(HistogramConfig& histogram, double value, double weight) { + if (histogram.monitorEle) + histogram.monitorEle->Fill(value, weight); } - -void HistogramBase::fillHistogram(MonitorElement* histogram, - double value, - double weight) -{ - if (histogram) histogram->Fill(value,weight); +void HistogramBase::fillHistogram(MonitorElement* histogram, double value, double weight) { + if (histogram) + histogram->Fill(value, weight); } -void HistogramBase::fillHistogram2D(HistogramConfig & histogram, - double trendVar, - double value, - double weight - ) -{ - if (histogram.monitorEle) histogram.monitorEle->Fill(trendVar,value,weight); +void HistogramBase::fillHistogram2D(HistogramConfig& histogram, double trendVar, double value, double weight) { + if (histogram.monitorEle) + histogram.monitorEle->Fill(trendVar, value, weight); } -void HistogramBase::fillTkHistoMap(TkHistoMap* aMap, - uint32_t & detid, - float value - ){ - if (aMap) aMap->fill(detid,value); +void HistogramBase::fillTkHistoMap(TkHistoMap* aMap, uint32_t& detid, float value) { + if (aMap) + aMap->fill(detid, value); } - -void HistogramBase::getConfigForHistogram(HistogramConfig & aConfig, - const std::string& configName, - const edm::ParameterSet& psetContainingConfigPSet, - std::ostringstream* pDebugStream - ) -{ - +void HistogramBase::getConfigForHistogram(HistogramConfig& aConfig, + const std::string& configName, + const edm::ParameterSet& psetContainingConfigPSet, + std::ostringstream* pDebugStream) { aConfig.monitorEle = nullptr; aConfig.enabled = false; aConfig.nBins = 0; aConfig.min = aConfig.max = 0.; - const std::string psetName = configName+std::string("HistogramConfig"); + const std::string psetName = configName + std::string("HistogramConfig"); bool isTimeHisto = configName.find("vsTime") != configName.npos; if (psetContainingConfigPSet.exists(psetName)) { const edm::ParameterSet& pset = psetContainingConfigPSet.getUntrackedParameter(psetName); - if(configName.find("fedErrorsVsIdVsLumi") != std::string::npos){ - aConfig.globalswitchon = pset.getUntrackedParameter("globalswitchon"); - } + if (configName.find("fedErrorsVsIdVsLumi") != std::string::npos) { + aConfig.globalswitchon = pset.getUntrackedParameter("globalswitchon"); + } aConfig.enabled = (pset.exists("Enabled") ? pset.getUntrackedParameter("Enabled") : true); if (aConfig.enabled) { aConfig.nBins = (pset.exists("NBins") ? pset.getUntrackedParameter("NBins") : 600); aConfig.min = (pset.exists("Min") ? pset.getUntrackedParameter("Min") : 0); aConfig.max = (pset.exists("Max") ? pset.getUntrackedParameter("Max") : 3600); if (aConfig.nBins) { - if (pDebugStream) (*pDebugStream) << "[HistogramBase]\tHistogram: " << configName << "\tEnabled" - << "\tNBins: " << aConfig.nBins << "\tMin: " << aConfig.min << "\tMax: " << aConfig.max << std::endl; + if (pDebugStream) + (*pDebugStream) << "[HistogramBase]\tHistogram: " << configName << "\tEnabled" + << "\tNBins: " << aConfig.nBins << "\tMin: " << aConfig.min << "\tMax: " << aConfig.max + << std::endl; } else { - if (pDebugStream) (*pDebugStream) << "[HistogramBase]\tHistogram: " << configName << "\tEnabled" << std::endl; + if (pDebugStream) + (*pDebugStream) << "[HistogramBase]\tHistogram: " << configName << "\tEnabled" << std::endl; } } else { aConfig.enabled = false; aConfig.nBins = 0; aConfig.min = aConfig.max = 0.; - if (pDebugStream) (*pDebugStream) << "[HistogramBase]\tHistogram: " << configName << "\tDisabled" << std::endl; + if (pDebugStream) + (*pDebugStream) << "[HistogramBase]\tHistogram: " << configName << "\tDisabled" << std::endl; } - } - else { + } else { aConfig.enabled = false; aConfig.nBins = 0; aConfig.min = aConfig.max = 0.; - if (pDebugStream) (*pDebugStream) << "[HistogramBase]\tHistogram: " << configName << "\tDisabled" << std::endl; + if (pDebugStream) + (*pDebugStream) << "[HistogramBase]\tHistogram: " << configName << "\tDisabled" << std::endl; } //for timehisto, if global parameter exists => overwrite individual settings - if (psetContainingConfigPSet.exists("TimeHistogramConfig") && isTimeHisto) - { - const edm::ParameterSet& pset = psetContainingConfigPSet.getUntrackedParameter("TimeHistogramConfig"); - aConfig.nBins = (pset.exists("NBins") ? pset.getUntrackedParameter("NBins") : 600); - aConfig.min = (pset.exists("Min") ? pset.getUntrackedParameter("Min") : 0); - aConfig.max = (pset.exists("Max") ? pset.getUntrackedParameter("Max") : 3600); - } - + if (psetContainingConfigPSet.exists("TimeHistogramConfig") && isTimeHisto) { + const edm::ParameterSet& pset = + psetContainingConfigPSet.getUntrackedParameter("TimeHistogramConfig"); + aConfig.nBins = (pset.exists("NBins") ? pset.getUntrackedParameter("NBins") : 600); + aConfig.min = (pset.exists("Min") ? pset.getUntrackedParameter("Min") : 0); + aConfig.max = (pset.exists("Max") ? pset.getUntrackedParameter("Max") : 3600); + } } -void HistogramBase::bookHistogram(DQMStore::IBooker & ibooker , HistogramConfig & aConfig, - const std::string& name, - const std::string& title, - const unsigned int nBins, - const double min, - const double max, - const std::string& xAxisTitle - ) -{ - +void HistogramBase::bookHistogram(DQMStore::IBooker& ibooker, + HistogramConfig& aConfig, + const std::string& name, + const std::string& title, + const unsigned int nBins, + const double min, + const double max, + const std::string& xAxisTitle) { if (aConfig.enabled) { - aConfig.monitorEle = ibooker.book1D(name,title,nBins,min,max); - aConfig.monitorEle->setAxisTitle(xAxisTitle,1); + aConfig.monitorEle = ibooker.book1D(name, title, nBins, min, max); + aConfig.monitorEle->setAxisTitle(xAxisTitle, 1); } else { aConfig.monitorEle = nullptr; } - } -void HistogramBase::bookHistogram(DQMStore::IBooker & ibooker , HistogramConfig & aConfig, - MonitorElement* & aHist, - const std::string& name, - const std::string& title, - const unsigned int nBins, - const double min, - const double max, - const std::string& xAxisTitle - ) -{ - +void HistogramBase::bookHistogram(DQMStore::IBooker& ibooker, + HistogramConfig& aConfig, + MonitorElement*& aHist, + const std::string& name, + const std::string& title, + const unsigned int nBins, + const double min, + const double max, + const std::string& xAxisTitle) { if (aConfig.enabled) { - aHist = ibooker.book1D(name,title,nBins,min,max); - aHist->setAxisTitle(xAxisTitle,1); + aHist = ibooker.book1D(name, title, nBins, min, max); + aHist->setAxisTitle(xAxisTitle, 1); } else { aHist = nullptr; } - } -void HistogramBase::bookHistogram(DQMStore::IBooker & ibooker , HistogramConfig & aConfig, - const std::string& name, - const std::string& title, - const std::string& xAxisTitle - ) -{ - return bookHistogram(ibooker , aConfig,name,title,aConfig.nBins,aConfig.min,aConfig.max,xAxisTitle); - +void HistogramBase::bookHistogram(DQMStore::IBooker& ibooker, + HistogramConfig& aConfig, + const std::string& name, + const std::string& title, + const std::string& xAxisTitle) { + return bookHistogram(ibooker, aConfig, name, title, aConfig.nBins, aConfig.min, aConfig.max, xAxisTitle); } -void HistogramBase::book2DHistogram(DQMStore::IBooker & ibooker , HistogramConfig & aConfig, - const std::string& name, - const std::string& title, - const unsigned int nBins, - const double min, - const double max, - const unsigned int nBinsY, - const double minY, - const double maxY, - const std::string& xAxisTitle, - const std::string& yAxisTitle - ) -{ +void HistogramBase::book2DHistogram(DQMStore::IBooker& ibooker, + HistogramConfig& aConfig, + const std::string& name, + const std::string& title, + const unsigned int nBins, + const double min, + const double max, + const unsigned int nBinsY, + const double minY, + const double maxY, + const std::string& xAxisTitle, + const std::string& yAxisTitle) { if (aConfig.enabled) { - aConfig.monitorEle = ibooker.book2D(name,title,nBins,min,max,nBinsY,minY,maxY); - aConfig.monitorEle->setAxisTitle(xAxisTitle,1); - aConfig.monitorEle->setAxisTitle(yAxisTitle,2); + aConfig.monitorEle = ibooker.book2D(name, title, nBins, min, max, nBinsY, minY, maxY); + aConfig.monitorEle->setAxisTitle(xAxisTitle, 1); + aConfig.monitorEle->setAxisTitle(yAxisTitle, 2); } else { - aConfig.monitorEle=nullptr; + aConfig.monitorEle = nullptr; } } - -void HistogramBase::book2DHistogram(DQMStore::IBooker & ibooker , HistogramConfig & aConfig, - MonitorElement* & aHist, - const std::string& name, - const std::string& title, - const unsigned int nBins, - const double min, - const double max, - const unsigned int nBinsY, - const double minY, - const double maxY, - const std::string& xAxisTitle, - const std::string& yAxisTitle - ) -{ +void HistogramBase::book2DHistogram(DQMStore::IBooker& ibooker, + HistogramConfig& aConfig, + MonitorElement*& aHist, + const std::string& name, + const std::string& title, + const unsigned int nBins, + const double min, + const double max, + const unsigned int nBinsY, + const double minY, + const double maxY, + const std::string& xAxisTitle, + const std::string& yAxisTitle) { if (aConfig.enabled) { - aHist = ibooker.book2D(name,title,nBins,min,max,nBinsY,minY,maxY); - aHist->setAxisTitle(xAxisTitle,1); - aHist->setAxisTitle(yAxisTitle,2); + aHist = ibooker.book2D(name, title, nBins, min, max, nBinsY, minY, maxY); + aHist->setAxisTitle(xAxisTitle, 1); + aHist->setAxisTitle(yAxisTitle, 2); } else { - aHist=nullptr; + aHist = nullptr; } } - -void HistogramBase::bookProfile(DQMStore::IBooker & ibooker , HistogramConfig & aConfig, - const std::string& name, - const std::string& title, - const unsigned int nBins, - const double min, - const double max, - const double minY, - const double maxY, - const std::string& xAxisTitle, - const std::string& yAxisTitle - ) -{ - +void HistogramBase::bookProfile(DQMStore::IBooker& ibooker, + HistogramConfig& aConfig, + const std::string& name, + const std::string& title, + const unsigned int nBins, + const double min, + const double max, + const double minY, + const double maxY, + const std::string& xAxisTitle, + const std::string& yAxisTitle) { if (aConfig.enabled) { - aConfig.monitorEle = ibooker.bookProfile(name, - title, - nBins, - min, - max, - minY, - maxY - ); + aConfig.monitorEle = ibooker.bookProfile(name, title, nBins, min, max, minY, maxY); - aConfig.monitorEle->setAxisTitle(xAxisTitle,1); - aConfig.monitorEle->setAxisTitle(yAxisTitle,2); + aConfig.monitorEle->setAxisTitle(xAxisTitle, 1); + aConfig.monitorEle->setAxisTitle(yAxisTitle, 2); } else { aConfig.monitorEle = nullptr; } } -void HistogramBase::bookProfile(DQMStore::IBooker & ibooker , HistogramConfig & aConfig, - const std::string& name, - const std::string& title, - const double minY, - const double maxY, - const std::string& xAxisTitle, - const std::string& yAxisTitle - ) -{ - - bookProfile(ibooker , aConfig, - name, - title, - aConfig.nBins, - aConfig.min, - aConfig.max, - minY, - maxY, - xAxisTitle, - yAxisTitle); +void HistogramBase::bookProfile(DQMStore::IBooker& ibooker, + HistogramConfig& aConfig, + const std::string& name, + const std::string& title, + const double minY, + const double maxY, + const std::string& xAxisTitle, + const std::string& yAxisTitle) { + bookProfile( + ibooker, aConfig, name, title, aConfig.nBins, aConfig.min, aConfig.max, minY, maxY, xAxisTitle, yAxisTitle); //automatically set the axis range: will accomodate new values keeping the same number of bins. - if (aConfig.monitorEle) aConfig.monitorEle->getTProfile()->SetCanExtend(TH1::kAllAxes); + if (aConfig.monitorEle) + aConfig.monitorEle->getTProfile()->SetCanExtend(TH1::kAllAxes); } // New method to book trend plots of 2D histograms. // Uses ibooker methods: // https://github.com/cms-sw/cmssw/blob/4297d2489bfac27c8fc19d37d58b5264f424ecfe/DQMServices/Core/src/DQMStore.cc#L1500 -void HistogramBase::bookProfile2D(DQMStore::IBooker & ibooker , HistogramConfig & aConfig, - const std::string& name, - const std::string& title, - const unsigned int nBinsx, - const double xmin, - const double xmax, - const unsigned int nBinsy, - const double ymin, - const double ymax, - const std::string& xAxisTitle, - const std::string& yAxisTitle - ) -{ - - if (aConfig.enabled) { - aConfig.monitorEle = ibooker.bookProfile2D(name, - title, - nBinsx, - xmin, - xmax, - nBinsy, - ymin, - ymax, - 0, - 0 - ); +void HistogramBase::bookProfile2D(DQMStore::IBooker& ibooker, + HistogramConfig& aConfig, + const std::string& name, + const std::string& title, + const unsigned int nBinsx, + const double xmin, + const double xmax, + const unsigned int nBinsy, + const double ymin, + const double ymax, + const std::string& xAxisTitle, + const std::string& yAxisTitle) { + if (aConfig.enabled) { + aConfig.monitorEle = ibooker.bookProfile2D(name, title, nBinsx, xmin, xmax, nBinsy, ymin, ymax, 0, 0); - aConfig.monitorEle->setAxisTitle(xAxisTitle,1); - aConfig.monitorEle->setAxisTitle(yAxisTitle,2); - } else { - aConfig.monitorEle = nullptr; - } + aConfig.monitorEle->setAxisTitle(xAxisTitle, 1); + aConfig.monitorEle->setAxisTitle(yAxisTitle, 2); + } else { + aConfig.monitorEle = nullptr; + } } +void HistogramBase::bookProfile2D(DQMStore::IBooker& ibooker, + HistogramConfig& aConfig, + const std::string& name, + const std::string& title, + const unsigned int nBinsy, + const double ymin, + const double ymax, + const std::string& xAxisTitle, + const std::string& yAxisTitle) { + bookProfile2D( + ibooker, aConfig, name, title, aConfig.nBins, aConfig.min, aConfig.max, nBinsy, ymin, ymax, xAxisTitle, yAxisTitle); -void HistogramBase::bookProfile2D(DQMStore::IBooker & ibooker , HistogramConfig & aConfig, - const std::string& name, - const std::string& title, - const unsigned int nBinsy, - const double ymin, - const double ymax, - const std::string& xAxisTitle, - const std::string& yAxisTitle - ) -{ - - bookProfile2D(ibooker , aConfig, - name, - title, - aConfig.nBins, - aConfig.min, - aConfig.max, - nBinsy, - ymin, - ymax, - xAxisTitle, - yAxisTitle); - - //automatically set the axis range: will accomodate new values keeping the same number of bins. - if (aConfig.monitorEle && aConfig.monitorEle->kind() == MonitorElement::DQM_KIND_TPROFILE2D) aConfig.monitorEle->getTProfile2D()->SetCanExtend(TH1::kAllAxes); + //automatically set the axis range: will accomodate new values keeping the same number of bins. + if (aConfig.monitorEle && aConfig.monitorEle->kind() == MonitorElement::DQM_KIND_TPROFILE2D) + aConfig.monitorEle->getTProfile2D()->SetCanExtend(TH1::kAllAxes); } diff --git a/DQM/SiStripMonitorHardware/src/SPYHistograms.cc b/DQM/SiStripMonitorHardware/src/SPYHistograms.cc index 1854fc1a0b3c6..f65e2536d9019 100644 --- a/DQM/SiStripMonitorHardware/src/SPYHistograms.cc +++ b/DQM/SiStripMonitorHardware/src/SPYHistograms.cc @@ -7,681 +7,677 @@ #include "DQM/SiStripMonitorHardware/interface/SPYHistograms.h" using edm::LogError; -using edm::LogWarning; using edm::LogInfo; +using edm::LogWarning; - -SPYHistograms::SPYHistograms() -{ -} - -SPYHistograms::~SPYHistograms() -{ -} - - -void -SPYHistograms::initialise(const edm::ParameterSet& iConfig, - std::ostringstream* pDebugStream){ - - getConfigForHistogram(nNoData_,"nNoData",iConfig,pDebugStream); - getConfigForHistogram(nLowRange_,"nLowRange",iConfig,pDebugStream); - getConfigForHistogram(nHighRange_,"nHighRange",iConfig,pDebugStream); - getConfigForHistogram(nMinZero_,"nMinZero",iConfig,pDebugStream); - getConfigForHistogram(nMaxSat_,"nMaxSat",iConfig,pDebugStream); - getConfigForHistogram(nLowPb_,"nLowPb",iConfig,pDebugStream); - getConfigForHistogram(nHighPb_,"nHighPb",iConfig,pDebugStream); - getConfigForHistogram(nOutOfSync_,"nOutOfSync",iConfig,pDebugStream); - getConfigForHistogram(nOtherPbs_,"nOtherPbs",iConfig,pDebugStream); - getConfigForHistogram(nApvErrorBit_,"nApvErrorBit",iConfig,pDebugStream); - getConfigForHistogram(nApvAddressError_,"nApvAddressError",iConfig,pDebugStream); - getConfigForHistogram(nNegativePeds_,"nNegativePeds",iConfig,pDebugStream); - - getConfigForHistogram(nNoDatavsTime_,"nNoDatavsTime",iConfig,pDebugStream); - getConfigForHistogram(nLowRangevsTime_,"nLowRangevsTime",iConfig,pDebugStream); - getConfigForHistogram(nHighRangevsTime_,"nHighRangevsTime",iConfig,pDebugStream); - getConfigForHistogram(nMinZerovsTime_,"nMinZerovsTime",iConfig,pDebugStream); - getConfigForHistogram(nMaxSatvsTime_,"nMaxSatvsTime",iConfig,pDebugStream); - getConfigForHistogram(nLowPbvsTime_,"nLowPbvsTime",iConfig,pDebugStream); - getConfigForHistogram(nHighPbvsTime_,"nHighPbvsTime",iConfig,pDebugStream); - getConfigForHistogram(nOutOfSyncvsTime_,"nOutOfSyncvsTime",iConfig,pDebugStream); - getConfigForHistogram(nOtherPbsvsTime_,"nOtherPbsvsTime",iConfig,pDebugStream); - getConfigForHistogram(nApvErrorBitvsTime_,"nApvErrorBitvsTime",iConfig,pDebugStream); - getConfigForHistogram(nApvAddressErrorvsTime_,"nApvAddressErrorvsTime",iConfig,pDebugStream); - getConfigForHistogram(nNegativePedsvsTime_,"nNegativePedsvsTime",iConfig,pDebugStream); - - getConfigForHistogram(meanDigitalLowvsTime_,"meanDigitalLowvsTime",iConfig,pDebugStream); - - - getConfigForHistogram(noData_,"NoData",iConfig,pDebugStream); - getConfigForHistogram(lowRange_,"LowRange",iConfig,pDebugStream); - getConfigForHistogram(highRange_,"HighRange",iConfig,pDebugStream); - getConfigForHistogram(minZero_,"MinZero",iConfig,pDebugStream); - getConfigForHistogram(maxSat_,"MaxSat",iConfig,pDebugStream); - getConfigForHistogram(lowPb_,"LowPb",iConfig,pDebugStream); - getConfigForHistogram(highPb_,"HighPb",iConfig,pDebugStream); - getConfigForHistogram(outOfSync_,"OutOfSync",iConfig,pDebugStream); - getConfigForHistogram(otherPbs_,"OtherPbs",iConfig,pDebugStream); - getConfigForHistogram(apvErrorBit_,"ApvErrorBit",iConfig,pDebugStream); - getConfigForHistogram(apvAddressError_,"ApvAddressError",iConfig,pDebugStream); - getConfigForHistogram(negativePeds_,"NegativePeds",iConfig,pDebugStream); - - getConfigForHistogram(frameRange_,"FrameRange",iConfig,pDebugStream); - getConfigForHistogram(frameMin_,"FrameMin",iConfig,pDebugStream); - getConfigForHistogram(frameMax_,"FrameMax",iConfig,pDebugStream); - getConfigForHistogram(baseline_,"Baseline",iConfig,pDebugStream); - - getConfigForHistogram(noDataDetailed_,"NoDataDetailed",iConfig,pDebugStream); - getConfigForHistogram(lowRangeDetailed_,"LowRangeDetailed",iConfig,pDebugStream); - getConfigForHistogram(highRangeDetailed_,"HighRangeDetailed",iConfig,pDebugStream); - getConfigForHistogram(minZeroDetailed_,"MinZeroDetailed",iConfig,pDebugStream); - getConfigForHistogram(maxSatDetailed_,"MaxSatDetailed",iConfig,pDebugStream); - getConfigForHistogram(lowPbDetailed_,"LowPbDetailed",iConfig,pDebugStream); - getConfigForHistogram(highPbDetailed_,"HighPbDetailed",iConfig,pDebugStream); - getConfigForHistogram(outOfSyncDetailed_,"OutOfSyncDetailed",iConfig,pDebugStream); - getConfigForHistogram(otherPbsDetailed_,"OtherPbsDetailed",iConfig,pDebugStream); - getConfigForHistogram(apvErrorBitDetailed_,"ApvErrorBitDetailed",iConfig,pDebugStream); - getConfigForHistogram(apvAddressErrorDetailed_,"ApvAddressErrorDetailed",iConfig,pDebugStream); - getConfigForHistogram(negativePedsDetailed_,"NegativePedsDetailed",iConfig,pDebugStream); - - getConfigForHistogram(positionOfFirstHeaderBitDetailed_,"PositionOfFirstHeaderBitDetailed",iConfig,pDebugStream); - getConfigForHistogram(positionOfFirstTrailerBitDetailed_,"PositionOfFirstTrailerBitDetailed",iConfig,pDebugStream); - getConfigForHistogram(distanceHeaderTrailerDetailed_,"DistanceHeaderTrailerDetailed",iConfig,pDebugStream); - +SPYHistograms::SPYHistograms() {} + +SPYHistograms::~SPYHistograms() {} + +void SPYHistograms::initialise(const edm::ParameterSet& iConfig, std::ostringstream* pDebugStream) { + getConfigForHistogram(nNoData_, "nNoData", iConfig, pDebugStream); + getConfigForHistogram(nLowRange_, "nLowRange", iConfig, pDebugStream); + getConfigForHistogram(nHighRange_, "nHighRange", iConfig, pDebugStream); + getConfigForHistogram(nMinZero_, "nMinZero", iConfig, pDebugStream); + getConfigForHistogram(nMaxSat_, "nMaxSat", iConfig, pDebugStream); + getConfigForHistogram(nLowPb_, "nLowPb", iConfig, pDebugStream); + getConfigForHistogram(nHighPb_, "nHighPb", iConfig, pDebugStream); + getConfigForHistogram(nOutOfSync_, "nOutOfSync", iConfig, pDebugStream); + getConfigForHistogram(nOtherPbs_, "nOtherPbs", iConfig, pDebugStream); + getConfigForHistogram(nApvErrorBit_, "nApvErrorBit", iConfig, pDebugStream); + getConfigForHistogram(nApvAddressError_, "nApvAddressError", iConfig, pDebugStream); + getConfigForHistogram(nNegativePeds_, "nNegativePeds", iConfig, pDebugStream); + + getConfigForHistogram(nNoDatavsTime_, "nNoDatavsTime", iConfig, pDebugStream); + getConfigForHistogram(nLowRangevsTime_, "nLowRangevsTime", iConfig, pDebugStream); + getConfigForHistogram(nHighRangevsTime_, "nHighRangevsTime", iConfig, pDebugStream); + getConfigForHistogram(nMinZerovsTime_, "nMinZerovsTime", iConfig, pDebugStream); + getConfigForHistogram(nMaxSatvsTime_, "nMaxSatvsTime", iConfig, pDebugStream); + getConfigForHistogram(nLowPbvsTime_, "nLowPbvsTime", iConfig, pDebugStream); + getConfigForHistogram(nHighPbvsTime_, "nHighPbvsTime", iConfig, pDebugStream); + getConfigForHistogram(nOutOfSyncvsTime_, "nOutOfSyncvsTime", iConfig, pDebugStream); + getConfigForHistogram(nOtherPbsvsTime_, "nOtherPbsvsTime", iConfig, pDebugStream); + getConfigForHistogram(nApvErrorBitvsTime_, "nApvErrorBitvsTime", iConfig, pDebugStream); + getConfigForHistogram(nApvAddressErrorvsTime_, "nApvAddressErrorvsTime", iConfig, pDebugStream); + getConfigForHistogram(nNegativePedsvsTime_, "nNegativePedsvsTime", iConfig, pDebugStream); + + getConfigForHistogram(meanDigitalLowvsTime_, "meanDigitalLowvsTime", iConfig, pDebugStream); + + getConfigForHistogram(noData_, "NoData", iConfig, pDebugStream); + getConfigForHistogram(lowRange_, "LowRange", iConfig, pDebugStream); + getConfigForHistogram(highRange_, "HighRange", iConfig, pDebugStream); + getConfigForHistogram(minZero_, "MinZero", iConfig, pDebugStream); + getConfigForHistogram(maxSat_, "MaxSat", iConfig, pDebugStream); + getConfigForHistogram(lowPb_, "LowPb", iConfig, pDebugStream); + getConfigForHistogram(highPb_, "HighPb", iConfig, pDebugStream); + getConfigForHistogram(outOfSync_, "OutOfSync", iConfig, pDebugStream); + getConfigForHistogram(otherPbs_, "OtherPbs", iConfig, pDebugStream); + getConfigForHistogram(apvErrorBit_, "ApvErrorBit", iConfig, pDebugStream); + getConfigForHistogram(apvAddressError_, "ApvAddressError", iConfig, pDebugStream); + getConfigForHistogram(negativePeds_, "NegativePeds", iConfig, pDebugStream); + + getConfigForHistogram(frameRange_, "FrameRange", iConfig, pDebugStream); + getConfigForHistogram(frameMin_, "FrameMin", iConfig, pDebugStream); + getConfigForHistogram(frameMax_, "FrameMax", iConfig, pDebugStream); + getConfigForHistogram(baseline_, "Baseline", iConfig, pDebugStream); + + getConfigForHistogram(noDataDetailed_, "NoDataDetailed", iConfig, pDebugStream); + getConfigForHistogram(lowRangeDetailed_, "LowRangeDetailed", iConfig, pDebugStream); + getConfigForHistogram(highRangeDetailed_, "HighRangeDetailed", iConfig, pDebugStream); + getConfigForHistogram(minZeroDetailed_, "MinZeroDetailed", iConfig, pDebugStream); + getConfigForHistogram(maxSatDetailed_, "MaxSatDetailed", iConfig, pDebugStream); + getConfigForHistogram(lowPbDetailed_, "LowPbDetailed", iConfig, pDebugStream); + getConfigForHistogram(highPbDetailed_, "HighPbDetailed", iConfig, pDebugStream); + getConfigForHistogram(outOfSyncDetailed_, "OutOfSyncDetailed", iConfig, pDebugStream); + getConfigForHistogram(otherPbsDetailed_, "OtherPbsDetailed", iConfig, pDebugStream); + getConfigForHistogram(apvErrorBitDetailed_, "ApvErrorBitDetailed", iConfig, pDebugStream); + getConfigForHistogram(apvAddressErrorDetailed_, "ApvAddressErrorDetailed", iConfig, pDebugStream); + getConfigForHistogram(negativePedsDetailed_, "NegativePedsDetailed", iConfig, pDebugStream); + + getConfigForHistogram(positionOfFirstHeaderBitDetailed_, "PositionOfFirstHeaderBitDetailed", iConfig, pDebugStream); + getConfigForHistogram(positionOfFirstTrailerBitDetailed_, "PositionOfFirstTrailerBitDetailed", iConfig, pDebugStream); + getConfigForHistogram(distanceHeaderTrailerDetailed_, "DistanceHeaderTrailerDetailed", iConfig, pDebugStream); } -void SPYHistograms::fillGainHistograms(const Trends & aTrendElement, const double aTime) { - - fillHistogram(meanDigitalLowvsTime_,aTime,aTrendElement.meanDigitalLow); - +void SPYHistograms::fillGainHistograms(const Trends& aTrendElement, const double aTime) { + fillHistogram(meanDigitalLowvsTime_, aTime, aTrendElement.meanDigitalLow); } -void SPYHistograms::fillCountersHistograms(const ErrorCounters & aCounter, const double aTime) { - - - fillHistogram(nNoData_,aCounter.nNoData); - fillHistogram(nLowRange_,aCounter.nLowRange); - fillHistogram(nHighRange_,aCounter.nHighRange); - fillHistogram(nMinZero_,aCounter.nMinZero); - fillHistogram(nMaxSat_,aCounter.nMaxSat); - fillHistogram(nLowPb_,aCounter.nLowPb); - fillHistogram(nHighPb_,aCounter.nHighPb); - fillHistogram(nOutOfSync_,aCounter.nOOS); - fillHistogram(nOtherPbs_,aCounter.nOtherPbs); - fillHistogram(nApvErrorBit_,aCounter.nAPVError); - fillHistogram(nApvAddressError_,aCounter.nAPVAddressError); - fillHistogram(nNegativePeds_,aCounter.nNegPeds); - - fillHistogram(nNoDatavsTime_,aTime,aCounter.nNoData); - fillHistogram(nLowRangevsTime_,aTime,aCounter.nLowRange); - fillHistogram(nHighRangevsTime_,aTime,aCounter.nHighRange); - fillHistogram(nMinZerovsTime_,aTime,aCounter.nMinZero); - fillHistogram(nMaxSatvsTime_,aTime,aCounter.nMaxSat); - fillHistogram(nLowPbvsTime_,aTime,aCounter.nLowPb); - fillHistogram(nHighPbvsTime_,aTime,aCounter.nHighPb); - fillHistogram(nOutOfSyncvsTime_,aTime,aCounter.nOOS); - fillHistogram(nOtherPbsvsTime_,aTime,aCounter.nOtherPbs); - fillHistogram(nApvErrorBitvsTime_,aTime,aCounter.nAPVError); - fillHistogram(nApvAddressErrorvsTime_,aTime,aCounter.nAPVAddressError); - fillHistogram(nNegativePedsvsTime_,aTime,aCounter.nNegPeds); - - +void SPYHistograms::fillCountersHistograms(const ErrorCounters& aCounter, const double aTime) { + fillHistogram(nNoData_, aCounter.nNoData); + fillHistogram(nLowRange_, aCounter.nLowRange); + fillHistogram(nHighRange_, aCounter.nHighRange); + fillHistogram(nMinZero_, aCounter.nMinZero); + fillHistogram(nMaxSat_, aCounter.nMaxSat); + fillHistogram(nLowPb_, aCounter.nLowPb); + fillHistogram(nHighPb_, aCounter.nHighPb); + fillHistogram(nOutOfSync_, aCounter.nOOS); + fillHistogram(nOtherPbs_, aCounter.nOtherPbs); + fillHistogram(nApvErrorBit_, aCounter.nAPVError); + fillHistogram(nApvAddressError_, aCounter.nAPVAddressError); + fillHistogram(nNegativePeds_, aCounter.nNegPeds); + + fillHistogram(nNoDatavsTime_, aTime, aCounter.nNoData); + fillHistogram(nLowRangevsTime_, aTime, aCounter.nLowRange); + fillHistogram(nHighRangevsTime_, aTime, aCounter.nHighRange); + fillHistogram(nMinZerovsTime_, aTime, aCounter.nMinZero); + fillHistogram(nMaxSatvsTime_, aTime, aCounter.nMaxSat); + fillHistogram(nLowPbvsTime_, aTime, aCounter.nLowPb); + fillHistogram(nHighPbvsTime_, aTime, aCounter.nHighPb); + fillHistogram(nOutOfSyncvsTime_, aTime, aCounter.nOOS); + fillHistogram(nOtherPbsvsTime_, aTime, aCounter.nOtherPbs); + fillHistogram(nApvErrorBitvsTime_, aTime, aCounter.nAPVError); + fillHistogram(nApvAddressErrorvsTime_, aTime, aCounter.nAPVAddressError); + fillHistogram(nNegativePedsvsTime_, aTime, aCounter.nNegPeds); } - -void SPYHistograms::fillFEDHistograms(const Errors & aErr,const unsigned int aFedId) { +void SPYHistograms::fillFEDHistograms(const Errors& aErr, const unsigned int aFedId) { //else is used when filling the Error struct per channel, to avoid redundancy - //use only if here, in case channels in the same FED have different + //use only if here, in case channels in the same FED have different //"exclusive" error types... if (aErr.hasNoData) { //fill in channel loop with delay FPGA number... //fillHistogram(noData_,aFedId); } - if (aErr.hasLowRange) { - fillHistogram(lowRange_,aFedId); + if (aErr.hasLowRange) { + fillHistogram(lowRange_, aFedId); } - if (aErr.hasHighRange) { - fillHistogram(highRange_,aFedId); + if (aErr.hasHighRange) { + fillHistogram(highRange_, aFedId); } if (aErr.hasMinZero) { - fillHistogram(minZero_,aFedId); + fillHistogram(minZero_, aFedId); } if (aErr.hasMaxSat) { - fillHistogram(maxSat_,aFedId); + fillHistogram(maxSat_, aFedId); } if (aErr.hasLowPb) { - fillHistogram(lowPb_,aFedId); + fillHistogram(lowPb_, aFedId); } if (aErr.hasHighPb) { - fillHistogram(highPb_,aFedId); + fillHistogram(highPb_, aFedId); } if (aErr.hasOOS) { - fillHistogram(outOfSync_,aFedId); + fillHistogram(outOfSync_, aFedId); } if (aErr.hasOtherPbs) { - fillHistogram(otherPbs_,aFedId); + fillHistogram(otherPbs_, aFedId); } if (aErr.hasErrorBit0 || aErr.hasErrorBit1) { - fillHistogram(apvErrorBit_,aFedId); + fillHistogram(apvErrorBit_, aFedId); } if (aErr.hasAPVAddressError0 || aErr.hasAPVAddressError1) { - fillHistogram(apvAddressError_,aFedId); + fillHistogram(apvAddressError_, aFedId); } if (aErr.hasNegPeds) { - fillHistogram(negativePeds_,aFedId); + fillHistogram(negativePeds_, aFedId); } - - } - -void SPYHistograms::fillDetailedHistograms(const Errors & aErr, - const sistrip::SpyUtilities::Frame & aFrame, - const unsigned int aFedId, - const unsigned int aFedChannel) { +void SPYHistograms::fillDetailedHistograms(const Errors& aErr, + const sistrip::SpyUtilities::Frame& aFrame, + const unsigned int aFedId, + const unsigned int aFedChannel) { //removed: tomas //bookFEDHistograms(aFedId,aErr); if (!aErr.hasNoData) { - fillHistogram(frameRange_,sistrip::SpyUtilities::range(aFrame)); - fillHistogram(frameMin_,aFrame.digitalLow); - fillHistogram(frameMax_,aFrame.digitalHigh); - fillHistogram(baseline_,aFrame.baseline); + fillHistogram(frameRange_, sistrip::SpyUtilities::range(aFrame)); + fillHistogram(frameMin_, aFrame.digitalLow); + fillHistogram(frameMax_, aFrame.digitalHigh); + fillHistogram(baseline_, aFrame.baseline); } if (aErr.hasNoData) { - fillHistogram(noDataDetailedMap_[aFedId],aFedChannel); + fillHistogram(noDataDetailedMap_[aFedId], aFedChannel); //fillHistogram(noData_,24*aFedId+static_cast(aFedChannel/4.)); - fillHistogram(noData_,static_cast(aFedChannel/4.)); + fillHistogram(noData_, static_cast(aFedChannel / 4.)); } - if (aErr.hasLowRange) { - fillHistogram(lowRangeDetailedMap_[aFedId],aFedChannel); + if (aErr.hasLowRange) { + fillHistogram(lowRangeDetailedMap_[aFedId], aFedChannel); } - if (aErr.hasHighRange) { - fillHistogram(highRangeDetailedMap_[aFedId],aFedChannel); + if (aErr.hasHighRange) { + fillHistogram(highRangeDetailedMap_[aFedId], aFedChannel); } if (aErr.hasMinZero) { - fillHistogram(minZeroDetailedMap_[aFedId],aFedChannel); + fillHistogram(minZeroDetailedMap_[aFedId], aFedChannel); } if (aErr.hasMaxSat) { - fillHistogram(maxSatDetailedMap_[aFedId],aFedChannel); + fillHistogram(maxSatDetailedMap_[aFedId], aFedChannel); } if (aErr.hasLowPb) { - fillHistogram(lowPbDetailedMap_[aFedId],aFedChannel); + fillHistogram(lowPbDetailedMap_[aFedId], aFedChannel); } if (aErr.hasHighPb) { - fillHistogram(highPbDetailedMap_[aFedId],aFedChannel); + fillHistogram(highPbDetailedMap_[aFedId], aFedChannel); } if (aErr.hasOOS) { - fillHistogram(outOfSyncDetailedMap_[aFedId],aFedChannel); + fillHistogram(outOfSyncDetailedMap_[aFedId], aFedChannel); } if (aErr.hasOtherPbs) { - fillHistogram(otherPbsDetailedMap_[aFedId],aFedChannel); + fillHistogram(otherPbsDetailedMap_[aFedId], aFedChannel); } if (aErr.hasErrorBit0) { - fillHistogram(apvErrorBitDetailedMap_[aFedId],2*aFedChannel); + fillHistogram(apvErrorBitDetailedMap_[aFedId], 2 * aFedChannel); } if (aErr.hasErrorBit1) { - fillHistogram(apvErrorBitDetailedMap_[aFedId],2*aFedChannel+1); + fillHistogram(apvErrorBitDetailedMap_[aFedId], 2 * aFedChannel + 1); } if (aErr.hasAPVAddressError0) { - fillHistogram(apvAddressErrorDetailedMap_[aFedId],2*aFedChannel); + fillHistogram(apvAddressErrorDetailedMap_[aFedId], 2 * aFedChannel); } if (aErr.hasAPVAddressError1) { - fillHistogram(apvAddressErrorDetailedMap_[aFedId],2*aFedChannel+1); + fillHistogram(apvAddressErrorDetailedMap_[aFedId], 2 * aFedChannel + 1); } if (aErr.hasNegPeds) { - fillHistogram(negativePedsDetailedMap_[aFedId],aFedChannel); + fillHistogram(negativePedsDetailedMap_[aFedId], aFedChannel); } - fillHistogram(positionOfFirstHeaderBitDetailedMap_[aFedId],aFrame.firstHeaderBit); - fillHistogram(positionOfFirstTrailerBitDetailedMap_[aFedId],aFrame.firstTrailerBit); + fillHistogram(positionOfFirstHeaderBitDetailedMap_[aFedId], aFrame.firstHeaderBit); + fillHistogram(positionOfFirstTrailerBitDetailedMap_[aFedId], aFrame.firstTrailerBit); if (aFrame.firstTrailerBit != sistrip::SPY_SAMPLES_PER_CHANNEL && aFrame.firstHeaderBit != sistrip::SPY_SAMPLES_PER_CHANNEL) - fillHistogram(distanceHeaderTrailerDetailedMap_[aFedId],aFrame.firstTrailerBit-aFrame.firstHeaderBit); - else fillHistogram(distanceHeaderTrailerDetailedMap_[aFedId],0); + fillHistogram(distanceHeaderTrailerDetailedMap_[aFedId], aFrame.firstTrailerBit - aFrame.firstHeaderBit); + else + fillHistogram(distanceHeaderTrailerDetailedMap_[aFedId], 0); } - -void SPYHistograms::bookTopLevelHistograms(DQMStore::IBooker & ibooker, const TkDetMap*) -{ +void SPYHistograms::bookTopLevelHistograms(DQMStore::IBooker& ibooker, const TkDetMap*) { //get FED IDs const unsigned int siStripFedIdMin = sistrip::FED_ID_MIN; const unsigned int siStripFedIdMax = sistrip::FED_ID_MAX; - //book FED level histograms: resize boolean so + //book FED level histograms: resize boolean so //they will be booked only once for the first event. - histosBooked_.resize(siStripFedIdMax+1,false); - + histosBooked_.resize(siStripFedIdMax + 1, false); //book histos - bookHistogram(ibooker , nNoData_,"nNoData", - ";n_{noData};n_{entries}", - "n_{noData}"); - - bookHistogram(ibooker , nLowRange_,"nLowRange", - ";n_{LowRange};n_{entries}", - "n_{LowRange}"); - - bookHistogram(ibooker , nHighRange_,"nHighRange", - ";n_{HighRange};n_{entries}", - "n_{HighRange}"); - - bookHistogram(ibooker , nMinZero_,"nMinZero", - ";n_{MinZero};n_{entries}", - "n_{MinZero}"); - - bookHistogram(ibooker , nMaxSat_,"nMaxSat", - ";n_{MaxSat};n_{entries}", - "n_{MaxSat}"); - - bookHistogram(ibooker , nLowPb_,"nLowPb", - ";n_{lowPb};n_{entries}", - "n_{lowPb}"); - - bookHistogram(ibooker , nHighPb_,"nHighPb", - ";n_{highPb};n_{entries}", - "n_{highPb}"); - - bookHistogram(ibooker , nOutOfSync_,"nOutOfSync", - ";n_{OOS};n_{entries}", - "n_{OOS}"); - - bookHistogram(ibooker , nOtherPbs_,"nOtherPbs", - ";n_{OtherPbs};n_{entries}", - "n_{OtherPbs}"); - - bookHistogram(ibooker , nApvErrorBit_,"nApvErrorBit", - ";n_{APVerror};n_{entries}", - "n_{APVerror}" - ); - - bookHistogram(ibooker , nApvAddressError_,"nApvAddressError", - ";n_{APVAddressError};n_{entries}", - "n_{APVAddressError}" - ); - - bookHistogram(ibooker , nNegativePeds_,"nNegativePeds", - ";n_{negPeds};n_{entries}", - "n_{negPeds}" - ); - - - - bookHistogram(ibooker , noData_,"NoData", - ";delayFPGA;n_{noData}", - //24*(siStripFedIdMax+1)-24*siStripFedIdMin, - //24*siStripFedIdMin,24*(siStripFedIdMax+1), - 24,0,24, - "delayFPGA index" - ); - - bookHistogram(ibooker , lowRange_,"LowRange", - ";fedId;n_{LowRange}", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5, - "FED-ID" - ); - - bookHistogram(ibooker , highRange_,"HighRange", - ";fedId;n_{HighRange}", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5, - "FED-ID" - ); - - bookHistogram(ibooker , minZero_,"MinZero", - ";fedId;n_{MinZero}", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5, - "FED-ID" - ); - - bookHistogram(ibooker , maxSat_,"MaxSat", - ";fedId;n_{MaxSat}", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5, - "FED-ID" - ); - - bookHistogram(ibooker , lowPb_,"LowPb", - ";fedId;n_{lowPb}", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5, - "FED-ID" - ); - - bookHistogram(ibooker , highPb_,"HighPb", - ";fedId;n_{highPb}", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5, - "FED-ID" - ); - - bookHistogram(ibooker , outOfSync_,"OutOfSync", - ";fedId;n_{OOS}", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5, - "FED-ID" - ); - - bookHistogram(ibooker , otherPbs_,"OtherPbs", - ";fedId;n_{OtherPbs}", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5, - "FED-ID" - ); - - bookHistogram(ibooker , apvErrorBit_,"ApvErrorBit", - ";fedId;n_{APVerror}", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5, - "FED-ID" - ); - - bookHistogram(ibooker , apvAddressError_,"ApvAddressError", - ";fedId;n_{APVAddressError}", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5, - "FED-ID" - ); - - bookHistogram(ibooker , negativePeds_,"NegativePeds", - ";fedId;n_{negPeds}", - siStripFedIdMax-siStripFedIdMin+1, - siStripFedIdMin-0.5,siStripFedIdMax+0.5, - "FED-ID" - ); - - bookHistogram(ibooker , frameRange_,"FrameRange", - ";range;n_{entries}", - 1024,0,1024, - "range (adc counts)"); - - bookHistogram(ibooker , frameMin_,"FrameMin", - ";Zero-light level;n_{entries}", - 800,0,800, - "Zero-light level (adc counts)"); - - bookHistogram(ibooker , frameMax_,"FrameMax", - ";Tick height;n_{entries}", - 824,200,1024, - "Tick height (adc counts)"); - - bookHistogram(ibooker , baseline_,"Baseline", - ";Baseline;n_{entries}", - 1024,0,1024, - "Baseline (adc counts)"); - - + bookHistogram(ibooker, nNoData_, "nNoData", ";n_{noData};n_{entries}", "n_{noData}"); + + bookHistogram(ibooker, nLowRange_, "nLowRange", ";n_{LowRange};n_{entries}", "n_{LowRange}"); + + bookHistogram(ibooker, nHighRange_, "nHighRange", ";n_{HighRange};n_{entries}", "n_{HighRange}"); + + bookHistogram(ibooker, nMinZero_, "nMinZero", ";n_{MinZero};n_{entries}", "n_{MinZero}"); + + bookHistogram(ibooker, nMaxSat_, "nMaxSat", ";n_{MaxSat};n_{entries}", "n_{MaxSat}"); + + bookHistogram(ibooker, nLowPb_, "nLowPb", ";n_{lowPb};n_{entries}", "n_{lowPb}"); + + bookHistogram(ibooker, nHighPb_, "nHighPb", ";n_{highPb};n_{entries}", "n_{highPb}"); + + bookHistogram(ibooker, nOutOfSync_, "nOutOfSync", ";n_{OOS};n_{entries}", "n_{OOS}"); + + bookHistogram(ibooker, nOtherPbs_, "nOtherPbs", ";n_{OtherPbs};n_{entries}", "n_{OtherPbs}"); + + bookHistogram(ibooker, nApvErrorBit_, "nApvErrorBit", ";n_{APVerror};n_{entries}", "n_{APVerror}"); + + bookHistogram( + ibooker, nApvAddressError_, "nApvAddressError", ";n_{APVAddressError};n_{entries}", "n_{APVAddressError}"); + + bookHistogram(ibooker, nNegativePeds_, "nNegativePeds", ";n_{negPeds};n_{entries}", "n_{negPeds}"); + + bookHistogram(ibooker, + noData_, + "NoData", + ";delayFPGA;n_{noData}", + //24*(siStripFedIdMax+1)-24*siStripFedIdMin, + //24*siStripFedIdMin,24*(siStripFedIdMax+1), + 24, + 0, + 24, + "delayFPGA index"); + + bookHistogram(ibooker, + lowRange_, + "LowRange", + ";fedId;n_{LowRange}", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + highRange_, + "HighRange", + ";fedId;n_{HighRange}", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + minZero_, + "MinZero", + ";fedId;n_{MinZero}", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + maxSat_, + "MaxSat", + ";fedId;n_{MaxSat}", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + lowPb_, + "LowPb", + ";fedId;n_{lowPb}", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + highPb_, + "HighPb", + ";fedId;n_{highPb}", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + outOfSync_, + "OutOfSync", + ";fedId;n_{OOS}", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + otherPbs_, + "OtherPbs", + ";fedId;n_{OtherPbs}", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + apvErrorBit_, + "ApvErrorBit", + ";fedId;n_{APVerror}", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + apvAddressError_, + "ApvAddressError", + ";fedId;n_{APVAddressError}", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, + negativePeds_, + "NegativePeds", + ";fedId;n_{negPeds}", + siStripFedIdMax - siStripFedIdMin + 1, + siStripFedIdMin - 0.5, + siStripFedIdMax + 0.5, + "FED-ID"); + + bookHistogram(ibooker, frameRange_, "FrameRange", ";range;n_{entries}", 1024, 0, 1024, "range (adc counts)"); + + bookHistogram( + ibooker, frameMin_, "FrameMin", ";Zero-light level;n_{entries}", 800, 0, 800, "Zero-light level (adc counts)"); + + bookHistogram(ibooker, frameMax_, "FrameMax", ";Tick height;n_{entries}", 824, 200, 1024, "Tick height (adc counts)"); + + bookHistogram(ibooker, baseline_, "Baseline", ";Baseline;n_{entries}", 1024, 0, 1024, "Baseline (adc counts)"); //book histos - - bookProfile(ibooker , nNoDatavsTime_,"nNoDatavsTime", - ";time;n_{noData}", - 0, - 42241,//total number of channels - "Time", - "n_{noData}"); - - bookProfile(ibooker , nLowRangevsTime_,"nLowRangevsTime", - ";time;n_{LowRange}", - 0, - 42241,//total number of channels - "Time", - "n_{LowRange}"); - - bookProfile(ibooker , nHighRangevsTime_,"nHighRangevsTime", - ";time;n_{HighRange}", - 0, - 42241,//total number of channels - "Time", - "n_{HighRange}"); - - - bookProfile(ibooker , nMinZerovsTime_,"nMinZerovsTime", - ";time;n_{MinZero}", - 0, - 42241,//total number of channels - "Time", - "n_{MinZero}"); - - bookProfile(ibooker , nMaxSatvsTime_,"nMaxSatvsTime", - ";time;n_{MaxSat}", - 0, - 42241,//total number of channels - "Time", - "n_{MaxSat}"); - - bookProfile(ibooker , nLowPbvsTime_,"nLowPbvsTime", - ";time;n_{lowPb}", - 0, - 42241,//total number of channels - "Time", - "n_{lowPb}"); - - bookProfile(ibooker , nHighPbvsTime_,"nHighPbvsTime", - ";time;n_{highPb}", - 0, - 42241,//total number of channels - "Time", - "n_{highPb}"); - - - bookProfile(ibooker , nOutOfSyncvsTime_,"nOutOfSyncvsTime", - ";time;n_{OOS}", - 0, - 42241,//total number of channels - "Time", - "n_{OOS}"); - - bookProfile(ibooker , nOtherPbsvsTime_,"nOtherPbsvsTime", - ";time;n_{OtherPbs}", - 0, - 42241,//total number of channels - "Time", - "n_{OtherPbs}"); - - bookProfile(ibooker , nApvErrorBitvsTime_,"nApvErrorBitvsTime", - ";time;n_{APVerror}", - 0, - 42241,//total number of channels - "Time", - "n_{APVerror}"); - - bookProfile(ibooker , nApvAddressErrorvsTime_,"nApvAddressErrorvsTime", - ";time;n_{APVAddressError}", - 0, - 42241,//total number of channels - "Time", - "n_{APVAddressError}"); - - bookProfile(ibooker , nNegativePedsvsTime_,"nNegativePedsvsTime", - ";time;n_{negPeds}", - 0, - 42241,//total number of channels - "Time", - "n_{negPeds}"); - - - //book histos + bookProfile(ibooker, + nNoDatavsTime_, + "nNoDatavsTime", + ";time;n_{noData}", + 0, + 42241, //total number of channels + "Time", + "n_{noData}"); + + bookProfile(ibooker, + nLowRangevsTime_, + "nLowRangevsTime", + ";time;n_{LowRange}", + 0, + 42241, //total number of channels + "Time", + "n_{LowRange}"); + + bookProfile(ibooker, + nHighRangevsTime_, + "nHighRangevsTime", + ";time;n_{HighRange}", + 0, + 42241, //total number of channels + "Time", + "n_{HighRange}"); + + bookProfile(ibooker, + nMinZerovsTime_, + "nMinZerovsTime", + ";time;n_{MinZero}", + 0, + 42241, //total number of channels + "Time", + "n_{MinZero}"); + + bookProfile(ibooker, + nMaxSatvsTime_, + "nMaxSatvsTime", + ";time;n_{MaxSat}", + 0, + 42241, //total number of channels + "Time", + "n_{MaxSat}"); + + bookProfile(ibooker, + nLowPbvsTime_, + "nLowPbvsTime", + ";time;n_{lowPb}", + 0, + 42241, //total number of channels + "Time", + "n_{lowPb}"); + + bookProfile(ibooker, + nHighPbvsTime_, + "nHighPbvsTime", + ";time;n_{highPb}", + 0, + 42241, //total number of channels + "Time", + "n_{highPb}"); + + bookProfile(ibooker, + nOutOfSyncvsTime_, + "nOutOfSyncvsTime", + ";time;n_{OOS}", + 0, + 42241, //total number of channels + "Time", + "n_{OOS}"); + + bookProfile(ibooker, + nOtherPbsvsTime_, + "nOtherPbsvsTime", + ";time;n_{OtherPbs}", + 0, + 42241, //total number of channels + "Time", + "n_{OtherPbs}"); + + bookProfile(ibooker, + nApvErrorBitvsTime_, + "nApvErrorBitvsTime", + ";time;n_{APVerror}", + 0, + 42241, //total number of channels + "Time", + "n_{APVerror}"); + + bookProfile(ibooker, + nApvAddressErrorvsTime_, + "nApvAddressErrorvsTime", + ";time;n_{APVAddressError}", + 0, + 42241, //total number of channels + "Time", + "n_{APVAddressError}"); + + bookProfile(ibooker, + nNegativePedsvsTime_, + "nNegativePedsvsTime", + ";time;n_{negPeds}", + 0, + 42241, //total number of channels + "Time", + "n_{negPeds}"); + //book histos - bookProfile(ibooker , meanDigitalLowvsTime_,"meanDigitalLowvsTime", - ";time;meanDigitalLow", - 0, - 800,//maximum for digitalLow - "Time", - "meanDigitalLow"); + bookProfile(ibooker, + meanDigitalLowvsTime_, + "meanDigitalLowvsTime", + ";time;meanDigitalLow", + 0, + 800, //maximum for digitalLow + "Time", + "meanDigitalLow"); } -void SPYHistograms::bookFEDHistograms(DQMStore::IBooker & ibooker , const unsigned int fedId, - const Errors & aErr, - bool doAll) -{ +void SPYHistograms::bookFEDHistograms(DQMStore::IBooker& ibooker, + const unsigned int fedId, + const Errors& aErr, + bool doAll) { if (!histosBooked_[fedId]) { //will do that only once //only if at least one error corresponds to enabled histo.... - if (!doAll && !( - (aErr.hasNoData && noDataDetailed_.enabled) || - (aErr.hasLowRange && lowRangeDetailed_.enabled) || - (aErr.hasHighRange && highRangeDetailed_.enabled) || - (aErr.hasMinZero && minZeroDetailed_.enabled) || - (aErr.hasMaxSat && maxSatDetailed_.enabled) || - (aErr.hasLowPb && lowPbDetailed_.enabled) || - (aErr.hasHighPb && highPbDetailed_.enabled) || - (aErr.hasOOS && outOfSyncDetailed_.enabled) || - (aErr.hasOtherPbs && otherPbsDetailed_.enabled) || - ((aErr.hasErrorBit0 ||aErr.hasErrorBit1) && apvErrorBitDetailed_.enabled) || - ((aErr.hasAPVAddressError0 || aErr.hasAPVAddressError1) && apvAddressErrorDetailed_.enabled) || - (aErr.hasNegPeds && negativePedsDetailed_.enabled) - ) - ) return; - - - - SiStripFedKey fedKey(fedId,0,0,0); + if (!doAll && !((aErr.hasNoData && noDataDetailed_.enabled) || (aErr.hasLowRange && lowRangeDetailed_.enabled) || + (aErr.hasHighRange && highRangeDetailed_.enabled) || + (aErr.hasMinZero && minZeroDetailed_.enabled) || (aErr.hasMaxSat && maxSatDetailed_.enabled) || + (aErr.hasLowPb && lowPbDetailed_.enabled) || (aErr.hasHighPb && highPbDetailed_.enabled) || + (aErr.hasOOS && outOfSyncDetailed_.enabled) || (aErr.hasOtherPbs && otherPbsDetailed_.enabled) || + ((aErr.hasErrorBit0 || aErr.hasErrorBit1) && apvErrorBitDetailed_.enabled) || + ((aErr.hasAPVAddressError0 || aErr.hasAPVAddressError1) && apvAddressErrorDetailed_.enabled) || + (aErr.hasNegPeds && negativePedsDetailed_.enabled))) + return; + + SiStripFedKey fedKey(fedId, 0, 0, 0); std::stringstream fedIdStream; fedIdStream << fedId; ibooker.setCurrentFolder(fedKey.path()); - - - bookHistogram(ibooker , noDataDetailed_, - noDataDetailedMap_[fedId], - "NoDataForFED"+fedIdStream.str(), - "No data for FED ID "+fedIdStream.str(), - sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED, - "Channel Index" - ); - - bookHistogram(ibooker , lowRangeDetailed_, - lowRangeDetailedMap_[fedId], - "LowRangeForFED"+fedIdStream.str(), - "Max-minVAL for FED ID "+fedIdStream.str(), - sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED, - "Channel Index" - ); - - bookHistogram(ibooker , minZeroDetailed_, - minZeroDetailedMap_[fedId], - "MinZeroForFED"+fedIdStream.str(), - "min=0 for FED ID "+fedIdStream.str(), - sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED, - "Channel Index" - ); - - bookHistogram(ibooker , maxSatDetailed_, - maxSatDetailedMap_[fedId], - "MaxSatForFED"+fedIdStream.str(), - "max=1023 for FED ID "+fedIdStream.str(), - sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED, - "Channel Index" - ); - - bookHistogram(ibooker , lowPbDetailed_, - lowPbDetailedMap_[fedId], - "LowPbForFED"+fedIdStream.str(), - "Pb with digitalLow for FED ID "+fedIdStream.str(), - sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED, - "Channel Index" - ); - - bookHistogram(ibooker , highPbDetailed_, - highPbDetailedMap_[fedId], - "HighPbForFED"+fedIdStream.str(), - "Pb with digitalHigh for FED ID "+fedIdStream.str(), - sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED, - "Channel Index" - ); - - bookHistogram(ibooker , outOfSyncDetailed_, - outOfSyncDetailedMap_[fedId], - "OutOfSyncForFED"+fedIdStream.str(), - "Out-of-sync for FED ID "+fedIdStream.str(), - sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED, - "Channel Index" - ); - - bookHistogram(ibooker , otherPbsDetailed_, - otherPbsDetailedMap_[fedId], - "OtherPbsForFED"+fedIdStream.str(), - "Other issues for FED ID "+fedIdStream.str(), - sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED, - "Channel Index" - ); - - bookHistogram(ibooker , apvErrorBitDetailed_, - apvErrorBitDetailedMap_[fedId], - "ApvErrorBitForFED"+fedIdStream.str(), - "APV error for FED ID "+fedIdStream.str(), - 2*sistrip::FEDCH_PER_FED,0,2*sistrip::FEDCH_PER_FED, - "APV Index" - ); - - bookHistogram(ibooker , apvAddressErrorDetailed_, - apvAddressErrorDetailedMap_[fedId], - "ApvAddressErrorForFED"+fedIdStream.str(), - "APV address error for FED ID "+fedIdStream.str(), - 2*sistrip::FEDCH_PER_FED,0,2*sistrip::FEDCH_PER_FED, - "APV Index" - ); - - bookHistogram(ibooker , negativePedsDetailed_, - negativePedsDetailedMap_[fedId], - "NegativePedsForFED"+fedIdStream.str(), - "Negative ped subtr for FED ID "+fedIdStream.str(), - sistrip::FEDCH_PER_FED,0,sistrip::FEDCH_PER_FED, - "Channel Index" - ); - - - - bookHistogram(ibooker , positionOfFirstHeaderBitDetailed_, - positionOfFirstHeaderBitDetailedMap_[fedId], - "PositionOfFirstHeaderBitForFED"+fedIdStream.str(), - "FED ID "+fedIdStream.str(), - 300,0,300, - "first header bit" - ); - - bookHistogram(ibooker , positionOfFirstTrailerBitDetailed_, - positionOfFirstTrailerBitDetailedMap_[fedId], - "PositionOfFirstTrailerBitForFED"+fedIdStream.str(), - "FED ID "+fedIdStream.str(), - 15,285,300, - "first trailer bit" - ); - - bookHistogram(ibooker , distanceHeaderTrailerDetailed_, - distanceHeaderTrailerDetailedMap_[fedId], - "DistanceHeaderTrailerForFED"+fedIdStream.str(), - "FED ID "+fedIdStream.str(), - 300,0,300, - "trailer - header" - ); + bookHistogram(ibooker, + noDataDetailed_, + noDataDetailedMap_[fedId], + "NoDataForFED" + fedIdStream.str(), + "No data for FED ID " + fedIdStream.str(), + sistrip::FEDCH_PER_FED, + 0, + sistrip::FEDCH_PER_FED, + "Channel Index"); + + bookHistogram(ibooker, + lowRangeDetailed_, + lowRangeDetailedMap_[fedId], + "LowRangeForFED" + fedIdStream.str(), + "Max-minVAL for FED ID " + fedIdStream.str(), + sistrip::FEDCH_PER_FED, + 0, + sistrip::FEDCH_PER_FED, + "Channel Index"); + + bookHistogram(ibooker, + minZeroDetailed_, + minZeroDetailedMap_[fedId], + "MinZeroForFED" + fedIdStream.str(), + "min=0 for FED ID " + fedIdStream.str(), + sistrip::FEDCH_PER_FED, + 0, + sistrip::FEDCH_PER_FED, + "Channel Index"); + + bookHistogram(ibooker, + maxSatDetailed_, + maxSatDetailedMap_[fedId], + "MaxSatForFED" + fedIdStream.str(), + "max=1023 for FED ID " + fedIdStream.str(), + sistrip::FEDCH_PER_FED, + 0, + sistrip::FEDCH_PER_FED, + "Channel Index"); + + bookHistogram(ibooker, + lowPbDetailed_, + lowPbDetailedMap_[fedId], + "LowPbForFED" + fedIdStream.str(), + "Pb with digitalLow for FED ID " + fedIdStream.str(), + sistrip::FEDCH_PER_FED, + 0, + sistrip::FEDCH_PER_FED, + "Channel Index"); + + bookHistogram(ibooker, + highPbDetailed_, + highPbDetailedMap_[fedId], + "HighPbForFED" + fedIdStream.str(), + "Pb with digitalHigh for FED ID " + fedIdStream.str(), + sistrip::FEDCH_PER_FED, + 0, + sistrip::FEDCH_PER_FED, + "Channel Index"); + + bookHistogram(ibooker, + outOfSyncDetailed_, + outOfSyncDetailedMap_[fedId], + "OutOfSyncForFED" + fedIdStream.str(), + "Out-of-sync for FED ID " + fedIdStream.str(), + sistrip::FEDCH_PER_FED, + 0, + sistrip::FEDCH_PER_FED, + "Channel Index"); + + bookHistogram(ibooker, + otherPbsDetailed_, + otherPbsDetailedMap_[fedId], + "OtherPbsForFED" + fedIdStream.str(), + "Other issues for FED ID " + fedIdStream.str(), + sistrip::FEDCH_PER_FED, + 0, + sistrip::FEDCH_PER_FED, + "Channel Index"); + + bookHistogram(ibooker, + apvErrorBitDetailed_, + apvErrorBitDetailedMap_[fedId], + "ApvErrorBitForFED" + fedIdStream.str(), + "APV error for FED ID " + fedIdStream.str(), + 2 * sistrip::FEDCH_PER_FED, + 0, + 2 * sistrip::FEDCH_PER_FED, + "APV Index"); + + bookHistogram(ibooker, + apvAddressErrorDetailed_, + apvAddressErrorDetailedMap_[fedId], + "ApvAddressErrorForFED" + fedIdStream.str(), + "APV address error for FED ID " + fedIdStream.str(), + 2 * sistrip::FEDCH_PER_FED, + 0, + 2 * sistrip::FEDCH_PER_FED, + "APV Index"); + + bookHistogram(ibooker, + negativePedsDetailed_, + negativePedsDetailedMap_[fedId], + "NegativePedsForFED" + fedIdStream.str(), + "Negative ped subtr for FED ID " + fedIdStream.str(), + sistrip::FEDCH_PER_FED, + 0, + sistrip::FEDCH_PER_FED, + "Channel Index"); + + bookHistogram(ibooker, + positionOfFirstHeaderBitDetailed_, + positionOfFirstHeaderBitDetailedMap_[fedId], + "PositionOfFirstHeaderBitForFED" + fedIdStream.str(), + "FED ID " + fedIdStream.str(), + 300, + 0, + 300, + "first header bit"); + + bookHistogram(ibooker, + positionOfFirstTrailerBitDetailed_, + positionOfFirstTrailerBitDetailedMap_[fedId], + "PositionOfFirstTrailerBitForFED" + fedIdStream.str(), + "FED ID " + fedIdStream.str(), + 15, + 285, + 300, + "first trailer bit"); + + bookHistogram(ibooker, + distanceHeaderTrailerDetailed_, + distanceHeaderTrailerDetailedMap_[fedId], + "DistanceHeaderTrailerForFED" + fedIdStream.str(), + "FED ID " + fedIdStream.str(), + 300, + 0, + 300, + "trailer - header"); histosBooked_[fedId] = true; - } - - } -void SPYHistograms::bookAllFEDHistograms(DQMStore::IBooker & ibooker) -{ +void SPYHistograms::bookAllFEDHistograms(DQMStore::IBooker& ibooker) { //get FED IDs const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID; const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID; @@ -689,6 +685,6 @@ void SPYHistograms::bookAllFEDHistograms(DQMStore::IBooker & ibooker) for (unsigned int iFed = siStripFedIdMin; iFed <= siStripFedIdMax; iFed++) { //dummy error object Errors lError; - bookFEDHistograms(ibooker , iFed,lError,true); + bookFEDHistograms(ibooker, iFed, lError, true); } } diff --git a/DQM/SiStripMonitorHardware/src/SiStripCMMonitor.cc b/DQM/SiStripMonitorHardware/src/SiStripCMMonitor.cc index b0dbfec32939a..e2afee5e5a8c6 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripCMMonitor.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripCMMonitor.cc @@ -3,7 +3,7 @@ // // Package: DQM/SiStripMonitorHardware // Class: SiStripCMMonitorPlugin -// +// /**\class SiStripCMMonitorPlugin SiStripCMMonitor.cc DQM/SiStripMonitorHardware/plugins/SiStripCMMonitor.cc Description: DQM source application to monitor common mode for SiStrip data @@ -59,14 +59,12 @@ // Class declaration // -class SiStripCMMonitorPlugin : public DQMEDAnalyzer -{ - public: - +class SiStripCMMonitorPlugin : public DQMEDAnalyzer { +public: explicit SiStripCMMonitorPlugin(const edm::ParameterSet&); ~SiStripCMMonitorPlugin() override; - private: +private: struct Statistics { float Mean; float Rms; @@ -74,14 +72,13 @@ class SiStripCMMonitorPlugin : public DQMEDAnalyzer }; void analyze(const edm::Event&, const edm::EventSetup&) override; - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - void dqmBeginRun(const edm::Run& , const edm::EventSetup& ) override; + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override; //update the cabling if necessary void updateCabling(const edm::EventSetup& eventSetup); - - void fillMaps(uint32_t aDetId, unsigned short aChInModule, std::pair aMedians); + void fillMaps(uint32_t aDetId, unsigned short aChInModule, std::pair aMedians); //tag of FEDRawData collection edm::InputTag rawDataTag_; @@ -106,78 +103,73 @@ class SiStripCMMonitorPlugin : public DQMEDAnalyzer CMHistograms cmHists_; - std::map CommonModes_; - std::map CommonModesAPV0minusAPV1_; + std::map CommonModes_; + std::map CommonModesAPV0minusAPV1_; - std::pair prevMedians_[FEDNumbering::MAXSiStripFEDID+1][sistrip::FEDCH_PER_FED]; + std::pair prevMedians_[FEDNumbering::MAXSiStripFEDID + 1][sistrip::FEDCH_PER_FED]; edm::EventNumber_t evt_; - }; - // // Constructors and destructor // SiStripCMMonitorPlugin::SiStripCMMonitorPlugin(const edm::ParameterSet& iConfig) - : rawDataTag_(iConfig.getUntrackedParameter("RawDataTag",edm::InputTag("source",""))), - folderName_(iConfig.getUntrackedParameter("HistogramFolderName","SiStrip/ReadoutView/CMMonitoring")), - fedIdVec_(iConfig.getUntrackedParameter >("FedIdVec")), - fillAllDetailedHistograms_(iConfig.getUntrackedParameter("FillAllDetailedHistograms",false)), - fillWithEvtNum_(iConfig.getUntrackedParameter("FillWithEventNumber",false)), - fillWithLocalEvtNum_(iConfig.getUntrackedParameter("FillWithLocalEventNumber",false)), - printDebug_(iConfig.getUntrackedParameter("PrintDebugMessages",1)), - cablingCacheId_(0) - + : rawDataTag_(iConfig.getUntrackedParameter("RawDataTag", edm::InputTag("source", ""))), + folderName_( + iConfig.getUntrackedParameter("HistogramFolderName", "SiStrip/ReadoutView/CMMonitoring")), + fedIdVec_(iConfig.getUntrackedParameter >("FedIdVec")), + fillAllDetailedHistograms_(iConfig.getUntrackedParameter("FillAllDetailedHistograms", false)), + fillWithEvtNum_(iConfig.getUntrackedParameter("FillWithEventNumber", false)), + fillWithLocalEvtNum_(iConfig.getUntrackedParameter("FillWithLocalEventNumber", false)), + printDebug_(iConfig.getUntrackedParameter("PrintDebugMessages", 1)), + cablingCacheId_(0) + { rawDataToken_ = consumes(rawDataTag_); //print config to debug log std::ostringstream debugStream; - if (printDebug_>1) { + if (printDebug_ > 1) { debugStream << "[SiStripCMMonitorPlugin]Configuration for SiStripCMMonitorPlugin: " << std::endl << "[SiStripCMMonitorPlugin]\tRawDataTag: " << rawDataTag_ << std::endl << "[SiStripCMMonitorPlugin]\tHistogramFolderName: " << folderName_ << std::endl - << "[SiStripCMMonitorPlugin]\tFillAllDetailedHistograms? " << (fillAllDetailedHistograms_ ? "yes" : "no") << std::endl - << "[SiStripCMMonitorPlugin]\tFillWithEventNumber?" << (fillWithEvtNum_ ? "yes" : "no") << std::endl + << "[SiStripCMMonitorPlugin]\tFillAllDetailedHistograms? " + << (fillAllDetailedHistograms_ ? "yes" : "no") << std::endl + << "[SiStripCMMonitorPlugin]\tFillWithEventNumber?" << (fillWithEvtNum_ ? "yes" : "no") << std::endl << "[SiStripCMMonitorPlugin]\tPrintDebugMessages? " << (printDebug_ ? "yes" : "no") << std::endl; } - - std::ostringstream* pDebugStream = (printDebug_>1 ? &debugStream : nullptr); - - cmHists_.initialise(iConfig,pDebugStream); - - doTkHistoMap_ = cmHists_.tkHistoMapEnabled(); - CommonModes_.clear(); - CommonModesAPV0minusAPV1_.clear(); + std::ostringstream* pDebugStream = (printDebug_ > 1 ? &debugStream : nullptr); - for (unsigned int fedId(FEDNumbering::MINSiStripFEDID); fedId <= FEDNumbering::MAXSiStripFEDID; fedId++){ - for (unsigned int iCh(0); iCh(0,0); - } - } + cmHists_.initialise(iConfig, pDebugStream); + doTkHistoMap_ = cmHists_.tkHistoMapEnabled(); - if (printDebug_) - LogTrace("SiStripMonitorHardware") << debugStream.str(); + CommonModes_.clear(); + CommonModesAPV0minusAPV1_.clear(); - evt_ = 0; + for (unsigned int fedId(FEDNumbering::MINSiStripFEDID); fedId <= FEDNumbering::MAXSiStripFEDID; fedId++) { + for (unsigned int iCh(0); iCh < sistrip::FEDCH_PER_FED; iCh++) { + prevMedians_[fedId][iCh] = std::pair(0, 0); + } + } -} + if (printDebug_) + LogTrace("SiStripMonitorHardware") << debugStream.str(); -SiStripCMMonitorPlugin::~SiStripCMMonitorPlugin() -{ + evt_ = 0; } +SiStripCMMonitorPlugin::~SiStripCMMonitorPlugin() {} // // Member functions // - -void SiStripCMMonitorPlugin::bookHistograms(DQMStore::IBooker & ibooker , const edm::Run & run, const edm::EventSetup & eSetup) -{ +void SiStripCMMonitorPlugin::bookHistograms(DQMStore::IBooker& ibooker, + const edm::Run& run, + const edm::EventSetup& eSetup) { ibooker.setCurrentFolder(folderName_); edm::ESHandle tkDetMapHandle; @@ -186,19 +178,14 @@ void SiStripCMMonitorPlugin::bookHistograms(DQMStore::IBooker & ibooker , const cmHists_.bookTopLevelHistograms(ibooker, tkDetMap); - if (fillAllDetailedHistograms_) cmHists_.bookAllFEDHistograms(ibooker); + if (fillAllDetailedHistograms_) + cmHists_.bookAllFEDHistograms(ibooker); } -void SiStripCMMonitorPlugin::dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) -{ - -} +void SiStripCMMonitorPlugin::dqmBeginRun(const edm::Run& r, const edm::EventSetup& c) {} // ------------ method called to for each event ------------ -void -SiStripCMMonitorPlugin::analyze(const edm::Event& iEvent, - const edm::EventSetup& iSetup) -{ +void SiStripCMMonitorPlugin::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //Retrieve tracker topology from geometry edm::ESHandle tTopoHandle; iSetup.get().get(tTopoHandle); @@ -208,23 +195,22 @@ SiStripCMMonitorPlugin::analyze(const edm::Event& iEvent, //static bool isBeingFilled = false; //update cabling updateCabling(iSetup); - + //get raw data edm::Handle rawDataCollectionHandle; - iEvent.getByToken(rawDataToken_,rawDataCollectionHandle); + iEvent.getByToken(rawDataToken_, rawDataCollectionHandle); const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle; - + //FED errors FEDErrors lFedErrors; //loop over siStrip FED IDs - for (unsigned int fedId = FEDNumbering::MINSiStripFEDID; - fedId <= FEDNumbering::MAXSiStripFEDID; - fedId++) {//loop over FED IDs + for (unsigned int fedId = FEDNumbering::MINSiStripFEDID; fedId <= FEDNumbering::MAXSiStripFEDID; + fedId++) { //loop over FED IDs const FEDRawData& fedData = rawDataCollection.FEDData(fedId); //create an object to fill all errors - lFedErrors.initialiseFED(fedId,cabling_,tTopo); + lFedErrors.initialiseFED(fedId, cabling_, tTopo); //Do detailed check //first check if data exists @@ -235,119 +221,113 @@ SiStripCMMonitorPlugin::analyze(const edm::Event& iEvent, std::unique_ptr buffer; - if (!lFedErrors.fillFatalFEDErrors(fedData,0)) { + if (!lFedErrors.fillFatalFEDErrors(fedData, 0)) { continue; - } - else { + } else { //need to construct full object to go any further - buffer.reset(new sistrip::FEDBuffer(fedData.data(),fedData.size(),true)); + buffer.reset(new sistrip::FEDBuffer(fedData.data(), fedData.size(), true)); bool channelLengthsOK = buffer->checkChannelLengthsMatchBufferLength(); bool channelPacketCodesOK = buffer->checkChannelPacketCodes(); bool feLengthsOK = buffer->checkFEUnitLengths(); - if ( !channelLengthsOK || - !channelPacketCodesOK || - !feLengthsOK ) { - continue; + if (!channelLengthsOK || !channelPacketCodesOK || !feLengthsOK) { + continue; } } std::ostringstream infoStream; - if (printDebug_ > 1) { infoStream << " --- Processing FED #" << fedId << std::endl; } - std::vector values; - for (unsigned int iCh = 0; - iCh < sistrip::FEDCH_PER_FED; - iCh++) {//loop on channels + for (unsigned int iCh = 0; iCh < sistrip::FEDCH_PER_FED; iCh++) { //loop on channels - const FedChannelConnection & lConnection = cabling_->fedConnection(fedId,iCh); + const FedChannelConnection& lConnection = cabling_->fedConnection(fedId, iCh); bool connected = lConnection.isConnected(); //std::cout << "FedID " << fedId << ", ch " << iCh << ", nAPVPairs " << lConnection.nApvPairs() << " apvPairNumber " << lConnection.apvPairNumber() << std::endl; if (!connected) { - continue; + continue; } uint32_t lDetId = lConnection.detId(); unsigned short nChInModule = lConnection.nApvPairs(); - if (!lDetId || lDetId == sistrip::invalid32_) continue; + if (!lDetId || lDetId == sistrip::invalid32_) + continue; bool lFailUnpackerChannelCheck = !buffer->channelGood(iCh, true) && connected; if (lFailUnpackerChannelCheck) { - continue; + continue; } - //short lAPVPair = lConnection.apvPairNumber(); //short lSubDet = DetId(lDetId).subdetId(); -// if (firstEvent){ -// infoStream << "Subdet " << lSubDet << ", " ; -// if (lSubDet == 3) { -// -// infoStream << "TIB layer " << tTopo->tibLayer(lDetId) << ", fedID " << fedId << ", channel " << iCh << std::endl; -// } -// else if (lSubDet == 4) { -// -// infoStream << "TID side " << tTopo->tibSide(lDetId) << " wheel " << tTopo->tibWheel(lDetId) << ", ring " << tTopo->tibRing(lDetId) << ", fedID " << fedId << ", channel " << iCh << std::endl; -// } -// else if (lSubDet == 5) { -// -// infoStream << "TOB side " << tTopo->tibRod(lDetId)[0] << " layer " << tTopo->tibLayer(lDetId) << ", rod " << tTopo->tibRodNumber(lDetId) << ", fedID " << fedId << ", channel " << iCh << std::endl; -// } -// else if (lSubDet == 6) { -// -// infoStream << "TEC side " << tTopo->tibSide(lDetId) << " wheel " << tTopo->tibWheel(lDetId) << ", petal " << tTopo->tibPetalNumber(lDetId) << ", ring " << tTopo->tibRing(lDetId) << ", fedID " << fedId << ", channel " << iCh << std::endl; -// } -// isBeingFilled=true; -// } + // if (firstEvent){ + // infoStream << "Subdet " << lSubDet << ", " ; + // if (lSubDet == 3) { + // + // infoStream << "TIB layer " << tTopo->tibLayer(lDetId) << ", fedID " << fedId << ", channel " << iCh << std::endl; + // } + // else if (lSubDet == 4) { + // + // infoStream << "TID side " << tTopo->tibSide(lDetId) << " wheel " << tTopo->tibWheel(lDetId) << ", ring " << tTopo->tibRing(lDetId) << ", fedID " << fedId << ", channel " << iCh << std::endl; + // } + // else if (lSubDet == 5) { + // + // infoStream << "TOB side " << tTopo->tibRod(lDetId)[0] << " layer " << tTopo->tibLayer(lDetId) << ", rod " << tTopo->tibRodNumber(lDetId) << ", fedID " << fedId << ", channel " << iCh << std::endl; + // } + // else if (lSubDet == 6) { + // + // infoStream << "TEC side " << tTopo->tibSide(lDetId) << " wheel " << tTopo->tibWheel(lDetId) << ", petal " << tTopo->tibPetalNumber(lDetId) << ", ring " << tTopo->tibRing(lDetId) << ", fedID " << fedId << ", channel " << iCh << std::endl; + // } + // isBeingFilled=true; + // } std::ostringstream lMode; lMode << buffer->readoutMode(); - if (evt_ == 0 && printDebug_ > 1) - std::cout << "Readout mode: " << lMode.str() << std::endl; - + if (evt_ == 0 && printDebug_ > 1) + std::cout << "Readout mode: " << lMode.str() << std::endl; + + const sistrip::FEDChannel& lChannel = buffer->channel(iCh); + std::pair medians = std::pair(0, 0); - const sistrip::FEDChannel & lChannel = buffer->channel(iCh); - std::pair medians = std::pair(0,0); + if (lMode.str().find("Zero suppressed") != lMode.str().npos && lMode.str().find("lite") == lMode.str().npos) + medians = std::pair(lChannel.cmMedian(0), lChannel.cmMedian(1)); - if (lMode.str().find("Zero suppressed") != lMode.str().npos && lMode.str().find("lite") == lMode.str().npos) medians = std::pair(lChannel.cmMedian(0),lChannel.cmMedian(1)); - CMHistograms::CMvalues lVal; lVal.ChannelID = iCh; - lVal.Medians = std::pair(medians.first,medians.second); + lVal.Medians = std::pair(medians.first, medians.second); lVal.PreviousMedians = prevMedians_[fedId][iCh]; -// if (medians.second-medians.first > 26){ -// std::ostringstream info; -// if (medians.second-medians.first > 44) info << " --- Second bump: event " << iEvent.id().event() << ", FED/Channel " << fedId << "/" << iCh << ", delta=" << medians.second-medians.first << std::endl; -// else info << " --- First bump: event " << iEvent.id().event() << ", FED/Channel " << fedId << "/" << iCh << ", delta=" << medians.second-medians.first << std::endl; -// edm::LogVerbatim("SiStripMonitorHardware") << info.str(); -// } + // if (medians.second-medians.first > 26){ + // std::ostringstream info; + // if (medians.second-medians.first > 44) info << " --- Second bump: event " << iEvent.id().event() << ", FED/Channel " << fedId << "/" << iCh << ", delta=" << medians.second-medians.first << std::endl; + // else info << " --- First bump: event " << iEvent.id().event() << ", FED/Channel " << fedId << "/" << iCh << ", delta=" << medians.second-medians.first << std::endl; + // edm::LogVerbatim("SiStripMonitorHardware") << info.str(); + // } if (printDebug_ > 1) { - if (lChannel.length() > 7) { - infoStream << "Medians for channel #" << iCh << " (length " << lChannel.length() << "): " << medians.first << ", " << medians.second << std::endl; - } + if (lChannel.length() > 7) { + infoStream << "Medians for channel #" << iCh << " (length " << lChannel.length() << "): " << medians.first + << ", " << medians.second << std::endl; + } } values.push_back(lVal); //if (iEvent.id().event() > 1000) - fillMaps(lDetId,nChInModule,medians); + fillMaps(lDetId, nChInModule, medians); + + prevMedians_[fedId][iCh] = std::pair(medians.first, medians.second); + + } //loop on channels - prevMedians_[fedId][iCh] = std::pair(medians.first,medians.second); - - }//loop on channels - float lTime = 0; if (fillWithEvtNum_) { // casting from unsigned long long to a float here @@ -359,25 +339,22 @@ SiStripCMMonitorPlugin::analyze(const edm::Event& iEvent, // doing it explicitely lTime = static_cast(evt_); } else { - lTime = iEvent.orbitNumber()/11223.; + lTime = iEvent.orbitNumber() / 11223.; } } - cmHists_.fillHistograms(values,lTime,fedId); + cmHists_.fillHistograms(values, lTime, fedId); //if (printDebug_ > 0 && isBeingFilled && firstEvent) edm::LogVerbatim("SiStripMonitorHardware") << infoStream.str(); - + } //loop on FEDs - }//loop on FEDs - - - //if (isBeingFilled) + //if (isBeingFilled) //firstEvent = false; evt_++; -}//analyze method +} //analyze method // ------------ method called once each job just after ending the event loop ------------ /* //to be moved to harvesting step @@ -440,8 +417,7 @@ SiStripCMMonitorPlugin::endJob() } */ -void SiStripCMMonitorPlugin::updateCabling(const edm::EventSetup& eventSetup) -{ +void SiStripCMMonitorPlugin::updateCabling(const edm::EventSetup& eventSetup) { uint32_t currentCacheId = eventSetup.get().cacheIdentifier(); if (cablingCacheId_ != currentCacheId) { edm::ESHandle cablingHandle; @@ -451,41 +427,39 @@ void SiStripCMMonitorPlugin::updateCabling(const edm::EventSetup& eventSetup) } } - -void SiStripCMMonitorPlugin::fillMaps(uint32_t aDetId, unsigned short aChInModule, std::pair aMedians) -{ - - if (doTkHistoMap_){//if TkHistMap is enabled - std::pair::iterator,bool> alreadyThere[2]; +void SiStripCMMonitorPlugin::fillMaps(uint32_t aDetId, + unsigned short aChInModule, + std::pair aMedians) { + if (doTkHistoMap_) { //if TkHistMap is enabled + std::pair::iterator, bool> alreadyThere[2]; Statistics lStat; - lStat.Mean = (aMedians.first+aMedians.second)*1./(2*aChInModule); - lStat.Rms = (aMedians.first+aMedians.second)*(aMedians.first+aMedians.second)*1./(4*aChInModule); - lStat.Counter = 1./aChInModule; + lStat.Mean = (aMedians.first + aMedians.second) * 1. / (2 * aChInModule); + lStat.Rms = (aMedians.first + aMedians.second) * (aMedians.first + aMedians.second) * 1. / (4 * aChInModule); + lStat.Counter = 1. / aChInModule; - alreadyThere[0] = CommonModes_.insert(std::pair(aDetId,lStat)); + alreadyThere[0] = CommonModes_.insert(std::pair(aDetId, lStat)); if (!alreadyThere[0].second) { - ((alreadyThere[0].first)->second).Mean += (aMedians.first+aMedians.second)*1./(2*aChInModule); - ((alreadyThere[0].first)->second).Rms += (aMedians.first+aMedians.second)*(aMedians.first+aMedians.second)*1./(4*aChInModule); - ((alreadyThere[0].first)->second).Counter += 1./aChInModule; + ((alreadyThere[0].first)->second).Mean += (aMedians.first + aMedians.second) * 1. / (2 * aChInModule); + ((alreadyThere[0].first)->second).Rms += + (aMedians.first + aMedians.second) * (aMedians.first + aMedians.second) * 1. / (4 * aChInModule); + ((alreadyThere[0].first)->second).Counter += 1. / aChInModule; } - lStat.Mean = (aMedians.first-aMedians.second)*1./aChInModule; - lStat.Rms = (aMedians.first-aMedians.second)*(aMedians.first-aMedians.second)*1./aChInModule; - lStat.Counter = 1./aChInModule; + lStat.Mean = (aMedians.first - aMedians.second) * 1. / aChInModule; + lStat.Rms = (aMedians.first - aMedians.second) * (aMedians.first - aMedians.second) * 1. / aChInModule; + lStat.Counter = 1. / aChInModule; - alreadyThere[1] = CommonModesAPV0minusAPV1_.insert(std::pair(aDetId,lStat)); + alreadyThere[1] = CommonModesAPV0minusAPV1_.insert(std::pair(aDetId, lStat)); if (!alreadyThere[1].second) { - ((alreadyThere[1].first)->second).Mean += (aMedians.first-aMedians.second)*1./aChInModule; - ((alreadyThere[1].first)->second).Rms += (aMedians.first-aMedians.second)*(aMedians.first-aMedians.second)*1./aChInModule; - ((alreadyThere[1].first)->second).Counter += 1./aChInModule; + ((alreadyThere[1].first)->second).Mean += (aMedians.first - aMedians.second) * 1. / aChInModule; + ((alreadyThere[1].first)->second).Rms += + (aMedians.first - aMedians.second) * (aMedians.first - aMedians.second) * 1. / aChInModule; + ((alreadyThere[1].first)->second).Counter += 1. / aChInModule; } - } - } - // // Define as a plug-in // diff --git a/DQM/SiStripMonitorHardware/src/SiStripFEDDataCheck.cc b/DQM/SiStripMonitorHardware/src/SiStripFEDDataCheck.cc index dc522bb4ced0a..ffea2c2242b7d 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripFEDDataCheck.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripFEDDataCheck.cc @@ -2,7 +2,7 @@ // // Package: DQM/SiStripMonitorHardware // Class: SiStripFEDCheckPlugin -// +// /**\class SiStripFEDCheckPlugin SiStripFEDCheck.cc DQM/SiStripMonitorHardware/plugins/SiStripFEDCheck.cc Description: DQM source application to produce data integrety histograms for SiStrip data for use in HLT and Prompt reco @@ -51,36 +51,34 @@ // Class declaration // -class SiStripFEDCheckPlugin : public DQMEDAnalyzer -{ - public: +class SiStripFEDCheckPlugin : public DQMEDAnalyzer { +public: explicit SiStripFEDCheckPlugin(const edm::ParameterSet&); ~SiStripFEDCheckPlugin() override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - private: +private: void analyze(const edm::Event&, const edm::EventSetup&) override; void endRun(edm::Run const&, edm::EventSetup const&) override; - - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; bool hasFatalError(const FEDRawData& fedData, unsigned int fedId) const; bool hasNonFatalError(const FEDRawData& fedData, unsigned int fedId) const; void updateCabling(const edm::EventSetup& eventSetup); - + inline void fillPresent(unsigned int fedId, bool present); inline void fillFatalError(unsigned int fedId, bool fatalError); inline void fillNonFatalError(unsigned int fedId, float nonFatalError); - + void doUpdateIfNeeded(); void updateHistograms(); - - + edm::InputTag rawDataTag_; edm::EDGetTokenT rawDataToken_; std::string dirName_; bool printDebug_; - + //Histograms bool doPLOTfedsPresent_, doPLOTfedFatalErrors_, doPLOTfedNonFatalErrors_; bool doPLOTnFEDinVsLS_, doPLOTnFEDinWdataVsLS_; @@ -90,18 +88,19 @@ class SiStripFEDCheckPlugin : public DQMEDAnalyzer MonitorElement* nFEDinVsLS_; MonitorElement* nFEDinWdataVsLS_; - + //For histogram cache - unsigned int updateFrequency_;//Update histograms with cached values every n events. If zero then fill normally every event + unsigned int + updateFrequency_; //Update histograms with cached values every n events. If zero then fill normally every event //cache values std::vector fedsPresentBinContents_; std::vector fedFatalErrorBinContents_; std::vector fedNonFatalErrorBinContents_; - unsigned int eventCount_;//incremented by doUpdateIfNeeded() - + unsigned int eventCount_; //incremented by doUpdateIfNeeded() + //Fine grained control of tests bool doPayloadChecks_, checkChannelLengths_, checkPacketCodes_, checkFELengths_, checkChannelStatusBits_, verbose_; - + //Cabling uint32_t cablingCacheId_; const SiStripFedCabling* cabling_; @@ -112,68 +111,66 @@ class SiStripFEDCheckPlugin : public DQMEDAnalyzer edm::ParameterSet conf_; }; - // // Constructors and destructor // SiStripFEDCheckPlugin::SiStripFEDCheckPlugin(const edm::ParameterSet& iConfig) - : rawDataTag_ (iConfig.getParameter("RawDataTag")) - , dirName_ (iConfig.getUntrackedParameter("DirName","SiStrip/FEDIntegrity/")) - , printDebug_ (iConfig.getUntrackedParameter("PrintDebugMessages",false)) - , doPLOTfedsPresent_ (iConfig.getParameter("doPLOTfedsPresent") ) - , doPLOTfedFatalErrors_ (iConfig.getParameter("doPLOTfedFatalErrors") ) - , doPLOTfedNonFatalErrors_ (iConfig.getParameter("doPLOTfedNonFatalErrors")) - , doPLOTnFEDinVsLS_ (iConfig.getParameter("doPLOTnFEDinVsLS") ) - , doPLOTnFEDinWdataVsLS_ (iConfig.getParameter("doPLOTnFEDinWdataVsLS") ) - , fedsPresent_ (nullptr) - , fedFatalErrors_ (nullptr) - , fedNonFatalErrors_(nullptr) - , nFEDinVsLS_ (nullptr) - , nFEDinWdataVsLS_ (nullptr) - , updateFrequency_(iConfig.getUntrackedParameter("HistogramUpdateFrequency",0)) - , fedsPresentBinContents_ (FEDNumbering::MAXSiStripFEDID+1,0) - , fedFatalErrorBinContents_ (FEDNumbering::MAXSiStripFEDID+1,0) - , fedNonFatalErrorBinContents_(FEDNumbering::MAXSiStripFEDID+1,0) - , eventCount_(0) - , doPayloadChecks_ (iConfig.getUntrackedParameter("DoPayloadChecks", true)) - , checkChannelLengths_ (iConfig.getUntrackedParameter("CheckChannelLengths", true)) - , checkPacketCodes_ (iConfig.getUntrackedParameter("CheckChannelPacketCodes",true)) - , checkFELengths_ (iConfig.getUntrackedParameter("CheckFELengths", true)) - , checkChannelStatusBits_(iConfig.getUntrackedParameter("CheckChannelStatus", true)) - , verbose_ (iConfig.getUntrackedParameter("verbose", false)) - , cablingCacheId_(0) -{ + : rawDataTag_(iConfig.getParameter("RawDataTag")), + dirName_(iConfig.getUntrackedParameter("DirName", "SiStrip/FEDIntegrity/")), + printDebug_(iConfig.getUntrackedParameter("PrintDebugMessages", false)), + doPLOTfedsPresent_(iConfig.getParameter("doPLOTfedsPresent")), + doPLOTfedFatalErrors_(iConfig.getParameter("doPLOTfedFatalErrors")), + doPLOTfedNonFatalErrors_(iConfig.getParameter("doPLOTfedNonFatalErrors")), + doPLOTnFEDinVsLS_(iConfig.getParameter("doPLOTnFEDinVsLS")), + doPLOTnFEDinWdataVsLS_(iConfig.getParameter("doPLOTnFEDinWdataVsLS")), + fedsPresent_(nullptr), + fedFatalErrors_(nullptr), + fedNonFatalErrors_(nullptr), + nFEDinVsLS_(nullptr), + nFEDinWdataVsLS_(nullptr), + updateFrequency_(iConfig.getUntrackedParameter("HistogramUpdateFrequency", 0)), + fedsPresentBinContents_(FEDNumbering::MAXSiStripFEDID + 1, 0), + fedFatalErrorBinContents_(FEDNumbering::MAXSiStripFEDID + 1, 0), + fedNonFatalErrorBinContents_(FEDNumbering::MAXSiStripFEDID + 1, 0), + eventCount_(0), + doPayloadChecks_(iConfig.getUntrackedParameter("DoPayloadChecks", true)), + checkChannelLengths_(iConfig.getUntrackedParameter("CheckChannelLengths", true)), + checkPacketCodes_(iConfig.getUntrackedParameter("CheckChannelPacketCodes", true)), + checkFELengths_(iConfig.getUntrackedParameter("CheckFELengths", true)), + checkChannelStatusBits_(iConfig.getUntrackedParameter("CheckChannelStatus", true)), + verbose_(iConfig.getUntrackedParameter("verbose", false)), + cablingCacheId_(0) { rawDataToken_ = consumes(rawDataTag_); if (printDebug_ && !doPayloadChecks_ && (checkChannelLengths_ || checkPacketCodes_ || checkFELengths_)) { std::stringstream ss; - ss << "Payload checks are disabled but individual payload checks have been enabled. The following payload checks will be skipped: "; - if (checkChannelLengths_) ss << "Channel length check, "; - if (checkPacketCodes_) ss << "Channel packet code check, "; - if (checkChannelStatusBits_) ss << "Cabled channel status bits checks, "; - if (checkFELengths_) ss << "FE Unit legnth check"; + ss << "Payload checks are disabled but individual payload checks have been enabled. The following payload checks " + "will be skipped: "; + if (checkChannelLengths_) + ss << "Channel length check, "; + if (checkPacketCodes_) + ss << "Channel packet code check, "; + if (checkChannelStatusBits_) + ss << "Cabled channel status bits checks, "; + if (checkFELengths_) + ss << "FE Unit legnth check"; edm::LogWarning("SiStripFEDCheck") << ss.str(); } siStripFedIdMin_ = FEDNumbering::MINSiStripFEDID; siStripFedIdMax_ = FEDNumbering::MAXSiStripFEDID; - - conf_ = iConfig; -} -SiStripFEDCheckPlugin::~SiStripFEDCheckPlugin() -{ + conf_ = iConfig; } +SiStripFEDCheckPlugin::~SiStripFEDCheckPlugin() {} // // Member functions // // ------------ method called to for each event ------------ -void -SiStripFEDCheckPlugin::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) -{ +void SiStripFEDCheckPlugin::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //Retrieve tracker topology from geometry edm::ESHandle tTopoHandle; iSetup.get().get(tTopoHandle); @@ -181,17 +178,18 @@ SiStripFEDCheckPlugin::analyze(const edm::Event& iEvent, const edm::EventSetup& //update cabling updateCabling(iSetup); - + //get raw data edm::Handle rawDataCollectionHandle; - const bool gotData = iEvent.getByToken(rawDataToken_,rawDataCollectionHandle); - if (verbose_) std::cout << "[SiStripFEDCheckPlugin::analyze] gotData ? " << (gotData ? "YES" : "NOPE") << std::endl; + const bool gotData = iEvent.getByToken(rawDataToken_, rawDataCollectionHandle); + if (verbose_) + std::cout << "[SiStripFEDCheckPlugin::analyze] gotData ? " << (gotData ? "YES" : "NOPE") << std::endl; if (!gotData) { //module is required to silently do nothing when data is not present return; } const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle; - + //FED errors FEDErrors lFedErrors; @@ -203,21 +201,26 @@ SiStripFEDCheckPlugin::analyze(const edm::Event& iEvent, const edm::EventSetup& //create an object to fill all errors //third param to false:save time by not initialising anything not used here - lFedErrors.initialiseFED(fedId,cabling_,tTopo,false); + lFedErrors.initialiseFED(fedId, cabling_, tTopo, false); //check data exists if (!fedData.size() || !fedData.data()) { - fillPresent(fedId,false); + fillPresent(fedId, false); continue; } - if (verbose_) std::cout << "FED " << fedId; - if (verbose_) std::cout << " fedData.size(): " << fedData.size(); - if (verbose_) std::cout << " fedData.data(): " << fedData.data() << std::endl; - if (fedData.size()) nFEDin++; - if (fedData.size() && fedData.data()) nFEDinWdata++; + if (verbose_) + std::cout << "FED " << fedId; + if (verbose_) + std::cout << " fedData.size(): " << fedData.size(); + if (verbose_) + std::cout << " fedData.data(): " << fedData.data() << std::endl; + if (fedData.size()) + nFEDin++; + if (fedData.size() && fedData.data()) + nFEDinWdata++; //fill buffer present histogram - fillPresent(fedId,true); + fillPresent(fedId, true); //check for fatal errors //no need for debug output @@ -226,127 +229,114 @@ SiStripFEDCheckPlugin::analyze(const edm::Event& iEvent, const edm::EventSetup& std::unique_ptr buffer; - if (!lFedErrors.fillFatalFEDErrors(fedData,0)) { + if (!lFedErrors.fillFatalFEDErrors(fedData, 0)) { hasFatalErrors = true; - } - else { + } else { //need to construct full object to go any further if (doPayloadChecks_ || checkChannelStatusBits_) { - - buffer.reset(new sistrip::FEDBuffer(fedData.data(),fedData.size(),true)); - if (doPayloadChecks_) { - - bool channelLengthsOK = checkChannelLengths_ ? buffer->checkChannelLengthsMatchBufferLength() : true; - bool channelPacketCodesOK = checkPacketCodes_ ? buffer->checkChannelPacketCodes() : true; - bool feLengthsOK = checkFELengths_ ? buffer->checkFEUnitLengths() : true; - if ( !channelLengthsOK || - !channelPacketCodesOK || - !feLengthsOK ) { - hasFatalErrors = true; - } - } - if (checkChannelStatusBits_) rateNonFatal = lFedErrors.fillNonFatalFEDErrors(buffer.get(),cabling_); + buffer.reset(new sistrip::FEDBuffer(fedData.data(), fedData.size(), true)); + if (doPayloadChecks_) { + bool channelLengthsOK = checkChannelLengths_ ? buffer->checkChannelLengthsMatchBufferLength() : true; + bool channelPacketCodesOK = checkPacketCodes_ ? buffer->checkChannelPacketCodes() : true; + bool feLengthsOK = checkFELengths_ ? buffer->checkFEUnitLengths() : true; + if (!channelLengthsOK || !channelPacketCodesOK || !feLengthsOK) { + hasFatalErrors = true; + } + } + if (checkChannelStatusBits_) + rateNonFatal = lFedErrors.fillNonFatalFEDErrors(buffer.get(), cabling_); } } if (hasFatalErrors) { - fillFatalError(fedId,true); + fillFatalError(fedId, true); if (printDebug_) { - if (!buffer.get()) buffer.reset(new sistrip::FEDBuffer(fedData.data(),fedData.size(),true)); - edm::LogInfo("SiStripFEDCheck") << "Fatal error with FED ID " << fedId << ". Check summary: " - << std::endl << buffer->checkSummary() << std::endl; - std::stringstream ss; - buffer->dump(ss); - edm::LogInfo("SiStripFEDCheck") << ss.str(); + if (!buffer.get()) + buffer.reset(new sistrip::FEDBuffer(fedData.data(), fedData.size(), true)); + edm::LogInfo("SiStripFEDCheck") << "Fatal error with FED ID " << fedId << ". Check summary: " << std::endl + << buffer->checkSummary() << std::endl; + std::stringstream ss; + buffer->dump(ss); + edm::LogInfo("SiStripFEDCheck") << ss.str(); } - } - else { - fillFatalError(fedId,false); + } else { + fillFatalError(fedId, false); //fill non-fatal errors histogram if there were no fatal errors - fillNonFatalError(fedId,rateNonFatal); + fillNonFatalError(fedId, rateNonFatal); if (printDebug_ && rateNonFatal > 0) { - if (!buffer.get()) buffer.reset(new sistrip::FEDBuffer(fedData.data(),fedData.size(),true)); - edm::LogInfo("SiStripFEDCheck") << "Non-fatal error with FED ID " << fedId - << " for " << rateNonFatal << " of the channels. Check summary: " - << std::endl << buffer->checkSummary() << std::endl; - std::stringstream ss; - buffer->dump(ss); - edm::LogInfo("SiStripFEDCheck") << ss.str(); + if (!buffer.get()) + buffer.reset(new sistrip::FEDBuffer(fedData.data(), fedData.size(), true)); + edm::LogInfo("SiStripFEDCheck") << "Non-fatal error with FED ID " << fedId << " for " << rateNonFatal + << " of the channels. Check summary: " << std::endl + << buffer->checkSummary() << std::endl; + std::stringstream ss; + buffer->dump(ss); + edm::LogInfo("SiStripFEDCheck") << ss.str(); } - } - }//loop over FED IDs - if (verbose_) std::cout << "nFEDin: " << nFEDin << " nFEDinWdata: " << nFEDinWdata << std::endl; - if (doPLOTnFEDinVsLS_) nFEDinVsLS_ -> Fill(static_cast(iEvent.id().luminosityBlock()),nFEDin); - if (doPLOTnFEDinWdataVsLS_) nFEDinWdataVsLS_ -> Fill(static_cast(iEvent.id().luminosityBlock()),nFEDinWdata); - + } //loop over FED IDs + if (verbose_) + std::cout << "nFEDin: " << nFEDin << " nFEDinWdata: " << nFEDinWdata << std::endl; + if (doPLOTnFEDinVsLS_) + nFEDinVsLS_->Fill(static_cast(iEvent.id().luminosityBlock()), nFEDin); + if (doPLOTnFEDinWdataVsLS_) + nFEDinWdataVsLS_->Fill(static_cast(iEvent.id().luminosityBlock()), nFEDinWdata); + //update histograms if needed doUpdateIfNeeded(); } // ------------ method called once each job just before starting event loop ------------ -void SiStripFEDCheckPlugin::bookHistograms(DQMStore::IBooker & ibooker , const edm::Run & run, const edm::EventSetup & eSetup) -{ - size_t nFED = siStripFedIdMax_-siStripFedIdMin_+1; - double xFEDmin = siStripFedIdMin_-0.5; - double xFEDmax = siStripFedIdMax_+0.5; +void SiStripFEDCheckPlugin::bookHistograms(DQMStore::IBooker& ibooker, + const edm::Run& run, + const edm::EventSetup& eSetup) { + size_t nFED = siStripFedIdMax_ - siStripFedIdMin_ + 1; + double xFEDmin = siStripFedIdMin_ - 0.5; + double xFEDmax = siStripFedIdMax_ + 0.5; //get DQM store ibooker.setCurrentFolder(dirName_); //book histograms if (doPLOTfedsPresent_) { - fedsPresent_ = ibooker.book1D("FEDEntries", - "Number of times FED buffer is present in data", - nFED, xFEDmin, xFEDmax); - fedsPresent_->setAxisTitle("FED-ID",1); + fedsPresent_ = + ibooker.book1D("FEDEntries", "Number of times FED buffer is present in data", nFED, xFEDmin, xFEDmax); + fedsPresent_->setAxisTitle("FED-ID", 1); } if (doPLOTfedFatalErrors_) { - fedFatalErrors_ = ibooker.book1D("FEDFatal", - "Number of fatal errors in FED buffer", - nFED, xFEDmin, xFEDmax); - fedFatalErrors_->setAxisTitle("FED-ID",1); + fedFatalErrors_ = ibooker.book1D("FEDFatal", "Number of fatal errors in FED buffer", nFED, xFEDmin, xFEDmax); + fedFatalErrors_->setAxisTitle("FED-ID", 1); } if (doPLOTfedNonFatalErrors_) { - fedNonFatalErrors_ = ibooker.book1D("FEDNonFatal", - "Number of non fatal errors in FED buffer", - nFED, xFEDmin, xFEDmax); - fedNonFatalErrors_->setAxisTitle("FED-ID",1); + fedNonFatalErrors_ = + ibooker.book1D("FEDNonFatal", "Number of non fatal errors in FED buffer", nFED, xFEDmin, xFEDmax); + fedNonFatalErrors_->setAxisTitle("FED-ID", 1); } - int LSBin = conf_.getParameter ("LSBin"); + int LSBin = conf_.getParameter("LSBin"); double LSMin = conf_.getParameter("LSMin"); double LSMax = conf_.getParameter("LSMax"); - + if (doPLOTnFEDinVsLS_) { - nFEDinVsLS_ = ibooker.bookProfile("nFEDinVsLS", - "number of FED in Vs LS", - LSBin, LSMin, LSMax, - nFED, xFEDmin, xFEDmax); - nFEDinVsLS_->setAxisTitle("LS",1); - nFEDinVsLS_->setAxisTitle("FED-ID",2); + nFEDinVsLS_ = + ibooker.bookProfile("nFEDinVsLS", "number of FED in Vs LS", LSBin, LSMin, LSMax, nFED, xFEDmin, xFEDmax); + nFEDinVsLS_->setAxisTitle("LS", 1); + nFEDinVsLS_->setAxisTitle("FED-ID", 2); } if (doPLOTnFEDinWdataVsLS_) { - nFEDinWdataVsLS_ = ibooker.bookProfile("nFEDinWdataVsLS", - "number of FED in (with data) Vs LS", - LSBin, LSMin, LSMax, - nFED, xFEDmin, xFEDmax); - nFEDinWdataVsLS_->setAxisTitle("LS",1); - nFEDinWdataVsLS_->setAxisTitle("FED-ID",2); + nFEDinWdataVsLS_ = ibooker.bookProfile( + "nFEDinWdataVsLS", "number of FED in (with data) Vs LS", LSBin, LSMin, LSMax, nFED, xFEDmin, xFEDmax); + nFEDinWdataVsLS_->setAxisTitle("LS", 1); + nFEDinWdataVsLS_->setAxisTitle("FED-ID", 2); } } // ------------ method called once each run just after ending the event loop ------------ -void -SiStripFEDCheckPlugin::endRun(edm::Run const&, edm::EventSetup const&) -{ - updateHistograms(); -} +void SiStripFEDCheckPlugin::endRun(edm::Run const&, edm::EventSetup const&) { updateHistograms(); } -void SiStripFEDCheckPlugin::updateCabling(const edm::EventSetup& eventSetup) -{ +void SiStripFEDCheckPlugin::updateCabling(const edm::EventSetup& eventSetup) { uint32_t currentCacheId = eventSetup.get().cacheIdentifier(); if (cablingCacheId_ != currentCacheId) { edm::ESHandle cablingHandle; @@ -356,108 +346,110 @@ void SiStripFEDCheckPlugin::updateCabling(const edm::EventSetup& eventSetup) } } -void SiStripFEDCheckPlugin::fillPresent(unsigned int fedId, bool present) -{ +void SiStripFEDCheckPlugin::fillPresent(unsigned int fedId, bool present) { if (present) { - if (updateFrequency_) fedsPresentBinContents_[fedId]++; - else - if (doPLOTfedsPresent_) fedsPresent_->Fill(fedId); + if (updateFrequency_) + fedsPresentBinContents_[fedId]++; + else if (doPLOTfedsPresent_) + fedsPresent_->Fill(fedId); } } -void SiStripFEDCheckPlugin::fillFatalError(unsigned int fedId, bool fatalError) -{ +void SiStripFEDCheckPlugin::fillFatalError(unsigned int fedId, bool fatalError) { if (updateFrequency_) { - if (fatalError) fedFatalErrorBinContents_[fedId]++; + if (fatalError) + fedFatalErrorBinContents_[fedId]++; } else { //fedFatalErrors_->Fill( fatalError ? 1 : 0 ); - if (fatalError) - if (doPLOTfedFatalErrors_) fedFatalErrors_->Fill(fedId); + if (fatalError) + if (doPLOTfedFatalErrors_) + fedFatalErrors_->Fill(fedId); } } -void SiStripFEDCheckPlugin::fillNonFatalError(unsigned int fedId, float nonFatalError) -{ +void SiStripFEDCheckPlugin::fillNonFatalError(unsigned int fedId, float nonFatalError) { if (updateFrequency_) { - if (nonFatalError>0) fedNonFatalErrorBinContents_[fedId]++;//nonFatalError; + if (nonFatalError > 0) + fedNonFatalErrorBinContents_[fedId]++; //nonFatalError; } else { - if (nonFatalError>0) - if (doPLOTfedNonFatalErrors_) fedNonFatalErrors_->Fill(fedId); + if (nonFatalError > 0) + if (doPLOTfedNonFatalErrors_) + fedNonFatalErrors_->Fill(fedId); } } -void SiStripFEDCheckPlugin::doUpdateIfNeeded() -{ +void SiStripFEDCheckPlugin::doUpdateIfNeeded() { eventCount_++; - if (updateFrequency_ && (eventCount_%updateFrequency_ == 0)) { + if (updateFrequency_ && (eventCount_ % updateFrequency_ == 0)) { updateHistograms(); } } -void SiStripFEDCheckPlugin::updateHistograms() -{ +void SiStripFEDCheckPlugin::updateHistograms() { //if the cache is not being used then do nothing - if (!updateFrequency_) return; + if (!updateFrequency_) + return; unsigned int entriesFedsPresent = 0; unsigned int entriesFatalErrors = 0; unsigned int entriesNonFatalErrors = 0; - for (unsigned int fedId = siStripFedIdMin_, bin = 1; fedId < siStripFedIdMax_+1; fedId++, bin++) { + for (unsigned int fedId = siStripFedIdMin_, bin = 1; fedId < siStripFedIdMax_ + 1; fedId++, bin++) { unsigned int fedsPresentBin = fedsPresentBinContents_[fedId]; - if (doPLOTfedsPresent_) fedsPresent_->getTH1()->SetBinContent(bin,fedsPresentBin); + if (doPLOTfedsPresent_) + fedsPresent_->getTH1()->SetBinContent(bin, fedsPresentBin); entriesFedsPresent += fedsPresentBin; unsigned int fedFatalErrorsBin = fedFatalErrorBinContents_[fedId]; - if (doPLOTfedFatalErrors_) fedFatalErrors_->getTH1()->SetBinContent(bin,fedFatalErrorsBin); + if (doPLOTfedFatalErrors_) + fedFatalErrors_->getTH1()->SetBinContent(bin, fedFatalErrorsBin); entriesFatalErrors += fedFatalErrorsBin; unsigned int fedNonFatalErrorsBin = fedNonFatalErrorBinContents_[fedId]; - if (doPLOTfedNonFatalErrors_) fedNonFatalErrors_->getTH1()->SetBinContent(bin,fedNonFatalErrorsBin); + if (doPLOTfedNonFatalErrors_) + fedNonFatalErrors_->getTH1()->SetBinContent(bin, fedNonFatalErrorsBin); entriesNonFatalErrors += fedNonFatalErrorsBin; } - if (doPLOTfedsPresent_) fedsPresent_->getTH1()->SetEntries(entriesFedsPresent); - if (doPLOTfedFatalErrors_) fedFatalErrors_->getTH1()->SetEntries(entriesFatalErrors); - if (doPLOTfedNonFatalErrors_) fedNonFatalErrors_->getTH1()->SetEntries(entriesNonFatalErrors); + if (doPLOTfedsPresent_) + fedsPresent_->getTH1()->SetEntries(entriesFedsPresent); + if (doPLOTfedFatalErrors_) + fedFatalErrors_->getTH1()->SetEntries(entriesFatalErrors); + if (doPLOTfedNonFatalErrors_) + fedNonFatalErrors_->getTH1()->SetEntries(entriesNonFatalErrors); } -void -SiStripFEDCheckPlugin::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - +void SiStripFEDCheckPlugin::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; // Directory to book histograms in - desc.addUntracked("DirName","SiStrip/FEDIntegrity/"); + desc.addUntracked("DirName", "SiStrip/FEDIntegrity/"); // Raw data collection - desc.add("RawDataTag",edm::InputTag("source")); + desc.add("RawDataTag", edm::InputTag("source")); // Number of events to cache info before updating histograms // (set to zero to disable cache) // HistogramUpdateFrequency = cms.untracked.uint32(0), - desc.addUntracked("HistogramUpdateFrequency",1000); + desc.addUntracked("HistogramUpdateFrequency", 1000); // Print info about errors buffer dumps to LogInfo(SiStripFEDCheck) - desc.addUntracked("PrintDebugMessages",false); - desc.add("doPLOTfedsPresent", true); - desc.add("doPLOTfedFatalErrors", true); - desc.add("doPLOTfedNonFatalErrors",true); - desc.add("doPLOTnFEDinVsLS", false); - desc.add("doPLOTnFEDinWdataVsLS", false); + desc.addUntracked("PrintDebugMessages", false); + desc.add("doPLOTfedsPresent", true); + desc.add("doPLOTfedFatalErrors", true); + desc.add("doPLOTfedNonFatalErrors", true); + desc.add("doPLOTnFEDinVsLS", false); + desc.add("doPLOTnFEDinWdataVsLS", false); // Write the DQM store to a file (DQMStore.root) at the end of the run - desc.addUntracked("WriteDQMStore",false); + desc.addUntracked("WriteDQMStore", false); // Use to disable all payload (non-fatal) checks - desc.addUntracked("DoPayloadChecks",true); + desc.addUntracked("DoPayloadChecks", true); // Use to disable check on channel lengths - desc.addUntracked("CheckChannelLengths",true); + desc.addUntracked("CheckChannelLengths", true); // Use to disable check on channel packet codes - desc.addUntracked("CheckChannelPacketCodes",true); + desc.addUntracked("CheckChannelPacketCodes", true); // Use to disable check on FE unit lengths in full debug header - desc.addUntracked("CheckFELengths",true); + desc.addUntracked("CheckFELengths", true); // Use to disable check on channel status bits - desc.addUntracked("CheckChannelStatus",true); - desc.add ("LSBin",5000); - desc.add ("LSMin", 0.5); - desc.add ("LSMax",5000.5); + desc.addUntracked("CheckChannelStatus", true); + desc.add("LSBin", 5000); + desc.add("LSMin", 0.5); + desc.add("LSMax", 5000.5); descriptions.addDefault(desc); - - } - // // Define as a plug-in // diff --git a/DQM/SiStripMonitorHardware/src/SiStripFEDDump.cc b/DQM/SiStripMonitorHardware/src/SiStripFEDDump.cc index 917bd4d13c5db..83a1e91a3489c 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripFEDDump.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripFEDDump.cc @@ -20,14 +20,14 @@ // Class declaration // -class SiStripFEDDumpPlugin : public DQMEDAnalyzer -{ - public: +class SiStripFEDDumpPlugin : public DQMEDAnalyzer { +public: explicit SiStripFEDDumpPlugin(const edm::ParameterSet&); ~SiStripFEDDumpPlugin() override; - private: + +private: void analyze(const edm::Event&, const edm::EventSetup&) override; - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; //tag of FEDRawData collection edm::InputTag rawDataTag_; @@ -36,50 +36,44 @@ class SiStripFEDDumpPlugin : public DQMEDAnalyzer unsigned int fedIdToDump_; }; - // // Constructors and destructor // SiStripFEDDumpPlugin::SiStripFEDDumpPlugin(const edm::ParameterSet& iConfig) - : rawDataTag_(iConfig.getUntrackedParameter("RawDataTag",edm::InputTag("source",""))), - fedIdToDump_(iConfig.getUntrackedParameter("FEDID",50)) -{ + : rawDataTag_(iConfig.getUntrackedParameter("RawDataTag", edm::InputTag("source", ""))), + fedIdToDump_(iConfig.getUntrackedParameter("FEDID", 50)) { rawDataToken_ = consumes(rawDataTag_); - if ( (fedIdToDump_ > FEDNumbering::MAXSiStripFEDID) || (fedIdToDump_ < FEDNumbering::MINSiStripFEDID) ) + if ((fedIdToDump_ > FEDNumbering::MAXSiStripFEDID) || (fedIdToDump_ < FEDNumbering::MINSiStripFEDID)) edm::LogError("SiStripFEDDump") << "FED ID " << fedIdToDump_ << " is not valid. " - << "SiStrip FED IDs are " << uint16_t(FEDNumbering::MINSiStripFEDID) << "-" << uint16_t(FEDNumbering::MAXSiStripFEDID); -} - -SiStripFEDDumpPlugin::~SiStripFEDDumpPlugin() -{ + << "SiStrip FED IDs are " << uint16_t(FEDNumbering::MINSiStripFEDID) << "-" + << uint16_t(FEDNumbering::MAXSiStripFEDID); } +SiStripFEDDumpPlugin::~SiStripFEDDumpPlugin() {} // // Member functions // // ------------ method called to for each event ------------ -void -SiStripFEDDumpPlugin::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) -{ +void SiStripFEDDumpPlugin::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //get raw data edm::Handle rawDataCollectionHandle; - iEvent.getByToken(rawDataToken_,rawDataCollectionHandle); + iEvent.getByToken(rawDataToken_, rawDataCollectionHandle); const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle; - + const FEDRawData& rawData = rawDataCollection.FEDData(fedIdToDump_); - const sistrip::FEDBufferBase buffer(rawData.data(),rawData.size(),true); + const sistrip::FEDBufferBase buffer(rawData.data(), rawData.size(), true); std::ostringstream os; os << buffer << std::endl; buffer.dump(os); edm::LogVerbatim("SiStripFEDDump") << os.str(); } -void SiStripFEDDumpPlugin::bookHistograms(DQMStore::IBooker & ibooker , const edm::Run & run, const edm::EventSetup & eSetup) -{ -} +void SiStripFEDDumpPlugin::bookHistograms(DQMStore::IBooker& ibooker, + const edm::Run& run, + const edm::EventSetup& eSetup) {} // // Define as a plug-in diff --git a/DQM/SiStripMonitorHardware/src/SiStripFEDEmulator.cc b/DQM/SiStripMonitorHardware/src/SiStripFEDEmulator.cc index 7631d6c4107bd..4967ccdfd1ce6 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripFEDEmulator.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripFEDEmulator.cc @@ -8,11 +8,10 @@ using edm::LogError; using edm::LogInfo; using edm::LogWarning; -namespace sistrip{ +namespace sistrip { const char* FEDEmulator::messageLabel_ = "SiStripFEDEmulator"; - FEDEmulator::FEDEmulator() { byModule_ = false; minStrip_ = 0; @@ -24,269 +23,248 @@ namespace sistrip{ detId_ = 0; nPairs_ = 0; pair_ = 0; - } + FEDEmulator::~FEDEmulator() {} - - FEDEmulator::~FEDEmulator() { - - } - - void FEDEmulator::initialise(const bool byModule) - { + void FEDEmulator::initialise(const bool byModule) { byModule_ = byModule; pedestals_.clear(); noises_.clear(); medians_.clear(); } - void FEDEmulator::initialiseModule(const uint32_t aDetId, - const uint32_t aNPairs, - const uint32_t aPair) - { + void FEDEmulator::initialiseModule(const uint32_t aDetId, const uint32_t aNPairs, const uint32_t aPair) { detId_ = aDetId; nPairs_ = aNPairs; pair_ = aPair; minStrip_ = 0; - maxStrip_ = nPairs_*sistrip::STRIPS_PER_FEDCH; + maxStrip_ = nPairs_ * sistrip::STRIPS_PER_FEDCH; if (!byModule_) { - minStrip_ = sistrip::STRIPS_PER_FEDCH*pair_; - maxStrip_ = sistrip::STRIPS_PER_FEDCH*(pair_+1); + minStrip_ = sistrip::STRIPS_PER_FEDCH * pair_; + maxStrip_ = sistrip::STRIPS_PER_FEDCH * (pair_ + 1); } //need resize because it will not be filled by push_back... pedestals_.clear(); - pedestals_.resize(nPairs_*sistrip::STRIPS_PER_FEDCH); + pedestals_.resize(nPairs_ * sistrip::STRIPS_PER_FEDCH); noises_.clear(); - noises_.resize(nPairs_*sistrip::STRIPS_PER_FEDCH); + noises_.resize(nPairs_ * sistrip::STRIPS_PER_FEDCH); medians_.clear(); - medians_.reserve(nPairs_*2); - + medians_.reserve(nPairs_ * 2); } - void FEDEmulator::retrievePedestals(const edm::ESHandle & aHandle){ + void FEDEmulator::retrievePedestals(const edm::ESHandle& aHandle) { try { SiStripPedestals::Range pedestalsRange = aHandle->getRange(detId_); - aHandle->allPeds(pedestals_,pedestalsRange); - } - catch(const cms::Exception& e) { - LogError(messageLabel_) << " Something wrong whilst getting pedestals: size = " - << pedestals_.size() << " detId = " - << detId_ << std::endl << e.what(); + aHandle->allPeds(pedestals_, pedestalsRange); + } catch (const cms::Exception& e) { + LogError(messageLabel_) << " Something wrong whilst getting pedestals: size = " << pedestals_.size() + << " detId = " << detId_ << std::endl + << e.what(); //throw cms::Exception("ProductNotFound") << "Problem with pedestals..." ; } - }//end of retrievePedestals method. + } //end of retrievePedestals method. - void FEDEmulator::retrieveNoises(const edm::ESHandle & aHandle){ + void FEDEmulator::retrieveNoises(const edm::ESHandle& aHandle) { try { SiStripNoises::Range noisesRange = aHandle->getRange(detId_); - aHandle->allNoises(noises_,noisesRange); - } - catch(const cms::Exception& e) { - LogError(messageLabel_) << " Something wrong whilst getting noises: size = " - << noises_.size() << " detId = " - << detId_ << std::endl << e.what(); + aHandle->allNoises(noises_, noisesRange); + } catch (const cms::Exception& e) { + LogError(messageLabel_) << " Something wrong whilst getting noises: size = " << noises_.size() + << " detId = " << detId_ << std::endl + << e.what(); //throw cms::Exception("ProductNotFound") << "Problem with noises..." ; } - }//end of retrieveNoises method. - - void FEDEmulator::subtractPedestals(const edm::DetSetVector::const_iterator & inputChannel, - std::vector & pedsDetSetData, - std::vector & noiseDetSetData, - std::vector & pedSubtrDetSetData, - std::vector & medsDetSetData, - const bool fillApvsForCM) - { - + } //end of retrieveNoises method. + + void FEDEmulator::subtractPedestals(const edm::DetSetVector::const_iterator& inputChannel, + std::vector& pedsDetSetData, + std::vector& noiseDetSetData, + std::vector& pedSubtrDetSetData, + std::vector& medsDetSetData, + const bool fillApvsForCM) { edm::DetSet::const_iterator digi_it = inputChannel->begin(); - ////for median calculation + ////for median calculation uint32_t lCount = 0; std::vector > apvs; - apvs.reserve(nPairs_*2); + apvs.reserve(nPairs_ * 2); - //subtract pedestals and fill apv vector + //subtract pedestals and fill apv vector //for median calculation //in a module, 256*nPairs, but here we are dealing //channel by channel, so 256 values at a time in the pedestal object. //reordered = 0-127 APV0 128-255 APV1 - std::vector apvVec;; + std::vector apvVec; + ; apvVec.reserve(sistrip::STRIPS_PER_APV); - + for (uint32_t st = minStrip_; st < maxStrip_; st++) { uint16_t ped = static_cast(pedestals_[st]); pedsDetSetData.push_back(SiStripRawDigi(ped)); float noise = noises_[st]; noiseDetSetData.push_back(SiStripProcessedRawDigi(noise)); - + if (digi_it == inputChannel->end()) { - LogError(messageLabel_) << " Error, end of inputchannel reached for detid " << detId_ << "! Processed " << lCount << " strips." << std::endl; - break; + LogError(messageLabel_) << " Error, end of inputchannel reached for detid " << detId_ << "! Processed " + << lCount << " strips." << std::endl; + break; } - + int lVal = digi_it->adc() - ped; if (lVal < 0) { - if (digi_it->adc()>0) LogDebug(messageLabel_) << " Negative value after pedestal subtraction ! Detid = " << detId_ << ", strip " << st << ", digi = " << digi_it->adc() << ", ped = " << ped << std::endl; - lVal = 0; + if (digi_it->adc() > 0) + LogDebug(messageLabel_) << " Negative value after pedestal subtraction ! Detid = " << detId_ << ", strip " + << st << ", digi = " << digi_it->adc() << ", ped = " << ped << std::endl; + lVal = 0; } - pedSubtrDetSetData.push_back( SiStripRawDigi(static_cast(lVal)) ); + pedSubtrDetSetData.push_back(SiStripRawDigi(static_cast(lVal))); - if (fillApvsForCM) { - apvVec.push_back( static_cast(lVal) ); + apvVec.push_back(static_cast(lVal)); } - + lCount++; ++digi_it; - - if (lCount%sistrip::STRIPS_PER_APV == 0 && fillApvsForCM) { - if (!apvVec.empty()) apvs.push_back(apvVec); - apvVec.clear(); - apvVec.reserve(sistrip::STRIPS_PER_APV); + + if (lCount % sistrip::STRIPS_PER_APV == 0 && fillApvsForCM) { + if (!apvVec.empty()) + apvs.push_back(apvVec); + apvVec.clear(); + apvVec.reserve(sistrip::STRIPS_PER_APV); } - - }//end of loop over strips - - if (fillApvsForCM){ - if (apvs.size() != nPairs_*2) { - LogError(messageLabel_) << " Error, wrong output size for median calculation for detid " << detId_ << "! Processed " << apvs.size() << " APVs." << std::endl; + + } //end of loop over strips + + if (fillApvsForCM) { + if (apvs.size() != nPairs_ * 2) { + LogError(messageLabel_) << " Error, wrong output size for median calculation for detid " << detId_ + << "! Processed " << apvs.size() << " APVs." << std::endl; } //calculate common mode values - for (uint32_t iapv(0); iapv lVec = apvs[iapv]; - - std::vector::iterator mid = lVec.begin() + (lVec.size()/2 - 1); - std::nth_element(lVec.begin(), mid, lVec.end()); - - //std::sort(lVec.begin(),lVec.end()); - //get the 64th element - //if (*mid != lVec.at(63)) exit(0); - //medians_.push_back(lVec.at(63)); - //medsDetSetData.push_back(lVec.at(63)); - medians_.push_back(*mid); - medsDetSetData.push_back(*mid); - + for (uint32_t iapv(0); iapv < apvs.size(); iapv++) { + std::vector lVec = apvs[iapv]; + + std::vector::iterator mid = lVec.begin() + (lVec.size() / 2 - 1); + std::nth_element(lVec.begin(), mid, lVec.end()); + + //std::sort(lVec.begin(),lVec.end()); + //get the 64th element + //if (*mid != lVec.at(63)) exit(0); + //medians_.push_back(lVec.at(63)); + //medsDetSetData.push_back(lVec.at(63)); + medians_.push_back(*mid); + medsDetSetData.push_back(*mid); } } - }//end of FEDEmulator::subtractPedestals method. - + } //end of FEDEmulator::subtractPedestals method. - void FEDEmulator::subtractCM(const std::vector & pedSubtrDetSetData, - std::vector & cmSubtrDetSetData) - { + void FEDEmulator::subtractCM(const std::vector& pedSubtrDetSetData, + std::vector& cmSubtrDetSetData) { //subtract Medians std::vector::const_iterator lDigi = pedSubtrDetSetData.begin(); uint32_t lCount = 0; for (uint32_t st = minStrip_; st < maxStrip_; st++) { - uint32_t lApvNum = static_cast(lCount*1./sistrip::STRIPS_PER_APV); - + uint32_t lApvNum = static_cast(lCount * 1. / sistrip::STRIPS_PER_APV); + int value = lDigi->adc() - medians_.at(lApvNum); if (value < 0) { - //FED doesn't handle negative values - value = 0; + //FED doesn't handle negative values + value = 0; } cmSubtrDetSetData.push_back(SiStripRawDigi(static_cast(value))); ++lDigi; lCount++; } - } - void FEDEmulator::zeroSuppress(const std::vector & cmSubtrDetSetData, - edm::DetSet & zsDetSetData, - const std::unique_ptr & algorithms) - { + void FEDEmulator::zeroSuppress(const std::vector& cmSubtrDetSetData, + edm::DetSet& zsDetSetData, + const std::unique_ptr& algorithms) { //transform the input digis to a vector of integers std::vector cmSubtrRawDigis; - transform(cmSubtrDetSetData.begin(), - cmSubtrDetSetData.end(), - back_inserter(cmSubtrRawDigis), - boost::bind(&SiStripRawDigi::adc ,_1) - ); - algorithms->suppressor->suppress(cmSubtrRawDigis, 0, - zsDetSetData); - - }//end of FEDEmulator::zeroSuppress method. - - - - void FEDEmulator::fillPeds(const edm::DetSetVector::const_iterator & peds){ - for (edm::DetSet::const_iterator iApv = peds->begin(); - iApv != peds->end(); ++iApv) { + transform(cmSubtrDetSetData.begin(), + cmSubtrDetSetData.end(), + back_inserter(cmSubtrRawDigis), + boost::bind(&SiStripRawDigi::adc, _1)); + algorithms->suppressor->suppress(cmSubtrRawDigis, 0, zsDetSetData); + + } //end of FEDEmulator::zeroSuppress method. + + void FEDEmulator::fillPeds(const edm::DetSetVector::const_iterator& peds) { + for (edm::DetSet::const_iterator iApv = peds->begin(); iApv != peds->end(); ++iApv) { pedestals_.push_back(iApv->adc()); } } - - void FEDEmulator::fillNoises(const edm::DetSetVector::const_iterator & noises){ - for (edm::DetSet::const_iterator iApv = noises->begin(); - iApv != noises->end(); ++iApv) { + + void FEDEmulator::fillNoises(const edm::DetSetVector::const_iterator& noises) { + for (edm::DetSet::const_iterator iApv = noises->begin(); iApv != noises->end(); ++iApv) { noises_.push_back(iApv->adc()); } } - - void FEDEmulator::fillMedians(const std::map >::const_iterator & meds){ + + void FEDEmulator::fillMedians(const std::map >::const_iterator& meds) { std::vector::const_iterator iApv = (meds->second).begin(); - for ( ; iApv != (meds->second).end(); ++iApv) { + for (; iApv != (meds->second).end(); ++iApv) { medians_.push_back(*iApv); } } - void FEDEmulator::print(std::ostream & aOs) { + void FEDEmulator::print(std::ostream& aOs) { aOs << "===============================" << std::endl - << " ===== FEDEmulator::print =====" << std::endl - << " === byModule = " << byModule_ << std::endl - << " === minStrip = " << minStrip_ << std::endl - << " === maxStrip = " << maxStrip_ << std::endl - << " === size of pedestals = " << pedestals_.size() << std::endl - << " === size of noises = " << noises_.size() << std::endl - << " === size of medians = " << medians_.size() << std::endl - << " === detId = " << detId_ << std::endl - << " === nPairs = " << nPairs_ << std::endl - << " === pair = " << pair_ << std::endl - << "===============================" << std::endl; + << " ===== FEDEmulator::print =====" << std::endl + << " === byModule = " << byModule_ << std::endl + << " === minStrip = " << minStrip_ << std::endl + << " === maxStrip = " << maxStrip_ << std::endl + << " === size of pedestals = " << pedestals_.size() << std::endl + << " === size of noises = " << noises_.size() << std::endl + << " === size of medians = " << medians_.size() << std::endl + << " === detId = " << detId_ << std::endl + << " === nPairs = " << nPairs_ << std::endl + << " === pair = " << pair_ << std::endl + << "===============================" << std::endl; } - - void FEDEmulator::printPeds(std::ostream & aOs) { + void FEDEmulator::printPeds(std::ostream& aOs) { aOs << "=========================================" << std::endl - << " ===== FEDEmulator::printPedestals =====" << std::endl; - for (unsigned int i(0); i > spyReorderedDigisToken_; edm::EDGetTokenT > spyVirginRawDigisToken_; - //by fedIndex or module detid bool byModule_; sistrip::FEDEmulator fedEmulator_; static const char* messageLabel_; - - std::unique_ptr algorithms_; //!< object for zero-suppression + + std::unique_ptr algorithms_; //!< object for zero-suppression //utilities for cabling etc... SpyUtilities utility_; - }; -}//~sistrip +} // namespace sistrip namespace sistrip { @@ -97,97 +91,88 @@ namespace sistrip { // const char* FEDEmulatorModule::messageLabel_ = "SiStripFEDEmulatorModule"; - - FEDEmulatorModule::FEDEmulatorModule(const edm::ParameterSet& iConfig): - spyReorderedDigisTag_(iConfig.getParameter("SpyReorderedDigisTag")), - spyVirginRawDigisTag_(iConfig.getParameter("SpyVirginRawDigisTag")), - byModule_(iConfig.getParameter("ByModule")), - algorithms_(SiStripRawProcessingFactory::create(iConfig.getParameter("Algorithms"))) - { - + FEDEmulatorModule::FEDEmulatorModule(const edm::ParameterSet& iConfig) + : spyReorderedDigisTag_(iConfig.getParameter("SpyReorderedDigisTag")), + spyVirginRawDigisTag_(iConfig.getParameter("SpyVirginRawDigisTag")), + byModule_(iConfig.getParameter("ByModule")), + algorithms_(SiStripRawProcessingFactory::create(iConfig.getParameter("Algorithms"))) { spyReorderedDigisToken_ = consumes >(spyReorderedDigisTag_); spyVirginRawDigisToken_ = consumes >(spyVirginRawDigisTag_); fedEmulator_.initialise(byModule_); - if (!byModule_) { //if not by module + if (!byModule_) { //if not by module //the medians will be produced by fed id/channel - produces > >("Medians"); + produces > >("Medians"); produces >("PedestalsOrdered"); produces >("NoisesOrdered"); produces >("PedSubtrDigisOrdered"); produces >("CMSubtrDigisOrdered"); - } - else { //by module + } else { //by module produces >("ModulePedestals"); produces >("ModuleNoises"); produces >("PedSubtrModuleDigis"); - produces > >("ModuleMedians"); + produces > >("ModuleMedians"); produces >("CMSubtrModuleDigis"); produces >("ZSModuleDigis"); - }//end of by module check + } //end of by module check - }//end of FEDEmulatorModule constructor + } //end of FEDEmulatorModule constructor - FEDEmulatorModule::~FEDEmulatorModule() - { - } + FEDEmulatorModule::~FEDEmulatorModule() {} // ------------ method called to for each event ------------ - void - FEDEmulatorModule::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) - { + void FEDEmulatorModule::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { //update cabling and pedestals - const SiStripFedCabling* lCabling = utility_.getCabling( iSetup ); + const SiStripFedCabling* lCabling = utility_.getCabling(iSetup); edm::ESHandle lPedsHandle = utility_.getPedestalHandle(iSetup); edm::ESHandle lNoiseHandle = utility_.getNoiseHandle(iSetup); - + //initialise the algorithms object for the zero suppression algorithms_->initialize(iSetup); //retrieve the digis edm::Handle > lDigisHandle; - try { //to get the digis from the event + try { //to get the digis from the event if (!byModule_) { - iEvent.getByToken(spyReorderedDigisToken_, lDigisHandle); - } - else { //digis supplied by module - iEvent.getByToken(spyVirginRawDigisToken_, lDigisHandle); - }//end of by module check + iEvent.getByToken(spyReorderedDigisToken_, lDigisHandle); + } else { //digis supplied by module + iEvent.getByToken(spyVirginRawDigisToken_, lDigisHandle); + } //end of by module check } catch (const cms::Exception& e) { - std::cout << e.what() ; + std::cout << e.what(); return; - } //end of get digis try + } //end of get digis try - const edm::DetSetVector * lInputDigis = lDigisHandle.product(); + const edm::DetSetVector* lInputDigis = lDigisHandle.product(); unsigned int lNDigis = lInputDigis->size(); //define output containers //reserve space, will push_back elements - std::vector::detset > pedsData; + std::vector::detset> pedsData; pedsData.reserve(lNDigis); - std::vector::detset > noiseData; + std::vector::detset> noiseData; noiseData.reserve(lNDigis); - std::vector::detset > pedSubtrData; + std::vector::detset> pedSubtrData; pedSubtrData.reserve(lNDigis); - std::vector::detset > cmSubtrData; + std::vector::detset> cmSubtrData; cmSubtrData.reserve(lNDigis); //zero suppressed contained - no fixed size (could be empty) so no need to reserve elements. - std::vector< edm::DetSet > zsData; - + std::vector > zsData; + //this is a map: no reserve/resize - std::map > medsData; + std::map > medsData; edm::DetSetVector::const_iterator inputChannel = lInputDigis->begin(); - for ( ; inputChannel!=lInputDigis->end(); ++inputChannel){//loop on input channels - uint32_t lDetId = inputChannel->detId(); //either fedIndex or detId + for (; inputChannel != lInputDigis->end(); ++inputChannel) { //loop on input channels + uint32_t lDetId = inputChannel->detId(); //either fedIndex or detId - pedsData.push_back( edm::DetSetVector::detset(lDetId) ); - noiseData.push_back( edm::DetSetVector::detset(lDetId) ); - pedSubtrData.push_back(edm::DetSetVector::detset(lDetId) ); - cmSubtrData.push_back( edm::DetSetVector::detset(lDetId) ); + pedsData.push_back(edm::DetSetVector::detset(lDetId)); + noiseData.push_back(edm::DetSetVector::detset(lDetId)); + pedSubtrData.push_back(edm::DetSetVector::detset(lDetId)); + cmSubtrData.push_back(edm::DetSetVector::detset(lDetId)); unsigned int lNStrips = inputChannel->size(); @@ -202,85 +187,84 @@ namespace sistrip { cmSubtrDetSetData.reserve(lNStrips); //zero suppressed - slightly different procedure as not fixed size edm::DetSet zsDetSetData(lDetId); - + //determine the number of APV pairs in the channel - uint32_t lNPairs = static_cast(lNStrips*1./sistrip::STRIPS_PER_FEDCH); + uint32_t lNPairs = static_cast(lNStrips * 1. / sistrip::STRIPS_PER_FEDCH); uint32_t lPair = 0; - + std::vector medsDetSetData; - medsDetSetData.reserve(lNPairs*2); //2*number of pairs per module. If not by module, lNPairs = 1... - - if (!byModule_) { //the input is not stored by module - //need to retrieve the proper detId from cabling - uint16_t lFedId = 0; - uint16_t lFedChannel = 0; - sistrip::SpyUtilities::fedIndex(lDetId, lFedId, lFedChannel); - - const FedChannelConnection & lConnection = lCabling->fedConnection(lFedId,lFedChannel); - lDetId = lConnection.detId(); - lNPairs = lConnection.nApvPairs(); - lPair = lConnection.apvPairNumber(); - }//end of by module check - - fedEmulator_.initialiseModule(lDetId,lNPairs,lPair); + medsDetSetData.reserve(lNPairs * 2); //2*number of pairs per module. If not by module, lNPairs = 1... + + if (!byModule_) { //the input is not stored by module + //need to retrieve the proper detId from cabling + uint16_t lFedId = 0; + uint16_t lFedChannel = 0; + sistrip::SpyUtilities::fedIndex(lDetId, lFedId, lFedChannel); + + const FedChannelConnection& lConnection = lCabling->fedConnection(lFedId, lFedChannel); + lDetId = lConnection.detId(); + lNPairs = lConnection.nApvPairs(); + lPair = lConnection.apvPairNumber(); + } //end of by module check + + fedEmulator_.initialiseModule(lDetId, lNPairs, lPair); //get the pedestal values //stored by module in the database fedEmulator_.retrievePedestals(lPedsHandle); fedEmulator_.retrieveNoises(lNoiseHandle); - + //last option: fill medians from these ped subtr data //if want something else, need to call a method to fill //the data member medians_ of the class fedEmulator. - fedEmulator_.subtractPedestals(inputChannel, - pedsDetSetData, - noiseDetSetData, - pedSubtrDetSetData, - medsDetSetData, - true); - - fedEmulator_.subtractCM(pedSubtrDetSetData,cmSubtrDetSetData); + fedEmulator_.subtractPedestals( + inputChannel, pedsDetSetData, noiseDetSetData, pedSubtrDetSetData, medsDetSetData, true); + + fedEmulator_.subtractCM(pedSubtrDetSetData, cmSubtrDetSetData); //fill the median map medsData[inputChannel->detId()] = medsDetSetData; //zero suppress the digis fedEmulator_.zeroSuppress(cmSubtrDetSetData, zsDetSetData, algorithms_); - if (!zsDetSetData.empty()) zsData.push_back( zsDetSetData ); - - }//loop on input channels + if (!zsDetSetData.empty()) + zsData.push_back(zsDetSetData); + + } //loop on input channels + std::unique_ptr > lPeds(new edm::DetSetVector(pedsData, true)); + std::unique_ptr > lNoises( + new edm::DetSetVector(noiseData, true)); - std::unique_ptr > lPeds(new edm::DetSetVector(pedsData,true)); - std::unique_ptr > lNoises(new edm::DetSetVector(noiseData,true)); + std::unique_ptr > lOutputPedSubtr( + new edm::DetSetVector(pedSubtrData, true)); - std::unique_ptr > lOutputPedSubtr(new edm::DetSetVector(pedSubtrData,true)); + std::unique_ptr > lOutputCMSubtr( + new edm::DetSetVector(cmSubtrData, true)); - std::unique_ptr > lOutputCMSubtr(new edm::DetSetVector(cmSubtrData,true)); + std::unique_ptr > > lMedians( + new std::map >(medsData)); - std::unique_ptr > > lMedians(new std::map >(medsData)); - //zero suppressed digis - std::unique_ptr< edm::DetSetVector > lOutputZS(new edm::DetSetVector(zsData)); - + std::unique_ptr > lOutputZS(new edm::DetSetVector(zsData)); + if (!byModule_) { - iEvent.put(std::move(lMedians),"Medians"); - iEvent.put(std::move(lPeds),"PedestalsOrdered"); - iEvent.put(std::move(lNoises),"NoisesOrdered"); - iEvent.put(std::move(lOutputPedSubtr),"PedSubtrDigisOrdered"); - iEvent.put(std::move(lOutputCMSubtr),"CMSubtrDigisOrdered"); - } - else { - iEvent.put(std::move(lPeds),"ModulePedestals"); - iEvent.put(std::move(lNoises),"ModuleNoises"); - iEvent.put(std::move(lOutputPedSubtr),"PedSubtrModuleDigis"); - iEvent.put(std::move(lMedians),"ModuleMedians"); - iEvent.put(std::move(lOutputCMSubtr),"CMSubtrModuleDigis"); - iEvent.put(std::move(lOutputZS),"ZSModuleDigis"); + iEvent.put(std::move(lMedians), "Medians"); + iEvent.put(std::move(lPeds), "PedestalsOrdered"); + iEvent.put(std::move(lNoises), "NoisesOrdered"); + iEvent.put(std::move(lOutputPedSubtr), "PedSubtrDigisOrdered"); + iEvent.put(std::move(lOutputCMSubtr), "CMSubtrDigisOrdered"); + } else { + iEvent.put(std::move(lPeds), "ModulePedestals"); + iEvent.put(std::move(lNoises), "ModuleNoises"); + iEvent.put(std::move(lOutputPedSubtr), "PedSubtrModuleDigis"); + iEvent.put(std::move(lMedians), "ModuleMedians"); + iEvent.put(std::move(lOutputCMSubtr), "CMSubtrModuleDigis"); + iEvent.put(std::move(lOutputZS), "ZSModuleDigis"); } - }//produce method -}//namespace sistrip + } //produce method +} //namespace sistrip // // Define as a plug-in diff --git a/DQM/SiStripMonitorHardware/src/SiStripFEDMonitor.cc b/DQM/SiStripMonitorHardware/src/SiStripFEDMonitor.cc index d153c6e97fb5b..0b34e7a30a870 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripFEDMonitor.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripFEDMonitor.cc @@ -58,28 +58,26 @@ // Class declaration // -class SiStripFEDMonitorPlugin : public one::DQMEDAnalyzer -{ - public: +class SiStripFEDMonitorPlugin : public one::DQMEDAnalyzer { +public: explicit SiStripFEDMonitorPlugin(const edm::ParameterSet&); ~SiStripFEDMonitorPlugin() override; - private: + +private: void analyze(const edm::Event&, const edm::EventSetup&) override; - void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, - const edm::EventSetup& context) override; - void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, - const edm::EventSetup& context) override; - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context) override; + void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context) override; + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; //update the cabling if necessary void updateCabling(const edm::EventSetup& eventSetup); - static bool pairComparison(const std::pair & pair1, - const std::pair & pair2); + static bool pairComparison(const std::pair& pair1, + const std::pair& pair2); - void getMajority(const std::vector > & aFeMajVec, - unsigned int & aMajorityCounter, - std::vector & afedIds); + void getMajority(const std::vector >& aFeMajVec, + unsigned int& aMajorityCounter, + std::vector& afedIds); //tag of FEDRawData collection edm::InputTag rawDataTag_; @@ -116,43 +114,41 @@ class SiStripFEDMonitorPlugin : public one::DQMEDAnalyzer("RawDataTag",edm::InputTag("source",""))), - topFolderName_(iConfig.getUntrackedParameter("TopFolderName","SiStrip")), - fillAllDetailedHistograms_(iConfig.getUntrackedParameter("FillAllDetailedHistograms",false)), - fillWithEvtNum_(iConfig.getUntrackedParameter("FillWithEventNumber",false)), - printDebug_(iConfig.getUntrackedParameter("PrintDebugMessages",1)), - cablingCacheId_(0), - maxFedBufferSize_(0), - fullDebugMode_(iConfig.getUntrackedParameter("FullDebugMode",false)) -{ - std::string subFolderName = iConfig.getUntrackedParameter("HistogramFolderName","ReadoutView"); + : rawDataTag_(iConfig.getUntrackedParameter("RawDataTag", edm::InputTag("source", ""))), + topFolderName_(iConfig.getUntrackedParameter("TopFolderName", "SiStrip")), + fillAllDetailedHistograms_(iConfig.getUntrackedParameter("FillAllDetailedHistograms", false)), + fillWithEvtNum_(iConfig.getUntrackedParameter("FillWithEventNumber", false)), + printDebug_(iConfig.getUntrackedParameter("PrintDebugMessages", 1)), + cablingCacheId_(0), + maxFedBufferSize_(0), + fullDebugMode_(iConfig.getUntrackedParameter("FullDebugMode", false)) { + std::string subFolderName = iConfig.getUntrackedParameter("HistogramFolderName", "ReadoutView"); folderName_ = topFolderName_ + "/" + subFolderName; - rawDataToken_ = consumes(rawDataTag_); - heToken_ = consumes(edm::InputTag("consecutiveHEs") ); + heToken_ = consumes(edm::InputTag("consecutiveHEs")); //print config to debug log std::ostringstream debugStream; - if (printDebug_>1) { + if (printDebug_ > 1) { debugStream << "[SiStripFEDMonitorPlugin]Configuration for SiStripFEDMonitorPlugin: " << std::endl << "[SiStripFEDMonitorPlugin]\tRawDataTag: " << rawDataTag_ << std::endl << "[SiStripFEDMonitorPlugin]\tHistogramFolderName: " << folderName_ << std::endl - << "[SiStripFEDMonitorPlugin]\tFillAllDetailedHistograms? " << (fillAllDetailedHistograms_ ? "yes" : "no") << std::endl - << "[SiStripFEDMonitorPlugin]\tFillWithEventNumber?" << (fillWithEvtNum_ ? "yes" : "no") << std::endl + << "[SiStripFEDMonitorPlugin]\tFillAllDetailedHistograms? " + << (fillAllDetailedHistograms_ ? "yes" : "no") << std::endl + << "[SiStripFEDMonitorPlugin]\tFillWithEventNumber?" << (fillWithEvtNum_ ? "yes" : "no") << std::endl << "[SiStripFEDMonitorPlugin]\tPrintDebugMessages? " << (printDebug_ ? "yes" : "no") << std::endl; } //don;t generate debug mesages if debug is disabled - std::ostringstream* pDebugStream = (printDebug_>1 ? &debugStream : nullptr); + std::ostringstream* pDebugStream = (printDebug_ > 1 ? &debugStream : nullptr); - fedHists_.initialise(iConfig,pDebugStream); + fedHists_.initialise(iConfig, pDebugStream); doTkHistoMap_ = fedHists_.tkHistoMapEnabled(); @@ -167,20 +163,14 @@ SiStripFEDMonitorPlugin::SiStripFEDMonitorPlugin(const edm::ParameterSet& iConfi nEvt_ = 0; } -SiStripFEDMonitorPlugin::~SiStripFEDMonitorPlugin() -{ -} - +SiStripFEDMonitorPlugin::~SiStripFEDMonitorPlugin() {} // // Member functions // // ------------ method called to for each event ------------ -void -SiStripFEDMonitorPlugin::analyze(const edm::Event& iEvent, - const edm::EventSetup& iSetup) -{ +void SiStripFEDMonitorPlugin::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //Retrieve tracker topology from geometry edm::ESHandle tTopoHandle; iSetup.get().get(tTopoHandle); @@ -191,7 +181,7 @@ SiStripFEDMonitorPlugin::analyze(const edm::Event& iEvent, //get raw data edm::Handle rawDataCollectionHandle; - iEvent.getByToken(rawDataToken_,rawDataCollectionHandle); + iEvent.getByToken(rawDataToken_, rawDataCollectionHandle); const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle; fedErrors_.initialiseEvent(); @@ -199,14 +189,14 @@ SiStripFEDMonitorPlugin::analyze(const edm::Event& iEvent, //add the deltaBX value if the product exist edm::Handle he; - iEvent.getByToken(heToken_,he); + iEvent.getByToken(heToken_, he); - if(he.isValid() && !he.failedToGet()) { + if (he.isValid() && !he.failedToGet()) { fedErrors_.fillEventProperties(he->deltaBX()); } //initialise map of fedId/bad channel number - std::map > badChannelFraction; + std::map > badChannelFraction; unsigned int lNFEDMonitoring = 0; unsigned int lNFEDUnpacker = 0; @@ -217,9 +207,9 @@ SiStripFEDMonitorPlugin::analyze(const edm::Event& iEvent, unsigned int lNTotBadChannels = 0; unsigned int lNTotBadActiveChannels = 0; - std::vector > > lFeMajFrac; + std::vector > > lFeMajFrac; const unsigned int nParts = 4; - if (doFEMajorityCheck_){ + if (doFEMajorityCheck_) { lFeMajFrac.resize(nParts); //max nFE per partition lFeMajFrac[0].reserve(912); @@ -231,46 +221,42 @@ SiStripFEDMonitorPlugin::analyze(const edm::Event& iEvent, maxFedBufferSize_ = 0; //loop over siStrip FED IDs - for (unsigned int fedId = FEDNumbering::MINSiStripFEDID; - fedId <= FEDNumbering::MAXSiStripFEDID; - fedId++) {//loop over FED IDs + for (unsigned int fedId = FEDNumbering::MINSiStripFEDID; fedId <= FEDNumbering::MAXSiStripFEDID; + fedId++) { //loop over FED IDs unsigned int lNBadChannels_perFEDID = 0; const FEDRawData& fedData = rawDataCollection.FEDData(fedId); //create an object to fill all errors - fedErrors_.initialiseFED(fedId,cabling_,tTopo); + fedErrors_.initialiseFED(fedId, cabling_, tTopo); - double aLumiSection = iEvent.orbitNumber()/262144.0; + double aLumiSection = iEvent.orbitNumber() / 262144.0; //Do detailed check //first check if data exists bool lDataExist = fedErrors_.checkDataPresent(fedData); if (!lDataExist) { - fedHists_.fillFEDHistograms(fedErrors_,0,fullDebugMode_,aLumiSection, lNBadChannels_perFEDID); + fedHists_.fillFEDHistograms(fedErrors_, 0, fullDebugMode_, aLumiSection, lNBadChannels_perFEDID); continue; } - - //check for problems and fill detailed histograms fedErrors_.fillFEDErrors(fedData, - fullDebugMode_, - printDebug_, - lNChannelMonitoring, - lNChannelUnpacker, - doMedHists_, - fedHists_.cmHistPointer(false), - fedHists_.cmHistPointer(true), - doFEMajorityCheck_, - lFeMajFrac - ); + fullDebugMode_, + printDebug_, + lNChannelMonitoring, + lNChannelUnpacker, + doMedHists_, + fedHists_.cmHistPointer(false), + fedHists_.cmHistPointer(true), + doFEMajorityCheck_, + lFeMajFrac); //check filled in previous method. bool lFailUnpackerFEDcheck = fedErrors_.failUnpackerFEDCheck(); fedErrors_.incrementFEDCounters(); unsigned int lSize = fedData.size(); - if (lSize > maxFedBufferSize_){ + if (lSize > maxFedBufferSize_) { maxFedBufferSize_ = lSize; } //std::cout << " -- " << fedId << " " << lSize << std::endl; @@ -278,92 +264,103 @@ SiStripFEDMonitorPlugin::analyze(const edm::Event& iEvent, //fedHists_.fillFEDHistograms(fedErrors_,lSize,fullDebugMode_); bool lFailMonitoringFEDcheck = fedErrors_.failMonitoringFEDCheck(); - if (lFailMonitoringFEDcheck) lNTotBadFeds++; - + if (lFailMonitoringFEDcheck) + lNTotBadFeds++; //sanity check: if something changed in the unpacking code //but wasn't propagated here //print only the summary, and more info if printDebug>1 if (lFailMonitoringFEDcheck != lFailUnpackerFEDcheck) { - if (printDebug_>1) { - std::ostringstream debugStream; - debugStream << " --- WARNING: FED " << fedId << std::endl - << " ------ Monitoring FED check " ; - if (lFailMonitoringFEDcheck) debugStream << "failed." << std::endl; - else debugStream << "passed." << std::endl ; - debugStream << " ------ Unpacker FED check " ; - if (lFailUnpackerFEDcheck) debugStream << "failed." << std::endl; - else debugStream << "passed." << std::endl ; - edm::LogError("SiStripMonitorHardware") << debugStream.str(); + if (printDebug_ > 1) { + std::ostringstream debugStream; + debugStream << " --- WARNING: FED " << fedId << std::endl << " ------ Monitoring FED check "; + if (lFailMonitoringFEDcheck) + debugStream << "failed." << std::endl; + else + debugStream << "passed." << std::endl; + debugStream << " ------ Unpacker FED check "; + if (lFailUnpackerFEDcheck) + debugStream << "failed." << std::endl; + else + debugStream << "passed." << std::endl; + edm::LogError("SiStripMonitorHardware") << debugStream.str(); } - if (lFailMonitoringFEDcheck) lNFEDMonitoring++; - else if (lFailUnpackerFEDcheck) lNFEDUnpacker++; + if (lFailMonitoringFEDcheck) + lNFEDMonitoring++; + else if (lFailUnpackerFEDcheck) + lNFEDUnpacker++; } - //Fill TkHistoMap: //add an entry for all channels (good = 0), //so that tkHistoMap knows which channels should be there. if (doTkHistoMap_ && !fedHists_.tkHistoMapPointer()) { - edm::LogWarning("SiStripMonitorHardware") << " -- Fedid " << fedId - << ", TkHistoMap enabled but pointer is null." << std::endl; + edm::LogWarning("SiStripMonitorHardware") + << " -- Fedid " << fedId << ", TkHistoMap enabled but pointer is null." << std::endl; } fedErrors_.fillBadChannelList(doTkHistoMap_, - fedHists_.tkHistoMapPointer(), - fedHists_.getFedvsAPVpointer(), - lNTotBadChannels, - lNTotBadActiveChannels, - lNBadChannels_perFEDID - ); - fedHists_.fillFEDHistograms(fedErrors_,lSize,fullDebugMode_,aLumiSection, lNBadChannels_perFEDID); - }//loop over FED IDs - - - if (doFEMajorityCheck_){ - for (unsigned int iP(0); iP(lMajorityCounter)/lFeMajFrac[iP].size(),lfedIds); + fedHists_.fillMajorityHistograms(iP, static_cast(lMajorityCounter) / lFeMajFrac[iP].size(), lfedIds); } } - if ((lNTotBadFeds> 0 || lNTotBadChannels>0) && printDebug_>1) { + if ((lNTotBadFeds > 0 || lNTotBadChannels > 0) && printDebug_ > 1) { std::ostringstream debugStream; - debugStream << "[SiStripFEDMonitorPlugin] --- Total number of bad feds = " - << lNTotBadFeds << std::endl - << "[SiStripFEDMonitorPlugin] --- Total number of bad channels = " - << lNTotBadChannels << std::endl - << "[SiStripFEDMonitorPlugin] --- Total number of bad active channels = " - << lNTotBadActiveChannels << std::endl; + debugStream << "[SiStripFEDMonitorPlugin] --- Total number of bad feds = " << lNTotBadFeds << std::endl + << "[SiStripFEDMonitorPlugin] --- Total number of bad channels = " << lNTotBadChannels << std::endl + << "[SiStripFEDMonitorPlugin] --- Total number of bad active channels = " << lNTotBadActiveChannels + << std::endl; edm::LogInfo("SiStripMonitorHardware") << debugStream.str(); } if ((lNFEDMonitoring > 0 || lNFEDUnpacker > 0 || lNChannelMonitoring > 0 || lNChannelUnpacker > 0) && printDebug_) { std::ostringstream debugStream; debugStream - << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl - << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl - << "[SiStripFEDMonitorPlugin]-- Summary of differences between unpacker and monitoring at FED level : " << std::endl - << "[SiStripFEDMonitorPlugin] ---- Number of times monitoring fails but not unpacking = " << lNFEDMonitoring << std::endl - << "[SiStripFEDMonitorPlugin] ---- Number of times unpacking fails but not monitoring = " << lNFEDUnpacker << std::endl - << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl - << "[SiStripFEDMonitorPlugin]-- Summary of differences between unpacker and monitoring at Channel level : " << std::endl - << "[SiStripFEDMonitorPlugin] ---- Number of times monitoring fails but not unpacking = " << lNChannelMonitoring << std::endl - << "[SiStripFEDMonitorPlugin] ---- Number of times unpacking fails but not monitoring = " << lNChannelUnpacker << std::endl - << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl - << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl ; + << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" + << std::endl + << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" + << std::endl + << "[SiStripFEDMonitorPlugin]-- Summary of differences between unpacker and monitoring at FED level : " + << std::endl + << "[SiStripFEDMonitorPlugin] ---- Number of times monitoring fails but not unpacking = " << lNFEDMonitoring + << std::endl + << "[SiStripFEDMonitorPlugin] ---- Number of times unpacking fails but not monitoring = " << lNFEDUnpacker + << std::endl + << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" + << std::endl + << "[SiStripFEDMonitorPlugin]-- Summary of differences between unpacker and monitoring at Channel level : " + << std::endl + << "[SiStripFEDMonitorPlugin] ---- Number of times monitoring fails but not unpacking = " << lNChannelMonitoring + << std::endl + << "[SiStripFEDMonitorPlugin] ---- Number of times unpacking fails but not monitoring = " << lNChannelUnpacker + << std::endl + << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" + << std::endl + << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" + << std::endl; edm::LogError("SiStripMonitorHardware") << debugStream.str(); - } fedErrors_.getFEDErrorsCounters().nTotalBadChannels = lNTotBadChannels; @@ -374,57 +371,47 @@ SiStripFEDMonitorPlugin::analyze(const edm::Event& iEvent, // explicitely casting the event number unsigned long long to double here double eventNumber = static_cast(iEvent.id().event()); fedHists_.fillCountersHistograms( - fedErrors_.getFEDErrorsCounters(), - fedErrors_.getChannelErrorsCounters(), - maxFedBufferSize_, - eventNumber); + fedErrors_.getFEDErrorsCounters(), fedErrors_.getChannelErrorsCounters(), maxFedBufferSize_, eventNumber); } else { - double aTime = iEvent.orbitNumber()/11223.; + double aTime = iEvent.orbitNumber() / 11223.; fedHists_.fillCountersHistograms( - fedErrors_.getFEDErrorsCounters(), - fedErrors_.getChannelErrorsCounters(), - maxFedBufferSize_, - aTime); + fedErrors_.getFEDErrorsCounters(), fedErrors_.getChannelErrorsCounters(), maxFedBufferSize_, aTime); } nEvt_++; -}//analyze method +} //analyze method - -bool SiStripFEDMonitorPlugin::pairComparison(const std::pair & pair1, - const std::pair & pair2){ - return (pair1.second < pair2.second) ; +bool SiStripFEDMonitorPlugin::pairComparison(const std::pair& pair1, + const std::pair& pair2) { + return (pair1.second < pair2.second); } -void SiStripFEDMonitorPlugin::getMajority(const std::vector > & aFeMajVec, - unsigned int & aMajorityCounter, - std::vector & afedIds) { - - +void SiStripFEDMonitorPlugin::getMajority(const std::vector >& aFeMajVec, + unsigned int& aMajorityCounter, + std::vector& afedIds) { unsigned int lMajAddress = 0; - std::vector >::const_iterator lIter = aFeMajVec.begin(); + std::vector >::const_iterator lIter = aFeMajVec.begin(); unsigned int lMajAddr = (*lIter).second; unsigned int lCounter = 0; //std::cout << " --- First element: addr = " << lMajAddr << " counter = " << lCounter << std::endl; - unsigned int iele=0; + unsigned int iele = 0; //bool foundMaj = false; - for ( ; lIter != aFeMajVec.end(); ++lIter,++iele) { + for (; lIter != aFeMajVec.end(); ++lIter, ++iele) { //std::cout << " ---- Ele " << iele << " " << (*lIter).first << " " << (*lIter).second << " ref " << lMajAddr << std::endl; if ((*lIter).second == lMajAddr) { ++lCounter; //std::cout << " ----- =ref: Counter = " << lCounter << std::endl; - } - else { + } else { //std::cout << " ----- !=ref: Counter = " << lCounter << " Majority = " << aMajorityCounter << std::endl; if (lCounter > aMajorityCounter) { - //std::cout << " ------ >Majority: " << std::endl; - aMajorityCounter = lCounter; - // AV bug here?? - lMajAddress = lMajAddr; - // lMajAddress = (*lIter).second; - //foundMaj=true; + //std::cout << " ------ >Majority: " << std::endl; + aMajorityCounter = lCounter; + // AV bug here?? + lMajAddress = lMajAddr; + // lMajAddress = (*lIter).second; + //foundMaj=true; } lCounter = 0; lMajAddr = (*lIter).second; @@ -434,38 +421,38 @@ void SiStripFEDMonitorPlugin::getMajority(const std::vector aMajorityCounter) { - //std::cout << " ------ >Majority: " << std::endl; - aMajorityCounter = lCounter; - lMajAddress = lMajAddr; - } - // } + if (lCounter > aMajorityCounter) { + //std::cout << " ------ >Majority: " << std::endl; + aMajorityCounter = lCounter; + lMajAddress = lMajAddr; + } + // } //std::cout << " -- found majority value for " << aMajorityCounter << " elements out of " << aFeMajVec.size() << "." << std::endl; //get list of feds with address different from majority in partition: lIter = aFeMajVec.begin(); afedIds.reserve(135); - for ( ; lIter != aFeMajVec.end(); ++lIter ) { - if((*lIter).second != lMajAddress) { + for (; lIter != aFeMajVec.end(); ++lIter) { + if ((*lIter).second != lMajAddress) { afedIds.push_back((*lIter).first); - } - else { - lIter += aMajorityCounter-1; - if(lIter >= aFeMajVec.end()) { - std::cout << "Here it is a bug: " << aMajorityCounter << " " << aFeMajVec.size() << " " << lIter - aFeMajVec.end() << std::endl; + } else { + lIter += aMajorityCounter - 1; + if (lIter >= aFeMajVec.end()) { + std::cout << "Here it is a bug: " << aMajorityCounter << " " << aFeMajVec.size() << " " + << lIter - aFeMajVec.end() << std::endl; } } } //std::cout << " -- Found " << lfedIds.size() << " elements not matching the majority." << std::endl; if (!afedIds.empty()) { - std::sort(afedIds.begin(),afedIds.end()); - std::vector::iterator lIt = std::unique(afedIds.begin(),afedIds.end()); - afedIds.erase(lIt,afedIds.end()); + std::sort(afedIds.begin(), afedIds.end()); + std::vector::iterator lIt = std::unique(afedIds.begin(), afedIds.end()); + afedIds.erase(lIt, afedIds.end()); } - } -void SiStripFEDMonitorPlugin::bookHistograms(DQMStore::IBooker & ibooker , const edm::Run & run, const edm::EventSetup & eSetup) -{ +void SiStripFEDMonitorPlugin::bookHistograms(DQMStore::IBooker& ibooker, + const edm::Run& run, + const edm::EventSetup& eSetup) { ibooker.setCurrentFolder(folderName_); edm::ESHandle tkDetMapHandle; @@ -474,31 +461,20 @@ void SiStripFEDMonitorPlugin::bookHistograms(DQMStore::IBooker & ibooker , const fedHists_.bookTopLevelHistograms(ibooker, tkDetMap); - if (fillAllDetailedHistograms_) fedHists_.bookAllFEDHistograms(ibooker , fullDebugMode_ ); + if (fillAllDetailedHistograms_) + fedHists_.bookAllFEDHistograms(ibooker, fullDebugMode_); } -void -SiStripFEDMonitorPlugin::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, - const edm::EventSetup& context) -{ - +void SiStripFEDMonitorPlugin::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, + const edm::EventSetup& context) { fedErrors_.initialiseLumiBlock(); - } - -void -SiStripFEDMonitorPlugin::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, - const edm::EventSetup& context) -{ +void SiStripFEDMonitorPlugin::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& context) { fedHists_.fillLumiHistograms(fedErrors_.getLumiErrors()); } - - - -void SiStripFEDMonitorPlugin::updateCabling(const edm::EventSetup& eventSetup) -{ +void SiStripFEDMonitorPlugin::updateCabling(const edm::EventSetup& eventSetup) { uint32_t currentCacheId = eventSetup.get().cacheIdentifier(); if (cablingCacheId_ != currentCacheId) { edm::ESHandle cablingHandle; @@ -508,7 +484,6 @@ void SiStripFEDMonitorPlugin::updateCabling(const edm::EventSetup& eventSetup) } } - // // Define as a plug-in // diff --git a/DQM/SiStripMonitorHardware/src/SiStripFEDSpyBuffer.cc b/DQM/SiStripMonitorHardware/src/SiStripFEDSpyBuffer.cc index 0b2076d6a966a..68a41c3856301 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripFEDSpyBuffer.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripFEDSpyBuffer.cc @@ -2,55 +2,52 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" namespace sistrip { - - const uint8_t FEDSpyBuffer::channelPositionsInData_[FEDCH_PER_DELAY_CHIP] = { 0, 3, 2, 1 }; - + + const uint8_t FEDSpyBuffer::channelPositionsInData_[FEDCH_PER_DELAY_CHIP] = {0, 3, 2, 1}; + FEDSpyBuffer::FEDSpyBuffer(const uint8_t* fedBuffer, const size_t fedBufferSize) - : FEDBufferBase(fedBuffer,fedBufferSize,false), - payloadPointer_(getPointerToDataAfterTrackerSpecialHeader()+16), - payloadLength_(getPointerToByteAfterEndOfPayload()-payloadPointer_), - versionId_(*(getPointerToDataAfterTrackerSpecialHeader()+3)) - { + : FEDBufferBase(fedBuffer, fedBufferSize, false), + payloadPointer_(getPointerToDataAfterTrackerSpecialHeader() + 16), + payloadLength_(getPointerToByteAfterEndOfPayload() - payloadPointer_), + versionId_(*(getPointerToDataAfterTrackerSpecialHeader() + 3)) { //Check it is spy data if (!(readoutMode() == READOUT_MODE_SPY)) throw cms::Exception("FEDSpyBuffer") << "Buffer is not from spy channel"; //Check the buffer format version ID and take action for any exceptions if (versionId_ == 0x00) { - payloadPointer_ = payloadPointer_-8; + payloadPointer_ = payloadPointer_ - 8; } //find the channel start positions findChannels(); } - FEDSpyBuffer::~FEDSpyBuffer() - { - } + FEDSpyBuffer::~FEDSpyBuffer() {} - void FEDSpyBuffer::findChannels() - { + void FEDSpyBuffer::findChannels() { size_t delayChipStartByteIndex = 0; //Loop over delay chips checking their data fits into buffer and setting up channel objects with correct offset for (uint8_t iDelayChip = 0; iDelayChip < DELAY_CHIPS_PER_FED; ++iDelayChip) { - if (delayChipStartByteIndex+SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES > payloadLength_) { + if (delayChipStartByteIndex + SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES > payloadLength_) { throw cms::Exception("FEDSpyBuffer") << "Delay chip " << uint16_t(iDelayChip) << " does not fit into buffer. " - << "Buffer size is " << bufferSize() << " delay chip data starts at " << delayChipStartByteIndex+8+8+8+8 << ". "; + << "Buffer size is " << bufferSize() << " delay chip data starts at " + << delayChipStartByteIndex + 8 + 8 + 8 + 8 << ". "; } for (uint8_t i = 0; i < FEDCH_PER_DELAY_CHIP; i++) { const uint8_t chanelIndexInDataOrder = channelPositionsInData_[i]; - const uint8_t fedCh = iDelayChip*FEDCH_PER_DELAY_CHIP + i; - const size_t channelOffsetInBits = SPY_DELAYCHIP_DATA_OFFSET_IN_BITS + 10*chanelIndexInDataOrder; - channels_[fedCh] = FEDChannel(payloadPointer_+delayChipStartByteIndex,channelOffsetInBits,SPY_SAMPLES_PER_CHANNEL); + const uint8_t fedCh = iDelayChip * FEDCH_PER_DELAY_CHIP + i; + const size_t channelOffsetInBits = SPY_DELAYCHIP_DATA_OFFSET_IN_BITS + 10 * chanelIndexInDataOrder; + channels_[fedCh] = + FEDChannel(payloadPointer_ + delayChipStartByteIndex, channelOffsetInBits, SPY_SAMPLES_PER_CHANNEL); } delayChipStartByteIndex += SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES; } } - uint32_t FEDSpyBuffer::globalRunNumber() const - { + uint32_t FEDSpyBuffer::globalRunNumber() const { if (versionId_ < 0x02) { return 0; } - const uint8_t * runNumberPointer = getPointerToDataAfterTrackerSpecialHeader()+4; + const uint8_t* runNumberPointer = getPointerToDataAfterTrackerSpecialHeader() + 4; uint32_t result = 0; result |= runNumberPointer[0]; result |= (uint32_t(runNumberPointer[1]) << 8); @@ -59,13 +56,12 @@ namespace sistrip { return result; } - uint32_t FEDSpyBuffer::spyHeaderL1ID() const - { + uint32_t FEDSpyBuffer::spyHeaderL1ID() const { if (versionId_ == 0x00) { return delayChipL1ID(0); } uint32_t result = 0; - const uint8_t* spyCounters = payloadPointer_-8; + const uint8_t* spyCounters = payloadPointer_ - 8; result |= spyCounters[4]; result |= (uint32_t(spyCounters[5]) << 8); result |= (uint32_t(spyCounters[6]) << 16); @@ -73,13 +69,12 @@ namespace sistrip { return result; } - uint32_t FEDSpyBuffer::spyHeaderTotalEventCount() const - { + uint32_t FEDSpyBuffer::spyHeaderTotalEventCount() const { if (versionId_ == 0x00) { return delayChipTotalEventCount(0); } uint32_t result = 0; - const uint8_t* spyCounters = payloadPointer_-8; + const uint8_t* spyCounters = payloadPointer_ - 8; result |= spyCounters[0]; result |= (uint32_t(spyCounters[1]) << 8); result |= (uint32_t(spyCounters[2]) << 16); @@ -87,9 +82,8 @@ namespace sistrip { return result; } - uint32_t FEDSpyBuffer::delayChipL1ID(const uint8_t delayChip) const - { - const uint8_t* delayChipCounters = payloadPointer_ + ( (SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES) * (delayChip+1) - 8); + uint32_t FEDSpyBuffer::delayChipL1ID(const uint8_t delayChip) const { + const uint8_t* delayChipCounters = payloadPointer_ + ((SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES) * (delayChip + 1) - 8); uint32_t result = 0; result |= delayChipCounters[4]; result |= (uint32_t(delayChipCounters[5]) << 8); @@ -98,9 +92,8 @@ namespace sistrip { return result; } - uint32_t FEDSpyBuffer::delayChipTotalEventCount(const uint8_t delayChip) const - { - const uint8_t* delayChipCounters = payloadPointer_ + ( (SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES) * (delayChip+1) - 8); + uint32_t FEDSpyBuffer::delayChipTotalEventCount(const uint8_t delayChip) const { + const uint8_t* delayChipCounters = payloadPointer_ + ((SPY_DELAY_CHIP_BUFFER_SIZE_IN_BYTES) * (delayChip + 1) - 8); uint32_t result = 0; result |= delayChipCounters[0]; result |= (uint32_t(delayChipCounters[1]) << 8); @@ -109,16 +102,15 @@ namespace sistrip { return result; } - void FEDSpyBuffer::print(std::ostream& os) const - { + void FEDSpyBuffer::print(std::ostream& os) const { FEDBufferBase::print(os); //TODO } - bool FEDSpyBuffer::delayChipGood(const uint8_t delayChip) const - { + bool FEDSpyBuffer::delayChipGood(const uint8_t delayChip) const { if (versionId_ == 0x00) { - if (delayChip == 0) return true; + if (delayChip == 0) + return true; } uint32_t l1CountBefore = 0; uint32_t totalEventCountBefore = 0; @@ -126,40 +118,36 @@ namespace sistrip { l1CountBefore = spyHeaderL1ID(); totalEventCountBefore = spyHeaderTotalEventCount(); } else { - l1CountBefore = delayChipL1ID(delayChip-1); - totalEventCountBefore = delayChipTotalEventCount(delayChip-1); + l1CountBefore = delayChipL1ID(delayChip - 1); + totalEventCountBefore = delayChipTotalEventCount(delayChip - 1); } const uint32_t l1CountAfter = delayChipL1ID(delayChip); const uint32_t totalEventCountAfter = delayChipTotalEventCount(delayChip); - const bool eventMatches = ( (l1CountBefore == l1CountAfter) && (totalEventCountBefore == totalEventCountAfter) ); + const bool eventMatches = ((l1CountBefore == l1CountAfter) && (totalEventCountBefore == totalEventCountAfter)); if (!eventMatches) { std::ostringstream ss; - ss << "Delay chip data was overwritten on chip " << uint16_t(delayChip) - << " L1A before: " << l1CountBefore << " after: " << l1CountAfter - << " Total event count before: " << totalEventCountBefore << " after: " << totalEventCountAfter << std::endl; + ss << "Delay chip data was overwritten on chip " << uint16_t(delayChip) << " L1A before: " << l1CountBefore + << " after: " << l1CountAfter << " Total event count before: " << totalEventCountBefore + << " after: " << totalEventCountAfter << std::endl; dump(ss); edm::LogInfo("FEDSpyBuffer") << ss.str(); } return eventMatches; } - bool FEDSpyBuffer::channelGood(const uint8_t internalFEDChannelNum) const - { - return delayChipGood(internalFEDChannelNum/FEDCH_PER_DELAY_CHIP); + bool FEDSpyBuffer::channelGood(const uint8_t internalFEDChannelNum) const { + return delayChipGood(internalFEDChannelNum / FEDCH_PER_DELAY_CHIP); } - - - - uint16_t FEDSpyChannelUnpacker::adc() const - { - const size_t offsetWords = currentOffset_/32; - const uint8_t offsetBits = currentOffset_%32; + uint16_t FEDSpyChannelUnpacker::adc() const { + const size_t offsetWords = currentOffset_ / 32; + const uint8_t offsetBits = currentOffset_ % 32; if (offsetBits < 23) { - return ( (data_[offsetWords]>>(32-10-offsetBits)) & 0x3FF ); + return ((data_[offsetWords] >> (32 - 10 - offsetBits)) & 0x3FF); } else { - return ( ((data_[offsetWords]<<(10-32+offsetBits))&0x3FF) | ((data_[offsetWords+1]&(0xFFC00000<<(32-offsetBits)))>>(64-10-offsetBits)) ); + return (((data_[offsetWords] << (10 - 32 + offsetBits)) & 0x3FF) | + ((data_[offsetWords + 1] & (0xFFC00000 << (32 - offsetBits))) >> (64 - 10 - offsetBits))); } } -} +} // namespace sistrip diff --git a/DQM/SiStripMonitorHardware/src/SiStripShotFilter.cc b/DQM/SiStripMonitorHardware/src/SiStripShotFilter.cc index 481d69d217b69..bfddc7a9cb29d 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripShotFilter.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripShotFilter.cc @@ -2,7 +2,7 @@ // -*- C++ -*- // // Class: SiStripShotFilterPlugins -// +// /* Description: DQM source application to filter "shots" for SiStrip data */ // @@ -50,14 +50,12 @@ // Class declaration // -class SiStripShotFilter : public edm::EDFilter -{ - public: - +class SiStripShotFilter : public edm::EDFilter { +public: explicit SiStripShotFilter(const edm::ParameterSet&); ~SiStripShotFilter() override; - private: +private: void beginJob() override; bool filter(edm::Event&, const edm::EventSetup&) override; void endJob() override; @@ -75,51 +73,40 @@ class SiStripShotFilter : public edm::EDFilter edm::InputTag digicollection_; edm::EDGetTokenT > digiToken_; bool zs_; - }; - // // Constructors and destructor // SiStripShotFilter::SiStripShotFilter(const edm::ParameterSet& iConfig) - : fOutPath_(iConfig.getUntrackedParameter("OutputFilePath","shotChannels.dat")), - cablingCacheId_(0), - digicollection_(iConfig.getParameter("DigiCollection")), - zs_(iConfig.getUntrackedParameter("ZeroSuppressed",true)) - -{ + : fOutPath_(iConfig.getUntrackedParameter("OutputFilePath", "shotChannels.dat")), + cablingCacheId_(0), + digicollection_(iConfig.getParameter("DigiCollection")), + zs_(iConfig.getUntrackedParameter("ZeroSuppressed", true)) - digiToken_ = consumes >(digicollection_); - -} - -SiStripShotFilter::~SiStripShotFilter() { + digiToken_ = consumes >(digicollection_); } +SiStripShotFilter::~SiStripShotFilter() {} // // Member functions // // ------------ method called to for each event ------------ -bool -SiStripShotFilter::filter(edm::Event& iEvent, - const edm::EventSetup& iSetup) -{ - +bool SiStripShotFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) { //update cabling updateCabling(iSetup); - + //get digi data edm::Handle > digis; - iEvent.getByToken(digiToken_,digis); + iEvent.getByToken(digiToken_, digis); // loop on detector with digis - APVShotFinder apvsf(*digis,zs_); + APVShotFinder apvsf(*digis, zs_); const std::vector& shots = apvsf.getShots(); //loop on feds first: there should be only a small number of shots... @@ -128,60 +115,50 @@ SiStripShotFilter::filter(edm::Event& iEvent, unsigned int lShots = 0; - for (unsigned int fedId = FEDNumbering::MINSiStripFEDID; - fedId <= FEDNumbering::MAXSiStripFEDID; - fedId++) {//loop over FED IDs + for (unsigned int fedId = FEDNumbering::MINSiStripFEDID; fedId <= FEDNumbering::MAXSiStripFEDID; + fedId++) { //loop over FED IDs - for (unsigned int iCh = 0; - iCh < sistrip::FEDCH_PER_FED; - iCh++) {//loop on channels - - const FedChannelConnection & lConnection = cabling_->fedConnection(fedId,iCh); + for (unsigned int iCh = 0; iCh < sistrip::FEDCH_PER_FED; iCh++) { //loop on channels + + const FedChannelConnection& lConnection = cabling_->fedConnection(fedId, iCh); uint32_t lDetId = lConnection.detId(); short lAPVPair = lConnection.apvPairNumber(); - for(std::vector::const_iterator shot=shots.begin();shot!=shots.end();++shot) {//loop on shots + for (std::vector::const_iterator shot = shots.begin(); shot != shots.end(); ++shot) { //loop on shots + + if (shot->detId() == lDetId && static_cast(shot->apvNumber() / 2.) == lAPVPair) { + if (shot->isGenuine()) { //genuine shot - if (shot->detId() == lDetId && - static_cast(shot->apvNumber()/2.) == lAPVPair) - { - if(shot->isGenuine()) {//genuine shot - - fOut_ << fedId << " " << iCh << " " << shot->detId() << " " << shot->apvNumber() << std::endl; - lShots++; - }//genuine shot - if (shot->apvNumber()%2==1) break; - } - }//loop on shots - }//loop on channels - }//loop on FEDs. + fOut_ << fedId << " " << iCh << " " << shot->detId() << " " << shot->apvNumber() << std::endl; + lShots++; + } //genuine shot + if (shot->apvNumber() % 2 == 1) + break; + } + } //loop on shots + } //loop on channels + } //loop on FEDs. - if (lShots > 0) fOut_ << "### " << iEvent.id().event() << " " << lShots << std::endl; + if (lShots > 0) + fOut_ << "### " << iEvent.id().event() << " " << lShots << std::endl; return lShots; -}//analyze method +} //analyze method // ------------ method called once each job just before starting event loop ------------ -void -SiStripShotFilter::beginJob() -{ - fOut_.open(fOutPath_.c_str(),std::ios::out); - if (!fOut_) std::cout << " WARNING ! Cannot open file " << fOutPath_ << " for writting. List of shot channels will not be saved." << std::endl; +void SiStripShotFilter::beginJob() { + fOut_.open(fOutPath_.c_str(), std::ios::out); + if (!fOut_) + std::cout << " WARNING ! Cannot open file " << fOutPath_ + << " for writting. List of shot channels will not be saved." << std::endl; } // ------------ method called once each job just after ending the event loop ------------ -void -SiStripShotFilter::endJob() -{ - - fOut_.close(); +void SiStripShotFilter::endJob() { fOut_.close(); } -} - -void SiStripShotFilter::updateCabling(const edm::EventSetup& eventSetup) -{ +void SiStripShotFilter::updateCabling(const edm::EventSetup& eventSetup) { uint32_t currentCacheId = eventSetup.get().cacheIdentifier(); if (cablingCacheId_ != currentCacheId) { edm::ESHandle cablingHandle; diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyDigiConverter.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyDigiConverter.cc index 4cd3cb25071fd..c1d6522dc15d5 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyDigiConverter.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyDigiConverter.cc @@ -20,29 +20,27 @@ namespace sistrip { - std::unique_ptr - SpyDigiConverter::extractPayloadDigis(const DSVRawDigis* inputScopeDigis, - std::vector * pAPVAddresses, - const bool discardDigisWithAPVAddrErr, - const sistrip::SpyUtilities::FrameQuality & aQuality, - const uint16_t expectedPos) - { + std::unique_ptr SpyDigiConverter::extractPayloadDigis( + const DSVRawDigis* inputScopeDigis, + std::vector* pAPVAddresses, + const bool discardDigisWithAPVAddrErr, + const sistrip::SpyUtilities::FrameQuality& aQuality, + const uint16_t expectedPos) { // Data is already sorted so push back fast into vector to avoid sorts and create DSV later std::vector outputData; outputData.reserve(inputScopeDigis->size()); //APV address vector indexed by fedid, majority value written. - pAPVAddresses->resize(sistrip::FED_ID_MAX+1,0); + pAPVAddresses->resize(sistrip::FED_ID_MAX + 1, 0); std::vector lAddrVec; - lAddrVec.reserve(2*sistrip::FEDCH_PER_FED); + lAddrVec.reserve(2 * sistrip::FEDCH_PER_FED); uint16_t lPreviousFedId = 0; std::vector lHeaderBitVec; lHeaderBitVec.reserve(sistrip::FEDCH_PER_FED); std::vector lTrailBitVec; lTrailBitVec.reserve(sistrip::FEDCH_PER_FED); - - //local DSVRawDigis per FED + //local DSVRawDigis per FED std::vector lFedScopeDigis; lFedScopeDigis.reserve(sistrip::FEDCH_PER_FED); @@ -52,47 +50,43 @@ namespace sistrip { bool hasBeenProcessed = false; for (; inputChannel != endChannels; ++inputChannel) { - const uint32_t lFedIndex = inputChannel->detId(); - const uint16_t fedId = static_cast ((lFedIndex>>16)&0xFFFF); + const uint16_t fedId = static_cast((lFedIndex >> 16) & 0xFFFF); // Fill frame parameters. Second parameter is to print debug info (if logDebug enabled....) - const sistrip::SpyUtilities::Frame lFrame = sistrip::SpyUtilities::extractFrameInfo(*inputChannel,false); - - - + const sistrip::SpyUtilities::Frame lFrame = sistrip::SpyUtilities::extractFrameInfo(*inputChannel, false); if (lPreviousFedId == 0) { - lPreviousFedId = fedId; + lPreviousFedId = fedId; } //print out warning only for non-empty frames.... - if (!sistrip::SpyUtilities::isValid(lFrame,aQuality,expectedPos)){ - if (lFrame.firstHeaderBit < sistrip::SPY_SAMPLES_PER_CHANNEL) { - // edm::LogWarning("SiStripSpyDigiConverter") << " FED ID: " << fedId << ", channel: " << fedCh << std::endl - // << sistrip::SpyUtilities::print(lFrame, - // std::string(" -- Invalid Frame ") - // ); - } - continue; + if (!sistrip::SpyUtilities::isValid(lFrame, aQuality, expectedPos)) { + if (lFrame.firstHeaderBit < sistrip::SPY_SAMPLES_PER_CHANNEL) { + // edm::LogWarning("SiStripSpyDigiConverter") << " FED ID: " << fedId << ", channel: " << fedCh << std::endl + // << sistrip::SpyUtilities::print(lFrame, + // std::string(" -- Invalid Frame ") + // ); + } + continue; } - + //fill local vectors per FED if (fedId == lPreviousFedId) { - if (hasBeenProcessed) hasBeenProcessed = false; + if (hasBeenProcessed) + hasBeenProcessed = false; } if (fedId != lPreviousFedId) { - SpyDigiConverter::processFED(lPreviousFedId, - discardDigisWithAPVAddrErr, - pAPVAddresses, - outputData, - lAddrVec, - lHeaderBitVec, - lTrailBitVec, - lFedScopeDigis - ); - lPreviousFedId = fedId; - hasBeenProcessed = true; + SpyDigiConverter::processFED(lPreviousFedId, + discardDigisWithAPVAddrErr, + pAPVAddresses, + outputData, + lAddrVec, + lHeaderBitVec, + lTrailBitVec, + lFedScopeDigis); + lPreviousFedId = fedId; + hasBeenProcessed = true; } // add digis lFedScopeDigis.push_back(inputChannel); @@ -101,72 +95,66 @@ namespace sistrip { lHeaderBitVec.push_back(lFrame.firstHeaderBit); lTrailBitVec.push_back(lFrame.firstTrailerBit); - } // end of loop over channels. + } // end of loop over channels. //process the last one if not already done. if (!hasBeenProcessed) { SpyDigiConverter::processFED(lPreviousFedId, - discardDigisWithAPVAddrErr, - pAPVAddresses, - outputData, - lAddrVec, - lHeaderBitVec, - lTrailBitVec, - lFedScopeDigis - ); + discardDigisWithAPVAddrErr, + pAPVAddresses, + outputData, + lAddrVec, + lHeaderBitVec, + lTrailBitVec, + lFedScopeDigis); } //return DSV of output - return std::unique_ptr( new DSVRawDigis(outputData, true) ); - - } // end of SpyDigiConverter::extractPayloadDigis method + return std::unique_ptr(new DSVRawDigis(outputData, true)); + } // end of SpyDigiConverter::extractPayloadDigis method void SpyDigiConverter::processFED(const uint16_t aPreviousFedId, - const bool discardDigisWithAPVAddrErr, - std::vector * pAPVAddresses, - std::vector & outputData, - std::vector & aAddrVec, - std::vector & aHeaderBitVec, - std::vector & aTrailBitVec, - std::vector & aFedScopeDigis - ) - { - + const bool discardDigisWithAPVAddrErr, + std::vector* pAPVAddresses, + std::vector& outputData, + std::vector& aAddrVec, + std::vector& aHeaderBitVec, + std::vector& aTrailBitVec, + std::vector& aFedScopeDigis) { //extract majority address - uint32_t lMaj = sistrip::SpyUtilities::findMajorityValue(aAddrVec,aPreviousFedId).first; - if (pAPVAddresses) (*pAPVAddresses)[aPreviousFedId] = lMaj; + uint32_t lMaj = sistrip::SpyUtilities::findMajorityValue(aAddrVec, aPreviousFedId).first; + if (pAPVAddresses) + (*pAPVAddresses)[aPreviousFedId] = lMaj; //loop over iterators and fill payload std::vector::iterator lIter; unsigned int lCh = 0; - for (lIter = aFedScopeDigis.begin(); lIter != aFedScopeDigis.end(); ++lIter,++lCh) { - - //discard if APV address different from majority. + for (lIter = aFedScopeDigis.begin(); lIter != aFedScopeDigis.end(); ++lIter, ++lCh) { + //discard if APV address different from majority. //Keep if only one of them is wrong: the other APV might be alright ?? - if ( discardDigisWithAPVAddrErr && - aAddrVec[2*lCh] != lMaj && - aAddrVec[2*lCh+1] != lMaj ) { - continue; + if (discardDigisWithAPVAddrErr && aAddrVec[2 * lCh] != lMaj && aAddrVec[2 * lCh + 1] != lMaj) { + continue; } DetSetRawDigis::const_iterator iDigi = (*lIter)->begin(); const DetSetRawDigis::const_iterator endOfChannel = (*lIter)->end(); if (iDigi == endOfChannel) { - continue; + continue; } //header starts in sample firstHeaderBit and is 18+6 samples long - const DetSetRawDigis::const_iterator payloadBegin = iDigi+aHeaderBitVec[lCh]+24; + const DetSetRawDigis::const_iterator payloadBegin = iDigi + aHeaderBitVec[lCh] + 24; const DetSetRawDigis::const_iterator payloadEnd = payloadBegin + STRIPS_PER_FEDCH; - - if(payloadEnd-iDigi >= endOfChannel-iDigi) continue; // few-cases where this is possible, i.e. nothing above frame-threhsold - + + if (payloadEnd - iDigi >= endOfChannel - iDigi) + continue; // few-cases where this is possible, i.e. nothing above frame-threhsold + // Copy data into output collection // Create new detSet with same key (in this case it is the fedKey, not detId) - outputData.push_back( DetSetRawDigis((*lIter)->detId()) ); + outputData.push_back(DetSetRawDigis((*lIter)->detId())); std::vector& outputDetSetData = outputData.back().data; outputDetSetData.resize(STRIPS_PER_FEDCH); std::vector::iterator outputBegin = outputDetSetData.begin(); @@ -178,48 +166,44 @@ namespace sistrip { aHeaderBitVec.clear(); aTrailBitVec.clear(); - aAddrVec.reserve(2*sistrip::FEDCH_PER_FED); + aAddrVec.reserve(2 * sistrip::FEDCH_PER_FED); aHeaderBitVec.reserve(sistrip::FEDCH_PER_FED); aTrailBitVec.reserve(sistrip::FEDCH_PER_FED); aFedScopeDigis.reserve(sistrip::FEDCH_PER_FED); - - } - - - - std::unique_ptr SpyDigiConverter::reorderDigis(const DSVRawDigis* inputPayloadDigis) - { + std::unique_ptr SpyDigiConverter::reorderDigis(const DSVRawDigis* inputPayloadDigis) { // Data is already sorted so push back fast into vector to avoid sorts and create DSV later std::vector outputData; outputData.reserve(inputPayloadDigis->size()); // Loop over channels in input collection - for (DSVRawDigis::const_iterator inputChannel = inputPayloadDigis->begin(); inputChannel != inputPayloadDigis->end(); ++inputChannel) { - const std::vector& inputDetSetData = inputChannel->data; - outputData.push_back( DetSetRawDigis(inputChannel->detId()) ); + for (DSVRawDigis::const_iterator inputChannel = inputPayloadDigis->begin(); + inputChannel != inputPayloadDigis->end(); + ++inputChannel) { + const std::vector& inputDetSetData = inputChannel->data; + outputData.push_back(DetSetRawDigis(inputChannel->detId())); std::vector& outputDetSetData = outputData.back().data; outputDetSetData.resize(STRIPS_PER_FEDCH); // Copy the data into the output vector reordering - for (uint16_t readoutOrderStripIndex = 0; readoutOrderStripIndex < inputDetSetData.size(); ++readoutOrderStripIndex) { - const uint16_t physicalOrderStripIndex = FEDStripOrdering::physicalOrderForStripInChannel(readoutOrderStripIndex); - outputDetSetData.at(physicalOrderStripIndex) = inputDetSetData.at(readoutOrderStripIndex); + for (uint16_t readoutOrderStripIndex = 0; readoutOrderStripIndex < inputDetSetData.size(); + ++readoutOrderStripIndex) { + const uint16_t physicalOrderStripIndex = + FEDStripOrdering::physicalOrderForStripInChannel(readoutOrderStripIndex); + outputDetSetData.at(physicalOrderStripIndex) = inputDetSetData.at(readoutOrderStripIndex); } } - + //return DSV of output - return std::unique_ptr( new DSVRawDigis(outputData,true) ); - } // end of SpyDigiConverter::reorderDigis method. + return std::unique_ptr(new DSVRawDigis(outputData, true)); + } // end of SpyDigiConverter::reorderDigis method. - std::unique_ptr - SpyDigiConverter::mergeModuleChannels(const DSVRawDigis* inputPhysicalOrderChannelDigis, - const SiStripFedCabling& cabling) - { + std::unique_ptr SpyDigiConverter::mergeModuleChannels( + const DSVRawDigis* inputPhysicalOrderChannelDigis, const SiStripFedCabling& cabling) { // Create filler for detSetVector to create output (with maximum number of DetSets and digis) - uint16_t nFeds = static_cast( FED_ID_MAX - FED_ID_MIN + 1); + uint16_t nFeds = static_cast(FED_ID_MAX - FED_ID_MIN + 1); - RawDigiDetSetVectorFiller dsvFiller(nFeds*FEDCH_PER_FED/2, nFeds*FEDCH_PER_FED*STRIPS_PER_FEDCH); + RawDigiDetSetVectorFiller dsvFiller(nFeds * FEDCH_PER_FED / 2, nFeds * FEDCH_PER_FED * STRIPS_PER_FEDCH); // Loop over FEDs in cabling auto iFed = cabling.fedIds().begin(); auto endFeds = cabling.fedIds().end(); @@ -229,35 +213,35 @@ namespace sistrip { auto iConn = conns.begin(); auto endConns = conns.end(); for (; iConn != endConns; ++iConn) { - // Skip channels not connected to a detector. - if (!iConn->isConnected()) continue; - if (iConn->detId() == sistrip::invalid32_) continue; - - // Find the data from the input collection - const uint32_t fedIndex = ( ( iConn->fedId() & sistrip::invalid_ ) << 16 ) | ( iConn->fedCh() & sistrip::invalid_ ); - const DSVRawDigis::const_iterator iDetSet = inputPhysicalOrderChannelDigis->find(fedIndex); - if (iDetSet == inputPhysicalOrderChannelDigis->end()) { - // NOTE: It will display this warning if channel hasn't been unpacked... - // Will comment out for now. - //edm::LogWarning("SiStripSpyDigiConverter") << "No data found for FED ID: " << iConn->fedId() << " channel: " << iConn->fedCh(); - continue; - } - - // Start a new channel indexed by the detId in the filler - dsvFiller.newChannel(iConn->detId(),iConn->apvPairNumber()*STRIPS_PER_FEDCH); - - // Add the data - DetSetRawDigis::const_iterator iDigi = iDetSet->begin(); - const DetSetRawDigis::const_iterator endDetSetDigis = iDetSet->end(); - for (; iDigi != endDetSetDigis; ++iDigi) { - dsvFiller.addItem(*iDigi); - } // end of loop over the digis. - } // end of loop over channels. - } // end of loop over FEDs - - return dsvFiller.createDetSetVector(); - } // end of SpyDigiConverter::mergeModuleChannels method. - + // Skip channels not connected to a detector. + if (!iConn->isConnected()) + continue; + if (iConn->detId() == sistrip::invalid32_) + continue; + + // Find the data from the input collection + const uint32_t fedIndex = ((iConn->fedId() & sistrip::invalid_) << 16) | (iConn->fedCh() & sistrip::invalid_); + const DSVRawDigis::const_iterator iDetSet = inputPhysicalOrderChannelDigis->find(fedIndex); + if (iDetSet == inputPhysicalOrderChannelDigis->end()) { + // NOTE: It will display this warning if channel hasn't been unpacked... + // Will comment out for now. + //edm::LogWarning("SiStripSpyDigiConverter") << "No data found for FED ID: " << iConn->fedId() << " channel: " << iConn->fedCh(); + continue; + } + + // Start a new channel indexed by the detId in the filler + dsvFiller.newChannel(iConn->detId(), iConn->apvPairNumber() * STRIPS_PER_FEDCH); + + // Add the data + DetSetRawDigis::const_iterator iDigi = iDetSet->begin(); + const DetSetRawDigis::const_iterator endDetSetDigis = iDetSet->end(); + for (; iDigi != endDetSetDigis; ++iDigi) { + dsvFiller.addItem(*iDigi); + } // end of loop over the digis. + } // end of loop over channels. + } // end of loop over FEDs + return dsvFiller.createDetSetVector(); + } // end of SpyDigiConverter::mergeModuleChannels method. -} // end of sistrip namespace. +} // namespace sistrip diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyDigiConverterModule.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyDigiConverterModule.cc index 65939a9c24c21..f5d4d99ab0700 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyDigiConverterModule.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyDigiConverterModule.cc @@ -34,58 +34,55 @@ class SiStripFedCabling; namespace sistrip { - class SpyDigiConverterModule : public edm::EDProducer - { + class SpyDigiConverterModule : public edm::EDProducer { public: - SpyDigiConverterModule( const edm::ParameterSet& ); + SpyDigiConverterModule(const edm::ParameterSet&); ~SpyDigiConverterModule() override; - void produce( edm::Event&, const edm::EventSetup& ) override; + void produce(edm::Event&, const edm::EventSetup&) override; private: const edm::InputTag productLabel_; edm::EDGetTokenT productToken_; - const bool storeAPVAddress_; //!< True = store APVE address for each channel. + const bool storeAPVAddress_; //!< True = store APVE address for each channel. const bool storePayloadDigis_, storeReorderedDigis_, storeModuleDigis_; sistrip::SpyUtilities::FrameQuality frameQuality_; const bool discardDigisWithAPVAddressError_; const uint32_t expectedHeaderBit_; - + //utilities for cabling etc... SpyUtilities utility_; }; -} // end of sistrip namespace. - - +} // namespace sistrip namespace sistrip { - SpyDigiConverterModule::SpyDigiConverterModule( const edm::ParameterSet& pset ) : - productLabel_(pset.getParameter("InputProductLabel")), - storeAPVAddress_(pset.getParameter("StoreAPVAddress")), - storePayloadDigis_(pset.getParameter("StorePayloadDigis")), - storeReorderedDigis_(pset.getParameter("StoreReorderedDigis")), - storeModuleDigis_(pset.getParameter("StoreModuleDigis")), - discardDigisWithAPVAddressError_(pset.getParameter("DiscardDigisWithWrongAPVAddress")), - expectedHeaderBit_(pset.getParameter("ExpectedPositionOfFirstHeaderBit")) - { + SpyDigiConverterModule::SpyDigiConverterModule(const edm::ParameterSet& pset) + : productLabel_(pset.getParameter("InputProductLabel")), + storeAPVAddress_(pset.getParameter("StoreAPVAddress")), + storePayloadDigis_(pset.getParameter("StorePayloadDigis")), + storeReorderedDigis_(pset.getParameter("StoreReorderedDigis")), + storeModuleDigis_(pset.getParameter("StoreModuleDigis")), + discardDigisWithAPVAddressError_(pset.getParameter("DiscardDigisWithWrongAPVAddress")), + expectedHeaderBit_(pset.getParameter("ExpectedPositionOfFirstHeaderBit")) { productToken_ = consumes(productLabel_); - if ( edm::isDebugEnabled() ) { - LogTrace("SiStripSpyDigiConverter") - << "[sistrip::SpyDigiConverterModule::" << __func__ << "]" - << " Constructing object..."; + if (edm::isDebugEnabled()) { + LogTrace("SiStripSpyDigiConverter") << "[sistrip::SpyDigiConverterModule::" << __func__ << "]" + << " Constructing object..."; } - - if (storePayloadDigis_) produces< edm::DetSetVector >("SpyPayload"); - if (storeReorderedDigis_) produces< edm::DetSetVector >("SpyReordered"); - if (storeModuleDigis_) produces< edm::DetSetVector >("SpyVirginRaw"); - + + if (storePayloadDigis_) + produces >("SpyPayload"); + if (storeReorderedDigis_) + produces >("SpyReordered"); + if (storeModuleDigis_) + produces >("SpyVirginRaw"); + if (storeAPVAddress_) { - produces< std::vector >("APVAddress"); + produces >("APVAddress"); //produces("APVAddress"); } - frameQuality_.minDigiRange = static_cast(pset.getParameter("MinDigiRange")); frameQuality_.maxDigiRange = static_cast(pset.getParameter("MaxDigiRange")); frameQuality_.minZeroLight = static_cast(pset.getParameter("MinZeroLight")); @@ -93,17 +90,14 @@ namespace sistrip { frameQuality_.minTickHeight = static_cast(pset.getParameter("MinTickHeight")); frameQuality_.maxTickHeight = static_cast(pset.getParameter("MaxTickHeight")); - - } // end of constructor. - + } // end of constructor. SpyDigiConverterModule::~SpyDigiConverterModule() { - if ( edm::isDebugEnabled() ) { - LogTrace("SiStripSpyDigiConverter") - << "[sistrip::SpyDigiConverterModule::" << __func__ << "]" - << " Destructing object..."; + if (edm::isDebugEnabled()) { + LogTrace("SiStripSpyDigiConverter") << "[sistrip::SpyDigiConverterModule::" << __func__ << "]" + << " Destructing object..."; } - } // end of destructor. + } // end of destructor. /** Retrieves cabling map from EventSetup and spy channel scope mode digis @@ -111,73 +105,68 @@ namespace sistrip { processing, using the SiStripSpyDigiConverter class and attaches the containers to the Event. */ - void SpyDigiConverterModule::produce( edm::Event& event, const edm::EventSetup& setup ) { - + void SpyDigiConverterModule::produce(edm::Event& event, const edm::EventSetup& setup) { static bool lFirstEvent = true; - const SiStripFedCabling* lCabling = utility_.getCabling( setup ); + const SiStripFedCabling* lCabling = utility_.getCabling(setup); + + if (!(storePayloadDigis_ || storeReorderedDigis_ || storeModuleDigis_ || storeAPVAddress_)) + return; - if ( !(storePayloadDigis_ || storeReorderedDigis_ || storeModuleDigis_ || storeAPVAddress_) ) return; - //retrieve the scope mode digis edm::Handle scopeDigisHandle; event.getByToken(productToken_, scopeDigisHandle); - + //32-bit to accomodate known CMSSW container - std::unique_ptr< std::vector > pAPVAddresses(new std::vector); - + std::unique_ptr > pAPVAddresses(new std::vector); + std::unique_ptr payloadDigis, reorderedDigis, moduleDigis; - + //get the majority value for expected position of first header bit //from first event, compare to expected one, else output warning. - if (lFirstEvent){ + if (lFirstEvent) { uint16_t lFirstHeaderBit; - sistrip::SpyUtilities::getMajorityHeader(scopeDigisHandle.product(),lFirstHeaderBit); + sistrip::SpyUtilities::getMajorityHeader(scopeDigisHandle.product(), lFirstHeaderBit); if (lFirstHeaderBit != static_cast(expectedHeaderBit_)) { - edm::LogWarning("") << " -- Majority position for firstHeaderBit in first event (" - << lFirstHeaderBit - << ") is not where expected: " - << static_cast(expectedHeaderBit_) - << std::endl; + edm::LogWarning("") << " -- Majority position for firstHeaderBit in first event (" << lFirstHeaderBit + << ") is not where expected: " << static_cast(expectedHeaderBit_) << std::endl; } - } - - //extract frame digis and APV addresses - payloadDigis = sistrip::SpyDigiConverter::extractPayloadDigis(scopeDigisHandle.product(), - pAPVAddresses.get(), - discardDigisWithAPVAddressError_, - frameQuality_, - static_cast(expectedHeaderBit_)); - + payloadDigis = sistrip::SpyDigiConverter::extractPayloadDigis(scopeDigisHandle.product(), + pAPVAddresses.get(), + discardDigisWithAPVAddressError_, + frameQuality_, + static_cast(expectedHeaderBit_)); + // Reorder if (storeReorderedDigis_ || storeModuleDigis_) { reorderedDigis = sistrip::SpyDigiConverter::reorderDigis(payloadDigis.get()); } - + // Merge into modules if (storeModuleDigis_) { moduleDigis = sistrip::SpyDigiConverter::mergeModuleChannels(reorderedDigis.get(), *lCabling); } - + //add to event - if (storePayloadDigis_) event.put(std::move(payloadDigis),"SpyPayload"); - if (storeReorderedDigis_) event.put(std::move(reorderedDigis),"SpyReordered"); - if (storeModuleDigis_) event.put(std::move(moduleDigis),"SpyVirginRaw"); + if (storePayloadDigis_) + event.put(std::move(payloadDigis), "SpyPayload"); + if (storeReorderedDigis_) + event.put(std::move(reorderedDigis), "SpyReordered"); + if (storeModuleDigis_) + event.put(std::move(moduleDigis), "SpyVirginRaw"); if (storeAPVAddress_) { event.put(std::move(pAPVAddresses), "APVAddress"); } - lFirstEvent = false; - } // end of SpyDigiConverter::produce method. - -} // end of sistrip namespace. + } // end of SpyDigiConverter::produce method. +} // namespace sistrip #include "FWCore/Framework/interface/MakerMacros.h" typedef sistrip::SpyDigiConverterModule SiStripSpyDigiConverterModule; diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyDisplayModule.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyDisplayModule.cc index 41e6f5702b32b..0e68cef69724f 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyDisplayModule.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyDisplayModule.cc @@ -5,7 +5,7 @@ // // Package: SiStripMonitorHardware // Class: SiStripSpyDisplayModule -// +// // Standard #include #include @@ -63,24 +63,25 @@ // // constants, enums and typedefs // -enum FEDSpyHistogramType {SCOPE_MODE, - PAYLOAD_RAW, - REORDERED_PAYLOAD_RAW, - REORDERED_MODULE_RAW, - PEDESTAL_VALUES, - NOISE_VALUES, - POST_PEDESTAL, - POST_COMMON_MODE, - ZERO_SUPPRESSED_PADDED, - ZERO_SUPPRESSED, - VR_COMP, - ZERO_SUPPRESSED_COMP}; +enum FEDSpyHistogramType { + SCOPE_MODE, + PAYLOAD_RAW, + REORDERED_PAYLOAD_RAW, + REORDERED_MODULE_RAW, + PEDESTAL_VALUES, + NOISE_VALUES, + POST_PEDESTAL, + POST_COMMON_MODE, + ZERO_SUPPRESSED_PADDED, + ZERO_SUPPRESSED, + VR_COMP, + ZERO_SUPPRESSED_COMP +}; // // class declaration // - /*! \brief EDAnalyzer for the online monitoring of the FED using STT spy channel data. * * \author Tom Whyntie @@ -93,73 +94,82 @@ enum FEDSpyHistogramType {SCOPE_MODE, * */ class SiStripSpyDisplayModule : public edm::EDAnalyzer { - public: - explicit SiStripSpyDisplayModule(const edm::ParameterSet&); - ~SiStripSpyDisplayModule() override; - - private: - void beginRun(const edm::Run&, const edm::EventSetup&) override; - void beginJob() override ; - void analyze(const edm::Event&, const edm::EventSetup&) override; - void endJob() override ; - - Bool_t MakeRawDigiHist_(const edm::Handle< edm::DetSetVector > & digi_handle, - uint32_t specifier, - const TFileDirectory & dir, - FEDSpyHistogramType type); - - Bool_t MakeProcessedRawDigiHist_(const edm::Handle< edm::DetSetVector > & digi_handle, - uint32_t specifier, - const TFileDirectory & dir, - FEDSpyHistogramType type); - - Bool_t MakeDigiHist_( const edm::Handle< edm::DetSetVector > & digi_handle, - uint32_t detID, - const TFileDirectory & dir, - FEDSpyHistogramType type); - - // ----------member data --------------------------- - std::vector detIDs_; //!< Vector of detIDs that are of interest (config-specified). +public: + explicit SiStripSpyDisplayModule(const edm::ParameterSet&); + ~SiStripSpyDisplayModule() override; + +private: + void beginRun(const edm::Run&, const edm::EventSetup&) override; + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + Bool_t MakeRawDigiHist_(const edm::Handle >& digi_handle, + uint32_t specifier, + const TFileDirectory& dir, + FEDSpyHistogramType type); + + Bool_t MakeProcessedRawDigiHist_(const edm::Handle >& digi_handle, + uint32_t specifier, + const TFileDirectory& dir, + FEDSpyHistogramType type); + + Bool_t MakeDigiHist_(const edm::Handle >& digi_handle, + uint32_t detID, + const TFileDirectory& dir, + FEDSpyHistogramType type); + + // ----------member data --------------------------- + std::vector detIDs_; //!< Vector of detIDs that are of interest (config-specified). //now from utility class // edm::ESHandle cabling_; //!< The Strip Tracker cabling object. sistrip::SpyUtilities utility_; - - // Data input labels - //=================== - edm::InputTag inputScopeModeRawDigiLabel_; //!< Label for the scope-mode RawDigi collection input tag - edm::InputTag inputPayloadRawDigiLabel_; //!< Label for the virgin raw RawDigi collection input tag. - edm::InputTag inputReorderedPayloadRawDigiLabel_; //!< Label for the re-ordered RawDigi module input tag. - edm::InputTag inputReorderedModuleRawDigiLabel_; //!< Label for the re-ordered RawDigi module input tag. - edm::InputTag inputPedestalsLabel_; //!< Label for the pedestals. - edm::InputTag inputNoisesLabel_; //!< Label for the noises. - edm::InputTag inputPostPedestalRawDigiLabel_; //!< Label for the post-pedestal subtraction RawDigi module input tag. - edm::InputTag inputPostCMRawDigiLabel_; //!< Label for the post-common mode subtraction RawDigi module input tag. - edm::InputTag inputZeroSuppressedRawDigiLabel_; //!< Label for the zero-suppressed, zero-padded RawDigi module input tag. - edm::InputTag inputZeroSuppressedDigiLabel_; //!< Guess what? It's the input label for the zero-suppressed digi - edm::InputTag inputCompVirginRawDigiLabel_; //!< VR RawDigis to compare (from mainline) - edm::InputTag inputCompZeroSuppressedDigiLabel_; //!< Zero-suppressed digis to compare (from mainline) - - edm::EDGetTokenT > inputScopeModeRawDigiToken_; //!< Token for the scope-mode RawDigi collection input tag - edm::EDGetTokenT > inputPayloadRawDigiToken_; //!< Token for the virgin raw RawDigi collection input tag. - edm::EDGetTokenT > inputReorderedPayloadRawDigiToken_; //!< Token for the re-ordered RawDigi module input tag. - edm::EDGetTokenT > inputReorderedModuleRawDigiToken_; //!< Token for the re-ordered RawDigi module input tag. - edm::EDGetTokenT > inputPedestalsToken_; //!< Token for the pedestals. - edm::EDGetTokenT > inputNoisesToken_; //!< Token for the noises. - edm::EDGetTokenT > inputPostPedestalRawDigiToken_; //!< Token for the post-pedestal subtraction RawDigi module input tag. - edm::EDGetTokenT > inputPostCMRawDigiToken_; //!< Token for the post-common mode subtraction RawDigi module input tag. - edm::EDGetTokenT > inputZeroSuppressedRawDigiToken_; //!< Token for the zero-suppressed, zero-padded RawDigi module input tag. - edm::EDGetTokenT > inputZeroSuppressedDigiToken_; //!< Guess what? It's the input label for the zero-suppressed digi - edm::EDGetTokenT > inputCompVirginRawDigiToken_; //!< VR RawDigis to compare (from mainline) - edm::EDGetTokenT > inputCompZeroSuppressedDigiToken_; //!< Zero-suppressed digis to compare (from mainline) - // - // Output information - //==================== - std::string outputFolderName_; //!< Name for the folder in the TFileService file output. + // Data input labels + //=================== + edm::InputTag inputScopeModeRawDigiLabel_; //!< Label for the scope-mode RawDigi collection input tag + edm::InputTag inputPayloadRawDigiLabel_; //!< Label for the virgin raw RawDigi collection input tag. + edm::InputTag inputReorderedPayloadRawDigiLabel_; //!< Label for the re-ordered RawDigi module input tag. + edm::InputTag inputReorderedModuleRawDigiLabel_; //!< Label for the re-ordered RawDigi module input tag. + edm::InputTag inputPedestalsLabel_; //!< Label for the pedestals. + edm::InputTag inputNoisesLabel_; //!< Label for the noises. + edm::InputTag inputPostPedestalRawDigiLabel_; //!< Label for the post-pedestal subtraction RawDigi module input tag. + edm::InputTag inputPostCMRawDigiLabel_; //!< Label for the post-common mode subtraction RawDigi module input tag. + edm::InputTag + inputZeroSuppressedRawDigiLabel_; //!< Label for the zero-suppressed, zero-padded RawDigi module input tag. + edm::InputTag inputZeroSuppressedDigiLabel_; //!< Guess what? It's the input label for the zero-suppressed digi + edm::InputTag inputCompVirginRawDigiLabel_; //!< VR RawDigis to compare (from mainline) + edm::InputTag inputCompZeroSuppressedDigiLabel_; //!< Zero-suppressed digis to compare (from mainline) + + edm::EDGetTokenT > + inputScopeModeRawDigiToken_; //!< Token for the scope-mode RawDigi collection input tag + edm::EDGetTokenT > + inputPayloadRawDigiToken_; //!< Token for the virgin raw RawDigi collection input tag. + edm::EDGetTokenT > + inputReorderedPayloadRawDigiToken_; //!< Token for the re-ordered RawDigi module input tag. + edm::EDGetTokenT > + inputReorderedModuleRawDigiToken_; //!< Token for the re-ordered RawDigi module input tag. + edm::EDGetTokenT > inputPedestalsToken_; //!< Token for the pedestals. + edm::EDGetTokenT > inputNoisesToken_; //!< Token for the noises. + edm::EDGetTokenT > + inputPostPedestalRawDigiToken_; //!< Token for the post-pedestal subtraction RawDigi module input tag. + edm::EDGetTokenT > + inputPostCMRawDigiToken_; //!< Token for the post-common mode subtraction RawDigi module input tag. + edm::EDGetTokenT > + inputZeroSuppressedRawDigiToken_; //!< Token for the zero-suppressed, zero-padded RawDigi module input tag. + edm::EDGetTokenT > + inputZeroSuppressedDigiToken_; //!< Guess what? It's the input label for the zero-suppressed digi + edm::EDGetTokenT > + inputCompVirginRawDigiToken_; //!< VR RawDigis to compare (from mainline) + edm::EDGetTokenT > + inputCompZeroSuppressedDigiToken_; //!< Zero-suppressed digis to compare (from mainline) + // + // Output information + //==================== + std::string outputFolderName_; //!< Name for the folder in the TFileService file output. + +}; // end of SiStripSpyDisplayModule class -}; // end of SiStripSpyDisplayModule class - - // // static data member definitions // @@ -170,389 +180,413 @@ using namespace std; // // constructors and destructor // -SiStripSpyDisplayModule::SiStripSpyDisplayModule(const edm::ParameterSet& iConfig) : - detIDs_( iConfig.getParameter< std::vector >( "detIDs")), - inputScopeModeRawDigiLabel_( iConfig.getParameter( "InputScopeModeRawDigiLabel" ) ), - inputPayloadRawDigiLabel_( iConfig.getParameter( "InputPayloadRawDigiLabel" ) ), - inputReorderedPayloadRawDigiLabel_( iConfig.getParameter( "InputReorderedPayloadRawDigiLabel" ) ), - inputReorderedModuleRawDigiLabel_( iConfig.getParameter( "InputReorderedModuleRawDigiLabel" ) ), - inputPedestalsLabel_( iConfig.getParameter( "InputPedestalsLabel" ) ), - inputNoisesLabel_( iConfig.getParameter( "InputNoisesLabel" ) ), - inputPostPedestalRawDigiLabel_( iConfig.getParameter( "InputPostPedestalRawDigiLabel" ) ), - inputPostCMRawDigiLabel_( iConfig.getParameter( "InputPostCMRawDigiLabel" ) ), - inputZeroSuppressedRawDigiLabel_( iConfig.getParameter( "InputZeroSuppressedRawDigiLabel" ) ), - inputZeroSuppressedDigiLabel_( iConfig.getParameter( "InputZeroSuppressedDigiLabel" ) ), - inputCompVirginRawDigiLabel_( iConfig.getParameter( "InputCompVirginRawDigiLabel" ) ), - inputCompZeroSuppressedDigiLabel_( iConfig.getParameter( "InputCompZeroSuppressedDigiLabel" ) ), - outputFolderName_( iConfig.getParameter( "OutputFolderName" ) ) -{ - //now do what ever initialization is needed - inputScopeModeRawDigiToken_ = consumes >(inputScopeModeRawDigiLabel_ ); - inputPayloadRawDigiToken_ = consumes >(inputPayloadRawDigiLabel_ ); - inputReorderedPayloadRawDigiToken_ = consumes >(inputReorderedPayloadRawDigiLabel_ ); - inputReorderedModuleRawDigiToken_ = consumes >(inputReorderedModuleRawDigiLabel_ ); - inputPedestalsToken_ = consumes >(inputPedestalsLabel_ ); - inputNoisesToken_ = consumes >(inputNoisesLabel_ ); - inputPostPedestalRawDigiToken_ = consumes >(inputPostPedestalRawDigiLabel_ ); - inputPostCMRawDigiToken_ = consumes >(inputPostCMRawDigiLabel_ ); - inputZeroSuppressedRawDigiToken_ = consumes >(inputZeroSuppressedRawDigiLabel_ ); - inputZeroSuppressedDigiToken_ = consumes >(inputZeroSuppressedDigiLabel_ ); - inputCompVirginRawDigiToken_ = consumes >(inputCompVirginRawDigiLabel_ ); - inputCompZeroSuppressedDigiToken_ = consumes >(inputCompZeroSuppressedDigiLabel_ ); - +SiStripSpyDisplayModule::SiStripSpyDisplayModule(const edm::ParameterSet& iConfig) + : detIDs_(iConfig.getParameter >("detIDs")), + inputScopeModeRawDigiLabel_(iConfig.getParameter("InputScopeModeRawDigiLabel")), + inputPayloadRawDigiLabel_(iConfig.getParameter("InputPayloadRawDigiLabel")), + inputReorderedPayloadRawDigiLabel_(iConfig.getParameter("InputReorderedPayloadRawDigiLabel")), + inputReorderedModuleRawDigiLabel_(iConfig.getParameter("InputReorderedModuleRawDigiLabel")), + inputPedestalsLabel_(iConfig.getParameter("InputPedestalsLabel")), + inputNoisesLabel_(iConfig.getParameter("InputNoisesLabel")), + inputPostPedestalRawDigiLabel_(iConfig.getParameter("InputPostPedestalRawDigiLabel")), + inputPostCMRawDigiLabel_(iConfig.getParameter("InputPostCMRawDigiLabel")), + inputZeroSuppressedRawDigiLabel_(iConfig.getParameter("InputZeroSuppressedRawDigiLabel")), + inputZeroSuppressedDigiLabel_(iConfig.getParameter("InputZeroSuppressedDigiLabel")), + inputCompVirginRawDigiLabel_(iConfig.getParameter("InputCompVirginRawDigiLabel")), + inputCompZeroSuppressedDigiLabel_(iConfig.getParameter("InputCompZeroSuppressedDigiLabel")), + outputFolderName_(iConfig.getParameter("OutputFolderName")) { + //now do what ever initialization is needed + inputScopeModeRawDigiToken_ = consumes >(inputScopeModeRawDigiLabel_); + inputPayloadRawDigiToken_ = consumes >(inputPayloadRawDigiLabel_); + inputReorderedPayloadRawDigiToken_ = consumes >(inputReorderedPayloadRawDigiLabel_); + inputReorderedModuleRawDigiToken_ = consumes >(inputReorderedModuleRawDigiLabel_); + inputPedestalsToken_ = consumes >(inputPedestalsLabel_); + inputNoisesToken_ = consumes >(inputNoisesLabel_); + inputPostPedestalRawDigiToken_ = consumes >(inputPostPedestalRawDigiLabel_); + inputPostCMRawDigiToken_ = consumes >(inputPostCMRawDigiLabel_); + inputZeroSuppressedRawDigiToken_ = consumes >(inputZeroSuppressedRawDigiLabel_); + inputZeroSuppressedDigiToken_ = consumes >(inputZeroSuppressedDigiLabel_); + inputCompVirginRawDigiToken_ = consumes >(inputCompVirginRawDigiLabel_); + inputCompZeroSuppressedDigiToken_ = consumes >(inputCompZeroSuppressedDigiLabel_); } - -SiStripSpyDisplayModule::~SiStripSpyDisplayModule() -{ - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) +SiStripSpyDisplayModule::~SiStripSpyDisplayModule() { + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) } // // member functions // -void -SiStripSpyDisplayModule::beginRun(const edm::Run & iRun, const edm::EventSetup & iSetup) -{ - // Retrieve FED cabling object - //iSetup.get().get( cabling_ ); - //std::stringstream ss; - //cabling_->print(ss); - //std::cout << ss.str() << std::endl; +void SiStripSpyDisplayModule::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { + // Retrieve FED cabling object + //iSetup.get().get( cabling_ ); + //std::stringstream ss; + //cabling_->print(ss); + //std::cout << ss.str() << std::endl; -} // end of beginRun method. +} // end of beginRun method. // ------------ method called once each job just before starting event loop ------------ -void -SiStripSpyDisplayModule::beginJob() -{ - // register to the TFileService - edm::Service fs; - // Check that the TFileService has been configured - if ( !fs.isAvailable() ) { - throw cms::Exception("Configuration") << "TFileService not available: did you configure it ?"; - } -} // end of beginJob method. +void SiStripSpyDisplayModule::beginJob() { + // register to the TFileService + edm::Service fs; + // Check that the TFileService has been configured + if (!fs.isAvailable()) { + throw cms::Exception("Configuration") << "TFileService not available: did you configure it ?"; + } +} // end of beginJob method. // ------------ method called once each job just after ending the event loop ------------ void SiStripSpyDisplayModule::endJob() {} // ------------ method called to for each event ------------ -void -SiStripSpyDisplayModule::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - using namespace edm; - using namespace std; - - //retrieve cabling - const SiStripDetCabling* lCabling = utility_.getDetCabling( iSetup ); - - // Set up the event-level histogram folder - //----------------------------------------- - // register to the TFileService - edm::Service fs; - - // Make the EDAnalyzer instance name directory - TFileDirectory an_dir = fs->mkdir( outputFolderName_ ); - - // Make the event directory filename - stringstream ev_dir_name; - ev_dir_name << "run" << iEvent.id().run() << "_event" << iEvent.id().event(); - TFileDirectory evdir = an_dir.mkdir( ev_dir_name.str() ); - - //if there are no detIds, get them from the comparison digis... - if (detIDs_.empty()) { - //get the detIds of the modules in the zero-suppressed comparison - if (!((inputCompZeroSuppressedDigiLabel_.label()=="") && (inputCompZeroSuppressedDigiLabel_.instance()==""))) { - edm::Handle< edm::DetSetVector< SiStripDigi > > czs_digis; - // iEvent.getByLabel( inputCompZeroSuppressedDigiLabel_, czs_digis ); - iEvent.getByToken( inputCompZeroSuppressedDigiToken_, czs_digis ); - std::vector< edm::DetSet >::const_iterator digis_it = czs_digis->begin(); - for (; digis_it!=czs_digis->end(); ++digis_it) { - detIDs_.push_back(digis_it->detId()); - } - } - else if (!((inputCompVirginRawDigiLabel_.label()=="") && (inputCompVirginRawDigiLabel_.instance()==""))) { - edm::Handle< edm::DetSetVector< SiStripRawDigi > > cvr_digis; - // iEvent.getByLabel( inputCompVirginRawDigiLabel_, cvr_digis ); - iEvent.getByToken( inputCompVirginRawDigiToken_, cvr_digis ); - std::vector< edm::DetSet >::const_iterator digis_it = cvr_digis->begin(); - for (; digis_it!=cvr_digis->end(); ++digis_it) { - detIDs_.push_back(digis_it->detId()); - } - } - +void SiStripSpyDisplayModule::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + using namespace edm; + using namespace std; + + //retrieve cabling + const SiStripDetCabling* lCabling = utility_.getDetCabling(iSetup); + + // Set up the event-level histogram folder + //----------------------------------------- + // register to the TFileService + edm::Service fs; + + // Make the EDAnalyzer instance name directory + TFileDirectory an_dir = fs->mkdir(outputFolderName_); + + // Make the event directory filename + stringstream ev_dir_name; + ev_dir_name << "run" << iEvent.id().run() << "_event" << iEvent.id().event(); + TFileDirectory evdir = an_dir.mkdir(ev_dir_name.str()); + + //if there are no detIds, get them from the comparison digis... + if (detIDs_.empty()) { + //get the detIds of the modules in the zero-suppressed comparison + if (!((inputCompZeroSuppressedDigiLabel_.label().empty()) && + (inputCompZeroSuppressedDigiLabel_.instance().empty()))) { + edm::Handle > czs_digis; + // iEvent.getByLabel( inputCompZeroSuppressedDigiLabel_, czs_digis ); + iEvent.getByToken(inputCompZeroSuppressedDigiToken_, czs_digis); + std::vector >::const_iterator digis_it = czs_digis->begin(); + for (; digis_it != czs_digis->end(); ++digis_it) { + detIDs_.push_back(digis_it->detId()); + } + } else if (!((inputCompVirginRawDigiLabel_.label().empty()) && (inputCompVirginRawDigiLabel_.instance().empty()))) { + edm::Handle > cvr_digis; + // iEvent.getByLabel( inputCompVirginRawDigiLabel_, cvr_digis ); + iEvent.getByToken(inputCompVirginRawDigiToken_, cvr_digis); + std::vector >::const_iterator digis_it = cvr_digis->begin(); + for (; digis_it != cvr_digis->end(); ++digis_it) { + detIDs_.push_back(digis_it->detId()); + } + } + } + + // Loop over detIDs as obtained from the SpyChannelMonitor config file. + for (std::vector::iterator d = detIDs_.begin(); d != detIDs_.end(); ++d) { + // TODO: Need some error checking here, probably... + const std::vector& conns = lCabling->getConnections(*d); + //cout << "________________________________________________" << endl; + //cout << "FED channels found in detId " << *d << " is " << conns.size() << endl; + if (!(conns.size())) { + // TODO: Properly DEBUG/warning this... + //cout << "Skipping detID " << uint32_t(*d) << endl; + continue; } - // Loop over detIDs as obtained from the SpyChannelMonitor config file. - for (std::vector::iterator d = detIDs_.begin(); d!=detIDs_.end(); ++d) { - // TODO: Need some error checking here, probably... - const std::vector & conns = lCabling->getConnections( *d ); - //cout << "________________________________________________" << endl; - //cout << "FED channels found in detId " << *d << " is " << conns.size() << endl; - if (!(conns.size())) { - // TODO: Properly DEBUG/warning this... - //cout << "Skipping detID " << uint32_t(*d) << endl; - continue; - } + // Create a histogram directory for each specified and available detID + stringstream sss; //!< detID folder filename + sss << "detID_" << *d; + TFileDirectory detID_dir = evdir.mkdir(sss.str()); - // Create a histogram directory for each specified and available detID - stringstream sss; //!< detID folder filename - sss << "detID_" << *d; - TFileDirectory detID_dir = evdir.mkdir( sss.str() ); - - // Loop over the channels found with the detID and add directories. - for (uint32_t ch = 0; chisConnected()) { - - // Name of channel histogram directory - stringstream ssss; ssss << sss.str() << "_APVpair_" << ch; - TFileDirectory chan_dir = detID_dir.mkdir(ssss.str()); - - // Get the fed key from the detID and the channel - uint32_t fedkey = SiStripFedKey::fedIndex(conns[ch]->fedId(), conns[ch]->fedCh()); - - // (Spy) Scope Mode (SM) - //======================= - // Get the fed key from the FED ID and the FED channel (from conns) - // This is because scope mode always stores in the collection by FED ID - if (!((inputScopeModeRawDigiLabel_.label()=="") && (inputScopeModeRawDigiLabel_.instance()==""))) { - // Use the SiStripFedKey object to return the FED key - //cout << "detID=" << *d << ", FED key looking for is " << fedkey << endl; - //cout << "Attempting to find scope mode raw digis" << endl; - // - edm::Handle< edm::DetSetVector< SiStripRawDigi > > sm_rawdigis; - // iEvent.getByLabel( inputScopeModeRawDigiLabel_, sm_rawdigis ); - iEvent.getByToken( inputScopeModeRawDigiToken_, sm_rawdigis ); - // - // Note that the fed key (also a uint32_t) is passed in this case. - // The method itself doesn't actually care, but it assumes whatever collection - // is stored in sm_rawdigis is indexed by FED key ;-) - // TODO: Make this, um, better. - if (!(MakeRawDigiHist_(sm_rawdigis, fedkey, chan_dir, SCOPE_MODE))) { ; } - } - - // Payload Unordered Raw (UR) - //============================ - if (!((inputPayloadRawDigiLabel_.label()=="") && (inputPayloadRawDigiLabel_.instance()==""))) { - uint32_t fedindex = SiStripFedKey::fedIndex(conns[ch]->fedId(), conns[ch]->fedCh()); - //cout << "Attempting to find payload mode raw digis" << endl; - edm::Handle< edm::DetSetVector< SiStripRawDigi > > ur_rawdigis; - // iEvent.getByLabel( inputPayloadRawDigiLabel_, ur_rawdigis ); - iEvent.getByToken( inputPayloadRawDigiToken_, ur_rawdigis ); - if (!(MakeRawDigiHist_(ur_rawdigis, fedindex, chan_dir, PAYLOAD_RAW))) { ; } - } - // Payload Reordered Raw - //======================= - if (!((inputReorderedPayloadRawDigiLabel_.label()=="") && (inputReorderedPayloadRawDigiLabel_.instance()==""))) { - uint32_t fedkey = SiStripFedKey::fedIndex(conns[ch]->fedId(), conns[ch]->fedCh()); - edm::Handle< edm::DetSetVector< SiStripRawDigi > > rrp_rawdigis; - // iEvent.getByLabel( inputReorderedPayloadRawDigiLabel_, rrp_rawdigis ); - iEvent.getByToken( inputReorderedPayloadRawDigiToken_, rrp_rawdigis ); - if (!(MakeRawDigiHist_(rrp_rawdigis, fedkey, chan_dir, REORDERED_PAYLOAD_RAW))) { ; } - } - } - } // end of loop over channels - // - // Module Reordered Raw (RR) - //==================== - if (!((inputReorderedModuleRawDigiLabel_.label()=="") && (inputReorderedModuleRawDigiLabel_.instance()==""))) { - edm::Handle< edm::DetSetVector< SiStripRawDigi > > rr_rawdigis; - // iEvent.getByLabel( inputReorderedModuleRawDigiLabel_, rr_rawdigis ); - iEvent.getByToken( inputReorderedModuleRawDigiToken_, rr_rawdigis ); - //cout << "Making Reordered module histogram for detID " << *d << endl; - if (!(MakeRawDigiHist_(rr_rawdigis, *d, detID_dir, REORDERED_MODULE_RAW))) { ; } - } // end of ReorderedModuleRaw check - - // - // Pedestal values - //======================== - if (!((inputPedestalsLabel_.label()=="") && (inputPedestalsLabel_.instance()==""))) { - edm::Handle< edm::DetSetVector< SiStripRawDigi > > pd_rawdigis; - // iEvent.getByLabel( inputPedestalsLabel_, pd_rawdigis ); - iEvent.getByToken( inputPedestalsToken_, pd_rawdigis ); - //cout << "Making pedestal values module histogram for detID " << *d << endl; - if (!(MakeRawDigiHist_(pd_rawdigis, *d, detID_dir, PEDESTAL_VALUES))) { ; } - } - // - // Noise values - //======================== - if (!((inputNoisesLabel_.label()=="") && (inputNoisesLabel_.instance()==""))) { - edm::Handle< edm::DetSetVector< SiStripProcessedRawDigi > > pd_rawdigis; - // iEvent.getByLabel( inputNoisesLabel_, pd_rawdigis ); - iEvent.getByToken( inputNoisesToken_, pd_rawdigis ); - //cout << "Making noise values module histogram for detID " << *d << endl; - if (!(MakeProcessedRawDigiHist_(pd_rawdigis, *d, detID_dir, NOISE_VALUES))) { ; } - } - // - // Post-Pedestal Raw (PP) - //======================== - if (!((inputPostPedestalRawDigiLabel_.label()=="") && (inputPostPedestalRawDigiLabel_.instance()==""))) { - edm::Handle< edm::DetSetVector< SiStripRawDigi > > pp_rawdigis; - // iEvent.getByLabel( inputPostPedestalRawDigiLabel_, pp_rawdigis ); - iEvent.getByToken( inputPostPedestalRawDigiToken_, pp_rawdigis ); - //cout << "Making post-pedestal module histogram for detID " << *d << endl; - if (!(MakeRawDigiHist_(pp_rawdigis, *d, detID_dir, POST_PEDESTAL))) { ; } - } - // - // Post-Common Mode Subtraction Raw (PC) - //======================================= - if (!((inputPostCMRawDigiLabel_.label()=="") && (inputPostCMRawDigiLabel_.instance()==""))) { - edm::Handle< edm::DetSetVector< SiStripRawDigi > > pc_rawdigis; - // iEvent.getByLabel( inputPostCMRawDigiLabel_, pc_rawdigis ); - iEvent.getByToken( inputPostCMRawDigiToken_, pc_rawdigis ); - //cout << "Making post-CM module histogram for detID " << *d << endl; - if (!(MakeRawDigiHist_(pc_rawdigis, *d, detID_dir, POST_COMMON_MODE))) { ; } - } - - // - // Zero-Suppressed Digis + // Loop over the channels found with the detID and add directories. + for (uint32_t ch = 0; ch < conns.size(); ch++) { + if (conns[ch] && conns[ch]->isConnected()) { + // Name of channel histogram directory + stringstream ssss; + ssss << sss.str() << "_APVpair_" << ch; + TFileDirectory chan_dir = detID_dir.mkdir(ssss.str()); + + // Get the fed key from the detID and the channel + uint32_t fedkey = SiStripFedKey::fedIndex(conns[ch]->fedId(), conns[ch]->fedCh()); + + // (Spy) Scope Mode (SM) //======================= - //bool founddigispy = false, founddigimain = false; - if (!((inputZeroSuppressedDigiLabel_.label()=="") && (inputZeroSuppressedDigiLabel_.instance()==""))) { - //cout << "Making ZeroSuppressed histogram!" << endl; - edm::Handle< edm::DetSetVector< SiStripDigi > > zs_digis; - // iEvent.getByLabel( inputZeroSuppressedDigiLabel_, zs_digis ); - iEvent.getByToken( inputZeroSuppressedDigiToken_, zs_digis ); - //founddigispy = - MakeDigiHist_(zs_digis, *d, detID_dir, ZERO_SUPPRESSED); + // Get the fed key from the FED ID and the FED channel (from conns) + // This is because scope mode always stores in the collection by FED ID + if (!((inputScopeModeRawDigiLabel_.label().empty()) && (inputScopeModeRawDigiLabel_.instance().empty()))) { + // Use the SiStripFedKey object to return the FED key + //cout << "detID=" << *d << ", FED key looking for is " << fedkey << endl; + //cout << "Attempting to find scope mode raw digis" << endl; + // + edm::Handle > sm_rawdigis; + // iEvent.getByLabel( inputScopeModeRawDigiLabel_, sm_rawdigis ); + iEvent.getByToken(inputScopeModeRawDigiToken_, sm_rawdigis); + // + // Note that the fed key (also a uint32_t) is passed in this case. + // The method itself doesn't actually care, but it assumes whatever collection + // is stored in sm_rawdigis is indexed by FED key ;-) + // TODO: Make this, um, better. + if (!(MakeRawDigiHist_(sm_rawdigis, fedkey, chan_dir, SCOPE_MODE))) { + ; + } } - //comparison to mainline data - if (!((inputCompVirginRawDigiLabel_.label()=="") && (inputCompVirginRawDigiLabel_.instance()==""))) { - //cout << "Making Mainline VirginRaw histogram!" << endl; - edm::Handle< edm::DetSetVector< SiStripRawDigi > > cvr_digis; - // iEvent.getByLabel( inputCompVirginRawDigiLabel_, cvr_digis ); - iEvent.getByToken( inputCompVirginRawDigiToken_, cvr_digis ); - //founddigimain = - MakeRawDigiHist_(cvr_digis, *d, detID_dir, VR_COMP); + + // Payload Unordered Raw (UR) + //============================ + if (!((inputPayloadRawDigiLabel_.label().empty()) && (inputPayloadRawDigiLabel_.instance().empty()))) { + uint32_t fedindex = SiStripFedKey::fedIndex(conns[ch]->fedId(), conns[ch]->fedCh()); + //cout << "Attempting to find payload mode raw digis" << endl; + edm::Handle > ur_rawdigis; + // iEvent.getByLabel( inputPayloadRawDigiLabel_, ur_rawdigis ); + iEvent.getByToken(inputPayloadRawDigiToken_, ur_rawdigis); + if (!(MakeRawDigiHist_(ur_rawdigis, fedindex, chan_dir, PAYLOAD_RAW))) { + ; + } } - if (!((inputCompZeroSuppressedDigiLabel_.label()=="") && (inputCompZeroSuppressedDigiLabel_.instance()==""))) { - //cout << "Making ZeroSuppressed histogram!" << endl; - edm::Handle< edm::DetSetVector< SiStripDigi > > czs_digis; - // iEvent.getByLabel( inputCompZeroSuppressedDigiLabel_, czs_digis ); - iEvent.getByToken( inputCompZeroSuppressedDigiToken_, czs_digis ); - //founddigimain = - MakeDigiHist_(czs_digis, *d, detID_dir, ZERO_SUPPRESSED_COMP); + // Payload Reordered Raw + //======================= + if (!((inputReorderedPayloadRawDigiLabel_.label().empty()) && + (inputReorderedPayloadRawDigiLabel_.instance().empty()))) { + uint32_t fedkey = SiStripFedKey::fedIndex(conns[ch]->fedId(), conns[ch]->fedCh()); + edm::Handle > rrp_rawdigis; + // iEvent.getByLabel( inputReorderedPayloadRawDigiLabel_, rrp_rawdigis ); + iEvent.getByToken(inputReorderedPayloadRawDigiToken_, rrp_rawdigis); + if (!(MakeRawDigiHist_(rrp_rawdigis, fedkey, chan_dir, REORDERED_PAYLOAD_RAW))) { + ; + } } - //if (founddigimain && founddigispy) cout << "Found digis for both in detid=" << *d << endl; - - } // end of loop over detIDs specified in the config. + } + } // end of loop over channels + // + // Module Reordered Raw (RR) + //==================== + if (!((inputReorderedModuleRawDigiLabel_.label().empty()) && + (inputReorderedModuleRawDigiLabel_.instance().empty()))) { + edm::Handle > rr_rawdigis; + // iEvent.getByLabel( inputReorderedModuleRawDigiLabel_, rr_rawdigis ); + iEvent.getByToken(inputReorderedModuleRawDigiToken_, rr_rawdigis); + //cout << "Making Reordered module histogram for detID " << *d << endl; + if (!(MakeRawDigiHist_(rr_rawdigis, *d, detID_dir, REORDERED_MODULE_RAW))) { + ; + } + } // end of ReorderedModuleRaw check -} // end of Analyze method. + // + // Pedestal values + //======================== + if (!((inputPedestalsLabel_.label().empty()) && (inputPedestalsLabel_.instance().empty()))) { + edm::Handle > pd_rawdigis; + // iEvent.getByLabel( inputPedestalsLabel_, pd_rawdigis ); + iEvent.getByToken(inputPedestalsToken_, pd_rawdigis); + //cout << "Making pedestal values module histogram for detID " << *d << endl; + if (!(MakeRawDigiHist_(pd_rawdigis, *d, detID_dir, PEDESTAL_VALUES))) { + ; + } + } + // + // Noise values + //======================== + if (!((inputNoisesLabel_.label().empty()) && (inputNoisesLabel_.instance().empty()))) { + edm::Handle > pd_rawdigis; + // iEvent.getByLabel( inputNoisesLabel_, pd_rawdigis ); + iEvent.getByToken(inputNoisesToken_, pd_rawdigis); + //cout << "Making noise values module histogram for detID " << *d << endl; + if (!(MakeProcessedRawDigiHist_(pd_rawdigis, *d, detID_dir, NOISE_VALUES))) { + ; + } + } + // + // Post-Pedestal Raw (PP) + //======================== + if (!((inputPostPedestalRawDigiLabel_.label().empty()) && (inputPostPedestalRawDigiLabel_.instance().empty()))) { + edm::Handle > pp_rawdigis; + // iEvent.getByLabel( inputPostPedestalRawDigiLabel_, pp_rawdigis ); + iEvent.getByToken(inputPostPedestalRawDigiToken_, pp_rawdigis); + //cout << "Making post-pedestal module histogram for detID " << *d << endl; + if (!(MakeRawDigiHist_(pp_rawdigis, *d, detID_dir, POST_PEDESTAL))) { + ; + } + } + // + // Post-Common Mode Subtraction Raw (PC) + //======================================= + if (!((inputPostCMRawDigiLabel_.label().empty()) && (inputPostCMRawDigiLabel_.instance().empty()))) { + edm::Handle > pc_rawdigis; + // iEvent.getByLabel( inputPostCMRawDigiLabel_, pc_rawdigis ); + iEvent.getByToken(inputPostCMRawDigiToken_, pc_rawdigis); + //cout << "Making post-CM module histogram for detID " << *d << endl; + if (!(MakeRawDigiHist_(pc_rawdigis, *d, detID_dir, POST_COMMON_MODE))) { + ; + } + } -Bool_t SiStripSpyDisplayModule::MakeRawDigiHist_( - const edm::Handle< edm::DetSetVector< SiStripRawDigi > > & digi_handle, - uint32_t specifier, - const TFileDirectory & dir, - FEDSpyHistogramType type) - //const std::string & name) -{ - // TODO: Remove the hard-coded numbers(!). - TH1S * hist; - if (type==SCOPE_MODE) hist = dir.make("ScopeMode", ";Sample number;ADC counts / strip", 298, 0, 298); - else if (type==PAYLOAD_RAW) hist = dir.make("PayloadRaw", ";Sample number;ADC counts / strip", 256, 0, 256); - else if (type==REORDERED_PAYLOAD_RAW) hist = dir.make("ReorderedPayloadRaw", ";Sample number;ADC counts / strip", 256, 0, 256); - else if (type==REORDERED_MODULE_RAW) hist = dir.make("ReorderedModuleRaw", ";Sample number;ADC counts / strip", 768, 0, 768); - else if (type==PEDESTAL_VALUES) hist = dir.make("PedestalValues", ";Strip number;Pedestal / strip", 768, 0, 768); - else if (type==POST_PEDESTAL) hist = dir.make("PostPedestal", ";Strip number;ADC counts / strip", 768, 0, 768); - else if (type==POST_COMMON_MODE) hist = dir.make("PostCommonMode", ";Strip number;ADC counts / strip", 768, 0, 768); - else if (type==ZERO_SUPPRESSED_PADDED) hist = dir.make("ZeroSuppressedRaw" , ";Strip number;ADC counts / strip", 768, 0, 768); - else if (type==VR_COMP) hist = dir.make("VirginRawCom" , ";Strip number;ADC counts / strip", 768, 0, 768); - else {hist = nullptr; return false;} - - // TODO: May need to make this error checking independent when refactoring... - //std::cout << "| * digis for " << type << " and detID " << specifier; - std::vector< edm::DetSet >::const_iterator digis_it = digi_handle->find( specifier ); - if (digis_it == digi_handle->end()) { - //std::cout << " not found :( "; - return false; + // + // Zero-Suppressed Digis + //======================= + //bool founddigispy = false, founddigimain = false; + if (!((inputZeroSuppressedDigiLabel_.label().empty()) && (inputZeroSuppressedDigiLabel_.instance().empty()))) { + //cout << "Making ZeroSuppressed histogram!" << endl; + edm::Handle > zs_digis; + // iEvent.getByLabel( inputZeroSuppressedDigiLabel_, zs_digis ); + iEvent.getByToken(inputZeroSuppressedDigiToken_, zs_digis); + //founddigispy = + MakeDigiHist_(zs_digis, *d, detID_dir, ZERO_SUPPRESSED); } - //std::cout << std::endl; - - // Loop over the digis for the detID and APV pair. - edm::DetSet::const_iterator idigi = digis_it->data.begin(); - uint32_t count = 0; - for ( ; idigi != digis_it->data.end(); ++idigi ) { - count++; - hist->SetBinContent(count,static_cast((*idigi).adc())); - } // end of loop over the digis - return true; // Success! (Probably.) + //comparison to mainline data + if (!((inputCompVirginRawDigiLabel_.label().empty()) && (inputCompVirginRawDigiLabel_.instance().empty()))) { + //cout << "Making Mainline VirginRaw histogram!" << endl; + edm::Handle > cvr_digis; + // iEvent.getByLabel( inputCompVirginRawDigiLabel_, cvr_digis ); + iEvent.getByToken(inputCompVirginRawDigiToken_, cvr_digis); + //founddigimain = + MakeRawDigiHist_(cvr_digis, *d, detID_dir, VR_COMP); + } + if (!((inputCompZeroSuppressedDigiLabel_.label().empty()) && + (inputCompZeroSuppressedDigiLabel_.instance().empty()))) { + //cout << "Making ZeroSuppressed histogram!" << endl; + edm::Handle > czs_digis; + // iEvent.getByLabel( inputCompZeroSuppressedDigiLabel_, czs_digis ); + iEvent.getByToken(inputCompZeroSuppressedDigiToken_, czs_digis); + //founddigimain = + MakeDigiHist_(czs_digis, *d, detID_dir, ZERO_SUPPRESSED_COMP); + } + //if (founddigimain && founddigispy) cout << "Found digis for both in detid=" << *d << endl; + + } // end of loop over detIDs specified in the config. + +} // end of Analyze method. + +Bool_t SiStripSpyDisplayModule::MakeRawDigiHist_(const edm::Handle >& digi_handle, + uint32_t specifier, + const TFileDirectory& dir, + FEDSpyHistogramType type) +//const std::string & name) +{ + // TODO: Remove the hard-coded numbers(!). + TH1S* hist; + if (type == SCOPE_MODE) + hist = dir.make("ScopeMode", ";Sample number;ADC counts / strip", 298, 0, 298); + else if (type == PAYLOAD_RAW) + hist = dir.make("PayloadRaw", ";Sample number;ADC counts / strip", 256, 0, 256); + else if (type == REORDERED_PAYLOAD_RAW) + hist = dir.make("ReorderedPayloadRaw", ";Sample number;ADC counts / strip", 256, 0, 256); + else if (type == REORDERED_MODULE_RAW) + hist = dir.make("ReorderedModuleRaw", ";Sample number;ADC counts / strip", 768, 0, 768); + else if (type == PEDESTAL_VALUES) + hist = dir.make("PedestalValues", ";Strip number;Pedestal / strip", 768, 0, 768); + else if (type == POST_PEDESTAL) + hist = dir.make("PostPedestal", ";Strip number;ADC counts / strip", 768, 0, 768); + else if (type == POST_COMMON_MODE) + hist = dir.make("PostCommonMode", ";Strip number;ADC counts / strip", 768, 0, 768); + else if (type == ZERO_SUPPRESSED_PADDED) + hist = dir.make("ZeroSuppressedRaw", ";Strip number;ADC counts / strip", 768, 0, 768); + else if (type == VR_COMP) + hist = dir.make("VirginRawCom", ";Strip number;ADC counts / strip", 768, 0, 768); + else { + hist = nullptr; + return false; + } + + // TODO: May need to make this error checking independent when refactoring... + //std::cout << "| * digis for " << type << " and detID " << specifier; + std::vector >::const_iterator digis_it = digi_handle->find(specifier); + if (digis_it == digi_handle->end()) { + //std::cout << " not found :( "; + return false; + } + //std::cout << std::endl; + + // Loop over the digis for the detID and APV pair. + edm::DetSet::const_iterator idigi = digis_it->data.begin(); + uint32_t count = 0; + for (; idigi != digis_it->data.end(); ++idigi) { + count++; + hist->SetBinContent(count, static_cast((*idigi).adc())); + } // end of loop over the digis + return true; // Success! (Probably.) } Bool_t SiStripSpyDisplayModule::MakeProcessedRawDigiHist_( - const edm::Handle< edm::DetSetVector< SiStripProcessedRawDigi > > & digi_handle, + const edm::Handle >& digi_handle, uint32_t specifier, - const TFileDirectory & dir, + const TFileDirectory& dir, FEDSpyHistogramType type) - //const std::string & name) +//const std::string & name) { - // TODO: Remove the hard-coded numbers(!). - TH1F * hist; - if (type==NOISE_VALUES) hist = dir.make("NoiseValues",";Strip number;Noise / strip",768, 0, 768); - else { - hist = nullptr; - return false; - } - - // TODO: May need to make this error checking independent when refactoring... - //std::cout << "| * digis for " << type << " and detID " << specifier; - std::vector< edm::DetSet >::const_iterator digis_it = digi_handle->find( specifier ); - if (digis_it == digi_handle->end()) { - //std::cout << " not found :( "; - return false; - } - //std::cout << std::endl; - - // Loop over the digis for the detID and APV pair. - edm::DetSet::const_iterator idigi = digis_it->data.begin(); - uint32_t count = 0; - for ( ; idigi != digis_it->data.end(); ++idigi ) { - count++; - hist->SetBinContent(count,static_cast((*idigi).adc())); - } // end of loop over the digis - return true; // Success! (Probably.) + // TODO: Remove the hard-coded numbers(!). + TH1F* hist; + if (type == NOISE_VALUES) + hist = dir.make("NoiseValues", ";Strip number;Noise / strip", 768, 0, 768); + else { + hist = nullptr; + return false; + } + + // TODO: May need to make this error checking independent when refactoring... + //std::cout << "| * digis for " << type << " and detID " << specifier; + std::vector >::const_iterator digis_it = digi_handle->find(specifier); + if (digis_it == digi_handle->end()) { + //std::cout << " not found :( "; + return false; + } + //std::cout << std::endl; + + // Loop over the digis for the detID and APV pair. + edm::DetSet::const_iterator idigi = digis_it->data.begin(); + uint32_t count = 0; + for (; idigi != digis_it->data.end(); ++idigi) { + count++; + hist->SetBinContent(count, static_cast((*idigi).adc())); + } // end of loop over the digis + return true; // Success! (Probably.) } -Bool_t SiStripSpyDisplayModule::MakeDigiHist_( - const edm::Handle< edm::DetSetVector< SiStripDigi > > & digi_handle, - uint32_t detID, - //uint32_t channel, - const TFileDirectory & dir, - FEDSpyHistogramType type) - //const std::string & name) +Bool_t SiStripSpyDisplayModule::MakeDigiHist_(const edm::Handle >& digi_handle, + uint32_t detID, + //uint32_t channel, + const TFileDirectory& dir, + FEDSpyHistogramType type) +//const std::string & name) { - // TODO: Remove the hard-coded numbers. - TH1S * hist; - if (type==ZERO_SUPPRESSED) hist = dir.make("ZeroSuppressedDigi", ";Strip number;ADC counts / strip", 768, 0, 768); - else if (type==ZERO_SUPPRESSED_COMP) hist = dir.make("ZeroSuppressedDigiComp", ";Strip number;ADC counts / strip", 768, 0, 768); - else {hist = nullptr; return false;} - - // TODO: May need to make this error checking independent when refactoring... - std::vector< edm::DetSet >::const_iterator digis_it = digi_handle->find( detID ); - if (digis_it == digi_handle->end()) { - return false; - } - else { - //cout << "--* ZS digis found for detID " << detID << endl; - } - - // Loop over the digis for the detID and APV pair. - edm::DetSet::const_iterator idigi = digis_it->data.begin(); - bool founddigi = false; - for ( ; idigi != digis_it->data.end(); ++idigi ) { - // Check strip number is within the channel limits - //if ( static_cast( (*idigi).strip()/256. ) == channel ) { - // hist->SetBinContent( ((*idigi).strip())%256 + 1,(*idigi).adc()); - //} - hist->SetBinContent( static_cast(((*idigi).strip())) + 1, static_cast((*idigi).adc()) ); - if ( (*idigi).adc() > 0 ) founddigi = true; - //cout << "----* ZS digi found at " << static_cast(((*idigi).strip())) - // << ", " << static_cast((*idigi).adc()) << endl; - } // end of loop over the digis - - return founddigi; + // TODO: Remove the hard-coded numbers. + TH1S* hist; + if (type == ZERO_SUPPRESSED) + hist = dir.make("ZeroSuppressedDigi", ";Strip number;ADC counts / strip", 768, 0, 768); + else if (type == ZERO_SUPPRESSED_COMP) + hist = dir.make("ZeroSuppressedDigiComp", ";Strip number;ADC counts / strip", 768, 0, 768); + else { + hist = nullptr; + return false; + } + + // TODO: May need to make this error checking independent when refactoring... + std::vector >::const_iterator digis_it = digi_handle->find(detID); + if (digis_it == digi_handle->end()) { + return false; + } else { + //cout << "--* ZS digis found for detID " << detID << endl; + } + + // Loop over the digis for the detID and APV pair. + edm::DetSet::const_iterator idigi = digis_it->data.begin(); + bool founddigi = false; + for (; idigi != digis_it->data.end(); ++idigi) { + // Check strip number is within the channel limits + //if ( static_cast( (*idigi).strip()/256. ) == channel ) { + // hist->SetBinContent( ((*idigi).strip())%256 + 1,(*idigi).adc()); + //} + hist->SetBinContent(static_cast(((*idigi).strip())) + 1, static_cast((*idigi).adc())); + if ((*idigi).adc() > 0) + founddigi = true; + //cout << "----* ZS digi found at " << static_cast(((*idigi).strip())) + // << ", " << static_cast((*idigi).adc()) << endl; + } // end of loop over the digis + + return founddigi; } // Define this as a plug-in diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc index e9293a39ae024..449ad7109d1c8 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcher.cc @@ -25,40 +25,40 @@ #include #include +using edm::LogError; using edm::LogInfo; using edm::LogWarning; -using edm::LogError; namespace sistrip { - + const char* SpyEventMatcher::mlLabel_ = "SpyEventMatcher"; - + SpyEventMatcher::EventKey::EventKey(const uint32_t eventId, const uint8_t apvAddress) - : eventId_(eventId), apvAddress_(apvAddress) {} - - SpyEventMatcher::MatchingOutput::MatchingOutput(FEDRawDataCollection& outputRawData) : - outputRawData_(outputRawData), - outputTotalEventCounters_(sistrip::FED_ID_MAX+1), - outputL1ACounters_(sistrip::FED_ID_MAX+1), - outputAPVAddresses_(sistrip::FED_ID_MAX+1) {} + : eventId_(eventId), apvAddress_(apvAddress) {} + + SpyEventMatcher::MatchingOutput::MatchingOutput(FEDRawDataCollection& outputRawData) + : outputRawData_(outputRawData), + outputTotalEventCounters_(sistrip::FED_ID_MAX + 1), + outputL1ACounters_(sistrip::FED_ID_MAX + 1), + outputAPVAddresses_(sistrip::FED_ID_MAX + 1) {} SpyEventMatcher::~SpyEventMatcher() {} - + SpyEventMatcher::SpyEventMatcher(const edm::ParameterSet& config) - : rawDataTag_(config.getParameter("RawSpyDataTag")), - totalEventCountersTag_(config.getParameter("SpyTotalEventCountersTag")), - l1aCountersTag_(config.getParameter("SpyL1ACountersTag")), - apvAddressesTag_(config.getParameter("SpyAPVAddressesTag")), - scopeDigisTag_(config.getParameter("SpyScopeDigisTag")), - payloadDigisTag_(config.getParameter("SpyPayloadDigisTag")), - reorderedDigisTag_(config.getParameter("SpyReorderedDigisTag")), - virginRawDigisTag_(config.getParameter("SpyVirginRawDigisTag")), - counterDiffMax_(config.getParameter("CounterDiffMaxAllowed")), - productRegistry_(new edm::SignallingProductRegistry), - source_(constructSource(config.getParameter("SpySource"))), - processConfiguration_(new edm::ProcessConfiguration(std::string("@MIXING"), edm::getReleaseVersion(), edm::getPassID())), - eventPrincipal_() - { + : rawDataTag_(config.getParameter("RawSpyDataTag")), + totalEventCountersTag_(config.getParameter("SpyTotalEventCountersTag")), + l1aCountersTag_(config.getParameter("SpyL1ACountersTag")), + apvAddressesTag_(config.getParameter("SpyAPVAddressesTag")), + scopeDigisTag_(config.getParameter("SpyScopeDigisTag")), + payloadDigisTag_(config.getParameter("SpyPayloadDigisTag")), + reorderedDigisTag_(config.getParameter("SpyReorderedDigisTag")), + virginRawDigisTag_(config.getParameter("SpyVirginRawDigisTag")), + counterDiffMax_(config.getParameter("CounterDiffMaxAllowed")), + productRegistry_(new edm::SignallingProductRegistry), + source_(constructSource(config.getParameter("SpySource"))), + processConfiguration_( + new edm::ProcessConfiguration(std::string("@MIXING"), edm::getReleaseVersion(), edm::getPassID())), + eventPrincipal_() { // Use the empty parameter set for the parameter set ID of our "@MIXING" process. processConfiguration_->setParameterSetID(edm::ParameterSet::emptyParameterSetID()); productRegistry_->setFrozen(); @@ -69,67 +69,67 @@ namespace sistrip { *processConfiguration_, nullptr)); } - - std::unique_ptr SpyEventMatcher::constructSource(const edm::ParameterSet& sourceConfig) - { + + std::unique_ptr SpyEventMatcher::constructSource(const edm::ParameterSet& sourceConfig) { const edm::VectorInputSourceFactory* sourceFactory = edm::VectorInputSourceFactory::get(); edm::VectorInputSourceDescription description(productRegistry_, edm::PreallocationConfiguration()); return sourceFactory->makeVectorInputSource(sourceConfig, description); } - void SpyEventMatcher::initialize() - { + void SpyEventMatcher::initialize() { size_t fileNameHash = 0U; //add spy events to the map until there are none left - source_->loopOverEvents(*eventPrincipal_,fileNameHash,std::numeric_limits::max(), - [this](auto const& iE, auto const&){ this->addNextEventToMap(iE); return true; }, - nullptr,nullptr,false); + source_->loopOverEvents(*eventPrincipal_, + fileNameHash, + std::numeric_limits::max(), + [this](auto const& iE, auto const&) { + this->addNextEventToMap(iE); + return true; + }, + nullptr, + nullptr, + false); //debug std::ostringstream ss; ss << "Events with possible matches (eventID,apvAddress): "; - for (std::map::const_iterator iSpyEvent = eventMatches_.begin(); iSpyEvent != eventMatches_.end(); ++iSpyEvent) { + for (std::map::const_iterator iSpyEvent = eventMatches_.begin(); + iSpyEvent != eventMatches_.end(); + ++iSpyEvent) { ss << "(" << iSpyEvent->first.eventId() << "," << uint16_t(iSpyEvent->first.apvAddress()) << ") "; } LogDebug(mlLabel_) << ss.str(); } - - void SpyEventMatcher::addNextEventToMap(const edm::EventPrincipal& nextSpyEvent) - { + + void SpyEventMatcher::addNextEventToMap(const edm::EventPrincipal& nextSpyEvent) { edm::EventID spyEventId = nextSpyEvent.id(); - CountersPtr totalEventCounters = getCounters(nextSpyEvent,totalEventCountersTag_); - CountersPtr l1aCounters = getCounters(nextSpyEvent,l1aCountersTag_); - CountersPtr apvAddresses = getCounters(nextSpyEvent,apvAddressesTag_,false); + CountersPtr totalEventCounters = getCounters(nextSpyEvent, totalEventCountersTag_); + CountersPtr l1aCounters = getCounters(nextSpyEvent, l1aCountersTag_); + CountersPtr apvAddresses = getCounters(nextSpyEvent, apvAddressesTag_, false); //loop over all FEDs. Maps should have same content and be in order so, avoid searches by iterating (and checking keys match) //add all possible event keys to the map std::vector::const_iterator iTotalEventCount = totalEventCounters->begin(); std::vector::const_iterator iL1ACount = l1aCounters->begin(); std::vector::const_iterator iAPVAddress = apvAddresses->begin(); //for debug - std::map fedCounts; + std::map fedCounts; unsigned int fedid = 0; - for (; - ( (iTotalEventCount != totalEventCounters->end()) && (iL1ACount != l1aCounters->end()) && (iAPVAddress != apvAddresses->end()) ); - (++iTotalEventCount, ++iL1ACount, ++iAPVAddress, ++fedid) - ){ + for (; ((iTotalEventCount != totalEventCounters->end()) && (iL1ACount != l1aCounters->end()) && + (iAPVAddress != apvAddresses->end())); + (++iTotalEventCount, ++iL1ACount, ++iAPVAddress, ++fedid)) { if (*iAPVAddress == 0) { continue; } - if ( ((*iTotalEventCount) > (*iL1ACount) ) || - ((*iL1ACount)-(*iTotalEventCount) > counterDiffMax_) - ) { - LogWarning(mlLabel_) << "Spy event " << spyEventId.event() - << " error in counter values for FED " << fedid - << ", totCount = " << *iTotalEventCount - << ", L1Acount = " << *iL1ACount - << std::endl; + if (((*iTotalEventCount) > (*iL1ACount)) || ((*iL1ACount) - (*iTotalEventCount) > counterDiffMax_)) { + LogWarning(mlLabel_) << "Spy event " << spyEventId.event() << " error in counter values for FED " << fedid + << ", totCount = " << *iTotalEventCount << ", L1Acount = " << *iL1ACount << std::endl; - continue; + continue; } - for (uint32_t eventId = (*iTotalEventCount)+1; eventId <= (*iL1ACount)+1; ++eventId) { - EventKey key(eventId,*iAPVAddress); + for (uint32_t eventId = (*iTotalEventCount) + 1; eventId <= (*iL1ACount) + 1; ++eventId) { + EventKey key(eventId, *iAPVAddress); eventMatches_[key].insert(spyEventId); fedCounts[key]++; } @@ -138,24 +138,28 @@ namespace sistrip { //for debug std::ostringstream ss; ss << "Spy event " << spyEventId.event() << " matches (eventID,apvAddress,nFEDs): "; - for (std::map::const_iterator iEventFEDCount = fedCounts.begin(); iEventFEDCount != fedCounts.end(); ++iEventFEDCount) { - ss << "(" << iEventFEDCount->first.eventId() << "," << uint16_t(iEventFEDCount->first.apvAddress()) << "," << iEventFEDCount->second << ") "; + for (std::map::const_iterator iEventFEDCount = fedCounts.begin(); + iEventFEDCount != fedCounts.end(); + ++iEventFEDCount) { + ss << "(" << iEventFEDCount->first.eventId() << "," << uint16_t(iEventFEDCount->first.apvAddress()) << "," + << iEventFEDCount->second << ") "; } LogDebug(mlLabel_) << ss.str(); } - - const SpyEventMatcher::SpyEventList* SpyEventMatcher::matchesForEvent(const uint32_t eventId, const uint8_t apvAddress) const - { - EventKey eventKey(eventId,apvAddress); - std::map::const_iterator iMatch = eventMatches_.find(eventKey); + + const SpyEventMatcher::SpyEventList* SpyEventMatcher::matchesForEvent(const uint32_t eventId, + const uint8_t apvAddress) const { + EventKey eventKey(eventId, apvAddress); + std::map::const_iterator iMatch = eventMatches_.find(eventKey); if (iMatch == eventMatches_.end()) { LogDebug(mlLabel_) << "No match found for event " << eventId << " with APV address " << uint16_t(apvAddress); return nullptr; - } - else { + } else { std::ostringstream ss; ss << "Found matches to event " << eventId << " with address " << uint16_t(apvAddress) << " in spy events "; - for (SpyEventList::const_iterator iMatchingSpyEvent = iMatch->second.begin(); iMatchingSpyEvent != iMatch->second.end(); ++iMatchingSpyEvent) { + for (SpyEventList::const_iterator iMatchingSpyEvent = iMatch->second.begin(); + iMatchingSpyEvent != iMatch->second.end(); + ++iMatchingSpyEvent) { ss << iMatchingSpyEvent->event() << " "; } LogInfo(mlLabel_) << ss.str(); @@ -163,101 +167,134 @@ namespace sistrip { } } - void SpyEventMatcher::getCollections(const edm::EventPrincipal& event, const uint32_t eventId, - const uint8_t apvAddress, const SiStripFedCabling& cabling, + void SpyEventMatcher::getCollections(const edm::EventPrincipal& event, + const uint32_t eventId, + const uint8_t apvAddress, + const SiStripFedCabling& cabling, MatchingOutput& mo) { - - //read the input collections from the event - const FEDRawDataCollection* inputRawDataPtr = getProduct< FEDRawDataCollection >(event,rawDataTag_); - if (!inputRawDataPtr) { - throw cms::Exception(mlLabel_) << "Failed to get raw spy data with tag " << rawDataTag_ << " from spy event"; - } - const FEDRawDataCollection& inputRawData = *inputRawDataPtr; - CountersPtr inputTotalEventCounters = getCounters(event,totalEventCountersTag_); - CountersPtr inputL1ACounters = getCounters(event,l1aCountersTag_); - CountersPtr inputAPVAddresses = getCounters(event,apvAddressesTag_,false); - const edm::DetSetVector* inputScopeDigis = getProduct< edm::DetSetVector >(event,scopeDigisTag_); - const edm::DetSetVector* inputPayloadDigis = getProduct< edm::DetSetVector >(event,payloadDigisTag_); - const edm::DetSetVector* inputReorderedDigis = getProduct< edm::DetSetVector >(event,reorderedDigisTag_); - const edm::DetSetVector* inputVirginRawDigis = getProduct< edm::DetSetVector >(event,virginRawDigisTag_); - //construct the output vectors if the digis were found and they do not exist - if (inputScopeDigis && !mo.outputScopeDigisVector_.get() ) mo.outputScopeDigisVector_.reset(new std::vector< edm::DetSet >); - if (inputPayloadDigis && !mo.outputPayloadDigisVector_.get() ) mo.outputPayloadDigisVector_.reset(new std::vector< edm::DetSet >); - if (inputReorderedDigis && !mo.outputReorderedDigisVector_.get() ) mo.outputReorderedDigisVector_.reset(new std::vector< edm::DetSet >); - if (inputVirginRawDigis && !mo.outputVirginRawDigisVector_.get() ) mo.outputVirginRawDigisVector_.reset(new std::vector< edm::DetSet >); - //find matching FEDs - std::set matchingFeds; - findMatchingFeds(eventId,apvAddress,inputTotalEventCounters,inputL1ACounters,inputAPVAddresses,matchingFeds); - LogInfo(mlLabel_) << "Spy event " << event.id() << " has " << matchingFeds.size() << " matching FEDs"; + //read the input collections from the event + const FEDRawDataCollection* inputRawDataPtr = getProduct(event, rawDataTag_); + if (!inputRawDataPtr) { + throw cms::Exception(mlLabel_) << "Failed to get raw spy data with tag " << rawDataTag_ << " from spy event"; + } + const FEDRawDataCollection& inputRawData = *inputRawDataPtr; + CountersPtr inputTotalEventCounters = getCounters(event, totalEventCountersTag_); + CountersPtr inputL1ACounters = getCounters(event, l1aCountersTag_); + CountersPtr inputAPVAddresses = getCounters(event, apvAddressesTag_, false); + const edm::DetSetVector* inputScopeDigis = + getProduct >(event, scopeDigisTag_); + const edm::DetSetVector* inputPayloadDigis = + getProduct >(event, payloadDigisTag_); + const edm::DetSetVector* inputReorderedDigis = + getProduct >(event, reorderedDigisTag_); + const edm::DetSetVector* inputVirginRawDigis = + getProduct >(event, virginRawDigisTag_); + //construct the output vectors if the digis were found and they do not exist + if (inputScopeDigis && !mo.outputScopeDigisVector_.get()) + mo.outputScopeDigisVector_.reset(new std::vector >); + if (inputPayloadDigis && !mo.outputPayloadDigisVector_.get()) + mo.outputPayloadDigisVector_.reset(new std::vector >); + if (inputReorderedDigis && !mo.outputReorderedDigisVector_.get()) + mo.outputReorderedDigisVector_.reset(new std::vector >); + if (inputVirginRawDigis && !mo.outputVirginRawDigisVector_.get()) + mo.outputVirginRawDigisVector_.reset(new std::vector >); + //find matching FEDs + std::set matchingFeds; + findMatchingFeds(eventId, apvAddress, inputTotalEventCounters, inputL1ACounters, inputAPVAddresses, matchingFeds); + LogInfo(mlLabel_) << "Spy event " << event.id() << " has " << matchingFeds.size() << " matching FEDs"; + std::ostringstream ss; + ss << "Matching FEDs for event " << event.id() << ": "; + for (std::set::const_iterator iFedId = matchingFeds.begin(); iFedId != matchingFeds.end(); ++iFedId) { + ss << *iFedId << " "; + } + LogDebug(mlLabel_) << ss.str(); + //check there are no duplicates + std::vector duplicateFeds(std::min(mo.alreadyMergedFeds_.size(), matchingFeds.size())); + std::vector::iterator duplicatesBegin = duplicateFeds.begin(); + std::vector::iterator duplicatesEnd = std::set_intersection(mo.alreadyMergedFeds_.begin(), + mo.alreadyMergedFeds_.end(), + matchingFeds.begin(), + matchingFeds.end(), + duplicatesBegin); + if ((duplicatesEnd - duplicatesBegin) != 0) { std::ostringstream ss; - ss << "Matching FEDs for event " << event.id() << ": "; - for (std::set::const_iterator iFedId = matchingFeds.begin(); iFedId != matchingFeds.end(); ++iFedId) { - ss << *iFedId << " "; - } - LogDebug(mlLabel_) << ss.str(); - //check there are no duplicates - std::vector duplicateFeds( std::min(mo.alreadyMergedFeds_.size(),matchingFeds.size()) ); - std::vector::iterator duplicatesBegin = duplicateFeds.begin(); - std::vector::iterator duplicatesEnd = std::set_intersection(mo.alreadyMergedFeds_.begin(),mo.alreadyMergedFeds_.end(), - matchingFeds.begin(),matchingFeds.end(), - duplicatesBegin); - if ( (duplicatesEnd-duplicatesBegin) != 0 ) { - std::ostringstream ss; - ss << "Found a match for FEDs "; - for (std::vector::const_iterator iDup = duplicatesBegin; iDup != duplicatesEnd; ++iDup) { - ss << *iDup << " "; - } - ss << ". Output SetSetVectors will be unusable!"; - LogError(mlLabel_) << ss.str(); + ss << "Found a match for FEDs "; + for (std::vector::const_iterator iDup = duplicatesBegin; iDup != duplicatesEnd; ++iDup) { + ss << *iDup << " "; } - //merge the matching data - mergeMatchingData(matchingFeds,inputRawData,inputTotalEventCounters,inputL1ACounters,inputAPVAddresses, - inputScopeDigis,inputPayloadDigis,inputReorderedDigis,inputVirginRawDigis, - mo.outputRawData_,mo.outputTotalEventCounters_,mo.outputL1ACounters_,mo.outputAPVAddresses_, - mo.outputScopeDigisVector_.get(),mo.outputPayloadDigisVector_.get(), - mo.outputReorderedDigisVector_.get(),mo.outputVirginRawDigisVector_.get(), - cabling); - mo.alreadyMergedFeds_.insert(matchingFeds.begin(),matchingFeds.end()); + ss << ". Output SetSetVectors will be unusable!"; + LogError(mlLabel_) << ss.str(); + } + //merge the matching data + mergeMatchingData(matchingFeds, + inputRawData, + inputTotalEventCounters, + inputL1ACounters, + inputAPVAddresses, + inputScopeDigis, + inputPayloadDigis, + inputReorderedDigis, + inputVirginRawDigis, + mo.outputRawData_, + mo.outputTotalEventCounters_, + mo.outputL1ACounters_, + mo.outputAPVAddresses_, + mo.outputScopeDigisVector_.get(), + mo.outputPayloadDigisVector_.get(), + mo.outputReorderedDigisVector_.get(), + mo.outputVirginRawDigisVector_.get(), + cabling); + mo.alreadyMergedFeds_.insert(matchingFeds.begin(), matchingFeds.end()); } - void SpyEventMatcher::getMatchedCollections(const uint32_t eventId, const uint8_t apvAddress, - const SpyEventList* matchingEvents, const SiStripFedCabling& cabling, - SpyDataCollections& collectionsToCreate) - { - if (!matchingEvents) return; + void SpyEventMatcher::getMatchedCollections(const uint32_t eventId, + const uint8_t apvAddress, + const SpyEventList* matchingEvents, + const SiStripFedCabling& cabling, + SpyDataCollections& collectionsToCreate) { + if (!matchingEvents) + return; size_t fileNameHash = 0U; FEDRawDataCollection outputRawData; MatchingOutput mo(outputRawData); - source_->loopSpecified(*eventPrincipal_,fileNameHash,matchingEvents->begin(),matchingEvents->end(), - [&](auto const& iE, auto const&){ this->getCollections(iE,eventId,apvAddress,cabling,mo); }); - collectionsToCreate = SpyDataCollections(mo.outputRawData_,mo.outputTotalEventCounters_,mo.outputL1ACounters_,mo.outputAPVAddresses_, - mo.outputScopeDigisVector_.get(),mo.outputPayloadDigisVector_.get(), - mo.outputReorderedDigisVector_.get(),mo.outputVirginRawDigisVector_.get()); + source_->loopSpecified( + *eventPrincipal_, + fileNameHash, + matchingEvents->begin(), + matchingEvents->end(), + [&](auto const& iE, auto const&) { this->getCollections(iE, eventId, apvAddress, cabling, mo); }); + collectionsToCreate = SpyDataCollections(mo.outputRawData_, + mo.outputTotalEventCounters_, + mo.outputL1ACounters_, + mo.outputAPVAddresses_, + mo.outputScopeDigisVector_.get(), + mo.outputPayloadDigisVector_.get(), + mo.outputReorderedDigisVector_.get(), + mo.outputVirginRawDigisVector_.get()); } - - void SpyEventMatcher::findMatchingFeds(const uint32_t eventId, const uint8_t apvAddress, + + void SpyEventMatcher::findMatchingFeds(const uint32_t eventId, + const uint8_t apvAddress, SpyEventMatcher::CountersPtr totalEventCounters, SpyEventMatcher::CountersPtr l1aCounters, SpyEventMatcher::CountersPtr apvAddresses, - std::set& matchingFeds) - { + std::set& matchingFeds) { //loop over all FEDs. Maps should have same content and be in order so, avoid searches by iterating (and checking keys match) std::vector::const_iterator iTotalEventCount = totalEventCounters->begin(); std::vector::const_iterator iL1ACount = l1aCounters->begin(); std::vector::const_iterator iAPVAddress = apvAddresses->begin(); - for (; - ( (iTotalEventCount != totalEventCounters->end()) && (iL1ACount != l1aCounters->end()) && (iAPVAddress != apvAddresses->end()) ); - (++iTotalEventCount, ++iL1ACount, ++iAPVAddress) - ){ + for (; ((iTotalEventCount != totalEventCounters->end()) && (iL1ACount != l1aCounters->end()) && + (iAPVAddress != apvAddresses->end())); + (++iTotalEventCount, ++iL1ACount, ++iAPVAddress)) { if (*iAPVAddress == 0) { continue; } - if ( (eventId > *iTotalEventCount) && (eventId <= (*iL1ACount)+1) && (*iAPVAddress == apvAddress) ) { - matchingFeds.insert(matchingFeds.end(),iTotalEventCount-totalEventCounters->begin()); + if ((eventId > *iTotalEventCount) && (eventId <= (*iL1ACount) + 1) && (*iAPVAddress == apvAddress)) { + matchingFeds.insert(matchingFeds.end(), iTotalEventCount - totalEventCounters->begin()); } } } - + void SpyEventMatcher::mergeMatchingData(const std::set& matchingFeds, const FEDRawDataCollection& inputRawData, SpyEventMatcher::CountersPtr inputTotalEventCounters, @@ -271,24 +308,27 @@ namespace sistrip { std::vector& outputTotalEventCounters, std::vector& outputL1ACounters, std::vector& outputAPVAddresses, - std::vector< edm::DetSet >* outputScopeDigisVector, - std::vector< edm::DetSet >* outputPayloadDigisVector, - std::vector< edm::DetSet >* outputReorderedDigisVector, - std::vector< edm::DetSet >* outputVirginRawDigisVector, - const SiStripFedCabling& cabling) - { + std::vector >* outputScopeDigisVector, + std::vector >* outputPayloadDigisVector, + std::vector >* outputReorderedDigisVector, + std::vector >* outputVirginRawDigisVector, + const SiStripFedCabling& cabling) { //reserve space in vectors if (inputScopeDigis) { - outputScopeDigisVector->reserve(outputScopeDigisVector->size()+matchingFeds.size()*FEDCH_PER_FED); //maximum number of channels on matching FEDs + outputScopeDigisVector->reserve(outputScopeDigisVector->size() + + matchingFeds.size() * + FEDCH_PER_FED); //maximum number of channels on matching FEDs } if (inputPayloadDigis) { - outputPayloadDigisVector->reserve(outputPayloadDigisVector->size()+matchingFeds.size()*FEDCH_PER_FED); + outputPayloadDigisVector->reserve(outputPayloadDigisVector->size() + matchingFeds.size() * FEDCH_PER_FED); } if (inputReorderedDigis) { - outputReorderedDigisVector->reserve(outputReorderedDigisVector->size()+matchingFeds.size()*FEDCH_PER_FED); + outputReorderedDigisVector->reserve(outputReorderedDigisVector->size() + matchingFeds.size() * FEDCH_PER_FED); } if (inputVirginRawDigis) { - outputVirginRawDigisVector->reserve(outputVirginRawDigisVector->size()+matchingFeds.size()*FEDCH_PER_FED/2); //maximum number of dets on matching FEDs + outputVirginRawDigisVector->reserve(outputVirginRawDigisVector->size() + + matchingFeds.size() * FEDCH_PER_FED / + 2); //maximum number of dets on matching FEDs } //copy the data into output collections std::set usedDetIds; @@ -302,7 +342,8 @@ namespace sistrip { outputL1ACounters[fedId] = (*inputL1ACounters)[fedId]; outputAPVAddresses[fedId] = (*inputAPVAddresses)[fedId]; for (uint8_t chan = 0; chan < FEDCH_PER_FED; ++chan) { - uint32_t fedIndex = ( ( fedId & sistrip::invalid_ ) << 16 ) | ( chan & sistrip::invalid_ ) ;; + uint32_t fedIndex = ((fedId & sistrip::invalid_) << 16) | (chan & sistrip::invalid_); + ; if (inputScopeDigis) { edm::DetSetVector::const_iterator iScopeDigis = inputScopeDigis->find(fedIndex); if (iScopeDigis != inputScopeDigis->end()) { @@ -326,7 +367,8 @@ namespace sistrip { std::set fedDetIds; auto conns = cabling.fedConnections(fedId); for (auto iConn = conns.begin(); iConn != conns.end(); ++iConn) { - if (!iConn->isConnected()) continue; + if (!iConn->isConnected()) + continue; const uint32_t detId = iConn->detId(); if (usedDetIds.find(detId) != usedDetIds.end()) { LogError(mlLabel_) << "Duplicate DetID found " << detId << " skipping data for this Det from FED " << fedId; @@ -334,7 +376,7 @@ namespace sistrip { } fedDetIds.insert(iConn->detId()); } - usedDetIds.insert(fedDetIds.begin(),fedDetIds.end()); + usedDetIds.insert(fedDetIds.begin(), fedDetIds.end()); for (std::set::const_iterator iDetId = fedDetIds.begin(); iDetId != fedDetIds.end(); ++iDetId) { edm::DetSetVector::const_iterator iVirginRawDigis = inputVirginRawDigis->find(*iDetId); if (iVirginRawDigis != inputVirginRawDigis->end()) { @@ -344,93 +386,88 @@ namespace sistrip { } } } - - SpyEventMatcher::CountersPtr SpyEventMatcher::getCounters(const edm::EventPrincipal& event, const edm::InputTag& tag, const bool mapKeyIsByFedID) - { - const std::vector* vectorFromEvent = getProduct< std::vector >(event,tag); + + SpyEventMatcher::CountersPtr SpyEventMatcher::getCounters(const edm::EventPrincipal& event, + const edm::InputTag& tag, + const bool mapKeyIsByFedID) { + const std::vector* vectorFromEvent = getProduct >(event, tag); if (vectorFromEvent) { //vector is from event so, will be deleted when the event is destroyed (and not before) - return CountersPtr(new CountersWrapper(vectorFromEvent) ); + return CountersPtr(new CountersWrapper(vectorFromEvent)); } else { - const std::map* mapFromEvent = getProduct< std::map >(event,tag); + const std::map* mapFromEvent = getProduct >(event, tag); if (mapFromEvent) { - std::vector* newVector = new std::vector(FED_ID_MAX+1,0); + std::vector* newVector = new std::vector(FED_ID_MAX + 1, 0); if (mapKeyIsByFedID) { - for (std::map::const_iterator iIdValue = mapFromEvent->begin(); iIdValue != mapFromEvent->end(); ++iIdValue) { + for (std::map::const_iterator iIdValue = mapFromEvent->begin(); + iIdValue != mapFromEvent->end(); + ++iIdValue) { newVector->at(iIdValue->first) = iIdValue->second; } } else { - SpyUtilities::fillFEDMajorities(*mapFromEvent,*newVector); + SpyUtilities::fillFEDMajorities(*mapFromEvent, *newVector); } -// std::cout << " -- Map " << tag << std::endl; -// for (uint32_t lIt= 0; -// lIt < newVector->size(); -// lIt++) { -// std::cout << lIt << " " << newVector->at(lIt) << std::endl; -// } + // std::cout << " -- Map " << tag << std::endl; + // for (uint32_t lIt= 0; + // lIt < newVector->size(); + // lIt++) { + // std::cout << lIt << " " << newVector->at(lIt) << std::endl; + // } //vector was allocated here so, will need to be deleted when finished with - CountersPtr newCountersPtr( new CountersWrapper(newVector,true) ); + CountersPtr newCountersPtr(new CountersWrapper(newVector, true)); return newCountersPtr; } else { throw cms::Exception(mlLabel_) << "Unable to get product " << tag << " from spy event"; } } } - - SpyEventMatcher::SpyDataCollections::SpyDataCollections(FEDRawDataCollection& theRawData, - std::vector& theTotalEventCounters, - std::vector& theL1ACounters, - std::vector& theAPVAddresses, - std::vector< edm::DetSet >* theScopeDigisVector, - std::vector< edm::DetSet >* thePayloadDigisVector, - std::vector< edm::DetSet >* theReorderedDigisVector, - std::vector< edm::DetSet >* theVirginRawDigisVector) - : rawData(new FEDRawDataCollection), - totalEventCounters(new std::vector), - l1aCounters(new std::vector), - apvAddresses(new std::vector), - scopeDigis(theScopeDigisVector ? new edm::DetSetVector(*theScopeDigisVector) : nullptr), - payloadDigis(thePayloadDigisVector ? new edm::DetSetVector(*thePayloadDigisVector) : nullptr), - reorderedDigis(theReorderedDigisVector ? new edm::DetSetVector(*theReorderedDigisVector) : nullptr), - virginRawDigis(theVirginRawDigisVector ? new edm::DetSetVector(*theVirginRawDigisVector) : nullptr) - { + + SpyEventMatcher::SpyDataCollections::SpyDataCollections( + FEDRawDataCollection& theRawData, + std::vector& theTotalEventCounters, + std::vector& theL1ACounters, + std::vector& theAPVAddresses, + std::vector >* theScopeDigisVector, + std::vector >* thePayloadDigisVector, + std::vector >* theReorderedDigisVector, + std::vector >* theVirginRawDigisVector) + : rawData(new FEDRawDataCollection), + totalEventCounters(new std::vector), + l1aCounters(new std::vector), + apvAddresses(new std::vector), + scopeDigis(theScopeDigisVector ? new edm::DetSetVector(*theScopeDigisVector) : nullptr), + payloadDigis(thePayloadDigisVector ? new edm::DetSetVector(*thePayloadDigisVector) : nullptr), + reorderedDigis(theReorderedDigisVector ? new edm::DetSetVector(*theReorderedDigisVector) + : nullptr), + virginRawDigis(theVirginRawDigisVector ? new edm::DetSetVector(*theVirginRawDigisVector) + : nullptr) { rawData->swap(theRawData); totalEventCounters->swap(theTotalEventCounters); l1aCounters->swap(theL1ACounters); apvAddresses->swap(theAPVAddresses); } - + SpyEventMatcher::SpyDataCollections::SpyDataCollections() - : rawData(), - totalEventCounters(), - l1aCounters(), - apvAddresses(), - scopeDigis(), - payloadDigis(), - reorderedDigis(), - virginRawDigis() - {} - + : rawData(), + totalEventCounters(), + l1aCounters(), + apvAddresses(), + scopeDigis(), + payloadDigis(), + reorderedDigis(), + virginRawDigis() {} + SpyEventMatcher::CountersWrapper::CountersWrapper(const Counters* theCounters) - : pConst(theCounters), - p(nullptr), - deleteP(false) - { - } - + : pConst(theCounters), p(nullptr), deleteP(false) {} + SpyEventMatcher::CountersWrapper::CountersWrapper(Counters* theCounters, const bool takeOwnership) - : pConst(theCounters), - p(theCounters), - deleteP(takeOwnership) - { + : pConst(theCounters), p(theCounters), deleteP(takeOwnership) {} + SpyEventMatcher::CountersWrapper::~CountersWrapper() { + if (deleteP) + delete p; } - - SpyEventMatcher::CountersWrapper::~CountersWrapper() - { - if (deleteP) delete p; - } - -} -#endif //SiStripMonitorHardware_BuildEventMatchingCode +} // namespace sistrip + +#endif //SiStripMonitorHardware_BuildEventMatchingCode diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcherModule.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcherModule.cc index 98ed471ab01a1..07dc71ef024ab 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcherModule.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyEventMatcherModule.cc @@ -26,101 +26,103 @@ using edm::LogError; using edm::LogInfo; namespace sistrip { - - class SpyEventMatcherModule : public edm::EDFilter - { - public: - SpyEventMatcherModule(const edm::ParameterSet& config); - ~SpyEventMatcherModule() override; - void beginJob() override; - bool filter(edm::Event& event, const edm::EventSetup& eventSetup) override; - private: - void findL1IDandAPVAddress(const edm::Event& event, const SiStripFedCabling& cabling, uint32_t& l1ID, uint8_t& apvAddress) const; - void copyData(const uint32_t eventId, const uint8_t apvAddress, const SpyEventMatcher::SpyEventList* matches, edm::Event& event, - const SiStripFedCabling& cabling) const; - - static const char* messageLabel_; - const bool filterNonMatchingEvents_; - const bool doMerge_; - const edm::InputTag primaryStreamRawDataTag_; + + class SpyEventMatcherModule : public edm::EDFilter { + public: + SpyEventMatcherModule(const edm::ParameterSet& config); + ~SpyEventMatcherModule() override; + void beginJob() override; + bool filter(edm::Event& event, const edm::EventSetup& eventSetup) override; + + private: + void findL1IDandAPVAddress(const edm::Event& event, + const SiStripFedCabling& cabling, + uint32_t& l1ID, + uint8_t& apvAddress) const; + void copyData(const uint32_t eventId, + const uint8_t apvAddress, + const SpyEventMatcher::SpyEventList* matches, + edm::Event& event, + const SiStripFedCabling& cabling) const; + + static const char* messageLabel_; + const bool filterNonMatchingEvents_; + const bool doMerge_; + const edm::InputTag primaryStreamRawDataTag_; edm::EDGetTokenT primaryStreamRawDataToken_; - std::unique_ptr spyEventMatcher_; - std::unique_ptr utils_; + std::unique_ptr spyEventMatcher_; + std::unique_ptr utils_; }; - -} + +} // namespace sistrip namespace sistrip { - + const char* SpyEventMatcherModule::messageLabel_ = "SiStripSpyDataMergeModule"; - + SpyEventMatcherModule::SpyEventMatcherModule(const edm::ParameterSet& config) - : filterNonMatchingEvents_( config.getParameter("FilterNonMatchingEvents") ), - doMerge_( config.getParameter("MergeData") ), - primaryStreamRawDataTag_( config.getParameter("PrimaryEventRawDataTag") ), - spyEventMatcher_(new SpyEventMatcher(config)), - utils_(new SpyUtilities) - { + : filterNonMatchingEvents_(config.getParameter("FilterNonMatchingEvents")), + doMerge_(config.getParameter("MergeData")), + primaryStreamRawDataTag_(config.getParameter("PrimaryEventRawDataTag")), + spyEventMatcher_(new SpyEventMatcher(config)), + utils_(new SpyUtilities) { primaryStreamRawDataToken_ = consumes(primaryStreamRawDataTag_); if (doMerge_) { produces("RawSpyData"); - produces< std::vector >("SpyTotalEventCount"); - produces< std::vector >("SpyL1ACount"); - produces< std::vector >("SpyAPVAddress"); - produces< edm::DetSetVector >("SpyScope"); - produces< edm::DetSetVector >("SpyPayload"); - produces< edm::DetSetVector >("SpyReordered"); - produces< edm::DetSetVector >("SpyVirginRaw"); + produces >("SpyTotalEventCount"); + produces >("SpyL1ACount"); + produces >("SpyAPVAddress"); + produces >("SpyScope"); + produces >("SpyPayload"); + produces >("SpyReordered"); + produces >("SpyVirginRaw"); } } - - SpyEventMatcherModule::~SpyEventMatcherModule() - { - } - - void SpyEventMatcherModule::beginJob() - { - spyEventMatcher_->initialize(); - } - - bool SpyEventMatcherModule::filter(edm::Event& event, const edm::EventSetup& eventSetup) - { + + SpyEventMatcherModule::~SpyEventMatcherModule() {} + + void SpyEventMatcherModule::beginJob() { spyEventMatcher_->initialize(); } + + bool SpyEventMatcherModule::filter(edm::Event& event, const edm::EventSetup& eventSetup) { const SiStripFedCabling& cabling = *(utils_->getCabling(eventSetup)); uint8_t apvAddress = 0; uint32_t eventId = 0; try { - findL1IDandAPVAddress(event,cabling,eventId,apvAddress); + findL1IDandAPVAddress(event, cabling, eventId, apvAddress); } catch (const cms::Exception& e) { LogError(messageLabel_) << e.what(); - return ( filterNonMatchingEvents_ ? false : true ); + return (filterNonMatchingEvents_ ? false : true); } - const SpyEventMatcher::SpyEventList* matches = spyEventMatcher_->matchesForEvent(eventId,apvAddress); + const SpyEventMatcher::SpyEventList* matches = spyEventMatcher_->matchesForEvent(eventId, apvAddress); if (matches) { if (doMerge_) { - copyData(eventId,apvAddress,matches,event,cabling); + copyData(eventId, apvAddress, matches, event, cabling); } return true; } else { - return ( filterNonMatchingEvents_ ? false : true ); + return (filterNonMatchingEvents_ ? false : true); } } - - void SpyEventMatcherModule::findL1IDandAPVAddress(const edm::Event& event, const SiStripFedCabling& cabling, uint32_t& l1ID, uint8_t& apvAddress) const - { + + void SpyEventMatcherModule::findL1IDandAPVAddress(const edm::Event& event, + const SiStripFedCabling& cabling, + uint32_t& l1ID, + uint8_t& apvAddress) const { edm::Handle fedRawDataHandle; - event.getByToken(primaryStreamRawDataToken_,fedRawDataHandle); + event.getByToken(primaryStreamRawDataToken_, fedRawDataHandle); const FEDRawDataCollection& fedRawData = *fedRawDataHandle; for (auto iFedId = cabling.fedIds().begin(); iFedId != cabling.fedIds().end(); ++iFedId) { const FEDRawData& data = fedRawData.FEDData(*iFedId); - if ( (!data.data()) || (!data.size()) ) { + if ((!data.data()) || (!data.size())) { LogDebug(messageLabel_) << "Failed to get FED data for FED ID " << *iFedId; continue; } std::unique_ptr buffer; try { - buffer.reset(new FEDBuffer(data.data(),data.size())); + buffer.reset(new FEDBuffer(data.data(), data.size())); } catch (const cms::Exception& e) { - LogDebug(messageLabel_) << "Failed to build FED buffer for FED ID " << *iFedId << ". Exception was " << e.what(); + LogDebug(messageLabel_) << "Failed to build FED buffer for FED ID " << *iFedId << ". Exception was " + << e.what(); continue; } if (!buffer->doChecks(true)) { @@ -141,10 +143,10 @@ namespace sistrip { if (!iConn->isConnected()) { continue; } - if ( !buffer->channelGood(iConn->fedCh(), true) ) { + if (!buffer->channelGood(iConn->fedCh(), true)) { continue; } else { - apvAddress = header->feUnitMajorityAddress(iConn->fedCh()/FEDCH_PER_FEUNIT); + apvAddress = header->feUnitMajorityAddress(iConn->fedCh() / FEDCH_PER_FEUNIT); return; } } @@ -153,26 +155,36 @@ namespace sistrip { //if we haven't already found an acceptable alternative, throw an exception throw cms::Exception(messageLabel_) << "Failed to get L1ID/APV address from any FED"; } - - void SpyEventMatcherModule::copyData(const uint32_t eventId, const uint8_t apvAddress, const SpyEventMatcher::SpyEventList* matches, edm::Event& event, - const SiStripFedCabling& cabling) const - { + + void SpyEventMatcherModule::copyData(const uint32_t eventId, + const uint8_t apvAddress, + const SpyEventMatcher::SpyEventList* matches, + edm::Event& event, + const SiStripFedCabling& cabling) const { SpyEventMatcher::SpyDataCollections matchedCollections; - spyEventMatcher_->getMatchedCollections(eventId,apvAddress,matches,cabling,matchedCollections); - if (matchedCollections.rawData.get()) event.put(std::move(matchedCollections.rawData),"RawSpyData"); - if (matchedCollections.totalEventCounters.get()) event.put(std::move(matchedCollections.totalEventCounters),"SpyTotalEventCount"); - if (matchedCollections.l1aCounters.get()) event.put(std::move(matchedCollections.l1aCounters),"SpyL1ACount"); - if (matchedCollections.apvAddresses.get()) event.put(std::move(matchedCollections.apvAddresses),"SpyAPVAddress"); - if (matchedCollections.scopeDigis.get()) event.put(std::move(matchedCollections.scopeDigis),"SpyScope"); - if (matchedCollections.payloadDigis.get()) event.put(std::move(matchedCollections.payloadDigis),"SpyPayload"); - if (matchedCollections.reorderedDigis.get()) event.put(std::move(matchedCollections.reorderedDigis),"SpyReordered"); - if (matchedCollections.virginRawDigis.get()) event.put(std::move(matchedCollections.virginRawDigis),"SpyVirginRaw"); + spyEventMatcher_->getMatchedCollections(eventId, apvAddress, matches, cabling, matchedCollections); + if (matchedCollections.rawData.get()) + event.put(std::move(matchedCollections.rawData), "RawSpyData"); + if (matchedCollections.totalEventCounters.get()) + event.put(std::move(matchedCollections.totalEventCounters), "SpyTotalEventCount"); + if (matchedCollections.l1aCounters.get()) + event.put(std::move(matchedCollections.l1aCounters), "SpyL1ACount"); + if (matchedCollections.apvAddresses.get()) + event.put(std::move(matchedCollections.apvAddresses), "SpyAPVAddress"); + if (matchedCollections.scopeDigis.get()) + event.put(std::move(matchedCollections.scopeDigis), "SpyScope"); + if (matchedCollections.payloadDigis.get()) + event.put(std::move(matchedCollections.payloadDigis), "SpyPayload"); + if (matchedCollections.reorderedDigis.get()) + event.put(std::move(matchedCollections.reorderedDigis), "SpyReordered"); + if (matchedCollections.virginRawDigis.get()) + event.put(std::move(matchedCollections.virginRawDigis), "SpyVirginRaw"); } - -} + +} // namespace sistrip #include "FWCore/Framework/interface/MakerMacros.h" typedef sistrip::SpyEventMatcherModule SiStripSpyEventMatcherModule; DEFINE_FWK_MODULE(SiStripSpyEventMatcherModule); -#endif //SiStripMonitorHardware_BuildEventMatchingCode +#endif //SiStripMonitorHardware_BuildEventMatchingCode diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyEventSummaryProducer.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyEventSummaryProducer.cc index fbbdf078c9746..afee1da01766e 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyEventSummaryProducer.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyEventSummaryProducer.cc @@ -1,6 +1,6 @@ -//Class to produce a dummy SiStripEventSummary object so that spy channel data can be used with commissioning software. -//Run types which need additional parameters from the trigger FED buffer or DAQ registers are not supported. -//If an unsupported run type is used, an error message will be printed and parameters will be set to zero. +//Class to produce a dummy SiStripEventSummary object so that spy channel data can be used with commissioning software. +//Run types which need additional parameters from the trigger FED buffer or DAQ registers are not supported. +//If an unsupported run type is used, an error message will be printed and parameters will be set to zero. //Author: Nick Cripps //Date: 10/05/2010 @@ -26,49 +26,47 @@ #include "boost/cstdint.hpp" using edm::LogError; -using edm::LogWarning; using edm::LogInfo; +using edm::LogWarning; namespace sistrip { - - class SpyEventSummaryProducer : public edm::EDProducer - { - public: - SpyEventSummaryProducer(const edm::ParameterSet& config); - ~SpyEventSummaryProducer() override; - void produce(edm::Event& event, const edm::EventSetup&) override; - private: - void warnAboutUnsupportedRunType(); - static const char* messageLabel_; - const edm::InputTag rawDataTag_; + + class SpyEventSummaryProducer : public edm::EDProducer { + public: + SpyEventSummaryProducer(const edm::ParameterSet& config); + ~SpyEventSummaryProducer() override; + void produce(edm::Event& event, const edm::EventSetup&) override; + + private: + void warnAboutUnsupportedRunType(); + static const char* messageLabel_; + const edm::InputTag rawDataTag_; edm::EDGetTokenT rawDataToken_; - const sistrip::RunType runType_; + const sistrip::RunType runType_; }; - -} + +} // namespace sistrip namespace sistrip { - + const char* SpyEventSummaryProducer::messageLabel_ = "SiStripSpyEventSummaryProducer"; - + SpyEventSummaryProducer::SpyEventSummaryProducer(const edm::ParameterSet& config) - : rawDataTag_(config.getParameter("RawDataTag")), - runType_(sistrip::RunType(config.getParameter("RunType"))) - { + : rawDataTag_(config.getParameter("RawDataTag")), + runType_(sistrip::RunType(config.getParameter("RunType"))) { rawDataToken_ = consumes(rawDataTag_); produces(); warnAboutUnsupportedRunType(); } - + SpyEventSummaryProducer::~SpyEventSummaryProducer() {} - - void SpyEventSummaryProducer::produce(edm::Event& event, const edm::EventSetup&) - { + + void SpyEventSummaryProducer::produce(edm::Event& event, const edm::EventSetup&) { warnAboutUnsupportedRunType(); - + //get the event number and Bx counter from the first valud FED buffer edm::Handle rawDataHandle; - event.getByToken(rawDataToken_,rawDataHandle); + event.getByToken(rawDataToken_, rawDataHandle); const FEDRawDataCollection& rawData = *rawDataHandle; bool fedFound = false; uint32_t fedEventNumber = 0; @@ -78,7 +76,7 @@ namespace sistrip { if (fedData.size() && fedData.data()) { std::unique_ptr pBuffer; try { - pBuffer.reset(new sistrip::FEDBufferBase(fedData.data(),fedData.size())); + pBuffer.reset(new sistrip::FEDBufferBase(fedData.data(), fedData.size())); } catch (const cms::Exception& e) { LogInfo(messageLabel_) << "Skipping FED " << fedId << " because of exception: " << e.what(); continue; @@ -93,7 +91,7 @@ namespace sistrip { LogError(messageLabel_) << "No SiStrip FED data found in raw data."; return; } - + //create summary object std::unique_ptr pSummary(new SiStripEventSummary); //set the trigger FED number to zero to indicate that it doesn't exist @@ -104,7 +102,7 @@ namespace sistrip { //create a fake trigger FED buffer to take comissioning parameters from const int maxTriggerFedBufferSize = 84; boost::scoped_array fakeTriggerFedData(new uint32_t[maxTriggerFedBufferSize]); - for (uint8_t i=0; icommissioningInfo(fakeTriggerFedData.get(),fedEventNumber); - + pSummary->commissioningInfo(fakeTriggerFedData.get(), fedEventNumber); + //store in event event.put(std::move(pSummary)); } - - void SpyEventSummaryProducer::warnAboutUnsupportedRunType() - { - switch(runType_) { + + void SpyEventSummaryProducer::warnAboutUnsupportedRunType() { + switch (runType_) { case sistrip::DAQ_SCOPE_MODE: case sistrip::PHYSICS: case sistrip::PHYSICS_ZS: @@ -151,12 +148,13 @@ namespace sistrip { case sistrip::FED_CABLING: case sistrip::QUITE_FAST_CABLING: case sistrip::VPSP_SCAN: - LogWarning(messageLabel_) << "Unsupported run type: " << runType_ << ". Parameters need to be set from real trigger FED. Parameters will be set to 0."; + LogWarning(messageLabel_) << "Unsupported run type: " << runType_ + << ". Parameters need to be set from real trigger FED. Parameters will be set to 0."; break; } } - -} + +} // namespace sistrip typedef sistrip::SpyEventSummaryProducer SiStripSpyEventSummaryProducer; DEFINE_FWK_MODULE(SiStripSpyEventSummaryProducer); diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyExtractRunModule.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyExtractRunModule.cc index 53b5646bb2c75..a2a3b98027950 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyExtractRunModule.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyExtractRunModule.cc @@ -32,15 +32,12 @@ // namespace sistrip { - class SpyExtractRunModule : public edm::EDAnalyzer - { + class SpyExtractRunModule : public edm::EDAnalyzer { public: - explicit SpyExtractRunModule(const edm::ParameterSet&); ~SpyExtractRunModule() override; private: - void beginJob() override; void analyze(const edm::Event&, const edm::EventSetup&) override; void endJob() override; @@ -62,109 +59,86 @@ namespace sistrip { //error counter for number of times the run number changes uint32_t errCounter_; - }; -}//namespace +} // namespace sistrip using edm::LogError; -using edm::LogWarning; using edm::LogInfo; +using edm::LogWarning; // // Constructors and destructor // namespace sistrip { SpyExtractRunModule::SpyExtractRunModule(const edm::ParameterSet& iConfig) - : fileName_(iConfig.getParameter("OutputTextFile")), - runTag_(iConfig.getParameter("RunNumberTag")), - currentRun_(0), - previousRun_(0), - errCounter_(0) - { + : fileName_(iConfig.getParameter("OutputTextFile")), + runTag_(iConfig.getParameter("RunNumberTag")), + currentRun_(0), + previousRun_(0), + errCounter_(0) { runToken_ = consumes(runTag_); } + SpyExtractRunModule::~SpyExtractRunModule() {} - SpyExtractRunModule::~SpyExtractRunModule() { - - } - - void SpyExtractRunModule::beginJob() - { + void SpyExtractRunModule::beginJob() { currentRun_ = 0; previousRun_ = 0; errCounter_ = 0; - } - void SpyExtractRunModule::analyze(const edm::Event& aEvt, const edm::EventSetup& aSetup) - { - + void SpyExtractRunModule::analyze(const edm::Event& aEvt, const edm::EventSetup& aSetup) { static bool lFirstEvent = true; edm::Handle lRun; - aEvt.getByToken( runToken_, lRun ); + aEvt.getByToken(runToken_, lRun); const bool isUpdated = updateRun(*lRun); - if (isUpdated && !lFirstEvent){ - edm::LogError("SpyExtractRunModule") << " -- Run number changed for event : " << aEvt.id().event() - << " (id().run() = " << aEvt.id().run() - << ") from " << previousRun_ << " to " << currentRun_ - << std::endl; + if (isUpdated && !lFirstEvent) { + edm::LogError("SpyExtractRunModule") + << " -- Run number changed for event : " << aEvt.id().event() << " (id().run() = " << aEvt.id().run() + << ") from " << previousRun_ << " to " << currentRun_ << std::endl; } - lFirstEvent = false; - } - void SpyExtractRunModule::endJob() { - //save global run number in text file in local directory //output loginfo with number of errors //or throw exception ? - - if (errCounter_ == 1){ - edm::LogInfo("SiStripSpyExtractRun") << " -- Writting run number " << currentRun_ - << " into file " << fileName_ - << std::endl; + if (errCounter_ == 1) { + edm::LogInfo("SiStripSpyExtractRun") + << " -- Writting run number " << currentRun_ << " into file " << fileName_ << std::endl; std::ofstream lOutFile; - lOutFile.open(fileName_.c_str(),std::ios::out); + lOutFile.open(fileName_.c_str(), std::ios::out); if (!lOutFile.is_open()) { - edm::LogError("SiStripSpyExtractRun") << " -- Cannot open file : " << fileName_ << " for writting run number " - << currentRun_ - << std::endl; - } - else { - lOutFile << currentRun_ << std::endl; - lOutFile.close(); + edm::LogError("SiStripSpyExtractRun") + << " -- Cannot open file : " << fileName_ << " for writting run number " << currentRun_ << std::endl; + } else { + lOutFile << currentRun_ << std::endl; + lOutFile.close(); } + } else { + edm::LogError("SiStripSpyExtractRun") + << " -- Number of times the run number changed in this job = " << errCounter_ + << ", currentRun = " << currentRun_ << ", previousRun = " << previousRun_ << std::endl; } - else { - edm::LogError("SiStripSpyExtractRun") << " -- Number of times the run number changed in this job = " << errCounter_ - << ", currentRun = " << currentRun_ - << ", previousRun = " << previousRun_ - << std::endl; - } - - } const bool SpyExtractRunModule::updateRun(const uint32_t aRun) { - if (aRun != currentRun_){ + if (aRun != currentRun_) { previousRun_ = currentRun_; currentRun_ = aRun; errCounter_++; return true; } return false; - } -}//namespace +} // namespace sistrip #include "FWCore/Framework/interface/MakerMacros.h" typedef sistrip::SpyExtractRunModule SiStripSpyExtractRunModule; diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyIdentifyRuns.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyIdentifyRuns.cc index 4ec29a6e060a1..4fd9c3b2ff126 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyIdentifyRuns.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyIdentifyRuns.cc @@ -10,7 +10,6 @@ #include #include - #include "FWCore/Utilities/interface/EDGetToken.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/EDAnalyzer.h" @@ -35,21 +34,18 @@ // namespace sistrip { - class SpyIdentifyRunsModule : public edm::EDAnalyzer - { + class SpyIdentifyRunsModule : public edm::EDAnalyzer { public: - explicit SpyIdentifyRunsModule(const edm::ParameterSet&); ~SpyIdentifyRunsModule() override; private: - void beginJob() override; void analyze(const edm::Event&, const edm::EventSetup&) override; void endJob() override; void writeRunInFile(const unsigned int aRunNumber); - + //name of the output file containing the run numbers //of spy runs std::string fileName_; @@ -59,113 +55,97 @@ namespace sistrip { edm::InputTag srcTag_; edm::EDGetTokenT srcToken_; uint32_t prevRun_; - }; -}//namespace +} // namespace sistrip using edm::LogError; -using edm::LogWarning; using edm::LogInfo; +using edm::LogWarning; // // Constructors and destructor // namespace sistrip { SpyIdentifyRunsModule::SpyIdentifyRunsModule(const edm::ParameterSet& iConfig) - : fileName_(iConfig.getParameter("OutputTextFile")), - srcTag_(iConfig.getParameter("InputProductLabel")), - prevRun_(0) - { + : fileName_(iConfig.getParameter("OutputTextFile")), + srcTag_(iConfig.getParameter("InputProductLabel")), + prevRun_(0) { srcToken_ = consumes(srcTag_); } + SpyIdentifyRunsModule::~SpyIdentifyRunsModule() {} - SpyIdentifyRunsModule::~SpyIdentifyRunsModule() { - - } - - void SpyIdentifyRunsModule::beginJob() - { - outFile_.open(fileName_.c_str(),std::ios::out); + void SpyIdentifyRunsModule::beginJob() { + outFile_.open(fileName_.c_str(), std::ios::out); if (!outFile_.is_open()) { - edm::LogError("SiStripSpyIdentifyRuns") << " -- Cannot open file : " << fileName_ << " for writting." - << std::endl; - edm::LogInfo("SiStripSpyIdentifyRuns") << " *** SPY RUNS *** "<< std::endl; + edm::LogError("SiStripSpyIdentifyRuns") + << " -- Cannot open file : " << fileName_ << " for writting." << std::endl; + edm::LogInfo("SiStripSpyIdentifyRuns") << " *** SPY RUNS *** " << std::endl; - } - else { + } else { outFile_ << " *** SPY RUNS *** " << std::endl; } } - void SpyIdentifyRunsModule::analyze(const edm::Event& aEvt, const edm::EventSetup& aSetup) - { - + void SpyIdentifyRunsModule::analyze(const edm::Event& aEvt, const edm::EventSetup& aSetup) { //static bool lFirstEvent = true; //if (!lFirstEvent) return; uint32_t lRunNum = aEvt.id().run(); - if (lRunNum == prevRun_) return; + if (lRunNum == prevRun_) + return; edm::Handle lHandle; - aEvt.getByToken( srcToken_, lHandle ); + aEvt.getByToken(srcToken_, lHandle); const FEDRawDataCollection& buffers = *lHandle; - for (unsigned int iFed(FEDNumbering::MINSiStripFEDID); - iFed <= FEDNumbering::MAXSiStripFEDID; - iFed++) - { - - //retrieve FED raw data for given FED - const FEDRawData& input = buffers.FEDData( static_cast(iFed) ); - //check on FEDRawData pointer and size - if ( !input.data() ||!input.size() ) continue; - - //construct FEDBuffer - std::unique_ptr buffer; - try { - buffer.reset(new sistrip::FEDSpyBuffer(input.data(),input.size())); - } catch (const cms::Exception& e) { - edm::LogWarning("SiStripSpyIdentifyRuns") - << "Exception caught when creating FEDSpyBuffer object for FED " << iFed << ": " << e.what(); - //if (!(buffer->readoutMode() == READOUT_MODE_SPY)) break; - std::string lErrStr = e.what(); - if (lErrStr.find("Buffer is not from spy channel")!=lErrStr.npos) break; - else { - writeRunInFile(lRunNum); - break; - } - } // end of buffer reset try. + for (unsigned int iFed(FEDNumbering::MINSiStripFEDID); iFed <= FEDNumbering::MAXSiStripFEDID; iFed++) { + //retrieve FED raw data for given FED + const FEDRawData& input = buffers.FEDData(static_cast(iFed)); + //check on FEDRawData pointer and size + if (!input.data() || !input.size()) + continue; + + //construct FEDBuffer + std::unique_ptr buffer; + try { + buffer.reset(new sistrip::FEDSpyBuffer(input.data(), input.size())); + } catch (const cms::Exception& e) { edm::LogWarning("SiStripSpyIdentifyRuns") - << " -- this is a spy file, run " << lRunNum << std::endl; - writeRunInFile(lRunNum); - break; - } + << "Exception caught when creating FEDSpyBuffer object for FED " << iFed << ": " << e.what(); + //if (!(buffer->readoutMode() == READOUT_MODE_SPY)) break; + std::string lErrStr = e.what(); + if (lErrStr.find("Buffer is not from spy channel") != lErrStr.npos) + break; + else { + writeRunInFile(lRunNum); + break; + } + } // end of buffer reset try. + edm::LogWarning("SiStripSpyIdentifyRuns") << " -- this is a spy file, run " << lRunNum << std::endl; + writeRunInFile(lRunNum); + break; + } //lFirstEvent = false; prevRun_ = lRunNum; - } - void SpyIdentifyRunsModule::writeRunInFile(const unsigned int aRunNumber){ + void SpyIdentifyRunsModule::writeRunInFile(const unsigned int aRunNumber) { if (!outFile_.is_open()) { - edm::LogInfo("SiStripSpyIdentifyRuns") << aRunNumber - << std::endl; - } - else { - outFile_ << aRunNumber << std::endl; + edm::LogInfo("SiStripSpyIdentifyRuns") << aRunNumber << std::endl; + } else { + outFile_ << aRunNumber << std::endl; } } void SpyIdentifyRunsModule::endJob() { - //save global run number in text file in local directory //output loginfo with number of errors //or throw exception ? - if (outFile_.is_open()) outFile_.close(); - + if (outFile_.is_open()) + outFile_.close(); } - -}//namespace +} // namespace sistrip #include "FWCore/Framework/interface/MakerMacros.h" typedef sistrip::SpyIdentifyRunsModule SiStripSpyIdentifyRuns; diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyMonitorModule.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyMonitorModule.cc index caaf52eebdfae..dbae55c9f84b9 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyMonitorModule.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyMonitorModule.cc @@ -48,32 +48,23 @@ // Class declaration // -class SiStripSpyMonitorModule : public DQMEDAnalyzer -{ - public: - - +class SiStripSpyMonitorModule : public DQMEDAnalyzer { +public: explicit SiStripSpyMonitorModule(const edm::ParameterSet&); ~SiStripSpyMonitorModule() override; - private: - +private: void analyze(const edm::Event&, const edm::EventSetup&) override; - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - void dqmBeginRun(const edm::Run& , const edm::EventSetup& ) override; - + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; + void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override; //check if contains pedsubtr data = 0 - bool hasNegativePedSubtr(const edm::DetSetVector::detset & channelDigis, - uint16_t aPair); + bool hasNegativePedSubtr(const edm::DetSetVector::detset& channelDigis, uint16_t aPair); - bool identifyTickmarks(const edm::DetSetVector::detset & channelDigis, - const uint16_t threshold); + bool identifyTickmarks(const edm::DetSetVector::detset& channelDigis, const uint16_t threshold); - edm::DetSetVector::detset::const_iterator - findTwoConsecutive(const edm::DetSetVector::detset & channelDigis, - const uint16_t threshold, - uint16_t & aCounter); + edm::DetSetVector::detset::const_iterator findTwoConsecutive( + const edm::DetSetVector::detset& channelDigis, const uint16_t threshold, uint16_t& aCounter); //tag of spydata collection edm::InputTag spyScopeRawDigisTag_; @@ -82,7 +73,6 @@ class SiStripSpyMonitorModule : public DQMEDAnalyzer edm::EDGetTokenT > spyScopeRawDigisToken_; edm::EDGetTokenT > spyPedSubtrDigisToken_; - //tag of l1A and apveAddress counters edm::InputTag spyL1Tag_; edm::InputTag spyTotCountTag_; @@ -91,7 +81,6 @@ class SiStripSpyMonitorModule : public DQMEDAnalyzer edm::EDGetTokenT > spyL1Token_; edm::EDGetTokenT > spyTotCountToken_; edm::EDGetTokenT > spyAPVeToken_; - uint32_t minDigiRange_; uint32_t maxDigiRange_; @@ -110,139 +99,131 @@ class SiStripSpyMonitorModule : public DQMEDAnalyzer bool fillWithEvtNum_; bool fillWithLocalEvtNum_; - SPYHistograms histManager_; + SPYHistograms histManager_; uint16_t firstHeaderBit_; uint16_t firstTrailerBit_; sistrip::SpyUtilities utility_; sistrip::SpyUtilities::FrameQuality frameQuality_; - std::ofstream outfile_[20]; - std::vector outfileNames_; - std::map outfileMap_; + std::ofstream outfile_[20]; + std::vector outfileNames_; + std::map outfileMap_; bool writeCabling_; - }; - - using edm::LogError; -using edm::LogWarning; using edm::LogInfo; +using edm::LogWarning; // // Constructors and destructor // SiStripSpyMonitorModule::SiStripSpyMonitorModule(const edm::ParameterSet& iConfig) - : spyScopeRawDigisTag_(iConfig.getUntrackedParameter("SpyScopeRawDigisTag",edm::InputTag("SiStripSpyUnpacker","ScopeRawDigis"))), - spyPedSubtrDigisTag_(iConfig.getUntrackedParameter("SpyPedSubtrDigisTag",edm::InputTag("SiStripFEDEmulator",""))), - spyL1Tag_(iConfig.getUntrackedParameter("SpyL1Tag",edm::InputTag("SiStripSpyDigiConverter","L1ACount"))), - spyTotCountTag_(iConfig.getUntrackedParameter("SpyTotalEventCountTag",edm::InputTag("SiStripSpyDigiConverter","TotalEventCount"))), - spyAPVeTag_(iConfig.getUntrackedParameter("SpyAPVeTag",edm::InputTag("SiStripSpyDigiConverter","APVAddress"))), - folderName_(iConfig.getUntrackedParameter("HistogramFolderName","SiStrip/ReadoutView/SpyMonitoringSummary")), - fillAllDetailedHistograms_(iConfig.getUntrackedParameter("FillAllDetailedHistograms",false)), - fillWithEvtNum_(iConfig.getUntrackedParameter("FillWithEventNumber",false)), - fillWithLocalEvtNum_(iConfig.getUntrackedParameter("FillWithLocalEventNumber",false)), - firstHeaderBit_(0), - firstTrailerBit_(0), - outfileNames_(iConfig.getUntrackedParameter >("OutputErrors")), - writeCabling_(iConfig.getUntrackedParameter("WriteCabling",false)) -{ - + : spyScopeRawDigisTag_(iConfig.getUntrackedParameter( + "SpyScopeRawDigisTag", edm::InputTag("SiStripSpyUnpacker", "ScopeRawDigis"))), + spyPedSubtrDigisTag_( + iConfig.getUntrackedParameter("SpyPedSubtrDigisTag", edm::InputTag("SiStripFEDEmulator", ""))), + spyL1Tag_(iConfig.getUntrackedParameter("SpyL1Tag", + edm::InputTag("SiStripSpyDigiConverter", "L1ACount"))), + spyTotCountTag_(iConfig.getUntrackedParameter( + "SpyTotalEventCountTag", edm::InputTag("SiStripSpyDigiConverter", "TotalEventCount"))), + spyAPVeTag_(iConfig.getUntrackedParameter("SpyAPVeTag", + edm::InputTag("SiStripSpyDigiConverter", "APVAddress"))), + folderName_(iConfig.getUntrackedParameter("HistogramFolderName", + "SiStrip/ReadoutView/SpyMonitoringSummary")), + fillAllDetailedHistograms_(iConfig.getUntrackedParameter("FillAllDetailedHistograms", false)), + fillWithEvtNum_(iConfig.getUntrackedParameter("FillWithEventNumber", false)), + fillWithLocalEvtNum_(iConfig.getUntrackedParameter("FillWithLocalEventNumber", false)), + firstHeaderBit_(0), + firstTrailerBit_(0), + outfileNames_(iConfig.getUntrackedParameter >("OutputErrors")), + writeCabling_(iConfig.getUntrackedParameter("WriteCabling", false)) { spyScopeRawDigisToken_ = consumes >(spyScopeRawDigisTag_); spyPedSubtrDigisToken_ = consumes >(spyPedSubtrDigisTag_); - spyL1Token_ = consumes >(spyL1Tag_); + spyL1Token_ = consumes >(spyL1Tag_); spyTotCountToken_ = consumes >(spyTotCountTag_); - spyAPVeToken_ = consumes >(spyAPVeTag_); + spyAPVeToken_ = consumes >(spyAPVeTag_); evt_ = 0; std::ostringstream pDebugStream; - histManager_.initialise(iConfig,&pDebugStream); + histManager_.initialise(iConfig, &pDebugStream); const unsigned int nFiles = outfileNames_.size(); - for (unsigned int i(0); i(iConfig.getUntrackedParameter("MinDigiRange",100)); - frameQuality_.maxDigiRange = static_cast(iConfig.getUntrackedParameter("MaxDigiRange",1024)); - frameQuality_.minZeroLight = static_cast(iConfig.getUntrackedParameter("MinZeroLight",0)); - frameQuality_.maxZeroLight = static_cast(iConfig.getUntrackedParameter("MaxZeroLight",1024)); - frameQuality_.minTickHeight = static_cast(iConfig.getUntrackedParameter("MinTickHeight",0)); - frameQuality_.maxTickHeight = static_cast(iConfig.getUntrackedParameter("MaxTickHeight",1024)); - + frameQuality_.minDigiRange = static_cast(iConfig.getUntrackedParameter("MinDigiRange", 100)); + frameQuality_.maxDigiRange = static_cast(iConfig.getUntrackedParameter("MaxDigiRange", 1024)); + frameQuality_.minZeroLight = static_cast(iConfig.getUntrackedParameter("MinZeroLight", 0)); + frameQuality_.maxZeroLight = static_cast(iConfig.getUntrackedParameter("MaxZeroLight", 1024)); + frameQuality_.minTickHeight = static_cast(iConfig.getUntrackedParameter("MinTickHeight", 0)); + frameQuality_.maxTickHeight = static_cast(iConfig.getUntrackedParameter("MaxTickHeight", 1024)); } -SiStripSpyMonitorModule::~SiStripSpyMonitorModule() -{ +SiStripSpyMonitorModule::~SiStripSpyMonitorModule() { const unsigned int nFiles = outfileNames_.size(); - for (unsigned int i(0); i tkDetMapHandle; eSetup.get().get(tkDetMapHandle); const TkDetMap* tkDetMap = tkDetMapHandle.product(); //this propagates dqm_ to the histoclass, must be called ! histManager_.bookTopLevelHistograms(ibooker, tkDetMap); - - if (fillAllDetailedHistograms_) histManager_.bookAllFEDHistograms(ibooker); + + if (fillAllDetailedHistograms_) + histManager_.bookAllFEDHistograms(ibooker); //dummy error object SPYHistograms::Errors lError; - for (uint16_t lFedId = sistrip::FED_ID_MIN; lFedId <= sistrip::FED_ID_MAX; ++lFedId) - histManager_.bookFEDHistograms(ibooker , lFedId , lError , true); + for (uint16_t lFedId = sistrip::FED_ID_MIN; lFedId <= sistrip::FED_ID_MAX; ++lFedId) + histManager_.bookFEDHistograms(ibooker, lFedId, lError, true); } // ------------ method called to for each event ------------ -void -SiStripSpyMonitorModule::analyze(const edm::Event& iEvent, - const edm::EventSetup& iSetup) -{ - +void SiStripSpyMonitorModule::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { //update cabling and pedestals - const SiStripFedCabling* lCabling = utility_.getCabling( iSetup ); - if (evt_ == 0 && writeCabling_){ + const SiStripFedCabling* lCabling = utility_.getCabling(iSetup); + if (evt_ == 0 && writeCabling_) { std::ofstream lOutCabling; - lOutCabling.open("trackerDetId_FEDIdChNum_list.txt",std::ios::out); - for (uint16_t lFedId = sistrip::FED_ID_MIN; lFedId <= sistrip::FED_ID_MAX; ++lFedId) {//loop on feds - for (uint16_t lFedChannel = 0; lFedChannel < sistrip::FEDCH_PER_FED; lFedChannel++){//loop on channels - const FedChannelConnection & lConnection = lCabling->fedConnection(lFedId,lFedChannel); - if (!lConnection.isConnected()) continue; - uint32_t lDetId = lConnection.detId(); - lOutCabling << "FED ID = " << lFedId - << ", Channel = " << lFedChannel - << ",fedkey = " << sistrip::FEDCH_PER_FED*lFedId + lFedChannel - << ", detId = " << lDetId - << std::endl; + lOutCabling.open("trackerDetId_FEDIdChNum_list.txt", std::ios::out); + for (uint16_t lFedId = sistrip::FED_ID_MIN; lFedId <= sistrip::FED_ID_MAX; ++lFedId) { //loop on feds + for (uint16_t lFedChannel = 0; lFedChannel < sistrip::FEDCH_PER_FED; lFedChannel++) { //loop on channels + const FedChannelConnection& lConnection = lCabling->fedConnection(lFedId, lFedChannel); + if (!lConnection.isConnected()) + continue; + uint32_t lDetId = lConnection.detId(); + lOutCabling << "FED ID = " << lFedId << ", Channel = " << lFedChannel + << ",fedkey = " << sistrip::FEDCH_PER_FED * lFedId + lFedChannel << ", detId = " << lDetId + << std::endl; } } lOutCabling.close(); @@ -250,42 +231,38 @@ SiStripSpyMonitorModule::analyze(const edm::Event& iEvent, //For spy data //get map of TotalEventCount and L1ID, indexed by fedId, and APVaddress indexed by fedIndex. - edm::Handle > lSpyL1IDHandle,lSpyTotCountHandle,lSpyAPVeHandle; + edm::Handle > lSpyL1IDHandle, lSpyTotCountHandle, lSpyAPVeHandle; try { - iEvent.getByToken(spyL1Token_,lSpyL1IDHandle); - iEvent.getByToken(spyTotCountToken_,lSpyTotCountHandle); - iEvent.getByToken(spyAPVeToken_,lSpyAPVeHandle); - } - catch (const cms::Exception& e) { - LogError("SiStripSpyMonitorModule") << e.what() ; + iEvent.getByToken(spyL1Token_, lSpyL1IDHandle); + iEvent.getByToken(spyTotCountToken_, lSpyTotCountHandle); + iEvent.getByToken(spyAPVeToken_, lSpyAPVeHandle); + } catch (const cms::Exception& e) { + LogError("SiStripSpyMonitorModule") << e.what(); return; } //const std::map & lSpyMaxCountMap = *lSpyL1IDHandle; //const std::map & lSpyMinCountMap = *lSpyTotCountHandle; - const std::vector & lSpyAPVeVec = *lSpyAPVeHandle; + const std::vector& lSpyAPVeVec = *lSpyAPVeHandle; //retrieve the scope digis edm::Handle > digisHandle; try { iEvent.getByToken(spyScopeRawDigisToken_, digisHandle); - } - catch (const cms::Exception& e) { - LogError("SiStripSpyMonitorModule") << e.what() ; + } catch (const cms::Exception& e) { + LogError("SiStripSpyMonitorModule") << e.what(); return; } - const edm::DetSetVector * lInputDigis = digisHandle.product(); + const edm::DetSetVector* lInputDigis = digisHandle.product(); //retrieve the reordered payload digis edm::Handle > payloadHandle; try { iEvent.getByToken(spyPedSubtrDigisToken_, payloadHandle); - } - catch (const cms::Exception& e) { - LogError("SiStripSpyMonitorModule") << e.what() ; + } catch (const cms::Exception& e) { + LogError("SiStripSpyMonitorModule") << e.what(); return; } - const edm::DetSetVector * lPayloadDigis = payloadHandle.product(); - + const edm::DetSetVector* lPayloadDigis = payloadHandle.product(); //for first event only //loop first on channels to calculate majority value of when the first header bit is found. @@ -293,9 +270,9 @@ SiStripSpyMonitorModule::analyze(const edm::Event& iEvent, //should currently be 6 but may vary in the futur //then we can check firstTrailerBit is +256+24 after - if (evt_ == 0){ - sistrip::SpyUtilities::getMajorityHeader(lInputDigis,firstHeaderBit_); - firstTrailerBit_ = firstHeaderBit_+24+sistrip::STRIPS_PER_FEDCH; + if (evt_ == 0) { + sistrip::SpyUtilities::getMajorityHeader(lInputDigis, firstHeaderBit_); + firstTrailerBit_ = firstHeaderBit_ + 24 + sistrip::STRIPS_PER_FEDCH; } //initialise some counters, filled in histos eventually @@ -313,23 +290,20 @@ SiStripSpyMonitorModule::analyze(const edm::Event& iEvent, lCounters.nAPVAddressError = 0; lCounters.nNegPeds = 0; - - //fill event number for output text files const unsigned int nFiles = outfileNames_.size(); - for (unsigned int i(0); ifedConnection(lFedId,lFedChannel); + for (uint16_t lFedChannel = 0; lFedChannel < sistrip::FEDCH_PER_FED; lFedChannel++) { //loop on channels + + uint32_t lFedIndex = sistrip::FEDCH_PER_FED * lFedId + lFedChannel; - if (!lConnection.isConnected()) continue; + const FedChannelConnection& lConnection = lCabling->fedConnection(lFedId, lFedChannel); + + if (!lConnection.isConnected()) + continue; uint32_t lDetId = lConnection.detId(); //uint16_t lNPairs = lConnection.nApvPairs(); @@ -360,20 +335,20 @@ SiStripSpyMonitorModule::analyze(const edm::Event& iEvent, //pedsubtr digis edm::DetSetVector::const_iterator lPayload = lPayloadDigis->find(lDetId); - + //no digis found, continue. if (lDigis == lInputDigis->end()) { - LogDebug("SiStripSpyMonitorModule") << " -- digis not found in ScopeRawDigis map for FEDID " - << lFedId << " and FED channel " << lFedChannel << std::endl; - continue; + LogDebug("SiStripSpyMonitorModule") << " -- digis not found in ScopeRawDigis map for FEDID " << lFedId + << " and FED channel " << lFedChannel << std::endl; + continue; } sistrip::SpyUtilities::Frame lFrame = sistrip::SpyUtilities::extractFrameInfo(*lDigis); - + SPYHistograms::Errors lErrors; lErrors.hasNoData = false; - lErrors.hasLowRange = false; - lErrors.hasHighRange = false; + lErrors.hasLowRange = false; + lErrors.hasHighRange = false; lErrors.hasMinZero = false; lErrors.hasMaxSat = false; lErrors.hasLowPb = false; @@ -385,127 +360,127 @@ SiStripSpyMonitorModule::analyze(const edm::Event& iEvent, lErrors.hasAPVAddressError0 = false; lErrors.hasAPVAddressError1 = false; lErrors.hasNegPeds = false; - + uint16_t lRange = sistrip::SpyUtilities::range(lFrame); uint16_t lThreshold = sistrip::SpyUtilities::threshold(lFrame); if (lRange == 0) { - lCounters.nNoData++; - lErrors.hasNoData = true; - lFEDErrors.hasNoData = true; - if (outfileMap_.find("NoData") != outfileMap_.end()) outfile_[outfileMap_["NoData"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; - } - else if (lFrame.digitalLow == 0 && lRange > 0) { - lCounters.nMinZero++; - lErrors.hasMinZero = true; - lFEDErrors.hasMinZero = true; - if (outfileMap_.find("MinZero") != outfileMap_.end()) outfile_[outfileMap_["MinZero"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; - } - else if (lFrame.digitalHigh >= 1023){ - lCounters.nMaxSat++; - lErrors.hasMaxSat = true; - lFEDErrors.hasMaxSat = true; - if (outfileMap_.find("MaxSat") != outfileMap_.end()) outfile_[outfileMap_["MaxSat"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; - } - else if (lRange > 0 && lRange < frameQuality_.minDigiRange) { - lCounters.nLowRange++; - lErrors.hasLowRange = true; - lFEDErrors.hasLowRange = true; - if (outfileMap_.find("LowRange") != outfileMap_.end()) outfile_[outfileMap_["LowRange"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; - } - else if (lRange > frameQuality_.maxDigiRange) { - lCounters.nHighRange++; - lErrors.hasHighRange = true; - lFEDErrors.hasHighRange = true; - if (outfileMap_.find("HighRange") != outfileMap_.end()) outfile_[outfileMap_["HighRange"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; - } - else if (lFrame.digitalLow < frameQuality_.minZeroLight || lFrame.digitalLow > frameQuality_.maxZeroLight) { - lCounters.nLowPb++; - lErrors.hasLowPb = true; - lFEDErrors.hasLowPb = true; - if (outfileMap_.find("LowPb") != outfileMap_.end()) outfile_[outfileMap_["LowPb"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; - } - else if (lFrame.digitalHigh < frameQuality_.minTickHeight || lFrame.digitalHigh > frameQuality_.maxTickHeight){ - lCounters.nHighPb++; - lErrors.hasHighPb = true; - lFEDErrors.hasHighPb = true; - if (outfileMap_.find("HighPb") != outfileMap_.end()) outfile_[outfileMap_["HighPb"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; - } - else if ( lFrame.firstHeaderBit != firstHeaderBit_ && //header in wrong position - ( (lFrame.firstHeaderBit != sistrip::SPY_SAMPLES_PER_CHANNEL && //header and - lFrame.firstTrailerBit != sistrip::SPY_SAMPLES_PER_CHANNEL && //trailer found - lFrame.firstTrailerBit-lFrame.firstHeaderBit == 280) || //+ right distance between them - (lFrame.firstHeaderBit != sistrip::SPY_SAMPLES_PER_CHANNEL && // or header found - lFrame.firstTrailerBit == sistrip::SPY_SAMPLES_PER_CHANNEL && // and trailer not found - lFrame.firstHeaderBit > 16 ) || // corresponding to back-to-back frame late enough - (lFrame.firstHeaderBit == sistrip::SPY_SAMPLES_PER_CHANNEL && // or header not found - identifyTickmarks(*lDigis,lThreshold) ) // but such that tickmark compatible with OOS frame - ) - ){ - lCounters.nOOS++; - lErrors.hasOOS = true; - lFEDErrors.hasOOS = true; - if (outfileMap_.find("OOS") != outfileMap_.end()) outfile_[outfileMap_["OOS"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; - } - else if ( !(lFrame.firstHeaderBit == firstHeaderBit_ && lFrame.firstTrailerBit == firstTrailerBit_) ){ - lCounters.nOtherPbs++; - lErrors.hasOtherPbs = true; - lFEDErrors.hasOtherPbs = true; - if (outfileMap_.find("OtherPbs") != outfileMap_.end()) outfile_[outfileMap_["OtherPbs"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; - } - else if (lFrame.apvErrorBit.first || lFrame.apvErrorBit.second) { - if (lFrame.apvErrorBit.first) { - lCounters.nAPVError++; - lErrors.hasErrorBit0 = true; - lFEDErrors.hasErrorBit0 = true; - } - if (lFrame.apvErrorBit.second) { - lCounters.nAPVError++; - lErrors.hasErrorBit1 = true; - lFEDErrors.hasErrorBit1 = true; - } - if (outfileMap_.find("APVError") != outfileMap_.end()) { - outfile_[outfileMap_["APVError"]] << lFedId << " " << lFedChannel << " " << lDetId ; - if (lFrame.apvErrorBit.first) outfile_[outfileMap_["APVError"]] << " APV0" << std::endl; - if (lFrame.apvErrorBit.second) outfile_[outfileMap_["APVError"]] << " APV1" << std::endl; - } - } - else if ( lFrame.apvAddress.first != lAPVAddrRef || - lFrame.apvAddress.second != lAPVAddrRef ) { - if (lFrame.apvAddress.first != lAPVAddrRef){ - lCounters.nAPVAddressError++; - lErrors.hasAPVAddressError0 = true; - lFEDErrors.hasAPVAddressError0 = true; - } - if (lFrame.apvAddress.second != lAPVAddrRef){ - lCounters.nAPVAddressError++; - lErrors.hasAPVAddressError1 = true; - lFEDErrors.hasAPVAddressError1 = true; - } - if (outfileMap_.find("APVAddressError") != outfileMap_.end()){ - outfile_[outfileMap_["APVAddressError"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; - if (lFrame.apvAddress.first != lAPVAddrRef) outfile_[outfileMap_["APVAddressError"]] << " APV0" << std::endl; - if (lFrame.apvAddress.second != lAPVAddrRef) outfile_[outfileMap_["APVAddressError"]] << " APV1" << std::endl; - } - } - else if (lPayload != lPayloadDigis->end() && hasNegativePedSubtr(*lPayload,lPair)){ - lCounters.nNegPeds++; - lErrors.hasNegPeds = true; - lFEDErrors.hasNegPeds = true; - if (outfileMap_.find("NegPeds") != outfileMap_.end()) outfile_[outfileMap_["NegPeds"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; + lCounters.nNoData++; + lErrors.hasNoData = true; + lFEDErrors.hasNoData = true; + if (outfileMap_.find("NoData") != outfileMap_.end()) + outfile_[outfileMap_["NoData"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; + } else if (lFrame.digitalLow == 0 && lRange > 0) { + lCounters.nMinZero++; + lErrors.hasMinZero = true; + lFEDErrors.hasMinZero = true; + if (outfileMap_.find("MinZero") != outfileMap_.end()) + outfile_[outfileMap_["MinZero"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; + } else if (lFrame.digitalHigh >= 1023) { + lCounters.nMaxSat++; + lErrors.hasMaxSat = true; + lFEDErrors.hasMaxSat = true; + if (outfileMap_.find("MaxSat") != outfileMap_.end()) + outfile_[outfileMap_["MaxSat"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; + } else if (lRange > 0 && lRange < frameQuality_.minDigiRange) { + lCounters.nLowRange++; + lErrors.hasLowRange = true; + lFEDErrors.hasLowRange = true; + if (outfileMap_.find("LowRange") != outfileMap_.end()) + outfile_[outfileMap_["LowRange"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; + } else if (lRange > frameQuality_.maxDigiRange) { + lCounters.nHighRange++; + lErrors.hasHighRange = true; + lFEDErrors.hasHighRange = true; + if (outfileMap_.find("HighRange") != outfileMap_.end()) + outfile_[outfileMap_["HighRange"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; + } else if (lFrame.digitalLow < frameQuality_.minZeroLight || lFrame.digitalLow > frameQuality_.maxZeroLight) { + lCounters.nLowPb++; + lErrors.hasLowPb = true; + lFEDErrors.hasLowPb = true; + if (outfileMap_.find("LowPb") != outfileMap_.end()) + outfile_[outfileMap_["LowPb"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; + } else if (lFrame.digitalHigh < frameQuality_.minTickHeight || lFrame.digitalHigh > frameQuality_.maxTickHeight) { + lCounters.nHighPb++; + lErrors.hasHighPb = true; + lFEDErrors.hasHighPb = true; + if (outfileMap_.find("HighPb") != outfileMap_.end()) + outfile_[outfileMap_["HighPb"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; + } else if (lFrame.firstHeaderBit != firstHeaderBit_ && //header in wrong position + ((lFrame.firstHeaderBit != sistrip::SPY_SAMPLES_PER_CHANNEL && //header and + lFrame.firstTrailerBit != sistrip::SPY_SAMPLES_PER_CHANNEL && //trailer found + lFrame.firstTrailerBit - lFrame.firstHeaderBit == 280) || //+ right distance between them + (lFrame.firstHeaderBit != sistrip::SPY_SAMPLES_PER_CHANNEL && // or header found + lFrame.firstTrailerBit == sistrip::SPY_SAMPLES_PER_CHANNEL && // and trailer not found + lFrame.firstHeaderBit > 16) || // corresponding to back-to-back frame late enough + (lFrame.firstHeaderBit == sistrip::SPY_SAMPLES_PER_CHANNEL && // or header not found + identifyTickmarks(*lDigis, lThreshold)) // but such that tickmark compatible with OOS frame + )) { + lCounters.nOOS++; + lErrors.hasOOS = true; + lFEDErrors.hasOOS = true; + if (outfileMap_.find("OOS") != outfileMap_.end()) + outfile_[outfileMap_["OOS"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; + } else if (!(lFrame.firstHeaderBit == firstHeaderBit_ && lFrame.firstTrailerBit == firstTrailerBit_)) { + lCounters.nOtherPbs++; + lErrors.hasOtherPbs = true; + lFEDErrors.hasOtherPbs = true; + if (outfileMap_.find("OtherPbs") != outfileMap_.end()) + outfile_[outfileMap_["OtherPbs"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; + } else if (lFrame.apvErrorBit.first || lFrame.apvErrorBit.second) { + if (lFrame.apvErrorBit.first) { + lCounters.nAPVError++; + lErrors.hasErrorBit0 = true; + lFEDErrors.hasErrorBit0 = true; + } + if (lFrame.apvErrorBit.second) { + lCounters.nAPVError++; + lErrors.hasErrorBit1 = true; + lFEDErrors.hasErrorBit1 = true; + } + if (outfileMap_.find("APVError") != outfileMap_.end()) { + outfile_[outfileMap_["APVError"]] << lFedId << " " << lFedChannel << " " << lDetId; + if (lFrame.apvErrorBit.first) + outfile_[outfileMap_["APVError"]] << " APV0" << std::endl; + if (lFrame.apvErrorBit.second) + outfile_[outfileMap_["APVError"]] << " APV1" << std::endl; + } + } else if (lFrame.apvAddress.first != lAPVAddrRef || lFrame.apvAddress.second != lAPVAddrRef) { + if (lFrame.apvAddress.first != lAPVAddrRef) { + lCounters.nAPVAddressError++; + lErrors.hasAPVAddressError0 = true; + lFEDErrors.hasAPVAddressError0 = true; + } + if (lFrame.apvAddress.second != lAPVAddrRef) { + lCounters.nAPVAddressError++; + lErrors.hasAPVAddressError1 = true; + lFEDErrors.hasAPVAddressError1 = true; + } + if (outfileMap_.find("APVAddressError") != outfileMap_.end()) { + outfile_[outfileMap_["APVAddressError"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; + if (lFrame.apvAddress.first != lAPVAddrRef) + outfile_[outfileMap_["APVAddressError"]] << " APV0" << std::endl; + if (lFrame.apvAddress.second != lAPVAddrRef) + outfile_[outfileMap_["APVAddressError"]] << " APV1" << std::endl; + } + } else if (lPayload != lPayloadDigis->end() && hasNegativePedSubtr(*lPayload, lPair)) { + lCounters.nNegPeds++; + lErrors.hasNegPeds = true; + lFEDErrors.hasNegPeds = true; + if (outfileMap_.find("NegPeds") != outfileMap_.end()) + outfile_[outfileMap_["NegPeds"]] << lFedId << " " << lFedChannel << " " << lDetId << std::endl; } - histManager_.fillDetailedHistograms(lErrors,lFrame,lFedId,lFedChannel); + histManager_.fillDetailedHistograms(lErrors, lFrame, lFedId, lFedChannel); - }//loop on channels + } //loop on channels + histManager_.fillFEDHistograms(lFEDErrors, lFedId); - histManager_.fillFEDHistograms(lFEDErrors,lFedId); - - }//loop on feds + } //loop on feds double lTime; - //if (fillWithEvtNum_) + //if (fillWithEvtNum_) //lTime = iEvent.id().event(); //else if (fillWithLocalEvtNum_) lTime = evt_; //no orbit number for spy data !! @@ -519,90 +494,83 @@ SiStripSpyMonitorModule::analyze(const edm::Event& iEvent, // doing it explicitely lTime = static_cast(iEvent.id().event()); } - - histManager_.fillCountersHistograms(lCounters,lTime); - + + histManager_.fillCountersHistograms(lCounters, lTime); //used to fill histo vs time with local event number.... evt_++; -}//analyze method +} //analyze method -bool SiStripSpyMonitorModule::hasNegativePedSubtr(const edm::DetSetVector::detset & channelDigis, - uint16_t aPair) -{ +bool SiStripSpyMonitorModule::hasNegativePedSubtr(const edm::DetSetVector::detset& channelDigis, + uint16_t aPair) { edm::DetSetVector::detset::const_iterator iDigi = channelDigis.begin(); const edm::DetSetVector::detset::const_iterator endChannelDigis = channelDigis.end(); uint32_t count = 0; for (; iDigi != endChannelDigis; ++iDigi) { const uint16_t val = iDigi->adc(); - uint16_t lPair = static_cast(count/sistrip::STRIPS_PER_FEDCH); - if (val == 0 && lPair == aPair) return true; + uint16_t lPair = static_cast(count / sistrip::STRIPS_PER_FEDCH); + if (val == 0 && lPair == aPair) + return true; count++; } return false; - } -bool SiStripSpyMonitorModule::identifyTickmarks(const edm::DetSetVector::detset & channelDigis, - const uint16_t threshold) -{ - +bool SiStripSpyMonitorModule::identifyTickmarks(const edm::DetSetVector::detset& channelDigis, + const uint16_t threshold) { //start from the end - uint16_t count = sistrip::SPY_SAMPLES_PER_CHANNEL-3; + uint16_t count = sistrip::SPY_SAMPLES_PER_CHANNEL - 3; uint16_t lastPos = sistrip::SPY_SAMPLES_PER_CHANNEL; uint16_t nTrailers = 0; edm::DetSetVector::detset::const_iterator iDigi = channelDigis.end(); - for ( ; count == 0; count--){ - iDigi = findTwoConsecutive(channelDigis,threshold,count); + for (; count == 0; count--) { + iDigi = findTwoConsecutive(channelDigis, threshold, count); //if found, in different position = 70 before than previous value, go and look 70 before - if (iDigi != channelDigis.end() && - (lastPos == sistrip::SPY_SAMPLES_PER_CHANNEL || count == lastPos+1-70)) { + if (iDigi != channelDigis.end() && (lastPos == sistrip::SPY_SAMPLES_PER_CHANNEL || count == lastPos + 1 - 70)) { nTrailers++; - lastPos = count-1; + lastPos = count - 1; count -= 70; } //else keep looking - else count--; + else + count--; } - if (nTrailers > 1) LogDebug("SiStripSpyMonitorModule") << " -- Found " - << nTrailers << " trailers every 70 clock cycles for channel " - << channelDigis.detId() - << ", evt " << evt_ - << std::endl; + if (nTrailers > 1) + LogDebug("SiStripSpyMonitorModule") << " -- Found " << nTrailers << " trailers every 70 clock cycles for channel " + << channelDigis.detId() << ", evt " << evt_ << std::endl; //if only one found, should be < 280 otherwise header should have been found and this method would not be called return (nTrailers > 1) || (nTrailers == 1 && lastPos < 280); - } -edm::DetSetVector::detset::const_iterator -SiStripSpyMonitorModule::findTwoConsecutive(const edm::DetSetVector::detset & channelDigis, - const uint16_t threshold, - uint16_t & aCounter) -{ +edm::DetSetVector::detset::const_iterator SiStripSpyMonitorModule::findTwoConsecutive( + const edm::DetSetVector::detset& channelDigis, const uint16_t threshold, uint16_t& aCounter) { const edm::DetSetVector::detset::const_iterator endChannelDigis = channelDigis.end(); - edm::DetSetVector::detset::const_iterator lStart = channelDigis.begin()+aCounter; + edm::DetSetVector::detset::const_iterator lStart = channelDigis.begin() + aCounter; bool foundTrailer = false; // Loop over digis looking for last two above threshold uint8_t aboveThreshold = 0; for (; lStart != endChannelDigis; ++lStart) { - if ( lStart->adc() > threshold) { + if (lStart->adc() > threshold) { aboveThreshold++; - } - else { + } else { aboveThreshold = 0; } - if (aboveThreshold == 2) {foundTrailer = true; break; } + if (aboveThreshold == 2) { + foundTrailer = true; + break; + } aCounter++; - }//end of loop over digis - - if (foundTrailer) return lStart; + } //end of loop over digis + + if (foundTrailer) + return lStart; else { aCounter = sistrip::SPY_SAMPLES_PER_CHANNEL; return endChannelDigis; @@ -615,4 +583,3 @@ SiStripSpyMonitorModule::findTwoConsecutive(const edm::DetSetVector & ids, - Counters* pTotalEventCounts, - Counters* pL1ACounts, - uint32_t* aRunRef) - { + const FEDRawDataCollection& buffers, + RawDigis* pDigis, + const std::vector& ids, + Counters* pTotalEventCounts, + Counters* pL1ACounts, + uint32_t* aRunRef) { //create DSV filler to fill output - //As of Feb 2010, bug in DataFormats/SiStripCommon/interface/ConstantsForHardwareSystems.h: + //As of Feb 2010, bug in DataFormats/SiStripCommon/interface/ConstantsForHardwareSystems.h: //number of feds=max-min+1 (440...). Corrected in head of DataFormats/SiStripCommon package. - uint16_t nFeds = static_cast( FED_ID_MAX - FED_ID_MIN + 1); - - RawDigiDetSetVectorFiller dsvFiller(nFeds*FEDCH_PER_FED,nFeds*FEDCH_PER_FED*SPY_SAMPLES_PER_CHANNEL); - + uint16_t nFeds = static_cast(FED_ID_MAX - FED_ID_MIN + 1); + + RawDigiDetSetVectorFiller dsvFiller(nFeds * FEDCH_PER_FED, nFeds * FEDCH_PER_FED * SPY_SAMPLES_PER_CHANNEL); + //check if FEDs found in cabling map and event data - if ( edm::isDebugEnabled() ) { - if ( cabling.fedIds().empty() ) { - edm::LogWarning("SiStripSpyUnpacker") - << "[sistrip::SpyUnpacker::" << __func__ << "]" - << " No FEDs found in cabling map!"; + if (edm::isDebugEnabled()) { + if (cabling.fedIds().empty()) { + edm::LogWarning("SiStripSpyUnpacker") << "[sistrip::SpyUnpacker::" << __func__ << "]" + << " No FEDs found in cabling map!"; } } - - //retrieve FED ids from cabling map and iterate through - std::vector::const_iterator ifed = ids.begin(); - std::vector::const_iterator endfed = ids.end(); + + //retrieve FED ids from cabling map and iterate through + std::vector::const_iterator ifed = ids.begin(); + std::vector::const_iterator endfed = ids.end(); //reference value for run number //encoded per fed but should be the same for all feds uint32_t lRef = 0; //initialise counter vectors to FED_ID_MAX+1 - pTotalEventCounts->resize(FED_ID_MAX+1,0); - pL1ACounts->resize(FED_ID_MAX+1,0); - - for ( ; ifed != endfed; ++ifed ) { + pTotalEventCounts->resize(FED_ID_MAX + 1, 0); + pL1ACounts->resize(FED_ID_MAX + 1, 0); + for (; ifed != endfed; ++ifed) { uint32_t lFedId = (*ifed); //check the fedid is valid: if (lFedId < FED_ID_MIN || lFedId > FED_ID_MAX) { - if ( edm::isDebugEnabled() ) { - edm::LogWarning("SiStripSpyUnpacker") - << "[sistrip::SpyUnpacker::" << __func__ << "]" - << " Invalid FED id provided: " - << lFedId; - } - continue; + if (edm::isDebugEnabled()) { + edm::LogWarning("SiStripSpyUnpacker") << "[sistrip::SpyUnpacker::" << __func__ << "]" + << " Invalid FED id provided: " << lFedId; + } + continue; } - //retrieve FED raw data for given FED - const FEDRawData& input = buffers.FEDData( static_cast(lFedId) ); + //retrieve FED raw data for given FED + const FEDRawData& input = buffers.FEDData(static_cast(lFedId)); //check on FEDRawData pointer - if ( !input.data() ) { - if ( edm::isDebugEnabled() ) { - edm::LogWarning("SiStripSpyUnpacker") - << "[sistrip::SpyUnpacker::" << __func__ << "]" - << " NULL pointer to FEDRawData for FED id " - << lFedId; - } - continue; + if (!input.data()) { + if (edm::isDebugEnabled()) { + edm::LogWarning("SiStripSpyUnpacker") << "[sistrip::SpyUnpacker::" << __func__ << "]" + << " NULL pointer to FEDRawData for FED id " << lFedId; + } + continue; } //check on FEDRawData size - if ( !input.size() ) { - if ( edm::isDebugEnabled() ) { - edm::LogWarning("SiStripSpyUnpacker") - << "[sistrip::SpyUnpacker::" << __func__ << "]" - << " FEDRawData has zero size for FED id " - << lFedId; - } - continue; + if (!input.size()) { + if (edm::isDebugEnabled()) { + edm::LogWarning("SiStripSpyUnpacker") << "[sistrip::SpyUnpacker::" << __func__ << "]" + << " FEDRawData has zero size for FED id " << lFedId; + } + continue; } - + //get the cabling connections for this FED auto conns = cabling.fedConnections(lFedId); - + //construct FEDBuffer std::unique_ptr buffer; try { - buffer.reset(new sistrip::FEDSpyBuffer(input.data(),input.size())); - if (!buffer->doChecks() && !allowIncompleteEvents_) { - throw cms::Exception("FEDSpyBuffer") << "FED Buffer check fails for FED ID " << lFedId << "."; - } - } catch (const cms::Exception& e) { - if ( edm::isDebugEnabled() ) { - edm::LogWarning("SiStripSpyUnpacker") - << "Exception caught when creating FEDSpyBuffer object for FED " << lFedId << ": " << e.what(); - } - continue; - } // end of buffer reset try. - + buffer.reset(new sistrip::FEDSpyBuffer(input.data(), input.size())); + if (!buffer->doChecks() && !allowIncompleteEvents_) { + throw cms::Exception("FEDSpyBuffer") << "FED Buffer check fails for FED ID " << lFedId << "."; + } + } catch (const cms::Exception& e) { + if (edm::isDebugEnabled()) { + edm::LogWarning("SiStripSpyUnpacker") + << "Exception caught when creating FEDSpyBuffer object for FED " << lFedId << ": " << e.what(); + } + continue; + } // end of buffer reset try. + // Get the event counter values uint32_t totalEvCount = buffer->spyHeaderTotalEventCount(); - uint32_t l1ID = buffer->spyHeaderL1ID(); + uint32_t l1ID = buffer->spyHeaderL1ID(); uint32_t lGRun = buffer->globalRunNumber(); //for the first fed, put it as reference value for others - if (lRef == 0) lRef = lGRun; - if (lGRun != lRef){ - edm::LogError("SiStripSpyUnpacker") - << " -- Global run encoded in buffer for FED " << lFedId << ": " - << lGRun << " is different from reference value " << lRef - << std::endl; + if (lRef == 0) + lRef = lGRun; + if (lGRun != lRef) { + edm::LogError("SiStripSpyUnpacker") << " -- Global run encoded in buffer for FED " << lFedId << ": " << lGRun + << " is different from reference value " << lRef << std::endl; } // Add event counters @@ -160,51 +146,53 @@ namespace sistrip { //iterate through FED channels, extract payload and create Digis std::vector::const_iterator iconn = conns.begin(); std::vector::const_iterator endconn = conns.end(); - for ( ; iconn != endconn; ++iconn ) { - - //check if fed connection is valid - if ( !iconn->isConnected()) { continue; } - - //FED channel - uint16_t chan = iconn->fedCh(); - - //check values are valid: - if (chan > FEDCH_PER_FED || iconn->fedId() != lFedId){ - if (edm::isDebugEnabled()) { - std::ostringstream ss; - ss << "Channel connection values invalid: iconn->fedId() = " << iconn->fedId() << " for FED " << lFedId << ", iconn->fedCh() = " << chan << std::endl; - edm::LogWarning("SiStripSpyUnpacker") << ss.str(); - } - continue; - } - - //check FED channel - if (!buffer->channelGood(chan)) { - if (edm::isDebugEnabled()) { - std::ostringstream ss; - ss << "Channel check failed for FED " << lFedId << " channel " << chan << std::endl; - edm::LogWarning("SiStripSpyUnpacker") << ss.str(); - } - continue; - } - - //determine key from cabling - const uint32_t key = ( ( lFedId & sistrip::invalid_ ) << 16 ) | ( chan & sistrip::invalid_ ); - - // Start a new channel in the filler - dsvFiller.newChannel(key); - // Create the unpacker object - sistrip::FEDSpyChannelUnpacker unpacker = sistrip::FEDSpyChannelUnpacker(buffer->channel(chan)); - - // Unpack the data into dsv filler - while (unpacker.hasData()) { - dsvFiller.addItem(unpacker.adc()); - unpacker++; - } - } // end of channel loop - - } //fed loop - + for (; iconn != endconn; ++iconn) { + //check if fed connection is valid + if (!iconn->isConnected()) { + continue; + } + + //FED channel + uint16_t chan = iconn->fedCh(); + + //check values are valid: + if (chan > FEDCH_PER_FED || iconn->fedId() != lFedId) { + if (edm::isDebugEnabled()) { + std::ostringstream ss; + ss << "Channel connection values invalid: iconn->fedId() = " << iconn->fedId() << " for FED " << lFedId + << ", iconn->fedCh() = " << chan << std::endl; + edm::LogWarning("SiStripSpyUnpacker") << ss.str(); + } + continue; + } + + //check FED channel + if (!buffer->channelGood(chan)) { + if (edm::isDebugEnabled()) { + std::ostringstream ss; + ss << "Channel check failed for FED " << lFedId << " channel " << chan << std::endl; + edm::LogWarning("SiStripSpyUnpacker") << ss.str(); + } + continue; + } + + //determine key from cabling + const uint32_t key = ((lFedId & sistrip::invalid_) << 16) | (chan & sistrip::invalid_); + + // Start a new channel in the filler + dsvFiller.newChannel(key); + // Create the unpacker object + sistrip::FEDSpyChannelUnpacker unpacker = sistrip::FEDSpyChannelUnpacker(buffer->channel(chan)); + + // Unpack the data into dsv filler + while (unpacker.hasData()) { + dsvFiller.addItem(unpacker.adc()); + unpacker++; + } + } // end of channel loop + + } //fed loop + //set the run number *aRunRef = lRef; @@ -212,6 +200,6 @@ namespace sistrip { std::unique_ptr pResult = dsvFiller.createDetSetVector(); pDigis->swap(*pResult); - } // end of SpyUnpacker::createDigis method. + } // end of SpyUnpacker::createDigis method. -} // end of sistrip namespace. +} // namespace sistrip diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyUnpackerModule.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyUnpackerModule.cc index c9d758b05b4e0..001d81d2b2db4 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyUnpackerModule.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyUnpackerModule.cc @@ -37,16 +37,18 @@ #include #include "boost/cstdint.hpp" -namespace sistrip { class SpyUnpacker; class SpyUtilities; } +namespace sistrip { + class SpyUnpacker; + class SpyUtilities; +} // namespace sistrip class SiStripFedCabling; using edm::LogError; using edm::LogInfo; - namespace sistrip { - /*! + /*! * @file DQM/SiStripMonitorHardware/interface/SiStripSpyUnpackerModule.cc * @class SiStripSpyUnpackerModule * @@ -54,77 +56,80 @@ namespace sistrip { * from the Event and creates EDProducts containing StripDigis from spy channel * data. */ - class SpyUnpackerModule : public edm::EDProducer - { - public: - SpyUnpackerModule( const edm::ParameterSet& ); - ~SpyUnpackerModule() override; - void produce( edm::Event&, const edm::EventSetup& ) override; - private: - static const char* msgLb_; - - // Data members - //-------------- - // Configuration - std::vector fed_ids_; //!< Vector of FED IDs to examine (FEDs). - const edm::InputTag productLabel_; //!< The product label of the FEDRawDataCollection input. - edm::EDGetTokenT productToken_; - const bool allowIncompleteEvents_; //!< Allow inconsistent (by event count, APV address) event storage. - const bool storeCounters_; //!< True = store L1ID and TotalEventCount by FED key. - const bool storeScopeRawDigis_; //!< True = store the scope mode raw digis. - // Unpacking - SpyUnpacker* unpacker_; //!< - - //utilities for cabling etc... - SpyUtilities utility_; - - }; // end of SpyUnpackerModule class. - -} // end of namespace sistrip. + class SpyUnpackerModule : public edm::EDProducer { + public: + SpyUnpackerModule(const edm::ParameterSet&); + ~SpyUnpackerModule() override; + void produce(edm::Event&, const edm::EventSetup&) override; + + private: + static const char* msgLb_; + + // Data members + //-------------- + // Configuration + std::vector fed_ids_; //!< Vector of FED IDs to examine (FEDs). + const edm::InputTag productLabel_; //!< The product label of the FEDRawDataCollection input. + edm::EDGetTokenT productToken_; + const bool allowIncompleteEvents_; //!< Allow inconsistent (by event count, APV address) event storage. + const bool storeCounters_; //!< True = store L1ID and TotalEventCount by FED key. + const bool storeScopeRawDigis_; //!< True = store the scope mode raw digis. + // Unpacking + SpyUnpacker* unpacker_; //!< + + //utilities for cabling etc... + SpyUtilities utility_; + + }; // end of SpyUnpackerModule class. + +} // end of namespace sistrip. namespace sistrip { const char* SpyUnpackerModule::msgLb_ = "SiStripSpyUnpackerModule"; - - SpyUnpackerModule::SpyUnpackerModule( const edm::ParameterSet& pset ) : - fed_ids_( pset.getParameter< std::vector >("FEDIDs")), - productLabel_(pset.getParameter("InputProductLabel")), - allowIncompleteEvents_(pset.getParameter("AllowIncompleteEvents")), - storeCounters_(pset.getParameter("StoreCounters")), - storeScopeRawDigis_(pset.getParameter("StoreScopeRawDigis")), - unpacker_(nullptr) - { + + SpyUnpackerModule::SpyUnpackerModule(const edm::ParameterSet& pset) + : fed_ids_(pset.getParameter >("FEDIDs")), + productLabel_(pset.getParameter("InputProductLabel")), + allowIncompleteEvents_(pset.getParameter("AllowIncompleteEvents")), + storeCounters_(pset.getParameter("StoreCounters")), + storeScopeRawDigis_(pset.getParameter("StoreScopeRawDigis")), + unpacker_(nullptr) { productToken_ = consumes(productLabel_); if ((fed_ids_.empty())) { LogInfo(msgLb_) << "No FED IDs specified, so will try to unpack all FEDs with data" << std::endl; - fed_ids_.reserve(FEDNumbering::MAXSiStripFEDID-FEDNumbering::MINSiStripFEDID+1); - for ( uint32_t ifed = FEDNumbering::MINSiStripFEDID; ifed <= FEDNumbering::MAXSiStripFEDID; ifed++ ) { - fed_ids_.push_back( ifed ); + fed_ids_.reserve(FEDNumbering::MAXSiStripFEDID - FEDNumbering::MINSiStripFEDID + 1); + for (uint32_t ifed = FEDNumbering::MINSiStripFEDID; ifed <= FEDNumbering::MAXSiStripFEDID; ifed++) { + fed_ids_.push_back(ifed); } - } // end of FED ID specified check. - - if ( edm::isDebugEnabled() ) LogTrace(msgLb_) << "["<< __func__ << "]:" << " Constructing object..."; - + } // end of FED ID specified check. + + if (edm::isDebugEnabled()) + LogTrace(msgLb_) << "[" << __func__ << "]:" + << " Constructing object..."; + unpacker_ = new sistrip::SpyUnpacker(allowIncompleteEvents_); - - if (storeScopeRawDigis_) produces< edm::DetSetVector >("ScopeRawDigis"); - + + if (storeScopeRawDigis_) + produces >("ScopeRawDigis"); + if (storeCounters_) { - produces< std::vector >("L1ACount"); - produces< std::vector >("TotalEventCount"); + produces >("L1ACount"); + produces >("TotalEventCount"); } - + produces("GlobalRunNumber"); - - } // end of SpyUnpackerModule constructor. + + } // end of SpyUnpackerModule constructor. SpyUnpackerModule::~SpyUnpackerModule() { - if ( unpacker_ ) { delete unpacker_; } - if ( edm::isDebugEnabled() ) { - LogTrace("SiStripSpyUnpacker") - << "[sistrip::SpyUnpackerModule::" << __func__ << "]" - << " Destructing object..."; + if (unpacker_) { + delete unpacker_; + } + if (edm::isDebugEnabled()) { + LogTrace("SiStripSpyUnpacker") << "[sistrip::SpyUnpackerModule::" << __func__ << "]" + << " Destructing object..."; } } @@ -134,37 +139,30 @@ namespace sistrip { * SiStripSpyUnpacker class to fill the DetSetVector, and * attaches the container to the Event. */ - void SpyUnpackerModule::produce( edm::Event& event, const edm::EventSetup& setup ) { - - - const SiStripFedCabling* lCabling = utility_.getCabling( setup ); + void SpyUnpackerModule::produce(edm::Event& event, const edm::EventSetup& setup) { + const SiStripFedCabling* lCabling = utility_.getCabling(setup); //retrieve FED raw data (by label, which is "source" by default) edm::Handle buffers; - event.getByToken( productToken_, buffers ); - + event.getByToken(productToken_, buffers); + //create container for digis - std::unique_ptr< edm::DetSetVector > digis(new edm::DetSetVector); - + std::unique_ptr > digis(new edm::DetSetVector); + //if necessary, create container for event counters - std::unique_ptr< std::vector > pTotalCounts(new std::vector); - std::unique_ptr< std::vector > pL1ACounts(new std::vector); + std::unique_ptr > pTotalCounts(new std::vector); + std::unique_ptr > pL1ACounts(new std::vector); //and for run number std::unique_ptr pGlobalRun(new uint32_t); //create digis // Using FED IDs... - unpacker_->createDigis(*lCabling, - *buffers, - digis.get(), - fed_ids_, - pTotalCounts.get(), - pL1ACounts.get(), - pGlobalRun.get() - ); - + unpacker_->createDigis( + *lCabling, *buffers, digis.get(), fed_ids_, pTotalCounts.get(), pL1ACounts.get(), pGlobalRun.get()); + // Add digis to event - if (storeScopeRawDigis_) event.put(std::move(digis), "ScopeRawDigis" ); - + if (storeScopeRawDigis_) + event.put(std::move(digis), "ScopeRawDigis"); + //add counters to event if (storeCounters_) { event.put(std::move(pTotalCounts), "TotalEventCount"); @@ -174,10 +172,9 @@ namespace sistrip { //add global run to the event event.put(std::move(pGlobalRun), "GlobalRunNumber"); - } // end of SpyUnpackerModule::produce method. - + } // end of SpyUnpackerModule::produce method. -} // end of sistrip namespace +} // namespace sistrip typedef sistrip::SpyUnpackerModule SiStripSpyUnpackerModule; DEFINE_FWK_MODULE(SiStripSpyUnpackerModule); diff --git a/DQM/SiStripMonitorHardware/src/SiStripSpyUtilities.cc b/DQM/SiStripMonitorHardware/src/SiStripSpyUtilities.cc index 885cc5d63a1bb..a15dc4decb1d4 100644 --- a/DQM/SiStripMonitorHardware/src/SiStripSpyUtilities.cc +++ b/DQM/SiStripMonitorHardware/src/SiStripSpyUtilities.cc @@ -13,86 +13,78 @@ #include "DQM/SiStripMonitorHardware/interface/SiStripSpyUtilities.h" using edm::LogError; -using edm::LogWarning; using edm::LogInfo; - +using edm::LogWarning; namespace sistrip { - SpyUtilities::SpyUtilities() : - cabling_(nullptr), - cacheId_(0), - detCabling_(nullptr), - cacheIdDet_(0), - pedsCacheId_(0), - pedsHandle_(nullptr), - noiseCacheId_(0), - noiseHandle_(nullptr) - { - - } - - SpyUtilities::~SpyUtilities() - { - if ( cabling_ ) cabling_ = nullptr; - if ( detCabling_ ) detCabling_ = nullptr; + SpyUtilities::SpyUtilities() + : cabling_(nullptr), + cacheId_(0), + detCabling_(nullptr), + cacheIdDet_(0), + pedsCacheId_(0), + pedsHandle_(nullptr), + noiseCacheId_(0), + noiseHandle_(nullptr) {} + + SpyUtilities::~SpyUtilities() { + if (cabling_) + cabling_ = nullptr; + if (detCabling_) + detCabling_ = nullptr; } - const SiStripFedCabling* SpyUtilities::getCabling( const edm::EventSetup& setup ) - { - + const SiStripFedCabling* SpyUtilities::getCabling(const edm::EventSetup& setup) { uint32_t cache_id = setup.get().cacheIdentifier(); - - if ( cacheId_ != cache_id ) { // If the cache ID has changed since the last update... + + if (cacheId_ != cache_id) { // If the cache ID has changed since the last update... // Update the cabling object edm::ESHandle c; - setup.get().get( c ); + setup.get().get(c); cabling_ = c.product(); - -// if ( edm::isDebugEnabled() ) { -// if ( !cacheId_ ) { // First time cabling has been retrieved - print it out in full. -// std::stringstream ss; -// ss << "[sistrip::SpyChannelUnpackerModule::" << __func__ << "]" -// << " Updating cabling for first time..." << std::endl -// << " Terse print out of FED cabling:" << std::endl; -// //cabling_->terse(ss); -// //LogTrace("SiStripMonitorHardwareUnpacker") << ss.str(); -// } // end of cacheId_ check -// } // end of debugEnabled check - -// if ( edm::isDebugEnabled() ) { -// std::stringstream sss; -// sss << "[sistrip::SpyUtilities::" << __func__ << "]" -// << " Summary of FED cabling:" << std::endl; -// cabling_->summary(sss); -// LogTrace("SiStripSpyUtilities") << sss.str(); -// } + + // if ( edm::isDebugEnabled() ) { + // if ( !cacheId_ ) { // First time cabling has been retrieved - print it out in full. + // std::stringstream ss; + // ss << "[sistrip::SpyChannelUnpackerModule::" << __func__ << "]" + // << " Updating cabling for first time..." << std::endl + // << " Terse print out of FED cabling:" << std::endl; + // //cabling_->terse(ss); + // //LogTrace("SiStripMonitorHardwareUnpacker") << ss.str(); + // } // end of cacheId_ check + // } // end of debugEnabled check + + // if ( edm::isDebugEnabled() ) { + // std::stringstream sss; + // sss << "[sistrip::SpyUtilities::" << __func__ << "]" + // << " Summary of FED cabling:" << std::endl; + // cabling_->summary(sss); + // LogTrace("SiStripSpyUtilities") << sss.str(); + // } // Update the cache ID with the new value. cacheId_ = cache_id; - } // end of new cache ID check - + } // end of new cache ID check + return cabling_; } - const SiStripDetCabling* SpyUtilities::getDetCabling( const edm::EventSetup& setup ) - { - - uint32_t cache_id = setup.get().cacheIdentifier();//.get( cabling_ ); - - if ( cacheIdDet_ != cache_id ) { // If the cache ID has changed since the last update... + const SiStripDetCabling* SpyUtilities::getDetCabling(const edm::EventSetup& setup) { + uint32_t cache_id = setup.get().cacheIdentifier(); //.get( cabling_ ); + + if (cacheIdDet_ != cache_id) { // If the cache ID has changed since the last update... // Update the cabling object edm::ESHandle c; - setup.get().get( c ); + setup.get().get(c); detCabling_ = c.product(); cacheIdDet_ = cache_id; - } // end of new cache ID check - + } // end of new cache ID check + return detCabling_; } - edm::ESHandle SpyUtilities::getPedestalHandle(const edm::EventSetup& eventSetup) - { + edm::ESHandle SpyUtilities::getPedestalHandle(const edm::EventSetup& eventSetup) { //check if new pedestal values are available uint32_t lCacheId = eventSetup.get().cacheIdentifier(); if (lCacheId != pedsCacheId_) { @@ -103,9 +95,7 @@ namespace sistrip { return pedsHandle_; } - - edm::ESHandle SpyUtilities::getNoiseHandle(const edm::EventSetup& eventSetup) - { + edm::ESHandle SpyUtilities::getNoiseHandle(const edm::EventSetup& eventSetup) { //check if new noise values are available uint32_t lCacheId = eventSetup.get().cacheIdentifier(); if (lCacheId != noiseCacheId_) { @@ -116,12 +106,8 @@ namespace sistrip { return noiseHandle_; } - - const SpyUtilities::Frame - SpyUtilities::extractFrameInfo(const edm::DetSetVector::detset & channelDigis, - bool aPrintDebug) - { - + const SpyUtilities::Frame SpyUtilities::extractFrameInfo( + const edm::DetSetVector::detset& channelDigis, bool aPrintDebug) { SpyUtilities::Frame lFrame; lFrame.detId = channelDigis.detId(); lFrame.firstHeaderBit = 0; @@ -142,140 +128,122 @@ namespace sistrip { //counters for outputting warnings uint16_t numzeroes = 0, numsats = 0; - if (iDigi == endChannelDigis) return lFrame; + if (iDigi == endChannelDigis) + return lFrame; for (; iDigi != endChannelDigis; ++iDigi) { const uint16_t val = iDigi->adc(); - if (val < min) min = val; - if (val > max) max = val; - if (val==0) numzeroes++; - if (val==0x3FF) numsats++; + if (val < min) + min = val; + if (val > max) + max = val; + if (val == 0) + numzeroes++; + if (val == 0x3FF) + numsats++; lFrame.baseline += val; } - if (!channelDigis.empty()) lFrame.baseline = lFrame.baseline/channelDigis.size(); + if (!channelDigis.empty()) + lFrame.baseline = lFrame.baseline / channelDigis.size(); lFrame.digitalLow = min; lFrame.digitalHigh = max; - const uint16_t threshold = static_cast( (2.0 * static_cast(max-min)) / 3.0 ); + const uint16_t threshold = static_cast((2.0 * static_cast(max - min)) / 3.0); - if (aPrintDebug){ - if ( edm::isDebugEnabled() ) { - LogDebug("SiStripSpyUtilities") << "Channel with key: " << lFrame.detId - << " Min: " << min << " Max: " << max - << " Range: " << (max-min) << " Threshold: " << threshold; + if (aPrintDebug) { + if (edm::isDebugEnabled()) { + LogDebug("SiStripSpyUtilities") << "Channel with key: " << lFrame.detId << " Min: " << min << " Max: " << max + << " Range: " << (max - min) << " Threshold: " << threshold; } - if (numzeroes>0 || numsats>0) { - edm::LogWarning("SiStripSpyUtilities") << "Channel with key: " << lFrame.detId << " has " - << numzeroes << " zero and " - << numsats << " saturated samples."; + if (numzeroes > 0 || numsats > 0) { + edm::LogWarning("SiStripSpyUtilities") << "Channel with key: " << lFrame.detId << " has " << numzeroes + << " zero and " << numsats << " saturated samples."; } } - lFrame.firstHeaderBit = findHeaderBits(channelDigis,threshold); - lFrame.firstTrailerBit = findTrailerBits(channelDigis,threshold); + lFrame.firstHeaderBit = findHeaderBits(channelDigis, threshold); + lFrame.firstTrailerBit = findTrailerBits(channelDigis, threshold); + + lFrame.apvErrorBit = findAPVErrorBits(channelDigis, threshold, lFrame.firstHeaderBit); + lFrame.apvAddress = findAPVAddresses(channelDigis, threshold, lFrame.firstHeaderBit); - lFrame.apvErrorBit = findAPVErrorBits(channelDigis,threshold,lFrame.firstHeaderBit); - lFrame.apvAddress = findAPVAddresses(channelDigis,threshold,lFrame.firstHeaderBit); - return lFrame; - } - const uint16_t SpyUtilities::range(const SpyUtilities::Frame & aFrame) - { - if (aFrame.digitalHigh < aFrame.digitalLow) return 0; - else return aFrame.digitalHigh-aFrame.digitalLow; + const uint16_t SpyUtilities::range(const SpyUtilities::Frame& aFrame) { + if (aFrame.digitalHigh < aFrame.digitalLow) + return 0; + else + return aFrame.digitalHigh - aFrame.digitalLow; } - const uint16_t SpyUtilities::threshold(const SpyUtilities::Frame & aFrame) - { - return static_cast( (2.0 * static_cast(range(aFrame))) / 3.0 ); + const uint16_t SpyUtilities::threshold(const SpyUtilities::Frame& aFrame) { + return static_cast((2.0 * static_cast(range(aFrame))) / 3.0); } - const uint8_t SpyUtilities::extractAPVaddress(const SpyUtilities::Frame & aFrame) - { - - if (aFrame.apvErrorBit.first == false) return aFrame.apvAddress.first; + const uint8_t SpyUtilities::extractAPVaddress(const SpyUtilities::Frame& aFrame) { + if (aFrame.apvErrorBit.first == false) + return aFrame.apvAddress.first; else if (aFrame.apvErrorBit.second == false) { return aFrame.apvAddress.second; - } - else { + } else { return 0; } - } - - void SpyUtilities::getMajorityHeader(const edm::DetSetVector *aInputDigis, - uint16_t & aFirstHeaderBit, - bool printResult) - { + void SpyUtilities::getMajorityHeader(const edm::DetSetVector* aInputDigis, + uint16_t& aFirstHeaderBit, + bool printResult) { std::vector lFirstBitVec; lFirstBitVec.reserve(aInputDigis->size()); aFirstHeaderBit = 0; edm::DetSetVector::const_iterator lDigis = aInputDigis->begin(); - - for ( ; lDigis != aInputDigis->end(); lDigis++){ + + for (; lDigis != aInputDigis->end(); lDigis++) { sistrip::SpyUtilities::Frame lFrame = sistrip::SpyUtilities::extractFrameInfo(*lDigis); lFirstBitVec.push_back(lFrame.firstHeaderBit); } - std::pair lMaj = sistrip::SpyUtilities::findMajorityValue(lFirstBitVec); + std::pair lMaj = sistrip::SpyUtilities::findMajorityValue(lFirstBitVec); aFirstHeaderBit = lMaj.first; uint32_t lMajorityCounter = lMaj.second; - - //header is 24-sample long (2*8+2+6) - uint16_t lFirstTrailerBit = aFirstHeaderBit+24+sistrip::STRIPS_PER_FEDCH; - - if (printResult) - { - LogInfo("SiStripSpyUtilities") << " -- Found majority position of first header (trailer) bit: " - << aFirstHeaderBit - << " (" << lFirstTrailerBit - << ") for " << lMajorityCounter << " out of " << lFirstBitVec.size() << " channels." - << std::endl; - } - } + //header is 24-sample long (2*8+2+6) + uint16_t lFirstTrailerBit = aFirstHeaderBit + 24 + sistrip::STRIPS_PER_FEDCH; - const bool SpyUtilities::isValid(const SpyUtilities::Frame & aFrame, - const FrameQuality & aQuality, - const uint16_t aExpectedPos) - { + if (printResult) { + LogInfo("SiStripSpyUtilities") << " -- Found majority position of first header (trailer) bit: " << aFirstHeaderBit + << " (" << lFirstTrailerBit << ") for " << lMajorityCounter << " out of " + << lFirstBitVec.size() << " channels." << std::endl; + } + } + const bool SpyUtilities::isValid(const SpyUtilities::Frame& aFrame, + const FrameQuality& aQuality, + const uint16_t aExpectedPos) { uint16_t lRange = sistrip::SpyUtilities::range(aFrame); if (lRange < aQuality.minDigiRange || lRange > aQuality.maxDigiRange) { return false; - } - else if (aFrame.digitalLow < aQuality.minZeroLight || aFrame.digitalLow > aQuality.maxZeroLight) { + } else if (aFrame.digitalLow < aQuality.minZeroLight || aFrame.digitalLow > aQuality.maxZeroLight) { return false; - } - else if (aFrame.digitalHigh < aQuality.minTickHeight || aFrame.digitalHigh > aQuality.maxTickHeight){ + } else if (aFrame.digitalHigh < aQuality.minTickHeight || aFrame.digitalHigh > aQuality.maxTickHeight) { return false; } //if expectedPos=0: return true whatever the position of header is... - else if ( aExpectedPos > 0 && - ( - !(aFrame.firstHeaderBit == aExpectedPos && - aFrame.firstTrailerBit == aExpectedPos+24+sistrip::STRIPS_PER_FEDCH) - ) - ) { + else if (aExpectedPos > 0 && (!(aFrame.firstHeaderBit == aExpectedPos && + aFrame.firstTrailerBit == aExpectedPos + 24 + sistrip::STRIPS_PER_FEDCH))) { return false; - } - else if (aFrame.apvErrorBit.first && aFrame.apvErrorBit.second) { + } else if (aFrame.apvErrorBit.first && aFrame.apvErrorBit.second) { return false; } - + return true; } - - const uint16_t SpyUtilities::findHeaderBits(const edm::DetSetVector::detset & channelDigis, - const uint16_t threshold) - { - + const uint16_t SpyUtilities::findHeaderBits(const edm::DetSetVector::detset& channelDigis, + const uint16_t threshold) { // Loop over digis looking for first above threshold uint8_t aboveThreshold = 0; bool foundHeader = false; @@ -285,27 +253,28 @@ namespace sistrip { const edm::DetSetVector::detset::const_iterator endChannelDigis = channelDigis.end(); for (; iDigi != endChannelDigis; ++iDigi) { - if ( iDigi->adc() > threshold) { - aboveThreshold++; + if (iDigi->adc() > threshold) { + aboveThreshold++; + } else { + aboveThreshold = 0; } - else { - aboveThreshold = 0; + if (aboveThreshold == 6) { + foundHeader = true; + break; } - if (aboveThreshold == 6) {foundHeader = true; break; } count++; - }//end of loop over digis + } //end of loop over digis //break before incrementing the last time... so count-5 is the first header sample. - if (foundHeader && count < 5) return 0; - if (foundHeader) return count-5; + if (foundHeader && count < 5) + return 0; + if (foundHeader) + return count - 5; return sistrip::SPY_SAMPLES_PER_CHANNEL; - } - const uint16_t SpyUtilities::findTrailerBits(const edm::DetSetVector::detset & channelDigis, - const uint16_t threshold) - { - + const uint16_t SpyUtilities::findTrailerBits(const edm::DetSetVector::detset& channelDigis, + const uint16_t threshold) { // Loop over digis looking for last above threshold uint8_t aboveThreshold = 0; bool foundTrailer = false; @@ -313,213 +282,193 @@ namespace sistrip { //discard the first 30 values, which will have some digital high in them... //start searching from the expected position : sometimes after 24+256 samples, //normally at 6+24+256 if 6-bit low before tickmark header bits... - uint16_t count = 24+sistrip::STRIPS_PER_FEDCH; + uint16_t count = 24 + sistrip::STRIPS_PER_FEDCH; - if (count >= sistrip::SPY_SAMPLES_PER_CHANNEL) return sistrip::SPY_SAMPLES_PER_CHANNEL; + if (count >= sistrip::SPY_SAMPLES_PER_CHANNEL) + return sistrip::SPY_SAMPLES_PER_CHANNEL; - edm::DetSetVector::detset::const_iterator iDigi = channelDigis.begin()+count; + edm::DetSetVector::detset::const_iterator iDigi = channelDigis.begin() + count; const edm::DetSetVector::detset::const_iterator endChannelDigis = channelDigis.end(); for (; iDigi != endChannelDigis; ++iDigi) { - if ( iDigi->adc() > threshold) { - aboveThreshold++; + if (iDigi->adc() > threshold) { + aboveThreshold++; + } else { + aboveThreshold = 0; } - else { - aboveThreshold = 0; + if (aboveThreshold == 2) { + foundTrailer = true; + break; } - if (aboveThreshold == 2) {foundTrailer = true; break; } count++; - }//end of loop over digis + } //end of loop over digis //break before incrementing the last time... so count-1 is the first trailer sample. - if (foundTrailer && count < 1) return 0; - if (foundTrailer) return count-1; + if (foundTrailer && count < 1) + return 0; + if (foundTrailer) + return count - 1; return sistrip::SPY_SAMPLES_PER_CHANNEL; - } - - - const std::pair - SpyUtilities::findAPVErrorBits(const edm::DetSetVector::detset & channelDigis, - const uint16_t threshold, - const uint16_t aFirstBits) - { - + const std::pair SpyUtilities::findAPVErrorBits( + const edm::DetSetVector::detset& channelDigis, + const uint16_t threshold, + const uint16_t aFirstBits) { // Loop over digis looking for firstHeader+6+16 - uint16_t count = aFirstBits+22; + uint16_t count = aFirstBits + 22; - std::pair lPair = std::pair(false,false); + std::pair lPair = std::pair(false, false); //if header invalid: we don't know what apverr is.... - if (count >= sistrip::SPY_SAMPLES_PER_CHANNEL-1) return lPair; + if (count >= sistrip::SPY_SAMPLES_PER_CHANNEL - 1) + return lPair; - edm::DetSetVector::detset::const_iterator iDigi = channelDigis.begin()+count; + edm::DetSetVector::detset::const_iterator iDigi = channelDigis.begin() + count; const edm::DetSetVector::detset::const_iterator endChannelDigis = channelDigis.end(); //double check.... - if (iDigi == endChannelDigis) return lPair; + if (iDigi == endChannelDigis) + return lPair; - if ( iDigi->adc() <= threshold) lPair.first = true; + if (iDigi->adc() <= threshold) + lPair.first = true; ++iDigi; //triple check... - if (iDigi == endChannelDigis) return std::pair(false,false); + if (iDigi == endChannelDigis) + return std::pair(false, false); - if ( iDigi->adc() <= threshold) lPair.second = true; + if (iDigi->adc() <= threshold) + lPair.second = true; - return lPair; + return lPair; } - - const std::pair - SpyUtilities::findAPVAddresses(const edm::DetSetVector::detset & channelDigis, - const uint16_t threshold, - const uint16_t aFirstBits) - { - + const std::pair SpyUtilities::findAPVAddresses( + const edm::DetSetVector::detset& channelDigis, + const uint16_t threshold, + const uint16_t aFirstBits) { // Loop over digis looking for firstHeader+6 - uint16_t count = aFirstBits+6; - std::pair lPair = std::pair(0,0); + uint16_t count = aFirstBits + 6; + std::pair lPair = std::pair(0, 0); //check enough room to have 16 values.... - if (count >= sistrip::SPY_SAMPLES_PER_CHANNEL-15) return lPair; + if (count >= sistrip::SPY_SAMPLES_PER_CHANNEL - 15) + return lPair; - edm::DetSetVector::detset::const_iterator iDigi = channelDigis.begin()+count; + edm::DetSetVector::detset::const_iterator iDigi = channelDigis.begin() + count; const edm::DetSetVector::detset::const_iterator endChannelDigis = channelDigis.end(); //double check.... - if (iDigi == endChannelDigis) return lPair; + if (iDigi == endChannelDigis) + return lPair; for (uint8_t i = 0; i < 16; ++i) { - if ( iDigi->adc() > threshold) { - //data is MSB first - if (i%2==0) - lPair.first |= (0x80 >> static_cast(i/2)); - else - lPair.second |= (0x80 >> static_cast(i/2)); + if (iDigi->adc() > threshold) { + //data is MSB first + if (i % 2 == 0) + lPair.first |= (0x80 >> static_cast(i / 2)); + else + lPair.second |= (0x80 >> static_cast(i / 2)); } ++iDigi; } return lPair; - } - - std::string SpyUtilities::print(const SpyUtilities::Frame & aFrame, - std::string aErr) - { - + std::string SpyUtilities::print(const SpyUtilities::Frame& aFrame, std::string aErr) { std::ostringstream lOs; lOs << " ------------------------------------------------------" << std::endl - << " -- Error: " << aErr << std::endl - << " ------- Printing Frame for detId " << aFrame.detId << " --------" << std::endl - << " -- firstHeaderBit = " << aFrame.firstHeaderBit << std::endl - << " -- firstTrailerBit = " << aFrame.firstTrailerBit << std::endl - << " -- digitalLow = " << aFrame.digitalLow << std::endl - << " -- digitalHigh = " << aFrame.digitalHigh << std::endl - << " -- baseline = " << aFrame.baseline << std::endl - << " -- apvErrorBits = " << aFrame.apvErrorBit.first - << " " << aFrame.apvErrorBit.second << std::endl - << " -- apvAddresses = " << static_cast(aFrame.apvAddress.first) - << " " << static_cast(aFrame.apvAddress.second) << std::endl - << " ------------------------------------------------------" << std::endl; + << " -- Error: " << aErr << std::endl + << " ------- Printing Frame for detId " << aFrame.detId << " --------" << std::endl + << " -- firstHeaderBit = " << aFrame.firstHeaderBit << std::endl + << " -- firstTrailerBit = " << aFrame.firstTrailerBit << std::endl + << " -- digitalLow = " << aFrame.digitalLow << std::endl + << " -- digitalHigh = " << aFrame.digitalHigh << std::endl + << " -- baseline = " << aFrame.baseline << std::endl + << " -- apvErrorBits = " << aFrame.apvErrorBit.first << " " << aFrame.apvErrorBit.second << std::endl + << " -- apvAddresses = " << static_cast(aFrame.apvAddress.first) << " " + << static_cast(aFrame.apvAddress.second) << std::endl + << " ------------------------------------------------------" << std::endl; return lOs.str(); - } - - void SpyUtilities::fedIndex(const uint32_t aFedIndex, - uint16_t & aFedId, - uint16_t & aFedChannel){ - + void SpyUtilities::fedIndex(const uint32_t aFedIndex, uint16_t& aFedId, uint16_t& aFedChannel) { //find the corresponding detId (for the pedestals) - aFedId = static_cast(aFedIndex/sistrip::FEDCH_PER_FED); - aFedChannel = static_cast(aFedIndex%sistrip::FEDCH_PER_FED); - - if (aFedId < sistrip::FED_ID_MIN || - aFedId > sistrip::FED_ID_MAX || - aFedChannel >= sistrip::FEDCH_PER_FED ) { + aFedId = static_cast(aFedIndex / sistrip::FEDCH_PER_FED); + aFedChannel = static_cast(aFedIndex % sistrip::FEDCH_PER_FED); + + if (aFedId < sistrip::FED_ID_MIN || aFedId > sistrip::FED_ID_MAX || aFedChannel >= sistrip::FEDCH_PER_FED) { aFedId = sistrip::invalid_; aFedChannel = sistrip::invalid_; } - } - std::pair SpyUtilities::findMajorityValue(std::vector& values, - const uint16_t aFedId) - { - + std::pair SpyUtilities::findMajorityValue(std::vector& values, const uint16_t aFedId) { uint32_t lTot = values.size(); - if (!lTot) return std::pair(0,0); + if (!lTot) + return std::pair(0, 0); - std::sort(values.begin(),values.end()); + std::sort(values.begin(), values.end()); uint32_t lMajorityCounter = 0; uint16_t lMaj = 0; std::vector::iterator lIter = values.begin(); - for ( ; lIter != values.end(); ) { - uint32_t lCounter = std::count(lIter,values.end(),*lIter); + for (; lIter != values.end();) { + uint32_t lCounter = std::count(lIter, values.end(), *lIter); if (lCounter > lMajorityCounter) { - lMajorityCounter = lCounter; - lMaj = *lIter; + lMajorityCounter = lCounter; + lMaj = *lIter; } lIter += lCounter; } - + //std::cout << " -- Found majority value " << lMaj << " for " << lMajorityCounter << " elements out of " << values.size() << "." << std::endl; - if (static_cast(lMajorityCounter)/lTot < 0.5) { - LogError("SiStripSpyUtilities") << " -- Found majority position for index " - << aFedId - << ": " << lMaj - << " for less than half the values : " << lMajorityCounter << " out of " << lTot << " values." - << std::endl; + if (static_cast(lMajorityCounter) / lTot < 0.5) { + LogError("SiStripSpyUtilities") << " -- Found majority position for index " << aFedId << ": " << lMaj + << " for less than half the values : " << lMajorityCounter << " out of " << lTot + << " values." << std::endl; } - return std::pair(lMaj,lMajorityCounter); - + return std::pair(lMaj, lMajorityCounter); } - void SpyUtilities::fillFEDMajorities(const std::map& channelValues, - std::vector & fedMajoritiesToFill) - { - - std::map::const_iterator lMapIter = channelValues.begin(); + void SpyUtilities::fillFEDMajorities(const std::map& channelValues, + std::vector& fedMajoritiesToFill) { + std::map::const_iterator lMapIter = channelValues.begin(); uint16_t lPreviousFedId = 0; std::vector lAddrVec; lAddrVec.reserve(sistrip::FEDCH_PER_FED); - fedMajoritiesToFill.resize(sistrip::FED_ID_MAX-sistrip::FED_ID_MIN+1,0); + fedMajoritiesToFill.resize(sistrip::FED_ID_MAX - sistrip::FED_ID_MIN + 1, 0); uint32_t lChCount = 0; - for ( ; lMapIter != channelValues.end(); ++lMapIter,++lChCount){ - - uint16_t lFedId = static_cast(lMapIter->first/sistrip::FEDCH_PER_FED); + for (; lMapIter != channelValues.end(); ++lMapIter, ++lChCount) { + uint16_t lFedId = static_cast(lMapIter->first / sistrip::FEDCH_PER_FED); if (lPreviousFedId == 0) { - lPreviousFedId = lFedId; + lPreviousFedId = lFedId; } if (lFedId == lPreviousFedId) { - lAddrVec.push_back(lMapIter->second); + lAddrVec.push_back(lMapIter->second); } - if (lFedId != lPreviousFedId || (lChCount == channelValues.size()-1)) { - //extract majority address + if (lFedId != lPreviousFedId || (lChCount == channelValues.size() - 1)) { + //extract majority address - uint32_t lMaj = sistrip::SpyUtilities::findMajorityValue(lAddrVec,lPreviousFedId).first; - fedMajoritiesToFill[lPreviousFedId] = lMaj; + uint32_t lMaj = sistrip::SpyUtilities::findMajorityValue(lAddrVec, lPreviousFedId).first; + fedMajoritiesToFill[lPreviousFedId] = lMaj; - lAddrVec.clear(); - - //if new fed, fill the first channel - if (lFedId != lPreviousFedId) { - lAddrVec.push_back(lMapIter->second); - lPreviousFedId = lFedId; - } + lAddrVec.clear(); + //if new fed, fill the first channel + if (lFedId != lPreviousFedId) { + lAddrVec.push_back(lMapIter->second); + lPreviousFedId = lFedId; + } } } - } -}//namespace +} // namespace sistrip diff --git a/Validation/MuonHits/interface/CSCSimHitMatcher.h b/Validation/MuonHits/interface/CSCSimHitMatcher.h index f8d9c59458a61..e569f23d342af 100644 --- a/Validation/MuonHits/interface/CSCSimHitMatcher.h +++ b/Validation/MuonHits/interface/CSCSimHitMatcher.h @@ -12,7 +12,7 @@ #include "Validation/MuonHits/interface/MuonSimHitMatcher.h" class CSCSimHitMatcher : public MuonSimHitMatcher { - public: +public: // constructor CSCSimHitMatcher(const edm::ParameterSet& iPS, edm::ConsumesCollector&& iC); @@ -70,7 +70,7 @@ class CSCSimHitMatcher : public MuonSimHitMatcher { void camberIdsToString(const std::set&) const; - private: +private: void matchSimHitsToSimTrack(); edm::ESHandle csc_geom_; diff --git a/Validation/MuonHits/interface/DTSimHitMatcher.h b/Validation/MuonHits/interface/DTSimHitMatcher.h index 98895b6b0a515..1eaa9bc4a23e7 100644 --- a/Validation/MuonHits/interface/DTSimHitMatcher.h +++ b/Validation/MuonHits/interface/DTSimHitMatcher.h @@ -12,7 +12,7 @@ #include "Validation/MuonHits/interface/MuonSimHitMatcher.h" class DTSimHitMatcher : public MuonSimHitMatcher { - public: +public: // constructor DTSimHitMatcher(const edm::ParameterSet& iPS, edm::ConsumesCollector&& iC); @@ -61,16 +61,13 @@ class DTSimHitMatcher : public MuonSimHitMatcher { // calculate the average position at the second station GlobalPoint simHitsMeanPositionStation(int n) const; - std::set hitWiresInDTLayerId( - unsigned int, int margin_n_wires = 0) const; // DT - std::set hitWiresInDTSuperLayerId( - unsigned int, int margin_n_wires = 0) const; // DT - std::set hitWiresInDTChamberId( - unsigned int, int margin_n_wires = 0) const; // DT + std::set hitWiresInDTLayerId(unsigned int, int margin_n_wires = 0) const; // DT + std::set hitWiresInDTSuperLayerId(unsigned int, int margin_n_wires = 0) const; // DT + std::set hitWiresInDTChamberId(unsigned int, int margin_n_wires = 0) const; // DT void dtChamberIdsToString(const std::set&) const; - private: +private: void matchSimHitsToSimTrack(); std::map layer_to_hits_; diff --git a/Validation/MuonHits/interface/GEMSimHitMatcher.h b/Validation/MuonHits/interface/GEMSimHitMatcher.h index eda6fe813bbbd..a2443e9a1c75d 100644 --- a/Validation/MuonHits/interface/GEMSimHitMatcher.h +++ b/Validation/MuonHits/interface/GEMSimHitMatcher.h @@ -12,7 +12,7 @@ #include "Validation/MuonHits/interface/MuonSimHitMatcher.h" class GEMSimHitMatcher : public MuonSimHitMatcher { - public: +public: // constructor GEMSimHitMatcher(const edm::ParameterSet& iPS, edm::ConsumesCollector&& iC); @@ -29,8 +29,7 @@ class GEMSimHitMatcher : public MuonSimHitMatcher { std::set detIds(int gem_type = MuonHitHelper::GEM_ALL) const; // chamber detIds with SimHits - std::set chamberIds( - int gem_type = MuonHitHelper::GEM_ALL) const; + std::set chamberIds(int gem_type = MuonHitHelper::GEM_ALL) const; // GEM detid's with hits in 2 layers of coincidence pads // those are layer==1 only detid's @@ -73,7 +72,7 @@ class GEMSimHitMatcher : public MuonSimHitMatcher { // what unique partitions numbers were hit by this simtrack? std::set hitPartitions() const; - private: +private: void matchSimHitsToSimTrack(); edm::ESHandle gem_geom_; diff --git a/Validation/MuonHits/interface/ME0SimHitMatcher.h b/Validation/MuonHits/interface/ME0SimHitMatcher.h index 38b433a65b1e9..834269ccd94e9 100644 --- a/Validation/MuonHits/interface/ME0SimHitMatcher.h +++ b/Validation/MuonHits/interface/ME0SimHitMatcher.h @@ -12,7 +12,7 @@ #include "Validation/MuonHits/interface/MuonSimHitMatcher.h" class ME0SimHitMatcher : public MuonSimHitMatcher { - public: +public: // constructor ME0SimHitMatcher(const edm::ParameterSet& iPS, edm::ConsumesCollector&& iC); @@ -41,8 +41,7 @@ class ME0SimHitMatcher : public MuonSimHitMatcher { int nLayersWithHitsInSuperChamber(unsigned int) const; // ME0 superchamber detIds with SimHits >=4 layers of coincidence pads - std::set superChamberIdsCoincidences( - int min_n_layers = 4) const; + std::set superChamberIdsCoincidences(int min_n_layers = 4) const; // How many ME0 chambers with minimum number of layer with simhits did this // simtrack get? @@ -60,7 +59,7 @@ class ME0SimHitMatcher : public MuonSimHitMatcher { // How many pads with simhits in ME0 did this simtrack get? int nPadsWithHits() const; - private: +private: void matchSimHitsToSimTrack(); edm::ESHandle me0_geom_; diff --git a/Validation/MuonHits/interface/MuonHitHelper.h b/Validation/MuonHits/interface/MuonHitHelper.h index fd97dfd9645c8..b84903ea18e2d 100644 --- a/Validation/MuonHits/interface/MuonHitHelper.h +++ b/Validation/MuonHits/interface/MuonHitHelper.h @@ -9,7 +9,7 @@ #include "DataFormats/MuonDetId/interface/RPCDetId.h" class MuonHitHelper { - public: +public: /// CSC chamber types, according to CSCDetId::iChamberType() enum CSCType { CSC_ALL = 0, diff --git a/Validation/MuonHits/interface/MuonSimHitMatcher.h b/Validation/MuonHits/interface/MuonSimHitMatcher.h index eb99675850064..bc1af70253137 100644 --- a/Validation/MuonHits/interface/MuonSimHitMatcher.h +++ b/Validation/MuonHits/interface/MuonSimHitMatcher.h @@ -31,7 +31,7 @@ #include class MuonSimHitMatcher { - public: +public: // constructor MuonSimHitMatcher(const edm::ParameterSet& iPS, edm::ConsumesCollector&& iC); @@ -67,10 +67,10 @@ class MuonSimHitMatcher { // calculate the average position at the second station GlobalPoint simHitsMeanPositionStation(int n) const; - protected: - std::vector getIdsOfSimTrackShower( - unsigned trk_id, const edm::SimTrackContainer& simTracks, - const edm::SimVertexContainer& simVertices); +protected: + std::vector getIdsOfSimTrackShower(unsigned trk_id, + const edm::SimTrackContainer& simTracks, + const edm::SimVertexContainer& simVertices); bool verboseSimTrack_; bool simMuOnly_; diff --git a/Validation/MuonHits/interface/RPCSimHitMatcher.h b/Validation/MuonHits/interface/RPCSimHitMatcher.h index bc078327d3498..dcaf264d24058 100644 --- a/Validation/MuonHits/interface/RPCSimHitMatcher.h +++ b/Validation/MuonHits/interface/RPCSimHitMatcher.h @@ -12,7 +12,7 @@ #include "Validation/MuonHits/interface/MuonSimHitMatcher.h" class RPCSimHitMatcher : public MuonSimHitMatcher { - public: +public: // constructor RPCSimHitMatcher(const edm::ParameterSet& iPS, edm::ConsumesCollector&& iC); @@ -41,7 +41,7 @@ class RPCSimHitMatcher : public MuonSimHitMatcher { std::set hitStripsInDetId(unsigned int, int margin_n_strips = 0) const; - private: +private: void matchSimHitsToSimTrack(); edm::ESHandle rpc_geom_; diff --git a/Validation/MuonHits/plugins/MuonSimHitsValidAnalyzer.cc b/Validation/MuonHits/plugins/MuonSimHitsValidAnalyzer.cc index c7cc0800f9624..0847a5398f93c 100644 --- a/Validation/MuonHits/plugins/MuonSimHitsValidAnalyzer.cc +++ b/Validation/MuonHits/plugins/MuonSimHitsValidAnalyzer.cc @@ -11,249 +11,247 @@ using namespace edm; using namespace std; - -MuonSimHitsValidAnalyzer::MuonSimHitsValidAnalyzer(const edm::ParameterSet& iPSet) : - fName(""), verbosity(0), label(""), getAllProvenances(false), - printProvenanceInfo(false), nRawGenPart(0), count(0) +MuonSimHitsValidAnalyzer::MuonSimHitsValidAnalyzer(const edm::ParameterSet& iPSet) + : fName(""), + verbosity(0), + label(""), + getAllProvenances(false), + printProvenanceInfo(false), + nRawGenPart(0), + count(0) { /// get information from parameter set fName = iPSet.getUntrackedParameter("Name"); verbosity = iPSet.getUntrackedParameter("Verbosity"); label = iPSet.getParameter("Label"); - edm::ParameterSet m_Prov = - iPSet.getParameter("ProvenanceLookup"); - getAllProvenances = - m_Prov.getUntrackedParameter("GetAllProvenances"); - printProvenanceInfo = - m_Prov.getUntrackedParameter("PrintProvenanceInfo"); - - nRawGenPart = 0; - - /// get labels for input tags - DTHitsToken_ = consumes( - iPSet.getParameter("DTHitsSrc")); - - /// print out Parameter Set information being used - - if (verbosity) { - Labels l; - labelsForToken(DTHitsToken_, l); - edm::LogInfo ("MuonSimHitsValidAnalyzer::MuonSimHitsValidAnalyzer") - << "\n===============================\n" - << "Initialized as EDAnalyzer with parameter values:\n" - << " Name = " << fName << "\n" - << " Verbosity = " << verbosity << "\n" - << " Label = " << label << "\n" - << " GetProv = " << getAllProvenances << "\n" - << " PrintProv = " << printProvenanceInfo << "\n" - // << " CSCHitsSrc= " <("ProvenanceLookup"); + getAllProvenances = m_Prov.getUntrackedParameter("GetAllProvenances"); + printProvenanceInfo = m_Prov.getUntrackedParameter("PrintProvenanceInfo"); + + nRawGenPart = 0; + + /// get labels for input tags + DTHitsToken_ = consumes(iPSet.getParameter("DTHitsSrc")); + + /// print out Parameter Set information being used + + if (verbosity) { + Labels l; + labelsForToken(DTHitsToken_, l); + edm::LogInfo("MuonSimHitsValidAnalyzer::MuonSimHitsValidAnalyzer") + << "\n===============================\n" + << "Initialized as EDAnalyzer with parameter values:\n" + << " Name = " << fName << "\n" + << " Verbosity = " << verbosity << "\n" + << " Label = " << label << "\n" + << " GetProv = " << getAllProvenances << "\n" + << " PrintProv = " << printProvenanceInfo + << "\n" + // << " CSCHitsSrc= " < 0) { - edm::LogInfo ("MuonSimHitsValidAnalyzer::analyze") - << "Processing run " << nrun << ", event " << nevt; + edm::LogInfo("MuonSimHitsValidAnalyzer::analyze") << "Processing run " << nrun << ", event " << nevt; } /// look at information available in the event if (getAllProvenances) { - std::vector AllProv; iEvent.getAllStableProvenance(AllProv); if (verbosity > 0) - edm::LogInfo ("MuonSimHitsValidAnalyzer::analyze") - << "Number of Provenances = " << AllProv.size(); + edm::LogInfo("MuonSimHitsValidAnalyzer::analyze") << "Number of Provenances = " << AllProv.size(); if (printProvenanceInfo && (verbosity > 0)) { TString eventout("\nProvenance info:\n"); for (unsigned int i = 0; i < AllProv.size(); ++i) { - eventout += "\n ******************************"; - eventout += "\n Module : "; - eventout += AllProv[i]->moduleLabel(); - eventout += "\n ProductID : "; - eventout += AllProv[i]->productID().id(); - eventout += "\n ClassName : "; - eventout += AllProv[i]->className(); - eventout += "\n InstanceName : "; - eventout += AllProv[i]->productInstanceName(); - eventout += "\n BranchName : "; - eventout += AllProv[i]->branchName(); + eventout += "\n ******************************"; + eventout += "\n Module : "; + eventout += AllProv[i]->moduleLabel(); + eventout += "\n ProductID : "; + eventout += AllProv[i]->productID().id(); + eventout += "\n ClassName : "; + eventout += AllProv[i]->className(); + eventout += "\n InstanceName : "; + eventout += AllProv[i]->productInstanceName(); + eventout += "\n BranchName : "; + eventout += AllProv[i]->branchName(); } eventout += " ******************************\n"; edm::LogInfo("MuonSimHitsValidAnalyzer::analyze") << eventout << "\n"; @@ -300,16 +295,13 @@ void MuonSimHitsValidAnalyzer::analyze(const edm::Event& iEvent, fillDT(iEvent, iSetup); if (verbosity > 0) - edm::LogInfo ("MuonSimHitsValidAnalyzer::analyze") - << "Done gathering data from event."; + edm::LogInfo("MuonSimHitsValidAnalyzer::analyze") << "Done gathering data from event."; return; } -void MuonSimHitsValidAnalyzer::fillDT(const edm::Event& iEvent, - const edm::EventSetup& iSetup) -{ - TString eventout; +void MuonSimHitsValidAnalyzer::fillDT(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + TString eventout; if (verbosity > 0) eventout = "\nGathering DT info:"; @@ -322,7 +314,7 @@ void MuonSimHitsValidAnalyzer::fillDT(const edm::Event& iEvent, iSetup.get().get(theDTGeometry); if (!theDTGeometry.isValid()) { edm::LogWarning("MuonSimHitsValidAnalyzer::fillDT") - << "Unable to find MuonGeometryRecord for the DTGeometry in event!"; + << "Unable to find MuonGeometryRecord for the DTGeometry in event!"; return; } const DTGeometry& theDTMuon(*theDTGeometry); @@ -331,22 +323,19 @@ void MuonSimHitsValidAnalyzer::fillDT(const edm::Event& iEvent, edm::Handle MuonDTContainer; iEvent.getByToken(DTHitsToken_, MuonDTContainer); if (!MuonDTContainer.isValid()) { - edm::LogWarning("MuonSimHitsValidAnalyzer::fillDT") - << "Unable to find MuonDTHits in event!"; + edm::LogWarning("MuonSimHitsValidAnalyzer::fillDT") << "Unable to find MuonDTHits in event!"; return; } touch1 = 0; touch4 = 0; - nummu_DT = 0 ; + nummu_DT = 0; - meAllDTHits->Fill( MuonDTContainer->size() ); + meAllDTHits->Fill(MuonDTContainer->size()); /// cycle through container int i = 0, j = 0; - for (itHit = MuonDTContainer->begin(); itHit != MuonDTContainer->end(); - ++itHit) { - + for (itHit = MuonDTContainer->begin(); itHit != MuonDTContainer->end(); ++itHit) { ++i; /// create a DetId from the detUnitId @@ -355,16 +344,13 @@ void MuonSimHitsValidAnalyzer::fillDT(const edm::Event& iEvent, int subdetector = theDetUnitId.subdetId(); /// check that expected detector is returned - if ((detector == dMuon) && - (subdetector == sdMuonDT)) { - + if ((detector == dMuon) && (subdetector == sdMuonDT)) { /// get the GeomDetUnit from the geometry using theDetUnitID - const GeomDetUnit *theDet = theDTMuon.idToDetUnit(theDetUnitId); + const GeomDetUnit* theDet = theDTMuon.idToDetUnit(theDetUnitId); if (!theDet) { - edm::LogWarning("MuonSimHitsValidAnalyzer::fillDT") - << "Unable to get GeomDetUnit from theDTMuon for hit " << i; - continue; + edm::LogWarning("MuonSimHitsValidAnalyzer::fillDT") << "Unable to get GeomDetUnit from theDTMuon for hit " << i; + continue; } ++j; @@ -374,122 +360,112 @@ void MuonSimHitsValidAnalyzer::fillDT(const edm::Event& iEvent, /// gather necessary information - if ( abs(itHit->particleType()) == 13 ) { - - nummu_DT++; - meToF->Fill( itHit->tof() ); - meEnergyLoss->Fill( itHit->energyLoss()*pow6 ); - - iden = itHit->detUnitId(); - - wheel = ((iden>>15) & 0x7 ) -3 ; - station = ((iden>>22) & 0x7 ) ; - sector = ((iden>>18) & 0xf ) ; - superlayer = ((iden>>13) & 0x3 ) ; - layer = ((iden>>10) & 0x7 ) ; - wire = ((iden>>3) & 0x7f ) ; - - meWheelOccup->Fill((float)wheel); - meStationOccup->Fill((float) station); - meSectorOccup->Fill((float) sector); - meSuperLOccup->Fill((float) superlayer); - meLayerOccup->Fill((float) layer); - meWireOccup->Fill((float) wire); - - // Define a quantity to take into account station, splayer and layer being hit. - path = (station-1) * 40 + superlayer * 10 + layer; - mePathMuon->Fill((float) path); - - // Define a quantity to take into chamber being hit. - pathchamber = (wheel+2) * 50 + (station-1) * 12 + sector; - meChamberOccup->Fill((float) pathchamber); - - /// Muon Momentum at MB1 - if (station == 1 ) - { - if (touch1 == 0) - { - mom1=itHit->pabs(); - meMomentumMB1->Fill(mom1); - touch1 = 1; - } + if (abs(itHit->particleType()) == 13) { + nummu_DT++; + meToF->Fill(itHit->tof()); + meEnergyLoss->Fill(itHit->energyLoss() * pow6); + + iden = itHit->detUnitId(); + + wheel = ((iden >> 15) & 0x7) - 3; + station = ((iden >> 22) & 0x7); + sector = ((iden >> 18) & 0xf); + superlayer = ((iden >> 13) & 0x3); + layer = ((iden >> 10) & 0x7); + wire = ((iden >> 3) & 0x7f); + + meWheelOccup->Fill((float)wheel); + meStationOccup->Fill((float)station); + meSectorOccup->Fill((float)sector); + meSuperLOccup->Fill((float)superlayer); + meLayerOccup->Fill((float)layer); + meWireOccup->Fill((float)wire); + + // Define a quantity to take into account station, splayer and layer being hit. + path = (station - 1) * 40 + superlayer * 10 + layer; + mePathMuon->Fill((float)path); + + // Define a quantity to take into chamber being hit. + pathchamber = (wheel + 2) * 50 + (station - 1) * 12 + sector; + meChamberOccup->Fill((float)pathchamber); + + /// Muon Momentum at MB1 + if (station == 1) { + if (touch1 == 0) { + mom1 = itHit->pabs(); + meMomentumMB1->Fill(mom1); + touch1 = 1; + } } - /// Muon Momentum at MB4 & Loss of Muon Momentum in Iron (between MB1 and MB4) - if (station == 4 ) - { - if ( touch4 == 0) - { - mom4=itHit->pabs(); - touch4 = 1; - meMomentumMB4->Fill(mom4); - if (touch1 == 1 ) - { - meLossMomIron->Fill(mom1-mom4); + /// Muon Momentum at MB4 & Loss of Muon Momentum in Iron (between MB1 and MB4) + if (station == 4) { + if (touch4 == 0) { + mom4 = itHit->pabs(); + touch4 = 1; + meMomentumMB4->Fill(mom4); + if (touch1 == 1) { + meLossMomIron->Fill(mom1 - mom4); + } } - } } - /// X-Local Coordinate vs Z-Local Coordinate - meLocalXvsZ->Fill(itHit->localPosition().x(), itHit->localPosition().z() ); + /// X-Local Coordinate vs Z-Local Coordinate + meLocalXvsZ->Fill(itHit->localPosition().x(), itHit->localPosition().z()); - /// X-Local Coordinate vs Y-Local Coordinate - meLocalXvsY->Fill(itHit->localPosition().x(), itHit->localPosition().y() ); + /// X-Local Coordinate vs Y-Local Coordinate + meLocalXvsY->Fill(itHit->localPosition().x(), itHit->localPosition().y()); - /// Global Coordinates + /// Global Coordinates - globposz = bsurf.toGlobal(itHit->localPosition()).z(); - globposeta = bsurf.toGlobal(itHit->localPosition()).eta(); - globposphi = bsurf.toGlobal(itHit->localPosition()).phi(); + globposz = bsurf.toGlobal(itHit->localPosition()).z(); + globposeta = bsurf.toGlobal(itHit->localPosition()).eta(); + globposphi = bsurf.toGlobal(itHit->localPosition()).phi(); - radius = globposz* ( 1.+ exp(-2.* globposeta) ) / ( 1. - exp(-2.* globposeta ) ) ; + radius = globposz * (1. + exp(-2. * globposeta)) / (1. - exp(-2. * globposeta)); - costeta = ( 1. - exp(-2.*globposeta) ) /( 1. + exp(-2.* globposeta) ) ; - sinteta = 2. * exp(-globposeta) /( 1. + exp(-2.*globposeta) ); + costeta = (1. - exp(-2. * globposeta)) / (1. + exp(-2. * globposeta)); + sinteta = 2. * exp(-globposeta) / (1. + exp(-2. * globposeta)); - /// Z-Global Coordinate vs X-Global Coordinate - /// Y-Global Coordinate vs X-Global Coordinate - globposx = radius*sinteta*cos(globposphi); - globposy = radius*sinteta*sin(globposphi); + /// Z-Global Coordinate vs X-Global Coordinate + /// Y-Global Coordinate vs X-Global Coordinate + globposx = radius * sinteta * cos(globposphi); + globposy = radius * sinteta * sin(globposphi); - meGlobalXvsZ->Fill(globposz, globposx); - meGlobalXvsY->Fill(globposx, globposy); - -// New Histos - if (wheel == -2) { - meGlobalXvsZWm2->Fill(globposz, globposx); - meGlobalXvsYWm2->Fill(globposx, globposy); - } - if (wheel == -1) { - meGlobalXvsZWm1->Fill(globposz, globposx); - meGlobalXvsYWm1->Fill(globposx, globposy); - } - if (wheel == 0) { - meGlobalXvsZW0->Fill(globposz, globposx); - meGlobalXvsYW0->Fill(globposx, globposy); - } - if (wheel == 1) { - meGlobalXvsZWp1->Fill(globposz, globposx); - meGlobalXvsYWp1->Fill(globposx, globposy); - } - if (wheel == 2) { - meGlobalXvsZWp2->Fill(globposz, globposx); - meGlobalXvsYWp2->Fill(globposx, globposy); - } -// - meHitRadius->Fill(radius); - meCosTheta->Fill(costeta); - meGlobalEta->Fill(globposeta); - meGlobalPhi->Fill(globposphi); + meGlobalXvsZ->Fill(globposz, globposx); + meGlobalXvsY->Fill(globposx, globposy); + // New Histos + if (wheel == -2) { + meGlobalXvsZWm2->Fill(globposz, globposx); + meGlobalXvsYWm2->Fill(globposx, globposy); + } + if (wheel == -1) { + meGlobalXvsZWm1->Fill(globposz, globposx); + meGlobalXvsYWm1->Fill(globposx, globposy); + } + if (wheel == 0) { + meGlobalXvsZW0->Fill(globposz, globposx); + meGlobalXvsYW0->Fill(globposx, globposy); + } + if (wheel == 1) { + meGlobalXvsZWp1->Fill(globposz, globposx); + meGlobalXvsYWp1->Fill(globposx, globposy); + } + if (wheel == 2) { + meGlobalXvsZWp2->Fill(globposz, globposx); + meGlobalXvsYWp2->Fill(globposx, globposy); + } + // + meHitRadius->Fill(radius); + meCosTheta->Fill(costeta); + meGlobalEta->Fill(globposeta); + meGlobalPhi->Fill(globposphi); } } else { edm::LogWarning("MuonSimHitsValidAnalyzer::fillDT") - << "MuonDT PSimHit " << i - << " is expected to be (det,subdet) = (" - << dMuon << "," << sdMuonDT - << "); value returned is: (" - << detector << "," << subdetector << ")"; + << "MuonDT PSimHit " << i << " is expected to be (det,subdet) = (" << dMuon << "," << sdMuonDT + << "); value returned is: (" << detector << "," << subdetector << ")"; continue; } } @@ -498,9 +474,9 @@ void MuonSimHitsValidAnalyzer::fillDT(const edm::Event& iEvent, eventout += "\n Number of DT muon Hits collected:......... "; eventout += j; } - meMuDTHits->Fill( (float) nummu_DT ); + meMuDTHits->Fill((float)nummu_DT); if (verbosity > 0) edm::LogInfo("MuonSimHitsValidAnalyzer::fillDT") << eventout << "\n"; -return; + return; } diff --git a/Validation/MuonHits/plugins/MuonSimHitsValidAnalyzer.h b/Validation/MuonHits/plugins/MuonSimHitsValidAnalyzer.h index 3bbf5fd382201..3a385e805bf97 100644 --- a/Validation/MuonHits/plugins/MuonSimHitsValidAnalyzer.h +++ b/Validation/MuonHits/plugins/MuonSimHitsValidAnalyzer.h @@ -43,28 +43,27 @@ class TH1F; class TFile; namespace edm { - class ParameterSet; class Event; class EventSetup;} - -class MuonSimHitsValidAnalyzer : public DQMEDAnalyzer -{ - - public: + class ParameterSet; + class Event; + class EventSetup; +} // namespace edm +class MuonSimHitsValidAnalyzer : public DQMEDAnalyzer { +public: typedef std::vector FloatVector; - typedef std::vector IntegerVector; - typedef std::vector LongIntegerVector; - typedef std::vector UnsigIntegerVector; + typedef std::vector IntegerVector; + typedef std::vector LongIntegerVector; + typedef std::vector UnsigIntegerVector; explicit MuonSimHitsValidAnalyzer(const edm::ParameterSet&); ~MuonSimHitsValidAnalyzer() override; - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override; void analyze(const edm::Event&, const edm::EventSetup&) override; - private: +private: void fillDT(const edm::Event&, const edm::EventSetup&); - private: - +private: /// parameter information std::string fName; int verbosity; @@ -83,7 +82,7 @@ class MuonSimHitsValidAnalyzer : public DQMEDAnalyzer Int_t touche1, touche4; Float_t pow6; Float_t mom1, mom4, mome1, mome4; - Float_t costeta, radius,sinteta; + Float_t costeta, radius, sinteta; Float_t globposx, globposy, globposz; Float_t globposphi, globposeta; @@ -129,14 +128,14 @@ class MuonSimHitsValidAnalyzer : public DQMEDAnalyzer /// private statistics information unsigned int count; -}; /// end class declaration +}; /// end class declaration /// geometry mapping -static const int dMuon = 2; +static const int dMuon = 2; -static const int sdMuonDT = 1; -static const int sdMuonCSC = 2; -static const int sdMuonRPC = 3; +static const int sdMuonDT = 1; +static const int sdMuonCSC = 2; +static const int sdMuonRPC = 3; #endif diff --git a/Validation/MuonHits/src/CSCSimHitMatcher.cc b/Validation/MuonHits/src/CSCSimHitMatcher.cc index 4332b42dc8fe8..9cc01baef6aaa 100644 --- a/Validation/MuonHits/src/CSCSimHitMatcher.cc +++ b/Validation/MuonHits/src/CSCSimHitMatcher.cc @@ -2,28 +2,24 @@ using namespace std; -CSCSimHitMatcher::CSCSimHitMatcher(const edm::ParameterSet& ps, - edm::ConsumesCollector&& iC) +CSCSimHitMatcher::CSCSimHitMatcher(const edm::ParameterSet& ps, edm::ConsumesCollector&& iC) : MuonSimHitMatcher(ps, std::move(iC)) { simHitPSet_ = ps.getParameterSet("cscSimHit"); verbose_ = simHitPSet_.getParameter("verbose"); simMuOnly_ = simHitPSet_.getParameter("simMuOnly"); discardEleHits_ = simHitPSet_.getParameter("discardEleHits"); - simHitInput_ = iC.consumes( - simHitPSet_.getParameter("inputTag")); + simHitInput_ = iC.consumes(simHitPSet_.getParameter("inputTag")); } /// initialize the event -void CSCSimHitMatcher::init(const edm::Event& iEvent, - const edm::EventSetup& iSetup) { +void CSCSimHitMatcher::init(const edm::Event& iEvent, const edm::EventSetup& iSetup) { iSetup.get().get(csc_geom_); if (csc_geom_.isValid()) { geometry_ = &*csc_geom_; } else { hasGeometry_ = false; - edm::LogWarning("CSCSimHitMatcher") - << "+++ Info: CSC geometry is unavailable. +++\n"; + edm::LogWarning("CSCSimHitMatcher") << "+++ Info: CSC geometry is unavailable. +++\n"; } MuonSimHitMatcher::init(iEvent, iSetup); } @@ -37,11 +33,9 @@ void CSCSimHitMatcher::match(const SimTrack& track, const SimVertex& vertex) { matchSimHitsToSimTrack(); if (verbose_) { - edm::LogInfo("CSCSimHitMatcher") - << "nTrackIds " << track_ids_.size() << " nSelectedCSCSimHits " - << hits_.size() << endl; - edm::LogInfo("CSCSimHitMatcher") - << "detids CSC " << detIds(0).size() << endl; + edm::LogInfo("CSCSimHitMatcher") << "nTrackIds " << track_ids_.size() << " nSelectedCSCSimHits " << hits_.size() + << endl; + edm::LogInfo("CSCSimHitMatcher") << "detids CSC " << detIds(0).size() << endl; for (const auto& id : detIds(0)) { const auto& simhits = hitsInDetId(id); @@ -49,11 +43,9 @@ void CSCSimHitMatcher::match(const SimTrack& track, const SimVertex& vertex) { const auto& strips = hitStripsInDetId(id); CSCDetId cscid(id); if (cscid.station() == 1 and (cscid.ring() == 1 or cscid.ring() == 4)) { - edm::LogInfo("CSCSimHitMatcher") - << "cscdetid " << CSCDetId(id) << ": " << simhits.size() << " " - << simhits_gp.phi() << " " << detid_to_hits_[id].size() << endl; - edm::LogInfo("CSCSimHitMatcher") - << "nStrip " << strips.size() << endl; + edm::LogInfo("CSCSimHitMatcher") << "cscdetid " << CSCDetId(id) << ": " << simhits.size() << " " + << simhits_gp.phi() << " " << detid_to_hits_[id].size() << endl; + edm::LogInfo("CSCSimHitMatcher") << "nStrip " << strips.size() << endl; edm::LogInfo("CSCSimHitMatcher") << "strips : "; for (const auto& p : strips) { edm::LogInfo("CSCSimHitMatcher") << p; @@ -67,11 +59,14 @@ void CSCSimHitMatcher::match(const SimTrack& track, const SimVertex& vertex) { void CSCSimHitMatcher::matchSimHitsToSimTrack() { for (const auto& track_id : track_ids_) { for (const auto& h : simHits_) { - if (h.trackId() != track_id) continue; + if (h.trackId() != track_id) + continue; int pdgid = h.particleType(); - if (simMuOnly_ && std::abs(pdgid) != 13) continue; + if (simMuOnly_ && std::abs(pdgid) != 13) + continue; // discard electron hits in the CSC chambers - if (discardEleHits_ && pdgid == 11) continue; + if (discardEleHits_ && pdgid == 11) + continue; const CSCDetId& layer_id(h.detUnitId()); hits_.push_back(h); @@ -123,14 +118,16 @@ bool CSCSimHitMatcher::hitStation(int st, int nlayers) const { for (const auto& ddt : chamberIds()) { const CSCDetId id(ddt); int ri(id.ring()); - if (id.station() != st) continue; + if (id.station() != st) + continue; // ME1/a case - check the ME1/b chamber if (st == 1 and ri == 4) { CSCDetId idME1b(id.endcap(), id.station(), 1, id.chamber(), 0); const int nl1a(nLayersWithHitsInChamber(id.rawId())); const int nl1b(nLayersWithHitsInChamber(idME1b.rawId())); - if (nl1a + nl1b < nlayers) continue; + if (nl1a + nl1b < nlayers) + continue; ++nst; } // ME1/b case - check the ME1/a chamber @@ -138,13 +135,15 @@ bool CSCSimHitMatcher::hitStation(int st, int nlayers) const { CSCDetId idME1a(id.endcap(), id.station(), 4, id.chamber(), 0); const int nl1a(nLayersWithHitsInChamber(idME1a.rawId())); const int nl1b(nLayersWithHitsInChamber(id.rawId())); - if (nl1a + nl1b < nlayers) continue; + if (nl1a + nl1b < nlayers) + continue; ++nst; } // default case else { const int nl(nLayersWithHitsInChamber(id.rawId())); - if (nl < nlayers) continue; + if (nl < nlayers) + continue; ++nst; } } @@ -152,30 +151,24 @@ bool CSCSimHitMatcher::hitStation(int st, int nlayers) const { } int CSCSimHitMatcher::nStations(int nlayers) const { - return (hitStation(1, nlayers) + hitStation(2, nlayers) + - hitStation(3, nlayers) + hitStation(4, nlayers)); + return (hitStation(1, nlayers) + hitStation(2, nlayers) + hitStation(3, nlayers) + hitStation(4, nlayers)); } float CSCSimHitMatcher::LocalBendingInChamber(unsigned int detid) const { const CSCDetId cscid(detid); - if (nLayersWithHitsInChamber(detid) < 6) return -100; + if (nLayersWithHitsInChamber(detid) < 6) + return -100; float phi_layer1 = -10; float phi_layer6 = 10; if (cscid.station() == 1 and (cscid.ring() == 1 or cscid.ring() == 4)) { // phi in layer 1 - const CSCDetId cscid1a(cscid.endcap(), cscid.station(), 4, cscid.chamber(), - 1); - const CSCDetId cscid1b(cscid.endcap(), cscid.station(), 1, cscid.chamber(), - 1); - const edm::PSimHitContainer& hits1a = - MuonSimHitMatcher::hitsInDetId(cscid1a.rawId()); - const edm::PSimHitContainer& hits1b = - MuonSimHitMatcher::hitsInDetId(cscid1b.rawId()); - const GlobalPoint& gp1a = - simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid1a.rawId())); - const GlobalPoint& gp1b = - simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid1b.rawId())); + const CSCDetId cscid1a(cscid.endcap(), cscid.station(), 4, cscid.chamber(), 1); + const CSCDetId cscid1b(cscid.endcap(), cscid.station(), 1, cscid.chamber(), 1); + const edm::PSimHitContainer& hits1a = MuonSimHitMatcher::hitsInDetId(cscid1a.rawId()); + const edm::PSimHitContainer& hits1b = MuonSimHitMatcher::hitsInDetId(cscid1b.rawId()); + const GlobalPoint& gp1a = simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid1a.rawId())); + const GlobalPoint& gp1b = simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid1b.rawId())); if (!hits1a.empty() and !hits1b.empty()) phi_layer1 = (gp1a.phi() + gp1b.phi()) / 2.0; else if (!hits1a.empty()) @@ -184,18 +177,12 @@ float CSCSimHitMatcher::LocalBendingInChamber(unsigned int detid) const { phi_layer1 = gp1b.phi(); // phi in layer 6 - const CSCDetId cscid6a(cscid.endcap(), cscid.station(), 4, cscid.chamber(), - 6); - const CSCDetId cscid6b(cscid.endcap(), cscid.station(), 1, cscid.chamber(), - 6); - const edm::PSimHitContainer& hits6a = - MuonSimHitMatcher::hitsInDetId(cscid6a.rawId()); - const edm::PSimHitContainer& hits6b = - MuonSimHitMatcher::hitsInDetId(cscid6b.rawId()); - const GlobalPoint& gp6a = - simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid6a.rawId())); - const GlobalPoint& gp6b = - simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid6b.rawId())); + const CSCDetId cscid6a(cscid.endcap(), cscid.station(), 4, cscid.chamber(), 6); + const CSCDetId cscid6b(cscid.endcap(), cscid.station(), 1, cscid.chamber(), 6); + const edm::PSimHitContainer& hits6a = MuonSimHitMatcher::hitsInDetId(cscid6a.rawId()); + const edm::PSimHitContainer& hits6b = MuonSimHitMatcher::hitsInDetId(cscid6b.rawId()); + const GlobalPoint& gp6a = simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid6a.rawId())); + const GlobalPoint& gp6b = simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid6b.rawId())); if (!hits6a.empty() and !hits6b.empty()) phi_layer6 = (gp6a.phi() + gp6b.phi()) / 2.0; else if (!hits6a.empty()) @@ -205,25 +192,21 @@ float CSCSimHitMatcher::LocalBendingInChamber(unsigned int detid) const { } else { // phi in layer 1 - const CSCDetId cscid1(cscid.endcap(), cscid.station(), cscid.ring(), - cscid.chamber(), 1); - const GlobalPoint& gp1 = - simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid1.rawId())); + const CSCDetId cscid1(cscid.endcap(), cscid.station(), cscid.ring(), cscid.chamber(), 1); + const GlobalPoint& gp1 = simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid1.rawId())); phi_layer1 = gp1.phi(); // phi in layer 6 - const CSCDetId cscid6(cscid.endcap(), cscid.station(), cscid.ring(), - cscid.chamber(), 6); - const GlobalPoint& gp6 = - simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid6.rawId())); + const CSCDetId cscid6(cscid.endcap(), cscid.station(), cscid.ring(), cscid.chamber(), 6); + const GlobalPoint& gp6 = simHitsMeanPosition(MuonSimHitMatcher::hitsInDetId(cscid6.rawId())); phi_layer6 = gp6.phi(); } return deltaPhi(phi_layer6, phi_layer1); } -float CSCSimHitMatcher::simHitsMeanStrip( - const edm::PSimHitContainer& sim_hits) const { - if (sim_hits.empty()) return -1.f; +float CSCSimHitMatcher::simHitsMeanStrip(const edm::PSimHitContainer& sim_hits) const { + if (sim_hits.empty()) + return -1.f; float sums = 0.f; size_t n = 0; @@ -231,22 +214,20 @@ float CSCSimHitMatcher::simHitsMeanStrip( const LocalPoint& lp = h.entryPoint(); float s; const auto& d = h.detUnitId(); - s = dynamic_cast(geometry_) - ->layer(d) - ->geometry() - ->strip(lp); + s = dynamic_cast(geometry_)->layer(d)->geometry()->strip(lp); // convert to half-strip: s *= 2.; sums += s; ++n; } - if (n == 0) return -1.f; + if (n == 0) + return -1.f; return sums / n; } -float CSCSimHitMatcher::simHitsMeanWG( - const edm::PSimHitContainer& sim_hits) const { - if (sim_hits.empty()) return -1.f; +float CSCSimHitMatcher::simHitsMeanWG(const edm::PSimHitContainer& sim_hits) const { + if (sim_hits.empty()) + return -1.f; float sums = 0.f; size_t n = 0; @@ -255,61 +236,51 @@ float CSCSimHitMatcher::simHitsMeanWG( float s; const auto& d = h.detUnitId(); // find nearest wire - const auto& layerG( - dynamic_cast(geometry_)->layer(d)->geometry()); + const auto& layerG(dynamic_cast(geometry_)->layer(d)->geometry()); int nearestWire(layerG->nearestWire(lp)); // then find the corresponding wire group s = layerG->wireGroup(nearestWire); sums += s; ++n; } - if (n == 0) return -1.f; + if (n == 0) + return -1.f; return sums / n; } -std::set CSCSimHitMatcher::hitStripsInDetId(unsigned int detid, - int margin_n_strips) const { +std::set CSCSimHitMatcher::hitStripsInDetId(unsigned int detid, int margin_n_strips) const { set result; const auto& simhits = MuonSimHitMatcher::hitsInDetId(detid); CSCDetId id(detid); - int max_nstrips = dynamic_cast(geometry_) - ->layer(id) - ->geometry() - ->numberOfStrips(); + int max_nstrips = dynamic_cast(geometry_)->layer(id)->geometry()->numberOfStrips(); for (const auto& h : simhits) { const LocalPoint& lp = h.entryPoint(); - int central_strip = dynamic_cast(geometry_) - ->layer(id) - ->geometry() - ->nearestStrip(lp); + int central_strip = dynamic_cast(geometry_)->layer(id)->geometry()->nearestStrip(lp); int smin = central_strip - margin_n_strips; smin = (smin > 0) ? smin : 1; int smax = central_strip + margin_n_strips; smax = (smax <= max_nstrips) ? smax : max_nstrips; - for (int ss = smin; ss <= smax; ++ss) result.insert(ss); + for (int ss = smin; ss <= smax; ++ss) + result.insert(ss); } return result; } -std::set CSCSimHitMatcher::hitWiregroupsInDetId(unsigned int detid, - int margin_n_wg) const { +std::set CSCSimHitMatcher::hitWiregroupsInDetId(unsigned int detid, int margin_n_wg) const { set result; const auto& simhits = MuonSimHitMatcher::hitsInDetId(detid); CSCDetId id(detid); - int max_n_wg = dynamic_cast(geometry_) - ->layer(id) - ->geometry() - ->numberOfWireGroups(); + int max_n_wg = dynamic_cast(geometry_)->layer(id)->geometry()->numberOfWireGroups(); for (const auto& h : simhits) { const LocalPoint& lp = h.entryPoint(); - const auto& layer_geo = - dynamic_cast(geometry_)->layer(id)->geometry(); + const auto& layer_geo = dynamic_cast(geometry_)->layer(id)->geometry(); int central_wg = layer_geo->wireGroup(layer_geo->nearestWire(lp)); int wg_min = central_wg - margin_n_wg; wg_min = (wg_min > 0) ? wg_min : 1; int wg_max = central_wg + margin_n_wg; wg_max = (wg_max <= max_n_wg) ? wg_max : max_n_wg; - for (int wg = wg_min; wg <= wg_max; ++wg) result.insert(wg); + for (int wg = wg_min; wg <= wg_max; ++wg) + result.insert(wg); } return result; } @@ -318,13 +289,13 @@ int CSCSimHitMatcher::nCoincidenceChambers(int min_n_layers) const { int result = 0; const auto& chamber_ids = chamberIds(0); for (const auto& id : chamber_ids) { - if (nLayersWithHitsInChamber(id) >= min_n_layers) result += 1; + if (nLayersWithHitsInChamber(id) >= min_n_layers) + result += 1; } return result; } -void CSCSimHitMatcher::chamberIdsToString( - const std::set& set) const { +void CSCSimHitMatcher::chamberIdsToString(const std::set& set) const { for (const auto& p : set) { CSCDetId detId(p); edm::LogInfo("CSCSimHitMatcher") << " " << detId << "\n"; diff --git a/Validation/MuonHits/src/DTSimHitMatcher.cc b/Validation/MuonHits/src/DTSimHitMatcher.cc index b98bff00f48d2..a725c18aa386f 100644 --- a/Validation/MuonHits/src/DTSimHitMatcher.cc +++ b/Validation/MuonHits/src/DTSimHitMatcher.cc @@ -2,28 +2,24 @@ using namespace std; -DTSimHitMatcher::DTSimHitMatcher(const edm::ParameterSet& ps, - edm::ConsumesCollector&& iC) +DTSimHitMatcher::DTSimHitMatcher(const edm::ParameterSet& ps, edm::ConsumesCollector&& iC) : MuonSimHitMatcher(ps, std::move(iC)) { simHitPSet_ = ps.getParameterSet("dtSimHit"); verbose_ = simHitPSet_.getParameter("verbose"); simMuOnly_ = simHitPSet_.getParameter("simMuOnly"); discardEleHits_ = simHitPSet_.getParameter("discardEleHits"); - simHitInput_ = iC.consumes( - simHitPSet_.getParameter("inputTag")); + simHitInput_ = iC.consumes(simHitPSet_.getParameter("inputTag")); } /// initialize the event -void DTSimHitMatcher::init(const edm::Event& iEvent, - const edm::EventSetup& iSetup) { +void DTSimHitMatcher::init(const edm::Event& iEvent, const edm::EventSetup& iSetup) { iSetup.get().get(dt_geom_); if (dt_geom_.isValid()) { geometry_ = &*dt_geom_; } else { hasGeometry_ = false; - edm::LogWarning("DTSimHitMatcher") - << "+++ Info: DT geometry is unavailable. +++\n"; + edm::LogWarning("DTSimHitMatcher") << "+++ Info: DT geometry is unavailable. +++\n"; } MuonSimHitMatcher::init(iEvent, iSetup); } @@ -37,20 +33,17 @@ void DTSimHitMatcher::match(const SimTrack& track, const SimVertex& vertex) { matchSimHitsToSimTrack(); if (verbose_) { - edm::LogInfo("DTSimHitMatcher") - << "nTrackIds " << track_ids_.size() << " nSelectedDTSimHits " - << hits_.size() << endl; - edm::LogInfo("DTSimHitMatcher") - << "detids DT " << detIds(0).size() << endl; + edm::LogInfo("DTSimHitMatcher") << "nTrackIds " << track_ids_.size() << " nSelectedDTSimHits " << hits_.size() + << endl; + edm::LogInfo("DTSimHitMatcher") << "detids DT " << detIds(0).size() << endl; const auto& dt_det_ids = detIds(0); for (const auto& id : dt_det_ids) { const auto& dt_simhits = MuonSimHitMatcher::hitsInDetId(id); const auto& dt_simhits_gp = simHitsMeanPosition(dt_simhits); - edm::LogInfo("DTSimHitMatcher") - << "DTWireId " << DTWireId(id) << ": nHits " << dt_simhits.size() - << " eta " << dt_simhits_gp.eta() << " phi " << dt_simhits_gp.phi() - << " nCh " << chamber_to_hits_[id].size() << endl; + edm::LogInfo("DTSimHitMatcher") << "DTWireId " << DTWireId(id) << ": nHits " << dt_simhits.size() << " eta " + << dt_simhits_gp.eta() << " phi " << dt_simhits_gp.phi() << " nCh " + << chamber_to_hits_[id].size() << endl; } } } @@ -59,11 +52,14 @@ void DTSimHitMatcher::match(const SimTrack& track, const SimVertex& vertex) { void DTSimHitMatcher::matchSimHitsToSimTrack() { for (const auto& track_id : track_ids_) { for (const auto& h : simHits_) { - if (h.trackId() != track_id) continue; + if (h.trackId() != track_id) + continue; int pdgid = h.particleType(); - if (simMuOnly_ && std::abs(pdgid) != 13) continue; + if (simMuOnly_ && std::abs(pdgid) != 13) + continue; // discard electron hits in the DT chambers - if (discardEleHits_ && pdgid == 11) continue; + if (discardEleHits_ && pdgid == 11) + continue; const DTWireId layer_id(h.detUnitId()); detid_to_hits_[h.detUnitId()].push_back(h); @@ -105,19 +101,21 @@ std::set DTSimHitMatcher::chamberIds(int dt_type) const { std::set DTSimHitMatcher::layerIds() const { std::set result; - for (const auto& p : layer_to_hits_) result.insert(p.first); + for (const auto& p : layer_to_hits_) + result.insert(p.first); return result; } std::set DTSimHitMatcher::superlayerIds() const { std::set result; - for (const auto& p : superlayer_to_hits_) result.insert(p.first); + for (const auto& p : superlayer_to_hits_) + result.insert(p.first); return result; } -const edm::PSimHitContainer& DTSimHitMatcher::hitsInLayer( - unsigned int detid) const { - if (!MuonHitHelper::isDT(detid)) return no_hits_; +const edm::PSimHitContainer& DTSimHitMatcher::hitsInLayer(unsigned int detid) const { + if (!MuonHitHelper::isDT(detid)) + return no_hits_; const DTWireId id(detid); if (layer_to_hits_.find(id.layerId().rawId()) == layer_to_hits_.end()) @@ -125,20 +123,19 @@ const edm::PSimHitContainer& DTSimHitMatcher::hitsInLayer( return layer_to_hits_.at(id.layerId().rawId()); } -const edm::PSimHitContainer& DTSimHitMatcher::hitsInSuperLayer( - unsigned int detid) const { - if (!MuonHitHelper::isDT(detid)) return no_hits_; +const edm::PSimHitContainer& DTSimHitMatcher::hitsInSuperLayer(unsigned int detid) const { + if (!MuonHitHelper::isDT(detid)) + return no_hits_; const DTWireId id(detid); - if (superlayer_to_hits_.find(id.superlayerId().rawId()) == - superlayer_to_hits_.end()) + if (superlayer_to_hits_.find(id.superlayerId().rawId()) == superlayer_to_hits_.end()) return no_hits_; return superlayer_to_hits_.at(id.superlayerId().rawId()); } -const edm::PSimHitContainer& DTSimHitMatcher::hitsInChamber( - unsigned int detid) const { - if (!MuonHitHelper::isDT(detid)) return no_hits_; +const edm::PSimHitContainer& DTSimHitMatcher::hitsInChamber(unsigned int detid) const { + if (!MuonHitHelper::isDT(detid)) + return no_hits_; const DTWireId id(detid); if (chamber_to_hits_.find(id.chamberId().rawId()) == chamber_to_hits_.end()) @@ -150,25 +147,26 @@ bool DTSimHitMatcher::hitStation(int st, int nsuperlayers, int nlayers) const { int nst = 0; for (const auto& ddt : chamberIds()) { const DTChamberId id(ddt); - if (id.station() != st) continue; + if (id.station() != st) + continue; // require at least 1 superlayer const int nsl(nSuperLayersWithHitsInChamber(id.rawId())); - if (nsl < nsuperlayers) continue; + if (nsl < nsuperlayers) + continue; // require at least 3 layers hit per chamber const int nl(nLayersWithHitsInChamber(id.rawId())); - if (nl < nlayers) continue; + if (nl < nlayers) + continue; ++nst; } return nst; } int DTSimHitMatcher::nStations(int nsuperlayers, int nlayers) const { - return (hitStation(1, nsuperlayers, nlayers) + - hitStation(2, nsuperlayers, nlayers) + - hitStation(3, nsuperlayers, nlayers) + - hitStation(4, nsuperlayers, nlayers)); + return (hitStation(1, nsuperlayers, nlayers) + hitStation(2, nsuperlayers, nlayers) + + hitStation(3, nsuperlayers, nlayers) + hitStation(4, nsuperlayers, nlayers)); } int DTSimHitMatcher::nCellsWithHitsInLayer(unsigned int detid) const { @@ -209,17 +207,15 @@ int DTSimHitMatcher::nSuperLayersWithHitsInChamber(unsigned int detid) const { int DTSimHitMatcher::nLayersWithHitsInChamber(unsigned int detid) const { int nLayers = 0; - const auto& superLayers(dynamic_cast(geometry_) - ->chamber(DTChamberId(detid)) - ->superLayers()); + const auto& superLayers(dynamic_cast(geometry_)->chamber(DTChamberId(detid))->superLayers()); for (const auto& sl : superLayers) { nLayers += nLayersWithHitsInSuperLayer(sl->id().rawId()); } return nLayers; } -float DTSimHitMatcher::simHitsMeanWire( - const edm::PSimHitContainer& sim_hits) const { - if (sim_hits.empty()) return -1.f; +float DTSimHitMatcher::simHitsMeanWire(const edm::PSimHitContainer& sim_hits) const { + if (sim_hits.empty()) + return -1.f; float sums = 0.f; size_t n = 0; @@ -229,34 +225,27 @@ float DTSimHitMatcher::simHitsMeanWire( const auto& d = h.detUnitId(); if (MuonHitHelper::isDT(d)) { // find nearest wire - s = dynamic_cast(geometry_) - ->layer(DTLayerId(d)) - ->specificTopology() - .channel(lp); + s = dynamic_cast(geometry_)->layer(DTLayerId(d))->specificTopology().channel(lp); } else continue; sums += s; ++n; } - if (n == 0) return -1.f; + if (n == 0) + return -1.f; return sums / n; } -std::set DTSimHitMatcher::hitWiresInDTLayerId( - unsigned int detid, int margin_n_wires) const { +std::set DTSimHitMatcher::hitWiresInDTLayerId(unsigned int detid, int margin_n_wires) const { set result; if (MuonHitHelper::isDT(detid)) { DTLayerId id(detid); - int max_nwires = dynamic_cast(geometry_) - ->layer(id) - ->specificTopology() - .channels(); + int max_nwires = dynamic_cast(geometry_)->layer(id)->specificTopology().channels(); for (int wn = 0; wn <= max_nwires; ++wn) { DTWireId wid(id, wn); for (const auto& h : MuonSimHitMatcher::hitsInDetId(wid.rawId())) { if (verbose_) - edm::LogInfo("DTSimHitMatcher") - << "central DTWireId " << wid << " simhit " << h << endl; + edm::LogInfo("DTSimHitMatcher") << "central DTWireId " << wid << " simhit " << h << endl; int smin = wn - margin_n_wires; smin = (smin > 0) ? smin : 1; int smax = wn + margin_n_wires; @@ -264,8 +253,7 @@ std::set DTSimHitMatcher::hitWiresInDTLayerId( for (int ss = smin; ss <= smax; ++ss) { DTWireId widd(id, ss); if (verbose_) - edm::LogInfo("DTSimHitMatcher") - << "\tadding DTWireId to collection " << widd << endl; + edm::LogInfo("DTSimHitMatcher") << "\tadding DTWireId to collection " << widd << endl; result.insert(widd.rawId()); } } @@ -274,40 +262,31 @@ std::set DTSimHitMatcher::hitWiresInDTLayerId( return result; } -std::set DTSimHitMatcher::hitWiresInDTSuperLayerId( - unsigned int detid, int margin_n_wires) const { +std::set DTSimHitMatcher::hitWiresInDTSuperLayerId(unsigned int detid, int margin_n_wires) const { set result; - const auto& layers(dynamic_cast(geometry_) - ->superLayer(DTSuperLayerId(detid)) - ->layers()); + const auto& layers(dynamic_cast(geometry_)->superLayer(DTSuperLayerId(detid))->layers()); for (const auto& l : layers) { if (verbose_) - edm::LogInfo("DTSimHitMatcher") - << "hitWiresInDTSuperLayerId::l id " << l->id() << endl; + edm::LogInfo("DTSimHitMatcher") << "hitWiresInDTSuperLayerId::l id " << l->id() << endl; const auto& p(hitWiresInDTLayerId(l->id().rawId(), margin_n_wires)); result.insert(p.begin(), p.end()); } return result; } -std::set DTSimHitMatcher::hitWiresInDTChamberId( - unsigned int detid, int margin_n_wires) const { +std::set DTSimHitMatcher::hitWiresInDTChamberId(unsigned int detid, int margin_n_wires) const { set result; - const auto& superLayers(dynamic_cast(geometry_) - ->chamber(DTChamberId(detid)) - ->superLayers()); + const auto& superLayers(dynamic_cast(geometry_)->chamber(DTChamberId(detid))->superLayers()); for (const auto& sl : superLayers) { if (verbose_) - edm::LogInfo("DTSimHitMatcher") - << "hitWiresInDTChamberId::sl id " << sl->id() << endl; + edm::LogInfo("DTSimHitMatcher") << "hitWiresInDTChamberId::sl id " << sl->id() << endl; const auto& p(hitWiresInDTSuperLayerId(sl->id().rawId(), margin_n_wires)); result.insert(p.begin(), p.end()); } return result; } -void DTSimHitMatcher::dtChamberIdsToString( - const std::set& set) const { +void DTSimHitMatcher::dtChamberIdsToString(const std::set& set) const { for (const auto& p : set) { DTChamberId detId(p); edm::LogInfo("DTSimHitMatcher") << " " << detId << "\n"; diff --git a/Validation/MuonHits/src/GEMSimHitMatcher.cc b/Validation/MuonHits/src/GEMSimHitMatcher.cc index 2f16bb04eac6b..c68608806f171 100644 --- a/Validation/MuonHits/src/GEMSimHitMatcher.cc +++ b/Validation/MuonHits/src/GEMSimHitMatcher.cc @@ -2,28 +2,24 @@ using namespace std; -GEMSimHitMatcher::GEMSimHitMatcher(const edm::ParameterSet& ps, - edm::ConsumesCollector&& iC) +GEMSimHitMatcher::GEMSimHitMatcher(const edm::ParameterSet& ps, edm::ConsumesCollector&& iC) : MuonSimHitMatcher(ps, std::move(iC)) { simHitPSet_ = ps.getParameterSet("gemSimHit"); verbose_ = simHitPSet_.getParameter("verbose"); simMuOnly_ = simHitPSet_.getParameter("simMuOnly"); discardEleHits_ = simHitPSet_.getParameter("discardEleHits"); - simHitInput_ = iC.consumes( - simHitPSet_.getParameter("inputTag")); + simHitInput_ = iC.consumes(simHitPSet_.getParameter("inputTag")); } /// initialize the event -void GEMSimHitMatcher::init(const edm::Event& iEvent, - const edm::EventSetup& iSetup) { +void GEMSimHitMatcher::init(const edm::Event& iEvent, const edm::EventSetup& iSetup) { iSetup.get().get(gem_geom_); if (gem_geom_.isValid()) { geometry_ = dynamic_cast(&*gem_geom_); } else { hasGeometry_ = false; - edm::LogWarning("GEMSimHitMatcher") - << "+++ Info: GEM geometry is unavailable. +++\n"; + edm::LogWarning("GEMSimHitMatcher") << "+++ Info: GEM geometry is unavailable. +++\n"; } MuonSimHitMatcher::init(iEvent, iSetup); } @@ -37,20 +33,16 @@ void GEMSimHitMatcher::match(const SimTrack& track, const SimVertex& vertex) { matchSimHitsToSimTrack(); if (verbose_) { - edm::LogInfo("GEMSimHitMatcher") - << "nTrackIds " << track_ids_.size() << " nSelectedGEMSimHits " - << hits_.size() << endl; - edm::LogInfo("GEMSimHitMatcher") - << "detids GEM " << detIds(0).size() << endl; + edm::LogInfo("GEMSimHitMatcher") << "nTrackIds " << track_ids_.size() << " nSelectedGEMSimHits " << hits_.size() + << endl; + edm::LogInfo("GEMSimHitMatcher") << "detids GEM " << detIds(0).size() << endl; const auto& gem_ch_ids = detIds(); for (const auto& id : gem_ch_ids) { const auto& gem_simhits = MuonSimHitMatcher::hitsInDetId(id); const auto& gem_simhits_gp = simHitsMeanPosition(gem_simhits); - edm::LogInfo("GEMSimHitMatcher") - << "gemchid " << GEMDetId(id) << ": nHits " << gem_simhits.size() - << " phi " << gem_simhits_gp.phi() << " nCh " - << chamber_to_hits_[id].size() << endl; + edm::LogInfo("GEMSimHitMatcher") << "gemchid " << GEMDetId(id) << ": nHits " << gem_simhits.size() << " phi " + << gem_simhits_gp.phi() << " nCh " << chamber_to_hits_[id].size() << endl; const auto& strips = hitStripsInDetId(id); edm::LogInfo("GEMSimHitMatcher") << "nStrip " << strips.size() << endl; edm::LogInfo("GEMSimHitMatcher") << "strips : "; @@ -62,10 +54,9 @@ void GEMSimHitMatcher::match(const SimTrack& track, const SimVertex& vertex) { for (const auto& id : gem_sch_ids) { const auto& gem_simhits = hitsInSuperChamber(id); const auto& gem_simhits_gp = simHitsMeanPosition(gem_simhits); - edm::LogInfo("GEMSimHitMatcher") - << "gemschid " << GEMDetId(id) << ": " << nCoincidencePadsWithHits() - << " | " << gem_simhits.size() << " " << gem_simhits_gp.phi() << " " - << superchamber_to_hits_[id].size() << endl; + edm::LogInfo("GEMSimHitMatcher") << "gemschid " << GEMDetId(id) << ": " << nCoincidencePadsWithHits() << " | " + << gem_simhits.size() << " " << gem_simhits_gp.phi() << " " + << superchamber_to_hits_[id].size() << endl; } } } @@ -74,11 +65,14 @@ void GEMSimHitMatcher::match(const SimTrack& track, const SimVertex& vertex) { void GEMSimHitMatcher::matchSimHitsToSimTrack() { for (const auto& track_id : track_ids_) { for (const auto& h : simHits_) { - if (h.trackId() != track_id) continue; + if (h.trackId() != track_id) + continue; int pdgid = h.particleType(); - if (simMuOnly_ && std::abs(pdgid) != 13) continue; + if (simMuOnly_ && std::abs(pdgid) != 13) + continue; // discard electron hits in the GEM chambers - if (discardEleHits_ && pdgid == 11) continue; + if (discardEleHits_ && pdgid == 11) + continue; const GEMDetId& p_id(h.detUnitId()); detid_to_hits_[h.detUnitId()].push_back(h); @@ -94,8 +88,7 @@ void GEMSimHitMatcher::matchSimHitsToSimTrack() { for (const auto& d : detids) { GEMDetId id(d); const auto& hits = hitsInDetId(d); - const auto& roll = - dynamic_cast(geometry_)->etaPartition(id); + const auto& roll = dynamic_cast(geometry_)->etaPartition(id); // int max_npads = roll->npads(); set pads; for (const auto& h : hits) { @@ -108,12 +101,12 @@ void GEMSimHitMatcher::matchSimHitsToSimTrack() { // find 2-layer coincidence pads with hits for (const auto& d : detids) { GEMDetId id1(d); - if (id1.layer() != 1) continue; + if (id1.layer() != 1) + continue; // find pads with hits in layer1 const auto& hits1 = hitsInDetId(d); - const auto& roll1 = - dynamic_cast(geometry_)->etaPartition(id1); + const auto& roll1 = dynamic_cast(geometry_)->etaPartition(id1); set pads1; set pads2; set copads; @@ -122,10 +115,8 @@ void GEMSimHitMatcher::matchSimHitsToSimTrack() { const LocalPoint& lp = h.entryPoint(); pads1.insert(1 + static_cast(roll1->padTopology().channel(lp))); if (verbose_) - edm::LogInfo("GEMSimHitMatcher") - << "GEMHits detid1 " << id1 << " pad1 " - << 1 + static_cast(roll1->padTopology().channel(lp)) - << std::endl; + edm::LogInfo("GEMSimHitMatcher") << "GEMHits detid1 " << id1 << " pad1 " + << 1 + static_cast(roll1->padTopology().channel(lp)) << std::endl; } // find pads with hits in layer2 @@ -133,34 +124,33 @@ void GEMSimHitMatcher::matchSimHitsToSimTrack() { // staggered geometry???? improve here !! GEMDetId id2(d2); // does layer 2 has simhits? - if (id2.layer() != 2 or id2.region() != id1.region() or - id2.ring() != id1.ring() or id2.station() != id1.station() or - abs(id2.roll() - id1.roll()) > 1) + if (id2.layer() != 2 or id2.region() != id1.region() or id2.ring() != id1.ring() or + id2.station() != id1.station() or abs(id2.roll() - id1.roll()) > 1) continue; const auto& hits2 = hitsInDetId(id2()); - const auto& roll2 = - dynamic_cast(geometry_)->etaPartition(id2); + const auto& roll2 = dynamic_cast(geometry_)->etaPartition(id2); for (const auto& h : hits2) { const LocalPoint& lp = h.entryPoint(); pads2.insert(1 + static_cast(roll2->padTopology().channel(lp))); if (verbose_) - edm::LogInfo("GEMSimHitMatcher") - << "GEMHits detid2 " << id2 << " pad2 " - << 1 + static_cast(roll2->padTopology().channel(lp)) - << std::endl; + edm::LogInfo("GEMSimHitMatcher") << "GEMHits detid2 " << id2 << " pad2 " + << 1 + static_cast(roll2->padTopology().channel(lp)) << std::endl; } } for (const auto& pad1 : pads1) { for (const auto& pad2 : pads2) { if (abs(pad1 - pad2) <= 2) { - if (copads.find(pad1) == copads.end()) copads.insert(pad1); - if (copads.find(pad2) == copads.end()) copads.insert(pad2); + if (copads.find(pad1) == copads.end()) + copads.insert(pad1); + if (copads.find(pad2) == copads.end()) + copads.insert(pad2); } } } - if (copads.empty()) continue; + if (copads.empty()) + continue; // detids here is layer1 id detids_to_copads_[d] = copads; @@ -183,7 +173,8 @@ std::set GEMSimHitMatcher::detIds(int gem_type) const { std::set GEMSimHitMatcher::detIdsCoincidences() const { std::set result; - for (const auto& p : detids_to_copads_) result.insert(p.first); + for (const auto& p : detids_to_copads_) + result.insert(p.first); return result; } @@ -203,7 +194,8 @@ std::set GEMSimHitMatcher::chamberIds(int gem_type) const { std::set GEMSimHitMatcher::superChamberIds() const { std::set result; - for (const auto& p : superchamber_to_hits_) result.insert(p.first); + for (const auto& p : superchamber_to_hits_) + result.insert(p.first); return result; } @@ -216,12 +208,10 @@ std::set GEMSimHitMatcher::superChamberIdsCoincidences() const { return result; } -const edm::PSimHitContainer& GEMSimHitMatcher::hitsInSuperChamber( - unsigned int detid) const { +const edm::PSimHitContainer& GEMSimHitMatcher::hitsInSuperChamber(unsigned int detid) const { if (MuonHitHelper::isGEM(detid)) { const GEMDetId id(detid); - if (superchamber_to_hits_.find(id.chamberId().rawId()) == - superchamber_to_hits_.end()) + if (superchamber_to_hits_.find(id.chamberId().rawId()) == superchamber_to_hits_.end()) return no_hits_; return superchamber_to_hits_.at(id.chamberId().rawId()); } @@ -243,22 +233,22 @@ bool GEMSimHitMatcher::hitStation(int st, int nlayers) const { int nst = 0; for (const auto& ddt : chamberIds()) { const GEMDetId id(ddt); - if (id.station() != st) continue; + if (id.station() != st) + continue; const int nl(nLayersWithHitsInSuperChamber(id.rawId())); - if (nl < nlayers) continue; + if (nl < nlayers) + continue; ++nst; } return nst; } -int GEMSimHitMatcher::nStations(int nlayers) const { - return (hitStation(1, nlayers) + hitStation(2, nlayers)); -} +int GEMSimHitMatcher::nStations(int nlayers) const { return (hitStation(1, nlayers) + hitStation(2, nlayers)); } -float GEMSimHitMatcher::simHitsGEMCentralPosition( - const edm::PSimHitContainer& sim_hits) const { - if (sim_hits.empty()) return -0.0; // point "zero" +float GEMSimHitMatcher::simHitsGEMCentralPosition(const edm::PSimHitContainer& sim_hits) const { + if (sim_hits.empty()) + return -0.0; // point "zero" float central = -0.0; size_t n = 0; @@ -270,63 +260,60 @@ float GEMSimHitMatcher::simHitsGEMCentralPosition( } central = gp.perp(); if (n >= 1) - edm::LogWarning("GEMSimHitMatcher") - << "warning! find more than one simhits in GEM chamber " << std::endl; + edm::LogWarning("GEMSimHitMatcher") << "warning! find more than one simhits in GEM chamber " << std::endl; ++n; } return central; } -float GEMSimHitMatcher::simHitsMeanStrip( - const edm::PSimHitContainer& sim_hits) const { - if (sim_hits.empty()) return -1.f; +float GEMSimHitMatcher::simHitsMeanStrip(const edm::PSimHitContainer& sim_hits) const { + if (sim_hits.empty()) + return -1.f; float sums = 0.f; size_t n = 0; for (const auto& h : sim_hits) { const LocalPoint& lp = h.entryPoint(); const auto& d = h.detUnitId(); - sums += - dynamic_cast(geometry_)->etaPartition(d)->strip(lp); + sums += dynamic_cast(geometry_)->etaPartition(d)->strip(lp); ++n; } - if (n == 0) return -1.f; + if (n == 0) + return -1.f; return sums / n; } -std::set GEMSimHitMatcher::hitStripsInDetId(unsigned int detid, - int margin_n_strips) const { +std::set GEMSimHitMatcher::hitStripsInDetId(unsigned int detid, int margin_n_strips) const { set result; const auto& simhits = MuonSimHitMatcher::hitsInDetId(detid); GEMDetId id(detid); - int max_nstrips = - dynamic_cast(geometry_)->etaPartition(id)->nstrips(); + int max_nstrips = dynamic_cast(geometry_)->etaPartition(id)->nstrips(); for (const auto& h : simhits) { const LocalPoint& lp = h.entryPoint(); int central_strip = - static_cast(dynamic_cast(geometry_) - ->etaPartition(id) - ->topology() - .channel(lp)); + static_cast(dynamic_cast(geometry_)->etaPartition(id)->topology().channel(lp)); int smin = central_strip - margin_n_strips; smin = (smin > 0) ? smin : 1; int smax = central_strip + margin_n_strips; smax = (smax <= max_nstrips) ? smax : max_nstrips; - for (int ss = smin; ss <= smax; ++ss) result.insert(ss); + for (int ss = smin; ss <= smax; ++ss) + result.insert(ss); } return result; } std::set GEMSimHitMatcher::hitPadsInDetId(unsigned int detid) const { set none; - if (detids_to_pads_.find(detid) == detids_to_pads_.end()) return none; + if (detids_to_pads_.find(detid) == detids_to_pads_.end()) + return none; return detids_to_pads_.at(detid); } std::set GEMSimHitMatcher::hitCoPadsInDetId(unsigned int detid) const { set none; - if (detids_to_copads_.find(detid) == detids_to_copads_.end()) return none; + if (detids_to_copads_.find(detid) == detids_to_copads_.end()) + return none; return detids_to_copads_.at(detid); } diff --git a/Validation/MuonHits/src/ME0SimHitMatcher.cc b/Validation/MuonHits/src/ME0SimHitMatcher.cc index 645e1bac17895..75ea634badf05 100644 --- a/Validation/MuonHits/src/ME0SimHitMatcher.cc +++ b/Validation/MuonHits/src/ME0SimHitMatcher.cc @@ -2,28 +2,24 @@ using namespace std; -ME0SimHitMatcher::ME0SimHitMatcher(const edm::ParameterSet& ps, - edm::ConsumesCollector&& iC) +ME0SimHitMatcher::ME0SimHitMatcher(const edm::ParameterSet& ps, edm::ConsumesCollector&& iC) : MuonSimHitMatcher(ps, std::move(iC)) { simHitPSet_ = ps.getParameterSet("me0SimHit"); verbose_ = simHitPSet_.getParameter("verbose"); simMuOnly_ = simHitPSet_.getParameter("simMuOnly"); discardEleHits_ = simHitPSet_.getParameter("discardEleHits"); - simHitInput_ = iC.consumes( - simHitPSet_.getParameter("inputTag")); + simHitInput_ = iC.consumes(simHitPSet_.getParameter("inputTag")); } /// initialize the event -void ME0SimHitMatcher::init(const edm::Event& iEvent, - const edm::EventSetup& iSetup) { +void ME0SimHitMatcher::init(const edm::Event& iEvent, const edm::EventSetup& iSetup) { iSetup.get().get(me0_geom_); if (me0_geom_.isValid()) { geometry_ = &*me0_geom_; } else { hasGeometry_ = false; - edm::LogWarning("ME0SimHitMatcher") - << "+++ Info: ME0 geometry is unavailable. +++\n"; + edm::LogWarning("ME0SimHitMatcher") << "+++ Info: ME0 geometry is unavailable. +++\n"; } MuonSimHitMatcher::init(iEvent, iSetup); } @@ -37,20 +33,16 @@ void ME0SimHitMatcher::match(const SimTrack& track, const SimVertex& vertex) { matchSimHitsToSimTrack(); if (verbose_) { - edm::LogInfo("ME0SimHitMatcher") - << "nTrackIds " << track_ids_.size() << " nSelectedME0SimHits " - << hits_.size() << endl; - edm::LogInfo("ME0SimHitMatcher") - << "detids ME0 " << detIds().size() << endl; + edm::LogInfo("ME0SimHitMatcher") << "nTrackIds " << track_ids_.size() << " nSelectedME0SimHits " << hits_.size() + << endl; + edm::LogInfo("ME0SimHitMatcher") << "detids ME0 " << detIds().size() << endl; const auto& me0_ch_ids = detIds(); for (const auto& id : me0_ch_ids) { const auto& me0_simhits = MuonSimHitMatcher::hitsInChamber(id); const auto& me0_simhits_gp = simHitsMeanPosition(me0_simhits); - edm::LogInfo("ME0SimHitMatcher") - << "me0chid " << ME0DetId(id) << ": nHits " << me0_simhits.size() - << " phi " << me0_simhits_gp.phi() << " nCh " - << chamber_to_hits_[id].size() << endl; + edm::LogInfo("ME0SimHitMatcher") << "me0chid " << ME0DetId(id) << ": nHits " << me0_simhits.size() << " phi " + << me0_simhits_gp.phi() << " nCh " << chamber_to_hits_[id].size() << endl; const auto& strips = hitStripsInDetId(id); edm::LogInfo("ME0SimHitMatcher") << "nStrip " << strips.size() << endl; edm::LogInfo("ME0SimHitMatcher") << "strips : "; @@ -65,11 +57,14 @@ void ME0SimHitMatcher::match(const SimTrack& track, const SimVertex& vertex) { void ME0SimHitMatcher::matchSimHitsToSimTrack() { for (const auto& track_id : track_ids_) { for (const auto& h : simHits_) { - if (h.trackId() != track_id) continue; + if (h.trackId() != track_id) + continue; int pdgid = h.particleType(); - if (simMuOnly_ && std::abs(pdgid) != 13) continue; + if (simMuOnly_ && std::abs(pdgid) != 13) + continue; // discard electron hits in the ME0 chambers - if (discardEleHits_ && std::abs(pdgid) == 11) continue; + if (discardEleHits_ && std::abs(pdgid) == 11) + continue; const ME0DetId& layer_id(h.detUnitId()); detid_to_hits_[h.detUnitId()].push_back(h); @@ -84,8 +79,7 @@ void ME0SimHitMatcher::matchSimHitsToSimTrack() { for (const auto& d : detids) { ME0DetId id(d); const auto& hits = hitsInDetId(d); - const auto& roll = - dynamic_cast(geometry_)->etaPartition(id); + const auto& roll = dynamic_cast(geometry_)->etaPartition(id); // int max_npads = roll->npads(); set pads; for (const auto& h : hits) { @@ -98,24 +92,26 @@ void ME0SimHitMatcher::matchSimHitsToSimTrack() { std::set ME0SimHitMatcher::detIds() const { std::set result; - for (const auto& p : detid_to_hits_) result.insert(p.first); + for (const auto& p : detid_to_hits_) + result.insert(p.first); return result; } std::set ME0SimHitMatcher::chamberIds() const { std::set result; - for (const auto& p : chamber_to_hits_) result.insert(p.first); + for (const auto& p : chamber_to_hits_) + result.insert(p.first); return result; } std::set ME0SimHitMatcher::superChamberIds() const { std::set result; - for (const auto& p : superChamber_to_hits_) result.insert(p.first); + for (const auto& p : superChamber_to_hits_) + result.insert(p.first); return result; } -const edm::PSimHitContainer& ME0SimHitMatcher::hitsInSuperChamber( - unsigned int detid) const { +const edm::PSimHitContainer& ME0SimHitMatcher::hitsInSuperChamber(unsigned int detid) const { if (superChamber_to_hits_.find(detid) == superChamber_to_hits_.end()) return no_hits_; return superChamber_to_hits_.at(detid); @@ -131,8 +127,7 @@ int ME0SimHitMatcher::nLayersWithHitsInSuperChamber(unsigned int detid) const { return layers_with_hits.size(); } -std::set ME0SimHitMatcher::superChamberIdsCoincidences( - int min_n_layers) const { +std::set ME0SimHitMatcher::superChamberIdsCoincidences(int min_n_layers) const { set result; // loop over the super chamber Ids for (const auto& p : superChamberIds()) { @@ -147,9 +142,9 @@ int ME0SimHitMatcher::nCoincidenceChambers(int min_n_layers) const { return superChamberIdsCoincidences(min_n_layers).size(); } -float ME0SimHitMatcher::simHitsMeanStrip( - const edm::PSimHitContainer& sim_hits) const { - if (sim_hits.empty()) return -1.f; +float ME0SimHitMatcher::simHitsMeanStrip(const edm::PSimHitContainer& sim_hits) const { + if (sim_hits.empty()) + return -1.f; float sums = 0.f; size_t n = 0; @@ -161,36 +156,34 @@ float ME0SimHitMatcher::simHitsMeanStrip( sums += s; ++n; } - if (n == 0) return -1.f; + if (n == 0) + return -1.f; return sums / n; } -std::set ME0SimHitMatcher::hitStripsInDetId(unsigned int detid, - int margin_n_strips) const { +std::set ME0SimHitMatcher::hitStripsInDetId(unsigned int detid, int margin_n_strips) const { set result; const auto& simhits = hitsInDetId(detid); ME0DetId id(detid); - int max_nstrips = - dynamic_cast(geometry_)->etaPartition(id)->nstrips(); + int max_nstrips = dynamic_cast(geometry_)->etaPartition(id)->nstrips(); for (const auto& h : simhits) { const LocalPoint& lp = h.entryPoint(); int central_strip = - 1 + static_cast(dynamic_cast(geometry_) - ->etaPartition(id) - ->topology() - .channel(lp)); + 1 + static_cast(dynamic_cast(geometry_)->etaPartition(id)->topology().channel(lp)); int smin = central_strip - margin_n_strips; smin = (smin > 0) ? smin : 1; int smax = central_strip + margin_n_strips; smax = (smax <= max_nstrips) ? smax : max_nstrips; - for (int ss = smin; ss <= smax; ++ss) result.insert(ss); + for (int ss = smin; ss <= smax; ++ss) + result.insert(ss); } return result; } std::set ME0SimHitMatcher::hitPadsInDetId(unsigned int detid) const { set none; - if (detids_to_pads_.find(detid) == detids_to_pads_.end()) return none; + if (detids_to_pads_.find(detid) == detids_to_pads_.end()) + return none; return detids_to_pads_.at(detid); } diff --git a/Validation/MuonHits/src/MuonHitHelper.cc b/Validation/MuonHits/src/MuonHitHelper.cc index ec3281ac78927..eb8c955dfa965 100644 --- a/Validation/MuonHits/src/MuonHitHelper.cc +++ b/Validation/MuonHits/src/MuonHitHelper.cc @@ -1,32 +1,28 @@ #include "Validation/MuonHits/interface/MuonHitHelper.h" bool MuonHitHelper::isDT(unsigned int detId) { - return (DetId(detId)).det() == DetId::Muon && - (DetId(detId)).subdetId() == MuonSubdetId::DT; + return (DetId(detId)).det() == DetId::Muon && (DetId(detId)).subdetId() == MuonSubdetId::DT; } bool MuonHitHelper::isGEM(unsigned int detId) { - return (DetId(detId)).det() == DetId::Muon && - (DetId(detId)).subdetId() == MuonSubdetId::GEM; + return (DetId(detId)).det() == DetId::Muon && (DetId(detId)).subdetId() == MuonSubdetId::GEM; } bool MuonHitHelper::isCSC(unsigned int detId) { - return (DetId(detId)).det() == DetId::Muon && - (DetId(detId)).subdetId() == MuonSubdetId::CSC; + return (DetId(detId)).det() == DetId::Muon && (DetId(detId)).subdetId() == MuonSubdetId::CSC; } bool MuonHitHelper::isRPC(unsigned int detId) { - return (DetId(detId)).det() == DetId::Muon && - (DetId(detId)).subdetId() == MuonSubdetId::RPC; + return (DetId(detId)).det() == DetId::Muon && (DetId(detId)).subdetId() == MuonSubdetId::RPC; } bool MuonHitHelper::isME0(unsigned int detId) { - return (DetId(detId)).det() == DetId::Muon && - (DetId(detId)).subdetId() == MuonSubdetId::ME0; + return (DetId(detId)).det() == DetId::Muon && (DetId(detId)).subdetId() == MuonSubdetId::ME0; } int MuonHitHelper::chamber(const DetId& id) { - if (id.det() != DetId::Detector::Muon) return -99; + if (id.det() != DetId::Detector::Muon) + return -99; int chamberN = 0; switch (id.subdetId()) { case MuonSubdetId::GEM: @@ -52,9 +48,11 @@ int MuonHitHelper::chamber(const DetId& id) { // return MuonType for a particular DetId int MuonHitHelper::toGEMType(int st, int ri) { if (st == 1) { - if (ri == 1) return GEM_ME11; + if (ri == 1) + return GEM_ME11; } else if (st == 2) { - if (ri == 1) return GEM_ME21; + if (ri == 1) + return GEM_ME21; } return GEM_ALL; } @@ -63,48 +61,78 @@ int MuonHitHelper::toRPCType(int re, int st, int ri) { // endcap if (std::abs(re) == 1) { if (st == 1) { - if (ri == 2) return RPC_ME12; - if (ri == 3) return RPC_ME13; + if (ri == 2) + return RPC_ME12; + if (ri == 3) + return RPC_ME13; } else if (st == 2) { - if (ri == 2) return RPC_ME22; - if (ri == 3) return RPC_ME23; + if (ri == 2) + return RPC_ME22; + if (ri == 3) + return RPC_ME23; } else if (st == 3) { - if (ri == 1) return RPC_ME31; - if (ri == 2) return RPC_ME32; - if (ri == 3) return RPC_ME33; + if (ri == 1) + return RPC_ME31; + if (ri == 2) + return RPC_ME32; + if (ri == 3) + return RPC_ME33; } else if (st == 4) { - if (ri == 1) return RPC_ME41; - if (ri == 2) return RPC_ME42; - if (ri == 3) return RPC_ME43; + if (ri == 1) + return RPC_ME41; + if (ri == 2) + return RPC_ME42; + if (ri == 3) + return RPC_ME43; } } // Barrel else { if (ri == -2) { - if (st == 1) return RPC_MB21n; - if (st == 2) return RPC_MB22n; - if (st == 3) return RPC_MB23n; - if (st == 4) return RPC_MB24n; + if (st == 1) + return RPC_MB21n; + if (st == 2) + return RPC_MB22n; + if (st == 3) + return RPC_MB23n; + if (st == 4) + return RPC_MB24n; } else if (ri == -1) { - if (st == 1) return RPC_MB11n; - if (st == 2) return RPC_MB12n; - if (st == 3) return RPC_MB13n; - if (st == 4) return RPC_MB14n; + if (st == 1) + return RPC_MB11n; + if (st == 2) + return RPC_MB12n; + if (st == 3) + return RPC_MB13n; + if (st == 4) + return RPC_MB14n; } else if (ri == 0) { - if (st == 1) return RPC_MB01; - if (st == 2) return RPC_MB02; - if (st == 3) return RPC_MB03; - if (st == 4) return RPC_MB04; + if (st == 1) + return RPC_MB01; + if (st == 2) + return RPC_MB02; + if (st == 3) + return RPC_MB03; + if (st == 4) + return RPC_MB04; } else if (ri == 1) { - if (st == 1) return RPC_MB11p; - if (st == 2) return RPC_MB12p; - if (st == 3) return RPC_MB13p; - if (st == 4) return RPC_MB14p; + if (st == 1) + return RPC_MB11p; + if (st == 2) + return RPC_MB12p; + if (st == 3) + return RPC_MB13p; + if (st == 4) + return RPC_MB14p; } else if (ri == 2) { - if (st == 1) return RPC_MB21p; - if (st == 2) return RPC_MB22p; - if (st == 3) return RPC_MB23p; - if (st == 4) return RPC_MB24p; + if (st == 1) + return RPC_MB21p; + if (st == 2) + return RPC_MB22p; + if (st == 3) + return RPC_MB23p; + if (st == 4) + return RPC_MB24p; } } return RPC_ALL; @@ -112,54 +140,85 @@ int MuonHitHelper::toRPCType(int re, int st, int ri) { int MuonHitHelper::toDTType(int wh, int st) { if (wh == -2) { - if (st == 1) return DT_MB21n; - if (st == 2) return DT_MB22n; - if (st == 3) return DT_MB23n; - if (st == 4) return DT_MB24n; + if (st == 1) + return DT_MB21n; + if (st == 2) + return DT_MB22n; + if (st == 3) + return DT_MB23n; + if (st == 4) + return DT_MB24n; } if (wh == -1) { - if (st == 1) return DT_MB11n; - if (st == 2) return DT_MB12n; - if (st == 3) return DT_MB13n; - if (st == 4) return DT_MB14n; + if (st == 1) + return DT_MB11n; + if (st == 2) + return DT_MB12n; + if (st == 3) + return DT_MB13n; + if (st == 4) + return DT_MB14n; } if (wh == 0) { - if (st == 1) return DT_MB01; - if (st == 2) return DT_MB02; - if (st == 3) return DT_MB03; - if (st == 4) return DT_MB04; + if (st == 1) + return DT_MB01; + if (st == 2) + return DT_MB02; + if (st == 3) + return DT_MB03; + if (st == 4) + return DT_MB04; } if (wh == 1) { - if (st == 1) return DT_MB11p; - if (st == 2) return DT_MB12p; - if (st == 3) return DT_MB13p; - if (st == 4) return DT_MB14p; + if (st == 1) + return DT_MB11p; + if (st == 2) + return DT_MB12p; + if (st == 3) + return DT_MB13p; + if (st == 4) + return DT_MB14p; } if (wh == 2) { - if (st == 1) return DT_MB21p; - if (st == 2) return DT_MB22p; - if (st == 3) return DT_MB23p; - if (st == 4) return DT_MB24p; + if (st == 1) + return DT_MB21p; + if (st == 2) + return DT_MB22p; + if (st == 3) + return DT_MB23p; + if (st == 4) + return DT_MB24p; } return DT_ALL; } int MuonHitHelper::toCSCType(int st, int ri) { if (st == 1) { - if (ri == 0) return CSC_ME11; - if (ri == 1) return CSC_ME1b; - if (ri == 2) return CSC_ME12; - if (ri == 3) return CSC_ME13; - if (ri == 4) return CSC_ME1a; + if (ri == 0) + return CSC_ME11; + if (ri == 1) + return CSC_ME1b; + if (ri == 2) + return CSC_ME12; + if (ri == 3) + return CSC_ME13; + if (ri == 4) + return CSC_ME1a; } else if (st == 2) { - if (ri == 1) return CSC_ME21; - if (ri == 2) return CSC_ME22; + if (ri == 1) + return CSC_ME21; + if (ri == 2) + return CSC_ME22; } else if (st == 3) { - if (ri == 1) return CSC_ME31; - if (ri == 2) return CSC_ME32; + if (ri == 1) + return CSC_ME31; + if (ri == 2) + return CSC_ME32; } else if (st == 4) { - if (ri == 1) return CSC_ME41; - if (ri == 2) return CSC_ME42; + if (ri == 1) + return CSC_ME41; + if (ri == 2) + return CSC_ME42; } return CSC_ALL; } diff --git a/Validation/MuonHits/src/MuonSimHitMatcher.cc b/Validation/MuonHits/src/MuonSimHitMatcher.cc index cf26b358c51e1..e6ddafa9ba688 100644 --- a/Validation/MuonHits/src/MuonSimHitMatcher.cc +++ b/Validation/MuonHits/src/MuonSimHitMatcher.cc @@ -4,21 +4,17 @@ using namespace std; -MuonSimHitMatcher::MuonSimHitMatcher(const edm::ParameterSet& ps, - edm::ConsumesCollector&& iC) { +MuonSimHitMatcher::MuonSimHitMatcher(const edm::ParameterSet& ps, edm::ConsumesCollector&& iC) { const auto& simVertex = ps.getParameterSet("simVertex"); const auto& simTrack = ps.getParameterSet("simTrack"); verboseSimTrack_ = simTrack.getParameter("verbose"); - simVertexInput_ = iC.consumes( - simVertex.getParameter("inputTag")); - simTrackInput_ = iC.consumes( - simTrack.getParameter("inputTag")); + simVertexInput_ = iC.consumes(simVertex.getParameter("inputTag")); + simTrackInput_ = iC.consumes(simTrack.getParameter("inputTag")); } /// initialize the event -void MuonSimHitMatcher::init(const edm::Event& iEvent, - const edm::EventSetup& iSetup) { +void MuonSimHitMatcher::init(const edm::Event& iEvent, const edm::EventSetup& iSetup) { hasGeometry_ = true; iEvent.getByToken(simTrackInput_, simTracksH_); @@ -40,29 +36,32 @@ void MuonSimHitMatcher::match(const SimTrack& track, const SimVertex& vertex) { no++; } - track_ids_ = - getIdsOfSimTrackShower(track.trackId(), simTracks_, simVertices_); + track_ids_ = getIdsOfSimTrackShower(track.trackId(), simTracks_, simVertices_); if (verboseSimTrack_) { edm::LogInfo("MuonSimHitMatcher") << "Printing track_ids" << std::endl; - for (const auto& id : track_ids_) edm::LogInfo("MuonSimHitMatcher") << "id: " << id << std::endl; + for (const auto& id : track_ids_) + edm::LogInfo("MuonSimHitMatcher") << "id: " << id << std::endl; } } -std::vector MuonSimHitMatcher::getIdsOfSimTrackShower( - unsigned int initial_trk_id, const edm::SimTrackContainer& simTracks, - const edm::SimVertexContainer& simVertices) { +std::vector MuonSimHitMatcher::getIdsOfSimTrackShower(unsigned int initial_trk_id, + const edm::SimTrackContainer& simTracks, + const edm::SimVertexContainer& simVertices) { vector result; result.push_back(initial_trk_id); - if (!simMuOnly_) return result; + if (!simMuOnly_) + return result; for (const auto& t : simTracks_) { SimTrack last_trk = t; // if (std::abs(t.type()) != 13) continue; bool is_child = false; while (true) { - if (last_trk.noVertex()) break; - if (simVertices_[last_trk.vertIndex()].noParent()) break; + if (last_trk.noVertex()) + break; + if (simVertices_[last_trk.vertIndex()].noParent()) + break; unsigned parentId = simVertices_[last_trk.vertIndex()].parentIndex(); if (parentId == initial_trk_id) { @@ -71,7 +70,8 @@ std::vector MuonSimHitMatcher::getIdsOfSimTrackShower( } const auto& association = trkid_to_index_.find(parentId); - if (association == trkid_to_index_.end()) break; + if (association == trkid_to_index_.end()) + break; last_trk = simTracks_[association->second]; } @@ -82,58 +82,56 @@ std::vector MuonSimHitMatcher::getIdsOfSimTrackShower( return result; } -const edm::PSimHitContainer& MuonSimHitMatcher::simHits(int sub) const { - return hits_; -} +const edm::PSimHitContainer& MuonSimHitMatcher::simHits(int sub) const { return hits_; } -const edm::PSimHitContainer& MuonSimHitMatcher::hitsInDetId( - unsigned int detid) const { - if (detid_to_hits_.find(detid) == detid_to_hits_.end()) return no_hits_; +const edm::PSimHitContainer& MuonSimHitMatcher::hitsInDetId(unsigned int detid) const { + if (detid_to_hits_.find(detid) == detid_to_hits_.end()) + return no_hits_; return detid_to_hits_.at(detid); } -const edm::PSimHitContainer& MuonSimHitMatcher::hitsInChamber( - unsigned int detid) const { - if (chamber_to_hits_.find(detid) == chamber_to_hits_.end()) return no_hits_; +const edm::PSimHitContainer& MuonSimHitMatcher::hitsInChamber(unsigned int detid) const { + if (chamber_to_hits_.find(detid) == chamber_to_hits_.end()) + return no_hits_; return chamber_to_hits_.at(detid); } -GlobalPoint MuonSimHitMatcher::simHitsMeanPosition( - const edm::PSimHitContainer& sim_hits) const { - if (sim_hits.empty()) return GlobalPoint(); // point "zero" +GlobalPoint MuonSimHitMatcher::simHitsMeanPosition(const edm::PSimHitContainer& sim_hits) const { + if (sim_hits.empty()) + return GlobalPoint(); // point "zero" float sumx, sumy, sumz; sumx = sumy = sumz = 0.f; size_t n = 0; for (const auto& h : sim_hits) { const LocalPoint& lp = h.entryPoint(); - const GlobalPoint& gp = - geometry_->idToDet(h.detUnitId())->surface().toGlobal(lp); + const GlobalPoint& gp = geometry_->idToDet(h.detUnitId())->surface().toGlobal(lp); sumx += gp.x(); sumy += gp.y(); sumz += gp.z(); ++n; } - if (n == 0) return GlobalPoint(); + if (n == 0) + return GlobalPoint(); return GlobalPoint(sumx / n, sumy / n, sumz / n); } -GlobalVector MuonSimHitMatcher::simHitsMeanMomentum( - const edm::PSimHitContainer& sim_hits) const { - if (sim_hits.empty()) return GlobalVector(); // point "zero" +GlobalVector MuonSimHitMatcher::simHitsMeanMomentum(const edm::PSimHitContainer& sim_hits) const { + if (sim_hits.empty()) + return GlobalVector(); // point "zero" float sumx, sumy, sumz; sumx = sumy = sumz = 0.f; size_t n = 0; for (const auto& h : sim_hits) { const LocalVector& lv = h.momentumAtEntry(); - const GlobalVector& gv = - geometry_->idToDet(h.detUnitId())->surface().toGlobal(lv); + const GlobalVector& gv = geometry_->idToDet(h.detUnitId())->surface().toGlobal(lv); sumx += gv.x(); sumy += gv.y(); sumz += gv.z(); ++n; } - if (n == 0) return GlobalVector(); + if (n == 0) + return GlobalVector(); return GlobalVector(sumx / n, sumy / n, sumz / n); } diff --git a/Validation/MuonHits/src/RPCSimHitMatcher.cc b/Validation/MuonHits/src/RPCSimHitMatcher.cc index 1da78f99c8c25..198a81fbce35b 100644 --- a/Validation/MuonHits/src/RPCSimHitMatcher.cc +++ b/Validation/MuonHits/src/RPCSimHitMatcher.cc @@ -3,28 +3,24 @@ using namespace std; -RPCSimHitMatcher::RPCSimHitMatcher(const edm::ParameterSet& ps, - edm::ConsumesCollector&& iC) +RPCSimHitMatcher::RPCSimHitMatcher(const edm::ParameterSet& ps, edm::ConsumesCollector&& iC) : MuonSimHitMatcher(ps, std::move(iC)) { simHitPSet_ = ps.getParameterSet("rpcSimHit"); verbose_ = simHitPSet_.getParameter("verbose"); simMuOnly_ = simHitPSet_.getParameter("simMuOnly"); discardEleHits_ = simHitPSet_.getParameter("discardEleHits"); - simHitInput_ = iC.consumes( - simHitPSet_.getParameter("inputTag")); + simHitInput_ = iC.consumes(simHitPSet_.getParameter("inputTag")); } /// initialize the event -void RPCSimHitMatcher::init(const edm::Event& iEvent, - const edm::EventSetup& iSetup) { +void RPCSimHitMatcher::init(const edm::Event& iEvent, const edm::EventSetup& iSetup) { iSetup.get().get(rpc_geom_); if (rpc_geom_.isValid()) { geometry_ = &*rpc_geom_; } else { hasGeometry_ = false; - edm::LogWarning("RPCSimHitMatcher") - << "+++ Info: RPC geometry is unavailable. +++\n"; + edm::LogWarning("RPCSimHitMatcher") << "+++ Info: RPC geometry is unavailable. +++\n"; } MuonSimHitMatcher::init(iEvent, iSetup); } @@ -38,20 +34,16 @@ void RPCSimHitMatcher::match(const SimTrack& track, const SimVertex& vertex) { matchSimHitsToSimTrack(); if (verbose_) { - edm::LogInfo("RPCSimHitMatcher") - << "nSimHits " << simHits_.size() << " nTrackIds " - << track_ids_.size() << endl; - edm::LogInfo("RPCSimHitMatcher") - << "detids RPC " << detIds().size() << endl; + edm::LogInfo("RPCSimHitMatcher") << "nSimHits " << simHits_.size() << " nTrackIds " << track_ids_.size() << endl; + edm::LogInfo("RPCSimHitMatcher") << "detids RPC " << detIds().size() << endl; const auto& ch_ids = chamberIds(); for (const auto& id : ch_ids) { const auto& simhits = MuonSimHitMatcher::hitsInChamber(id); const auto& simhits_gp = simHitsMeanPosition(simhits); - edm::LogInfo("RPCSimHitMatcher") - << "RPCDetId " << RPCDetId(id) << ": nHits " << simhits.size() - << " eta " << simhits_gp.eta() << " phi " << simhits_gp.phi() - << " nCh " << chamber_to_hits_[id].size() << endl; + edm::LogInfo("RPCSimHitMatcher") << "RPCDetId " << RPCDetId(id) << ": nHits " << simhits.size() << " eta " + << simhits_gp.eta() << " phi " << simhits_gp.phi() << " nCh " + << chamber_to_hits_[id].size() << endl; const auto& strips = hitStripsInDetId(id); edm::LogInfo("RPCSimHitMatcher") << "nStrips " << strips.size() << endl; edm::LogInfo("RPCSimHitMatcher") << "strips : "; @@ -66,11 +58,14 @@ void RPCSimHitMatcher::match(const SimTrack& track, const SimVertex& vertex) { void RPCSimHitMatcher::matchSimHitsToSimTrack() { for (const auto& track_id : track_ids_) { for (const auto& h : simHits_) { - if (h.trackId() != track_id) continue; + if (h.trackId() != track_id) + continue; int pdgid = h.particleType(); - if (simMuOnly_ && std::abs(pdgid) != 13) continue; + if (simMuOnly_ && std::abs(pdgid) != 13) + continue; // discard electron hits in the RPC chambers - if (discardEleHits_ && pdgid == 11) continue; + if (discardEleHits_ && pdgid == 11) + continue; const RPCDetId& layer_id(h.detUnitId()); detid_to_hits_[h.detUnitId()].push_back(h); @@ -86,8 +81,7 @@ std::set RPCSimHitMatcher::detIds(int type) const { const auto& id = p.first; if (type > 0) { RPCDetId detId(id); - if (MuonHitHelper::toRPCType(detId.region(), detId.station(), - detId.ring()) != type) + if (MuonHitHelper::toRPCType(detId.region(), detId.station(), detId.ring()) != type) continue; } result.insert(id); @@ -101,8 +95,7 @@ std::set RPCSimHitMatcher::chamberIds(int type) const { const auto& id = p.first; if (type > 0) { RPCDetId detId(id); - if (MuonHitHelper::toRPCType(detId.region(), detId.station(), - detId.ring()) != type) + if (MuonHitHelper::toRPCType(detId.region(), detId.station(), detId.ring()) != type) continue; } result.insert(id); @@ -114,19 +107,18 @@ bool RPCSimHitMatcher::hitStation(int st) const { int nst = 0; for (const auto& ddt : chamberIds(0)) { const RPCDetId id(ddt); - if (id.station() != st) continue; + if (id.station() != st) + continue; ++nst; } return nst; } -int RPCSimHitMatcher::nStations() const { - return (hitStation(1) + hitStation(2) + hitStation(3) + hitStation(4)); -} +int RPCSimHitMatcher::nStations() const { return (hitStation(1) + hitStation(2) + hitStation(3) + hitStation(4)); } -float RPCSimHitMatcher::simHitsMeanStrip( - const edm::PSimHitContainer& sim_hits) const { - if (sim_hits.empty()) return -1.f; +float RPCSimHitMatcher::simHitsMeanStrip(const edm::PSimHitContainer& sim_hits) const { + if (sim_hits.empty()) + return -1.f; float sums = 0.f; size_t n = 0; @@ -136,16 +128,15 @@ float RPCSimHitMatcher::simHitsMeanStrip( sums += dynamic_cast(geometry_)->roll(d)->strip(lp); ++n; } - if (n == 0) return -1.f; + if (n == 0) + return -1.f; return sums / n; } -std::set RPCSimHitMatcher::hitStripsInDetId(unsigned int detid, - int margin_n_strips) const { +std::set RPCSimHitMatcher::hitStripsInDetId(unsigned int detid, int margin_n_strips) const { set result; RPCDetId id(detid); - for (const auto& roll : - dynamic_cast(geometry_)->chamber(id)->rolls()) { + for (const auto& roll : dynamic_cast(geometry_)->chamber(id)->rolls()) { int max_nstrips = roll->nstrips(); for (const auto& h : MuonSimHitMatcher::hitsInDetId(roll->id().rawId())) { const LocalPoint& lp = h.entryPoint(); @@ -154,7 +145,8 @@ std::set RPCSimHitMatcher::hitStripsInDetId(unsigned int detid, smin = (smin > 0) ? smin : 1; int smax = central_strip + margin_n_strips; smax = (smax <= max_nstrips) ? smax : max_nstrips; - for (int ss = smin; ss <= smax; ++ss) result.insert(ss); + for (int ss = smin; ss <= smax; ++ss) + result.insert(ss); } } return result; diff --git a/Validation/RecoVertex/bin/BSvsPVPlots.cc b/Validation/RecoVertex/bin/BSvsPVPlots.cc index eb2dede2ea690..fa24b9a610b35 100644 --- a/Validation/RecoVertex/bin/BSvsPVPlots.cc +++ b/Validation/RecoVertex/bin/BSvsPVPlots.cc @@ -19,39 +19,39 @@ #include "TText.h" #include "TLegend.h" -void BSvsPVPlots(const char* fullname,const char* module, const char* label, const char* postfix, const char* shortname, const char* outtrunk) { - +void BSvsPVPlots(const char* fullname, + const char* module, + const char* label, + const char* postfix, + const char* shortname, + const char* outtrunk) { char modfull[300]; - sprintf(modfull,"%s%s",module,postfix); + sprintf(modfull, "%s%s", module, postfix); char labfull[300]; - sprintf(labfull,"%s%s",label,postfix); + sprintf(labfull, "%s%s", label, postfix); char dirname[400]; - sprintf(dirname,"%s",shortname); + sprintf(dirname, "%s", shortname); // char fullname[300]; // if(strlen(family)==0) { sprintf(fullname,"rootfiles/Tracking_PFG_%s.root",filename);} // else { sprintf(fullname,"rootfiles/%s.root",dirname); } - - - std::string workdir = outtrunk ; + std::string workdir = outtrunk; workdir += dirname; gSystem->cd(workdir.c_str()); gSystem->MakeDirectory(labfull); // gSystem->cd("/afs/cern.ch/cms/tracking/output"); - TFile ff(fullname); gStyle->SetOptStat(111111); // Colliding events - - CommonAnalyzer castat(&ff,"",modfull); + CommonAnalyzer castat(&ff, "", modfull); { - TH1F* deltax = (TH1F*)castat.getObject("deltax"); - if (deltax && deltax->GetEntries()>0) { + TH1F* deltax = (TH1F*)castat.getObject("deltax"); + if (deltax && deltax->GetEntries() > 0) { deltax->Draw(); gPad->SetLogy(1); std::string plotfilename; @@ -68,8 +68,8 @@ void BSvsPVPlots(const char* fullname,const char* module, const char* label, con gPad->SetLogy(0); delete deltax; } - TH1F* deltay = (TH1F*)castat.getObject("deltay"); - if (deltay && deltay->GetEntries()>0) { + TH1F* deltay = (TH1F*)castat.getObject("deltay"); + if (deltay && deltay->GetEntries() > 0) { deltay->Draw(); gPad->SetLogy(1); std::string plotfilename; @@ -86,8 +86,8 @@ void BSvsPVPlots(const char* fullname,const char* module, const char* label, con gPad->SetLogy(0); delete deltay; } - TH1F* deltaz = (TH1F*)castat.getObject("deltaz"); - if (deltaz && deltaz->GetEntries()>0) { + TH1F* deltaz = (TH1F*)castat.getObject("deltaz"); + if (deltaz && deltaz->GetEntries() > 0) { deltaz->Draw(); gPad->SetLogy(1); std::string plotfilename; @@ -106,15 +106,15 @@ void BSvsPVPlots(const char* fullname,const char* module, const char* label, con } gStyle->SetOptStat(111); gStyle->SetOptFit(111); - TProfile* deltaxvsz = (TProfile*)castat.getObject("deltaxvsz"); - if (deltaxvsz && deltaxvsz->GetEntries()>0) { + TProfile* deltaxvsz = (TProfile*)castat.getObject("deltaxvsz"); + if (deltaxvsz && deltaxvsz->GetEntries() > 0) { // deltaxvsz->Draw(); - deltaxvsz->Fit("pol1","","",-10.,10.); - if(deltaxvsz->GetFunction("pol1")) { - deltaxvsz->GetFunction("pol1")->SetLineColor(kRed); - deltaxvsz->GetFunction("pol1")->SetLineWidth(1); + deltaxvsz->Fit("pol1", "", "", -10., 10.); + if (deltaxvsz->GetFunction("pol1")) { + deltaxvsz->GetFunction("pol1")->SetLineColor(kRed); + deltaxvsz->GetFunction("pol1")->SetLineWidth(1); } - deltaxvsz->GetYaxis()->SetRangeUser(-0.001,0.001); + deltaxvsz->GetYaxis()->SetRangeUser(-0.001, 0.001); std::string plotfilename; plotfilename += outtrunk; plotfilename += dirname; @@ -128,15 +128,15 @@ void BSvsPVPlots(const char* fullname,const char* module, const char* label, con gPad->Print(plotfilename.c_str()); delete deltaxvsz; } - TProfile* deltayvsz = (TProfile*)castat.getObject("deltayvsz"); - if (deltayvsz && deltayvsz->GetEntries()>0) { + TProfile* deltayvsz = (TProfile*)castat.getObject("deltayvsz"); + if (deltayvsz && deltayvsz->GetEntries() > 0) { // deltayvsz->Draw(); - deltayvsz->Fit("pol1","","",-10.,10.); - if(deltayvsz->GetFunction("pol1")) { - deltayvsz->GetFunction("pol1")->SetLineColor(kRed); - deltayvsz->GetFunction("pol1")->SetLineWidth(1); + deltayvsz->Fit("pol1", "", "", -10., 10.); + if (deltayvsz->GetFunction("pol1")) { + deltayvsz->GetFunction("pol1")->SetLineColor(kRed); + deltayvsz->GetFunction("pol1")->SetLineWidth(1); } - deltayvsz->GetYaxis()->SetRangeUser(-0.001,0.001); + deltayvsz->GetYaxis()->SetRangeUser(-0.001, 0.001); std::string plotfilename; plotfilename += outtrunk; plotfilename += dirname; @@ -153,9 +153,12 @@ void BSvsPVPlots(const char* fullname,const char* module, const char* label, con } gStyle->SetOptStat(111111); gStyle->SetOptFit(1111); - + // Define fitting functions - TF1* fdoubleg = new TF1("doubleg","[1]*exp(-0.5*((x-[0])/[2])**2)+[3]*exp(-0.5*((x-[0])/[4])**2)+[5]*exp(sqrt((x-[0])**2)*[6])",-.2,.2); + TF1* fdoubleg = new TF1("doubleg", + "[1]*exp(-0.5*((x-[0])/[2])**2)+[3]*exp(-0.5*((x-[0])/[4])**2)+[5]*exp(sqrt((x-[0])**2)*[6])", + -.2, + .2); fdoubleg->SetLineColor(kRed); fdoubleg->SetLineWidth(1); /* @@ -167,228 +170,229 @@ void BSvsPVPlots(const char* fullname,const char* module, const char* label, con gStyle->SetOptFit(1111); // Summary histograms - TH1D* deltaxsum = new TH1D("deltaxsum","(PV-BS) Fitted X position vs run",10,0.,10.); + TH1D* deltaxsum = new TH1D("deltaxsum", "(PV-BS) Fitted X position vs run", 10, 0., 10.); deltaxsum->SetCanExtend(TH1::kAllAxes); - TH1D* deltaysum = new TH1D("deltaysum","(PV-BS) Fitted Y position vs run",10,0.,10.); + TH1D* deltaysum = new TH1D("deltaysum", "(PV-BS) Fitted Y position vs run", 10, 0., 10.); deltaysum->SetCanExtend(TH1::kAllAxes); - TH1D* deltaxmeansum = new TH1D("deltaxmeansum","(PV-BS) Mean X position vs run",10,0.,10.); + TH1D* deltaxmeansum = new TH1D("deltaxmeansum", "(PV-BS) Mean X position vs run", 10, 0., 10.); deltaxmeansum->SetCanExtend(TH1::kAllAxes); - TH1D* deltaymeansum = new TH1D("deltaymeansum","(PV-BS) Mean Y position vs run",10,0.,10.); + TH1D* deltaymeansum = new TH1D("deltaymeansum", "(PV-BS) Mean Y position vs run", 10, 0., 10.); deltaymeansum->SetCanExtend(TH1::kAllAxes); - TH1D* deltazmeansum = new TH1D("deltazmeansum","(PV-BS) Mean Z position vs run",10,0.,10.); + TH1D* deltazmeansum = new TH1D("deltazmeansum", "(PV-BS) Mean Z position vs run", 10, 0., 10.); deltazmeansum->SetCanExtend(TH1::kAllAxes); std::vector runs = castat.getRunList(); - std::sort(runs.begin(),runs.end()); + std::sort(runs.begin(), runs.end()); { - std::cout << "Found " << runs.size() << " runs" << std::endl; - for(unsigned int i=0;iGetEntries()>0) { - // deltax->Draw(); - fdoubleg->SetParameter(0,deltax->GetMean()); - fdoubleg->SetParameter(2,deltax->GetRMS()); - fdoubleg->SetParameter(4,deltax->GetRMS()); - fdoubleg->SetParameter(1,deltax->GetMaximum()); - fdoubleg->SetParameter(3,0.1*deltax->GetMaximum()); - fdoubleg->SetParameter(5,0.1*deltax->GetMaximum()); - const int result = deltax->Fit(fdoubleg,"b","",-.05,.05); - gPad->SetLogy(1); - char tresult[100]; - sprintf(tresult,"%d",result); - TText res; res.SetTextColor(kRed); - if(result!=0) res.DrawTextNDC(.2,.8,tresult); - - int bin = deltaxsum->Fill(runlabel,fdoubleg->GetParameter(0)); - deltaxsum->SetBinError(bin,fdoubleg->GetParError(0)); - - bin = deltaxmeansum->Fill(runlabel,deltax->GetMean()); - deltaxmeansum->SetBinError(bin,deltax->GetMeanError()); - - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/deltaxrun_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - gPad->SetLogy(0); - delete deltax; + + TH1F* deltax = (TH1F*)castat.getObject("deltaxrun"); + if (deltax && deltax->GetEntries() > 0) { + // deltax->Draw(); + fdoubleg->SetParameter(0, deltax->GetMean()); + fdoubleg->SetParameter(2, deltax->GetRMS()); + fdoubleg->SetParameter(4, deltax->GetRMS()); + fdoubleg->SetParameter(1, deltax->GetMaximum()); + fdoubleg->SetParameter(3, 0.1 * deltax->GetMaximum()); + fdoubleg->SetParameter(5, 0.1 * deltax->GetMaximum()); + const int result = deltax->Fit(fdoubleg, "b", "", -.05, .05); + gPad->SetLogy(1); + char tresult[100]; + sprintf(tresult, "%d", result); + TText res; + res.SetTextColor(kRed); + if (result != 0) + res.DrawTextNDC(.2, .8, tresult); + + int bin = deltaxsum->Fill(runlabel, fdoubleg->GetParameter(0)); + deltaxsum->SetBinError(bin, fdoubleg->GetParError(0)); + + bin = deltaxmeansum->Fill(runlabel, deltax->GetMean()); + deltaxmeansum->SetBinError(bin, deltax->GetMeanError()); + + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/deltaxrun_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + gPad->SetLogy(0); + delete deltax; } - TH1F* deltay = (TH1F*)castat.getObject("deltayrun"); - if (deltay && deltay->GetEntries()>0) { - deltay->Draw(); - fdoubleg->SetParameter(0,deltay->GetMean()); - fdoubleg->SetParameter(2,deltay->GetRMS()); - fdoubleg->SetParameter(4,deltay->GetRMS()); - fdoubleg->SetParameter(1,deltay->GetMaximum()); - fdoubleg->SetParameter(3,0.1*deltay->GetMaximum()); - fdoubleg->SetParameter(5,0.1*deltay->GetMaximum()); - const int result = deltay->Fit(fdoubleg,"b","",-.05,.05); - gPad->SetLogy(1); - char tresult[100]; - sprintf(tresult,"%d",result); - TText res; res.SetTextColor(kRed); - if(result!=0) res.DrawTextNDC(.2,.8,tresult); - - int bin = deltaysum->Fill(runlabel,fdoubleg->GetParameter(0)); - deltaysum->SetBinError(bin,fdoubleg->GetParError(0)); - - bin = deltaymeansum->Fill(runlabel,deltay->GetMean()); - deltaymeansum->SetBinError(bin,deltay->GetMeanError()); - - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/deltayrun_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - gPad->SetLogy(0); - delete deltay; + TH1F* deltay = (TH1F*)castat.getObject("deltayrun"); + if (deltay && deltay->GetEntries() > 0) { + deltay->Draw(); + fdoubleg->SetParameter(0, deltay->GetMean()); + fdoubleg->SetParameter(2, deltay->GetRMS()); + fdoubleg->SetParameter(4, deltay->GetRMS()); + fdoubleg->SetParameter(1, deltay->GetMaximum()); + fdoubleg->SetParameter(3, 0.1 * deltay->GetMaximum()); + fdoubleg->SetParameter(5, 0.1 * deltay->GetMaximum()); + const int result = deltay->Fit(fdoubleg, "b", "", -.05, .05); + gPad->SetLogy(1); + char tresult[100]; + sprintf(tresult, "%d", result); + TText res; + res.SetTextColor(kRed); + if (result != 0) + res.DrawTextNDC(.2, .8, tresult); + + int bin = deltaysum->Fill(runlabel, fdoubleg->GetParameter(0)); + deltaysum->SetBinError(bin, fdoubleg->GetParError(0)); + + bin = deltaymeansum->Fill(runlabel, deltay->GetMean()); + deltaymeansum->SetBinError(bin, deltay->GetMeanError()); + + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/deltayrun_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + gPad->SetLogy(0); + delete deltay; } - TH1F* deltaz = (TH1F*)castat.getObject("deltazrun"); - if (deltaz && deltaz->GetEntries()>0) { - deltaz->Draw(); - gPad->SetLogy(1); - - int bin = deltazmeansum->Fill(runlabel,deltaz->GetMean()); - deltazmeansum->SetBinError(bin,deltaz->GetMeanError()); - - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/deltazrun_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - gPad->SetLogy(0); - delete deltaz; + TH1F* deltaz = (TH1F*)castat.getObject("deltazrun"); + if (deltaz && deltaz->GetEntries() > 0) { + deltaz->Draw(); + gPad->SetLogy(1); + + int bin = deltazmeansum->Fill(runlabel, deltaz->GetMean()); + deltazmeansum->SetBinError(bin, deltaz->GetMeanError()); + + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/deltazrun_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + gPad->SetLogy(0); + delete deltaz; } - TProfile* deltaxvsz = (TProfile*)castat.getObject("deltaxvszrun"); - if (deltaxvsz && deltaxvsz->GetEntries()>0) { - deltaxvsz->Draw(); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/deltaxvszrun_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete deltaxvsz; + TProfile* deltaxvsz = (TProfile*)castat.getObject("deltaxvszrun"); + if (deltaxvsz && deltaxvsz->GetEntries() > 0) { + deltaxvsz->Draw(); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/deltaxvszrun_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete deltaxvsz; } - - TProfile* deltayvsz = (TProfile*)castat.getObject("deltayvszrun"); - if (deltayvsz && deltayvsz->GetEntries()>0) { - deltayvsz->Draw(); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/deltayvszrun_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete deltayvsz; + + TProfile* deltayvsz = (TProfile*)castat.getObject("deltayvszrun"); + if (deltayvsz && deltayvsz->GetEntries() > 0) { + deltayvsz->Draw(); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/deltayvszrun_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete deltayvsz; } - - - TH1F* deltaxvsorb = (TH1F*)castat.getObject("deltaxvsorbrun"); - if (deltaxvsorb && deltaxvsorb->GetEntries()>0) { - deltaxvsorb->Draw(); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/deltaxvsorb_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete deltaxvsorb; + + TH1F* deltaxvsorb = (TH1F*)castat.getObject("deltaxvsorbrun"); + if (deltaxvsorb && deltaxvsorb->GetEntries() > 0) { + deltaxvsorb->Draw(); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/deltaxvsorb_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete deltaxvsorb; } - TH1F* deltayvsorb = (TH1F*)castat.getObject("deltayvsorbrun"); - if (deltayvsorb && deltayvsorb->GetEntries()>0) { - deltayvsorb->Draw(); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/deltayvsorb_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete deltayvsorb; + TH1F* deltayvsorb = (TH1F*)castat.getObject("deltayvsorbrun"); + if (deltayvsorb && deltayvsorb->GetEntries() > 0) { + deltayvsorb->Draw(); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/deltayvsorb_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete deltayvsorb; } - TH1F* deltazvsorb = (TH1F*)castat.getObject("deltazvsorbrun"); - if (deltazvsorb && deltazvsorb->GetEntries()>0) { - deltazvsorb->Draw(); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/deltazvsorb_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete deltazvsorb; + TH1F* deltazvsorb = (TH1F*)castat.getObject("deltazvsorbrun"); + if (deltazvsorb && deltazvsorb->GetEntries() > 0) { + deltazvsorb->Draw(); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/deltazvsorb_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete deltazvsorb; } } } @@ -396,9 +400,9 @@ void BSvsPVPlots(const char* fullname,const char* module, const char* label, con gStyle->SetOptStat(1111); gStyle->SetOptFit(0); - if(!runs.empty()) { + if (!runs.empty()) { std::string plotfilename; - + plotfilename = outtrunk; plotfilename += dirname; plotfilename += "/"; @@ -409,16 +413,17 @@ void BSvsPVPlots(const char* fullname,const char* module, const char* label, con plotfilename += dirname; plotfilename += ".gif"; - TCanvas * cwidedeltax = new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500); + TCanvas* cwidedeltax = new TCanvas(plotfilename.c_str(), plotfilename.c_str(), 1500, 500); - deltaxsum->SetLineColor(kRed); deltaxsum->SetMarkerColor(kRed); - deltaxsum->GetYaxis()->SetRangeUser(-.002,.002); + deltaxsum->SetLineColor(kRed); + deltaxsum->SetMarkerColor(kRed); + deltaxsum->GetYaxis()->SetRangeUser(-.002, .002); deltaxsum->GetYaxis()->SetTitle("#Delta x (cm)"); deltaxsum->Draw(); deltaxmeansum->Draw("esame"); - TLegend deltaxleg(.7,.8,.85,.9,"#Delta(x)"); - deltaxleg.AddEntry(deltaxsum,"fitted mean","l"); - deltaxleg.AddEntry(deltaxmeansum,"aritm. mean","l"); + TLegend deltaxleg(.7, .8, .85, .9, "#Delta(x)"); + deltaxleg.AddEntry(deltaxsum, "fitted mean", "l"); + deltaxleg.AddEntry(deltaxmeansum, "aritm. mean", "l"); deltaxleg.Draw(); gPad->Print(plotfilename.c_str()); delete cwidedeltax; @@ -433,21 +438,21 @@ void BSvsPVPlots(const char* fullname,const char* module, const char* label, con plotfilename += dirname; plotfilename += ".gif"; - TCanvas * cwidedeltay = new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500); + TCanvas* cwidedeltay = new TCanvas(plotfilename.c_str(), plotfilename.c_str(), 1500, 500); - deltaysum->SetLineColor(kRed); deltaysum->SetMarkerColor(kRed); - deltaysum->GetYaxis()->SetRangeUser(-.002,.002); + deltaysum->SetLineColor(kRed); + deltaysum->SetMarkerColor(kRed); + deltaysum->GetYaxis()->SetRangeUser(-.002, .002); deltaysum->GetYaxis()->SetTitle("#Delta y (cm)"); deltaysum->Draw(); deltaymeansum->Draw("esame"); - TLegend deltayleg(.7,.8,.85,.9,"#Delta(y)"); - deltayleg.AddEntry(deltaysum,"fitted mean","l"); - deltayleg.AddEntry(deltaymeansum,"aritm. mean","l"); + TLegend deltayleg(.7, .8, .85, .9, "#Delta(y)"); + deltayleg.AddEntry(deltaysum, "fitted mean", "l"); + deltayleg.AddEntry(deltaymeansum, "aritm. mean", "l"); deltayleg.Draw(); gPad->Print(plotfilename.c_str()); delete cwidedeltay; - plotfilename = outtrunk; plotfilename += dirname; plotfilename += "/"; @@ -458,9 +463,9 @@ void BSvsPVPlots(const char* fullname,const char* module, const char* label, con plotfilename += dirname; plotfilename += ".gif"; - TCanvas * cwidedeltaz = new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500); + TCanvas* cwidedeltaz = new TCanvas(plotfilename.c_str(), plotfilename.c_str(), 1500, 500); - deltazmeansum->GetYaxis()->SetRangeUser(-2.,2.); + deltazmeansum->GetYaxis()->SetRangeUser(-2., 2.); deltazmeansum->GetYaxis()->SetTitle("#Delta z (cm)"); deltazmeansum->Draw(); gPad->Print(plotfilename.c_str()); @@ -472,8 +477,6 @@ void BSvsPVPlots(const char* fullname,const char* module, const char* label, con delete deltaymeansum; delete deltazmeansum; - ff.Close(); delete fdoubleg; } - diff --git a/Validation/RecoVertex/bin/BSvsPVPlots.h b/Validation/RecoVertex/bin/BSvsPVPlots.h index 89620620e00ad..9ab58f9be87cf 100644 --- a/Validation/RecoVertex/bin/BSvsPVPlots.h +++ b/Validation/RecoVertex/bin/BSvsPVPlots.h @@ -1,7 +1,11 @@ #ifndef Validation_RecoVertex_BSvsPVPlots_h #define Validation_RecoVertex_BSvsPVPlots_h -void BSvsPVPlots(const char* fullname,const char* module, const char* label, const char* postfix, const char* shortname, const char* outtrunk); - -#endif // Validation_RecoVertex_BSvsPVPlots_h +void BSvsPVPlots(const char* fullname, + const char* module, + const char* label, + const char* postfix, + const char* shortname, + const char* outtrunk); +#endif // Validation_RecoVertex_BSvsPVPlots_h diff --git a/Validation/RecoVertex/bin/PrimaryVertexPlots.cc b/Validation/RecoVertex/bin/PrimaryVertexPlots.cc index 6d0ca580eadff..bce80f98bb918 100644 --- a/Validation/RecoVertex/bin/PrimaryVertexPlots.cc +++ b/Validation/RecoVertex/bin/PrimaryVertexPlots.cc @@ -20,270 +20,269 @@ #include "TCanvas.h" #include "TGraphErrors.h" -void PrimaryVertexPlots(const char* fullname,const char* module, const char* postfix, const char* label, const char* shortname, const char* outtrunk) { - +void PrimaryVertexPlots(const char* fullname, + const char* module, + const char* postfix, + const char* label, + const char* shortname, + const char* outtrunk) { std::cout << shortname << module << postfix << label << std::endl; char modfull[300]; - sprintf(modfull,"%s%s",module,postfix); + sprintf(modfull, "%s%s", module, postfix); char labfull[300]; - sprintf(labfull,"%s%s",label,postfix); + sprintf(labfull, "%s%s", label, postfix); char dirname[400]; - sprintf(dirname,"%s",shortname); + sprintf(dirname, "%s", shortname); // char fullname[300]; // if(strlen(family)==0) { sprintf(fullname,"rootfiles/Tracking_PFG_%s.root",filename);} // else { sprintf(fullname,"rootfiles/%s.root",dirname); } - - - std::string workdir = outtrunk ; + std::string workdir = outtrunk; workdir += dirname; gSystem->cd(workdir.c_str()); gSystem->MakeDirectory(labfull); // gSystem->cd("/afs/cern.ch/cms/tracking/output"); - TFile ff(fullname); // Colliding events - - CommonAnalyzer castat(&ff,"",modfull); + CommonAnalyzer castat(&ff, "", modfull); char bsmodule[300]; - sprintf(bsmodule,"beamspotanalyzer%s",postfix); - CommonAnalyzer cabs(&ff,"",bsmodule); - sprintf(bsmodule,"onlinebsanalyzer%s",postfix); - CommonAnalyzer cabsonl(&ff,"",bsmodule); - sprintf(bsmodule,"testbsanalyzer%s",postfix); - CommonAnalyzer cabstest(&ff,"",bsmodule); - + sprintf(bsmodule, "beamspotanalyzer%s", postfix); + CommonAnalyzer cabs(&ff, "", bsmodule); + sprintf(bsmodule, "onlinebsanalyzer%s", postfix); + CommonAnalyzer cabsonl(&ff, "", bsmodule); + sprintf(bsmodule, "testbsanalyzer%s", postfix); + CommonAnalyzer cabstest(&ff, "", bsmodule); std::cout << "ready" << std::endl; - + TH1F* ntrvtx = (TH1F*)castat.getObject("ntruevtx"); - if(ntrvtx) { - ntrvtx->Draw(); - gPad->SetLogy(1); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/ntrvtx_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete ntrvtx; - gPad->SetLogy(0); + if (ntrvtx) { + ntrvtx->Draw(); + gPad->SetLogy(1); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/ntrvtx_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete ntrvtx; + gPad->SetLogy(0); } gStyle->SetOptStat(111); gStyle->SetOptFit(111); TProfile* ntrvtxvslumi = (TProfile*)castat.getObject("ntruevtxvslumi"); - if(ntrvtxvslumi && ntrvtxvslumi->GetEntries()>0 ) { + if (ntrvtxvslumi && ntrvtxvslumi->GetEntries() > 0) { // ntrvtxvslumi->Draw(); - ntrvtxvslumi->Fit("pol2","","",0.5,3.0); - if(ntrvtxvslumi->GetFunction("pol2")) { - ntrvtxvslumi->GetFunction("pol2")->SetLineColor(kBlack); - ntrvtxvslumi->GetFunction("pol2")->SetLineWidth(1); - } - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/ntrvtxvslumi_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); + ntrvtxvslumi->Fit("pol2", "", "", 0.5, 3.0); + if (ntrvtxvslumi->GetFunction("pol2")) { + ntrvtxvslumi->GetFunction("pol2")->SetLineColor(kBlack); + ntrvtxvslumi->GetFunction("pol2")->SetLineWidth(1); + } + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/ntrvtxvslumi_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); } gStyle->SetOptStat(1111); TH2D* ntrvtxvslumi2D = (TH2D*)castat.getObject("ntruevtxvslumi2D"); - if(ntrvtxvslumi2D && ntrvtxvslumi2D->GetEntries()>0 ) { - ntrvtxvslumi2D->Draw("colz"); - if(ntrvtxvslumi) { - ntrvtxvslumi->SetMarkerStyle(20); - ntrvtxvslumi->SetMarkerSize(.3); - ntrvtxvslumi->Draw("same"); - } - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/ntrvtxvslumi2D_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += ".gif"; - gPad->SetLogz(1); - gPad->Print(plotfilename.c_str()); - gPad->SetLogz(0); - delete ntrvtxvslumi2D; + if (ntrvtxvslumi2D && ntrvtxvslumi2D->GetEntries() > 0) { + ntrvtxvslumi2D->Draw("colz"); + if (ntrvtxvslumi) { + ntrvtxvslumi->SetMarkerStyle(20); + ntrvtxvslumi->SetMarkerSize(.3); + ntrvtxvslumi->Draw("same"); + } + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/ntrvtxvslumi2D_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += ".gif"; + gPad->SetLogz(1); + gPad->Print(plotfilename.c_str()); + gPad->SetLogz(0); + delete ntrvtxvslumi2D; } delete ntrvtxvslumi; std::cout << "ready2" << std::endl; TH1F* ndofvtx = (TH1F*)castat.getObject("ndof"); - if(ndofvtx) { - ndofvtx->Draw(); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/ndofvtx_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete ndofvtx; + if (ndofvtx) { + ndofvtx->Draw(); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/ndofvtx_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete ndofvtx; } TH1F* ntracksvtx = (TH1F*)castat.getObject("ntracks"); - if(ntracksvtx) { - ntracksvtx->Draw(); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/ntracksvtx_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete ntracksvtx; + if (ntracksvtx) { + ntracksvtx->Draw(); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/ntracksvtx_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete ntracksvtx; } TH1F* aveweight = (TH1F*)castat.getObject("aveweight"); - if(aveweight) { - aveweight->Draw(); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/aveweight_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete aveweight; + if (aveweight) { + aveweight->Draw(); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/aveweight_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete aveweight; } TProfile* aveweightvsvtxz = (TProfile*)castat.getObject("aveweightvsvtxz"); - if(aveweightvsvtxz) { - aveweightvsvtxz->Draw(); - aveweightvsvtxz->GetYaxis()->SetRangeUser(0.75,1.05); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/aveweightvsvtxz_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete aveweightvsvtxz; + if (aveweightvsvtxz) { + aveweightvsvtxz->Draw(); + aveweightvsvtxz->GetYaxis()->SetRangeUser(0.75, 1.05); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/aveweightvsvtxz_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete aveweightvsvtxz; } TProfile* ndofvsvtxz = (TProfile*)castat.getObject("ndofvsvtxz"); - if(ndofvsvtxz) { - ndofvsvtxz->Draw(); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/ndofvsvtxz_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete ndofvsvtxz; + if (ndofvsvtxz) { + ndofvsvtxz->Draw(); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/ndofvsvtxz_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete ndofvsvtxz; } TProfile* ntracksvsvtxz = (TProfile*)castat.getObject("ntracksvsvtxz"); - if(ntracksvsvtxz) { - ntracksvsvtxz->Draw(); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/ntracksvsvtxz_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete ntracksvsvtxz; + if (ntracksvsvtxz) { + ntracksvsvtxz->Draw(); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/ntracksvsvtxz_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete ntracksvsvtxz; } std::cout << "ready3" << std::endl; TH2F* ndofvsntrks = (TH2F*)castat.getObject("ndofvstracks"); - if(ndofvsntrks) { - ndofvsntrks->Draw("colz"); - gPad->SetLogz(1); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/ndofvsntrks_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete ndofvsntrks; - gPad->SetLogz(0); + if (ndofvsntrks) { + ndofvsntrks->Draw("colz"); + gPad->SetLogz(1); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/ndofvsntrks_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete ndofvsntrks; + gPad->SetLogz(0); } std::cout << "ready4" << std::endl; TH1F* trkweights = (TH1F*)castat.getObject("weights"); - if(trkweights) { - trkweights->Draw(); - gPad->SetLogy(1); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/trkweights_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete trkweights; - gPad->SetLogy(0); + if (trkweights) { + trkweights->Draw(); + gPad->SetLogy(1); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/trkweights_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete trkweights; + gPad->SetLogy(0); } { - TH1F* vtxx = (TH1F*)castat.getObject("vtxx"); + TH1F* vtxx = (TH1F*)castat.getObject("vtxx"); if (vtxx) { vtxx->Draw(); gPad->SetLogy(1); - + std::string plotfilename; plotfilename += outtrunk; plotfilename += dirname; @@ -298,12 +297,12 @@ void PrimaryVertexPlots(const char* fullname,const char* module, const char* pos delete vtxx; gPad->SetLogy(0); } - - TH1F* vtxy = (TH1F*)castat.getObject("vtxy"); + + TH1F* vtxy = (TH1F*)castat.getObject("vtxy"); if (vtxy) { vtxy->Draw(); gPad->SetLogy(1); - + std::string plotfilename; plotfilename += outtrunk; plotfilename += dirname; @@ -318,12 +317,12 @@ void PrimaryVertexPlots(const char* fullname,const char* module, const char* pos delete vtxy; gPad->SetLogy(0); } - - TH1F* vtxz = (TH1F*)castat.getObject("vtxz"); + + TH1F* vtxz = (TH1F*)castat.getObject("vtxz"); if (vtxz) { vtxz->Draw(); gPad->SetLogy(1); - + std::string plotfilename; plotfilename += outtrunk; plotfilename += dirname; @@ -341,7 +340,6 @@ void PrimaryVertexPlots(const char* fullname,const char* module, const char* pos } std::cout << "ready4" << std::endl; - // Summary histograms /* @@ -353,398 +351,436 @@ void PrimaryVertexPlots(const char* fullname,const char* module, const char* pos vtxzsum->SetCanExtend(TH1::kAllAxes); */ - TH1D* vtxxmeansum = new TH1D("vtxxmeansum","PV mean X position vs run",10,0.,10.); + TH1D* vtxxmeansum = new TH1D("vtxxmeansum", "PV mean X position vs run", 10, 0., 10.); vtxxmeansum->SetCanExtend(TH1::kAllAxes); - TH1D* vtxymeansum = new TH1D("vtxymeansum","PV mean Y position vs run",10,0.,10.); + TH1D* vtxymeansum = new TH1D("vtxymeansum", "PV mean Y position vs run", 10, 0., 10.); vtxymeansum->SetCanExtend(TH1::kAllAxes); - TH1D* vtxzmeansum = new TH1D("vtxzmeansum","PV mean Z position vs run",10,0.,10.); + TH1D* vtxzmeansum = new TH1D("vtxzmeansum", "PV mean Z position vs run", 10, 0., 10.); vtxzmeansum->SetCanExtend(TH1::kAllAxes); - TH1D* vtxzsigmasum = new TH1D("vtxzsigmasum","PV sigma Z position vs run",10,0.,10.); + TH1D* vtxzsigmasum = new TH1D("vtxzsigmasum", "PV sigma Z position vs run", 10, 0., 10.); vtxzsigmasum->SetCanExtend(TH1::kAllAxes); std::vector runs = castat.getRunList(); - std::sort(runs.begin(),runs.end()); + std::sort(runs.begin(), runs.end()); { - std::cout << "Found " << runs.size() << " runs" << std::endl; - for(unsigned int i=0;iGetEntries()>0) { - vtxx->Draw(); - gPad->SetLogy(1); - - - int bin = vtxxmeansum->Fill(runlabel,vtxx->GetMean()); - vtxxmeansum->SetBinError(bin,vtxx->GetMeanError()); - - - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/pvtxx_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete vtxx; + + TH1F* vtxx = (TH1F*)castat.getObject("vtxxrun"); + if (vtxx && vtxx->GetEntries() > 0) { + vtxx->Draw(); + gPad->SetLogy(1); + + int bin = vtxxmeansum->Fill(runlabel, vtxx->GetMean()); + vtxxmeansum->SetBinError(bin, vtxx->GetMeanError()); + + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/pvtxx_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete vtxx; } gPad->SetLogy(0); - TH1F* vtxy = (TH1F*)castat.getObject("vtxyrun"); - if (vtxy && vtxy->GetEntries()>0) { - vtxy->Draw(); - gPad->SetLogy(1); - - int bin = vtxymeansum->Fill(runlabel,vtxy->GetMean()); - vtxymeansum->SetBinError(bin,vtxy->GetMeanError()); - - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/pvtxy_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete vtxy; + TH1F* vtxy = (TH1F*)castat.getObject("vtxyrun"); + if (vtxy && vtxy->GetEntries() > 0) { + vtxy->Draw(); + gPad->SetLogy(1); + + int bin = vtxymeansum->Fill(runlabel, vtxy->GetMean()); + vtxymeansum->SetBinError(bin, vtxy->GetMeanError()); + + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/pvtxy_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete vtxy; } gPad->SetLogy(0); - double vtxsigmazrunvalue = -1.; double vtxsigmazrunerror = -1.; - double vtxsigmazrunfitvalue = -1.; double vtxsigmazrunfiterror = -1.; - TH1F* vtxz = (TH1F*)castat.getObject("vtxzrun"); - if (vtxz && vtxz->GetEntries()>0) { - vtxz->Fit("gaus","","",-3.*vtxz->GetRMS(),3.*vtxz->GetRMS()); - // vtxz->Draw(); - if(vtxz->GetFunction("gaus")) { - vtxz->GetFunction("gaus")->SetLineColor(kRed); - vtxz->GetFunction("gaus")->SetLineWidth(1); - vtxsigmazrunfitvalue = vtxz->GetFunction("gaus")->GetParameter(2); - vtxsigmazrunfiterror = vtxz->GetFunction("gaus")->GetParError(2); - } - gPad->SetLogy(1); - - int bin = vtxzmeansum->Fill(runlabel,vtxz->GetMean()); - vtxzmeansum->SetBinError(bin,vtxz->GetMeanError()); - - bin = vtxzsigmasum->Fill(runlabel,vtxz->GetRMS()); - vtxzsigmasum->SetBinError(bin,vtxz->GetRMSError()); - - vtxsigmazrunvalue = vtxz->GetRMS(); - vtxsigmazrunerror = vtxz->GetRMSError(); - - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/pvtxz_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete vtxz; + double vtxsigmazrunvalue = -1.; + double vtxsigmazrunerror = -1.; + double vtxsigmazrunfitvalue = -1.; + double vtxsigmazrunfiterror = -1.; + TH1F* vtxz = (TH1F*)castat.getObject("vtxzrun"); + if (vtxz && vtxz->GetEntries() > 0) { + vtxz->Fit("gaus", "", "", -3. * vtxz->GetRMS(), 3. * vtxz->GetRMS()); + // vtxz->Draw(); + if (vtxz->GetFunction("gaus")) { + vtxz->GetFunction("gaus")->SetLineColor(kRed); + vtxz->GetFunction("gaus")->SetLineWidth(1); + vtxsigmazrunfitvalue = vtxz->GetFunction("gaus")->GetParameter(2); + vtxsigmazrunfiterror = vtxz->GetFunction("gaus")->GetParError(2); + } + gPad->SetLogy(1); + + int bin = vtxzmeansum->Fill(runlabel, vtxz->GetMean()); + vtxzmeansum->SetBinError(bin, vtxz->GetMeanError()); + + bin = vtxzsigmasum->Fill(runlabel, vtxz->GetRMS()); + vtxzsigmasum->SetBinError(bin, vtxz->GetRMSError()); + + vtxsigmazrunvalue = vtxz->GetRMS(); + vtxsigmazrunerror = vtxz->GetRMSError(); + + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/pvtxz_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete vtxz; } gPad->SetLogy(0); - - TH1F* vtxxvsorb = (TH1F*)castat.getObject("vtxxvsorbrun"); - TH1F* bsxvsorb = (TH1F*)cabs.getObject("bsxvsorbrun"); - TH1F* onlbsxvsorb = (TH1F*)cabsonl.getObject("bsxvsorbrun"); - TH1F* testbsxvsorb = (TH1F*)cabstest.getObject("bsxvsorbrun"); - if (vtxxvsorb && vtxxvsorb->GetEntries()>0) { - // vtxxvsorb->GetYaxis()->SetRangeUser(0.0650,0.07); - vtxxvsorb->Draw(); - if(bsxvsorb) { - bsxvsorb->SetMarkerColor(kGreen); bsxvsorb->SetLineColor(kGreen); bsxvsorb->SetLineWidth(2); - bsxvsorb->Draw("esame"); - } - if(onlbsxvsorb) { - onlbsxvsorb->SetMarkerColor(kRed); onlbsxvsorb->SetLineColor(kRed); - onlbsxvsorb->Draw("esame"); - } - if(testbsxvsorb) { - testbsxvsorb->SetMarkerColor(kBlue); testbsxvsorb->SetLineColor(kBlue); - testbsxvsorb->Draw("esame"); - } - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/pvtxxvsorb_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete vtxxvsorb; delete bsxvsorb; delete onlbsxvsorb; delete testbsxvsorb; + TH1F* vtxxvsorb = (TH1F*)castat.getObject("vtxxvsorbrun"); + TH1F* bsxvsorb = (TH1F*)cabs.getObject("bsxvsorbrun"); + TH1F* onlbsxvsorb = (TH1F*)cabsonl.getObject("bsxvsorbrun"); + TH1F* testbsxvsorb = (TH1F*)cabstest.getObject("bsxvsorbrun"); + if (vtxxvsorb && vtxxvsorb->GetEntries() > 0) { + // vtxxvsorb->GetYaxis()->SetRangeUser(0.0650,0.07); + vtxxvsorb->Draw(); + if (bsxvsorb) { + bsxvsorb->SetMarkerColor(kGreen); + bsxvsorb->SetLineColor(kGreen); + bsxvsorb->SetLineWidth(2); + bsxvsorb->Draw("esame"); + } + if (onlbsxvsorb) { + onlbsxvsorb->SetMarkerColor(kRed); + onlbsxvsorb->SetLineColor(kRed); + onlbsxvsorb->Draw("esame"); + } + if (testbsxvsorb) { + testbsxvsorb->SetMarkerColor(kBlue); + testbsxvsorb->SetLineColor(kBlue); + testbsxvsorb->Draw("esame"); + } + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/pvtxxvsorb_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete vtxxvsorb; + delete bsxvsorb; + delete onlbsxvsorb; + delete testbsxvsorb; } - TH1F* vtxyvsorb = (TH1F*)castat.getObject("vtxyvsorbrun"); - TH1F* bsyvsorb = (TH1F*)cabs.getObject("bsyvsorbrun"); - TH1F* onlbsyvsorb = (TH1F*)cabsonl.getObject("bsyvsorbrun"); - TH1F* testbsyvsorb = (TH1F*)cabstest.getObject("bsyvsorbrun"); - if (vtxyvsorb && vtxyvsorb->GetEntries()>0) { - // vtxyvsorb->GetYaxis()->SetRangeUser(0.0620,0.0670); - vtxyvsorb->Draw(); - if(bsyvsorb) { - bsyvsorb->SetMarkerColor(kGreen); bsyvsorb->SetLineColor(kGreen); bsyvsorb->SetLineWidth(2); - bsyvsorb->Draw("esame"); - } - if(onlbsyvsorb) { - onlbsyvsorb->SetMarkerColor(kRed); onlbsyvsorb->SetLineColor(kRed); - onlbsyvsorb->Draw("esame"); - } - if(testbsyvsorb) { - testbsyvsorb->SetMarkerColor(kCyan); testbsyvsorb->SetLineColor(kCyan); - testbsyvsorb->Draw("esame"); - } - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/pvtxyvsorb_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete vtxyvsorb; delete bsyvsorb; delete onlbsyvsorb; delete testbsyvsorb; + TH1F* vtxyvsorb = (TH1F*)castat.getObject("vtxyvsorbrun"); + TH1F* bsyvsorb = (TH1F*)cabs.getObject("bsyvsorbrun"); + TH1F* onlbsyvsorb = (TH1F*)cabsonl.getObject("bsyvsorbrun"); + TH1F* testbsyvsorb = (TH1F*)cabstest.getObject("bsyvsorbrun"); + if (vtxyvsorb && vtxyvsorb->GetEntries() > 0) { + // vtxyvsorb->GetYaxis()->SetRangeUser(0.0620,0.0670); + vtxyvsorb->Draw(); + if (bsyvsorb) { + bsyvsorb->SetMarkerColor(kGreen); + bsyvsorb->SetLineColor(kGreen); + bsyvsorb->SetLineWidth(2); + bsyvsorb->Draw("esame"); + } + if (onlbsyvsorb) { + onlbsyvsorb->SetMarkerColor(kRed); + onlbsyvsorb->SetLineColor(kRed); + onlbsyvsorb->Draw("esame"); + } + if (testbsyvsorb) { + testbsyvsorb->SetMarkerColor(kCyan); + testbsyvsorb->SetLineColor(kCyan); + testbsyvsorb->Draw("esame"); + } + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/pvtxyvsorb_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete vtxyvsorb; + delete bsyvsorb; + delete onlbsyvsorb; + delete testbsyvsorb; } - TH1F* vtxzvsorb = (TH1F*)castat.getObject("vtxzvsorbrun"); - TH1F* bszvsorb = (TH1F*)cabs.getObject("bszvsorbrun"); - TH1F* onlbszvsorb = (TH1F*)cabsonl.getObject("bszvsorbrun"); - TH1F* testbszvsorb = (TH1F*)cabstest.getObject("bszvsorbrun"); - if (vtxzvsorb && vtxzvsorb->GetEntries()>0) { - vtxzvsorb->Draw(); - if(bszvsorb) { - bszvsorb->SetMarkerColor(kGreen); bszvsorb->SetLineColor(kGreen); bszvsorb->SetLineWidth(2); - bszvsorb->Draw("esame"); - } - if(onlbszvsorb) { - onlbszvsorb->SetMarkerColor(kRed); onlbszvsorb->SetLineColor(kRed); - onlbszvsorb->Draw("esame"); - } - if(testbszvsorb) { - testbszvsorb->SetMarkerColor(kCyan); testbszvsorb->SetLineColor(kCyan); - testbszvsorb->Draw("esame"); - } - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/pvtxzvsorb_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete vtxzvsorb; delete bszvsorb; delete onlbszvsorb; delete testbszvsorb; + TH1F* vtxzvsorb = (TH1F*)castat.getObject("vtxzvsorbrun"); + TH1F* bszvsorb = (TH1F*)cabs.getObject("bszvsorbrun"); + TH1F* onlbszvsorb = (TH1F*)cabsonl.getObject("bszvsorbrun"); + TH1F* testbszvsorb = (TH1F*)cabstest.getObject("bszvsorbrun"); + if (vtxzvsorb && vtxzvsorb->GetEntries() > 0) { + vtxzvsorb->Draw(); + if (bszvsorb) { + bszvsorb->SetMarkerColor(kGreen); + bszvsorb->SetLineColor(kGreen); + bszvsorb->SetLineWidth(2); + bszvsorb->Draw("esame"); + } + if (onlbszvsorb) { + onlbszvsorb->SetMarkerColor(kRed); + onlbszvsorb->SetLineColor(kRed); + onlbszvsorb->Draw("esame"); + } + if (testbszvsorb) { + testbszvsorb->SetMarkerColor(kCyan); + testbszvsorb->SetLineColor(kCyan); + testbszvsorb->Draw("esame"); + } + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/pvtxzvsorb_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete vtxzvsorb; + delete bszvsorb; + delete onlbszvsorb; + delete testbszvsorb; } - TProfile* bssigmazvsorb = (TProfile*)cabs.getObject("bssigmazvsorbrun"); - TProfile* onlbssigmazvsorb = (TProfile*)cabsonl.getObject("bssigmazvsorbrun"); - TProfile* testbssigmazvsorb = (TProfile*)cabstest.getObject("bssigmazvsorbrun"); - TGraphErrors gr;TGraphErrors grfit; - if ( bssigmazvsorb || onlbssigmazvsorb || testbssigmazvsorb) { - if(bssigmazvsorb) { - bssigmazvsorb->SetMarkerColor(kGreen); bssigmazvsorb->SetLineColor(kGreen); bssigmazvsorb->SetLineWidth(2); - bssigmazvsorb->Draw(); - bssigmazvsorb->GetYaxis()->SetRangeUser(0.,7.); - if(vtxsigmazrunvalue >= 0.) { - // look for last filled bin - int lastbin= bssigmazvsorb->GetNbinsX()+1; - int firstbin= 1; - for(int ibin=bssigmazvsorb->GetNbinsX()+1;ibin>0;--ibin) { - if(bssigmazvsorb->GetBinEntries(ibin)!=0) { - lastbin=ibin; - break; - } - } - for(int ibin=1;ibin<=bssigmazvsorb->GetNbinsX()+1;++ibin) { - if(bssigmazvsorb->GetBinEntries(ibin)!=0) { - firstbin=ibin; - break; - } - } - gr.SetMarkerStyle(20); - gr.SetPoint(1,(bssigmazvsorb->GetBinCenter(firstbin)+bssigmazvsorb->GetBinCenter(lastbin))/2.,vtxsigmazrunvalue); - gr.SetPointError(1,(bssigmazvsorb->GetBinCenter(lastbin)-bssigmazvsorb->GetBinCenter(firstbin))/2.,vtxsigmazrunerror); - gr.Draw("p"); - grfit.SetMarkerStyle(24);grfit.SetMarkerColor(kBlue);grfit.SetLineColor(kBlue); - grfit.SetPoint(1,(bssigmazvsorb->GetBinCenter(firstbin)+bssigmazvsorb->GetBinCenter(lastbin))/2.,vtxsigmazrunfitvalue); - grfit.SetPointError(1,(bssigmazvsorb->GetBinCenter(lastbin)-bssigmazvsorb->GetBinCenter(firstbin))/2.,vtxsigmazrunfiterror); - grfit.Draw("p"); - } - } - if(onlbssigmazvsorb) { - onlbssigmazvsorb->SetMarkerColor(kRed); onlbssigmazvsorb->SetLineColor(kRed); - onlbssigmazvsorb->Draw("esame"); - } - if(testbssigmazvsorb) { - testbssigmazvsorb->SetMarkerColor(kCyan); testbssigmazvsorb->SetLineColor(kCyan); - testbssigmazvsorb->Draw("esame"); - } - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/pvtxsigmazvsorb_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete bssigmazvsorb; delete onlbssigmazvsorb; delete testbssigmazvsorb; + TProfile* bssigmazvsorb = (TProfile*)cabs.getObject("bssigmazvsorbrun"); + TProfile* onlbssigmazvsorb = (TProfile*)cabsonl.getObject("bssigmazvsorbrun"); + TProfile* testbssigmazvsorb = (TProfile*)cabstest.getObject("bssigmazvsorbrun"); + TGraphErrors gr; + TGraphErrors grfit; + if (bssigmazvsorb || onlbssigmazvsorb || testbssigmazvsorb) { + if (bssigmazvsorb) { + bssigmazvsorb->SetMarkerColor(kGreen); + bssigmazvsorb->SetLineColor(kGreen); + bssigmazvsorb->SetLineWidth(2); + bssigmazvsorb->Draw(); + bssigmazvsorb->GetYaxis()->SetRangeUser(0., 7.); + if (vtxsigmazrunvalue >= 0.) { + // look for last filled bin + int lastbin = bssigmazvsorb->GetNbinsX() + 1; + int firstbin = 1; + for (int ibin = bssigmazvsorb->GetNbinsX() + 1; ibin > 0; --ibin) { + if (bssigmazvsorb->GetBinEntries(ibin) != 0) { + lastbin = ibin; + break; + } + } + for (int ibin = 1; ibin <= bssigmazvsorb->GetNbinsX() + 1; ++ibin) { + if (bssigmazvsorb->GetBinEntries(ibin) != 0) { + firstbin = ibin; + break; + } + } + gr.SetMarkerStyle(20); + gr.SetPoint(1, + (bssigmazvsorb->GetBinCenter(firstbin) + bssigmazvsorb->GetBinCenter(lastbin)) / 2., + vtxsigmazrunvalue); + gr.SetPointError(1, + (bssigmazvsorb->GetBinCenter(lastbin) - bssigmazvsorb->GetBinCenter(firstbin)) / 2., + vtxsigmazrunerror); + gr.Draw("p"); + grfit.SetMarkerStyle(24); + grfit.SetMarkerColor(kBlue); + grfit.SetLineColor(kBlue); + grfit.SetPoint(1, + (bssigmazvsorb->GetBinCenter(firstbin) + bssigmazvsorb->GetBinCenter(lastbin)) / 2., + vtxsigmazrunfitvalue); + grfit.SetPointError(1, + (bssigmazvsorb->GetBinCenter(lastbin) - bssigmazvsorb->GetBinCenter(firstbin)) / 2., + vtxsigmazrunfiterror); + grfit.Draw("p"); + } + } + if (onlbssigmazvsorb) { + onlbssigmazvsorb->SetMarkerColor(kRed); + onlbssigmazvsorb->SetLineColor(kRed); + onlbssigmazvsorb->Draw("esame"); + } + if (testbssigmazvsorb) { + testbssigmazvsorb->SetMarkerColor(kCyan); + testbssigmazvsorb->SetLineColor(kCyan); + testbssigmazvsorb->Draw("esame"); + } + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/pvtxsigmazvsorb_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete bssigmazvsorb; + delete onlbssigmazvsorb; + delete testbssigmazvsorb; } - - - - - TProfile* nvtxvsorb = (TProfile*)castat.getObject("nvtxvsorbrun"); - if(nvtxvsorb) { - nvtxvsorb->Draw(); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/nvtxvsorb_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete nvtxvsorb; + if (nvtxvsorb) { + nvtxvsorb->Draw(); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/nvtxvsorb_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete nvtxvsorb; } - + TProfile* nvtxvsbx = (TProfile*)castat.getObject("nvtxvsbxrun"); - if(nvtxvsbx) { - nvtxvsbx->SetLineColor(kRed); nvtxvsbx->SetMarkerColor(kRed); nvtxvsbx->SetMarkerStyle(20); nvtxvsbx->SetMarkerSize(.5); - nvtxvsbx->Draw(); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/nvtxvsbx_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - delete nvtxvsbx; + if (nvtxvsbx) { + nvtxvsbx->SetLineColor(kRed); + nvtxvsbx->SetMarkerColor(kRed); + nvtxvsbx->SetMarkerStyle(20); + nvtxvsbx->SetMarkerSize(.5); + nvtxvsbx->Draw(); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/nvtxvsbx_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + delete nvtxvsbx; } - + TH2D* nvtxvsbxvsorb = (TH2D*)castat.getObject("nvtxvsbxvsorbrun"); - if(nvtxvsbxvsorb) { - - nvtxvsbxvsorb->Draw("colz"); - std::string plotfilename; - plotfilename += outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/nvtxvsbxvsorb_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - - // slicing - std::string cname; - cname = "slice_run_"; - cname += runpath; - new TCanvas(cname.c_str(),cname.c_str()); - bool first=true; - int mcount=20; - int ccount=1; - for(unsigned int bx=0;bx<3564;++bx) { - char hname[300]; - sprintf(hname,"bx_%d",bx); - TH1D* slice = nvtxvsbxvsorb->ProjectionY(hname,bx+1,bx+1); - // std::cout << "slice " << bx << " with pointer " << slice << std::endl; - if(slice) { - if(slice->GetEntries()) { - std::cout << "slice " << bx << " ready " << std::endl; - slice->SetMarkerStyle(mcount); - slice->SetMarkerColor(ccount); - slice->SetLineColor(ccount); - slice->SetMarkerSize(.4); - if(first) {slice->SetMaximum(4.); slice->Draw("e");} - else {slice->Draw("same");} - first=false; - ++mcount; - if(mcount==28) {mcount=20; ++ccount;} - } - } - } - // std::string plotfilename; - plotfilename = outtrunk; - plotfilename += dirname; - plotfilename += "/"; - plotfilename += labfull; - plotfilename += "/nvtxvsorbsliced_"; - plotfilename += labfull; - plotfilename += "_"; - plotfilename += dirname; - plotfilename += "_"; - plotfilename += runpath; - plotfilename += ".gif"; - gPad->Print(plotfilename.c_str()); - - delete nvtxvsbxvsorb; + if (nvtxvsbxvsorb) { + nvtxvsbxvsorb->Draw("colz"); + std::string plotfilename; + plotfilename += outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/nvtxvsbxvsorb_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + + // slicing + std::string cname; + cname = "slice_run_"; + cname += runpath; + new TCanvas(cname.c_str(), cname.c_str()); + bool first = true; + int mcount = 20; + int ccount = 1; + for (unsigned int bx = 0; bx < 3564; ++bx) { + char hname[300]; + sprintf(hname, "bx_%d", bx); + TH1D* slice = nvtxvsbxvsorb->ProjectionY(hname, bx + 1, bx + 1); + // std::cout << "slice " << bx << " with pointer " << slice << std::endl; + if (slice) { + if (slice->GetEntries()) { + std::cout << "slice " << bx << " ready " << std::endl; + slice->SetMarkerStyle(mcount); + slice->SetMarkerColor(ccount); + slice->SetLineColor(ccount); + slice->SetMarkerSize(.4); + if (first) { + slice->SetMaximum(4.); + slice->Draw("e"); + } else { + slice->Draw("same"); + } + first = false; + ++mcount; + if (mcount == 28) { + mcount = 20; + ++ccount; + } + } + } + } + // std::string plotfilename; + plotfilename = outtrunk; + plotfilename += dirname; + plotfilename += "/"; + plotfilename += labfull; + plotfilename += "/nvtxvsorbsliced_"; + plotfilename += labfull; + plotfilename += "_"; + plotfilename += dirname; + plotfilename += "_"; + plotfilename += runpath; + plotfilename += ".gif"; + gPad->Print(plotfilename.c_str()); + + delete nvtxvsbxvsorb; } } - } - if(!runs.empty()) { + if (!runs.empty()) { std::string plotfilename; - + plotfilename = outtrunk; plotfilename += dirname; plotfilename += "/"; @@ -755,9 +791,9 @@ void PrimaryVertexPlots(const char* fullname,const char* module, const char* pos plotfilename += dirname; plotfilename += ".gif"; - TCanvas * cwidevtxx = new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500); + TCanvas* cwidevtxx = new TCanvas(plotfilename.c_str(), plotfilename.c_str(), 1500, 500); - vtxxmeansum->GetYaxis()->SetRangeUser(.05,.15); + vtxxmeansum->GetYaxis()->SetRangeUser(.05, .15); vtxxmeansum->GetYaxis()->SetTitle("x (cm)"); vtxxmeansum->Draw(); // vtxxmeansum->SetLineColor(kRed); vtxxmeansum->SetMarkerColor(kRed); @@ -775,9 +811,9 @@ void PrimaryVertexPlots(const char* fullname,const char* module, const char* pos plotfilename += dirname; plotfilename += ".gif"; - TCanvas * cwidevtxy = new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500); + TCanvas* cwidevtxy = new TCanvas(plotfilename.c_str(), plotfilename.c_str(), 1500, 500); - vtxymeansum->GetYaxis()->SetRangeUser(-0.05,.05); + vtxymeansum->GetYaxis()->SetRangeUser(-0.05, .05); vtxymeansum->GetYaxis()->SetTitle("y (cm)"); vtxymeansum->Draw(); // vtxymeansum->SetLineColor(kRed); vtxymeansum->SetMarkerColor(kRed); @@ -795,9 +831,9 @@ void PrimaryVertexPlots(const char* fullname,const char* module, const char* pos plotfilename += dirname; plotfilename += ".gif"; - TCanvas * cwidevtxz = new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500); + TCanvas* cwidevtxz = new TCanvas(plotfilename.c_str(), plotfilename.c_str(), 1500, 500); - vtxzmeansum->GetYaxis()->SetRangeUser(-2.,2.); + vtxzmeansum->GetYaxis()->SetRangeUser(-2., 2.); vtxzmeansum->GetYaxis()->SetTitle("z (cm)"); vtxzmeansum->Draw(); // vtxzmeansum->SetLineColor(kRed); vtxzmeansum->SetMarkerColor(kRed); @@ -815,20 +851,18 @@ void PrimaryVertexPlots(const char* fullname,const char* module, const char* pos plotfilename += dirname; plotfilename += ".gif"; - TCanvas * cwidevtxsigmaz = new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500); + TCanvas* cwidevtxsigmaz = new TCanvas(plotfilename.c_str(), plotfilename.c_str(), 1500, 500); - vtxzsigmasum->GetYaxis()->SetRangeUser(0.,15.); + vtxzsigmasum->GetYaxis()->SetRangeUser(0., 15.); vtxzsigmasum->GetYaxis()->SetTitle("z (cm)"); vtxzsigmasum->Draw(); // vtxzsigmasum->SetLineColor(kRed); vtxzsigmasum->SetMarkerColor(kRed); // vtxzsigmasum->Draw("esame"); gPad->Print(plotfilename.c_str()); delete cwidevtxsigmaz; - } delete vtxxmeansum; delete vtxymeansum; delete vtxzmeansum; delete vtxzsigmasum; } - diff --git a/Validation/RecoVertex/bin/PrimaryVertexPlots.h b/Validation/RecoVertex/bin/PrimaryVertexPlots.h index 881935fe78e59..6bc1669b161f1 100644 --- a/Validation/RecoVertex/bin/PrimaryVertexPlots.h +++ b/Validation/RecoVertex/bin/PrimaryVertexPlots.h @@ -1,6 +1,11 @@ #ifndef Validation_RecoVertex_PrimaryVertexPlots_h #define Validation_RecoVertex_PrimaryVertexPlots_h -void PrimaryVertexPlots(const char* fullname,const char* module, const char* postfix, const char* label, const char* shortname, const char* outtrunk); +void PrimaryVertexPlots(const char* fullname, + const char* module, + const char* postfix, + const char* label, + const char* shortname, + const char* outtrunk); -#endif // Validation_RecoVertex_PrimaryVertexPlots_h +#endif // Validation_RecoVertex_PrimaryVertexPlots_h diff --git a/Validation/RecoVertex/bin/classes.h b/Validation/RecoVertex/bin/classes.h index 3ac02130e9bf2..127a4ace40488 100644 --- a/Validation/RecoVertex/bin/classes.h +++ b/Validation/RecoVertex/bin/classes.h @@ -3,6 +3,5 @@ #include "Validation/RecoVertex/bin/multibsvspvplots.h" namespace Validation_RecoVertex_bin { - struct dictionary { - }; -} + struct dictionary {}; +} // namespace Validation_RecoVertex_bin diff --git a/Validation/RecoVertex/bin/multibsvspvplots.cc b/Validation/RecoVertex/bin/multibsvspvplots.cc index 8c77b06f0cb1f..163206e795c7a 100644 --- a/Validation/RecoVertex/bin/multibsvspvplots.cc +++ b/Validation/RecoVertex/bin/multibsvspvplots.cc @@ -20,7 +20,6 @@ #include "TLegend.h" void multibsvspvplots(const char* module, const char* label, const char* postfix, const char* /* family="" */) { - TFile* file[5]; file[0] = new TFile("rootfiles/Tracking_PFG_Run2012A_prompt_minbias_v1_190456-194076_muon_relumi_v55_fittedV0.root"); @@ -30,101 +29,91 @@ void multibsvspvplots(const char* module, const char* label, const char* postfix file[4] = new TFile("rootfiles/Tracking_PFG_Run2012D_prompt_minbias_v1_190456-208686_muon_relumi_v57_fittedV0.root"); char modfull[300]; - sprintf(modfull,"%s%s",module,postfix); + sprintf(modfull, "%s%s", module, postfix); char labfull[300]; - sprintf(labfull,"%s%s",label,postfix); + sprintf(labfull, "%s%s", label, postfix); // Summary histograms - TH1D* deltaxsum = new TH1D("deltaxsum","(PV-BS) Fitted X position vs run",10,0.,10.); + TH1D* deltaxsum = new TH1D("deltaxsum", "(PV-BS) Fitted X position vs run", 10, 0., 10.); deltaxsum->SetCanExtend(TH1::kAllAxes); - TH1D* deltaysum = new TH1D("deltaysum","(PV-BS) Fitted Y position vs run",10,0.,10.); + TH1D* deltaysum = new TH1D("deltaysum", "(PV-BS) Fitted Y position vs run", 10, 0., 10.); deltaysum->SetCanExtend(TH1::kAllAxes); - TH1D* deltaxmeansum = new TH1D("deltaxmeansum","(PV-BS) Mean X position vs run",10,0.,10.); + TH1D* deltaxmeansum = new TH1D("deltaxmeansum", "(PV-BS) Mean X position vs run", 10, 0., 10.); deltaxmeansum->SetCanExtend(TH1::kAllAxes); - TH1D* deltaymeansum = new TH1D("deltaymeansum","(PV-BS) Mean Y position vs run",10,0.,10.); + TH1D* deltaymeansum = new TH1D("deltaymeansum", "(PV-BS) Mean Y position vs run", 10, 0., 10.); deltaymeansum->SetCanExtend(TH1::kAllAxes); - TH1D* deltazmeansum = new TH1D("deltazmeansum","(PV-BS) Mean Z position vs run",10,0.,10.); + TH1D* deltazmeansum = new TH1D("deltazmeansum", "(PV-BS) Mean Z position vs run", 10, 0., 10.); deltazmeansum->SetCanExtend(TH1::kAllAxes); - TF1* fdoubleg = new TF1("doubleg","[1]*exp(-0.5*((x-[0])/[2])**2)+[3]*exp(-0.5*((x-[0])/[4])**2)+[5]*exp(sqrt((x-[0])**2)*[6])",-.2,.2); + TF1* fdoubleg = new TF1("doubleg", + "[1]*exp(-0.5*((x-[0])/[2])**2)+[3]*exp(-0.5*((x-[0])/[4])**2)+[5]*exp(sqrt((x-[0])**2)*[6])", + -.2, + .2); fdoubleg->SetLineColor(kRed); fdoubleg->SetLineWidth(1); - for(unsigned int ifile=0;ifile<5;++ifile) { - - CommonAnalyzer castat(file[ifile],"",modfull); - + for (unsigned int ifile = 0; ifile < 5; ++ifile) { + CommonAnalyzer castat(file[ifile], "", modfull); + std::vector runs = castat.getRunList(); - std::sort(runs.begin(),runs.end()); - + std::sort(runs.begin(), runs.end()); + { - std::cout << "Found " << runs.size() << " runs" << std::endl; - - for(unsigned int i=0;iGetEntries()>0) { - - fdoubleg->SetParameter(0,deltax->GetMean()); - fdoubleg->SetParameter(2,deltax->GetRMS()); - fdoubleg->SetParameter(4,deltax->GetRMS()); - fdoubleg->SetParameter(1,deltax->GetMaximum()); - fdoubleg->SetParameter(3,0.1*deltax->GetMaximum()); - fdoubleg->SetParameter(5,0.1*deltax->GetMaximum()); - /* const int result = */ deltax->Fit(fdoubleg,"q0b","",-.05,.05); - - int bin = deltaxsum->Fill(runlabel,fdoubleg->GetParameter(0)); - deltaxsum->SetBinError(bin,fdoubleg->GetParError(0)); - - bin = deltaxmeansum->Fill(runlabel,deltax->GetMean()); - deltaxmeansum->SetBinError(bin,deltax->GetMeanError()); - - } - TH1F* deltay = (TH1F*)castat.getObject("deltayrun"); - if (deltay && deltay->GetEntries()>0) { - - fdoubleg->SetParameter(0,deltay->GetMean()); - fdoubleg->SetParameter(2,deltay->GetRMS()); - fdoubleg->SetParameter(4,deltay->GetRMS()); - fdoubleg->SetParameter(1,deltay->GetMaximum()); - fdoubleg->SetParameter(3,0.1*deltay->GetMaximum()); - fdoubleg->SetParameter(5,0.1*deltay->GetMaximum()); - /* const int result = */ deltay->Fit(fdoubleg,"q0b","",-.05,.05); - int bin = deltaysum->Fill(runlabel,fdoubleg->GetParameter(0)); - deltaysum->SetBinError(bin,fdoubleg->GetParError(0)); - - bin = deltaymeansum->Fill(runlabel,deltay->GetMean()); - deltaymeansum->SetBinError(bin,deltay->GetMeanError()); - - } - TH1F* deltaz = (TH1F*)castat.getObject("deltazrun"); - if (deltaz && deltaz->GetEntries()>0) { - - int bin = deltazmeansum->Fill(runlabel,deltaz->GetMean()); - deltazmeansum->SetBinError(bin,deltaz->GetMeanError()); - - } - - - + + for (unsigned int i = 0; i < runs.size(); ++i) { + char runlabel[100]; + sprintf(runlabel, "%d", runs[i]); + char runpath[100]; + sprintf(runpath, "run_%d", runs[i]); + castat.setPath(runpath); + std::cout << runpath << std::endl; + + TH1F* deltax = (TH1F*)castat.getObject("deltaxrun"); + if (deltax && deltax->GetEntries() > 0) { + fdoubleg->SetParameter(0, deltax->GetMean()); + fdoubleg->SetParameter(2, deltax->GetRMS()); + fdoubleg->SetParameter(4, deltax->GetRMS()); + fdoubleg->SetParameter(1, deltax->GetMaximum()); + fdoubleg->SetParameter(3, 0.1 * deltax->GetMaximum()); + fdoubleg->SetParameter(5, 0.1 * deltax->GetMaximum()); + /* const int result = */ deltax->Fit(fdoubleg, "q0b", "", -.05, .05); + + int bin = deltaxsum->Fill(runlabel, fdoubleg->GetParameter(0)); + deltaxsum->SetBinError(bin, fdoubleg->GetParError(0)); + + bin = deltaxmeansum->Fill(runlabel, deltax->GetMean()); + deltaxmeansum->SetBinError(bin, deltax->GetMeanError()); + } + TH1F* deltay = (TH1F*)castat.getObject("deltayrun"); + if (deltay && deltay->GetEntries() > 0) { + fdoubleg->SetParameter(0, deltay->GetMean()); + fdoubleg->SetParameter(2, deltay->GetRMS()); + fdoubleg->SetParameter(4, deltay->GetRMS()); + fdoubleg->SetParameter(1, deltay->GetMaximum()); + fdoubleg->SetParameter(3, 0.1 * deltay->GetMaximum()); + fdoubleg->SetParameter(5, 0.1 * deltay->GetMaximum()); + /* const int result = */ deltay->Fit(fdoubleg, "q0b", "", -.05, .05); + int bin = deltaysum->Fill(runlabel, fdoubleg->GetParameter(0)); + deltaysum->SetBinError(bin, fdoubleg->GetParError(0)); + + bin = deltaymeansum->Fill(runlabel, deltay->GetMean()); + deltaymeansum->SetBinError(bin, deltay->GetMeanError()); + } + TH1F* deltaz = (TH1F*)castat.getObject("deltazrun"); + if (deltaz && deltaz->GetEntries() > 0) { + int bin = deltazmeansum->Fill(runlabel, deltaz->GetMean()); + deltazmeansum->SetBinError(bin, deltaz->GetMeanError()); + } } - } - } - + } + std::string plotfilename; - + plotfilename = "/afs/cern.ch/cms/tracking/output/"; // plotfilename += dirname; // plotfilename += "/"; @@ -134,21 +123,22 @@ void multibsvspvplots(const char* module, const char* label, const char* postfix // plotfilename += "_"; // plotfilename += dirname; plotfilename += ".gif"; - - /* TCanvas * cwidedeltax = */ new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500); - - deltaxsum->SetLineColor(kRed); deltaxsum->SetMarkerColor(kRed); - deltaxsum->GetYaxis()->SetRangeUser(-.002,.002); + + /* TCanvas * cwidedeltax = */ new TCanvas(plotfilename.c_str(), plotfilename.c_str(), 1500, 500); + + deltaxsum->SetLineColor(kRed); + deltaxsum->SetMarkerColor(kRed); + deltaxsum->GetYaxis()->SetRangeUser(-.002, .002); deltaxsum->GetYaxis()->SetTitle("#Delta x (cm)"); deltaxsum->Draw(); deltaxmeansum->Draw("esame"); - TLegend deltaxleg(.7,.8,.85,.9,"#Delta(x)"); - deltaxleg.AddEntry(deltaxsum,"fitted mean","l"); - deltaxleg.AddEntry(deltaxmeansum,"aritm. mean","l"); + TLegend deltaxleg(.7, .8, .85, .9, "#Delta(x)"); + deltaxleg.AddEntry(deltaxsum, "fitted mean", "l"); + deltaxleg.AddEntry(deltaxmeansum, "aritm. mean", "l"); deltaxleg.Draw(); gPad->Print(plotfilename.c_str()); // delete cwidedeltax; - + plotfilename = "/afs/cern.ch/cms/tracking/output/"; // plotfilename += dirname; // plotfilename += "/"; @@ -158,22 +148,22 @@ void multibsvspvplots(const char* module, const char* label, const char* postfix // plotfilename += "_"; // plotfilename += dirname; plotfilename += ".gif"; - - /* TCanvas * cwidedeltay = */ new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500); - - deltaysum->SetLineColor(kRed); deltaysum->SetMarkerColor(kRed); - deltaysum->GetYaxis()->SetRangeUser(-.002,.002); + + /* TCanvas * cwidedeltay = */ new TCanvas(plotfilename.c_str(), plotfilename.c_str(), 1500, 500); + + deltaysum->SetLineColor(kRed); + deltaysum->SetMarkerColor(kRed); + deltaysum->GetYaxis()->SetRangeUser(-.002, .002); deltaysum->GetYaxis()->SetTitle("#Delta y (cm)"); deltaysum->Draw(); deltaymeansum->Draw("esame"); - TLegend deltayleg(.7,.8,.85,.9,"#Delta(y)"); - deltayleg.AddEntry(deltaysum,"fitted mean","l"); - deltayleg.AddEntry(deltaymeansum,"aritm. mean","l"); + TLegend deltayleg(.7, .8, .85, .9, "#Delta(y)"); + deltayleg.AddEntry(deltaysum, "fitted mean", "l"); + deltayleg.AddEntry(deltaymeansum, "aritm. mean", "l"); deltayleg.Draw(); gPad->Print(plotfilename.c_str()); // delete cwidedeltay; - - + plotfilename = "/afs/cern.ch/cms/tracking/output/"; // plotfilename += dirname; // plotfilename += "/"; @@ -183,10 +173,10 @@ void multibsvspvplots(const char* module, const char* label, const char* postfix // plotfilename += "_"; // plotfilename += dirname; plotfilename += ".gif"; - - /* TCanvas * cwidedeltaz = */ new TCanvas(plotfilename.c_str(),plotfilename.c_str(),1500,500); - - deltazmeansum->GetYaxis()->SetRangeUser(-2.,2.); + + /* TCanvas * cwidedeltaz = */ new TCanvas(plotfilename.c_str(), plotfilename.c_str(), 1500, 500); + + deltazmeansum->GetYaxis()->SetRangeUser(-2., 2.); deltazmeansum->GetYaxis()->SetTitle("#Delta z (cm)"); deltazmeansum->Draw(); gPad->Print(plotfilename.c_str()); @@ -199,5 +189,4 @@ void multibsvspvplots(const char* module, const char* label, const char* postfix delete deltazmeansum; */ delete fdoubleg; - } diff --git a/Validation/RecoVertex/bin/multibsvspvplots.h b/Validation/RecoVertex/bin/multibsvspvplots.h index f6ff0e4569108..ef64caf437bd4 100644 --- a/Validation/RecoVertex/bin/multibsvspvplots.h +++ b/Validation/RecoVertex/bin/multibsvspvplots.h @@ -3,4 +3,4 @@ void multibsvspvplots(const char* module, const char* label, const char* postfix, const char* /* family="" */); -#endif // Validation_RecoVertex_multibsvspvplots_h +#endif // Validation_RecoVertex_multibsvspvplots_h diff --git a/Validation/RecoVertex/interface/BSvsPVHistogramMaker.h b/Validation/RecoVertex/interface/BSvsPVHistogramMaker.h index 7db39e9da0bc3..ddca8c2eb6195 100644 --- a/Validation/RecoVertex/interface/BSvsPVHistogramMaker.h +++ b/Validation/RecoVertex/interface/BSvsPVHistogramMaker.h @@ -10,27 +10,25 @@ namespace edm { class ParameterSet; class Event; -} +} // namespace edm namespace reco { class BeamSpot; } - class TH1F; class TH2F; class TProfile; class TFileDirectory; class BSvsPVHistogramMaker { - - public: +public: BSvsPVHistogramMaker(edm::ConsumesCollector&& iC); BSvsPVHistogramMaker(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC); ~BSvsPVHistogramMaker(); - void book(const std::string dirname=""); + void book(const std::string dirname = ""); void beginRun(const unsigned int nrun); void fill(const unsigned int orbit, const int bx, const reco::VertexCollection& vertices, const reco::BeamSpot& bs); void fill(const edm::Event& iEvent, const reco::VertexCollection& vertices, const reco::BeamSpot& bs); @@ -38,8 +36,7 @@ class BSvsPVHistogramMaker { double x(const reco::BeamSpot& bs, const double z) const; double y(const reco::BeamSpot& bs, const double z) const; - private: - +private: TFileDirectory* _currdir; const unsigned int m_maxLS; const bool useSlope_; @@ -72,8 +69,6 @@ class BSvsPVHistogramMaker { TH2F** _hdeltaxvsbx2drun; TH2F** _hdeltayvsbx2drun; TH2F** _hdeltazvsbx2drun; - }; - -#endif // Validation_RecoVertex_BSvsPVHistogramMaker_H +#endif // Validation_RecoVertex_BSvsPVHistogramMaker_H diff --git a/Validation/RecoVertex/interface/BeamSpotHistogramMaker.h b/Validation/RecoVertex/interface/BeamSpotHistogramMaker.h index 6191503143572..c7128de8dd32e 100644 --- a/Validation/RecoVertex/interface/BeamSpotHistogramMaker.h +++ b/Validation/RecoVertex/interface/BeamSpotHistogramMaker.h @@ -19,19 +19,17 @@ class TProfile; class TFileDirectory; class BeamSpotHistogramMaker { - - public: +public: BeamSpotHistogramMaker(edm::ConsumesCollector&& iC); BeamSpotHistogramMaker(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC); ~BeamSpotHistogramMaker(); - void book(const std::string dirname=""); + void book(const std::string dirname = ""); void beginRun(const unsigned int nrun); void fill(const unsigned int orbit, const reco::BeamSpot& bs); - private: - +private: TFileDirectory* _currdir; const edm::ParameterSet _histoParameters; @@ -48,9 +46,6 @@ class BeamSpotHistogramMaker { TProfile** _hbssigmaxvsorbrun; TProfile** _hbssigmayvsorbrun; TProfile** _hbssigmazvsorbrun; - - }; - -#endif // Validation_RecoVertex_BeamSpotHistogramMaker_H +#endif // Validation_RecoVertex_BeamSpotHistogramMaker_H diff --git a/Validation/RecoVertex/interface/PrimaryVertexAnalyzer4PUSlimmed.h b/Validation/RecoVertex/interface/PrimaryVertexAnalyzer4PUSlimmed.h index 84055211ede65..fef9ba1e3e2de 100644 --- a/Validation/RecoVertex/interface/PrimaryVertexAnalyzer4PUSlimmed.h +++ b/Validation/RecoVertex/interface/PrimaryVertexAnalyzer4PUSlimmed.h @@ -17,7 +17,6 @@ // Original Author: Marco Rovere (code adapted from old code by // Wolfram Erdmann) - // system include files #include #include @@ -63,26 +62,25 @@ class MonitorElement; class PrimaryVertexAnalyzer4PUSlimmed : public DQMEDAnalyzer { typedef math::XYZTLorentzVector LorentzVector; - enum SignalVertexKind { - HIGHEST_PT = 0, - IS_ASSOC2FIRST_RECO = 1, - IS_ASSOC2ANY_RECO = 2 - }; + enum SignalVertexKind { HIGHEST_PT = 0, IS_ASSOC2FIRST_RECO = 1, IS_ASSOC2ANY_RECO = 2 }; // auxiliary class holding simulated vertices struct simPrimaryVertex { simPrimaryVertex(double x1, double y1, double z1) - :x(x1), y(y1), z(z1), - ptsq(0), closest_vertex_distance_z(-1.), - nGenTrk(0), - num_matched_reco_tracks(0), - average_match_quality(0.0) { + : x(x1), + y(y1), + z(z1), + ptsq(0), + closest_vertex_distance_z(-1.), + nGenTrk(0), + num_matched_reco_tracks(0), + average_match_quality(0.0) { ptot.setPx(0); ptot.setPy(0); ptot.setPz(0); ptot.setE(0); p4 = LorentzVector(0, 0, 0, 0); - r = sqrt(x*x + y*y); + r = sqrt(x * x + y * y); }; double x, y, z, r; HepMC::FourVector ptot; @@ -99,26 +97,26 @@ class PrimaryVertexAnalyzer4PUSlimmed : public DQMEDAnalyzer { // auxiliary class holding reconstructed vertices struct recoPrimaryVertex { - enum VertexProperties { - NONE = 0, - MATCHED = 1, - DUPLICATE = 2, - MERGED = 4 - }; + enum VertexProperties { NONE = 0, MATCHED = 1, DUPLICATE = 2, MERGED = 4 }; recoPrimaryVertex(double x1, double y1, double z1) - :x(x1), y(y1), z(z1), - pt(0), ptsq(0), closest_vertex_distance_z(-1.), purity(-1.), - nRecoTrk(0), - num_matched_sim_tracks(0), - kind_of_vertex(0), - recVtx(nullptr) { - r = sqrt(x*x + y*y); + : x(x1), + y(y1), + z(z1), + pt(0), + ptsq(0), + closest_vertex_distance_z(-1.), + purity(-1.), + nRecoTrk(0), + num_matched_sim_tracks(0), + kind_of_vertex(0), + recVtx(nullptr) { + r = sqrt(x * x + y * y); }; double x, y, z, r; double pt; double ptsq; double closest_vertex_distance_z; - double purity; // calculated and assigned in calculatePurityAndFillHistograms + double purity; // calculated and assigned in calculatePurityAndFillHistograms int nRecoTrk; int num_matched_sim_tracks; int kind_of_vertex; @@ -129,50 +127,39 @@ class PrimaryVertexAnalyzer4PUSlimmed : public DQMEDAnalyzer { reco::VertexBaseRef recVtxRef; }; - public: - explicit PrimaryVertexAnalyzer4PUSlimmed(const edm::ParameterSet&); +public: + explicit PrimaryVertexAnalyzer4PUSlimmed(const edm::ParameterSet &); ~PrimaryVertexAnalyzer4PUSlimmed() override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - void bookHistograms(DQMStore::IBooker &i, - edm::Run const&, - edm::EventSetup const&) override; - - private: - void resetSimPVAssociation(std::vector&); - void matchSim2RecoVertices(std::vector&, - const reco::VertexSimToRecoCollection&); - void matchReco2SimVertices(std::vector&, - const reco::VertexRecoToSimCollection&, - const std::vector&); - bool matchRecoTrack2SimSignal(const reco::TrackBaseRef&); + void analyze(const edm::Event &, const edm::EventSetup &) override; + void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override; + +private: + void resetSimPVAssociation(std::vector &); + void matchSim2RecoVertices(std::vector &, const reco::VertexSimToRecoCollection &); + void matchReco2SimVertices(std::vector &, + const reco::VertexRecoToSimCollection &, + const std::vector &); + bool matchRecoTrack2SimSignal(const reco::TrackBaseRef &); void fillGenericGenVertexHistograms(const simPrimaryVertex &v); // void fillGenericRecoVertexHistograms(const std::string &, // const simPrimaryVertex &v); - void fillRecoAssociatedGenVertexHistograms(const std::string &, - const simPrimaryVertex &v); - void fillRecoAssociatedGenPVHistograms(const std::string& label, - const PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex& v, + void fillRecoAssociatedGenVertexHistograms(const std::string &, const simPrimaryVertex &v); + void fillRecoAssociatedGenPVHistograms(const std::string &label, + const PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex &v, bool genPVMatchedToRecoPV); - void fillGenAssociatedRecoVertexHistograms(const std::string &, - int, - recoPrimaryVertex &v); - void fillResolutionAndPullHistograms(const std::string &, - int, - recoPrimaryVertex &v, - bool); - - void calculatePurityAndFillHistograms(const std::string&, - std::vector&, - int, bool); + void fillGenAssociatedRecoVertexHistograms(const std::string &, int, recoPrimaryVertex &v); + void fillResolutionAndPullHistograms(const std::string &, int, recoPrimaryVertex &v, bool); + + void calculatePurityAndFillHistograms(const std::string &, std::vector &, int, bool); std::vector getSimPVs( - const edm::Handle&); + const edm::Handle &); std::vector getRecoPVs( - const edm::Handle>&); + const edm::Handle> &); - template + template void computePairDistance(const T &collection, MonitorElement *me); // ----------member data --------------------------- @@ -181,13 +168,13 @@ class PrimaryVertexAnalyzer4PUSlimmed : public DQMEDAnalyzer { const bool do_generic_sim_plots_; std::string root_folder_; - std::map > mes_; + std::map> mes_; const reco::RecoToSimCollection *r2s_; const reco::SimToRecoCollection *s2r_; - edm::EDGetTokenT< std::vector > vecPileupSummaryInfoToken_; - std::vector > > reco_vertex_collection_tokens_; - std::vector reco_vertex_collections_; + edm::EDGetTokenT> vecPileupSummaryInfoToken_; + std::vector>> reco_vertex_collection_tokens_; + std::vector reco_vertex_collections_; edm::EDGetTokenT trackingParticleCollectionToken_; edm::EDGetTokenT trackingVertexCollectionToken_; edm::EDGetTokenT simToRecoAssociationToken_; diff --git a/Validation/RecoVertex/interface/TrackParameterAnalyzer.h b/Validation/RecoVertex/interface/TrackParameterAnalyzer.h index cf3e99dbad8c3..18947f804db36 100644 --- a/Validation/RecoVertex/interface/TrackParameterAnalyzer.h +++ b/Validation/RecoVertex/interface/TrackParameterAnalyzer.h @@ -2,7 +2,7 @@ // // Package: TrackParameterAnalyzer // Class: TrackParameterAnalyzer -// +// /**\class TrackParameterAnalyzer TrackParameterAnalyzer.cc Validation/RecoVertex/src/TrackParameterAnalyzer.cc Description: @@ -16,7 +16,6 @@ // // - // system include files #include @@ -45,40 +44,40 @@ class TH2; typedef reco::TrackBase::ParameterVector ParameterVector; class TrackParameterAnalyzer : public edm::EDAnalyzer { - public: - explicit TrackParameterAnalyzer(const edm::ParameterSet&); - ~TrackParameterAnalyzer() override; +public: + explicit TrackParameterAnalyzer(const edm::ParameterSet&); + ~TrackParameterAnalyzer() override; - void analyze(const edm::Event&, const edm::EventSetup&) override; - void beginJob() override; - void endJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void beginJob() override; + void endJob() override; - private: - bool match(const ParameterVector &a, const ParameterVector &b); - // ----------member data --------------------------- - edm::EDGetTokenT edmSimVertexContainerToken_; - edm::EDGetTokenT edmSimTrackContainerToken_; - edm::EDGetTokenT recoTrackCollectionToken_; - // root file to store histograms - std::string outputFile_; // output file - TFile* rootFile_; - TH1* h1_pull0_; - TH1* h1_pull1_; - TH1* h1_pull2_; - TH1* h1_pull3_; - TH1* h1_pull4_; - TH1* h1_res0_; - TH1* h1_res1_; - TH1* h1_res2_; - TH1* h1_res3_; - TH1* h1_res4_; - TH1* h1_Beff_; - TH2* h2_dvsphi_; - TH1* h1_par0_; - TH1* h1_par1_; - TH1* h1_par2_; - TH1* h1_par3_; - TH1* h1_par4_; - double simUnit_; - bool verbose_; +private: + bool match(const ParameterVector& a, const ParameterVector& b); + // ----------member data --------------------------- + edm::EDGetTokenT edmSimVertexContainerToken_; + edm::EDGetTokenT edmSimTrackContainerToken_; + edm::EDGetTokenT recoTrackCollectionToken_; + // root file to store histograms + std::string outputFile_; // output file + TFile* rootFile_; + TH1* h1_pull0_; + TH1* h1_pull1_; + TH1* h1_pull2_; + TH1* h1_pull3_; + TH1* h1_pull4_; + TH1* h1_res0_; + TH1* h1_res1_; + TH1* h1_res2_; + TH1* h1_res3_; + TH1* h1_res4_; + TH1* h1_Beff_; + TH2* h2_dvsphi_; + TH1* h1_par0_; + TH1* h1_par1_; + TH1* h1_par2_; + TH1* h1_par3_; + TH1* h1_par4_; + double simUnit_; + bool verbose_; }; diff --git a/Validation/RecoVertex/interface/V0Validator.h b/Validation/RecoVertex/interface/V0Validator.h index c5c2cbbb49b0d..d171ffd811ae1 100644 --- a/Validation/RecoVertex/interface/V0Validator.h +++ b/Validation/RecoVertex/interface/V0Validator.h @@ -78,45 +78,38 @@ #include "TH2F.h" class V0Validator : public DQMEDAnalyzer { - public: +public: explicit V0Validator(const edm::ParameterSet &); ~V0Validator() override; enum V0Type { KSHORT, LAMBDA }; struct V0Couple { reco::TrackRef one; reco::TrackRef two; - explicit V0Couple(reco::TrackRef first_daughter, - reco::TrackRef second_daughter) { - one = first_daughter.key() < second_daughter.key() ? first_daughter - : second_daughter; - two = first_daughter.key() > second_daughter.key() ? first_daughter - : second_daughter; + explicit V0Couple(reco::TrackRef first_daughter, reco::TrackRef second_daughter) { + one = first_daughter.key() < second_daughter.key() ? first_daughter : second_daughter; + two = first_daughter.key() > second_daughter.key() ? first_daughter : second_daughter; assert(one != two); } - bool operator<(const V0Couple &rh) const { - return one.key() < rh.one.key(); - } - bool operator==(const V0Couple &rh) const { - return ((one.key() == rh.one.key()) && (two.key() == rh.two.key())); - } + bool operator<(const V0Couple &rh) const { return one.key() < rh.one.key(); } + bool operator==(const V0Couple &rh) const { return ((one.key() == rh.one.key()) && (two.key() == rh.two.key())); } }; - private: +private: void analyze(const edm::Event &, const edm::EventSetup &) override; - void bookHistograms(DQMStore::IBooker &, edm::Run const &, - edm::EventSetup const &) override; + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; void doFakeRates(const reco::VertexCompositeCandidateCollection &collection, const reco::RecoToSimCollection &recotosimCollection, - V0Type t, int particle_pdgid, + V0Type t, + int particle_pdgid, int misreconstructed_particle_pdgid); - void doEfficiencies( - const TrackingVertexCollection &gen_vertices, V0Type t, - int parent_particle_id, - int first_daughter_id, /* give only positive charge */ - int second_daughter_id, /* give only positive charge */ - const reco::VertexCompositeCandidateCollection &collection, - const reco::SimToRecoCollection &simtorecoCollection); + void doEfficiencies(const TrackingVertexCollection &gen_vertices, + V0Type t, + int parent_particle_id, + int first_daughter_id, /* give only positive charge */ + int second_daughter_id, /* give only positive charge */ + const reco::VertexCompositeCandidateCollection &collection, + const reco::SimToRecoCollection &simtorecoCollection); // MonitorElements for final histograms @@ -153,7 +146,6 @@ class V0Validator : public DQMEDAnalyzer { edm::EDGetTokenT recoSimToRecoCollectionToken_; edm::EDGetTokenT trackingVertexCollection_Token_; edm::EDGetTokenT > vec_recoVertex_Token_; - edm::EDGetTokenT - recoVertexCompositeCandidateCollection_k0s_Token_, + edm::EDGetTokenT recoVertexCompositeCandidateCollection_k0s_Token_, recoVertexCompositeCandidateCollection_lambda_Token_; }; diff --git a/Validation/RecoVertex/interface/VertexHistogramMaker.h b/Validation/RecoVertex/interface/VertexHistogramMaker.h index 3e55eece29d2c..eada5a39b7893 100644 --- a/Validation/RecoVertex/interface/VertexHistogramMaker.h +++ b/Validation/RecoVertex/interface/VertexHistogramMaker.h @@ -21,20 +21,22 @@ namespace edm { class LumiDetails; class VertexHistogramMaker { - - public: +public: VertexHistogramMaker(edm::ConsumesCollector&& iC); VertexHistogramMaker(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC); ~VertexHistogramMaker(); - void book(const std::string dirname=""); + void book(const std::string dirname = ""); void beginRun(const edm::Run& iRun); - void fill(const edm::Event& iEvent, const reco::VertexCollection& vertices, const double weight=1.); - - private: + void fill(const edm::Event& iEvent, const reco::VertexCollection& vertices, const double weight = 1.); - void fill(const unsigned int orbit, const int bx, const float bxlumi, const reco::VertexCollection& vertices, const double weight=1.); +private: + void fill(const unsigned int orbit, + const int bx, + const float bxlumi, + const reco::VertexCollection& vertices, + const double weight = 1.); TFileDirectory* m_currdir; const unsigned int m_maxLS; @@ -90,8 +92,6 @@ class VertexHistogramMaker { TH2F** m_hvtxxvsbx2drun; TH2F** m_hvtxyvsbx2drun; TH2F** m_hvtxzvsbx2drun; - }; - -#endif // Validation_RecoVertex_VertexHistogramMaker_H +#endif // Validation_RecoVertex_VertexHistogramMaker_H diff --git a/Validation/RecoVertex/interface/VertexWeighter.h b/Validation/RecoVertex/interface/VertexWeighter.h index 74cf6f6fa50fa..d099dd23cb0e2 100644 --- a/Validation/RecoVertex/interface/VertexWeighter.h +++ b/Validation/RecoVertex/interface/VertexWeighter.h @@ -3,28 +3,24 @@ #include -namespace edm { class ParameterSet; } - -class VertexWeighter{ - - public: +namespace edm { + class ParameterSet; +} +class VertexWeighter { +public: VertexWeighter(); VertexWeighter(const double& sigma_init, const double& mean_init, const double& sigma_final, const bool& usemainvtx); VertexWeighter(const edm::ParameterSet& iConfig); const double weight(const std::vector& zpositions, const float& zmain) const; - private: - +private: const double m_sigma_init; const double m_mean_init; const double m_sigma_final; const bool m_usemain; - const bool m_dummy; - - + const bool m_dummy; }; - -#endif // TRACKINGPFG_PILEUP_VERTEXWEIGHTER_H +#endif // TRACKINGPFG_PILEUP_VERTEXWEIGHTER_H diff --git a/Validation/RecoVertex/src/AnotherPrimaryVertexAnalyzer.cc b/Validation/RecoVertex/src/AnotherPrimaryVertexAnalyzer.cc index 69c9fc7829af0..1436c3fcba2c3 100644 --- a/Validation/RecoVertex/src/AnotherPrimaryVertexAnalyzer.cc +++ b/Validation/RecoVertex/src/AnotherPrimaryVertexAnalyzer.cc @@ -16,7 +16,6 @@ // // - // system include files #include @@ -44,25 +43,23 @@ #include "CommonTools/TriggerUtils/interface/PrescaleWeightProvider.h" - // // class decleration // class AnotherPrimaryVertexAnalyzer : public edm::EDAnalyzer { - public: - explicit AnotherPrimaryVertexAnalyzer(const edm::ParameterSet&); - ~AnotherPrimaryVertexAnalyzer() override; - +public: + explicit AnotherPrimaryVertexAnalyzer(const edm::ParameterSet&); + ~AnotherPrimaryVertexAnalyzer() override; private: - void beginJob() override ; + void beginJob() override; void analyze(const edm::Event&, const edm::EventSetup&) override; void beginRun(const edm::Run&, const edm::EventSetup&) override; void endRun(const edm::Run&, const edm::EventSetup&) override; - void endJob() override ; + void endJob() override; - // ----------member data --------------------------- + // ----------member data --------------------------- VertexHistogramMaker _vhm; edm::EDGetTokenT _recoVertexCollectionToken; @@ -83,82 +80,64 @@ class AnotherPrimaryVertexAnalyzer : public edm::EDAnalyzer { // constructors and destructor // AnotherPrimaryVertexAnalyzer::AnotherPrimaryVertexAnalyzer(const edm::ParameterSet& iConfig) - : _vhm(iConfig.getParameter("vHistogramMakerPSet"), consumesCollector()) - , _recoVertexCollectionToken(consumes(iConfig.getParameter("pvCollection"))) - , _firstOnly(iConfig.getUntrackedParameter("firstOnly",false)) - , _weightprov(iConfig.getParameter("usePrescaleWeight") - ? new PrescaleWeightProvider(iConfig.getParameter("prescaleWeightProviderPSet"), consumesCollector(), *this) - : nullptr - ) -{ - //now do what ever initialization is needed + : _vhm(iConfig.getParameter("vHistogramMakerPSet"), consumesCollector()), + _recoVertexCollectionToken(consumes(iConfig.getParameter("pvCollection"))), + _firstOnly(iConfig.getUntrackedParameter("firstOnly", false)), + _weightprov( + iConfig.getParameter("usePrescaleWeight") + ? new PrescaleWeightProvider( + iConfig.getParameter("prescaleWeightProviderPSet"), consumesCollector(), *this) + : nullptr) { + //now do what ever initialization is needed // _vhm.book(); - -} - - -AnotherPrimaryVertexAnalyzer::~AnotherPrimaryVertexAnalyzer() -{ } +AnotherPrimaryVertexAnalyzer::~AnotherPrimaryVertexAnalyzer() {} // // member functions // // ------------ method called to for each event ------------ -void -AnotherPrimaryVertexAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - +void AnotherPrimaryVertexAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // compute event weigth double weight = 1.; - if(_weightprov) weight = _weightprov->prescaleWeight(iEvent,iSetup); + if (_weightprov) + weight = _weightprov->prescaleWeight(iEvent, iSetup); // get PV edm::Handle pvcoll; - iEvent.getByToken(_recoVertexCollectionToken,pvcoll); + iEvent.getByToken(_recoVertexCollectionToken, pvcoll); - if(_firstOnly) { + if (_firstOnly) { reco::VertexCollection firstpv; - if(!pvcoll->empty()) firstpv.push_back((*pvcoll)[0]); - _vhm.fill(iEvent,firstpv,weight); - } - else { - _vhm.fill(iEvent,*pvcoll,weight); + if (!pvcoll->empty()) + firstpv.push_back((*pvcoll)[0]); + _vhm.fill(iEvent, firstpv, weight); + } else { + _vhm.fill(iEvent, *pvcoll, weight); } } - // ------------ method called once each job just before starting event loop ------------ -void -AnotherPrimaryVertexAnalyzer::beginJob() -{ } - -void -AnotherPrimaryVertexAnalyzer::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { +void AnotherPrimaryVertexAnalyzer::beginJob() {} +void AnotherPrimaryVertexAnalyzer::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { _vhm.beginRun(iRun); - if(_weightprov) _weightprov->initRun(iRun,iSetup); - + if (_weightprov) + _weightprov->initRun(iRun, iSetup); } -void -AnotherPrimaryVertexAnalyzer::endRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { - -} +void AnotherPrimaryVertexAnalyzer::endRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {} // ------------ method called once each job just after ending the event loop ------------ -void -AnotherPrimaryVertexAnalyzer::endJob() { -} - +void AnotherPrimaryVertexAnalyzer::endJob() {} //define this as a plug-in DEFINE_FWK_MODULE(AnotherPrimaryVertexAnalyzer); diff --git a/Validation/RecoVertex/src/BSvsPVAnalyzer.cc b/Validation/RecoVertex/src/BSvsPVAnalyzer.cc index b94391870358c..3a9955bab5046 100644 --- a/Validation/RecoVertex/src/BSvsPVAnalyzer.cc +++ b/Validation/RecoVertex/src/BSvsPVAnalyzer.cc @@ -16,7 +16,6 @@ // // - // system include files #include @@ -48,25 +47,23 @@ // class BSvsPVAnalyzer : public edm::EDAnalyzer { - public: - explicit BSvsPVAnalyzer(const edm::ParameterSet&); - ~BSvsPVAnalyzer() override; - +public: + explicit BSvsPVAnalyzer(const edm::ParameterSet&); + ~BSvsPVAnalyzer() override; private: - void beginJob() override ; + void beginJob() override; void analyze(const edm::Event&, const edm::EventSetup&) override; void beginRun(const edm::Run&, const edm::EventSetup&) override; void endRun(const edm::Run&, const edm::EventSetup&) override; - void endJob() override ; + void endJob() override; - // ----------member data --------------------------- + // ----------member data --------------------------- BSvsPVHistogramMaker _bspvhm; edm::EDGetTokenT _recoVertexCollectionToken; edm::EDGetTokenT _recoBeamSpotToken; bool _firstOnly; - }; // @@ -81,80 +78,56 @@ class BSvsPVAnalyzer : public edm::EDAnalyzer { // constructors and destructor // BSvsPVAnalyzer::BSvsPVAnalyzer(const edm::ParameterSet& iConfig) - : _bspvhm(iConfig.getParameter("bspvHistogramMakerPSet"), consumesCollector()) - , _recoVertexCollectionToken(consumes(iConfig.getParameter("pvCollection"))) - , _recoBeamSpotToken(consumes(iConfig.getParameter("bsCollection"))) - , _firstOnly(iConfig.getUntrackedParameter("firstOnly",false)) -{ - //now do what ever initialization is needed + : _bspvhm(iConfig.getParameter("bspvHistogramMakerPSet"), consumesCollector()), + _recoVertexCollectionToken(consumes(iConfig.getParameter("pvCollection"))), + _recoBeamSpotToken(consumes(iConfig.getParameter("bsCollection"))), + _firstOnly(iConfig.getUntrackedParameter("firstOnly", false)) { + //now do what ever initialization is needed // _bspvhm.book(); - } - -BSvsPVAnalyzer::~BSvsPVAnalyzer() -{ - - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) - +BSvsPVAnalyzer::~BSvsPVAnalyzer() { + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) } - // // member functions // // ------------ method called to for each event ------------ -void -BSvsPVAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - +void BSvsPVAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // get BS edm::Handle bs; - iEvent.getByToken(_recoBeamSpotToken,bs); + iEvent.getByToken(_recoBeamSpotToken, bs); // get PV edm::Handle pvcoll; - iEvent.getByToken(_recoVertexCollectionToken,pvcoll); + iEvent.getByToken(_recoVertexCollectionToken, pvcoll); - if(_firstOnly) { + if (_firstOnly) { reco::VertexCollection firstpv; - if(!pvcoll->empty()) firstpv.push_back((*pvcoll)[0]); - _bspvhm.fill(iEvent,firstpv,*bs); - } - else { - _bspvhm.fill(iEvent,*pvcoll,*bs); + if (!pvcoll->empty()) + firstpv.push_back((*pvcoll)[0]); + _bspvhm.fill(iEvent, firstpv, *bs); + } else { + _bspvhm.fill(iEvent, *pvcoll, *bs); } } - // ------------ method called once each job just before starting event loop ------------ -void -BSvsPVAnalyzer::beginJob() -{ } - -void -BSvsPVAnalyzer::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { +void BSvsPVAnalyzer::beginJob() {} - _bspvhm.beginRun(iRun.run()); - -} +void BSvsPVAnalyzer::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { _bspvhm.beginRun(iRun.run()); } -void -BSvsPVAnalyzer::endRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { - -} +void BSvsPVAnalyzer::endRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {} // ------------ method called once each job just after ending the event loop ------------ -void -BSvsPVAnalyzer::endJob() { -} - +void BSvsPVAnalyzer::endJob() {} //define this as a plug-in DEFINE_FWK_MODULE(BSvsPVAnalyzer); diff --git a/Validation/RecoVertex/src/BSvsPVHistogramMaker.cc b/Validation/RecoVertex/src/BSvsPVHistogramMaker.cc index 98592b4a7a3e1..b6e89ec2f3268 100644 --- a/Validation/RecoVertex/src/BSvsPVHistogramMaker.cc +++ b/Validation/RecoVertex/src/BSvsPVHistogramMaker.cc @@ -10,256 +10,297 @@ #include "TH2F.h" #include "TProfile.h" - -BSvsPVHistogramMaker::BSvsPVHistogramMaker(edm::ConsumesCollector&& iC): - _currdir(nullptr), m_maxLS(100), useSlope_(true), _trueOnly(true), - _runHisto(true), _runHistoProfile(true), _runHistoBXProfile(true), _runHistoBX2D(false), _histoParameters(), _rhm(iC) { } - -BSvsPVHistogramMaker::BSvsPVHistogramMaker(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC): - _currdir(nullptr), - m_maxLS(iConfig.getParameter("maxLSBeforeRebin")), - useSlope_(iConfig.getParameter("useSlope")), - _trueOnly(iConfig.getUntrackedParameter("trueOnly",true)), - _runHisto(iConfig.getUntrackedParameter("runHisto",true)), - _runHistoProfile(iConfig.getUntrackedParameter("runHistoProfile",true)), - _runHistoBXProfile(iConfig.getUntrackedParameter("runHistoBXProfile",true)), - _runHistoBX2D(iConfig.getUntrackedParameter("runHistoBX2D",false)), - _histoParameters(iConfig.getUntrackedParameter("histoParameters",edm::ParameterSet())), - _rhm(iC) -{ } - - -BSvsPVHistogramMaker::~BSvsPVHistogramMaker() { - - delete _currdir; - -} - +BSvsPVHistogramMaker::BSvsPVHistogramMaker(edm::ConsumesCollector&& iC) + : _currdir(nullptr), + m_maxLS(100), + useSlope_(true), + _trueOnly(true), + _runHisto(true), + _runHistoProfile(true), + _runHistoBXProfile(true), + _runHistoBX2D(false), + _histoParameters(), + _rhm(iC) {} + +BSvsPVHistogramMaker::BSvsPVHistogramMaker(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC) + : _currdir(nullptr), + m_maxLS(iConfig.getParameter("maxLSBeforeRebin")), + useSlope_(iConfig.getParameter("useSlope")), + _trueOnly(iConfig.getUntrackedParameter("trueOnly", true)), + _runHisto(iConfig.getUntrackedParameter("runHisto", true)), + _runHistoProfile(iConfig.getUntrackedParameter("runHistoProfile", true)), + _runHistoBXProfile(iConfig.getUntrackedParameter("runHistoBXProfile", true)), + _runHistoBX2D(iConfig.getUntrackedParameter("runHistoBX2D", false)), + _histoParameters(iConfig.getUntrackedParameter("histoParameters", edm::ParameterSet())), + _rhm(iC) {} + +BSvsPVHistogramMaker::~BSvsPVHistogramMaker() { delete _currdir; } void BSvsPVHistogramMaker::book(const std::string dirname) { - edm::Service tfserv; TFileDirectory* currdir = &(tfserv->tFileDirectory()); - if(dirname!="") { + if (!dirname.empty()) { currdir = new TFileDirectory(tfserv->mkdir(dirname)); _currdir = currdir; } edm::LogInfo("HistogramBooking") << "Vertex histogram booking in directory " << dirname; - _hdeltax = currdir->make("deltax","(PV-BS) X position", - _histoParameters.getUntrackedParameter("nBinX",200), - _histoParameters.getUntrackedParameter("xMin",-1.), - _histoParameters.getUntrackedParameter("xMax",1.) - ); - _hdeltax->GetXaxis()->SetTitle("#Delta(X) [cm]"); _hdeltax->GetYaxis()->SetTitle("Vertices"); - - _hdeltay = currdir->make("deltay","(PV-BS) Y position", - _histoParameters.getUntrackedParameter("nBinY",200), - _histoParameters.getUntrackedParameter("yMin",-1.), - _histoParameters.getUntrackedParameter("yMax",1.) - ); - _hdeltay->GetXaxis()->SetTitle("#Delta(Y) [cm]"); _hdeltay->GetYaxis()->SetTitle("Vertices"); - - _hdeltaz = currdir->make("deltaz","(PV-BS) Z position", - _histoParameters.getUntrackedParameter("nBinZ",200), - _histoParameters.getUntrackedParameter("zMin",-20.), - _histoParameters.getUntrackedParameter("zMax",20.) - ); - _hdeltaz->GetXaxis()->SetTitle("#Delta(Z) [cm]"); _hdeltaz->GetYaxis()->SetTitle("Vertices"); - - _hdeltaxvsz = currdir->make("deltaxvsz","(PV-BS) X position vs Z", - _histoParameters.getUntrackedParameter("nBinZProfile",40), - _histoParameters.getUntrackedParameter("zMinProfile",-20.), - _histoParameters.getUntrackedParameter("zMaxProfile",20.) - ); - _hdeltaxvsz->GetXaxis()->SetTitle("Z [cm]"); _hdeltaxvsz->GetYaxis()->SetTitle("#Delta(X) [cm]"); - - _hdeltayvsz = currdir->make("deltayvsz","(PV-BS) Y position vs Z", - _histoParameters.getUntrackedParameter("nBinZProfile",40), - _histoParameters.getUntrackedParameter("zMinProfile",-20.), - _histoParameters.getUntrackedParameter("zMaxProfile",20.) - ); - _hdeltayvsz->GetXaxis()->SetTitle("Z [cm]"); _hdeltayvsz->GetYaxis()->SetTitle("#Delta(Y) [cm]"); - - - - - if(_runHisto) { - _hdeltaxrun = _rhm.makeTH1F("deltaxrun","(PV-BS) X position", - _histoParameters.getUntrackedParameter("nBinX",200), - _histoParameters.getUntrackedParameter("xMin",-1.), - _histoParameters.getUntrackedParameter("xMax",1.)); - - _hdeltayrun = _rhm.makeTH1F("deltayrun","(PV-BS) Y position", - _histoParameters.getUntrackedParameter("nBinY",200), - _histoParameters.getUntrackedParameter("yMin",-1.), - _histoParameters.getUntrackedParameter("yMax",1.)); - - _hdeltazrun = _rhm.makeTH1F("deltazrun","(PV-BS) Z position", - _histoParameters.getUntrackedParameter("nBinZ",200), - _histoParameters.getUntrackedParameter("zMin",-20.), - _histoParameters.getUntrackedParameter("zMax",20.)); - - _hdeltaxvszrun = _rhm.makeTProfile("deltaxvszrun","(PV-BS) X position vs Z", - _histoParameters.getUntrackedParameter("nBinZProfile",40), - _histoParameters.getUntrackedParameter("zMinProfile",-20.), - _histoParameters.getUntrackedParameter("zMaxProfile",20.) - ); - - _hdeltayvszrun = _rhm.makeTProfile("deltayvszrun","(PV-BS) Y position vs Z", - _histoParameters.getUntrackedParameter("nBinZProfile",40), - _histoParameters.getUntrackedParameter("zMinProfile",-20.), - _histoParameters.getUntrackedParameter("zMaxProfile",20.) - ); - - if(_runHistoProfile) { - _hdeltaxvsorbrun = _rhm.makeTProfile("deltaxvsorbrun","(PV-BS) X position vs orbit number",4*m_maxLS,0.5,m_maxLS*262144+0.5); - _hdeltayvsorbrun = _rhm.makeTProfile("deltayvsorbrun","(PV-BS) Y position vs orbit number",4*m_maxLS,0.5,m_maxLS*262144+0.5); - _hdeltazvsorbrun = _rhm.makeTProfile("deltazvsorbrun","(PV-BS) Z position vs orbit number",4*m_maxLS,0.5,m_maxLS*262144+0.5); + _hdeltax = currdir->make("deltax", + "(PV-BS) X position", + _histoParameters.getUntrackedParameter("nBinX", 200), + _histoParameters.getUntrackedParameter("xMin", -1.), + _histoParameters.getUntrackedParameter("xMax", 1.)); + _hdeltax->GetXaxis()->SetTitle("#Delta(X) [cm]"); + _hdeltax->GetYaxis()->SetTitle("Vertices"); + + _hdeltay = currdir->make("deltay", + "(PV-BS) Y position", + _histoParameters.getUntrackedParameter("nBinY", 200), + _histoParameters.getUntrackedParameter("yMin", -1.), + _histoParameters.getUntrackedParameter("yMax", 1.)); + _hdeltay->GetXaxis()->SetTitle("#Delta(Y) [cm]"); + _hdeltay->GetYaxis()->SetTitle("Vertices"); + + _hdeltaz = currdir->make("deltaz", + "(PV-BS) Z position", + _histoParameters.getUntrackedParameter("nBinZ", 200), + _histoParameters.getUntrackedParameter("zMin", -20.), + _histoParameters.getUntrackedParameter("zMax", 20.)); + _hdeltaz->GetXaxis()->SetTitle("#Delta(Z) [cm]"); + _hdeltaz->GetYaxis()->SetTitle("Vertices"); + + _hdeltaxvsz = currdir->make("deltaxvsz", + "(PV-BS) X position vs Z", + _histoParameters.getUntrackedParameter("nBinZProfile", 40), + _histoParameters.getUntrackedParameter("zMinProfile", -20.), + _histoParameters.getUntrackedParameter("zMaxProfile", 20.)); + _hdeltaxvsz->GetXaxis()->SetTitle("Z [cm]"); + _hdeltaxvsz->GetYaxis()->SetTitle("#Delta(X) [cm]"); + + _hdeltayvsz = currdir->make("deltayvsz", + "(PV-BS) Y position vs Z", + _histoParameters.getUntrackedParameter("nBinZProfile", 40), + _histoParameters.getUntrackedParameter("zMinProfile", -20.), + _histoParameters.getUntrackedParameter("zMaxProfile", 20.)); + _hdeltayvsz->GetXaxis()->SetTitle("Z [cm]"); + _hdeltayvsz->GetYaxis()->SetTitle("#Delta(Y) [cm]"); + + if (_runHisto) { + _hdeltaxrun = _rhm.makeTH1F("deltaxrun", + "(PV-BS) X position", + _histoParameters.getUntrackedParameter("nBinX", 200), + _histoParameters.getUntrackedParameter("xMin", -1.), + _histoParameters.getUntrackedParameter("xMax", 1.)); + + _hdeltayrun = _rhm.makeTH1F("deltayrun", + "(PV-BS) Y position", + _histoParameters.getUntrackedParameter("nBinY", 200), + _histoParameters.getUntrackedParameter("yMin", -1.), + _histoParameters.getUntrackedParameter("yMax", 1.)); + + _hdeltazrun = _rhm.makeTH1F("deltazrun", + "(PV-BS) Z position", + _histoParameters.getUntrackedParameter("nBinZ", 200), + _histoParameters.getUntrackedParameter("zMin", -20.), + _histoParameters.getUntrackedParameter("zMax", 20.)); + + _hdeltaxvszrun = _rhm.makeTProfile("deltaxvszrun", + "(PV-BS) X position vs Z", + _histoParameters.getUntrackedParameter("nBinZProfile", 40), + _histoParameters.getUntrackedParameter("zMinProfile", -20.), + _histoParameters.getUntrackedParameter("zMaxProfile", 20.)); + + _hdeltayvszrun = _rhm.makeTProfile("deltayvszrun", + "(PV-BS) Y position vs Z", + _histoParameters.getUntrackedParameter("nBinZProfile", 40), + _histoParameters.getUntrackedParameter("zMinProfile", -20.), + _histoParameters.getUntrackedParameter("zMaxProfile", 20.)); + + if (_runHistoProfile) { + _hdeltaxvsorbrun = _rhm.makeTProfile( + "deltaxvsorbrun", "(PV-BS) X position vs orbit number", 4 * m_maxLS, 0.5, m_maxLS * 262144 + 0.5); + _hdeltayvsorbrun = _rhm.makeTProfile( + "deltayvsorbrun", "(PV-BS) Y position vs orbit number", 4 * m_maxLS, 0.5, m_maxLS * 262144 + 0.5); + _hdeltazvsorbrun = _rhm.makeTProfile( + "deltazvsorbrun", "(PV-BS) Z position vs orbit number", 4 * m_maxLS, 0.5, m_maxLS * 262144 + 0.5); } - if(_runHistoBXProfile) { - _hdeltaxvsbxrun = _rhm.makeTProfile("deltaxvsbxrun","(PV-BS) X position vs BX number",3564,-0.5,3563.5); - _hdeltayvsbxrun = _rhm.makeTProfile("deltayvsbxrun","(PV-BS) Y position vs BX number",3564,-0.5,3563.5); - _hdeltazvsbxrun = _rhm.makeTProfile("deltazvsbxrun","(PV-BS) Z position vs BX number",3564,-0.5,3563.5); - if(_runHistoBX2D) { - _hdeltaxvsbx2drun = _rhm.makeTH2F("deltaxvsbx2drun","(PV-BS) X position vs BX number",3564,-0.5,3563.5, - _histoParameters.getUntrackedParameter("nBinX",200), - _histoParameters.getUntrackedParameter("xMin",-1.), - _histoParameters.getUntrackedParameter("xMax",1.)); - _hdeltayvsbx2drun = _rhm.makeTH2F("deltayvsbx2drun","(PV-BS) Y position vs BX number",3564,-0.5,3563.5, - _histoParameters.getUntrackedParameter("nBinY",200), - _histoParameters.getUntrackedParameter("yMin",-1.), - _histoParameters.getUntrackedParameter("yMax",1.)); - _hdeltazvsbx2drun = _rhm.makeTH2F("deltazvsbx2drun","(PV-BS) Z position vs BX number",3564,-0.5,3563.5, - _histoParameters.getUntrackedParameter("nBinZ",200), - _histoParameters.getUntrackedParameter("zMin",-20.), - _histoParameters.getUntrackedParameter("zMax",20.)); + if (_runHistoBXProfile) { + _hdeltaxvsbxrun = _rhm.makeTProfile("deltaxvsbxrun", "(PV-BS) X position vs BX number", 3564, -0.5, 3563.5); + _hdeltayvsbxrun = _rhm.makeTProfile("deltayvsbxrun", "(PV-BS) Y position vs BX number", 3564, -0.5, 3563.5); + _hdeltazvsbxrun = _rhm.makeTProfile("deltazvsbxrun", "(PV-BS) Z position vs BX number", 3564, -0.5, 3563.5); + if (_runHistoBX2D) { + _hdeltaxvsbx2drun = _rhm.makeTH2F("deltaxvsbx2drun", + "(PV-BS) X position vs BX number", + 3564, + -0.5, + 3563.5, + _histoParameters.getUntrackedParameter("nBinX", 200), + _histoParameters.getUntrackedParameter("xMin", -1.), + _histoParameters.getUntrackedParameter("xMax", 1.)); + _hdeltayvsbx2drun = _rhm.makeTH2F("deltayvsbx2drun", + "(PV-BS) Y position vs BX number", + 3564, + -0.5, + 3563.5, + _histoParameters.getUntrackedParameter("nBinY", 200), + _histoParameters.getUntrackedParameter("yMin", -1.), + _histoParameters.getUntrackedParameter("yMax", 1.)); + _hdeltazvsbx2drun = _rhm.makeTH2F("deltazvsbx2drun", + "(PV-BS) Z position vs BX number", + 3564, + -0.5, + 3563.5, + _histoParameters.getUntrackedParameter("nBinZ", 200), + _histoParameters.getUntrackedParameter("zMin", -20.), + _histoParameters.getUntrackedParameter("zMax", 20.)); } } - } } void BSvsPVHistogramMaker::beginRun(const unsigned int nrun) { - char runname[100]; - sprintf(runname,"run_%d",nrun); + sprintf(runname, "run_%d", nrun); TFileDirectory* currdir = _currdir; - if(currdir==nullptr) { + if (currdir == nullptr) { edm::Service tfserv; currdir = &(tfserv->tFileDirectory()); } - _rhm.beginRun(nrun,*currdir); - - if(_runHisto) { - (*_hdeltaxrun)->GetXaxis()->SetTitle("#Delta(X) [cm]"); (*_hdeltaxrun)->GetYaxis()->SetTitle("Vertices"); - (*_hdeltayrun)->GetXaxis()->SetTitle("#Delta(Y) [cm]"); (*_hdeltayrun)->GetYaxis()->SetTitle("Vertices"); - (*_hdeltazrun)->GetXaxis()->SetTitle("#Delta(Z) [cm]"); (*_hdeltazrun)->GetYaxis()->SetTitle("Vertices"); - (*_hdeltaxvszrun)->GetXaxis()->SetTitle("Z [cm]"); (*_hdeltaxvszrun)->GetYaxis()->SetTitle("#Delta(X) [cm]"); - (*_hdeltayvszrun)->GetXaxis()->SetTitle("Z [cm]"); (*_hdeltayvszrun)->GetYaxis()->SetTitle("#Delta(Y) [cm]"); - - if(_runHistoProfile) { - (*_hdeltaxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hdeltaxvsorbrun)->GetYaxis()->SetTitle("#Delta(X) [cm]"); + _rhm.beginRun(nrun, *currdir); + + if (_runHisto) { + (*_hdeltaxrun)->GetXaxis()->SetTitle("#Delta(X) [cm]"); + (*_hdeltaxrun)->GetYaxis()->SetTitle("Vertices"); + (*_hdeltayrun)->GetXaxis()->SetTitle("#Delta(Y) [cm]"); + (*_hdeltayrun)->GetYaxis()->SetTitle("Vertices"); + (*_hdeltazrun)->GetXaxis()->SetTitle("#Delta(Z) [cm]"); + (*_hdeltazrun)->GetYaxis()->SetTitle("Vertices"); + (*_hdeltaxvszrun)->GetXaxis()->SetTitle("Z [cm]"); + (*_hdeltaxvszrun)->GetYaxis()->SetTitle("#Delta(X) [cm]"); + (*_hdeltayvszrun)->GetXaxis()->SetTitle("Z [cm]"); + (*_hdeltayvszrun)->GetYaxis()->SetTitle("#Delta(Y) [cm]"); + + if (_runHistoProfile) { + (*_hdeltaxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); + (*_hdeltaxvsorbrun)->GetYaxis()->SetTitle("#Delta(X) [cm]"); (*_hdeltaxvsorbrun)->SetCanExtend(TH1::kAllAxes); - (*_hdeltayvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hdeltayvsorbrun)->GetYaxis()->SetTitle("#Delta(Y) [cm]"); + (*_hdeltayvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); + (*_hdeltayvsorbrun)->GetYaxis()->SetTitle("#Delta(Y) [cm]"); (*_hdeltayvsorbrun)->SetCanExtend(TH1::kAllAxes); - (*_hdeltazvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hdeltazvsorbrun)->GetYaxis()->SetTitle("#Delta(Z) [cm]"); + (*_hdeltazvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); + (*_hdeltazvsorbrun)->GetYaxis()->SetTitle("#Delta(Z) [cm]"); (*_hdeltazvsorbrun)->SetCanExtend(TH1::kAllAxes); } - if(_runHistoBXProfile) { - (*_hdeltaxvsbxrun)->GetXaxis()->SetTitle("BX"); (*_hdeltaxvsbxrun)->GetYaxis()->SetTitle("#Delta(X) [cm]"); - (*_hdeltayvsbxrun)->GetXaxis()->SetTitle("BX"); (*_hdeltayvsbxrun)->GetYaxis()->SetTitle("#Delta(Y) [cm]"); - (*_hdeltazvsbxrun)->GetXaxis()->SetTitle("BX"); (*_hdeltazvsbxrun)->GetYaxis()->SetTitle("#Delta(Z) [cm]"); - if(_runHistoBX2D) { - (*_hdeltaxvsbx2drun)->GetXaxis()->SetTitle("BX"); (*_hdeltaxvsbx2drun)->GetYaxis()->SetTitle("#Delta(X) [cm]"); - (*_hdeltayvsbx2drun)->GetXaxis()->SetTitle("BX"); (*_hdeltayvsbx2drun)->GetYaxis()->SetTitle("#Delta(Y) [cm]"); - (*_hdeltazvsbx2drun)->GetXaxis()->SetTitle("BX"); (*_hdeltazvsbx2drun)->GetYaxis()->SetTitle("#Delta(Z) [cm]"); + if (_runHistoBXProfile) { + (*_hdeltaxvsbxrun)->GetXaxis()->SetTitle("BX"); + (*_hdeltaxvsbxrun)->GetYaxis()->SetTitle("#Delta(X) [cm]"); + (*_hdeltayvsbxrun)->GetXaxis()->SetTitle("BX"); + (*_hdeltayvsbxrun)->GetYaxis()->SetTitle("#Delta(Y) [cm]"); + (*_hdeltazvsbxrun)->GetXaxis()->SetTitle("BX"); + (*_hdeltazvsbxrun)->GetYaxis()->SetTitle("#Delta(Z) [cm]"); + if (_runHistoBX2D) { + (*_hdeltaxvsbx2drun)->GetXaxis()->SetTitle("BX"); + (*_hdeltaxvsbx2drun)->GetYaxis()->SetTitle("#Delta(X) [cm]"); + (*_hdeltayvsbx2drun)->GetXaxis()->SetTitle("BX"); + (*_hdeltayvsbx2drun)->GetYaxis()->SetTitle("#Delta(Y) [cm]"); + (*_hdeltazvsbx2drun)->GetXaxis()->SetTitle("BX"); + (*_hdeltazvsbx2drun)->GetYaxis()->SetTitle("#Delta(Z) [cm]"); } } - } } -void BSvsPVHistogramMaker::fill(const unsigned int orbit, const int bx, const reco::VertexCollection& vertices, const reco::BeamSpot& bs) { - - for(reco::VertexCollection::const_iterator vtx=vertices.begin();vtx!=vertices.end();++vtx) { - - if(!(_trueOnly && vtx->isFake())) { - +void BSvsPVHistogramMaker::fill(const unsigned int orbit, + const int bx, + const reco::VertexCollection& vertices, + const reco::BeamSpot& bs) { + for (reco::VertexCollection::const_iterator vtx = vertices.begin(); vtx != vertices.end(); ++vtx) { + if (!(_trueOnly && vtx->isFake())) { /* double deltax = vtx->x()-bs.x0(); double deltay = vtx->y()-bs.y0(); double deltaz = vtx->z()-bs.z0(); */ - double deltax = vtx->x()-x(bs,vtx->z()); - double deltay = vtx->y()-y(bs,vtx->z()); - double deltaz = vtx->z()-bs.z0(); + double deltax = vtx->x() - x(bs, vtx->z()); + double deltay = vtx->y() - y(bs, vtx->z()); + double deltaz = vtx->z() - bs.z0(); _hdeltax->Fill(deltax); _hdeltay->Fill(deltay); _hdeltaz->Fill(deltaz); - _hdeltaxvsz->Fill(vtx->z(),deltax); - _hdeltayvsz->Fill(vtx->z(),deltay); - - if(_runHisto) { - if(_hdeltaxrun && *_hdeltaxrun ) (*_hdeltaxrun)->Fill(deltax); - if(_hdeltayrun && *_hdeltayrun ) (*_hdeltayrun)->Fill(deltay); - if(_hdeltazrun && *_hdeltazrun ) (*_hdeltazrun)->Fill(deltaz); - if(_hdeltaxvszrun && *_hdeltaxvszrun ) (*_hdeltaxvszrun)->Fill(vtx->z(),deltax); - if(_hdeltayvszrun && *_hdeltayvszrun ) (*_hdeltayvszrun)->Fill(vtx->z(),deltay); - if(_runHistoProfile) { - if(_hdeltaxvsorbrun && *_hdeltaxvsorbrun ) (*_hdeltaxvsorbrun)->Fill(orbit,deltax); - if(_hdeltayvsorbrun && *_hdeltayvsorbrun ) (*_hdeltayvsorbrun)->Fill(orbit,deltay); - if(_hdeltazvsorbrun && *_hdeltazvsorbrun ) (*_hdeltazvsorbrun)->Fill(orbit,deltaz); - } - if(_runHistoBXProfile) { - if(_hdeltaxvsbxrun && *_hdeltaxvsbxrun ) (*_hdeltaxvsbxrun)->Fill(bx%3564,deltax); - if(_hdeltayvsbxrun && *_hdeltayvsbxrun ) (*_hdeltayvsbxrun)->Fill(bx%3564,deltay); - if(_hdeltazvsbxrun && *_hdeltazvsbxrun ) (*_hdeltazvsbxrun)->Fill(bx%3564,deltaz); - if(_runHistoBX2D) { - if(_hdeltaxvsbx2drun && *_hdeltaxvsbx2drun ) (*_hdeltaxvsbx2drun)->Fill(bx%3564,deltax); - if(_hdeltayvsbx2drun && *_hdeltayvsbx2drun ) (*_hdeltayvsbx2drun)->Fill(bx%3564,deltay); - if(_hdeltazvsbx2drun && *_hdeltazvsbx2drun ) (*_hdeltazvsbx2drun)->Fill(bx%3564,deltaz); - } - } + _hdeltaxvsz->Fill(vtx->z(), deltax); + _hdeltayvsz->Fill(vtx->z(), deltay); + + if (_runHisto) { + if (_hdeltaxrun && *_hdeltaxrun) + (*_hdeltaxrun)->Fill(deltax); + if (_hdeltayrun && *_hdeltayrun) + (*_hdeltayrun)->Fill(deltay); + if (_hdeltazrun && *_hdeltazrun) + (*_hdeltazrun)->Fill(deltaz); + if (_hdeltaxvszrun && *_hdeltaxvszrun) + (*_hdeltaxvszrun)->Fill(vtx->z(), deltax); + if (_hdeltayvszrun && *_hdeltayvszrun) + (*_hdeltayvszrun)->Fill(vtx->z(), deltay); + if (_runHistoProfile) { + if (_hdeltaxvsorbrun && *_hdeltaxvsorbrun) + (*_hdeltaxvsorbrun)->Fill(orbit, deltax); + if (_hdeltayvsorbrun && *_hdeltayvsorbrun) + (*_hdeltayvsorbrun)->Fill(orbit, deltay); + if (_hdeltazvsorbrun && *_hdeltazvsorbrun) + (*_hdeltazvsorbrun)->Fill(orbit, deltaz); + } + if (_runHistoBXProfile) { + if (_hdeltaxvsbxrun && *_hdeltaxvsbxrun) + (*_hdeltaxvsbxrun)->Fill(bx % 3564, deltax); + if (_hdeltayvsbxrun && *_hdeltayvsbxrun) + (*_hdeltayvsbxrun)->Fill(bx % 3564, deltay); + if (_hdeltazvsbxrun && *_hdeltazvsbxrun) + (*_hdeltazvsbxrun)->Fill(bx % 3564, deltaz); + if (_runHistoBX2D) { + if (_hdeltaxvsbx2drun && *_hdeltaxvsbx2drun) + (*_hdeltaxvsbx2drun)->Fill(bx % 3564, deltax); + if (_hdeltayvsbx2drun && *_hdeltayvsbx2drun) + (*_hdeltayvsbx2drun)->Fill(bx % 3564, deltay); + if (_hdeltazvsbx2drun && *_hdeltazvsbx2drun) + (*_hdeltazvsbx2drun)->Fill(bx % 3564, deltaz); + } + } } } } } -void BSvsPVHistogramMaker::fill(const edm::Event& iEvent, const reco::VertexCollection& vertices, const reco::BeamSpot& bs) { - - fill(iEvent.orbitNumber(),iEvent.bunchCrossing(),vertices,bs); - +void BSvsPVHistogramMaker::fill(const edm::Event& iEvent, + const reco::VertexCollection& vertices, + const reco::BeamSpot& bs) { + fill(iEvent.orbitNumber(), iEvent.bunchCrossing(), vertices, bs); } double BSvsPVHistogramMaker::x(const reco::BeamSpot& bs, const double z) const { - double x = bs.x0(); // if(useSlope_) x += bs.dxdz()*z; - if(useSlope_) x += bs.dxdz()*(z-bs.z0()); + if (useSlope_) + x += bs.dxdz() * (z - bs.z0()); // if(useSlope_) x = bs.x(z); return x; - } double BSvsPVHistogramMaker::y(const reco::BeamSpot& bs, const double z) const { - double y = bs.y0(); // if(useSlope_) y += bs.dydz()*z; - if(useSlope_) y += bs.dydz()*(z-bs.z0()); + if (useSlope_) + y += bs.dydz() * (z - bs.z0()); - // if(useSlope_) y = bs.y(z); + // if(useSlope_) y = bs.y(z); return y; - } - diff --git a/Validation/RecoVertex/src/BeamSpotAnalyzer.cc b/Validation/RecoVertex/src/BeamSpotAnalyzer.cc index f36a1894d850e..a0b54ac5cc40e 100644 --- a/Validation/RecoVertex/src/BeamSpotAnalyzer.cc +++ b/Validation/RecoVertex/src/BeamSpotAnalyzer.cc @@ -16,7 +16,6 @@ // // - // system include files #include @@ -40,30 +39,26 @@ #include "Validation/RecoVertex/interface/BeamSpotHistogramMaker.h" #include "DataFormats/BeamSpot/interface/BeamSpot.h" - // // class decleration // class AnotherBeamSpotAnalyzer : public edm::EDAnalyzer { - public: - explicit AnotherBeamSpotAnalyzer(const edm::ParameterSet&); - ~AnotherBeamSpotAnalyzer() override; - +public: + explicit AnotherBeamSpotAnalyzer(const edm::ParameterSet&); + ~AnotherBeamSpotAnalyzer() override; private: - void beginJob() override ; + void beginJob() override; void analyze(const edm::Event&, const edm::EventSetup&) override; void beginRun(const edm::Run&, const edm::EventSetup&) override; void endRun(const edm::Run&, const edm::EventSetup&) override; - void endJob() override ; + void endJob() override; - // ----------member data --------------------------- + // ----------member data --------------------------- BeamSpotHistogramMaker _bshm; edm::EDGetTokenT _recoBeamSpotToken; - - }; // @@ -78,66 +73,43 @@ class AnotherBeamSpotAnalyzer : public edm::EDAnalyzer { // constructors and destructor // AnotherBeamSpotAnalyzer::AnotherBeamSpotAnalyzer(const edm::ParameterSet& iConfig) - : _bshm(iConfig.getParameter("bsHistogramMakerPSet"), consumesCollector()) - , _recoBeamSpotToken(consumes(iConfig.getParameter("bsCollection"))) -{ - //now do what ever initialization is needed + : _bshm(iConfig.getParameter("bsHistogramMakerPSet"), consumesCollector()), + _recoBeamSpotToken(consumes(iConfig.getParameter("bsCollection"))) { + //now do what ever initialization is needed // _bshm.book(); - } - -AnotherBeamSpotAnalyzer::~AnotherBeamSpotAnalyzer() -{ - - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) - +AnotherBeamSpotAnalyzer::~AnotherBeamSpotAnalyzer() { + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) } - // // member functions // // ------------ method called to for each event ------------ -void -AnotherBeamSpotAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - +void AnotherBeamSpotAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // get BS edm::Handle bs; - iEvent.getByToken(_recoBeamSpotToken,bs); - _bshm.fill(iEvent.orbitNumber(),*bs); - + iEvent.getByToken(_recoBeamSpotToken, bs); + _bshm.fill(iEvent.orbitNumber(), *bs); } - // ------------ method called once each job just before starting event loop ------------ -void -AnotherBeamSpotAnalyzer::beginJob() -{ } - -void -AnotherBeamSpotAnalyzer::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { +void AnotherBeamSpotAnalyzer::beginJob() {} +void AnotherBeamSpotAnalyzer::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { _bshm.beginRun(iRun.run()); - } -void -AnotherBeamSpotAnalyzer::endRun(const edm::Run& iRun, const edm::EventSetup& iSetup) { - -} +void AnotherBeamSpotAnalyzer::endRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {} // ------------ method called once each job just after ending the event loop ------------ -void -AnotherBeamSpotAnalyzer::endJob() { -} - +void AnotherBeamSpotAnalyzer::endJob() {} //define this as a plug-in DEFINE_FWK_MODULE(AnotherBeamSpotAnalyzer); diff --git a/Validation/RecoVertex/src/BeamSpotHistogramMaker.cc b/Validation/RecoVertex/src/BeamSpotHistogramMaker.cc index fac8c291e4703..c3d55425b1c67 100644 --- a/Validation/RecoVertex/src/BeamSpotHistogramMaker.cc +++ b/Validation/RecoVertex/src/BeamSpotHistogramMaker.cc @@ -8,128 +8,148 @@ #include "TH1F.h" #include "TProfile.h" +BeamSpotHistogramMaker::BeamSpotHistogramMaker(edm::ConsumesCollector&& iC) + : _currdir(nullptr), _histoParameters(), _rhm(iC) {} -BeamSpotHistogramMaker::BeamSpotHistogramMaker(edm::ConsumesCollector&& iC): - _currdir(nullptr), _histoParameters(), _rhm(iC) { } - -BeamSpotHistogramMaker::BeamSpotHistogramMaker(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC): - _currdir(nullptr), - _histoParameters(iConfig.getUntrackedParameter("histoParameters",edm::ParameterSet())), - _rhm(iC) -{ } - - -BeamSpotHistogramMaker::~BeamSpotHistogramMaker() { - - delete _currdir; - -} +BeamSpotHistogramMaker::BeamSpotHistogramMaker(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC) + : _currdir(nullptr), + _histoParameters(iConfig.getUntrackedParameter("histoParameters", edm::ParameterSet())), + _rhm(iC) {} +BeamSpotHistogramMaker::~BeamSpotHistogramMaker() { delete _currdir; } void BeamSpotHistogramMaker::book(const std::string dirname) { - edm::Service tfserv; TFileDirectory* currdir = &(tfserv->tFileDirectory()); - if(dirname!="") { + if (!dirname.empty()) { currdir = new TFileDirectory(tfserv->mkdir(dirname)); _currdir = currdir; } edm::LogInfo("HistogramBooking") << "BeamSpot histogram booking in directory " << dirname; - _hbsxrun = _rhm.makeTH1F("bsxrun","BeamSpot X position", - _histoParameters.getUntrackedParameter("nBinX",200), - _histoParameters.getUntrackedParameter("xMin",-1.), - _histoParameters.getUntrackedParameter("xMax",1.)); - - _hbsyrun = _rhm.makeTH1F("bsyrun","BeamSpot Y position", - _histoParameters.getUntrackedParameter("nBinY",200), - _histoParameters.getUntrackedParameter("yMin",-1.), - _histoParameters.getUntrackedParameter("yMax",1.)); - - _hbszrun = _rhm.makeTH1F("bszrun","BeamSpot Z position", - _histoParameters.getUntrackedParameter("nBinZ",200), - _histoParameters.getUntrackedParameter("zMin",-1.), - _histoParameters.getUntrackedParameter("zMax",1.)); - - _hbssigmaxrun = _rhm.makeTH1F("bssigmaxrun","BeamSpot sigmaX", - _histoParameters.getUntrackedParameter("nBinSigmaX",200), - _histoParameters.getUntrackedParameter("sigmaXMin",0.), - _histoParameters.getUntrackedParameter("sigmaXMax",0.025)); - - _hbssigmayrun = _rhm.makeTH1F("bssigmayrun","BeamSpot sigmaY", - _histoParameters.getUntrackedParameter("nBinSigmaY",200), - _histoParameters.getUntrackedParameter("sigmaYMin",0.), - _histoParameters.getUntrackedParameter("sigmaYMax",0.025)); - - _hbssigmazrun = _rhm.makeTH1F("bssigmazrun","BeamSpot sigmaZ", - _histoParameters.getUntrackedParameter("nBinSigmaZ",200), - _histoParameters.getUntrackedParameter("sigmaZMin",0.), - _histoParameters.getUntrackedParameter("sigmaZMax",15.)); - - _hbsxvsorbrun = _rhm.makeTProfile("bsxvsorbrun","BeamSpot X position vs orbit number",1600,0.5,1600.*16384+0.5); - _hbsyvsorbrun = _rhm.makeTProfile("bsyvsorbrun","BeamSpot Y position vs orbit number",1600,0.5,1600.*16384+0.5); - _hbszvsorbrun = _rhm.makeTProfile("bszvsorbrun","BeamSpot Z position vs orbit number",1600,0.5,1600.*16384+0.5); - _hbssigmaxvsorbrun = _rhm.makeTProfile("bssigmaxvsorbrun","BeamSpot sigmaX vs orbit number",1600,0.5,1600.*16384+0.5); - _hbssigmayvsorbrun = _rhm.makeTProfile("bssigmayvsorbrun","BeamSpot sigmaY vs orbit number",1600,0.5,1600.*16384+0.5); - _hbssigmazvsorbrun = _rhm.makeTProfile("bssigmazvsorbrun","BeamSpot sigmaZ vs orbit number",1600,0.5,1600.*16384+0.5); - + _hbsxrun = _rhm.makeTH1F("bsxrun", + "BeamSpot X position", + _histoParameters.getUntrackedParameter("nBinX", 200), + _histoParameters.getUntrackedParameter("xMin", -1.), + _histoParameters.getUntrackedParameter("xMax", 1.)); + + _hbsyrun = _rhm.makeTH1F("bsyrun", + "BeamSpot Y position", + _histoParameters.getUntrackedParameter("nBinY", 200), + _histoParameters.getUntrackedParameter("yMin", -1.), + _histoParameters.getUntrackedParameter("yMax", 1.)); + + _hbszrun = _rhm.makeTH1F("bszrun", + "BeamSpot Z position", + _histoParameters.getUntrackedParameter("nBinZ", 200), + _histoParameters.getUntrackedParameter("zMin", -1.), + _histoParameters.getUntrackedParameter("zMax", 1.)); + + _hbssigmaxrun = _rhm.makeTH1F("bssigmaxrun", + "BeamSpot sigmaX", + _histoParameters.getUntrackedParameter("nBinSigmaX", 200), + _histoParameters.getUntrackedParameter("sigmaXMin", 0.), + _histoParameters.getUntrackedParameter("sigmaXMax", 0.025)); + + _hbssigmayrun = _rhm.makeTH1F("bssigmayrun", + "BeamSpot sigmaY", + _histoParameters.getUntrackedParameter("nBinSigmaY", 200), + _histoParameters.getUntrackedParameter("sigmaYMin", 0.), + _histoParameters.getUntrackedParameter("sigmaYMax", 0.025)); + + _hbssigmazrun = _rhm.makeTH1F("bssigmazrun", + "BeamSpot sigmaZ", + _histoParameters.getUntrackedParameter("nBinSigmaZ", 200), + _histoParameters.getUntrackedParameter("sigmaZMin", 0.), + _histoParameters.getUntrackedParameter("sigmaZMax", 15.)); + + _hbsxvsorbrun = + _rhm.makeTProfile("bsxvsorbrun", "BeamSpot X position vs orbit number", 1600, 0.5, 1600. * 16384 + 0.5); + _hbsyvsorbrun = + _rhm.makeTProfile("bsyvsorbrun", "BeamSpot Y position vs orbit number", 1600, 0.5, 1600. * 16384 + 0.5); + _hbszvsorbrun = + _rhm.makeTProfile("bszvsorbrun", "BeamSpot Z position vs orbit number", 1600, 0.5, 1600. * 16384 + 0.5); + _hbssigmaxvsorbrun = + _rhm.makeTProfile("bssigmaxvsorbrun", "BeamSpot sigmaX vs orbit number", 1600, 0.5, 1600. * 16384 + 0.5); + _hbssigmayvsorbrun = + _rhm.makeTProfile("bssigmayvsorbrun", "BeamSpot sigmaY vs orbit number", 1600, 0.5, 1600. * 16384 + 0.5); + _hbssigmazvsorbrun = + _rhm.makeTProfile("bssigmazvsorbrun", "BeamSpot sigmaZ vs orbit number", 1600, 0.5, 1600. * 16384 + 0.5); } void BeamSpotHistogramMaker::beginRun(const unsigned int nrun) { - char runname[100]; - sprintf(runname,"run_%d",nrun); + sprintf(runname, "run_%d", nrun); TFileDirectory* currdir = _currdir; - if(currdir==nullptr) { + if (currdir == nullptr) { edm::Service tfserv; currdir = &(tfserv->tFileDirectory()); } - _rhm.beginRun(nrun,*currdir); - - (*_hbsxrun)->GetXaxis()->SetTitle("X [cm]"); (*_hbsxrun)->GetYaxis()->SetTitle("Events"); - (*_hbsyrun)->GetXaxis()->SetTitle("Y [cm]"); (*_hbsyrun)->GetYaxis()->SetTitle("Events"); - (*_hbszrun)->GetXaxis()->SetTitle("Z [cm]"); (*_hbszrun)->GetYaxis()->SetTitle("Events"); - (*_hbssigmaxrun)->GetXaxis()->SetTitle("sigmaX [cm]"); (*_hbssigmaxrun)->GetYaxis()->SetTitle("Events"); - (*_hbssigmayrun)->GetXaxis()->SetTitle("sigmaY [cm]"); (*_hbssigmayrun)->GetYaxis()->SetTitle("Events"); - (*_hbssigmazrun)->GetXaxis()->SetTitle("sigmaZ [cm]"); (*_hbssigmazrun)->GetYaxis()->SetTitle("Events"); - - (*_hbsxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hbsxvsorbrun)->GetYaxis()->SetTitle("X [cm]"); + _rhm.beginRun(nrun, *currdir); + + (*_hbsxrun)->GetXaxis()->SetTitle("X [cm]"); + (*_hbsxrun)->GetYaxis()->SetTitle("Events"); + (*_hbsyrun)->GetXaxis()->SetTitle("Y [cm]"); + (*_hbsyrun)->GetYaxis()->SetTitle("Events"); + (*_hbszrun)->GetXaxis()->SetTitle("Z [cm]"); + (*_hbszrun)->GetYaxis()->SetTitle("Events"); + (*_hbssigmaxrun)->GetXaxis()->SetTitle("sigmaX [cm]"); + (*_hbssigmaxrun)->GetYaxis()->SetTitle("Events"); + (*_hbssigmayrun)->GetXaxis()->SetTitle("sigmaY [cm]"); + (*_hbssigmayrun)->GetYaxis()->SetTitle("Events"); + (*_hbssigmazrun)->GetXaxis()->SetTitle("sigmaZ [cm]"); + (*_hbssigmazrun)->GetYaxis()->SetTitle("Events"); + + (*_hbsxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); + (*_hbsxvsorbrun)->GetYaxis()->SetTitle("X [cm]"); (*_hbsxvsorbrun)->SetCanExtend(TH1::kAllAxes); - (*_hbsyvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hbsyvsorbrun)->GetYaxis()->SetTitle("Y [cm]"); + (*_hbsyvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); + (*_hbsyvsorbrun)->GetYaxis()->SetTitle("Y [cm]"); (*_hbsyvsorbrun)->SetCanExtend(TH1::kAllAxes); - (*_hbszvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hbszvsorbrun)->GetYaxis()->SetTitle("Z [cm]"); + (*_hbszvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); + (*_hbszvsorbrun)->GetYaxis()->SetTitle("Z [cm]"); (*_hbszvsorbrun)->SetCanExtend(TH1::kAllAxes); - (*_hbssigmaxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hbssigmaxvsorbrun)->GetYaxis()->SetTitle("sigmaX [cm]"); + (*_hbssigmaxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); + (*_hbssigmaxvsorbrun)->GetYaxis()->SetTitle("sigmaX [cm]"); (*_hbssigmaxvsorbrun)->SetCanExtend(TH1::kAllAxes); - (*_hbssigmayvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hbssigmayvsorbrun)->GetYaxis()->SetTitle("sigmaY [cm]"); + (*_hbssigmayvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); + (*_hbssigmayvsorbrun)->GetYaxis()->SetTitle("sigmaY [cm]"); (*_hbssigmayvsorbrun)->SetCanExtend(TH1::kAllAxes); - (*_hbssigmazvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*_hbssigmazvsorbrun)->GetYaxis()->SetTitle("sigmaZ [cm]"); + (*_hbssigmazvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); + (*_hbssigmazvsorbrun)->GetYaxis()->SetTitle("sigmaZ [cm]"); (*_hbssigmazvsorbrun)->SetCanExtend(TH1::kAllAxes); - - } void BeamSpotHistogramMaker::fill(const unsigned int orbit, const reco::BeamSpot& bs) { - - if(_hbsxrun && *_hbsxrun ) (*_hbsxrun)->Fill(bs.x0()); - if(_hbsxvsorbrun && *_hbsxvsorbrun ) (*_hbsxvsorbrun)->Fill(orbit,bs.x0()); - - if(_hbsyrun && *_hbsyrun ) (*_hbsyrun)->Fill(bs.y0()); - if(_hbsyvsorbrun && *_hbsyvsorbrun ) (*_hbsyvsorbrun)->Fill(orbit,bs.y0()); - - if(_hbszrun && *_hbszrun ) (*_hbszrun)->Fill(bs.z0()); - if(_hbszvsorbrun && *_hbszvsorbrun ) (*_hbszvsorbrun)->Fill(orbit,bs.z0()); - - if(_hbssigmaxrun && *_hbssigmaxrun ) (*_hbssigmaxrun)->Fill(bs.BeamWidthX()); - if(_hbssigmayrun && *_hbssigmayrun ) (*_hbssigmayrun)->Fill(bs.BeamWidthY()); - if(_hbssigmazrun && *_hbssigmazrun ) (*_hbssigmazrun)->Fill(bs.sigmaZ()); - if(_hbssigmaxvsorbrun && *_hbssigmaxvsorbrun ) (*_hbssigmaxvsorbrun)->Fill(orbit,bs.BeamWidthX()); - if(_hbssigmayvsorbrun && *_hbssigmayvsorbrun ) (*_hbssigmayvsorbrun)->Fill(orbit,bs.BeamWidthY()); - if(_hbssigmazvsorbrun && *_hbssigmazvsorbrun ) (*_hbssigmazvsorbrun)->Fill(orbit,bs.sigmaZ()); - + if (_hbsxrun && *_hbsxrun) + (*_hbsxrun)->Fill(bs.x0()); + if (_hbsxvsorbrun && *_hbsxvsorbrun) + (*_hbsxvsorbrun)->Fill(orbit, bs.x0()); + + if (_hbsyrun && *_hbsyrun) + (*_hbsyrun)->Fill(bs.y0()); + if (_hbsyvsorbrun && *_hbsyvsorbrun) + (*_hbsyvsorbrun)->Fill(orbit, bs.y0()); + + if (_hbszrun && *_hbszrun) + (*_hbszrun)->Fill(bs.z0()); + if (_hbszvsorbrun && *_hbszvsorbrun) + (*_hbszvsorbrun)->Fill(orbit, bs.z0()); + + if (_hbssigmaxrun && *_hbssigmaxrun) + (*_hbssigmaxrun)->Fill(bs.BeamWidthX()); + if (_hbssigmayrun && *_hbssigmayrun) + (*_hbssigmayrun)->Fill(bs.BeamWidthY()); + if (_hbssigmazrun && *_hbssigmazrun) + (*_hbssigmazrun)->Fill(bs.sigmaZ()); + if (_hbssigmaxvsorbrun && *_hbssigmaxvsorbrun) + (*_hbssigmaxvsorbrun)->Fill(orbit, bs.BeamWidthX()); + if (_hbssigmayvsorbrun && *_hbssigmayvsorbrun) + (*_hbssigmayvsorbrun)->Fill(orbit, bs.BeamWidthY()); + if (_hbssigmazvsorbrun && *_hbssigmazvsorbrun) + (*_hbssigmazvsorbrun)->Fill(orbit, bs.sigmaZ()); } - diff --git a/Validation/RecoVertex/src/MCVerticesAnalyzer.cc b/Validation/RecoVertex/src/MCVerticesAnalyzer.cc index cdb99cb9e68d8..9e634a2126e79 100644 --- a/Validation/RecoVertex/src/MCVerticesAnalyzer.cc +++ b/Validation/RecoVertex/src/MCVerticesAnalyzer.cc @@ -2,7 +2,7 @@ // // Package: MCVerticesAnalyzer // Class: MCVerticesAnalyzer -// +// /**\class MCVerticesAnalyzer MCVerticesAnalyzer.cc TrackingPFG/PileUp/src/MCVerticesAnalyzer.cc Description: @@ -16,7 +16,6 @@ // // - // system include files #include #include @@ -44,7 +43,6 @@ #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h" - #include "TH1F.h" #include "TH2F.h" #include "TProfile.h" @@ -53,24 +51,21 @@ // class decleration // - class MCVerticesAnalyzer : public edm::one::EDAnalyzer { public: explicit MCVerticesAnalyzer(const edm::ParameterSet&); ~MCVerticesAnalyzer() override; - + private: void analyze(const edm::Event&, const edm::EventSetup&) override; - - // ----------member data --------------------------- - + // ----------member data --------------------------- const bool m_useweight; - edm::EDGetTokenT< double > m_doubleToken; - edm::EDGetTokenT< std::vector > m_vecPileupSummaryInfoToken; - edm::EDGetTokenT< edm::HepMCProduct > m_hepMCProductToken; + edm::EDGetTokenT m_doubleToken; + edm::EDGetTokenT > m_vecPileupSummaryInfoToken; + edm::EDGetTokenT m_hepMCProductToken; TH1F* m_hnvtx; TH2F* m_hnvtxvsbx; @@ -82,7 +77,6 @@ class MCVerticesAnalyzer : public edm::one::EDAnalyzer( "useWeight" ) ) - , m_doubleToken( consumes< double >( iConfig.getParameter< edm::InputTag >( "weightProduct" ) ) ) - , m_vecPileupSummaryInfoToken( consumes< std::vector >( iConfig.getParameter< edm::InputTag >( "pileupSummaryCollection" ) ) ) - , m_hepMCProductToken( consumes< edm::HepMCProduct >( iConfig.getParameter< edm::InputTag >( "mcTruthCollection" ) ) ) -{ - //now do what ever initialization is needed - - + : m_useweight(iConfig.getParameter("useWeight")), + m_doubleToken(consumes(iConfig.getParameter("weightProduct"))), + m_vecPileupSummaryInfoToken( + consumes >(iConfig.getParameter("pileupSummaryCollection"))), + m_hepMCProductToken(consumes(iConfig.getParameter("mcTruthCollection"))) { + //now do what ever initialization is needed usesResource("TFileService"); edm::Service tfserv; - m_hnvtx = tfserv->make("nvtx","Number of pileup vertices",400,-0.5,399.5); + m_hnvtx = tfserv->make("nvtx", "Number of pileup vertices", 400, -0.5, 399.5); m_hnvtx->GetXaxis()->SetTitle("Number of Interactions"); - m_hnvtxvsbx = tfserv->make("nvtxvsbx","Number of pileup vertices vs BX",9,-4.5,4.5,400,-0.5,399.5); + m_hnvtxvsbx = tfserv->make("nvtxvsbx", "Number of pileup vertices vs BX", 9, -4.5, 4.5, 400, -0.5, 399.5); m_hnvtxvsbx->GetXaxis()->SetTitle("BX number"); m_hnvtxvsbx->GetYaxis()->SetTitle("Number of Interactions"); - m_hlumi = tfserv->make("lumi","BX luminosity*xsect",200,0.,50.); + m_hlumi = tfserv->make("lumi", "BX luminosity*xsect", 200, 0., 50.); m_hlumi->GetXaxis()->SetTitle("Average Number of Interactions"); - m_hnvtxvslumi = tfserv->make("nvtxvslumi","Npileup vs BX luminosity*xsect",200,0.,50.,400,-0.5,399.5); - m_hnvtxvslumi->GetXaxis()->SetTitle("Average Number of Interactions"); m_hnvtxvslumi->GetYaxis()->SetTitle("Number of Interactions"); + m_hnvtxvslumi = tfserv->make("nvtxvslumi", "Npileup vs BX luminosity*xsect", 200, 0., 50., 400, -0.5, 399.5); + m_hnvtxvslumi->GetXaxis()->SetTitle("Average Number of Interactions"); + m_hnvtxvslumi->GetYaxis()->SetTitle("Number of Interactions"); - if(m_useweight) { - m_hnvtxweight = tfserv->make("nvtxweight","Number of pileup vertices (1-w)",400,-0.5,399.5); + if (m_useweight) { + m_hnvtxweight = tfserv->make("nvtxweight", "Number of pileup vertices (1-w)", 400, -0.5, 399.5); m_hnvtxweight->GetXaxis()->SetTitle("Number of Interactions"); - m_hnvtxweightprof = tfserv->make("nvtxweightprof","Mean (1-w) vs Number of pileup interactions",400,-0.5,399.5); + m_hnvtxweightprof = + tfserv->make("nvtxweightprof", "Mean (1-w) vs Number of pileup interactions", 400, -0.5, 399.5); m_hnvtxweightprof->GetXaxis()->SetTitle("Number of Interactions"); } - m_hmainvtxx = tfserv->make("mainvtxx","Main vertex x position",200,-.5,.5); + m_hmainvtxx = tfserv->make("mainvtxx", "Main vertex x position", 200, -.5, .5); m_hmainvtxx->GetXaxis()->SetTitle("X (cm)"); - m_hmainvtxy = tfserv->make("mainvtxy","Main vertex y position",200,-.5,.5); + m_hmainvtxy = tfserv->make("mainvtxy", "Main vertex y position", 200, -.5, .5); m_hmainvtxy->GetXaxis()->SetTitle("Y (cm)"); - m_hmainvtxz = tfserv->make("mainvtxz","Main vertex z position",600,-30.,30.); + m_hmainvtxz = tfserv->make("mainvtxz", "Main vertex z position", 600, -30., 30.); m_hmainvtxz->GetXaxis()->SetTitle("Z (cm)"); - m_hpileupvtxz = tfserv->make("pileupvtxz","PileUp vertices z position",600,-30.,30.); + m_hpileupvtxz = tfserv->make("pileupvtxz", "PileUp vertices z position", 600, -30., 30.); m_hpileupvtxz->GetXaxis()->SetTitle("Z (cm)"); - } - -MCVerticesAnalyzer::~MCVerticesAnalyzer() -{ - - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) - +MCVerticesAnalyzer::~MCVerticesAnalyzer() { + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) } - // // member functions // // ------------ method called to for each event ------------ -void -MCVerticesAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - - double weight = 1.; - - if(m_useweight) { - edm::Handle weightprod; - iEvent.getByToken( m_doubleToken, weightprod ); - - weight = *weightprod; +void MCVerticesAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + double weight = 1.; - } + if (m_useweight) { + edm::Handle weightprod; + iEvent.getByToken(m_doubleToken, weightprod); + weight = *weightprod; + } - edm::Handle > pileupinfos; - iEvent.getByToken( m_vecPileupSummaryInfoToken, pileupinfos ); - - // - - if(pileupinfos.isValid()) { + edm::Handle > pileupinfos; + iEvent.getByToken(m_vecPileupSummaryInfoToken, pileupinfos); - // look for the intime PileupSummaryInfo + // - std::vector::const_iterator pileupinfo; + if (pileupinfos.isValid()) { + // look for the intime PileupSummaryInfo - for(pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end() ; ++pileupinfo) { - m_hnvtxvsbx->Fill(pileupinfo->getBunchCrossing(),pileupinfo->getPU_NumInteractions(),weight); - } + std::vector::const_iterator pileupinfo; + for (pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end(); ++pileupinfo) { + m_hnvtxvsbx->Fill(pileupinfo->getBunchCrossing(), pileupinfo->getPU_NumInteractions(), weight); + } - for(pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end() ; ++pileupinfo) { - if(pileupinfo->getBunchCrossing()==0) break; - } - - // + for (pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end(); ++pileupinfo) { + if (pileupinfo->getBunchCrossing() == 0) + break; + } - if(pileupinfo->getBunchCrossing()!=0) { - edm::LogError("NoInTimePileUpInfo") << "Cannot find the in-time pileup info " << pileupinfo->getBunchCrossing(); - } - else { + // - m_hlumi->Fill(pileupinfo->getTrueNumInteractions(),weight); - m_hnvtx->Fill(pileupinfo->getPU_NumInteractions(),weight); - m_hnvtxvslumi->Fill(pileupinfo->getTrueNumInteractions(),pileupinfo->getPU_NumInteractions(),weight); + if (pileupinfo->getBunchCrossing() != 0) { + edm::LogError("NoInTimePileUpInfo") << "Cannot find the in-time pileup info " << pileupinfo->getBunchCrossing(); + } else { + m_hlumi->Fill(pileupinfo->getTrueNumInteractions(), weight); + m_hnvtx->Fill(pileupinfo->getPU_NumInteractions(), weight); + m_hnvtxvslumi->Fill(pileupinfo->getTrueNumInteractions(), pileupinfo->getPU_NumInteractions(), weight); - if(m_useweight) { - m_hnvtxweight->Fill(pileupinfo->getPU_NumInteractions(),1.-weight); - m_hnvtxweightprof->Fill(pileupinfo->getPU_NumInteractions(),1.-weight); - } - - const std::vector& zpositions = pileupinfo->getPU_zpositions(); - - for(std::vector::const_iterator zpos = zpositions.begin() ; zpos != zpositions.end() ; ++zpos) { - - m_hpileupvtxz->Fill(*zpos,weight); - - } - } - } - // main interaction part + if (m_useweight) { + m_hnvtxweight->Fill(pileupinfo->getPU_NumInteractions(), 1. - weight); + m_hnvtxweightprof->Fill(pileupinfo->getPU_NumInteractions(), 1. - weight); + } - edm::Handle< edm::HepMCProduct > EvtHandle ; - iEvent.getByToken( m_hepMCProductToken, EvtHandle ); + const std::vector& zpositions = pileupinfo->getPU_zpositions(); - if(EvtHandle.isValid()) { + for (std::vector::const_iterator zpos = zpositions.begin(); zpos != zpositions.end(); ++zpos) { + m_hpileupvtxz->Fill(*zpos, weight); + } + } + } + // main interaction part - const HepMC::GenEvent* Evt = EvtHandle->GetEvent(); + edm::Handle EvtHandle; + iEvent.getByToken(m_hepMCProductToken, EvtHandle); - // get the first vertex - - if(Evt->vertices_begin() != Evt->vertices_end()) { + if (EvtHandle.isValid()) { + const HepMC::GenEvent* Evt = EvtHandle->GetEvent(); - m_hmainvtxx->Fill((*Evt->vertices_begin())->point3d().x()/10.,weight); - m_hmainvtxy->Fill((*Evt->vertices_begin())->point3d().y()/10.,weight); - m_hmainvtxz->Fill((*Evt->vertices_begin())->point3d().z()/10.,weight); + // get the first vertex - } - } + if (Evt->vertices_begin() != Evt->vertices_end()) { + m_hmainvtxx->Fill((*Evt->vertices_begin())->point3d().x() / 10., weight); + m_hmainvtxy->Fill((*Evt->vertices_begin())->point3d().y() / 10., weight); + m_hmainvtxz->Fill((*Evt->vertices_begin())->point3d().z() / 10., weight); + } + } } //define this as a plug-in diff --git a/Validation/RecoVertex/src/MCVerticesWeight.cc b/Validation/RecoVertex/src/MCVerticesWeight.cc index 764b96c99ffe8..ca16bee0c8275 100644 --- a/Validation/RecoVertex/src/MCVerticesWeight.cc +++ b/Validation/RecoVertex/src/MCVerticesWeight.cc @@ -2,7 +2,7 @@ // // Package: PileUp // Class: MCVerticesWeight -// +// /**\class MCVerticesWeight MCVerticesWeight.cc Validation/RecoVertex/MCVerticesWeight.cc Description: @@ -16,7 +16,6 @@ // // - // system include files #include #include @@ -47,104 +46,91 @@ // class MCVerticesWeight : public edm::global::EDFilter<> { - public: - explicit MCVerticesWeight(const edm::ParameterSet&); - ~MCVerticesWeight() override; +public: + explicit MCVerticesWeight(const edm::ParameterSet&); + ~MCVerticesWeight() override; - private: - bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - - // ----------member data --------------------------- +private: + bool filter(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - edm::EDGetTokenT< std::vector > m_vecPileupSummaryInfoToken; - edm::EDGetTokenT< edm::HepMCProduct > m_hepMCProductToken; - const VertexWeighter m_weighter; + // ----------member data --------------------------- + edm::EDGetTokenT > m_vecPileupSummaryInfoToken; + edm::EDGetTokenT m_hepMCProductToken; + const VertexWeighter m_weighter; }; // // constructors and destructor // MCVerticesWeight::MCVerticesWeight(const edm::ParameterSet& iConfig) - : m_vecPileupSummaryInfoToken( consumes< std::vector >( iConfig.getParameter< edm::InputTag >( "pileupSummaryCollection" ) ) ) - , m_hepMCProductToken( consumes< edm::HepMCProduct >( iConfig.getParameter< edm::InputTag >( "mcTruthCollection" ) ) ) - , m_weighter( iConfig.getParameter( "weighterConfig" ) ) -{ - + : m_vecPileupSummaryInfoToken( + consumes >(iConfig.getParameter("pileupSummaryCollection"))), + m_hepMCProductToken(consumes(iConfig.getParameter("mcTruthCollection"))), + m_weighter(iConfig.getParameter("weighterConfig")) { produces(); - -} - -MCVerticesWeight::~MCVerticesWeight() -{ } +MCVerticesWeight::~MCVerticesWeight() {} // // member functions // // ------------ method called on each new Event ------------ -bool -MCVerticesWeight::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const -{ - - bool selected = true; - - double computed_weight(1); - - edm::Handle > pileupinfos; - iEvent.getByToken( m_vecPileupSummaryInfoToken, pileupinfos ); +bool MCVerticesWeight::filter(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { + bool selected = true; + + double computed_weight(1); + edm::Handle > pileupinfos; + iEvent.getByToken(m_vecPileupSummaryInfoToken, pileupinfos); // look for the intime PileupSummaryInfo - std::vector::const_iterator pileupinfo; - for(pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end() ; ++pileupinfo) { - if(pileupinfo->getBunchCrossing()==0) break; - } - - // - if(pileupinfo->getBunchCrossing()!=0) { - edm::LogError("NoInTimePileUpInfo") << "Cannot find the in-time pileup info " << pileupinfo->getBunchCrossing(); - } - else { - - // pileupinfo->getPU_NumInteractions(); - - const std::vector& zpositions = pileupinfo->getPU_zpositions(); - - // for(std::vector::const_iterator zpos = zpositions.begin() ; zpos != zpositions.end() ; ++zpos) { - - // } - - // main interaction part - - edm::Handle< edm::HepMCProduct > EvtHandle ; - iEvent.getByToken( m_hepMCProductToken, EvtHandle ); - - const HepMC::GenEvent* Evt = EvtHandle->GetEvent(); - - // get the first vertex - - double zmain = 0.0; - if(Evt->vertices_begin() != Evt->vertices_end()) { - zmain = (*Evt->vertices_begin())->point3d().z()/10.; - } - - // - - - computed_weight = m_weighter.weight(zpositions,zmain); - - } - - std::unique_ptr weight(new double(computed_weight)); - - iEvent.put(std::move(weight)); - - // - + std::vector::const_iterator pileupinfo; + for (pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end(); ++pileupinfo) { + if (pileupinfo->getBunchCrossing() == 0) + break; + } + + // + if (pileupinfo->getBunchCrossing() != 0) { + edm::LogError("NoInTimePileUpInfo") << "Cannot find the in-time pileup info " << pileupinfo->getBunchCrossing(); + } else { + // pileupinfo->getPU_NumInteractions(); + + const std::vector& zpositions = pileupinfo->getPU_zpositions(); + + // for(std::vector::const_iterator zpos = zpositions.begin() ; zpos != zpositions.end() ; ++zpos) { + + // } + + // main interaction part + + edm::Handle EvtHandle; + iEvent.getByToken(m_hepMCProductToken, EvtHandle); + + const HepMC::GenEvent* Evt = EvtHandle->GetEvent(); + + // get the first vertex + + double zmain = 0.0; + if (Evt->vertices_begin() != Evt->vertices_end()) { + zmain = (*Evt->vertices_begin())->point3d().z() / 10.; + } + + // + + computed_weight = m_weighter.weight(zpositions, zmain); + } + + std::unique_ptr weight(new double(computed_weight)); + + iEvent.put(std::move(weight)); + + // + return selected; } diff --git a/Validation/RecoVertex/src/MCvsRecoVerticesAnalyzer.cc b/Validation/RecoVertex/src/MCvsRecoVerticesAnalyzer.cc index 6fbaf4a692f94..afe98e2b7d94e 100644 --- a/Validation/RecoVertex/src/MCvsRecoVerticesAnalyzer.cc +++ b/Validation/RecoVertex/src/MCvsRecoVerticesAnalyzer.cc @@ -2,7 +2,7 @@ // // Package: MCvsRecoVerticesAnalyzer // Class: MCvsRecoVerticesAnalyzer -// +// /**\class MCvsRecoVerticesAnalyzer MCvsRecoVerticesAnalyzer.cc TrackingPFG/PileUp/src/MCvsRecoVerticesAnalyzer.cc Description: @@ -16,7 +16,6 @@ // // - // system include files #include #include @@ -55,26 +54,23 @@ // class decleration // - class MCvsRecoVerticesAnalyzer : public edm::one::EDAnalyzer { public: explicit MCvsRecoVerticesAnalyzer(const edm::ParameterSet&); ~MCvsRecoVerticesAnalyzer() override; - + private: void analyze(const edm::Event&, const edm::EventSetup&) override; - - // ----------member data --------------------------- - + // ----------member data --------------------------- const bool m_useweight; const bool m_useVisibleVertices; const edm::ParameterSet m_histoParameters; - edm::EDGetTokenT< double > m_doubleToken; - edm::EDGetTokenT< std::vector > m_vecPileupSummaryInfoToken; - edm::EDGetTokenT< reco::VertexCollection > m_recoVertexCollectionToken; - edm::EDGetTokenT< edm::HepMCProduct > m_hepMCProductToken; + edm::EDGetTokenT m_doubleToken; + edm::EDGetTokenT > m_vecPileupSummaryInfoToken; + edm::EDGetTokenT m_recoVertexCollectionToken; + edm::EDGetTokenT m_hepMCProductToken; TH2F* m_hrecovsmcnvtx2d; TProfile* m_hrecovsmcnvtxprof; @@ -85,12 +81,10 @@ class MCvsRecoVerticesAnalyzer : public edm::one::EDAnalyzer( "useWeight" ) ) - , m_useVisibleVertices( iConfig.getParameter< bool >( "useVisibleVertices" ) ) - , m_histoParameters( iConfig.getUntrackedParameter< edm::ParameterSet >( "histoParameters", edm::ParameterSet() ) ) - , m_doubleToken( consumes< double >( iConfig.getParameter< edm::InputTag >( "weightProduct" ) ) ) - , m_vecPileupSummaryInfoToken( consumes< std::vector >( iConfig.getParameter< edm::InputTag >( "pileupSummaryCollection" ) ) ) - , m_recoVertexCollectionToken( consumes< reco::VertexCollection >( iConfig.getParameter< edm::InputTag >( "pvCollection" ) ) ) - , m_hepMCProductToken( consumes< edm::HepMCProduct >( iConfig.getParameter< edm::InputTag >( "mcTruthCollection" ) ) ) -{ - //now do what ever initialization is needed - - if(m_useVisibleVertices) edm::LogInfo("UseVisibleVertices") << "Only visible vertices will be used to compute Npileup"; + : m_useweight(iConfig.getParameter("useWeight")), + m_useVisibleVertices(iConfig.getParameter("useVisibleVertices")), + m_histoParameters(iConfig.getUntrackedParameter("histoParameters", edm::ParameterSet())), + m_doubleToken(consumes(iConfig.getParameter("weightProduct"))), + m_vecPileupSummaryInfoToken( + consumes >(iConfig.getParameter("pileupSummaryCollection"))), + m_recoVertexCollectionToken( + consumes(iConfig.getParameter("pvCollection"))), + m_hepMCProductToken(consumes(iConfig.getParameter("mcTruthCollection"))) { + //now do what ever initialization is needed + + if (m_useVisibleVertices) + edm::LogInfo("UseVisibleVertices") << "Only visible vertices will be used to compute Npileup"; usesResource("TFileService"); edm::Service tfserv; - m_hrecovsmcnvtx2d = tfserv->make("recovsmcnvtx2d","Number of reco vertices vs pileup interactions",60,-0.5,59.5,60,-0.5,59.5); - m_hrecovsmcnvtx2d->GetXaxis()->SetTitle("Pileup Interactions"); m_hrecovsmcnvtx2d->GetYaxis()->SetTitle("Reco Vertices"); - m_hrecovsmcnvtxprof = tfserv->make("recovsmcnvtxprof","Mean number of reco vs pileup vertices",60,-0.5,59.5); - m_hrecovsmcnvtxprof->GetXaxis()->SetTitle("Pileup Interactions"); m_hrecovsmcnvtxprof->GetYaxis()->SetTitle("Reco Vertices"); - - m_hrecovsmclumi2d = tfserv->make("recovsmclumi2d","Number of reco vertices vs ave pileup interactions",200,0.,50.,60,-0.5,59.5); - m_hrecovsmclumi2d->GetXaxis()->SetTitle("Average Pileup Interactions"); m_hrecovsmclumi2d->GetYaxis()->SetTitle("Reco Vertices"); - m_hrecovsmclumiprof = tfserv->make("recovsmclumiprof","Mean number of reco vs ave pileup vertices",200,0.,50.); - m_hrecovsmclumiprof->GetXaxis()->SetTitle("Average Pileup Interactions"); m_hrecovsmclumiprof->GetYaxis()->SetTitle("Reco Vertices"); - - if(m_useweight) { - m_hrecovsmcnvtxweightedprof = tfserv->make("recovsmcnvtxweightedprof","Mean number of reco vs pileup vertices (1-w) weight",60,-0.5,59.5); - m_hrecovsmcnvtxweightedprof->GetXaxis()->SetTitle("Pileup Interactions"); m_hrecovsmcnvtxweightedprof->GetYaxis()->SetTitle("Reco Vertices (1-w)"); - - m_hrecovsmclumiweightedprof = tfserv->make("recovsmclumiweightedprof","Mean number of reco vs ave pileup vertices (1-w) weight", - 200,0.,50.); - m_hrecovsmclumiweightedprof->GetXaxis()->SetTitle("Average Pileup Interactions"); + m_hrecovsmcnvtx2d = tfserv->make( + "recovsmcnvtx2d", "Number of reco vertices vs pileup interactions", 60, -0.5, 59.5, 60, -0.5, 59.5); + m_hrecovsmcnvtx2d->GetXaxis()->SetTitle("Pileup Interactions"); + m_hrecovsmcnvtx2d->GetYaxis()->SetTitle("Reco Vertices"); + m_hrecovsmcnvtxprof = + tfserv->make("recovsmcnvtxprof", "Mean number of reco vs pileup vertices", 60, -0.5, 59.5); + m_hrecovsmcnvtxprof->GetXaxis()->SetTitle("Pileup Interactions"); + m_hrecovsmcnvtxprof->GetYaxis()->SetTitle("Reco Vertices"); + + m_hrecovsmclumi2d = tfserv->make( + "recovsmclumi2d", "Number of reco vertices vs ave pileup interactions", 200, 0., 50., 60, -0.5, 59.5); + m_hrecovsmclumi2d->GetXaxis()->SetTitle("Average Pileup Interactions"); + m_hrecovsmclumi2d->GetYaxis()->SetTitle("Reco Vertices"); + m_hrecovsmclumiprof = + tfserv->make("recovsmclumiprof", "Mean number of reco vs ave pileup vertices", 200, 0., 50.); + m_hrecovsmclumiprof->GetXaxis()->SetTitle("Average Pileup Interactions"); + m_hrecovsmclumiprof->GetYaxis()->SetTitle("Reco Vertices"); + + if (m_useweight) { + m_hrecovsmcnvtxweightedprof = tfserv->make( + "recovsmcnvtxweightedprof", "Mean number of reco vs pileup vertices (1-w) weight", 60, -0.5, 59.5); + m_hrecovsmcnvtxweightedprof->GetXaxis()->SetTitle("Pileup Interactions"); + m_hrecovsmcnvtxweightedprof->GetYaxis()->SetTitle("Reco Vertices (1-w)"); + + m_hrecovsmclumiweightedprof = tfserv->make( + "recovsmclumiweightedprof", "Mean number of reco vs ave pileup vertices (1-w) weight", 200, 0., 50.); + m_hrecovsmclumiweightedprof->GetXaxis()->SetTitle("Average Pileup Interactions"); m_hrecovsmclumiweightedprof->GetYaxis()->SetTitle("Reco Vertices (1-w)"); } - m_hdeltazfirst = tfserv->make("deltazfirst","Reco-MC vertex z position (first vertex)", - m_histoParameters.getUntrackedParameter("zBins",1000), - m_histoParameters.getUntrackedParameter("zMin",-1.), - m_histoParameters.getUntrackedParameter("zMax",1.)); - m_hdeltazfirst->GetXaxis()->SetTitle("#Delta z (cm)"); m_hdeltazfirst->GetYaxis()->SetTitle("Events"); - - m_hdeltazclose = tfserv->make("deltazclose","Reco-MC vertex z position (closest vertex)", - m_histoParameters.getUntrackedParameter("zBins",1000), - m_histoParameters.getUntrackedParameter("zMin",-1.), - m_histoParameters.getUntrackedParameter("zMax",1.)); - m_hdeltazclose->GetXaxis()->SetTitle("#Delta z (cm)"); m_hdeltazclose->GetYaxis()->SetTitle("Events"); - - m_hclosestvtx = tfserv->make("closestvtx","Closest reco vtx ID",30,-0.5,29.5); - m_hclosestvtx->GetXaxis()->SetTitle("Vtx ID"); m_hclosestvtx->GetYaxis()->SetTitle("Events"); - - m_hdeltazfirstvsnpu = tfserv->make("deltazfirstvsnpu","Reco-MC vertex z position (first vertex) vs Npileup",30,-0.5,29.5, - m_histoParameters.getUntrackedParameter("zBins",1000), - m_histoParameters.getUntrackedParameter("zMin",-1.), - m_histoParameters.getUntrackedParameter("zMax",1.)); - m_hdeltazfirstvsnpu->GetXaxis()->SetTitle("pileup Interactions"); m_hdeltazfirstvsnpu->GetYaxis()->SetTitle("#Delta z (cm)"); - - m_hdeltazclosevsnpu = tfserv->make("deltazclosevsnpu","Reco-MC vertex z position (closest vertex) v Npileup",30,-0.5,29.5, - m_histoParameters.getUntrackedParameter("zBins",1000), - m_histoParameters.getUntrackedParameter("zMin",-1.), - m_histoParameters.getUntrackedParameter("zMax",1.)); - m_hdeltazclosevsnpu->GetXaxis()->SetTitle("Pileup Interactions"); m_hdeltazclosevsnpu->GetYaxis()->SetTitle("#Delta z (cm)"); - - m_hclosestvtxvsnpu = tfserv->make("closestvtxvsnpu","Closest reco vtx ID vs Npileup",30,-0.5,29.5,30,-0.5,29.5); - m_hclosestvtxvsnpu->GetXaxis()->SetTitle("Pileup Interactions"); m_hclosestvtxvsnpu->GetYaxis()->SetTitle("Vtx ID"); - + m_hdeltazfirst = tfserv->make("deltazfirst", + "Reco-MC vertex z position (first vertex)", + m_histoParameters.getUntrackedParameter("zBins", 1000), + m_histoParameters.getUntrackedParameter("zMin", -1.), + m_histoParameters.getUntrackedParameter("zMax", 1.)); + m_hdeltazfirst->GetXaxis()->SetTitle("#Delta z (cm)"); + m_hdeltazfirst->GetYaxis()->SetTitle("Events"); + + m_hdeltazclose = tfserv->make("deltazclose", + "Reco-MC vertex z position (closest vertex)", + m_histoParameters.getUntrackedParameter("zBins", 1000), + m_histoParameters.getUntrackedParameter("zMin", -1.), + m_histoParameters.getUntrackedParameter("zMax", 1.)); + m_hdeltazclose->GetXaxis()->SetTitle("#Delta z (cm)"); + m_hdeltazclose->GetYaxis()->SetTitle("Events"); + + m_hclosestvtx = tfserv->make("closestvtx", "Closest reco vtx ID", 30, -0.5, 29.5); + m_hclosestvtx->GetXaxis()->SetTitle("Vtx ID"); + m_hclosestvtx->GetYaxis()->SetTitle("Events"); + + m_hdeltazfirstvsnpu = tfserv->make("deltazfirstvsnpu", + "Reco-MC vertex z position (first vertex) vs Npileup", + 30, + -0.5, + 29.5, + m_histoParameters.getUntrackedParameter("zBins", 1000), + m_histoParameters.getUntrackedParameter("zMin", -1.), + m_histoParameters.getUntrackedParameter("zMax", 1.)); + m_hdeltazfirstvsnpu->GetXaxis()->SetTitle("pileup Interactions"); + m_hdeltazfirstvsnpu->GetYaxis()->SetTitle("#Delta z (cm)"); + + m_hdeltazclosevsnpu = tfserv->make("deltazclosevsnpu", + "Reco-MC vertex z position (closest vertex) v Npileup", + 30, + -0.5, + 29.5, + m_histoParameters.getUntrackedParameter("zBins", 1000), + m_histoParameters.getUntrackedParameter("zMin", -1.), + m_histoParameters.getUntrackedParameter("zMax", 1.)); + m_hdeltazclosevsnpu->GetXaxis()->SetTitle("Pileup Interactions"); + m_hdeltazclosevsnpu->GetYaxis()->SetTitle("#Delta z (cm)"); + + m_hclosestvtxvsnpu = + tfserv->make("closestvtxvsnpu", "Closest reco vtx ID vs Npileup", 30, -0.5, 29.5, 30, -0.5, 29.5); + m_hclosestvtxvsnpu->GetXaxis()->SetTitle("Pileup Interactions"); + m_hclosestvtxvsnpu->GetYaxis()->SetTitle("Vtx ID"); } - -MCvsRecoVerticesAnalyzer::~MCvsRecoVerticesAnalyzer() -{ - - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) - +MCvsRecoVerticesAnalyzer::~MCvsRecoVerticesAnalyzer() { + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) } - // // member functions // // ------------ method called to for each event ------------ -void -MCvsRecoVerticesAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - +void MCvsRecoVerticesAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { double weight = 1.; - - if(m_useweight) { - edm::Handle< double > weightprod; - iEvent.getByToken( m_doubleToken, weightprod ); - + + if (m_useweight) { + edm::Handle weightprod; + iEvent.getByToken(m_doubleToken, weightprod); + weight = *weightprod; - } - - edm::Handle< std::vector > pileupinfos; - iEvent.getByToken( m_vecPileupSummaryInfoToken, pileupinfos ); + + edm::Handle > pileupinfos; + iEvent.getByToken(m_vecPileupSummaryInfoToken, pileupinfos); // look for the intime PileupSummaryInfo std::vector::const_iterator pileupinfo; - for(pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end() ; ++pileupinfo) { - - if(pileupinfo->getBunchCrossing()==0) break; + for (pileupinfo = pileupinfos->begin(); pileupinfo != pileupinfos->end(); ++pileupinfo) { + if (pileupinfo->getBunchCrossing() == 0) + break; + } - } - // - - edm::Handle< reco::VertexCollection > pvcoll; - iEvent.getByToken( m_recoVertexCollectionToken, pvcoll ); - - // + edm::Handle pvcoll; + iEvent.getByToken(m_recoVertexCollectionToken, pvcoll); - if(pileupinfo->getBunchCrossing()!=0) { + // + if (pileupinfo->getBunchCrossing() != 0) { edm::LogError("NoInTimePileUpInfo") << "Cannot find the in-time pileup info " << pileupinfo->getBunchCrossing(); - } - else { - + } else { int npileup = pileupinfo->getPU_NumInteractions(); - if(m_useVisibleVertices) npileup = pileupinfo->getPU_zpositions().size(); + if (m_useVisibleVertices) + npileup = pileupinfo->getPU_zpositions().size(); - m_hrecovsmcnvtx2d->Fill(npileup,pvcoll->size(),weight); - m_hrecovsmcnvtxprof->Fill(npileup,pvcoll->size(),weight); + m_hrecovsmcnvtx2d->Fill(npileup, pvcoll->size(), weight); + m_hrecovsmcnvtxprof->Fill(npileup, pvcoll->size(), weight); - m_hrecovsmclumi2d->Fill(pileupinfo->getTrueNumInteractions(),pvcoll->size(),weight); - m_hrecovsmclumiprof->Fill(pileupinfo->getTrueNumInteractions(),pvcoll->size(),weight); + m_hrecovsmclumi2d->Fill(pileupinfo->getTrueNumInteractions(), pvcoll->size(), weight); + m_hrecovsmclumiprof->Fill(pileupinfo->getTrueNumInteractions(), pvcoll->size(), weight); - if(m_useweight) { - m_hrecovsmcnvtxweightedprof->Fill(npileup,pvcoll->size(),1.-weight); - m_hrecovsmclumiweightedprof->Fill(pileupinfo->getTrueNumInteractions(),pvcoll->size(),1.-weight); + if (m_useweight) { + m_hrecovsmcnvtxweightedprof->Fill(npileup, pvcoll->size(), 1. - weight); + m_hrecovsmclumiweightedprof->Fill(pileupinfo->getTrueNumInteractions(), pvcoll->size(), 1. - weight); } // - - edm::Handle< edm::HepMCProduct > EvtHandle ; - iEvent.getByToken( m_hepMCProductToken, EvtHandle ); - + + edm::Handle EvtHandle; + iEvent.getByToken(m_hepMCProductToken, EvtHandle); + const HepMC::GenEvent* Evt = EvtHandle->GetEvent(); - + // compute the difference between the main interaction vertex z position and the first vertex of the collection - - if(!pvcoll->empty()) { - if(!(*pvcoll)[0].isFake()) { - // get the first vertex - if(Evt->vertices_begin() != Evt->vertices_end()) { - m_hdeltazfirst->Fill((*pvcoll)[0].z()-(*Evt->vertices_begin())->point3d().z()/10.,weight); - m_hdeltazfirstvsnpu->Fill(npileup,(*pvcoll)[0].z()-(*Evt->vertices_begin())->point3d().z()/10.,weight); - } + + if (!pvcoll->empty()) { + if (!(*pvcoll)[0].isFake()) { + // get the first vertex + if (Evt->vertices_begin() != Evt->vertices_end()) { + m_hdeltazfirst->Fill((*pvcoll)[0].z() - (*Evt->vertices_begin())->point3d().z() / 10., weight); + m_hdeltazfirstvsnpu->Fill(npileup, (*pvcoll)[0].z() - (*Evt->vertices_begin())->point3d().z() / 10., weight); + } } } - - // compute the difference between the main interaction vertex z position and the closest reco vertex - + + // compute the difference between the main interaction vertex z position and the closest reco vertex + double minabsdist = -1.; double mindist = -999.; int closestvtx = -1; - - for(unsigned int ivtx = 0 ; ivtx < pvcoll->size() ; ++ivtx) { - - if(closestvtx < 0 || minabsdist > std::abs((*pvcoll)[ivtx].z()-(*Evt->vertices_begin())->point3d().z()/10.)) { - mindist = (*pvcoll)[ivtx].z()-(*Evt->vertices_begin())->point3d().z()/10.; - closestvtx = ivtx; - minabsdist = std::abs(mindist); + + for (unsigned int ivtx = 0; ivtx < pvcoll->size(); ++ivtx) { + if (closestvtx < 0 || + minabsdist > std::abs((*pvcoll)[ivtx].z() - (*Evt->vertices_begin())->point3d().z() / 10.)) { + mindist = (*pvcoll)[ivtx].z() - (*Evt->vertices_begin())->point3d().z() / 10.; + closestvtx = ivtx; + minabsdist = std::abs(mindist); } - } - if(closestvtx >= 0) { - m_hdeltazclose->Fill(mindist,weight); - m_hdeltazclosevsnpu->Fill(npileup,mindist,weight); - m_hclosestvtx->Fill(closestvtx,weight); - m_hclosestvtxvsnpu->Fill(npileup,closestvtx,weight); + if (closestvtx >= 0) { + m_hdeltazclose->Fill(mindist, weight); + m_hdeltazclosevsnpu->Fill(npileup, mindist, weight); + m_hclosestvtx->Fill(closestvtx, weight); + m_hclosestvtxvsnpu->Fill(npileup, closestvtx, weight); } - } } - + //define this as a plug-in DEFINE_FWK_MODULE(MCvsRecoVerticesAnalyzer); diff --git a/Validation/RecoVertex/src/PrimaryVertexAnalyzer4PUSlimmed.cc b/Validation/RecoVertex/src/PrimaryVertexAnalyzer4PUSlimmed.cc index e330d4010cf59..dc754801dee90 100644 --- a/Validation/RecoVertex/src/PrimaryVertexAnalyzer4PUSlimmed.cc +++ b/Validation/RecoVertex/src/PrimaryVertexAnalyzer4PUSlimmed.cc @@ -24,50 +24,43 @@ namespace { template - std::array makeLogBins(const double min, const double max) { + std::array makeLogBins(const double min, const double max) { const double minLog10 = std::log10(min); const double maxLog10 = std::log10(max); - const double width = (maxLog10-minLog10)/N; - std::array ret; - ret[0] = std::pow(10,minLog10); + const double width = (maxLog10 - minLog10) / N; + std::array ret; + ret[0] = std::pow(10, minLog10); const double mult = std::pow(10, width); - for(size_t i=1; i<= N; ++i) { - ret[i] = ret[i-1]*mult; + for (size_t i = 1; i <= N; ++i) { + ret[i] = ret[i - 1] * mult; } return ret; } -} +} // namespace // // constructors and destructor // -PrimaryVertexAnalyzer4PUSlimmed::PrimaryVertexAnalyzer4PUSlimmed( - const edm::ParameterSet& iConfig) +PrimaryVertexAnalyzer4PUSlimmed::PrimaryVertexAnalyzer4PUSlimmed(const edm::ParameterSet& iConfig) : verbose_(iConfig.getUntrackedParameter("verbose", false)), - use_only_charged_tracks_(iConfig.getUntrackedParameter( - "use_only_charged_tracks", true)), + use_only_charged_tracks_(iConfig.getUntrackedParameter("use_only_charged_tracks", true)), do_generic_sim_plots_(iConfig.getUntrackedParameter("do_generic_sim_plots")), - root_folder_( - iConfig.getUntrackedParameter("root_folder", - "Validation/Vertices")), - vecPileupSummaryInfoToken_(consumes >( - edm::InputTag(std::string("addPileupInfo")))), + root_folder_(iConfig.getUntrackedParameter("root_folder", "Validation/Vertices")), + vecPileupSummaryInfoToken_(consumes>(edm::InputTag(std::string("addPileupInfo")))), trackingParticleCollectionToken_(consumes( iConfig.getUntrackedParameter("trackingParticleCollection"))), - trackingVertexCollectionToken_(consumes( - iConfig.getUntrackedParameter("trackingVertexCollection"))), - simToRecoAssociationToken_(consumes( - iConfig.getUntrackedParameter("trackAssociatorMap"))), - recoToSimAssociationToken_(consumes( - iConfig.getUntrackedParameter("trackAssociatorMap"))), + trackingVertexCollectionToken_( + consumes(iConfig.getUntrackedParameter("trackingVertexCollection"))), + simToRecoAssociationToken_( + consumes(iConfig.getUntrackedParameter("trackAssociatorMap"))), + recoToSimAssociationToken_( + consumes(iConfig.getUntrackedParameter("trackAssociatorMap"))), vertexAssociatorToken_(consumes( iConfig.getUntrackedParameter("vertexAssociator"))) { - reco_vertex_collections_ = iConfig.getParameter >( - "vertexRecoCollections"); + reco_vertex_collections_ = iConfig.getParameter>("vertexRecoCollections"); for (auto const& l : reco_vertex_collections_) { reco_vertex_collection_tokens_.push_back( - edm::EDGetTokenT>( - consumes>(l))); + edm::EDGetTokenT>(consumes>(l))); } errorPrintedForColl_.resize(reco_vertex_collections_.size(), false); } @@ -77,93 +70,59 @@ PrimaryVertexAnalyzer4PUSlimmed::~PrimaryVertexAnalyzer4PUSlimmed() {} // // member functions // -void PrimaryVertexAnalyzer4PUSlimmed::bookHistograms( - DQMStore::IBooker& i, edm::Run const& iRun, edm::EventSetup const& iSetup) { +void PrimaryVertexAnalyzer4PUSlimmed::bookHistograms(DQMStore::IBooker& i, + edm::Run const& iRun, + edm::EventSetup const& iSetup) { // TODO(rovere) make this booking method shorter and smarter, // factorizing similar histograms with different prefix in a single // method call. - float log_bins[31] = { - 0.0, 0.0002, 0.0004, 0.0006, 0.0008, 0.001, 0.002, - 0.004, 0.006, 0.008, 0.01, 0.02, - 0.04, 0.06, 0.08, 0.1, 0.2, - 0.4, 0.6, 0.8, 1.0, 2.0, - 4.0, 6.0, 8.0, 10.0, 20.0, - 40.0, 60.0, 80.0, 100.0 - }; - auto const log_mergez_bins = makeLogBins(1e-4, 1); // 4 bins / 10x + float log_bins[31] = {0.0, 0.0002, 0.0004, 0.0006, 0.0008, 0.001, 0.002, 0.004, 0.006, 0.008, 0.01, + 0.02, 0.04, 0.06, 0.08, 0.1, 0.2, 0.4, 0.6, 0.8, 1.0, 2.0, + 4.0, 6.0, 8.0, 10.0, 20.0, 40.0, 60.0, 80.0, 100.0}; + auto const log_mergez_bins = makeLogBins(1e-4, 1); // 4 bins / 10x auto const log_pt_bins = makeLogBins(0.1, 1e4); float log_pt2_bins[16] = { - 0.0, 0.1, 0.5, - 1.0, 2.0, 5.0, - 10.0, 20.0, 50.0, - 100.0, 200.0, 500.0, - 1000.0, 2000.0, 5000.0,10000.0 - }; - float log_ntrk_bins[25] = { - 0., 2.0, 4.0, 6.0, 8.0, 10., - 12.0, 14.0, 16.0, 18.0, 22.0, - 26.0, 30.0, 35.0, 40.0, - 45.0, 50.0, 55.0, 60.0, 70.0, - 80.0, 90.0, 100.0, 150.0, 200.0 - }; + 0.0, 0.1, 0.5, 1.0, 2.0, 5.0, 10.0, 20.0, 50.0, 100.0, 200.0, 500.0, 1000.0, 2000.0, 5000.0, 10000.0}; + float log_ntrk_bins[25] = {0., 2.0, 4.0, 6.0, 8.0, 10., 12.0, 14.0, 16.0, 18.0, 22.0, 26.0, 30.0, + 35.0, 40.0, 45.0, 50.0, 55.0, 60.0, 70.0, 80.0, 90.0, 100.0, 150.0, 200.0}; // TODO(rovere) Possibly change or add the main DQMStore booking // interface to allow booking a TProfile with variable bin-width // using an array of floats, as done for the TH1F case, not of // doubles. double log_pt2_bins_double[16] = { - 0.0, 0.1, 0.5, - 1.0, 2.0, 5.0, - 10.0, 20.0, 50.0, - 100.0, 200.0, 500.0, - 1000.0, 2000.0, 5000.0,10000.0 - }; + 0.0, 0.1, 0.5, 1.0, 2.0, 5.0, 10.0, 20.0, 50.0, 100.0, 200.0, 500.0, 1000.0, 2000.0, 5000.0, 10000.0}; i.setCurrentFolder(root_folder_); - if(do_generic_sim_plots_) { - mes_["root_folder"]["GenVtx_vs_BX"] = - i.book2D("GenVtx_vs_BX", "GenVtx_vs_BX", 16, -12.5, 3.5, 200, 0., 200.); + if (do_generic_sim_plots_) { + mes_["root_folder"]["GenVtx_vs_BX"] = i.book2D("GenVtx_vs_BX", "GenVtx_vs_BX", 16, -12.5, 3.5, 200, 0., 200.); // Generated Primary Vertex Plots - mes_["root_folder"]["GenPV_X"] = - i.book1D("GenPV_X", "GeneratedPV_X", 120, -0.6, 0.6); - mes_["root_folder"]["GenPV_Y"] = - i.book1D("GenPV_Y", "GeneratedPV_Y", 120, -0.6, 0.6); - mes_["root_folder"]["GenPV_Z"] = - i.book1D("GenPV_Z", "GeneratedPV_Z", 120, -60., 60.); - mes_["root_folder"]["GenPV_R"] = - i.book1D("GenPV_R", "GeneratedPV_R", 120, 0, 0.6); - mes_["root_folder"]["GenPV_Pt2"] = - i.book1D("GenPV_Pt2", "GeneratedPV_Sum-pt2", 15, &log_pt2_bins[0]); + mes_["root_folder"]["GenPV_X"] = i.book1D("GenPV_X", "GeneratedPV_X", 120, -0.6, 0.6); + mes_["root_folder"]["GenPV_Y"] = i.book1D("GenPV_Y", "GeneratedPV_Y", 120, -0.6, 0.6); + mes_["root_folder"]["GenPV_Z"] = i.book1D("GenPV_Z", "GeneratedPV_Z", 120, -60., 60.); + mes_["root_folder"]["GenPV_R"] = i.book1D("GenPV_R", "GeneratedPV_R", 120, 0, 0.6); + mes_["root_folder"]["GenPV_Pt2"] = i.book1D("GenPV_Pt2", "GeneratedPV_Sum-pt2", 15, &log_pt2_bins[0]); mes_["root_folder"]["GenPV_NumTracks"] = - i.book1D("GenPV_NumTracks", "GeneratedPV_NumTracks", 24, &log_ntrk_bins[0]); + i.book1D("GenPV_NumTracks", "GeneratedPV_NumTracks", 24, &log_ntrk_bins[0]); mes_["root_folder"]["GenPV_ClosestDistanceZ"] = - i.book1D("GenPV_ClosestDistanceZ", "GeneratedPV_ClosestDistanceZ", 30, - &log_bins[0]); + i.book1D("GenPV_ClosestDistanceZ", "GeneratedPV_ClosestDistanceZ", 30, &log_bins[0]); // All Generated Vertices, used for efficiency plots - mes_["root_folder"]["GenAllV_NumVertices"] = i.book1D( - "GenAllV_NumVertices", "GeneratedAllV_NumVertices", 100, 0., 200.); - mes_["root_folder"]["GenAllV_X"] = - i.book1D("GenAllV_X", "GeneratedAllV_X", 120, -0.6, 0.6); - mes_["root_folder"]["GenAllV_Y"] = - i.book1D("GenAllV_Y", "GeneratedAllV_Y", 120, -0.6, 0.6); - mes_["root_folder"]["GenAllV_Z"] = - i.book1D("GenAllV_Z", "GeneratedAllV_Z", 120, -60, 60); - mes_["root_folder"]["GenAllV_R"] = - i.book1D("GenAllV_R", "GeneratedAllV_R", 120, 0, 0.6); - mes_["root_folder"]["GenAllV_Pt2"] = - i.book1D("GenAllV_Pt2", "GeneratedAllV_Sum-pt2", 15, &log_pt2_bins[0]); + mes_["root_folder"]["GenAllV_NumVertices"] = + i.book1D("GenAllV_NumVertices", "GeneratedAllV_NumVertices", 100, 0., 200.); + mes_["root_folder"]["GenAllV_X"] = i.book1D("GenAllV_X", "GeneratedAllV_X", 120, -0.6, 0.6); + mes_["root_folder"]["GenAllV_Y"] = i.book1D("GenAllV_Y", "GeneratedAllV_Y", 120, -0.6, 0.6); + mes_["root_folder"]["GenAllV_Z"] = i.book1D("GenAllV_Z", "GeneratedAllV_Z", 120, -60, 60); + mes_["root_folder"]["GenAllV_R"] = i.book1D("GenAllV_R", "GeneratedAllV_R", 120, 0, 0.6); + mes_["root_folder"]["GenAllV_Pt2"] = i.book1D("GenAllV_Pt2", "GeneratedAllV_Sum-pt2", 15, &log_pt2_bins[0]); mes_["root_folder"]["GenAllV_NumTracks"] = - i.book1D("GenAllV_NumTracks", "GeneratedAllV_NumTracks", 24, &log_ntrk_bins[0]); + i.book1D("GenAllV_NumTracks", "GeneratedAllV_NumTracks", 24, &log_ntrk_bins[0]); mes_["root_folder"]["GenAllV_ClosestDistanceZ"] = - i.book1D("GenAllV_ClosestDistanceZ", "GeneratedAllV_ClosestDistanceZ", 30, - &log_bins[0]); + i.book1D("GenAllV_ClosestDistanceZ", "GeneratedAllV_ClosestDistanceZ", 30, &log_bins[0]); mes_["root_folder"]["GenAllV_PairDistanceZ"] = - i.book1D("GenAllV_PairDistanceZ", "GeneratedAllV_PairDistanceZ", - 1000, 0, 20); - mes_["root_folder"]["SignalIsHighestPt2"] = - i.book1D("SignalIsHighestPt2", "SignalIsHighestPt2", 2, -0.5, 1.5); + i.book1D("GenAllV_PairDistanceZ", "GeneratedAllV_PairDistanceZ", 1000, 0, 20); + mes_["root_folder"]["SignalIsHighestPt2"] = i.book1D("SignalIsHighestPt2", "SignalIsHighestPt2", 2, -0.5, 1.5); } for (auto const& l : reco_vertex_collections_) { @@ -171,33 +130,26 @@ void PrimaryVertexAnalyzer4PUSlimmed::bookHistograms( std::string current_folder = root_folder_ + "/" + label; i.setCurrentFolder(current_folder); - auto book1d = [&](const char *name, int bins, double min, double max) { + auto book1d = [&](const char* name, int bins, double min, double max) { mes_[label][name] = i.book1D(name, name, bins, min, max); }; - auto book1dlogx = [&](const char *name, int bins, const float *xbinedges) { + auto book1dlogx = [&](const char* name, int bins, const float* xbinedges) { mes_[label][name] = i.book1D(name, name, bins, xbinedges); }; - auto book2d = [&](const char *name, - int xbins, double xmin, double xmax, - int ybins, double ymin, double ymax) { - mes_[label][name] = i.book2D(name, name, xbins,xmin,xmax, ybins,ymin,ymax); + auto book2d = [&](const char* name, int xbins, double xmin, double xmax, int ybins, double ymin, double ymax) { + mes_[label][name] = i.book2D(name, name, xbins, xmin, xmax, ybins, ymin, ymax); }; - auto book2dlogx = [&](const char *name, - int xbins, const float *xbinedges, - int ybins, double ymin, double ymax) { - auto me = i.book2D(name, name, xbins,xbinedges[0],xbinedges[xbins], ybins,ymin,ymax); + auto book2dlogx = [&](const char* name, int xbins, const float* xbinedges, int ybins, double ymin, double ymax) { + auto me = i.book2D(name, name, xbins, xbinedges[0], xbinedges[xbins], ybins, ymin, ymax); me->getTH2F()->GetXaxis()->Set(xbins, xbinedges); mes_[label][name] = me; }; - - mes_[label]["RecoVtx_vs_GenVtx"] = i.bookProfile( - "RecoVtx_vs_GenVtx", "RecoVtx_vs_GenVtx", 125, 0., 250., 250, 0., 250.); + mes_[label]["RecoVtx_vs_GenVtx"] = + i.bookProfile("RecoVtx_vs_GenVtx", "RecoVtx_vs_GenVtx", 125, 0., 250., 250, 0., 250.); mes_[label]["MatchedRecoVtx_vs_GenVtx"] = - i.bookProfile("MatchedRecoVtx_vs_GenVtx", "MatchedRecoVtx_vs_GenVtx", - 125, 0., 250., 250, 0., 250.); - mes_[label]["KindOfSignalPV"] = - i.book1D("KindOfSignalPV", "KindOfSignalPV", 9, -0.5, 8.5); + i.bookProfile("MatchedRecoVtx_vs_GenVtx", "MatchedRecoVtx_vs_GenVtx", 125, 0., 250., 250, 0., 250.); + mes_[label]["KindOfSignalPV"] = i.book1D("KindOfSignalPV", "KindOfSignalPV", 9, -0.5, 8.5); mes_[label]["KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(1, "!Highest!Assoc2Any"); mes_[label]["KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(2, "Highest!Assoc2Any"); mes_[label]["KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(3, "!HighestAssoc2First"); @@ -206,269 +158,208 @@ void PrimaryVertexAnalyzer4PUSlimmed::bookHistograms( mes_[label]["KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(6, "HighestAssoc2!First"); mes_[label]["KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(7, "!HighestAssoc2First"); mes_[label]["KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(8, "HighestAssoc2First"); - mes_[label]["MisTagRate"] = - i.book1D("MisTagRate", "MisTagRate", 2, -0.5, 1.5); - mes_[label]["MisTagRate_vs_PU"] = - i.bookProfile("MisTagRate_vs_PU", "MisTagRate_vs_PU", 125, 0., 250., - 2, 0., 1.); + mes_[label]["MisTagRate"] = i.book1D("MisTagRate", "MisTagRate", 2, -0.5, 1.5); + mes_[label]["MisTagRate_vs_PU"] = i.bookProfile("MisTagRate_vs_PU", "MisTagRate_vs_PU", 125, 0., 250., 2, 0., 1.); mes_[label]["MisTagRate_vs_sum-pt2"] = - i.bookProfile("MisTagRate_vs_sum-pt2", "MisTagRate_vs_sum-pt2", - 15, &log_pt2_bins_double[0], 2, 0., 1.); - mes_[label]["MisTagRate_vs_Z"] = - i.bookProfile("MisTagRate_vs_Z", "MisTagRate_vs_Z", - 120, -60., 60., 2, 0., 1.); - mes_[label]["MisTagRate_vs_R"] = - i.bookProfile("MisTagRate_vs_R", "MisTagRate_vs_R", - 120, 0., 0.6, 2, 0., 1.); + i.bookProfile("MisTagRate_vs_sum-pt2", "MisTagRate_vs_sum-pt2", 15, &log_pt2_bins_double[0], 2, 0., 1.); + mes_[label]["MisTagRate_vs_Z"] = i.bookProfile("MisTagRate_vs_Z", "MisTagRate_vs_Z", 120, -60., 60., 2, 0., 1.); + mes_[label]["MisTagRate_vs_R"] = i.bookProfile("MisTagRate_vs_R", "MisTagRate_vs_R", 120, 0., 0.6, 2, 0., 1.); mes_[label]["MisTagRate_vs_NumTracks"] = - i.bookProfile("MisTagRate_vs_NumTracks", "MisTagRate_vs_NumTracks", - 100, 0., 200, 2, 0., 1.); + i.bookProfile("MisTagRate_vs_NumTracks", "MisTagRate_vs_NumTracks", 100, 0., 200, 2, 0., 1.); mes_[label]["MisTagRateSignalIsHighest"] = - i.book1D("MisTagRateSignalIsHighest", - "MisTagRateSignalIsHighest", 2, -0.5, 1.5); + i.book1D("MisTagRateSignalIsHighest", "MisTagRateSignalIsHighest", 2, -0.5, 1.5); mes_[label]["MisTagRateSignalIsHighest_vs_PU"] = - i.bookProfile("MisTagRateSignalIsHighest_vs_PU", - "MisTagRateSignalIsHighest_vs_PU", 125, 0., 250., - 2, 0., 1.); - mes_[label]["MisTagRateSignalIsHighest_vs_sum-pt2"] = - i.bookProfile("MisTagRateSignalIsHighest_vs_sum-pt2", - "MisTagRateSignalIsHighest_vs_sum-pt2", - 15, &log_pt2_bins_double[0], 2, 0., 1.); + i.bookProfile("MisTagRateSignalIsHighest_vs_PU", "MisTagRateSignalIsHighest_vs_PU", 125, 0., 250., 2, 0., 1.); + mes_[label]["MisTagRateSignalIsHighest_vs_sum-pt2"] = i.bookProfile("MisTagRateSignalIsHighest_vs_sum-pt2", + "MisTagRateSignalIsHighest_vs_sum-pt2", + 15, + &log_pt2_bins_double[0], + 2, + 0., + 1.); mes_[label]["MisTagRateSignalIsHighest_vs_Z"] = - i.bookProfile("MisTagRateSignalIsHighest_vs_Z", - "MisTagRateSignalIsHighest_vs_Z", - 120, -60., 60., 2, 0., 1.); + i.bookProfile("MisTagRateSignalIsHighest_vs_Z", "MisTagRateSignalIsHighest_vs_Z", 120, -60., 60., 2, 0., 1.); mes_[label]["MisTagRateSignalIsHighest_vs_R"] = - i.bookProfile("MisTagRateSignalIsHighest_vs_R", - "MisTagRateSignalIsHighest_vs_R", - 120, 0., 0.6, 2, 0., 1.); - mes_[label]["MisTagRateSignalIsHighest_vs_NumTracks"] = - i.bookProfile("MisTagRateSignalIsHighest_vs_NumTracks", - "MisTagRateSignalIsHighest_vs_NumTracks", - 100, 0., 200, 2, 0., 1.); + i.bookProfile("MisTagRateSignalIsHighest_vs_R", "MisTagRateSignalIsHighest_vs_R", 120, 0., 0.6, 2, 0., 1.); + mes_[label]["MisTagRateSignalIsHighest_vs_NumTracks"] = i.bookProfile( + "MisTagRateSignalIsHighest_vs_NumTracks", "MisTagRateSignalIsHighest_vs_NumTracks", 100, 0., 200, 2, 0., 1.); mes_[label]["MisTagRateSignalIsNotHighest"] = - i.book1D("MisTagRateSignalIsNotHighest", - "MisTagRateSignalIsNotHighest", 2, -0.5, 1.5); - mes_[label]["MisTagRateSignalIsNotHighest_vs_PU"] = - i.bookProfile("MisTagRateSignalIsNotHighest_vs_PU", - "MisTagRateSignalIsNotHighest_vs_PU", 125, 0., 250., - 2, 0., 1.); - mes_[label]["MisTagRateSignalIsNotHighest_vs_sum-pt2"] = - i.bookProfile("MisTagRateSignalIsNotHighest_vs_sum-pt2", - "MisTagRateSignalIsNotHighest_vs_sum-pt2", - 15, &log_pt2_bins_double[0], 2, 0., 1.); - mes_[label]["MisTagRateSignalIsNotHighest_vs_Z"] = - i.bookProfile("MisTagRateSignalIsNotHighest_vs_Z", - "MisTagRateSignalIsNotHighest_vs_Z", - 120, -60., 60., 2, 0., 1.); - mes_[label]["MisTagRateSignalIsNotHighest_vs_R"] = - i.bookProfile("MisTagRateSignalIsNotHighest_vs_R", - "MisTagRateSignalIsNotHighest_vs_R", - 120, 0., 0.6, 2, 0., 1.); + i.book1D("MisTagRateSignalIsNotHighest", "MisTagRateSignalIsNotHighest", 2, -0.5, 1.5); + mes_[label]["MisTagRateSignalIsNotHighest_vs_PU"] = i.bookProfile( + "MisTagRateSignalIsNotHighest_vs_PU", "MisTagRateSignalIsNotHighest_vs_PU", 125, 0., 250., 2, 0., 1.); + mes_[label]["MisTagRateSignalIsNotHighest_vs_sum-pt2"] = i.bookProfile("MisTagRateSignalIsNotHighest_vs_sum-pt2", + "MisTagRateSignalIsNotHighest_vs_sum-pt2", + 15, + &log_pt2_bins_double[0], + 2, + 0., + 1.); + mes_[label]["MisTagRateSignalIsNotHighest_vs_Z"] = i.bookProfile( + "MisTagRateSignalIsNotHighest_vs_Z", "MisTagRateSignalIsNotHighest_vs_Z", 120, -60., 60., 2, 0., 1.); + mes_[label]["MisTagRateSignalIsNotHighest_vs_R"] = i.bookProfile( + "MisTagRateSignalIsNotHighest_vs_R", "MisTagRateSignalIsNotHighest_vs_R", 120, 0., 0.6, 2, 0., 1.); mes_[label]["MisTagRateSignalIsNotHighest_vs_NumTracks"] = i.bookProfile("MisTagRateSignalIsNotHighest_vs_NumTracks", "MisTagRateSignalIsNotHighest_vs_NumTracks", - 100, 0., 200, 2, 0., 1.); + 100, + 0., + 200, + 2, + 0., + 1.); mes_[label]["TruePVLocationIndex"] = - i.book1D("TruePVLocationIndex", - "TruePVLocationIndexInRecoVertexCollection", 12, -1.5, 10.5); + i.book1D("TruePVLocationIndex", "TruePVLocationIndexInRecoVertexCollection", 12, -1.5, 10.5); mes_[label]["TruePVLocationIndexCumulative"] = - i.book1D("TruePVLocationIndexCumulative", - "TruePVLocationIndexInRecoVertexCollectionCumulative", - 3, -1.5, 1.5); + i.book1D("TruePVLocationIndexCumulative", "TruePVLocationIndexInRecoVertexCollectionCumulative", 3, -1.5, 1.5); mes_[label]["TruePVLocationIndexSignalIsHighest"] = i.book1D("TruePVLocationIndexSignalIsHighest", "TruePVLocationIndexSignalIsHighestInRecoVertexCollection", - 12, -1.5, 10.5); + 12, + -1.5, + 10.5); mes_[label]["TruePVLocationIndexSignalIsNotHighest"] = i.book1D("TruePVLocationIndexSignalIsNotHighest", "TruePVLocationIndexSignalIsNotHighestInRecoVertexCollection", - 12, -1.5, 10.5); + 12, + -1.5, + 10.5); // All Generated Vertices. Used for Efficiency plots We kind of // duplicate plots here in case we want to perform more detailed // studies on a selection of generated vertices, not on all of them. mes_[label]["GenAllAssoc2Reco_NumVertices"] = - i.book1D("GenAllAssoc2Reco_NumVertices", - "GeneratedAllAssoc2Reco_NumVertices", 100, 0., 200.); - mes_[label]["GenAllAssoc2Reco_X"] = i.book1D( - "GenAllAssoc2Reco_X", "GeneratedAllAssoc2Reco_X", 120, -0.6, 0.6); - mes_[label]["GenAllAssoc2Reco_Y"] = i.book1D( - "GenAllAssoc2Reco_Y", "GeneratedAllAssoc2Reco_Y", 120, -0.6, 0.6); - mes_[label]["GenAllAssoc2Reco_Z"] = i.book1D( - "GenAllAssoc2Reco_Z", "GeneratedAllAssoc2Reco_Z", 120, -60, 60); - mes_[label]["GenAllAssoc2Reco_R"] = - i.book1D("GenAllAssoc2Reco_R", "GeneratedAllAssoc2Reco_R", 120, 0, 0.6); + i.book1D("GenAllAssoc2Reco_NumVertices", "GeneratedAllAssoc2Reco_NumVertices", 100, 0., 200.); + mes_[label]["GenAllAssoc2Reco_X"] = i.book1D("GenAllAssoc2Reco_X", "GeneratedAllAssoc2Reco_X", 120, -0.6, 0.6); + mes_[label]["GenAllAssoc2Reco_Y"] = i.book1D("GenAllAssoc2Reco_Y", "GeneratedAllAssoc2Reco_Y", 120, -0.6, 0.6); + mes_[label]["GenAllAssoc2Reco_Z"] = i.book1D("GenAllAssoc2Reco_Z", "GeneratedAllAssoc2Reco_Z", 120, -60, 60); + mes_[label]["GenAllAssoc2Reco_R"] = i.book1D("GenAllAssoc2Reco_R", "GeneratedAllAssoc2Reco_R", 120, 0, 0.6); mes_[label]["GenAllAssoc2Reco_Pt2"] = - i.book1D("GenAllAssoc2Reco_Pt2", "GeneratedAllAssoc2Reco_Sum-pt2", 15, - &log_pt2_bins[0]); + i.book1D("GenAllAssoc2Reco_Pt2", "GeneratedAllAssoc2Reco_Sum-pt2", 15, &log_pt2_bins[0]); mes_[label]["GenAllAssoc2Reco_NumTracks"] = - i.book1D("GenAllAssoc2Reco_NumTracks", - "GeneratedAllAssoc2Reco_NumTracks", 24, &log_ntrk_bins[0]); + i.book1D("GenAllAssoc2Reco_NumTracks", "GeneratedAllAssoc2Reco_NumTracks", 24, &log_ntrk_bins[0]); mes_[label]["GenAllAssoc2Reco_ClosestDistanceZ"] = - i.book1D("GenAllAssoc2Reco_ClosestDistanceZ", - "GeneratedAllAssoc2Reco_ClosestDistanceZ", 30, &log_bins[0]); + i.book1D("GenAllAssoc2Reco_ClosestDistanceZ", "GeneratedAllAssoc2Reco_ClosestDistanceZ", 30, &log_bins[0]); book1d("GenPVAssoc2RecoPV_X", 120, -0.6, 0.6); book1d("GenPVAssoc2RecoPV_Y", 120, -0.6, 0.6); - book1d("GenPVAssoc2RecoPV_Z", 120, -60, 60); + book1d("GenPVAssoc2RecoPV_Z", 120, -60, 60); // All Generated Vertices Matched to a Reconstructed vertex. Used // for Efficiency plots mes_[label]["GenAllAssoc2RecoMatched_NumVertices"] = - i.book1D("GenAllAssoc2RecoMatched_NumVertices", - "GeneratedAllAssoc2RecoMatched_NumVertices", 100, 0., 200.); + i.book1D("GenAllAssoc2RecoMatched_NumVertices", "GeneratedAllAssoc2RecoMatched_NumVertices", 100, 0., 200.); mes_[label]["GenAllAssoc2RecoMatched_X"] = - i.book1D("GenAllAssoc2RecoMatched_X", "GeneratedAllAssoc2RecoMatched_X", - 120, -0.6, 0.6); + i.book1D("GenAllAssoc2RecoMatched_X", "GeneratedAllAssoc2RecoMatched_X", 120, -0.6, 0.6); mes_[label]["GenAllAssoc2RecoMatched_Y"] = - i.book1D("GenAllAssoc2RecoMatched_Y", "GeneratedAllAssoc2RecoMatched_Y", - 120, -0.6, 0.6); + i.book1D("GenAllAssoc2RecoMatched_Y", "GeneratedAllAssoc2RecoMatched_Y", 120, -0.6, 0.6); mes_[label]["GenAllAssoc2RecoMatched_Z"] = - i.book1D("GenAllAssoc2RecoMatched_Z", "GeneratedAllAssoc2RecoMatched_Z", - 120, -60, 60); + i.book1D("GenAllAssoc2RecoMatched_Z", "GeneratedAllAssoc2RecoMatched_Z", 120, -60, 60); mes_[label]["GenAllAssoc2RecoMatched_R"] = - i.book1D("GenAllAssoc2RecoMatched_R", "GeneratedAllAssoc2RecoMatched_R", - 120, 0, 0.6); + i.book1D("GenAllAssoc2RecoMatched_R", "GeneratedAllAssoc2RecoMatched_R", 120, 0, 0.6); mes_[label]["GenAllAssoc2RecoMatched_Pt2"] = - i.book1D("GenAllAssoc2RecoMatched_Pt2", - "GeneratedAllAssoc2RecoMatched_Sum-pt2", 15, &log_pt2_bins[0]); + i.book1D("GenAllAssoc2RecoMatched_Pt2", "GeneratedAllAssoc2RecoMatched_Sum-pt2", 15, &log_pt2_bins[0]); mes_[label]["GenAllAssoc2RecoMatched_NumTracks"] = - i.book1D("GenAllAssoc2RecoMatched_NumTracks", - "GeneratedAllAssoc2RecoMatched_NumTracks", 24, &log_ntrk_bins[0]); + i.book1D("GenAllAssoc2RecoMatched_NumTracks", "GeneratedAllAssoc2RecoMatched_NumTracks", 24, &log_ntrk_bins[0]); mes_[label]["GenAllAssoc2RecoMatched_ClosestDistanceZ"] = i.book1D( - "GenAllAssoc2RecoMatched_ClosestDistanceZ", - "GeneratedAllAssoc2RecoMatched_ClosestDistanceZ", 30, &log_bins[0]); + "GenAllAssoc2RecoMatched_ClosestDistanceZ", "GeneratedAllAssoc2RecoMatched_ClosestDistanceZ", 30, &log_bins[0]); book1d("GenPVAssoc2RecoPVMatched_X", 120, -0.6, 0.6); book1d("GenPVAssoc2RecoPVMatched_Y", 120, -0.6, 0.6); - book1d("GenPVAssoc2RecoPVMatched_Z", 120, -60, 60); + book1d("GenPVAssoc2RecoPVMatched_Z", 120, -60, 60); // All Generated Vertices Multi-Matched to a Reconstructed vertex. Used // for Duplicate rate plots mes_[label]["GenAllAssoc2RecoMultiMatched_NumVertices"] = i.book1D( - "GenAllAssoc2RecoMultiMatched_NumVertices", - "GeneratedAllAssoc2RecoMultiMatched_NumVertices", 100, 0., 200.); + "GenAllAssoc2RecoMultiMatched_NumVertices", "GeneratedAllAssoc2RecoMultiMatched_NumVertices", 100, 0., 200.); mes_[label]["GenAllAssoc2RecoMultiMatched_X"] = - i.book1D("GenAllAssoc2RecoMultiMatched_X", - "GeneratedAllAssoc2RecoMultiMatched_X", 120, -0.6, 0.6); + i.book1D("GenAllAssoc2RecoMultiMatched_X", "GeneratedAllAssoc2RecoMultiMatched_X", 120, -0.6, 0.6); mes_[label]["GenAllAssoc2RecoMultiMatched_Y"] = - i.book1D("GenAllAssoc2RecoMultiMatched_Y", - "GeneratedAllAssoc2RecoMultiMatched_Y", 120, -0.6, 0.6); + i.book1D("GenAllAssoc2RecoMultiMatched_Y", "GeneratedAllAssoc2RecoMultiMatched_Y", 120, -0.6, 0.6); mes_[label]["GenAllAssoc2RecoMultiMatched_Z"] = - i.book1D("GenAllAssoc2RecoMultiMatched_Z", - "GeneratedAllAssoc2RecoMultiMatched_Z", 120, -60, 60); + i.book1D("GenAllAssoc2RecoMultiMatched_Z", "GeneratedAllAssoc2RecoMultiMatched_Z", 120, -60, 60); mes_[label]["GenAllAssoc2RecoMultiMatched_R"] = - i.book1D("GenAllAssoc2RecoMultiMatched_R", - "GeneratedAllAssoc2RecoMultiMatched_R", 120, 0, 0.6); - mes_[label]["GenAllAssoc2RecoMultiMatched_Pt2"] = - i.book1D("GenAllAssoc2RecoMultiMatched_Pt2", - "GeneratedAllAssoc2RecoMultiMatched_Sum-pt2", - 15, &log_pt2_bins[0]); - mes_[label]["GenAllAssoc2RecoMultiMatched_NumTracks"] = - i.book1D("GenAllAssoc2RecoMultiMatched_NumTracks", - "GeneratedAllAssoc2RecoMultiMatched_NumTracks", 24, &log_ntrk_bins[0]); - mes_[label]["GenAllAssoc2RecoMultiMatched_ClosestDistanceZ"] = i.book1D( - "GenAllAssoc2RecoMultiMatched_ClosestDistanceZ", - "GeneratedAllAssoc2RecoMultiMatched_ClosestDistanceZ", - 30, &log_bins[0]); + i.book1D("GenAllAssoc2RecoMultiMatched_R", "GeneratedAllAssoc2RecoMultiMatched_R", 120, 0, 0.6); + mes_[label]["GenAllAssoc2RecoMultiMatched_Pt2"] = i.book1D( + "GenAllAssoc2RecoMultiMatched_Pt2", "GeneratedAllAssoc2RecoMultiMatched_Sum-pt2", 15, &log_pt2_bins[0]); + mes_[label]["GenAllAssoc2RecoMultiMatched_NumTracks"] = i.book1D("GenAllAssoc2RecoMultiMatched_NumTracks", + "GeneratedAllAssoc2RecoMultiMatched_NumTracks", + 24, + &log_ntrk_bins[0]); + mes_[label]["GenAllAssoc2RecoMultiMatched_ClosestDistanceZ"] = + i.book1D("GenAllAssoc2RecoMultiMatched_ClosestDistanceZ", + "GeneratedAllAssoc2RecoMultiMatched_ClosestDistanceZ", + 30, + &log_bins[0]); // All Reco Vertices. Used for {Fake,Duplicate}-Rate plots mes_[label]["RecoAllAssoc2Gen_NumVertices"] = - i.book1D("RecoAllAssoc2Gen_NumVertices", - "ReconstructedAllAssoc2Gen_NumVertices", 100, 0., 200.); - mes_[label]["RecoAllAssoc2Gen_X"] = i.book1D( - "RecoAllAssoc2Gen_X", "ReconstructedAllAssoc2Gen_X", 120, -0.6, 0.6); - mes_[label]["RecoAllAssoc2Gen_Y"] = i.book1D( - "RecoAllAssoc2Gen_Y", "ReconstructedAllAssoc2Gen_Y", 120, -0.6, 0.6); - mes_[label]["RecoAllAssoc2Gen_Z"] = i.book1D( - "RecoAllAssoc2Gen_Z", "ReconstructedAllAssoc2Gen_Z", 120, -60, 60); - mes_[label]["RecoAllAssoc2Gen_R"] = i.book1D( - "RecoAllAssoc2Gen_R", "ReconstructedAllAssoc2Gen_R", 120, 0, 0.6); + i.book1D("RecoAllAssoc2Gen_NumVertices", "ReconstructedAllAssoc2Gen_NumVertices", 100, 0., 200.); + mes_[label]["RecoAllAssoc2Gen_X"] = i.book1D("RecoAllAssoc2Gen_X", "ReconstructedAllAssoc2Gen_X", 120, -0.6, 0.6); + mes_[label]["RecoAllAssoc2Gen_Y"] = i.book1D("RecoAllAssoc2Gen_Y", "ReconstructedAllAssoc2Gen_Y", 120, -0.6, 0.6); + mes_[label]["RecoAllAssoc2Gen_Z"] = i.book1D("RecoAllAssoc2Gen_Z", "ReconstructedAllAssoc2Gen_Z", 120, -60, 60); + mes_[label]["RecoAllAssoc2Gen_R"] = i.book1D("RecoAllAssoc2Gen_R", "ReconstructedAllAssoc2Gen_R", 120, 0, 0.6); mes_[label]["RecoAllAssoc2Gen_Pt2"] = - i.book1D("RecoAllAssoc2Gen_Pt2", "ReconstructedAllAssoc2Gen_Sum-pt2", - 15, &log_pt2_bins[0]); + i.book1D("RecoAllAssoc2Gen_Pt2", "ReconstructedAllAssoc2Gen_Sum-pt2", 15, &log_pt2_bins[0]); mes_[label]["RecoAllAssoc2Gen_Ndof"] = - i.book1D("RecoAllAssoc2Gen_Ndof", - "ReconstructedAllAssoc2Gen_Ndof", 120, 0., 240.); + i.book1D("RecoAllAssoc2Gen_Ndof", "ReconstructedAllAssoc2Gen_Ndof", 120, 0., 240.); mes_[label]["RecoAllAssoc2Gen_NumTracks"] = - i.book1D("RecoAllAssoc2Gen_NumTracks", - "ReconstructedAllAssoc2Gen_NumTracks", 24, &log_ntrk_bins[0]); - mes_[label]["RecoAllAssoc2Gen_PU"] = - i.book1D("RecoAllAssoc2Gen_PU", - "ReconstructedAllAssoc2Gen_PU", 125, 0., 250.); + i.book1D("RecoAllAssoc2Gen_NumTracks", "ReconstructedAllAssoc2Gen_NumTracks", 24, &log_ntrk_bins[0]); + mes_[label]["RecoAllAssoc2Gen_PU"] = i.book1D("RecoAllAssoc2Gen_PU", "ReconstructedAllAssoc2Gen_PU", 125, 0., 250.); mes_[label]["RecoAllAssoc2Gen_ClosestDistanceZ"] = - i.book1D("RecoAllAssoc2Gen_ClosestDistanceZ", - "ReconstructedAllAssoc2Gen_ClosestDistanceZ", - 30, &log_bins[0]); + i.book1D("RecoAllAssoc2Gen_ClosestDistanceZ", "ReconstructedAllAssoc2Gen_ClosestDistanceZ", 30, &log_bins[0]); mes_[label]["RecoAllAssoc2GenProperties"] = - i.book1D("RecoAllAssoc2GenProperties", - "ReconstructedAllAssoc2Gen_Properties", 8, -0.5, 7.5); + i.book1D("RecoAllAssoc2GenProperties", "ReconstructedAllAssoc2Gen_Properties", 8, -0.5, 7.5); mes_[label]["RecoAllAssoc2Gen_PairDistanceZ"] = - i.book1D("RecoAllAssoc2Gen_PairDistanceZ", - "RecoAllAssoc2Gen_PairDistanceZ", 1000, 0, 20); + i.book1D("RecoAllAssoc2Gen_PairDistanceZ", "RecoAllAssoc2Gen_PairDistanceZ", 1000, 0, 20); // All Reconstructed Vertices Matched to a Generated vertex. Used // for Fake-Rate plots mes_[label]["RecoAllAssoc2GenMatched_NumVertices"] = - i.book1D("RecoAllAssoc2GenMatched_NumVertices", - "ReconstructedAllAssoc2GenMatched_NumVertices", 100, 0., 200.); + i.book1D("RecoAllAssoc2GenMatched_NumVertices", "ReconstructedAllAssoc2GenMatched_NumVertices", 100, 0., 200.); mes_[label]["RecoAllAssoc2GenMatched_X"] = - i.book1D("RecoAllAssoc2GenMatched_X", - "ReconstructedAllAssoc2GenMatched_X", 120, -0.6, 0.6); + i.book1D("RecoAllAssoc2GenMatched_X", "ReconstructedAllAssoc2GenMatched_X", 120, -0.6, 0.6); mes_[label]["RecoAllAssoc2GenMatched_Y"] = - i.book1D("RecoAllAssoc2GenMatched_Y", - "ReconstructedAllAssoc2GenMatched_Y", 120, -0.6, 0.6); + i.book1D("RecoAllAssoc2GenMatched_Y", "ReconstructedAllAssoc2GenMatched_Y", 120, -0.6, 0.6); mes_[label]["RecoAllAssoc2GenMatched_Z"] = - i.book1D("RecoAllAssoc2GenMatched_Z", - "ReconstructedAllAssoc2GenMatched_Z", 120, -60, 60); + i.book1D("RecoAllAssoc2GenMatched_Z", "ReconstructedAllAssoc2GenMatched_Z", 120, -60, 60); mes_[label]["RecoAllAssoc2GenMatched_R"] = - i.book1D("RecoAllAssoc2GenMatched_R", - "ReconstructedAllAssoc2GenMatched_R", 120, 0, 0.6); + i.book1D("RecoAllAssoc2GenMatched_R", "ReconstructedAllAssoc2GenMatched_R", 120, 0, 0.6); mes_[label]["RecoAllAssoc2GenMatched_Pt2"] = - i.book1D("RecoAllAssoc2GenMatched_Pt2", - "ReconstructedAllAssoc2GenMatched_Sum-pt2", - 15, &log_pt2_bins[0]); + i.book1D("RecoAllAssoc2GenMatched_Pt2", "ReconstructedAllAssoc2GenMatched_Sum-pt2", 15, &log_pt2_bins[0]); mes_[label]["RecoAllAssoc2GenMatched_Ndof"] = - i.book1D("RecoAllAssoc2GenMatched_Ndof", - "ReconstructedAllAssoc2GenMatched_Ndof", 120, 0., 240.); - mes_[label]["RecoAllAssoc2GenMatched_NumTracks"] = - i.book1D("RecoAllAssoc2GenMatched_NumTracks", - "ReconstructedAllAssoc2GenMatched_NumTracks", 24, &log_ntrk_bins[0]); + i.book1D("RecoAllAssoc2GenMatched_Ndof", "ReconstructedAllAssoc2GenMatched_Ndof", 120, 0., 240.); + mes_[label]["RecoAllAssoc2GenMatched_NumTracks"] = i.book1D( + "RecoAllAssoc2GenMatched_NumTracks", "ReconstructedAllAssoc2GenMatched_NumTracks", 24, &log_ntrk_bins[0]); mes_[label]["RecoAllAssoc2GenMatched_PU"] = - i.book1D("RecoAllAssoc2GenMatched_PU", - "ReconstructedAllAssoc2GenMatched_PU", 125, 0., 250.); - mes_[label]["RecoAllAssoc2GenMatched_ClosestDistanceZ"] = i.book1D( - "RecoAllAssoc2GenMatched_ClosestDistanceZ", - "ReconstructedAllAssoc2GenMatched_ClosestDistanceZ", 30, &log_bins[0]); + i.book1D("RecoAllAssoc2GenMatched_PU", "ReconstructedAllAssoc2GenMatched_PU", 125, 0., 250.); + mes_[label]["RecoAllAssoc2GenMatched_ClosestDistanceZ"] = + i.book1D("RecoAllAssoc2GenMatched_ClosestDistanceZ", + "ReconstructedAllAssoc2GenMatched_ClosestDistanceZ", + 30, + &log_bins[0]); // All Reconstructed Vertices Multi-Matched to a Generated vertex. Used // for Merge-Rate plots mes_[label]["RecoAllAssoc2GenMultiMatched_NumVertices"] = i.book1D( - "RecoAllAssoc2GenMultiMatched_NumVertices", - "ReconstructedAllAssoc2GenMultiMatched_NumVertices", 100, 0., 200.); + "RecoAllAssoc2GenMultiMatched_NumVertices", "ReconstructedAllAssoc2GenMultiMatched_NumVertices", 100, 0., 200.); mes_[label]["RecoAllAssoc2GenMultiMatched_X"] = - i.book1D("RecoAllAssoc2GenMultiMatched_X", - "ReconstructedAllAssoc2GenMultiMatched_X", 120, -0.6, 0.6); + i.book1D("RecoAllAssoc2GenMultiMatched_X", "ReconstructedAllAssoc2GenMultiMatched_X", 120, -0.6, 0.6); mes_[label]["RecoAllAssoc2GenMultiMatched_Y"] = - i.book1D("RecoAllAssoc2GenMultiMatched_Y", - "ReconstructedAllAssoc2GenMultiMatched_Y", 120, -0.6, 0.6); + i.book1D("RecoAllAssoc2GenMultiMatched_Y", "ReconstructedAllAssoc2GenMultiMatched_Y", 120, -0.6, 0.6); mes_[label]["RecoAllAssoc2GenMultiMatched_Z"] = - i.book1D("RecoAllAssoc2GenMultiMatched_Z", - "ReconstructedAllAssoc2GenMultiMatched_Z", 120, -60, 60); + i.book1D("RecoAllAssoc2GenMultiMatched_Z", "ReconstructedAllAssoc2GenMultiMatched_Z", 120, -60, 60); mes_[label]["RecoAllAssoc2GenMultiMatched_R"] = - i.book1D("RecoAllAssoc2GenMultiMatched_R", - "ReconstructedAllAssoc2GenMultiMatched_R", 120, 0, 0.6); + i.book1D("RecoAllAssoc2GenMultiMatched_R", "ReconstructedAllAssoc2GenMultiMatched_R", 120, 0, 0.6); mes_[label]["RecoAllAssoc2GenMultiMatched_Pt2"] = i.book1D( - "RecoAllAssoc2GenMultiMatched_Pt2", - "ReconstructedAllAssoc2GenMultiMatched_Sum-pt2", 15, &log_pt2_bins[0]); - mes_[label]["RecoAllAssoc2GenMultiMatched_NumTracks"] = i.book1D( - "RecoAllAssoc2GenMultiMatched_NumTracks", - "ReconstructedAllAssoc2GenMultiMatched_NumTracks", 24, &log_ntrk_bins[0]); + "RecoAllAssoc2GenMultiMatched_Pt2", "ReconstructedAllAssoc2GenMultiMatched_Sum-pt2", 15, &log_pt2_bins[0]); + mes_[label]["RecoAllAssoc2GenMultiMatched_NumTracks"] = i.book1D("RecoAllAssoc2GenMultiMatched_NumTracks", + "ReconstructedAllAssoc2GenMultiMatched_NumTracks", + 24, + &log_ntrk_bins[0]); mes_[label]["RecoAllAssoc2GenMultiMatched_PU"] = - i.book1D("RecoAllAssoc2GenMultiMatched_PU", - "ReconstructedAllAssoc2GenMultiMatched_PU", 125, 0., 250.); + i.book1D("RecoAllAssoc2GenMultiMatched_PU", "ReconstructedAllAssoc2GenMultiMatched_PU", 125, 0., 250.); mes_[label]["RecoAllAssoc2GenMultiMatched_ClosestDistanceZ"] = i.book1D("RecoAllAssoc2GenMultiMatched_ClosestDistanceZ", "ReconstructedAllAssoc2GenMultiMatched_ClosestDistanceZ", - log_mergez_bins.size()-1, &log_mergez_bins[0]); + log_mergez_bins.size() - 1, + &log_mergez_bins[0]); // All Reconstructed Vertices Matched to a Multi-Matched Gen // Vertex. Used for Duplicate rate plots done w.r.t. Reco @@ -476,38 +367,32 @@ void PrimaryVertexAnalyzer4PUSlimmed::bookHistograms( // has been reconstructed and associated to a SimulatedVTX that // has been linked to at least another RecoVTX. In this sense this // RecoVTX is a duplicate of the same, real GenVTX. - mes_[label]["RecoAllAssoc2MultiMatchedGen_NumVertices"] = i.book1D( - "RecoAllAssoc2MultiMatchedGen_NumVertices", - "RecoAllAssoc2MultiMatchedGen_NumVertices", 100, 0., 200.); + mes_[label]["RecoAllAssoc2MultiMatchedGen_NumVertices"] = + i.book1D("RecoAllAssoc2MultiMatchedGen_NumVertices", "RecoAllAssoc2MultiMatchedGen_NumVertices", 100, 0., 200.); mes_[label]["RecoAllAssoc2MultiMatchedGen_X"] = - i.book1D("RecoAllAssoc2MultiMatchedGen_X", - "RecoAllAssoc2MultiMatchedGen_X", 120, -0.6, 0.6); + i.book1D("RecoAllAssoc2MultiMatchedGen_X", "RecoAllAssoc2MultiMatchedGen_X", 120, -0.6, 0.6); mes_[label]["RecoAllAssoc2MultiMatchedGen_Y"] = - i.book1D("RecoAllAssoc2MultiMatchedGen_Y", - "RecoAllAssoc2MultiMatchedGen_Y", 120, -0.6, 0.6); + i.book1D("RecoAllAssoc2MultiMatchedGen_Y", "RecoAllAssoc2MultiMatchedGen_Y", 120, -0.6, 0.6); mes_[label]["RecoAllAssoc2MultiMatchedGen_Z"] = - i.book1D("RecoAllAssoc2MultiMatchedGen_Z", - "RecoAllAssoc2MultiMatchedGen_Z", 120, -60, 60); + i.book1D("RecoAllAssoc2MultiMatchedGen_Z", "RecoAllAssoc2MultiMatchedGen_Z", 120, -60, 60); mes_[label]["RecoAllAssoc2MultiMatchedGen_R"] = - i.book1D("RecoAllAssoc2MultiMatchedGen_R", - "RecoAllAssoc2MultiMatchedGen_R", 120, 0, 0.6); + i.book1D("RecoAllAssoc2MultiMatchedGen_R", "RecoAllAssoc2MultiMatchedGen_R", 120, 0, 0.6); mes_[label]["RecoAllAssoc2MultiMatchedGen_Pt2"] = - i.book1D("RecoAllAssoc2MultiMatchedGen_Pt2", - "RecoAllAssoc2MultiMatchedGen_Sum-pt2", 15, &log_pt2_bins[0]); - mes_[label]["RecoAllAssoc2MultiMatchedGen_NumTracks"] = - i.book1D("RecoAllAssoc2MultiMatchedGen_NumTracks", - "RecoAllAssoc2MultiMatchedGen_NumTracks", 24, &log_ntrk_bins[0]); + i.book1D("RecoAllAssoc2MultiMatchedGen_Pt2", "RecoAllAssoc2MultiMatchedGen_Sum-pt2", 15, &log_pt2_bins[0]); + mes_[label]["RecoAllAssoc2MultiMatchedGen_NumTracks"] = i.book1D( + "RecoAllAssoc2MultiMatchedGen_NumTracks", "RecoAllAssoc2MultiMatchedGen_NumTracks", 24, &log_ntrk_bins[0]); mes_[label]["RecoAllAssoc2MultiMatchedGen_PU"] = - i.book1D("RecoAllAssoc2MultiMatchedGen_PU", - "RecoAllAssoc2MultiMatchedGen_PU", 125, 0., 250.); - mes_[label]["RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ"] = i.book1D( - "RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ", - "RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ", 30, &log_bins[0]); - mes_[label]["RecoAllAssoc2GenSimForMerge_ClosestDistanceZ"] = i.book1D( - "RecoAllAssoc2GenSimForMerge_ClosestDistanceZ", - "RecoAllAssoc2GenSimForMerge_ClosestDistanceZ", - log_mergez_bins.size()-1, &log_mergez_bins[0]); - + i.book1D("RecoAllAssoc2MultiMatchedGen_PU", "RecoAllAssoc2MultiMatchedGen_PU", 125, 0., 250.); + mes_[label]["RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ"] = + i.book1D("RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ", + "RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ", + 30, + &log_bins[0]); + mes_[label]["RecoAllAssoc2GenSimForMerge_ClosestDistanceZ"] = + i.book1D("RecoAllAssoc2GenSimForMerge_ClosestDistanceZ", + "RecoAllAssoc2GenSimForMerge_ClosestDistanceZ", + log_mergez_bins.size() - 1, + &log_mergez_bins[0]); // Resolution and pull histograms const double resolpt2 = 10; @@ -517,65 +402,67 @@ void PrimaryVertexAnalyzer4PUSlimmed::bookHistograms( const double nPull = 100; auto bookResolPull = [&](const std::string& prefix, const double resolx, const double resoly, const double resolz) { - book1d((prefix+"_ResolX" ).c_str(), 100,-resolx,resolx); - book1d((prefix+"_ResolY" ).c_str(), 100,-resoly,resoly); - book1d((prefix+"_ResolZ" ).c_str(), 100,-resolz,resolz); - book1d((prefix+"_ResolPt2").c_str(), 100,-resolpt2,resolpt2); - book1d((prefix+"_PullX" ).c_str(), 250,-25,25); - book1d((prefix+"_PullY" ).c_str(), 250,-25,25); - book1d((prefix+"_PullZ" ).c_str(), 250,-25,25); - - book2d((prefix+"_ResolX_vs_PU" ).c_str(), 125,0.,250., 100,-resolx,resolx); - book2d((prefix+"_ResolY_vs_PU" ).c_str(), 125,0.,250., 100,-resoly,resoly); - book2d((prefix+"_ResolZ_vs_PU" ).c_str(), 125,0.,250., 100,-resolz,resolz); - book2d((prefix+"_ResolPt2_vs_PU").c_str(), 125,0.,250., 100,-resolpt2,resolpt2); - book2d((prefix+"_PullX_vs_PU" ).c_str(), 125,0.,250., nPull,minPull,maxPull); - book2d((prefix+"_PullY_vs_PU" ).c_str(), 125,0.,250., nPull,minPull,maxPull); - book2d((prefix+"_PullZ_vs_PU" ).c_str(), 125,0.,250., nPull,minPull,maxPull); - - book2dlogx((prefix+"_ResolX_vs_NumTracks" ).c_str(), 24,&log_ntrk_bins[0], 100,-resolx,resolx); - book2dlogx((prefix+"_ResolY_vs_NumTracks" ).c_str(), 24,&log_ntrk_bins[0], 100,-resoly,resoly); - book2dlogx((prefix+"_ResolZ_vs_NumTracks" ).c_str(), 24,&log_ntrk_bins[0], 100,-resolz,resolz); - book2dlogx((prefix+"_ResolPt2_vs_NumTracks").c_str(), 24,&log_ntrk_bins[0], 100,-resolpt2,resolpt2); - book2dlogx((prefix+"_PullX_vs_NumTracks" ).c_str(), 24,&log_ntrk_bins[0], nPull,minPull,maxPull); - book2dlogx((prefix+"_PullY_vs_NumTracks" ).c_str(), 24,&log_ntrk_bins[0], nPull,minPull,maxPull); - book2dlogx((prefix+"_PullZ_vs_NumTracks" ).c_str(), 24,&log_ntrk_bins[0], nPull,minPull,maxPull); - - book2d((prefix+"_ResolX_vs_Z" ).c_str(), 120,-60,60, 100,-resolx,resolx); - book2d((prefix+"_ResolY_vs_Z" ).c_str(), 120,-60,60, 100,-resoly,resoly); - book2d((prefix+"_ResolZ_vs_Z" ).c_str(), 120,-60,60, 100,-resolz,resolz); - book2d((prefix+"_ResolPt2_vs_Z").c_str(), 120,-60,60, 100,-resolpt2,resolpt2); - book2d((prefix+"_PullX_vs_Z" ).c_str(), 120,-60,60, nPull,minPull,maxPull); - book2d((prefix+"_PullY_vs_Z" ).c_str(), 120,-60,60, nPull,minPull,maxPull); - book2d((prefix+"_PullZ_vs_Z" ).c_str(), 120,-60,60, nPull,minPull,maxPull); - - book2dlogx((prefix+"_ResolX_vs_Pt" ).c_str(), log_pt_bins.size()-1,&log_pt_bins[0], 100,-resolx,resolx); - book2dlogx((prefix+"_ResolY_vs_Pt" ).c_str(), log_pt_bins.size()-1,&log_pt_bins[0], 100,-resoly,resoly); - book2dlogx((prefix+"_ResolZ_vs_Pt" ).c_str(), log_pt_bins.size()-1,&log_pt_bins[0], 100,-resolz,resolz); - book2dlogx((prefix+"_ResolPt2_vs_Pt").c_str(), log_pt_bins.size()-1,&log_pt_bins[0], 100,-resolpt2,resolpt2); - book2dlogx((prefix+"_PullX_vs_Pt" ).c_str(), log_pt_bins.size()-1,&log_pt_bins[0], nPull,minPull,maxPull); - book2dlogx((prefix+"_PullY_vs_Pt" ).c_str(), log_pt_bins.size()-1,&log_pt_bins[0], nPull,minPull,maxPull); - book2dlogx((prefix+"_PullZ_vs_Pt" ).c_str(), log_pt_bins.size()-1,&log_pt_bins[0], nPull,minPull,maxPull); + book1d((prefix + "_ResolX").c_str(), 100, -resolx, resolx); + book1d((prefix + "_ResolY").c_str(), 100, -resoly, resoly); + book1d((prefix + "_ResolZ").c_str(), 100, -resolz, resolz); + book1d((prefix + "_ResolPt2").c_str(), 100, -resolpt2, resolpt2); + book1d((prefix + "_PullX").c_str(), 250, -25, 25); + book1d((prefix + "_PullY").c_str(), 250, -25, 25); + book1d((prefix + "_PullZ").c_str(), 250, -25, 25); + + book2d((prefix + "_ResolX_vs_PU").c_str(), 125, 0., 250., 100, -resolx, resolx); + book2d((prefix + "_ResolY_vs_PU").c_str(), 125, 0., 250., 100, -resoly, resoly); + book2d((prefix + "_ResolZ_vs_PU").c_str(), 125, 0., 250., 100, -resolz, resolz); + book2d((prefix + "_ResolPt2_vs_PU").c_str(), 125, 0., 250., 100, -resolpt2, resolpt2); + book2d((prefix + "_PullX_vs_PU").c_str(), 125, 0., 250., nPull, minPull, maxPull); + book2d((prefix + "_PullY_vs_PU").c_str(), 125, 0., 250., nPull, minPull, maxPull); + book2d((prefix + "_PullZ_vs_PU").c_str(), 125, 0., 250., nPull, minPull, maxPull); + + book2dlogx((prefix + "_ResolX_vs_NumTracks").c_str(), 24, &log_ntrk_bins[0], 100, -resolx, resolx); + book2dlogx((prefix + "_ResolY_vs_NumTracks").c_str(), 24, &log_ntrk_bins[0], 100, -resoly, resoly); + book2dlogx((prefix + "_ResolZ_vs_NumTracks").c_str(), 24, &log_ntrk_bins[0], 100, -resolz, resolz); + book2dlogx((prefix + "_ResolPt2_vs_NumTracks").c_str(), 24, &log_ntrk_bins[0], 100, -resolpt2, resolpt2); + book2dlogx((prefix + "_PullX_vs_NumTracks").c_str(), 24, &log_ntrk_bins[0], nPull, minPull, maxPull); + book2dlogx((prefix + "_PullY_vs_NumTracks").c_str(), 24, &log_ntrk_bins[0], nPull, minPull, maxPull); + book2dlogx((prefix + "_PullZ_vs_NumTracks").c_str(), 24, &log_ntrk_bins[0], nPull, minPull, maxPull); + + book2d((prefix + "_ResolX_vs_Z").c_str(), 120, -60, 60, 100, -resolx, resolx); + book2d((prefix + "_ResolY_vs_Z").c_str(), 120, -60, 60, 100, -resoly, resoly); + book2d((prefix + "_ResolZ_vs_Z").c_str(), 120, -60, 60, 100, -resolz, resolz); + book2d((prefix + "_ResolPt2_vs_Z").c_str(), 120, -60, 60, 100, -resolpt2, resolpt2); + book2d((prefix + "_PullX_vs_Z").c_str(), 120, -60, 60, nPull, minPull, maxPull); + book2d((prefix + "_PullY_vs_Z").c_str(), 120, -60, 60, nPull, minPull, maxPull); + book2d((prefix + "_PullZ_vs_Z").c_str(), 120, -60, 60, nPull, minPull, maxPull); + + book2dlogx((prefix + "_ResolX_vs_Pt").c_str(), log_pt_bins.size() - 1, &log_pt_bins[0], 100, -resolx, resolx); + book2dlogx((prefix + "_ResolY_vs_Pt").c_str(), log_pt_bins.size() - 1, &log_pt_bins[0], 100, -resoly, resoly); + book2dlogx((prefix + "_ResolZ_vs_Pt").c_str(), log_pt_bins.size() - 1, &log_pt_bins[0], 100, -resolz, resolz); + book2dlogx( + (prefix + "_ResolPt2_vs_Pt").c_str(), log_pt_bins.size() - 1, &log_pt_bins[0], 100, -resolpt2, resolpt2); + book2dlogx((prefix + "_PullX_vs_Pt").c_str(), log_pt_bins.size() - 1, &log_pt_bins[0], nPull, minPull, maxPull); + book2dlogx((prefix + "_PullY_vs_Pt").c_str(), log_pt_bins.size() - 1, &log_pt_bins[0], nPull, minPull, maxPull); + book2dlogx((prefix + "_PullZ_vs_Pt").c_str(), log_pt_bins.size() - 1, &log_pt_bins[0], nPull, minPull, maxPull); }; - bookResolPull("RecoAllAssoc2GenMatched" , 0.1 , 0.1 , 0.1 ); // Non-merged vertices - bookResolPull("RecoAllAssoc2GenMatchedMerged", 0.1 , 0.1 , 0.1 ); // Merged vertices - bookResolPull("RecoPVAssoc2GenPVMatched" , 0.01, 0.01, 0.01); // PV, when correctly matched, regardless if merged or not + bookResolPull("RecoAllAssoc2GenMatched", 0.1, 0.1, 0.1); // Non-merged vertices + bookResolPull("RecoAllAssoc2GenMatchedMerged", 0.1, 0.1, 0.1); // Merged vertices + bookResolPull( + "RecoPVAssoc2GenPVMatched", 0.01, 0.01, 0.01); // PV, when correctly matched, regardless if merged or not // Purity histograms // Reco PV (vtx0) matched to hard-scatter gen vertex book1d("RecoPVAssoc2GenPVMatched_Purity", 50, 0, 1); book1d("RecoPVAssoc2GenPVMatched_Missing", 50, 0, 1); - book2d("RecoPVAssoc2GenPVMatched_Purity_vs_Index", 100,0,100, 50,0,1); + book2d("RecoPVAssoc2GenPVMatched_Purity_vs_Index", 100, 0, 100, 50, 0, 1); // RECO PV (vtx0) not matched to hard-scatter gen vertex book1d("RecoPVAssoc2GenPVNotMatched_Purity", 50, 0, 1); book1d("RecoPVAssoc2GenPVNotMatched_Missing", 50, 0, 1); - book2d("RecoPVAssoc2GenPVNotMatched_Purity_vs_Index", 100,0,100, 50,0,1); + book2d("RecoPVAssoc2GenPVNotMatched_Purity_vs_Index", 100, 0, 100, 50, 0, 1); // Purity vs. fake rate - book1d("RecoAllAssoc2Gen_Purity", 50, 0, 1); // denominator - book1d("RecoAllAssoc2GenMatched_Purity", 50, 0, 1); // 1-numerator + book1d("RecoAllAssoc2Gen_Purity", 50, 0, 1); // denominator + book1d("RecoAllAssoc2GenMatched_Purity", 50, 0, 1); // 1-numerator // Vertex sum(pt2) // The first two are orthogonal (i.e. their sum includes all reco vertices) @@ -598,8 +485,7 @@ void PrimaryVertexAnalyzer4PUSlimmed::bookHistograms( } } -void PrimaryVertexAnalyzer4PUSlimmed::fillGenericGenVertexHistograms( - const simPrimaryVertex& v) { +void PrimaryVertexAnalyzer4PUSlimmed::fillGenericGenVertexHistograms(const simPrimaryVertex& v) { if (v.eventId.event() == 0) { mes_["root_folder"]["GenPV_X"]->Fill(v.x); mes_["root_folder"]["GenPV_Y"]->Fill(v.y); @@ -608,8 +494,7 @@ void PrimaryVertexAnalyzer4PUSlimmed::fillGenericGenVertexHistograms( mes_["root_folder"]["GenPV_Pt2"]->Fill(v.ptsq); mes_["root_folder"]["GenPV_NumTracks"]->Fill(v.nGenTrk); if (v.closest_vertex_distance_z > 0.) - mes_["root_folder"]["GenPV_ClosestDistanceZ"] - ->Fill(v.closest_vertex_distance_z); + mes_["root_folder"]["GenPV_ClosestDistanceZ"]->Fill(v.closest_vertex_distance_z); } mes_["root_folder"]["GenAllV_X"]->Fill(v.x); mes_["root_folder"]["GenAllV_Y"]->Fill(v.y); @@ -618,13 +503,11 @@ void PrimaryVertexAnalyzer4PUSlimmed::fillGenericGenVertexHistograms( mes_["root_folder"]["GenAllV_Pt2"]->Fill(v.ptsq); mes_["root_folder"]["GenAllV_NumTracks"]->Fill(v.nGenTrk); if (v.closest_vertex_distance_z > 0.) - mes_["root_folder"]["GenAllV_ClosestDistanceZ"] - ->Fill(v.closest_vertex_distance_z); + mes_["root_folder"]["GenAllV_ClosestDistanceZ"]->Fill(v.closest_vertex_distance_z); } void PrimaryVertexAnalyzer4PUSlimmed::fillRecoAssociatedGenVertexHistograms( - const std::string& label, - const PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex& v) { + const std::string& label, const PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex& v) { mes_[label]["GenAllAssoc2Reco_X"]->Fill(v.x); mes_[label]["GenAllAssoc2Reco_Y"]->Fill(v.y); mes_[label]["GenAllAssoc2Reco_Z"]->Fill(v.z); @@ -632,8 +515,7 @@ void PrimaryVertexAnalyzer4PUSlimmed::fillRecoAssociatedGenVertexHistograms( mes_[label]["GenAllAssoc2Reco_Pt2"]->Fill(v.ptsq); mes_[label]["GenAllAssoc2Reco_NumTracks"]->Fill(v.nGenTrk); if (v.closest_vertex_distance_z > 0.) - mes_[label]["GenAllAssoc2Reco_ClosestDistanceZ"] - ->Fill(v.closest_vertex_distance_z); + mes_[label]["GenAllAssoc2Reco_ClosestDistanceZ"]->Fill(v.closest_vertex_distance_z); if (!v.rec_vertices.empty()) { mes_[label]["GenAllAssoc2RecoMatched_X"]->Fill(v.x); mes_[label]["GenAllAssoc2RecoMatched_Y"]->Fill(v.y); @@ -642,8 +524,7 @@ void PrimaryVertexAnalyzer4PUSlimmed::fillRecoAssociatedGenVertexHistograms( mes_[label]["GenAllAssoc2RecoMatched_Pt2"]->Fill(v.ptsq); mes_[label]["GenAllAssoc2RecoMatched_NumTracks"]->Fill(v.nGenTrk); if (v.closest_vertex_distance_z > 0.) - mes_[label]["GenAllAssoc2RecoMatched_ClosestDistanceZ"] - ->Fill(v.closest_vertex_distance_z); + mes_[label]["GenAllAssoc2RecoMatched_ClosestDistanceZ"]->Fill(v.closest_vertex_distance_z); } if (v.rec_vertices.size() > 1) { mes_[label]["GenAllAssoc2RecoMultiMatched_X"]->Fill(v.x); @@ -653,15 +534,12 @@ void PrimaryVertexAnalyzer4PUSlimmed::fillRecoAssociatedGenVertexHistograms( mes_[label]["GenAllAssoc2RecoMultiMatched_Pt2"]->Fill(v.ptsq); mes_[label]["GenAllAssoc2RecoMultiMatched_NumTracks"]->Fill(v.nGenTrk); if (v.closest_vertex_distance_z > 0.) - mes_[label]["GenAllAssoc2RecoMultiMatched_ClosestDistanceZ"] - ->Fill(v.closest_vertex_distance_z); + mes_[label]["GenAllAssoc2RecoMultiMatched_ClosestDistanceZ"]->Fill(v.closest_vertex_distance_z); } } void PrimaryVertexAnalyzer4PUSlimmed::fillRecoAssociatedGenPVHistograms( - const std::string& label, - const PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex& v, - bool genPVMatchedToRecoPV) { + const std::string& label, const PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex& v, bool genPVMatchedToRecoPV) { mes_[label]["GenPVAssoc2RecoPV_X"]->Fill(v.x); mes_[label]["GenPVAssoc2RecoPV_Y"]->Fill(v.y); mes_[label]["GenPVAssoc2RecoPV_Z"]->Fill(v.z); @@ -673,9 +551,7 @@ void PrimaryVertexAnalyzer4PUSlimmed::fillRecoAssociatedGenPVHistograms( } void PrimaryVertexAnalyzer4PUSlimmed::fillGenAssociatedRecoVertexHistograms( - const std::string& label, - int num_pileup_vertices, - PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex& v) { + const std::string& label, int num_pileup_vertices, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex& v) { mes_[label]["RecoAllAssoc2Gen_X"]->Fill(v.x); mes_[label]["RecoAllAssoc2Gen_Y"]->Fill(v.y); mes_[label]["RecoAllAssoc2Gen_Z"]->Fill(v.z); @@ -686,8 +562,7 @@ void PrimaryVertexAnalyzer4PUSlimmed::fillGenAssociatedRecoVertexHistograms( mes_[label]["RecoAllAssoc2Gen_PU"]->Fill(num_pileup_vertices); mes_[label]["RecoAllAssoc2Gen_Purity"]->Fill(v.purity); if (v.closest_vertex_distance_z > 0.) - mes_[label]["RecoAllAssoc2Gen_ClosestDistanceZ"] - ->Fill(v.closest_vertex_distance_z); + mes_[label]["RecoAllAssoc2Gen_ClosestDistanceZ"]->Fill(v.closest_vertex_distance_z); if (!v.sim_vertices.empty()) { v.kind_of_vertex |= recoPrimaryVertex::MATCHED; mes_[label]["RecoAllAssoc2GenMatched_X"]->Fill(v.x); @@ -700,8 +575,7 @@ void PrimaryVertexAnalyzer4PUSlimmed::fillGenAssociatedRecoVertexHistograms( mes_[label]["RecoAllAssoc2GenMatched_PU"]->Fill(num_pileup_vertices); mes_[label]["RecoAllAssoc2GenMatched_Purity"]->Fill(v.purity); if (v.closest_vertex_distance_z > 0.) - mes_[label]["RecoAllAssoc2GenMatched_ClosestDistanceZ"] - ->Fill(v.closest_vertex_distance_z); + mes_[label]["RecoAllAssoc2GenMatched_ClosestDistanceZ"]->Fill(v.closest_vertex_distance_z); // Fill resolution and pull plots here (as in MultiTrackValidator) fillResolutionAndPullHistograms(label, num_pileup_vertices, v, false); @@ -719,8 +593,7 @@ void PrimaryVertexAnalyzer4PUSlimmed::fillGenAssociatedRecoVertexHistograms( mes_[label]["RecoAllAssoc2MultiMatchedGen_NumTracks"]->Fill(v.nRecoTrk); mes_[label]["RecoAllAssoc2MultiMatchedGen_PU"]->Fill(num_pileup_vertices); if (v.closest_vertex_distance_z > 0.) - mes_[label]["RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ"] - ->Fill(v.closest_vertex_distance_z); + mes_[label]["RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ"]->Fill(v.closest_vertex_distance_z); } // This is meant to be used as "denominator" for the merge-rate // plots produced starting from reco quantities. We enter here @@ -729,8 +602,8 @@ void PrimaryVertexAnalyzer4PUSlimmed::fillGenAssociatedRecoVertexHistograms( // merge-rate plot coming from reco is not to be intended as a // pure efficiency-like plot, since the normalization is biased. if (v.sim_vertices_internal[0]->closest_vertex_distance_z > 0.) - mes_[label]["RecoAllAssoc2GenSimForMerge_ClosestDistanceZ"] - ->Fill(v.sim_vertices_internal[0]->closest_vertex_distance_z); + mes_[label]["RecoAllAssoc2GenSimForMerge_ClosestDistanceZ"]->Fill( + v.sim_vertices_internal[0]->closest_vertex_distance_z); } // this plots are meant to be used to compute the merge rate if (v.sim_vertices.size() > 1) { @@ -743,27 +616,25 @@ void PrimaryVertexAnalyzer4PUSlimmed::fillGenAssociatedRecoVertexHistograms( mes_[label]["RecoAllAssoc2GenMultiMatched_NumTracks"]->Fill(v.nRecoTrk); mes_[label]["RecoAllAssoc2GenMultiMatched_PU"]->Fill(num_pileup_vertices); if (v.sim_vertices_internal[0]->closest_vertex_distance_z > 0.) - mes_[label]["RecoAllAssoc2GenMultiMatched_ClosestDistanceZ"] - ->Fill(v.sim_vertices_internal[0]->closest_vertex_distance_z); + mes_[label]["RecoAllAssoc2GenMultiMatched_ClosestDistanceZ"]->Fill( + v.sim_vertices_internal[0]->closest_vertex_distance_z); } mes_[label]["RecoAllAssoc2GenProperties"]->Fill(v.kind_of_vertex); - std::string prefix; - if(v.sim_vertices.size() == 1) { + if (v.sim_vertices.size() == 1) { prefix = "RecoAllAssoc2GenSingleMatched_SharedTrackFraction"; - } - else if(v.sim_vertices.size() > 1) { + } else if (v.sim_vertices.size() > 1) { prefix = "RecoAllAssoc2GenMultiMatched_SharedTrackFraction"; } - for(size_t i=0; iFill(sharedTracks/v.nRecoTrk); - mes_[label][prefix+"RecoMatched"]->Fill(sharedTracks/v.num_matched_sim_tracks); - mes_[label][prefix+"Sim"]->Fill(sharedTracks/simV->nGenTrk); - mes_[label][prefix+"SimMatched"]->Fill(sharedTracks/simV->num_matched_reco_tracks); + const simPrimaryVertex* simV = v.sim_vertices_internal[i]; + mes_[label][prefix + "Reco"]->Fill(sharedTracks / v.nRecoTrk); + mes_[label][prefix + "RecoMatched"]->Fill(sharedTracks / v.num_matched_sim_tracks); + mes_[label][prefix + "Sim"]->Fill(sharedTracks / simV->nGenTrk); + mes_[label][prefix + "SimMatched"]->Fill(sharedTracks / simV->num_matched_reco_tracks); } } @@ -772,12 +643,11 @@ void PrimaryVertexAnalyzer4PUSlimmed::fillResolutionAndPullHistograms( int num_pileup_vertices, PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex& v, bool isPV) { - std::string prefix = "RecoAllAssoc2GenMatched"; - if(v.sim_vertices_internal.size() > 1) { + if (v.sim_vertices_internal.size() > 1) { prefix += "Merged"; } - if(isPV) { + if (isPV) { prefix = "RecoPVAssoc2GenPVMatched"; } @@ -792,62 +662,62 @@ void PrimaryVertexAnalyzer4PUSlimmed::fillResolutionAndPullHistograms( const double xresol = xres; const double yresol = yres; const double zresol = zres; - const double pt2resol = pt2res/v.ptsq; - const double xpull = xres/v.recVtx->xError(); - const double ypull = yres/v.recVtx->yError(); - const double zpull = zres/v.recVtx->zError(); - - mes_[label][prefix+"_ResolX"]->Fill(xresol); - mes_[label][prefix+"_ResolY"]->Fill(yresol); - mes_[label][prefix+"_ResolZ"]->Fill(zresol); - mes_[label][prefix+"_ResolPt2"]->Fill(pt2resol); - mes_[label][prefix+"_PullX"]->Fill(xpull); - mes_[label][prefix+"_PullY"]->Fill(ypull); - mes_[label][prefix+"_PullZ"]->Fill(zpull); - - mes_[label][prefix+"_ResolX_vs_PU"]->Fill(num_pileup_vertices, xresol); - mes_[label][prefix+"_ResolY_vs_PU"]->Fill(num_pileup_vertices, yresol); - mes_[label][prefix+"_ResolZ_vs_PU"]->Fill(num_pileup_vertices, zresol); - mes_[label][prefix+"_ResolPt2_vs_PU"]->Fill(num_pileup_vertices, pt2resol); - mes_[label][prefix+"_PullX_vs_PU"]->Fill(num_pileup_vertices, xpull); - mes_[label][prefix+"_PullY_vs_PU"]->Fill(num_pileup_vertices, ypull); - mes_[label][prefix+"_PullZ_vs_PU"]->Fill(num_pileup_vertices, zpull); - - mes_[label][prefix+"_ResolX_vs_NumTracks"]->Fill(v.nRecoTrk, xresol); - mes_[label][prefix+"_ResolY_vs_NumTracks"]->Fill(v.nRecoTrk, yresol); - mes_[label][prefix+"_ResolZ_vs_NumTracks"]->Fill(v.nRecoTrk, zresol); - mes_[label][prefix+"_ResolPt2_vs_NumTracks"]->Fill(v.nRecoTrk, pt2resol); - mes_[label][prefix+"_PullX_vs_NumTracks"]->Fill(v.nRecoTrk, xpull); - mes_[label][prefix+"_PullY_vs_NumTracks"]->Fill(v.nRecoTrk, ypull); - mes_[label][prefix+"_PullZ_vs_NumTracks"]->Fill(v.nRecoTrk, zpull); - - mes_[label][prefix+"_ResolX_vs_Z"]->Fill(v.z, xresol); - mes_[label][prefix+"_ResolY_vs_Z"]->Fill(v.z, yresol); - mes_[label][prefix+"_ResolZ_vs_Z"]->Fill(v.z, zresol); - mes_[label][prefix+"_ResolPt2_vs_Z"]->Fill(v.z, pt2resol); - mes_[label][prefix+"_PullX_vs_Z"]->Fill(v.z, xpull); - mes_[label][prefix+"_PullY_vs_Z"]->Fill(v.z, ypull); - mes_[label][prefix+"_PullZ_vs_Z"]->Fill(v.z, zpull); - - mes_[label][prefix+"_ResolX_vs_Pt"]->Fill(v.pt, xresol); - mes_[label][prefix+"_ResolY_vs_Pt"]->Fill(v.pt, yresol); - mes_[label][prefix+"_ResolZ_vs_Pt"]->Fill(v.pt, zresol); - mes_[label][prefix+"_ResolPt2_vs_Pt"]->Fill(v.pt, pt2resol); - mes_[label][prefix+"_PullX_vs_Pt"]->Fill(v.pt, xpull); - mes_[label][prefix+"_PullY_vs_Pt"]->Fill(v.pt, ypull); - mes_[label][prefix+"_PullZ_vs_Pt"]->Fill(v.pt, zpull); + const double pt2resol = pt2res / v.ptsq; + const double xpull = xres / v.recVtx->xError(); + const double ypull = yres / v.recVtx->yError(); + const double zpull = zres / v.recVtx->zError(); + + mes_[label][prefix + "_ResolX"]->Fill(xresol); + mes_[label][prefix + "_ResolY"]->Fill(yresol); + mes_[label][prefix + "_ResolZ"]->Fill(zresol); + mes_[label][prefix + "_ResolPt2"]->Fill(pt2resol); + mes_[label][prefix + "_PullX"]->Fill(xpull); + mes_[label][prefix + "_PullY"]->Fill(ypull); + mes_[label][prefix + "_PullZ"]->Fill(zpull); + + mes_[label][prefix + "_ResolX_vs_PU"]->Fill(num_pileup_vertices, xresol); + mes_[label][prefix + "_ResolY_vs_PU"]->Fill(num_pileup_vertices, yresol); + mes_[label][prefix + "_ResolZ_vs_PU"]->Fill(num_pileup_vertices, zresol); + mes_[label][prefix + "_ResolPt2_vs_PU"]->Fill(num_pileup_vertices, pt2resol); + mes_[label][prefix + "_PullX_vs_PU"]->Fill(num_pileup_vertices, xpull); + mes_[label][prefix + "_PullY_vs_PU"]->Fill(num_pileup_vertices, ypull); + mes_[label][prefix + "_PullZ_vs_PU"]->Fill(num_pileup_vertices, zpull); + + mes_[label][prefix + "_ResolX_vs_NumTracks"]->Fill(v.nRecoTrk, xresol); + mes_[label][prefix + "_ResolY_vs_NumTracks"]->Fill(v.nRecoTrk, yresol); + mes_[label][prefix + "_ResolZ_vs_NumTracks"]->Fill(v.nRecoTrk, zresol); + mes_[label][prefix + "_ResolPt2_vs_NumTracks"]->Fill(v.nRecoTrk, pt2resol); + mes_[label][prefix + "_PullX_vs_NumTracks"]->Fill(v.nRecoTrk, xpull); + mes_[label][prefix + "_PullY_vs_NumTracks"]->Fill(v.nRecoTrk, ypull); + mes_[label][prefix + "_PullZ_vs_NumTracks"]->Fill(v.nRecoTrk, zpull); + + mes_[label][prefix + "_ResolX_vs_Z"]->Fill(v.z, xresol); + mes_[label][prefix + "_ResolY_vs_Z"]->Fill(v.z, yresol); + mes_[label][prefix + "_ResolZ_vs_Z"]->Fill(v.z, zresol); + mes_[label][prefix + "_ResolPt2_vs_Z"]->Fill(v.z, pt2resol); + mes_[label][prefix + "_PullX_vs_Z"]->Fill(v.z, xpull); + mes_[label][prefix + "_PullY_vs_Z"]->Fill(v.z, ypull); + mes_[label][prefix + "_PullZ_vs_Z"]->Fill(v.z, zpull); + + mes_[label][prefix + "_ResolX_vs_Pt"]->Fill(v.pt, xresol); + mes_[label][prefix + "_ResolY_vs_Pt"]->Fill(v.pt, yresol); + mes_[label][prefix + "_ResolZ_vs_Pt"]->Fill(v.pt, zresol); + mes_[label][prefix + "_ResolPt2_vs_Pt"]->Fill(v.pt, pt2resol); + mes_[label][prefix + "_PullX_vs_Pt"]->Fill(v.pt, xpull); + mes_[label][prefix + "_PullY_vs_Pt"]->Fill(v.pt, ypull); + mes_[label][prefix + "_PullZ_vs_Pt"]->Fill(v.pt, zpull); } bool PrimaryVertexAnalyzer4PUSlimmed::matchRecoTrack2SimSignal(const reco::TrackBaseRef& recoTrack) { auto found = r2s_->find(recoTrack); // reco track not matched to any TP - if(found == r2s_->end()) + if (found == r2s_->end()) return false; // reco track matched to some TP from signal vertex - for(const auto& tp: found->val) { - if(tp.first->eventId().bunchCrossing() == 0 && tp.first->eventId().event() == 0) + for (const auto& tp : found->val) { + if (tp.first->eventId().bunchCrossing() == 0 && tp.first->eventId().event() == 0) return true; } @@ -855,12 +725,12 @@ bool PrimaryVertexAnalyzer4PUSlimmed::matchRecoTrack2SimSignal(const reco::Track return false; } -void PrimaryVertexAnalyzer4PUSlimmed::calculatePurityAndFillHistograms( - const std::string& label, - std::vector& recopvs, - int genpv_position_in_reco_collection, - bool signal_is_highest_pt) { - if(recopvs.empty()) return; +void PrimaryVertexAnalyzer4PUSlimmed::calculatePurityAndFillHistograms(const std::string& label, + std::vector& recopvs, + int genpv_position_in_reco_collection, + bool signal_is_highest_pt) { + if (recopvs.empty()) + return; std::vector vtx_sumpt_sigmatched; std::vector vtx_sumpt2_sigmatched; @@ -869,17 +739,17 @@ void PrimaryVertexAnalyzer4PUSlimmed::calculatePurityAndFillHistograms( vtx_sumpt2_sigmatched.reserve(recopvs.size()); // Calculate purity - for(auto& v: recopvs) { + for (auto& v : recopvs) { double sumpt_all = 0; double sumpt_sigmatched = 0; double sumpt2_sigmatched = 0; - const reco::Vertex *vertex = v.recVtx; - for(auto iTrack = vertex->tracks_begin(); iTrack != vertex->tracks_end(); ++iTrack) { + const reco::Vertex* vertex = v.recVtx; + for (auto iTrack = vertex->tracks_begin(); iTrack != vertex->tracks_end(); ++iTrack) { double pt = (*iTrack)->pt(); sumpt_all += pt; - if(matchRecoTrack2SimSignal(*iTrack)) { + if (matchRecoTrack2SimSignal(*iTrack)) { sumpt_sigmatched += pt; - sumpt2_sigmatched += pt*pt; + sumpt2_sigmatched += pt * pt; } } v.purity = sumpt_sigmatched / sumpt_all; @@ -894,38 +764,36 @@ void PrimaryVertexAnalyzer4PUSlimmed::calculatePurityAndFillHistograms( // Fill purity std::string prefix = "RecoPVAssoc2GenPVNotMatched_"; - if(genpv_position_in_reco_collection == 0) + if (genpv_position_in_reco_collection == 0) prefix = "RecoPVAssoc2GenPVMatched_"; - mes_[label][prefix+"Purity"]->Fill(recopvs[0].purity); - mes_[label][prefix+"Missing"]->Fill(missing); - auto hpurity = mes_[label][prefix+"Purity_vs_Index"]; - for(size_t i=0; iFill(recopvs[0].purity); + mes_[label][prefix + "Missing"]->Fill(missing); + auto hpurity = mes_[label][prefix + "Purity_vs_Index"]; + for (size_t i = 0; i < recopvs.size(); ++i) { hpurity->Fill(i, recopvs[i].purity); } // Fill sumpt2 - for(size_t i=0; i(i) == genpv_position_in_reco_collection) { + for (size_t i = 0; i < recopvs.size(); ++i) { + if (static_cast(i) == genpv_position_in_reco_collection) { mes_[label]["RecoAssoc2GenPVMatched_Pt2"]->Fill(recopvs[i].ptsq); - } - else { + } else { double pt2 = recopvs[i].ptsq; mes_[label]["RecoAssoc2GenPVNotMatched_Pt2"]->Fill(pt2); // Subtract hard-scatter track pt2 from the pileup pt2 - double pt2_pu = pt2-vtx_sumpt2_sigmatched[i]; + double pt2_pu = pt2 - vtx_sumpt2_sigmatched[i]; mes_[label]["RecoAssoc2GenPVNotMatched_GenPVTracksRemoved_Pt2"]->Fill(pt2_pu); } } - if(!signal_is_highest_pt && genpv_position_in_reco_collection >= 0) + if (!signal_is_highest_pt && genpv_position_in_reco_collection >= 0) mes_[label]["RecoAssoc2GenPVMatchedNotHighest_Pt2"]->Fill(recopvs[genpv_position_in_reco_collection].ptsq); } /* Extract information form TrackingParticles/TrackingVertex and fill * the helper class simPrimaryVertex with proper generation-level * information */ -std::vector -PrimaryVertexAnalyzer4PUSlimmed::getSimPVs( +std::vector PrimaryVertexAnalyzer4PUSlimmed::getSimPVs( const edm::Handle& tVC) { std::vector simpv; int current_event = -1; @@ -934,17 +802,13 @@ PrimaryVertexAnalyzer4PUSlimmed::getSimPVs( std::cout << "getSimPVs TrackingVertexCollection " << std::endl; } - for (TrackingVertexCollection::const_iterator v = tVC->begin(); - v != tVC->end(); ++v) { + for (TrackingVertexCollection::const_iterator v = tVC->begin(); v != tVC->end(); ++v) { if (verbose_) { - std::cout << "BunchX.EventId: " << v->eventId().bunchCrossing() << "." - << (v->eventId()).event() << " Position: " << v->position() - << " G4/HepMC Vertices: " << v->g4Vertices().size() << "/" - << v->genVertices().size() - << " t = " << v->position().t() * 1.e12 + std::cout << "BunchX.EventId: " << v->eventId().bunchCrossing() << "." << (v->eventId()).event() + << " Position: " << v->position() << " G4/HepMC Vertices: " << v->g4Vertices().size() << "/" + << v->genVertices().size() << " t = " << v->position().t() * 1.e12 << " == 0:" << (v->position().t() > 0) << std::endl; - for (TrackingVertex::g4v_iterator gv = v->g4Vertices_begin(); - gv != v->g4Vertices_end(); gv++) { + for (TrackingVertex::g4v_iterator gv = v->g4Vertices_begin(); gv != v->g4Vertices_end(); gv++) { std::cout << *gv << std::endl; } std::cout << "----------" << std::endl; @@ -954,24 +818,25 @@ PrimaryVertexAnalyzer4PUSlimmed::getSimPVs( // I'd rather change this and select only vertices that come from // BX=0. We should keep only the first vertex from all the events // at BX=0. - if (v->eventId().bunchCrossing() != 0) continue; + if (v->eventId().bunchCrossing() != 0) + continue; if (v->eventId().event() != current_event) { current_event = v->eventId().event(); } else { continue; } // TODO(rovere) is this really necessary? - if (fabs(v->position().z()) > 1000) continue; // skip funny junk vertices + if (fabs(v->position().z()) > 1000) + continue; // skip funny junk vertices // could be a new vertex, check all primaries found so far to avoid // multiple entries - simPrimaryVertex sv(v->position().x(), v->position().y(), - v->position().z()); + simPrimaryVertex sv(v->position().x(), v->position().y(), v->position().z()); sv.eventId = v->eventId(); sv.sim_vertex = TrackingVertexRef(tVC, std::distance(tVC->begin(), v)); - for (TrackingParticleRefVector::iterator iTrack = v->daughterTracks_begin(); - iTrack != v->daughterTracks_end(); ++iTrack) { + for (TrackingParticleRefVector::iterator iTrack = v->daughterTracks_begin(); iTrack != v->daughterTracks_end(); + ++iTrack) { // TODO(rovere) isn't it always the case? Is it really worth // checking this out? // sv.eventId = (**iTrack).eventId(); @@ -979,11 +844,10 @@ PrimaryVertexAnalyzer4PUSlimmed::getSimPVs( } // TODO(rovere) maybe get rid of this old logic completely ... ? simPrimaryVertex* vp = nullptr; // will become non-NULL if a vertex - // is found and then point to it - for (std::vector::iterator v0 = simpv.begin(); - v0 != simpv.end(); v0++) { - if ((sv.eventId == v0->eventId) && (fabs(sv.x - v0->x) < 1e-5) && - (fabs(sv.y - v0->y) < 1e-5) && (fabs(sv.z - v0->z) < 1e-5)) { + // is found and then point to it + for (std::vector::iterator v0 = simpv.begin(); v0 != simpv.end(); v0++) { + if ((sv.eventId == v0->eventId) && (fabs(sv.x - v0->x) < 1e-5) && (fabs(sv.y - v0->y) < 1e-5) && + (fabs(sv.z - v0->z) < 1e-5)) { vp = &(*v0); break; } @@ -993,24 +857,22 @@ PrimaryVertexAnalyzer4PUSlimmed::getSimPVs( simpv.push_back(sv); vp = &simpv.back(); if (verbose_) { - std::cout << "this is a new vertex " << sv.eventId.event() << " " - << sv.x << " " << sv.y << " " << sv.z << std::endl; + std::cout << "this is a new vertex " << sv.eventId.event() << " " << sv.x << " " << sv.y << " " << sv.z + << std::endl; } } else { if (verbose_) { - std::cout << "this is not a new vertex" << sv.x << " " << sv.y << " " - << sv.z << std::endl; + std::cout << "this is not a new vertex" << sv.x << " " << sv.y << " " << sv.z << std::endl; } } // Loop over daughter track(s) as Tracking Particles - for (TrackingVertex::tp_iterator iTP = v->daughterTracks_begin(); - iTP != v->daughterTracks_end(); ++iTP) { + for (TrackingVertex::tp_iterator iTP = v->daughterTracks_begin(); iTP != v->daughterTracks_end(); ++iTP) { auto momentum = (*(*iTP)).momentum(); const reco::Track* matched_best_reco_track = nullptr; double match_quality = -1; if (use_only_charged_tracks_ && (**iTP).charge() == 0) - continue; + continue; if (s2r_->find(*iTP) != s2r_->end()) { matched_best_reco_track = (*s2r_)[*iTP][0].first.get(); match_quality = (*s2r_)[*iTP][0].second; @@ -1037,48 +899,43 @@ PrimaryVertexAnalyzer4PUSlimmed::getSimPVs( // TODO(rovere) be consistent between simulated tracks and // reconstructed tracks selection // count relevant particles - if (((**iTP).pt() > 0.2) && (fabs((**iTP).eta()) < 2.5) && - (**iTP).charge() != 0) { + if (((**iTP).pt() > 0.2) && (fabs((**iTP).eta()) < 2.5) && (**iTP).charge() != 0) { vp->nGenTrk++; } } // End of for loop on daughters sim-particles if (vp->num_matched_reco_tracks) - vp->average_match_quality /= - static_cast(vp->num_matched_reco_tracks); + vp->average_match_quality /= static_cast(vp->num_matched_reco_tracks); if (verbose_) { std::cout << "average number of associated tracks: " << vp->num_matched_reco_tracks / static_cast(vp->nGenTrk) - << " with average quality: " << vp->average_match_quality - << std::endl; + << " with average quality: " << vp->average_match_quality << std::endl; } } // End of for loop on tracking vertices if (verbose_) { std::cout << "------- PrimaryVertexAnalyzer4PUSlimmed simPVs from " "TrackingVertices " - "-------" << std::endl; - for (std::vector::iterator v0 = simpv.begin(); - v0 != simpv.end(); v0++) { - std::cout << "z=" << v0->z << " event=" << v0->eventId.event() - << std::endl; + "-------" + << std::endl; + for (std::vector::iterator v0 = simpv.begin(); v0 != simpv.end(); v0++) { + std::cout << "z=" << v0->z << " event=" << v0->eventId.event() << std::endl; } std::cout << "-----------------------------------------------" << std::endl; } // End of for summary on discovered simulated primary vertices. // In case of no simulated vertices, break here - if(simpv.empty()) + if (simpv.empty()) return simpv; // Now compute the closest distance in z between all simulated vertex // first initialize auto prev_z = simpv.back().z; - for(simPrimaryVertex& vsim: simpv) { + for (simPrimaryVertex& vsim : simpv) { vsim.closest_vertex_distance_z = std::abs(vsim.z - prev_z); prev_z = vsim.z; } // then calculate - for (std::vector::iterator vsim = simpv.begin(); - vsim != simpv.end(); vsim++) { + for (std::vector::iterator vsim = simpv.begin(); vsim != simpv.end(); vsim++) { std::vector::iterator vsim2 = vsim; vsim2++; for (; vsim2 != simpv.end(); vsim2++) { @@ -1093,8 +950,7 @@ PrimaryVertexAnalyzer4PUSlimmed::getSimPVs( /* Extract information form recoVertex and fill the helper class * recoPrimaryVertex with proper reco-level information */ -std::vector -PrimaryVertexAnalyzer4PUSlimmed::getRecoPVs( +std::vector PrimaryVertexAnalyzer4PUSlimmed::getRecoPVs( const edm::Handle>& tVC) { std::vector recopv; @@ -1108,11 +964,12 @@ PrimaryVertexAnalyzer4PUSlimmed::getRecoPVs( } // Skip junk vertices - if (fabs(v->z()) > 1000) continue; - if (v->isFake() || !v->isValid()) continue; + if (fabs(v->z()) > 1000) + continue; + if (v->isFake() || !v->isValid()) + continue; - recoPrimaryVertex sv(v->position().x(), v->position().y(), - v->position().z()); + recoPrimaryVertex sv(v->position().x(), v->position().y(), v->position().z()); sv.recVtx = &(*v); sv.recVtxRef = reco::VertexBaseRef(tVC, std::distance(tVC->begin(), v)); // this is a new vertex, add it to the list of reco-vertices @@ -1136,7 +993,7 @@ PrimaryVertexAnalyzer4PUSlimmed::getRecoPVs( vp->nRecoTrk++; auto matched = r2s_->find(*iTrack); - if(matched != r2s_->end()) { + if (matched != r2s_->end()) { vp->num_matched_sim_tracks++; } @@ -1146,27 +1003,26 @@ PrimaryVertexAnalyzer4PUSlimmed::getRecoPVs( if (verbose_) { std::cout << "------- PrimaryVertexAnalyzer4PUSlimmed recoPVs from " "VertexCollection " - "-------" << std::endl; - for (std::vector::iterator v0 = recopv.begin(); - v0 != recopv.end(); v0++) { + "-------" + << std::endl; + for (std::vector::iterator v0 = recopv.begin(); v0 != recopv.end(); v0++) { std::cout << "z=" << v0->z << std::endl; } std::cout << "-----------------------------------------------" << std::endl; } // End of for summary on reconstructed primary vertices. // In case of no reco vertices, break here - if(recopv.empty()) + if (recopv.empty()) return recopv; // Now compute the closest distance in z between all reconstructed vertex // first initialize auto prev_z = recopv.back().z; - for(recoPrimaryVertex& vreco: recopv) { + for (recoPrimaryVertex& vreco : recopv) { vreco.closest_vertex_distance_z = std::abs(vreco.z - prev_z); prev_z = vreco.z; } - for (std::vector::iterator vreco = recopv.begin(); - vreco != recopv.end(); vreco++) { + for (std::vector::iterator vreco = recopv.begin(); vreco != recopv.end(); vreco++) { std::vector::iterator vreco2 = vreco; vreco2++; for (; vreco2 != recopv.end(); vreco2++) { @@ -1179,26 +1035,22 @@ PrimaryVertexAnalyzer4PUSlimmed::getRecoPVs( return recopv; } -void PrimaryVertexAnalyzer4PUSlimmed::resetSimPVAssociation( - std::vector & simpv) { - for (auto & v : simpv) { +void PrimaryVertexAnalyzer4PUSlimmed::resetSimPVAssociation(std::vector& simpv) { + for (auto& v : simpv) { v.rec_vertices.clear(); } } // ------------ method called to produce the data ------------ -void PrimaryVertexAnalyzer4PUSlimmed::matchSim2RecoVertices( - std::vector& simpv, - const reco::VertexSimToRecoCollection& vertex_s2r) { +void PrimaryVertexAnalyzer4PUSlimmed::matchSim2RecoVertices(std::vector& simpv, + const reco::VertexSimToRecoCollection& vertex_s2r) { if (verbose_) { std::cout << "PrimaryVertexAnalyzer4PUSlimmed::matchSim2RecoVertices " << std::endl; } - for (std::vector::iterator vsim = simpv.begin(); - vsim != simpv.end(); vsim++) { - + for (std::vector::iterator vsim = simpv.begin(); vsim != simpv.end(); vsim++) { auto matched = vertex_s2r.find(vsim->sim_vertex); - if(matched != vertex_s2r.end()) { - for(const auto vertexRefQuality: matched->val) { + if (matched != vertex_s2r.end()) { + for (const auto vertexRefQuality : matched->val) { vsim->rec_vertices.push_back(&(*(vertexRefQuality.first))); } } @@ -1206,10 +1058,8 @@ void PrimaryVertexAnalyzer4PUSlimmed::matchSim2RecoVertices( if (verbose_) { if (!vsim->rec_vertices.empty()) { for (auto const& v : vsim->rec_vertices) { - std::cout << "Found a matching vertex for genVtx " - << vsim->z << " at " << v->z() - << " with sign: " << fabs(v->z() - vsim->z) / v->zError() - << std::endl; + std::cout << "Found a matching vertex for genVtx " << vsim->z << " at " << v->z() + << " with sign: " << fabs(v->z() - vsim->z) / v->zError() << std::endl; } } else { std::cout << "No matching vertex for " << vsim->z << std::endl; @@ -1221,23 +1071,20 @@ void PrimaryVertexAnalyzer4PUSlimmed::matchSim2RecoVertices( } } -void PrimaryVertexAnalyzer4PUSlimmed::matchReco2SimVertices( - std::vector& recopv, - const reco::VertexRecoToSimCollection& vertex_r2s, - const std::vector& simpv) { - for (std::vector::iterator vrec = recopv.begin(); - vrec != recopv.end(); vrec++) { - +void PrimaryVertexAnalyzer4PUSlimmed::matchReco2SimVertices(std::vector& recopv, + const reco::VertexRecoToSimCollection& vertex_r2s, + const std::vector& simpv) { + for (std::vector::iterator vrec = recopv.begin(); vrec != recopv.end(); vrec++) { auto matched = vertex_r2s.find(vrec->recVtxRef); - if(matched != vertex_r2s.end()) { - for(const auto vertexRefQuality: matched->val) { + if (matched != vertex_r2s.end()) { + for (const auto vertexRefQuality : matched->val) { const auto tvPtr = &(*(vertexRefQuality.first)); vrec->sim_vertices.push_back(tvPtr); } - for(const TrackingVertex *tv: vrec->sim_vertices) { + for (const TrackingVertex* tv : vrec->sim_vertices) { // Set pointers to internal simVertex objects - for(const auto& vv: simpv) { + for (const auto& vv : simpv) { if (&(*(vv.sim_vertex)) == tv) { vrec->sim_vertices_internal.push_back(&vv); continue; @@ -1251,33 +1098,29 @@ void PrimaryVertexAnalyzer4PUSlimmed::matchReco2SimVertices( if (verbose_) { for (auto v : vrec->sim_vertices) { - std::cout << "Found a matching vertex for reco: " << vrec->z - << " at gen:" << v->position().z() << " with sign: " - << fabs(vrec->z - v->position().z()) / vrec->recVtx->zError() - << std::endl; + std::cout << "Found a matching vertex for reco: " << vrec->z << " at gen:" << v->position().z() + << " with sign: " << fabs(vrec->z - v->position().z()) / vrec->recVtx->zError() << std::endl; } } } // end for loop on reconstructed vertices } -void PrimaryVertexAnalyzer4PUSlimmed::analyze(const edm::Event& iEvent, - const edm::EventSetup& iSetup) { - using std::vector; - using std::cout; - using std::endl; +void PrimaryVertexAnalyzer4PUSlimmed::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using edm::Handle; using edm::View; + using std::cout; + using std::endl; + using std::vector; using namespace reco; std::vector pileUpInfo_z; // get the pileup information - edm::Handle > puinfoH; + edm::Handle> puinfoH; if (iEvent.getByToken(vecPileupSummaryInfoToken_, puinfoH)) { for (auto const& pu_info : *puinfoH.product()) { - if(do_generic_sim_plots_) { - mes_["root_folder"]["GenVtx_vs_BX"] - ->Fill(pu_info.getBunchCrossing(), pu_info.getPU_NumInteractions()); + if (do_generic_sim_plots_) { + mes_["root_folder"]["GenVtx_vs_BX"]->Fill(pu_info.getBunchCrossing(), pu_info.getPU_NumInteractions()); } if (pu_info.getBunchCrossing() == 0) { pileUpInfo_z = pu_info.getPU_zpositions(); @@ -1293,15 +1136,13 @@ void PrimaryVertexAnalyzer4PUSlimmed::analyze(const edm::Event& iEvent, edm::Handle TPCollectionH; iEvent.getByToken(trackingParticleCollectionToken_, TPCollectionH); - if (!TPCollectionH.isValid()) - edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") - << "TPCollectionH is not valid"; + if (!TPCollectionH.isValid()) + edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") << "TPCollectionH is not valid"; edm::Handle TVCollectionH; iEvent.getByToken(trackingVertexCollectionToken_, TVCollectionH); if (!TVCollectionH.isValid()) - edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") - << "TVCollectionH is not valid"; + edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") << "TVCollectionH is not valid"; // TODO(rovere) the idea is to put in case a track-selector in front // of this module and then use its label to get the selected tracks @@ -1310,26 +1151,23 @@ void PrimaryVertexAnalyzer4PUSlimmed::analyze(const edm::Event& iEvent, edm::Handle simToRecoH; iEvent.getByToken(simToRecoAssociationToken_, simToRecoH); - if ( simToRecoH.isValid() ) + if (simToRecoH.isValid()) s2r_ = simToRecoH.product(); else - edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") - << "simToRecoH is not valid"; + edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") << "simToRecoH is not valid"; edm::Handle recoToSimH; iEvent.getByToken(recoToSimAssociationToken_, recoToSimH); - if ( recoToSimH.isValid() ) + if (recoToSimH.isValid()) r2s_ = recoToSimH.product(); else - edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") - << "recoToSimH is not valid"; + edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") << "recoToSimH is not valid"; // Vertex associator edm::Handle vertexAssociatorH; iEvent.getByToken(vertexAssociatorToken_, vertexAssociatorH); if (!vertexAssociatorH.isValid()) { - edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") - << "vertexAssociatorH is not valid"; + edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") << "vertexAssociatorH is not valid"; return; } const reco::VertexToTrackingVertexAssociator& vertexAssociator = *(vertexAssociatorH.product()); @@ -1342,29 +1180,29 @@ void PrimaryVertexAnalyzer4PUSlimmed::analyze(const edm::Event& iEvent, // probably be subtracted? int kind_of_signal_vertex = 0; int num_pileup_vertices = simpv.size(); - if(do_generic_sim_plots_) mes_["root_folder"]["GenAllV_NumVertices"]->Fill(simpv.size()); - bool signal_is_highest_pt = std::max_element(simpv.begin(), simpv.end(), - [](const simPrimaryVertex& lhs, - const simPrimaryVertex& rhs) { - return lhs.ptsq < rhs.ptsq; - }) == simpv.begin(); + if (do_generic_sim_plots_) + mes_["root_folder"]["GenAllV_NumVertices"]->Fill(simpv.size()); + bool signal_is_highest_pt = + std::max_element(simpv.begin(), simpv.end(), [](const simPrimaryVertex& lhs, const simPrimaryVertex& rhs) { + return lhs.ptsq < rhs.ptsq; + }) == simpv.begin(); kind_of_signal_vertex |= (signal_is_highest_pt << HIGHEST_PT); - if(do_generic_sim_plots_) { + if (do_generic_sim_plots_) { mes_["root_folder"]["SignalIsHighestPt2"]->Fill(signal_is_highest_pt ? 1. : 0.); computePairDistance(simpv, mes_["root_folder"]["GenAllV_PairDistanceZ"]); } int label_index = -1; - for(size_t iToken=0, endToken=reco_vertex_collection_tokens_.size(); iToken recopv; // a list of reconstructed // primary MC vertices std::string label = reco_vertex_collections_[++label_index].label(); edm::Handle> recVtxs; if (!iEvent.getByToken(vertex_token, recVtxs)) { - if(!errorPrintedForColl_[iToken]) { + if (!errorPrintedForColl_[iToken]) { edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") - << "Skipping vertex collection: " << label << " since it is missing."; + << "Skipping vertex collection: " << label << " since it is missing."; errorPrintedForColl_[iToken] = true; } continue; @@ -1373,21 +1211,23 @@ void PrimaryVertexAnalyzer4PUSlimmed::analyze(const edm::Event& iEvent, { // check upfront that refs to track are (likely) to be valid bool ok = true; - for(const auto& v: *recVtxs) { - if(v.tracksSize() > 0) { - const auto& ref = v.trackRefAt(0); - if(ref.isNull() || !ref.isAvailable()) { - if(!errorPrintedForColl_[iToken]) { - edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") - << "Skipping vertex collection: " << label << " since likely the track collection the vertex has refs pointing to is missing (at least the first TrackBaseRef is null or not available)"; - errorPrintedForColl_[iToken] = true; - } - ok = false; - } - } + for (const auto& v : *recVtxs) { + if (v.tracksSize() > 0) { + const auto& ref = v.trackRefAt(0); + if (ref.isNull() || !ref.isAvailable()) { + if (!errorPrintedForColl_[iToken]) { + edm::LogWarning("PrimaryVertexAnalyzer4PUSlimmed") + << "Skipping vertex collection: " << label + << " since likely the track collection the vertex has refs pointing to is missing (at least the " + "first TrackBaseRef is null or not available)"; + errorPrintedForColl_[iToken] = true; + } + ok = false; + } + } } - if(!ok) - continue; + if (!ok) + continue; } reco::VertexRecoToSimCollection vertex_r2s = vertexAssociator.associateRecoToSim(recVtxs, TVCollectionH); @@ -1396,8 +1236,7 @@ void PrimaryVertexAnalyzer4PUSlimmed::analyze(const edm::Event& iEvent, resetSimPVAssociation(simpv); matchSim2RecoVertices(simpv, vertex_s2r); recopv = getRecoPVs(recVtxs); - computePairDistance(recopv, - mes_[label]["RecoAllAssoc2Gen_PairDistanceZ"]); + computePairDistance(recopv, mes_[label]["RecoAllAssoc2Gen_PairDistanceZ"]); matchReco2SimVertices(recopv, vertex_r2s, simpv); int num_total_gen_vertices_assoc2reco = 0; @@ -1410,9 +1249,8 @@ void PrimaryVertexAnalyzer4PUSlimmed::analyze(const edm::Event& iEvent, float mistag = 1.; // TODO(rovere) put selectors here in front of fill* methods. if (v.eventId.event() == 0) { - if (!recVtxs->empty() && - std::find(v.rec_vertices.begin(), v.rec_vertices.end(), - &((*recVtxs.product())[0])) != v.rec_vertices.end()) { + if (!recVtxs->empty() && std::find(v.rec_vertices.begin(), v.rec_vertices.end(), &((*recVtxs.product())[0])) != + v.rec_vertices.end()) { mistag = 0.; kind_of_signal_vertex |= (1 << IS_ASSOC2FIRST_RECO); } else { @@ -1429,24 +1267,18 @@ void PrimaryVertexAnalyzer4PUSlimmed::analyze(const edm::Event& iEvent, mes_[label]["MisTagRate_vs_NumTracks"]->Fill(v.nGenTrk, mistag); if (signal_is_highest_pt) { mes_[label]["MisTagRateSignalIsHighest"]->Fill(mistag); - mes_[label]["MisTagRateSignalIsHighest_vs_PU"]->Fill(simpv.size(), - mistag); - mes_[label]["MisTagRateSignalIsHighest_vs_sum-pt2"]->Fill(v.ptsq, - mistag); + mes_[label]["MisTagRateSignalIsHighest_vs_PU"]->Fill(simpv.size(), mistag); + mes_[label]["MisTagRateSignalIsHighest_vs_sum-pt2"]->Fill(v.ptsq, mistag); mes_[label]["MisTagRateSignalIsHighest_vs_Z"]->Fill(v.z, mistag); mes_[label]["MisTagRateSignalIsHighest_vs_R"]->Fill(v.r, mistag); - mes_[label]["MisTagRateSignalIsHighest_vs_NumTracks"]->Fill(v.nGenTrk, - mistag); + mes_[label]["MisTagRateSignalIsHighest_vs_NumTracks"]->Fill(v.nGenTrk, mistag); } else { mes_[label]["MisTagRateSignalIsNotHighest"]->Fill(mistag); - mes_[label]["MisTagRateSignalIsNotHighest_vs_PU"]->Fill(simpv.size(), - mistag); - mes_[label]["MisTagRateSignalIsNotHighest_vs_sum-pt2"]->Fill(v.ptsq, - mistag); + mes_[label]["MisTagRateSignalIsNotHighest_vs_PU"]->Fill(simpv.size(), mistag); + mes_[label]["MisTagRateSignalIsNotHighest_vs_sum-pt2"]->Fill(v.ptsq, mistag); mes_[label]["MisTagRateSignalIsNotHighest_vs_Z"]->Fill(v.z, mistag); mes_[label]["MisTagRateSignalIsNotHighest_vs_R"]->Fill(v.r, mistag); - mes_[label]["MisTagRateSignalIsNotHighest_vs_NumTracks"]-> - Fill(v.nGenTrk, mistag); + mes_[label]["MisTagRateSignalIsNotHighest_vs_NumTracks"]->Fill(v.nGenTrk, mistag); } // Now check at which location the Simulated PV has been // reconstructed in the primary vertex collection @@ -1454,27 +1286,21 @@ void PrimaryVertexAnalyzer4PUSlimmed::analyze(const edm::Event& iEvent, // reconstructed at all. auto iv = (*recVtxs.product()).begin(); - for (int pv_position_in_reco_collection = 0; - iv != (*recVtxs.product()).end(); + for (int pv_position_in_reco_collection = 0; iv != (*recVtxs.product()).end(); ++pv_position_in_reco_collection, ++iv) { - if (std::find(v.rec_vertices.begin(), v.rec_vertices.end(), - &(*iv)) != v.rec_vertices.end()) { - mes_[label]["TruePVLocationIndex"] - ->Fill(pv_position_in_reco_collection); + if (std::find(v.rec_vertices.begin(), v.rec_vertices.end(), &(*iv)) != v.rec_vertices.end()) { + mes_[label]["TruePVLocationIndex"]->Fill(pv_position_in_reco_collection); const bool genPVMatchedToRecoPV = (pv_position_in_reco_collection == 0); - mes_[label]["TruePVLocationIndexCumulative"] - ->Fill(genPVMatchedToRecoPV ? 0 : 1); + mes_[label]["TruePVLocationIndexCumulative"]->Fill(genPVMatchedToRecoPV ? 0 : 1); if (signal_is_highest_pt) { - mes_[label]["TruePVLocationIndexSignalIsHighest"] - ->Fill(pv_position_in_reco_collection); + mes_[label]["TruePVLocationIndexSignalIsHighest"]->Fill(pv_position_in_reco_collection); } else { - mes_[label]["TruePVLocationIndexSignalIsNotHighest"] - ->Fill(pv_position_in_reco_collection); + mes_[label]["TruePVLocationIndexSignalIsNotHighest"]->Fill(pv_position_in_reco_collection); } fillRecoAssociatedGenPVHistograms(label, v, genPVMatchedToRecoPV); - if(genPVMatchedToRecoPV) { + if (genPVMatchedToRecoPV) { auto pv = recopv[0]; assert(pv.recVtx == &(*iv)); fillResolutionAndPullHistograms(label, num_pileup_vertices, pv, true); @@ -1498,22 +1324,22 @@ void PrimaryVertexAnalyzer4PUSlimmed::analyze(const edm::Event& iEvent, } } - if (!v.rec_vertices.empty()) num_total_gen_vertices_assoc2reco++; - if (v.rec_vertices.size() > 1) num_total_gen_vertices_multiassoc2reco++; + if (!v.rec_vertices.empty()) + num_total_gen_vertices_assoc2reco++; + if (v.rec_vertices.size() > 1) + num_total_gen_vertices_multiassoc2reco++; // No need to N-tplicate the Gen-related cumulative histograms: // fill them only at the first iteration - if (do_generic_sim_plots_ && label_index == 0) fillGenericGenVertexHistograms(v); + if (do_generic_sim_plots_ && label_index == 0) + fillGenericGenVertexHistograms(v); fillRecoAssociatedGenVertexHistograms(label, v); } calculatePurityAndFillHistograms(label, recopv, genpv_position_in_reco_collection, signal_is_highest_pt); - mes_[label]["GenAllAssoc2Reco_NumVertices"] - ->Fill(simpv.size(), simpv.size()); - mes_[label]["GenAllAssoc2RecoMatched_NumVertices"] - ->Fill(simpv.size(), num_total_gen_vertices_assoc2reco); - mes_[label]["GenAllAssoc2RecoMultiMatched_NumVertices"] - ->Fill(simpv.size(), num_total_gen_vertices_multiassoc2reco); - for (auto & v : recopv) { + mes_[label]["GenAllAssoc2Reco_NumVertices"]->Fill(simpv.size(), simpv.size()); + mes_[label]["GenAllAssoc2RecoMatched_NumVertices"]->Fill(simpv.size(), num_total_gen_vertices_assoc2reco); + mes_[label]["GenAllAssoc2RecoMultiMatched_NumVertices"]->Fill(simpv.size(), num_total_gen_vertices_multiassoc2reco); + for (auto& v : recopv) { fillGenAssociatedRecoVertexHistograms(label, num_pileup_vertices, v); if (!v.sim_vertices.empty()) { num_total_reco_vertices_assoc2gen++; @@ -1521,30 +1347,24 @@ void PrimaryVertexAnalyzer4PUSlimmed::analyze(const edm::Event& iEvent, num_total_reco_vertices_duplicate++; } } - if (v.sim_vertices.size() > 1) num_total_reco_vertices_multiassoc2gen++; + if (v.sim_vertices.size() > 1) + num_total_reco_vertices_multiassoc2gen++; } - mes_[label]["RecoAllAssoc2Gen_NumVertices"] - ->Fill(recopv.size(), recopv.size()); - mes_[label]["RecoAllAssoc2GenMatched_NumVertices"] - ->Fill(recopv.size(), num_total_reco_vertices_assoc2gen); - mes_[label]["RecoAllAssoc2GenMultiMatched_NumVertices"] - ->Fill(recopv.size(), num_total_reco_vertices_multiassoc2gen); - mes_[label]["RecoAllAssoc2MultiMatchedGen_NumVertices"] - ->Fill(recopv.size(), num_total_reco_vertices_duplicate); + mes_[label]["RecoAllAssoc2Gen_NumVertices"]->Fill(recopv.size(), recopv.size()); + mes_[label]["RecoAllAssoc2GenMatched_NumVertices"]->Fill(recopv.size(), num_total_reco_vertices_assoc2gen); + mes_[label]["RecoAllAssoc2GenMultiMatched_NumVertices"]->Fill(recopv.size(), + num_total_reco_vertices_multiassoc2gen); + mes_[label]["RecoAllAssoc2MultiMatchedGen_NumVertices"]->Fill(recopv.size(), num_total_reco_vertices_duplicate); mes_[label]["RecoVtx_vs_GenVtx"]->Fill(simpv.size(), recopv.size()); - mes_[label]["MatchedRecoVtx_vs_GenVtx"] - ->Fill(simpv.size(), num_total_reco_vertices_assoc2gen); - + mes_[label]["MatchedRecoVtx_vs_GenVtx"]->Fill(simpv.size(), num_total_reco_vertices_assoc2gen); } } // end of analyze -template -void PrimaryVertexAnalyzer4PUSlimmed::computePairDistance(const T &collection, - MonitorElement *me) { +template +void PrimaryVertexAnalyzer4PUSlimmed::computePairDistance(const T& collection, MonitorElement* me) { for (unsigned int i = 0; i < collection.size(); ++i) { - for (unsigned int j = i+1; j < collection.size(); ++j) { - me->Fill( - std::abs(collection[i].z-collection[j].z)); + for (unsigned int j = i + 1; j < collection.size(); ++j) { + me->Fill(std::abs(collection[i].z - collection[j].z)); } } } diff --git a/Validation/RecoVertex/src/TrackParameterAnalyzer.cc b/Validation/RecoVertex/src/TrackParameterAnalyzer.cc index 14a208617bdcc..8312715aca856 100644 --- a/Validation/RecoVertex/src/TrackParameterAnalyzer.cc +++ b/Validation/RecoVertex/src/TrackParameterAnalyzer.cc @@ -34,62 +34,59 @@ // constructors and destructor // TrackParameterAnalyzer::TrackParameterAnalyzer(const edm::ParameterSet& iConfig) - : edmSimVertexContainerToken_( consumes( iConfig.getParameter( "simG4" ) ) ) - , edmSimTrackContainerToken_( consumes( iConfig.getParameter( "simG4" ) ) ) - , recoTrackCollectionToken_( consumes( edm::InputTag( iConfig.getUntrackedParameter( "recoTrackProducer" ) ) ) ) - , outputFile_( iConfig.getUntrackedParameter( "outputFile" ) ) - , simUnit_( 1.0 ) // starting from CMSSW_1_2_x, I think - , verbose_( iConfig.getUntrackedParameter( "verbose", false ) ) { - //now do whatever initialization is needed + : edmSimVertexContainerToken_(consumes(iConfig.getParameter("simG4"))), + edmSimTrackContainerToken_(consumes(iConfig.getParameter("simG4"))), + recoTrackCollectionToken_(consumes( + edm::InputTag(iConfig.getUntrackedParameter("recoTrackProducer")))), + outputFile_(iConfig.getUntrackedParameter("outputFile")), + simUnit_(1.0) // starting from CMSSW_1_2_x, I think + , + verbose_(iConfig.getUntrackedParameter("verbose", false)) { + //now do whatever initialization is needed // open output file to store histograms} auto tversion = edm::getReleaseVersion(); tversion = tversion.erase(tversion.size() - 1, 1).erase(0, 1); - outputFile_ = tversion + "_" + outputFile_; - rootFile_ = TFile::Open(outputFile_.c_str(),"RECREATE"); - if ( (edm::getReleaseVersion()).find("CMSSW_1_1_",0)!=std::string::npos){ - simUnit_=0.1; // for use in CMSSW_1_1_1 tutorial + outputFile_ = tversion + "_" + outputFile_; + rootFile_ = TFile::Open(outputFile_.c_str(), "RECREATE"); + if ((edm::getReleaseVersion()).find("CMSSW_1_1_", 0) != std::string::npos) { + simUnit_ = 0.1; // for use in CMSSW_1_1_1 tutorial } } - -TrackParameterAnalyzer::~TrackParameterAnalyzer() -{ - // do anything here that needs to be done at destruction time - // (e.g. close files, deallocate resources etc.) +TrackParameterAnalyzer::~TrackParameterAnalyzer() { + // do anything here that needs to be done at destruction time + // (e.g. close files, deallocate resources etc.) delete rootFile_; } - - // // member functions // -void TrackParameterAnalyzer::beginJob(){ +void TrackParameterAnalyzer::beginJob() { std::cout << " TrackParameterAnalyzer::beginJob conversion from sim units to rec units is " << simUnit_ << std::endl; rootFile_->cd(); - h1_pull0_ = new TH1F("pull0","pull q/p",100,-25.,25.); - h1_pull1_ = new TH1F("pull1","pull lambda",100,-25.,25.); - h1_pull2_ = new TH1F("pull2","pull phi ",100,-25.,25.); - h1_pull3_ = new TH1F("pull3","pull dca ",100,-25.,25.); - h1_pull4_ = new TH1F("pull4","pull zdca ",100,-25.,25.); - - h1_res0_ = new TH1F("res0","res q/p",100,-0.1,0.1); - h1_res1_ = new TH1F("res1","res lambda",100,-0.1,0.1); - h1_res2_ = new TH1F("res2","res phi ",100,-0.1,0.1); - h1_res3_ = new TH1F("res3","res dca ",100,-0.1,0.1); - h1_res4_ = new TH1F("res4","res zdca ",100,-0.1,0.1); - - h1_Beff_ = new TH1F("Beff", "Beff",2000,-10.,10.); - h2_dvsphi_ = new TH2F("dvsphi","dvsphi",360,-M_PI,M_PI,100,-0.1,0.1); - h1_par0_ = new TH1F("par0","q/p",100,-0.1,0.1); - h1_par1_ = new TH1F("par1","lambda",100, -M_PI/2.,M_PI/2.); - h1_par2_ = new TH1F("par2","phi ",100,-M_PI,M_PI); - h1_par3_ = new TH1F("par3","dca ",100,-0.1,0.1); - h1_par4_ = new TH1F("par4","zdca ",1000,-10.,10.); + h1_pull0_ = new TH1F("pull0", "pull q/p", 100, -25., 25.); + h1_pull1_ = new TH1F("pull1", "pull lambda", 100, -25., 25.); + h1_pull2_ = new TH1F("pull2", "pull phi ", 100, -25., 25.); + h1_pull3_ = new TH1F("pull3", "pull dca ", 100, -25., 25.); + h1_pull4_ = new TH1F("pull4", "pull zdca ", 100, -25., 25.); + + h1_res0_ = new TH1F("res0", "res q/p", 100, -0.1, 0.1); + h1_res1_ = new TH1F("res1", "res lambda", 100, -0.1, 0.1); + h1_res2_ = new TH1F("res2", "res phi ", 100, -0.1, 0.1); + h1_res3_ = new TH1F("res3", "res dca ", 100, -0.1, 0.1); + h1_res4_ = new TH1F("res4", "res zdca ", 100, -0.1, 0.1); + + h1_Beff_ = new TH1F("Beff", "Beff", 2000, -10., 10.); + h2_dvsphi_ = new TH2F("dvsphi", "dvsphi", 360, -M_PI, M_PI, 100, -0.1, 0.1); + h1_par0_ = new TH1F("par0", "q/p", 100, -0.1, 0.1); + h1_par1_ = new TH1F("par1", "lambda", 100, -M_PI / 2., M_PI / 2.); + h1_par2_ = new TH1F("par2", "phi ", 100, -M_PI, M_PI); + h1_par3_ = new TH1F("par3", "dca ", 100, -0.1, 0.1); + h1_par4_ = new TH1F("par4", "zdca ", 1000, -10., 10.); } - void TrackParameterAnalyzer::endJob() { rootFile_->cd(); h1_pull0_->Write(); @@ -114,146 +111,136 @@ void TrackParameterAnalyzer::endJob() { } // helper function -bool TrackParameterAnalyzer::match(const ParameterVector &a, - const ParameterVector &b){ - double dtheta=a(1)-b(1); - double dphi =a(2)-b(2); - if (dphi>M_PI){ dphi-=M_2_PI; }else if(dphi<-M_PI){dphi+=M_2_PI;} - return ( (fabs(dtheta)<0.02) && (fabs(dphi)<0.04) ); +bool TrackParameterAnalyzer::match(const ParameterVector& a, const ParameterVector& b) { + double dtheta = a(1) - b(1); + double dphi = a(2) - b(2); + if (dphi > M_PI) { + dphi -= M_2_PI; + } else if (dphi < -M_PI) { + dphi += M_2_PI; + } + return ((fabs(dtheta) < 0.02) && (fabs(dphi) < 0.04)); } // ------------ method called to produce the data ------------ -void -TrackParameterAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) -{ - using CLHEP::HepLorentzVector; - - const double fBfield=3.8; - - edm::Handle simVtcs; - iEvent.getByToken( edmSimVertexContainerToken_, simVtcs ); - if(verbose_){ - std::cout << "SimVertex " << simVtcs->size() << std::endl; - for(edm::SimVertexContainer::const_iterator v=simVtcs->begin(); - v!=simVtcs->end(); ++v){ - std::cout << "simvtx " - << std::setw(10) << std::setprecision(4) - << v->position().x() << " " - << v->position().y() << " " - << v->position().z() << " " - << v->parentIndex() << " " - << v->noParent() << " " - << std::endl; - } - } - - // get the simulated tracks, extract perigee parameters - edm::Handle simTrks; - iEvent.getByToken( edmSimTrackContainerToken_, simTrks ); - - if(verbose_){std::cout << "simtrks " << simTrks->size() << std::endl;} - std::vector tsim; - for(edm::SimTrackContainer::const_iterator t=simTrks->begin(); - t!=simTrks->end(); ++t){ - if (t->noVertex()){ - std::cout << "simtrk has no vertex" << std::endl; - return; - }else{ - // get the vertex position - HepLorentzVector v((*simVtcs)[t->vertIndex()].position().x(), - (*simVtcs)[t->vertIndex()].position().y(), - (*simVtcs)[t->vertIndex()].position().z(), - (*simVtcs)[t->vertIndex()].position().e()); - int pdgCode=t->type(); - - if( pdgCode==-99 ){ - // such entries cause crashes, no idea what they are - std::cout << "funny particle skipped , code=" << pdgCode << std::endl; - }else{ - double Q=0; - if ((pdgCode==11)||(pdgCode==13)||(pdgCode==15)||(pdgCode==-211)||(pdgCode==-2212)||(pdgCode==321)){Q=-1;} - else if((pdgCode==-11)||(pdgCode==-13)||(pdgCode==-15)||(pdgCode==211)||(pdgCode==2212)||(pdgCode==321)){Q=1;} - else { - std::cout << pdgCode << " " <momentum().x(),t->momentum().y(),t->momentum().z(),t->momentum().e()); - if(verbose_){ - std::cout << "simtrk " - << " gen=" << std::setw( 4) << t->genpartIndex() - << " vtx=" << std::setw( 4) << t->vertIndex() - << " pdg=" << std::setw( 5) << t->type() - << " Q=" << std::setw( 3) << Q - << " pt=" << std::setw(6) << p.perp() - << " vx=" << std::setw(6) << v.x() - << " vy=" << std::setw(6) << v.y() - << " vz=" << std::setw(6) << v.z() - << std::endl; - } - if ( (Q != 0) && (p.perp()>0.1) ){ - double x0=v.x()*simUnit_; - double y0=v.y()*simUnit_; - double z0=v.z()*simUnit_; - double kappa=-Q*0.002998*fBfield/p.perp(); - double D0=x0*sin(p.phi())-y0*cos(p.phi())-0.5*kappa*(x0*x0+y0*y0); - double q=sqrt(1.-2.*kappa*D0); - double s0=(x0*cos(p.phi())+y0*sin(p.phi()))/q; - double s1; - if (fabs(kappa*s0)>0.001){ - s1=asin(kappa*s0)/kappa; - }else{ - double ks02=(kappa*s0)*(kappa*s0); - s1=s0*(1.+ks02/6.+3./40.*ks02*ks02+5./112.*pow(ks02,3)); - } - ParameterVector par; - par[reco::TrackBase::i_qoverp] = Q/sqrt(p.perp2()+p.pz()*p.pz()); - par[reco::TrackBase::i_lambda] = M_PI/2.-p.theta(); - par[reco::TrackBase::i_phi] = p.phi()-asin(kappa*s0); - par[reco::TrackBase::i_dxy] = 2.*D0/(1.+q); - par[reco::TrackBase::i_dsz] = z0*sin(p.theta())-s1*cos(p.theta()); - tsim.push_back(par); - } - } - }// has vertex - }//for loop - - // simtrack parameters are in now tsim - // loop over tracks and try to match them to simulated tracks - - - edm::Handle recTracks; - iEvent.getByToken( recoTrackCollectionToken_, recTracks ); - - for(reco::TrackCollection::const_iterator t=recTracks->begin(); - t!=recTracks->end(); ++t){ - reco::TrackBase::ParameterVector p = t->parameters(); - reco::TrackBase::CovarianceMatrix c = t->covariance(); - if(verbose_){ - std::cout << "reco pars= " << p << std::endl; - } - for(std::vector::const_iterator s=tsim.begin(); - s!=tsim.end(); ++s){ - if (match(*s,p)){ - h1_pull0_->Fill((p(0)-(*s)(0))/sqrt(c(0,0))); - h1_pull1_->Fill((p(1)-(*s)(1))/sqrt(c(1,1))); - h1_pull2_->Fill((p(2)-(*s)(2))/sqrt(c(2,2))); - h1_pull3_->Fill((p(3)-(*s)(3))/sqrt(c(3,3))); - h1_pull4_->Fill((p(4)-(*s)(4))/sqrt(c(4,4))); +void TrackParameterAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + using CLHEP::HepLorentzVector; + + const double fBfield = 3.8; + + edm::Handle simVtcs; + iEvent.getByToken(edmSimVertexContainerToken_, simVtcs); + if (verbose_) { + std::cout << "SimVertex " << simVtcs->size() << std::endl; + for (edm::SimVertexContainer::const_iterator v = simVtcs->begin(); v != simVtcs->end(); ++v) { + std::cout << "simvtx " << std::setw(10) << std::setprecision(4) << v->position().x() << " " << v->position().y() + << " " << v->position().z() << " " << v->parentIndex() << " " << v->noParent() << " " << std::endl; + } + } - h1_res0_->Fill(p(0)-(*s)(0)); - h1_res1_->Fill(p(1)-(*s)(1)); - h1_res2_->Fill(p(2)-(*s)(2)); - h1_res3_->Fill(p(3)-(*s)(3)); - h1_res4_->Fill(p(4)-(*s)(4)); + // get the simulated tracks, extract perigee parameters + edm::Handle simTrks; + iEvent.getByToken(edmSimTrackContainerToken_, simTrks); - h1_Beff_->Fill(p(0)/(*s)(0)*fBfield); - h2_dvsphi_->Fill(p(2),p(3)); - h1_par0_->Fill(p(0)); - h1_par1_->Fill(p(1)); - h1_par2_->Fill(p(2)); - h1_par3_->Fill(p(3)); - h1_par4_->Fill(p(4)); + if (verbose_) { + std::cout << "simtrks " << simTrks->size() << std::endl; + } + std::vector tsim; + for (edm::SimTrackContainer::const_iterator t = simTrks->begin(); t != simTrks->end(); ++t) { + if (t->noVertex()) { + std::cout << "simtrk has no vertex" << std::endl; + return; + } else { + // get the vertex position + HepLorentzVector v((*simVtcs)[t->vertIndex()].position().x(), + (*simVtcs)[t->vertIndex()].position().y(), + (*simVtcs)[t->vertIndex()].position().z(), + (*simVtcs)[t->vertIndex()].position().e()); + int pdgCode = t->type(); + + if (pdgCode == -99) { + // such entries cause crashes, no idea what they are + std::cout << "funny particle skipped , code=" << pdgCode << std::endl; + } else { + double Q = 0; + if ((pdgCode == 11) || (pdgCode == 13) || (pdgCode == 15) || (pdgCode == -211) || (pdgCode == -2212) || + (pdgCode == 321)) { + Q = -1; + } else if ((pdgCode == -11) || (pdgCode == -13) || (pdgCode == -15) || (pdgCode == 211) || (pdgCode == 2212) || + (pdgCode == 321)) { + Q = 1; + } else { + std::cout << pdgCode << " " << std::endl; + } + HepLorentzVector p(t->momentum().x(), t->momentum().y(), t->momentum().z(), t->momentum().e()); + if (verbose_) { + std::cout << "simtrk " + << " gen=" << std::setw(4) << t->genpartIndex() << " vtx=" << std::setw(4) << t->vertIndex() + << " pdg=" << std::setw(5) << t->type() << " Q=" << std::setw(3) << Q << " pt=" << std::setw(6) + << p.perp() << " vx=" << std::setw(6) << v.x() << " vy=" << std::setw(6) << v.y() + << " vz=" << std::setw(6) << v.z() << std::endl; + } + if ((Q != 0) && (p.perp() > 0.1)) { + double x0 = v.x() * simUnit_; + double y0 = v.y() * simUnit_; + double z0 = v.z() * simUnit_; + double kappa = -Q * 0.002998 * fBfield / p.perp(); + double D0 = x0 * sin(p.phi()) - y0 * cos(p.phi()) - 0.5 * kappa * (x0 * x0 + y0 * y0); + double q = sqrt(1. - 2. * kappa * D0); + double s0 = (x0 * cos(p.phi()) + y0 * sin(p.phi())) / q; + double s1; + if (fabs(kappa * s0) > 0.001) { + s1 = asin(kappa * s0) / kappa; + } else { + double ks02 = (kappa * s0) * (kappa * s0); + s1 = s0 * (1. + ks02 / 6. + 3. / 40. * ks02 * ks02 + 5. / 112. * pow(ks02, 3)); + } + ParameterVector par; + par[reco::TrackBase::i_qoverp] = Q / sqrt(p.perp2() + p.pz() * p.pz()); + par[reco::TrackBase::i_lambda] = M_PI / 2. - p.theta(); + par[reco::TrackBase::i_phi] = p.phi() - asin(kappa * s0); + par[reco::TrackBase::i_dxy] = 2. * D0 / (1. + q); + par[reco::TrackBase::i_dsz] = z0 * sin(p.theta()) - s1 * cos(p.theta()); + tsim.push_back(par); + } } - } - } - + } // has vertex + } //for loop + + // simtrack parameters are in now tsim + // loop over tracks and try to match them to simulated tracks + + edm::Handle recTracks; + iEvent.getByToken(recoTrackCollectionToken_, recTracks); + + for (reco::TrackCollection::const_iterator t = recTracks->begin(); t != recTracks->end(); ++t) { + reco::TrackBase::ParameterVector p = t->parameters(); + reco::TrackBase::CovarianceMatrix c = t->covariance(); + if (verbose_) { + std::cout << "reco pars= " << p << std::endl; + } + for (std::vector::const_iterator s = tsim.begin(); s != tsim.end(); ++s) { + if (match(*s, p)) { + h1_pull0_->Fill((p(0) - (*s)(0)) / sqrt(c(0, 0))); + h1_pull1_->Fill((p(1) - (*s)(1)) / sqrt(c(1, 1))); + h1_pull2_->Fill((p(2) - (*s)(2)) / sqrt(c(2, 2))); + h1_pull3_->Fill((p(3) - (*s)(3)) / sqrt(c(3, 3))); + h1_pull4_->Fill((p(4) - (*s)(4)) / sqrt(c(4, 4))); + + h1_res0_->Fill(p(0) - (*s)(0)); + h1_res1_->Fill(p(1) - (*s)(1)); + h1_res2_->Fill(p(2) - (*s)(2)); + h1_res3_->Fill(p(3) - (*s)(3)); + h1_res4_->Fill(p(4) - (*s)(4)); + + h1_Beff_->Fill(p(0) / (*s)(0) * fBfield); + h2_dvsphi_->Fill(p(2), p(3)); + h1_par0_->Fill(p(0)); + h1_par1_->Fill(p(1)); + h1_par2_->Fill(p(2)); + h1_par3_->Fill(p(3)); + h1_par4_->Fill(p(4)); + } + } + } } diff --git a/Validation/RecoVertex/src/V0Validator.cc b/Validation/RecoVertex/src/V0Validator.cc index 17ff20370308b..2d8e0eb41dda8 100644 --- a/Validation/RecoVertex/src/V0Validator.cc +++ b/Validation/RecoVertex/src/V0Validator.cc @@ -22,35 +22,27 @@ typedef std::vector TrackingVertexCollection; typedef edm::Ref TrackingVertexRef; typedef edm::RefVector GenVertexRefVector; -typedef edm::RefVector - GenParticleRefVector; +typedef edm::RefVector GenParticleRefVector; V0Validator::V0Validator(const edm::ParameterSet& iConfig) - : theDQMRootFileName( - iConfig.getUntrackedParameter("DQMRootFileName")), + : theDQMRootFileName(iConfig.getUntrackedParameter("DQMRootFileName")), dirName(iConfig.getUntrackedParameter("dirName")), - recoRecoToSimCollectionToken_(consumes( - iConfig.getUntrackedParameter("trackAssociatorMap"))), - recoSimToRecoCollectionToken_(consumes( - iConfig.getUntrackedParameter("trackAssociatorMap"))), - trackingVertexCollection_Token_(consumes( - iConfig.getUntrackedParameter( - "trackingVertexCollection"))), - vec_recoVertex_Token_(consumes >( - iConfig.getUntrackedParameter("vertexCollection"))), - recoVertexCompositeCandidateCollection_k0s_Token_( - consumes( - iConfig.getUntrackedParameter( - "kShortCollection"))), - recoVertexCompositeCandidateCollection_lambda_Token_( - consumes( - iConfig.getUntrackedParameter( - "lambdaCollection"))) {} + recoRecoToSimCollectionToken_( + consumes(iConfig.getUntrackedParameter("trackAssociatorMap"))), + recoSimToRecoCollectionToken_( + consumes(iConfig.getUntrackedParameter("trackAssociatorMap"))), + trackingVertexCollection_Token_( + consumes(iConfig.getUntrackedParameter("trackingVertexCollection"))), + vec_recoVertex_Token_( + consumes >(iConfig.getUntrackedParameter("vertexCollection"))), + recoVertexCompositeCandidateCollection_k0s_Token_(consumes( + iConfig.getUntrackedParameter("kShortCollection"))), + recoVertexCompositeCandidateCollection_lambda_Token_(consumes( + iConfig.getUntrackedParameter("lambdaCollection"))) {} V0Validator::~V0Validator() {} -void V0Validator::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, - edm::EventSetup const&) { +void V0Validator::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, edm::EventSetup const&) { double minKsMass = 0.49767 - 0.07; double maxKsMass = 0.49767 + 0.07; double minLamMass = 1.1156 - 0.05; @@ -66,140 +58,122 @@ void V0Validator::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, std::string subDirName = V0Validator::dirName + "/K0"; ibooker.setCurrentFolder(subDirName); - candidateEffVsR_num_[V0Validator::KSHORT] = ibooker.book1D( - "K0sEffVsR_num", "K^{0}_{S} Efficiency vs #rho", 80, 0., 40.); - candidateEffVsEta_num_[V0Validator::KSHORT] = ibooker.book1D( - "K0sEffVsEta_num", "K^{0}_{S} Efficiency vs #eta", 40, -2.5, 2.5); - candidateEffVsPt_num_[V0Validator::KSHORT] = ibooker.book1D( - "K0sEffVsPt_num", "K^{0}_{S} Efficiency vs p_{T}", 70, 0., 20.); + candidateEffVsR_num_[V0Validator::KSHORT] = + ibooker.book1D("K0sEffVsR_num", "K^{0}_{S} Efficiency vs #rho", 80, 0., 40.); + candidateEffVsEta_num_[V0Validator::KSHORT] = + ibooker.book1D("K0sEffVsEta_num", "K^{0}_{S} Efficiency vs #eta", 40, -2.5, 2.5); + candidateEffVsPt_num_[V0Validator::KSHORT] = + ibooker.book1D("K0sEffVsPt_num", "K^{0}_{S} Efficiency vs p_{T}", 70, 0., 20.); - candidateTkEffVsR_num_[V0Validator::KSHORT] = ibooker.book1D( - "K0sTkEffVsR_num", "K^{0}_{S} Tracking Efficiency vs #rho", 80, 0., 40.); + candidateTkEffVsR_num_[V0Validator::KSHORT] = + ibooker.book1D("K0sTkEffVsR_num", "K^{0}_{S} Tracking Efficiency vs #rho", 80, 0., 40.); candidateTkEffVsEta_num_[V0Validator::KSHORT] = - ibooker.book1D("K0sTkEffVsEta_num", - "K^{0}_{S} Tracking Efficiency vs #eta", 40, -2.5, 2.5); + ibooker.book1D("K0sTkEffVsEta_num", "K^{0}_{S} Tracking Efficiency vs #eta", 40, -2.5, 2.5); candidateTkEffVsPt_num_[V0Validator::KSHORT] = - ibooker.book1D("K0sTkEffVsPt_num", - "K^{0}_{S} Tracking Efficiency vs p_{T}", 70, 0., 20.); - - candidateEffVsR_denom_[V0Validator::KSHORT] = ibooker.book1D( - "K0sEffVsR_denom", "K^{0}_{S} Efficiency vs #rho", 80, 0., 40.); - candidateEffVsEta_denom_[V0Validator::KSHORT] = ibooker.book1D( - "K0sEffVsEta_denom", "K^{0}_{S} Efficiency vs #eta", 40, -2.5, 2.5); - candidateEffVsPt_denom_[V0Validator::KSHORT] = ibooker.book1D( - "K0sEffVsPt_denom", "K^{0}_{S} Efficiency vs p_{T}", 70, 0., 20.); - - candidateFakeVsR_num_[V0Validator::KSHORT] = ibooker.book1D( - "K0sFakeVsR_num", "K^{0}_{S} Fake Rate vs #rho", 80, 0., 40.); - candidateFakeVsEta_num_[V0Validator::KSHORT] = ibooker.book1D( - "K0sFakeVsEta_num", "K^{0}_{S} Fake Rate vs #eta", 40, -2.5, 2.5); - candidateFakeVsPt_num_[V0Validator::KSHORT] = ibooker.book1D( - "K0sFakeVsPt_num", "K^{0}_{S} Fake Rate vs p_{T}", 70, 0., 20.); - candidateTkFakeVsR_num_[V0Validator::KSHORT] = ibooker.book1D( - "K0sTkFakeVsR_num", "K^{0}_{S} Tracking Fake Rate vs #rho", 80, 0., 80.); + ibooker.book1D("K0sTkEffVsPt_num", "K^{0}_{S} Tracking Efficiency vs p_{T}", 70, 0., 20.); + + candidateEffVsR_denom_[V0Validator::KSHORT] = + ibooker.book1D("K0sEffVsR_denom", "K^{0}_{S} Efficiency vs #rho", 80, 0., 40.); + candidateEffVsEta_denom_[V0Validator::KSHORT] = + ibooker.book1D("K0sEffVsEta_denom", "K^{0}_{S} Efficiency vs #eta", 40, -2.5, 2.5); + candidateEffVsPt_denom_[V0Validator::KSHORT] = + ibooker.book1D("K0sEffVsPt_denom", "K^{0}_{S} Efficiency vs p_{T}", 70, 0., 20.); + + candidateFakeVsR_num_[V0Validator::KSHORT] = + ibooker.book1D("K0sFakeVsR_num", "K^{0}_{S} Fake Rate vs #rho", 80, 0., 40.); + candidateFakeVsEta_num_[V0Validator::KSHORT] = + ibooker.book1D("K0sFakeVsEta_num", "K^{0}_{S} Fake Rate vs #eta", 40, -2.5, 2.5); + candidateFakeVsPt_num_[V0Validator::KSHORT] = + ibooker.book1D("K0sFakeVsPt_num", "K^{0}_{S} Fake Rate vs p_{T}", 70, 0., 20.); + candidateTkFakeVsR_num_[V0Validator::KSHORT] = + ibooker.book1D("K0sTkFakeVsR_num", "K^{0}_{S} Tracking Fake Rate vs #rho", 80, 0., 80.); candidateTkFakeVsEta_num_[V0Validator::KSHORT] = - ibooker.book1D("K0sTkFakeVsEta_num", - "K^{0}_{S} Tracking Fake Rate vs #eta", 40, -2.5, 2.5); + ibooker.book1D("K0sTkFakeVsEta_num", "K^{0}_{S} Tracking Fake Rate vs #eta", 40, -2.5, 2.5); candidateTkFakeVsPt_num_[V0Validator::KSHORT] = - ibooker.book1D("K0sTkFakeVsPt_num", - "K^{0}_{S} Tracking Fake Rate vs p_{T}", 70, 0., 20.); - - candidateFakeVsR_denom_[V0Validator::KSHORT] = ibooker.book1D( - "K0sFakeVsR_denom", "K^{0}_{S} Fake Rate vs #rho", 80, 0., 40.); - candidateFakeVsEta_denom_[V0Validator::KSHORT] = ibooker.book1D( - "K0sFakeVsEta_denom", "K^{0}_{S} Fake Rate vs #eta", 40, -2.5, 2.5); - candidateFakeVsPt_denom_[V0Validator::KSHORT] = ibooker.book1D( - "K0sFakeVsPt_denom", "K^{0}_{S} Fake Rate vs p_{T}", 70, 0., 20.); - nCandidates_[V0Validator::KSHORT] = ibooker.book1D( - "nK0s", "Number of K^{0}_{S} found per event", 60, 0., 60.); - fakeCandidateMass_[V0Validator::KSHORT] = ibooker.book1D( - "ksMassFake", "Mass of fake K0S", ksMassNbins, minKsMass, maxKsMass); - goodCandidateMass[V0Validator::KSHORT] = ibooker.book1D( - "ksMassGood", "Mass of good reco K0S", ksMassNbins, minKsMass, maxKsMass); + ibooker.book1D("K0sTkFakeVsPt_num", "K^{0}_{S} Tracking Fake Rate vs p_{T}", 70, 0., 20.); + + candidateFakeVsR_denom_[V0Validator::KSHORT] = + ibooker.book1D("K0sFakeVsR_denom", "K^{0}_{S} Fake Rate vs #rho", 80, 0., 40.); + candidateFakeVsEta_denom_[V0Validator::KSHORT] = + ibooker.book1D("K0sFakeVsEta_denom", "K^{0}_{S} Fake Rate vs #eta", 40, -2.5, 2.5); + candidateFakeVsPt_denom_[V0Validator::KSHORT] = + ibooker.book1D("K0sFakeVsPt_denom", "K^{0}_{S} Fake Rate vs p_{T}", 70, 0., 20.); + nCandidates_[V0Validator::KSHORT] = ibooker.book1D("nK0s", "Number of K^{0}_{S} found per event", 60, 0., 60.); + fakeCandidateMass_[V0Validator::KSHORT] = + ibooker.book1D("ksMassFake", "Mass of fake K0S", ksMassNbins, minKsMass, maxKsMass); + goodCandidateMass[V0Validator::KSHORT] = + ibooker.book1D("ksMassGood", "Mass of good reco K0S", ksMassNbins, minKsMass, maxKsMass); candidateMassAll[V0Validator::KSHORT] = - ibooker.book1D("ksMassAll", "Invariant mass of all K0S", ksMassNbins, - ksMassXmin, ksMassXmax); - candidateFakeDauRadDist_[V0Validator::KSHORT] = ibooker.book1D( - "radDistFakeKs", "Production radius of daughter particle of Ks fake", 100, - 0., 15.); - candidateStatus_[V0Validator::KSHORT] = - ibooker.book1D("ksCandStatus", "Fake type by cand status", 10, 0., 10.); + ibooker.book1D("ksMassAll", "Invariant mass of all K0S", ksMassNbins, ksMassXmin, ksMassXmax); + candidateFakeDauRadDist_[V0Validator::KSHORT] = + ibooker.book1D("radDistFakeKs", "Production radius of daughter particle of Ks fake", 100, 0., 15.); + candidateStatus_[V0Validator::KSHORT] = ibooker.book1D("ksCandStatus", "Fake type by cand status", 10, 0., 10.); // Lambda Plots follow subDirName = V0Validator::dirName + "/Lambda"; ibooker.setCurrentFolder(subDirName); - candidateEffVsR_num_[V0Validator::LAMBDA] = ibooker.book1D( - "LamEffVsR_num", "#Lambda^{0} Efficiency vs #rho", 80, 0., 40.); - candidateEffVsEta_num_[V0Validator::LAMBDA] = ibooker.book1D( - "LamEffVsEta_num", "#Lambda^{0} Efficiency vs #eta", 40, -2.5, 2.5); - candidateEffVsPt_num_[V0Validator::LAMBDA] = ibooker.book1D( - "LamEffVsPt_num", "#Lambda^{0} Efficiency vs p_{T}", 70, 0., 20.); + candidateEffVsR_num_[V0Validator::LAMBDA] = + ibooker.book1D("LamEffVsR_num", "#Lambda^{0} Efficiency vs #rho", 80, 0., 40.); + candidateEffVsEta_num_[V0Validator::LAMBDA] = + ibooker.book1D("LamEffVsEta_num", "#Lambda^{0} Efficiency vs #eta", 40, -2.5, 2.5); + candidateEffVsPt_num_[V0Validator::LAMBDA] = + ibooker.book1D("LamEffVsPt_num", "#Lambda^{0} Efficiency vs p_{T}", 70, 0., 20.); - candidateTkEffVsR_num_[V0Validator::LAMBDA] = ibooker.book1D( - "LamTkEffVsR_num", "#Lambda^{0} TrackingEfficiency vs #rho", 80, 0., 40.); + candidateTkEffVsR_num_[V0Validator::LAMBDA] = + ibooker.book1D("LamTkEffVsR_num", "#Lambda^{0} TrackingEfficiency vs #rho", 80, 0., 40.); candidateTkEffVsEta_num_[V0Validator::LAMBDA] = - ibooker.book1D("LamTkEffVsEta_num", - "#Lambda^{0} Tracking Efficiency vs #eta", 40, -2.5, 2.5); + ibooker.book1D("LamTkEffVsEta_num", "#Lambda^{0} Tracking Efficiency vs #eta", 40, -2.5, 2.5); candidateTkEffVsPt_num_[V0Validator::LAMBDA] = - ibooker.book1D("LamTkEffVsPt_num", - "#Lambda^{0} Tracking Efficiency vs p_{T}", 70, 0., 20.); - - candidateEffVsR_denom_[V0Validator::LAMBDA] = ibooker.book1D( - "LamEffVsR_denom", "#Lambda^{0} Efficiency vs #rho", 80, 0., 40.); - candidateEffVsEta_denom_[V0Validator::LAMBDA] = ibooker.book1D( - "LamEffVsEta_denom", "#Lambda^{0} Efficiency vs #eta", 40, -2.5, 2.5); - candidateEffVsPt_denom_[V0Validator::LAMBDA] = ibooker.book1D( - "LamEffVsPt_denom", "#Lambda^{0} Efficiency vs p_{T}", 70, 0., 20.); - - candidateFakeVsR_num_[V0Validator::LAMBDA] = ibooker.book1D( - "LamFakeVsR_num", "#Lambda^{0} Fake Rate vs #rho", 80, 0., 40.); - candidateFakeVsEta_num_[V0Validator::LAMBDA] = ibooker.book1D( - "LamFakeVsEta_num", "#Lambda^{0} Fake Rate vs #eta", 40, -2.5, 2.5); - candidateFakeVsPt_num_[V0Validator::LAMBDA] = ibooker.book1D( - "LamFakeVsPt_num", "#Lambda^{0} Fake Rate vs p_{T}", 70, 0., 20.); + ibooker.book1D("LamTkEffVsPt_num", "#Lambda^{0} Tracking Efficiency vs p_{T}", 70, 0., 20.); + + candidateEffVsR_denom_[V0Validator::LAMBDA] = + ibooker.book1D("LamEffVsR_denom", "#Lambda^{0} Efficiency vs #rho", 80, 0., 40.); + candidateEffVsEta_denom_[V0Validator::LAMBDA] = + ibooker.book1D("LamEffVsEta_denom", "#Lambda^{0} Efficiency vs #eta", 40, -2.5, 2.5); + candidateEffVsPt_denom_[V0Validator::LAMBDA] = + ibooker.book1D("LamEffVsPt_denom", "#Lambda^{0} Efficiency vs p_{T}", 70, 0., 20.); + + candidateFakeVsR_num_[V0Validator::LAMBDA] = + ibooker.book1D("LamFakeVsR_num", "#Lambda^{0} Fake Rate vs #rho", 80, 0., 40.); + candidateFakeVsEta_num_[V0Validator::LAMBDA] = + ibooker.book1D("LamFakeVsEta_num", "#Lambda^{0} Fake Rate vs #eta", 40, -2.5, 2.5); + candidateFakeVsPt_num_[V0Validator::LAMBDA] = + ibooker.book1D("LamFakeVsPt_num", "#Lambda^{0} Fake Rate vs p_{T}", 70, 0., 20.); candidateTkFakeVsR_num_[V0Validator::LAMBDA] = - ibooker.book1D("LamTkFakeVsR_num", - "#Lambda^{0} Tracking Fake Rate vs #rho", 80, 0., 40.); + ibooker.book1D("LamTkFakeVsR_num", "#Lambda^{0} Tracking Fake Rate vs #rho", 80, 0., 40.); candidateTkFakeVsEta_num_[V0Validator::LAMBDA] = - ibooker.book1D("LamTkFakeVsEta_num", - "#Lambda^{0} Tracking Fake Rate vs #eta", 40, -2.5, 2.5); + ibooker.book1D("LamTkFakeVsEta_num", "#Lambda^{0} Tracking Fake Rate vs #eta", 40, -2.5, 2.5); candidateTkFakeVsPt_num_[V0Validator::LAMBDA] = - ibooker.book1D("LamTkFakeVsPt_num", - "#Lambda^{0} Tracking Fake Rate vs p_{T}", 70, 0., 20.); - - candidateFakeVsR_denom_[V0Validator::LAMBDA] = ibooker.book1D( - "LamFakeVsR_denom", "#Lambda^{0} Fake Rate vs #rho", 80, 0., 40.); - candidateFakeVsEta_denom_[V0Validator::LAMBDA] = ibooker.book1D( - "LamFakeVsEta_denom", "#Lambda^{0} Fake Rate vs #eta", 40, -2.5, 2.5); - candidateFakeVsPt_denom_[V0Validator::LAMBDA] = ibooker.book1D( - "LamFakeVsPt_denom", "#Lambda^{0} Fake Rate vs p_{T}", 70, 0., 20.); - - nCandidates_[V0Validator::LAMBDA] = ibooker.book1D( - "nLam", "Number of #Lambda^{0} found per event", 60, 0., 60.); + ibooker.book1D("LamTkFakeVsPt_num", "#Lambda^{0} Tracking Fake Rate vs p_{T}", 70, 0., 20.); + + candidateFakeVsR_denom_[V0Validator::LAMBDA] = + ibooker.book1D("LamFakeVsR_denom", "#Lambda^{0} Fake Rate vs #rho", 80, 0., 40.); + candidateFakeVsEta_denom_[V0Validator::LAMBDA] = + ibooker.book1D("LamFakeVsEta_denom", "#Lambda^{0} Fake Rate vs #eta", 40, -2.5, 2.5); + candidateFakeVsPt_denom_[V0Validator::LAMBDA] = + ibooker.book1D("LamFakeVsPt_denom", "#Lambda^{0} Fake Rate vs p_{T}", 70, 0., 20.); + + nCandidates_[V0Validator::LAMBDA] = ibooker.book1D("nLam", "Number of #Lambda^{0} found per event", 60, 0., 60.); fakeCandidateMass_[V0Validator::LAMBDA] = - ibooker.book1D("lamMassFake", "Mass of fake Lambda", lamMassNbins, - minLamMass, maxLamMass); + ibooker.book1D("lamMassFake", "Mass of fake Lambda", lamMassNbins, minLamMass, maxLamMass); goodCandidateMass[V0Validator::LAMBDA] = - ibooker.book1D("lamMassGood", "Mass of good Lambda", lamMassNbins, - minLamMass, maxLamMass); + ibooker.book1D("lamMassGood", "Mass of good Lambda", lamMassNbins, minLamMass, maxLamMass); candidateMassAll[V0Validator::LAMBDA] = - ibooker.book1D("lamMassAll", "Invariant mass of all #Lambda^{0}", - lamMassNbins, lamMassXmin, lamMassXmax); - candidateFakeDauRadDist_[V0Validator::LAMBDA] = ibooker.book1D( - "radDistFakeLam", "Production radius of daughter particle of Lam fake", - 100, 0., 15.); - - candidateStatus_[V0Validator::LAMBDA] = - ibooker.book1D("ksCandStatus", "Fake type by cand status", 10, 0., 10.); + ibooker.book1D("lamMassAll", "Invariant mass of all #Lambda^{0}", lamMassNbins, lamMassXmin, lamMassXmax); + candidateFakeDauRadDist_[V0Validator::LAMBDA] = + ibooker.book1D("radDistFakeLam", "Production radius of daughter particle of Lam fake", 100, 0., 15.); + + candidateStatus_[V0Validator::LAMBDA] = ibooker.book1D("ksCandStatus", "Fake type by cand status", 10, 0., 10.); } -void V0Validator::doFakeRates( - const reco::VertexCompositeCandidateCollection& collection, - const reco::RecoToSimCollection& recotosimCollection, V0Type v0_type, - int particle_pdgid, int misreconstructed_particle_pdgid) { +void V0Validator::doFakeRates(const reco::VertexCompositeCandidateCollection& collection, + const reco::RecoToSimCollection& recotosimCollection, + V0Type v0_type, + int particle_pdgid, + int misreconstructed_particle_pdgid) { using namespace edm; int numCandidateFound = 0; @@ -211,9 +185,9 @@ void V0Validator::doFakeRates( int CandidateStatus = 0; const unsigned int NUM_DAUGHTERS = 2; if (!collection.empty()) { - for (reco::VertexCompositeCandidateCollection::const_iterator iCandidate = - collection.begin(); - iCandidate != collection.end(); iCandidate++) { + for (reco::VertexCompositeCandidateCollection::const_iterator iCandidate = collection.begin(); + iCandidate != collection.end(); + iCandidate++) { // Fill values to be histogrammed mass = iCandidate->mass(); CandidatepT = (sqrt(iCandidate->momentum().perp2())); @@ -223,10 +197,8 @@ void V0Validator::doFakeRates( CandidateStatus = 0; std::array theDaughterTracks = { - {(*(dynamic_cast( - iCandidate->daughter(0)))).track(), - (*(dynamic_cast( - iCandidate->daughter(1)))).track()}}; + {(*(dynamic_cast(iCandidate->daughter(0)))).track(), + (*(dynamic_cast(iCandidate->daughter(1)))).track()}}; TrackingParticleRef tpref; TrackingParticleRef firstDauTP; @@ -234,15 +206,13 @@ void V0Validator::doFakeRates( std::array radDist; // Loop through candidate's daugher tracks - for (View::size_type i = 0; i < theDaughterTracks.size(); - ++i) { + for (View::size_type i = 0; i < theDaughterTracks.size(); ++i) { radDist = {{-1., -1.}}; // Found track from theDaughterTracks RefToBase track(theDaughterTracks.at(i)); if (recotosimCollection.find(track) != recotosimCollection.end()) { - const std::vector >& tp = - recotosimCollection[track]; + const std::vector >& tp = recotosimCollection[track]; if (!tp.empty()) { tpref = tp.begin()->first; @@ -259,9 +229,9 @@ void V0Validator::doFakeRates( CandidateStatus = 6; } - for (TrackingVertex::tp_iterator iTP = - parentVertex->sourceTracks_begin(); - iTP != parentVertex->sourceTracks_end(); iTP++) { + for (TrackingVertex::tp_iterator iTP = parentVertex->sourceTracks_begin(); + iTP != parentVertex->sourceTracks_end(); + iTP++) { if (abs((*iTP)->pdgId()) == particle_pdgid) { CandidateStatus = 1; realCandidateFound++; @@ -269,8 +239,7 @@ void V0Validator::doFakeRates( goodCandidateMass[v0_type]->Fill(mass); } else { CandidateStatus = 2; - if (abs((*iTP)->pdgId()) == - misreconstructed_particle_pdgid) { + if (abs((*iTP)->pdgId()) == misreconstructed_particle_pdgid) { CandidateStatus = 7; } } @@ -307,7 +276,8 @@ void V0Validator::doFakeRates( candidateStatus_[v0_type]->Fill((float)CandidateStatus); fakeCandidateMass_[v0_type]->Fill(mass); for (auto distance : radDist) { - if (distance > 0) candidateFakeDauRadDist_[v0_type]->Fill(distance); + if (distance > 0) + candidateFakeDauRadDist_[v0_type]->Fill(distance); } } if (CandidateStatus == 5) { @@ -323,13 +293,13 @@ void V0Validator::doFakeRates( nCandidates_[v0_type]->Fill((float)numCandidateFound); } -void V0Validator::doEfficiencies( - const TrackingVertexCollection& gen_vertices, V0Type v0_type, - int parent_particle_id, - int first_daughter_id, /* give only positive charge */ - int second_daughter_id, /* give only positive charge */ - const reco::VertexCompositeCandidateCollection& collection, - const reco::SimToRecoCollection& simtorecoCollection) { +void V0Validator::doEfficiencies(const TrackingVertexCollection& gen_vertices, + V0Type v0_type, + int parent_particle_id, + int first_daughter_id, /* give only positive charge */ + int second_daughter_id, /* give only positive charge */ + const reco::VertexCompositeCandidateCollection& collection, + const reco::SimToRecoCollection& simtorecoCollection) { /* We store the TrackRef of the tracks that have been used to * produce the V0 under consideration here. This is used later to * check if a specific V0 has been really reconstructed or not. The @@ -338,14 +308,12 @@ void V0Validator::doEfficiencies( std::set reconstructed_V0_couples; if (!collection.empty()) { - for (reco::VertexCompositeCandidateCollection::const_iterator iCandidate = - collection.begin(); - iCandidate != collection.end(); iCandidate++) { + for (reco::VertexCompositeCandidateCollection::const_iterator iCandidate = collection.begin(); + iCandidate != collection.end(); + iCandidate++) { reconstructed_V0_couples.insert( - V0Couple((dynamic_cast( - iCandidate->daughter(0)))->track(), - (dynamic_cast( - iCandidate->daughter(1)))->track())); + V0Couple((dynamic_cast(iCandidate->daughter(0)))->track(), + (dynamic_cast(iCandidate->daughter(1)))->track())); } } @@ -363,23 +331,18 @@ void V0Validator::doEfficiencies( for (auto const& gen_vertex : gen_vertices) { if (gen_vertex.eventId().bunchCrossing() != 0) continue; // Consider only in-time events - if (gen_vertex.nDaughterTracks() != 2) continue; // Keep only V0 vertices - for (TrackingVertex::tp_iterator source = gen_vertex.sourceTracks_begin(); - source != gen_vertex.sourceTracks_end(); ++source) { + if (gen_vertex.nDaughterTracks() != 2) + continue; // Keep only V0 vertices + for (TrackingVertex::tp_iterator source = gen_vertex.sourceTracks_begin(); source != gen_vertex.sourceTracks_end(); + ++source) { if (std::abs((*source)->pdgId()) == parent_particle_id) { - if ((std::abs((gen_vertex.daughterTracks().at(0))->pdgId()) == - first_daughter_id && - std::abs((gen_vertex.daughterTracks().at(1))->pdgId()) == - second_daughter_id) || - (std::abs((gen_vertex.daughterTracks().at(0))->pdgId()) == - second_daughter_id && - std::abs((gen_vertex.daughterTracks().at(1))->pdgId()) == - first_daughter_id)) { - if ((std::abs((gen_vertex.daughterTracks().at(0))->momentum().eta()) < - 2.4 && + if ((std::abs((gen_vertex.daughterTracks().at(0))->pdgId()) == first_daughter_id && + std::abs((gen_vertex.daughterTracks().at(1))->pdgId()) == second_daughter_id) || + (std::abs((gen_vertex.daughterTracks().at(0))->pdgId()) == second_daughter_id && + std::abs((gen_vertex.daughterTracks().at(1))->pdgId()) == first_daughter_id)) { + if ((std::abs((gen_vertex.daughterTracks().at(0))->momentum().eta()) < 2.4 && gen_vertex.daughterTracks().at(0)->pt() > 0.9) && - (std::abs((gen_vertex.daughterTracks().at(1))->momentum().eta()) < - 2.4 && + (std::abs((gen_vertex.daughterTracks().at(1))->momentum().eta()) < 2.4 && gen_vertex.daughterTracks().at(1)->pt() > 0.9)) { // found desired generated Candidate float candidateGenpT = sqrt((*source)->momentum().perp2()); @@ -392,24 +355,18 @@ void V0Validator::doEfficiencies( std::array reco_daughter; for (unsigned int daughter = 0; daughter < 2; ++daughter) { - if (simtorecoCollection.find( - gen_vertex.daughterTracks()[daughter]) != - simtorecoCollection.end()) { + if (simtorecoCollection.find(gen_vertex.daughterTracks()[daughter]) != simtorecoCollection.end()) { if (!simtorecoCollection[gen_vertex.daughterTracks()[daughter]].empty()) { candidateEff[daughter] = 1; // Found a daughter track reco_daughter[daughter] = - simtorecoCollection[gen_vertex.daughterTracks()[daughter]] - .begin() - ->first.castTo(); + simtorecoCollection[gen_vertex.daughterTracks()[daughter]].begin()->first.castTo(); } } else { candidateEff[daughter] = 2; // First daughter not found } } - if ((candidateEff[0] == 1 && candidateEff[1] == 1) && - (reco_daughter[0].key() != reco_daughter[1].key()) && - (reconstructed_V0_couples.find( - V0Couple(reco_daughter[0], reco_daughter[1])) != + if ((candidateEff[0] == 1 && candidateEff[1] == 1) && (reco_daughter[0].key() != reco_daughter[1].key()) && + (reconstructed_V0_couples.find(V0Couple(reco_daughter[0], reco_daughter[1])) != reconstructed_V0_couples.end())) { candidateEffVsPt_num_[v0_type]->Fill(candidateGenpT); candidateEffVsEta_num_[v0_type]->Fill(candidateGenEta); @@ -422,8 +379,7 @@ void V0Validator::doEfficiencies( } // Loop over all generated vertices } -void V0Validator::analyze(const edm::Event& iEvent, - const edm::EventSetup& iSetup) { +void V0Validator::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using std::cout; using std::endl; using namespace edm; @@ -450,11 +406,10 @@ void V0Validator::analyze(const edm::Event& iEvent, edm::Handle > primaryVtxCollectionH; iEvent.getByToken(vec_recoVertex_Token_, primaryVtxCollectionH); - std::vector::const_iterator iVtxPH = - primaryVtxCollectionH->begin(); - for (std::vector::const_iterator iVtx = - primaryVtxCollectionH->begin(); - iVtx < primaryVtxCollectionH->end(); iVtx++) { + std::vector::const_iterator iVtxPH = primaryVtxCollectionH->begin(); + for (std::vector::const_iterator iVtx = primaryVtxCollectionH->begin(); + iVtx < primaryVtxCollectionH->end(); + iVtx++) { if (primaryVtxCollectionH->size() > 1) { if (iVtx->tracksSize() > iVtxPH->tracksSize()) { iVtxPH = iVtx; @@ -466,25 +421,30 @@ void V0Validator::analyze(const edm::Event& iEvent, // get the V0s; edm::Handle k0sCollection; edm::Handle lambdaCollection; - iEvent.getByToken(recoVertexCompositeCandidateCollection_k0s_Token_, - k0sCollection); - iEvent.getByToken(recoVertexCompositeCandidateCollection_lambda_Token_, - lambdaCollection); + iEvent.getByToken(recoVertexCompositeCandidateCollection_k0s_Token_, k0sCollection); + iEvent.getByToken(recoVertexCompositeCandidateCollection_lambda_Token_, lambdaCollection); // Do fake rate and efficiency calculation // Get gen vertex collection out of the event, as done in the Vertex // validation package!!! if (k0sCollection.isValid()) { - doFakeRates(*k0sCollection.product(), *recotosimCollectionH.product(), - V0Type::KSHORT, 310, 3122); - doEfficiencies(*TVCollectionH.product(), V0Type::KSHORT, 310, 211, 211, - *k0sCollection.product(), *simtorecoCollectionH.product()); + doFakeRates(*k0sCollection.product(), *recotosimCollectionH.product(), V0Type::KSHORT, 310, 3122); + doEfficiencies(*TVCollectionH.product(), + V0Type::KSHORT, + 310, + 211, + 211, + *k0sCollection.product(), + *simtorecoCollectionH.product()); } if (lambdaCollection.isValid()) { - doFakeRates(*lambdaCollection.product(), *recotosimCollectionH.product(), - V0Type::LAMBDA, 3122, 310); - doEfficiencies(*TVCollectionH.product(), V0Type::LAMBDA, 3122, 211, 2212, + doFakeRates(*lambdaCollection.product(), *recotosimCollectionH.product(), V0Type::LAMBDA, 3122, 310); + doEfficiencies(*TVCollectionH.product(), + V0Type::LAMBDA, + 3122, + 211, + 2212, *lambdaCollection.product(), *simtorecoCollectionH.product()); } diff --git a/Validation/RecoVertex/src/VertexHistogramMaker.cc b/Validation/RecoVertex/src/VertexHistogramMaker.cc index 044582f49d6eb..2f5f646c74c6b 100644 --- a/Validation/RecoVertex/src/VertexHistogramMaker.cc +++ b/Validation/RecoVertex/src/VertexHistogramMaker.cc @@ -12,362 +12,444 @@ #include "TH1F.h" #include "TProfile.h" - VertexHistogramMaker::VertexHistogramMaker(edm::ConsumesCollector&& iC) - : m_currdir(nullptr), m_maxLS(100), m_weightThreshold(0.5), m_trueOnly(true) - , m_runHisto(true), m_runHistoProfile(true), m_runHistoBXProfile(true), m_runHistoBXProfile2D(false), m_runHisto2D(false) - , m_bsConstrained(false) - , m_histoParameters() - , m_rhm(iC) - , m_fhm(iC) { } + : m_currdir(nullptr), + m_maxLS(100), + m_weightThreshold(0.5), + m_trueOnly(true), + m_runHisto(true), + m_runHistoProfile(true), + m_runHistoBXProfile(true), + m_runHistoBXProfile2D(false), + m_runHisto2D(false), + m_bsConstrained(false), + m_histoParameters(), + m_rhm(iC), + m_fhm(iC) {} VertexHistogramMaker::VertexHistogramMaker(const edm::ParameterSet& iConfig, edm::ConsumesCollector&& iC) - : m_currdir(nullptr) - , m_maxLS(iConfig.getParameter("maxLSBeforeRebin")) - , m_weightThreshold(iConfig.getUntrackedParameter("weightThreshold",0.5)) - , m_trueOnly(iConfig.getUntrackedParameter("trueOnly",true)) - , m_runHisto(iConfig.getUntrackedParameter("runHisto",true)) - , m_runHistoProfile(iConfig.getUntrackedParameter("runHistoProfile",true)) - , m_runHistoBXProfile(iConfig.getUntrackedParameter("runHistoBXProfile",true)) - , m_runHistoBXProfile2D(iConfig.getUntrackedParameter("runHistoBXProfile2D",false)) - , m_runHisto2D(iConfig.getUntrackedParameter("runHisto2D",false)) - , m_bsConstrained(iConfig.getParameter("bsConstrained")) - , m_histoParameters(iConfig.getUntrackedParameter("histoParameters",edm::ParameterSet())) - , m_lumiDetailsToken( iC.consumes< LumiDetails, edm::InLumi >( edm::InputTag( std::string( "lumiProducer" ) ) ) ) - , m_rhm(iC, false),m_fhm(iC, true) -{ } - - -VertexHistogramMaker::~VertexHistogramMaker() { - - delete m_currdir; - -} - + : m_currdir(nullptr), + m_maxLS(iConfig.getParameter("maxLSBeforeRebin")), + m_weightThreshold(iConfig.getUntrackedParameter("weightThreshold", 0.5)), + m_trueOnly(iConfig.getUntrackedParameter("trueOnly", true)), + m_runHisto(iConfig.getUntrackedParameter("runHisto", true)), + m_runHistoProfile(iConfig.getUntrackedParameter("runHistoProfile", true)), + m_runHistoBXProfile(iConfig.getUntrackedParameter("runHistoBXProfile", true)), + m_runHistoBXProfile2D(iConfig.getUntrackedParameter("runHistoBXProfile2D", false)), + m_runHisto2D(iConfig.getUntrackedParameter("runHisto2D", false)), + m_bsConstrained(iConfig.getParameter("bsConstrained")), + m_histoParameters(iConfig.getUntrackedParameter("histoParameters", edm::ParameterSet())), + m_lumiDetailsToken(iC.consumes(edm::InputTag(std::string("lumiProducer")))), + m_rhm(iC, false), + m_fhm(iC, true) {} + +VertexHistogramMaker::~VertexHistogramMaker() { delete m_currdir; } void VertexHistogramMaker::book(const std::string dirname) { - edm::Service tfserv; TFileDirectory* currdir = &(tfserv->tFileDirectory()); - if(dirname!="") { + if (!dirname.empty()) { currdir = new TFileDirectory(tfserv->mkdir(dirname)); m_currdir = currdir; } edm::LogInfo("HistogramBooking") << "Vertex histogram booking in directory " << dirname; - m_hnvtx = currdir->make("nvtx","Number of Vertices",60,-0.5,59.5); - m_hnvtx->GetXaxis()->SetTitle("vertices"); m_hnvtx->GetYaxis()->SetTitle("Events"); + m_hnvtx = currdir->make("nvtx", "Number of Vertices", 60, -0.5, 59.5); + m_hnvtx->GetXaxis()->SetTitle("vertices"); + m_hnvtx->GetYaxis()->SetTitle("Events"); - m_hntruevtx = currdir->make("ntruevtx","Number of True Vertices",60,-0.5,59.5); - m_hntruevtx->GetXaxis()->SetTitle("vertices"); m_hntruevtx->GetYaxis()->SetTitle("Events"); + m_hntruevtx = currdir->make("ntruevtx", "Number of True Vertices", 60, -0.5, 59.5); + m_hntruevtx->GetXaxis()->SetTitle("vertices"); + m_hntruevtx->GetYaxis()->SetTitle("Events"); - m_hntruevtxvslumi = currdir->make("ntruevtxvslumi","Number of True Vertices vs BX lumi",250,0.,10.); - m_hntruevtxvslumi->GetXaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]"); m_hntruevtxvslumi->GetYaxis()->SetTitle("Vertices"); + m_hntruevtxvslumi = currdir->make("ntruevtxvslumi", "Number of True Vertices vs BX lumi", 250, 0., 10.); + m_hntruevtxvslumi->GetXaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]"); + m_hntruevtxvslumi->GetYaxis()->SetTitle("Vertices"); - m_hntruevtxvslumi2D = currdir->make("ntruevtxvslumi2D","Number of True Vertices vs BX lumi",250,0.,10.,100,-0.5,99.5); - m_hntruevtxvslumi2D->GetXaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]"); m_hntruevtxvslumi2D->GetYaxis()->SetTitle("Vertices"); + m_hntruevtxvslumi2D = + currdir->make("ntruevtxvslumi2D", "Number of True Vertices vs BX lumi", 250, 0., 10., 100, -0.5, 99.5); + m_hntruevtxvslumi2D->GetXaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]"); + m_hntruevtxvslumi2D->GetYaxis()->SetTitle("Vertices"); - m_hntracks = currdir->make("ntracks","Number of Tracks",300,-0.5,299.5); - m_hntracks->GetXaxis()->SetTitle("tracks"); m_hntracks->GetYaxis()->SetTitle("Vertices"); + m_hntracks = currdir->make("ntracks", "Number of Tracks", 300, -0.5, 299.5); + m_hntracks->GetXaxis()->SetTitle("tracks"); + m_hntracks->GetYaxis()->SetTitle("Vertices"); - m_hsqsumptsq = currdir->make("sqsumptsq","sqrt(sum pt**2)",1000,0.,1000.); - m_hsqsumptsq->GetXaxis()->SetTitle("sqrt(#Sigma pt^{2}) (GeV)"); m_hsqsumptsq->GetYaxis()->SetTitle("Vertices"); + m_hsqsumptsq = currdir->make("sqsumptsq", "sqrt(sum pt**2)", 1000, 0., 1000.); + m_hsqsumptsq->GetXaxis()->SetTitle("sqrt(#Sigma pt^{2}) (GeV)"); + m_hsqsumptsq->GetYaxis()->SetTitle("Vertices"); char htitle[300]; - sprintf(htitle,"sqrt(sum pt**2) of Tracks weight > %f",m_weightThreshold); - m_hsqsumptsqheavy = currdir->make("sqsumptsqheavy",htitle,1000,0.,1000.); - m_hsqsumptsqheavy->GetXaxis()->SetTitle("sqrt(#Sigma pt^{2}) (GeV)"); m_hsqsumptsqheavy->GetYaxis()->SetTitle("Vertices"); - - sprintf(htitle,"Number of Tracks weight > %f",m_weightThreshold); - m_hnheavytracks = currdir->make("nheavytracks",htitle,200,-0.5,199.5); - m_hnheavytracks->GetXaxis()->SetTitle("tracks"); m_hnheavytracks->GetYaxis()->SetTitle("Vertices"); - - m_hndof = currdir->make("ndof","Number of degree of freedom",250,-0.5,499.5); - m_hndof->GetXaxis()->SetTitle("ndof"); m_hndof->GetYaxis()->SetTitle("Vertices"); - - m_hndofvstracks = currdir->make("ndofvstracks","Ndof vs Ntracks",300,-0.5,299.5,250,-0.5,499.5); - m_hndofvstracks->GetXaxis()->SetTitle("tracks"); m_hndofvstracks->GetYaxis()->SetTitle("ndof"); - - m_hndofvsvtxz = currdir->make("ndofvsvtxz","Ndof vs Vertex Z position",200, - m_histoParameters.getUntrackedParameter("zMin",-20.), - m_histoParameters.getUntrackedParameter("zMax",20.)); - m_hndofvsvtxz->GetXaxis()->SetTitle("Z [cm]"); m_hndofvsvtxz->GetYaxis()->SetTitle("ndof"); - - m_hntracksvsvtxz = currdir->make("ntracksvsvtxz","Ntracks vs Vertex Z position",200, - m_histoParameters.getUntrackedParameter("zMin",-20.), - m_histoParameters.getUntrackedParameter("zMax",20.)); - m_hntracksvsvtxz->GetXaxis()->SetTitle("Z [cm]"); m_hntracksvsvtxz->GetYaxis()->SetTitle("tracks"); - - m_haveweightvsvtxz = currdir->make("aveweightvsvtxz","Average weight vs Vertex Z position",200, - m_histoParameters.getUntrackedParameter("zMin",-20.), - m_histoParameters.getUntrackedParameter("zMax",20.)); - m_haveweightvsvtxz->GetXaxis()->SetTitle("Z [cm]"); m_haveweightvsvtxz->GetYaxis()->SetTitle("Average weight"); - - m_haveweightvsvtxzchk = currdir->make("aveweightvsvtxzchk","Average weight vs Vertex Z position (check)",200, - m_histoParameters.getUntrackedParameter("zMin",-20.), - m_histoParameters.getUntrackedParameter("zMax",20.)); - m_haveweightvsvtxzchk->GetXaxis()->SetTitle("Z [cm]"); m_haveweightvsvtxzchk->GetYaxis()->SetTitle("Average weight"); - - m_hweights = currdir->make("weights","Tracks weights",51,0.,1.02); - m_hweights->GetXaxis()->SetTitle("weights"); m_hweights->GetYaxis()->SetTitle("Tracks"); - - m_haveweight = currdir->make("aveweight","Tracks average weights sum",51,0.,1.02); - m_haveweight->GetXaxis()->SetTitle("Average weight"); m_haveweight->GetYaxis()->SetTitle("Vertices"); - - - m_hvtxx = currdir->make("vtxx","Vertex X position", - m_histoParameters.getUntrackedParameter("nBinX",200), - m_histoParameters.getUntrackedParameter("xMin",-1.), - m_histoParameters.getUntrackedParameter("xMax",1.) - ); - m_hvtxx->GetXaxis()->SetTitle("X [cm]"); m_hvtxx->GetYaxis()->SetTitle("Vertices"); - - m_hvtxy = currdir->make("vtxy","Vertex Y position", - m_histoParameters.getUntrackedParameter("nBinY",200), - m_histoParameters.getUntrackedParameter("yMin",-1.), - m_histoParameters.getUntrackedParameter("yMax",1.) - ); - m_hvtxy->GetXaxis()->SetTitle("Y [cm]"); m_hvtxy->GetYaxis()->SetTitle("Vertices"); - - m_hvtxz = currdir->make("vtxz","Vertex Z position", - m_histoParameters.getUntrackedParameter("nBinZ",200), - m_histoParameters.getUntrackedParameter("zMin",-20.), - m_histoParameters.getUntrackedParameter("zMax",20.) - ); - m_hvtxz->GetXaxis()->SetTitle("Z [cm]"); m_hvtxz->GetYaxis()->SetTitle("Vertices"); - - if(m_runHisto) { - m_hvtxxrun = m_rhm.makeTH1F("vtxxrun","Vertex X position", - m_histoParameters.getUntrackedParameter("nBinX",200), - m_histoParameters.getUntrackedParameter("xMin",-1.), - m_histoParameters.getUntrackedParameter("xMax",1.)); - - m_hvtxyrun = m_rhm.makeTH1F("vtxyrun","Vertex Y position", - m_histoParameters.getUntrackedParameter("nBinY",200), - m_histoParameters.getUntrackedParameter("yMin",-1.), - m_histoParameters.getUntrackedParameter("yMax",1.)); - - m_hvtxzrun = m_rhm.makeTH1F("vtxzrun","Vertex Z position", - m_histoParameters.getUntrackedParameter("nBinZ",200), - m_histoParameters.getUntrackedParameter("zMin",-20.), - m_histoParameters.getUntrackedParameter("zMax",20.)); - - if(m_runHistoProfile) { - m_hvtxxvsorbrun = m_rhm.makeTProfile("vtxxvsorbrun","Vertex X position vs orbit number",4*m_maxLS,0.5,m_maxLS*262144+0.5); - m_hvtxyvsorbrun = m_rhm.makeTProfile("vtxyvsorbrun","Vertex Y position vs orbit number",4*m_maxLS,0.5,m_maxLS*262144+0.5); - m_hvtxzvsorbrun = m_rhm.makeTProfile("vtxzvsorbrun","Vertex Z position vs orbit number",4*m_maxLS,0.5,m_maxLS*262144+0.5); - m_hnvtxvsorbrun = m_rhm.makeTProfile("nvtxvsorbrun","Number of true vertices vs orbit number",m_maxLS,0.5,m_maxLS*262144+0.5); + sprintf(htitle, "sqrt(sum pt**2) of Tracks weight > %f", m_weightThreshold); + m_hsqsumptsqheavy = currdir->make("sqsumptsqheavy", htitle, 1000, 0., 1000.); + m_hsqsumptsqheavy->GetXaxis()->SetTitle("sqrt(#Sigma pt^{2}) (GeV)"); + m_hsqsumptsqheavy->GetYaxis()->SetTitle("Vertices"); + + sprintf(htitle, "Number of Tracks weight > %f", m_weightThreshold); + m_hnheavytracks = currdir->make("nheavytracks", htitle, 200, -0.5, 199.5); + m_hnheavytracks->GetXaxis()->SetTitle("tracks"); + m_hnheavytracks->GetYaxis()->SetTitle("Vertices"); + + m_hndof = currdir->make("ndof", "Number of degree of freedom", 250, -0.5, 499.5); + m_hndof->GetXaxis()->SetTitle("ndof"); + m_hndof->GetYaxis()->SetTitle("Vertices"); + + m_hndofvstracks = currdir->make("ndofvstracks", "Ndof vs Ntracks", 300, -0.5, 299.5, 250, -0.5, 499.5); + m_hndofvstracks->GetXaxis()->SetTitle("tracks"); + m_hndofvstracks->GetYaxis()->SetTitle("ndof"); + + m_hndofvsvtxz = currdir->make("ndofvsvtxz", + "Ndof vs Vertex Z position", + 200, + m_histoParameters.getUntrackedParameter("zMin", -20.), + m_histoParameters.getUntrackedParameter("zMax", 20.)); + m_hndofvsvtxz->GetXaxis()->SetTitle("Z [cm]"); + m_hndofvsvtxz->GetYaxis()->SetTitle("ndof"); + + m_hntracksvsvtxz = currdir->make("ntracksvsvtxz", + "Ntracks vs Vertex Z position", + 200, + m_histoParameters.getUntrackedParameter("zMin", -20.), + m_histoParameters.getUntrackedParameter("zMax", 20.)); + m_hntracksvsvtxz->GetXaxis()->SetTitle("Z [cm]"); + m_hntracksvsvtxz->GetYaxis()->SetTitle("tracks"); + + m_haveweightvsvtxz = currdir->make("aveweightvsvtxz", + "Average weight vs Vertex Z position", + 200, + m_histoParameters.getUntrackedParameter("zMin", -20.), + m_histoParameters.getUntrackedParameter("zMax", 20.)); + m_haveweightvsvtxz->GetXaxis()->SetTitle("Z [cm]"); + m_haveweightvsvtxz->GetYaxis()->SetTitle("Average weight"); + + m_haveweightvsvtxzchk = currdir->make("aveweightvsvtxzchk", + "Average weight vs Vertex Z position (check)", + 200, + m_histoParameters.getUntrackedParameter("zMin", -20.), + m_histoParameters.getUntrackedParameter("zMax", 20.)); + m_haveweightvsvtxzchk->GetXaxis()->SetTitle("Z [cm]"); + m_haveweightvsvtxzchk->GetYaxis()->SetTitle("Average weight"); + + m_hweights = currdir->make("weights", "Tracks weights", 51, 0., 1.02); + m_hweights->GetXaxis()->SetTitle("weights"); + m_hweights->GetYaxis()->SetTitle("Tracks"); + + m_haveweight = currdir->make("aveweight", "Tracks average weights sum", 51, 0., 1.02); + m_haveweight->GetXaxis()->SetTitle("Average weight"); + m_haveweight->GetYaxis()->SetTitle("Vertices"); + + m_hvtxx = currdir->make("vtxx", + "Vertex X position", + m_histoParameters.getUntrackedParameter("nBinX", 200), + m_histoParameters.getUntrackedParameter("xMin", -1.), + m_histoParameters.getUntrackedParameter("xMax", 1.)); + m_hvtxx->GetXaxis()->SetTitle("X [cm]"); + m_hvtxx->GetYaxis()->SetTitle("Vertices"); + + m_hvtxy = currdir->make("vtxy", + "Vertex Y position", + m_histoParameters.getUntrackedParameter("nBinY", 200), + m_histoParameters.getUntrackedParameter("yMin", -1.), + m_histoParameters.getUntrackedParameter("yMax", 1.)); + m_hvtxy->GetXaxis()->SetTitle("Y [cm]"); + m_hvtxy->GetYaxis()->SetTitle("Vertices"); + + m_hvtxz = currdir->make("vtxz", + "Vertex Z position", + m_histoParameters.getUntrackedParameter("nBinZ", 200), + m_histoParameters.getUntrackedParameter("zMin", -20.), + m_histoParameters.getUntrackedParameter("zMax", 20.)); + m_hvtxz->GetXaxis()->SetTitle("Z [cm]"); + m_hvtxz->GetYaxis()->SetTitle("Vertices"); + + if (m_runHisto) { + m_hvtxxrun = m_rhm.makeTH1F("vtxxrun", + "Vertex X position", + m_histoParameters.getUntrackedParameter("nBinX", 200), + m_histoParameters.getUntrackedParameter("xMin", -1.), + m_histoParameters.getUntrackedParameter("xMax", 1.)); + + m_hvtxyrun = m_rhm.makeTH1F("vtxyrun", + "Vertex Y position", + m_histoParameters.getUntrackedParameter("nBinY", 200), + m_histoParameters.getUntrackedParameter("yMin", -1.), + m_histoParameters.getUntrackedParameter("yMax", 1.)); + + m_hvtxzrun = m_rhm.makeTH1F("vtxzrun", + "Vertex Z position", + m_histoParameters.getUntrackedParameter("nBinZ", 200), + m_histoParameters.getUntrackedParameter("zMin", -20.), + m_histoParameters.getUntrackedParameter("zMax", 20.)); + + if (m_runHistoProfile) { + m_hvtxxvsorbrun = m_rhm.makeTProfile( + "vtxxvsorbrun", "Vertex X position vs orbit number", 4 * m_maxLS, 0.5, m_maxLS * 262144 + 0.5); + m_hvtxyvsorbrun = m_rhm.makeTProfile( + "vtxyvsorbrun", "Vertex Y position vs orbit number", 4 * m_maxLS, 0.5, m_maxLS * 262144 + 0.5); + m_hvtxzvsorbrun = m_rhm.makeTProfile( + "vtxzvsorbrun", "Vertex Z position vs orbit number", 4 * m_maxLS, 0.5, m_maxLS * 262144 + 0.5); + m_hnvtxvsorbrun = m_rhm.makeTProfile( + "nvtxvsorbrun", "Number of true vertices vs orbit number", m_maxLS, 0.5, m_maxLS * 262144 + 0.5); } - if(m_runHisto2D) { - m_hnvtxvsbxvsorbrun = m_rhm.makeTProfile2D("nvtxvsbxvsorbrun","Number of true vertices vs BX vs orbit number", - 3564,-0.5,3563.5,m_maxLS,0.5,m_maxLS*262144+0.5); - m_hnvtxvsorbrun2D = m_rhm.makeTH2F("nvtxvsorbrun2D","Number of true vertices vs orbit number", - m_maxLS,0.5,m_maxLS*262144+0.5,60,-0.5,59.5); + if (m_runHisto2D) { + m_hnvtxvsbxvsorbrun = m_rhm.makeTProfile2D("nvtxvsbxvsorbrun", + "Number of true vertices vs BX vs orbit number", + 3564, + -0.5, + 3563.5, + m_maxLS, + 0.5, + m_maxLS * 262144 + 0.5); + m_hnvtxvsorbrun2D = m_rhm.makeTH2F("nvtxvsorbrun2D", + "Number of true vertices vs orbit number", + m_maxLS, + 0.5, + m_maxLS * 262144 + 0.5, + 60, + -0.5, + 59.5); } - if(m_runHistoBXProfile) { - m_hvtxxvsbxrun = m_fhm.makeTProfile("vtxxvsbxrun","Vertex X position vs BX number",3564,-0.5,3563.5); - m_hvtxyvsbxrun = m_fhm.makeTProfile("vtxyvsbxrun","Vertex Y position vs BX number",3564,-0.5,3563.5); - m_hvtxzvsbxrun = m_fhm.makeTProfile("vtxzvsbxrun","Vertex Z position vs BX number",3564,-0.5,3563.5); + if (m_runHistoBXProfile) { + m_hvtxxvsbxrun = m_fhm.makeTProfile("vtxxvsbxrun", "Vertex X position vs BX number", 3564, -0.5, 3563.5); + m_hvtxyvsbxrun = m_fhm.makeTProfile("vtxyvsbxrun", "Vertex Y position vs BX number", 3564, -0.5, 3563.5); + m_hvtxzvsbxrun = m_fhm.makeTProfile("vtxzvsbxrun", "Vertex Z position vs BX number", 3564, -0.5, 3563.5); - m_hnvtxvsbxrun = m_rhm.makeTProfile("nvtxvsbxrun","Number of true vertices vs BX number",3564,-0.5,3563.5); + m_hnvtxvsbxrun = m_rhm.makeTProfile("nvtxvsbxrun", "Number of true vertices vs BX number", 3564, -0.5, 3563.5); - if(m_runHistoBXProfile2D) { - m_hnvtxvsbxvslumirun = m_fhm.makeTProfile2D("nvtxvsbxvslumirun","Number of vertices vs BX and BX lumi",3564,-0.5,3563.5,250,0.,10.); + if (m_runHistoBXProfile2D) { + m_hnvtxvsbxvslumirun = m_fhm.makeTProfile2D( + "nvtxvsbxvslumirun", "Number of vertices vs BX and BX lumi", 3564, -0.5, 3563.5, 250, 0., 10.); } - if(m_runHisto2D) { - m_hvtxxvsbx2drun = m_fhm.makeTH2F("vtxxvsbx2drun","Vertex X position vs BX number",3564,-0.5,3563.5, - m_histoParameters.getUntrackedParameter("nBinX",200), - m_histoParameters.getUntrackedParameter("xMin",-1.), - m_histoParameters.getUntrackedParameter("xMax",1.)); - m_hvtxyvsbx2drun = m_fhm.makeTH2F("vtxyvsbx2drun","Vertex Y position vs BX number",3564,-0.5,3563.5, - m_histoParameters.getUntrackedParameter("nBinY",200), - m_histoParameters.getUntrackedParameter("yMin",-1.), - m_histoParameters.getUntrackedParameter("yMax",1.)); - m_hvtxzvsbx2drun = m_fhm.makeTH2F("vtxzvsbx2drun","Vertex Z position vs BX number",3564,-0.5,3563.5, - m_histoParameters.getUntrackedParameter("nBinZ",200), - m_histoParameters.getUntrackedParameter("zMin",-20.), - m_histoParameters.getUntrackedParameter("zMax",20.)); + if (m_runHisto2D) { + m_hvtxxvsbx2drun = m_fhm.makeTH2F("vtxxvsbx2drun", + "Vertex X position vs BX number", + 3564, + -0.5, + 3563.5, + m_histoParameters.getUntrackedParameter("nBinX", 200), + m_histoParameters.getUntrackedParameter("xMin", -1.), + m_histoParameters.getUntrackedParameter("xMax", 1.)); + m_hvtxyvsbx2drun = m_fhm.makeTH2F("vtxyvsbx2drun", + "Vertex Y position vs BX number", + 3564, + -0.5, + 3563.5, + m_histoParameters.getUntrackedParameter("nBinY", 200), + m_histoParameters.getUntrackedParameter("yMin", -1.), + m_histoParameters.getUntrackedParameter("yMax", 1.)); + m_hvtxzvsbx2drun = m_fhm.makeTH2F("vtxzvsbx2drun", + "Vertex Z position vs BX number", + 3564, + -0.5, + 3563.5, + m_histoParameters.getUntrackedParameter("nBinZ", 200), + m_histoParameters.getUntrackedParameter("zMin", -20.), + m_histoParameters.getUntrackedParameter("zMax", 20.)); } } - - } } void VertexHistogramMaker::beginRun(const edm::Run& iRun) { - TFileDirectory* currdir = m_currdir; - if(currdir==nullptr) { + if (currdir == nullptr) { edm::Service tfserv; currdir = &(tfserv->tFileDirectory()); } - m_rhm.beginRun(iRun,*currdir); - m_fhm.beginRun(iRun,*currdir); + m_rhm.beginRun(iRun, *currdir); + m_fhm.beginRun(iRun, *currdir); + if (m_runHisto) { + (*m_hvtxxrun)->GetXaxis()->SetTitle("X [cm]"); + (*m_hvtxxrun)->GetYaxis()->SetTitle("Vertices"); + (*m_hvtxyrun)->GetXaxis()->SetTitle("Y [cm]"); + (*m_hvtxyrun)->GetYaxis()->SetTitle("Vertices"); + (*m_hvtxzrun)->GetXaxis()->SetTitle("Z [cm]"); + (*m_hvtxzrun)->GetYaxis()->SetTitle("Vertices"); - if(m_runHisto) { - (*m_hvtxxrun)->GetXaxis()->SetTitle("X [cm]"); (*m_hvtxxrun)->GetYaxis()->SetTitle("Vertices"); - (*m_hvtxyrun)->GetXaxis()->SetTitle("Y [cm]"); (*m_hvtxyrun)->GetYaxis()->SetTitle("Vertices"); - (*m_hvtxzrun)->GetXaxis()->SetTitle("Z [cm]"); (*m_hvtxzrun)->GetYaxis()->SetTitle("Vertices"); - - if(m_runHistoProfile) { - (*m_hvtxxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*m_hvtxxvsorbrun)->GetYaxis()->SetTitle("X [cm]"); + if (m_runHistoProfile) { + (*m_hvtxxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); + (*m_hvtxxvsorbrun)->GetYaxis()->SetTitle("X [cm]"); (*m_hvtxxvsorbrun)->SetCanExtend(TH1::kAllAxes); - (*m_hvtxyvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*m_hvtxyvsorbrun)->GetYaxis()->SetTitle("Y [cm]"); + (*m_hvtxyvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); + (*m_hvtxyvsorbrun)->GetYaxis()->SetTitle("Y [cm]"); (*m_hvtxyvsorbrun)->SetCanExtend(TH1::kAllAxes); - (*m_hvtxzvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*m_hvtxzvsorbrun)->GetYaxis()->SetTitle("Z [cm]"); + (*m_hvtxzvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); + (*m_hvtxzvsorbrun)->GetYaxis()->SetTitle("Z [cm]"); (*m_hvtxzvsorbrun)->SetCanExtend(TH1::kAllAxes); - (*m_hnvtxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); (*m_hnvtxvsorbrun)->GetYaxis()->SetTitle("Nvertices"); + (*m_hnvtxvsorbrun)->GetXaxis()->SetTitle("time [orbit#]"); + (*m_hnvtxvsorbrun)->GetYaxis()->SetTitle("Nvertices"); (*m_hnvtxvsorbrun)->SetCanExtend(TH1::kAllAxes); } - if(m_runHistoBXProfile) { - (*m_hvtxxvsbxrun)->GetXaxis()->SetTitle("BX"); (*m_hvtxxvsbxrun)->GetYaxis()->SetTitle("X [cm]"); - (*m_hvtxyvsbxrun)->GetXaxis()->SetTitle("BX"); (*m_hvtxyvsbxrun)->GetYaxis()->SetTitle("Y [cm]"); - (*m_hvtxzvsbxrun)->GetXaxis()->SetTitle("BX"); (*m_hvtxzvsbxrun)->GetYaxis()->SetTitle("Z [cm]"); - (*m_hnvtxvsbxrun)->GetXaxis()->SetTitle("BX"); (*m_hnvtxvsbxrun)->GetYaxis()->SetTitle("Nvertices"); - if(m_runHistoBXProfile2D) { - (*m_hnvtxvsbxvslumirun)->GetXaxis()->SetTitle("BX"); (*m_hnvtxvsbxvslumirun)->GetYaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]"); + if (m_runHistoBXProfile) { + (*m_hvtxxvsbxrun)->GetXaxis()->SetTitle("BX"); + (*m_hvtxxvsbxrun)->GetYaxis()->SetTitle("X [cm]"); + (*m_hvtxyvsbxrun)->GetXaxis()->SetTitle("BX"); + (*m_hvtxyvsbxrun)->GetYaxis()->SetTitle("Y [cm]"); + (*m_hvtxzvsbxrun)->GetXaxis()->SetTitle("BX"); + (*m_hvtxzvsbxrun)->GetYaxis()->SetTitle("Z [cm]"); + (*m_hnvtxvsbxrun)->GetXaxis()->SetTitle("BX"); + (*m_hnvtxvsbxrun)->GetYaxis()->SetTitle("Nvertices"); + if (m_runHistoBXProfile2D) { + (*m_hnvtxvsbxvslumirun)->GetXaxis()->SetTitle("BX"); + (*m_hnvtxvsbxvslumirun)->GetYaxis()->SetTitle("BX lumi [10^{30}cm^{-2}s^{-1}]"); } - if(m_runHisto2D) { - (*m_hvtxxvsbx2drun)->GetXaxis()->SetTitle("BX"); (*m_hvtxxvsbx2drun)->GetYaxis()->SetTitle("X [cm]"); - (*m_hvtxyvsbx2drun)->GetXaxis()->SetTitle("BX"); (*m_hvtxyvsbx2drun)->GetYaxis()->SetTitle("Y [cm]"); - (*m_hvtxzvsbx2drun)->GetXaxis()->SetTitle("BX"); (*m_hvtxzvsbx2drun)->GetYaxis()->SetTitle("Z [cm]"); + if (m_runHisto2D) { + (*m_hvtxxvsbx2drun)->GetXaxis()->SetTitle("BX"); + (*m_hvtxxvsbx2drun)->GetYaxis()->SetTitle("X [cm]"); + (*m_hvtxyvsbx2drun)->GetXaxis()->SetTitle("BX"); + (*m_hvtxyvsbx2drun)->GetYaxis()->SetTitle("Y [cm]"); + (*m_hvtxzvsbx2drun)->GetXaxis()->SetTitle("BX"); + (*m_hvtxzvsbx2drun)->GetYaxis()->SetTitle("Z [cm]"); } } - if(m_runHisto2D) { - (*m_hnvtxvsbxvsorbrun)->GetXaxis()->SetTitle("BX#"); (*m_hnvtxvsbxvsorbrun)->GetYaxis()->SetTitle("time [orbit#]"); + if (m_runHisto2D) { + (*m_hnvtxvsbxvsorbrun)->GetXaxis()->SetTitle("BX#"); + (*m_hnvtxvsbxvsorbrun)->GetYaxis()->SetTitle("time [orbit#]"); (*m_hnvtxvsbxvsorbrun)->SetCanExtend(TH1::kAllAxes); - (*m_hnvtxvsorbrun2D)->GetXaxis()->SetTitle("time [orbit#]"); (*m_hnvtxvsorbrun2D)->GetYaxis()->SetTitle("Nvertices"); + (*m_hnvtxvsorbrun2D)->GetXaxis()->SetTitle("time [orbit#]"); + (*m_hnvtxvsorbrun2D)->GetYaxis()->SetTitle("Nvertices"); (*m_hnvtxvsorbrun2D)->SetCanExtend(TH1::kAllAxes); } } } -void VertexHistogramMaker::fill(const unsigned int orbit, const int bx, const float bxlumi, const reco::VertexCollection& vertices, const double weight) { - - m_hnvtx->Fill(vertices.size(),weight); +void VertexHistogramMaker::fill(const unsigned int orbit, + const int bx, + const float bxlumi, + const reco::VertexCollection& vertices, + const double weight) { + m_hnvtx->Fill(vertices.size(), weight); int ntruevtx = 0; - for(reco::VertexCollection::const_iterator vtx=vertices.begin();vtx!=vertices.end();++vtx) { - if(!vtx->isFake()) ntruevtx++; - - if(!(m_trueOnly && vtx->isFake())) { - - double aveweight = m_bsConstrained ? vtx->ndof()/(2.*vtx->tracksSize()) : (vtx->ndof()+3)/(2.*vtx->tracksSize()); - - m_hntracks->Fill(vtx->tracksSize(),weight); - m_hndof->Fill(vtx->ndof(),weight); - m_haveweight->Fill(aveweight,weight); - m_hndofvstracks->Fill(vtx->tracksSize(),vtx->ndof(),weight); - m_hndofvsvtxz->Fill(vtx->z(),vtx->ndof(),weight); - m_hntracksvsvtxz->Fill(vtx->z(),vtx->tracksSize(),weight); - m_haveweightvsvtxz->Fill(vtx->z(),aveweight,weight); - - m_hvtxx->Fill(vtx->x(),weight); - m_hvtxy->Fill(vtx->y(),weight); - m_hvtxz->Fill(vtx->z(),weight); - - if(m_runHisto) { - if(m_hvtxxrun && *m_hvtxxrun ) (*m_hvtxxrun)->Fill(vtx->x(),weight); - if(m_hvtxyrun && *m_hvtxyrun ) (*m_hvtxyrun)->Fill(vtx->y(),weight); - if(m_hvtxzrun && *m_hvtxzrun ) (*m_hvtxzrun)->Fill(vtx->z(),weight); - if(m_runHistoProfile) { - if(m_hvtxxvsorbrun && *m_hvtxxvsorbrun ) (*m_hvtxxvsorbrun)->Fill(orbit,vtx->x(),weight); - if(m_hvtxyvsorbrun && *m_hvtxyvsorbrun ) (*m_hvtxyvsorbrun)->Fill(orbit,vtx->y(),weight); - if(m_hvtxzvsorbrun && *m_hvtxzvsorbrun ) (*m_hvtxzvsorbrun)->Fill(orbit,vtx->z(),weight); - } - if(m_runHistoBXProfile) { - if(m_hvtxxvsbxrun && *m_hvtxxvsbxrun ) (*m_hvtxxvsbxrun)->Fill(bx%3564,vtx->x(),weight); - if(m_hvtxyvsbxrun && *m_hvtxyvsbxrun ) (*m_hvtxyvsbxrun)->Fill(bx%3564,vtx->y(),weight); - if(m_hvtxzvsbxrun && *m_hvtxzvsbxrun ) (*m_hvtxzvsbxrun)->Fill(bx%3564,vtx->z(),weight); - if(m_runHisto2D) { - if(m_hvtxxvsbx2drun && *m_hvtxxvsbx2drun ) (*m_hvtxxvsbx2drun)->Fill(bx%3564,vtx->x(),weight); - if(m_hvtxyvsbx2drun && *m_hvtxyvsbx2drun ) (*m_hvtxyvsbx2drun)->Fill(bx%3564,vtx->y(),weight); - if(m_hvtxzvsbx2drun && *m_hvtxzvsbx2drun ) (*m_hvtxzvsbx2drun)->Fill(bx%3564,vtx->z(),weight); - } - } + for (reco::VertexCollection::const_iterator vtx = vertices.begin(); vtx != vertices.end(); ++vtx) { + if (!vtx->isFake()) + ntruevtx++; + + if (!(m_trueOnly && vtx->isFake())) { + double aveweight = + m_bsConstrained ? vtx->ndof() / (2. * vtx->tracksSize()) : (vtx->ndof() + 3) / (2. * vtx->tracksSize()); + + m_hntracks->Fill(vtx->tracksSize(), weight); + m_hndof->Fill(vtx->ndof(), weight); + m_haveweight->Fill(aveweight, weight); + m_hndofvstracks->Fill(vtx->tracksSize(), vtx->ndof(), weight); + m_hndofvsvtxz->Fill(vtx->z(), vtx->ndof(), weight); + m_hntracksvsvtxz->Fill(vtx->z(), vtx->tracksSize(), weight); + m_haveweightvsvtxz->Fill(vtx->z(), aveweight, weight); + + m_hvtxx->Fill(vtx->x(), weight); + m_hvtxy->Fill(vtx->y(), weight); + m_hvtxz->Fill(vtx->z(), weight); + + if (m_runHisto) { + if (m_hvtxxrun && *m_hvtxxrun) + (*m_hvtxxrun)->Fill(vtx->x(), weight); + if (m_hvtxyrun && *m_hvtxyrun) + (*m_hvtxyrun)->Fill(vtx->y(), weight); + if (m_hvtxzrun && *m_hvtxzrun) + (*m_hvtxzrun)->Fill(vtx->z(), weight); + if (m_runHistoProfile) { + if (m_hvtxxvsorbrun && *m_hvtxxvsorbrun) + (*m_hvtxxvsorbrun)->Fill(orbit, vtx->x(), weight); + if (m_hvtxyvsorbrun && *m_hvtxyvsorbrun) + (*m_hvtxyvsorbrun)->Fill(orbit, vtx->y(), weight); + if (m_hvtxzvsorbrun && *m_hvtxzvsorbrun) + (*m_hvtxzvsorbrun)->Fill(orbit, vtx->z(), weight); + } + if (m_runHistoBXProfile) { + if (m_hvtxxvsbxrun && *m_hvtxxvsbxrun) + (*m_hvtxxvsbxrun)->Fill(bx % 3564, vtx->x(), weight); + if (m_hvtxyvsbxrun && *m_hvtxyvsbxrun) + (*m_hvtxyvsbxrun)->Fill(bx % 3564, vtx->y(), weight); + if (m_hvtxzvsbxrun && *m_hvtxzvsbxrun) + (*m_hvtxzvsbxrun)->Fill(bx % 3564, vtx->z(), weight); + if (m_runHisto2D) { + if (m_hvtxxvsbx2drun && *m_hvtxxvsbx2drun) + (*m_hvtxxvsbx2drun)->Fill(bx % 3564, vtx->x(), weight); + if (m_hvtxyvsbx2drun && *m_hvtxyvsbx2drun) + (*m_hvtxyvsbx2drun)->Fill(bx % 3564, vtx->y(), weight); + if (m_hvtxzvsbx2drun && *m_hvtxzvsbx2drun) + (*m_hvtxzvsbx2drun)->Fill(bx % 3564, vtx->z(), weight); + } + } } int nheavytracks = 0; double sumpt2 = 0.; double sumpt2heavy = 0.; - for(reco::Vertex::trackRef_iterator trk=vtx->tracks_begin();trk!=vtx->tracks_end();++trk) { + for (reco::Vertex::trackRef_iterator trk = vtx->tracks_begin(); trk != vtx->tracks_end(); ++trk) { + sumpt2 += (*trk)->pt() * (*trk)->pt(); - sumpt2 += (*trk)->pt()*(*trk)->pt(); - - if(vtx->trackWeight(*trk) > m_weightThreshold) { - nheavytracks++; - sumpt2heavy += (*trk)->pt()*(*trk)->pt(); - } - - m_hweights->Fill(vtx->trackWeight(*trk),weight); - m_haveweightvsvtxzchk->Fill(vtx->z(),vtx->trackWeight(*trk),weight); + if (vtx->trackWeight(*trk) > m_weightThreshold) { + nheavytracks++; + sumpt2heavy += (*trk)->pt() * (*trk)->pt(); + } + m_hweights->Fill(vtx->trackWeight(*trk), weight); + m_haveweightvsvtxzchk->Fill(vtx->z(), vtx->trackWeight(*trk), weight); } - m_hnheavytracks->Fill(nheavytracks,weight); - m_hsqsumptsq->Fill(sqrt(sumpt2),weight); - m_hsqsumptsqheavy->Fill(sqrt(sumpt2heavy),weight); - - + m_hnheavytracks->Fill(nheavytracks, weight); + m_hsqsumptsq->Fill(sqrt(sumpt2), weight); + m_hsqsumptsqheavy->Fill(sqrt(sumpt2heavy), weight); } - - } - m_hntruevtx->Fill(ntruevtx,weight); + m_hntruevtx->Fill(ntruevtx, weight); - if(bxlumi >= 0.) { - m_hntruevtxvslumi->Fill(bxlumi,ntruevtx,weight); - m_hntruevtxvslumi2D->Fill(bxlumi,ntruevtx,weight); + if (bxlumi >= 0.) { + m_hntruevtxvslumi->Fill(bxlumi, ntruevtx, weight); + m_hntruevtxvslumi2D->Fill(bxlumi, ntruevtx, weight); } - if(m_runHisto) { - if(m_runHistoProfile) { - if(m_hnvtxvsorbrun && *m_hnvtxvsorbrun ) (*m_hnvtxvsorbrun)->Fill(orbit,ntruevtx,weight); + if (m_runHisto) { + if (m_runHistoProfile) { + if (m_hnvtxvsorbrun && *m_hnvtxvsorbrun) + (*m_hnvtxvsorbrun)->Fill(orbit, ntruevtx, weight); } - if(m_runHistoBXProfile) { - if(m_hnvtxvsbxrun && *m_hnvtxvsbxrun ) (*m_hnvtxvsbxrun)->Fill(bx%3564,ntruevtx,weight); - if(m_runHistoBXProfile2D) { - if(m_hnvtxvsbxvslumirun && *m_hnvtxvsbxvslumirun && bxlumi >= 0.) (*m_hnvtxvsbxvslumirun)->Fill(bx%3564,bxlumi,ntruevtx,weight); + if (m_runHistoBXProfile) { + if (m_hnvtxvsbxrun && *m_hnvtxvsbxrun) + (*m_hnvtxvsbxrun)->Fill(bx % 3564, ntruevtx, weight); + if (m_runHistoBXProfile2D) { + if (m_hnvtxvsbxvslumirun && *m_hnvtxvsbxvslumirun && bxlumi >= 0.) + (*m_hnvtxvsbxvslumirun)->Fill(bx % 3564, bxlumi, ntruevtx, weight); } } - if(m_runHisto2D) { - if(m_hnvtxvsbxvsorbrun && *m_hnvtxvsbxvsorbrun ) (*m_hnvtxvsbxvsorbrun)->Fill(bx%3564,orbit,ntruevtx,weight); - if(m_hnvtxvsorbrun2D && *m_hnvtxvsorbrun2D ) { - if(ntruevtx < (*m_hnvtxvsorbrun2D)->GetYaxis()->GetXmax() && ntruevtx > (*m_hnvtxvsorbrun2D)->GetYaxis()->GetXmin()) { - (*m_hnvtxvsorbrun2D)->Fill(orbit,ntruevtx,weight); - } + if (m_runHisto2D) { + if (m_hnvtxvsbxvsorbrun && *m_hnvtxvsbxvsorbrun) + (*m_hnvtxvsbxvsorbrun)->Fill(bx % 3564, orbit, ntruevtx, weight); + if (m_hnvtxvsorbrun2D && *m_hnvtxvsorbrun2D) { + if (ntruevtx < (*m_hnvtxvsorbrun2D)->GetYaxis()->GetXmax() && + ntruevtx > (*m_hnvtxvsorbrun2D)->GetYaxis()->GetXmin()) { + (*m_hnvtxvsorbrun2D)->Fill(orbit, ntruevtx, weight); + } } } } - - } void VertexHistogramMaker::fill(const edm::Event& iEvent, const reco::VertexCollection& vertices, const double weight) { - // get luminosity edm::Handle ld; - iEvent.getLuminosityBlock().getByToken( m_lumiDetailsToken, ld ); + iEvent.getLuminosityBlock().getByToken(m_lumiDetailsToken, ld); float bxlumi = -1.; - if(ld.isValid()) { - if(ld->isValid()) { - bxlumi = ld->lumiValue(LumiDetails::kOCC1,iEvent.bunchCrossing())*6.37; + if (ld.isValid()) { + if (ld->isValid()) { + bxlumi = ld->lumiValue(LumiDetails::kOCC1, iEvent.bunchCrossing()) * 6.37; } } - fill(iEvent.orbitNumber(),iEvent.bunchCrossing(),bxlumi,vertices,weight); - + fill(iEvent.orbitNumber(), iEvent.bunchCrossing(), bxlumi, vertices, weight); } diff --git a/Validation/RecoVertex/src/VertexWeighter.cc b/Validation/RecoVertex/src/VertexWeighter.cc index 500266a44882f..38cc89d87e972 100644 --- a/Validation/RecoVertex/src/VertexWeighter.cc +++ b/Validation/RecoVertex/src/VertexWeighter.cc @@ -3,39 +3,40 @@ #include #include "FWCore/ParameterSet/interface/ParameterSet.h" - -VertexWeighter::VertexWeighter(): - m_sigma_init(1.), m_mean_init(0.), m_sigma_final(1.), m_usemain(false), m_dummy(true) { } - -VertexWeighter::VertexWeighter(const double& sigma_init, const double& mean_init, const double& sigma_final, const bool& usemainvtx): - m_sigma_init(sigma_init), m_mean_init(mean_init), m_sigma_final(sigma_final), m_usemain(usemainvtx), m_dummy(false) { } - -VertexWeighter::VertexWeighter(const edm::ParameterSet& iConfig): - m_sigma_init(iConfig.getParameter("initSigma")), - m_mean_init(iConfig.getParameter("initMean")), - m_sigma_final(iConfig.getParameter("finalSigma")), - m_usemain(iConfig.getParameter("useMainVertex")), - m_dummy(false) { } +VertexWeighter::VertexWeighter() + : m_sigma_init(1.), m_mean_init(0.), m_sigma_final(1.), m_usemain(false), m_dummy(true) {} + +VertexWeighter::VertexWeighter(const double& sigma_init, + const double& mean_init, + const double& sigma_final, + const bool& usemainvtx) + : m_sigma_init(sigma_init), + m_mean_init(mean_init), + m_sigma_final(sigma_final), + m_usemain(usemainvtx), + m_dummy(false) {} + +VertexWeighter::VertexWeighter(const edm::ParameterSet& iConfig) + : m_sigma_init(iConfig.getParameter("initSigma")), + m_mean_init(iConfig.getParameter("initMean")), + m_sigma_final(iConfig.getParameter("finalSigma")), + m_usemain(iConfig.getParameter("useMainVertex")), + m_dummy(false) {} const double VertexWeighter::weight(const std::vector& zpositions, const float& zmain) const { - double final_weight = 1.; - if(!m_dummy) { - - for(std::vector::const_iterator zpos = zpositions.begin() ; zpos != zpositions.end() ; ++zpos) { - - final_weight *= (m_sigma_init/m_sigma_final) * exp(-pow((*zpos-m_mean_init),2)/2.*(1./pow(m_sigma_final,2)-1./pow(m_sigma_init,2))); - + if (!m_dummy) { + for (std::vector::const_iterator zpos = zpositions.begin(); zpos != zpositions.end(); ++zpos) { + final_weight *= (m_sigma_init / m_sigma_final) * exp(-pow((*zpos - m_mean_init), 2) / 2. * + (1. / pow(m_sigma_final, 2) - 1. / pow(m_sigma_init, 2))); } - if(m_usemain) { - final_weight *= (m_sigma_init/m_sigma_final) * exp(-pow((zmain-m_mean_init),2)/2.*(1./pow(m_sigma_final,2)-1./pow(m_sigma_init,2))); + if (m_usemain) { + final_weight *= (m_sigma_init / m_sigma_final) * exp(-pow((zmain - m_mean_init), 2) / 2. * + (1. / pow(m_sigma_final, 2) - 1. / pow(m_sigma_init, 2))); } - } return final_weight; - - }