16 DiMuonSeedGeneratorHIC::DiMuonSeedGeneratorHIC(
edm::InputTag rphirecHitsTag0,
26 theTracker = theTracker0;
30 rphirecHitsTag = rphirecHitsTag0;
38 map<DetLayer*,DiMuonSeedGeneratorHIC::SeedContainer> DiMuonSeedGeneratorHIC::produce(
const edm::Event& e,
const edm::EventSetup& iSetup,
44 vector<DetLayer*>* theDetLayer ) {
47 theMeasurementTracker = measurementTracker;
52 std::map<DetLayer*,DiMuonSeedGeneratorHIC::SeedContainer> seedMap;
55 bl = theTracker->barrelLayers();
56 fpos = theTracker->posForwardLayers();
57 fneg = theTracker->negForwardLayers();
62 TTRHbuilder = theBuilderHandle.
product();
75 double phipred=0.;
double zpred=0.;
double phiupd=0.;
double zupd=0.;
77 for( vector<DetLayer* >::const_iterator ml=theDetLayer->begin(); ml != theDetLayer->end(); ml++)
89 phipred = (double)theHICConst->phicut[12];
90 phiupd = (
double)theHICConst->phiro[12];
91 zpred = (double)theHICConst->zcut[12];
92 zupd = (
double)theHICConst->tetro[12];
101 phipred = (double)theHICConst->phicutf[13];
102 phiupd = (
double)theHICConst->phirof[13];
103 zpred = (double)theHICConst->tetcutf[13];
104 zupd = (
double)theHICConst->tetrof[13];
111 theEstimator.
set(phipred, zpred);
113 std::cout<<
" DiMuonSeedGenerator::estimator::set cuts "<<std::endl;
115 std::vector<TrajectoryMeasurement> vTM = theLayerMeasurements->measurements((**ml),newtsos, *thePropagator, theEstimator);
117 std::cout<<
" DiMuonSeedGenerator::Size of compatible TM found by measurements "<<vTM.size()<<std::endl;
122 for(std::vector<TrajectoryMeasurement>::iterator it=vTM.begin(); it!=vTM.end(); it++)
127 if(!(rh->isValid())) {
128 cout<<
" DiMuonSeedGenerator::rechit not valid "<<endl;
131 cout<<
" DiMuonSeedGenerator::Compatible TM: "<<realhit.
perp()<<
" "
132 <<realhit.
phi()<<
" "<<realhit.
z()<<endl;
136 pair<TrajectoryMeasurement,bool> newtmr;
141 cout<<
" DiMuonSeedGenerator::Barrel seed "<<endl;
143 newtmr = barrelUpdateSeed(theFtsMuon,(*it));
149 cout<<
" DiMuonSeedGenerator::Endcap seed "<<endl;
151 newtmr = forwardUpdateSeed(theFtsMuon,(*it));
154 cout<<
" DiMuonSeedGenerator::Estimate seed "<<newtmr.first.estimate()<<
" True or false "<<newtmr.second<<endl;
156 if(newtmr.second) seedContainer.push_back(
DiMuonTrajectorySeed(newtmr.first,theFtsMuon,theLowMult));
158 seedMap[*ml] = seedContainer;
160 delete theLayerMeasurements;
165 pair<TrajectoryMeasurement,bool> DiMuonSeedGeneratorHIC::barrelUpdateSeed (
173 std::cout<<
" DiMuonSeedGeneratorHIC::barrelUpdateSeed::BarrelSeed "<<std::endl;
182 std::cout<<
" DiMuonSeedGeneratorHIC::barrelUpdateSeed::hit is not valid "<<std::endl;
184 return pair<TrajectoryMeasurement,bool>(tm,good);
187 std::cout<<
" DiMuonSeedGeneratorHIC::barrelUpdateSeed::hit is valid "<<std::endl;
204 double dptup = 0.35*pt;
205 double dptdown = 0.7*pt;
206 double ptshift = 0.22*pt;
212 int imax0 = (int)((pt+ptshift+dptup-theHICConst->ptboun)/theHICConst->step) + 1;
213 int imin0 = (int)((pt+ptshift-dptdown-theHICConst->ptboun)/theHICConst->step) + 1;
214 if( imin0 < 1 ) imin0 = 1;
216 std::cout<<
" DiMuonSeedGeneratorHIC::barrelUpdateSeed::imin0,imax0 "<<imin0<<
" "<<imax0<<
" pt,dpt "<<pt+ptshift<<
" "<<dptup<<
" "<<dptdown<<std::endl;
219 double dens,df,ptmax,
ptmin;
222 df = fabs(realhit.
phi() -
phi);
224 double pi=4.*atan(1.);
225 double twopi=8.*atan(1.);
227 if(df > pi) df = twopi-df;
242 ptmax = (dens-(double)(theHICConst->phias[26]))/(
double)(theHICConst->phibs[26]) + theHICConst->ptbmax;
243 ptmin = (dens-(
double)(theHICConst->phiai[26]))/(double)(theHICConst->phibi[26]) + theHICConst->ptbmax;
245 std::cout<<
" Phias,phibs,phiai,phibi "<<theHICConst->phias[26]<<
" "<<theHICConst->phibs[26]<<
" "<<
246 theHICConst->phiai[26]<<
" "<<theHICConst->phibi[26]<<
" "<<theHICConst->ptbmax<<std::endl;
247 std::cout<<
" ptmin= "<<ptmin<<
" ptmax "<<ptmax<<std::endl;
248 std::cout<<
" ptboun "<<theHICConst->ptboun<<
" "<<theHICConst->step<<std::endl;
250 imax = (int)((ptmax-theHICConst->ptboun)/theHICConst->step)+1;
251 imin = (int)((ptmin-theHICConst->ptboun)/theHICConst->step)+1;
254 std::cout<<
" imin>imax "<<imin<<
" "<<imax<<std::endl;
256 return pair<TrajectoryMeasurement,bool>(tm,good);}
261 return pair<TrajectoryMeasurement,bool>(tm,good);}
263 imin1 =
max(imin,imin0);
264 imax1 =
min(imax,imax0);
267 std::cout<<
" imin,imax "<<imin<<
" "<<imax<<std::endl;
268 std::cout<<
" imin,imax "<<imin0<<
" "<<imax0<<std::endl;
269 std::cout<<
" imin1>imax1 "<<imin1<<
" "<<imax1<<std::endl;
271 return pair<TrajectoryMeasurement,bool>(tm,good);
277 double ptnew = theHICConst->ptboun + theHICConst->step * (imax1 + imin1)/2. - theHICConst->step/2.;
283 double dfmax = 1./((
double)(theHICConst->phias[26])+(
double)(theHICConst->phibs[26])*(ptnew-theHICConst->ptbmax));
284 double dfmin = 1./((double)(theHICConst->phiai[26])+(double)(theHICConst->phibi[26])*(ptnew-theHICConst->ptbmax));
285 double dfcalc = fabs(dfmax+dfmin)/2.;
286 double phinew = phi+aCharge*dfcalc;
292 double rad = 100.*ptnew/(0.3*4.);
293 double alf = 2.*asin(realhit.
perp()/rad);
294 double alfnew = phinew - aCharge*alf;
300 double delx = realhit.
z()-theHICConst->zvert;
301 double delr =
sqrt( realhit.
y()*realhit.
y()+realhit.
x()*realhit.
x() );
302 double theta = atan2(delr,delx);
314 m(0,0) = 0.5*ptnew;
m(1,1) = theHICConst->phiro[12];
315 m(2,2) = theHICConst->tetro[12];
316 m(3,3) = theHICConst->phiro[12];
317 m(4,4) = theHICConst->tetro[12];
326 pair<TrajectoryMeasurement,bool> newtmr(newtm,good);
331 pair<TrajectoryMeasurement,bool> DiMuonSeedGeneratorHIC::forwardUpdateSeed (
338 std::cout<<
" DiMuonSeedGeneratorHIC::forwardUpdateSeed::EndcapSeed::start "<<std::endl;
347 std::cout<<
" DiMuonSeedGeneratorHIC::forwardUpdateSeed::EndcapSeed::EndcapSeed::hit is not valid "<<std::endl;
350 return pair<TrajectoryMeasurement,bool>(tm,good);
354 std::cout<<
" DiMuonSeedGeneratorHIC::forwardUpdateSeed::EndcapSeed::EndcapSeed::valid "<<std::endl;
371 double pi=4.*atan(1.);
372 double twopi=8.*atan(1.);
379 double df = fabs(realhit.
phi() -
phi);
381 if(df > pi) df = twopi-df;
384 cout<<
" DiMuonSeedGeneratorHIC::forwardUpdateSeed::phipred::phihit::df "<<phi<<
" "<<realhit.
phi()<<
" "<<df<<endl;
391 double delx = realhit.
z() - theHICConst->zvert;
392 double delr =
sqrt(realhit.
y()*realhit.
y()+realhit.
x()*realhit.
x());
393 double theta = atan2( delr, delx );
404 cout<<
" First parametrization "<<df<<endl;
406 pznew = fabs(( df - 0.0191878 )/(-0.0015952))/3.;
408 if( df > 0.1 ) pznew = 5.;
409 if( fabs(pznew)<3.) pznew = 3.;
412 ptnew = pznew *
tan( theta );
417 cout<<
" Second parametrization "<<df<<endl;
419 pznew = fabs(( df - 0.38 )/(-0.009))/3.;
420 if( fabs(pznew)<2.) pznew = 2.;
423 ptnew = pznew *
tan( theta );
428 cout<<
" Third parametrization "<<df<<endl;
430 pznew = fabs(( df - 0.9 )/(-0.02))/3.;
431 if( fabs(pznew)<1.) pznew = 1.;
433 ptnew = pznew *
tan( theta );
438 cout<<
" Forth parametrization "<<df<<endl;
441 if( df < 0.0000001 ) {
448 ptmin = (dfinv - 4.)/0.7 + 3.;
449 if( ptmin < 2. ) ptmin = 2.;
450 ptmax = (dfinv - 0.5)/0.3 + 3.;
451 ptnew = ( ptmin + ptmax )/2.;
452 pznew = ptnew/
tan( theta );
456 std::cout<<
" Paramters of algorithm "<<df<<
" "<<theHICConst->forwparam[1]<<
" "<<theHICConst->forwparam[0]<<std::endl;
457 std::cout<<
" dfinv "<<dfinv<<
" ptmax "<<ptmax<<
" ptmin "<<ptmin<<std::endl;
464 if( (pt - ptnew)/pt < -2 || (pt - ptnew)/pt > 1 )
467 cout<<
" Return fake 0 pt::ptnew "<<pt<<
" "<<ptnew<<endl;
469 return pair<TrajectoryMeasurement,bool>(tm,good);
475 double alf = theHICConst->atra * ( realhit.
z() - theHICConst->zvert )/fabs(pznew);
476 double alfnew = realhit.
phi() + aCharge*alf;
485 if( realhit.
perp() < 80. ) {
488 cout<<
" Return fake 1 "<<realhit.
perp()<<endl;
490 return pair<TrajectoryMeasurement,bool>(tm,good);
498 if( realhit.
perp() > 100. || realhit.
perp() < 60. ) {
500 cout<<
" Return fake 2 "<<endl;
502 return pair<TrajectoryMeasurement,bool>(tm,good);
507 if( realhit.
perp() > 75. || realhit.
perp() < 40. ) {
510 cout<<
" Return fake 3 "<<endl;
512 return pair<TrajectoryMeasurement,bool>(tm,good);
521 if( realhit.
perp() > 84. || realhit.
perp() < 40. ) {
523 cout<<
" Return fake 4 "<<endl;
525 return pair<TrajectoryMeasurement,bool>(tm,good);
530 if( realhit.
perp() > 84. || realhit.
perp() < 40. ) {
532 cout<<
" Return fake 5 "<<endl;
534 return pair<TrajectoryMeasurement,bool>(tm,good);
539 cout<<
" Create new TM "<<endl;
542 m(0,0) = fabs(0.5*pznew);
543 m(1,1) = theHICConst->phiro[13];
544 m(2,2) = theHICConst->tetro[13];
545 m(3,3) = theHICConst->phiro[13];
546 m(4,4) = theHICConst->tetro[13];
555 pair<TrajectoryMeasurement,bool> newtmr(newtm,good);
557 std::cout<<
" Endcap newtm estimate= "<<newtmr.first.estimate()<<
" "<<newtmr.second<<
" pt "<<pnew0.perp()<<
" pz "<<pnew0.z()<<std::endl;
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
const GlobalTrajectoryParameters & parameters() const
TrajectoryStateOnSurface forwardPredictedState() const
Access to forward predicted state (from fitter or builder)
FreeTrajectoryState * freeTrajectoryState(bool withErrors=true) const
std::vector< DiMuonTrajectorySeed > SeedContainer
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
Geom::Theta< T > theta() const
ConstRecHitPointer recHit() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const CurvilinearTrajectoryError & curvilinearError() const
void set(double &phi, double &z)
GlobalVector momentum() const
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
const DetLayer * layer() const
EventID const & min(EventID const &lh, EventID const &rh)
GlobalPoint position() const
T const * product() const
const AlgebraicSymMatrix55 & matrix() const
TrackCharge charge() const
EventID const & max(EventID const &lh, EventID const &rh)