CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EERecoSummary.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EERecoSummary
4 // Class: EERecoSummary
5 // Original Author: Martina Malberti
6 //
7 // system include files
8 #include <memory>
9 
10 // user include files
13 
18 
22 
23 
32 
48 
51 
54 
59 
60 #include "TVector3.h"
61 
62 #include <iostream>
63 #include <cmath>
64 #include <fstream>
65 
66 //
67 // constructors and destructor
68 //
70 {
71 
72  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
73 
74  //now do what ever initialization is needed
75  recHitCollection_EE_ = ps.getParameter<edm::InputTag>("recHitCollection_EE");
76  redRecHitCollection_EE_ = ps.getParameter<edm::InputTag>("redRecHitCollection_EE");
77  basicClusterCollection_EE_ = ps.getParameter<edm::InputTag>("basicClusterCollection_EE");
78  superClusterCollection_EE_ = ps.getParameter<edm::InputTag>("superClusterCollection_EE");
79 
80  ethrEE_ = ps.getParameter<double>("ethrEE");
81 
82  scEtThrEE_ = ps.getParameter<double>("scEtThrEE");
83 
84  // DQM Store -------------------
86 
87  // Monitor Elements (ex THXD)
88  dqmStore_->setCurrentFolder(prefixME_ + "/EERecoSummary"); // to organise the histos in folders
89 
90  // ReducedRecHits ----------------------------------------------
91  // ... endcap
92  h_redRecHits_EE_recoFlag = dqmStore_->book1D("redRecHits_EE_recoFlag","redRecHits_EE_recoFlag",16,-0.5,15.5);
93 
94  // RecHits ----------------------------------------------
95  // ... endcap
96  h_recHits_EE_recoFlag = dqmStore_->book1D("recHits_EE_recoFlag","recHits_EE_recoFlag",16,-0.5,15.5);
97 
98  // ... endcap +
99  h_recHits_EEP_energyMax = dqmStore_->book1D("recHits_EEP_energyMax","recHitsEEP_energyMax",110,-10,100);
100  h_recHits_EEP_Chi2 = dqmStore_->book1D("recHits_EEP_Chi2","recHits_EEP_Chi2",200,0,100);
101  h_recHits_EEP_time = dqmStore_->book1D("recHits_EEP_time","recHits_EEP_time",200,-50,50);
102 
103  // ... endcap -
104  h_recHits_EEM_energyMax = dqmStore_->book1D("recHits_EEM_energyMax","recHits_EEM_energyMax",110,-10,100);
105  h_recHits_EEM_Chi2 = dqmStore_->book1D("recHits_EEM_Chi2","recHits_EEM_Chi2",200,0,100);
106  h_recHits_EEM_time = dqmStore_->book1D("recHits_EEM_time","recHits_EEM_time",200,-50,50);
107 
108  // Basic Clusters ----------------------------------------------
109  // ... associated endcap rec hits
110  h_basicClusters_recHits_EE_recoFlag = dqmStore_->book1D("basicClusters_recHits_EE_recoFlag","basicClusters_recHits_EE_recoFlag",16,-0.5,15.5);
111 
112  // Super Clusters ----------------------------------------------
113  // ... endcap
114  h_superClusters_EEP_nBC = dqmStore_->book1D("superClusters_EEP_nBC","superClusters_EEP_nBC",100,0.,100.);
115  h_superClusters_EEM_nBC = dqmStore_->book1D("superClusters_EEM_nBC","superClusters_EEM_nBC",100,0.,100.);
116 
117  h_superClusters_eta = dqmStore_->book1D("superClusters_eta","superClusters_eta",150,-3.,3.);
118  h_superClusters_EE_phi = dqmStore_->book1D("superClusters_EE_phi","superClusters_EE_phi",360,-3.1415927,3.1415927);
119 
120 }
121 
122 
123 
125 {
126  // do anything here that needs to be done at desctruction time
127  // (e.g. close files, deallocate resources etc.)
128 }
129 
130 
131 //
132 // member functions
133 //
134 
135 // ------------ method called to for each event ------------
136 void EERecoSummary::analyze(const edm::Event& ev, const edm::EventSetup& iSetup)
137 {
138 
139  //Get the magnetic field
140  edm::ESHandle<MagneticField> theMagField;
141  iSetup.get<IdealMagneticFieldRecord>().get(theMagField);
142 
143  // --- REDUCED REC HITS -------------------------------------------------------------------------------------
144  // ... endcap
146  ev.getByLabel( redRecHitCollection_EE_, redRecHitsEE );
147  const EcalRecHitCollection* theEndcapEcalredRecHits = redRecHitsEE.product () ;
148  if ( ! redRecHitsEE.isValid() ) {
149  edm::LogWarning("EERecoSummary") << "redRecHitsEE not found";
150  }
151 
152  for ( EcalRecHitCollection::const_iterator itr = theEndcapEcalredRecHits->begin () ;
153  itr != theEndcapEcalredRecHits->end () ; ++itr)
154  {
155 
156  EEDetId eeid( itr -> id() );
157 
158  h_redRecHits_EE_recoFlag->Fill( itr -> recoFlag() );
159 
160  }
161 
162  // --- REC HITS -------------------------------------------------------------------------------------
163 
164  // ... endcap
166  ev.getByLabel( recHitCollection_EE_, recHitsEE );
167  const EcalRecHitCollection* theEndcapEcalRecHits = recHitsEE.product () ;
168  if ( ! recHitsEE.isValid() ) {
169  edm::LogWarning("EERecoSummary") << "recHitsEE not found";
170  }
171 
172  float maxRecHitEnergyEEP = -999.;
173  float maxRecHitEnergyEEM = -999.;
174 
175  EEDetId eeid_MrecHitEEM;
176  EEDetId eeid_MrecHitEEP;
177 
178  for ( EcalRecHitCollection::const_iterator itr = theEndcapEcalRecHits->begin () ;
179  itr != theEndcapEcalRecHits->end () ; ++itr)
180  {
181 
182  EEDetId eeid( itr -> id() );
183 
184  // EE+
185  if ( eeid.zside() > 0 ){
186 
187  h_recHits_EE_recoFlag -> Fill( itr -> recoFlag() );
188 
189  // max E rec hit
190  if (itr -> energy() > maxRecHitEnergyEEP &&
191  !(eeid.ix()>=41 && eeid.ix()<=60 && eeid.iy()>=41 && eeid.iy()<=60) ) {
192  maxRecHitEnergyEEP = itr -> energy() ;
193  }
194 
195  // only channels above noise
196  if ( itr -> energy() > ethrEE_ ){
197  h_recHits_EEP_Chi2 -> Fill( itr -> chi2() );
198  h_recHits_EEP_time -> Fill( itr -> time() );
199  }
200  }
201 
202  // EE-
203  if ( eeid.zside() < 0 ){
204 
205  h_recHits_EE_recoFlag -> Fill( itr -> recoFlag() );
206 
207  // max E rec hit
208  if (itr -> energy() > maxRecHitEnergyEEM &&
209  !(eeid.ix()>=41 && eeid.ix()<=60 && eeid.iy()>=41 && eeid.iy()<=60) ) {
210  maxRecHitEnergyEEM = itr -> energy() ;
211  }
212 
213  // only channels above noise
214  if ( itr -> energy() > ethrEE_ ) {
215  h_recHits_EEM_Chi2 -> Fill( itr -> chi2() );
216  h_recHits_EEM_time -> Fill( itr -> time() );
217  }
218 
219  }
220  } // end loop over EE rec hits
221 
222  // energy
223  h_recHits_EEP_energyMax -> Fill( maxRecHitEnergyEEP );
224  h_recHits_EEM_energyMax -> Fill( maxRecHitEnergyEEM );
225 
226  //--- BASIC CLUSTERS --------------------------------------------------------------
227 
228  // ... endcap
230  ev.getByLabel( basicClusterCollection_EE_, basicClusters_EE_h );
231  if ( ! basicClusters_EE_h.isValid() ) {
232  edm::LogWarning("EERecoSummary") << "basicClusters_EE_h not found";
233  }
234 
235  for (unsigned int icl = 0; icl < basicClusters_EE_h->size(); ++icl) {
236 
237  //Get the associated RecHits
238  const std::vector<std::pair<DetId,float> > & hits= (*basicClusters_EE_h)[icl].hitsAndFractions();
239  for (std::vector<std::pair<DetId,float> > ::const_iterator rh = hits.begin(); rh!=hits.end(); ++rh){
240 
241  EBRecHitCollection::const_iterator itrechit = theEndcapEcalRecHits->find((*rh).first);
242  if (itrechit==theEndcapEcalRecHits->end()) continue;
243  h_basicClusters_recHits_EE_recoFlag -> Fill ( itrechit -> recoFlag() );
244  }
245 
246  }
247 
248  // Super Clusters
249  // ... endcap
251  ev.getByLabel( superClusterCollection_EE_, superClusters_EE_h );
252  const reco::SuperClusterCollection* theEndcapSuperClusters = superClusters_EE_h.product () ;
253  if ( ! superClusters_EE_h.isValid() ) {
254  edm::LogWarning("EERecoSummary") << "superClusters_EE_h not found";
255  }
256 
257  for (reco::SuperClusterCollection::const_iterator itSC = theEndcapSuperClusters->begin();
258  itSC != theEndcapSuperClusters->end(); ++itSC ) {
259 
260  double scEt = itSC -> energy() * sin(2.*atan( exp(- itSC->position().eta() )));
261 
262  if (scEt < scEtThrEE_ ) continue;
263 
264  h_superClusters_eta -> Fill( itSC -> eta() );
265  h_superClusters_EE_phi -> Fill( itSC -> phi() );
266 
267  if ( itSC -> z() > 0 ){
268  h_superClusters_EEP_nBC -> Fill( itSC -> clustersSize() );
269  }
270 
271  if ( itSC -> z() < 0 ){
272  h_superClusters_EEM_nBC -> Fill( itSC -> clustersSize() );
273  }
274  }
275 
276  //--------------------------------------------------------
277 
278 }
279 
280 
281 // ------------ method called once each job just before starting event loop ------------
282 void
284 {
285 }
286 
287 // ------------ method called once each job just after ending the event loop ------------
288 void
290 {}
291 
292 
293 //define this as a plug-in
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
double scEtThrEE_
Definition: EERecoSummary.h:99
MonitorElement * h_redRecHits_EE_recoFlag
Definition: EERecoSummary.h:64
int ix() const
Definition: EEDetId.h:71
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void beginJob()
EERecoSummary(const edm::ParameterSet &)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::string prefixME_
Definition: EERecoSummary.h:58
std::vector< EcalRecHit >::const_iterator const_iterator
MonitorElement * h_basicClusters_recHits_EE_recoFlag
Definition: EERecoSummary.h:79
edm::InputTag basicClusterCollection_EE_
Definition: EERecoSummary.h:94
edm::InputTag superClusterCollection_EE_
Definition: EERecoSummary.h:95
MonitorElement * h_recHits_EEM_Chi2
Definition: EERecoSummary.h:75
T eta() const
MonitorElement * h_recHits_EE_recoFlag
Definition: EERecoSummary.h:68
double double double z
MonitorElement * h_recHits_EEP_Chi2
Definition: EERecoSummary.h:71
void Fill(long long x)
edm::InputTag recHitCollection_EE_
Definition: EERecoSummary.h:92
MonitorElement * h_recHits_EEP_time
Definition: EERecoSummary.h:72
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int zside() const
Definition: EEDetId.h:65
MonitorElement * h_superClusters_EEM_nBC
Definition: EERecoSummary.h:84
MonitorElement * h_recHits_EEM_energyMax
Definition: EERecoSummary.h:74
int iy() const
Definition: EEDetId.h:77
MonitorElement * h_superClusters_eta
Definition: EERecoSummary.h:86
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
MonitorElement * h_superClusters_EEP_nBC
Definition: EERecoSummary.h:83
MonitorElement * h_recHits_EEM_time
Definition: EERecoSummary.h:76
const_iterator end() const
DQMStore * dqmStore_
Definition: EERecoSummary.h:56
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: Handle.h:74
iterator find(key_type k)
edm::InputTag redRecHitCollection_EE_
Definition: EERecoSummary.h:93
MonitorElement * h_recHits_EEP_energyMax
Definition: EERecoSummary.h:70
virtual void endJob()
MonitorElement * h_superClusters_EE_phi
Definition: EERecoSummary.h:87
const_iterator begin() const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
Definition: DDAxes.h:10