CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HITrackVertexMaker.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: TestMuL1L2
4 // Class: TestMuL1L2
5 //
6 // \class TestMuL1L2 TestMuL1L2.cc TestMuonL1L2/TestMuL1L2/src/TestMuL1L2.cc
7 //
8 // Original Author: Dong Ho Moon
9 // Created: Wed May 9 06:22:36 CEST 2007
10 // $Id: HITrackVertexMaker.cc,v 1.7 2011/01/10 00:19:47 dlange Exp $
11 //
12 // added CAIR error cut
13 
15 
16 // C++ Headers
17 
18 #include <memory>
19 #include<iostream>
20 #include<iomanip>
21 #include<vector>
22 #include<cmath>
23 
24 // ES include files
28 
29 // Muon trigger includes
36 
37 // Tracking includes
57 //#include "TrackingTools/PatternTools/interface/TrajectoryStateClosestToBeamLineBuilder.h"
66 
67 // Geometry includes
68 
78 
79 // RecoHIMuon includes
80 
91 
92 // Global points
93 
96 
97 // Vertex reco modification
100 
101 
102 //Constructor
103 
104 using namespace reco;
105 using namespace std;
106 
107 //#define DEBUG
108 
109 namespace cms{
110 HITrackVertexMaker::HITrackVertexMaker(const edm::ParameterSet& ps1, const edm::EventSetup& es1)
111 {
112 
113  L2candTag_ = ps1.getParameter< edm::InputTag > ("L2CandTag");
114  rphirecHitsTag = ps1.getParameter< edm::InputTag > ("rphiRecHits");
115  builderName = ps1.getParameter< std::string > ("TTRHBuilder");
116  primaryVertexTag = ps1.getParameter< edm::InputTag > ("PrimaryVertexTag");
117 #ifdef DEBUG
118  std::cout<<" Start HI TrackVertexMaker constructor "<<std::endl;
119 #endif
120  pset_ = ps1;
121  std::cout<<" No initialization "<<std::endl;
122  eventCount = 0;
123 #ifdef DEBUG
124  std::cout<<" HICTrajectoryBuilder constructed "<<std::endl;
125 #endif
126 }
127 
128 
129 
130 //Destructor
131 
132 HITrackVertexMaker::~HITrackVertexMaker()
133 {
134 // std::cout<<" HITrackVertexMaker::destructor "<<std::endl;
135 }
136 
137 bool HITrackVertexMaker::produceTracks(const edm::Event& e1, const edm::EventSetup& es1, HICConst* theHICConst, FmpConst* theFmpConst)
138 {
139  bool dimuon = false;
140 
142 // edm::Handle<TrackCollection> L2mucands;
143  e1.getByLabel (L2candTag_,L2mucands);
144 
145 #ifdef DEBUG
146  cout<<" Number of muon candidates "<<L2mucands->size()<<endl;
147  if( L2mucands->size() < 2 ) cout<<"L2 muon failed"<<endl;
148 #endif
149 
150  if( L2mucands->size() < 2 ) return dimuon;
151 
152 #ifdef DEBUG
153  cout<<"L2 muon accepted"<<endl;
154 #endif
155 // std::cout<<" Just do nothing for L3 but initiate ESHandles "<<std::endl;
157  e1.getByLabel (primaryVertexTag,vertexcands);
158 
159 #ifdef DEBUG
160  cout<<" Number of vertices primary "<<vertexcands->size()<<endl;
161  if(vertexcands->size()<1) cout<<" Primary vertex failed "<<endl;
162 #endif
163 
164  if(vertexcands->size()<1) return dimuon;
165 
166 #ifdef DEBUG_COUNT
167  cout<<" Accepted for L3 propagation "<<endl;
168 #endif
169 
170 
171  int iv = 0;
172  for (reco::VertexCollection::const_iterator ipvertex=vertexcands->begin();ipvertex!=vertexcands->end();ipvertex++)
173  {
174 // cout<<" Vertex position from pixels "<<(*ipvertex).position().z()<<endl;
175  if (iv == 0) {theHICConst->setVertex((*ipvertex).position().z()); theFmpConst->setVertex((*ipvertex).position().z());}
176  iv++;
177  }
178 
179 // cout << " Vertex is set to (found by pixel finder)"<<theHICConst->zvert<<endl;
180 
181  eventCount++;
182 // ============================ Event accepted for L3
183 // Initialization from Records
184 //
185  std::string updatorName = "KFUpdator";
186  std::string propagatorAlongName = "PropagatorWithMaterial";
187  std::string propagatorOppositeName = "PropagatorWithMaterialOpposite";
188  double theChiSquareCut = 500.;
189  double nsig = 3.;
190  double ptmin=1.;
191 
192 
195  edm::ESHandle<MeasurementTracker> measurementTrackerHandle;
197  edm::ESHandle<Propagator> propagatorAlongHandle;
198  edm::ESHandle<Propagator> propagatorOppositeHandle;
200 
201  es1.get<TrackerRecoGeometryRecord>().get( tracker );
202  es1.get<IdealMagneticFieldRecord>().get(magfield);
203  es1.get<CkfComponentsRecord>().get("",measurementTrackerHandle);
204  es1.get<TransientRecHitRecord>().get(builderName,recHitBuilderHandle);
205  es1.get<TrackingComponentsRecord>().get(propagatorAlongName,propagatorAlongHandle);
206  es1.get<TrackingComponentsRecord>().get(propagatorOppositeName,propagatorOppositeHandle);
207  es1.get<TrackingComponentsRecord>().get(updatorName,updatorHandle);
208 
209 // Initialization of navigation school
210 
211  if(eventCount == 1) {
212 
213  int lost=-1;
214  int lostf=-1;
215  theNavigationSchoolV.push_back(new HICSimpleNavigationSchool(&(*tracker), &(*magfield), lost, lostf));
216  for(int i=11;i>-1;i--) {
217  theNavigationSchoolV.push_back(new HICSimpleNavigationSchool(&(*tracker), &(*magfield), i, lostf));
218  }
219  lost=-1;
220  for(int i=12;i>-1;i--) {
221  theNavigationSchoolV.push_back(new HICSimpleNavigationSchool(&(*tracker), &(*magfield), lost, i));
222  }
223 
224  } // initialization at the first event
225 
226 
227 
228  MinPtTrajectoryFilter theMinPtFilter(ptmin);
229  HICMeasurementEstimator theEstimator(&(*tracker), &(*magfield), theChiSquareCut, nsig);
230 
231 
232  HICTrajectoryBuilder theTrajectoryBuilder( pset_, es1,
233  updatorHandle.product(),
234  propagatorAlongHandle.product(),
235  propagatorOppositeHandle.product(),
236  &theEstimator,
237  recHitBuilderHandle.product(),
238  measurementTrackerHandle.product(),
239  &theMinPtFilter);
240 
241 
242 
243 
244 
245  measurementTrackerHandle->update(e1);
246 
247 #ifdef DEBUG
248  std::cout<<" After first tracker update "<<std::endl;
249 #endif
250 
251 
252 // For trajectory builder
253  int theLowMult = 1;
254  theEstimator.setHICConst(theHICConst);
255  theEstimator.setMult(theLowMult);
256 
257 
258  theTrajectoryBuilder.settracker(measurementTrackerHandle.product());
259 
260 //============================
261 // FastMuPropagator* theFmp = new FastMuPropagator(&(*magfield),theFmpConst);
262 // StateOnTrackerBound state(theFmp);
263 
264  FastMuPropagator theFmp(&(*magfield),theFmpConst);
265  StateOnTrackerBound state(&theFmp);
266 
268 
269 
270  HICFTSfromL1orL2 vFts(&(*magfield));
271 
272 
273  int NumOfSigma=4;
274  HICTkOuterStartingLayerFinder TkOSLF(NumOfSigma, &(*magfield), &(*tracker), theHICConst);
275 
276  int mult = 1;
277  DiMuonSeedGeneratorHIC Seed(rphirecHitsTag,&(*magfield),&(*tracker), theHICConst, builderName, mult);
278 
279 // vector<FreeTrajectoryState> theFts = vFts.createFTSfromStandAlone((*mucands));
280 
281  vector<FreeTrajectoryState> theFts = vFts.createFTSfromL2((*L2mucands));
282 
283 #ifdef DEBUG
284  cout<<" Size of the freeTS "<<theFts.size()<<endl;
285 #endif
286 
287 
288 
290  map<DetLayer*, DiMuonSeedGeneratorHIC::SeedContainer> seedmap;
291  vector<Trajectory> theTmpTrajectories0;
292 
293 // map< FreeTrajectoryState*, Trajectory>
294 
295  vector<FreeTrajectoryState*> theFoundFts;
296  map<FreeTrajectoryState*, vector<Trajectory> > theMapFtsTraj;
297 
298 
299  for(vector<FreeTrajectoryState>::iterator ifts=theFts.begin(); ifts!=theFts.end(); ifts++)
300  {
301  theTmpTrajectories0.clear();
302 #ifdef DEBUG
303  cout<<" cycle on Muon Trajectory State " <<(*ifts).parameters().position().perp()<<
304  " " <<(*ifts).parameters().position().z() <<endl;
305 #endif
306 
307  tsos=state((*ifts));
308  if(tsos.isValid())
309  {
310 
311 // vector<Trajectory> theTmpTrajectories0;
312 #ifdef DEBUG
313  cout<<" Position "<<tsos.globalPosition().perp()<<" "<<tsos.globalPosition().phi()<<
314  " "<<tsos.globalPosition().z()<<" "<<tsos.globalMomentum().perp()<<endl;
315 #endif
316 
317 // Start to find starting layers
319  vector<DetLayer*> seedlayers = TkOSLF.startingLayers((*ftsnew));
320 
321 #ifdef DEBUG
322  std::cout<<" The size of the starting layers "<<seedlayers.size()<<std::endl;
323 #endif
324 
325  if( seedlayers.size() == 0 ) {
326 #ifdef DEBUG
327  cout<<" Starting layers failed for muon candidate "<<endl;
328 #endif
329  continue;
330  }
331  map<DetLayer*, DiMuonSeedGeneratorHIC::SeedContainer> seedmap = Seed.produce(e1 ,es1,
332  (*ftsnew), tsos, (*ifts),
333  recHitBuilderHandle.product(),
334  measurementTrackerHandle.product(),
335  &seedlayers);
336 
337 
338 
339  for( vector<DetLayer*>::iterator it = seedlayers.begin(); it != seedlayers.end(); it++)
340  {
341 
342  DiMuonSeedGeneratorHIC::SeedContainer seeds = (*seedmap.find(*it)).second;
343 
344 #ifdef DEBUG
345  std::cout<<" Layer::Position z "<<(**it).surface().position().z()<<
346  " Number of seeds in layer "<<seeds.size()<<std::endl;
347 #endif
348 
349  if(seeds.size() == 0) {
350 #ifdef DEBUG
351  std::cout<<" No seeds are found: do not continue with this Detlayer "<<std::endl;
352 #endif
353  continue;
354  }
355  // set the first navigation (all layers without gap)
356 
357  NavigationSetter setter( *(theNavigationSchoolV[0]));
358 
359  for(DiMuonSeedGeneratorHIC::SeedContainer::iterator iseed=seeds.begin();
360  iseed!=seeds.end();iseed++)
361  {
362  std::vector<TrajectoryMeasurement> theV = (*iseed).measurements();
363 
364 #ifdef DEBUG
365  std::cout<< "RecHIT Layer position r "<<
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;
371 #endif
372 
373  vector<Trajectory> theTmpTrajectories = theTrajectoryBuilder.trajectories(*iseed);
374 
375 #ifdef DEBUG
376  cout<<" Number of found trajectories "<<theTmpTrajectories.size()<<endl;
377 #endif
378  if(theTmpTrajectories.size()>0) {
379 
380  theTmpTrajectories0.insert(theTmpTrajectories0.end(),
381  theTmpTrajectories.begin(),
382  theTmpTrajectories.end());
383 #ifdef DEBUG
384  std::cout<<"We found trajectories for at least one seed "<<theTmpTrajectories0.size()<<std::endl;
385 #endif
386  break;
387  } // There are trajectories
388  } // seeds
389 
390  if( theTmpTrajectories0.size() > 0 ) {
391 #ifdef DEBUG
392  std::cout<<"We found trajectories for at least one seed "<<theTmpTrajectories0.size()<<"break layer cycle "<<std::endl;
393 #endif
394  break;
395  }
396  } // seedlayer
397 
398  if( theTmpTrajectories0.size() > 0 ) {
399 #ifdef DEBUG
400  std::cout<<"We found trajectories for at least one seed "<<theTmpTrajectories0.size()
401  <<"continue"<<std::endl;
402 #endif
403  theFoundFts.push_back(&(*ifts));
404  theMapFtsTraj[&(*ifts)] = theTmpTrajectories0;
405  continue;
406  }
407 
408 #ifdef DEBUG
409  std::cout<<"No trajectories for this FTS "<<theTmpTrajectories0.size()<<
410  "try second path"<<std::endl;
411 #endif
412 
413 
414 // No trajectories found for this Muon FTS although seeds exist.
415 // Try to allow another trajectory map with lost 1 layer (only for barrel layers)
416 
417  for( vector<DetLayer*>::iterator it = seedlayers.begin(); it != seedlayers.end(); it++)
418  {
419 
420  DiMuonSeedGeneratorHIC::SeedContainer seeds = (*seedmap.find(*it)).second;
421 
422  if(seeds.size() == 0) {
423 #ifdef DEBUG
424  std::cout<<" Second path: No seeds are found: do not continue with this Detlayer "<<std::endl;
425 #endif
426  continue;
427  }
428 
429  if((**it).location() == GeomDetEnumerators::endcap) {
430  for(unsigned int j=13; j<theNavigationSchoolV.size();j++){
431  NavigationSetter setter( *(theNavigationSchoolV[j]));
432  for(DiMuonSeedGeneratorHIC::SeedContainer::iterator iseed=seeds.begin();
433  iseed!=seeds.end();iseed++)
434  {
435  std::vector<TrajectoryMeasurement> theV = (*iseed).measurements();
436  vector<Trajectory> theTmpTrajectories = theTrajectoryBuilder.trajectories(*iseed);
437 
438  if(theTmpTrajectories.size()>0) {
439 
440  theTmpTrajectories0.insert(theTmpTrajectories0.end(),
441  theTmpTrajectories.begin(),
442  theTmpTrajectories.end());
443 #ifdef DEBUG
444  std::cout<<"Second path: We found trajectories for at least one seed in barrel layer "<<
445  theTmpTrajectories0.size()<<std::endl;
446 #endif
447  break;
448  } // There are trajectories
449  } // seeds
450 
451  if( theTmpTrajectories0.size() > 0 ) {
452 #ifdef DEBUG
453  std::cout<<"Second path: no trajectories: we try next barrel layer "<<
454  theTmpTrajectories0.size()<<std::endl;
455 #endif
456  break;
457  }
458  } // navigation maps
459  } else {
460  for(int j=1; j<13;j++){
461  NavigationSetter setter(*(theNavigationSchoolV[j]));
462  for(DiMuonSeedGeneratorHIC::SeedContainer::iterator iseed=seeds.begin();
463  iseed!=seeds.end();iseed++)
464  {
465  std::vector<TrajectoryMeasurement> theV = (*iseed).measurements();
466  vector<Trajectory> theTmpTrajectories = theTrajectoryBuilder.trajectories(*iseed);
467 
468  if(theTmpTrajectories.size()>0) {
469 
470  theTmpTrajectories0.insert(theTmpTrajectories0.end(),
471  theTmpTrajectories.begin(),
472  theTmpTrajectories.end());
473 #ifdef DEBUG
474  std::cout<<"Second path: We found trajectories for at least one seed in barrel layer "<<
475  theTmpTrajectories0.size()<<std::endl;
476 #endif
477  break;
478  } // There are trajectories
479  } // seeds
480 
481  if( theTmpTrajectories0.size() > 0 ) {
482 #ifdef DEBUG
483  std::cout<<
484  "Second path: We found trajectories for at least one seed in barrel/endcap layer"<<
485  theTmpTrajectories0.size()<<std::endl;
486 #endif
487  break;
488  }
489  } // navigation maps
490  } // barrel or endcap seed
491  if( theTmpTrajectories0.size() > 0 ) {
492 #ifdef DEBUG
493  std::cout<<
494  "Second path: We found trajectories for at least one seed in barrel/endcap layer "
495  <<
496  theTmpTrajectories0.size()<<std::endl;
497 #endif
498  theFoundFts.push_back(&(*ifts));
499  theMapFtsTraj[&(*ifts)] = theTmpTrajectories0;
500  break;
501  }
502  } // seedlayer
503  } // tsos. isvalid
504  } // Muon Free trajectory state
505 
506 //
507 // start fitting procedure
508 //
509 #ifdef DEBUG
510  if(theFoundFts.size()>0 ) {
511  std::cout<<" Event reconstruction finished with "<<theFoundFts.size()
512  <<std::endl;}
513  else {std::cout<<" Event reconstruction::no tracks found"<<std::endl;}
514 #endif
515  if(theFoundFts.size()<2) return dimuon;
516 
517 // Look for vertex constraints
518 
519  edm::ESHandle<GlobalTrackingGeometry> globTkGeomHandle;
520  es1.get<GlobalTrackingGeometryRecord>().get(globTkGeomHandle);
521 
523  matrix(2,2) = 0.001;
524  matrix(3,3) = 0.001;
525 
526  reco::BeamSpot bs( reco::BeamSpot::Point(0., 0., theHICConst->zvert),
527  0.1,
528  0.,
529  0.,
530  0.,
531  matrix
532  );
533 
534 
536 
537 // For trajectory refitting
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;
544 
545  for(vector<FreeTrajectoryState*>::iterator it = theFoundFts.begin(); it!= theFoundFts.end(); it++)
546  {
547  vector<Trajectory> first = (*theMapFtsTraj.find(*it)).second;
548 
549  for(vector<Trajectory>::iterator im=first.begin();im!=first.end(); im++) {
550 
551  TrajectoryStateOnSurface innertsos;
552  if (im->direction() == alongMomentum) {
553  innertsos = im->firstMeasurement().updatedState();
554  } else {
555  innertsos = im->lastMeasurement().updatedState();
556  }
557 
558 
559  // CMSSW31X
560  TSCBLBuilderNoMaterial tscblBuilder;
561  // CMSSW22X
562  //TrajectoryStateClosestToBeamLineBuilder tscblBuilder;
563  TrajectoryStateClosestToBeamLine tscbl = tscblBuilder(*(innertsos.freeState()),bs);
564 
565  if (tscbl.isValid()==false) {
566  //cout<<" false track "<<endl;
567  continue;
568  }
569 
571  math::XYZPoint pos( v.x(), v.y(), v.z() );
572 
573 // cout<<" Position of track close to vertex "<<v.perp()<<" "<<v.z()<<" Primary vertex "<<theHICConst->zvert<<
574 // " charge "<<tscbl.trackStateAtPCA().charge()<<endl;
575 
576  if(v.perp() > 0.1 ) continue;
577  if(fabs(v.z() - theHICConst->zvert ) > 0.4 ) continue;
578 
580  math::XYZVector mom( p.x(), p.y(), p.z() );
581 
582  Track theTrack(im->chiSquared(),
583  im->ndof(),
584  pos, mom, tscbl.trackStateAtPCA().charge(),
585  tscbl.trackStateAtPCA().curvilinearError(),Algo);
586  TransientTrack tmpTk( theTrack, &(*magfield), globTkGeomHandle );
587 
588 
589  firstTrack.push_back( theTrack );
590  firstTransTracks.push_back( tmpTk );
591  }
592 
593  if( firstTrack.size() == 0 ) continue;
594 
595  for(vector<FreeTrajectoryState*>::iterator jt = it+1; jt!= theFoundFts.end(); jt++)
596  {
597  vector<Trajectory> second = (*theMapFtsTraj.find(*jt)).second;
598  // cout<<" Number of trajectories first "<<first.size()<<" second "<<second.size()<<endl;
599 
600  for(vector<Trajectory>::iterator im=second.begin();im!=second.end(); im++) {
601 
602  TrajectoryStateOnSurface innertsos;
603 
604  if (im->direction() == alongMomentum) {
605  innertsos = im->firstMeasurement().updatedState();
606  } else {
607  innertsos = im->lastMeasurement().updatedState();
608  }
609 
610  TSCBLBuilderNoMaterial tscblBuilder;
611  //TrajectoryStateClosestToBeamLineBuilder tscblBuilder;
612  TrajectoryStateClosestToBeamLine tscbl = tscblBuilder(*(innertsos.freeState()),bs);
613 
614  if (tscbl.isValid()==false) {
615  //cout<<" false track "<<endl;
616  continue;
617  }
618 
620  math::XYZPoint pos( v.x(), v.y(), v.z() );
621 
622 // cout<<" Position of track close to vertex "<<v.perp()<<" "<<v.z()<<" Primary vertex "<<theHICConst->zvert<<
623 // " charge "<<tscbl.trackStateAtPCA().charge()<<endl;
624 
625  if(v.perp() > 0.1 ) continue;
626  if(fabs(v.z() - theHICConst->zvert ) > 0.4 ) continue;
627 
629  math::XYZVector mom( p.x(), p.y(), p.z() );
630 
631  Track theTrack(im->chiSquared(),
632  im->ndof(),
633  pos, mom, tscbl.trackStateAtPCA().charge(),
634  tscbl.trackStateAtPCA().curvilinearError(),Algo);
635  TransientTrack tmpTk( theTrack, &(*magfield), globTkGeomHandle );
636 
637 
638  secondTrack.push_back( theTrack );
639  secondTransTracks.push_back( tmpTk );
640  }
641  if( secondTrack.size() == 0 ) continue;
642 
643  } // FTS
644  } // FTS
645 
646 
647  if( firstTrack.size() < 1 || secondTrack.size() < 1 ){
648 #ifdef DEBUG
649  cout<<" No enough tracks to get vertex "<<endl;
650 #endif
651  return dimuon;
652  }
653 
654 
655  bool useRefTrax=true;
656  KalmanVertexFitter theFitter(useRefTrax);
657  TransientVertex theRecoVertex;
658 //
659 // Create possible two particles vertices
660 //
661  vector<reco::TransientTrack> theTwoTransTracks;
662 
663  vector<TransientVertex> theVertexContainer;
664 
665  for(vector<reco::TransientTrack>::iterator iplus = firstTransTracks.begin();
666  iplus != firstTransTracks.end(); iplus++)
667  {
668  for(vector<reco::TransientTrack>::iterator iminus = secondTransTracks.begin();
669  iminus != secondTransTracks.end(); iminus++)
670  {
671  // To chech CAIR error before the vertex fitting
673  bool CAIR_ST = false;
674  GlobalTrajectoryParameters sta = (*iminus).impactPointState().globalParameters();
675  GlobalTrajectoryParameters stb = (*iplus).impactPointState().globalParameters();
676  ClosestApproachInRPhi theIniAlgo;
677 
678  CAIR_ST = theIniAlgo.calculate( sta, stb );
679  //cout<<"%%%%% CAIR_ST : "<<CAIR_ST<<" %%%%%"<<endl;
680  if(CAIR_ST == 0) continue;
681 
682  theTwoTransTracks.clear();
683  theTwoTransTracks.push_back(*iplus);
684  theTwoTransTracks.push_back(*iminus);
685  theRecoVertex = theFitter.vertex(theTwoTransTracks);
686  if( !theRecoVertex.isValid() ) {
687  continue;
688  }
689 
690  // cout<<" Vertex is found "<<endl;
691  // cout<<" Chi2 = "<<theRecoVertex.totalChiSquared()<<
692  // " r= "<<theRecoVertex.position().perp()<<
693  // " z= "<<theRecoVertex.position().z()<<endl;
694 
695 // Additional cuts
696  if ( theRecoVertex.totalChiSquared() > 0.0002 ) {
697  // cout<<" Vertex is failed with Chi2 : "<<theRecoVertex.totalChiSquared()<<endl;
698  continue;
699  }
700  if ( theRecoVertex.position().perp() > 0.08 ) {
701  // cout<<" Vertex is failed with r position : "<<theRecoVertex.position().perp()<<endl;
702  continue;
703  }
704  if ( fabs(theRecoVertex.position().z()-theHICConst->zvert) > 0.06 ) {
705  // cout<<" Vertex is failed with z position : "<<theRecoVertex.position().z()<<endl;
706  continue;
707  }
708  double quality = theRecoVertex.normalisedChiSquared();
709  std::vector<reco::TransientTrack> tracks = theRecoVertex.originalTracks();
710 
711  for (std::vector<reco::TransientTrack>::iterator ivb = tracks.begin(); ivb != tracks.end(); ivb++)
712  {
713  quality = quality * (*ivb).chi2() /(*ivb).ndof();
714  }
715  if( quality > 70. ) {
716  // cout<<" Vertex failed quality cut "<<quality<<endl;
717  continue;
718  }
719  theVertexContainer.push_back(theRecoVertex);
720 
721  dimuon = true;
722  break;
723  } // iminus
724  if(dimuon) break;
725  } // iplus
726  return dimuon;
727 
728 }
729 }
730 
731 
std::vector< FreeTrajectoryState > createFTSfromL2(const reco::RecoChargedCandidateCollection &rc)
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:32
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
T perp() const
Definition: PV3DBase.h:71
float zvert
Definition: HICConst.h:25
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
Definition: PV3DBase.h:68
tuple magfield
Definition: HLT_ES_cff.py:2311
T y() const
Definition: PV3DBase.h:62
GlobalPoint globalPosition() const
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:30
TrackCharge charge() const
const CurvilinearTrajectoryError & curvilinearError() const
std::vector< reco::TransientTrack > originalTracks() const
TrackAlgorithm
track algorithm
Definition: TrackBase.h:82
void setHICConst(cms::HICConst *hh)
U second(std::pair< T, U > const &p)
float normalisedChiSquared() const
void setVertex(double a)
Definition: FmpConst.cc:4
FreeTrajectoryState * freeState(bool withErrors=true) const
LayerContainer startingLayers(FreeTrajectoryState &fts)
GlobalPoint position() const
T z() const
Definition: PV3DBase.h:63
int j
Definition: DBlmapReader.cc:9
bool first
Definition: L1TdeRCT.cc:94
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
GlobalVector momentum() const
void setVertex(double a)
Definition: HICConst.cc:4
GlobalPoint position() const
int iseed
Definition: AMPTWrapper.h:124
virtual bool calculate(const TrajectoryStateOnSurface &sta, const TrajectoryStateOnSurface &stb)
tuple tracks
Definition: testEve_cfg.py:39
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
char state
Definition: procUtils.cc:75
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 * > *)
double ptmin
Definition: HydjetWrapper.h:86
virtual void setMult(int aMult=1)
GlobalVector globalMomentum() const
tuple cout
Definition: gather_cfg.py:121
T x() const
Definition: PV3DBase.h:61
bool isValid() const
mathSSE::Vec4< T > v
Definition: fakeMenu.h:4