CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalRecHitsFilter.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EcalRecHitsFilter
4 // Class: EcalRecHitsFilter
5 //
6 //class EcalHighEnCosmicFilter EcalHighEnCosmicFilter.cc
7 //
8 // Original Author:
9 
10 
11 #include <memory>
12 #include <vector>
13 #include <map>
14 #include <set>
15 
16 // user include files
18 
33 
34 using namespace edm;
35 using namespace std;
36 using namespace reco;
37 
38 //
40  NumBadXtalsThreshold_ (iConfig.getUntrackedParameter<int>("NumberXtalsThreshold")),
41  EBRecHitCollection_ (iConfig.getParameter<edm::InputTag>("EcalRecHitCollectionEB"))
42 
43 {
44  EnergyCut = (iConfig.getUntrackedParameter<double>("energycut"));
45 }
46 
48 {
49 }
50 
52 {
53  //int ievt = iEvent.id().event();
55  iEvent.getByLabel(EBRecHitCollection_,EBhits);
56 
57  bool accepted = true;
58  int nRecHitsGreater1GevPerEvent = 0;
59 
60  for (EcalRecHitCollection::const_iterator hitItr = EBhits->begin(); hitItr != EBhits->end(); ++hitItr)
61  {
62 
63  EcalRecHit hit = (*hitItr);
64  EBDetId det = hit.id();
65 
66  float ampli = hit.energy();
67  if(ampli > EnergyCut /*1GeV*/)
68  {
69  nRecHitsGreater1GevPerEvent++;
71  }
72  }
73  nRecHitsGreater1GevPerEvent_hist->Fill(nRecHitsGreater1GevPerEvent);
74  if(nRecHitsGreater1GevPerEvent > NumBadXtalsThreshold_ ) accepted = false;
75  return accepted;
76 }
77 
78 void
80 {
81  nRecHitsGreater1GevPerEvent_hist = new TH1F("nRecHitsGreater1GevPerEvent_hist","nRecHitsGreater1GevPerEvent_hist",65000,0.,65000.);
82  nRecHitsGreater1GevPerEvent_hist_MAP = new TH2F("nRecHitsGreater1GevPerEvent_hist_MAP","nRecHitsGreater1GevPerEvent_hist_MAP",360,1.,361.,171,-85.,86.);
83 }
84 
85 
86 void
88 {
89  cout << "------EcalRecHitsFilter EndJob------>>>>>>>>>>" << endl;
90  file = new TFile("RecHitFilter.root" , "RECREATE");
91  file->cd();
94  file->Close();
95 }
T getUntrackedParameter(std::string const &, T const &) const
std::vector< EcalRecHit >::const_iterator const_iterator
TH1F * nRecHitsGreater1GevPerEvent_hist
int iphi() const
get the crystal iphi
Definition: EBDetId.h:53
int iEvent
Definition: GenABIO.cc:230
TH2F * nRecHitsGreater1GevPerEvent_hist_MAP
EcalRecHitsFilter(const edm::ParameterSet &)
float energy() const
Definition: EcalRecHit.h:68
int ieta() const
get the crystal ieta
Definition: EBDetId.h:51
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:420
DetId id() const
get the id
Definition: EcalRecHit.h:76
virtual bool filter(edm::Event &, const edm::EventSetup &)
edm::InputTag EBRecHitCollection_
virtual void beginJob()
tuple cout
Definition: gather_cfg.py:121
virtual void endJob()