CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaBasicClusters.cc
Go to the documentation of this file.
2 
6 
9 
11 {
12  outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "");
13  //CMSSW_Version_ = ps.getUntrackedParameter<std::string>("CMSSW_Version", "");
14 
15  verboseDBE_ = ps.getUntrackedParameter<bool>("verboseDBE", false);
16 
17  hist_min_Size_ = ps.getParameter<double>("hist_min_Size");
18  hist_max_Size_ = ps.getParameter<double>("hist_max_Size");
19  hist_bins_Size_ = ps.getParameter<int> ("hist_bins_Size");
20 
21  hist_min_NumRecHits_ = ps.getParameter<double>("hist_min_NumRecHits");
22  hist_max_NumRecHits_ = ps.getParameter<double>("hist_max_NumRecHits");
23  hist_bins_NumRecHits_ = ps.getParameter<int> ("hist_bins_NumRecHits");
24 
25  hist_min_ET_ = ps.getParameter<double>("hist_min_ET");
26  hist_max_ET_ = ps.getParameter<double>("hist_max_ET");
27  hist_bins_ET_ = ps.getParameter<int> ("hist_bins_ET");
28 
29  hist_min_Eta_ = ps.getParameter<double>("hist_min_Eta");
30  hist_max_Eta_ = ps.getParameter<double>("hist_max_Eta");
31  hist_bins_Eta_ = ps.getParameter<int> ("hist_bins_Eta");
32 
33  hist_min_Phi_ = ps.getParameter<double>("hist_min_Phi");
34  hist_max_Phi_ = ps.getParameter<double>("hist_max_Phi");
35  hist_bins_Phi_ = ps.getParameter<int> ("hist_bins_Phi");
36 
37  hist_min_R_ = ps.getParameter<double>("hist_min_R");
38  hist_max_R_ = ps.getParameter<double>("hist_max_R");
39  hist_bins_R_ = ps.getParameter<int> ("hist_bins_R");
40 
41  barrelBasicClusterCollection_ = consumes<reco::BasicClusterCollection>(ps.getParameter<edm::InputTag>("barrelBasicClusterCollection"));
42  endcapBasicClusterCollection_ = consumes<reco::BasicClusterCollection>(ps.getParameter<edm::InputTag>("endcapBasicClusterCollection"));
43 }
44 
46 
48 {
50 
51  if ( verboseDBE_ )
52  {
53  dbe_->setVerbose(1);
55  }
56  else
57  dbe_->setVerbose(0);
58 
59  //dbe_->setCurrentFolder("Ecal/CMSSW_"+CMSSW_Version_+"/EcalClusters/BasicClusters/");
60  dbe_->setCurrentFolder("EcalClusterV/EcalBasicClusters/");
61 
63  = dbe_->book1D("hist_EB_BC_Size_","# Basic Clusters in Barrel",
66  = dbe_->book1D("hist_EE_BC_Size_","# Basic Clusters in Endcap",
68 
70  = dbe_->book1D("hist_EB_BC_NumRecHits_","# of RecHits in Basic Clusters in Barrel",
73  = dbe_->book1D("hist_EE_BC_NumRecHits_","# of RecHits in Basic Clusters in Endcap",
75 
77  = dbe_->book1D("hist_EB_BC_ET_","ET of Basic Clusters in Barrel",
80  = dbe_->book1D("hist_EE_BC_ET_","ET of Basic Clusters in Endcap",
82 
84  = dbe_->book1D("hist_EB_BC_Eta_","Eta of Basic Clusters in Barrel",
87  = dbe_->book1D("hist_EE_BC_Eta_","Eta of Basic Clusters in Endcap",
89 
91  = dbe_->book1D("hist_EB_BC_Phi_","Phi of Basic Clusters in Barrel",
94  = dbe_->book1D("hist_EE_BC_Phi_","Phi of Basic Clusters in Endcap",
96 
97 
98  hist_EB_BC_ET_vs_Eta_ = dbe_->book2D( "hist_EB_BC_ET_vs_Eta_", "Basic Cluster ET versus Eta in Barrel",
101 
102  hist_EB_BC_ET_vs_Phi_ = dbe_->book2D( "hist_EB_BC_ET_vs_Phi_", "Basic Cluster ET versus Phi in Barrel",
105 
106  hist_EE_BC_ET_vs_Eta_ = dbe_->book2D( "hist_EE_BC_ET_vs_Eta_", "Basic Cluster ET versus Eta in Endcap",
109 
110  hist_EE_BC_ET_vs_Phi_ = dbe_->book2D( "hist_EE_BC_ET_vs_Phi_", "Basic Cluster ET versus Phi in Endcap",
113 
114  hist_EE_BC_ET_vs_R_ = dbe_->book2D( "hist_EE_BC_ET_vs_R_", "Basic Cluster ET versus Radius in Endcap",
117 
118 
119 
120 }
121 
123 {
124  edm::Handle<reco::BasicClusterCollection> pBarrelBasicClusters;
125  evt.getByToken(barrelBasicClusterCollection_, pBarrelBasicClusters);
126  if (!pBarrelBasicClusters.isValid()) {
127 
128  Labels l;
130  edm::LogError("EgammaBasicClusters") << "Error! can't get collection with label "
131  << l.module;
132  }
133 
134  const reco::BasicClusterCollection* barrelBasicClusters = pBarrelBasicClusters.product();
135  hist_EB_BC_Size_->Fill(barrelBasicClusters->size());
136 
137  for(reco::BasicClusterCollection::const_iterator aClus = barrelBasicClusters->begin();
138  aClus != barrelBasicClusters->end(); aClus++)
139  {
140  hist_EB_BC_NumRecHits_->Fill(aClus->size());
141  hist_EB_BC_ET_->Fill(aClus->energy()/std::cosh(aClus->position().eta()));
142  hist_EB_BC_Eta_->Fill(aClus->position().eta());
143  hist_EB_BC_Phi_->Fill(aClus->position().phi());
144 
145  hist_EB_BC_ET_vs_Eta_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->eta() );
146  hist_EB_BC_ET_vs_Phi_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->phi() );
147  }
148 
149  edm::Handle<reco::BasicClusterCollection> pEndcapBasicClusters;
150 
151  evt.getByToken(endcapBasicClusterCollection_, pEndcapBasicClusters);
152  if (!pEndcapBasicClusters.isValid()) {
153 
154  Labels l;
156  edm::LogError("EgammaBasicClusters") << "Error! can't get collection with label "
157  << l.module;
158  }
159 
160  const reco::BasicClusterCollection* endcapBasicClusters = pEndcapBasicClusters.product();
161  hist_EE_BC_Size_->Fill(endcapBasicClusters->size());
162 
163  for(reco::BasicClusterCollection::const_iterator aClus = endcapBasicClusters->begin();
164  aClus != endcapBasicClusters->end(); aClus++)
165  {
166  hist_EE_BC_NumRecHits_->Fill(aClus->size());
167  hist_EE_BC_ET_->Fill(aClus->energy()/std::cosh(aClus->position().eta()));
168  hist_EE_BC_Eta_->Fill(aClus->position().eta());
169  hist_EE_BC_Phi_->Fill(aClus->position().phi());
170 
171  hist_EE_BC_ET_vs_Eta_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->eta() );
172  hist_EE_BC_ET_vs_Phi_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->phi() );
173  hist_EE_BC_ET_vs_R_->Fill( aClus->energy()/std::cosh(aClus->position().eta()),
174  std::sqrt( std::pow(aClus->x(),2) + std::pow(aClus->y(),2) ) );
175 
176  }
177 }
178 
180 {
181  if (outputFile_.size() != 0 && dbe_) dbe_->save(outputFile_);
182 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * hist_EE_BC_NumRecHits_
MonitorElement * hist_EB_BC_Eta_
MonitorElement * hist_EE_BC_ET_vs_R_
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:971
MonitorElement * hist_EE_BC_Phi_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
MonitorElement * hist_EB_BC_NumRecHits_
MonitorElement * hist_EE_BC_ET_vs_Phi_
MonitorElement * hist_EB_BC_ET_
MonitorElement * hist_EB_BC_ET_vs_Eta_
MonitorElement * hist_EE_BC_ET_vs_Eta_
void Fill(long long x)
MonitorElement * hist_EB_BC_ET_vs_Phi_
MonitorElement * hist_EE_BC_Eta_
T sqrt(T t)
Definition: SSEVec.h:48
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void setVerbose(unsigned level)
Definition: DQMStore.cc:648
bool isValid() const
Definition: HandleBase.h:76
EgammaBasicClusters(const edm::ParameterSet &)
MonitorElement * hist_EB_BC_Phi_
edm::EDGetTokenT< reco::BasicClusterCollection > barrelBasicClusterCollection_
T const * product() const
Definition: Handle.h:81
MonitorElement * hist_EE_BC_ET_
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
MonitorElement * hist_EB_BC_Size_
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2562
void showDirStructure(void) const
Definition: DQMStore.cc:3355
MonitorElement * hist_EE_BC_Size_
edm::EDGetTokenT< reco::BasicClusterCollection > endcapBasicClusterCollection_
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1099
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:684