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.6 by bbetchar, Tue Aug 11 14:07:09 2009 UTC vs.
Revision 1.10 by bbetchar, Tue Sep 29 10:16:31 2009 UTC

# Line 16 | Line 16
16   #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
17   #include "Geometry/CommonTopologies/interface/StripTopology.h"
18   #include "FWCore/Framework/interface/ESHandle.h"
19 + #include "FWCore/Framework/interface/Event.h"
20   #include "boost/foreach.hpp"
21  
22  
23   ShallowTrackClustersProducer::ShallowTrackClustersProducer(const edm::ParameterSet& iConfig)
24    :  theTracksLabel( iConfig.getParameter<edm::InputTag>("Tracks") ),
25 +     theClustersLabel( iConfig.getParameter<edm::InputTag>("Clusters") ),
26       Suffix       ( iConfig.getParameter<std::string>("Suffix")    ),
27       Prefix       ( iConfig.getParameter<std::string>("Prefix") )
28   {
# Line 59 | Line 61 | ShallowTrackClustersProducer::ShallowTra
61    produces <std::vector<float> >       ( Prefix + "driftx"        + Suffix );
62    produces <std::vector<float> >       ( Prefix + "drifty"        + Suffix );
63    produces <std::vector<float> >       ( Prefix + "driftz"        + Suffix );
64 +  produces <std::vector<float> >       ( Prefix + "globalZofunitlocalY" + Suffix );            
65   }
66  
67   void ShallowTrackClustersProducer::
68   produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
69 <  shallow::CLUSTERMAP clustermap = shallow::make_cluster_map(iEvent);
69 >  shallow::CLUSTERMAP clustermap = shallow::make_cluster_map(iEvent,theClustersLabel);
70  
71    int size = clustermap.size();
72    std::auto_ptr<std::vector<unsigned int> > trackmulti   ( new std::vector<unsigned int>(size,    0)   );
# Line 98 | Line 101 | produce(edm::Event& iEvent, const edm::E
101    std::auto_ptr<std::vector<float> >  driftx        ( new std::vector<float>(size,  -10000  ));
102    std::auto_ptr<std::vector<float> >  drifty        ( new std::vector<float>(size,  -10000  ));
103    std::auto_ptr<std::vector<float> >  driftz        ( new std::vector<float>(size,  -10000  ));
104 +  std::auto_ptr<std::vector<float> >  globalZofunitlocalY ( new std::vector<float>(size, -1000));
105  
106    edm::ESHandle<TrackerGeometry> theTrackerGeometry;         iSetup.get<TrackerDigiGeometryRecord>().get( theTrackerGeometry );  
107    edm::ESHandle<MagneticField> magfield;                     iSetup.get<IdealMagneticFieldRecord>().get(magfield);                    
# Line 118 | Line 122 | produce(edm::Event& iEvent, const edm::E
122        const TrajectoryStateOnSurface unbiased = combiner(measurement.forwardPredictedState(), measurement.backwardPredictedState());
123        const SiStripRecHit2D* hit = dynamic_cast<const SiStripRecHit2D*> ( measurement.recHit()->hit() );  
124        
125 <      if(!hit) break;
125 >      if(!hit) continue;
126        shallow::CLUSTERMAP::const_iterator cluster = clustermap.find( std::make_pair(hit->geographicalId().rawId(), hit->cluster()->firstStrip() ));
127 <      if(cluster == clustermap.end() ) break;
127 >      if(cluster == clustermap.end() ) throw cms::Exception("Logic Error") << "Cluster not found: this could be a configuration error" << std::endl;
128        
129        unsigned i = cluster->second;
130        if( 0 == (trackmulti->at(i))++ ) {
# Line 158 | Line 162 | produce(edm::Event& iEvent, const edm::E
162          driftx->at(i)       = drift.x();
163          drifty->at(i)       = drift.y();
164          driftz->at(i)       = drift.z();
165 +        globalZofunitlocalY->at(i) = (theStripDet->toGlobal(LocalVector(0,1,0))).z();
166        }
167      }
168    }
# Line 191 | Line 196 | produce(edm::Event& iEvent, const edm::E
196    iEvent.put(rhmerr,      Prefix + "rhmerr"      + Suffix );  
197    iEvent.put(ubstrip,     Prefix + "ubstrip"     + Suffix );  
198    iEvent.put(ubmerr,      Prefix + "ubmerr"      + Suffix );  
199 <  iEvent.put( driftx,        Prefix + "driftx"        );
200 <  iEvent.put( drifty,        Prefix + "drifty"        );
201 <  iEvent.put( driftz,        Prefix + "driftz"        );
199 >  iEvent.put( driftx,     Prefix + "driftx"      + Suffix );
200 >  iEvent.put( drifty,     Prefix + "drifty"      + Suffix );
201 >  iEvent.put( driftz,     Prefix + "driftz"      + Suffix );
202 >  iEvent.put( globalZofunitlocalY, Prefix + "globalZofunitlocalY" + Suffix );
203   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines