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 |
|
|
// $Id: Frog_Analyzer.cc,v 1.19 2008/04/18 13:08:34 querten Exp $
|
17 |
|
|
//
|
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 |
|
|
|
65 |
|
|
#include "DataFormats/CaloRecHit/interface/CaloRecHit.h"
|
66 |
|
|
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
|
67 |
|
|
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
|
68 |
|
|
|
69 |
|
|
#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
|
70 |
|
|
#include "SimDataFormats/TrackingHit/interface/PSimHit.h"
|
71 |
|
|
#include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
|
72 |
|
|
#include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
|
73 |
|
|
#include "SimDataFormats/CaloHit/interface/PCaloHit.h"
|
74 |
|
|
#include "SimDataFormats/Track/interface/SimTrack.h"
|
75 |
|
|
#include "SimDataFormats/Vertex/interface/SimVertex.h"
|
76 |
|
|
|
77 |
|
|
#include "DataFormats/Provenance/interface/BranchDescription.h"
|
78 |
|
|
#include "DataFormats/Provenance/interface/Provenance.h"
|
79 |
|
|
#include "DataFormats/Candidate/interface/Candidate.h"
|
80 |
|
|
#include "DataFormats/HepMCCandidate/interface/GenParticleCandidate.h"
|
81 |
|
|
#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
|
82 |
|
|
#include "DataFormats/TrackReco/interface/Track.h"
|
83 |
|
|
|
84 |
|
|
#include "DataFormats/Math/interface/Point3D.h"
|
85 |
|
|
#include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
|
86 |
|
|
#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
|
87 |
|
|
|
88 |
|
|
#include "Visualisation/Frog/interface/SimEvent.h"
|
89 |
|
|
#include "Visualisation/Frog/interface/Geometry.h"
|
90 |
|
|
|
91 |
|
|
using namespace edm;
|
92 |
|
|
using namespace std;
|
93 |
|
|
|
94 |
|
|
//
|
95 |
|
|
// class decleration
|
96 |
|
|
//
|
97 |
|
|
|
98 |
|
|
class Frog_Analyzer : public edm::EDAnalyzer {
|
99 |
|
|
public:
|
100 |
|
|
explicit Frog_Analyzer(const edm::ParameterSet&);
|
101 |
|
|
~Frog_Analyzer();
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
private:
|
105 |
|
|
virtual void beginJob(const edm::EventSetup& iSetup);
|
106 |
|
|
virtual void analyze (const edm::Event&, const edm::EventSetup&);
|
107 |
|
|
virtual void endJob ();
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
MySimEvents* MyEvents;
|
111 |
|
|
Geometry* Geom_Tracker;
|
112 |
|
|
Geometry* Geom_ECAL;
|
113 |
|
|
Geometry* Geom_HCAL;
|
114 |
|
|
Geometry* Geom_Muon;
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
std::string OutputFile;
|
118 |
|
|
|
119 |
|
|
std::vector<InputTag> SimTrackProducers;
|
120 |
|
|
std::vector<InputTag> SimVertexProducers;
|
121 |
|
|
std::vector<InputTag> SimHitProducers;
|
122 |
|
|
|
123 |
|
|
std::vector<InputTag> TrackProducers;
|
124 |
|
|
std::vector<InputTag> EcalRecHitProducers;
|
125 |
|
|
std::vector<InputTag> HcalHBHERecHitProducers;
|
126 |
|
|
std::vector<InputTag> HcalHORecHitProducers;
|
127 |
|
|
std::vector<InputTag> HcalHFRecHitProducers;
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
// ----------member data ---------------------------
|
133 |
|
|
};
|
134 |
|
|
|
135 |
|
|
//
|
136 |
|
|
// constructors and destructor
|
137 |
|
|
//
|
138 |
|
|
Frog_Analyzer::Frog_Analyzer(const edm::ParameterSet& iConfig)
|
139 |
|
|
{
|
140 |
|
|
OutputFile = iConfig.getParameter<std::string >("OutputFile");
|
141 |
|
|
|
142 |
|
|
SimTrackProducers = iConfig.getParameter<std::vector<InputTag> >("SimTrackProducers");
|
143 |
|
|
SimVertexProducers = iConfig.getParameter<std::vector<InputTag> >("SimVertexProducers");
|
144 |
|
|
SimHitProducers = iConfig.getParameter<std::vector<InputTag> >("SimHitProducers");
|
145 |
|
|
|
146 |
|
|
TrackProducers = iConfig.getParameter<std::vector<InputTag> >("TrackProducers");
|
147 |
|
|
EcalRecHitProducers = iConfig.getParameter<std::vector<InputTag> >("EcalRecHitProducers");
|
148 |
|
|
HcalHBHERecHitProducers = iConfig.getParameter<std::vector<InputTag> >("HcalHBHERecHitProducers");
|
149 |
|
|
HcalHORecHitProducers = iConfig.getParameter<std::vector<InputTag> >("HcalHORecHitProducers");
|
150 |
|
|
HcalHFRecHitProducers = iConfig.getParameter<std::vector<InputTag> >("HcalHFRecHitProducers");
|
151 |
|
|
|
152 |
|
|
}
|
153 |
|
|
|
154 |
|
|
|
155 |
|
|
Frog_Analyzer::~Frog_Analyzer()
|
156 |
|
|
{
|
157 |
|
|
}
|
158 |
|
|
|
159 |
|
|
// ------------ method called once each job just before starting event loop ------------
|
160 |
|
|
void
|
161 |
|
|
Frog_Analyzer::beginJob(const edm::EventSetup& iSetup)
|
162 |
|
|
{
|
163 |
|
|
DetId Detid;
|
164 |
|
|
int SubDet;
|
165 |
|
|
|
166 |
|
|
MyEvents = new MySimEvents();
|
167 |
|
|
Geom_Tracker = new Geometry();
|
168 |
|
|
Geom_ECAL = new Geometry();
|
169 |
|
|
Geom_HCAL = new Geometry();
|
170 |
|
|
Geom_Muon = new Geometry();
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
// ### TRACKER GEOMETRY ###
|
174 |
|
|
|
175 |
|
|
edm::ESHandle<TrackerGeometry> tkGeom;
|
176 |
|
|
iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
|
177 |
|
|
vector<GeomDet*> TrackerDets = tkGeom->dets();
|
178 |
|
|
|
179 |
|
|
for(unsigned int i=0;i<TrackerDets.size();i++){
|
180 |
|
|
Detid = TrackerDets[i]->geographicalId();
|
181 |
|
|
// SubDet = Detid.subdetId();
|
182 |
|
|
|
183 |
|
|
GeomDet* DetUnit = TrackerDets[i];
|
184 |
|
|
if(!DetUnit)continue;
|
185 |
|
|
const BoundPlane plane = DetUnit->surface();
|
186 |
|
|
const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
|
187 |
|
|
const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
|
188 |
|
|
|
189 |
|
|
float width = 0;
|
190 |
|
|
float length = 0;
|
191 |
|
|
float thickness = 0;
|
192 |
|
|
float TrapezoidalParam = 0;
|
193 |
|
|
|
194 |
|
|
if(trapezoidalBounds)
|
195 |
|
|
{
|
196 |
|
|
std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
|
197 |
|
|
width = parameters[0]*2;
|
198 |
|
|
length = parameters[3]*2;
|
199 |
|
|
thickness = (*trapezoidalBounds).thickness();
|
200 |
|
|
TrapezoidalParam = parameters[1]/parameters[0];
|
201 |
|
|
}else if(rectangularBounds){
|
202 |
|
|
width = DetUnit->surface().bounds().width();
|
203 |
|
|
length = DetUnit->surface().bounds().length();
|
204 |
|
|
thickness = DetUnit->surface().bounds().thickness();
|
205 |
|
|
TrapezoidalParam = 1;
|
206 |
|
|
}
|
207 |
|
|
|
208 |
|
|
Surface::GlobalPoint WidthVector = plane.toGlobal( LocalPoint(width/2, 0, 0) );
|
209 |
|
|
Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) );
|
210 |
|
|
Surface::GlobalPoint ThickVector = plane.toGlobal( LocalPoint(0, 0, thickness/2) );
|
211 |
|
|
|
212 |
|
|
GlobalVector Pos = GlobalVector(DetUnit->position().basicVector());
|
213 |
|
|
|
214 |
|
|
Geom_Tracker->Add_TrackerDet(Detid.rawId(), TrapezoidalParam,
|
215 |
|
|
Pos.x(), Pos.y(), Pos.z(),
|
216 |
|
|
WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
|
217 |
|
|
LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
|
218 |
|
|
ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
|
219 |
|
|
|
220 |
|
|
|
221 |
|
|
}
|
222 |
|
|
|
223 |
|
|
|
224 |
|
|
// ### CALO GEOMETRY ###
|
225 |
|
|
|
226 |
|
|
edm::ESHandle<CaloGeometry> CaloGeom;
|
227 |
|
|
iSetup.get<IdealGeometryRecord>().get( CaloGeom );
|
228 |
|
|
const vector<DetId> CaloDets = CaloGeom->getValidDetIds();
|
229 |
|
|
|
230 |
|
|
for(unsigned int i=0;i<CaloDets.size();i++)
|
231 |
|
|
{
|
232 |
|
|
Detid = CaloDets[i];
|
233 |
|
|
SubDet = Detid.subdetId();
|
234 |
|
|
|
235 |
|
|
Geometry* Geom_temp = NULL;
|
236 |
|
|
if(Detid.det()==DetId::Ecal){
|
237 |
|
|
Geom_temp = Geom_ECAL;
|
238 |
|
|
|
239 |
|
|
if(SubDet<1 || SubDet>3){
|
240 |
|
|
printf("Don't Save EcalTriggerTower or EcalLaserPnDiode\n");
|
241 |
|
|
continue;
|
242 |
|
|
}
|
243 |
|
|
}else if(Detid.det()==DetId::Hcal){
|
244 |
|
|
Geom_temp = Geom_HCAL;
|
245 |
|
|
|
246 |
|
|
if(SubDet<1 || SubDet>4){
|
247 |
|
|
printf("Don't Save HcalEmpty, HcalTriggerTower, HcalOther\n");
|
248 |
|
|
continue;
|
249 |
|
|
}
|
250 |
|
|
}else{
|
251 |
|
|
continue;
|
252 |
|
|
}
|
253 |
|
|
|
254 |
|
|
const CaloCellGeometry* CellGeom = CaloGeom->getGeometry(Detid);
|
255 |
|
|
GlobalPoint CellPos = CellGeom->getPosition();
|
256 |
|
|
const CaloCellGeometry::CornersVec CellCorners = CellGeom->getCorners();
|
257 |
|
|
|
258 |
|
|
Geom_temp->Add_CaloDet(Detid.rawId(),
|
259 |
|
|
CellPos.x() , CellPos.y() , CellPos.z(),
|
260 |
|
|
CellCorners[0].x() , CellCorners[0].y() , CellCorners[0].z() ,
|
261 |
|
|
CellCorners[1].x() , CellCorners[1].y() , CellCorners[1].z() ,
|
262 |
|
|
CellCorners[2].x() , CellCorners[2].y() , CellCorners[2].z() ,
|
263 |
|
|
CellCorners[3].x() , CellCorners[3].y() , CellCorners[3].z() ,
|
264 |
|
|
CellCorners[4].x() , CellCorners[4].y() , CellCorners[4].z() ,
|
265 |
|
|
CellCorners[5].x() , CellCorners[5].y() , CellCorners[5].z() ,
|
266 |
|
|
CellCorners[6].x() , CellCorners[6].y() , CellCorners[6].z() ,
|
267 |
|
|
CellCorners[7].x() , CellCorners[7].y() , CellCorners[7].z() );
|
268 |
|
|
}
|
269 |
|
|
|
270 |
|
|
// ### MUON GEOMETRY ###
|
271 |
|
|
|
272 |
|
|
edm::ESHandle<DTGeometry> DtGeom;
|
273 |
|
|
iSetup.get<MuonGeometryRecord>().get( DtGeom );
|
274 |
|
|
const vector<GeomDet*> DtDets = DtGeom->dets();
|
275 |
|
|
|
276 |
|
|
edm::ESHandle<CSCGeometry> CscGeom;
|
277 |
|
|
iSetup.get<MuonGeometryRecord>().get( CscGeom );
|
278 |
|
|
const vector<GeomDet*> CscDets = CscGeom->dets();
|
279 |
|
|
|
280 |
|
|
edm::ESHandle<RPCGeometry> RpcGeom;
|
281 |
|
|
iSetup.get<MuonGeometryRecord>().get( RpcGeom );
|
282 |
|
|
const vector<GeomDet*> RpcDets = RpcGeom->dets();
|
283 |
|
|
|
284 |
|
|
vector<GeomDet*> MuonDets;
|
285 |
|
|
for(unsigned int i=0;i<DtDets.size() ;i++){MuonDets.push_back(DtDets [i]);}
|
286 |
|
|
for(unsigned int i=0;i<CscDets.size();i++){MuonDets.push_back(CscDets[i]);}
|
287 |
|
|
for(unsigned int i=0;i<RpcDets.size();i++){MuonDets.push_back(RpcDets[i]);}
|
288 |
|
|
|
289 |
|
|
|
290 |
|
|
for(unsigned int i=0;i<MuonDets.size();i++)
|
291 |
|
|
{
|
292 |
|
|
Detid = DetId(MuonDets[i]->geographicalId());
|
293 |
|
|
SubDet = Detid.subdetId();
|
294 |
|
|
|
295 |
|
|
GeomDet* DetUnit = MuonDets[i];
|
296 |
|
|
if(!DetUnit)continue;
|
297 |
|
|
const BoundPlane plane = DetUnit->surface();
|
298 |
|
|
const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
|
299 |
|
|
const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
|
300 |
|
|
|
301 |
|
|
float width = 0;
|
302 |
|
|
float length = 0;
|
303 |
|
|
float thickness = 0;
|
304 |
|
|
float TrapezoidalParam = 0;
|
305 |
|
|
|
306 |
|
|
if(trapezoidalBounds)
|
307 |
|
|
{
|
308 |
|
|
std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
|
309 |
|
|
width = parameters[0]*2;
|
310 |
|
|
length = parameters[3]*2;
|
311 |
|
|
thickness = (*trapezoidalBounds).thickness();
|
312 |
|
|
TrapezoidalParam = parameters[1]/parameters[0];
|
313 |
|
|
}else if(rectangularBounds){
|
314 |
|
|
width = DetUnit->surface().bounds().width();
|
315 |
|
|
length = DetUnit->surface().bounds().length();
|
316 |
|
|
thickness = DetUnit->surface().bounds().thickness();
|
317 |
|
|
TrapezoidalParam = 1;
|
318 |
|
|
}
|
319 |
|
|
|
320 |
|
|
Surface::GlobalPoint WidthVector = plane.toGlobal( LocalPoint(width/2, 0, 0) );
|
321 |
|
|
Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) );
|
322 |
|
|
Surface::GlobalPoint ThickVector = plane.toGlobal( LocalPoint(0, 0, thickness/2) );
|
323 |
|
|
|
324 |
|
|
GlobalVector Pos = GlobalVector(DetUnit->position().basicVector());
|
325 |
|
|
|
326 |
|
|
Geom_Muon->Add_TrackerDet(Detid.rawId(), TrapezoidalParam,
|
327 |
|
|
Pos.x(), Pos.y(), Pos.z(),
|
328 |
|
|
WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
|
329 |
|
|
LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
|
330 |
|
|
ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
|
331 |
|
|
}
|
332 |
|
|
|
333 |
|
|
|
334 |
|
|
// ### Save .geom ###
|
335 |
|
|
|
336 |
|
|
Geom_Tracker->Save("Tracker.geom");
|
337 |
|
|
Geom_ECAL ->Save("Ecal.geom");
|
338 |
|
|
Geom_HCAL ->Save("Hcal.geom");
|
339 |
|
|
|
340 |
|
|
printf("RPC = %i\n",Geom_Muon ->Det_Muon_RPC.size());
|
341 |
|
|
|
342 |
|
|
Geom_Muon ->Save("Muon.geom");
|
343 |
|
|
|
344 |
|
|
}
|
345 |
|
|
|
346 |
|
|
// ------------ method called once each job just after ending the event loop ------------
|
347 |
|
|
void
|
348 |
|
|
Frog_Analyzer::endJob() {
|
349 |
|
|
|
350 |
|
|
MyEvents->Save((char*) OutputFile.c_str());
|
351 |
|
|
// MyEvents->Load((char*) OutputFile.c_str());
|
352 |
|
|
}
|
353 |
|
|
|
354 |
|
|
|
355 |
|
|
|
356 |
|
|
//
|
357 |
|
|
// member functions
|
358 |
|
|
//
|
359 |
|
|
|
360 |
|
|
// ------------ method called to for each event ------------
|
361 |
|
|
void
|
362 |
|
|
Frog_Analyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
|
363 |
|
|
{
|
364 |
|
|
MySimEvent* MyEvent = new MySimEvent;
|
365 |
|
|
|
366 |
|
|
|
367 |
|
|
|
368 |
|
|
// access the tracker
|
369 |
|
|
edm::ESHandle<TrackerGeometry> theTrackerGeometry;
|
370 |
|
|
iSetup.get<TrackerDigiGeometryRecord>().get(theTrackerGeometry);
|
371 |
|
|
const TrackerGeometry& theTracker(*theTrackerGeometry);
|
372 |
|
|
|
373 |
|
|
// the DetUnits
|
374 |
|
|
TrackingGeometry::DetContainer theDetUnits = theTracker.dets();
|
375 |
|
|
|
376 |
|
|
|
377 |
|
|
// Save Data
|
378 |
|
|
for(unsigned int i=0;i<SimTrackProducers.size();i++){
|
379 |
|
|
edm::Handle<std::vector< SimTrack > > h_SimTracks;
|
380 |
|
|
iEvent.getByLabel(SimTrackProducers[i], h_SimTracks);
|
381 |
|
|
std::vector< SimTrack > SimTrackColl = *h_SimTracks.product();
|
382 |
|
|
|
383 |
|
|
for ( unsigned int a = 0; a < SimTrackColl.size(); ++a ) {
|
384 |
|
|
MySimTrack MysimTrack;
|
385 |
|
|
SimTrack simTrack =SimTrackColl[a];
|
386 |
|
|
|
387 |
|
|
MysimTrack.track_id =simTrack.trackId();
|
388 |
|
|
MysimTrack.Type =simTrack.type();
|
389 |
|
|
MysimTrack.parent_vertex=simTrack.vertIndex();
|
390 |
|
|
MysimTrack.Px =simTrack.momentum().x();
|
391 |
|
|
MysimTrack.Py =simTrack.momentum().y();
|
392 |
|
|
MysimTrack.Pz =simTrack.momentum().z();
|
393 |
|
|
MysimTrack.E =simTrack.momentum().e();
|
394 |
|
|
MysimTrack.charge =simTrack.charge();
|
395 |
|
|
|
396 |
|
|
MyEvent->MySimTrackCollection.push_back(MysimTrack);
|
397 |
|
|
}
|
398 |
|
|
}
|
399 |
|
|
|
400 |
|
|
|
401 |
|
|
for(unsigned int i=0;i<SimVertexProducers.size();i++){
|
402 |
|
|
edm::Handle<std::vector< SimVertex > > h_Vertex;
|
403 |
|
|
iEvent.getByLabel(SimVertexProducers[i], h_Vertex);
|
404 |
|
|
std::vector< SimVertex > VertexColl = *h_Vertex.product();
|
405 |
|
|
|
406 |
|
|
for (unsigned int b = 0; b < VertexColl.size(); ++b ) {
|
407 |
|
|
MySimVertex MyVertex;
|
408 |
|
|
SimVertex Vertex = VertexColl[b];
|
409 |
|
|
|
410 |
|
|
MyVertex.parentTrack_id =Vertex.parentIndex ();
|
411 |
|
|
MyVertex.x =Vertex.position().x();
|
412 |
|
|
MyVertex.y =Vertex.position().y();
|
413 |
|
|
MyVertex.z =Vertex.position().z();
|
414 |
|
|
|
415 |
|
|
MyEvent->MySimVertexCollection.push_back(MyVertex);
|
416 |
|
|
}
|
417 |
|
|
}
|
418 |
|
|
|
419 |
|
|
for(unsigned int i=0;i<SimHitProducers.size();i++){
|
420 |
|
|
edm::Handle<std::vector< PSimHit > > h_Hits;
|
421 |
|
|
iEvent.getByLabel(SimHitProducers[i], h_Hits);
|
422 |
|
|
std::vector< PSimHit > Hits = *h_Hits.product();
|
423 |
|
|
|
424 |
|
|
for(unsigned int h=0; h<Hits.size(); h++)
|
425 |
|
|
{
|
426 |
|
|
DetId theDetUnitId(Hits[h].detUnitId());
|
427 |
|
|
const GeomDet * theDet = theTracker.idToDet(theDetUnitId);
|
428 |
|
|
|
429 |
|
|
MyPSimHit Hit;
|
430 |
|
|
Hit.x = theDet->surface().toGlobal(Hits[h].localPosition()).x();
|
431 |
|
|
Hit.y = theDet->surface().toGlobal(Hits[h].localPosition()).y();
|
432 |
|
|
Hit.z = theDet->surface().toGlobal(Hits[h].localPosition()).z();
|
433 |
|
|
Hit.ProcessType = Hits[h].processType();
|
434 |
|
|
Hit.dEdX = Hits[h].energyLoss();
|
435 |
|
|
|
436 |
|
|
MyEvent->MyPSimHitCollection.push_back(Hit);
|
437 |
|
|
}
|
438 |
|
|
}
|
439 |
|
|
|
440 |
|
|
|
441 |
|
|
for(unsigned int i=0;i<TrackProducers.size();i++){
|
442 |
|
|
edm::Handle<std::vector< reco::Track > > h_Tracks;
|
443 |
|
|
iEvent.getByLabel(TrackProducers[i], h_Tracks);
|
444 |
|
|
std::vector< reco::Track > TrackColl = *h_Tracks.product();
|
445 |
|
|
|
446 |
|
|
for ( unsigned int t = 0; t < TrackColl.size(); ++t ) {
|
447 |
|
|
MyRecoTrack MyrecoTrack;
|
448 |
|
|
reco::Track recoTrack =TrackColl[t];
|
449 |
|
|
|
450 |
|
|
for(unsigned int h=0;h<recoTrack.recHitsSize();h++){
|
451 |
|
|
TrackingRecHitRef h_it = recoTrack.recHit(h);
|
452 |
|
|
if(!h_it->isValid() )continue;
|
453 |
|
|
DetId detId = h_it->geographicalId();
|
454 |
|
|
const GeomDet * theDet = theTracker.idToDet(detId);
|
455 |
|
|
LocalPoint localPos = h_it->localPosition();
|
456 |
|
|
|
457 |
|
|
MyRecoHit hit;
|
458 |
|
|
hit.x = theDet->surface().toGlobal(localPos).x();
|
459 |
|
|
hit.y = theDet->surface().toGlobal(localPos).y();
|
460 |
|
|
hit.z = theDet->surface().toGlobal(localPos).z();
|
461 |
|
|
hit.DetId = detId.rawId();
|
462 |
|
|
hit.Charge = -1;
|
463 |
|
|
MyrecoTrack.Hits.push_back(hit);
|
464 |
|
|
}
|
465 |
|
|
MyEvent->MyRecoTrackCollection.push_back(MyrecoTrack);
|
466 |
|
|
}
|
467 |
|
|
}
|
468 |
|
|
|
469 |
|
|
|
470 |
|
|
for(unsigned int i=0;i<EcalRecHitProducers.size();i++){
|
471 |
|
|
edm::Handle<EcalRecHitCollection > h_Ecal_RecHits;
|
472 |
|
|
iEvent.getByLabel(EcalRecHitProducers[i], h_Ecal_RecHits);
|
473 |
|
|
EcalRecHitCollection Ecal_RecHits = *h_Ecal_RecHits.product();
|
474 |
|
|
|
475 |
|
|
for(unsigned int eh=0;eh<Ecal_RecHits.size();eh++){
|
476 |
|
|
MyCaloHit temp_EcalHit;
|
477 |
|
|
temp_EcalHit.E = Ecal_RecHits[eh].energy();
|
478 |
|
|
temp_EcalHit.t = Ecal_RecHits[eh].time();
|
479 |
|
|
temp_EcalHit.DetId = (Ecal_RecHits[eh].detid()).rawId();
|
480 |
|
|
|
481 |
|
|
MyEvent->MyEcalCaloHitCollection.push_back(temp_EcalHit);
|
482 |
|
|
}
|
483 |
|
|
}
|
484 |
|
|
|
485 |
|
|
|
486 |
|
|
for(unsigned int i=0;i<HcalHBHERecHitProducers.size();i++){
|
487 |
|
|
edm::Handle<HBHERecHitCollection > h_HcalHBHE_RecHits;
|
488 |
|
|
iEvent.getByLabel(HcalHBHERecHitProducers[i], h_HcalHBHE_RecHits);
|
489 |
|
|
HBHERecHitCollection HcalHBHE_RecHits = *h_HcalHBHE_RecHits.product();
|
490 |
|
|
|
491 |
|
|
for(unsigned int hh=0;hh<HcalHBHE_RecHits.size();hh++){
|
492 |
|
|
MyCaloHit temp_HcalHBHEHit;
|
493 |
|
|
temp_HcalHBHEHit.E = HcalHBHE_RecHits[hh].energy();
|
494 |
|
|
temp_HcalHBHEHit.t = HcalHBHE_RecHits[hh].time();
|
495 |
|
|
temp_HcalHBHEHit.DetId = (HcalHBHE_RecHits[hh].detid()).rawId();
|
496 |
|
|
|
497 |
|
|
MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHBHEHit);
|
498 |
|
|
}
|
499 |
|
|
}
|
500 |
|
|
|
501 |
|
|
|
502 |
|
|
for(unsigned int i=0;i<HcalHORecHitProducers.size();i++){
|
503 |
|
|
edm::Handle<HORecHitCollection > h_HcalHO_RecHits;
|
504 |
|
|
iEvent.getByLabel(HcalHORecHitProducers[i], h_HcalHO_RecHits);
|
505 |
|
|
HORecHitCollection HcalHO_RecHits = *h_HcalHO_RecHits.product();
|
506 |
|
|
|
507 |
|
|
for(unsigned int hh=0;hh<HcalHO_RecHits.size();hh++){
|
508 |
|
|
MyCaloHit temp_HcalHOHit;
|
509 |
|
|
temp_HcalHOHit.E = HcalHO_RecHits[hh].energy();
|
510 |
|
|
temp_HcalHOHit.t = HcalHO_RecHits[hh].time();
|
511 |
|
|
temp_HcalHOHit.DetId = (HcalHO_RecHits[hh].detid()).rawId();
|
512 |
|
|
|
513 |
|
|
MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHOHit);
|
514 |
|
|
}
|
515 |
|
|
}
|
516 |
|
|
|
517 |
|
|
|
518 |
|
|
for(unsigned int i=0;i<HcalHFRecHitProducers.size();i++){
|
519 |
|
|
edm::Handle<HFRecHitCollection > h_HcalHF_RecHits;
|
520 |
|
|
iEvent.getByLabel(HcalHFRecHitProducers[i], h_HcalHF_RecHits);
|
521 |
|
|
HFRecHitCollection HcalHF_RecHits = *h_HcalHF_RecHits.product();
|
522 |
|
|
|
523 |
|
|
for(unsigned int hh=0;hh<HcalHF_RecHits.size();hh++){
|
524 |
|
|
MyCaloHit temp_HcalHFHit;
|
525 |
|
|
temp_HcalHFHit.E = HcalHF_RecHits[hh].energy();
|
526 |
|
|
temp_HcalHFHit.t = HcalHF_RecHits[hh].time();
|
527 |
|
|
temp_HcalHFHit.DetId = (HcalHF_RecHits[hh].detid()).rawId();
|
528 |
|
|
|
529 |
|
|
MyEvent->MyHcalCaloHitCollection.push_back(temp_HcalHFHit);
|
530 |
|
|
}
|
531 |
|
|
}
|
532 |
|
|
|
533 |
|
|
MyEvents->Events.push_back(MyEvent);
|
534 |
|
|
}
|
535 |
|
|
|
536 |
|
|
|
537 |
|
|
//define this as a plug-in
|
538 |
|
|
DEFINE_FWK_MODULE(Frog_Analyzer);
|
539 |
|
|
|
540 |
|
|
|