CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
miscalibExample.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: miscalibExample
4 // Class: miscalibExample
5 //
13 //
14 // Original Author: Lorenzo AGOSTINO
15 // Created: Tue Jul 18 12:17:01 CEST 2006
16 // $Id: miscalibExample.cc,v 1.7 2010/01/04 15:07:18 ferriff Exp $
17 //
18 //
19 
20 
21 // system include files
22 
23 // user include files
25 
26 
27 //
28 
32 
33 
34 #include <iostream>
35 #include <stdexcept>
36 #include <vector>
37 
38 
39 
40 // class declaration
41 //
42 /*
43 class miscalibExample : public edm::EDAnalyzer {
44  public:
45  explicit miscalibExample(const edm::ParameterSet&);
46  ~miscalibExample();
47 
48  virtual void analyze(const edm::Event&, const edm::EventSetup&);
49  virtual void beginJob();
50  virtual void endJob();
51  private:
52 
53 
54  // ----------member data ---------------------------
55  std::string rootfile_;
56  std::string correctedHybridSuperClusterProducer_;
57  std::string correctedHybridSuperClusterCollection_;
58  std::string BarrelHitsCollection_;
59  std::string ecalHitsProducer_ ;
60  int read_events;
61 
62  TH1F* scEnergy;
63 };
64 
65 */
67 {
68 
69  rootfile_ = iConfig.getUntrackedParameter<std::string>("rootfile","ecalSimpleTBanalysis.root");
70  correctedHybridSuperClusterProducer_ = iConfig.getParameter<std::string>("correctedHybridSuperClusterProducer");
71  correctedHybridSuperClusterCollection_ = iConfig.getParameter<std::string>("correctedHybridSuperClusterCollection");
72 
73 }
74 
75 
77 {
78 
79 
80 }
81 
82 //========================================================================
83 void
85 //========================================================================
86 
87  // Book histograms
88  scEnergy = new TH1F("scEnergy","SuperCluster energy", 100, 20., 80.);
89  read_events=0;
90 
91  }
92 
93 //========================================================================
94 void
96 //========================================================================
97 
98  std::cout << "************* STATISTICS **************" << std::endl;
99  std::cout << "Read Events: " << read_events << std::endl;
100 
101 
103 
104  TFile f(rootfile_.c_str(),"RECREATE");
105 
106  scEnergy->Write();
107  f.Close();
108 
109 }
110 
111 
112 
113 //=================================================================================
114 void
116 {
117 //=================================================================================
118  using namespace edm;
119  using namespace std;
120 
121  read_events++;
122 
123  // Get hybrid super clusters after energy correction
124 
125  Handle<reco::SuperClusterCollection> pCorrectedHybridSuperClusters;
127  if (!pCorrectedHybridSuperClusters.isValid()) {
128  LogError("EgammaSimpleAnalyzer") << "Error! can't get collection with label " << correctedHybridSuperClusterCollection_.c_str() ;
129  }
130  const reco::SuperClusterCollection* correctedHybridSuperClusters = pCorrectedHybridSuperClusters.product();
131 
132 
133  reco::SuperClusterCollection::const_iterator superClusterIt;
134  for(superClusterIt=correctedHybridSuperClusters->begin(); superClusterIt!=correctedHybridSuperClusters->end(); superClusterIt++ )
135  {
136 
137  scEnergy->Fill(superClusterIt->energy());
138 
139  }
140 
141 }
142 
143 //define this as a plug-in
144 //DEFINE_FWK_MODULE(miscalibExample);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::string correctedHybridSuperClusterProducer_
virtual void beginJob()
int iEvent
Definition: GenABIO.cc:243
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
std::string correctedHybridSuperClusterCollection_
double f[11][100]
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
std::string rootfile_
miscalibExample(const edm::ParameterSet &)
tuple cout
Definition: gather_cfg.py:41
virtual void endJob()