/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
CondTools/CTPPS/plugins/CTPPSPixelDAQMappingAnalyzer.cc
76 строк
3 KB
Jan Kaspar
apply formatting
07 июл 2021, 14:46
07 июл 2021, 14:46
9d07a3a
Код
Авторство
О чём код?
// system include files #include <memory> #include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "CondCore/CondDB/interface/Time.h" #include "CondFormats/PPSObjects/interface/CTPPSPixelDAQMapping.h" #include "CondFormats/DataRecord/interface/CTPPSPixelDAQMappingRcd.h" #include "CondFormats/PPSObjects/interface/CTPPSPixelAnalysisMask.h" #include "CondFormats/DataRecord/interface/CTPPSPixelAnalysisMaskRcd.h" using namespace std; class CTPPSPixelDAQMappingAnalyzer : public edm::one::EDAnalyzer<> { public: string label_; cond::Time_t daqmappingiov_; cond::Time_t analysismaskiov_; edm::ESGetToken<CTPPSPixelDAQMapping, CTPPSPixelDAQMappingRcd> tokenMapping_; edm::ESGetToken<CTPPSPixelAnalysisMask, CTPPSPixelAnalysisMaskRcd> tokenMask_; explicit CTPPSPixelDAQMappingAnalyzer(edm::ParameterSet const& iConfig) : label_(iConfig.getUntrackedParameter<string>("label", "RPix")), daqmappingiov_(iConfig.getParameter<unsigned long long>("daqmappingiov")), analysismaskiov_(iConfig.getParameter<unsigned long long>("analysismaskiov")), tokenMapping_(esConsumes<CTPPSPixelDAQMapping, CTPPSPixelDAQMappingRcd>(edm::ESInputTag("", label_))), tokenMask_(esConsumes<CTPPSPixelAnalysisMask, CTPPSPixelAnalysisMaskRcd>(edm::ESInputTag("", label_))) {} explicit CTPPSPixelDAQMappingAnalyzer(int i) {} ~CTPPSPixelDAQMappingAnalyzer() override {} void analyze(const edm::Event& e, const edm::EventSetup& c) override; }; void CTPPSPixelDAQMappingAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) { using namespace edm; /*edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("CTPPSPixelDAQMappingRcd")); if( recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) { //record not found std::cout <<"Record \"CTPPSPixelDAQMappingRcd"<<"\" does not exist "<<std::endl; }*/ //this part gets the handle of the event source and the record (i.e. the Database) if (e.id().run() == daqmappingiov_) { ESHandle<CTPPSPixelDAQMapping> mapping = context.getHandle(tokenMapping_); // print mapping /*printf("* DAQ mapping\n"); for (const auto &p : mapping->ROCMapping) std::cout << " " << p.first << " -> " << p.second << std::endl;*/ } //edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("CTPPSPixelAnalysisMaskRcd")); //if( recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) { //record not found //std::cout <<"Record \"CTPPSPixelAnalysisMaskRcd"<<"\" does not exist "<<std::endl; //} if (e.id().run() == analysismaskiov_) { // get analysis mask to mask channels ESHandle<CTPPSPixelAnalysisMask> analysisMask = context.getHandle(tokenMask_); // print mask /*printf("* mask\n"); for (const auto &p : analysisMask->analysisMask) cout << " " << p.first << ": fullMask=" << p.second.fullMask << ", number of masked channels " << p.second.maskedPixels.size() << endl; */ } } DEFINE_FWK_MODULE(CTPPSPixelDAQMappingAnalyzer);