51 std::cout <<
"TrackCandidateProducer created" << std::endl;
54 if(conf.
exists(
"keepFittedTracks")){
55 std::cout <<
"TrackCandidateProducer no longer supports option keepFittedTracks" << std::endl;
58 if(conf.
exists(
"TrackProducers")){
59 edm::LogError(
"TrackCandidateProducer") <<
"TrackCandidateProducer no longer supports TrackProducers" << std::endl;
64 produces<TrackCandidateCollection>();
126 typedef std::pair<reco::TrackRef,edm::Ref<std::vector<Trajectory> > > TrackPair;
142 if(theSeeds->size() == 0) {
152 const std::vector<unsigned> theSimTrackIds = theGSRecHits->ids();
161 LogDebug(
"FastTracking")<<
"looking at: "<< theSimTrackIds.size()<<
" simtracks.";
164 int currentTrackId = -1;
168 std::cout <<
"Number of seeds : " << theSeeds->size() << std::endl;
170 unsigned seed_size = theSeeds->size();
171 for (
unsigned seednr = 0; seednr < seed_size; ++seednr){
173 LogDebug(
"FastTracking")<<
"looking at seed #:"<<seednr;
178 std::vector<int> simTrackIds;
179 std::map<int,TrajectoryStateOnSurface> seedStates;
180 std::map<int,TrajectoryStateOnSurface> simtkStates;
183 if (theSeeds->at(seednr).nHits()==0){
186 LogDebug(
"FastTracking")<<
" seed with no hits to be considered.";
191 const Surface * surface=&g->surface();
198 double minimunEst=1000000;
199 LogDebug(
"FastTracking")<<
"looking at: "<< theSimTrackIds.size()<<
" simtracks.";
200 for (
unsigned tkId=0; tkId != theSimTrackIds.size(); ++tkId ) {
202 const SimTrack & simtrack = (*theSimTracks)[theSimTrackIds[tkId]];
213 LogDebug(
"FastTracking")<<
"not on the same direction.";
228 if (!simtrack_comparestate.
isValid()){
229 LogDebug(
"FastTracking")<<
" ok this is a state-based seed. simtrack state does not propagate to the seed surface. skipping.";
233 LogDebug(
"FastTracking")<<
"not on the same direction.";
239 bool ierr = !
m.Invert();
241 edm::LogWarning(
"FastTracking") <<
" Candidate Producer cannot invert the error matrix! - Skipping...";
244 double est = ROOT::Math::Similarity(
v,
m);
245 LogDebug(
"FastTracking")<<
"comparing two state on the seed surface:\n"
246 <<
"seed: "<<seedState
247 <<
"sim: "<<simtrack_comparestate
248 <<
"\n estimator is: "<<est;
250 if (est<minimunEst) minimunEst=est;
252 simTrackIds.push_back(theSimTrackIds[tkId]);
263 LogDebug(
"FastTracking")<<
"the compatibility estimator is: "<<est<<
" for track id: "<<simTrackIds.back();
266 if (simTrackIds.size()==0)
LogDebug(
"FastTracking")<<
"could not find any simtrack within errors, closest was at: "<<minimunEst;
275 simTrackIds.push_back( theFirstSeedingRecHit->
simtrackId() );
281 for (
unsigned int iToMake=0;iToMake!=simTrackIds.size();++iToMake){
282 int simTrackId = simTrackIds[iToMake];
286 if (
seedCleaning && currentTrackId == simTrackId )
continue;
287 currentTrackId = simTrackId;
290 std::vector<TrajectorySeedHitCandidate> theTrackerRecHits;
291 unsigned theNumberOfCrossedLayers = 0;
293 LogDebug(
"FastTracking")<<
"Track " << simTrackId <<
" is considered to return a track candidate" ;
301 LogDebug(
"FastTracking")<<
"counting: "<<theRecHitRangeIteratorEnd-theRecHitRangeIteratorBegin<<
" hits to be considered.";
303 bool firstRecHit =
true;
307 for ( iterRecHit = theRecHitRangeIteratorBegin;
308 iterRecHit != theRecHitRangeIteratorEnd;
315 if(!firstRecHit) thePreviousRecHit = theCurrentRecHit;
329 ++theNumberOfCrossedLayers;
336 else theTrackerRecHits.push_back(theCurrentRecHit);
349 else theTrackerRecHits.push_back(theCurrentRecHit);
357 theTrackerRecHits.pop_back();
365 theTrackerRecHits.back() = theCurrentRecHit;
371 theCurrentRecHit = thePreviousRecHit;
377 LogDebug(
"FastTracking")<<
" number of hits: " << theTrackerRecHits.size()<<
" after counting overlaps and splitting.";
381 unsigned nTrackerHits = theTrackerRecHits.size();
385 LogDebug(
"FastTracking")<<
"reversing the order of the hits";
386 std::reverse(theTrackerRecHits.begin(),theTrackerRecHits.end());
389 for (
unsigned ih=0; ih<nTrackerHits; ++ih ) {
397 LogDebug(
"FastTracking")<<
"not enough layer crossed ("<<theNumberOfCrossedLayers<<
")";
407 if (aSeed->
nHits()==0){
415 int vertexIndex = (*theSimTracks)[currentTrackId].vertIndex();
418 (*theSimVtx)[vertexIndex].
position().
y(),
419 (*theSimVtx)[vertexIndex].
position().
z());
422 GlobalVector momentum( (*theSimTracks)[currentTrackId].momentum().
x() ,
423 (*theSimTracks)[currentTrackId].momentum().
y() ,
424 (*theSimTracks)[currentTrackId].momentum().
z() );
426 float charge = (*theSimTracks)[simTrackId].charge();
435 std::cout <<
"TrajectorySeedProducer: FTS momentum " << initialFTS.
momentum() << std::endl;
441 if (!initialTSOS.
isValid())
continue;
449 output->push_back(newTrackCandidate);
455 LogDebug(
"FastTracking") <<
"Saving "
456 << output->size() <<
" track candidates" ;
463 std::vector<TrajectorySeedHitCandidate>& theTrackerRecHits) {
PropagationDirection direction() const
const math::XYZVectorD & trackerSurfacePosition() const
T getParameter(std::string const &) const
unsigned int minNumberOfCrossedLayers
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
std::pair< const_iterator, const_iterator > range
iterator range
const int & simhitId() const
const LocalTrajectoryParameters & localParameters() const
edm::EDGetTokenT< edm::View< TrajectorySeed > > seedToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< edm::SimVertexContainer > simVertexToken
edm::EDGetTokenT< edm::SimTrackContainer > simTrackToken
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
TrackCandidateProducer(const edm::ParameterSet &conf)
const CurvilinearTrajectoryError & curvilinearError() const
std::vector< TrackCandidate > TrackCandidateCollection
bool exists(std::string const ¶meterName) const
checks if a parameter exists
GlobalPoint globalPosition() const
const SiTrackerGSRecHit2D * stereoHit() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
float charge() const
charge
const MagneticField * theMagField
const Plane & surface() const
The nominal surface of the GeomDet.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
unsigned int maxNumberOfCrossedLayers
edm::InputTag seedProducer
virtual void produce(edm::Event &e, const edm::EventSetup &es) override
uint32_t rawId() const
get the raw id
virtual ~TrackCandidateProducer()
C::const_iterator const_iterator
constant access iterator type
AlgebraicVector5 vector() const
const int & simtrackId() const
void addSplitHits(const TrajectorySeedHitCandidate &, std::vector< TrajectorySeedHitCandidate > &)
const SurfaceType & surface() const
const SiTrackerGSRecHit2D * monoHit() const
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
PropagatorWithMaterial * thePropagator
edm::EDGetTokenT< SiTrackerGSMatchedRecHit2DCollection > recHitToken
const SiTrackerGSMatchedRecHit2D * matchedHit() const
The Hit itself.
edm::InputTag hitProducer
std::pair< const_iterator, const_iterator > range
unsigned int detId() const
const AlgebraicSymMatrix55 & matrix() const
const LocalTrajectoryError & localError() const
GlobalVector momentum() const
virtual TrackingRecHit * clone() const =0
virtual TrackingRecHit const * hit() const
PTrajectoryStateOnDet const & startingState() const
const bool & isMatched() const
ROOT::Math::SVector< double, 5 > AlgebraicVector5
const GlobalTrajectoryParameters & globalParameters() const
const math::XYZTLorentzVectorD & trackerSurfaceMomentum() const
virtual void beginRun(edm::Run const &run, const edm::EventSetup &es) override
T const * product() const
ESHandle< TrackerGeometry > geometry
unsigned int nHits() const
const AlgebraicSymMatrix55 & matrix() const
GlobalVector globalMomentum() const
static int position[264][3]
double localError() const
const TrackerGeometry * theGeometry
unsigned int layerNumber() const
The Layer Number.
DetId geographicalId() const
bool isOnTheSameLayer(const TrajectorySeedHitCandidate &other) const
Check if two hits are on the same layer of the same subdetector.
unsigned int subDetId() const
The subdet Id.
const BasicVectorType & basicVector() const
std::vector< SimTrack > SimTrackContainer
virtual const TrackerGeomDet * idToDet(DetId) const
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.