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 
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
EDAnalyzer.h
edm::ESWatcher< RPRealAlignmentRecord >
ESHandle.h
CTPPSAlignmentInfo::alignmentType_
std::string alignmentType_
Definition: CTPPSAlignmentInfo.cc:35
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
CTPPSAlignmentInfo::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: CTPPSAlignmentInfo.cc:48
RPMisalignedAlignmentRecord.h
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
RPRealAlignmentRecord.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
CTPPSAlignmentInfo
Class to print out information on current geometry.
Definition: CTPPSAlignmentInfo.cc:26
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:58
edm::ESGetToken< CTPPSRPAlignmentCorrectionsData, RPRealAlignmentRecord >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
std
Definition: JetResolutionObject.h:76
CTPPSAlignmentInfo::CTPPSAlignmentInfo
CTPPSAlignmentInfo(const edm::ParameterSet &)
Definition: CTPPSAlignmentInfo.cc:42
ESWatcher.h
Exception
Definition: hltDiff.cc:245
CTPPSRPAlignmentCorrectionsData
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
Definition: CTPPSRPAlignmentCorrectionsData.h:24
EventSetup.h
Exception.h
CTPPSRPAlignmentCorrectionsData.h
CTPPSAlignmentInfo::watcherMisalignedAlignments_
edm::ESWatcher< RPMisalignedAlignmentRecord > watcherMisalignedAlignments_
Definition: CTPPSAlignmentInfo.cc:38
ParameterSet.h
event
Definition: event.py:1
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
CTPPSAlignmentInfo::printInfo
void printInfo(const CTPPSRPAlignmentCorrectionsData &alignments, const edm::Event &event) const
Definition: CTPPSAlignmentInfo.cc:70
CTPPSAlignmentInfo::watcherRealAlignments_
edm::ESWatcher< RPRealAlignmentRecord > watcherRealAlignments_
Definition: CTPPSAlignmentInfo.cc:37
CTPPSAlignmentInfo::alignmentToken_
edm::ESGetToken< CTPPSRPAlignmentCorrectionsData, RPRealAlignmentRecord > alignmentToken_
Definition: CTPPSAlignmentInfo.cc:39