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");
99 edm::LogInfo(
"EventInfo") <<
" Run = " <<
e.id().run() <<
" Event = " <<
e.id().event();
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();
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 pedestalPreSampleAnalog = 0.;
242 ebAnalogSignal[
sample] = 0.;
253 if (Emax < ebAnalogSignal[
sample]) {
254 Emax = ebAnalogSignal[
sample];
261 <<
" Gain Id = " << ebADCGains[
sample] <<
" Analog eq = " << ebAnalogSignal[
sample];
264 pedestalPreSampleAnalog /= 3.;
265 double Erec = Emax - pedestalPreSampleAnalog *
gainConv_[(
int)ebADCGains[
Pmax]];
267 if (ebSimMap[ebid.
rawId()] != 0.) {
268 LogDebug(
"DigiInfo") <<
" Digi / Hit = " << Erec <<
" / " << ebSimMap[ebid.
rawId()] <<
" gainConv " 292 LogDebug(
"HitInfo") <<
" CaloHit " << iHit.getName() <<
"\n" 293 <<
" DetID = " << iHit.id() <<
" EEDetId side = " << eeid.
zside() <<
" = " << eeid.
ix() <<
" " 295 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n" 296 <<
" Track Id = " << iHit.geantTrackId() <<
"\n" 297 <<
" Energy = " << iHit.energy();
299 uint32_t crystid = eeid.
rawId();
300 eeSimMap[crystid] += iHit.energy();
307 std::vector<double> eeAnalogSignal;
308 std::vector<double> eeADCCounts;
309 std::vector<double> eeADCGains;
314 for (
unsigned int digis = 0; digis < EcalDigiEE->
size(); ++digis) {
316 int nrSamples = eedf.
size();
322 double pedestalPreSampleAnalog = 0.;
325 eeAnalogSignal[
sample] = 0.;
336 if (Emax < eeAnalogSignal[
sample]) {
337 Emax = eeAnalogSignal[
sample];
344 <<
" Gain Id = " << eeADCGains[
sample] <<
" Analog eq = " << eeAnalogSignal[
sample];
346 pedestalPreSampleAnalog /= 3.;
347 double Erec = Emax - pedestalPreSampleAnalog *
gainConv_[(
int)eeADCGains[
Pmax]];
349 if (eeSimMap[eeid.
rawId()] != 0.) {
350 LogDebug(
"DigiInfo") <<
" Digi / Hit = " << Erec <<
" / " << eeSimMap[eeid.
rawId()] <<
" gainConv " 368 LogDebug(
"HitInfo") <<
" CaloHit " << iHit.getName() <<
"\n" 369 <<
" DetID = " << iHit.id() <<
"ESDetId: z side " << esid.
zside() <<
" plane " 370 << esid.
plane() << esid.
six() <<
',' << esid.
siy() <<
':' << esid.
strip() <<
"\n" 371 <<
" Time = " << iHit.time() <<
" Event id. = " << iHit.eventId().rawId() <<
"\n" 372 <<
" Track Id = " << iHit.geantTrackId() <<
"\n" 373 <<
" Energy = " << iHit.energy();
389 LogDebug(
"EcalDigi") <<
" Gains conversions: " 394 LogDebug(
"EcalDigi") <<
" Gains conversions: " 398 delete defaultRatios;
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
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)
int iphi() const
get the crystal iphi
T const * product() 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_
MonitorElement * meGunEnergy_
int ieta() const
get the crystal ieta
T getUntrackedParameter(std::string const &, T const &) 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)
MonitorElement * meGunEta_
bool isEndcap(GeomDetEnumerators::SubDetector m)
const HepMC::GenEvent * GetEvent() const
void reserve(size_t isize)
Log< level::Info, false > LogInfo
float gain12Over6() const
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
constexpr uint32_t rawId() const
get the raw id
std::vector< SimVertex > SimVertexContainer
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_