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 
22 
26 
28 #include <string>
29 
30 //----------------------------------------------------------------------------------------------------
31 
36 public:
38  ~CTPPSRPAlignmentInfoAnalyzer() override {}
39 
40 private:
41  void analyze(const edm::Event& e, const edm::EventSetup& es) override;
42 
43  void printInfo(const CTPPSRPAlignmentCorrectionsData& alignments, const edm::Event& event) const;
44 
48 
51 };
52 
53 //----------------------------------------------------------------------------------------------------
54 //----------------------------------------------------------------------------------------------------
55 
56 using namespace std;
57 using namespace edm;
58 
59 //----------------------------------------------------------------------------------------------------
60 
62  : record_(iConfig.getParameter<string>("record")), iov_(iConfig.getParameter<unsigned long long>("iov")) {
63  if (strcmp(record_.c_str(), "CTPPSRPAlignmentCorrectionsDataRcd") == 0) {
64  tokenAlignmentIdeal_ = esConsumes<CTPPSRPAlignmentCorrectionsData, CTPPSRPAlignmentCorrectionsDataRcd>();
65  } else if (strcmp(record_.c_str(), "RPRealAlignmentRecord") == 0) {
66  tokenAlignmentReal_ = esConsumes<CTPPSRPAlignmentCorrectionsData, RPRealAlignmentRecord>();
67  } else {
68  tokenAlignmentMisaligned_ = esConsumes<CTPPSRPAlignmentCorrectionsData, RPMisalignedAlignmentRecord>();
69  }
70 }
71 
72 //----------------------------------------------------------------------------------------------------
73 
76 
77  if (strcmp(record_.c_str(), "CTPPSRPAlignmentCorrectionsDataRcd") == 0) {
78  alignments = iSetup.getHandle(tokenAlignmentIdeal_);
79  } else if (strcmp(record_.c_str(), "RPRealAlignmentRecord") == 0) {
80  alignments = iSetup.getHandle(tokenAlignmentReal_);
81  } else {
82  alignments = iSetup.getHandle(tokenAlignmentMisaligned_);
83  }
84 
85  const CTPPSRPAlignmentCorrectionsData* pCTPPSRPAlignmentCorrectionsData = alignments.product();
87  if (poolDbService.isAvailable()) {
88  poolDbService->writeOne(pCTPPSRPAlignmentCorrectionsData, iov_, record_);
89  }
90 }
91 
92 //----------------------------------------------------------------------------------------------------
93 
95  const edm::Event& event) const {
96  time_t unixTime = event.time().unixTime();
97  char timeStr[50];
98  strftime(timeStr, 50, "%F %T", localtime(&unixTime));
99 
100  edm::LogInfo("CTPPSRPAlignmentInfoAnalyzer")
101  << "New alignments found in run=" << event.id().run() << ", event=" << event.id().event()
102  << ", UNIX timestamp=" << unixTime << " (" << timeStr << "):\n"
103  << alignments;
104 }
105 
106 //----------------------------------------------------------------------------------------------------
107 
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
CTPPSRPAlignmentInfoAnalyzer::~CTPPSRPAlignmentInfoAnalyzer
~CTPPSRPAlignmentInfoAnalyzer() override
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:43
EDAnalyzer.h
ESHandle.h
CTPPSRPAlignmentInfoAnalyzer::analyze
void analyze(const edm::Event &e, const edm::EventSetup &es) override
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:73
edm
HLT enums.
Definition: AlignableModifier.h:19
CTPPSRPAlignmentInfoAnalyzer::tokenAlignmentIdeal_
edm::ESGetToken< CTPPSRPAlignmentCorrectionsData, CTPPSRPAlignmentCorrectionsDataRcd > tokenAlignmentIdeal_
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:50
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
ESGetToken.h
CTPPSRPAlignmentInfoAnalyzer::tokenAlignmentMisaligned_
edm::ESGetToken< CTPPSRPAlignmentCorrectionsData, RPMisalignedAlignmentRecord > tokenAlignmentMisaligned_
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:52
RPMisalignedAlignmentRecord.h
CTPPSRPAlignmentInfoAnalyzer
Class to print out information on current geometry.
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:34
MakerMacros.h
PoolDBOutputService.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Service.h
CTPPSRPAlignmentInfoAnalyzer::CTPPSRPAlignmentInfoAnalyzer
CTPPSRPAlignmentInfoAnalyzer(const edm::ParameterSet &ps)
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:60
RPRealAlignmentRecord.h
edm::ESHandle
Definition: DTSurvey.h:22
CTPPSRPAlignmentInfoAnalyzer::iov_
cond::Time_t iov_
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:55
Time.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
CTPPSRPAlignmentInfoAnalyzer::record_
std::string record_
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:54
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
edm::Service< cond::service::PoolDBOutputService >
iEvent
int iEvent
Definition: GenABIO.cc:224
CTPPSRPAlignmentInfoAnalyzer::tokenAlignmentReal_
edm::ESGetToken< CTPPSRPAlignmentCorrectionsData, RPRealAlignmentRecord > tokenAlignmentReal_
Definition: CTPPSRPAlignmentInfoAnalyzer.cc:51
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
edm::EventSetup
Definition: EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ESGetToken< CTPPSRPAlignmentCorrectionsData, CTPPSRPAlignmentCorrectionsDataRcd >
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:63
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:93
ParameterSet.h
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37