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 
11 
13 {
14  outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "");
15  //CMSSW_Version_ = ps.getUntrackedParameter<std::string>("CMSSW_Version", "");
16 
17  verboseDBE_ = ps.getUntrackedParameter<bool>("verboseDBE", false);
18 
19  hist_min_Size_ = ps.getParameter<double>("hist_min_Size");
20  hist_max_Size_ = ps.getParameter<double>("hist_max_Size");
21  hist_bins_Size_ = ps.getParameter<int> ("hist_bins_Size");
22 
23  hist_min_NumRecHits_ = ps.getParameter<double>("hist_min_NumRecHits");
24  hist_max_NumRecHits_ = ps.getParameter<double>("hist_max_NumRecHits");
25  hist_bins_NumRecHits_ = ps.getParameter<int> ("hist_bins_NumRecHits");
26 
27  hist_min_ET_ = ps.getParameter<double>("hist_min_ET");
28  hist_max_ET_ = ps.getParameter<double>("hist_max_ET");
29  hist_bins_ET_ = ps.getParameter<int> ("hist_bins_ET");
30 
31  hist_min_Eta_ = ps.getParameter<double>("hist_min_Eta");
32  hist_max_Eta_ = ps.getParameter<double>("hist_max_Eta");
33  hist_bins_Eta_ = ps.getParameter<int> ("hist_bins_Eta");
34 
35  hist_min_Phi_ = ps.getParameter<double>("hist_min_Phi");
36  hist_max_Phi_ = ps.getParameter<double>("hist_max_Phi");
37  hist_bins_Phi_ = ps.getParameter<int> ("hist_bins_Phi");
38 
39  hist_min_R_ = ps.getParameter<double>("hist_min_R");
40  hist_max_R_ = ps.getParameter<double>("hist_max_R");
41  hist_bins_R_ = ps.getParameter<int> ("hist_bins_R");
42 
43  barrelBasicClusterCollection_ = ps.getParameter<edm::InputTag>("barrelBasicClusterCollection");
44  endcapBasicClusterCollection_ = ps.getParameter<edm::InputTag>("endcapBasicClusterCollection");
45 }
46 
48 
50 {
52 
53  if ( verboseDBE_ )
54  {
55  dbe_->setVerbose(1);
57  }
58  else
59  dbe_->setVerbose(0);
60 
61  //dbe_->setCurrentFolder("Ecal/CMSSW_"+CMSSW_Version_+"/EcalClusters/BasicClusters/");
62  dbe_->setCurrentFolder("EcalClusterV/EcalBasicClusters/");
63 
65  = dbe_->book1D("hist_EB_BC_Size_","# Basic Clusters in Barrel",
68  = dbe_->book1D("hist_EE_BC_Size_","# Basic Clusters in Endcap",
70 
72  = dbe_->book1D("hist_EB_BC_NumRecHits_","# of RecHits in Basic Clusters in Barrel",
75  = dbe_->book1D("hist_EE_BC_NumRecHits_","# of RecHits in Basic Clusters in Endcap",
77 
79  = dbe_->book1D("hist_EB_BC_ET_","ET of Basic Clusters in Barrel",
82  = dbe_->book1D("hist_EE_BC_ET_","ET of Basic Clusters in Endcap",
84 
86  = dbe_->book1D("hist_EB_BC_Eta_","Eta of Basic Clusters in Barrel",
89  = dbe_->book1D("hist_EE_BC_Eta_","Eta of Basic Clusters in Endcap",
91 
93  = dbe_->book1D("hist_EB_BC_Phi_","Phi of Basic Clusters in Barrel",
96  = dbe_->book1D("hist_EE_BC_Phi_","Phi of Basic Clusters in Endcap",
98 
99 
100  hist_EB_BC_ET_vs_Eta_ = dbe_->book2D( "hist_EB_BC_ET_vs_Eta_", "Basic Cluster ET versus Eta in Barrel",
103 
104  hist_EB_BC_ET_vs_Phi_ = dbe_->book2D( "hist_EB_BC_ET_vs_Phi_", "Basic Cluster ET versus Phi in Barrel",
107 
108  hist_EE_BC_ET_vs_Eta_ = dbe_->book2D( "hist_EE_BC_ET_vs_Eta_", "Basic Cluster ET versus Eta in Endcap",
111 
112  hist_EE_BC_ET_vs_Phi_ = dbe_->book2D( "hist_EE_BC_ET_vs_Phi_", "Basic Cluster ET versus Phi in Endcap",
115 
116  hist_EE_BC_ET_vs_R_ = dbe_->book2D( "hist_EE_BC_ET_vs_R_", "Basic Cluster ET versus Radius in Endcap",
119 
120 
121 
122 }
123 
125 {
126  edm::Handle<reco::BasicClusterCollection> pBarrelBasicClusters;
127  evt.getByLabel(barrelBasicClusterCollection_, pBarrelBasicClusters);
128  if (!pBarrelBasicClusters.isValid()) {
129  edm::LogError("EgammaBasicClusters") << "Error! can't get collection with label "
131  }
132 
133  const reco::BasicClusterCollection* barrelBasicClusters = pBarrelBasicClusters.product();
134  hist_EB_BC_Size_->Fill(barrelBasicClusters->size());
135 
136  for(reco::BasicClusterCollection::const_iterator aClus = barrelBasicClusters->begin();
137  aClus != barrelBasicClusters->end(); aClus++)
138  {
139  hist_EB_BC_NumRecHits_->Fill(aClus->size());
140  hist_EB_BC_ET_->Fill(aClus->energy()/std::cosh(aClus->position().eta()));
141  hist_EB_BC_Eta_->Fill(aClus->position().eta());
142  hist_EB_BC_Phi_->Fill(aClus->position().phi());
143 
144  hist_EB_BC_ET_vs_Eta_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->eta() );
145  hist_EB_BC_ET_vs_Phi_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->phi() );
146  }
147 
148  edm::Handle<reco::BasicClusterCollection> pEndcapBasicClusters;
149 
150  evt.getByLabel(endcapBasicClusterCollection_, pEndcapBasicClusters);
151  if (!pEndcapBasicClusters.isValid()) {
152  edm::LogError("EgammaBasicClusters") << "Error! can't get collection with label "
154  }
155 
156  const reco::BasicClusterCollection* endcapBasicClusters = pEndcapBasicClusters.product();
157  hist_EE_BC_Size_->Fill(endcapBasicClusters->size());
158 
159  for(reco::BasicClusterCollection::const_iterator aClus = endcapBasicClusters->begin();
160  aClus != endcapBasicClusters->end(); aClus++)
161  {
162  hist_EE_BC_NumRecHits_->Fill(aClus->size());
163  hist_EE_BC_ET_->Fill(aClus->energy()/std::cosh(aClus->position().eta()));
164  hist_EE_BC_Eta_->Fill(aClus->position().eta());
165  hist_EE_BC_Phi_->Fill(aClus->position().phi());
166 
167  hist_EE_BC_ET_vs_Eta_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->eta() );
168  hist_EE_BC_ET_vs_Phi_->Fill( aClus->energy()/std::cosh(aClus->position().eta()), aClus->phi() );
169  hist_EE_BC_ET_vs_R_->Fill( aClus->energy()/std::cosh(aClus->position().eta()),
170  std::sqrt( std::pow(aClus->x(),2) + std::pow(aClus->y(),2) ) );
171 
172  }
173 }
174 
176 {
177  if (outputFile_.size() != 0 && dbe_) dbe_->save(outputFile_);
178 }
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:872
MonitorElement * hist_EE_BC_Phi_
edm::InputTag endcapBasicClusterCollection_
MonitorElement * hist_EB_BC_NumRecHits_
edm::InputTag barrelBasicClusterCollection_
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
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2296
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void setVerbose(unsigned level)
Definition: DQMStore.cc:548
bool isValid() const
Definition: HandleBase.h:76
EgammaBasicClusters(const edm::ParameterSet &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
MonitorElement * hist_EB_BC_Phi_
MonitorElement * hist_EE_BC_ET_
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
T const * product() const
Definition: Handle.h:81
std::string const & label() const
Definition: InputTag.h:42
MonitorElement * hist_EB_BC_Size_
void showDirStructure(void) const
Definition: DQMStore.cc:2961
MonitorElement * hist_EE_BC_Size_
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:1000
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584