CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
29 
30  explicit CTPPSRPAlignmentInfoReader(int i) {}
32  void analyze(const edm::Event& e, const edm::EventSetup& c) override;
33  void printInfo(const CTPPSRPAlignmentCorrectionsData& alignments, const edm::Event& event);
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 
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
const edm::EventSetup & c
void analyze(const edm::Event &e, const edm::EventSetup &c) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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
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...
edm::EventID id() const
Definition: EventBase.h:59
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
edm::ESGetToken< CTPPSRPAlignmentCorrectionsData, RPRealAlignmentRecord > tokenAlignmentsReal_