CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PFDisplacedTrackerVertexProducer Class Reference

#include <PFDisplacedTrackerVertexProducer.h>

Inheritance diagram for PFDisplacedTrackerVertexProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 PFDisplacedTrackerVertexProducer (const edm::ParameterSet &)
 Constructor.
 ~PFDisplacedTrackerVertexProducer ()
 Destructor.

Private Member Functions

virtual void beginRun (edm::Run &, const edm::EventSetup &)
virtual void endRun ()
virtual void produce (edm::Event &, const edm::EventSetup &)
 Produce the PFRecTrack collection.

Private Attributes

edm::InputTag pfDisplacedVertexContainer_
edm::InputTag pfTrackContainer_
PFTrackTransformerpfTransformer_
 PFTrackTransformer.

Detailed Description

Definition at line 11 of file PFDisplacedTrackerVertexProducer.h.


Constructor & Destructor Documentation

PFDisplacedTrackerVertexProducer::PFDisplacedTrackerVertexProducer ( const edm::ParameterSet iConfig) [explicit]

Constructor.

Definition at line 11 of file PFDisplacedTrackerVertexProducer.cc.

References edm::ParameterSet::getParameter(), pfDisplacedVertexContainer_, and pfTrackContainer_.

                                                                                             :
  pfTransformer_(0)
{
  produces<reco::PFRecTrackCollection>();
  produces<reco::PFDisplacedTrackerVertexCollection>();

  pfDisplacedVertexContainer_ = 
    iConfig.getParameter< InputTag >("displacedTrackerVertexColl");

  pfTrackContainer_ =
    iConfig.getParameter< InputTag >("trackColl");

}
PFDisplacedTrackerVertexProducer::~PFDisplacedTrackerVertexProducer ( )

Destructor.

Definition at line 25 of file PFDisplacedTrackerVertexProducer.cc.

References pfTransformer_.

{
  delete pfTransformer_;
}

Member Function Documentation

void PFDisplacedTrackerVertexProducer::beginRun ( edm::Run run,
const edm::EventSetup iSetup 
) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 101 of file PFDisplacedTrackerVertexProducer.cc.

References edm::EventSetup::get(), PFTrackTransformer::OnlyProp(), and pfTransformer_.

{
  ESHandle<MagneticField> magneticField;
  iSetup.get<IdealMagneticFieldRecord>().get(magneticField);
  pfTransformer_= new PFTrackTransformer(math::XYZVector(magneticField->inTesla(GlobalPoint(0,0,0))));
  pfTransformer_->OnlyProp();
}
void PFDisplacedTrackerVertexProducer::endRun ( void  ) [private, virtual]

Definition at line 112 of file PFDisplacedTrackerVertexProducer.cc.

References pfTransformer_.

                                         {
  delete pfTransformer_;
}
void PFDisplacedTrackerVertexProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Produce the PFRecTrack collection.

Implements edm::EDProducer.

Definition at line 31 of file PFDisplacedTrackerVertexProducer.cc.

References PFTrackTransformer::addPoints(), edm::Event::getByLabel(), edm::Event::getRefBeforePut(), icoll, edm::RefToBase< T >::key(), reco::PFRecTrack::KF, pfDisplacedVertexContainer_, pfTrackContainer_, pfTransformer_, edm::RefVector< C, T, F >::push_back(), edm::Event::put(), and TrackValidation_HighPurity_cff::valid.

{

  //create the empty collections 
  auto_ptr< reco::PFDisplacedTrackerVertexCollection > 
    pfDisplacedTrackerVertexColl (new reco::PFDisplacedTrackerVertexCollection);
  auto_ptr< reco::PFRecTrackCollection > 
    pfRecTrackColl (new reco::PFRecTrackCollection);
  
  reco::PFRecTrackRefProd pfTrackRefProd = iEvent.getRefBeforePut<reco::PFRecTrackCollection>();


    
  Handle<reco::PFDisplacedVertexCollection> nuclCollH;
  iEvent.getByLabel(pfDisplacedVertexContainer_, nuclCollH);
  const reco::PFDisplacedVertexCollection& nuclColl = *(nuclCollH.product());

  Handle<reco::TrackCollection> trackColl;
  iEvent.getByLabel(pfTrackContainer_, trackColl);

  int idx = 0;

  //  cout << "Size of Displaced Vertices " 
  //     <<  nuclColl.size() << endl;

  // loop on all NuclearInteraction 
  for( unsigned int icoll=0; icoll < nuclColl.size(); icoll++) {

    reco::PFRecTrackRefVector pfRecTkcoll;

    std::vector<reco::Track> refittedTracks = nuclColl[icoll].refittedTracks();

    // convert the secondary tracks
    for(unsigned it = 0; it < refittedTracks.size(); it++){

      reco::TrackBaseRef trackBaseRef = nuclColl[icoll].originalTrack(refittedTracks[it]);

      //      cout << "track base pt = " << trackBaseRef->pt() << endl;

      reco::TrackRef trackRef(trackColl, trackBaseRef.key());

      //      cout << "track pt = " << trackRef->pt() << endl;


      reco::PFRecTrack pfRecTrack( trackBaseRef->charge(), 
                                   reco::PFRecTrack::KF, 
                                   trackBaseRef.key(), 
                                   trackRef );

      // cout << pfRecTrack << endl;

      Trajectory FakeTraj;
      bool valid = pfTransformer_->addPoints( pfRecTrack, *trackBaseRef, FakeTraj);
      if(valid) {
        pfRecTkcoll.push_back(reco::PFRecTrackRef( pfTrackRefProd, idx++));     
        pfRecTrackColl->push_back(pfRecTrack);
        //      cout << "after "<< pfRecTrack << endl;
          
      }
    }
    reco::PFDisplacedVertexRef niRef(nuclCollH, icoll);
    pfDisplacedTrackerVertexColl->push_back( reco::PFDisplacedTrackerVertex( niRef, pfRecTkcoll ));
  }
 
  iEvent.put(pfRecTrackColl);
  iEvent.put(pfDisplacedTrackerVertexColl);
}

Member Data Documentation

Definition at line 29 of file PFDisplacedTrackerVertexProducer.h.

Referenced by PFDisplacedTrackerVertexProducer(), and produce().

Definition at line 30 of file PFDisplacedTrackerVertexProducer.h.

Referenced by PFDisplacedTrackerVertexProducer(), and produce().