ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/CmsHi/JetAnalysis/src/HiHcalAnalyzer.cc
Revision: 1.2
Committed: Fri Dec 2 01:05:57 2011 UTC (13 years, 5 months ago) by yjlee
Content type: text/plain
Branch: MAIN
CVS Tags: HiForest_V02_34, HiForest_V02_33, HiForest_V02_32, HiForest_V02_31, HiForest_V02_30, HiForest_V02_27, HiForest_V02_26, QM_2012, HiForest_V02_25, HiForest_V02_24, HiForest_V02_23, HiForest_V02_22, HiForest_V02_21, HiForest_V02_20, HiForest_V02_19, HiForest_V02_18, HiForest_V02_17, HiForest_V02_16, HiForest_V02_15, HiForest_V02_14, HiForest_V02_13, HiForest_V02_12, HiForest_V02_11, HiForest_V02_10, HiForest_V02_09, HiForest_V02_08, HiForest_V02_07, HiForest_V02_06, HiForest_V02_05, HiForest_V02_04, HiForest_V02_03, HiForest_V02_02, HiForest_V02_01, HiForest_V02_00
Branch point for: branch_44x
Changes since 1.1: +2 -2 lines
Log Message:
Actually fill the tree..

File Contents

# User Rev Content
1 yilmaz 1.1 // -*- C++ -*-
2     //
3     // Package: HiHcalAnalyzer
4     // Class: HiHcalAnalyzer
5     //
6     /**\class HiHcalAnalyzer HiHcalAnalyzer.cc CmsHi/HiHcalAnalyzer/src/HiHcalAnalyzer.cc
7    
8     Description: [one line class summary]
9    
10     Implementation:
11     [Notes on implementation]
12     */
13     //
14     // Original Author: Yetkin Yilmaz
15     // Created: Thu Dec 1 10:28:28 EST 2011
16 yjlee 1.2 // $Id: HiHcalAnalyzer.cc,v 1.1 2011/12/01 22:55:20 yilmaz Exp $
17 yilmaz 1.1 //
18     //
19    
20     #define versionTag "v1"
21    
22     // system include files
23     #include <memory>
24     #include <vector>
25     #include <iostream>
26    
27     // user include files
28     #include "FWCore/Framework/interface/Frameworkfwd.h"
29     #include "FWCore/Framework/interface/EDAnalyzer.h"
30    
31     #include "FWCore/Framework/interface/Event.h"
32     #include "FWCore/Framework/interface/MakerMacros.h"
33    
34     #include "DataFormats/METReco/interface/HcalNoiseSummary.h"
35     #include "FWCore/ParameterSet/interface/ParameterSet.h"
36     #include "CommonTools/UtilAlgos/interface/TFileService.h"
37     #include "FWCore/ServiceRegistry/interface/Service.h"
38    
39     #include "TNtuple.h"
40    
41     using namespace std;
42    
43    
44     //
45     // class declaration
46     //
47    
48     class HiHcalAnalyzer : public edm::EDAnalyzer {
49     public:
50     explicit HiHcalAnalyzer(const edm::ParameterSet&);
51     ~HiHcalAnalyzer();
52    
53     static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
54    
55    
56     private:
57     virtual void beginJob() ;
58     virtual void analyze(const edm::Event&, const edm::EventSetup&);
59     virtual void endJob() ;
60    
61     virtual void beginRun(edm::Run const&, edm::EventSetup const&);
62     virtual void endRun(edm::Run const&, edm::EventSetup const&);
63     virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
64     virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
65    
66     // ----------member data ---------------------------
67    
68     edm::Service<TFileService> fs;
69     TTree* t;
70    
71    
72     int filterstatus, noisetype;
73     float emenergy, hadenergy, trackenergy;
74     float min10, max10, rms10;
75     float min25, max25, rms25;
76     int cnthit10, cnthit25;
77     float mine2ts, mine10ts;
78     float maxe2ts, maxe10ts;
79     int maxzeros;
80     int maxhpdhits, maxhpdhitsnoother, maxrbxhits;
81     float minhpdemf, minrbxemf;
82     int nproblemRBXs;
83     int nisolnoise;
84     float isolnoisee, isolnoiseet;
85     int nflatnoise;
86     float flatnoisee, flatnoiseet;
87     int nspikenoise;
88     float spikenoisee, spikenoiseet;
89     int ntrianglenoise;
90     float trianglenoisee, trianglenoiseet;
91     int nts4ts5noise;
92     float ts4ts5noisee, ts4ts5noiseet;
93    
94     bool hasBadRBXTS4TS5;
95    
96    
97     };
98    
99     //
100     // constants, enums and typedefs
101     //
102    
103     //
104     // static data member definitions
105     //
106    
107     //
108     // constructors and destructor
109     //
110     HiHcalAnalyzer::HiHcalAnalyzer(const edm::ParameterSet& iConfig)
111    
112     {
113     //now do what ever initialization is needed
114    
115     }
116    
117    
118     HiHcalAnalyzer::~HiHcalAnalyzer()
119     {
120    
121     // do anything here that needs to be done at desctruction time
122     // (e.g. close files, deallocate resources etc.)
123    
124     }
125    
126    
127     //
128     // member functions
129     //
130    
131     // ------------ method called for each event ------------
132     void
133     HiHcalAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
134     {
135     using namespace edm;
136    
137     edm::Handle<HcalNoiseSummary> hcalSummary;
138     iEvent.getByType(hcalSummary);
139    
140     filterstatus= hcalSummary->noiseFilterStatus ();
141     noisetype= hcalSummary->noiseType ();
142     emenergy= hcalSummary->eventEMEnergy ();
143     hadenergy= hcalSummary->eventHadEnergy ();
144     trackenergy= hcalSummary-> eventTrackEnergy();
145     min10= hcalSummary->min10GeVHitTime ();
146     max10= hcalSummary->max10GeVHitTime ();
147     rms10= hcalSummary->rms10GeVHitTime ();
148     min25= hcalSummary->min25GeVHitTime ();
149     max25= hcalSummary->max25GeVHitTime ();
150     rms25= hcalSummary->rms25GeVHitTime ();
151     cnthit10= hcalSummary->num10GeVHits ();
152     cnthit25= hcalSummary->num25GeVHits ();
153     mine2ts= hcalSummary->minE2TS ();
154     mine10ts= hcalSummary->minE10TS ();
155     maxe2ts= hcalSummary->maxE2TS ();
156     maxe10ts= hcalSummary->maxE10TS ();
157     maxzeros= hcalSummary->maxZeros ();
158     maxhpdhits= hcalSummary->maxHPDHits ();
159     maxhpdhitsnoother= hcalSummary->maxHPDNoOtherHits ();
160     maxrbxhits= hcalSummary->maxRBXHits ();
161     minhpdemf= hcalSummary->minHPDEMF();
162     minrbxemf= hcalSummary->minRBXEMF ();
163    
164     nproblemRBXs= hcalSummary->numProblematicRBXs ();
165     nisolnoise= hcalSummary->numIsolatedNoiseChannels ();
166     isolnoisee= hcalSummary->isolatedNoiseSumE ();
167     isolnoiseet= hcalSummary->isolatedNoiseSumEt ();
168     nflatnoise= hcalSummary->numFlatNoiseChannels ();
169     flatnoisee= hcalSummary->flatNoiseSumE ();
170     flatnoiseet= hcalSummary->flatNoiseSumEt ();
171     nspikenoise= hcalSummary->numSpikeNoiseChannels ();
172     spikenoisee= hcalSummary->spikeNoiseSumE ();
173     spikenoiseet= hcalSummary->spikeNoiseSumEt ();
174     ntrianglenoise= hcalSummary->numTriangleNoiseChannels ();
175     trianglenoisee= hcalSummary->triangleNoiseSumE ();
176     trianglenoiseet= hcalSummary->triangleNoiseSumEt ();
177     nts4ts5noise= hcalSummary->numTS4TS5NoiseChannels ();
178     ts4ts5noisee= hcalSummary->TS4TS5NoiseSumE ();
179     ts4ts5noiseet= hcalSummary->TS4TS5NoiseSumEt ();
180     hasBadRBXTS4TS5= hcalSummary->HasBadRBXTS4TS5 ();
181    
182 yjlee 1.2 t->Fill();
183 yilmaz 1.1 }
184    
185    
186     // ------------ method called once each job just before starting event loop ------------
187     void
188     HiHcalAnalyzer::beginJob()
189     {
190    
191     t = fs->make<TTree>("hcalNoise",versionTag);
192     t->Branch("filterstatus",&filterstatus,"filterstatus/I");
193     t->Branch("noisetype",&noisetype,"noisetype/I");
194     t->Branch("emenergy",&emenergy,"emenergy/F");
195     t->Branch("hadenergy",&hadenergy,"hadenergy/F");
196     t->Branch("trackenergy",&trackenergy,"trackenergy/F");
197     t->Branch("min10",&min10,"min10/F");
198     t->Branch("max10",&max10,"max10/F");
199     t->Branch("rms10",&rms10,"rms10/F");
200    
201     t->Branch("min25",&min25,"min25/F");
202     t->Branch("max25",&max25,"max25/F");
203     t->Branch("rms25",&rms25,"rms25/F");
204    
205     t->Branch("cnthit10",&cnthit10,"cnthit10/I");
206     t->Branch("cnthit25",&cnthit25,"cnthit25/I");
207    
208     t->Branch("mine2ts",&mine2ts,"mine2ts/F");
209    
210     t->Branch("maxe2ts",&maxe2ts,"maxe2ts/F");
211     t->Branch("maxe10ts",&maxe10ts,"maxe10ts/F");
212    
213    
214     t->Branch("maxzeros",&maxzeros,"maxzeros/I");
215     t->Branch("maxhpdhits",&maxhpdhits,"maxhpdhits/I");
216     t->Branch("maxhpdhitsnoother",&maxhpdhitsnoother,"maxhpdhitsnoother/I");
217     t->Branch("maxrbxhits",&maxrbxhits,"maxrbxhits/I");
218    
219     t->Branch("minhpdemf",&minhpdemf,"minhpdemf/F");
220     t->Branch("minrbxemf",&minrbxemf,"minrbxemf/F");
221     t->Branch("nproblemRBXs",&nproblemRBXs,"nproblemRBXs/I");
222     t->Branch("nisolnoise",&nisolnoise,"nisolnoise/I");
223     t->Branch("isolnoisee",&isolnoisee,"isolnoisee/F");
224    
225     t->Branch("nflatnoise",&nflatnoise,"nflatnoise/I");
226     t->Branch("flatnoisee",&flatnoisee,"flatnoisee/F");
227     t->Branch("flatnoiseet",&flatnoiseet,"flatnoiseet/F");
228     t->Branch("nspikenoise",&nspikenoise,"nspikenoise/I");
229     t->Branch("spikenoisee",&spikenoisee,"spikenoisee/F");
230     t->Branch("spikenoiseet",&spikenoiseet,"spikenoiseet/F");
231     t->Branch("ntrianglenoise",&ntrianglenoise,"ntrianglenoise/I");
232     t->Branch("trianglenoisee",&trianglenoisee,"trianglenoisee/F");
233     t->Branch("trianglenoiseet",&trianglenoiseet,"trianglenoiseet/F");
234     t->Branch("nts4ts5noise",&nts4ts5noise,"nts4ts5noise/I");
235     t->Branch("ts4ts5noisee",&ts4ts5noisee,"ts4ts5noisee/F");
236     t->Branch("ts4ts5noiseet",&ts4ts5noiseet,"ts4ts5noiseet/F");
237    
238     t->Branch("hasBadRBXTS4TS5",&hasBadRBXTS4TS5,"hasBadRBXTS4TS5/O");
239    
240    
241    
242     }
243    
244     // ------------ method called once each job just after ending the event loop ------------
245     void
246     HiHcalAnalyzer::endJob()
247     {
248     }
249    
250     // ------------ method called when starting to processes a run ------------
251     void
252     HiHcalAnalyzer::beginRun(edm::Run const&, edm::EventSetup const&)
253     {
254     }
255    
256     // ------------ method called when ending the processing of a run ------------
257     void
258     HiHcalAnalyzer::endRun(edm::Run const&, edm::EventSetup const&)
259     {
260     }
261    
262     // ------------ method called when starting to processes a luminosity block ------------
263     void
264     HiHcalAnalyzer::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&)
265     {
266     }
267    
268     // ------------ method called when ending the processing of a luminosity block ------------
269     void
270     HiHcalAnalyzer::endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&)
271     {
272     }
273    
274     // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
275     void
276     HiHcalAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
277     //The following says we do not know what parameters are allowed so do no validation
278     // Please change this to state exactly what you do use, even if it is no parameters
279     edm::ParameterSetDescription desc;
280     desc.setUnknown();
281     descriptions.addDefault(desc);
282     }
283    
284     //define this as a plug-in
285     DEFINE_FWK_MODULE(HiHcalAnalyzer);