CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
TrackInfoProducerAlgorithm Class Reference

#include <TrackInfoProducerAlgorithm.h>

Public Types

typedef TrackingRecHit::ConstRecHitPointer ConstRecHitPointer
 

Public Member Functions

LocalPoint project (const GeomDet *det, const GeomDet *projdet, LocalPoint position, LocalVector trackdirection) const
 
void run (const edm::Ref< std::vector< Trajectory > > traj_iterator, reco::TrackRef track, reco::TrackInfo &output, const TrackerGeometry *tracker)
 
 TrackInfoProducerAlgorithm (const edm::ParameterSet &conf)
 
 ~TrackInfoProducerAlgorithm ()
 

Private Attributes

std::string backwardPredictedStateTag_
 
std::string combinedStateTag_
 
edm::ParameterSet conf_
 
std::string forwardPredictedStateTag_
 
std::string updatedStateTag_
 

Detailed Description

Definition at line 20 of file TrackInfoProducerAlgorithm.h.

Member Typedef Documentation

Definition at line 23 of file TrackInfoProducerAlgorithm.h.

Constructor & Destructor Documentation

TrackInfoProducerAlgorithm::TrackInfoProducerAlgorithm ( const edm::ParameterSet conf)
inline

Definition at line 25 of file TrackInfoProducerAlgorithm.h.

25  :
26  conf_(conf),
27  forwardPredictedStateTag_(conf.getParameter<std::string>( "forwardPredictedState" )),
28  backwardPredictedStateTag_(conf.getParameter<std::string>( "backwardPredictedState" )),
29  updatedStateTag_(conf.getParameter<std::string>( "updatedState" )),
30  combinedStateTag_(conf.getParameter<std::string>( "combinedState" )) { }
T getParameter(std::string const &) const
TrackInfoProducerAlgorithm::~TrackInfoProducerAlgorithm ( )
inline

Member Function Documentation

LocalPoint TrackInfoProducerAlgorithm::project ( const GeomDet det,
const GeomDet projdet,
LocalPoint  position,
LocalVector  trackdirection 
) const

Definition at line 170 of file TrackInfoProducerAlgorithm.cc.

References Scenarios_cff::scale, GeomDet::surface(), toLocal(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by ~TrackInfoProducerAlgorithm().

171 {
172 
173  GlobalPoint globalpoint=(det->surface()).toGlobal(position);
174 
175  // position of the initial and final point of the strip in glued local coordinates
176  LocalPoint projposition=(projdet->surface()).toLocal(globalpoint);
177 
178  //correct the position with the track direction
179 
180  float scale=-projposition.z()/trackdirection.z();
181 
182  projposition+= scale*trackdirection;
183 
184  return projposition;
185 }
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:42
T z() const
Definition: PV3DBase.h:64
void TrackInfoProducerAlgorithm::run ( const edm::Ref< std::vector< Trajectory > >  traj_iterator,
reco::TrackRef  track,
reco::TrackInfo output,
const TrackerGeometry tracker 
)

Definition at line 16 of file TrackInfoProducerAlgorithm.cc.

References reco::BwPredicted, TrajectoryStateCombiner::combine(), reco::Combined, MillePedeFileConverter_cfg::e, reco::FwPredicted, TrackingRecHit::geographicalId(), mps_fire::i, TrackerGeometry::idToDet(), mag(), reco::Matched, LocalTrajectoryParameters::momentum(), GluedGeomDet::monoDet(), ProjectedSiStripRecHit2D::originalHit(), PTrajectoryStateOnDet::parameters(), trajectoryStateTransform::persistentState(), LocalTrajectoryParameters::position(), reco::Projected, DetId::rawId(), reco::Single, GluedGeomDet::stereoDet(), GeomDet::toGlobal(), GeomDet::toLocal(), and reco::Updated.

Referenced by DTWorkflow.DTWorkflow::all(), Types.EventID::cppID(), Types.LuminosityBlockID::cppID(), o2olib.O2OTool::execute(), TrackInfoProducer::produce(), and ~TrackInfoProducerAlgorithm().

18 {
19 
20  std::vector<TrajectoryMeasurement> measurements =traj_iterator->measurements();
21 
22  std::vector<TrajectoryMeasurement>::iterator traj_mes_iterator;
23  //edm::LogInfo("TrackInfoProducer") << "Number of Measurements: "<<measurements.size();
25  int nhit=0;
26  for(traj_mes_iterator=measurements.begin();traj_mes_iterator!=measurements.end();++traj_mes_iterator){//loop on measurements
27 
28  TrajectoryStateOnSurface fwdtsos=traj_mes_iterator->forwardPredictedState();
29  TrajectoryStateOnSurface bwdtsos=traj_mes_iterator->backwardPredictedState();
30  TrajectoryStateOnSurface updatedtsos=traj_mes_iterator->updatedState();
31  TrajectoryStateCombiner statecombiner;
32  TrajectoryStateOnSurface combinedtsos=statecombiner.combine(fwdtsos, bwdtsos);
33 
34  ConstRecHitPointer ttrh=traj_mes_iterator->recHit();
36  if (ttrh->isValid())pos=ttrh->hit()->localPosition() ;
37  nhit++;
38  unsigned int detid=ttrh->hit()->geographicalId().rawId();
39 
41  TrackingRecHitRef thehitref;
42  TrackingRecHit const * thehitptr=nullptr;
43  int i=0,j=0;
44 
45  for (thehit=track->recHitsBegin();thehit!=track->recHitsEnd();thehit++){
46  i++;
47  LocalPoint hitpos;
48  if ((*thehit)->isValid())hitpos=(*thehit)->localPosition();
49  if((*thehit)->geographicalId().rawId()==detid&&
50  (hitpos - pos).mag() < 1e-4)
51  {
52  thehitptr=(*thehit);
53  thehitref = track->extra()->recHitRef(i-1);
54  j++;
55  break;
56  }
57  }
58 
61  PTrajectoryStateOnDet const & updatedptsod=trajectoryStateTransform::persistentState( updatedtsos,detid);
62  PTrajectoryStateOnDet const & combinedptsod=trajectoryStateTransform::persistentState( combinedtsos,detid);
63 
64 
65  const ProjectedSiStripRecHit2D* phit=dynamic_cast<const ProjectedSiStripRecHit2D*>( thehitptr);
66  const SiStripMatchedRecHit2D* matchedhit=dynamic_cast<const SiStripMatchedRecHit2D*>( thehitptr);
67 
69  LocalVector monofwd, stereofwd;
70  LocalVector monobwd, stereobwd;
71  LocalVector monoco, stereoco;
72  LocalVector monoup, stereoup;
73 
74  LocalPoint pmonofwd, pstereofwd;
75  LocalPoint pmonobwd, pstereobwd;
76  LocalPoint pmonoco, pstereoco;
77  LocalPoint pmonoup, pstereoup;
78  if(matchedhit){
79  type=Matched;
80  GluedGeomDet * gdet=(GluedGeomDet *)tracker->idToDet(matchedhit->geographicalId());
81 
82  GlobalVector gtrkdirfwd=gdet->toGlobal(fwdptsod.parameters().momentum());
83  GlobalVector gtrkdirbwd=gdet->toGlobal(bwdptsod.parameters().momentum());
84  GlobalVector gtrkdirup=gdet->toGlobal(updatedptsod.parameters().momentum());
85  GlobalVector gtrkdirco=gdet->toGlobal(combinedptsod.parameters().momentum());
86 
87 
88 
89  const GeomDetUnit * monodet=gdet->monoDet();
90 
91  monofwd=monodet->toLocal(gtrkdirfwd);
92  monobwd=monodet->toLocal(gtrkdirbwd);
93  monoup=monodet->toLocal(gtrkdirup);
94  monoco=monodet->toLocal(gtrkdirco);
95 
96  pmonofwd=project(gdet,monodet,fwdptsod.parameters().position(),monofwd);
97  pmonobwd=project(gdet,monodet,bwdptsod.parameters().position(),monobwd);
98  pmonoup=project(gdet,monodet,updatedptsod.parameters().position(),monoup);
99  pmonoco=project(gdet,monodet,combinedptsod.parameters().position(),monoco);
100 
101 
102  const GeomDetUnit * stereodet=gdet->stereoDet();
103 
104  stereofwd=stereodet->toLocal(gtrkdirfwd);
105  stereobwd=stereodet->toLocal(gtrkdirbwd);
106  stereoup=stereodet->toLocal(gtrkdirup);
107  stereoco=stereodet->toLocal(gtrkdirco);
108 
109  pstereofwd=project(gdet,stereodet,fwdptsod.parameters().position(),stereofwd);
110  pstereobwd=project(gdet,stereodet,bwdptsod.parameters().position(),stereobwd);
111  pstereoup=project(gdet,stereodet,updatedptsod.parameters().position(),stereoup);
112  pstereoco=project(gdet,stereodet,combinedptsod.parameters().position(),stereoco);
113 
114 
115  }
116  else if(phit){
117  type=Projected;
118  GluedGeomDet * gdet=(GluedGeomDet *)tracker->idToDet(phit->geographicalId());
119 
120  GlobalVector gtrkdirfwd=gdet->toGlobal(fwdptsod.parameters().momentum());
121  GlobalVector gtrkdirbwd=gdet->toGlobal(bwdptsod.parameters().momentum());
122  GlobalVector gtrkdirup=gdet->toGlobal(updatedptsod.parameters().momentum());
123  GlobalVector gtrkdirco=gdet->toGlobal(combinedptsod.parameters().momentum());
124  const SiStripRecHit2D& originalhit=phit->originalHit();
125  const GeomDetUnit * det;
126  if(!StripSubdetector(originalhit.geographicalId().rawId()).stereo()){
127  det=gdet->monoDet();
128  monofwd= det->toLocal(gtrkdirfwd);
129  monobwd= det->toLocal(gtrkdirbwd);
130  monoup= det->toLocal(gtrkdirup);
131  monoco= det->toLocal(gtrkdirco);
132  pmonofwd=project(gdet,det,fwdptsod.parameters().position(),monofwd);
133  pmonobwd=project(gdet,det,bwdptsod.parameters().position(),monobwd);
134  pmonoup=project(gdet,det,updatedptsod.parameters().position(),monoup);
135  pmonoco=project(gdet,det,combinedptsod.parameters().position(),monoco);
136  }
137  else{
138  det=gdet->stereoDet();
139  stereofwd= det->toLocal(gtrkdirfwd);
140  stereobwd= det->toLocal(gtrkdirbwd);
141  stereoup= det->toLocal(gtrkdirup);
142  stereoco= det->toLocal(gtrkdirco);
143  pstereofwd=project(gdet,det,fwdptsod.parameters().position(),stereofwd);
144  pstereobwd=project(gdet,det,bwdptsod.parameters().position(),stereobwd);
145  pstereoup=project(gdet,det,updatedptsod.parameters().position(),stereoup);
146  pstereoco=project(gdet,det,combinedptsod.parameters().position(),stereoco);
147  }
148  }
150  if(forwardPredictedStateTag_!="") states.insert(std::make_pair(FwPredicted, TrackingStateInfo(std::make_pair(monofwd,stereofwd), std::make_pair(pmonofwd,pstereofwd), fwdptsod)));
151  if(backwardPredictedStateTag_!="")states.insert(std::make_pair(BwPredicted, TrackingStateInfo(std::make_pair(monobwd,stereobwd), std::make_pair(pmonobwd,pstereobwd), bwdptsod)));
152  if(updatedStateTag_!="")states.insert(std::make_pair(Updated, TrackingStateInfo(std::make_pair(monoup,stereoup), std::make_pair(pmonoup,pstereoup), updatedptsod)));
153  if(combinedStateTag_!="")states.insert(std::make_pair(Combined, TrackingStateInfo(std::make_pair(monoco,stereoco), std::make_pair(pmonoco,pstereoco), combinedptsod)));
154 
155  TrackingRecHitInfo tkRecHitInfo(type, states);
156 
157 
158 
159  if(j!=0){
160  trajinfo.insert(std::make_pair(thehitref,tkRecHitInfo));
161  }
162  // else edm::LogInfo("TrackInfoProducer") << "RecHit not associated ";
163  }
164  //edm::LogInfo("TrackInfoProducer") << "Found "<<nhit<< " hits";
165  //if(fwdtrajinfo.size()!=nhit) edm::LogInfo("TrackInfoProducer") << "Number of trackinfos "<<fwdtrajinfo.size()<< " doesn't match!";
166  output=TrackInfo((traj_iterator->seed()),trajinfo);
167 
168 }
type
Definition: HCALResponse.h:21
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
TSOS combine(const TSOS &pTsos1, const TSOS &pTsos2) const
LocalPoint position() const
Local x and y position coordinates.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:69
uint32_t rawId() const
get the raw id
Definition: DetId.h:44
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
std::map< StateType, TrackingStateInfo > TrackingStates
LocalVector momentum() const
Momentum vector in the local frame.
SiStripRecHit2D originalHit() const
const TrackerGeomDet * idToDet(DetId) const override
DetId geographicalId() const
LocalPoint project(const GeomDet *det, const GeomDet *projdet, LocalPoint position, LocalVector trackdirection) const
const GeomDetUnit * stereoDet() const
Definition: GluedGeomDet.h:21
const LocalTrajectoryParameters & parameters() const
std::map< TrackingRecHitRef, TrackingRecHitInfo > TrajectoryInfo
default constructor
Definition: TrackInfo.h:26

Member Data Documentation

std::string TrackInfoProducerAlgorithm::backwardPredictedStateTag_
private

Definition at line 40 of file TrackInfoProducerAlgorithm.h.

std::string TrackInfoProducerAlgorithm::combinedStateTag_
private

Definition at line 40 of file TrackInfoProducerAlgorithm.h.

edm::ParameterSet TrackInfoProducerAlgorithm::conf_
private

Definition at line 39 of file TrackInfoProducerAlgorithm.h.

std::string TrackInfoProducerAlgorithm::forwardPredictedStateTag_
private

Definition at line 40 of file TrackInfoProducerAlgorithm.h.

std::string TrackInfoProducerAlgorithm::updatedStateTag_
private

Definition at line 40 of file TrackInfoProducerAlgorithm.h.