CMS 3D CMS Logo

WriteCTPPSPixelDAQMapping.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * Offline analyzer for writing CTPPS DAQ Mapping sqlite file
4 * H. Malbouisson
5 * based on TOTEM code from Jan Kašpar (jan.kaspar@gmail.com)
6 *
7 ****************************************************************************/
8 
16 
18 
21 
27 
28 #include <cstdint>
29 
30 //----------------------------------------------------------------------------------------------------
31 
36 public:
39 
40 private:
41  void analyze(const edm::Event &e, const edm::EventSetup &es) override;
45 
47 };
48 
49 using namespace std;
50 using namespace edm;
51 
52 //----------------------------------------------------------------------------------------------------
53 
55  : daqmappingiov_(ps.getParameter<unsigned long long>("daqmappingiov")),
56  record_(ps.getParameter<string>("record")),
57  label_(ps.getParameter<string>("label")),
58  tokenMapping_(esConsumes<CTPPSPixelDAQMapping, CTPPSPixelDAQMappingRcd>(edm::ESInputTag("", label_))) {}
59 
61  // print mapping
62  /*printf("* DAQ mapping\n");
63  for (const auto &p : mapping->ROCMapping)
64  cout << " " << p.first << " -> " << p.second << endl;
65  */
66 
67  // Write DAQ Mapping to sqlite file:
68 
69  const auto &mapping = es.getData(tokenMapping_);
70 
72  if (poolDbService.isAvailable()) {
73  poolDbService->writeOneIOV(mapping, daqmappingiov_, record_);
74  }
75 }
76 
77 //----------------------------------------------------------------------------------------------------
78 
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::ESGetToken< CTPPSPixelDAQMapping, CTPPSPixelDAQMappingRcd > tokenMapping_
Prints the DAQ mapping loaded by TotemDAQMappingESSourceXML.
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
void analyze(const edm::Event &e, const edm::EventSetup &es) override
unsigned long long Time_t
Definition: Time.h:14
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HLT enums.
WriteCTPPSPixelDAQMapping(const edm::ParameterSet &ps)
bool isAvailable() const
Definition: Service.h:40
The mapping between FramePosition and ROCInfo.