CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PFNuclearProducer Class Reference

#include <PFNuclearProducer.h>

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

List of all members.

Public Member Functions

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

double likelihoodCut_
std::vector< edm::InputTagnuclearContainers_
PFTrackTransformerpfTransformer_
 PFTrackTransformer.

Detailed Description

Definition at line 11 of file PFNuclearProducer.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 11 of file PFNuclearProducer.cc.

References edm::ParameterSet::getParameter(), likelihoodCut_, and nuclearContainers_.

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

  nuclearContainers_ = 
    iConfig.getParameter< vector < InputTag > >("nuclearColList");
  likelihoodCut_
     = iConfig.getParameter<double>("likelihoodCut");
}
PFNuclearProducer::~PFNuclearProducer ( )

Destructor.

Definition at line 23 of file PFNuclearProducer.cc.

References pfTransformer_.

{
  delete pfTransformer_;
}

Member Function Documentation

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

Reimplemented from edm::EDProducer.

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

Definition at line 89 of file PFNuclearProducer.cc.

References pfTransformer_.

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

Produce the PFRecTrack collection.

Implements edm::EDProducer.

Definition at line 29 of file PFNuclearProducer.cc.

References PFTrackTransformer::addPoints(), edm::Event::getByLabel(), edm::Event::getRefBeforePut(), icoll, reco::PFRecTrack::KF, likelihood(), likelihoodCut_, nuclearContainers_, pfTransformer_, edm::Handle< T >::product(), edm::RefVector< C, T, F >::push_back(), edm::Event::put(), and TrackValidation_HighPurity_cff::valid.

{
  typedef reco::NuclearInteraction::trackRef_iterator trackRef_iterator;

  //create the empty collections 
  auto_ptr< reco::PFNuclearInteractionCollection > 
    pfNuclearColl (new reco::PFNuclearInteractionCollection);
  auto_ptr< reco::PFRecTrackCollection > 
    pfNuclearRecTrackColl (new reco::PFRecTrackCollection);
  
  reco::PFRecTrackRefProd pfTrackRefProd = iEvent.getRefBeforePut<reco::PFRecTrackCollection>();
  int hid=0;

  // loop on the nuclear interaction collections
  for (unsigned int istr=0; istr<nuclearContainers_.size();istr++){
    
    Handle<reco::NuclearInteractionCollection> nuclCollH;
    iEvent.getByLabel(nuclearContainers_[istr], nuclCollH);
    const reco::NuclearInteractionCollection& nuclColl = *(nuclCollH.product());

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

      if( nuclColl[icoll].likelihood() < likelihoodCut_) continue;

      reco::PFRecTrackRefVector pfRecTkcoll;

      // convert the secondary tracks
      for(trackRef_iterator it = nuclColl[icoll].secondaryTracks_begin(); it!=nuclColl[icoll].secondaryTracks_end(); it++){
        reco::PFRecTrack pftrack( (*it)->charge(), 
                                reco::PFRecTrack::KF, 
                                it->key(), (reco::TrackRef)((*it).castTo<reco::TrackRef>()) );
        Trajectory FakeTraj;
        bool valid = pfTransformer_->addPoints( pftrack, **it, FakeTraj);
        if(valid) {
          pfRecTkcoll.push_back(reco::PFRecTrackRef( pfTrackRefProd, hid++ ));  
          pfNuclearRecTrackColl->push_back(pftrack);
        }
      }
      reco::NuclearInteractionRef niRef(nuclCollH, icoll);
      pfNuclearColl->push_back( reco::PFNuclearInteraction( niRef, pfRecTkcoll ));
    }
  }
  iEvent.put(pfNuclearRecTrackColl);
  iEvent.put(pfNuclearColl);
}

Member Data Documentation

Definition at line 29 of file PFNuclearProducer.h.

Referenced by PFNuclearProducer(), and produce().

Definition at line 30 of file PFNuclearProducer.h.

Referenced by PFNuclearProducer(), and produce().

PFTrackTransformer.

Definition at line 28 of file PFNuclearProducer.h.

Referenced by beginRun(), endRun(), produce(), and ~PFNuclearProducer().