ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/ShallowTools/plugins/ShallowTrackClustersProducer.cc
(Generate patch)

Comparing UserCode/ShallowTools/plugins/ShallowTrackClustersProducer.cc (file contents):
Revision 1.2 by bbetchar, Wed Jun 10 01:24:50 2009 UTC vs.
Revision 1.5 by bbetchar, Wed Jun 17 01:34:26 2009 UTC

# Line 4 | Line 4
4  
5   #include "TrackingTools/PatternTools/interface/Trajectory.h"
6   #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
7 + #include "TrackingTools/TrackFitters/interface/TrajectoryStateCombiner.h"
8   #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
9  
10   #include "MagneticField/Engine/interface/MagneticField.h"
# Line 17 | Line 18
18   #include "FWCore/Framework/interface/ESHandle.h"
19   #include "boost/foreach.hpp"
20  
21 +
22   ShallowTrackClustersProducer::ShallowTrackClustersProducer(const edm::ParameterSet& iConfig)
23    :  theTracksLabel( iConfig.getParameter<edm::InputTag>("Tracks") ),
24       Suffix       ( iConfig.getParameter<std::string>("Suffix")    ),
# Line 39 | Line 41 | ShallowTrackClustersProducer::ShallowTra
41    produces <std::vector<float> >        ( Prefix + "insidistance"+ Suffix );
42    produces <std::vector<float> >        ( Prefix + "covered"     + Suffix );
43    produces <std::vector<float> >        ( Prefix + "projwidth"   + Suffix );
42  produces <std::vector<float> >        ( Prefix + "projlength"  + Suffix );
44  
45    produces <std::vector<float> >        ( Prefix + "rhlocalx"     + Suffix );  
46    produces <std::vector<float> >        ( Prefix + "rhlocaly"     + Suffix );  
# Line 51 | Line 52 | ShallowTrackClustersProducer::ShallowTra
52    produces <std::vector<float> >        ( Prefix + "rhstrip"      + Suffix );  
53    produces <std::vector<float> >        ( Prefix + "rhmerr"       + Suffix );  
54  
55 +  produces <std::vector<float> >        ( Prefix + "ubstrip"      + Suffix );  
56 +  produces <std::vector<float> >        ( Prefix + "ubmerr"       + Suffix );  
57 +
58    produces <std::vector<float> >       ( Prefix + "driftx"        + Suffix );
59    produces <std::vector<float> >       ( Prefix + "drifty"        + Suffix );
60    produces <std::vector<float> >       ( Prefix + "driftz"        + Suffix );
# Line 78 | Line 82 | produce(edm::Event& iEvent, const edm::E
82    std::auto_ptr<std::vector<float> >        insidistance ( new std::vector<float>       (size,     -1) );
83    std::auto_ptr<std::vector<float> >        projwidth    ( new std::vector<float>       (size,  -1000) );
84    std::auto_ptr<std::vector<float> >        covered      ( new std::vector<float>       (size,  -1000) );
81  std::auto_ptr<std::vector<float> >        projlength   ( new std::vector<float>       (size,  -1000) );
85    std::auto_ptr<std::vector<float> >  rhlocalx      ( new std::vector<float>(size,  -10000  ));  
86    std::auto_ptr<std::vector<float> >  rhlocaly      ( new std::vector<float>(size,  -10000  ));  
87    std::auto_ptr<std::vector<float> >  rhlocalxerr   ( new std::vector<float>(size,  -1  ));  
# Line 88 | Line 91 | produce(edm::Event& iEvent, const edm::E
91    std::auto_ptr<std::vector<float> >  rhglobalz     ( new std::vector<float>(size,  -10000  ));  
92    std::auto_ptr<std::vector<float> >  rhstrip       ( new std::vector<float>(size,  -10000  ));  
93    std::auto_ptr<std::vector<float> >  rhmerr        ( new std::vector<float>(size,  -10000  ));  
94 +  std::auto_ptr<std::vector<float> >  ubstrip       ( new std::vector<float>(size,  -10000  ));  
95 +  std::auto_ptr<std::vector<float> >  ubmerr        ( new std::vector<float>(size,  -10000  ));  
96    std::auto_ptr<std::vector<float> >  driftx        ( new std::vector<float>(size,  -10000  ));
97    std::auto_ptr<std::vector<float> >  drifty        ( new std::vector<float>(size,  -10000  ));
98    std::auto_ptr<std::vector<float> >  driftz        ( new std::vector<float>(size,  -10000  ));
# Line 96 | Line 101 | produce(edm::Event& iEvent, const edm::E
101    edm::ESHandle<MagneticField> magfield;                     iSetup.get<IdealMagneticFieldRecord>().get(magfield);                    
102    edm::ESHandle<SiStripLorentzAngle> SiStripLorentzAngle;    iSetup.get<SiStripLorentzAngleRcd>().get(SiStripLorentzAngle);      
103  
104 <  edm::Handle<std::vector<reco::Track> > tracks;             iEvent.getByLabel(theTracksLabel, tracks);  
104 >  edm::Handle<edm::View<reco::Track> > tracks;               iEvent.getByLabel(theTracksLabel, tracks);  
105    edm::Handle<TrajTrackAssociationCollection> associations;  iEvent.getByLabel(theTracksLabel, associations);
106  
107 +  TrajectoryStateCombiner combiner;
108 +
109    for( TrajTrackAssociationCollection::const_iterator association = associations->begin();
110         association != associations->end(); association++) {
111      const Trajectory*  traj  = association->key.get();
# Line 106 | Line 113 | produce(edm::Event& iEvent, const edm::E
113  
114      BOOST_FOREACH( const TrajectoryMeasurement measurement, traj->measurements() ) {
115        const TrajectoryStateOnSurface tsos = measurement.updatedState();
116 +      const TrajectoryStateOnSurface unbiased = combiner(measurement.forwardPredictedState(), measurement.backwardPredictedState());
117        const SiStripRecHit2D* hit = dynamic_cast<const SiStripRecHit2D*> ( measurement.recHit()->hit() );  
118        
119        if(!hit) break;
# Line 133 | Line 141 | produce(edm::Event& iEvent, const edm::E
141          insidistance->at(i) = 1./fabs(cos(localtheta->at(i)));                      
142          projwidth->at(i)    = tan(localtheta->at(i))*cos(localphi->at(i));        
143          covered->at(i)      = drift.z()/localpitch->at(i) * fabs(projwidth->at(i) - drift.x()/drift.z());
136        projlength->at(i)   = tan(localtheta->at(i))*cos(localphi->at(i)) ;        
144          rhlocalx->at(i)     = hit->localPosition().x();
145          rhlocaly->at(i)     = hit->localPosition().y();
146          rhlocalxerr->at(i)  = sqrt(hit->localPositionError().xx());
# Line 143 | Line 150 | produce(edm::Event& iEvent, const edm::E
150          rhglobalz->at(i)    = theStripDet->toGlobal(hit->localPosition()).z();
151          rhstrip->at(i)      = theStripDet->specificTopology().strip(hit->localPosition());
152          rhmerr->at(i)       = sqrt(theStripDet->specificTopology().measurementError(hit->localPosition(), hit->localPositionError()).uu());
153 <        driftx->push_back(drift.x());
154 <        drifty->push_back(drift.y());
155 <        driftz->push_back(drift.z());
153 >        ubstrip->at(i)      = theStripDet->specificTopology().strip(unbiased.localPosition());
154 >        ubmerr->at(i)       = sqrt(theStripDet->specificTopology().measurementError(unbiased.localPosition(), unbiased.localError().positionError()).uu());
155 >        driftx->at(i)       = drift.x();
156 >        drifty->at(i)       = drift.y();
157 >        driftz->at(i)       = drift.z();
158        }
159      }
160    }
# Line 167 | Line 176 | produce(edm::Event& iEvent, const edm::E
176    iEvent.put(insidistance,Prefix + "insidistance"+ Suffix );
177    iEvent.put(covered,     Prefix + "covered"     + Suffix );
178    iEvent.put(projwidth,   Prefix + "projwidth"   + Suffix );
170  iEvent.put(projlength,  Prefix + "projlength"  + Suffix );
179    iEvent.put(rhlocalx,    Prefix + "rhlocalx"    + Suffix );  
180    iEvent.put(rhlocaly,    Prefix + "rhlocaly"    + Suffix );  
181    iEvent.put(rhlocalxerr, Prefix + "rhlocalxerr" + Suffix );  
# Line 177 | Line 185 | produce(edm::Event& iEvent, const edm::E
185    iEvent.put(rhglobalz,   Prefix + "rhglobalz"   + Suffix );  
186    iEvent.put(rhstrip,     Prefix + "rhstrip"     + Suffix );  
187    iEvent.put(rhmerr,      Prefix + "rhmerr"      + Suffix );  
188 +  iEvent.put(ubstrip,     Prefix + "ubstrip"     + Suffix );  
189 +  iEvent.put(ubmerr,      Prefix + "ubmerr"      + Suffix );  
190    iEvent.put( driftx,        Prefix + "driftx"        );
191    iEvent.put( drifty,        Prefix + "drifty"        );
192    iEvent.put( driftz,        Prefix + "driftz"        );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines