Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:42:33

0001 /****************************************************************************
0002  *
0003  * This is a part of TOTEM offline software.
0004  * Authors: 
0005  *  Jan Kašpar (jan.kaspar@gmail.com) 
0006  *
0007  ****************************************************************************/
0008 
0009 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 #include "FWCore/Framework/interface/EventSetup.h"
0013 #include "FWCore/Framework/interface/MakerMacros.h"
0014 #include "FWCore/Framework/interface/ESHandle.h"
0015 
0016 #include "CondFormats/DataRecord/interface/TotemReadoutRcd.h"
0017 #include "CondFormats/PPSObjects/interface/TotemDAQMapping.h"
0018 #include "CondFormats/PPSObjects/interface/TotemAnalysisMask.h"
0019 
0020 //----------------------------------------------------------------------------------------------------
0021 
0022 /**
0023  *\brief Prints the DAQ mapping loaded by TotemDAQMappingESSourceXML.
0024  **/
0025 class PrintTotemDAQMapping : public edm::one::EDAnalyzer<> {
0026 public:
0027   PrintTotemDAQMapping(const edm::ParameterSet &ps);
0028   ~PrintTotemDAQMapping() override {}
0029 
0030 private:
0031   /// label of the CTPPS sub-system
0032   std::string subSystemName;
0033   edm::ESGetToken<TotemDAQMapping, TotemReadoutRcd> mappingToken_;
0034   edm::ESGetToken<TotemAnalysisMask, TotemReadoutRcd> maskToken_;
0035   void analyze(const edm::Event &e, const edm::EventSetup &es) override;
0036 };
0037 
0038 PrintTotemDAQMapping::PrintTotemDAQMapping(const edm::ParameterSet &ps)
0039     : subSystemName(ps.getUntrackedParameter<std::string>("subSystem")),
0040       mappingToken_(esConsumes(edm::ESInputTag("", subSystemName))),
0041       maskToken_(esConsumes(edm::ESInputTag("", subSystemName))) {}
0042 
0043 //----------------------------------------------------------------------------------------------------
0044 
0045 void PrintTotemDAQMapping::analyze(const edm::Event &, edm::EventSetup const &es) {
0046   // get mapping
0047   auto const &mapping = es.getData(mappingToken_);
0048 
0049   // get analysis mask to mask channels
0050   auto const &analysisMask = es.getData(maskToken_);
0051 
0052   // print mapping
0053   for (const auto &p : mapping.VFATMapping)
0054     edm::LogInfo("PrintTotemDAQMapping mapping") << "    " << p.first << " -> " << p.second;
0055 
0056   // print mapping
0057   for (const auto &p : analysisMask.analysisMask)
0058     edm::LogInfo("PrintTotemDAQMapping mask") << "    " << p.first << ": fullMask=" << p.second.fullMask
0059                                               << ", number of masked channels " << p.second.maskedChannels.size();
0060 }
0061 
0062 //----------------------------------------------------------------------------------------------------
0063 
0064 DEFINE_FWK_MODULE(PrintTotemDAQMapping);