#include <PFV0Producer.h>
Public Member Functions | |
PFV0Producer (const edm::ParameterSet &) | |
Constructor. | |
~PFV0Producer () | |
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 | |
PFTrackTransformer * | pfTransformer_ |
PFTrackTransformer. | |
std::vector< edm::InputTag > | V0list_ |
Definition at line 12 of file PFV0Producer.h.
PFV0Producer::PFV0Producer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Constructor.
Definition at line 17 of file PFV0Producer.cc.
References edm::ParameterSet::getParameter(), and V0list_.
: pfTransformer_(0) { produces<reco::PFV0Collection>(); produces<reco::PFRecTrackCollection>(); V0list_ = iConfig.getParameter< vector < InputTag > >("V0List"); }
PFV0Producer::~PFV0Producer | ( | ) |
Destructor.
Definition at line 28 of file PFV0Producer.cc.
References pfTransformer_.
{ delete pfTransformer_; }
void PFV0Producer::beginRun | ( | edm::Run & | run, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 90 of file PFV0Producer.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 PFV0Producer::endRun | ( | void | ) | [private, virtual] |
Definition at line 102 of file PFV0Producer.cc.
References pfTransformer_.
{ delete pfTransformer_; }
void PFV0Producer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Produce the PFRecTrack collection.
Implements edm::EDProducer.
Definition at line 34 of file PFV0Producer.cc.
References PFTrackTransformer::addPoints(), edm::EventID::event(), edm::Event::getByLabel(), edm::Event::getRefBeforePut(), edm::EventBase::id(), UserOptions_cff::idx, edm::Ref< C, T, F >::key(), reco::PFRecTrack::KF, LogDebug, pfTransformer_, edm::Event::put(), edm::EventID::run(), V0list_, and TrackValidation_HighPurity_cff::valid.
{ LogDebug("PFV0Producer")<<"START event: "<<iEvent.id().event() <<" in run "<<iEvent.id().run(); //create the empty collections auto_ptr< PFV0Collection > pfV0Coll (new PFV0Collection); auto_ptr<reco::PFRecTrackCollection> pfV0RecTrackColl(new reco::PFRecTrackCollection); reco::PFRecTrackRefProd pfTrackRefProd = iEvent.getRefBeforePut<reco::PFRecTrackCollection>(); int idx = 0; for (unsigned int il=0; il<V0list_.size(); il++){ Handle<VertexCompositeCandidateCollection> V0coll; iEvent.getByLabel(V0list_[il],V0coll); LogDebug("PFV0Producer")<<V0list_[il]<<" contains "<<V0coll->size()<<" V0 candidates "; for (unsigned int iv=0;iv<V0coll->size();iv++){ VertexCompositeCandidateRef V0(V0coll, iv); vector<TrackRef> Tracks; vector<PFRecTrackRef> PFTracks; for( unsigned int ndx = 0; ndx < V0->numberOfDaughters(); ndx++ ) { Tracks.push_back( (dynamic_cast<const RecoChargedCandidate*>(V0->daughter(ndx)))->track() ); TrackRef trackRef = (dynamic_cast<const RecoChargedCandidate*>(V0->daughter(ndx)))->track(); reco::PFRecTrack pfRecTrack( trackRef->charge(), reco::PFRecTrack::KF, trackRef.key(), trackRef ); Trajectory FakeTraj; bool valid = pfTransformer_->addPoints( pfRecTrack, *trackRef, FakeTraj); if(valid) { PFTracks.push_back(reco::PFRecTrackRef( pfTrackRefProd, idx++)); pfV0RecTrackColl->push_back(pfRecTrack); } } if ((PFTracks.size()==2)&&(Tracks.size()==2)){ pfV0Coll->push_back(PFV0(V0,PFTracks,Tracks)); } } } iEvent.put(pfV0Coll); iEvent.put(pfV0RecTrackColl); }
PFTrackTransformer* PFV0Producer::pfTransformer_ [private] |
Definition at line 29 of file PFV0Producer.h.
Referenced by beginRun(), endRun(), produce(), and ~PFV0Producer().
std::vector< edm::InputTag > PFV0Producer::V0list_ [private] |
Definition at line 30 of file PFV0Producer.h.
Referenced by PFV0Producer(), and produce().