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 #include <vector>
10 #include <map>
11 
12 constexpr float epsilon = 0.001;
13 
15 constexpr float barrelRadius = 129.f; // p81, p50, ECAL TDR
16 constexpr float barrelHalfLength = 270.9f; // p81, p50, ECAL TDR
17 constexpr float endcapRadius = 171.1f; // fig 3.26, p81, ECAL TDR
18 constexpr float endcapZ = 320.5f; // fig 3.26, p81, ECAL TDR
19 
21  Surface::RotationType rot; // unit rotation matrix
22 
23  return new Cylinder(
25  Surface::PositionType(0, 0, 0),
26  rot,
28 }
29 
31  Surface::RotationType rot; // unit rotation matrix
32  return new BoundDisk(
34 }
35 
37  Surface::RotationType rot; // unit rotation matrix
38 
39  return new BoundDisk(
41 }
42 
46 
48  :
49 
50  theMF_(field) {
52 }
53 
55 
56 std::vector<math::XYZPointF> ConversionTrackEcalImpactPoint::find(
57  const std::vector<reco::TransientTrack>& tracks, const edm::Handle<edm::View<reco::CaloCluster> >& bcHandle) {
58  std::vector<math::XYZPointF> result;
59  //
60  matchingBC_.clear();
61 
62  std::vector<reco::CaloClusterPtr> matchingBC(2);
63 
64  //
65 
66  int iTrk = 0;
67  for (auto const& track : tracks) {
68  math::XYZPointF ecalImpactPosition(0., 0., 0.);
69  const TrajectoryStateOnSurface myTSOS = track.innermostMeasurementState();
70  if (!(myTSOS.isValid()))
71  continue;
72 
74 
75  if (!stateAtECAL_.isValid() || (stateAtECAL_.isValid() && fabs(stateAtECAL_.globalPosition().eta()) > 1.479)) {
76  if (track.innermostMeasurementState().globalPosition().eta() > 0.) {
78 
79  } else {
81  }
82  }
83 
84  if (stateAtECAL_.isValid())
85  ecalImpactPosition = stateAtECAL_.globalPosition();
86 
87  result.push_back(ecalImpactPosition);
88 
89  if (stateAtECAL_.isValid()) {
90  int goodBC = 0;
91  float bcDistanceToTrack = 9999;
92  reco::CaloClusterPtr matchedBCItr;
93  int ibc = 0;
94  goodBC = 0;
95 
96  for (auto const& bc : *bcHandle) {
97  float dEta = bc.position().eta() - ecalImpactPosition.eta();
98  float dPhi = bc.position().phi() - ecalImpactPosition.phi();
99  if (sqrt(dEta * dEta + dPhi * dPhi) < bcDistanceToTrack) {
100  goodBC = ibc;
101  bcDistanceToTrack = sqrt(dEta * dEta + dPhi * dPhi);
102  }
103  ibc++;
104  }
105 
106  matchingBC[iTrk] = bcHandle->ptrAt(goodBC);
107  }
108 
109  iTrk++;
110  }
111 
113 
114  return result;
115 }
static BoundCylinder * initBarrel()
static BoundDisk * initNegative()
T eta() const
Definition: PV3DBase.h:73
static const ReferenceCountingPointer< BoundDisk > theNegativeEtaEndcap_
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Definition: Point3D.h:10
constexpr float barrelHalfLength
static const BoundDisk & positiveEtaEndcap()
ConversionTrackEcalImpactPoint(const MagneticField *field)
std::vector< reco::CaloClusterPtr > matchingBC() const
static BoundDisk * initPositive()
std::vector< reco::CaloClusterPtr > matchingBC_
GlobalPoint globalPosition() const
static const BoundDisk & negativeEtaEndcap()
T sqrt(T t)
Definition: SSEVec.h:19
constexpr float endcapRadius
std::vector< math::XYZPointF > find(const std::vector< reco::TransientTrack > &tracks, const edm::Handle< edm::View< reco::CaloCluster > > &bcHandle)
static const BoundCylinder & barrel()
constexpr float endcapZ
static const ReferenceCountingPointer< BoundDisk > thePositiveEtaEndcap_
constexpr float epsilon
static const ReferenceCountingPointer< BoundCylinder > theBarrel_
auto const & tracks
cannot be loose
Disk BoundDisk
Definition: BoundDisk.h:54
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:50
constexpr float barrelRadius