Analyze.
119 edm::LogInfo(
"EventInfo") <<
" Run = " <<
e.id().run() <<
" Event = " <<
e.id().event();
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.;
347 for (
int sample = 0 ; sample < nrSamples; ++
sample) {
348 eeAnalogSignal[
sample] = 0.;
353 for (
int sample = 0 ; sample < nrSamples; ++
sample) {
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();
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
edm::EDGetTokenT< EBDigiCollection > EBdigiCollectionToken_
std::map< uint32_t, float, std::less< uint32_t > > MapType
constexpr uint32_t rawId() const
get the raw id
edm::EDGetTokenT< edm::SimVertexContainer > g4VtxInfoToken_
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
MonitorElement * meEBDigiSimRatiogt10ADC_
MonitorElement * meEBDigiSimRatio_
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_
const HepMC::GenEvent * GetEvent() const
T const * product() const
MonitorElement * meEEDigiSimRatio_
MonitorElement * meGunPhi_
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
MonitorElement * meEEDigiSimRatiogt20ADC_
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
MonitorElement * meEBDigiSimRatiogt100ADC_
static const int MAXSAMPLES
edm::EDGetTokenT< edm::SimTrackContainer > g4TkInfoToken_
int adc() const
get the ADC sample (12 bits)