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