23 std::
string(
"mix"), ps.getParameter<std::
string>(
"moduleLabelG4") + std::
string(
"EcalHitsEB")))),
25 std::
string(
"mix"), ps.getParameter<std::
string>(
"moduleLabelG4") + std::
string(
"EcalHitsEE")))),
27 std::
string(
"mix"), ps.getParameter<std::
string>(
"moduleLabelG4") + std::
string(
"EcalHitsES")))) {
34 edm::LogInfo(
"OutputInfo") <<
" Ecal Digi Task histograms will NOT be saved";
70 sprintf(histo,
"EcalDigiTask Gun Momentum");
73 sprintf(histo,
"EcalDigiTask Gun Eta");
76 sprintf(histo,
"EcalDigiTask Gun Phi");
79 sprintf(histo,
"EcalDigiTask Barrel maximum Digi over Sim ratio");
82 sprintf(histo,
"EcalDigiTask Endcap maximum Digi over Sim ratio");
85 sprintf(histo,
"EcalDigiTask Barrel maximum Digi over Sim ratio gt 10 ADC");
88 sprintf(histo,
"EcalDigiTask Endcap maximum Digi over Sim ratio gt 20 ADC");
91 sprintf(histo,
"EcalDigiTask Barrel maximum Digi over Sim ratio gt 100 ADC");
94 sprintf(histo,
"EcalDigiTask Endcap maximum Digi over Sim ratio gt 100 ADC");
101 std::vector<SimTrack> theSimTracks;
102 std::vector<SimVertex> theSimVertexes;
127 EBdigis = EcalDigiEB.
product();
128 LogDebug(
"DigiInfo") <<
"total # EBdigis: " << EBdigis->
size();
129 if (EBdigis->
empty())
138 EEdigis = EcalDigiEE.
product();
139 LogDebug(
"DigiInfo") <<
"total # EEdigis: " << EEdigis->
size();
140 if (EEdigis->
empty())
146 bool isPreshower =
true;
149 ESdigis = EcalDigiES.
product();
150 LogDebug(
"DigiInfo") <<
"total # ESdigis: " << ESdigis->
size();
151 if (ESdigis->
empty())
157 theSimTracks.insert(theSimTracks.end(), SimTk->begin(), SimTk->end());
158 theSimVertexes.insert(theSimVertexes.end(), SimVtx->begin(), SimVtx->end());
161 double theGunEnergy = 0.;
162 for (HepMC::GenEvent::particle_const_iterator
p = MCEvt->GetEvent()->particles_begin();
163 p != MCEvt->GetEvent()->particles_end();
165 theGunEnergy = (*p)->momentum().e();
166 double htheta = (*p)->momentum().theta();
167 double heta = -
log(
tan(htheta * 0.5));
168 double hphi = (*p)->momentum().phi();
169 hphi = (hphi >= 0) ? hphi : hphi + 2 *
M_PI;
170 hphi = hphi /
M_PI * 180.;
171 LogDebug(
"EventInfo") <<
"Particle gun type form MC = " <<
abs((*p)->pdg_id()) <<
"\n"
172 <<
"Energy = " << (*p)->momentum().e() <<
" Eta = " << heta <<
" Phi = " << hphi;
184 for (std::vector<SimVertex>::iterator isimvtx = theSimVertexes.begin(); isimvtx != theSimVertexes.end(); ++isimvtx) {
185 LogDebug(
"EventInfo") <<
" Vertex index = " << nvtx <<
" event Id = " << isimvtx->eventId().rawId() <<
"\n"
186 <<
" vertex dump: " << *isimvtx;
191 for (std::vector<SimTrack>::iterator isimtrk = theSimTracks.begin(); isimtrk != theSimTracks.end(); ++isimtrk) {
192 LogDebug(
"EventInfo") <<
" Track index = " << ntrk <<
" track Id = " << isimtrk->trackId()
193 <<
" event Id = " << isimtrk->eventId().rawId() <<
"\n"
194 <<
" track dump: " << *isimtrk;
210 LogDebug(
"HitInfo") <<
" CaloHit " << iHit.getName() <<
"\n"
211 <<
" DetID = " << iHit.id() <<
" EBDetId = " << ebid.
ieta() <<
" " << ebid.
iphi() <<
"\n"
212 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n"
213 <<
" Track Id = " << iHit.geantTrackId() <<
"\n"
214 <<
" Energy = " << iHit.energy();
216 uint32_t crystid = ebid.
rawId();
217 ebSimMap[crystid] += iHit.energy();
224 std::vector<double> ebAnalogSignal;
225 std::vector<double> ebADCCounts;
226 std::vector<double> ebADCGains;
231 for (
unsigned int digis = 0; digis < EcalDigiEB->size(); ++digis) {
233 int nrSamples = ebdf.
size();
239 double pedestalPreSample = 0.;
240 double pedestalPreSampleAnalog = 0.;
243 ebAnalogSignal[
sample] = 0.;
254 if (Emax < ebAnalogSignal[
sample]) {
255 Emax = ebAnalogSignal[
sample];
259 pedestalPreSample += ebADCCounts[
sample];
260 pedestalPreSampleAnalog += ebADCCounts[
sample] *
gainConv_[(int)ebADCGains[sample]] * barrelADCtoGeV_;
262 LogDebug(
"DigiInfo") <<
"EB sample " << sample <<
" ADC counts = " << ebADCCounts[
sample]
263 <<
" Gain Id = " << ebADCGains[
sample] <<
" Analog eq = " << ebAnalogSignal[
sample];
266 pedestalPreSample /= 3.;
267 pedestalPreSampleAnalog /= 3.;
268 double Erec = Emax - pedestalPreSampleAnalog *
gainConv_[(int)ebADCGains[Pmax]];
270 if (ebSimMap[ebid.
rawId()] != 0.) {
271 LogDebug(
"DigiInfo") <<
" Digi / Hit = " << Erec <<
" / " << ebSimMap[ebid.
rawId()] <<
" gainConv "
295 LogDebug(
"HitInfo") <<
" CaloHit " << iHit.getName() <<
"\n"
296 <<
" DetID = " << iHit.id() <<
" EEDetId side = " << eeid.
zside() <<
" = " << eeid.
ix() <<
" "
298 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n"
299 <<
" Track Id = " << iHit.geantTrackId() <<
"\n"
300 <<
" Energy = " << iHit.energy();
302 uint32_t crystid = eeid.
rawId();
303 eeSimMap[crystid] += iHit.energy();
310 std::vector<double> eeAnalogSignal;
311 std::vector<double> eeADCCounts;
312 std::vector<double> eeADCGains;
317 for (
unsigned int digis = 0; digis < EcalDigiEE->size(); ++digis) {
319 int nrSamples = eedf.
size();
325 double pedestalPreSample = 0.;
326 double pedestalPreSampleAnalog = 0.;
329 eeAnalogSignal[
sample] = 0.;
340 if (Emax < eeAnalogSignal[
sample]) {
341 Emax = eeAnalogSignal[
sample];
345 pedestalPreSample += eeADCCounts[
sample];
346 pedestalPreSampleAnalog += eeADCCounts[
sample] *
gainConv_[(int)eeADCGains[sample]] * endcapADCtoGeV_;
348 LogDebug(
"DigiInfo") <<
"EE sample " << sample <<
" ADC counts = " << eeADCCounts[
sample]
349 <<
" Gain Id = " << eeADCGains[
sample] <<
" Analog eq = " << eeAnalogSignal[
sample];
351 pedestalPreSample /= 3.;
352 pedestalPreSampleAnalog /= 3.;
353 double Erec = Emax - pedestalPreSampleAnalog *
gainConv_[(int)eeADCGains[Pmax]];
355 if (eeSimMap[eeid.
rawId()] != 0.) {
356 LogDebug(
"DigiInfo") <<
" Digi / Hit = " << Erec <<
" / " << eeSimMap[eeid.
rawId()] <<
" gainConv "
374 LogDebug(
"HitInfo") <<
" CaloHit " << iHit.getName() <<
"\n"
375 <<
" DetID = " << iHit.id() <<
"ESDetId: z side " << esid.
zside() <<
" plane "
376 << esid.
plane() << esid.
six() <<
',' << esid.
siy() <<
':' << esid.
strip() <<
"\n"
377 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n"
378 <<
" Track Id = " << iHit.geantTrackId() <<
"\n"
379 <<
" Energy = " << iHit.energy();
395 LogDebug(
"EcalDigi") <<
" Gains conversions: "
397 <<
" g1 = " << gainConv_[1] <<
"\n"
398 <<
" g2 = " << gainConv_[2] <<
"\n"
399 <<
" g3 = " << gainConv_[3];
400 LogDebug(
"EcalDigi") <<
" Gains conversions: "
402 <<
" saturation = " << gainConv_[0];
404 delete defaultRatios;
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
static std::vector< std::string > checklist log
const edm::EventSetup & c
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitESToken_
~EcalDigisValidation() override
Destructor.
std::map< uint32_t, float, std::less< uint32_t > > MapType
edm::EDGetTokenT< EBDigiCollection > EBdigiCollectionToken_
virtual void setCurrentFolder(std::string const &fullpath)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
constexpr uint32_t rawId() const
get the raw id
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
bool getData(T &iHolder) const
MonitorElement * meEBDigiSimRatiogt10ADC_
void analyze(edm::Event const &e, edm::EventSetup const &c) override
Analyze.
MonitorElement * meEBDigiSimRatio_
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
int ieta() const
get the crystal ieta
MonitorElement * meGunEta_
bool isEndcap(GeomDetEnumerators::SubDetector m)
Log< level::Info, false > LogInfo
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
T const * product() const
std::vector< SimVertex > SimVertexContainer
float gain12Over6() const
EcalDigisValidation(const edm::ParameterSet &ps)
Constructor.
MonitorElement * meEEDigiSimRatio_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEBToken_
MonitorElement * meGunPhi_
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > pAgc
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
MonitorElement * meEEDigiSimRatiogt20ADC_
static constexpr int MAXSAMPLES
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken_
void checkCalibrations(edm::EventSetup const &c)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
std::vector< SimTrack > SimTrackContainer
MonitorElement * meEBDigiSimRatiogt100ADC_
edm::EDGetTokenT< edm::SimTrackContainer > g4TkInfoToken_
int adc() const
get the ADC sample (12 bits)