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 
25 
27 #include <string>
28 
29 //----------------------------------------------------------------------------------------------------
30 
35 public:
37  ~CTPPSRPAlignmentInfoAnalyzer() override {}
38 
39 private:
40  void analyze(const edm::Event& e, const edm::EventSetup& es) override;
41 
42  void printInfo(const CTPPSRPAlignmentCorrectionsData& alignments, const edm::Event& event) const;
44 
47 };
48 
49 //----------------------------------------------------------------------------------------------------
50 //----------------------------------------------------------------------------------------------------
51 
52 using namespace std;
53 using namespace edm;
54 
55 //----------------------------------------------------------------------------------------------------
56 
58  record_ = iConfig.getParameter<string>("record");
59  iov_ = iConfig.getParameter<unsigned long long>("iov");
60 }
61 
62 //----------------------------------------------------------------------------------------------------
63 
66  if (watcherAlignments_.check(iSetup)) {
67  if (strcmp(record_.c_str(), "CTPPSRPAlignmentCorrectionsDataRcd") == 0) {
68  iSetup.get<CTPPSRPAlignmentCorrectionsDataRcd>().get(alignments);
69  } else if (strcmp(record_.c_str(), "RPRealAlignmentRecord") == 0) {
70  iSetup.get<RPRealAlignmentRecord>().get(alignments);
71  } else {
72  iSetup.get<RPMisalignedAlignmentRecord>().get(alignments);
73  }
74  const CTPPSRPAlignmentCorrectionsData* pCTPPSRPAlignmentCorrectionsData = alignments.product();
76  if (poolDbService.isAvailable()) {
77  poolDbService->writeOne(pCTPPSRPAlignmentCorrectionsData, iov_, record_);
78  }
79  }
80  return;
81 }
82 
83 //----------------------------------------------------------------------------------------------------
84 
86  const edm::Event& event) const {
87  time_t unixTime = event.time().unixTime();
88  char timeStr[50];
89  strftime(timeStr, 50, "%F %T", localtime(&unixTime));
90 
91  edm::LogInfo("CTPPSRPAlignmentInfoAnalyzer")
92  << "New alignments found in run=" << event.id().run() << ", event=" << event.id().event()
93  << ", UNIX timestamp=" << unixTime << " (" << timeStr << "):\n"
94  << alignments;
95 }
96 
97 //----------------------------------------------------------------------------------------------------
98 
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
CTPPSRPAlignmentInfoAnalyzer::~CTPPSRPAlignmentInfoAnalyzer
~CTPPSRPAlignmentInfoAnalyzer() override
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:42
EDAnalyzer.h
edm::ESWatcher< CTPPSRPAlignmentCorrectionsDataRcd >
ESHandle.h
CTPPSRPAlignmentInfoAnalyzer::analyze
void analyze(const edm::Event &e, const edm::EventSetup &es) override
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:63
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::LogInfo
Definition: MessageLogger.h:254
CTPPSRPAlignmentCorrectionsDataRcd
Definition: CTPPSRPAlignmentCorrectionsDataRcd.h:23
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
RPMisalignedAlignmentRecord
Definition: RPMisalignedAlignmentRecord.h:6
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
RPMisalignedAlignmentRecord.h
CTPPSRPAlignmentInfoAnalyzer
Class to print out information on current geometry.
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:33
MakerMacros.h
RPRealAlignmentRecord
Definition: RPRealAlignmentRecord.h:6
PoolDBOutputService.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
CTPPSRPAlignmentInfoAnalyzer::CTPPSRPAlignmentInfoAnalyzer
CTPPSRPAlignmentInfoAnalyzer(const edm::ParameterSet &ps)
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:56
RPRealAlignmentRecord.h
edm::ESHandle
Definition: DTSurvey.h:22
CTPPSRPAlignmentInfoAnalyzer::watcherAlignments_
edm::ESWatcher< CTPPSRPAlignmentCorrectionsDataRcd > watcherAlignments_
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CTPPSRPAlignmentInfoAnalyzer::iov_
cond::Time_t iov_
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:50
Time.h
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
CTPPSRPAlignmentInfoAnalyzer::record_
std::string record_
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:51
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
edm::Service< cond::service::PoolDBOutputService >
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
CTPPSRPAlignmentCorrectionsDataRcd.h
std
Definition: JetResolutionObject.h:76
ESWatcher.h
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:57
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
CTPPSRPAlignmentInfoAnalyzer::printInfo
void printInfo(const CTPPSRPAlignmentCorrectionsData &alignments, const edm::Event &event) const
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:84
ParameterSet.h
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37