test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
CondTools
Hcal
plugins
HcalDumpConditions.cc
Go to the documentation of this file.
1
2
/*----------------------------------------------------------------------
3
4
R.Ofierzynski - 2.Oct. 2007
5
modified to dump all pedestals on screen, see
6
testHcalDBFake.cfg
7
testHcalDBFrontier.cfg
8
9
July 29, 2009 Added HcalValidationCorrs - Gena Kukartsev
10
September 21, 2009 Added HcalLutMetadata - Gena Kukartsev
11
12
----------------------------------------------------------------------*/
13
14
#include <stdexcept>
15
#include <string>
16
#include <iostream>
17
#include <fstream>
18
#include <sstream>
19
#include <map>
20
#include "
FWCore/Framework/interface/EDAnalyzer.h
"
21
#include "
FWCore/Framework/interface/Event.h
"
22
#include "
FWCore/Framework/interface/ESHandle.h
"
23
#include "
FWCore/Framework/interface/MakerMacros.h
"
24
25
#include "
FWCore/Framework/interface/EventSetup.h
"
26
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
27
28
#include "
CondFormats/DataRecord/interface/HcalAllRcds.h
"
29
30
#include "
CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h
"
31
32
#include "
CalibFormats/HcalObjects/interface/HcalDbService.h
"
33
#include "
CalibFormats/HcalObjects/interface/HcalDbRecord.h
"
34
#include "
Geometry/Records/interface/HcalRecNumberingRecord.h
"
35
36
#include "
FWCore/Framework/interface/IOVSyncValue.h
"
37
#include "
CondFormats/HcalObjects/interface/AllObjects.h
"
38
39
namespace
edmtest
40
{
41
class
HcalDumpConditions
:
public
edm::EDAnalyzer
42
{
43
public
:
44
explicit
HcalDumpConditions
(
edm::ParameterSet
const
&
p
)
45
{
46
front
= p.
getUntrackedParameter
<
std::string
>(
"outFilePrefix"
,
"Dump"
);
47
mDumpRequest
= p.
getUntrackedParameter
<std::vector <std::string> > (
"dump"
, std::vector<std::string>());
48
}
49
50
explicit
HcalDumpConditions
(
int
i
)
51
{ }
52
virtual
~ HcalDumpConditions
() { }
53
virtual
void
analyze
(
const
edm::Event
&
e
,
const
edm::EventSetup
&
c
)
override
;
54
55
template
<
class
S,
class
SRcd>
void
dumpIt
(
S
* myS, SRcd* mySRcd,
const
edm::Event
&
e
,
const
edm::EventSetup
& context,
std::string
name
,
const
HcalTopology
* topo);
56
template
<
class
S,
class
SRcd>
void
dumpIt
(
S
* myS, SRcd* mySRcd,
const
edm::Event
&
e
,
const
edm::EventSetup
& context,
std::string
name
);
57
template
<
class
S>
void
writeToFile
(
S
* myS,
const
edm::Event
&
e
,
std::string
name
);
58
59
private
:
60
std::string
front
;
61
std::vector<std::string>
mDumpRequest
;
62
};
63
64
65
template
<
class
S,
class
SRcd>
66
void
HcalDumpConditions::dumpIt
(
S
* myS, SRcd* mySRcd,
const
edm::Event
&
e
,
const
edm::EventSetup
& context,
std::string
name
,
const
HcalTopology
* topo)
67
{
68
edm::ESHandle<S>
p
;
69
context.
get
<SRcd>().
get
(p);
70
S
* myobject =
new
S
(*p.
product
());
71
if
( topo ) myobject->setTopo(topo);
72
73
writeToFile
(myobject, e, name);
74
75
if
( context.
get
<SRcd>().validityInterval().first() ==
edm::IOVSyncValue::invalidIOVSyncValue
() )
76
std::cout
<<
"error: invalid IOV sync value !"
<< std::endl;
77
78
}
79
80
81
template
<
class
S,
class
SRcd>
82
void
HcalDumpConditions::dumpIt
(
S
* myS, SRcd* mySRcd,
const
edm::Event
&
e
,
const
edm::EventSetup
& context,
std::string
name
)
83
{
84
edm::ESHandle<S>
p
;
85
context.
get
<SRcd>().
get
(p);
86
S
* myobject =
new
S
(*p.
product
());
87
88
writeToFile
(myobject, e, name);
89
90
if
( context.
get
<SRcd>().validityInterval().first() ==
edm::IOVSyncValue::invalidIOVSyncValue
() )
91
std::cout
<<
"error: invalid IOV sync value !"
<< std::endl;
92
93
}
94
95
template
<
class
S>
void
HcalDumpConditions::writeToFile
(
S
* myS,
const
edm::Event
&
e
,
std::string
name
){
96
int
myrun = e.
id
().
run
();
97
std::ostringstream
file
;
98
file <<
front
<< name.c_str() <<
"_Run"
<< myrun <<
".txt"
;
99
std::ofstream outStream(file.str().c_str() );
100
std::cout
<<
"HcalDumpConditions: ---- Dumping "
<< name.c_str() <<
" ----"
<< std::endl;
101
HcalDbASCIIIO::dumpObject
(outStream, (*myS) );
102
}
103
104
void
105
HcalDumpConditions::analyze
(
const
edm::Event
&
e
,
const
edm::EventSetup
& context)
106
{
107
edm::ESHandle<HcalTopology>
topology
;
108
context.
get
<
HcalRecNumberingRecord
>().
get
( topology );
109
const
HcalTopology
* topo=&(*topology);
110
111
using namespace
edm::eventsetup;
112
std::cout
<<
"HcalDumpConditions::analyze-> I AM IN RUN NUMBER "
<<e.
id
().
run
() <<std::endl;
113
114
if
(
mDumpRequest
.empty())
return
;
115
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"ElectronicsMap"
)) !=
mDumpRequest
.end())
116
dumpIt
(
new
HcalElectronicsMap
,
new
HcalElectronicsMapRcd
, e,context,
"ElectronicsMap"
);
117
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"QIEData"
)) !=
mDumpRequest
.end())
118
dumpIt
(
new
HcalQIEData
(&(*topology)),
new
HcalQIEDataRcd
,
e
,context,
"QIEData"
, topo);
119
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"QIETypes"
)) !=
mDumpRequest
.end())
120
dumpIt
(
new
HcalQIETypes
(&(*topology)),
new
HcalQIETypesRcd
,
e
,context,
"QIETypes"
, topo);
121
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"Pedestals"
)) !=
mDumpRequest
.end())
122
dumpIt
(
new
HcalPedestals
(&(*topology)),
new
HcalPedestalsRcd
,
e
,context,
"Pedestals"
, topo);
123
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"PedestalWidths"
)) !=
mDumpRequest
.end())
124
dumpIt
(
new
HcalPedestalWidths
(&(*topology)),
new
HcalPedestalWidthsRcd
,
e
,context,
"PedestalWidths"
, topo);
125
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"Gains"
)) !=
mDumpRequest
.end())
126
dumpIt
(
new
HcalGains
(&(*topology)),
new
HcalGainsRcd
,
e
,context,
"Gains"
, topo);
127
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"GainWidths"
)) !=
mDumpRequest
.end())
128
dumpIt
(
new
HcalGainWidths
(&(*topology)),
new
HcalGainWidthsRcd
,
e
,context,
"GainWidths"
, topo);
129
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"ChannelQuality"
)) !=
mDumpRequest
.end())
130
dumpIt
(
new
HcalChannelQuality
(&(*topology)),
new
HcalChannelQualityRcd
,
e
,context,
"ChannelQuality"
, topo);
131
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"RespCorrs"
)) !=
mDumpRequest
.end())
132
dumpIt
(
new
HcalRespCorrs
(&(*topology)),
new
HcalRespCorrsRcd
,
e
,context,
"RespCorrs"
, topo);
133
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"ZSThresholds"
)) !=
mDumpRequest
.end())
134
dumpIt
(
new
HcalZSThresholds
(&(*topology)),
new
HcalZSThresholdsRcd
,
e
,context,
"ZSThresholds"
, topo);
135
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"L1TriggerObjects"
)) !=
mDumpRequest
.end())
136
dumpIt
(
new
HcalL1TriggerObjects
(&(*topology)),
new
HcalL1TriggerObjectsRcd
,
e
,context,
"L1TriggerObjects"
, topo);
137
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"TimeCorrs"
)) !=
mDumpRequest
.end())
138
dumpIt
(
new
HcalTimeCorrs
(&(*topology)),
new
HcalTimeCorrsRcd
,
e
,context,
"TimeCorrs"
, topo);
139
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"LUTCorrs"
)) !=
mDumpRequest
.end())
140
dumpIt
(
new
HcalLUTCorrs
(&(*topology)),
new
HcalLUTCorrsRcd
,
e
,context,
"LUTCorrs"
, topo);
141
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"PFCorrs"
)) !=
mDumpRequest
.end())
142
dumpIt
(
new
HcalPFCorrs
(&(*topology)),
new
HcalPFCorrsRcd
,
e
,context,
"PFCorrs"
, topo);
143
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"ValidationCorrs"
)) !=
mDumpRequest
.end())
144
dumpIt
(
new
HcalValidationCorrs
(&(*topology)),
new
HcalValidationCorrsRcd
,
e
,context,
"ValidationCorrs"
, topo);
145
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"LutMetadata"
)) !=
mDumpRequest
.end())
146
dumpIt
(
new
HcalLutMetadata
(&(*topology)),
new
HcalLutMetadataRcd
,
e
,context,
"LutMetadata"
, topo);
147
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"DcsValues"
)) !=
mDumpRequest
.end())
148
dumpIt
(
new
HcalDcsValues
,
new
HcalDcsRcd
, e,context,
"DcsValues"
);
149
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"DcsMap"
)) !=
mDumpRequest
.end())
150
dumpIt
(
new
HcalDcsMap
,
new
HcalDcsMapRcd
, e,context,
"DcsMap"
);
151
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"CholeskyMatrices"
)) !=
mDumpRequest
.end())
152
dumpIt
(
new
HcalCholeskyMatrices
(&(*topology)),
new
HcalCholeskyMatricesRcd
,
e
,context,
"CholeskyMatrices"
, topo);
153
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"RecoParams"
)) !=
mDumpRequest
.end())
154
dumpIt
(
new
HcalRecoParams
(&(*topology)),
new
HcalRecoParamsRcd
,
e
,context,
"RecoParams"
, topo);
155
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"TimingParams"
)) !=
mDumpRequest
.end())
156
dumpIt
(
new
HcalTimingParams
(&(*topology)),
new
HcalTimingParamsRcd
,
e
,context,
"TimingParams"
, topo);
157
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"LongRecoParams"
)) !=
mDumpRequest
.end())
158
dumpIt
(
new
HcalLongRecoParams
(&(*topology)),
new
HcalLongRecoParamsRcd
,
e
,context,
"LongRecoParams"
, topo);
159
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"ZDCLowGainFractions"
)) !=
mDumpRequest
.end())
160
dumpIt
(
new
HcalZDCLowGainFractions
(&(*topology)),
new
HcalZDCLowGainFractionsRcd
,
e
,context,
"ZDCLowGainFractions"
, topo);
161
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"MCParams"
)) !=
mDumpRequest
.end())
162
dumpIt
(
new
HcalMCParams
(&(*topology)),
new
HcalMCParamsRcd
,
e
,context,
"MCParams"
, topo);
163
if
(
std::find
(
mDumpRequest
.begin(),
mDumpRequest
.end(),
std::string
(
"FlagHFDigiTimeParams"
)) !=
mDumpRequest
.end())
164
dumpIt
(
new
HcalFlagHFDigiTimeParams
(&(*topology)),
new
HcalFlagHFDigiTimeParamsRcd
,
e
,context,
"FlagHFDigiTimeParams"
, topo);
165
166
167
}
168
DEFINE_FWK_MODULE
(
HcalDumpConditions
);
169
}
edm::EventID::run
RunNumber_t run() const
Definition:
EventID.h:39
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
i
int i
Definition:
DBlmapReader.cc:9
HcalGainWidths
Definition:
HcalGainWidths.h:17
HcalDcsMapRcd
Definition:
HcalDcsMapRcd.h:5
mergeVDriftHistosByStation.file
tuple file
Definition:
mergeVDriftHistosByStation.py:54
HcalValidationCorrsRcd
Definition:
HcalValidationCorrsRcd.h:25
HcalZSThresholds
Definition:
HcalZSThresholds.h:17
HcalValidationCorrs
Definition:
HcalValidationCorrs.h:17
HcalDcsMap
Definition:
HcalDcsMap.h:28
edmtest::HcalDumpConditions::writeToFile
void writeToFile(S *myS, const edm::Event &e, std::string name)
Definition:
HcalDumpConditions.cc:95
HcalLongRecoParamsRcd
Definition:
HcalLongRecoParamsRcd.h:6
ecaldqm::topology
CaloTopology const * topology(0)
HcalTimeCorrs
Definition:
HcalTimeCorrs.h:17
HcalLongRecoParams
Definition:
HcalLongRecoParams.h:11
HcalDbRecord.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:17
HcalRespCorrs
Definition:
HcalRespCorrs.h:17
HcalCholeskyMatricesRcd
Definition:
HcalCholeskyMatricesRcd.h:25
IOVSyncValue.h
Event.h
HcalChannelQualityRcd
Definition:
HcalChannelQualityRcd.h:8
MakerMacros.h
HcalQIETypesRcd
Definition:
HcalQIETypesRcd.h:25
HcalPFCorrsRcd
Definition:
HcalPFCorrsRcd.h:25
EventSetup.h
HcalTopology
Definition:
HcalTopology.h:25
HcalElectronicsMapRcd
Definition:
HcalElectronicsMapRcd.h:6
HcalQIEDataRcd
Definition:
HcalQIEDataRcd.h:8
HcalMCParamsRcd
Definition:
HcalMCParamsRcd.h:6
HcalZDCLowGainFractions
Definition:
HcalZDCLowGainFractions.h:10
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition:
FindCaloHit.cc:7
EnergyCorrector.c
tuple c
Definition:
EnergyCorrector.py:43
mergeVDriftHistosByStation.name
string name
Definition:
mergeVDriftHistosByStation.py:77
HcalRecoParamsRcd
Definition:
HcalRecoParamsRcd.h:6
HcalMCParams
Definition:
HcalMCParams.h:11
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
HcalPedestalsRcd
Definition:
HcalPedestalsRcd.h:9
HcalPedestalWidths
Definition:
HcalPedestalWidths.h:17
ParameterSet.h
HcalRecoParams
Definition:
HcalRecoParams.h:11
HcalTimeCorrsRcd
Definition:
HcalTimeCorrsRcd.h:25
HcalLUTCorrsRcd
Definition:
HcalLUTCorrsRcd.h:25
HcalRespCorrsRcd
Definition:
HcalRespCorrsRcd.h:25
HcalL1TriggerObjectsRcd
Definition:
HcalL1TriggerObjectsRcd.h:25
edm::ESHandle
Definition:
DTSurvey.h:22
HcalGainsRcd
Definition:
HcalGainsRcd.h:8
HcalLUTCorrs
Definition:
HcalLUTCorrs.h:17
HcalDcsValues
Definition:
HcalDcsValues.h:25
HcalCholeskyMatrices
Definition:
HcalCholeskyMatrices.h:18
ESHandle.h
HcalChannelQuality
Definition:
HcalChannelQuality.h:17
edm::EventSetup
Definition:
EventSetup.h:45
edmtest::HcalDumpConditions::front
std::string front
Definition:
HcalDumpConditions.cc:60
edmtest::HcalDumpConditions::HcalDumpConditions
HcalDumpConditions(edm::ParameterSet const &p)
Definition:
HcalDumpConditions.cc:44
edmtest::HcalDumpConditions::HcalDumpConditions
HcalDumpConditions(int i)
Definition:
HcalDumpConditions.cc:50
HcalQIEData
Definition:
HcalQIEData.h:25
HcalFlagHFDigiTimeParams
Definition:
HcalFlagHFDigiTimeParams.h:10
edm::EDAnalyzer
Definition:
EDAnalyzer.h:27
EDAnalyzer.h
HcalTimingParamsRcd
Definition:
HcalTimingParamsRcd.h:6
HcalPedestalWidthsRcd
Definition:
HcalPedestalWidthsRcd.h:8
HcalPFCorrs
Definition:
HcalPFCorrs.h:17
edmtest::HcalDumpConditions::dumpIt
void dumpIt(S *myS, SRcd *mySRcd, const edm::Event &e, const edm::EventSetup &context, std::string name, const HcalTopology *topo)
Definition:
HcalDumpConditions.cc:66
HcalDcsRcd
Definition:
HcalDcsRcd.h:5
HcalQIETypes
Definition:
HcalQIETypes.h:17
HcalRecNumberingRecord.h
edmtest::HcalDumpConditions::mDumpRequest
std::vector< std::string > mDumpRequest
Definition:
HcalDumpConditions.cc:61
HcalLutMetadata
Definition:
HcalLutMetadata.h:15
edm::EventSetup::get
const T & get() const
Definition:
EventSetup.h:56
edm::ESHandle::product
T const * product() const
Definition:
ESHandle.h:86
HcalLutMetadataRcd
Definition:
HcalLutMetadataRcd.h:25
S
double S(const TLorentzVector &, const TLorentzVector &)
Definition:
Particle.cc:99
alignCSCRings.e
list e
Definition:
alignCSCRings.py:90
HcalGains
Definition:
HcalGains.h:17
AlCaHLTBitMon_ParallelJobs.p
tuple p
Definition:
AlCaHLTBitMon_ParallelJobs.py:152
edm::EventBase::id
edm::EventID id() const
Definition:
EventBase.h:59
HcalFlagHFDigiTimeParamsRcd
Definition:
HcalFlagHFDigiTimeParamsRcd.h:6
HcalRecNumberingRecord
Definition:
HcalRecNumberingRecord.h:23
HcalDbASCIIIO::dumpObject
bool dumpObject(std::ostream &fOutput, const HcalPedestals &fObject)
AllObjects.h
HcalL1TriggerObjects
Definition:
HcalL1TriggerObjects.h:14
HcalElectronicsMap
Definition:
HcalElectronicsMap.h:29
HcalDbASCIIIO.h
edmtest::HcalDumpConditions
Definition:
HcalDumpConditions.cc:41
HcalPedestals
Definition:
HcalPedestals.h:17
edm::ParameterSet
Definition:
ParameterSet.h:36
gather_cfg.cout
tuple cout
Definition:
gather_cfg.py:145
edmtest::HcalDumpConditions::analyze
virtual void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition:
HcalDumpConditions.cc:105
HcalAllRcds.h
edm::Event
Definition:
Event.h:65
HcalZDCLowGainFractionsRcd
Definition:
HcalZDCLowGainFractionsRcd.h:25
HcalTimingParams
Definition:
HcalTimingParams.h:11
HcalZSThresholdsRcd
Definition:
HcalZSThresholdsRcd.h:25
HcalGainWidthsRcd
Definition:
HcalGainWidthsRcd.h:8
edm::IOVSyncValue::invalidIOVSyncValue
static const IOVSyncValue & invalidIOVSyncValue()
Definition:
IOVSyncValue.cc:92
HcalDbService.h
edmtest::HcalDumpConditions::~HcalDumpConditions
virtual ~HcalDumpConditions()
Definition:
HcalDumpConditions.cc:52
Generated for CMSSW Reference Manual by
1.8.5