19 MCTruthCollectionToken_(consumes<
edm::
HepMCProduct>(ps.getParameter<
edm::InputTag>(
"MCTruthCollection"))),
20 barrelRawSuperClusterCollectionToken_(consumes<
reco::
SuperClusterCollection>(ps.getParameter<
edm::InputTag>(
"barrelRawSuperClusterCollection"))),
21 barrelCorSuperClusterCollectionToken_(consumes<
reco::
SuperClusterCollection>(ps.getParameter<
edm::InputTag>(
"barrelCorSuperClusterCollection"))),
22 endcapRawSuperClusterCollectionToken_(consumes<
reco::
SuperClusterCollection>(ps.getParameter<
edm::InputTag>(
"endcapRawSuperClusterCollection"))),
23 endcapPreSuperClusterCollectionToken_(consumes<
reco::
SuperClusterCollection>(ps.getParameter<
edm::InputTag>(
"endcapPreSuperClusterCollection"))),
24 endcapCorSuperClusterCollectionToken_(consumes<
reco::
SuperClusterCollection>(ps.getParameter<
edm::InputTag>(
"endcapCorSuperClusterCollection"))),
25 barrelRecHitCollectionToken_(consumes<
EcalRecHitCollection>(ps.getParameter<
edm::InputTag>(
"barrelRecHitCollection"))),
26 endcapRecHitCollectionToken_(consumes<
EcalRecHitCollection>(ps.getParameter<
edm::InputTag>(
"endcapRecHitCollection"))),
28 hsNumBC_(ps,
"NumBC"),
32 hsS1toS9_(ps,
"S1toS9"),
33 hsS25toE_(ps,
"S25toE"),
34 hsEoverTruth_(ps,
"EoverTruth"),
35 hsdeltaR_(ps,
"deltaR"),
36 hsphiWidth_(ps,
"phiWidth"),
37 hsetaWidth_(ps,
"etaWidth"),
38 hspreshowerE_(ps,
"preshowerE"),
75 hist_EB_RawSC_EoverTruth_(
nullptr),
76 hist_EE_RawSC_EoverTruth_(
nullptr),
77 hist_EB_CorSC_EoverTruth_(
nullptr),
78 hist_EE_CorSC_EoverTruth_(
nullptr),
79 hist_EE_PreSC_EoverTruth_(
nullptr),
85 hist_EE_PreSC_preshowerE_(
nullptr),
86 hist_EE_CorSC_preshowerE_(
nullptr),
87 hist_EE_CorSC_phiWidth_(
nullptr),
88 hist_EB_CorSC_phiWidth_(
nullptr),
89 hist_EE_CorSC_etaWidth_(
nullptr),
90 hist_EB_CorSC_etaWidth_(
nullptr),
91 hist_EB_CorSC_ET_vs_Eta_(
nullptr),
92 hist_EB_CorSC_ET_vs_Phi_(
nullptr),
93 hist_EE_CorSC_ET_vs_Eta_(
nullptr),
94 hist_EE_CorSC_ET_vs_Phi_(
nullptr),
111 = _ibooker.
book1D(
"hist_EB_RawSC_Size_",
"# Raw SuperClusters in Barrel",
114 = _ibooker.
book1D(
"hist_EE_RawSC_Size_",
"# Raw SuperClusters in Endcap",
117 = _ibooker.
book1D(
"hist_EB_CorSC_Size_",
"# Corrected SuperClusters in Barrel",
120 = _ibooker.
book1D(
"hist_EE_CorSC_Size_",
"# Corrected SuperClusters in Endcap",
123 = _ibooker.
book1D(
"hist_EE_PreSC_Size_",
"# SuperClusters with Preshower in Endcap",
129 = _ibooker.
book1D(
"hist_EB_RawSC_NumBC_",
"# of Basic Clusters in Raw Super Clusters in Barrel",
132 = _ibooker.
book1D(
"hist_EE_RawSC_NumBC_",
"# of Basic Clusters in Raw Super Clusters in Endcap",
135 = _ibooker.
book1D(
"hist_EB_CorSC_NumBC_",
"# of Basic Clusters in Corrected SuperClusters in Barrel",
138 = _ibooker.
book1D(
"hist_EE_CorSC_NumBC_",
"# of Basic Clusters in Corrected SuperClusters in Endcap",
141 = _ibooker.
book1D(
"hist_EE_PreSC_NumBC_",
"# of Basic Clusters in SuperClusters with Preshower in Endcap",
147 = _ibooker.
book1D(
"hist_EB_RawSC_ET_",
"ET of Raw SuperClusters in Barrel",
150 = _ibooker.
book1D(
"hist_EE_RawSC_ET_",
"ET of Raw SuperClusters in Endcap",
153 = _ibooker.
book1D(
"hist_EB_CorSC_ET_",
"ET of Corrected SuperClusters in Barrel",
156 = _ibooker.
book1D(
"hist_EE_CorSC_ET_",
"ET of Corrected SuperClusters in Endcap",
159 = _ibooker.
book1D(
"hist_EE_PreSC_ET_",
"ET of SuperClusters with Preshower in Endcap",
165 = _ibooker.
book1D(
"hist_EB_RawSC_Eta_",
"Eta of Raw SuperClusters in Barrel",
168 = _ibooker.
book1D(
"hist_EE_RawSC_Eta_",
"Eta of Raw SuperClusters in Endcap",
171 = _ibooker.
book1D(
"hist_EB_CorSC_Eta_",
"Eta of Corrected SuperClusters in Barrel",
174 = _ibooker.
book1D(
"hist_EE_CorSC_Eta_",
"Eta of Corrected SuperClusters in Endcap",
177 = _ibooker.
book1D(
"hist_EE_PreSC_Eta_",
"Eta of SuperClusters with Preshower in Endcap",
183 = _ibooker.
book1D(
"hist_EB_RawSC_Phi_",
"Phi of Raw SuperClusters in Barrel",
186 = _ibooker.
book1D(
"hist_EE_RawSC_Phi_",
"Phi of Raw SuperClusters in Endcap",
189 = _ibooker.
book1D(
"hist_EB_CorSC_Phi_",
"Phi of Corrected SuperClusters in Barrel",
192 = _ibooker.
book1D(
"hist_EE_CorSC_Phi_",
"Phi of Corrected SuperClusters in Endcap",
195 = _ibooker.
book1D(
"hist_EE_PreSC_Phi_",
"Phi of SuperClusters with Preshower in Endcap",
201 = _ibooker.
book1D(
"hist_EB_RawSC_S1toS9_",
"S1/S9 of Raw Super Clusters in Barrel",
204 = _ibooker.
book1D(
"hist_EE_RawSC_S1toS9_",
"S1/S9 of Raw Super Clusters in Endcap",
207 = _ibooker.
book1D(
"hist_EB_CorSC_S1toS9_",
"S1/S9 of Corrected SuperClusters in Barrel",
210 = _ibooker.
book1D(
"hist_EE_CorSC_S1toS9_",
"S1/S9 of Corrected SuperClusters in Endcap",
213 = _ibooker.
book1D(
"hist_EE_PreSC_S1toS9_",
"S1/S9 of SuperClusters with Preshower in Endcap",
219 = _ibooker.
book1D(
"hist_EB_RawSC_S25toE_",
"S25/E of Raw Super Clusters in Barrel",
222 = _ibooker.
book1D(
"hist_EE_RawSC_S25toE_",
"S25/E of Raw Super Clusters in Endcap",
225 = _ibooker.
book1D(
"hist_EB_CorSC_S25toE_",
"S25/E of Corrected SuperClusters in Barrel",
228 = _ibooker.
book1D(
"hist_EE_CorSC_S25toE_",
"S25/E of Corrected SuperClusters in Endcap",
231 = _ibooker.
book1D(
"hist_EE_PreSC_S25toE_",
"S25/E of SuperClusters with Preshower in Endcap",
237 = _ibooker.
book1D(
"hist_EB_RawSC_EoverTruth_",
"E/True E of Raw SuperClusters in Barrel",
240 = _ibooker.
book1D(
"hist_EE_RawSC_EoverTruth_",
"E/True E of Raw SuperClusters in Endcap",
243 = _ibooker.
book1D(
"hist_EB_CorSC_EoverTruth_",
"E/True E of Corrected SuperClusters in Barrel",
246 = _ibooker.
book1D(
"hist_EE_CorSC_EoverTruth_",
"E/True E of Corrected SuperClusters in Endcap",
249 = _ibooker.
book1D(
"hist_EE_PreSC_EoverTruth_",
"E/True E of SuperClusters with Preshower in Endcap",
255 = _ibooker.
book1D(
"hist_EB_RawSC_deltaR_",
"dR to MC truth of Raw Super Clusters in Barrel",
258 = _ibooker.
book1D(
"hist_EE_RawSC_deltaR_",
"dR to MC truth of Raw Super Clusters in Endcap",
261 = _ibooker.
book1D(
"hist_EB_CorSC_deltaR_",
"dR to MC truth of Corrected SuperClusters in Barrel",
264 = _ibooker.
book1D(
"hist_EE_CorSC_deltaR_",
"dR to MC truth of Corrected SuperClusters in Endcap",
267 = _ibooker.
book1D(
"hist_EE_PreSC_deltaR_",
"dR to MC truth of SuperClusters with Preshower in Endcap",
272 = _ibooker.
book1D(
"hist_EB_CorSC_phiWidth_",
"phiWidth of Corrected Super Clusters in Barrel",
275 = _ibooker.
book1D(
"hist_EE_CorSC_phiWidth_",
"phiWidth of Corrected Super Clusters in Endcap",
280 = _ibooker.
book1D(
"hist_EB_CorSC_etaWidth_",
"etaWidth of Corrected Super Clusters in Barrel",
283 = _ibooker.
book1D(
"hist_EE_CorSC_etaWidth_",
"etaWidth of Corrected Super Clusters in Endcap",
289 = _ibooker.
book1D(
"hist_EE_PreSC_preshowerE_",
"preshower energy in Super Clusters with Preshower in Endcap",
292 = _ibooker.
book1D(
"hist_EE_CorSC_preshowerE_",
"preshower energy in Corrected Super Clusters with Preshower in Endcap",
298 = _ibooker.
book2D(
"hist_EB_CorSC_ET_vs_Eta_",
"Corr Super Cluster ET versus Eta in Barrel",
303 = _ibooker.
book2D(
"hist_EB_CorSC_ET_vs_Phi_",
"Corr Super Cluster ET versus Phi in Barrel",
308 = _ibooker.
book2D(
"hist_EE_CorSC_ET_vs_Eta_",
"Corr Super Cluster ET versus Eta in Endcap",
313 = _ibooker.
book2D(
"hist_EE_CorSC_ET_vs_Phi_",
"Corr Super Cluster ET versus Phi in Endcap",
318 = _ibooker.
book2D(
"hist_EE_CorSC_ET_vs_R_",
"Corr Super Cluster ET versus Radius in Endcap",
329 bool skipBarrel =
false;
330 bool skipEndcap =
false;
338 edm::LogError(
"EgammaSuperClusters") <<
"Error! can't get MC collection ";
350 if (!pBarrelRawSuperClusters.
isValid()) {
351 edm::LogError(
"EgammaSuperClusters") <<
"Error! can't get collection Raw SC";
357 if (!pBarrelCorSuperClusters.
isValid()) {
358 edm::LogError(
"EgammaSuperClusters") <<
"Error! can't get collection Cor SC";
364 if ( ! pBarrelRecHitCollection.
isValid() ) {
369 if ( ! pEndcapRecHitCollection.
isValid() ) {
373 if( skipBarrel || skipEndcap )
return;
386 for(reco::SuperClusterCollection::const_iterator aClus = barrelRawSuperClusters->begin();
387 aClus != barrelRawSuperClusters->end(); aClus++)
401 double dRClosest = 999.9;
402 double energyClosest = 0;
415 for(reco::SuperClusterCollection::const_iterator aClus = barrelCorSuperClusters->begin();
416 aClus != barrelCorSuperClusters->end(); aClus++)
438 double dRClosest = 999.9;
439 double energyClosest = 0;
456 if (!pEndcapRawSuperClusters.
isValid()) {
457 edm::LogError(
"EgammaSuperClusters") <<
"Error! can't get collection Raw EE SC";
462 if (!pEndcapPreSuperClusters.
isValid()) {
463 edm::LogError(
"EgammaSuperClusters") <<
"Error! can't get collection Pre EE SC";
468 if (!pEndcapCorSuperClusters.
isValid()) {
469 edm::LogError(
"EgammaSuperClusters") <<
"Error! can't get collection Cor EE SC";
483 for(reco::SuperClusterCollection::const_iterator aClus = endcapRawSuperClusters->begin();
484 aClus != endcapRawSuperClusters->end(); aClus++)
496 double dRClosest = 999.9;
497 double energyClosest = 0;
509 for(reco::SuperClusterCollection::const_iterator aClus = endcapPreSuperClusters->begin();
510 aClus != endcapPreSuperClusters->end(); aClus++)
523 double dRClosest = 999.9;
524 double energyClosest = 0;
536 for(reco::SuperClusterCollection::const_iterator aClus = endcapCorSuperClusters->begin();
537 aClus != endcapCorSuperClusters->end(); aClus++)
560 double dRClosest = 999.9;
561 double energyClosest = 0;
579 double &dRClosest,
double &energyClosest)
const 583 double scEta = sc.
eta();
584 double scPhi = sc.
phi();
591 for(HepMC::GenEvent::particle_const_iterator currentParticle = genEvent->particles_begin();
592 currentParticle != genEvent->particles_end(); currentParticle++ )
594 if((*currentParticle)->status() == 1)
597 HepMC::FourVector
vtx = (*currentParticle)->production_vertex()->position();
598 double phiTrue = (*currentParticle)->momentum().phi();
599 double etaTrue =
ecalEta((*currentParticle)->momentum().eta(), vtx.z()/10., vtx.perp()/10.);
602 double dEta = scEta - etaTrue;
605 if(deltaR < dRClosest)
608 energyClosest = (*currentParticle)->momentum().e();
624 const float R_ECAL = 136.5;
628 if(EtaParticle != 0.)
631 float ZEcal = (R_ECAL-plane_Radius)*sinh(EtaParticle)+Zvertex;
633 if(ZEcal != 0.0) Theta = atan(R_ECAL/ZEcal);
634 if(Theta<0.0) Theta = Theta+
Geom::pi() ;
638 if( fabs(ETA) > etaBarrelEndcap )
641 if(EtaParticle<0.0 ) Zend = -Zend ;
642 float Zlen = Zend - Zvertex ;
643 float RR = Zlen/sinh(EtaParticle);
644 Theta = atan((RR+plane_Radius)/Zend);
645 if(Theta<0.0) Theta = Theta+
Geom::pi() ;
646 ETA = -
log(
tan(0.5*Theta));
653 edm::LogWarning(
"") <<
"[EgammaSuperClusters::ecalEta] Warning: Eta equals to zero, not correcting" ;
constexpr double deltaPhi(double phi1, double phi2)
MonitorElement * hist_EE_CorSC_ET_vs_Phi_
MonitorElement * hist_EE_CorSC_ET_vs_R_
MonitorElement * hist_EE_PreSC_ET_
edm::EDGetTokenT< reco::SuperClusterCollection > endcapRawSuperClusterCollectionToken_
MonitorElement * hist_EB_CorSC_ET_
MonitorElement * hist_EB_CorSC_NumBC_
MonitorElement * hist_EE_CorSC_etaWidth_
MonitorElement * hist_EE_PreSC_EoverTruth_
MonitorElement * hist_EE_CorSC_Eta_
MonitorElement * hist_EB_RawSC_Size_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * hist_EE_RawSC_NumBC_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * hist_EB_RawSC_S1toS9_
MonitorElement * hist_EB_RawSC_ET_
MonitorElement * hist_EE_CorSC_EoverTruth_
MonitorElement * hist_EE_CorSC_deltaR_
MonitorElement * hist_EB_RawSC_Phi_
MonitorElement * hist_EE_RawSC_ET_
double eta() const
pseudorapidity of cluster centroid
float ecalEta(float, float, float) const
MonitorElement * hist_EB_CorSC_phiWidth_
MonitorElement * hist_EE_PreSC_S1toS9_
edm::EDGetTokenT< reco::SuperClusterCollection > endcapPreSuperClusterCollectionToken_
MonitorElement * hist_EB_RawSC_Eta_
MonitorElement * hist_EB_CorSC_deltaR_
MonitorElement * hist_EE_RawSC_S1toS9_
MonitorElement * hist_EB_CorSC_S25toE_
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
MonitorElement * hist_EE_CorSC_S1toS9_
edm::EDGetTokenT< EcalRecHitCollection > endcapRecHitCollectionToken_
MonitorElement * hist_EE_RawSC_deltaR_
edm::EDGetTokenT< edm::HepMCProduct > MCTruthCollectionToken_
MonitorElement * hist_EE_PreSC_Phi_
~EgammaSuperClusters() override
MonitorElement * book1D(Args &&...args)
Tan< T >::type tan(const T &t)
MonitorElement * hist_EB_CorSC_ET_vs_Eta_
edm::EDGetTokenT< reco::SuperClusterCollection > barrelRawSuperClusterCollectionToken_
MonitorElement * hist_EB_CorSC_EoverTruth_
MonitorElement * hist_EB_CorSC_etaWidth_
MonitorElement * hist_EE_CorSC_ET_
void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< reco::SuperClusterCollection > endcapCorSuperClusterCollectionToken_
MonitorElement * hist_EE_PreSC_deltaR_
MonitorElement * hist_EE_CorSC_Size_
double deltaR(double eta1, double eta2, double phi1, double phi2)
MonitorElement * hist_EE_PreSC_preshowerE_
MonitorElement * hist_EB_CorSC_Phi_
void setCurrentFolder(const std::string &fullpath)
const HepMC::GenEvent * GetEvent() const
T const * product() const
MonitorElement * hist_EB_CorSC_S1toS9_
MonitorElement * book2D(Args &&...args)
MonitorElement * hist_EB_CorSC_Size_
MonitorElement * hist_EE_CorSC_Phi_
edm::EDGetTokenT< reco::SuperClusterCollection > barrelCorSuperClusterCollectionToken_
MonitorElement * hist_EB_RawSC_EoverTruth_
static const float etaBarrelEndcap
MonitorElement * hist_EE_RawSC_EoverTruth_
EgammaSuperClusters(const edm::ParameterSet &)
static const float Z_Endcap
MonitorElement * hist_EB_RawSC_S25toE_
MonitorElement * hist_EE_PreSC_Eta_
MonitorElement * hist_EB_CorSC_Eta_
MonitorElement * hist_EB_RawSC_NumBC_
MonitorElement * hist_EE_CorSC_preshowerE_
static const float R_ECAL
MonitorElement * hist_EE_RawSC_Size_
MonitorElement * hist_EE_CorSC_NumBC_
MonitorElement * hist_EE_CorSC_S25toE_
double phi() const
azimuthal angle of cluster centroid
MonitorElement * hist_EE_RawSC_S25toE_
edm::EDGetTokenT< EcalRecHitCollection > barrelRecHitCollectionToken_
MonitorElement * hist_EE_CorSC_ET_vs_Eta_
void closestMCParticle(HepMC::GenEvent const *, reco::SuperCluster const &, double &, double &) const
MonitorElement * hist_EE_PreSC_NumBC_
MonitorElement * hist_EE_PreSC_S25toE_
MonitorElement * hist_EE_RawSC_Eta_
MonitorElement * hist_EE_PreSC_Size_
Power< A, B >::type pow(const A &a, const B &b)
MonitorElement * hist_EB_RawSC_deltaR_
MonitorElement * hist_EE_RawSC_Phi_
MonitorElement * hist_EB_CorSC_ET_vs_Phi_
MonitorElement * hist_EE_CorSC_phiWidth_