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 
37 
38  void analyze(const edm::Event&, const edm::EventSetup&) override;
39 
40  void printInfo(const CTPPSRPAlignmentCorrectionsData& alignments, const edm::Event& event) const;
41 };
42 
44  : alignmentType_(iConfig.getUntrackedParameter<std::string>("alignmentType", "real")),
45  alignmentToken_(esConsumes()) {}
46 
47 //----------------------------------------------------------------------------------------------------
48 
50  if (alignmentType_ == "real") {
51  if (watcherRealAlignments_.check(iSetup)) {
52  auto const& alignments = iSetup.getData(alignmentToken_);
53  printInfo(alignments, iEvent);
54  }
55  return;
56  }
57 
58  else if (alignmentType_ == "misaligned") {
59  if (watcherMisalignedAlignments_.check(iSetup)) {
60  auto const& alignments = iSetup.getData(alignmentToken_);
61  printInfo(alignments, iEvent);
62  }
63  return;
64  }
65 
66  throw cms::Exception("CTPPSAlignmentInfo") << "Unknown geometry type: `" << alignmentType_ << "'.";
67 }
68 
69 //----------------------------------------------------------------------------------------------------
70 
72  time_t unixTime = event.time().unixTime();
73  char timeStr[50];
74  strftime(timeStr, 50, "%F %T", localtime(&unixTime));
75 
76  edm::LogInfo("CTPPSAlignmentInfo") << "New " << alignmentType_ << " alignments found in run=" << event.id().run()
77  << ", event=" << event.id().event() << ", UNIX timestamp=" << unixTime << " ("
78  << timeStr << "):\n"
79  << alignments;
80 }
81 
82 //----------------------------------------------------------------------------------------------------
83 
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
void printInfo(const CTPPSRPAlignmentCorrectionsData &alignments, const edm::Event &event) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESWatcher< RPMisalignedAlignmentRecord > watcherMisalignedAlignments_
edm::ESGetToken< CTPPSRPAlignmentCorrectionsData, RPRealAlignmentRecord > alignmentToken_
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
CTPPSAlignmentInfo(const edm::ParameterSet &)
Log< level::Info, false > LogInfo
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:57
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
Definition: event.py:1