Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F8725563
Frog_Analyzer.cc
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
24 KB
Subscribers
None
Frog_Analyzer.cc
View Options
// -*- C++ -*-
//
// Package: Frog_Analyzer
// Class: Frog_Analyzer
//
/**\class Frog_Analyzer Frog_Analyzer.cc Visualisation/Frog/src/Frog_Analyzer.cc
Description: <one line class summary>
Implementation:
<Notes on implementation>
*/
//
// Original Author: Loic QUERTENMONT
// Created: Fri Oct 26 07:22:12 CEST 2007
// $Id: Frog_Analyzer.cc,v 1.4 2008-04-27 07:27:30 querten Exp $
//
//
// system include files
#include
<memory>
// user include files
#include
"FWCore/Framework/interface/Frameworkfwd.h"
#include
"FWCore/Framework/interface/EDAnalyzer.h"
#include
"FWCore/Framework/interface/Event.h"
#include
"FWCore/Framework/interface/MakerMacros.h"
#include
"FWCore/ParameterSet/interface/ParameterSet.h"
#include
"FWCore/ServiceRegistry/interface/Service.h"
#include
"FWCore/Framework/interface/ESHandle.h"
#include
"Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
#include
"Geometry/CommonDetUnit/interface/GeomDetUnit.h"
#include
"Geometry/Records/interface/TrackerDigiGeometryRecord.h"
#include
"Geometry/TrackerNumberingBuilder/interface/GeometricDet.h"
#include
"Geometry/CommonTopologies/interface/PixelTopology.h"
#include
"Geometry/CommonTopologies/interface/StripTopology.h"
#include
"Geometry/TrackerGeometryBuilder/interface/PixelGeomDetType.h"
#include
"Geometry/TrackerGeometryBuilder/interface/StripGeomDetType.h"
#include
"Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
#include
"Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
#include
"DataFormats/GeometrySurface/interface/BoundSurface.h"
#include
"DataFormats/DetId/interface/DetId.h"
#include
"Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
#include
"Geometry/Records/interface/IdealGeometryRecord.h"
#include
"Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
#include
"Geometry/CaloGeometry/interface/CaloGeometry.h"
#include
"Geometry/EcalBarrelAlgo/interface/EcalBarrelGeometry.h"
#include
"Geometry/EcalEndcapAlgo/interface/EcalEndcapGeometry.h"
#include
"Geometry/CaloGeometry/interface/CaloCellGeometry.h"
#include
"DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include
"Geometry/CommonDetUnit/interface/TrackingGeometry.h"
#include
"Geometry/Records/interface/MuonGeometryRecord.h"
#include
"Geometry/DTGeometry/interface/DTGeometry.h"
#include
"Geometry/CSCGeometry/interface/CSCGeometry.h"
#include
"Geometry/RPCGeometry/interface/RPCGeometry.h"
#include
"DataFormats/CaloRecHit/interface/CaloRecHit.h"
#include
"DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include
"DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
#include
"SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
#include
"SimDataFormats/TrackingHit/interface/PSimHit.h"
#include
"SimDataFormats/CrossingFrame/interface/CrossingFrame.h"
#include
"SimDataFormats/CrossingFrame/interface/MixCollection.h"
#include
"SimDataFormats/CaloHit/interface/PCaloHit.h"
#include
"SimDataFormats/Track/interface/SimTrack.h"
#include
"SimDataFormats/Vertex/interface/SimVertex.h"
#include
"DataFormats/Provenance/interface/BranchDescription.h"
#include
"DataFormats/Provenance/interface/Provenance.h"
#include
"DataFormats/Candidate/interface/Candidate.h"
#include
"DataFormats/HepMCCandidate/interface/GenParticleCandidate.h"
#include
"DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"
#include
"DataFormats/TrackReco/interface/Track.h"
#include
"DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
#include
"DataFormats/CSCRecHit/interface/CSCSegmentCollection.h"
#include
"DataFormats/DTRecHit/interface/DTRecHitCollection.h"
#include
"DataFormats/CSCRecHit/interface/CSCRecHit2DCollection.h"
#include
"DataFormats/RPCRecHit/interface/RPCRecHitCollection.h"
#include
"DataFormats/Math/interface/Point3D.h"
#include
"DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
#include
"DataFormats/GeometrySurface/interface/RectangularPlaneBounds.h"
#include
"Visualisation/Frog/interface/SimEvent.h"
#include
"Visualisation/Frog/interface/Geometry.h"
using
namespace
edm
;
using
namespace
std
;
//
// class decleration
//
class
Frog_Analyzer
:
public
edm
::
EDAnalyzer
{
public
:
explicit
Frog_Analyzer
(
const
edm
::
ParameterSet
&
);
~
Frog_Analyzer
();
private
:
virtual
void
beginJob
(
const
edm
::
EventSetup
&
iSetup
);
virtual
void
analyze
(
const
edm
::
Event
&
,
const
edm
::
EventSetup
&
);
virtual
void
endJob
();
MySimEvents
*
MyEvents
;
Geometry
*
Geom_Tracker
;
Geometry
*
Geom_ECAL
;
Geometry
*
Geom_HCAL
;
Geometry
*
Geom_Muon
;
std
::
string
OutputFile
;
std
::
vector
<
InputTag
>
SimTrackProducers
;
std
::
vector
<
InputTag
>
SimVertexProducers
;
std
::
vector
<
InputTag
>
SimHitProducers
;
std
::
vector
<
InputTag
>
TrackProducers
;
std
::
vector
<
InputTag
>
EcalRecHitProducers
;
std
::
vector
<
InputTag
>
HcalHBHERecHitProducers
;
std
::
vector
<
InputTag
>
HcalHORecHitProducers
;
std
::
vector
<
InputTag
>
HcalHFRecHitProducers
;
std
::
vector
<
InputTag
>
DTSegmentProducers
;
std
::
vector
<
InputTag
>
CSCSegmentProducers
;
std
::
vector
<
InputTag
>
RPCHitsProducers
;
// ----------member data ---------------------------
};
//
// constructors and destructor
//
Frog_Analyzer
::
Frog_Analyzer
(
const
edm
::
ParameterSet
&
iConfig
)
{
OutputFile
=
iConfig
.
getParameter
<
std
::
string
>
(
"OutputFile"
);
SimTrackProducers
=
iConfig
.
getParameter
<
std
::
vector
<
InputTag
>
>
(
"SimTrackProducers"
);
SimVertexProducers
=
iConfig
.
getParameter
<
std
::
vector
<
InputTag
>
>
(
"SimVertexProducers"
);
SimHitProducers
=
iConfig
.
getParameter
<
std
::
vector
<
InputTag
>
>
(
"SimHitProducers"
);
TrackProducers
=
iConfig
.
getParameter
<
std
::
vector
<
InputTag
>
>
(
"TrackProducers"
);
EcalRecHitProducers
=
iConfig
.
getParameter
<
std
::
vector
<
InputTag
>
>
(
"EcalRecHitProducers"
);
HcalHBHERecHitProducers
=
iConfig
.
getParameter
<
std
::
vector
<
InputTag
>
>
(
"HcalHBHERecHitProducers"
);
HcalHORecHitProducers
=
iConfig
.
getParameter
<
std
::
vector
<
InputTag
>
>
(
"HcalHORecHitProducers"
);
HcalHFRecHitProducers
=
iConfig
.
getParameter
<
std
::
vector
<
InputTag
>
>
(
"HcalHFRecHitProducers"
);
DTSegmentProducers
=
iConfig
.
getParameter
<
std
::
vector
<
InputTag
>
>
(
"DTSegmentProducers"
);
CSCSegmentProducers
=
iConfig
.
getParameter
<
std
::
vector
<
InputTag
>
>
(
"CSCSegmentProducers"
);
RPCHitsProducers
=
iConfig
.
getParameter
<
std
::
vector
<
InputTag
>
>
(
"RPCHitsProducers"
);
}
Frog_Analyzer
::~
Frog_Analyzer
()
{
}
// ------------ method called once each job just before starting event loop ------------
void
Frog_Analyzer
::
beginJob
(
const
edm
::
EventSetup
&
iSetup
)
{
DetId
Detid
;
int
SubDet
;
MyEvents
=
new
MySimEvents
();
Geom_Tracker
=
new
Geometry
();
Geom_ECAL
=
new
Geometry
();
Geom_HCAL
=
new
Geometry
();
Geom_Muon
=
new
Geometry
();
// ### TRACKER GEOMETRY ###
edm
::
ESHandle
<
TrackerGeometry
>
tkGeom
;
iSetup
.
get
<
TrackerDigiGeometryRecord
>
().
get
(
tkGeom
);
vector
<
GeomDet
*>
TrackerDets
=
tkGeom
->
dets
();
for
(
unsigned
int
i
=
0
;
i
<
TrackerDets
.
size
();
i
++
){
Detid
=
TrackerDets
[
i
]
->
geographicalId
();
// SubDet = Detid.subdetId();
GeomDet
*
DetUnit
=
TrackerDets
[
i
];
if
(
!
DetUnit
)
continue
;
const
BoundPlane
plane
=
DetUnit
->
surface
();
const
TrapezoidalPlaneBounds
*
trapezoidalBounds
(
dynamic_cast
<
const
TrapezoidalPlaneBounds
*>
(
&
(
plane
.
bounds
())));
const
RectangularPlaneBounds
*
rectangularBounds
(
dynamic_cast
<
const
RectangularPlaneBounds
*>
(
&
(
plane
.
bounds
())));
float
width
=
0
;
float
length
=
0
;
float
thickness
=
0
;
float
TrapezoidalParam
=
0
;
if
(
trapezoidalBounds
)
{
std
::
vector
<
float
>
const
&
parameters
=
(
*
trapezoidalBounds
).
parameters
();
width
=
parameters
[
0
]
*
2
;
length
=
parameters
[
3
]
*
2
;
thickness
=
(
*
trapezoidalBounds
).
thickness
();
TrapezoidalParam
=
parameters
[
1
]
/
parameters
[
0
];
}
else
if
(
rectangularBounds
){
width
=
DetUnit
->
surface
().
bounds
().
width
();
length
=
DetUnit
->
surface
().
bounds
().
length
();
thickness
=
DetUnit
->
surface
().
bounds
().
thickness
();
TrapezoidalParam
=
1
;
}
Surface
::
GlobalPoint
WidthVector
=
plane
.
toGlobal
(
LocalPoint
(
width
/
2
,
0
,
0
)
);
Surface
::
GlobalPoint
LengthVector
=
plane
.
toGlobal
(
LocalPoint
(
0
,
length
/
2
,
0
)
);
Surface
::
GlobalPoint
ThickVector
=
plane
.
toGlobal
(
LocalPoint
(
0
,
0
,
thickness
/
2
)
);
GlobalVector
Pos
=
GlobalVector
(
DetUnit
->
position
().
basicVector
());
Geom_Tracker
->
Add_TrackerDet
(
Detid
.
rawId
(),
TrapezoidalParam
,
Pos
.
x
(),
Pos
.
y
(),
Pos
.
z
(),
WidthVector
.
x
()
-
Pos
.
x
(),
WidthVector
.
y
()
-
Pos
.
y
(),
WidthVector
.
z
()
-
Pos
.
z
(),
LengthVector
.
x
()
-
Pos
.
x
(),
LengthVector
.
y
()
-
Pos
.
y
(),
LengthVector
.
z
()
-
Pos
.
z
(),
ThickVector
.
x
()
-
Pos
.
x
(),
ThickVector
.
y
()
-
Pos
.
y
(),
ThickVector
.
z
()
-
Pos
.
z
());
}
// ### CALO GEOMETRY ###
edm
::
ESHandle
<
CaloGeometry
>
CaloGeom
;
iSetup
.
get
<
IdealGeometryRecord
>
().
get
(
CaloGeom
);
const
vector
<
DetId
>
CaloDets
=
CaloGeom
->
getValidDetIds
();
for
(
unsigned
int
i
=
0
;
i
<
CaloDets
.
size
();
i
++
)
{
Detid
=
CaloDets
[
i
];
SubDet
=
Detid
.
subdetId
();
Geometry
*
Geom_temp
=
NULL
;
if
(
Detid
.
det
()
==
DetId
::
Ecal
){
Geom_temp
=
Geom_ECAL
;
if
(
SubDet
<
1
||
SubDet
>
3
){
printf
(
"Don't Save EcalTriggerTower or EcalLaserPnDiode
\n
"
);
continue
;
}
}
else
if
(
Detid
.
det
()
==
DetId
::
Hcal
){
Geom_temp
=
Geom_HCAL
;
if
(
SubDet
<
1
||
SubDet
>
4
){
printf
(
"Don't Save HcalEmpty, HcalTriggerTower, HcalOther
\n
"
);
continue
;
}
}
else
{
continue
;
}
const
CaloCellGeometry
*
CellGeom
=
CaloGeom
->
getGeometry
(
Detid
);
GlobalPoint
CellPos
=
CellGeom
->
getPosition
();
const
CaloCellGeometry
::
CornersVec
CellCorners
=
CellGeom
->
getCorners
();
float
cX
=
(
CellCorners
[
0
].
x
()
+
CellCorners
[
2
].
x
())
/
2
;
float
cY
=
(
CellCorners
[
0
].
y
()
+
CellCorners
[
2
].
y
())
/
2
;
float
cZ
=
(
CellCorners
[
0
].
z
()
+
CellCorners
[
2
].
z
())
/
2
;
float
wX
=
(
CellCorners
[
1
].
x
()
-
CellCorners
[
0
].
x
())
/
2
;
float
wY
=
(
CellCorners
[
1
].
y
()
-
CellCorners
[
0
].
y
())
/
2
;
float
wZ
=
(
CellCorners
[
1
].
z
()
-
CellCorners
[
0
].
z
())
/
2
;
float
hX
=
(
CellCorners
[
3
].
x
()
-
CellCorners
[
0
].
x
())
/
2
;
float
hY
=
(
CellCorners
[
3
].
y
()
-
CellCorners
[
0
].
y
())
/
2
;
float
hZ
=
(
CellCorners
[
3
].
z
()
-
CellCorners
[
0
].
z
())
/
2
;
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
)
);
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
)
);
Geom_temp
->
Add_CaloDet
(
Detid
.
rawId
(),
cX
,
cY
,
cZ
,
wX
,
wY
,
wZ
,
hX
,
hY
,
hZ
,
F
);
}
// ### MUON GEOMETRY ###
edm
::
ESHandle
<
DTGeometry
>
DtGeom
;
iSetup
.
get
<
MuonGeometryRecord
>
().
get
(
DtGeom
);
const
vector
<
GeomDet
*>
DtDets
=
DtGeom
->
dets
();
edm
::
ESHandle
<
CSCGeometry
>
CscGeom
;
iSetup
.
get
<
MuonGeometryRecord
>
().
get
(
CscGeom
);
const
vector
<
GeomDet
*>
CscDets
=
CscGeom
->
dets
();
edm
::
ESHandle
<
RPCGeometry
>
RpcGeom
;
iSetup
.
get
<
MuonGeometryRecord
>
().
get
(
RpcGeom
);
const
vector
<
GeomDet
*>
RpcDets
=
RpcGeom
->
dets
();
vector
<
GeomDet
*>
MuonDets
;
for
(
unsigned
int
i
=
0
;
i
<
DtDets
.
size
()
;
i
++
){
MuonDets
.
push_back
(
DtDets
[
i
]);}
for
(
unsigned
int
i
=
0
;
i
<
CscDets
.
size
();
i
++
){
MuonDets
.
push_back
(
CscDets
[
i
]);}
for
(
unsigned
int
i
=
0
;
i
<
RpcDets
.
size
();
i
++
){
MuonDets
.
push_back
(
RpcDets
[
i
]);}
for
(
unsigned
int
i
=
0
;
i
<
MuonDets
.
size
();
i
++
)
{
Detid
=
DetId
(
MuonDets
[
i
]
->
geographicalId
());
SubDet
=
Detid
.
subdetId
();
GeomDet
*
DetUnit
=
MuonDets
[
i
];
if
(
!
DetUnit
)
continue
;
const
BoundPlane
plane
=
DetUnit
->
surface
();
const
TrapezoidalPlaneBounds
*
trapezoidalBounds
(
dynamic_cast
<
const
TrapezoidalPlaneBounds
*>
(
&
(
plane
.
bounds
())));
const
RectangularPlaneBounds
*
rectangularBounds
(
dynamic_cast
<
const
RectangularPlaneBounds
*>
(
&
(
plane
.
bounds
())));
float
width
=
0
;
float
length
=
0
;
float
thickness
=
0
;
float
TrapezoidalParam
=
0
;
if
(
trapezoidalBounds
)
{
std
::
vector
<
float
>
const
&
parameters
=
(
*
trapezoidalBounds
).
parameters
();
width
=
parameters
[
0
]
*
2
;
length
=
parameters
[
3
]
*
2
;
thickness
=
(
*
trapezoidalBounds
).
thickness
();
TrapezoidalParam
=
parameters
[
1
]
/
parameters
[
0
];
}
else
if
(
rectangularBounds
){
width
=
DetUnit
->
surface
().
bounds
().
width
();
length
=
DetUnit
->
surface
().
bounds
().
length
();
thickness
=
DetUnit
->
surface
().
bounds
().
thickness
();
TrapezoidalParam
=
1
;
}
Surface
::
GlobalPoint
WidthVector
=
plane
.
toGlobal
(
LocalPoint
(
width
/
2
,
0
,
0
)
);
Surface
::
GlobalPoint
LengthVector
=
plane
.
toGlobal
(
LocalPoint
(
0
,
length
/
2
,
0
)
);
Surface
::
GlobalPoint
ThickVector
=
plane
.
toGlobal
(
LocalPoint
(
0
,
0
,
thickness
/
2
)
);
GlobalVector
Pos
=
GlobalVector
(
DetUnit
->
position
().
basicVector
());
Geom_Muon
->
Add_TrackerDet
(
Detid
.
rawId
(),
TrapezoidalParam
,
Pos
.
x
(),
Pos
.
y
(),
Pos
.
z
(),
WidthVector
.
x
()
-
Pos
.
x
(),
WidthVector
.
y
()
-
Pos
.
y
(),
WidthVector
.
z
()
-
Pos
.
z
(),
LengthVector
.
x
()
-
Pos
.
x
(),
LengthVector
.
y
()
-
Pos
.
y
(),
LengthVector
.
z
()
-
Pos
.
z
(),
ThickVector
.
x
()
-
Pos
.
x
(),
ThickVector
.
y
()
-
Pos
.
y
(),
ThickVector
.
z
()
-
Pos
.
z
());
}
// ### Save .geom ###
Geom_Tracker
->
Save
(
"Tracker.geom"
);
Geom_ECAL
->
Save
(
"Ecal.geom"
);
Geom_HCAL
->
Save
(
"Hcal.geom"
);
Geom_Muon
->
Save
(
"Muon.geom"
);
}
// ------------ method called once each job just after ending the event loop ------------
void
Frog_Analyzer
::
endJob
()
{
MyEvents
->
Save
((
char
*
)
OutputFile
.
c_str
());
// MyEvents->Load((char*) OutputFile.c_str());
}
//
// member functions
//
// ------------ method called to for each event ------------
void
Frog_Analyzer
::
analyze
(
const
edm
::
Event
&
iEvent
,
const
edm
::
EventSetup
&
iSetup
)
{
MySimEvent
*
MyEvent
=
new
MySimEvent
;
// access the tracker
edm
::
ESHandle
<
TrackerGeometry
>
tkGeom
;
iSetup
.
get
<
TrackerDigiGeometryRecord
>
().
get
(
tkGeom
);
edm
::
ESHandle
<
DTGeometry
>
DtGeom
;
iSetup
.
get
<
MuonGeometryRecord
>
().
get
(
DtGeom
);
edm
::
ESHandle
<
CSCGeometry
>
CscGeom
;
iSetup
.
get
<
MuonGeometryRecord
>
().
get
(
CscGeom
);
edm
::
ESHandle
<
RPCGeometry
>
RpcGeom
;
iSetup
.
get
<
MuonGeometryRecord
>
().
get
(
RpcGeom
);
// Save Data
// ### SIMTRACK ###
for
(
unsigned
int
i
=
0
;
i
<
SimTrackProducers
.
size
();
i
++
){
edm
::
Handle
<
std
::
vector
<
SimTrack
>
>
h_SimTracks
;
iEvent
.
getByLabel
(
SimTrackProducers
[
i
],
h_SimTracks
);
std
::
vector
<
SimTrack
>
SimTrackColl
=
*
h_SimTracks
.
product
();
for
(
unsigned
int
a
=
0
;
a
<
SimTrackColl
.
size
();
++
a
)
{
MySimTrack
*
MysimTrack
=
new
MySimTrack
;
SimTrack
simTrack
=
SimTrackColl
[
a
];
MysimTrack
->
track_id
=
simTrack
.
trackId
();
MysimTrack
->
Type
=
simTrack
.
type
();
MysimTrack
->
parent_vertex
=
simTrack
.
vertIndex
();
MysimTrack
->
Px
=
simTrack
.
momentum
().
x
();
MysimTrack
->
Py
=
simTrack
.
momentum
().
y
();
MysimTrack
->
Pz
=
simTrack
.
momentum
().
z
();
MysimTrack
->
E
=
simTrack
.
momentum
().
e
();
MysimTrack
->
charge
=
simTrack
.
charge
();
MyEvent
->
MySimTrackCollection
.
push_back
(
MysimTrack
);
}
}
// ### SIMVERTEX ###
for
(
unsigned
int
i
=
0
;
i
<
SimVertexProducers
.
size
();
i
++
){
edm
::
Handle
<
std
::
vector
<
SimVertex
>
>
h_Vertex
;
iEvent
.
getByLabel
(
SimVertexProducers
[
i
],
h_Vertex
);
std
::
vector
<
SimVertex
>
VertexColl
=
*
h_Vertex
.
product
();
for
(
unsigned
int
b
=
0
;
b
<
VertexColl
.
size
();
++
b
)
{
MySimVertex
*
MyVertex
=
new
MySimVertex
;
SimVertex
Vertex
=
VertexColl
[
b
];
MyVertex
->
parentTrack_id
=
Vertex
.
parentIndex
();
MyVertex
->
x
=
Vertex
.
position
().
x
();
MyVertex
->
y
=
Vertex
.
position
().
y
();
MyVertex
->
z
=
Vertex
.
position
().
z
();
MyEvent
->
MySimVertexCollection
.
push_back
(
MyVertex
);
}
}
// ### SIMHIT ###
for
(
unsigned
int
i
=
0
;
i
<
SimHitProducers
.
size
();
i
++
){
edm
::
Handle
<
std
::
vector
<
PSimHit
>
>
h_Hits
;
iEvent
.
getByLabel
(
SimHitProducers
[
i
],
h_Hits
);
std
::
vector
<
PSimHit
>
Hits
=
*
h_Hits
.
product
();
for
(
unsigned
int
h
=
0
;
h
<
Hits
.
size
();
h
++
)
{
DetId
theDetUnitId
(
Hits
[
h
].
detUnitId
());
const
GeomDet
*
theDet
=
tkGeom
->
idToDet
(
theDetUnitId
);
MyPSimHit
*
Hit
=
new
MyPSimHit
;
Hit
->
x
=
theDet
->
surface
().
toGlobal
(
Hits
[
h
].
localPosition
()).
x
();
Hit
->
y
=
theDet
->
surface
().
toGlobal
(
Hits
[
h
].
localPosition
()).
y
();
Hit
->
z
=
theDet
->
surface
().
toGlobal
(
Hits
[
h
].
localPosition
()).
z
();
Hit
->
ProcessType
=
Hits
[
h
].
processType
();
Hit
->
dEdX
=
Hits
[
h
].
energyLoss
();
MyEvent
->
MyPSimHitCollection
.
push_back
(
Hit
);
}
}
// ### TRACKS ###
for
(
unsigned
int
i
=
0
;
i
<
TrackProducers
.
size
();
i
++
){
edm
::
Handle
<
std
::
vector
<
reco
::
Track
>
>
h_Tracks
;
iEvent
.
getByLabel
(
TrackProducers
[
i
],
h_Tracks
);
std
::
vector
<
reco
::
Track
>
TrackColl
=
*
h_Tracks
.
product
();
for
(
unsigned
int
t
=
0
;
t
<
TrackColl
.
size
();
++
t
)
{
MyRecoTrack
*
MyrecoTrack
=
new
MyRecoTrack
;
reco
::
Track
recoTrack
=
TrackColl
[
t
];
for
(
unsigned
int
h
=
0
;
h
<
recoTrack
.
recHitsSize
();
h
++
){
TrackingRecHitRef
h_it
=
recoTrack
.
recHit
(
h
);
if
(
!
h_it
->
isValid
()
)
continue
;
DetId
detId
=
h_it
->
geographicalId
();
const
GeomDet
*
theDet
=
tkGeom
->
idToDet
(
detId
);
LocalPoint
localPos
=
h_it
->
localPosition
();
MyRecoHit
*
hit
=
new
MyRecoHit
;
hit
->
x
=
theDet
->
surface
().
toGlobal
(
localPos
).
x
();
hit
->
y
=
theDet
->
surface
().
toGlobal
(
localPos
).
y
();
hit
->
z
=
theDet
->
surface
().
toGlobal
(
localPos
).
z
();
hit
->
DetId
=
detId
.
rawId
();
hit
->
Charge
=
-
1
;
MyrecoTrack
->
Hits
.
push_back
(
hit
);
}
MyEvent
->
MyRecoTrackCollection
.
push_back
(
MyrecoTrack
);
}
}
// ### ECALRecHits ###
for
(
unsigned
int
i
=
0
;
i
<
EcalRecHitProducers
.
size
();
i
++
){
edm
::
Handle
<
EcalRecHitCollection
>
h_Ecal_RecHits
;
iEvent
.
getByLabel
(
EcalRecHitProducers
[
i
],
h_Ecal_RecHits
);
EcalRecHitCollection
Ecal_RecHits
=
*
h_Ecal_RecHits
.
product
();
for
(
unsigned
int
eh
=
0
;
eh
<
Ecal_RecHits
.
size
();
eh
++
){
MyCaloHit
*
temp_EcalHit
=
new
MyCaloHit
;
temp_EcalHit
->
E
=
Ecal_RecHits
[
eh
].
energy
();
temp_EcalHit
->
t
=
Ecal_RecHits
[
eh
].
time
();
temp_EcalHit
->
DetId
=
(
Ecal_RecHits
[
eh
].
detid
()).
rawId
();
MyEvent
->
MyEcalCaloHitCollection
.
push_back
(
temp_EcalHit
);
}
}
// ### HCALRecHits ###
for
(
unsigned
int
i
=
0
;
i
<
HcalHBHERecHitProducers
.
size
();
i
++
){
edm
::
Handle
<
HBHERecHitCollection
>
h_HcalHBHE_RecHits
;
iEvent
.
getByLabel
(
HcalHBHERecHitProducers
[
i
],
h_HcalHBHE_RecHits
);
HBHERecHitCollection
HcalHBHE_RecHits
=
*
h_HcalHBHE_RecHits
.
product
();
for
(
unsigned
int
hh
=
0
;
hh
<
HcalHBHE_RecHits
.
size
();
hh
++
){
MyCaloHit
*
temp_HcalHBHEHit
=
new
MyCaloHit
;
temp_HcalHBHEHit
->
E
=
HcalHBHE_RecHits
[
hh
].
energy
();
temp_HcalHBHEHit
->
t
=
HcalHBHE_RecHits
[
hh
].
time
();
temp_HcalHBHEHit
->
DetId
=
(
HcalHBHE_RecHits
[
hh
].
detid
()).
rawId
();
MyEvent
->
MyHcalCaloHitCollection
.
push_back
(
temp_HcalHBHEHit
);
}
}
for
(
unsigned
int
i
=
0
;
i
<
HcalHORecHitProducers
.
size
();
i
++
){
edm
::
Handle
<
HORecHitCollection
>
h_HcalHO_RecHits
;
iEvent
.
getByLabel
(
HcalHORecHitProducers
[
i
],
h_HcalHO_RecHits
);
HORecHitCollection
HcalHO_RecHits
=
*
h_HcalHO_RecHits
.
product
();
for
(
unsigned
int
hh
=
0
;
hh
<
HcalHO_RecHits
.
size
();
hh
++
){
MyCaloHit
*
temp_HcalHOHit
=
new
MyCaloHit
;
temp_HcalHOHit
->
E
=
HcalHO_RecHits
[
hh
].
energy
();
temp_HcalHOHit
->
t
=
HcalHO_RecHits
[
hh
].
time
();
temp_HcalHOHit
->
DetId
=
(
HcalHO_RecHits
[
hh
].
detid
()).
rawId
();
MyEvent
->
MyHcalCaloHitCollection
.
push_back
(
temp_HcalHOHit
);
}
}
for
(
unsigned
int
i
=
0
;
i
<
HcalHFRecHitProducers
.
size
();
i
++
){
edm
::
Handle
<
HFRecHitCollection
>
h_HcalHF_RecHits
;
iEvent
.
getByLabel
(
HcalHFRecHitProducers
[
i
],
h_HcalHF_RecHits
);
HFRecHitCollection
HcalHF_RecHits
=
*
h_HcalHF_RecHits
.
product
();
for
(
unsigned
int
hh
=
0
;
hh
<
HcalHF_RecHits
.
size
();
hh
++
){
MyCaloHit
*
temp_HcalHFHit
=
new
MyCaloHit
;
temp_HcalHFHit
->
E
=
HcalHF_RecHits
[
hh
].
energy
();
temp_HcalHFHit
->
t
=
HcalHF_RecHits
[
hh
].
time
();
temp_HcalHFHit
->
DetId
=
(
HcalHF_RecHits
[
hh
].
detid
()).
rawId
();
MyEvent
->
MyHcalCaloHitCollection
.
push_back
(
temp_HcalHFHit
);
}
}
// ### Muon Segments ###
for
(
unsigned
int
i
=
0
;
i
<
CSCSegmentProducers
.
size
();
i
++
){
edm
::
Handle
<
CSCSegmentCollection
>
h_CSC_Segments
;
iEvent
.
getByLabel
(
CSCSegmentProducers
[
i
],
h_CSC_Segments
);
CSCSegmentCollection
CSC_Segments
=
*
h_CSC_Segments
.
product
();
for
(
unsigned
int
s
=
0
;
s
<
CSC_Segments
.
size
();
s
++
){
DetId
theDetUnitId
=
CSC_Segments
[
s
].
geographicalId
();
const
GeomDet
*
theDet
=
CscGeom
->
idToDet
(
theDetUnitId
);
MyMuonSegment
*
temp_CscSeg
=
new
MyMuonSegment
;
temp_CscSeg
->
DetId
=
theDetUnitId
.
rawId
();
temp_CscSeg
->
PosX
=
theDet
->
surface
().
toGlobal
(
CSC_Segments
[
s
].
localPosition
()).
x
();
temp_CscSeg
->
PosY
=
theDet
->
surface
().
toGlobal
(
CSC_Segments
[
s
].
localPosition
()).
y
();
temp_CscSeg
->
PosZ
=
theDet
->
surface
().
toGlobal
(
CSC_Segments
[
s
].
localPosition
()).
z
();
temp_CscSeg
->
DirX
=
theDet
->
surface
().
toGlobal
(
CSC_Segments
[
s
].
localDirection
()).
x
();
temp_CscSeg
->
DirY
=
theDet
->
surface
().
toGlobal
(
CSC_Segments
[
s
].
localDirection
()).
y
();
temp_CscSeg
->
DirZ
=
theDet
->
surface
().
toGlobal
(
CSC_Segments
[
s
].
localDirection
()).
z
();
MyEvent
->
MyMuonSegmentCollection
.
push_back
(
temp_CscSeg
);
}
}
for
(
unsigned
int
i
=
0
;
i
<
DTSegmentProducers
.
size
();
i
++
){
edm
::
Handle
<
DTRecSegment4DCollection
>
h_DT_Segments
;
iEvent
.
getByLabel
(
DTSegmentProducers
[
i
],
h_DT_Segments
);
DTRecSegment4DCollection
DT_Segments
=
*
h_DT_Segments
.
product
();
for
(
unsigned
int
s
=
0
;
s
<
DT_Segments
.
size
();
s
++
){
DetId
theDetUnitId
=
DT_Segments
[
s
].
geographicalId
();
const
GeomDet
*
theDet
=
DtGeom
->
idToDet
(
theDetUnitId
);
MyMuonSegment
*
temp_DtSeg
=
new
MyMuonSegment
;
temp_DtSeg
->
DetId
=
theDetUnitId
.
rawId
();
temp_DtSeg
->
PosX
=
theDet
->
surface
().
toGlobal
(
DT_Segments
[
s
].
localPosition
()).
x
();
temp_DtSeg
->
PosY
=
theDet
->
surface
().
toGlobal
(
DT_Segments
[
s
].
localPosition
()).
y
();
temp_DtSeg
->
PosZ
=
theDet
->
surface
().
toGlobal
(
DT_Segments
[
s
].
localPosition
()).
z
();
temp_DtSeg
->
DirX
=
theDet
->
surface
().
toGlobal
(
DT_Segments
[
s
].
localDirection
()).
x
();
temp_DtSeg
->
DirY
=
theDet
->
surface
().
toGlobal
(
DT_Segments
[
s
].
localDirection
()).
y
();
temp_DtSeg
->
DirZ
=
theDet
->
surface
().
toGlobal
(
DT_Segments
[
s
].
localDirection
()).
z
();
MyEvent
->
MyMuonSegmentCollection
.
push_back
(
temp_DtSeg
);
}
}
// ### Muon Hits ###
for
(
unsigned
int
i
=
0
;
i
<
RPCHitsProducers
.
size
();
i
++
){
edm
::
Handle
<
RPCRecHitCollection
>
h_RPC_Hits
;
iEvent
.
getByLabel
(
RPCHitsProducers
[
i
],
h_RPC_Hits
);
RPCRecHitCollection
RPC_Hits
=
*
h_RPC_Hits
.
product
();
for
(
unsigned
int
h
=
0
;
h
<
RPC_Hits
.
size
();
h
++
){
DetId
theDetUnitId
=
RPC_Hits
[
h
].
geographicalId
();
const
GeomDet
*
theDet
=
RpcGeom
->
idToDet
(
theDetUnitId
);
MyMuonHit
*
temp_RpcHit
=
new
MyMuonHit
;
temp_RpcHit
->
DetId
=
theDetUnitId
.
rawId
();
temp_RpcHit
->
x
=
theDet
->
surface
().
toGlobal
(
RPC_Hits
[
h
].
localPosition
()).
x
();
temp_RpcHit
->
y
=
theDet
->
surface
().
toGlobal
(
RPC_Hits
[
h
].
localPosition
()).
y
();
temp_RpcHit
->
z
=
theDet
->
surface
().
toGlobal
(
RPC_Hits
[
h
].
localPosition
()).
z
();
MyEvent
->
MyMuonHitCollection
.
push_back
(
temp_RpcHit
);
}
}
MyEvents
->
Events
.
push_back
(
MyEvent
);
}
//define this as a plug-in
DEFINE_FWK_MODULE
(
Frog_Analyzer
);
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Tue, Jan 21, 1:51 AM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4239820
Default Alt Text
Frog_Analyzer.cc (24 KB)
Attached To
rFROGSVN frogsvn
Event Timeline
Log In to Comment