18 EBdigiCollectionToken_( consumes<
EBDigiCollection>( ps.getParameter<
edm::InputTag>(
"EBdigiCollection" ) ) ),
19 EEdigiCollectionToken_( consumes<
EEDigiCollection>( ps.getParameter<
edm::InputTag>(
"EEdigiCollection" ) ) ),
20 ESdigiCollectionToken_( consumes<
ESDigiCollection>( ps.getParameter<
edm::InputTag>(
"ESdigiCollection" ) ) ),
44 edm::LogInfo(
"OutputInfo") <<
" Ecal Digi Task histograms will NOT be saved";
88 sprintf (histo,
"EcalDigiTask Gun Momentum" ) ;
91 sprintf (histo,
"EcalDigiTask Gun Eta" ) ;
94 sprintf (histo,
"EcalDigiTask Gun Phi" ) ;
97 sprintf (histo,
"EcalDigiTask Barrel maximum Digi over Sim ratio" ) ;
100 sprintf (histo,
"EcalDigiTask Endcap maximum Digi over Sim ratio" ) ;
103 sprintf (histo,
"EcalDigiTask Barrel maximum Digi over Sim ratio gt 10 ADC" ) ;
106 sprintf (histo,
"EcalDigiTask Endcap maximum Digi over Sim ratio gt 20 ADC" ) ;
109 sprintf (histo,
"EcalDigiTask Barrel maximum Digi over Sim ratio gt 100 ADC" ) ;
112 sprintf (histo,
"EcalDigiTask Endcap maximum Digi over Sim ratio gt 100 ADC" ) ;
121 std::vector<SimTrack> theSimTracks;
122 std::vector<SimVertex> theSimVertexes;
134 if (!MCEvt.
isValid()) { skipMC =
true; }
145 EBdigis = EcalDigiEB.
product();
146 LogDebug(
"DigiInfo") <<
"total # EBdigis: " << EBdigis->
size() ;
147 if ( EBdigis->
empty() ) isBarrel =
false;
155 EEdigis = EcalDigiEE.
product();
156 LogDebug(
"DigiInfo") <<
"total # EEdigis: " << EEdigis->
size() ;
157 if ( EEdigis->
empty() ) isEndcap =
false;
162 bool isPreshower =
true;
165 ESdigis = EcalDigiES.
product();
166 LogDebug(
"DigiInfo") <<
"total # ESdigis: " << ESdigis->
size() ;
167 if ( ESdigis->
empty() ) isPreshower =
false;
172 theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end());
173 theSimVertexes.insert(theSimVertexes.end(),SimVtx->begin(),SimVtx->end());
176 double theGunEnergy = 0.;
177 for ( HepMC::GenEvent::particle_const_iterator
p = MCEvt->
GetEvent()->particles_begin();
178 p != MCEvt->
GetEvent()->particles_end(); ++
p ) {
180 theGunEnergy = (*p)->momentum().e();
181 double htheta = (*p)->momentum().theta();
182 double heta = -
log(
tan(htheta * 0.5));
183 double hphi = (*p)->momentum().phi();
184 hphi = (hphi>=0) ? hphi : hphi+2*
M_PI;
185 hphi = hphi /
M_PI * 180.;
186 LogDebug(
"EventInfo") <<
"Particle gun type form MC = " <<
abs((*p)->pdg_id()) <<
"\n" <<
"Energy = "<< (*p)->momentum().e() <<
" Eta = " << heta <<
" Phi = " << hphi;
196 for (std::vector<SimVertex>::iterator isimvtx = theSimVertexes.begin();
197 isimvtx != theSimVertexes.end(); ++isimvtx){
198 LogDebug(
"EventInfo") <<
" Vertex index = " << nvtx <<
" event Id = " << isimvtx->eventId().rawId() <<
"\n" <<
" vertex dump: " << *isimvtx ;
203 for (std::vector<SimTrack>::iterator isimtrk = theSimTracks.begin();
204 isimtrk != theSimTracks.end(); ++isimtrk){
205 LogDebug(
"EventInfo") <<
" Track index = " << ntrk <<
" track Id = " << isimtrk->trackId() <<
" event Id = " << isimtrk->eventId().rawId() <<
"\n" <<
" track dump: " << *isimtrk ;
224 <<
" CaloHit " << iHit.getName() <<
"\n" 225 <<
" DetID = " << iHit.id()<<
" EBDetId = " << ebid.
ieta() <<
" " << ebid.
iphi() <<
"\n" 226 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n" 227 <<
" Track Id = " << iHit.geantTrackId() <<
"\n" 228 <<
" Energy = " << iHit.energy();
230 uint32_t crystid = ebid.
rawId();
231 ebSimMap[crystid] += iHit.energy();
239 std::vector<double> ebAnalogSignal ;
240 std::vector<double> ebADCCounts ;
241 std::vector<double> ebADCGains ;
246 for (
unsigned int digis=0; digis<EcalDigiEB->
size(); ++digis) {
249 int nrSamples=ebdf.
size();
255 double pedestalPreSample = 0.;
256 double pedestalPreSampleAnalog = 0.;
259 ebAnalogSignal[
sample] = 0.;
271 if (Emax < ebAnalogSignal[
sample] ) {
272 Emax = ebAnalogSignal[
sample] ;
276 pedestalPreSample += ebADCCounts[
sample] ;
277 pedestalPreSampleAnalog += ebADCCounts[
sample]*
gainConv_[(
int)ebADCGains[sample]]*barrelADCtoGeV_ ;
279 LogDebug(
"DigiInfo") <<
"EB sample " << sample <<
" ADC counts = " << ebADCCounts[
sample] <<
" Gain Id = " << ebADCGains[
sample] <<
" Analog eq = " << ebAnalogSignal[
sample];
282 pedestalPreSample /= 3. ;
283 pedestalPreSampleAnalog /= 3. ;
284 double Erec = Emax - pedestalPreSampleAnalog*
gainConv_[(
int)ebADCGains[Pmax]];
286 if ( ebSimMap[ebid.
rawId()] != 0. ) {
287 LogDebug(
"DigiInfo") <<
" Digi / Hit = " << Erec <<
" / " << ebSimMap[ebid.
rawId()] <<
" gainConv " <<
gainConv_[(
int)ebADCGains[Pmax]];
313 <<
" CaloHit " << iHit.getName() <<
"\n" 314 <<
" DetID = "<<iHit.id()<<
" EEDetId side = " << eeid.
zside() <<
" = " << eeid.
ix() <<
" " << eeid.
iy() <<
"\n" 315 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n" 316 <<
" Track Id = " << iHit.geantTrackId() <<
"\n" 317 <<
" Energy = " << iHit.energy();
319 uint32_t crystid = eeid.
rawId();
320 eeSimMap[crystid] += iHit.energy();
328 std::vector<double> eeAnalogSignal ;
329 std::vector<double> eeADCCounts ;
330 std::vector<double> eeADCGains ;
335 for (
unsigned int digis=0; digis<EcalDigiEE->
size(); ++digis) {
338 int nrSamples=eedf.
size();
344 double pedestalPreSample = 0.;
345 double pedestalPreSampleAnalog = 0.;
348 eeAnalogSignal[
sample] = 0.;
360 if (Emax < eeAnalogSignal[
sample] ) {
361 Emax = eeAnalogSignal[
sample] ;
365 pedestalPreSample += eeADCCounts[
sample] ;
366 pedestalPreSampleAnalog += eeADCCounts[
sample]*
gainConv_[(
int)eeADCGains[sample]]*endcapADCtoGeV_ ;
368 LogDebug(
"DigiInfo") <<
"EE sample " << sample <<
" ADC counts = " << eeADCCounts[
sample] <<
" Gain Id = " << eeADCGains[
sample] <<
" Analog eq = " << eeAnalogSignal[
sample];
370 pedestalPreSample /= 3. ;
371 pedestalPreSampleAnalog /= 3. ;
372 double Erec = Emax - pedestalPreSampleAnalog*
gainConv_[(
int)eeADCGains[Pmax]];
374 if (eeSimMap[eeid.
rawId()] != 0. ) {
375 LogDebug(
"DigiInfo") <<
" Digi / Hit = " << Erec <<
" / " << eeSimMap[eeid.
rawId()] <<
" gainConv " <<
gainConv_[(
int)eeADCGains[Pmax]];
394 <<
" CaloHit " << iHit.getName() <<
"\n" 395 <<
" DetID = " << iHit.id()<<
"ESDetId: z side " << esid.
zside() <<
" plane " << esid.
plane() << esid.
six() <<
',' << esid.
siy() <<
':' << esid.
strip() <<
"\n" 396 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n" 397 <<
" Track Id = " << iHit.geantTrackId() <<
"\n" 398 <<
" Energy = " << iHit.energy();
421 LogDebug(
"EcalDigi") <<
" Gains conversions: " <<
"\n" <<
" g1 = " << gainConv_[1] <<
"\n" <<
" g2 = " << gainConv_[2] <<
"\n" <<
" g3 = " << gainConv_[3];
422 LogDebug(
"EcalDigi") <<
" Gains conversions: " <<
"\n" <<
" saturation = " << gainConv_[0];
424 delete defaultRatios;
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
~EcalDigisValidation() override
Destructor.
edm::EDGetTokenT< EBDigiCollection > EBdigiCollectionToken_
std::map< uint32_t, float, std::less< uint32_t > > MapType
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< edm::SimVertexContainer > g4VtxInfoToken_
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
MonitorElement * meEEDigiSimRatiogt100ADC_
std::map< int, double, std::less< int > > gainConv_
int gainId() const
get the gainId (2 bits)
MonitorElement * meGunEnergy_
int iphi() const
get the crystal iphi
uint32_t rawId() const
get the raw id
MonitorElement * meEBDigiSimRatiogt10ADC_
void analyze(edm::Event const &e, edm::EventSetup const &c) override
Analyze.
MonitorElement * meEBDigiSimRatio_
MonitorElement * book1D(Args &&...args)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitESToken_
int ieta() const
get the crystal ieta
MonitorElement * meGunEta_
bool isEndcap(GeomDetEnumerators::SubDetector m)
void reserve(size_t isize)
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEBToken_
void setCurrentFolder(const std::string &fullpath)
const HepMC::GenEvent * GetEvent() const
T const * product() const
std::vector< SimVertex > SimVertexContainer
float gain12Over6() const
EcalDigisValidation(const edm::ParameterSet &ps)
Constructor.
MonitorElement * meEEDigiSimRatio_
MonitorElement * meGunPhi_
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
MonitorElement * meEEDigiSimRatiogt20ADC_
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken_
void checkCalibrations(edm::EventSetup const &c)
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
T const * product() const
std::vector< SimTrack > SimTrackContainer
MonitorElement * meEBDigiSimRatiogt100ADC_
static const int MAXSAMPLES
edm::EDGetTokenT< edm::SimTrackContainer > g4TkInfoToken_
int adc() const
get the ADC sample (12 bits)