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

Comparing UserCode/Jeng/PVStudy/plugins/TrackSplitterProducer.cc (file contents):
Revision 1.2 by yygao, Sun Nov 8 02:57:06 2009 UTC vs.
Revision 1.3 by yygao, Wed Nov 11 19:27:50 2009 UTC

# Line 59 | Line 59 | TrackSplitterProducer::TrackSplitterProd
59    debug_    = iConfig.getParameter<bool>       ("Debug");  
60    TrackCollectionTag_      = iConfig.getParameter<edm::InputTag>("TrackCollectionTag");  
61    bsSrc = iConfig.getParameter< edm::InputTag >("beamSpot");
62 +  vertexCollectionTag_       = iConfig.getUntrackedParameter<edm::InputTag>("vertexCollection");
63 +  min_pvtx_zsep_    = iConfig.getParameter<double>       ("minPvtxZsep");  
64    pixelVertexCollectionTag_      = iConfig.getParameter<edm::InputTag>("pixelVertexCollectionTag");  
65 <  trkFilterZcut_    = iConfig.getParameter<double>       ("trkFilterZcut");  
65 >  trkFilterZcut_    = iConfig.getParameter<double>       ("trkFilterZcut");
66  
67    produces<TrackCollection>("SplittedTracks1");
68    produces<TrackCollection>("SplittedTracks2");  
# Line 75 | Line 77 | void TrackSplitterProducer::produce(edm:
77  
78    if(debug_)
79      cout<<"Starting TrackSplitterProducer::produce()..."<<endl;
80 +
81 +  
82 +  //=======================================================
83 +  // PVTX accessors
84 +  //=======================================================
85 +  //vertexCollection
86 +  static const reco::VertexCollection s_empty_vertexColl;
87 +  const reco::VertexCollection *vertexColl = &s_empty_vertexColl;
88 +  edm::Handle<reco::VertexCollection> vertexCollectionHandle;
89 +  iEvent.getByLabel(vertexCollectionTag_, vertexCollectionHandle);
90 +  if( iEvent.getByLabel(vertexCollectionTag_, vertexCollectionHandle)) {
91 +    vertexColl = vertexCollectionHandle.product();
92 +  } else {
93 +    cout << "vertexCollection cannot be found -> using empty collection of same type." <<endl;
94 +  }
95 +
96 +  if (vertexColl->size() == 0) return;
97 +  // The event must have a valid leading vertex with proper fit (!isFake())
98 +  if (vertexColl->begin()->isFake() || !(vertexColl->begin()->isValid())) return;  
99    
100 +  // == Apply event pre-selection based on if the leading pvtx has nearby pvtx within max_zsep
101 +  // zsep is the mininum separation of the secondary pvtxs to the leading one
102 +  if(vertexColl->size()>1) {
103 +    double zsep = 9999.0;    
104 +    for(reco::VertexCollection::const_iterator v=vertexColl->begin() + 1 ;
105 +        v!=vertexColl->end(); ++v) {  
106 +      if(v->isValid() && ! v->isFake()) {
107 +        // zsep
108 +        if(fabs(v->z()- vertexColl->begin()->z())< zsep)
109 +          zsep = fabs(v->z()- vertexColl->begin()->z());
110 +      }
111 +    }
112 +    if( zsep < min_pvtx_zsep_ ) return;
113 +  }
114 +  
115 +  //=======================================================
116 +  // Track accessors
117 +  //=======================================================
118 +
119    edm::Handle<reco::TrackCollection>  trackCollectionHandle;
120    iEvent.getByLabel(TrackCollectionTag_, trackCollectionHandle);
121  
122 +  
123 +  //=======================================================
124 +  // BeamSpot accessors
125 +  //=======================================================
126 +
127    edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
128    iEvent.getByLabel(bsSrc,recoBeamSpotHandle);
129    reco::BeamSpot bs = *recoBeamSpotHandle;    
# Line 108 | Line 153 | void TrackSplitterProducer::produce(edm:
153    if(debug_)
154      cout<<"Getting pixelVertices: size() = "<< pixelVertexColl->size() <<endl;
155    
156 <  if(pixelVertexColl->size()<1) return;
156 >  if(pixelVertexColl->size() == 0 ) return;
157  
158    //Get the z and sigma z of the first vertex of pixelVertexColl
159    double z_pixelpvtx  = pixelVertexColl->begin()->z();
# Line 128 | Line 173 | void TrackSplitterProducer::produce(edm:
173      }
174    }
175    
176 <  
176 >
177 >  // Loop over generalTracks and apply trkFilter
178    for(TrackCollection::const_iterator track = sortedTrackColl.begin(); track!= sortedTrackColl.end(); ++track)
179      {      
180        TransientTrack t_track = (*theB).build(*track);
# Line 148 | Line 194 | void TrackSplitterProducer::produce(edm:
194        }
195      }
196        
197 +
198    // create the two splitted trackCollections
199    splittedTColl1_ = std::auto_ptr<TrackCollection> (new TrackCollection );
200    splittedTColl2_ = std::auto_ptr<TrackCollection> (new TrackCollection );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines