17 : MCTruthCollectionToken_(consumes<edm::
HepMCProduct>(ps.getParameter<edm::
InputTag>(
"MCTruthCollection"))),
18 barrelRawSuperClusterCollectionToken_(
20 barrelCorSuperClusterCollectionToken_(
22 endcapRawSuperClusterCollectionToken_(
24 endcapPreSuperClusterCollectionToken_(
26 endcapCorSuperClusterCollectionToken_(
28 barrelRecHitCollectionToken_(
30 endcapRecHitCollectionToken_(
32 ecalClusterToolsESGetTokens_{consumesCollector()},
34 hsNumBC_(ps,
"NumBC"),
38 hsS1toS9_(ps,
"S1toS9"),
39 hsS25toE_(ps,
"S25toE"),
40 hsEoverTruth_(ps,
"EoverTruth"),
41 hsdeltaR_(ps,
"deltaR"),
42 hsphiWidth_(ps,
"phiWidth"),
43 hsetaWidth_(ps,
"etaWidth"),
44 hspreshowerE_(ps,
"preshowerE"),
46 hist_EB_RawSC_Size_(
nullptr),
47 hist_EE_RawSC_Size_(
nullptr),
48 hist_EB_CorSC_Size_(
nullptr),
49 hist_EE_CorSC_Size_(
nullptr),
50 hist_EE_PreSC_Size_(
nullptr),
51 hist_EB_RawSC_NumBC_(
nullptr),
52 hist_EE_RawSC_NumBC_(
nullptr),
53 hist_EB_CorSC_NumBC_(
nullptr),
54 hist_EE_CorSC_NumBC_(
nullptr),
55 hist_EE_PreSC_NumBC_(
nullptr),
56 hist_EB_RawSC_ET_(
nullptr),
57 hist_EE_RawSC_ET_(
nullptr),
58 hist_EB_CorSC_ET_(
nullptr),
59 hist_EE_CorSC_ET_(
nullptr),
60 hist_EE_PreSC_ET_(
nullptr),
61 hist_EB_RawSC_Eta_(
nullptr),
62 hist_EE_RawSC_Eta_(
nullptr),
63 hist_EB_CorSC_Eta_(
nullptr),
64 hist_EE_CorSC_Eta_(
nullptr),
65 hist_EE_PreSC_Eta_(
nullptr),
66 hist_EB_RawSC_Phi_(
nullptr),
67 hist_EE_RawSC_Phi_(
nullptr),
68 hist_EB_CorSC_Phi_(
nullptr),
69 hist_EE_CorSC_Phi_(
nullptr),
70 hist_EE_PreSC_Phi_(
nullptr),
71 hist_EB_RawSC_S1toS9_(
nullptr),
72 hist_EE_RawSC_S1toS9_(
nullptr),
73 hist_EB_CorSC_S1toS9_(
nullptr),
74 hist_EE_CorSC_S1toS9_(
nullptr),
75 hist_EE_PreSC_S1toS9_(
nullptr),
76 hist_EB_RawSC_S25toE_(
nullptr),
77 hist_EE_RawSC_S25toE_(
nullptr),
78 hist_EB_CorSC_S25toE_(
nullptr),
79 hist_EE_CorSC_S25toE_(
nullptr),
80 hist_EE_PreSC_S25toE_(
nullptr),
81 hist_EB_RawSC_EoverTruth_(
nullptr),
82 hist_EE_RawSC_EoverTruth_(
nullptr),
83 hist_EB_CorSC_EoverTruth_(
nullptr),
84 hist_EE_CorSC_EoverTruth_(
nullptr),
85 hist_EE_PreSC_EoverTruth_(
nullptr),
86 hist_EB_RawSC_deltaR_(
nullptr),
87 hist_EE_RawSC_deltaR_(
nullptr),
88 hist_EB_CorSC_deltaR_(
nullptr),
89 hist_EE_CorSC_deltaR_(
nullptr),
90 hist_EE_PreSC_deltaR_(
nullptr),
91 hist_EE_PreSC_preshowerE_(
nullptr),
92 hist_EE_CorSC_preshowerE_(
nullptr),
93 hist_EE_CorSC_phiWidth_(
nullptr),
94 hist_EB_CorSC_phiWidth_(
nullptr),
95 hist_EE_CorSC_etaWidth_(
nullptr),
96 hist_EB_CorSC_etaWidth_(
nullptr),
97 hist_EB_CorSC_ET_vs_Eta_(
nullptr),
98 hist_EB_CorSC_ET_vs_Phi_(
nullptr),
99 hist_EE_CorSC_ET_vs_Eta_(
nullptr),
100 hist_EE_CorSC_ET_vs_Phi_(
nullptr),
101 hist_EE_CorSC_ET_vs_R_(
nullptr) {}
124 "# of Basic Clusters in Raw Super Clusters in Barrel",
129 "# of Basic Clusters in Raw Super Clusters in Endcap",
134 "# of Basic Clusters in Corrected SuperClusters in Barrel",
139 "# of Basic Clusters in Corrected SuperClusters in Endcap",
144 "# of Basic Clusters in SuperClusters with Preshower in Endcap",
195 "S1/S9 of Corrected SuperClusters in Barrel",
200 "S1/S9 of Corrected SuperClusters in Endcap",
205 "S1/S9 of SuperClusters with Preshower in Endcap",
217 "S25/E of Corrected SuperClusters in Barrel",
222 "S25/E of Corrected SuperClusters in Endcap",
227 "S25/E of SuperClusters with Preshower in Endcap",
235 "E/True E of Raw SuperClusters in Barrel",
240 "E/True E of Raw SuperClusters in Endcap",
245 "E/True E of Corrected SuperClusters in Barrel",
250 "E/True E of Corrected SuperClusters in Endcap",
255 "E/True E of SuperClusters with Preshower in Endcap",
263 "dR to MC truth of Raw Super Clusters in Barrel",
268 "dR to MC truth of Raw Super Clusters in Endcap",
273 "dR to MC truth of Corrected SuperClusters in Barrel",
278 "dR to MC truth of Corrected SuperClusters in Endcap",
283 "dR to MC truth of SuperClusters with Preshower in Endcap",
290 "phiWidth of Corrected Super Clusters in Barrel",
295 "phiWidth of Corrected Super Clusters in Endcap",
302 "etaWidth of Corrected Super Clusters in Barrel",
307 "etaWidth of Corrected Super Clusters in Endcap",
314 "preshower energy in Super Clusters with Preshower in Endcap",
319 "preshower energy in Corrected Super Clusters with Preshower in Endcap",
326 "Corr Super Cluster ET versus Eta in Barrel",
335 "Corr Super Cluster ET versus Phi in Barrel",
344 "Corr Super Cluster ET versus Eta in Endcap",
353 "Corr Super Cluster ET versus Phi in Endcap",
362 "Corr Super Cluster ET versus Radius in Endcap",
373 bool skipBarrel =
false;
374 bool skipEndcap =
false;
382 edm::LogError(
"EgammaSuperClusters") <<
"Error! can't get MC collection ";
395 if (!pBarrelRawSuperClusters.
isValid()) {
396 edm::LogError(
"EgammaSuperClusters") <<
"Error! can't get collection Raw SC";
402 if (!pBarrelCorSuperClusters.
isValid()) {
403 edm::LogError(
"EgammaSuperClusters") <<
"Error! can't get collection Cor SC";
409 if (!pBarrelRecHitCollection.
isValid()) {
414 if (!pEndcapRecHitCollection.
isValid()) {
418 if (skipBarrel || skipEndcap)
433 for (reco::SuperClusterCollection::const_iterator aClus = barrelRawSuperClusters->begin();
434 aClus != barrelRawSuperClusters->end();
448 double dRClosest = 999.9;
449 double energyClosest = 0;
452 if (dRClosest < 0.1) {
459 for (reco::SuperClusterCollection::const_iterator aClus = barrelCorSuperClusters->begin();
460 aClus != barrelCorSuperClusters->end();
481 double dRClosest = 999.9;
482 double energyClosest = 0;
485 if (dRClosest < 0.1) {
496 if (!pEndcapRawSuperClusters.
isValid()) {
497 edm::LogError(
"EgammaSuperClusters") <<
"Error! can't get collection Raw EE SC";
502 if (!pEndcapPreSuperClusters.
isValid()) {
503 edm::LogError(
"EgammaSuperClusters") <<
"Error! can't get collection Pre EE SC";
508 if (!pEndcapCorSuperClusters.
isValid()) {
509 edm::LogError(
"EgammaSuperClusters") <<
"Error! can't get collection Cor EE SC";
523 for (reco::SuperClusterCollection::const_iterator aClus = endcapRawSuperClusters->begin();
524 aClus != endcapRawSuperClusters->end();
536 double dRClosest = 999.9;
537 double energyClosest = 0;
540 if (dRClosest < 0.1) {
547 for (reco::SuperClusterCollection::const_iterator aClus = endcapPreSuperClusters->begin();
548 aClus != endcapPreSuperClusters->end();
561 double dRClosest = 999.9;
562 double energyClosest = 0;
565 if (dRClosest < 0.1) {
572 for (reco::SuperClusterCollection::const_iterator aClus = endcapCorSuperClusters->begin();
573 aClus != endcapCorSuperClusters->end();
595 double dRClosest = 999.9;
596 double energyClosest = 0;
599 if (dRClosest < 0.1) {
612 double &energyClosest)
const {
614 double scEta = sc.
eta();
615 double scPhi = sc.
phi();
622 for (HepMC::GenEvent::particle_const_iterator currentParticle = genEvent->particles_begin();
623 currentParticle != genEvent->particles_end();
625 if ((*currentParticle)->status() == 1) {
627 HepMC::FourVector vtx = (*currentParticle)->production_vertex()->position();
628 double phiTrue = (*currentParticle)->momentum().phi();
629 double etaTrue =
ecalEta((*currentParticle)->momentum().eta(), vtx.z() / 10., vtx.perp() / 10.);
632 double dEta = scEta - etaTrue;
635 if (deltaR < dRClosest) {
637 energyClosest = (*currentParticle)->momentum().e();
649 const float R_ECAL = 136.5;
653 if (EtaParticle != 0.) {
655 float ZEcal = (R_ECAL - plane_Radius) * sinh(EtaParticle) + Zvertex;
658 Theta = atan(R_ECAL / ZEcal);
664 if (fabs(ETA) > etaBarrelEndcap) {
666 if (EtaParticle < 0.0)
668 float Zlen = Zend - Zvertex;
669 float RR = Zlen / sinh(EtaParticle);
670 Theta = atan((RR + plane_Radius) / Zend);
673 ETA = -
log(
tan(0.5 * Theta));
678 edm::LogWarning(
"") <<
"[EgammaSuperClusters::ecalEta] Warning: Eta equals "
679 "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_
static std::vector< std::string > checklist log
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_
virtual void setCurrentFolder(std::string const &fullpath)
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_
Log< level::Error, false > LogError
static constexpr float R_ECAL
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
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_
static constexpr float etaBarrelEndcap
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_
MonitorElement * hist_EE_PreSC_preshowerE_
MonitorElement * hist_EB_CorSC_Phi_
T const * product() const
MonitorElement * hist_EB_CorSC_S1toS9_
MonitorElement * hist_EB_CorSC_Size_
MonitorElement * hist_EE_CorSC_Phi_
edm::EDGetTokenT< reco::SuperClusterCollection > barrelCorSuperClusterCollectionToken_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * hist_EB_RawSC_EoverTruth_
MonitorElement * hist_EE_RawSC_EoverTruth_
EgammaSuperClusters(const edm::ParameterSet &)
MonitorElement * hist_EB_RawSC_S25toE_
MonitorElement * hist_EE_PreSC_Eta_
MonitorElement * hist_EB_CorSC_Eta_
EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
MonitorElement * hist_EB_RawSC_NumBC_
MonitorElement * hist_EE_CorSC_preshowerE_
static constexpr float ZEcal
MonitorElement * hist_EE_RawSC_Size_
MonitorElement * hist_EE_CorSC_NumBC_
MonitorElement * hist_EE_CorSC_S25toE_
Log< level::Warning, false > LogWarning
double phi() const
azimuthal angle of cluster centroid
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
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_
static constexpr float Z_Endcap
MonitorElement * hist_EB_CorSC_ET_vs_Phi_
MonitorElement * hist_EE_CorSC_phiWidth_