CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

LightPFTrackProducer Class Reference

#include <LightPFTrackProducer.h>

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

List of all members.

Public Member Functions

 LightPFTrackProducer (const edm::ParameterSet &)
 Constructor.
 ~LightPFTrackProducer ()
 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

PFTrackTransformerpfTransformer_
 PFTrackTransformer.
reco::TrackBase::TrackQuality trackQuality_
std::vector< edm::InputTagtracksContainers_
bool useQuality_
 TRACK QUALITY.

Detailed Description

Definition at line 11 of file LightPFTrackProducer.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 15 of file LightPFTrackProducer.cc.

References edm::ParameterSet::getParameter(), reco::TrackBase::qualityByName(), AlCaHLTBitMon_QueryRunRegistry::string, trackQuality_, tracksContainers_, and useQuality_.

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

  tracksContainers_ = 
    iConfig.getParameter< vector < InputTag > >("TkColList");


  useQuality_   = iConfig.getParameter<bool>("UseQuality");
  trackQuality_=reco::TrackBase::qualityByName(iConfig.getParameter<std::string>("TrackQuality"));

}
LightPFTrackProducer::~LightPFTrackProducer ( )

Destructor.

Definition at line 29 of file LightPFTrackProducer.cc.

References pfTransformer_.

{
  delete pfTransformer_;
}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 68 of file LightPFTrackProducer.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 LightPFTrackProducer::endRun ( void  ) [private, virtual]

Definition at line 79 of file LightPFTrackProducer.cc.

References pfTransformer_.

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

Produce the PFRecTrack collection.

Implements edm::EDProducer.

Definition at line 35 of file LightPFTrackProducer.cc.

References PFTrackTransformer::addPoints(), edm::Event::getByLabel(), i, reco::PFRecTrack::KF, pfTransformer_, edm::Handle< T >::product(), edm::Event::put(), trackQuality_, tracksContainers_, useQuality_, and TrackValidation_HighPurity_cff::valid.

{

  //create the empty collections 
  auto_ptr< reco::PFRecTrackCollection > 
    PfTrColl (new reco::PFRecTrackCollection);
  
  for (unsigned int istr=0; istr<tracksContainers_.size();istr++){
    
    //Track collection
    Handle<reco::TrackCollection> tkRefCollection;
    iEvent.getByLabel(tracksContainers_[istr], tkRefCollection);
    reco::TrackCollection  Tk=*(tkRefCollection.product());
    for(unsigned int i=0;i<Tk.size();i++){
      if (useQuality_ &&
          (!(Tk[i].quality(trackQuality_)))) continue;
     reco::TrackRef trackRef(tkRefCollection, i);
      reco::PFRecTrack pftrack( trackRef->charge(), 
                                reco::PFRecTrack::KF, 
                                i, trackRef );
      Trajectory FakeTraj;
      bool mymsgwarning = false;
      bool valid = pfTransformer_->addPoints( pftrack, *trackRef, FakeTraj, mymsgwarning);
      if(valid)
        PfTrColl->push_back(pftrack);           

    }
  }
  iEvent.put(PfTrColl);
}

Member Data Documentation

Definition at line 32 of file LightPFTrackProducer.h.

Referenced by LightPFTrackProducer(), and produce().

Definition at line 29 of file LightPFTrackProducer.h.

Referenced by LightPFTrackProducer(), and produce().

TRACK QUALITY.

Definition at line 31 of file LightPFTrackProducer.h.

Referenced by LightPFTrackProducer(), and produce().