1 |
querten |
1.1 |
// -*- C++ -*-
|
2 |
|
|
//
|
3 |
|
|
// Package: Frog_Analyzer
|
4 |
|
|
// Class: Frog_Analyzer
|
5 |
|
|
//
|
6 |
|
|
/**\class Frog_Analyzer Frog_Analyzer.cc Visualisation/Frog/src/Frog_Analyzer.cc
|
7 |
|
|
|
8 |
|
|
Description: <one line class summary>
|
9 |
|
|
|
10 |
|
|
Implementation:
|
11 |
|
|
<Notes on implementation>
|
12 |
|
|
*/
|
13 |
|
|
//
|
14 |
|
|
// Original Author: Loic QUERTENMONT
|
15 |
|
|
// Created: Fri Oct 26 07:22:12 CEST 2007
|
16 |
querten |
1.2 |
// $Id: Frog_Analyzer.cc,v 1.1 2008/04/19 06:16:28 querten Exp $
|
17 |
querten |
1.1 |
//
|
18 |
|
|
//
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
// system include files
|
22 |
|
|
#include <memory>
|
23 |
|
|
|
24 |
|
|
// user include files
|
25 |
|
|
#include "FWCore/Framework/interface/Frameworkfwd.h"
|
26 |
|
|
#include "FWCore/Framework/interface/EDAnalyzer.h"
|
27 |
|
|
|
28 |
|
|
#include "FWCore/Framework/interface/Event.h"
|
29 |
|
|
#include "FWCore/Framework/interface/MakerMacros.h"
|
30 |
|
|
|
31 |
|
|
#include "FWCore/ParameterSet/interface/ParameterSet.h"
|
32 |
|
|
#include "FWCore/ServiceRegistry/interface/Service.h"
|
33 |
|
|
#include "FWCore/Framework/interface/ESHandle.h"
|
34 |
|
|
|
35 |
|
|
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
|
36 |
|
|
#include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
|
37 |
|
|
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
|
38 |
|
|
#include "Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
|
39 |
|
|
#include "Geometry/CommonTopologies/interface/PixelTopology.h"
|
40 |
|
|
#include "Geometry/CommonTopologies/interface/StripTopology.h"
|
41 |
|
|
#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetType.h"
|
42 |
|
|
#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetType.h"
|
43 |
|
|
#include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
|
44 |
|
|
#include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
|
45 |
|
|
#include "DataFormats/GeometrySurface/interface/BoundSurface.h"
|
46 |
|
|
#include "DataFormats/DetId/interface/DetId.h"
|
47 |
|
|
|
48 |
|
|
#include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
|
49 |
|
|
#include "Geometry/Records/interface/IdealGeometryRecord.h"
|
50 |
|
|
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
|
51 |
|
|
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
|
52 |
|
|
#include "Geometry/EcalBarrelAlgo/interface/EcalBarrelGeometry.h"
|
53 |
|
|
#include "Geometry/EcalEndcapAlgo/interface/EcalEndcapGeometry.h"
|
54 |
|
|
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
|
55 |
|
|
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
|
56 |
|
|
|
57 |
|
|
#include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
|
58 |
|
|
#include "Geometry/Records/interface/MuonGeometryRecord.h"
|
59 |
|
|
#include "Geometry/DTGeometry/interface/DTGeometry.h"
|
60 |
|
|
#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
|
61 |
|
|
#include "Geometry/RPCGeometry/interface/RPCGeometry.h"
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
#include "DataFormats/CaloRecHit/interface/CaloRecHit.h"
|
65 |
|
|
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
|
66 |
|
|
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
|
67 |
|
|
|
68 |
|
|
#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
|
69 |
|
|
#include "SimDataFormats/TrackingHit/interface/PSimHit.h"
|
70 |
|
|
#include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
|
71 |
|
|
#include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
|
72 |
|
|
#include "SimDataFormats/CaloHit/interface/PCaloHit.h"
|
73 |
|
|
#include "SimDataFormats/Track/interface/SimTrack.h"
|
74 |
|
|
#include "SimDataFormats/Vertex/interface/SimVertex.h"
|
75 |
|
|
|
76 |
|
|
#include "DataFormats/Provenance/interface/BranchDescription.h"
|
77 |
|
|
#include "DataFormats/Provenance/interface/Provenance.h"
|
78 |
|
|
#include "DataFormats/Candidate/interface/Candidate.h"
|
79 |
|
|
#include "DataFormats/HepMCCandidate/interface/GenParticleCandidate.h"
|
80 |
|
|
#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
|
81 |
|
|
#include "DataFormats/TrackReco/interface/Track.h"
|
82 |
|
|
|
83 |
querten |
1.2 |
#include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
|
84 |
|
|
#include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h"
|
85 |
|
|
|
86 |
|
|
#include "DataFormats/DTRecHit/interface/DTRecHitCollection.h"
|
87 |
|
|
#include "DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h"
|
88 |
|
|
#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h"
|
89 |
|
|
|
90 |
querten |
1.1 |
#include "DataFormats/Math/interface/Point3D.h"
|
91 |
|
|
#include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
|
92 |
|
|
#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
|
93 |
|
|
|
94 |
|
|
#include "Visualisation/Frog/interface/SimEvent.h"
|
95 |
|
|
#include "Visualisation/Frog/interface/Geometry.h"
|
96 |
|
|
|
97 |
|
|
using namespace edm;
|
98 |
|
|
using namespace std;
|
99 |
|
|
|
100 |
|
|
//
|
101 |
|
|
// class decleration
|
102 |
|
|
//
|
103 |
|
|
|
104 |
|
|
class Frog_Analyzer : public edm::EDAnalyzer {
|
105 |
|
|
public:
|
106 |
|
|
explicit Frog_Analyzer(const edm::ParameterSet&);
|
107 |
|
|
~Frog_Analyzer();
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
private:
|
111 |
|
|
virtual void beginJob(const edm::EventSetup& iSetup);
|
112 |
|
|
virtual void analyze (const edm::Event&, const edm::EventSetup&);
|
113 |
|
|
virtual void endJob ();
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
MySimEvents* MyEvents;
|
117 |
|
|
Geometry* Geom_Tracker;
|
118 |
|
|
Geometry* Geom_ECAL;
|
119 |
|
|
Geometry* Geom_HCAL;
|
120 |
|
|
Geometry* Geom_Muon;
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
std::string OutputFile;
|
124 |
|
|
|
125 |
|
|
std::vector<InputTag> SimTrackProducers;
|
126 |
|
|
std::vector<InputTag> SimVertexProducers;
|
127 |
|
|
std::vector<InputTag> SimHitProducers;
|
128 |
|
|
|
129 |
|
|
std::vector<InputTag> TrackProducers;
|
130 |
|
|
std::vector<InputTag> EcalRecHitProducers;
|
131 |
|
|
std::vector<InputTag> HcalHBHERecHitProducers;
|
132 |
|
|
std::vector<InputTag> HcalHORecHitProducers;
|
133 |
|
|
std::vector<InputTag> HcalHFRecHitProducers;
|
134 |
querten |
1.2 |
std::vector<InputTag> DTSegmentProducers;
|
135 |
|
|
std::vector<InputTag> CSCSegmentProducers;
|
136 |
|
|
|
137 |
|
|
std::vector<InputTag> RPCHitsProducers;
|
138 |
querten |
1.1 |
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
// ----------member data ---------------------------
|
143 |
|
|
};
|
144 |
|
|
|
145 |
|
|
//
|
146 |
|
|
// constructors and destructor
|
147 |
|
|
//
|
148 |
|
|
Frog_Analyzer::Frog_Analyzer(const edm::ParameterSet& iConfig)
|
149 |
|
|
{
|
150 |
|
|
OutputFile = iConfig.getParameter<std::string >("OutputFile");
|
151 |
|
|
|
152 |
|
|
SimTrackProducers = iConfig.getParameter<std::vector<InputTag> >("SimTrackProducers");
|
153 |
|
|
SimVertexProducers = iConfig.getParameter<std::vector<InputTag> >("SimVertexProducers");
|
154 |
|
|
SimHitProducers = iConfig.getParameter<std::vector<InputTag> >("SimHitProducers");
|
155 |
|
|
|
156 |
|
|
TrackProducers = iConfig.getParameter<std::vector<InputTag> >("TrackProducers");
|
157 |
|
|
EcalRecHitProducers = iConfig.getParameter<std::vector<InputTag> >("EcalRecHitProducers");
|
158 |
|
|
HcalHBHERecHitProducers = iConfig.getParameter<std::vector<InputTag> >("HcalHBHERecHitProducers");
|
159 |
|
|
HcalHORecHitProducers = iConfig.getParameter<std::vector<InputTag> >("HcalHORecHitProducers");
|
160 |
|
|
HcalHFRecHitProducers = iConfig.getParameter<std::vector<InputTag> >("HcalHFRecHitProducers");
|
161 |
|
|
|
162 |
querten |
1.2 |
DTSegmentProducers = iConfig.getParameter<std::vector<InputTag> >("DTSegmentProducers");
|
163 |
|
|
CSCSegmentProducers = iConfig.getParameter<std::vector<InputTag> >("CSCSegmentProducers");
|
164 |
|
|
|
165 |
|
|
RPCHitsProducers = iConfig.getParameter<std::vector<InputTag> >("RPCHitsProducers");
|
166 |
|
|
|
167 |
querten |
1.1 |
}
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
Frog_Analyzer::~Frog_Analyzer()
|
171 |
|
|
{
|
172 |
|
|
}
|
173 |
|
|
|
174 |
|
|
// ------------ method called once each job just before starting event loop ------------
|
175 |
|
|
void
|
176 |
|
|
Frog_Analyzer::beginJob(const edm::EventSetup& iSetup)
|
177 |
|
|
{
|
178 |
|
|
DetId Detid;
|
179 |
|
|
int SubDet;
|
180 |
|
|
|
181 |
|
|
MyEvents = new MySimEvents();
|
182 |
|
|
Geom_Tracker = new Geometry();
|
183 |
|
|
Geom_ECAL = new Geometry();
|
184 |
|
|
Geom_HCAL = new Geometry();
|
185 |
|
|
Geom_Muon = new Geometry();
|
186 |
|
|
|
187 |
|
|
|
188 |
|
|
// ### TRACKER GEOMETRY ###
|
189 |
|
|
|
190 |
|
|
edm::ESHandle<TrackerGeometry> tkGeom;
|
191 |
|
|
iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
|
192 |
|
|
vector<GeomDet*> TrackerDets = tkGeom->dets();
|
193 |
|
|
|
194 |
|
|
for(unsigned int i=0;i<TrackerDets.size();i++){
|
195 |
|
|
Detid = TrackerDets[i]->geographicalId();
|
196 |
|
|
// SubDet = Detid.subdetId();
|
197 |
|
|
|
198 |
|
|
GeomDet* DetUnit = TrackerDets[i];
|
199 |
|
|
if(!DetUnit)continue;
|
200 |
|
|
const BoundPlane plane = DetUnit->surface();
|
201 |
|
|
const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
|
202 |
|
|
const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
|
203 |
|
|
|
204 |
|
|
float width = 0;
|
205 |
|
|
float length = 0;
|
206 |
|
|
float thickness = 0;
|
207 |
|
|
float TrapezoidalParam = 0;
|
208 |
|
|
|
209 |
|
|
if(trapezoidalBounds)
|
210 |
|
|
{
|
211 |
|
|
std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
|
212 |
|
|
width = parameters[0]*2;
|
213 |
|
|
length = parameters[3]*2;
|
214 |
|
|
thickness = (*trapezoidalBounds).thickness();
|
215 |
|
|
TrapezoidalParam = parameters[1]/parameters[0];
|
216 |
|
|
}else if(rectangularBounds){
|
217 |
|
|
width = DetUnit->surface().bounds().width();
|
218 |
|
|
length = DetUnit->surface().bounds().length();
|
219 |
|
|
thickness = DetUnit->surface().bounds().thickness();
|
220 |
|
|
TrapezoidalParam = 1;
|
221 |
|
|
}
|
222 |
|
|
|
223 |
|
|
Surface::GlobalPoint WidthVector = plane.toGlobal( LocalPoint(width/2, 0, 0) );
|
224 |
|
|
Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) );
|
225 |
|
|
Surface::GlobalPoint ThickVector = plane.toGlobal( LocalPoint(0, 0, thickness/2) );
|
226 |
|
|
|
227 |
|
|
GlobalVector Pos = GlobalVector(DetUnit->position().basicVector());
|
228 |
|
|
|
229 |
|
|
Geom_Tracker->Add_TrackerDet(Detid.rawId(), TrapezoidalParam,
|
230 |
|
|
Pos.x(), Pos.y(), Pos.z(),
|
231 |
|
|
WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
|
232 |
|
|
LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
|
233 |
|
|
ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
|
234 |
|
|
|
235 |
|
|
|
236 |
|
|
}
|
237 |
|
|
|
238 |
|
|
|
239 |
|
|
// ### CALO GEOMETRY ###
|
240 |
|
|
|
241 |
|
|
edm::ESHandle<CaloGeometry> CaloGeom;
|
242 |
|
|
iSetup.get<IdealGeometryRecord>().get( CaloGeom );
|
243 |
|
|
const vector<DetId> CaloDets = CaloGeom->getValidDetIds();
|
244 |
|
|
|
245 |
|
|
for(unsigned int i=0;i<CaloDets.size();i++)
|
246 |
|
|
{
|
247 |
|
|
Detid = CaloDets[i];
|
248 |
|
|
SubDet = Detid.subdetId();
|
249 |
|
|
|
250 |
|
|
Geometry* Geom_temp = NULL;
|
251 |
|
|
if(Detid.det()==DetId::Ecal){
|
252 |
|
|
Geom_temp = Geom_ECAL;
|
253 |
|
|
|
254 |
|
|
if(SubDet<1 || SubDet>3){
|
255 |
|
|
printf("Don't Save EcalTriggerTower or EcalLaserPnDiode\n");
|
256 |
|
|
continue;
|
257 |
|
|
}
|
258 |
|
|
}else if(Detid.det()==DetId::Hcal){
|
259 |
|
|
Geom_temp = Geom_HCAL;
|
260 |
|
|
|
261 |
|
|
if(SubDet<1 || SubDet>4){
|
262 |
|
|
printf("Don't Save HcalEmpty, HcalTriggerTower, HcalOther\n");
|
263 |
|
|
continue;
|
264 |
|
|
}
|
265 |
|
|
}else{
|
266 |
|
|
continue;
|
267 |
|
|
}
|
268 |
|
|
|
269 |
|
|
const CaloCellGeometry* CellGeom = CaloGeom->getGeometry(Detid);
|
270 |
|
|
GlobalPoint CellPos = CellGeom->getPosition();
|
271 |
|
|
const CaloCellGeometry::CornersVec CellCorners = CellGeom->getCorners();
|
272 |
|
|
|
273 |
|
|
Geom_temp->Add_CaloDet(Detid.rawId(),
|
274 |
|
|
CellPos.x() , CellPos.y() , CellPos.z(),
|
275 |
|
|
CellCorners[0].x() , CellCorners[0].y() , CellCorners[0].z() ,
|
276 |
|
|
CellCorners[1].x() , CellCorners[1].y() , CellCorners[1].z() ,
|
277 |
|
|
CellCorners[2].x() , CellCorners[2].y() , CellCorners[2].z() ,
|
278 |
|
|
CellCorners[3].x() , CellCorners[3].y() , CellCorners[3].z() ,
|
279 |
|
|
CellCorners[4].x() , CellCorners[4].y() , CellCorners[4].z() ,
|
280 |
|
|
CellCorners[5].x() , CellCorners[5].y() , CellCorners[5].z() ,
|
281 |
|
|
CellCorners[6].x() , CellCorners[6].y() , CellCorners[6].z() ,
|
282 |
|
|
CellCorners[7].x() , CellCorners[7].y() , CellCorners[7].z() );
|
283 |
|
|
}
|
284 |
|
|
|
285 |
|
|
// ### MUON GEOMETRY ###
|
286 |
|
|
|
287 |
|
|
edm::ESHandle<DTGeometry> DtGeom;
|
288 |
|
|
iSetup.get<MuonGeometryRecord>().get( DtGeom );
|
289 |
|
|
const vector<GeomDet*> DtDets = DtGeom->dets();
|
290 |
|
|
|
291 |
|
|
edm::ESHandle<CSCGeometry> CscGeom;
|
292 |
|
|
iSetup.get<MuonGeometryRecord>().get( CscGeom );
|
293 |
|
|
const vector<GeomDet*> CscDets = CscGeom->dets();
|
294 |
|
|
|
295 |
|
|
edm::ESHandle<RPCGeometry> RpcGeom;
|
296 |
|
|
iSetup.get<MuonGeometryRecord>().get( RpcGeom );
|
297 |
|
|
const vector<GeomDet*> RpcDets = RpcGeom->dets();
|
298 |
|
|
|
299 |
|
|
vector<GeomDet*> MuonDets;
|
300 |
|
|
for(unsigned int i=0;i<DtDets.size() ;i++){MuonDets.push_back(DtDets [i]);}
|
301 |
|
|
for(unsigned int i=0;i<CscDets.size();i++){MuonDets.push_back(CscDets[i]);}
|
302 |
|
|
for(unsigned int i=0;i<RpcDets.size();i++){MuonDets.push_back(RpcDets[i]);}
|
303 |
|
|
|
304 |
|
|
|
305 |
|
|
for(unsigned int i=0;i<MuonDets.size();i++)
|
306 |
|
|
{
|
307 |
|
|
Detid = DetId(MuonDets[i]->geographicalId());
|
308 |
|
|
SubDet = Detid.subdetId();
|
309 |
|
|
|
310 |
|
|
GeomDet* DetUnit = MuonDets[i];
|
311 |
|
|
if(!DetUnit)continue;
|
312 |
|
|
const BoundPlane plane = DetUnit->surface();
|
313 |
|
|
const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
|
314 |
|
|
const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
|
315 |
|
|
|
316 |
|
|
float width = 0;
|
317 |
|
|
float length = 0;
|
318 |
|
|
float thickness = 0;
|
319 |
|
|
float TrapezoidalParam = 0;
|
320 |
|
|
|
321 |
|
|
if(trapezoidalBounds)
|
322 |
|
|
{
|
323 |
|
|
std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
|
324 |
|
|
width = parameters[0]*2;
|
325 |
|
|
length = parameters[3]*2;
|
326 |
|
|
thickness = (*trapezoidalBounds).thickness();
|
327 |
|
|
TrapezoidalParam = parameters[1]/parameters[0];
|
328 |
|
|
}else if(rectangularBounds){
|
329 |
|
|
width = DetUnit->surface().bounds().width();
|
330 |
|
|
length = DetUnit->surface().bounds().length();
|
331 |
|
|
thickness = DetUnit->surface().bounds().thickness();
|
332 |
|
|
TrapezoidalParam = 1;
|
333 |
|
|
}
|
334 |
|
|
|
335 |
|
|
Surface::GlobalPoint WidthVector = plane.toGlobal( LocalPoint(width/2, 0, 0) );
|
336 |
|
|
Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) );
|
337 |
|
|
Surface::GlobalPoint ThickVector = plane.toGlobal( LocalPoint(0, 0, thickness/2) );
|
338 |
|
|
|
339 |
|
|
GlobalVector Pos = GlobalVector(DetUnit->position().basicVector());
|
340 |
|
|
|
341 |
|
|
Geom_Muon->Add_TrackerDet(Detid.rawId(), TrapezoidalParam,
|
342 |
|
|
Pos.x(), Pos.y(), Pos.z(),
|
343 |
|
|
WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
|
344 |
|
|
LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
|
345 |
|
|
ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
|
346 |
|
|
}
|
347 |
|
|
|
348 |
|
|
|
349 |
|
|
// ### Save .geom ###
|
350 |
|
|
|
351 |
|
|
Geom_Tracker->Save("Tracker.geom");
|
352 |
|
|
Geom_ECAL ->Save("Ecal.geom");
|
353 |
|
|
Geom_HCAL ->Save("Hcal.geom");
|
354 |
|
|
Geom_Muon ->Save("Muon.geom");
|
355 |
|
|
|
356 |
|
|
}
|
357 |
|
|
|
358 |
|
|
// ------------ method called once each job just after ending the event loop ------------
|
359 |
|
|
void
|
360 |
|
|
Frog_Analyzer::endJob() {
|
361 |
|
|
|
362 |
|
|
MyEvents->Save((char*) OutputFile.c_str());
|
363 |
|
|
// MyEvents->Load((char*) OutputFile.c_str());
|
364 |
|
|
}
|
365 |
|
|
|
366 |
|
|
|
367 |
|
|
|
368 |
|
|
//
|
369 |
|
|
// member functions
|
370 |
|
|
//
|
371 |
|
|
|
372 |
|
|
// ------------ method called to for each event ------------
|
373 |
|
|
void
|
374 |
|
|
Frog_Analyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
|
375 |
|
|
{
|
376 |
|
|
MySimEvent* MyEvent = new MySimEvent;
|
377 |
|
|
|
378 |
querten |
1.2 |
// access the tracker
|
379 |
|
|
edm::ESHandle<TrackerGeometry> tkGeom;
|
380 |
|
|
iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
|
381 |
querten |
1.1 |
|
382 |
querten |
1.2 |
edm::ESHandle<DTGeometry> DtGeom;
|
383 |
|
|
iSetup.get<MuonGeometryRecord>().get( DtGeom );
|
384 |
|
|
|
385 |
|
|
edm::ESHandle<CSCGeometry> CscGeom;
|
386 |
|
|
iSetup.get<MuonGeometryRecord>().get( CscGeom );
|
387 |
querten |
1.1 |
|
388 |
querten |
1.2 |
edm::ESHandle<RPCGeometry> RpcGeom;
|
389 |
|
|
iSetup.get<MuonGeometryRecord>().get( RpcGeom );
|
390 |
querten |
1.1 |
|
391 |
|
|
|
392 |
|
|
// Save Data
|
393 |
querten |
1.2 |
// ### SIMTRACK ###
|
394 |
querten |
1.1 |
for(unsigned int i=0;i<SimTrackProducers.size();i++){
|
395 |
|
|
edm::Handle<std::vector< SimTrack > > h_SimTracks;
|
396 |
|
|
iEvent.getByLabel(SimTrackProducers[i], h_SimTracks);
|
397 |
|
|
std::vector< SimTrack > SimTrackColl = *h_SimTracks.product();
|
398 |
|
|
|
399 |
|
|
for ( unsigned int a = 0; a < SimTrackColl.size(); ++a ) {
|
400 |
|
|
MySimTrack MysimTrack;
|
401 |
|
|
SimTrack simTrack =SimTrackColl[a];
|
402 |
|
|
|
403 |
|
|
MysimTrack.track_id =simTrack.trackId();
|
404 |
|
|
MysimTrack.Type =simTrack.type();
|
405 |
|
|
MysimTrack.parent_vertex=simTrack.vertIndex();
|
406 |
|
|
MysimTrack.Px =simTrack.momentum().x();
|
407 |
|
|
MysimTrack.Py =simTrack.momentum().y();
|
408 |
|
|
MysimTrack.Pz =simTrack.momentum().z();
|
409 |
|
|
MysimTrack.E =simTrack.momentum().e();
|
410 |
|
|
MysimTrack.charge =simTrack.charge();
|
411 |
|
|
|
412 |
|
|
MyEvent->MySimTrackCollection.push_back(MysimTrack);
|
413 |
|
|
}
|
414 |
|
|
}
|
415 |
|
|
|
416 |
querten |
1.2 |
// ### SIMVERTEX ###
|
417 |
querten |
1.1 |
for(unsigned int i=0;i<SimVertexProducers.size();i++){
|
418 |
|
|
edm::Handle<std::vector< SimVertex > > h_Vertex;
|
419 |
|
|
iEvent.getByLabel(SimVertexProducers[i], h_Vertex);
|
420 |
|
|
std::vector< SimVertex > VertexColl = *h_Vertex.product();
|
421 |
|
|
|
422 |
|
|
for (unsigned int b = 0; b < VertexColl.size(); ++b ) {
|
423 |
|
|
MySimVertex MyVertex;
|
424 |
|
|
SimVertex Vertex = VertexColl[b];
|
425 |
|
|
|
426 |
|
|
MyVertex.parentTrack_id =Vertex.parentIndex ();
|
427 |
|
|
MyVertex.x =Vertex.position().x();
|
428 |
|
|
MyVertex.y =Vertex.position().y();
|
429 |
|
|
MyVertex.z =Vertex.position().z();
|
430 |
|
|
|
431 |
|
|
MyEvent->MySimVertexCollection.push_back(MyVertex);
|
432 |
|
|
}
|
433 |
|
|
}
|
434 |
|
|
|
435 |
querten |
1.2 |
// ### SIMHIT ###
|
436 |
querten |
1.1 |
for(unsigned int i=0;i<SimHitProducers.size();i++){
|
437 |
|
|
edm::Handle<std::vector< PSimHit > > h_Hits;
|
438 |
|
|
iEvent.getByLabel(SimHitProducers[i], h_Hits);
|
439 |
|
|
std::vector< PSimHit > Hits = *h_Hits.product();
|
440 |
|
|
|
441 |
|
|
for(unsigned int h=0; h<Hits.size(); h++)
|
442 |
|
|
{
|
443 |
querten |
1.2 |
DetId theDetUnitId(Hits[h].detUnitId());
|
444 |
|
|
const GeomDet* theDet = tkGeom->idToDet(theDetUnitId);
|
445 |
querten |
1.1 |
|
446 |
|
|
MyPSimHit Hit;
|
447 |
|
|
Hit.x = theDet->surface().toGlobal(Hits[h].localPosition()).x();
|
448 |
|
|
Hit.y = theDet->surface().toGlobal(Hits[h].localPosition()).y();
|
449 |
|
|
Hit.z = theDet->surface().toGlobal(Hits[h].localPosition()).z();
|
450 |
|
|
Hit.ProcessType = Hits[h].processType();
|
451 |
|
|
Hit.dEdX = Hits[h].energyLoss();
|
452 |
|
|
|
453 |
|
|
MyEvent->MyPSimHitCollection.push_back(Hit);
|
454 |
|
|
}
|
455 |
|
|
}
|
456 |
|
|
|
457 |
|
|
|
458 |
querten |
1.2 |
// ### TRACKS ###
|
459 |
querten |
1.1 |
for(unsigned int i=0;i<TrackProducers.size();i++){
|
460 |
|
|
edm::Handle<std::vector< reco::Track > > h_Tracks;
|
461 |
|
|
iEvent.getByLabel(TrackProducers[i], h_Tracks);
|
462 |
|
|
std::vector< reco::Track > TrackColl = *h_Tracks.product();
|
463 |
|
|
|
464 |
|
|
for ( unsigned int t = 0; t < TrackColl.size(); ++t ) {
|
465 |
|
|
MyRecoTrack MyrecoTrack;
|
466 |
|
|
reco::Track recoTrack =TrackColl[t];
|
467 |
|
|
|
468 |
|
|
for(unsigned int h=0;h<recoTrack.recHitsSize();h++){
|
469 |
|
|
TrackingRecHitRef h_it = recoTrack.recHit(h);
|
470 |
|
|
if(!h_it->isValid() )continue;
|
471 |
|
|
DetId detId = h_it->geographicalId();
|
472 |
querten |
1.2 |
const GeomDet * theDet = tkGeom->idToDet(detId);
|
473 |
querten |
1.1 |
LocalPoint localPos = h_it->localPosition();
|
474 |
|
|
|
475 |
|
|
MyRecoHit hit;
|
476 |
|
|
hit.x = theDet->surface().toGlobal(localPos).x();
|
477 |
|
|
hit.y = theDet->surface().toGlobal(localPos).y();
|
478 |
|
|
hit.z = theDet->surface().toGlobal(localPos).z();
|
479 |
|
|
hit.DetId = detId.rawId();
|
480 |
|
|
hit.Charge = -1;
|
481 |
|
|
MyrecoTrack.Hits.push_back(hit);
|
482 |
|
|
}
|
483 |
|
|
MyEvent->MyRecoTrackCollection.push_back(MyrecoTrack);
|
484 |
|
|
}
|
485 |
|
|
}
|
486 |
|
|
|
487 |
|
|
|
488 |
querten |
1.2 |
// ### ECALRecHits ###
|
489 |
querten |
1.1 |
for(unsigned int i=0;i<EcalRecHitProducers.size();i++){
|
490 |
|
|
edm::Handle<EcalRecHitCollection > h_Ecal_RecHits;
|
491 |
|
|
iEvent.getByLabel(EcalRecHitProducers[i], h_Ecal_RecHits);
|
492 |
|
|
EcalRecHitCollection Ecal_RecHits = *h_Ecal_RecHits.product();
|
493 |
|
|
|
494 |
|
|
for(unsigned int eh=0;eh<Ecal_RecHits.size();eh++){
|
495 |
|
|
MyCaloHit temp_EcalHit;
|
496 |
|
|
temp_EcalHit.E = Ecal_RecHits[eh].energy();
|
497 |
|
|
temp_EcalHit.t = Ecal_RecHits[eh].time();
|
498 |
|
|
temp_EcalHit.DetId = (Ecal_RecHits[eh].detid()).rawId();
|
499 |
|
|
|
500 |
|
|
MyEvent->MyEcalCaloHitCollection.push_back(temp_EcalHit);
|
501 |
|
|
}
|
502 |
|
|
}
|
503 |
|
|
|
504 |
|
|
|
505 |
querten |
1.2 |
// ### HCALRecHits ###
|
506 |
querten |
1.1 |
for(unsigned int i=0;i<HcalHBHERecHitProducers.size();i++){
|
507 |
|
|
edm::Handle<HBHERecHitCollection > h_HcalHBHE_RecHits;
|
508 |
|
|
iEvent.getByLabel(HcalHBHERecHitProducers[i], h_HcalHBHE_RecHits);
|
509 |
|
|
HBHERecHitCollection HcalHBHE_RecHits = *h_HcalHBHE_RecHits.product();
|
510 |
|
|
|
511 |
|
|
for(unsigned int hh=0;hh<HcalHBHE_RecHits.size();hh++){
|
512 |
|
|
MyCaloHit temp_HcalHBHEHit;
|
513 |
|
|
temp_HcalHBHEHit.E = HcalHBHE_RecHits[hh].energy();
|
514 |
|
|
temp_HcalHBHEHit.t = HcalHBHE_RecHits[hh].time();
|
515 |
|
|
temp_HcalHBHEHit.DetId = (HcalHBHE_RecHits[hh].detid()).rawId();
|
516 |
|
|
|
517 |
|
|
MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHBHEHit);
|
518 |
|
|
}
|
519 |
|
|
}
|
520 |
|
|
|
521 |
|
|
|
522 |
|
|
for(unsigned int i=0;i<HcalHORecHitProducers.size();i++){
|
523 |
|
|
edm::Handle<HORecHitCollection > h_HcalHO_RecHits;
|
524 |
|
|
iEvent.getByLabel(HcalHORecHitProducers[i], h_HcalHO_RecHits);
|
525 |
|
|
HORecHitCollection HcalHO_RecHits = *h_HcalHO_RecHits.product();
|
526 |
|
|
|
527 |
|
|
for(unsigned int hh=0;hh<HcalHO_RecHits.size();hh++){
|
528 |
|
|
MyCaloHit temp_HcalHOHit;
|
529 |
|
|
temp_HcalHOHit.E = HcalHO_RecHits[hh].energy();
|
530 |
|
|
temp_HcalHOHit.t = HcalHO_RecHits[hh].time();
|
531 |
|
|
temp_HcalHOHit.DetId = (HcalHO_RecHits[hh].detid()).rawId();
|
532 |
|
|
|
533 |
|
|
MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHOHit);
|
534 |
|
|
}
|
535 |
|
|
}
|
536 |
|
|
|
537 |
|
|
|
538 |
|
|
for(unsigned int i=0;i<HcalHFRecHitProducers.size();i++){
|
539 |
|
|
edm::Handle<HFRecHitCollection > h_HcalHF_RecHits;
|
540 |
|
|
iEvent.getByLabel(HcalHFRecHitProducers[i], h_HcalHF_RecHits);
|
541 |
|
|
HFRecHitCollection HcalHF_RecHits = *h_HcalHF_RecHits.product();
|
542 |
|
|
|
543 |
|
|
for(unsigned int hh=0;hh<HcalHF_RecHits.size();hh++){
|
544 |
|
|
MyCaloHit temp_HcalHFHit;
|
545 |
|
|
temp_HcalHFHit.E = HcalHF_RecHits[hh].energy();
|
546 |
|
|
temp_HcalHFHit.t = HcalHF_RecHits[hh].time();
|
547 |
|
|
temp_HcalHFHit.DetId = (HcalHF_RecHits[hh].detid()).rawId();
|
548 |
|
|
|
549 |
|
|
MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHFHit);
|
550 |
|
|
}
|
551 |
|
|
}
|
552 |
|
|
|
553 |
querten |
1.2 |
// ### Muon Segments ###
|
554 |
|
|
for(unsigned int i=0;i<CSCSegmentProducers.size();i++){
|
555 |
|
|
edm::Handle<CSCSegmentCollection > h_CSC_Segments;
|
556 |
|
|
iEvent.getByLabel(CSCSegmentProducers[i], h_CSC_Segments);
|
557 |
|
|
CSCSegmentCollection CSC_Segments = *h_CSC_Segments.product();
|
558 |
|
|
|
559 |
|
|
for(unsigned int s=0;s<CSC_Segments.size();s++){
|
560 |
|
|
DetId theDetUnitId = CSC_Segments[s].geographicalId();
|
561 |
|
|
const GeomDet* theDet = CscGeom->idToDet(theDetUnitId);
|
562 |
|
|
|
563 |
|
|
MyMuonSegment temp_CscSeg;
|
564 |
|
|
temp_CscSeg.DetId = theDetUnitId.rawId();
|
565 |
|
|
temp_CscSeg.PosX = theDet->surface().toGlobal(CSC_Segments[s].localPosition()).x();
|
566 |
|
|
temp_CscSeg.PosY = theDet->surface().toGlobal(CSC_Segments[s].localPosition()).y();
|
567 |
|
|
temp_CscSeg.PosZ = theDet->surface().toGlobal(CSC_Segments[s].localPosition()).z();
|
568 |
|
|
temp_CscSeg.DirX = theDet->surface().toGlobal(CSC_Segments[s].localDirection()).x();
|
569 |
|
|
temp_CscSeg.DirY = theDet->surface().toGlobal(CSC_Segments[s].localDirection()).y();
|
570 |
|
|
temp_CscSeg.DirZ = theDet->surface().toGlobal(CSC_Segments[s].localDirection()).z();
|
571 |
|
|
|
572 |
|
|
MyEvent->MyMuonSegmentCollection.push_back(temp_CscSeg);
|
573 |
|
|
}
|
574 |
|
|
}
|
575 |
|
|
|
576 |
|
|
for(unsigned int i=0;i<DTSegmentProducers.size();i++){
|
577 |
|
|
edm::Handle<DTRecSegment4DCollection > h_DT_Segments;
|
578 |
|
|
iEvent.getByLabel(DTSegmentProducers[i], h_DT_Segments);
|
579 |
|
|
DTRecSegment4DCollection DT_Segments = *h_DT_Segments.product();
|
580 |
|
|
|
581 |
|
|
for(unsigned int s=0;s<DT_Segments.size();s++){
|
582 |
|
|
DetId theDetUnitId = DT_Segments[s].geographicalId();
|
583 |
|
|
const GeomDet* theDet = DtGeom->idToDet(theDetUnitId);
|
584 |
|
|
|
585 |
|
|
MyMuonSegment temp_DtSeg;
|
586 |
|
|
temp_DtSeg.DetId = theDetUnitId.rawId();
|
587 |
|
|
temp_DtSeg.PosX = theDet->surface().toGlobal(DT_Segments[s].localPosition()).x();
|
588 |
|
|
temp_DtSeg.PosY = theDet->surface().toGlobal(DT_Segments[s].localPosition()).y();
|
589 |
|
|
temp_DtSeg.PosZ = theDet->surface().toGlobal(DT_Segments[s].localPosition()).z();
|
590 |
|
|
temp_DtSeg.DirX = theDet->surface().toGlobal(DT_Segments[s].localDirection()).x();
|
591 |
|
|
temp_DtSeg.DirY = theDet->surface().toGlobal(DT_Segments[s].localDirection()).y();
|
592 |
|
|
temp_DtSeg.DirZ = theDet->surface().toGlobal(DT_Segments[s].localDirection()).z();
|
593 |
|
|
|
594 |
|
|
MyEvent->MyMuonSegmentCollection.push_back(temp_DtSeg);
|
595 |
|
|
}
|
596 |
|
|
}
|
597 |
|
|
|
598 |
|
|
// ### Muon Hits ###
|
599 |
|
|
for(unsigned int i=0;i<RPCHitsProducers.size();i++){
|
600 |
|
|
edm::Handle<RPCRecHitCollection > h_RPC_Hits;
|
601 |
|
|
iEvent.getByLabel(RPCHitsProducers[i], h_RPC_Hits);
|
602 |
|
|
RPCRecHitCollection RPC_Hits = *h_RPC_Hits.product();
|
603 |
|
|
|
604 |
|
|
for(unsigned int h=0;h<RPC_Hits.size();h++){
|
605 |
|
|
DetId theDetUnitId = RPC_Hits[h].geographicalId();
|
606 |
|
|
const GeomDet* theDet = RpcGeom->idToDet(theDetUnitId);
|
607 |
|
|
|
608 |
|
|
MyMuonHit temp_RpcHit;
|
609 |
|
|
temp_RpcHit.DetId = theDetUnitId.rawId();
|
610 |
|
|
temp_RpcHit.x = theDet->surface().toGlobal(RPC_Hits[h].localPosition()).x();
|
611 |
|
|
temp_RpcHit.y = theDet->surface().toGlobal(RPC_Hits[h].localPosition()).y();
|
612 |
|
|
temp_RpcHit.z = theDet->surface().toGlobal(RPC_Hits[h].localPosition()).z();
|
613 |
|
|
|
614 |
|
|
MyEvent->MyMuonHitCollection.push_back(temp_RpcHit);
|
615 |
|
|
}
|
616 |
|
|
}
|
617 |
|
|
|
618 |
|
|
printf("RPC Hits = %i\n",MyEvent->MyMuonHitCollection.size());
|
619 |
|
|
|
620 |
querten |
1.1 |
MyEvents->Events.push_back(MyEvent);
|
621 |
|
|
}
|
622 |
|
|
|
623 |
|
|
|
624 |
|
|
//define this as a plug-in
|
625 |
|
|
DEFINE_FWK_MODULE(Frog_Analyzer);
|
626 |
|
|
|
627 |
|
|
|