CMS 3D CMS Logo

CTPPSRPAlignmentInfoAnalyzer.cc
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Authors:
4  * Jan Kaspar
5  * Adapted by:
6  * Helena Malbouisson
7  * Clemencia Mora Herrera
8  ****************************************************************************/
9 
21 
22 
26 
28 #include <string>
29 
30 //----------------------------------------------------------------------------------------------------
31 
36 {
37 public:
40 
41 private:
42  void analyze( const edm::Event& e, const edm::EventSetup& es ) override;
43 
44  void printInfo(const CTPPSRPAlignmentCorrectionsData &alignments, const edm::Event& event) const;
46 
49 };
50 
51 //----------------------------------------------------------------------------------------------------
52 //----------------------------------------------------------------------------------------------------
53 
54 using namespace std;
55 using namespace edm;
56 
57 //----------------------------------------------------------------------------------------------------
58 
60  {
61  record_=iConfig.getParameter<string>("record");
62  iov_=iConfig.getParameter<unsigned long long>("iov");
63 }
64 
65 //----------------------------------------------------------------------------------------------------
66 
68 {
69 
71  if ( watcherAlignments_.check( iSetup ) )
72  {
73  if(strcmp(record_.c_str(),"CTPPSRPAlignmentCorrectionsDataRcd")==0){
74  iSetup.get<CTPPSRPAlignmentCorrectionsDataRcd>().get(alignments);
75  }
76  else if(strcmp(record_.c_str(),"RPRealAlignmentRecord")==0){
77  iSetup.get<RPRealAlignmentRecord>().get(alignments);
78  }
79  else {
80  iSetup.get<RPMisalignedAlignmentRecord>().get(alignments);
81  }
82  const CTPPSRPAlignmentCorrectionsData* pCTPPSRPAlignmentCorrectionsData = alignments.product();
84  if( poolDbService.isAvailable() ){
85  poolDbService->writeOne( pCTPPSRPAlignmentCorrectionsData, iov_, record_ );
86  }
87 
88  }
89  return;
90 
91 }
92 
93 //----------------------------------------------------------------------------------------------------
94 
96 {
97  time_t unixTime = event.time().unixTime();
98  char timeStr[50];
99  strftime( timeStr, 50, "%F %T", localtime( &unixTime ) );
100 
101  edm::LogInfo("CTPPSRPAlignmentInfoAnalyzer")
102  << "New alignments found in run="
103  << event.id().run() << ", event=" << event.id().event() << ", UNIX timestamp=" << unixTime
104  << " (" << timeStr << "):\n"
105  << alignments;
106 }
107 
108 //----------------------------------------------------------------------------------------------------
109 
T getParameter(std::string const &) const
void printInfo(const CTPPSRPAlignmentCorrectionsData &alignments, const edm::Event &event) const
Class to print out information on current geometry.
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
unsigned long long Time_t
Definition: Time.h:16
bool isAvailable() const
Definition: Service.h:40
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
void analyze(const edm::Event &e, const edm::EventSetup &es) 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:71
CTPPSRPAlignmentInfoAnalyzer(const edm::ParameterSet &ps)
edm::ESWatcher< CTPPSRPAlignmentCorrectionsDataRcd > watcherAlignments_
T const * product() const
Definition: ESHandle.h:86
Definition: event.py:1