-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEcalTimePhyTreeMaker.h
More file actions
260 lines (204 loc) · 9.14 KB
/
EcalTimePhyTreeMaker.h
File metadata and controls
260 lines (204 loc) · 9.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
#ifndef EcalTimePhyTreeMaker_h
#define EcalTimePhyTreeMaker_h
// -*- C++ -*-
//
// Package: EcalTimePhyTreeMaker
// Class: EcalTimePhyTreeMaker
//
/**\class EcalTimePhyTreeMaker EcalTimePhyTreeMaker.h
Description: <one line class summary>
Implementation:
<Notes on implementation>
*/
//
// Authors: Shih-Chuan Kao, Giovanni Franzoni (UMN)
// Created: Mo Jul 14 5:46:22 CEST 2008
// $Id: EcalTimePhyTreeMaker.h,v 1.3 2011/11/04 11:23:08 franzoni Exp $
//
//
// system include files
#include <memory>
#include <vector>
#include <map>
#include <set>
// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h"
#include "DataFormats/L1GlobalMuonTrigger/interface/L1MuGMTReadoutCollection.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
#include "DataFormats/L1GlobalTrigger/interface/L1GtPsbWord.h"
#include "DataFormats/EgammaReco/interface/BasicCluster.h"
#include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
#include "DataFormats/EgammaReco/interface/SuperCluster.h"
#include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
#include "DataFormats/EgammaReco/interface/BasicClusterShapeAssociation.h"
#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h"
#include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h"
#include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbService.h"
#include "TFile.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TH3F.h"
#include "TGraph.h"
#include "TTree.h"
#include <vector>
// *** for TrackAssociation
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
// ***
//for track length
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/CaloTopology/interface/CaloTopology.h"
#include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
#include "Geometry/Records/interface/IdealGeometryRecord.h"
#include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h"
#include "RecoCaloTools/Navigation/interface/CaloNavigator.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
#include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
#include "DataFormats/ParticleFlowReco/interface/PFBlock.h"
#include "DataFormats/ParticleFlowReco/interface/PFBlockElement.h"
#include "DataFormats/JetReco/interface/PFJetCollection.h"
#include "FWCore/Common/interface/TriggerNames.h"
#include "DataFormats/Common/interface/TriggerResults.h"
#include "DataFormats/METReco/interface/PFMET.h"
#include "DataFormats/METReco/interface/PFMETCollection.h"
#include "DataFormats/MuonReco/interface/MuonFwd.h"
#include "DataFormats/MuonReco/interface/Muon.h"
#include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
#include "DataFormats/EgammaCandidates/interface/Photon.h"
#include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
#include "DataFormats/EgammaCandidates/interface/ElectronFwd.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
// containers for vertices
#include <DataFormats/VertexReco/interface/VertexFwd.h>
#include <TMath.h>
#include <Math/VectorUtil.h>
#include "EcalTimePhyTreeContent.h"
#include "timeVsAmpliCorrector.h"
typedef std::pair<reco::SuperClusterRef, float> ParticleSC ;
class EcalTimePhyTreeMaker : public edm::EDAnalyzer
{
public:
explicit EcalTimePhyTreeMaker (const edm::ParameterSet&) ;
~EcalTimePhyTreeMaker () ;
protected:
virtual void beginJob () {} ;
virtual void analyze (const edm::Event&, const edm::EventSetup&) ;
virtual void endJob () ;
virtual void beginRun(edm::Run const &, edm::EventSetup const &) ;
private:
std::string intToString (int num) ;
void initHists (int) ;
//bool HLTSelection( const edm::Event& iEvent ) ;
int HLTSelection( const edm::Event& iEvent ) ;
bool dumpEvtObjectInfo( const edm::Event& iEvent ) ;
//! dump Cluster information
//! has to run after dumpMUinfo, to have the XtalMap already filled
void dumpBarrelClusterInfo(const edm::Event& iEvent,
const CaloGeometry * theGeometry,
const CaloTopology * theCaloTopology,
const EcalRecHitCollection* theBarrelEcalRecHits,
const reco::BasicClusterCollection* theBarrelBasicClusters,
const reco::SuperClusterCollection* theBarrelSuperClusters,
EcalClusterLazyTools* lazyTools,
const std::map<int,float> & XtalMap,
const std::map<int,float> & XtalMapCurved,
EcalTimePhyTreeContent & myTreeVariables_) ;
void dumpEndcapClusterInfo(const edm::Event& iEvent,
const CaloGeometry * theGeometry,
const CaloTopology * theCaloTopology,
const EcalRecHitCollection* theEndcapEcalRecHits,
const reco::BasicClusterCollection* theEndcapBasicClusters,
const reco::SuperClusterCollection* theEndcapSuperClusters,
EcalClusterLazyTools* lazyTools,
const std::map<int,float> & XtalMap,
const std::map<int,float> & XtalMapCurved,
EcalTimePhyTreeContent & myTreeVariables_) ;
void dumpJetBarrelClusterInfo (const edm::Event& iEvent,
const CaloGeometry * theGeometry,
const CaloTopology * theCaloTopology,
const EcalRecHitCollection* theBarrelEcalRecHits,
const reco::BasicClusterCollection* theBarrelBasicClusters,
EcalClusterLazyTools* lazyTools,
const std::map<int,float> & XtalMap,
const std::map<int,float> & XtalMapCurved ) ;
void dumpJetEndcapClusterInfo (const edm::Event& iEvent,
const CaloGeometry * theGeometry,
const CaloTopology * theCaloTopology,
const EcalRecHitCollection* theEndcapEcalRecHits,
const reco::BasicClusterCollection* theEndcapBasicClusters,
EcalClusterLazyTools* lazyTools,
const std::map<int,float> & XtalMap,
const std::map<int,float> & XtalMapCurved ) ;
void dumpVertexInfo(const reco::VertexCollection* recVtxs, EcalTimePhyTreeContent & myTreeVariables_);
//! dump trigger information
void dump3Ginfo (const edm::Event& iEvent, const edm::EventSetup& eventSetup,
EcalTimePhyTreeContent & myTreeVariables_) ;
bool matching ( float sc_Energy, math::XYZPoint sc_pos, math::XYZPoint obj_v3, math::XYZTLorentzVector obj_p4 ) ;
//! collect trigger information to be dumped
std::vector<bool> determineTriggers (const edm::Event& iEvent,
const edm::EventSetup& eventSetup, int Bx=0) ;
// ----------member data ---------------------------
protected:
edm::InputTag barrelEcalRecHitCollection_ ;
edm::InputTag endcapEcalRecHitCollection_ ;
edm::InputTag barrelBasicClusterCollection_ ;
edm::InputTag endcapBasicClusterCollection_ ;
edm::InputTag barrelSuperClusterCollection_ ;
edm::InputTag endcapSuperClusterCollection_ ;
edm::InputTag muonCollection_ ;
edm::InputTag JetSource_ ;
edm::InputTag METSource_ ;
edm::InputTag MuonSource_ ;
edm::InputTag ElectronSource_ ;
edm::InputTag PhotonSource_ ;
edm::InputTag triggerSource_ ;
edm::InputTag vertexCollection_ ;
edm::InputTag l1GMTReadoutRecTag_ ;
edm::InputTag gtRecordCollectionTag_ ;
int runNum_ ;
double minEtEB_;
double minEtEE_;
std::vector<double> jetCuts_ ;
std::vector<double> metCuts_ ;
std::vector<double> photonCuts_ ;
std::vector<double> photonIso_ ;
std::vector<double> electronCuts_ ;
std::vector<double> muonCuts_ ;
std::string fileName_ ;
std::string triggerName_ ;
EcalTimePhyTreeContent myTreeVariables_ ;
TFile* file_ ;
TTree* tree_ ;
std::vector<int> l1Accepts_ ;
std::vector<std::string> l1Names_ ;
double hbTreshold_;
edm::ESHandle<EcalIntercalibConstants> ical;
edm::ESHandle<EcalADCToGeVConstant> agc;
edm::ESHandle<EcalLaserDbService> laser;
std::vector<const reco::PFJet*> selectedJets ;
//std::vector<const reco::Electron*> selectedElectrons ;
std::vector<const reco::GsfElectron*> selectedElectrons ;
std::vector<const reco::Muon*> selectedMuons ;
std::vector<const reco::Photon*> selectedPhotons ;
std::vector<ParticleSC> sclist ;
int numberOfSuperClusters ;
int numberOfClusters ;
bool doTimeVSAmpliCorrection_;
timeCorrector theTimeCorrector_;
int naiveId_ ;
} ;
#endif