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
9 //
13 
14 
15 //
16 #include "CLHEP/Units/GlobalPhysicalConstants.h"
17 #include <TMath.h>
18 #include <vector>
19 #include <map>
20 
25 
26 
28 
29 theMF_(field)
30 {
31 
33 
34 }
35 
37 
38  delete forwardPropagator_ ;
39 
40 }
41 
42 std::vector<math::XYZPoint> ConversionTrackEcalImpactPoint::find( const std::vector<reco::TransientTrack>& tracks, const edm::Handle<edm::View<reco::CaloCluster> >& bcHandle ) {
43 
44 
45  std::vector<math::XYZPoint> result;
46  //
47  matchingBC_.clear();
48 
49  std::vector<reco::CaloClusterPtr> matchingBC(2);
50 
51 
52  //
53 
54 
55 
56  int iTrk=0;
57  for ( std::vector<reco::TransientTrack>::const_iterator iTk=tracks.begin(); iTk!=tracks.end(); ++iTk) {
58 
59  math::XYZPoint ecalImpactPosition(0.,0.,0.);
60  const TrajectoryStateOnSurface myTSOS=(*iTk).innermostMeasurementState();
61  if ( !( myTSOS.isValid() ) ) continue;
62 
64 
65 
66  if (!stateAtECAL_.isValid() || ( stateAtECAL_.isValid() && fabs(stateAtECAL_.globalPosition().eta() ) >1.479 ) ) {
67 
68 
69  if ( (*iTk).innermostMeasurementState().globalPosition().eta() > 0.) {
71 
72  } else {
73 
75 
76  }
77  }
78 
79 
80  if ( stateAtECAL_.isValid() ) ecalImpactPosition = stateAtECAL_.globalPosition();
81 
82 
83  result.push_back(ecalImpactPosition );
84 
85 
86  if ( stateAtECAL_.isValid() ) {
87  int goodBC=0;
88  float bcDistanceToTrack=9999;
89  reco::CaloClusterPtr matchedBCItr;
90  int ibc=0;
91  goodBC=0;
92 
93  for (unsigned i = 0; i < bcHandle->size(); ++i ) {
94  float dEta= bcHandle->ptrAt(i)->position().eta() - ecalImpactPosition.eta() ;
95  float dPhi= bcHandle->ptrAt(i)->position().phi() - ecalImpactPosition.phi() ;
96  if ( sqrt(dEta*dEta + dPhi*dPhi) < bcDistanceToTrack ) {
97  goodBC=ibc;
98  bcDistanceToTrack=sqrt(dEta*dEta + dPhi*dPhi);
99  }
100  ibc++;
101 
102  }
103 
104  matchingBC[iTrk]=bcHandle->ptrAt(goodBC);
105  }
106 
107 
108  iTrk++;
109  }
110 
112 
113  return result;
114 
115 }
116 
117 
118 
119 
121 
122  const float epsilon = 0.001;
123  Surface::RotationType rot; // unit rotation matrix
124 
125 
126  theBarrel_ = new BoundCylinder( Surface::PositionType(0,0,0), rot,
128  barrelRadius()+epsilon,
129  -barrelHalfLength(),
130  barrelHalfLength()));
132  new BoundDisk( Surface::PositionType( 0, 0, -endcapZ()), rot,
133  SimpleDiskBounds( 0, endcapRadius(), -epsilon, epsilon));
134 
136  new BoundDisk( Surface::PositionType( 0, 0, endcapZ()), rot,
137  SimpleDiskBounds( 0, endcapRadius(), -epsilon, epsilon));
138 
139  theInit_ = true;
140 
141 
142 }
int i
Definition: DBlmapReader.cc:9
static ReferenceCountingPointer< BoundCylinder > theBarrel_
GlobalPoint globalPosition() const
static const BoundDisk & positiveEtaEndcap()
ConversionTrackEcalImpactPoint(const MagneticField *field)
std::vector< reco::CaloClusterPtr > matchingBC_
std::vector< math::XYZPoint > find(const std::vector< reco::TransientTrack > &tracks, const edm::Handle< edm::View< reco::CaloCluster > > &bcHandle)
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
static const BoundDisk & negativeEtaEndcap()
T sqrt(T t)
Definition: SSEVec.h:28
tuple result
Definition: query.py:137
static const BoundCylinder & barrel()
virtual TrajectoryStateOnSurface propagate(const TrajectoryStateOnSurface &tsos, const Plane &plane) const
tuple tracks
Definition: testEve_cfg.py:39
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
T eta() const
Definition: PV3DBase.h:70
static ReferenceCountingPointer< BoundDisk > thePositiveEtaEndcap_
static ReferenceCountingPointer< BoundDisk > theNegativeEtaEndcap_
const double epsilon
std::vector< reco::CaloClusterPtr > matchingBC() const