CMS 3D CMS Logo

CTPPSRPAlignmentInfoReader.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 #include <iostream>
11 
16 
17 using namespace std;
18 
20 public:
23 
27 
28  explicit CTPPSRPAlignmentInfoReader(edm::ParameterSet const& iConfig);
29 
30  explicit CTPPSRPAlignmentInfoReader(int i) {}
32  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
34 };
35 
36 //----------------------------------------------------------------------------------------------------
37 
39  : iov_(iConfig.getParameter<unsigned long long>("iov")), record_(iConfig.getParameter<string>("record")) {
40  if (strcmp(record_.c_str(), "CTPPSRPAlignmentCorrectionsDataRcd") == 0) {
41  tokenAlignmentsIdeal_ = esConsumes<CTPPSRPAlignmentCorrectionsData, CTPPSRPAlignmentCorrectionsDataRcd>();
42  } else if (strcmp(record_.c_str(), "RPRealAlignmentRecord") == 0) {
43  tokenAlignmentsReal_ = esConsumes<CTPPSRPAlignmentCorrectionsData, RPRealAlignmentRecord>();
44  } else {
45  tokenAlignmentsMisaligned_ = esConsumes<CTPPSRPAlignmentCorrectionsData, RPMisalignedAlignmentRecord>();
46  }
47 }
48 
49 //----------------------------------------------------------------------------------------------------
50 
52  using namespace edm;
53 
54  //this part gets the handle of the event source and the record (i.e. the Database)
55  if (e.id().run() == iov_) {
57 
58  if (strcmp(record_.c_str(), "CTPPSRPAlignmentCorrectionsDataRcd") == 0) {
59  hAlignments = context.getHandle(tokenAlignmentsIdeal_);
60  } else if (strcmp(record_.c_str(), "RPRealAlignmentRecord") == 0) {
61  hAlignments = context.getHandle(tokenAlignmentsReal_);
62  } else {
63  hAlignments = context.getHandle(tokenAlignmentsMisaligned_);
64  }
65 
66  //std::cout
67  edm::LogPrint("CTPPSRPAlignmentInfoReader")
68  << "New alignments found in run=" << e.id().run() << ", event=" << e.id().event() << ":\n"
69  << *hAlignments;
70  }
71 }
72 
void analyze(const edm::Event &e, const edm::EventSetup &c) override
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::ESGetToken< CTPPSRPAlignmentCorrectionsData, CTPPSRPAlignmentCorrectionsDataRcd > tokenAlignmentsIdeal_
CTPPSRPAlignmentInfoReader(edm::ParameterSet const &iConfig)
unsigned long long Time_t
Definition: Time.h:14
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Log< level::Warning, true > LogPrint
edm::ESGetToken< CTPPSRPAlignmentCorrectionsData, RPMisalignedAlignmentRecord > tokenAlignmentsMisaligned_
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
HLT enums.
def printInfo(self, event)
edm::ESGetToken< CTPPSRPAlignmentCorrectionsData, RPRealAlignmentRecord > tokenAlignmentsReal_
Definition: event.py:1