test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ConversionTrackEcalImpactPoint.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <vector>
3 #include <memory>
5 // Framework
6 //
7 
8 
9 //
10 #include <vector>
11 #include <map>
12 
13 static const float epsilon = 0.001;
14 
16 static float barrelRadius() {return 129.f;} //p81, p50, ECAL TDR
17 static float barrelHalfLength() {return 270.9f;} //p81, p50, ECAL TDR
18 static float endcapRadius() {return 171.1f;} // fig 3.26, p81, ECAL TDR
19 static float endcapZ() {return 320.5f;} // fig 3.26, p81, ECAL TDR
20 
21 
22 
24  Surface::RotationType rot; // unit rotation matrix
25 
26 
27  return new Cylinder(barrelRadius(), Surface::PositionType(0,0,0), rot,
30  -barrelHalfLength(),
31  barrelHalfLength()));
32 }
33 
35  Surface::RotationType rot; // unit rotation matrix
36  return new BoundDisk( Surface::PositionType( 0, 0, -endcapZ()), rot,
38 }
39 
41  Surface::RotationType rot; // unit rotation matrix
42 
43  return new BoundDisk( Surface::PositionType( 0, 0, endcapZ()), rot,
45 
46 }
47 
51 
52 
54 
55 theMF_(field)
56 {
57 
59 
60 }
61 
63 
64  delete forwardPropagator_ ;
65 
66 }
67 
68 std::vector<math::XYZPointF> ConversionTrackEcalImpactPoint::find( const std::vector<reco::TransientTrack>& tracks, const edm::Handle<edm::View<reco::CaloCluster> >& bcHandle ) {
69 
70 
71  std::vector<math::XYZPointF> result;
72  //
73  matchingBC_.clear();
74 
75  std::vector<reco::CaloClusterPtr> matchingBC(2);
76 
77 
78  //
79 
80 
81 
82  int iTrk=0;
83  for ( std::vector<reco::TransientTrack>::const_iterator iTk=tracks.begin(); iTk!=tracks.end(); ++iTk) {
84 
85  math::XYZPointF ecalImpactPosition(0.,0.,0.);
86  const TrajectoryStateOnSurface myTSOS=(*iTk).innermostMeasurementState();
87  if ( !( myTSOS.isValid() ) ) continue;
88 
90 
91 
92  if (!stateAtECAL_.isValid() || ( stateAtECAL_.isValid() && fabs(stateAtECAL_.globalPosition().eta() ) >1.479 ) ) {
93 
94 
95  if ( (*iTk).innermostMeasurementState().globalPosition().eta() > 0.) {
97 
98  } else {
99 
101 
102  }
103  }
104 
105 
106  if ( stateAtECAL_.isValid() ) ecalImpactPosition = stateAtECAL_.globalPosition();
107 
108 
109  result.push_back(ecalImpactPosition );
110 
111 
112  if ( stateAtECAL_.isValid() ) {
113  int goodBC=0;
114  float bcDistanceToTrack=9999;
115  reco::CaloClusterPtr matchedBCItr;
116  int ibc=0;
117  goodBC=0;
118 
119  for (unsigned i = 0; i < bcHandle->size(); ++i ) {
120  float dEta= bcHandle->ptrAt(i)->position().eta() - ecalImpactPosition.eta() ;
121  float dPhi= bcHandle->ptrAt(i)->position().phi() - ecalImpactPosition.phi() ;
122  if ( sqrt(dEta*dEta + dPhi*dPhi) < bcDistanceToTrack ) {
123  goodBC=ibc;
124  bcDistanceToTrack=sqrt(dEta*dEta + dPhi*dPhi);
125  }
126  ibc++;
127 
128  }
129 
130  matchingBC[iTrk]=bcHandle->ptrAt(goodBC);
131  }
132 
133 
134  iTrk++;
135  }
136 
138 
139  return result;
140 
141 }
142 
143 
144 
145 
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
Definition: Propagator.h:119
int i
Definition: DBlmapReader.cc:9
static BoundCylinder * initBarrel()
static float barrelHalfLength()
static BoundDisk * initNegative()
GlobalPoint globalPosition() const
static const ReferenceCountingPointer< BoundDisk > theNegativeEtaEndcap_
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Definition: Point3D.h:10
static const BoundDisk & positiveEtaEndcap()
ConversionTrackEcalImpactPoint(const MagneticField *field)
static BoundDisk * initPositive()
static float endcapRadius()
std::vector< reco::CaloClusterPtr > matchingBC_
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
static const BoundDisk & negativeEtaEndcap()
T sqrt(T t)
Definition: SSEVec.h:48
tuple result
Definition: query.py:137
std::vector< math::XYZPointF > find(const std::vector< reco::TransientTrack > &tracks, const edm::Handle< edm::View< reco::CaloCluster > > &bcHandle)
static const BoundCylinder & barrel()
static const ReferenceCountingPointer< BoundDisk > thePositiveEtaEndcap_
static float endcapZ()
static const ReferenceCountingPointer< BoundCylinder > theBarrel_
tuple tracks
Definition: testEve_cfg.py:39
Disk BoundDisk
Definition: BoundDisk.h:62
T eta() const
Definition: PV3DBase.h:76
std::vector< reco::CaloClusterPtr > matchingBC() const
static float barrelRadius()