#include <RecoPixelVertexing/PixelTrackFitting/plugins/PixelTrackProducer.h>
Public Member Functions | |
virtual void | beginRun (edm::Run &run, const edm::EventSetup &es) |
virtual void | endRun (edm::Run &run, const edm::EventSetup &es) |
PixelTrackProducer (const edm::ParameterSet &conf) | |
virtual void | produce (edm::Event &ev, const edm::EventSetup &es) |
~PixelTrackProducer () | |
Private Member Functions | |
void | store (edm::Event &ev, const pixeltrackfitting::TracksWithRecHits &selectedTracks) |
Private Attributes | |
PixelTrackCleaner * | theCleaner |
edm::ParameterSet | theConfig |
const PixelTrackFilter * | theFilter |
const PixelFitter * | theFitter |
OrderedHitsGenerator * | theGenerator |
TrackingRegionProducer * | theRegionProducer |
Definition at line 16 of file PixelTrackProducer.h.
PixelTrackProducer::PixelTrackProducer | ( | const edm::ParameterSet & | conf | ) | [explicit] |
Definition at line 35 of file PixelTrackProducer.cc.
00036 : theConfig(cfg), theFitter(0), theFilter(0), theCleaner(0), theGenerator(0), theRegionProducer(0) 00037 { 00038 edm::LogInfo("PixelTrackProducer")<<" construction..."; 00039 produces<reco::TrackCollection>(); 00040 produces<TrackingRecHitCollection>(); 00041 produces<reco::TrackExtraCollection>(); 00042 }
PixelTrackProducer::~PixelTrackProducer | ( | ) |
void PixelTrackProducer::beginRun | ( | edm::Run & | run, | |
const edm::EventSetup & | es | |||
) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 58 of file PixelTrackProducer.cc.
References DBSPlugin::get(), edm::ParameterSet::getParameter(), theCleaner, theConfig, theFilter, theFitter, theGenerator, and theRegionProducer.
00059 { 00060 ParameterSet regfactoryPSet = theConfig.getParameter<ParameterSet>("RegionFactoryPSet"); 00061 std::string regfactoryName = regfactoryPSet.getParameter<std::string>("ComponentName"); 00062 theRegionProducer = TrackingRegionProducerFactory::get()->create(regfactoryName,regfactoryPSet); 00063 00064 ParameterSet orderedPSet = 00065 theConfig.getParameter<ParameterSet>("OrderedHitsFactoryPSet"); 00066 std::string orderedName = orderedPSet.getParameter<std::string>("ComponentName"); 00067 theGenerator = OrderedHitsGeneratorFactory::get()->create( orderedName, orderedPSet); 00068 00069 ParameterSet fitterPSet = theConfig.getParameter<ParameterSet>("FitterPSet"); 00070 std::string fitterName = fitterPSet.getParameter<std::string>("ComponentName"); 00071 theFitter = PixelFitterFactory::get()->create( fitterName, fitterPSet); 00072 00073 ParameterSet filterPSet = theConfig.getParameter<ParameterSet>("FilterPSet"); 00074 std::string filterName = filterPSet.getParameter<std::string>("ComponentName"); 00075 theFilter = PixelTrackFilterFactory::get()->create( filterName, filterPSet); 00076 00077 ParameterSet cleanerPSet = theConfig.getParameter<ParameterSet>("CleanerPSet"); 00078 std::string cleanerName = cleanerPSet.getParameter<std::string>("ComponentName"); 00079 theCleaner = PixelTrackCleanerFactory::get()->create( cleanerName, cleanerPSet); 00080 00081 }
void PixelTrackProducer::endRun | ( | edm::Run & | run, | |
const edm::EventSetup & | es | |||
) | [virtual] |
Reimplemented from edm::EDProducer.
Definition at line 49 of file PixelTrackProducer.cc.
References theCleaner, theFilter, theFitter, theGenerator, and theRegionProducer.
00050 { 00051 delete theFilter; 00052 delete theFitter; 00053 delete theCleaner; 00054 delete theGenerator; 00055 delete theRegionProducer; 00056 }
void PixelTrackProducer::produce | ( | edm::Event & | ev, | |
const edm::EventSetup & | es | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 83 of file PixelTrackProducer.cc.
References PixelTrackCleaner::cleanTracks(), edm::Event::id(), LogDebug, TrackingRegionProducer::regions(), PixelFitter::run(), OrderedHitsGenerator::run(), SeedingHitSet::size(), OrderedSeedingHits::size(), store(), theCleaner, theFilter, theFitter, theGenerator, theRegionProducer, track, and tracks.
00084 { 00085 LogDebug("PixelTrackProducer, produce")<<"event# :"<<ev.id(); 00086 00087 TracksWithRecHits tracks; 00088 00089 typedef std::vector<TrackingRegion* > Regions; 00090 typedef Regions::const_iterator IR; 00091 Regions regions = theRegionProducer->regions(ev,es); 00092 00093 for (IR ir=regions.begin(), irEnd=regions.end(); ir < irEnd; ++ir) { 00094 const TrackingRegion & region = **ir; 00095 00096 const OrderedSeedingHits & triplets = theGenerator->run(region,ev,es); 00097 unsigned int nTriplets = triplets.size(); 00098 edm::LogInfo("PixelTrackProducer") << "number of proto tracks: " << triplets.size(); 00099 00100 // producing tracks 00101 for (unsigned int iTriplet = 0; iTriplet < nTriplets; ++iTriplet) { 00102 const SeedingHitSet & triplet = triplets[iTriplet]; 00103 00104 std::vector<const TrackingRecHit *> hits; 00105 for (unsigned int iHit = 0, nHits = triplet.size(); iHit < nHits; ++iHit) { 00106 hits.push_back( triplet[iHit] ); 00107 } 00108 00109 // fitting 00110 reco::Track* track = theFitter->run(es, hits, region); 00111 00112 // decide if track should be skipped according to filter 00113 if ( ! (*theFilter)(track) ) { 00114 delete track; 00115 continue; 00116 } 00117 00118 // add tracks 00119 tracks.push_back(TrackWithRecHits(track, hits)); 00120 } 00121 } 00122 00123 // skip ovelrapped tracks 00124 if(theCleaner) tracks = theCleaner->cleanTracks(tracks); 00125 00126 // store tracks 00127 store(ev, tracks); 00128 00129 // clean memory 00130 for (IR ir=regions.begin(), irEnd=regions.end(); ir < irEnd; ++ir) delete (*ir); 00131 }
void PixelTrackProducer::store | ( | edm::Event & | ev, | |
const pixeltrackfitting::TracksWithRecHits & | selectedTracks | |||
) | [private] |
Definition at line 133 of file PixelTrackProducer.cc.
References reco::TrackExtraBase::add(), clone(), i, k, LogDebug, edm::Event::put(), reco::TrackBase::setHitPattern(), track, and tracks.
Referenced by produce().
00134 { 00135 std::auto_ptr<reco::TrackCollection> tracks(new reco::TrackCollection); 00136 std::auto_ptr<TrackingRecHitCollection> recHits(new TrackingRecHitCollection); 00137 std::auto_ptr<reco::TrackExtraCollection> trackExtras(new reco::TrackExtraCollection); 00138 typedef std::vector<const TrackingRecHit *> RecHits; 00139 00140 00141 int cc = 0, nTracks = cleanedTracks.size(); 00142 00143 for (int i = 0; i < nTracks; i++) 00144 { 00145 reco::Track* track = cleanedTracks.at(i).first; 00146 const RecHits & hits = cleanedTracks.at(i).second; 00147 00148 for (unsigned int k = 0; k < hits.size(); k++) 00149 { 00150 TrackingRecHit *hit = (hits.at(k))->clone(); 00151 track->setHitPattern(*hit, k); 00152 recHits->push_back(hit); 00153 } 00154 tracks->push_back(*track); 00155 delete track; 00156 00157 } 00158 00159 LogDebug("TrackProducer") << "put the collection of TrackingRecHit in the event" << "\n"; 00160 edm::OrphanHandle <TrackingRecHitCollection> ohRH = ev.put( recHits ); 00161 00162 00163 for (int k = 0; k < nTracks; k++) 00164 { 00165 reco::TrackExtra* theTrackExtra = new reco::TrackExtra(); 00166 00167 //fill the TrackExtra with TrackingRecHitRef 00168 unsigned int nHits = tracks->at(k).numberOfValidHits(); 00169 for(unsigned int i = 0; i < nHits; ++i) { 00170 theTrackExtra->add(TrackingRecHitRef(ohRH,cc)); 00171 cc++; 00172 } 00173 00174 trackExtras->push_back(*theTrackExtra); 00175 delete theTrackExtra; 00176 } 00177 00178 LogDebug("TrackProducer") << "put the collection of TrackExtra in the event" << "\n"; 00179 edm::OrphanHandle<reco::TrackExtraCollection> ohTE = ev.put(trackExtras); 00180 00181 for (int k = 0; k < nTracks; k++) 00182 { 00183 const reco::TrackExtraRef theTrackExtraRef(ohTE,k); 00184 (tracks->at(k)).setExtra(theTrackExtraRef); 00185 } 00186 00187 ev.put(tracks); 00188 }
PixelTrackCleaner* PixelTrackProducer::theCleaner [private] |
Definition at line 36 of file PixelTrackProducer.h.
Referenced by beginRun(), endRun(), and produce().
const PixelTrackFilter* PixelTrackProducer::theFilter [private] |
Definition at line 35 of file PixelTrackProducer.h.
Referenced by beginRun(), endRun(), and produce().
const PixelFitter* PixelTrackProducer::theFitter [private] |
Definition at line 34 of file PixelTrackProducer.h.
Referenced by beginRun(), endRun(), and produce().
Definition at line 37 of file PixelTrackProducer.h.
Referenced by beginRun(), endRun(), and produce().
Definition at line 38 of file PixelTrackProducer.h.
Referenced by beginRun(), endRun(), and produce().