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.3 by bbetchar, Thu Jun 11 16:09:16 2009 UTC vs.
Revision 1.7 by bbetchar, Wed Sep 2 12:05:33 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 );
44 <  produces <std::vector<float> >        ( Prefix + "projlength"  + Suffix );
44 >  produces <std::vector<float> >        ( Prefix + "BdotY"       + Suffix );
45  
46    produces <std::vector<float> >        ( Prefix + "rhlocalx"     + Suffix );  
47    produces <std::vector<float> >        ( Prefix + "rhlocaly"     + Suffix );  
# Line 51 | Line 53 | ShallowTrackClustersProducer::ShallowTra
53    produces <std::vector<float> >        ( Prefix + "rhstrip"      + Suffix );  
54    produces <std::vector<float> >        ( Prefix + "rhmerr"       + Suffix );  
55  
56 +  produces <std::vector<float> >        ( Prefix + "ubstrip"      + Suffix );  
57 +  produces <std::vector<float> >        ( Prefix + "ubmerr"       + Suffix );  
58 +
59    produces <std::vector<float> >       ( Prefix + "driftx"        + Suffix );
60    produces <std::vector<float> >       ( Prefix + "drifty"        + Suffix );
61    produces <std::vector<float> >       ( Prefix + "driftz"        + Suffix );
62 +  produces <std::vector<float> >       ( Prefix + "globalZofunitlocalY" + Suffix );            
63   }
64  
65   void ShallowTrackClustersProducer::
# Line 77 | Line 83 | produce(edm::Event& iEvent, const edm::E
83    std::auto_ptr<std::vector<float> >        globalz      ( new std::vector<float>       (size, -10000) );
84    std::auto_ptr<std::vector<float> >        insidistance ( new std::vector<float>       (size,     -1) );
85    std::auto_ptr<std::vector<float> >        projwidth    ( new std::vector<float>       (size,  -1000) );
86 +  std::auto_ptr<std::vector<float> >        BdotY        ( new std::vector<float>       (size,  -1000) );
87    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) );
88    std::auto_ptr<std::vector<float> >  rhlocalx      ( new std::vector<float>(size,  -10000  ));  
89    std::auto_ptr<std::vector<float> >  rhlocaly      ( new std::vector<float>(size,  -10000  ));  
90    std::auto_ptr<std::vector<float> >  rhlocalxerr   ( new std::vector<float>(size,  -1  ));  
# Line 88 | Line 94 | produce(edm::Event& iEvent, const edm::E
94    std::auto_ptr<std::vector<float> >  rhglobalz     ( new std::vector<float>(size,  -10000  ));  
95    std::auto_ptr<std::vector<float> >  rhstrip       ( new std::vector<float>(size,  -10000  ));  
96    std::auto_ptr<std::vector<float> >  rhmerr        ( new std::vector<float>(size,  -10000  ));  
97 +  std::auto_ptr<std::vector<float> >  ubstrip       ( new std::vector<float>(size,  -10000  ));  
98 +  std::auto_ptr<std::vector<float> >  ubmerr        ( new std::vector<float>(size,  -10000  ));  
99    std::auto_ptr<std::vector<float> >  driftx        ( new std::vector<float>(size,  -10000  ));
100    std::auto_ptr<std::vector<float> >  drifty        ( new std::vector<float>(size,  -10000  ));
101    std::auto_ptr<std::vector<float> >  driftz        ( new std::vector<float>(size,  -10000  ));
102 +  std::auto_ptr<std::vector<float> >  globalZofunitlocalY ( new std::vector<float>(size, -1000));
103  
104    edm::ESHandle<TrackerGeometry> theTrackerGeometry;         iSetup.get<TrackerDigiGeometryRecord>().get( theTrackerGeometry );  
105    edm::ESHandle<MagneticField> magfield;                     iSetup.get<IdealMagneticFieldRecord>().get(magfield);                    
# Line 99 | Line 108 | produce(edm::Event& iEvent, const edm::E
108    edm::Handle<edm::View<reco::Track> > tracks;               iEvent.getByLabel(theTracksLabel, tracks);  
109    edm::Handle<TrajTrackAssociationCollection> associations;  iEvent.getByLabel(theTracksLabel, associations);
110  
111 +  TrajectoryStateCombiner combiner;
112 +
113    for( TrajTrackAssociationCollection::const_iterator association = associations->begin();
114         association != associations->end(); association++) {
115      const Trajectory*  traj  = association->key.get();
# Line 106 | Line 117 | produce(edm::Event& iEvent, const edm::E
117  
118      BOOST_FOREACH( const TrajectoryMeasurement measurement, traj->measurements() ) {
119        const TrajectoryStateOnSurface tsos = measurement.updatedState();
120 +      const TrajectoryStateOnSurface unbiased = combiner(measurement.forwardPredictedState(), measurement.backwardPredictedState());
121        const SiStripRecHit2D* hit = dynamic_cast<const SiStripRecHit2D*> ( measurement.recHit()->hit() );  
122        
123        if(!hit) break;
# Line 116 | Line 128 | produce(edm::Event& iEvent, const edm::E
128        if( 0 == (trackmulti->at(i))++ ) {
129          const StripGeomDetUnit* theStripDet = dynamic_cast<const StripGeomDetUnit*>( theTrackerGeometry->idToDet( hit->geographicalId() ) );
130          LocalVector drift = shallow::drift( theStripDet, *magfield, *SiStripLorentzAngle);
131 <        
131 >
132          trackindex->at(i)   = shallow::findTrackIndex(tracks, track);
133          localtheta->at(i)   = (theStripDet->toLocal(tsos.globalDirection())).theta();
134          localphi->at(i)     = (theStripDet->toLocal(tsos.globalDirection())).phi();  
# Line 132 | Line 144 | produce(edm::Event& iEvent, const edm::E
144          globalz->at(i)      = tsos.globalPosition().z();                            
145          insidistance->at(i) = 1./fabs(cos(localtheta->at(i)));                      
146          projwidth->at(i)    = tan(localtheta->at(i))*cos(localphi->at(i));        
147 +        BdotY->at(i)        = (theStripDet->surface()).toLocal( magfield->inTesla(theStripDet->surface().position())).y();
148          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)) ;        
149          rhlocalx->at(i)     = hit->localPosition().x();
150          rhlocaly->at(i)     = hit->localPosition().y();
151          rhlocalxerr->at(i)  = sqrt(hit->localPositionError().xx());
# Line 143 | Line 155 | produce(edm::Event& iEvent, const edm::E
155          rhglobalz->at(i)    = theStripDet->toGlobal(hit->localPosition()).z();
156          rhstrip->at(i)      = theStripDet->specificTopology().strip(hit->localPosition());
157          rhmerr->at(i)       = sqrt(theStripDet->specificTopology().measurementError(hit->localPosition(), hit->localPositionError()).uu());
158 <        driftx->push_back(drift.x());
159 <        drifty->push_back(drift.y());
160 <        driftz->push_back(drift.z());
158 >        ubstrip->at(i)      = theStripDet->specificTopology().strip(unbiased.localPosition());
159 >        ubmerr->at(i)       = sqrt(theStripDet->specificTopology().measurementError(unbiased.localPosition(), unbiased.localError().positionError()).uu());
160 >        driftx->at(i)       = drift.x();
161 >        drifty->at(i)       = drift.y();
162 >        driftz->at(i)       = drift.z();
163 >        globalZofunitlocalY->at(i) = (theStripDet->toGlobal(LocalVector(0,1,0))).z();
164        }
165      }
166    }
# Line 167 | Line 182 | produce(edm::Event& iEvent, const edm::E
182    iEvent.put(insidistance,Prefix + "insidistance"+ Suffix );
183    iEvent.put(covered,     Prefix + "covered"     + Suffix );
184    iEvent.put(projwidth,   Prefix + "projwidth"   + Suffix );
185 <  iEvent.put(projlength,  Prefix + "projlength"  + Suffix );
185 >  iEvent.put(BdotY,       Prefix + "BdotY"       + Suffix );
186    iEvent.put(rhlocalx,    Prefix + "rhlocalx"    + Suffix );  
187    iEvent.put(rhlocaly,    Prefix + "rhlocaly"    + Suffix );  
188    iEvent.put(rhlocalxerr, Prefix + "rhlocalxerr" + Suffix );  
# Line 177 | Line 192 | produce(edm::Event& iEvent, const edm::E
192    iEvent.put(rhglobalz,   Prefix + "rhglobalz"   + Suffix );  
193    iEvent.put(rhstrip,     Prefix + "rhstrip"     + Suffix );  
194    iEvent.put(rhmerr,      Prefix + "rhmerr"      + Suffix );  
195 <  iEvent.put( driftx,        Prefix + "driftx"        );
196 <  iEvent.put( drifty,        Prefix + "drifty"        );
197 <  iEvent.put( driftz,        Prefix + "driftz"        );
195 >  iEvent.put(ubstrip,     Prefix + "ubstrip"     + Suffix );  
196 >  iEvent.put(ubmerr,      Prefix + "ubmerr"      + Suffix );  
197 >  iEvent.put( driftx,     Prefix + "driftx"      + Suffix );
198 >  iEvent.put( drifty,     Prefix + "drifty"      + Suffix );
199 >  iEvent.put( driftz,     Prefix + "driftz"      + Suffix );
200 >  iEvent.put( globalZofunitlocalY, Prefix + "globalZofunitlocalY" + Suffix );
201   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines