104 using namespace reco;
115 builderName = ps1.
getParameter< std::string > (
"TTRHBuilder");
118 std::cout<<
" Start HI TrackVertexMaker constructor "<<std::endl;
121 std::cout<<
" No initialization "<<std::endl;
124 std::cout<<
" HICTrajectoryBuilder constructed "<<std::endl;
132 HITrackVertexMaker::~HITrackVertexMaker()
146 cout<<
" Number of muon candidates "<<L2mucands->size()<<endl;
147 if( L2mucands->size() < 2 )
cout<<
"L2 muon failed"<<endl;
150 if( L2mucands->size() < 2 )
return dimuon;
153 cout<<
"L2 muon accepted"<<endl;
160 cout<<
" Number of vertices primary "<<vertexcands->size()<<endl;
161 if(vertexcands->size()<1)
cout<<
" Primary vertex failed "<<endl;
164 if(vertexcands->size()<1)
return dimuon;
167 cout<<
" Accepted for L3 propagation "<<endl;
172 for (reco::VertexCollection::const_iterator ipvertex=vertexcands->begin();ipvertex!=vertexcands->end();ipvertex++)
175 if (iv == 0) {theHICConst->
setVertex((*ipvertex).position().z()); theFmpConst->
setVertex((*ipvertex).position().z());}
185 std::string updatorName =
"KFUpdator";
186 std::string propagatorAlongName =
"PropagatorWithMaterial";
187 std::string propagatorOppositeName =
"PropagatorWithMaterialOpposite";
188 double theChiSquareCut = 500.;
211 if(eventCount == 1) {
216 for(
int i=11;
i>-1;
i--) {
220 for(
int i=12;
i>-1;
i--) {
234 propagatorAlongHandle.
product(),
235 propagatorOppositeHandle.
product(),
238 measurementTrackerHandle.
product(),
245 measurementTrackerHandle->update(e1);
248 std::cout<<
" After first tracker update "<<std::endl;
255 theEstimator.
setMult(theLowMult);
258 theTrajectoryBuilder.settracker(measurementTrackerHandle.
product());
281 vector<FreeTrajectoryState> theFts = vFts.
createFTSfromL2((*L2mucands));
284 cout<<
" Size of the freeTS "<<theFts.size()<<endl;
290 map<DetLayer*, DiMuonSeedGeneratorHIC::SeedContainer> seedmap;
291 vector<Trajectory> theTmpTrajectories0;
295 vector<FreeTrajectoryState*> theFoundFts;
296 map<FreeTrajectoryState*, vector<Trajectory> > theMapFtsTraj;
299 for(vector<FreeTrajectoryState>::iterator ifts=theFts.begin(); ifts!=theFts.end(); ifts++)
301 theTmpTrajectories0.clear();
303 cout<<
" cycle on Muon Trajectory State " <<(*ifts).parameters().position().perp()<<
304 " " <<(*ifts).parameters().position().z() <<endl;
322 std::cout<<
" The size of the starting layers "<<seedlayers.size()<<std::endl;
325 if( seedlayers.size() == 0 ) {
327 cout<<
" Starting layers failed for muon candidate "<<endl;
331 map<DetLayer*, DiMuonSeedGeneratorHIC::SeedContainer> seedmap = Seed.
produce(e1 ,es1,
332 (*ftsnew), tsos, (*ifts),
334 measurementTrackerHandle.
product(),
339 for( vector<DetLayer*>::iterator it = seedlayers.begin(); it != seedlayers.end(); it++)
345 std::cout<<
" Layer::Position z "<<(**it).surface().position().z()<<
346 " Number of seeds in layer "<<seeds.size()<<std::endl;
349 if(seeds.size() == 0) {
351 std::cout<<
" No seeds are found: do not continue with this Detlayer "<<std::endl;
359 for(DiMuonSeedGeneratorHIC::SeedContainer::iterator
iseed=seeds.begin();
362 std::vector<TrajectoryMeasurement> theV = (*iseed).measurements();
366 theV[0].recHit()->globalPosition().perp()<<
" phi "<<
367 theV[0].recHit()->globalPosition().phi()<<
" z "<<
368 theV[0].recHit()->globalPosition().z()<<
" momentum "<<
369 theV[0].updatedState().freeTrajectoryState()->parameters().momentum().perp()<<
" "<<
370 theV[0].updatedState().freeTrajectoryState()->parameters().momentum().z()<<std::endl;
373 vector<Trajectory> theTmpTrajectories = theTrajectoryBuilder.trajectories(*
iseed);
376 cout<<
" Number of found trajectories "<<theTmpTrajectories.size()<<endl;
378 if(theTmpTrajectories.size()>0) {
380 theTmpTrajectories0.insert(theTmpTrajectories0.end(),
381 theTmpTrajectories.begin(),
382 theTmpTrajectories.end());
384 std::cout<<
"We found trajectories for at least one seed "<<theTmpTrajectories0.size()<<std::endl;
390 if( theTmpTrajectories0.size() > 0 ) {
392 std::cout<<
"We found trajectories for at least one seed "<<theTmpTrajectories0.size()<<
"break layer cycle "<<std::endl;
398 if( theTmpTrajectories0.size() > 0 ) {
400 std::cout<<
"We found trajectories for at least one seed "<<theTmpTrajectories0.size()
401 <<
"continue"<<std::endl;
403 theFoundFts.push_back(&(*ifts));
404 theMapFtsTraj[&(*ifts)] = theTmpTrajectories0;
409 std::cout<<
"No trajectories for this FTS "<<theTmpTrajectories0.size()<<
410 "try second path"<<std::endl;
417 for( vector<DetLayer*>::iterator it = seedlayers.begin(); it != seedlayers.end(); it++)
422 if(seeds.size() == 0) {
424 std::cout<<
" Second path: No seeds are found: do not continue with this Detlayer "<<std::endl;
430 for(
unsigned int j=13;
j<theNavigationSchoolV.size();
j++){
432 for(DiMuonSeedGeneratorHIC::SeedContainer::iterator
iseed=seeds.begin();
435 std::vector<TrajectoryMeasurement> theV = (*iseed).measurements();
436 vector<Trajectory> theTmpTrajectories = theTrajectoryBuilder.trajectories(*
iseed);
438 if(theTmpTrajectories.size()>0) {
440 theTmpTrajectories0.insert(theTmpTrajectories0.end(),
441 theTmpTrajectories.begin(),
442 theTmpTrajectories.end());
444 std::cout<<
"Second path: We found trajectories for at least one seed in barrel layer "<<
445 theTmpTrajectories0.size()<<std::endl;
451 if( theTmpTrajectories0.size() > 0 ) {
453 std::cout<<
"Second path: no trajectories: we try next barrel layer "<<
454 theTmpTrajectories0.size()<<std::endl;
460 for(
int j=1;
j<13;
j++){
462 for(DiMuonSeedGeneratorHIC::SeedContainer::iterator
iseed=seeds.begin();
465 std::vector<TrajectoryMeasurement> theV = (*iseed).measurements();
466 vector<Trajectory> theTmpTrajectories = theTrajectoryBuilder.trajectories(*
iseed);
468 if(theTmpTrajectories.size()>0) {
470 theTmpTrajectories0.insert(theTmpTrajectories0.end(),
471 theTmpTrajectories.begin(),
472 theTmpTrajectories.end());
474 std::cout<<
"Second path: We found trajectories for at least one seed in barrel layer "<<
475 theTmpTrajectories0.size()<<std::endl;
481 if( theTmpTrajectories0.size() > 0 ) {
484 "Second path: We found trajectories for at least one seed in barrel/endcap layer"<<
485 theTmpTrajectories0.size()<<std::endl;
491 if( theTmpTrajectories0.size() > 0 ) {
494 "Second path: We found trajectories for at least one seed in barrel/endcap layer "
496 theTmpTrajectories0.size()<<std::endl;
498 theFoundFts.push_back(&(*ifts));
499 theMapFtsTraj[&(*ifts)] = theTmpTrajectories0;
510 if(theFoundFts.size()>0 ) {
511 std::cout<<
" Event reconstruction finished with "<<theFoundFts.size()
513 else {
std::cout<<
" Event reconstruction::no tracks found"<<std::endl;}
515 if(theFoundFts.size()<2)
return dimuon;
538 vector<reco::Track> firstTrack;
539 vector<reco::TransientTrack> firstTransTracks;
540 vector<reco::TrackRef> firstTrackRefs;
541 vector<reco::Track> secondTrack;
542 vector<reco::TransientTrack> secondTransTracks;
543 vector<reco::TrackRef> secondTrackRefs;
545 for(vector<FreeTrajectoryState*>::iterator it = theFoundFts.begin(); it!= theFoundFts.end(); it++)
547 vector<Trajectory>
first = (*theMapFtsTraj.find(*it)).
second;
549 for(vector<Trajectory>::iterator im=first.begin();im!=first.end(); im++) {
553 innertsos = im->firstMeasurement().updatedState();
555 innertsos = im->lastMeasurement().updatedState();
576 if(v.
perp() > 0.1 )
continue;
577 if(fabs(v.
z() - theHICConst->
zvert ) > 0.4 )
continue;
582 Track theTrack(im->chiSquared(),
589 firstTrack.push_back( theTrack );
590 firstTransTracks.push_back( tmpTk );
593 if( firstTrack.size() == 0 )
continue;
595 for(vector<FreeTrajectoryState*>::iterator jt = it+1; jt!= theFoundFts.end(); jt++)
597 vector<Trajectory>
second = (*theMapFtsTraj.find(*jt)).second;
600 for(vector<Trajectory>::iterator im=second.begin();im!=second.end(); im++) {
605 innertsos = im->firstMeasurement().updatedState();
607 innertsos = im->lastMeasurement().updatedState();
625 if(v.
perp() > 0.1 )
continue;
626 if(fabs(v.
z() - theHICConst->
zvert ) > 0.4 )
continue;
631 Track theTrack(im->chiSquared(),
638 secondTrack.push_back( theTrack );
639 secondTransTracks.push_back( tmpTk );
641 if( secondTrack.size() == 0 )
continue;
647 if( firstTrack.size() < 1 || secondTrack.size() < 1 ){
649 cout<<
" No enough tracks to get vertex "<<endl;
655 bool useRefTrax=
true;
661 vector<reco::TransientTrack> theTwoTransTracks;
663 vector<TransientVertex> theVertexContainer;
665 for(vector<reco::TransientTrack>::iterator iplus = firstTransTracks.begin();
666 iplus != firstTransTracks.end(); iplus++)
668 for(vector<reco::TransientTrack>::iterator iminus = secondTransTracks.begin();
669 iminus != secondTransTracks.end(); iminus++)
673 bool CAIR_ST =
false;
678 CAIR_ST = theIniAlgo.
calculate( sta, stb );
680 if(CAIR_ST == 0)
continue;
682 theTwoTransTracks.clear();
683 theTwoTransTracks.push_back(*iplus);
684 theTwoTransTracks.push_back(*iminus);
685 theRecoVertex = theFitter.
vertex(theTwoTransTracks);
686 if( !theRecoVertex.
isValid() ) {
704 if ( fabs(theRecoVertex.
position().
z()-theHICConst->
zvert) > 0.06 ) {
711 for (std::vector<reco::TransientTrack>::iterator ivb = tracks.begin(); ivb != tracks.end(); ivb++)
713 quality = quality * (*ivb).chi2() /(*ivb).ndof();
715 if( quality > 70. ) {
719 theVertexContainer.push_back(theRecoVertex);
std::vector< FreeTrajectoryState > createFTSfromL2(const reco::RecoChargedCandidateCollection &rc)
math::Error< dimension >::type CovarianceMatrix
T getParameter(std::string const &) const
FreeTrajectoryState * freeTrajectoryState(bool withErrors=true) const
std::vector< DiMuonTrajectorySeed > SeedContainer
virtual CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &tracks) const
float totalChiSquared() const
Geom::Phi< T > phi() const
GlobalPoint globalPosition() const
math::XYZPoint Point
point in the space
TrackCharge charge() const
const CurvilinearTrajectoryError & curvilinearError() const
std::vector< reco::TransientTrack > originalTracks() const
TrackAlgorithm
track algorithm
void setHICConst(cms::HICConst *hh)
U second(std::pair< T, U > const &p)
float normalisedChiSquared() const
FreeTrajectoryState * freeState(bool withErrors=true) const
LayerContainer startingLayers(FreeTrajectoryState &fts)
GlobalPoint position() const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
GlobalVector momentum() const
FTS const & trackStateAtPCA() const
GlobalPoint position() const
virtual bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
T const * product() const
virtual std::map< DetLayer *, SeedContainer > produce(const edm::Event &e, const edm::EventSetup &c, FreeTrajectoryState &, TrajectoryStateOnSurface &, FreeTrajectoryState &, const TransientTrackingRecHitBuilder *RecHitBuilder, const MeasurementTracker *measurementTracker, std::vector< DetLayer * > *)
virtual void setMult(int aMult=1)
GlobalVector globalMomentum() const