Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
CondTools
Hcal
plugins
CastorDumpConditions.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: Castor
4
// Class: CastorDumpConditions
5
//
13
//
14
// Original Author: Luiz Mundim Filho
15
// Created: Thu Mar 12 14:45:44 CET 2009
16
// $Id: CastorDumpConditions.cc,v 1.1 2011/05/09 19:38:47 mundim Exp $
17
//
18
//
19
20
21
// system include files
22
#include <memory>
23
#include <iostream>
24
#include <fstream>
25
#include <sstream>
26
#include <string>
27
28
// user include files
29
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
30
#include "
FWCore/Framework/interface/EDAnalyzer.h
"
31
#include "
FWCore/Framework/interface/ESHandle.h
"
32
33
#include "
FWCore/Framework/interface/Event.h
"
34
#include "
FWCore/Framework/interface/EventSetup.h
"
35
#include "
FWCore/Framework/interface/MakerMacros.h
"
36
37
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
38
#include "
CondFormats/DataRecord/interface/CastorPedestalsRcd.h
"
39
#include "
CondFormats/DataRecord/interface/CastorPedestalWidthsRcd.h
"
40
#include "
CondFormats/DataRecord/interface/CastorGainsRcd.h
"
41
#include "
CondFormats/DataRecord/interface/CastorGainWidthsRcd.h
"
42
#include "
CondFormats/DataRecord/interface/CastorQIEDataRcd.h
"
43
#include "
CondFormats/DataRecord/interface/CastorChannelQualityRcd.h
"
44
#include "
CondFormats/DataRecord/interface/CastorElectronicsMapRcd.h
"
45
#include "
CondFormats/DataRecord/interface/CastorRecoParamsRcd.h
"
46
#include "
CondFormats/DataRecord/interface/CastorSaturationCorrsRcd.h
"
47
#include "
CondFormats/CastorObjects/interface/AllObjects.h
"
48
49
#include "
CalibCalorimetry/CastorCalib/interface/CastorDbASCIIIO.h
"
50
//
51
// class decleration
52
//
53
54
class
CastorDumpConditions
:
public
edm::EDAnalyzer
{
55
public
:
56
explicit
CastorDumpConditions
(
const
edm::ParameterSet
&);
57
~CastorDumpConditions
();
58
59
template
<
class
S,
class
SRcd>
void
dumpIt
(
S
* myS, SRcd* mySRcd,
const
edm::Event
&
e
,
const
edm::EventSetup
& context,
std::string
name
);
60
61
private
:
62
std::string
file_prefix
;
63
std::vector<std::string>
mDumpRequest
;
64
virtual
void
beginJob
(
const
edm::EventSetup
&) ;
65
virtual
void
analyze
(
const
edm::Event
&,
const
edm::EventSetup
&)
override
;
66
virtual
void
endJob
()
override
;
67
68
// ----------member data ---------------------------
69
};
70
71
//
72
// constants, enums and typedefs
73
//
74
75
//
76
// static data member definitions
77
//
78
79
//
80
// constructors and destructor
81
//
82
CastorDumpConditions::CastorDumpConditions
(
const
edm::ParameterSet
& iConfig)
83
84
{
85
file_prefix
= iConfig.
getUntrackedParameter
<
std::string
>(
"outFilePrefix"
,
"Dump"
);
86
mDumpRequest
= iConfig.
getUntrackedParameter
<std::vector<std::string> >(
"dump"
,std::vector<std::string>());
87
if
(mDumpRequest.empty()) {
88
std::cout
<<
"CastorDumpConditions: No record to dump. Exiting."
<< std::endl;
89
exit
(0);
90
}
91
92
}
93
94
95
CastorDumpConditions::~CastorDumpConditions
()
96
{
97
98
// do anything here that needs to be done at desctruction time
99
// (e.g. close files, deallocate resources etc.)
100
101
}
102
103
104
//
105
// member functions
106
//
107
108
// ------------ method called to for each event ------------
109
void
110
CastorDumpConditions::analyze
(
const
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup)
111
{
112
using namespace
edm;
113
114
#ifdef THIS_IS_AN_EVENT_EXAMPLE
115
Handle<ExampleData>
pIn;
116
iEvent.
getByLabel
(
"example"
,pIn);
117
#endif
118
119
#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
120
ESHandle<SetupData>
pSetup;
121
iSetup.
get
<SetupRecord>().
get
(pSetup);
122
#endif
123
std::cout
<<
"I AM IN THE RUN "
<< iEvent.
id
().
run
() << std::endl;
124
std::cout
<<
"What to dump? "
<< std::endl;
125
if
(
mDumpRequest
.empty()) {
126
std::cout
<<
"CastorDumpConditions: Empty request"
<< std::endl;
127
return
;
128
}
129
130
for
(std::vector<std::string>::const_iterator it=
mDumpRequest
.begin();it!=
mDumpRequest
.end();it++)
131
std::cout
<< *it << std::endl;
132
133
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"ElectronicsMap"
)) !=
mDumpRequest
.end())
134
dumpIt
(
new
CastorElectronicsMap
(),
new
CastorElectronicsMapRcd
(),
iEvent
,iSetup,
"ElectronicsMap"
);
135
136
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"QIEData"
)) !=
mDumpRequest
.end())
137
dumpIt
(
new
CastorQIEData
(),
new
CastorQIEDataRcd
(),
iEvent
,iSetup,
"QIEData"
);
138
139
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"Pedestals"
)) !=
mDumpRequest
.end())
140
dumpIt
(
new
CastorPedestals
(),
new
CastorPedestalsRcd
(),
iEvent
,iSetup,
"Pedestals"
);
141
142
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"PedestalWidths"
)) !=
mDumpRequest
.end())
143
dumpIt
(
new
CastorPedestalWidths
(),
new
CastorPedestalWidthsRcd
(),
iEvent
,iSetup,
"PedestalWidths"
);
144
145
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"Gains"
)) !=
mDumpRequest
.end())
146
dumpIt
(
new
CastorGains
(),
new
CastorGainsRcd
(),
iEvent
,iSetup,
"Gains"
);
147
148
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"GainWidths"
)) !=
mDumpRequest
.end())
149
dumpIt
(
new
CastorGainWidths
(),
new
CastorGainWidthsRcd
(),
iEvent
,iSetup,
"GainWidths"
);
150
151
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"ChannelQuality"
)) !=
mDumpRequest
.end())
152
dumpIt
(
new
CastorChannelQuality
(),
new
CastorChannelQualityRcd
(),
iEvent
,iSetup,
"ChannelQuality"
);
153
154
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"RecoParams"
)) !=
mDumpRequest
.end())
155
dumpIt
(
new
CastorRecoParams
(),
new
CastorRecoParamsRcd
(),
iEvent
,iSetup,
"RecoParams"
);
156
157
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"SaturationCorrs"
)) !=
mDumpRequest
.end())
158
dumpIt
(
new
CastorSaturationCorrs
(),
new
CastorSaturationCorrsRcd
(),
iEvent
,iSetup,
"SaturationCorrs"
);
159
160
/*
161
ESHandle<CastorPedestals> p;
162
iSetup.get<CastorPedestalsRcd>().get(p);
163
CastorPedestals* mypeds = new CastorPedestals(*p.product());
164
std::ostringstream file;
165
std::string name = "CastorPedestal";
166
file << file_prefix << name.c_str() << "_Run" << iEvent.id().run()<< ".txt";
167
std::ofstream outStream(file.str().c_str() );
168
std::cout << "CastorDumpConditions: ---- Dumping " << name.c_str() << " ----" << std::endl;
169
CastorDbASCIIIO::dumpObject (outStream, (*mypeds) );
170
171
*/
172
}
173
174
175
// ------------ method called once each job just before starting event loop ------------
176
void
177
CastorDumpConditions::beginJob
(
const
edm::EventSetup
&)
178
{
179
}
180
181
// ------------ method called once each job just after ending the event loop ------------
182
void
183
CastorDumpConditions::endJob
() {
184
}
185
186
template
<
class
S,
class
SRcd>
187
void
CastorDumpConditions::dumpIt
(
S
* myS, SRcd* mySRcd,
const
edm::Event
&
e
,
const
edm::EventSetup
& context,
std::string
name
) {
188
int
myrun = e.
id
().
run
();
189
edm::ESHandle<S>
p
;
190
context.
get
<SRcd>().
get
(p);
191
S
* myobject =
new
S
(*p.
product
());
192
193
std::ostringstream
file
;
194
file <<
file_prefix
<< name.c_str() <<
"_Run"
<< myrun <<
".txt"
;
195
std::ofstream outStream(file.str().c_str() );
196
CastorDbASCIIIO::dumpObject
(outStream, (*myobject) );
197
}
198
199
//define this as a plug-in
200
DEFINE_FWK_MODULE
(
CastorDumpConditions
);
edm::EventID::run
RunNumber_t run() const
Definition:
EventID.h:39
CastorQIEData
Definition:
CastorQIEData.h:25
cmsRelvalreport.exit
tuple exit
Definition:
cmsRelvalreport.py:1000
edm::EDAnalyzer::beginJob
virtual void beginJob()
Definition:
EDAnalyzer.h:72
CastorPedestalWidthsRcd
Definition:
CastorPedestalWidthsRcd.h:24
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
mergeVDriftHistosByStation.file
tuple file
Definition:
mergeVDriftHistosByStation.py:54
CastorRecoParamsRcd.h
CastorDumpConditions::~CastorDumpConditions
~CastorDumpConditions()
Definition:
CastorDumpConditions.cc:95
CastorRecoParams
Definition:
CastorRecoParams.h:11
CastorChannelQuality
Definition:
CastorChannelQuality.h:17
CastorGains
Definition:
CastorGains.h:18
CastorSaturationCorrsRcd.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:17
Event.h
MakerMacros.h
edm::Handle
Definition:
AssociativeIterator.h:47
EventSetup.h
CastorDbASCIIIO.h
CastorDumpConditions::endJob
virtual void endJob() override
Definition:
CastorDumpConditions.cc:183
CastorChannelQualityRcd
Definition:
CastorChannelQualityRcd.h:24
CastorSaturationCorrsRcd
Definition:
CastorSaturationCorrsRcd.h:4
CastorElectronicsMapRcd.h
CastorDumpConditions::analyze
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
CastorDumpConditions.cc:110
CastorPedestalsRcd.h
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition:
FindCaloHit.cc:7
mergeVDriftHistosByStation.name
string name
Definition:
mergeVDriftHistosByStation.py:77
Frameworkfwd.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
CastorPedestals
Definition:
CastorPedestals.h:18
ParameterSet.h
CastorRecoParamsRcd
Definition:
CastorRecoParamsRcd.h:4
CastorDumpConditions
Definition:
CastorDumpConditions.cc:54
iEvent
int iEvent
Definition:
GenABIO.cc:230
CastorDumpConditions::mDumpRequest
std::vector< std::string > mDumpRequest
Definition:
CastorDumpConditions.cc:63
CastorGainsRcd
Definition:
CastorGainsRcd.h:24
edm::ESHandle
Definition:
DTSurvey.h:22
CastorGainWidthsRcd
Definition:
CastorGainWidthsRcd.h:24
CastorDumpConditions::file_prefix
std::string file_prefix
Definition:
CastorDumpConditions.cc:62
ESHandle.h
edm::EventSetup
Definition:
EventSetup.h:44
CastorPedestalWidthsRcd.h
CastorGainsRcd.h
edm::Event::getByLabel
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition:
Event.h:402
AllObjects.h
edm::EDAnalyzer
Definition:
EDAnalyzer.h:27
EDAnalyzer.h
CastorGainWidths
Definition:
CastorGainWidths.h:18
CastorPedestalWidths
Definition:
CastorPedestalWidths.h:18
CastorDbASCIIIO::dumpObject
bool dumpObject(std::ostream &fOutput, const CastorPedestals &fObject)
CastorQIEDataRcd.h
CastorElectronicsMap
Definition:
CastorElectronicsMap.h:30
CastorDumpConditions::CastorDumpConditions
CastorDumpConditions(const edm::ParameterSet &)
Definition:
CastorDumpConditions.cc:82
edm::EventSetup::get
const T & get() const
Definition:
EventSetup.h:55
edm::ESHandle::product
T const * product() const
Definition:
ESHandle.h:86
S
double S(const TLorentzVector &, const TLorentzVector &)
Definition:
Particle.cc:99
alignCSCRings.e
list e
Definition:
alignCSCRings.py:90
AlCaHLTBitMon_ParallelJobs.p
tuple p
Definition:
AlCaHLTBitMon_ParallelJobs.py:152
edm::EventBase::id
edm::EventID id() const
Definition:
EventBase.h:56
edm::ParameterSet
Definition:
ParameterSet.h:35
gather_cfg.cout
tuple cout
Definition:
gather_cfg.py:121
edm::Event
Definition:
Event.h:59
CastorElectronicsMapRcd
Definition:
CastorElectronicsMapRcd.h:4
CastorPedestalsRcd
Definition:
CastorPedestalsRcd.h:24
CastorSaturationCorrs
Definition:
CastorSaturationCorrs.h:11
CastorQIEDataRcd
Definition:
CastorQIEDataRcd.h:24
CastorChannelQualityRcd.h
CastorGainWidthsRcd.h
CastorDumpConditions::dumpIt
void dumpIt(S *myS, SRcd *mySRcd, const edm::Event &e, const edm::EventSetup &context, std::string name)
Definition:
CastorDumpConditions.cc:187
Generated for CMSSW Reference Manual by
1.8.5