CMS 3D CMS Logo

TrackInfoProducerAlgorithm Class Reference

#include <AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducerAlgorithm.h>

List of all members.

Public Types

typedef
TransientTrackingRecHit::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

typedef TransientTrackingRecHit::ConstRecHitPointer TrackInfoProducerAlgorithm::ConstRecHitPointer

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.

00025                                                           : 
00026     conf_(conf),
00027     forwardPredictedStateTag_(conf.getParameter<std::string>( "forwardPredictedState" )),
00028     backwardPredictedStateTag_(conf.getParameter<std::string>( "backwardPredictedState" )),
00029     updatedStateTag_(conf.getParameter<std::string>( "updatedState" )),
00030     combinedStateTag_(conf.getParameter<std::string>( "combinedState" ))    { }

TrackInfoProducerAlgorithm::~TrackInfoProducerAlgorithm (  )  [inline]

Definition at line 32 of file TrackInfoProducerAlgorithm.h.

00032 {}


Member Function Documentation

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

Definition at line 171 of file TrackInfoProducerAlgorithm.cc.

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

Referenced by run().

00172 {
00173   
00174   GlobalPoint globalpoint=(det->surface()).toGlobal(position);
00175   
00176   // position of the initial and final point of the strip in glued local coordinates
00177   LocalPoint projposition=(projdet->surface()).toLocal(globalpoint);
00178   
00179   //correct the position with the track direction
00180   
00181   float scale=-projposition.z()/trackdirection.z();
00182   
00183   projposition+= scale*trackdirection;
00184   
00185   return projposition;
00186 }

void TrackInfoProducerAlgorithm::run ( const edm::Ref< std::vector< Trajectory > >  traj_iterator,
reco::TrackRef  track,
reco::TrackInfo output,
const TrackerGeometry tracker 
)

Definition at line 19 of file TrackInfoProducerAlgorithm.cc.

References backwardPredictedStateTag_, reco::BwPredicted, TrajectoryStateCombiner::combine(), reco::Combined, combinedStateTag_, e, forwardPredictedStateTag_, reco::FwPredicted, TrackingRecHit::geographicalId(), i, TrackerGeometry::idToDet(), j, muonGeometry::mag(), reco::Matched, LocalTrajectoryParameters::momentum(), GluedGeomDet::monoDet(), ProjectedSiStripRecHit2D::originalHit(), PTrajectoryStateOnDet::parameters(), TrajectoryStateTransform::persistentState(), LocalTrajectoryParameters::position(), project(), reco::Projected, DetId::rawId(), reco::Single, GluedGeomDet::stereoDet(), GeomDet::toGlobal(), GeomDet::toLocal(), reco::Updated, and updatedStateTag_.

Referenced by TrackInfoProducer::produce().

00021 {
00022 
00023     std::vector<TrajectoryMeasurement> measurements =traj_iterator->measurements();
00024     
00025     std::vector<TrajectoryMeasurement>::iterator traj_mes_iterator;
00026     //edm::LogInfo("TrackInfoProducer") << "Number of Measurements: "<<measurements.size();
00027     TrackInfo::TrajectoryInfo trajinfo;
00028     int nhit=0;
00029     for(traj_mes_iterator=measurements.begin();traj_mes_iterator!=measurements.end();traj_mes_iterator++){//loop on measurements
00030       
00031       TrajectoryStateOnSurface  fwdtsos=traj_mes_iterator->forwardPredictedState();
00032       TrajectoryStateOnSurface  bwdtsos=traj_mes_iterator->backwardPredictedState();
00033       TrajectoryStateOnSurface  updatedtsos=traj_mes_iterator->updatedState();
00034       TrajectoryStateCombiner statecombiner;
00035       TrajectoryStateOnSurface  combinedtsos=statecombiner.combine(fwdtsos, bwdtsos);
00036 
00037       ConstRecHitPointer ttrh=traj_mes_iterator->recHit();
00038       LocalPoint pos;
00039       if (ttrh->isValid())pos=ttrh->hit()->localPosition() ;
00040       nhit++;
00041       unsigned int detid=ttrh->hit()->geographicalId().rawId();
00042       
00043       trackingRecHit_iterator thehit;
00044       TrackingRecHitRef thehitref;
00045       int i=0,j=0;
00046 
00047       for (thehit=track->recHitsBegin();thehit!=track->recHitsEnd();thehit++){
00048         i++;
00049         LocalPoint hitpos;
00050         if ((*thehit)->isValid())hitpos=(*thehit)->localPosition();
00051         if((*thehit)->geographicalId().rawId()==detid&&
00052            (hitpos - pos).mag() < 1e-4)
00053           {
00054             thehitref=(*thehit);
00055             j++;
00056             break;
00057           }
00058       }
00059       TrajectoryStateTransform tsostransform;
00060       PTrajectoryStateOnDet* fwdptsod=tsostransform.persistentState( fwdtsos,detid);
00061       PTrajectoryStateOnDet* bwdptsod=tsostransform.persistentState( bwdtsos,detid);
00062       PTrajectoryStateOnDet* updatedptsod=tsostransform.persistentState( updatedtsos,detid);
00063       PTrajectoryStateOnDet* combinedptsod=tsostransform.persistentState( combinedtsos,detid);
00064       
00065 
00066       const ProjectedSiStripRecHit2D* phit=dynamic_cast<const ProjectedSiStripRecHit2D*>( &*(thehitref));
00067       const SiStripMatchedRecHit2D* matchedhit=dynamic_cast<const SiStripMatchedRecHit2D*>( &*(thehitref));
00068 
00069       RecHitType type=Single;
00070       LocalVector monofwd, stereofwd;
00071       LocalVector monobwd, stereobwd;
00072       LocalVector monoco, stereoco;
00073       LocalVector monoup, stereoup;
00074 
00075       LocalPoint pmonofwd, pstereofwd;
00076       LocalPoint pmonobwd, pstereobwd;
00077       LocalPoint pmonoco, pstereoco;
00078       LocalPoint pmonoup, pstereoup;
00079       if(matchedhit){
00080         type=Matched;
00081         GluedGeomDet * gdet=(GluedGeomDet *)tracker->idToDet(matchedhit->geographicalId());
00082         
00083         GlobalVector gtrkdirfwd=gdet->toGlobal(fwdptsod->parameters().momentum());
00084         GlobalVector gtrkdirbwd=gdet->toGlobal(bwdptsod->parameters().momentum());
00085         GlobalVector gtrkdirup=gdet->toGlobal(updatedptsod->parameters().momentum());
00086         GlobalVector gtrkdirco=gdet->toGlobal(combinedptsod->parameters().momentum());
00087         
00088 
00089         
00090         const GeomDetUnit * monodet=gdet->monoDet();
00091         
00092         monofwd=monodet->toLocal(gtrkdirfwd);
00093         monobwd=monodet->toLocal(gtrkdirbwd);
00094         monoup=monodet->toLocal(gtrkdirup);
00095         monoco=monodet->toLocal(gtrkdirco);
00096 
00097         pmonofwd=project(gdet,monodet,fwdptsod->parameters().position(),monofwd);
00098         pmonobwd=project(gdet,monodet,bwdptsod->parameters().position(),monobwd);
00099         pmonoup=project(gdet,monodet,updatedptsod->parameters().position(),monoup);
00100         pmonoco=project(gdet,monodet,combinedptsod->parameters().position(),monoco);
00101 
00102 
00103         const GeomDetUnit * stereodet=gdet->stereoDet();
00104         
00105         stereofwd=stereodet->toLocal(gtrkdirfwd);
00106         stereobwd=stereodet->toLocal(gtrkdirbwd);
00107         stereoup=stereodet->toLocal(gtrkdirup);
00108         stereoco=stereodet->toLocal(gtrkdirco);
00109 
00110         pstereofwd=project(gdet,stereodet,fwdptsod->parameters().position(),stereofwd);
00111         pstereobwd=project(gdet,stereodet,bwdptsod->parameters().position(),stereobwd);
00112         pstereoup=project(gdet,stereodet,updatedptsod->parameters().position(),stereoup);
00113         pstereoco=project(gdet,stereodet,combinedptsod->parameters().position(),stereoco);
00114 
00115 
00116       }
00117       else if(phit){
00118         type=Projected;
00119         GluedGeomDet * gdet=(GluedGeomDet *)tracker->idToDet(phit->geographicalId());
00120         
00121         GlobalVector gtrkdirfwd=gdet->toGlobal(fwdptsod->parameters().momentum());
00122         GlobalVector gtrkdirbwd=gdet->toGlobal(bwdptsod->parameters().momentum());
00123         GlobalVector gtrkdirup=gdet->toGlobal(updatedptsod->parameters().momentum());
00124         GlobalVector gtrkdirco=gdet->toGlobal(combinedptsod->parameters().momentum());
00125         const SiStripRecHit2D&  originalhit=phit->originalHit();
00126         const GeomDetUnit * det;
00127         if(!StripSubdetector(originalhit.geographicalId().rawId()).stereo()){
00128           det=gdet->monoDet();
00129           monofwd= det->toLocal(gtrkdirfwd);
00130           monobwd= det->toLocal(gtrkdirbwd);
00131           monoup=  det->toLocal(gtrkdirup);
00132           monoco=  det->toLocal(gtrkdirco);
00133           pmonofwd=project(gdet,det,fwdptsod->parameters().position(),monofwd);
00134           pmonobwd=project(gdet,det,bwdptsod->parameters().position(),monobwd);
00135           pmonoup=project(gdet,det,updatedptsod->parameters().position(),monoup);
00136           pmonoco=project(gdet,det,combinedptsod->parameters().position(),monoco);
00137         }
00138         else{
00139           det=gdet->stereoDet();
00140           stereofwd= det->toLocal(gtrkdirfwd);
00141           stereobwd= det->toLocal(gtrkdirbwd);
00142           stereoup=  det->toLocal(gtrkdirup);
00143           stereoco=  det->toLocal(gtrkdirco);
00144           pstereofwd=project(gdet,det,fwdptsod->parameters().position(),stereofwd);
00145           pstereobwd=project(gdet,det,bwdptsod->parameters().position(),stereobwd);
00146           pstereoup=project(gdet,det,updatedptsod->parameters().position(),stereoup);
00147           pstereoco=project(gdet,det,combinedptsod->parameters().position(),stereoco);
00148         }
00149       }
00150       TrackingRecHitInfo::TrackingStates states;
00151       if(forwardPredictedStateTag_!="") states.insert(std::make_pair(FwPredicted, TrackingStateInfo(std::make_pair(monofwd,stereofwd), std::make_pair(pmonofwd,pstereofwd), *fwdptsod)));
00152       if(backwardPredictedStateTag_!="")states.insert(std::make_pair(BwPredicted, TrackingStateInfo(std::make_pair(monobwd,stereobwd), std::make_pair(pmonobwd,pstereobwd), *bwdptsod)));
00153       if(updatedStateTag_!="")states.insert(std::make_pair(Updated, TrackingStateInfo(std::make_pair(monoup,stereoup), std::make_pair(pmonoup,pstereoup), *updatedptsod)));
00154       if(combinedStateTag_!="")states.insert(std::make_pair(Combined, TrackingStateInfo(std::make_pair(monoco,stereoco), std::make_pair(pmonoco,pstereoco), *combinedptsod)));
00155       
00156       TrackingRecHitInfo  tkRecHitInfo(type, states);
00157       
00158       
00159       
00160       if(j!=0){
00161         trajinfo.insert(std::make_pair(thehitref,tkRecHitInfo));
00162       }
00163       //      else  edm::LogInfo("TrackInfoProducer") << "RecHit not associated ";
00164     }
00165     //edm::LogInfo("TrackInfoProducer") << "Found "<<nhit<< " hits";
00166     //if(fwdtrajinfo.size()!=nhit) edm::LogInfo("TrackInfoProducer") << "Number of trackinfos  "<<fwdtrajinfo.size()<< " doesn't match!";
00167     output=TrackInfo((traj_iterator->seed()),trajinfo);
00168     
00169 }


Member Data Documentation

std::string TrackInfoProducerAlgorithm::backwardPredictedStateTag_ [private]

Definition at line 40 of file TrackInfoProducerAlgorithm.h.

Referenced by run().

std::string TrackInfoProducerAlgorithm::combinedStateTag_ [private]

Definition at line 40 of file TrackInfoProducerAlgorithm.h.

Referenced by run().

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.

Referenced by run().

std::string TrackInfoProducerAlgorithm::updatedStateTag_ [private]

Definition at line 40 of file TrackInfoProducerAlgorithm.h.

Referenced by run().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:34:11 2009 for CMSSW by  doxygen 1.5.4