CMS 3D CMS Logo

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 constexpr float epsilon = 0.001;
14 
16 constexpr float barrelRadius = 129.f; // p81, p50, ECAL TDR
17 constexpr float barrelHalfLength = 270.9f; // p81, p50, ECAL TDR
18 constexpr float endcapRadius = 171.1f; // fig 3.26, p81, ECAL TDR
19 constexpr float endcapZ = 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,
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(auto const& track : tracks) {
84 
85  math::XYZPointF ecalImpactPosition(0.,0.,0.);
86  const TrajectoryStateOnSurface myTSOS = track.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 ( track.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(auto const& bc : *bcHandle) {
120  float dEta= bc.position().eta() - ecalImpactPosition.eta();
121  float dPhi= bc.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  matchingBC[iTrk]=bcHandle->ptrAt(goodBC);
130  }
131 
132 
133  iTrk++;
134  }
135 
137 
138  return result;
139 
140 }
141 
142 
143 
144 
static BoundCylinder * initBarrel()
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()
std::vector< reco::CaloClusterPtr > matchingBC_
static const BoundDisk & negativeEtaEndcap()
T sqrt(T t)
Definition: SSEVec.h:18
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 const ReferenceCountingPointer< BoundCylinder > theBarrel_
Disk BoundDisk
Definition: BoundDisk.h:62
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
T eta() const
Definition: PV3DBase.h:76
std::vector< reco::CaloClusterPtr > matchingBC() const
#define constexpr