CMS 3D CMS Logo

CTPPSAlignmentInfo.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * Authors:
4 * Jan Kašpar (jan.kaspar@gmail.com)
5 *
6 ****************************************************************************/
7 
16 
19 
21 
22 //----------------------------------------------------------------------------------------------------
23 
28 public:
29  explicit CTPPSAlignmentInfo(const edm::ParameterSet&);
30 
31 private:
33 
36 
37  void analyze(const edm::Event&, const edm::EventSetup&) override;
38 
39  void printInfo(const CTPPSRPAlignmentCorrectionsData& alignments, const edm::Event& event) const;
40 };
41 
42 //----------------------------------------------------------------------------------------------------
43 //----------------------------------------------------------------------------------------------------
44 
45 using namespace std;
46 using namespace edm;
47 
48 //----------------------------------------------------------------------------------------------------
49 
51  : alignmentType_(iConfig.getUntrackedParameter<std::string>("alignmentType", "real")) {}
52 
53 //----------------------------------------------------------------------------------------------------
54 
57 
58  if (alignmentType_ == "real") {
59  if (watcherRealAlignments_.check(iSetup)) {
60  iSetup.get<RPRealAlignmentRecord>().get(alignments);
61  printInfo(*alignments, iEvent);
62  }
63  return;
64  }
65 
66  else if (alignmentType_ == "misaligned") {
67  if (watcherMisalignedAlignments_.check(iSetup)) {
68  iSetup.get<RPMisalignedAlignmentRecord>().get(alignments);
69  printInfo(*alignments, iEvent);
70  }
71  return;
72  }
73 
74  throw cms::Exception("CTPPSAlignmentInfo") << "Unknown geometry type: `" << alignmentType_ << "'.";
75 }
76 
77 //----------------------------------------------------------------------------------------------------
78 
80  time_t unixTime = event.time().unixTime();
81  char timeStr[50];
82  strftime(timeStr, 50, "%F %T", localtime(&unixTime));
83 
84  edm::LogInfo("CTPPSAlignmentInfo") << "New " << alignmentType_ << " alignments found in run=" << event.id().run()
85  << ", event=" << event.id().event() << ", UNIX timestamp=" << unixTime << " ("
86  << timeStr << "):\n"
87  << alignments;
88 }
89 
90 //----------------------------------------------------------------------------------------------------
91 
edm::ESWatcher< RPMisalignedAlignmentRecord > watcherMisalignedAlignments_
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
CTPPSAlignmentInfo(const edm::ParameterSet &)
void printInfo(const CTPPSRPAlignmentCorrectionsData &alignments, const edm::Event &event) const
Class to print out information on current geometry.
edm::ESWatcher< RPRealAlignmentRecord > watcherRealAlignments_
void analyze(const edm::Event &, const edm::EventSetup &) override
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
HLT enums.
T get() const
Definition: EventSetup.h:73
Definition: event.py:1