61 |
|
#include "Geometry/RPCGeometry/interface/RPCGeometry.h" |
62 |
|
|
63 |
|
|
64 |
– |
|
64 |
|
#include "DataFormats/CaloRecHit/interface/CaloRecHit.h" |
65 |
|
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" |
66 |
|
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" |
80 |
|
#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h" |
81 |
|
#include "DataFormats/TrackReco/interface/Track.h" |
82 |
|
|
83 |
+ |
#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 |
|
#include "DataFormats/Math/interface/Point3D.h" |
91 |
|
#include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h" |
92 |
|
#include "DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h" |
131 |
|
std::vector<InputTag> HcalHBHERecHitProducers; |
132 |
|
std::vector<InputTag> HcalHORecHitProducers; |
133 |
|
std::vector<InputTag> HcalHFRecHitProducers; |
134 |
+ |
std::vector<InputTag> DTSegmentProducers; |
135 |
+ |
std::vector<InputTag> CSCSegmentProducers; |
136 |
+ |
|
137 |
+ |
std::vector<InputTag> RPCHitsProducers; |
138 |
|
|
139 |
|
|
140 |
|
|
159 |
|
HcalHORecHitProducers = iConfig.getParameter<std::vector<InputTag> >("HcalHORecHitProducers"); |
160 |
|
HcalHFRecHitProducers = iConfig.getParameter<std::vector<InputTag> >("HcalHFRecHitProducers"); |
161 |
|
|
162 |
+ |
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 |
|
} |
168 |
|
|
169 |
|
|
351 |
|
Geom_Tracker->Save("Tracker.geom"); |
352 |
|
Geom_ECAL ->Save("Ecal.geom"); |
353 |
|
Geom_HCAL ->Save("Hcal.geom"); |
339 |
– |
|
340 |
– |
printf("RPC = %i\n",Geom_Muon ->Det_Muon_RPC.size()); |
341 |
– |
|
354 |
|
Geom_Muon ->Save("Muon.geom"); |
355 |
|
|
356 |
|
} |
375 |
|
{ |
376 |
|
MySimEvent* MyEvent = new MySimEvent; |
377 |
|
|
378 |
+ |
// access the tracker |
379 |
+ |
edm::ESHandle<TrackerGeometry> tkGeom; |
380 |
+ |
iSetup.get<TrackerDigiGeometryRecord>().get( tkGeom ); |
381 |
|
|
382 |
+ |
edm::ESHandle<DTGeometry> DtGeom; |
383 |
+ |
iSetup.get<MuonGeometryRecord>().get( DtGeom ); |
384 |
+ |
|
385 |
+ |
edm::ESHandle<CSCGeometry> CscGeom; |
386 |
+ |
iSetup.get<MuonGeometryRecord>().get( CscGeom ); |
387 |
|
|
388 |
< |
// access the tracker |
389 |
< |
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(); |
388 |
> |
edm::ESHandle<RPCGeometry> RpcGeom; |
389 |
> |
iSetup.get<MuonGeometryRecord>().get( RpcGeom ); |
390 |
|
|
391 |
|
|
392 |
|
// Save Data |
393 |
+ |
// ### SIMTRACK ### |
394 |
|
for(unsigned int i=0;i<SimTrackProducers.size();i++){ |
395 |
|
edm::Handle<std::vector< SimTrack > > h_SimTracks; |
396 |
|
iEvent.getByLabel(SimTrackProducers[i], h_SimTracks); |
413 |
|
} |
414 |
|
} |
415 |
|
|
416 |
< |
|
416 |
> |
// ### SIMVERTEX ### |
417 |
|
for(unsigned int i=0;i<SimVertexProducers.size();i++){ |
418 |
|
edm::Handle<std::vector< SimVertex > > h_Vertex; |
419 |
|
iEvent.getByLabel(SimVertexProducers[i], h_Vertex); |
432 |
|
} |
433 |
|
} |
434 |
|
|
435 |
+ |
// ### SIMHIT ### |
436 |
|
for(unsigned int i=0;i<SimHitProducers.size();i++){ |
437 |
|
edm::Handle<std::vector< PSimHit > > h_Hits; |
438 |
|
iEvent.getByLabel(SimHitProducers[i], h_Hits); |
440 |
|
|
441 |
|
for(unsigned int h=0; h<Hits.size(); h++) |
442 |
|
{ |
443 |
< |
DetId theDetUnitId(Hits[h].detUnitId()); |
444 |
< |
const GeomDet * theDet = theTracker.idToDet(theDetUnitId); |
443 |
> |
DetId theDetUnitId(Hits[h].detUnitId()); |
444 |
> |
const GeomDet* theDet = tkGeom->idToDet(theDetUnitId); |
445 |
|
|
446 |
|
MyPSimHit Hit; |
447 |
|
Hit.x = theDet->surface().toGlobal(Hits[h].localPosition()).x(); |
455 |
|
} |
456 |
|
|
457 |
|
|
458 |
+ |
// ### TRACKS ### |
459 |
|
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); |
469 |
|
TrackingRecHitRef h_it = recoTrack.recHit(h); |
470 |
|
if(!h_it->isValid() )continue; |
471 |
|
DetId detId = h_it->geographicalId(); |
472 |
< |
const GeomDet * theDet = theTracker.idToDet(detId); |
472 |
> |
const GeomDet * theDet = tkGeom->idToDet(detId); |
473 |
|
LocalPoint localPos = h_it->localPosition(); |
474 |
|
|
475 |
|
MyRecoHit hit; |
485 |
|
} |
486 |
|
|
487 |
|
|
488 |
+ |
// ### ECALRecHits ### |
489 |
|
for(unsigned int i=0;i<EcalRecHitProducers.size();i++){ |
490 |
|
edm::Handle<EcalRecHitCollection > h_Ecal_RecHits; |
491 |
|
iEvent.getByLabel(EcalRecHitProducers[i], h_Ecal_RecHits); |
502 |
|
} |
503 |
|
|
504 |
|
|
505 |
+ |
// ### HCALRecHits ### |
506 |
|
for(unsigned int i=0;i<HcalHBHERecHitProducers.size();i++){ |
507 |
|
edm::Handle<HBHERecHitCollection > h_HcalHBHE_RecHits; |
508 |
|
iEvent.getByLabel(HcalHBHERecHitProducers[i], h_HcalHBHE_RecHits); |
550 |
|
} |
551 |
|
} |
552 |
|
|
553 |
+ |
// ### 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 |
|
MyEvents->Events.push_back(MyEvent); |
621 |
|
} |
622 |
|
|