Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:32:20

0001 #include "Validation/EcalClusters/interface/EgammaBasicClusters.h"
0002 
0003 #include "FWCore/Framework/interface/Event.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 
0006 #include "DataFormats/Common/interface/Handle.h"
0007 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
0008 
0009 #include "DQMServices/Core/interface/DQMStore.h"
0010 
0011 #include "FWCore/Framework/interface/MakerMacros.h"
0012 
0013 EgammaBasicClusters::EgammaBasicClusters(const edm::ParameterSet &ps)
0014     : barrelBasicClusterCollection_(
0015           consumes<reco::BasicClusterCollection>(ps.getParameter<edm::InputTag>("barrelBasicClusterCollection"))),
0016       endcapBasicClusterCollection_(
0017           consumes<reco::BasicClusterCollection>(ps.getParameter<edm::InputTag>("endcapBasicClusterCollection"))),
0018       hsSize_(ps, "Size"),
0019       hsNumRecHits_(ps, "NumRecHits"),
0020       hsET_(ps, "ET"),
0021       hsEta_(ps, "Eta"),
0022       hsPhi_(ps, "Phi"),
0023       hsR_(ps, "R"),
0024       hist_EB_BC_Size_(nullptr),
0025       hist_EE_BC_Size_(nullptr),
0026       hist_EB_BC_NumRecHits_(nullptr),
0027       hist_EE_BC_NumRecHits_(nullptr),
0028       hist_EB_BC_ET_(nullptr),
0029       hist_EE_BC_ET_(nullptr),
0030       hist_EB_BC_Eta_(nullptr),
0031       hist_EE_BC_Eta_(nullptr),
0032       hist_EB_BC_Phi_(nullptr),
0033       hist_EE_BC_Phi_(nullptr),
0034       hist_EB_BC_ET_vs_Eta_(nullptr),
0035       hist_EB_BC_ET_vs_Phi_(nullptr),
0036       hist_EE_BC_ET_vs_Eta_(nullptr),
0037       hist_EE_BC_ET_vs_Phi_(nullptr),
0038       hist_EE_BC_ET_vs_R_(nullptr) {}
0039 
0040 EgammaBasicClusters::~EgammaBasicClusters() {}
0041 
0042 void EgammaBasicClusters::bookHistograms(DQMStore::IBooker &_ibooker, edm::Run const &, edm::EventSetup const &) {
0043   _ibooker.setCurrentFolder("EcalClusterV/EcalBasicClusters/");
0044 
0045   hist_EB_BC_Size_ =
0046       _ibooker.book1D("hist_EB_BC_Size_", "# Basic Clusters in Barrel", hsSize_.bins, hsSize_.min, hsSize_.max);
0047   hist_EE_BC_Size_ =
0048       _ibooker.book1D("hist_EE_BC_Size_", "# Basic Clusters in Endcap", hsSize_.bins, hsSize_.min, hsSize_.max);
0049 
0050   hist_EB_BC_NumRecHits_ = _ibooker.book1D("hist_EB_BC_NumRecHits_",
0051                                            "# of RecHits in Basic Clusters in Barrel",
0052                                            hsNumRecHits_.bins,
0053                                            hsNumRecHits_.min,
0054                                            hsNumRecHits_.max);
0055   hist_EE_BC_NumRecHits_ = _ibooker.book1D("hist_EE_BC_NumRecHits_",
0056                                            "# of RecHits in Basic Clusters in Endcap",
0057                                            hsNumRecHits_.bins,
0058                                            hsNumRecHits_.min,
0059                                            hsNumRecHits_.max);
0060 
0061   hist_EB_BC_ET_ =
0062       _ibooker.book1D("hist_EB_BC_ET_", "ET of Basic Clusters in Barrel", hsET_.bins, hsET_.min, hsET_.max);
0063   hist_EE_BC_ET_ =
0064       _ibooker.book1D("hist_EE_BC_ET_", "ET of Basic Clusters in Endcap", hsET_.bins, hsET_.min, hsET_.max);
0065 
0066   hist_EB_BC_Eta_ =
0067       _ibooker.book1D("hist_EB_BC_Eta_", "Eta of Basic Clusters in Barrel", hsEta_.bins, hsEta_.min, hsEta_.max);
0068   hist_EE_BC_Eta_ =
0069       _ibooker.book1D("hist_EE_BC_Eta_", "Eta of Basic Clusters in Endcap", hsEta_.bins, hsEta_.min, hsEta_.max);
0070 
0071   hist_EB_BC_Phi_ =
0072       _ibooker.book1D("hist_EB_BC_Phi_", "Phi of Basic Clusters in Barrel", hsPhi_.bins, hsPhi_.min, hsPhi_.max);
0073   hist_EE_BC_Phi_ =
0074       _ibooker.book1D("hist_EE_BC_Phi_", "Phi of Basic Clusters in Endcap", hsPhi_.bins, hsPhi_.min, hsPhi_.max);
0075 
0076   hist_EB_BC_ET_vs_Eta_ = _ibooker.book2D("hist_EB_BC_ET_vs_Eta_",
0077                                           "Basic Cluster ET versus Eta in Barrel",
0078                                           hsET_.bins,
0079                                           hsET_.min,
0080                                           hsET_.max,
0081                                           hsEta_.bins,
0082                                           hsEta_.min,
0083                                           hsEta_.max);
0084 
0085   hist_EB_BC_ET_vs_Phi_ = _ibooker.book2D("hist_EB_BC_ET_vs_Phi_",
0086                                           "Basic Cluster ET versus Phi in Barrel",
0087                                           hsET_.bins,
0088                                           hsET_.min,
0089                                           hsET_.max,
0090                                           hsPhi_.bins,
0091                                           hsPhi_.min,
0092                                           hsPhi_.max);
0093 
0094   hist_EE_BC_ET_vs_Eta_ = _ibooker.book2D("hist_EE_BC_ET_vs_Eta_",
0095                                           "Basic Cluster ET versus Eta in Endcap",
0096                                           hsET_.bins,
0097                                           hsET_.min,
0098                                           hsET_.max,
0099                                           hsEta_.bins,
0100                                           hsEta_.min,
0101                                           hsEta_.max);
0102 
0103   hist_EE_BC_ET_vs_Phi_ = _ibooker.book2D("hist_EE_BC_ET_vs_Phi_",
0104                                           "Basic Cluster ET versus Phi in Endcap",
0105                                           hsET_.bins,
0106                                           hsET_.min,
0107                                           hsET_.max,
0108                                           hsPhi_.bins,
0109                                           hsPhi_.min,
0110                                           hsPhi_.max);
0111 
0112   hist_EE_BC_ET_vs_R_ = _ibooker.book2D("hist_EE_BC_ET_vs_R_",
0113                                         "Basic Cluster ET versus Radius in Endcap",
0114                                         hsET_.bins,
0115                                         hsET_.min,
0116                                         hsET_.max,
0117                                         hsR_.bins,
0118                                         hsR_.min,
0119                                         hsR_.max);
0120 }
0121 
0122 void EgammaBasicClusters::analyze(const edm::Event &evt, const edm::EventSetup &) {
0123   edm::Handle<reco::BasicClusterCollection> pBarrelBasicClusters;
0124   evt.getByToken(barrelBasicClusterCollection_, pBarrelBasicClusters);
0125   if (!pBarrelBasicClusters.isValid()) {
0126     Labels l;
0127     labelsForToken(barrelBasicClusterCollection_, l);
0128     edm::LogError("EgammaBasicClusters") << "Error! can't get collection with label " << l.module;
0129   }
0130 
0131   const reco::BasicClusterCollection *barrelBasicClusters = pBarrelBasicClusters.product();
0132   hist_EB_BC_Size_->Fill(barrelBasicClusters->size());
0133 
0134   for (reco::BasicClusterCollection::const_iterator aClus = barrelBasicClusters->begin();
0135        aClus != barrelBasicClusters->end();
0136        aClus++) {
0137     hist_EB_BC_NumRecHits_->Fill(aClus->size());
0138     hist_EB_BC_ET_->Fill(aClus->energy() / std::cosh(aClus->position().eta()));
0139     hist_EB_BC_Eta_->Fill(aClus->position().eta());
0140     hist_EB_BC_Phi_->Fill(aClus->position().phi());
0141 
0142     hist_EB_BC_ET_vs_Eta_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), aClus->eta());
0143     hist_EB_BC_ET_vs_Phi_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), aClus->phi());
0144   }
0145 
0146   edm::Handle<reco::BasicClusterCollection> pEndcapBasicClusters;
0147 
0148   evt.getByToken(endcapBasicClusterCollection_, pEndcapBasicClusters);
0149   if (!pEndcapBasicClusters.isValid()) {
0150     Labels l;
0151     labelsForToken(endcapBasicClusterCollection_, l);
0152     edm::LogError("EgammaBasicClusters") << "Error! can't get collection with label " << l.module;
0153   }
0154 
0155   const reco::BasicClusterCollection *endcapBasicClusters = pEndcapBasicClusters.product();
0156   hist_EE_BC_Size_->Fill(endcapBasicClusters->size());
0157 
0158   for (reco::BasicClusterCollection::const_iterator aClus = endcapBasicClusters->begin();
0159        aClus != endcapBasicClusters->end();
0160        aClus++) {
0161     hist_EE_BC_NumRecHits_->Fill(aClus->size());
0162     hist_EE_BC_ET_->Fill(aClus->energy() / std::cosh(aClus->position().eta()));
0163     hist_EE_BC_Eta_->Fill(aClus->position().eta());
0164     hist_EE_BC_Phi_->Fill(aClus->position().phi());
0165 
0166     hist_EE_BC_ET_vs_Eta_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), aClus->eta());
0167     hist_EE_BC_ET_vs_Phi_->Fill(aClus->energy() / std::cosh(aClus->position().eta()), aClus->phi());
0168     hist_EE_BC_ET_vs_R_->Fill(aClus->energy() / std::cosh(aClus->position().eta()),
0169                               std::sqrt(std::pow(aClus->x(), 2) + std::pow(aClus->y(), 2)));
0170   }
0171 }