46 theTrackCandidateOutput(
true),
47 theTrajectoryOutput(
false),
48 useSplitting(conf.getParameter<bool>(
"useHitsSplitting")),
49 doSeedingRegionRebuilding(conf.getParameter<bool>(
"doSeedingRegionRebuilding")),
50 cleanTrajectoryAfterInOut(conf.getParameter<bool>(
"cleanTrajectoryAfterInOut")),
51 theMaxNSeeds(conf.getParameter<unsigned int>(
"maxNSeeds")),
52 theTrajectoryBuilderName(conf.getParameter<std::string>(
"TrajectoryBuilder")),
53 theTrajectoryBuilder(0),
54 theTrajectoryCleanerName(conf.getParameter<std::string>(
"TrajectoryCleaner")),
55 theTrajectoryCleaner(0),
57 theNavigationSchoolName(conf.getParameter<std::string>(
"NavigationSchool")),
58 theNavigationSchool(0),
60 maxSeedsBeforeCleaning_(0)
68 if ( conf.
exists(
"maxSeedsBeforeCleaning") )
82 if (cleaner ==
"SeedCleanerByHitPosition") {
84 }
else if (cleaner ==
"SeedCleanerBySharedInput") {
86 }
else if (cleaner ==
"CachingSeedCleanerByHitPosition") {
88 }
else if (cleaner ==
"CachingSeedCleanerBySharedInput") {
90 }
else if (cleaner ==
"none") {
154 std::auto_ptr<std::vector<Trajectory> > outputT (
new std::vector<Trajectory>());
157 LogError(
"TooManySeeds")<<
"Exceeded maximum numeber of seeds! theMaxNSeeds="<<
theMaxNSeeds<<
" nSeed="<<(*collseed).size();
165 if ((*collseed).size()>0){
167 unsigned int lastCleanResult=0;
168 vector<Trajectory> rawResult;
169 rawResult.reserve(collseed->size() * 4);
176 vector<Trajectory> theTmpTrajectories;
179 size_t collseed_size = collseed->size();
180 for (
size_t j = 0;
j < collseed_size;
j++){
184 LogDebug(
"CkfTrackCandidateMakerBase")<<
" Seed cleaning kills seed "<<
j;
189 theTmpTrajectories.clear();
193 LogDebug(
"CkfPattern") <<
"======== In-out trajectory building found " << theTmpTrajectories.size()
194 <<
" trajectories from seed " << j <<
" ========"<<endl
202 LogDebug(
"CkfPattern") <<
"======== In-out trajectory cleaning gave the following valid trajectories from seed "
203 << j <<
" ========"<<endl
212 LogDebug(
"CkfPattern") <<
"======== Out-in trajectory building found " << theTmpTrajectories.size()
213 <<
" valid/invalid trajectories from seed " << j <<
" ========"<<endl
220 LogDebug(
"CkfPattern") <<
"======== Trajectory cleaning gave the following valid trajectories from seed "
221 << j <<
" ========"<<endl
224 for(vector<Trajectory>::iterator it=theTmpTrajectories.begin();
225 it!=theTmpTrajectories.end(); it++){
226 if( it->isValid() ) {
227 it->setSeedRef(collseed->refAt(j));
229 rawResult.push_back(*it);
237 theTmpTrajectories.clear();
239 LogDebug(
"CkfPattern") <<
"rawResult trajectories found so far = " << rawResult.size();
243 rawResult.erase(std::remove_if(rawResult.begin(),rawResult.end(),
246 lastCleanResult=rawResult.size();
258 LogDebug(
"CkfPattern") <<
"======== Final cleaning of entire event found " << rawResult.size()
259 <<
" valid/invalid trajectories ======="<<endl
262 LogDebug(
"CkfPattern") <<
"removing invalid trajectories.";
264 vector<Trajectory> & unsmoothedResult(rawResult);
265 unsmoothedResult.erase(std::remove_if(unsmoothedResult.begin(),unsmoothedResult.end(),
267 unsmoothedResult.end());
279 output->reserve(unsmoothedResult.size());
280 for (vector<Trajectory>::const_iterator it = unsmoothedResult.begin();
281 it != unsmoothedResult.end(); it++) {
285 LogDebug(
"CkfPattern") <<
"retrieving "<<(
useSplitting?
"splitted":
"un-splitted")<<
" hits from trajectory";
289 LogDebug(
"CkfPattern") <<
"cloning hits into new collection.";
290 for (Trajectory::RecHitContainer::const_iterator hitIt = thits.begin();
291 hitIt != thits.end(); hitIt++) {
292 recHits.
push_back( (**hitIt).hit()->clone());
295 LogDebug(
"CkfPattern") <<
"getting initial state.";
297 std::pair<TrajectoryStateOnSurface, const GeomDet*> initState =
301 if (! initState.first.isValid() || initState.second == 0) {
307 if(
useSplitting && (initState.second != thits.front()->det()) && thits.front()->det() ){
308 LogDebug(
"CkfPattern") <<
"propagating to hit front in case of splitting.";
310 if (!propagated.
isValid())
continue;
312 thits.front()->det()->geographicalId().rawId());
316 initState.second->geographicalId().rawId());
318 LogDebug(
"CkfPattern") <<
"pushing a TrackCandidate.";
327 LogTrace(
"CkfPattern|TrackingRegressionTest") <<
"========== CkfTrackCandidateMaker Info =========="
328 <<
"number of Seed: " << collseed->size()<<endl
virtual ~CkfTrackCandidateMakerBase()
T getParameter(std::string const &) const
virtual void deleteAssocDebugger()
static std::string dumpCandidates(collection &candidates)
void setEventSetup(const edm::EventSetup &es)
Call this at each event until this object will come from the EventSetup as it should.
bool theTrackCandidateOutput
virtual void rebuildSeedingRegion(const TrajectorySeed &, TrajectoryContainer &result) const
const TrajectoryBuilder * theTrajectoryBuilder
std::vector< TrackCandidate > TrackCandidateCollection
bool exists(std::string const ¶meterName) const
checks if a parameter exists
virtual void printHitsDebugger(edm::Event &e)
edm::ESHandle< GeometricSearchTracker > theGeomSearchTracker
virtual void done()=0
Tells the cleaner that the seeds are finished, and so it can clear any cache it has.
unsigned int theMaxNSeeds
virtual void add(const Trajectory *traj)=0
Informs the cleaner that a new trajectory has been made, in case the cleaner keeps a local collection...
virtual bool good(const TrajectorySeed *seed)=0
Returns true if the seed is not overlapping with another trajectory.
static std::string regressionTest(const TrackerGeometry &tracker, std::vector< Trajectory > &unsmoothedResult)
const TrajectoryCleaner * theTrajectoryCleaner
const NavigationSchool * theNavigationSchool
std::string theNavigationSchoolName
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual void produceBase(edm::Event &e, const edm::EventSetup &es)
virtual void clean(TrajectoryContainer &) const
unsigned int maxSeedsBeforeCleaning_
virtual void unset() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual TrajectoryContainer trajectories(const TrajectorySeed &) const =0
virtual void beginRunBase(edm::Run &, edm::EventSetup const &es)
std::string theTrajectoryCleanerName
ConstRecHitContainer RecHitContainer
T const * product() const
bool doSeedingRegionRebuilding
TransientInitialStateEstimator * theInitialState
void setEventSetup(const edm::EventSetup &es)
Initialize EventSetup objects at each event.
std::string theTrajectoryBuilderName
virtual void countSeedsDebugger()
virtual void setEvent(const edm::Event &event) const =0
std::pair< TrajectoryStateOnSurface, const GeomDet * > innerState(const Trajectory &traj, bool doBackFit=true) const
virtual void init(const std::vector< Trajectory > *vect)=0
Provides the cleaner a pointer to the vector where trajectories are stored, in case it does not want ...
bool cleanTrajectoryAfterInOut
edm::InputTag theSeedLabel
RedundantSeedCleaner * theSeedCleaner
edm::ESHandle< MagneticField > theMagField