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.32 |
// $Id: Frog_Analyzer.cc,v 1.31 2008/08/22 12:37:32 roberfro 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 |
querten |
1.28 |
//#include "Geometry/EcalBarrelAlgo/interface/EcalBarrelGeometry.h"
|
53 |
|
|
//#include "Geometry/EcalEndcapAlgo/interface/EcalEndcapGeometry.h"
|
54 |
|
|
#include "Geometry/Records/interface/CaloGeometryRecord.h"
|
55 |
|
|
#include "Geometry/EcalAlgo/interface/EcalBarrelGeometry.h"
|
56 |
|
|
#include "Geometry/EcalAlgo/interface/EcalEndcapGeometry.h"
|
57 |
querten |
1.1 |
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
|
58 |
|
|
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
|
59 |
|
|
|
60 |
|
|
#include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
|
61 |
|
|
#include "Geometry/Records/interface/MuonGeometryRecord.h"
|
62 |
|
|
#include "Geometry/DTGeometry/interface/DTGeometry.h"
|
63 |
|
|
#include "Geometry/CSCGeometry/interface/CSCGeometry.h"
|
64 |
|
|
#include "Geometry/RPCGeometry/interface/RPCGeometry.h"
|
65 |
|
|
|
66 |
|
|
|
67 |
|
|
#include "DataFormats/CaloRecHit/interface/CaloRecHit.h"
|
68 |
|
|
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
|
69 |
|
|
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
|
70 |
|
|
|
71 |
|
|
#include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
|
72 |
|
|
#include "SimDataFormats/TrackingHit/interface/PSimHit.h"
|
73 |
|
|
#include "SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
|
74 |
|
|
#include "SimDataFormats/CrossingFrame/interface/MixCollection.h"
|
75 |
|
|
#include "SimDataFormats/CaloHit/interface/PCaloHit.h"
|
76 |
|
|
#include "SimDataFormats/Track/interface/SimTrack.h"
|
77 |
|
|
#include "SimDataFormats/Vertex/interface/SimVertex.h"
|
78 |
|
|
|
79 |
|
|
#include "DataFormats/Provenance/interface/BranchDescription.h"
|
80 |
|
|
#include "DataFormats/Provenance/interface/Provenance.h"
|
81 |
|
|
#include "DataFormats/Candidate/interface/Candidate.h"
|
82 |
|
|
#include "DataFormats/HepMCCandidate/interface/GenParticleCandidate.h"
|
83 |
|
|
#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
|
84 |
|
|
#include "DataFormats/TrackReco/interface/Track.h"
|
85 |
roberfro |
1.5 |
#include "TrackingTools/PatternTools/interface/Trajectory.h"
|
86 |
querten |
1.6 |
#include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
|
87 |
|
|
|
88 |
querten |
1.1 |
|
89 |
querten |
1.2 |
#include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
|
90 |
|
|
#include "DataFormats/CSCRecHit/interface/CSCSegmentCollection.h"
|
91 |
|
|
|
92 |
|
|
#include "DataFormats/DTRecHit/interface/DTRecHitCollection.h"
|
93 |
|
|
#include "DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h"
|
94 |
|
|
#include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h"
|
95 |
|
|
|
96 |
querten |
1.1 |
#include "DataFormats/Math/interface/Point3D.h"
|
97 |
|
|
#include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
|
98 |
|
|
#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
|
99 |
|
|
|
100 |
querten |
1.11 |
#include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
|
101 |
|
|
#include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
|
102 |
|
|
#include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
|
103 |
|
|
#include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
|
104 |
|
|
#include "DataFormats/SiStripDetId/interface/TIBDetId.h"
|
105 |
|
|
#include "DataFormats/SiStripDetId/interface/TIDDetId.h"
|
106 |
|
|
#include "DataFormats/SiStripDetId/interface/TOBDetId.h"
|
107 |
|
|
#include "DataFormats/SiStripDetId/interface/TECDetId.h"
|
108 |
|
|
|
109 |
|
|
#include "DataFormats/MuonDetId/interface/DTChamberId.h"
|
110 |
|
|
#include "DataFormats/MuonDetId/interface/CSCDetId.h"
|
111 |
|
|
#include "DataFormats/MuonDetId/interface/RPCDetId.h"
|
112 |
|
|
|
113 |
|
|
#include "DataFormats/EcalDetId/interface/EBDetId.h"
|
114 |
|
|
#include "DataFormats/EcalDetId/interface/EEDetId.h"
|
115 |
|
|
#include "DataFormats/EcalDetId/interface/ESDetId.h"
|
116 |
|
|
#include "DataFormats/HcalDetId/interface/HcalDetId.h"
|
117 |
|
|
|
118 |
querten |
1.28 |
#include "DataFormats/VertexReco/interface/NuclearInteraction.h"
|
119 |
|
|
|
120 |
|
|
#include "DataFormats/JetReco/interface/Jet.h"
|
121 |
|
|
#include "DataFormats/JetReco/interface/BasicJetCollection.h"
|
122 |
|
|
#include "DataFormats/JetReco/interface/GenJetCollection.h"
|
123 |
|
|
#include "DataFormats/JetReco/interface/CaloJetCollection.h"
|
124 |
|
|
#include "DataFormats/JetReco/interface/PFJetCollection.h"
|
125 |
|
|
|
126 |
querten |
1.11 |
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Base_With_DetId.h"
|
127 |
|
|
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Tools.h"
|
128 |
|
|
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Tools.cpp"
|
129 |
roberfro |
1.13 |
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Event_Track.h"
|
130 |
|
|
|
131 |
|
|
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Events.h"
|
132 |
|
|
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Events.cpp"
|
133 |
|
|
|
134 |
|
|
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Geometry.h"
|
135 |
|
|
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Geometry.cpp"
|
136 |
querten |
1.11 |
|
137 |
roberfro |
1.13 |
#include "Visualisation/Frog/soft/Includes/FROG/FROG_DetId.h"
|
138 |
querten |
1.18 |
#include "Visualisation/Frog/soft/Includes/FROG/FROG_ReadCards.cpp"
|
139 |
querten |
1.28 |
#include "Visualisation/Frog/soft/Includes/FROG/FROG_Element_Event_NuclInt.h"
|
140 |
querten |
1.27 |
|
141 |
querten |
1.1 |
|
142 |
roberfro |
1.24 |
|
143 |
querten |
1.1 |
using namespace edm;
|
144 |
|
|
using namespace std;
|
145 |
querten |
1.28 |
using namespace reco;
|
146 |
querten |
1.1 |
|
147 |
|
|
//
|
148 |
|
|
// class decleration
|
149 |
|
|
//
|
150 |
|
|
|
151 |
|
|
class Frog_Analyzer : public edm::EDAnalyzer {
|
152 |
|
|
public:
|
153 |
|
|
explicit Frog_Analyzer(const edm::ParameterSet&);
|
154 |
|
|
~Frog_Analyzer();
|
155 |
|
|
|
156 |
|
|
|
157 |
|
|
private:
|
158 |
|
|
virtual void beginJob(const edm::EventSetup& iSetup);
|
159 |
|
|
virtual void analyze (const edm::Event&, const edm::EventSetup&);
|
160 |
|
|
virtual void endJob ();
|
161 |
|
|
|
162 |
querten |
1.15 |
FROG_Element_Base* events_prim;
|
163 |
querten |
1.1 |
|
164 |
querten |
1.11 |
std::string OutputFile;
|
165 |
querten |
1.1 |
|
166 |
|
|
std::vector<InputTag> SimTrackProducers;
|
167 |
|
|
std::vector<InputTag> SimVertexProducers;
|
168 |
|
|
std::vector<InputTag> SimHitProducers;
|
169 |
querten |
1.25 |
std::vector<InputTag> SimCaloHitProducers;
|
170 |
|
|
|
171 |
roberfro |
1.24 |
std::vector<InputTag> NIProducers;
|
172 |
querten |
1.1 |
|
173 |
querten |
1.9 |
std::vector<InputTag> TrackProducers;
|
174 |
roberfro |
1.5 |
std::vector<InputTag> TrajectoryProducers;
|
175 |
querten |
1.1 |
std::vector<InputTag> EcalRecHitProducers;
|
176 |
|
|
std::vector<InputTag> HcalHBHERecHitProducers;
|
177 |
|
|
std::vector<InputTag> HcalHORecHitProducers;
|
178 |
|
|
std::vector<InputTag> HcalHFRecHitProducers;
|
179 |
querten |
1.2 |
std::vector<InputTag> DTSegmentProducers;
|
180 |
|
|
std::vector<InputTag> CSCSegmentProducers;
|
181 |
|
|
|
182 |
|
|
std::vector<InputTag> RPCHitsProducers;
|
183 |
querten |
1.1 |
|
184 |
querten |
1.28 |
std::vector<InputTag> CaloJetsProducers;
|
185 |
|
|
|
186 |
querten |
1.22 |
// ----------member data ---------------------------
|
187 |
|
|
|
188 |
|
|
bool ProduceGeom;
|
189 |
|
|
int NEventsInVisFile;
|
190 |
|
|
int NEvents;
|
191 |
querten |
1.1 |
|
192 |
querten |
1.22 |
unsigned int SRun;
|
193 |
|
|
unsigned int SEvent;
|
194 |
querten |
1.1 |
};
|
195 |
|
|
|
196 |
|
|
//
|
197 |
|
|
// constructors and destructor
|
198 |
|
|
//
|
199 |
|
|
Frog_Analyzer::Frog_Analyzer(const edm::ParameterSet& iConfig)
|
200 |
|
|
{
|
201 |
|
|
OutputFile = iConfig.getParameter<std::string >("OutputFile");
|
202 |
|
|
|
203 |
|
|
SimTrackProducers = iConfig.getParameter<std::vector<InputTag> >("SimTrackProducers");
|
204 |
|
|
SimVertexProducers = iConfig.getParameter<std::vector<InputTag> >("SimVertexProducers");
|
205 |
|
|
SimHitProducers = iConfig.getParameter<std::vector<InputTag> >("SimHitProducers");
|
206 |
querten |
1.25 |
SimCaloHitProducers = iConfig.getParameter<std::vector<InputTag> >("SimCaloHitProducers");
|
207 |
|
|
|
208 |
querten |
1.1 |
|
209 |
querten |
1.10 |
TrackProducers = iConfig.getParameter<std::vector<InputTag> >("TrackProducers");
|
210 |
querten |
1.9 |
TrajectoryProducers = iConfig.getParameter<std::vector<InputTag> >("TrajectoryProducers");
|
211 |
querten |
1.1 |
EcalRecHitProducers = iConfig.getParameter<std::vector<InputTag> >("EcalRecHitProducers");
|
212 |
|
|
HcalHBHERecHitProducers = iConfig.getParameter<std::vector<InputTag> >("HcalHBHERecHitProducers");
|
213 |
|
|
HcalHORecHitProducers = iConfig.getParameter<std::vector<InputTag> >("HcalHORecHitProducers");
|
214 |
|
|
HcalHFRecHitProducers = iConfig.getParameter<std::vector<InputTag> >("HcalHFRecHitProducers");
|
215 |
|
|
|
216 |
roberfro |
1.24 |
NIProducers = iConfig.getParameter<std::vector<InputTag> >("NIProducers");
|
217 |
|
|
|
218 |
querten |
1.2 |
DTSegmentProducers = iConfig.getParameter<std::vector<InputTag> >("DTSegmentProducers");
|
219 |
|
|
CSCSegmentProducers = iConfig.getParameter<std::vector<InputTag> >("CSCSegmentProducers");
|
220 |
|
|
|
221 |
|
|
RPCHitsProducers = iConfig.getParameter<std::vector<InputTag> >("RPCHitsProducers");
|
222 |
|
|
|
223 |
querten |
1.28 |
CaloJetsProducers = iConfig.getParameter<std::vector<InputTag> >("CaloJetsProducers");
|
224 |
|
|
|
225 |
querten |
1.22 |
ProduceGeom = iConfig.getParameter<bool >("ProduceGeom" );
|
226 |
|
|
NEventsInVisFile = iConfig.getParameter<int >("NEventsInVisFile" );
|
227 |
|
|
|
228 |
|
|
NEvents = 0;
|
229 |
querten |
1.1 |
}
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
Frog_Analyzer::~Frog_Analyzer()
|
233 |
|
|
{
|
234 |
|
|
}
|
235 |
|
|
|
236 |
|
|
// ------------ method called once each job just before starting event loop ------------
|
237 |
|
|
void
|
238 |
|
|
Frog_Analyzer::beginJob(const edm::EventSetup& iSetup)
|
239 |
|
|
{
|
240 |
querten |
1.22 |
if(ProduceGeom){
|
241 |
|
|
DetId Detid;
|
242 |
|
|
unsigned int SubDet;
|
243 |
|
|
|
244 |
|
|
unsigned int Frog_DetId;
|
245 |
|
|
FROG_Element_Base* FEB = NULL;
|
246 |
|
|
FROG_Element_Base_With_DetId* FEB_Temp = NULL;
|
247 |
|
|
|
248 |
|
|
FROG_Element_Base* prim = new FROG_Element_Base(C_PRIMARY);
|
249 |
|
|
FROG_Element_Base* geom = new FROG_Element_Base(C_GEOMETRY); prim->addDaughter(geom);
|
250 |
|
|
FROG_Element_Base_With_DetId* tracker = new FROG_Element_Base_With_DetId(C_FEB_DETID, DETID_TRK); geom->addDaughter(tracker);
|
251 |
|
|
FROG_Element_Base_With_DetId* muon = new FROG_Element_Base_With_DetId(C_FEB_DETID, DETID_MUON); geom->addDaughter(muon);
|
252 |
|
|
FROG_Element_Base_With_DetId* ecal = new FROG_Element_Base_With_DetId(C_FEB_DETID, DETID_ECAL); geom->addDaughter(ecal);
|
253 |
|
|
FROG_Element_Base_With_DetId* hcal = new FROG_Element_Base_With_DetId(C_FEB_DETID, DETID_HCAL); geom->addDaughter(hcal);
|
254 |
|
|
|
255 |
|
|
|
256 |
|
|
// ### TRACKER GEOMETRY ###
|
257 |
|
|
|
258 |
|
|
edm::ESHandle<TrackerGeometry> tkGeom;
|
259 |
|
|
iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
|
260 |
|
|
vector<GeomDet*> TrackerDets = tkGeom->dets();
|
261 |
|
|
|
262 |
|
|
for(unsigned int i=0;i<TrackerDets.size();i++){
|
263 |
|
|
Detid = TrackerDets[i]->geographicalId();
|
264 |
|
|
SubDet = Detid.subdetId();
|
265 |
|
|
if(SubDet<1 || SubDet>6) continue;
|
266 |
querten |
1.11 |
|
267 |
querten |
1.1 |
|
268 |
querten |
1.22 |
GeomDet* DetUnit = TrackerDets[i];
|
269 |
|
|
if(!DetUnit)continue;
|
270 |
|
|
const BoundPlane plane = DetUnit->surface();
|
271 |
|
|
const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
|
272 |
|
|
const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
|
273 |
|
|
|
274 |
|
|
float width = 0;
|
275 |
|
|
float length = 0;
|
276 |
|
|
float thickness = 0;
|
277 |
|
|
float TrapezoidalParam = 0;
|
278 |
|
|
|
279 |
|
|
if(trapezoidalBounds){
|
280 |
|
|
std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
|
281 |
|
|
width = parameters[0]*2;
|
282 |
|
|
length = parameters[3]*2;
|
283 |
|
|
thickness = (*trapezoidalBounds).thickness();
|
284 |
|
|
TrapezoidalParam = parameters[1]/parameters[0];
|
285 |
|
|
}else if(rectangularBounds){
|
286 |
|
|
width = DetUnit->surface().bounds().width();
|
287 |
|
|
length = DetUnit->surface().bounds().length();
|
288 |
|
|
thickness = DetUnit->surface().bounds().thickness();
|
289 |
|
|
TrapezoidalParam = 1;
|
290 |
|
|
}
|
291 |
querten |
1.1 |
|
292 |
querten |
1.22 |
Surface::GlobalPoint WidthVector = plane.toGlobal( LocalPoint(width/2, 0, 0) );
|
293 |
|
|
Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) );
|
294 |
|
|
Surface::GlobalPoint ThickVector = plane.toGlobal( LocalPoint(0, 0, thickness/2) );
|
295 |
|
|
|
296 |
|
|
GlobalVector Pos = GlobalVector(DetUnit->position().basicVector());
|
297 |
|
|
|
298 |
|
|
FROG_Element_Geom_TrackerMod* mod = new FROG_Element_Geom_TrackerMod(
|
299 |
|
|
Detid.rawId(), TrapezoidalParam,
|
300 |
|
|
Pos.x(), Pos.y(), Pos.z(),
|
301 |
|
|
WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
|
302 |
|
|
LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
|
303 |
|
|
ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
|
304 |
querten |
1.1 |
|
305 |
|
|
|
306 |
querten |
1.22 |
Frog_DetId = DETID_TRK;
|
307 |
|
|
FEB = tracker;
|
308 |
querten |
1.11 |
|
309 |
querten |
1.22 |
Frog_DetId += SubDet*100000;
|
310 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
311 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
312 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
313 |
|
|
|
314 |
querten |
1.22 |
if(SubDet==PixelSubdetector::PixelBarrel){
|
315 |
|
|
PXBDetId detid = PXBDetId(Detid);
|
316 |
querten |
1.11 |
|
317 |
querten |
1.22 |
Frog_DetId += detid.layer()*10000;
|
318 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
319 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
320 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
321 |
querten |
1.11 |
|
322 |
querten |
1.22 |
Frog_DetId += detid.ladder()*100;
|
323 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
324 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
325 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
326 |
|
|
}else if(SubDet==PixelSubdetector::PixelEndcap){
|
327 |
|
|
PXFDetId detid = PXFDetId(Detid);
|
328 |
querten |
1.11 |
|
329 |
querten |
1.22 |
Frog_DetId += detid.side()*10000;
|
330 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
331 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
332 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
333 |
querten |
1.11 |
|
334 |
querten |
1.22 |
Frog_DetId += detid.disk()*1000;
|
335 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
336 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
337 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
338 |
querten |
1.11 |
|
339 |
querten |
1.22 |
Frog_DetId += detid.blade()*10;
|
340 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
341 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
342 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
343 |
querten |
1.11 |
|
344 |
querten |
1.22 |
Frog_DetId += detid.panel()*1;
|
345 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
346 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
347 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
348 |
|
|
}else if(SubDet==StripSubdetector::TIB){
|
349 |
|
|
TIBDetId detid = TIBDetId(Detid);
|
350 |
querten |
1.11 |
|
351 |
querten |
1.22 |
Frog_DetId += detid.layer()*10000;
|
352 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
353 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
354 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
355 |
querten |
1.11 |
|
356 |
querten |
1.22 |
Frog_DetId += detid.stringNumber()*100;
|
357 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
358 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
359 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
360 |
|
|
}else if(SubDet==StripSubdetector::TID){
|
361 |
|
|
TIDDetId detid = TIDDetId(Detid);
|
362 |
querten |
1.11 |
|
363 |
querten |
1.22 |
Frog_DetId += detid.side()*10000;
|
364 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
365 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
366 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
367 |
querten |
1.11 |
|
368 |
querten |
1.22 |
Frog_DetId += detid.wheel()*1000;
|
369 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
370 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
371 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
372 |
|
|
|
373 |
|
|
Frog_DetId += detid.ring()*10;
|
374 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
375 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
376 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
377 |
|
|
}else if(SubDet==StripSubdetector::TOB){
|
378 |
|
|
TOBDetId detid = TOBDetId(Detid);
|
379 |
querten |
1.11 |
|
380 |
querten |
1.22 |
Frog_DetId += detid.layer()*10000;
|
381 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
382 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
383 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
384 |
querten |
1.11 |
|
385 |
querten |
1.22 |
Frog_DetId += detid.rodNumber()*100;
|
386 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
387 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
388 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
389 |
|
|
}else if(SubDet==StripSubdetector::TEC){
|
390 |
|
|
TECDetId detid = TECDetId(Detid);
|
391 |
querten |
1.11 |
|
392 |
querten |
1.22 |
Frog_DetId += detid.side()*10000;
|
393 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
394 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
395 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
396 |
querten |
1.11 |
|
397 |
querten |
1.22 |
Frog_DetId += detid.wheel()*1000;
|
398 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
399 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
400 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
401 |
querten |
1.1 |
|
402 |
querten |
1.22 |
Frog_DetId += detid.ring()*10;
|
403 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
404 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
405 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
406 |
querten |
1.22 |
|
407 |
|
|
Frog_DetId += detid.petalNumber();
|
408 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
409 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
410 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
411 |
querten |
1.22 |
}else{
|
412 |
|
|
if(mod)delete mod;
|
413 |
|
|
continue;
|
414 |
querten |
1.11 |
}
|
415 |
querten |
1.22 |
FEB->addDaughter(mod);
|
416 |
|
|
}
|
417 |
querten |
1.11 |
|
418 |
|
|
|
419 |
querten |
1.22 |
// ### MUON GEOMETRY ###
|
420 |
querten |
1.11 |
|
421 |
querten |
1.22 |
edm::ESHandle<DTGeometry> DtGeom;
|
422 |
|
|
iSetup.get<MuonGeometryRecord>().get( DtGeom );
|
423 |
|
|
const vector<GeomDet*> DtDets = DtGeom->dets();
|
424 |
|
|
|
425 |
|
|
edm::ESHandle<CSCGeometry> CscGeom;
|
426 |
|
|
iSetup.get<MuonGeometryRecord>().get( CscGeom );
|
427 |
|
|
const vector<GeomDet*> CscDets = CscGeom->dets();
|
428 |
|
|
|
429 |
|
|
edm::ESHandle<RPCGeometry> RpcGeom;
|
430 |
|
|
iSetup.get<MuonGeometryRecord>().get( RpcGeom );
|
431 |
|
|
const vector<GeomDet*> RpcDets = RpcGeom->dets();
|
432 |
|
|
|
433 |
|
|
vector<GeomDet*> MuonDets;
|
434 |
|
|
for(unsigned int i=0;i<DtDets.size() ;i++){MuonDets.push_back(DtDets [i]);}
|
435 |
|
|
for(unsigned int i=0;i<CscDets.size();i++){MuonDets.push_back(CscDets[i]);}
|
436 |
|
|
for(unsigned int i=0;i<RpcDets.size();i++){MuonDets.push_back(RpcDets[i]);}
|
437 |
querten |
1.1 |
|
438 |
querten |
1.22 |
for(unsigned int i=0;i<MuonDets.size();i++)
|
439 |
|
|
{
|
440 |
|
|
Detid = DetId(MuonDets[i]->geographicalId());
|
441 |
|
|
SubDet = Detid.subdetId();
|
442 |
querten |
1.1 |
|
443 |
querten |
1.22 |
GeomDet* DetUnit = MuonDets[i];
|
444 |
|
|
if(!DetUnit)continue;
|
445 |
|
|
const BoundPlane plane = DetUnit->surface();
|
446 |
|
|
const TrapezoidalPlaneBounds* trapezoidalBounds( dynamic_cast<const TrapezoidalPlaneBounds*>(&(plane.bounds())));
|
447 |
|
|
const RectangularPlaneBounds* rectangularBounds( dynamic_cast<const RectangularPlaneBounds*>(&(plane.bounds())));
|
448 |
|
|
|
449 |
|
|
float width = 0;
|
450 |
|
|
float length = 0;
|
451 |
|
|
float thickness = 0;
|
452 |
|
|
float TrapezoidalParam = 0;
|
453 |
|
|
|
454 |
|
|
if(trapezoidalBounds)
|
455 |
|
|
{
|
456 |
|
|
std::vector<float> const & parameters = (*trapezoidalBounds).parameters();
|
457 |
|
|
width = parameters[0]*2;
|
458 |
|
|
length = parameters[3]*2;
|
459 |
|
|
thickness = (*trapezoidalBounds).thickness();
|
460 |
|
|
TrapezoidalParam = parameters[1]/parameters[0];
|
461 |
|
|
}else if(rectangularBounds){
|
462 |
|
|
width = DetUnit->surface().bounds().width();
|
463 |
|
|
length = DetUnit->surface().bounds().length();
|
464 |
|
|
thickness = DetUnit->surface().bounds().thickness();
|
465 |
|
|
TrapezoidalParam = 1;
|
466 |
|
|
}
|
467 |
querten |
1.1 |
|
468 |
querten |
1.22 |
Surface::GlobalPoint WidthVector = plane.toGlobal( LocalPoint(width/2, 0, 0) );
|
469 |
|
|
Surface::GlobalPoint LengthVector = plane.toGlobal( LocalPoint(0, length/2, 0) );
|
470 |
|
|
Surface::GlobalPoint ThickVector = plane.toGlobal( LocalPoint(0, 0, thickness/2) );
|
471 |
|
|
|
472 |
|
|
GlobalVector Pos = GlobalVector(DetUnit->position().basicVector());
|
473 |
|
|
|
474 |
|
|
FROG_Element_Geom_TrackerMod* mod = new FROG_Element_Geom_TrackerMod(
|
475 |
|
|
Detid.rawId(), TrapezoidalParam,
|
476 |
|
|
Pos.x(), Pos.y(), Pos.z(),
|
477 |
|
|
WidthVector.x() -Pos.x(), WidthVector.y() -Pos.y(), WidthVector.z() -Pos.z(),
|
478 |
|
|
LengthVector.x()-Pos.x(), LengthVector.y()-Pos.y(), LengthVector.z()-Pos.z(),
|
479 |
|
|
ThickVector.x() -Pos.x(), ThickVector.y() -Pos.y(), ThickVector.z() -Pos.z());
|
480 |
querten |
1.7 |
|
481 |
querten |
1.22 |
Frog_DetId = DETID_MUON;
|
482 |
|
|
FEB = muon;
|
483 |
querten |
1.7 |
|
484 |
querten |
1.11 |
Frog_DetId += SubDet*100000;
|
485 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
486 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
487 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
488 |
|
|
|
489 |
|
|
if(SubDet==1){
|
490 |
querten |
1.22 |
DTChamberId detid = DTChamberId(Detid);
|
491 |
querten |
1.11 |
|
492 |
querten |
1.22 |
Frog_DetId += (detid.wheel()+3)*10000;
|
493 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
494 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
495 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
496 |
|
|
|
497 |
querten |
1.22 |
Frog_DetId += detid.station()*100;
|
498 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
499 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
500 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
501 |
|
|
|
502 |
querten |
1.22 |
Frog_DetId += detid.sector()*1;
|
503 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
504 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
505 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
506 |
|
|
}else if(SubDet==2){
|
507 |
querten |
1.22 |
CSCDetId detid = CSCDetId(Detid);
|
508 |
|
|
|
509 |
|
|
Frog_DetId += detid.endcap()*10000;
|
510 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
511 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
512 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
513 |
querten |
1.22 |
|
514 |
|
|
Frog_DetId += detid.station()*1000;
|
515 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
516 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
517 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
518 |
querten |
1.22 |
|
519 |
|
|
Frog_DetId += detid.ring()*100;
|
520 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
521 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
522 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
523 |
querten |
1.22 |
|
524 |
|
|
Frog_DetId += detid.chamber()*1;
|
525 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
526 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
527 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
528 |
querten |
1.22 |
}else if(SubDet==3){
|
529 |
|
|
RPCDetId detid = RPCDetId(Detid);
|
530 |
querten |
1.11 |
|
531 |
querten |
1.22 |
Frog_DetId += (detid.region()+2)*10000;
|
532 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
533 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
534 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
535 |
|
|
|
536 |
querten |
1.22 |
// Barrel
|
537 |
|
|
if(detid.region()==0){
|
538 |
|
|
Frog_DetId += (detid.ring()+3)*1000;
|
539 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
540 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
541 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
542 |
|
|
// Endcap
|
543 |
|
|
}else{
|
544 |
|
|
Frog_DetId += detid.ring()*1000;
|
545 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
546 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
547 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
548 |
|
|
}
|
549 |
|
|
|
550 |
|
|
Frog_DetId += detid.station()*100;
|
551 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
552 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
553 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
554 |
|
|
|
555 |
querten |
1.22 |
Frog_DetId += detid.sector()*1;
|
556 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
557 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
558 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
559 |
|
|
}
|
560 |
|
|
|
561 |
querten |
1.22 |
FEB->addDaughter(mod);
|
562 |
|
|
}
|
563 |
|
|
|
564 |
|
|
|
565 |
|
|
|
566 |
|
|
// ### CALO GEOMETRY ###
|
567 |
|
|
|
568 |
|
|
edm::ESHandle<CaloGeometry> CaloGeom;
|
569 |
querten |
1.28 |
iSetup.get<CaloGeometryRecord>().get( CaloGeom );
|
570 |
querten |
1.22 |
const vector<DetId> CaloDets = CaloGeom->getValidDetIds();
|
571 |
querten |
1.11 |
|
572 |
querten |
1.22 |
for(unsigned int i=0;i<CaloDets.size();i++)
|
573 |
|
|
{
|
574 |
|
|
Detid = CaloDets[i];
|
575 |
|
|
SubDet = Detid.subdetId();
|
576 |
|
|
|
577 |
|
|
if(Detid.det()==DetId::Ecal){
|
578 |
|
|
if(SubDet<1 || SubDet>3) continue;
|
579 |
querten |
1.11 |
|
580 |
querten |
1.22 |
Frog_DetId = DETID_ECAL;
|
581 |
|
|
FEB = ecal;
|
582 |
querten |
1.11 |
|
583 |
querten |
1.22 |
Frog_DetId += SubDet*100000;
|
584 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
585 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
586 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
587 |
|
|
|
588 |
querten |
1.22 |
if(SubDet==1){
|
589 |
|
|
EBDetId detid = EBDetId(Detid);
|
590 |
|
|
|
591 |
|
|
Frog_DetId += ((detid.zside()==1)+1)*10000;
|
592 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
593 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
594 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
595 |
|
|
|
596 |
|
|
Frog_DetId += (detid.tower_ieta()*detid.zside())*100;
|
597 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
598 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
599 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
600 |
|
|
|
601 |
|
|
Frog_DetId += detid.tower_iphi()*1;
|
602 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
603 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
604 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
605 |
|
|
}else if(SubDet==2){
|
606 |
|
|
EEDetId detid = EEDetId(Detid);
|
607 |
|
|
|
608 |
|
|
Frog_DetId += ((detid.zside()==1)+1)*10000;
|
609 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
610 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
611 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
612 |
|
|
|
613 |
|
|
Frog_DetId += detid.iquadrant()*1000;
|
614 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
615 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
616 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
617 |
|
|
|
618 |
|
|
Frog_DetId += detid.isc();
|
619 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
620 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
621 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
622 |
|
|
}else if(SubDet==3){
|
623 |
|
|
ESDetId detid = ESDetId(Detid);
|
624 |
|
|
|
625 |
|
|
Frog_DetId += ((detid.zside()==1)+1)*10000;
|
626 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
627 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
628 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
629 |
|
|
|
630 |
|
|
Frog_DetId += detid.plane()*1000;
|
631 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
632 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
633 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
634 |
|
|
|
635 |
|
|
Frog_DetId += detid.six()*50;
|
636 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
637 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
638 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
639 |
|
|
|
640 |
|
|
Frog_DetId += detid.siy();
|
641 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
642 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
643 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
644 |
|
|
}
|
645 |
|
|
}else if(Detid.det()==DetId::Hcal){
|
646 |
|
|
if(SubDet<1 || SubDet>4) continue;
|
647 |
|
|
|
648 |
|
|
Frog_DetId = DETID_HCAL;
|
649 |
|
|
FEB = hcal;
|
650 |
|
|
|
651 |
|
|
Frog_DetId += SubDet*100000;
|
652 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
653 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
654 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
655 |
|
|
|
656 |
querten |
1.22 |
if(true){
|
657 |
|
|
HcalDetId detid = HcalDetId(Detid);
|
658 |
|
|
|
659 |
|
|
Frog_DetId += ((detid.zside()==1)+1)*10000;
|
660 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
661 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
662 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
663 |
|
|
|
664 |
|
|
Frog_DetId += detid.ietaAbs()*100;
|
665 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
666 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
667 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
668 |
|
|
|
669 |
|
|
Frog_DetId += detid.iphi()*1;
|
670 |
|
|
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
671 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
672 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
673 |
|
|
}
|
674 |
|
|
|
675 |
|
|
}else if(Detid.det() == DetId::Calo){
|
676 |
|
|
continue;
|
677 |
|
|
/*
|
678 |
|
|
Frog_DetId = DETID_CALO + 1000000;
|
679 |
|
|
FEB = hcal;
|
680 |
|
|
|
681 |
|
|
Frog_DetId += SubDet*100000;
|
682 |
querten |
1.11 |
FEB_Temp = dynamic_cast<FROG_Element_Base_With_DetId*>(FEB);
|
683 |
|
|
FEB = FEB_Temp->getDaughterWithDetId(Frog_DetId);
|
684 |
|
|
if(FEB==NULL){FEB = new FROG_Element_Base_With_DetId(C_FEB_DETID, Frog_DetId); FEB_Temp->addDaughter(FEB);}
|
685 |
querten |
1.22 |
*/
|
686 |
querten |
1.11 |
}
|
687 |
|
|
|
688 |
querten |
1.22 |
const CaloCellGeometry* CellGeom = CaloGeom->getGeometry(Detid);
|
689 |
|
|
GlobalPoint CellPos = CellGeom->getPosition();
|
690 |
|
|
const CaloCellGeometry::CornersVec CellCorners = CellGeom->getCorners();
|
691 |
|
|
|
692 |
|
|
float cX = (CellCorners[0].x() + CellCorners[2].x())/2;
|
693 |
|
|
float cY = (CellCorners[0].y() + CellCorners[2].y())/2;
|
694 |
|
|
float cZ = (CellCorners[0].z() + CellCorners[2].z())/2;
|
695 |
|
|
|
696 |
|
|
float wX = (CellCorners[1].x() - CellCorners[0].x())/2;
|
697 |
|
|
float wY = (CellCorners[1].y() - CellCorners[0].y())/2;
|
698 |
|
|
float wZ = (CellCorners[1].z() - CellCorners[0].z())/2;
|
699 |
|
|
|
700 |
|
|
float hX = (CellCorners[3].x() - CellCorners[0].x())/2;
|
701 |
|
|
float hY = (CellCorners[3].y() - CellCorners[0].y())/2;
|
702 |
|
|
float hZ = (CellCorners[3].z() - CellCorners[0].z())/2;
|
703 |
|
|
|
704 |
|
|
float F = sqrt( pow(CellCorners[4].x()+CellCorners[6].x(),2) + pow(CellCorners[4].y()+CellCorners[6].y(),2) + pow(CellCorners[4].z()+CellCorners[6].z(),2) );
|
705 |
|
|
F /= sqrt( pow(CellCorners[0].x()+CellCorners[2].x(),2) + pow(CellCorners[0].y()+CellCorners[2].y(),2) + pow(CellCorners[0].z()+CellCorners[2].z(),2) );
|
706 |
|
|
|
707 |
|
|
FROG_Element_Geom_CaloMod* mod = new FROG_Element_Geom_CaloMod(
|
708 |
|
|
Detid.rawId(), F,
|
709 |
|
|
cX , cY , cZ ,
|
710 |
|
|
wX , wY , wZ ,
|
711 |
|
|
hX , hY , hZ );
|
712 |
querten |
1.11 |
|
713 |
querten |
1.22 |
FEB->addDaughter(mod);
|
714 |
querten |
1.11 |
}
|
715 |
|
|
|
716 |
querten |
1.22 |
// ### Save .geom ###
|
717 |
querten |
1.11 |
|
718 |
querten |
1.22 |
FROG_Geometry* CMS_Geom = new FROG_Geometry(prim);
|
719 |
|
|
CMS_Geom->Save("CMS.geom");
|
720 |
querten |
1.11 |
}
|
721 |
|
|
|
722 |
querten |
1.15 |
events_prim = new FROG_Element_Base(C_PRIMARY);
|
723 |
querten |
1.1 |
}
|
724 |
|
|
|
725 |
|
|
// ------------ method called once each job just after ending the event loop ------------
|
726 |
|
|
void
|
727 |
roberfro |
1.13 |
Frog_Analyzer::endJob()
|
728 |
querten |
1.22 |
{
|
729 |
|
|
if(NEvents>0){
|
730 |
|
|
char OutputFileName[1024];
|
731 |
|
|
sprintf(OutputFileName,"%s",OutputFile.substr(0,OutputFile.size()-4).c_str());
|
732 |
|
|
if(NEventsInVisFile>=0)sprintf(OutputFileName,"%s_R%i_E%i.vis",OutputFileName,SRun,SEvent);
|
733 |
|
|
sprintf(OutputFileName,"%s.vis",OutputFileName);
|
734 |
|
|
|
735 |
|
|
FROG_Events* events = new FROG_Events(events_prim);
|
736 |
|
|
events->Save((char*) OutputFileName);
|
737 |
|
|
delete events;
|
738 |
|
|
delete events_prim;
|
739 |
|
|
|
740 |
|
|
events_prim = new FROG_Element_Base(C_PRIMARY);
|
741 |
|
|
NEvents=0;
|
742 |
|
|
}
|
743 |
querten |
1.1 |
}
|
744 |
|
|
|
745 |
|
|
|
746 |
|
|
|
747 |
|
|
//
|
748 |
|
|
// member functions
|
749 |
|
|
//
|
750 |
|
|
|
751 |
|
|
// ------------ method called to for each event ------------
|
752 |
|
|
void
|
753 |
|
|
Frog_Analyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
|
754 |
|
|
{
|
755 |
querten |
1.22 |
if(NEvents == 0){
|
756 |
|
|
SRun = iEvent.id().run();
|
757 |
|
|
SEvent = iEvent.id().event();
|
758 |
|
|
}
|
759 |
|
|
|
760 |
|
|
|
761 |
querten |
1.26 |
FROG_Element_Event* event = new FROG_Element_Event(iEvent.id().run(), iEvent.id().event(), iEvent.time().value() );
|
762 |
querten |
1.15 |
events_prim->addDaughter(event);
|
763 |
querten |
1.1 |
|
764 |
querten |
1.2 |
// access the tracker
|
765 |
|
|
edm::ESHandle<TrackerGeometry> tkGeom;
|
766 |
|
|
iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom );
|
767 |
querten |
1.1 |
|
768 |
querten |
1.2 |
edm::ESHandle<DTGeometry> DtGeom;
|
769 |
|
|
iSetup.get<MuonGeometryRecord>().get( DtGeom );
|
770 |
|
|
|
771 |
|
|
edm::ESHandle<CSCGeometry> CscGeom;
|
772 |
|
|
iSetup.get<MuonGeometryRecord>().get( CscGeom );
|
773 |
querten |
1.1 |
|
774 |
querten |
1.2 |
edm::ESHandle<RPCGeometry> RpcGeom;
|
775 |
|
|
iSetup.get<MuonGeometryRecord>().get( RpcGeom );
|
776 |
querten |
1.1 |
|
777 |
querten |
1.25 |
edm::ESHandle<CaloGeometry> CaloGeom;
|
778 |
querten |
1.28 |
iSetup.get<CaloGeometryRecord>().get( CaloGeom );
|
779 |
querten |
1.25 |
|
780 |
querten |
1.2 |
// ### SIMTRACK ###
|
781 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogSimTrkColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMTRK);
|
782 |
|
|
event->addDaughter(frogSimTrkColl);
|
783 |
|
|
|
784 |
querten |
1.1 |
for(unsigned int i=0;i<SimTrackProducers.size();i++){
|
785 |
|
|
edm::Handle<std::vector< SimTrack > > h_SimTracks;
|
786 |
|
|
iEvent.getByLabel(SimTrackProducers[i], h_SimTracks);
|
787 |
|
|
std::vector< SimTrack > SimTrackColl = *h_SimTracks.product();
|
788 |
|
|
|
789 |
|
|
for ( unsigned int a = 0; a < SimTrackColl.size(); ++a ) {
|
790 |
|
|
SimTrack simTrack =SimTrackColl[a];
|
791 |
|
|
|
792 |
roberfro |
1.13 |
FROG_Element_Event_Sim_Track* frogSimTrk = new FROG_Element_Event_Sim_Track(simTrack.trackId(),
|
793 |
|
|
simTrack.momentum().x(), simTrack.momentum().y(), simTrack.momentum().z(),
|
794 |
|
|
simTrack.momentum().e(), simTrack.type(), simTrack.vertIndex(),
|
795 |
|
|
simTrack.charge() );
|
796 |
querten |
1.15 |
frogSimTrkColl->addDaughter(frogSimTrk);
|
797 |
querten |
1.1 |
}
|
798 |
|
|
}
|
799 |
|
|
|
800 |
querten |
1.2 |
// ### SIMVERTEX ###
|
801 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogSimVtx = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMVTX);
|
802 |
|
|
event->addDaughter(frogSimVtx);
|
803 |
|
|
|
804 |
querten |
1.1 |
for(unsigned int i=0;i<SimVertexProducers.size();i++){
|
805 |
|
|
edm::Handle<std::vector< SimVertex > > h_Vertex;
|
806 |
|
|
iEvent.getByLabel(SimVertexProducers[i], h_Vertex);
|
807 |
|
|
std::vector< SimVertex > VertexColl = *h_Vertex.product();
|
808 |
|
|
|
809 |
|
|
for (unsigned int b = 0; b < VertexColl.size(); ++b ) {
|
810 |
|
|
SimVertex Vertex = VertexColl[b];
|
811 |
|
|
|
812 |
querten |
1.25 |
FROG_Element_Event_Sim_Vertex* frogSimVertex = new FROG_Element_Event_Sim_Vertex(
|
813 |
roberfro |
1.13 |
Vertex.position().x(), Vertex.position().y(), Vertex.position().z(),
|
814 |
|
|
Vertex.parentIndex());
|
815 |
querten |
1.1 |
|
816 |
querten |
1.25 |
frogSimVtx->addDaughter(frogSimVertex);
|
817 |
querten |
1.1 |
}
|
818 |
|
|
}
|
819 |
|
|
|
820 |
roberfro |
1.13 |
|
821 |
querten |
1.2 |
// ### SIMHIT ###
|
822 |
querten |
1.15 |
|
823 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogSimHit = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMHIT);
|
824 |
|
|
event->addDaughter(frogSimHit);
|
825 |
querten |
1.1 |
for(unsigned int i=0;i<SimHitProducers.size();i++){
|
826 |
|
|
edm::Handle<std::vector< PSimHit > > h_Hits;
|
827 |
|
|
iEvent.getByLabel(SimHitProducers[i], h_Hits);
|
828 |
|
|
std::vector< PSimHit > Hits = *h_Hits.product();
|
829 |
|
|
|
830 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogSimHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMHIT + i + 1);
|
831 |
|
|
frogSimHit->addDaughter(frogSimHitColl);
|
832 |
querten |
1.15 |
|
833 |
querten |
1.1 |
for(unsigned int h=0; h<Hits.size(); h++)
|
834 |
|
|
{
|
835 |
querten |
1.2 |
DetId theDetUnitId(Hits[h].detUnitId());
|
836 |
querten |
1.25 |
const GeomDet* theDet = NULL;
|
837 |
|
|
if(theDetUnitId.det() == DetId::Tracker)theDet = tkGeom->idToDet(theDetUnitId);
|
838 |
|
|
if(theDetUnitId.det() == DetId::Muon && theDetUnitId.subdetId() == MuonSubdetId::DT) theDet = DtGeom->idToDet(theDetUnitId);
|
839 |
|
|
if(theDetUnitId.det() == DetId::Muon && theDetUnitId.subdetId() == MuonSubdetId::CSC)theDet = CscGeom->idToDet(theDetUnitId);
|
840 |
|
|
if(theDetUnitId.det() == DetId::Muon && theDetUnitId.subdetId() == MuonSubdetId::RPC)theDet = RpcGeom->idToDet(theDetUnitId);
|
841 |
querten |
1.1 |
|
842 |
querten |
1.15 |
|
843 |
|
|
FROG_Element_Event_Sim_Hit* frogSimHit = new FROG_Element_Event_Sim_Hit(
|
844 |
|
|
theDet->surface().toGlobal(Hits[h].localPosition()).x(),theDet->surface().toGlobal(Hits[h].localPosition()).y(),theDet->surface().toGlobal(Hits[h].localPosition()).z(),
|
845 |
|
|
Hits[h].energyLoss(), Hits[h].processType() );
|
846 |
|
|
frogSimHitColl->addDaughter(frogSimHit);
|
847 |
querten |
1.1 |
}
|
848 |
|
|
}
|
849 |
querten |
1.15 |
|
850 |
querten |
1.25 |
// ### SIMCALOHIT ###
|
851 |
|
|
|
852 |
|
|
for(unsigned int i=0;i<SimCaloHitProducers.size();i++){
|
853 |
|
|
edm::Handle<std::vector< PCaloHit > > h_CaloHits;
|
854 |
|
|
iEvent.getByLabel(SimCaloHitProducers[i], h_CaloHits);
|
855 |
|
|
std::vector< PCaloHit > CaloHits = *h_CaloHits.product();
|
856 |
|
|
|
857 |
|
|
FROG_Element_Base_With_DetId* frogSimHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_SIMHIT + SimHitProducers.size() + i + 1);
|
858 |
|
|
frogSimHit->addDaughter(frogSimHitColl);
|
859 |
|
|
|
860 |
|
|
for(unsigned int h=0; h<CaloHits.size(); h++)
|
861 |
|
|
{
|
862 |
|
|
DetId theDetUnitId(CaloHits[h].id());
|
863 |
|
|
const CaloCellGeometry* CellGeom = NULL;
|
864 |
|
|
if(theDetUnitId.det() == DetId::Ecal || theDetUnitId.det() == DetId::Hcal)CellGeom = CaloGeom->getGeometry(theDetUnitId);
|
865 |
|
|
if(CellGeom==NULL)continue;
|
866 |
|
|
|
867 |
|
|
|
868 |
|
|
FROG_Element_Event_Sim_Hit* frogSimCaloHit = new FROG_Element_Event_Sim_Hit(
|
869 |
|
|
CellGeom->getPosition().x(),CellGeom->getPosition().y(),CellGeom->getPosition().z(),
|
870 |
|
|
CaloHits[h].energy(), CaloHits[h].depth() );
|
871 |
|
|
frogSimHitColl->addDaughter(frogSimCaloHit);
|
872 |
|
|
}
|
873 |
|
|
}
|
874 |
|
|
|
875 |
roberfro |
1.24 |
// NUCLEAR INTERACTIONS
|
876 |
|
|
for(unsigned int i=0;i<NIProducers.size();i++) {
|
877 |
|
|
edm::Handle<std::vector<reco::NuclearInteraction> > h_NIs;
|
878 |
|
|
iEvent.getByLabel(NIProducers[i], h_NIs);
|
879 |
|
|
std::vector<reco::NuclearInteraction> NIs = *h_NIs.product();
|
880 |
|
|
FROG_Element_Base_With_DetId* frogNIColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_NUCLINT + i);
|
881 |
|
|
event->addDaughter(frogNIColl);
|
882 |
|
|
|
883 |
|
|
for(unsigned int h=0; h<NIs.size();h++){
|
884 |
|
|
reco::NuclearInteraction ni = NIs[i];
|
885 |
|
|
float vtx_x = ni.vertex().x();
|
886 |
|
|
float vtx_y = ni.vertex().y();
|
887 |
|
|
float vtx_z = ni.vertex().z();
|
888 |
|
|
float like = ni.likelihood();
|
889 |
|
|
FROG_Element_Event_NuclInt* frogNI = new FROG_Element_Event_NuclInt(vtx_x, vtx_y, vtx_z, like );
|
890 |
|
|
frogNIColl->addDaughter(frogNI);
|
891 |
|
|
}
|
892 |
|
|
}
|
893 |
querten |
1.1 |
|
894 |
|
|
|
895 |
querten |
1.25 |
|
896 |
querten |
1.9 |
// ### TRAJECTORY ###
|
897 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogTrk = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_TRK);
|
898 |
|
|
event->addDaughter(frogTrk);
|
899 |
|
|
|
900 |
roberfro |
1.5 |
for(unsigned int i=0;i<TrajectoryProducers.size();i++){
|
901 |
querten |
1.6 |
Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
|
902 |
|
|
iEvent.getByLabel(TrajectoryProducers[i], trajTrackAssociationHandle);
|
903 |
|
|
const TrajTrackAssociationCollection TrajToTrackMap = *trajTrackAssociationHandle.product();
|
904 |
|
|
|
905 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogTrkColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_TRK + i + 1);
|
906 |
|
|
frogTrk->addDaughter(frogTrkColl);
|
907 |
querten |
1.15 |
|
908 |
querten |
1.6 |
for(TrajTrackAssociationCollection::const_iterator it = TrajToTrackMap.begin(); it!=TrajToTrackMap.end(); ++it) {
|
909 |
|
|
Trajectory recoTraj = *it->key;
|
910 |
querten |
1.15 |
FROG_Element_Event_Track* frogTrk = new FROG_Element_Event_Track(i,it->val->p(),it->val->pt(),it->key->chiSquared());
|
911 |
|
|
frogTrkColl->addDaughter(frogTrk);
|
912 |
querten |
1.1 |
|
913 |
roberfro |
1.5 |
std::vector<TrajectoryMeasurement> measurements = recoTraj.measurements();
|
914 |
|
|
for(unsigned int h=0;h<measurements.size();h++){
|
915 |
|
|
|
916 |
|
|
TrajectoryMeasurement::ConstRecHitPointer h_it = measurements[h].recHit();
|
917 |
querten |
1.1 |
if(!h_it->isValid() )continue;
|
918 |
|
|
DetId detId = h_it->geographicalId();
|
919 |
roberfro |
1.5 |
GlobalPoint globalPos = measurements[h].updatedState().globalPosition();
|
920 |
querten |
1.1 |
|
921 |
querten |
1.15 |
FROG_Element_Event_Hit* frogHit = new FROG_Element_Event_Hit(detId.rawId(), globalPos.x(),globalPos.y(), globalPos.z(), -1);
|
922 |
|
|
frogTrk->addDaughter(frogHit);
|
923 |
querten |
1.1 |
}
|
924 |
|
|
}
|
925 |
|
|
}
|
926 |
|
|
|
927 |
querten |
1.9 |
// ### TRACK ###
|
928 |
|
|
|
929 |
|
|
for(unsigned int i=0;i<TrackProducers.size();i++){
|
930 |
|
|
edm::Handle<std::vector< reco::Track > > h_Tracks;
|
931 |
|
|
iEvent.getByLabel(TrackProducers[i], h_Tracks);
|
932 |
|
|
std::vector< reco::Track > TrackColl = *h_Tracks.product();
|
933 |
|
|
|
934 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogTrkColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_TRK + TrajectoryProducers.size() + i + 1);
|
935 |
|
|
frogTrk->addDaughter(frogTrkColl);
|
936 |
querten |
1.15 |
|
937 |
querten |
1.11 |
//printf("Size of the TrackCOllection : %i = %i\n",i,TrackColl.size());
|
938 |
querten |
1.9 |
for ( unsigned int t = 0; t < TrackColl.size(); ++t ) {
|
939 |
querten |
1.15 |
reco::Track recoTrack =TrackColl[t];
|
940 |
querten |
1.9 |
|
941 |
querten |
1.15 |
FROG_Element_Event_Track* frogTrk = new FROG_Element_Event_Track(TrajectoryProducers.size()+i,recoTrack.p(),recoTrack.pt(), recoTrack.chi2());
|
942 |
|
|
frogTrkColl->addDaughter(frogTrk);
|
943 |
querten |
1.9 |
|
944 |
querten |
1.15 |
for(unsigned int h=0;h<recoTrack.recHitsSize();h++){
|
945 |
|
|
TrackingRecHitRef h_it = recoTrack.recHit(h);
|
946 |
|
|
if(!h_it->isValid() )continue;
|
947 |
|
|
DetId detId = h_it->geographicalId();
|
948 |
|
|
const GeomDet * theDet = NULL;
|
949 |
|
|
|
950 |
|
|
if(detId.det()==DetId::Tracker) theDet = tkGeom->idToDet(detId);
|
951 |
|
|
if(detId.det()==DetId::Muon && detId.subdetId() == 1) theDet = DtGeom->idToDet(detId);
|
952 |
|
|
if(detId.det()==DetId::Muon && detId.subdetId() == 2) theDet = CscGeom->idToDet(detId);
|
953 |
|
|
if(detId.det()==DetId::Muon && detId.subdetId() == 3) theDet = RpcGeom->idToDet(detId);
|
954 |
|
|
|
955 |
|
|
LocalPoint localPos = h_it->localPosition();
|
956 |
|
|
|
957 |
|
|
FROG_Element_Event_Hit* frogHit = new FROG_Element_Event_Hit(
|
958 |
|
|
detId.rawId(),
|
959 |
|
|
theDet->surface().toGlobal(localPos).x(),
|
960 |
|
|
theDet->surface().toGlobal(localPos).y(),
|
961 |
|
|
theDet->surface().toGlobal(localPos).z(),
|
962 |
|
|
-1);
|
963 |
|
|
frogTrk->addDaughter(frogHit);
|
964 |
|
|
}
|
965 |
querten |
1.9 |
}
|
966 |
|
|
}
|
967 |
|
|
|
968 |
|
|
|
969 |
querten |
1.2 |
// ### ECALRecHits ###
|
970 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogEcalHit = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_ECALHIT);
|
971 |
|
|
event->addDaughter(frogEcalHit);
|
972 |
querten |
1.1 |
for(unsigned int i=0;i<EcalRecHitProducers.size();i++){
|
973 |
|
|
edm::Handle<EcalRecHitCollection > h_Ecal_RecHits;
|
974 |
|
|
iEvent.getByLabel(EcalRecHitProducers[i], h_Ecal_RecHits);
|
975 |
|
|
EcalRecHitCollection Ecal_RecHits = *h_Ecal_RecHits.product();
|
976 |
|
|
|
977 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_ECALHIT + i + 1);
|
978 |
|
|
frogEcalHit->addDaughter(frogHitColl);
|
979 |
querten |
1.15 |
|
980 |
querten |
1.1 |
for(unsigned int eh=0;eh<Ecal_RecHits.size();eh++){
|
981 |
roberfro |
1.14 |
FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((Ecal_RecHits[eh].detid()).rawId(),
|
982 |
|
|
Ecal_RecHits[eh].energy(), Ecal_RecHits[eh].time());
|
983 |
querten |
1.15 |
frogHitColl->addDaughter(frogCaloHit);
|
984 |
querten |
1.1 |
}
|
985 |
|
|
}
|
986 |
|
|
|
987 |
|
|
|
988 |
querten |
1.2 |
// ### HCALRecHits ###
|
989 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogHcalHit = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_HCALHIT);
|
990 |
|
|
event->addDaughter(frogHcalHit);
|
991 |
querten |
1.1 |
for(unsigned int i=0;i<HcalHBHERecHitProducers.size();i++){
|
992 |
|
|
edm::Handle<HBHERecHitCollection > h_HcalHBHE_RecHits;
|
993 |
|
|
iEvent.getByLabel(HcalHBHERecHitProducers[i], h_HcalHBHE_RecHits);
|
994 |
|
|
HBHERecHitCollection HcalHBHE_RecHits = *h_HcalHBHE_RecHits.product();
|
995 |
|
|
|
996 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_HCALHIT + i + 1);
|
997 |
|
|
frogHcalHit->addDaughter(frogHitColl);
|
998 |
querten |
1.15 |
|
999 |
querten |
1.1 |
for(unsigned int hh=0;hh<HcalHBHE_RecHits.size();hh++){
|
1000 |
roberfro |
1.14 |
FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHBHE_RecHits[hh].detid()).rawId(),
|
1001 |
|
|
HcalHBHE_RecHits[hh].energy(), HcalHBHE_RecHits[hh].time());
|
1002 |
querten |
1.15 |
frogHitColl->addDaughter(frogCaloHit);
|
1003 |
querten |
1.1 |
}
|
1004 |
|
|
}
|
1005 |
|
|
|
1006 |
|
|
for(unsigned int i=0;i<HcalHORecHitProducers.size();i++){
|
1007 |
|
|
edm::Handle<HORecHitCollection > h_HcalHO_RecHits;
|
1008 |
|
|
iEvent.getByLabel(HcalHORecHitProducers[i], h_HcalHO_RecHits);
|
1009 |
|
|
HORecHitCollection HcalHO_RecHits = *h_HcalHO_RecHits.product();
|
1010 |
|
|
|
1011 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_HCALHIT + HcalHBHERecHitProducers.size() + i + 1);
|
1012 |
|
|
frogHcalHit->addDaughter(frogHitColl);
|
1013 |
querten |
1.15 |
|
1014 |
querten |
1.1 |
for(unsigned int hh=0;hh<HcalHO_RecHits.size();hh++){
|
1015 |
querten |
1.15 |
FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHO_RecHits[hh].detid()).rawId(),
|
1016 |
|
|
HcalHO_RecHits[hh].energy(), HcalHO_RecHits[hh].time());
|
1017 |
|
|
frogHitColl->addDaughter(frogCaloHit);
|
1018 |
querten |
1.1 |
}
|
1019 |
|
|
}
|
1020 |
|
|
|
1021 |
|
|
for(unsigned int i=0;i<HcalHFRecHitProducers.size();i++){
|
1022 |
|
|
edm::Handle<HFRecHitCollection > h_HcalHF_RecHits;
|
1023 |
|
|
iEvent.getByLabel(HcalHFRecHitProducers[i], h_HcalHF_RecHits);
|
1024 |
|
|
HFRecHitCollection HcalHF_RecHits = *h_HcalHF_RecHits.product();
|
1025 |
|
|
|
1026 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_HCALHIT + HcalHBHERecHitProducers.size() + HcalHORecHitProducers.size() + i + 1);
|
1027 |
|
|
frogHcalHit->addDaughter(frogHitColl);
|
1028 |
querten |
1.15 |
|
1029 |
querten |
1.1 |
for(unsigned int hh=0;hh<HcalHF_RecHits.size();hh++){
|
1030 |
querten |
1.15 |
FROG_Element_Event_CaloHit* frogCaloHit = new FROG_Element_Event_CaloHit((HcalHF_RecHits[hh].detid()).rawId(),
|
1031 |
|
|
HcalHF_RecHits[hh].energy(), HcalHF_RecHits[hh].time());
|
1032 |
|
|
frogHitColl->addDaughter(frogCaloHit);
|
1033 |
querten |
1.1 |
}
|
1034 |
|
|
}
|
1035 |
|
|
|
1036 |
querten |
1.25 |
|
1037 |
querten |
1.2 |
// ### Muon Segments ###
|
1038 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogMuonSeg = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONSEG);
|
1039 |
|
|
event->addDaughter(frogMuonSeg);
|
1040 |
|
|
|
1041 |
querten |
1.2 |
for(unsigned int i=0;i<CSCSegmentProducers.size();i++){
|
1042 |
|
|
edm::Handle<CSCSegmentCollection > h_CSC_Segments;
|
1043 |
|
|
iEvent.getByLabel(CSCSegmentProducers[i], h_CSC_Segments);
|
1044 |
|
|
CSCSegmentCollection CSC_Segments = *h_CSC_Segments.product();
|
1045 |
|
|
|
1046 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogSegColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONSEG + i + 1);
|
1047 |
|
|
frogMuonSeg->addDaughter(frogSegColl);
|
1048 |
querten |
1.15 |
|
1049 |
querten |
1.2 |
for(unsigned int s=0;s<CSC_Segments.size();s++){
|
1050 |
|
|
DetId theDetUnitId = CSC_Segments[s].geographicalId();
|
1051 |
|
|
const GeomDet* theDet = CscGeom->idToDet(theDetUnitId);
|
1052 |
|
|
|
1053 |
querten |
1.15 |
FROG_Element_Event_Segment* frogSeg = new FROG_Element_Event_Segment(theDetUnitId.rawId(),
|
1054 |
|
|
theDet->surface().toGlobal(CSC_Segments[s].localPosition()).x() , theDet->surface().toGlobal(CSC_Segments[s].localPosition()).y() , theDet->surface().toGlobal(CSC_Segments[s].localPosition()).z() ,
|
1055 |
|
|
theDet->surface().toGlobal(CSC_Segments[s].localDirection()).x(), theDet->surface().toGlobal(CSC_Segments[s].localDirection()).y(), theDet->surface().toGlobal(CSC_Segments[s].localDirection()).z() );
|
1056 |
|
|
frogSegColl->addDaughter(frogSeg);
|
1057 |
querten |
1.2 |
}
|
1058 |
|
|
}
|
1059 |
|
|
|
1060 |
|
|
for(unsigned int i=0;i<DTSegmentProducers.size();i++){
|
1061 |
|
|
edm::Handle<DTRecSegment4DCollection > h_DT_Segments;
|
1062 |
|
|
iEvent.getByLabel(DTSegmentProducers[i], h_DT_Segments);
|
1063 |
|
|
DTRecSegment4DCollection DT_Segments = *h_DT_Segments.product();
|
1064 |
|
|
|
1065 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogSegColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONSEG + CSCSegmentProducers.size() + i + 1);
|
1066 |
|
|
frogMuonSeg->addDaughter(frogSegColl);
|
1067 |
querten |
1.15 |
|
1068 |
querten |
1.2 |
for(unsigned int s=0;s<DT_Segments.size();s++){
|
1069 |
|
|
DetId theDetUnitId = DT_Segments[s].geographicalId();
|
1070 |
|
|
const GeomDet* theDet = DtGeom->idToDet(theDetUnitId);
|
1071 |
|
|
|
1072 |
querten |
1.15 |
FROG_Element_Event_Segment* frogSeg = new FROG_Element_Event_Segment(theDetUnitId.rawId(),
|
1073 |
|
|
theDet->surface().toGlobal(DT_Segments[s].localPosition()).x() , theDet->surface().toGlobal(DT_Segments[s].localPosition()).y() , theDet->surface().toGlobal(DT_Segments[s].localPosition()).z() ,
|
1074 |
|
|
theDet->surface().toGlobal(DT_Segments[s].localDirection()).x(), theDet->surface().toGlobal(DT_Segments[s].localDirection()).y(), theDet->surface().toGlobal(DT_Segments[s].localDirection()).z() );
|
1075 |
|
|
frogSegColl->addDaughter(frogSeg);
|
1076 |
querten |
1.2 |
}
|
1077 |
|
|
}
|
1078 |
|
|
|
1079 |
|
|
// ### Muon Hits ###
|
1080 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogMuonHit = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONHIT);
|
1081 |
|
|
event->addDaughter(frogMuonHit);
|
1082 |
querten |
1.2 |
for(unsigned int i=0;i<RPCHitsProducers.size();i++){
|
1083 |
|
|
edm::Handle<RPCRecHitCollection > h_RPC_Hits;
|
1084 |
|
|
iEvent.getByLabel(RPCHitsProducers[i], h_RPC_Hits);
|
1085 |
|
|
RPCRecHitCollection RPC_Hits = *h_RPC_Hits.product();
|
1086 |
|
|
|
1087 |
querten |
1.25 |
FROG_Element_Base_With_DetId* frogHitColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_MUONHIT + i + 1);
|
1088 |
|
|
frogMuonHit->addDaughter(frogHitColl);
|
1089 |
querten |
1.15 |
|
1090 |
querten |
1.2 |
for(unsigned int h=0;h<RPC_Hits.size();h++){
|
1091 |
|
|
DetId theDetUnitId = RPC_Hits[h].geographicalId();
|
1092 |
|
|
const GeomDet* theDet = RpcGeom->idToDet(theDetUnitId);
|
1093 |
|
|
|
1094 |
querten |
1.15 |
FROG_Element_Event_Hit* frogHit = new FROG_Element_Event_Hit(theDetUnitId.rawId(),
|
1095 |
|
|
theDet->surface().toGlobal(RPC_Hits[h].localPosition()).x() , theDet->surface().toGlobal(RPC_Hits[h].localPosition()).y() , theDet->surface().toGlobal(RPC_Hits[h].localPosition()).z(), -1 );
|
1096 |
|
|
frogHitColl->addDaughter(frogHit);
|
1097 |
querten |
1.2 |
}
|
1098 |
|
|
}
|
1099 |
|
|
|
1100 |
querten |
1.25 |
|
1101 |
querten |
1.28 |
|
1102 |
|
|
// ### Calo Jets ###
|
1103 |
|
|
FROG_Element_Base_With_DetId* frogCaloJet = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_JET_CALO);
|
1104 |
|
|
event->addDaughter(frogCaloJet);
|
1105 |
|
|
for(unsigned int i=0;i<CaloJetsProducers.size();i++){
|
1106 |
|
|
edm::Handle<CaloJetCollection> h_Calo_Jets;
|
1107 |
|
|
iEvent.getByLabel(CaloJetsProducers[i], h_Calo_Jets);
|
1108 |
|
|
CaloJetCollection Calo_Jets = *h_Calo_Jets.product();
|
1109 |
|
|
|
1110 |
|
|
FROG_Element_Base_With_DetId* frogCaloJetColl = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_JET_CALO + i + 1);
|
1111 |
|
|
frogCaloJet->addDaughter(frogCaloJetColl);
|
1112 |
|
|
|
1113 |
|
|
for(unsigned int h=0;h<Calo_Jets.size();h++){
|
1114 |
querten |
1.30 |
FROG_Element_Event_Jet* frogJet = new FROG_Element_Event_Jet(Calo_Jets[h].p(), Calo_Jets[h].eta(),Calo_Jets[h].phi());
|
1115 |
querten |
1.28 |
frogCaloJet->addDaughter(frogJet);
|
1116 |
querten |
1.32 |
|
1117 |
|
|
frogJet->Components_CollEvtId_ = C_GEOMETRY;
|
1118 |
|
|
std::vector<CaloTowerPtr> CaloTowers = Calo_Jets[h].getCaloConstituents();
|
1119 |
|
|
for(unsigned int t=0;t<CaloTowers.size();t++){
|
1120 |
|
|
std::vector<DetId> TowersDetIds = CaloTowers[t]->constituents();
|
1121 |
|
|
for(unsigned int D=0;D<TowersDetIds.size();D++){frogJet->Components_Vector_.push_back(TowersDetIds[D]);}
|
1122 |
|
|
}
|
1123 |
|
|
// const std::vector<DetId>& constituents() const { return constituents_; }
|
1124 |
|
|
|
1125 |
querten |
1.28 |
}
|
1126 |
|
|
}
|
1127 |
|
|
|
1128 |
querten |
1.32 |
// ### Calo Jets as reco::Candidates ###
|
1129 |
roberfro |
1.29 |
FROG_Element_Base_With_DetId* frogCaloJetCand = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_RECOCAND);
|
1130 |
|
|
event->addDaughter(frogCaloJetCand);
|
1131 |
|
|
for(unsigned int i=0;i<CaloJetsProducers.size();i++){
|
1132 |
|
|
edm::Handle<CaloJetCollection> h_Calo_Jets;
|
1133 |
|
|
iEvent.getByLabel(CaloJetsProducers[i], h_Calo_Jets);
|
1134 |
|
|
CaloJetCollection Calo_Jets = *h_Calo_Jets.product();
|
1135 |
|
|
|
1136 |
|
|
FROG_Element_Base_With_DetId* frogCaloJetCollCand = new FROG_Element_Base_With_DetId(C_FEB_DETID, EVTID_RECOCAND + i + 1);
|
1137 |
|
|
frogCaloJetCand->addDaughter(frogCaloJetCollCand);
|
1138 |
|
|
|
1139 |
|
|
for(unsigned int h=0;h<Calo_Jets.size();h++){
|
1140 |
roberfro |
1.31 |
FROG_Element_Event_Candidate* frogCandidate = new FROG_Element_Event_Candidate(Calo_Jets[h].p(), Calo_Jets[h].eta(),Calo_Jets[h].phi());
|
1141 |
roberfro |
1.29 |
frogCaloJetCand->addDaughter(frogCandidate);
|
1142 |
|
|
}
|
1143 |
|
|
}
|
1144 |
|
|
|
1145 |
querten |
1.28 |
|
1146 |
|
|
|
1147 |
querten |
1.22 |
NEvents++;
|
1148 |
|
|
if(NEvents == NEventsInVisFile){
|
1149 |
|
|
char OutputFileName[1024];
|
1150 |
|
|
sprintf(OutputFileName,"%s",OutputFile.substr(0,OutputFile.size()-4).c_str());
|
1151 |
|
|
if(NEventsInVisFile>=0)sprintf(OutputFileName,"%s_R%i_E%i.vis",OutputFileName,SRun,SEvent);
|
1152 |
|
|
sprintf(OutputFileName,"%s.vis",OutputFileName);
|
1153 |
|
|
|
1154 |
|
|
FROG_Events* events = new FROG_Events(events_prim);
|
1155 |
|
|
events->Save((char*) OutputFileName);
|
1156 |
|
|
delete events;
|
1157 |
|
|
delete events_prim;
|
1158 |
roberfro |
1.13 |
|
1159 |
querten |
1.22 |
events_prim = new FROG_Element_Base(C_PRIMARY);
|
1160 |
|
|
NEvents=0;
|
1161 |
|
|
}
|
1162 |
querten |
1.15 |
|
1163 |
querten |
1.1 |
}
|
1164 |
|
|
|
1165 |
|
|
|
1166 |
|
|
//define this as a plug-in
|
1167 |
|
|
DEFINE_FWK_MODULE(Frog_Analyzer);
|
1168 |
|
|
|
1169 |
|
|
|