![]() |
![]() |
#include <SoftConversionTrackCandidateProducer.h>
Definition at line 39 of file SoftConversionTrackCandidateProducer.h.
SoftConversionTrackCandidateProducer::SoftConversionTrackCandidateProducer | ( | const edm::ParameterSet & | ps | ) |
Definition at line 57 of file SoftConversionTrackCandidateProducer.cc.
References clusterBarrelCollection_, clusterEndcapCollection_, clusterType_, conf_, edm::ParameterSet::getParameter(), InOutTrackCandidateCollection_, InOutTrackClusterAssociationCollection_, LogDebug, OutInTrackCandidateCollection_, and OutInTrackClusterAssociationCollection_.
: conf_(config), theNavigationSchool_(0), theOutInSeedFinder_(0), theOutInTrackFinder_(0), theInOutSeedFinder_(0), theInOutTrackFinder_(0) { LogDebug("SoftConversionTrackCandidateProducer") << "SoftConversionTrackCandidateProducer CTOR " << "\n"; clusterType_ = conf_.getParameter<std::string>("clusterType"); clusterBarrelCollection_ = conf_.getParameter<edm::InputTag>("clusterBarrelCollection"); clusterEndcapCollection_ = conf_.getParameter<edm::InputTag>("clusterEndcapCollection"); OutInTrackCandidateCollection_ = conf_.getParameter<std::string>("outInTrackCandidateCollection"); InOutTrackCandidateCollection_ = conf_.getParameter<std::string>("inOutTrackCandidateCollection"); OutInTrackClusterAssociationCollection_ = conf_.getParameter<std::string>("outInTrackCandidateClusterAssociationCollection"); InOutTrackClusterAssociationCollection_ = conf_.getParameter<std::string>("inOutTrackCandidateClusterAssociationCollection"); // Register the product produces< TrackCandidateCollection > (OutInTrackCandidateCollection_); produces< TrackCandidateCollection > (InOutTrackCandidateCollection_); produces< reco::TrackCandidateCaloClusterPtrAssociation > ( OutInTrackClusterAssociationCollection_); produces< reco::TrackCandidateCaloClusterPtrAssociation > ( InOutTrackClusterAssociationCollection_); }
SoftConversionTrackCandidateProducer::~SoftConversionTrackCandidateProducer | ( | ) |
Definition at line 85 of file SoftConversionTrackCandidateProducer.cc.
{}
void SoftConversionTrackCandidateProducer::beginRun | ( | edm::Run & | r, |
edm::EventSetup const & | es | ||
) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 96 of file SoftConversionTrackCandidateProducer.cc.
References conf_, edm::EventSetup::get(), nEvt_, edm::ESHandle< T >::product(), theInOutSeedFinder_, theInOutTrackFinder_, theNavigationSchool_, theOutInSeedFinder_, and theOutInTrackFinder_.
{ nEvt_=0; //get magnetic field edm::LogInfo("SoftConversionTrackCandidateProducer") << " get magnetic field" << "\n"; edm::ESHandle<NavigationSchool> nav; theEventSetup.get<NavigationSchoolRecord>().get("SimpleNavigationSchool", nav); theNavigationSchool_ = nav.product(); // get the Out In Seed Finder edm::LogInfo("SoftConversionTrackCandidateProducer") << " get the OutInSeedFinder" << "\n"; theOutInSeedFinder_ = new OutInConversionSeedFinder ( conf_ ); // get the Out In Track Finder edm::LogInfo("SoftConversionTrackCandidateProducer") << " get the OutInTrackFinder" << "\n"; theOutInTrackFinder_ = new OutInConversionTrackFinder ( theEventSetup, conf_ ); // get the In Out Seed Finder edm::LogInfo("SoftConversionTrackCandidateProducer") << " get the InOutSeedFinder" << "\n"; theInOutSeedFinder_ = new InOutConversionSeedFinder ( conf_ ); // get the In Out Track Finder edm::LogInfo("SoftConversionTrackCandidateProducer") << " get the InOutTrackFinder" << "\n"; theInOutTrackFinder_ = new InOutConversionTrackFinder ( theEventSetup, conf_ ); }
void SoftConversionTrackCandidateProducer::buildCollections | ( | const edm::Handle< edm::View< reco::CaloCluster > > & | clusterHandle, |
TrackCandidateCollection & | outInTracks, | ||
TrackCandidateCollection & | inOutTracks, | ||
std::vector< edm::Ptr< reco::CaloCluster > > & | vecRecOI, | ||
std::vector< edm::Ptr< reco::CaloCluster > > & | vecRecIO | ||
) | [private] |
Definition at line 197 of file SoftConversionTrackCandidateProducer.cc.
References abs, dPhi(), IsGoodSeed(), InOutConversionSeedFinder::makeSeeds(), OutInConversionSeedFinder::makeSeeds(), position, ConversionSeedFinder::seeds(), ConversionSeedFinder::setCandidate(), InOutConversionSeedFinder::setTracks(), theInOutSeedFinder_, theInOutTrackFinder_, theOutInSeedFinder_, theOutInTrackFinder_, OutInConversionTrackFinder::tracks(), and InOutConversionTrackFinder::tracks().
Referenced by produce().
{ // temporary collection TrackCandidateCollection tempTCC; TrajectorySeedCollection totalOISeeds; // total number of out-in trajectory seeds through entire cluster collection loop TrajectorySeedCollection totalIOSeeds; // total number of in-out trajectory seeds through entire cluster collection loop int nClusters = (int) clusterHandle->size(); // first loop to fill totalOISeeds and totalIOSeeds for(int iCluster=0; iCluster<nClusters; iCluster++){ reco::CaloClusterPtr clusterRefOutIn = clusterHandle->ptrAt(iCluster); math::XYZPoint position = clusterRefOutIn->position(); GlobalPoint gp(position.x(),position.y(),position.z()); theOutInSeedFinder_->setCandidate(clusterRefOutIn->energy(),gp); theOutInSeedFinder_->makeSeeds(clusterRefOutIn); TrajectorySeedCollection oISeeds = theOutInSeedFinder_->seeds(); for(TrajectorySeedCollection::const_iterator it = oISeeds.begin(); it != oISeeds.end(); it++){ totalOISeeds.push_back(*it); } std::vector<Trajectory> theOutInTracks= theOutInTrackFinder_->tracks(oISeeds, tempTCC); tempTCC.clear(); for(int jCluster=iCluster; jCluster<nClusters; jCluster++){ reco::CaloClusterPtr clusterRefInOut = clusterHandle->ptrAt(jCluster); math::XYZPoint position2 = clusterRefInOut->position(); GlobalPoint gp2(position2.x(),position2.y(),position2.z()); double dEta = std::abs(position.Eta() - position2.Eta()); if(dEta > 0.1) continue; double dPhi = std::abs(ROOT::Math::VectorUtil::DeltaPhi(position, position2)); if(dPhi > 0.5) continue; theInOutSeedFinder_->setCandidate(clusterRefInOut->energy(),gp2); theInOutSeedFinder_->setTracks(theOutInTracks); theInOutSeedFinder_->makeSeeds(clusterHandle); TrajectorySeedCollection iOSeeds = theInOutSeedFinder_->seeds(); for(TrajectorySeedCollection::const_iterator it = iOSeeds.begin(); it != iOSeeds.end(); it++){ totalIOSeeds.push_back(*it); } }// for jCluster }// for iCluster // Now we have total OI/IO seeds. Let's clean them up and save them with only giving good trajectories TrajectorySeedCollection oIFilteredSeeds; TrajectorySeedCollection iOFilteredSeeds; tempTCC.clear(); std::vector<Trajectory> tempTrj = theOutInTrackFinder_->tracks(totalOISeeds,tempTCC); for(std::vector<Trajectory>::iterator it = tempTrj.begin(); it!= tempTrj.end(); it++){ oIFilteredSeeds.push_back(it->seed()); } tempTrj.clear(); tempTCC.clear(); tempTrj = theInOutTrackFinder_->tracks(totalIOSeeds,tempTCC); for(std::vector<Trajectory>::iterator it = tempTrj.begin(); it!= tempTrj.end(); it++){ iOFilteredSeeds.push_back(it->seed()); } tempTCC.clear(); tempTrj.clear(); totalOISeeds.clear(); totalIOSeeds.clear(); // Now start normal procedure and consider seeds that belong to filtered ones. for(int iCluster=0; iCluster<nClusters; iCluster++){ reco::CaloClusterPtr clusterRefOutIn = clusterHandle->ptrAt(iCluster); math::XYZPoint position = clusterRefOutIn->position(); GlobalPoint gp(position.x(),position.y(),position.z()); theOutInSeedFinder_->setCandidate(clusterRefOutIn->energy(),gp); theOutInSeedFinder_->makeSeeds(clusterRefOutIn); TrajectorySeedCollection oISeeds_all = theOutInSeedFinder_->seeds(); TrajectorySeedCollection oISeeds; for(TrajectorySeedCollection::iterator it = oISeeds_all.begin(); it != oISeeds_all.end(); it++){ if(IsGoodSeed(oIFilteredSeeds,*it)) oISeeds.push_back(*it); } if(oISeeds.size() == 0) continue; std::vector<Trajectory> theOutInTracks= theOutInTrackFinder_->tracks(oISeeds, outInTrackCandidates); int nOITrj = (int) theOutInTracks.size(); for(int itrj=0; itrj < nOITrj; itrj++) vecRecOI.push_back( clusterRefOutIn ); for(int jCluster=iCluster; jCluster<nClusters; jCluster++){ reco::CaloClusterPtr clusterRefInOut = clusterHandle->ptrAt(jCluster); math::XYZPoint position2 = clusterRefInOut->position(); GlobalPoint gp2(position2.x(),position2.y(),position2.z()); double dEta = std::abs(position.Eta() - position2.Eta()); if(dEta > 0.1) continue; double dPhi = std::abs(ROOT::Math::VectorUtil::DeltaPhi(position, position2)); if(dPhi > 0.5) continue; theInOutSeedFinder_->setCandidate(clusterRefInOut->energy(),gp2); theInOutSeedFinder_->setTracks(theOutInTracks); theInOutSeedFinder_->makeSeeds(clusterHandle); TrajectorySeedCollection iOSeeds_all = theInOutSeedFinder_->seeds(); TrajectorySeedCollection iOSeeds; for(TrajectorySeedCollection::iterator it = iOSeeds_all.begin(); it != iOSeeds_all.end(); it++){ if(IsGoodSeed(iOFilteredSeeds,*it)) iOSeeds.push_back(*it); } if(iOSeeds.size() == 0) continue; std::vector<Trajectory> theInOutTracks= theInOutTrackFinder_->tracks(iOSeeds, inOutTrackCandidates); int nIOTrj = (int) theInOutTracks.size(); for(int itrj=0; itrj < nIOTrj; itrj++) vecRecIO.push_back( clusterRefInOut ); }// for jCluster }// for iCluster }
void SoftConversionTrackCandidateProducer::endRun | ( | edm::Run & | r, |
edm::EventSetup const & | es | ||
) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 122 of file SoftConversionTrackCandidateProducer.cc.
References theInOutSeedFinder_, theInOutTrackFinder_, theOutInSeedFinder_, and theOutInTrackFinder_.
{ delete theOutInSeedFinder_; delete theOutInTrackFinder_; delete theInOutSeedFinder_; delete theInOutTrackFinder_; }
void SoftConversionTrackCandidateProducer::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 130 of file SoftConversionTrackCandidateProducer.cc.
References buildCollections(), clusterBarrelCollection_, clusterEndcapCollection_, clusterType_, gather_cfg::cout, edm::helper::Filler< Map >::fill(), edm::Event::getByLabel(), edm::EventBase::id(), InOutTrackCandidateCollection_, InOutTrackClusterAssociationCollection_, edm::helper::Filler< Map >::insert(), edm::HandleBase::isValid(), edm::InputTag::label(), nEvt_, OutInTrackCandidateCollection_, OutInTrackClusterAssociationCollection_, edm::Event::put(), ConversionTrackFinder::setEvent(), ConversionSeedFinder::setEvent(), setEventSetup(), theInOutSeedFinder_, theInOutTrackFinder_, theNavigationSchool_, theOutInSeedFinder_, and theOutInTrackFinder_.
{ using namespace edm; nEvt_++; edm::LogInfo("SoftConversionTrackCandidateProducer") << "SoftConversionTrackCandidateProducer Analyzing event number: " << theEvent.id() << " Global Counter " << nEvt_ << "\n"; std::cout << "SoftConversionTrackCandidateProducer Analyzing event number: " << theEvent.id() << " Global Counter " << nEvt_ << "\n"; setEventSetup( theEventSetup ); theOutInSeedFinder_->setEvent(theEvent); theInOutSeedFinder_->setEvent(theEvent); theOutInTrackFinder_->setEvent(theEvent); theInOutTrackFinder_->setEvent(theEvent); // Set the navigation school NavigationSetter setter(*theNavigationSchool_); // collections to be stored in events std::auto_ptr<TrackCandidateCollection> outInTrackCandidate_p(new TrackCandidateCollection); std::auto_ptr<TrackCandidateCollection> inOutTrackCandidate_p(new TrackCandidateCollection); std::auto_ptr<reco::TrackCandidateCaloClusterPtrAssociation> outInAssoc_p(new reco::TrackCandidateCaloClusterPtrAssociation); std::auto_ptr<reco::TrackCandidateCaloClusterPtrAssociation> inOutAssoc_p(new reco::TrackCandidateCaloClusterPtrAssociation); std::vector<edm::Ptr<reco::CaloCluster> > vecOfClusterRefForOutIn; std::vector<edm::Ptr<reco::CaloCluster> > vecOfClusterRefForInOut; // Get the basic cluster collection in the Barrel edm::Handle<edm::View<reco::CaloCluster> > clusterBarrelHandle; theEvent.getByLabel(clusterBarrelCollection_, clusterBarrelHandle); if (!clusterBarrelHandle.isValid()) { edm::LogError("SoftConverionTrackCandidateProducer") << "Error! Can't get the product "<<clusterBarrelCollection_.label(); return; } buildCollections(clusterBarrelHandle, *outInTrackCandidate_p, *inOutTrackCandidate_p, vecOfClusterRefForOutIn, vecOfClusterRefForInOut); if(clusterType_ == "BasicCluster" ) { // Get the basic cluster collection in the Endcap edm::Handle<edm::View<reco::CaloCluster> > clusterEndcapHandle; theEvent.getByLabel(clusterEndcapCollection_, clusterEndcapHandle); if (!clusterEndcapHandle.isValid()) { edm::LogError("SoftConversionTrackCandidateProducer") << "Error! Can't get the product "<<clusterEndcapCollection_.label(); return; } buildCollections(clusterEndcapHandle, *outInTrackCandidate_p, *inOutTrackCandidate_p, vecOfClusterRefForOutIn, vecOfClusterRefForInOut); } // put all products in the event const edm::OrphanHandle<TrackCandidateCollection> refprodOutInTrackC = theEvent.put( outInTrackCandidate_p, OutInTrackCandidateCollection_ ); const edm::OrphanHandle<TrackCandidateCollection> refprodInOutTrackC = theEvent.put( inOutTrackCandidate_p, InOutTrackCandidateCollection_ ); edm::ValueMap<reco::CaloClusterPtr>::Filler fillerOI(*outInAssoc_p); fillerOI.insert(refprodOutInTrackC, vecOfClusterRefForOutIn.begin(), vecOfClusterRefForOutIn.end()); fillerOI.fill(); edm::ValueMap<reco::CaloClusterPtr>::Filler fillerIO(*inOutAssoc_p); fillerIO.insert(refprodInOutTrackC, vecOfClusterRefForInOut.begin(), vecOfClusterRefForInOut.end()); fillerIO.fill(); theEvent.put( outInAssoc_p, OutInTrackClusterAssociationCollection_); theEvent.put( inOutAssoc_p, InOutTrackClusterAssociationCollection_); }
void SoftConversionTrackCandidateProducer::setEventSetup | ( | const edm::EventSetup & | es | ) | [private] |
Initialize EventSetup objects at each event.
Definition at line 87 of file SoftConversionTrackCandidateProducer.cc.
References ConversionSeedFinder::setEventSetup(), ConversionTrackFinder::setEventSetup(), theInOutSeedFinder_, theInOutTrackFinder_, theOutInSeedFinder_, and theOutInTrackFinder_.
Referenced by produce().
{ theOutInSeedFinder_->setEventSetup(theEventSetup); theInOutSeedFinder_->setEventSetup(theEventSetup); theOutInTrackFinder_->setEventSetup(theEventSetup); theInOutTrackFinder_->setEventSetup(theEventSetup); }
Definition at line 59 of file SoftConversionTrackCandidateProducer.h.
Referenced by produce(), and SoftConversionTrackCandidateProducer().
Definition at line 60 of file SoftConversionTrackCandidateProducer.h.
Referenced by produce(), and SoftConversionTrackCandidateProducer().
std::string SoftConversionTrackCandidateProducer::clusterType_ [private] |
Definition at line 58 of file SoftConversionTrackCandidateProducer.h.
Referenced by produce(), and SoftConversionTrackCandidateProducer().
Definition at line 66 of file SoftConversionTrackCandidateProducer.h.
Referenced by beginRun(), and SoftConversionTrackCandidateProducer().
std::string SoftConversionTrackCandidateProducer::InOutTrackCandidateCollection_ [private] |
Definition at line 62 of file SoftConversionTrackCandidateProducer.h.
Referenced by produce(), and SoftConversionTrackCandidateProducer().
std::string SoftConversionTrackCandidateProducer::InOutTrackClusterAssociationCollection_ [private] |
Definition at line 64 of file SoftConversionTrackCandidateProducer.h.
Referenced by produce(), and SoftConversionTrackCandidateProducer().
int SoftConversionTrackCandidateProducer::nEvt_ [private] |
Definition at line 53 of file SoftConversionTrackCandidateProducer.h.
Referenced by beginRun(), and produce().
std::string SoftConversionTrackCandidateProducer::OutInTrackCandidateCollection_ [private] |
Definition at line 61 of file SoftConversionTrackCandidateProducer.h.
Referenced by produce(), and SoftConversionTrackCandidateProducer().
std::string SoftConversionTrackCandidateProducer::OutInTrackClusterAssociationCollection_ [private] |
Definition at line 63 of file SoftConversionTrackCandidateProducer.h.
Referenced by produce(), and SoftConversionTrackCandidateProducer().
Definition at line 68 of file SoftConversionTrackCandidateProducer.h.
Definition at line 73 of file SoftConversionTrackCandidateProducer.h.
Referenced by beginRun(), buildCollections(), endRun(), produce(), and setEventSetup().
Definition at line 74 of file SoftConversionTrackCandidateProducer.h.
Referenced by beginRun(), buildCollections(), endRun(), produce(), and setEventSetup().
Definition at line 70 of file SoftConversionTrackCandidateProducer.h.
Referenced by beginRun(), and produce().
Definition at line 71 of file SoftConversionTrackCandidateProducer.h.
Referenced by beginRun(), buildCollections(), endRun(), produce(), and setEventSetup().
Definition at line 72 of file SoftConversionTrackCandidateProducer.h.
Referenced by beginRun(), buildCollections(), endRun(), produce(), and setEventSetup().