CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OutInConversionSeedFinder.cc
Go to the documentation of this file.
4 //
6 // Field
8 //
10 // Geometry
11 //
16 //
17 
18 //
19 #include "CLHEP/Units/GlobalPhysicalConstants.h"
20 #include "CLHEP/Geometry/Point3D.h"
21 #include "CLHEP/Geometry/Vector3D.h"
22  #include "CLHEP/Geometry/Transform3D.h"
23 #include <cfloat>
24 
25 
27 {
28 
29  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder CTOR " << "\n";
30 
31  maxNumberOfOutInSeedsPerBC_ = conf_.getParameter<int>("maxNumOfSeedsOutIn");
32  //the2ndHitdphi_ = 0.01;
33  the2ndHitdphi_ = 0.03;
34  the2ndHitdzConst_ = 5.;
35  the2ndHitdznSigma_ = 2.;
36 
37 
38 
39 }
40 
41 
42 
43 
45  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder DTOR " << "\n";
46 
47 }
48 
49 
50 
52 
53  theSeeds_.clear();
54 
55  // std::cout << " OutInConversionSeedFinder::makeSeeds() " << "\n";
56 
57  // debug
58  // std::cout << " OutInConversionSeedFinder::makeSeeds() SC position " << theSCPosition_.x() << " " << theSCPosition_.y() << " " << theSCPosition_.z() << "\n";
59  // std::cout << " SC eta " << theSCPosition_.eta() << " SC phi " << theSCPosition_.phi() << "\n";
60  // std::cout << " OutInConversionSeedFinder::makeSeeds() SC energy " << theSCenergy_ << "\n";
61  //
62 
63  findLayers();
64 
65 
66  // std::cout << " Check Calo cluster collection size " << allBC->size() << "\n";
67 
68  float theSCPhi=theSCPosition_.phi();
69  float theSCEta=theSCPosition_.eta();
70 
71 
72 
73  // Loop over the Calo Clusters in the event looking for seeds
74  reco::CaloClusterCollection::const_iterator bcItr;
75  LogDebug("OutInConversionSeedFinder") << " OutInConversionSeedFinder::makeSeeds() All BC in the event " << "\n";
76  for (unsigned i = 0; i < allBC->size(); ++i ) {
77 
78  //for(bcItr = allBC.begin(); bcItr != allBC.end(); bcItr++) {
79  nSeedsPerBC_=0;
80 
81  theBCEnergy_=allBC->ptrAt(i)->energy();
82  theBCPosition_ = GlobalPoint(allBC->ptrAt(i)->position().x(), allBC->ptrAt(i)->position().y(), allBC->ptrAt(i)->position().z() ) ;
83  float theBcEta= theBCPosition_.eta();
84  float theBcPhi= theBCPosition_.phi();
85  // float dPhi= theBcPhi-theSCPhi;
86 
87  // std::cout << " OutInConversionSeedFinder::makeSeeds() BC eta " << theBcEta << " phi " << theBcPhi << " BC energy " << theBCEnergy_ << " dPhi " << fabs(theBcPhi-theSCPhi) << " dEta " << fabs(theBcEta-theSCEta) << "\n";
88 
89  if ( theBCEnergy_ < 1.5 ) continue;
90 
91  LogDebug("OutInConversionSeedFinder") << " OutInConversionSeedFinder::makeSeeds() Passing the >=1.5 GeV cut BC eta " << theBcEta << " phi " << theBcPhi << " BC energy " << theBCEnergy_ << "\n";
92 
93  if ( fabs(theBcEta-theSCEta) < 0.015 && fabs(theBcPhi-theSCPhi) < 0.3 ) {
94  LogDebug("OutInConversionSeedFinder") << " OutInConversionSeedFinder::makeSeeds() in et and phi range passed to the analysis " << "\n";
95  fillClusterSeeds( allBC->ptrAt(i) );
96  }
97 
98 
99  }
100 
101 
102  // std::cout << "Built vector of seeds of size " << theSeeds_.size() << "\n" ;
103 
105  /*
106  int nSeed=0;
107  for ( std::vector<TrajectorySeed>::const_iterator iSeed= theSeeds_.begin(); iSeed != theSeeds_.end(); ++iSeed) {
108  nSeed++;
109  PTrajectoryStateOnDet ptsod=iSeed->startingState();
110  LogDebug("OutInConversionSeedFinder") << nSeed << ") Direction " << iSeed->direction() << " Num of hits " << iSeed->nHits() << " starting state position " << ptsod.parameters().position() << " R " << ptsod.parameters().position().perp() << " phi " << ptsod.parameters().position().phi() << " eta " << ptsod.parameters().position().eta() << "\n" ;
111 
112 
113  DetId tmpId = DetId( iSeed->startingState().detId());
114  const GeomDet* tmpDet = this->getMeasurementTracker()->geomTracker()->idToDet( tmpId );
115  GlobalVector gv = tmpDet->surface().toGlobal( iSeed->startingState().parameters().momentum() );
116 
117  LogDebug("OutInConversionSeedFinder") << "seed perp,phi,eta : "
118  << gv.perp() << " , "
119  << gv.phi() << " , "
120  << gv.eta() << "\n" ; ;
121 
122 
123 
124 
125  TrajectorySeed::range hitRange = iSeed->recHits();
126  for (TrajectorySeed::const_iterator ihit = hitRange.first; ihit != hitRange.second; ihit++) {
127 
128  if ( ihit->isValid() ) {
129 
130  LogDebug("OutInConversionSeedFinder") << " Valid hit global position " << this->getMeasurementTracker()->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()) << " R " << this->getMeasurementTracker()->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()).perp() << " phi " << this->getMeasurementTracker()->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()).phi() << " eta " << this->getMeasurementTracker()->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()).eta() << "\n" ;
131 
132  }
133  }
134  }
135 
136  */
137 
138 
139 
140 }
141 
142 
143 
145 
146  theSeeds_.clear();
147 
148  findLayers();
149 
150  float theSCPhi=theSCPosition_.phi();
151  float theSCEta=theSCPosition_.eta();
152 
153  nSeedsPerBC_=0;
154 
155  theBCEnergy_=aBC->energy();
156  theBCPosition_ = GlobalPoint(aBC->position().x(), aBC->position().y(), aBC->position().z() ) ;
157  float theBcEta= theBCPosition_.eta();
158  float theBcPhi= theBCPosition_.phi();
159  // float dPhi= theBcPhi-theSCPhi;
160 
161  if ( theBCEnergy_ < 1.5 ) return;
162 
163  if ( fabs(theBcEta-theSCEta) < 0.015 && fabs(theBcPhi-theSCPhi) < 0.25 ) {
164  fillClusterSeeds( aBC);
165  }
166 
167 }
168 
169 
170 
171 
172 
174 
175 
176  theFirstMeasurements_.clear();
177  FreeTrajectoryState fts;
178 
180  if ( makeTrackState(-1).second ) {
181  fts = makeTrackState(-1).first;
182  startSeed(fts);
183  }
185 
186  if ( makeTrackState(1).second ) {
187  fts = makeTrackState(1).first;
188  startSeed(fts);
189  }
190  theFirstMeasurements_.clear();
191 }
192 
193 
194 
195 std::pair<FreeTrajectoryState,bool> OutInConversionSeedFinder::makeTrackState(int charge) const {
196 
197  std::pair<FreeTrajectoryState,bool> result;
198  result.second=false;
199 
200 
201  //std::cout << " OutInConversionSeedFinder:makeTrackState " << "\n";
202 
203 
204  // Old GlobalPoint gpOrigine(theBCPosition_.x()*0.3, theBCPosition_.y()*0.3, theBCPosition_.z()*0.3) ;
205  // GlobalPoint gpOrigine(0.,0.,0.);
206 
208  GlobalVector gvBcRadius = theBCPosition_ - gpOrigine ;
209  HepGeom::Point3D<double> radiusBc(gvBcRadius.x(),gvBcRadius.y(),gvBcRadius.z()) ;
210  HepGeom::Point3D<double> momentumWithoutCurvature = radiusBc.unit() * theBCEnergy_ ;
211 
212  // compute momentum direction at calo
213  double curvature = theMF_->inTesla(theBCPosition_).z() * c_light * 1.e-3 / momentumWithoutCurvature.perp() ;
214  curvature /= 100. ; // in cm-1 !!
215 
216  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState gpOrigine " << gpOrigine.x() << " " << gpOrigine.y() << " " << gpOrigine.z() << " momentumWithoutCurvature " << momentumWithoutCurvature.mag() << " curvature " << curvature << "\n";
217 
218  // define rotation angle
219  float R = theBCPosition_.perp();
220  float r = gpOrigine.perp();
221  float rho = 1./curvature;
222  // from the formula for the intersection of two circles
223  // turns out to be about 2/3 of the deflection of the old formula
224  float d = sqrt(r*r+rho*rho);
225  float u = rho + rho/d/d*(R*R-rho*rho) - r/d/d*sqrt((R*R-r*r+2*rho*R)*(R*R-r*r+2*rho*R));
226  //float u = rho + rho/d/d*(R*R-rho*rho) ;
227  if ( u <=R ) result.second=true;
228 
229  double sinAlpha = 0.5*u/R;
230  if ( sinAlpha>(1.-10*DBL_EPSILON) ) sinAlpha = 1.-10*DBL_EPSILON;
231  else if ( sinAlpha<-(1.-10*DBL_EPSILON) ) sinAlpha = -(1.-10*DBL_EPSILON);
232 
233  double newdphi = charge * asin( sinAlpha) ;
234 
235  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState charge " << charge << " R " << R << " u/R " << u/R << " asin(0.5*u/R) " << asin(sinAlpha) << "\n";
236 
237  HepGeom::Transform3D rotation = HepGeom::Rotate3D(newdphi, HepGeom::Vector3D<double> (0., 0. ,1.));
238 
239 
240  HepGeom::Point3D<double> momentumInTracker = momentumWithoutCurvature.transform(rotation) ;
241  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState R " << R << " r " << r << " rho " << rho << " d " << d << " u " << u << " newdphi " << newdphi << " momentumInTracker " << momentumInTracker << "\n";
242 
243  HepGeom::Point3D<double> hepStartingPoint(gpOrigine.x(), gpOrigine.y(), gpOrigine.z()) ;
244 
245  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState hepStartingPoint " << hepStartingPoint << "\n";
246 
247  hepStartingPoint.transform(rotation);
248 
249  GlobalPoint startingPoint(hepStartingPoint.x(), hepStartingPoint.y(), hepStartingPoint.z());
250 
251  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState startingPoint " << startingPoint << " calo position " << theBCPosition_ << "\n";
252  GlobalVector gvTracker(momentumInTracker.x(), momentumInTracker.y(), momentumInTracker.z());
253  GlobalTrajectoryParameters gtp(startingPoint, gvTracker, charge, &(*theMF_) );
254  // error matrix
256  m(0,0) = 0.1; m(1,1) = 0.1 ; m(2,2) = 0.1 ;
257  m(3,3) = 0.1 ; m(4,4) = 0.1;
258 
259  //std::cout << "OutInConversionSeedFinder::makeTrackState " << FreeTrajectoryState(gtp, CurvilinearTrajectoryError(m) ) << "\n";
260 
261  result.first= FreeTrajectoryState(gtp, CurvilinearTrajectoryError(m) ) ;
262  return result;
263 
264 }
265 
266 
268 
269 
270  // std::cout << "OutInConversionSeedFinder::startSeed layer list " << this->layerList().size() << "\n";
271  //std::cout << "OutInConversionSeedFinder::startSeed fts " << fts << "\n";
272 
273  std::vector<const DetLayer*> myLayers=layerList();
274  if ( myLayers.size() > 3 ) {
275 
276  for(unsigned int ilayer = myLayers.size()-1; ilayer >= myLayers.size()-2; --ilayer) {
277  const DetLayer * layer = myLayers[ilayer];
278 
279 
280  // allow the z of the hit to be within a straight line from a vertex
281  // of +-15 cm to the cluster
282  // float dphi = 0.015;
283  float dphi = 0.030;
284 
285  MeasurementEstimator * newEstimator = makeEstimator(layer, dphi);
286 
287 
288  //std::cout << "OutInSeedFinder::startSeed propagationDirection " << int(thePropagatorAlongMomentum_->propagationDirection() ) << "\n";
289 
290  TSOS tsos(fts, layer->surface() );
291 
292  LogDebug("OutInConversionSeedFinder") << "OutInSeedFinder::startSeed after TSOS tsos(fts, layer->surface() ) " << "\n";
293 
294  LayerMeasurements theLayerMeasurements_(this->getMeasurementTracker() );
295  theFirstMeasurements_ = theLayerMeasurements_.measurements( *layer, tsos, *thePropagatorAlongMomentum_, *newEstimator);
296 
297  //std::cout << "OutInSeedFinder::startSeed after theFirstMeasurements_ " << theFirstMeasurements_.size() << "\n";
298 
299  if(theFirstMeasurements_.size() > 1) // always a dummy returned, too
300  LogDebug("OutInConversionSeedFinder") << " Found " << theFirstMeasurements_.size()-1 << " 1st hits in seed" << "\n";
301 
302  delete newEstimator;
303 
304  LogDebug("OutInConversionSeedFinder") << "OutInSeedFinder::startSeed Layer " << ilayer << " theFirstMeasurements_.size " << theFirstMeasurements_.size() << "\n";
305 
306  for(unsigned int i = 0; i < theFirstMeasurements_.size(); ++i) {
308  if(m1.recHit()->isValid()) {
309 
310  // update the fts to start from this point. much better than starting from
311  // extrapolated point along the line
312  GlobalPoint hitPoint = m1.recHit()->globalPosition();
313  LogDebug("OutInConversionSeedFinder") << " Valid hit at R " << m1.recHit()->globalPosition().perp() << " Z " << m1.recHit()->globalPosition().z() << " eta " << m1.recHit()->globalPosition().eta() << " phi " << m1.recHit()->globalPosition().phi() << " xyz " << m1.recHit()->globalPosition() << "\n";
314 
315 
316  FreeTrajectoryState newfts = trackStateFromClusters(fts.charge(), hitPoint, alongMomentum, 0.8);
317  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::startSeed newfts " << newfts << "\n";
318  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::startSeed propagationDirection after switching " << int(thePropagatorOppositeToMomentum_->propagationDirection() ) << "\n";
319  // std::cout << "OutInConversionSeedFinder::startSeed propagationDirection after switching " << int(thePropagatorOppositeToMomentum_->propagationDirection() ) << "\n";
320 
321 
322  completeSeed(m1, newfts, thePropagatorOppositeToMomentum_, ilayer-1);
323  // skip a layer, if you haven't already skipped the first layer
324  if(ilayer == myLayers.size()-1) {
325  completeSeed(m1, newfts, thePropagatorOppositeToMomentum_, ilayer-2);
326  }
327  }
328  }
329 
330  } // loop over layers
331  }
332 
333 
334 
335 
336 }
337 
338 
339 
341 
342  //std::cout << "OutInConversionSeedFinder::makeEstimator " << "\n";
343 
344  MeasurementEstimator * newEstimator=0;
345 
346  if (layer->location() == GeomDetEnumerators::barrel ) {
347 
348  const BarrelDetLayer * barrelLayer = dynamic_cast<const BarrelDetLayer*>(layer);
349  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeEstimator Barrel r = " << barrelLayer->specificSurface().radius() << " " << "\n";
350  float r = barrelLayer->specificSurface().radius();
351  float zrange = 15.* (1.-r/theBCPosition_.perp());
352  newEstimator = new ConversionBarrelEstimator(-dphi, dphi, -zrange, zrange);
353  }
354 
355 
356 
357  if (layer->location() == GeomDetEnumerators::endcap ) {
358 
359  const ForwardDetLayer * forwardLayer = dynamic_cast<const ForwardDetLayer*>(layer);
360  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeEstimator Endcap r = " << forwardLayer->specificSurface().innerRadius() << " R " << forwardLayer->specificSurface().outerRadius() << " Z " << forwardLayer->specificSurface().position().z() << "\n";
361 
362  float zc = fabs(theBCPosition_.z());
363  float z = fabs(forwardLayer->surface().position().z());
364 
365  float rrange = 15. * theBCPosition_.perp() * (zc - z) / (zc*zc - 15.*zc);
366  newEstimator = new ConversionForwardEstimator(-dphi, dphi, rrange);
367  }
368 
369 
370 
371 
372  return newEstimator;
373 }
374 
375 
376 
377 
379  FreeTrajectoryState & fts,
380  const Propagator* propagator, int ilayer) const {
381 
382  //std::cout << "OutInConversionSeedFinder::completeSeed ilayer " << ilayer << "\n";
383 
384  MeasurementEstimator * newEstimator=0;
385  const DetLayer * layer = theLayerList_[ilayer];
386 
387 
388  if ( layer->location() == GeomDetEnumerators::barrel ) {
389  // z error for 2nd hit is 2 sigma quadded with 5 cm
390  LogDebug("OutInConversionSeedFinder") << " Barrel OutInConversionSeedFinder::completeSeed " << the2ndHitdznSigma_ << " " << the2ndHitdzConst_ << " " << the2ndHitdphi_ << "\n";
391  float dz = sqrt(the2ndHitdznSigma_*the2ndHitdznSigma_*m1.recHit()->globalPositionError().czz()
393  newEstimator =
394  new ConversionBarrelEstimator(-the2ndHitdphi_, the2ndHitdphi_, -dz, dz);
395  }
396  else {
397  LogDebug("OutInConversionSeedFinder") << " EndCap OutInConversionSeedFinder::completeSeed " << the2ndHitdznSigma_ << " " << the2ndHitdzConst_ << " " << the2ndHitdphi_ << "\n";
398  // z error for 2nd hit is 2sigma quadded with 5 cm
399  //float m1dr = m1.recHit().globalPositionError().rerr(m1.recHit().globalPosition());
400  float m1dr = sqrt(m1.recHit()->localPositionError().yy());
401  float dr = sqrt(the2ndHitdznSigma_*the2ndHitdznSigma_*m1dr*m1dr
403  // LogDebug("OutInConversionSeedFinder") << "second hit forward dr " << dr << " this hit " << m1dr << endl;
404  newEstimator =
405  new ConversionForwardEstimator(-the2ndHitdphi_, the2ndHitdphi_, dr);
406  }
407 
408  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed ilayer " << ilayer << "\n";
409 
410  // Get the measurements consistent with the FTS and the Estimator
411  TSOS tsos(fts, layer->surface() );
412  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed propagationDirection " << int(propagator->propagationDirection() ) << "\n";
413  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed pointer to estimator " << newEstimator << "\n";
414 
415  LayerMeasurements theLayerMeasurements_(this->getMeasurementTracker() );
416  std::vector<TrajectoryMeasurement> measurements = theLayerMeasurements_.measurements( *layer, tsos, *propagator, *newEstimator);
417  //std::cout << "OutInConversionSeedFinder::completeSeed Found " << measurements.size() << " second hits " << "\n";
418  delete newEstimator;
419 
420  for(unsigned int i = 0; i < measurements.size(); ++i) {
421  if( measurements[i].recHit()->isValid() ) {
422  createSeed(m1, measurements[i]);
423  }
424  }
425 
426 
427 
428  //LogDebug("OutInConversionSeedFinder") << "COMPLETED " << theSeeds_.size() << " SEEDS " << "\n";
429 }
430 
431 
432 
434  const TrajectoryMeasurement & m2) const {
435 
436  //std::cout << "OutInConversionSeedFinder::createSeed from hit1 " << m1.recHit()->globalPosition() << " r1 " << m1.recHit()->globalPosition().perp() << " and hit2 " << m2.recHit()->globalPosition() << " r2 " << m2.recHit()->globalPosition().perp() << "\n";
437 
438 
439  FreeTrajectoryState fts = createSeedFTS(m1, m2);
440 
441 
442  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::createSeed First point errors " <<m1.recHit()->parametersError() << "\n";
443  LogDebug("OutInConversionSeedFinder") << "original cluster FTS " << fts <<"\n";
444 
445 
446 
447  //std::cout << "OutInConversionSeedFinder::createSeed propagation dir " << int( thePropagatorOppositeToMomentum_->propagationDirection() ) << "\n";
448  TrajectoryStateOnSurface state1 = thePropagatorOppositeToMomentum_->propagate(fts, m1.recHit()->det()->surface());
449 
450  // LogDebug("OutInConversionSeedFinder") << "hit surface " << h1.det().surface().position() << endl;
451  // LogDebug("OutInConversionSeedFinder") << "prop to " << typeid(h1.det().surface()).name() << endl;
452  // LogDebug("OutInConversionSeedFinder") << "prop to first hit " << state1 << endl;
453  // LogDebug("OutInConversionSeedFinder") << "update to " << h1.globalPosition() << endl;
454 
455  if ( state1.isValid() ) {
456  TrajectoryStateOnSurface updatedState1 = theUpdator_.update(state1, *m1.recHit() );
457 
458  if ( updatedState1.isValid() ) {
459  TrajectoryStateOnSurface state2 = thePropagatorOppositeToMomentum_->propagate(*updatedState1.freeTrajectoryState(), m2.recHit()->det()->surface());
460 
461  if ( state2.isValid() ) {
462 
463  TrajectoryStateOnSurface updatedState2 = theUpdator_.update(state2, *m2.recHit() );
464  TrajectoryMeasurement meas1(state1, updatedState1, m1.recHit() , m1.estimate(), m1.layer());
465  TrajectoryMeasurement meas2(state2, updatedState2, m2.recHit() , m2.estimate(), m2.layer());
466 
468  myHits.push_back(meas1.recHit()->hit()->clone());
469  myHits.push_back(meas2.recHit()->hit()->clone());
470 
471  if ( nSeedsPerBC_ >= maxNumberOfOutInSeedsPerBC_ ) return;
472 
473 
474  PTrajectoryStateOnDet ptsod= trajectoryStateTransform::persistentState(state2, meas2.recHit()->hit()->geographicalId().rawId() );
475 
476  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::createSeed new seed from state " << state2.globalPosition() << "\n";
477  LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::createSeed new seed ptsod " << ptsod.parameters().position() << " R "
478  << ptsod.parameters().position().perp() << " phi " << ptsod.parameters().position().phi() << " eta "
479  << ptsod.parameters().position().eta() << "\n";
480 
481 
482 
483  theSeeds_.push_back(TrajectorySeed( ptsod, myHits, oppositeToMomentum ));
484  nSeedsPerBC_++;
485 
486  }
487  }
488  }
489 
490 
491 
492 
493 
494 }
495 
496 
497 
498 
499 
501  const TrajectoryMeasurement & m2) const {
502 
503  //std::cout << "OutInConversionSeedFinder::createSeedFTS " << "\n";
504 
505  GlobalPoint xmeas = fixPointRadius(m1);
506  GlobalPoint xvert = fixPointRadius(m2);
507 
508 
509  float pt = theSCenergy_ * sin(theSCPosition_.theta());
510  float pz = theSCenergy_ * cos(theSCPosition_.theta());
511 
512 
513 
514  // doesn't work at all for endcap, where r is badly measured
515  //float dphidr = (p1.phi()-p2.phi())/(p1.perp()-p2.perp());
516  //int charge = (dphidr > 0.) ? -1 : 1;
517  int charge = m2.predictedState().charge();
518 
519  double BInTesla = theMF_->inTesla(xmeas).z();
520  GlobalVector xdiff = xmeas -xvert;
521 
522  double phi= xdiff.phi();
523  double pxOld = pt*cos(phi);
524  double pyOld = pt*sin(phi);
525  double RadCurv = 100*pt/(BInTesla*0.29979);
526  double alpha = asin(0.5*xdiff.perp()/RadCurv);
527  float ca = cos(charge*alpha);
528  float sa = sin(charge*alpha);
529  double pxNew = ca*pxOld + sa*pyOld;
530  double pyNew = -sa*pxOld + ca*pyOld;
531  GlobalVector pNew(pxNew, pyNew, pz);
532 
533  GlobalTrajectoryParameters gp(xmeas, pNew, charge, &(*theMF_) );
534 
536  m(0,0) = 0.05; m(1,1) = 0.02 ; m(2,2) = 0.007 ;
537  m(3,3) = 10. ; m(4,4) = 10. ;
539 
540 
541 }
542 
543 
544 
545 
547  GlobalPoint p1 = m1.recHit()->globalPosition();
548  GlobalPoint p2;
549  if(m1.layer()->location() == GeomDetEnumerators::barrel) {
550  p2 = p1;
551  } else {
552  float z = p1.z();
553  float phi = p1.phi();
554  float theta = theSCPosition_.theta();
555  float r = p1.z() * tan(theta);
556  p2 = GlobalPoint(r*cos(phi), r*sin(phi), z);
557  // LogDebug("OutInConversionSeedFinder") << "fixing point radius " << p2 << " from " << p1 << endl;
558  }
559  return p2;
560 }
561 
562 
563 
564 
565 
#define LogDebug(id)
const Propagator * thePropagatorAlongMomentum_
T getParameter(std::string const &) const
std::vector< TrajectoryMeasurement > measurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
std::vector< const DetLayer * > const & layerList() const
virtual const BoundSurface & surface() const =0
The surface of the GeometricSearchDet.
int i
Definition: DBlmapReader.cc:9
float alpha
Definition: AMPTWrapper.h:95
void fillClusterSeeds(const reco::CaloClusterPtr &bc) const
const MeasurementTracker * getMeasurementTracker() const
std::pair< FreeTrajectoryState, bool > makeTrackState(int charge) const
T perp() const
Definition: PV3DBase.h:71
virtual PropagationDirection propagationDirection() const
Definition: Propagator.h:143
virtual Location location() const =0
Which part of the detector (barrel, endcap)
LocalPoint position() const
Local x and y position coordinates.
void createSeed(const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2) const
FreeTrajectoryState * freeTrajectoryState(bool withErrors=true) const
ROOT::Math::SMatrixIdentity AlgebraicMatrixID
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
Geom::Theta< T > theta() const
MeasurementEstimator * makeEstimator(const DetLayer *, float dphi) const
GlobalPoint globalPosition() const
OutInConversionSeedFinder(const edm::ParameterSet &config)
ConstRecHitPointer recHit() const
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
TrackCharge charge() const
double charge(const std::vector< uint8_t > &Ampls)
TrajectorySeedCollection theSeeds_
GlobalPoint fixPointRadius(const TrajectoryMeasurement &) const
double double double z
const Propagator * thePropagatorOppositeToMomentum_
Geom::Theta< T > theta() const
Definition: PV3DBase.h:74
U second(std::pair< T, U > const &p)
void push_back(D *&d)
Definition: OwnVector.h:273
T curvature(T InversePt, const edm::EventSetup &iSetup)
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:55
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
tuple result
Definition: query.py:137
virtual const BoundDisk & specificSurface() const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
const DetLayer * layer() const
std::vector< const DetLayer * > theLayerList_
virtual void makeSeeds(const edm::Handle< edm::View< reco::CaloCluster > > &allBc) const
TrajectoryStateOnSurface predictedState() const
double p2[4]
Definition: TauolaWrapper.h:90
tuple conf
Definition: dbtoconf.py:185
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
edm::ESHandle< MagneticField > theMF_
virtual const BoundCylinder & specificSurface() const
Extension of the interface.
FreeTrajectoryState trackStateFromClusters(int aCharge, const GlobalPoint &gpOrigine, PropagationDirection dir, float scaleFactor) const
T eta() const
Definition: PV3DBase.h:75
double p1[4]
Definition: TauolaWrapper.h:89
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
Definition: KFUpdator.cc:10
FreeTrajectoryState createSeedFTS(const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2) const
float outerRadius() const
The outer radius of the disk.
Definition: BoundDisk.h:75
float innerRadius() const
The inner radius of the disk.
Definition: BoundDisk.h:72
const Point & position() const
position
Definition: BeamSpot.h:63
void completeSeed(const TrajectoryMeasurement &m1, FreeTrajectoryState &fts, const Propagator *, int layer) const
const PositionType & position() const
void startSeed(const FreeTrajectoryState &) const
std::vector< TrajectoryMeasurement > theFirstMeasurements_
const LocalTrajectoryParameters & parameters() const
Definition: DDAxes.h:10