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 {
29  public:
30  explicit CTPPSAlignmentInfo( const edm::ParameterSet& );
31 
32  private:
34 
37 
38  void analyze( const edm::Event&, const edm::EventSetup& ) override;
39 
40  void printInfo(const RPAlignmentCorrectionsData &alignments, const edm::Event& event) const;
41 };
42 
43 //----------------------------------------------------------------------------------------------------
44 //----------------------------------------------------------------------------------------------------
45 
46 using namespace std;
47 using namespace edm;
48 
49 //----------------------------------------------------------------------------------------------------
50 
52  alignmentType_ ( iConfig.getUntrackedParameter<std::string>( "alignmentType", "real" ) )
53 {
54 }
55 
56 //----------------------------------------------------------------------------------------------------
57 
59 {
61 
62  if ( alignmentType_ == "real" )
63  {
64  if ( watcherRealAlignments_.check( iSetup ) )
65  {
66  iSetup.get<RPRealAlignmentRecord>().get( alignments );
67  printInfo(*alignments, iEvent);
68  }
69  return;
70  }
71 
72  else if ( alignmentType_ == "misaligned" )
73  {
74  if ( watcherMisalignedAlignments_.check( iSetup ) )
75  {
76  iSetup.get<RPMisalignedAlignmentRecord>().get( alignments );
77  printInfo(*alignments, iEvent);
78  }
79  return;
80  }
81 
82  throw cms::Exception("CTPPSAlignmentInfo") << "Unknown geometry type: `" << alignmentType_ << "'.";
83 }
84 
85 //----------------------------------------------------------------------------------------------------
86 
88 {
89  time_t unixTime = event.time().unixTime();
90  char timeStr[50];
91  strftime( timeStr, 50, "%F %T", localtime( &unixTime ) );
92 
93  edm::LogInfo("CTPPSAlignmentInfo")
94  << "New " << alignmentType_ << " alignments found in run="
95  << event.id().run() << ", event=" << event.id().event() << ", UNIX timestamp=" << unixTime
96  << " (" << timeStr << "):\n"
97  << alignments;
98 }
99 
100 //----------------------------------------------------------------------------------------------------
101 
edm::ESWatcher< RPMisalignedAlignmentRecord > watcherMisalignedAlignments_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
CTPPSAlignmentInfo(const edm::ParameterSet &)
Class to print out information on current geometry.
edm::ESWatcher< RPRealAlignmentRecord > watcherRealAlignments_
void analyze(const edm::Event &, const edm::EventSetup &) override
Container for CTPPS RP alignment corrections. The corrections are stored on two levels - RP and senso...
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
HLT enums.
T get() const
Definition: EventSetup.h:68
void printInfo(const RPAlignmentCorrectionsData &alignments, const edm::Event &event) const
Definition: event.py:1