CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SeedForPhotonConversionFromQuadruplets.cc
Go to the documentation of this file.
2 
3 #include "Conv4HitsReco2.h"
4 
5 
21 //ClusterShapeIncludes
31 
32 //#define mydebug_knuenz
33 //#define mydebug_sguazz
34 //#define quadDispLine
35 template <class T> T sqr( T t) {return t*t;}
36 
39  SeedComparitorPSet,
40  cfg.getParameter<std::string>("propagator"),
41  cfg.existsAs<double>("SeedMomentumForBOFF") ? cfg.getParameter<double>("SeedMomentumForBOFF") : 5.0)
42 {}
43 
45  : thePropagatorLabel(propagator), theBOFFMomentum(seedMomentumForBOFF)
46 {
47  std::string comparitorName = SeedComparitorPSet.getParameter<std::string>("ComponentName");
48  if(comparitorName != "none") {
49  theComparitor.reset(SeedComparitorFactory::get()->create( comparitorName, SeedComparitorPSet, iC));
50  }
51 }
52 
54 
55 
57  TrajectorySeedCollection & seedCollection,
58  const SeedingHitSet & phits,
59  const SeedingHitSet & mhits,
60  const TrackingRegion & region,
61  const edm::Event& ev,
62  const edm::EventSetup& es,
63  std::stringstream& ss,
64  std::vector<Quad>& quadV,
66 {
67 
68 
70 
71 
72  bool rejectAllQuads=QuadCutPSet.getParameter<bool>("rejectAllQuads");
73  if(rejectAllQuads) return 0;
74 
75  bool applyDeltaPhiCuts=QuadCutPSet.getParameter<bool>("apply_DeltaPhiCuts");
76  bool ClusterShapeFiltering=QuadCutPSet.getParameter<bool>("apply_ClusterShapeFilter");
77  bool applyArbitration=QuadCutPSet.getParameter<bool>("apply_Arbitration");
78  bool applydzCAcut=QuadCutPSet.getParameter<bool>("apply_zCACut");
79  double CleaningmaxRadialDistance=QuadCutPSet.getParameter<double>("Cut_DeltaRho");//cm
80  double BeamPipeRadiusCut=QuadCutPSet.getParameter<double>("Cut_BeamPipeRadius");//cm
81  double CleaningMinLegPt = QuadCutPSet.getParameter<double>("Cut_minLegPt"); //GeV
82  double maxLegPt = QuadCutPSet.getParameter<double>("Cut_maxLegPt"); //GeV
83  double dzcut=QuadCutPSet.getParameter<double>("Cut_zCA");//cm
84 
85  double toleranceFactorOnDeltaPhiCuts=0.1;
86 
87  // return 0; //FIXME, remove this line to make the code working.
88 
89  pss = &ss;
90 
91  if ( phits.size() < 2) return 0;
92  if ( mhits.size() < 2) return 0;
93 
94  //PUT HERE THE QUADRUPLET ALGORITHM, AND IN CASE USE THE METHODS ALREADY DEVELOPED, ADAPTING THEM
95 
96  //
97  // Rozzo ma efficace (per ora)
98  //
99 
100 #ifdef mydebug_sguazz
101  std::cout << " --------------------------------------------------------------------------" << "\n";
102  std::cout << " Starting a hit quad fast reco " << "\n";
103  std::cout << " --------------------------------------------------------------------------" << "\n";
104 #endif
105 
106  //
107  // Let's build the 4 hits
108  SeedingHitSet::ConstRecHitPointer ptth1 = phits[0];
109  SeedingHitSet::ConstRecHitPointer ptth2 = phits[1];
110  SeedingHitSet::ConstRecHitPointer mtth1 = mhits[0];
111  SeedingHitSet::ConstRecHitPointer mtth2 = mhits[1];
112 
113  GlobalPoint vHit[4];
114  vHit[0]=ptth2->globalPosition();
115  vHit[1]=ptth1->globalPosition();
116  vHit[2]=mtth1->globalPosition();
117  vHit[3]=mtth2->globalPosition();
118 
119  //Photon source vertex primary vertex
120  GlobalPoint vgPhotVertex=region.origin();
121  math::XYZVector vPhotVertex(vgPhotVertex.x(), vgPhotVertex.y(), vgPhotVertex.z());
122 
123  math::XYZVector h1(vHit[0].x(),vHit[0].y(),vHit[0].z());
124  math::XYZVector h2(vHit[1].x(),vHit[1].y(),vHit[1].z());
125  math::XYZVector h3(vHit[2].x(),vHit[2].y(),vHit[2].z());
126  math::XYZVector h4(vHit[3].x(),vHit[3].y(),vHit[3].z());
127 
128 // At this point implement cleaning cuts before building the seed:::
129 
130 /*
131  Notes:
132 
133 h1, h2: positron
134 h3, h4: electron
135 
136 P1, P2: positron, ordered with radius
137 M1, M2: electron, ordered with radius
138 
139 Evan's notation:
140 V1=P1
141 V2=M1
142 V3=P2
143 V4=M2
144 
145 */
146 
147  math::XYZVector P1;
148  math::XYZVector P2;
149  math::XYZVector M1;
150  math::XYZVector M2;
151 
152  if(h1.x()*h1.x()+h1.y()*h1.y() < h2.x()*h2.x()+h2.y()*h2.y()){
153  P1=h1;
154  P2=h2;
155  }
156  else{
157  P1=h2;
158  P2=h1;
159  }
160 
161  if(h3.x()*h3.x()+h3.y()*h3.y() < h4.x()*h4.x()+h4.y()*h4.y()){
162  M1=h3;
163  M2=h4;
164  }
165  else{
166  M1=h4;
167  M2=h3;
168  }
169 
171 // Intersection-point:::
173 /*
174 Calculate the intersection point of the lines P2-P1 and M2-M1.
175 If this point is in the beam pipe, or if the distance of this
176 point to the layer of the most inner hit of the seed is less
177 than CleaningmaxRadialDistance cm, the combination is rejected.
178 */
179 
180 
181  math::XYZVector IP(0,0,0);
182 
183  //Line1:
184  double kP=(P1.y()-P2.y())/(P1.x()-P2.x());
185  double dP=P1.y()-kP*P1.x();
186  //Line2:
187  double kM=(M1.y()-M2.y())/(M1.x()-M2.x());
188  double dM=M1.y()-kM*M1.x();
189  //Intersection:
190  double IPx=(dM-dP)/(kP-kM);
191  double IPy=kP*IPx+dP;
192 
193  IP.SetXYZ(IPx,IPy,0);
194 
195  double IPrho=std::sqrt(IP.x()*IP.x()+IP.y()*IP.y());
196  double P1rho2=P1.x()*P1.x()+P1.y()*P1.y();
197  double M1rho2=M1.x()*M1.x()+M1.y()*M1.y();
198  double maxIPrho2=IPrho+CleaningmaxRadialDistance; maxIPrho2*=maxIPrho2;
199 
200  if( IPrho<BeamPipeRadiusCut || P1rho2>maxIPrho2 || M1rho2>maxIPrho2){
201  return 0;
202  }
203 
204  if(applyDeltaPhiCuts) {
205 
206  kPI_ = std::atan(1.0)*4;
207 
209  es.get<IdealMagneticFieldRecord>().get(bfield);
210  math::XYZVector QuadMean(0,0,0);
211  QuadMean.SetXYZ((M1.x()+M2.x()+P1.x()+P2.x())/4.,(M1.y()+M2.y()+P1.y()+P2.y())/4.,(M1.z()+M2.z()+P1.z()+P2.z())/4.);
212 
213  double fBField = bfield->inTesla(GlobalPoint(QuadMean.x(),QuadMean.y(),QuadMean.z())).z();
214 
215  double rMax=CleaningMinLegPt/(0.01*0.3*fBField);
216  double rMax_squared=rMax*rMax;
217  double Mx=M1.x();
218  double My=M1.y();
219 
220  math::XYZVector B(0,0,0);
221  math::XYZVector C(0,0,0);
222 
223  if(rMax_squared*4. > Mx*Mx+My*My){
224 
226 // Cleaning P1 points:::
228 
229  //Cx, Cy = Coordinates of circle center
230  //C_=line that contains the circle center
231 
232  //C_=k*x+d
233  double k=-Mx/My;
234  double d=My/2.-k*Mx/2.;
235 
236 #ifdef mydebug_knuenz
237 std::cout << "k" << k << std::endl;
238 std::cout << "d" << d << std::endl;
239 #endif
240 
241  //Cx1,2 and Cy1,2 are the two points that have a distance of rMax to 0,0
242  double CsolutionPart1=-2*k*d;
243  double CsolutionPart2=std::sqrt(4*k*k*d*d-4*(1+k*k)*(d*d-rMax_squared));
244  double CsolutionPart3=2*(1+k*k);
245  double Cx1=(CsolutionPart1+CsolutionPart2)/CsolutionPart3;
246  double Cx2=(CsolutionPart1-CsolutionPart2)/CsolutionPart3;
247  double Cy1=k*Cx1+d;
248  double Cy2=k*Cx2+d;
249 
250 
251  // Decide between solutions: phi(C) > phi(P)
252  double Cx,Cy;
253  math::XYZVector C1(Cx1,Cy1,0);
254  if(C1.x()*M1.y()-C1.y()*M1.x()<0){
255  Cx=Cx1;
256  Cy=Cy1;
257  }
258  else{
259  Cx=Cx2;
260  Cy=Cy2;
261  }
262  C.SetXYZ(Cx,Cy,0);
263 
264 #ifdef mydebug_knuenz
265  std::cout << "Cx1" << Cx1 << std::endl;
266  std::cout << "Cx2" << Cx2 << std::endl;
267  std::cout << "Cy1" << Cy1 << std::endl;
268  std::cout << "Cy2" << Cy2 << std::endl;
269  std::cout << "Cx" << Cx << std::endl;
270  std::cout << "Cy" << Cy << std::endl;
271 #endif
272 
273 // Find Tangent at 0,0 to minPtCircle and point (Bx,By) on the first layer which bisects the allowed angle
274  k=-Cx/Cy;
275  d=0;
276  double Bx1=std::sqrt(Mx*Mx+My*My/(1+k*k));
277  double Bx2=-Bx1;
278  double By1=k*Bx1+d;
279  double By2=k*Bx2+d;
280 
281 #ifdef mydebug_knuenz
282  std::cout << "k" << k << std::endl;
283  std::cout << "d" << d << std::endl;
284 #endif
285 
286 // Decide between solutions: phi(B) < phi(P)
287  double Bx,By;
288  math::XYZVector B1(Bx1,By1,0);
289  if(M1.x()*B1.y()-M1.y()*B1.x()<0){
290  Bx=Bx1;
291  By=By1;
292  }
293  else{
294  Bx=Bx2;
295  By=By2;
296  }
297  B.SetXYZ(Bx,By,0);
298 
299 #ifdef mydebug_knuenz
300  std::cout << "Bx1" << Bx1 << std::endl;
301  std::cout << "Bx2" << Bx2 << std::endl;
302  std::cout << "By1" << By1 << std::endl;
303  std::cout << "By2" << By2 << std::endl;
304  std::cout << "Bx" << Bx << std::endl;
305  std::cout << "By" << By << std::endl;
306 #endif
307 
308  double DeltaPhiMaxM1P1=DeltaPhiManual(M1,B)*2;
309 
310 #ifdef mydebug_knuenz
311  std::cout << "DeltaPhiMaxM1P1 " << DeltaPhiMaxM1P1 << std::endl;
312  std::cout << "M1.DeltaPhi(P1) " << DeltaPhiManual(M1,P1) << std::endl;
313  std::cout << "rho P1: " << std::sqrt(P1.x()*P1.x()+P1.y()*P1.y()) << "phi P1: " << P1.Phi() << std::endl;
314  std::cout << "rho M1: " << std::sqrt(M1.x()*M1.x()+M1.y()*M1.y()) << "phi M1: " << M1.Phi() << std::endl;
315 #endif
316 
317 //Finally Cut on DeltaPhi of P1 and M1
318 
319  double tol_DeltaPhiMaxM1P1=DeltaPhiMaxM1P1*toleranceFactorOnDeltaPhiCuts;
320  double DeltaPhiManualM1P1=DeltaPhiManual(M1,P1);
321 
322 if(DeltaPhiManualM1P1>DeltaPhiMaxM1P1+tol_DeltaPhiMaxM1P1 || DeltaPhiManualM1P1<0-tol_DeltaPhiMaxM1P1){
323  return 0;
324 }
325 
326  }//if rMax > rLayerM1
327 
328 
330 // Cleaning M2 points:::
332 
333 // if(B.DeltaPhi(P1)>0){//normal algo (with minPt circle)
334 
335  double rM2_squared=M2.x()*M2.x()+M2.y()*M2.y();
336  if(rMax_squared*4. > rM2_squared){//if minPt circle is smaller than 2*M2-layer radius, algo makes no sense
337 
338  //Chordales equation (line containing the two intersection points of the two circles)
339  double k=-C.x()/C.y();
340  double d=(rM2_squared-rMax_squared+C.x()*C.x()+C.y()*C.y())/(2*C.y());
341 
342  double M2solutionPart1=-2*k*d;
343  double M2solutionPart2=std::sqrt(4*k*k*d*d-4*(1+k*k)*(d*d-rM2_squared));
344  double M2solutionPart3=2+2*k*k;
345  double M2xMax1=(M2solutionPart1+M2solutionPart2)/M2solutionPart3;
346  double M2xMax2=(M2solutionPart1-M2solutionPart2)/M2solutionPart3;
347  double M2yMax1=k*M2xMax1+d;
348  double M2yMax2=k*M2xMax2+d;
349 
350  //double M2xMax,M2yMax;
351  math::XYZVector M2MaxVec1(M2xMax1,M2yMax1,0);
352  math::XYZVector M2MaxVec2(M2xMax2,M2yMax2,0);
353  math::XYZVector M2MaxVec(0,0,0);
354  if(M2MaxVec1.x()*M2MaxVec2.y()-M2MaxVec1.y()*M2MaxVec2.x()<0){
355  M2MaxVec.SetXYZ(M2xMax2,M2yMax2,0);
356  }
357  else{
358  M2MaxVec.SetXYZ(M2xMax1,M2yMax1,0);
359  }
360 
361  double DeltaPhiMaxM2=DeltaPhiManual(M2MaxVec,M1);
362 
363 #ifdef mydebug_knuenz
364  std::cout << "C.x() " << C.x() << std::endl;
365  std::cout << "C.y() " << C.y() << std::endl;
366  std::cout << "M1.x() " << M1.x() << std::endl;
367  std::cout << "M1.y() " << M1.y() << std::endl;
368  std::cout << "M2.x() " << M2.x() << std::endl;
369  std::cout << "M2.y() " << M2.y() << std::endl;
370  std::cout << "k " << k << std::endl;
371  std::cout << "d " << d << std::endl;
372  std::cout << "M2xMax1 " << M2xMax1 << std::endl;
373  std::cout << "M2xMax2 " << M2xMax2 << std::endl;
374  std::cout << "M2yMax1 " << M2yMax1 << std::endl;
375  std::cout << "M2yMax2 " << M2yMax2 << std::endl;
376  std::cout << "M2xMax " << M2MaxVec.x() << std::endl;
377  std::cout << "M2yMax " << M2MaxVec.y() << std::endl;
378  std::cout << "rM2_squared " << rM2_squared << std::endl;
379  std::cout << "rMax " << rMax << std::endl;
380  std::cout << "DeltaPhiMaxM2 " << DeltaPhiMaxM2 << std::endl;
381 #endif
382 
383 
384  double tol_DeltaPhiMaxM2=DeltaPhiMaxM2*toleranceFactorOnDeltaPhiCuts;
385  double DeltaPhiManualM2M1=DeltaPhiManual(M2,M1);
386 
387  if(DeltaPhiManualM2M1>DeltaPhiMaxM2+tol_DeltaPhiMaxM2 || DeltaPhiManualM2M1<0-tol_DeltaPhiMaxM2){
388  return 0;
389  }
390 
391  //Using the lazy solution for P2: DeltaPhiMaxP2=DeltaPhiMaxM2
392  double DeltaPhiManualP1P2=DeltaPhiManual(P1,P2);
393  if(DeltaPhiManualP1P2>DeltaPhiMaxM2+tol_DeltaPhiMaxM2 || DeltaPhiManualP1P2<0-tol_DeltaPhiMaxM2){
394  return 0;
395  }
396 
397  }
398 
399 }
400 
401 // }
402 
403 // if(B.DeltaPhi(P1)<0){//different algo (without minPt circle)
404 
405 // }
406 
407 // End of pre-seed cleaning
408 
409 
410 
411  Conv4HitsReco2 quad(vPhotVertex, h1, h2, h3, h4);
412  quad.SetMaxNumberOfIterations(100);
413 #ifdef mydebug_sguazz
414  quad.Dump();
415 #endif
416  math::XYZVector candVtx;
417  double candPtPlus, candPtMinus;
418  //double rPlus, rMinus;
419  int nite = quad.ConversionCandidate(candVtx, candPtPlus, candPtMinus);
420 
421  if ( ! (nite && abs(nite) < 25 && nite != -1000 && nite != -2000) ) return 0;
422 
423 // math::XYZVector plusCenter = quad.GetPlusCenter(rPlus);
424 // math::XYZVector minusCenter = quad.GetMinusCenter(rMinus);
425 
426 #ifdef mydebug_sguazz
427  std::cout << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << "\n";
428  std::cout << " >>>>>>>>>>> Conv Cand: " << " Vertex X: " << candVtx.X() << " [cm] Y: " << candVtx.Y() << " [cm] pt+: " << candPtPlus<< " [GeV] pt-: " << candPtMinus << " [GeV]; #its: " << nite << "\n";
429 #endif
430 
431  //Add here cuts
432  double minLegPt = CleaningMinLegPt;
433  double maxRadialDistance = CleaningmaxRadialDistance;
434 
435  //
436  // Cut on leg's transverse momenta
437  if ( candPtPlus < minLegPt ) return 0;
438  if ( candPtMinus < minLegPt ) return 0;
439  //
440  if ( candPtPlus > maxLegPt ) return 0;
441  if ( candPtMinus > maxLegPt ) return 0;
442  //
443  // Cut on radial distance between estimated conversion vertex and inner hits
444  double cr = std::sqrt(candVtx.Perp2());
445  double maxr2 = (maxRadialDistance + cr); maxr2*=maxr2;
446  if (h2.Perp2() > maxr2) return 0;
447  if (h3.Perp2() > maxr2) return 0;
448 
449 
450 // At this point implement cleaning cuts after building the seed
451 
452  //ClusterShapeFilter_knuenz:::
454  es.get<IdealMagneticFieldRecord>().get(bfield);
455  float nomField = bfield->nominalValue();
456 
457 
458  if(ClusterShapeFiltering){
459  if (theComparitor) theComparitor->init(ev, es);
460 
463 
464  // SeedingHitSet::ConstRecHitPointer ptth1 = phits[0]; // (never used???)
465  SeedingHitSet::ConstRecHitPointer ptth2 = phits[1];
466  SeedingHitSet::ConstRecHitPointer mtth1 = mhits[0];
467  SeedingHitSet::ConstRecHitPointer mtth2 = mhits[1];
468 
469  GlobalPoint vertexPos(candVtx.x(),candVtx.y(),candVtx.z());
470 
471  float ptMinReg=0.1;
472  GlobalTrackingRegion region(ptMinReg,vertexPos,0,0,true);
473 
474  FastHelix phelix(ptth2->globalPosition(), mtth1->globalPosition(), vertexPos, nomField,&*bfield, vertexPos);
475  pkine = phelix.stateAtVertex();
476  FastHelix mhelix(mtth2->globalPosition(), mtth1->globalPosition(), vertexPos, nomField,&*bfield, vertexPos);
477  mkine = mhelix.stateAtVertex();
478 
479  if(theComparitor&&!theComparitor->compatible(phits, pkine, phelix)) { return 0; }
480  if(theComparitor&&!theComparitor->compatible(mhits, mkine, mhelix)) { return 0; }
481  }
482 
483 
484  //Do a very simple fit to estimate the slope
485  double quadPhotCotTheta = 0.;
486  double quadZ0 = 0.;
487  simpleGetSlope(ptth2, ptth1, mtth1, mtth2, region, quadPhotCotTheta, quadZ0);
488 
489  double quadPhotPhi = (candVtx-vPhotVertex).Phi();
490 
491  math::XYZVector fittedPrimaryVertex(vgPhotVertex.x(), vgPhotVertex.y(),quadZ0);
492 
493  candVtx.SetZ(std::sqrt(candVtx.Perp2())*quadPhotCotTheta+quadZ0);
494  GlobalPoint convVtxGlobalPoint(candVtx.X(),candVtx.Y(),candVtx.Z());
495 
496  //
497  // Comparing new quad with old quad
498  //
499  //Arbitration
500 
501  Quad thisQuad;
502  thisQuad.x = candVtx.X();
503  thisQuad.y = candVtx.Y();
504  thisQuad.z = candVtx.Z();
505  thisQuad.ptPlus = candPtPlus;
506  thisQuad.ptMinus = candPtMinus;
507  thisQuad.cot = quadPhotCotTheta;
508  if ( similarQuadExist(thisQuad, quadV) && applyArbitration ) return 0;
509 
510  // not able to get the mag field... doing the dirty way
511  //
512  // Plus
513  FastHelix helixPlus(ptth2->globalPosition(), ptth1->globalPosition(), convVtxGlobalPoint, nomField,&*bfield, convVtxGlobalPoint);
514  GlobalTrajectoryParameters kinePlus = helixPlus.stateAtVertex();
515  kinePlus = GlobalTrajectoryParameters(convVtxGlobalPoint,
516  GlobalVector(candPtPlus*cos(quadPhotPhi),candPtPlus*sin(quadPhotPhi),candPtPlus*quadPhotCotTheta),
517  1,//1
518  & kinePlus.magneticField()
519  );
520 
521  //
522  // Minus
523  FastHelix helixMinus(mtth2->globalPosition(), mtth1->globalPosition(), convVtxGlobalPoint, nomField,&*bfield, convVtxGlobalPoint);
524  GlobalTrajectoryParameters kineMinus = helixMinus.stateAtVertex();
525  kineMinus = GlobalTrajectoryParameters(convVtxGlobalPoint,
526  GlobalVector(candPtMinus*cos(quadPhotPhi),candPtMinus*sin(quadPhotPhi),candPtMinus*quadPhotCotTheta),
527  -1,//-1
528  & kineMinus.magneticField()
529  );
530 
531  float sinThetaPlus = sin(kinePlus.momentum().theta());
532  float sinThetaMinus = sin(kineMinus.momentum().theta());
533  float ptmin = region.ptMin();
534  //vertexBounds da region
535  GlobalVector vertexBounds(region.originRBound(),region.originRBound(),region.originZBound());
536 
537  CurvilinearTrajectoryError errorPlus = initialError(vertexBounds, ptmin, sinThetaPlus);
538  CurvilinearTrajectoryError errorMinus = initialError(vertexBounds, ptmin, sinThetaMinus);
539  FreeTrajectoryState ftsPlus(kinePlus, errorPlus);
540  FreeTrajectoryState ftsMinus(kineMinus, errorMinus);
541 
542  //FIXME: here probably you want to go in parallel with phits and mhits
543  //NB: the seedCollection is filled (the important thing) the return of the last TrajectorySeed is not used, but is needed
544  //to maintain the inheritance
545 
546 #ifdef quadDispLine
547  double vError = region.originZBound();
548  if ( vError > 15. ) vError = 1.;
549  std::cout << "QuadDispLine "
550  << vgPhotVertex.x() << " " << vgPhotVertex.y() << " " << vgPhotVertex.z() << " " << vError << " "
551  << vHit[0].x() << " " << vHit[0].y() << " " << vHit[0].z() << " " << sqrt(getSqrEffectiveErrorOnZ(ptth2, region)) << " "
552  << vHit[1].x() << " " << vHit[1].y() << " " << vHit[1].z() << " " << sqrt(getSqrEffectiveErrorOnZ(ptth1, region)) << " "
553  << vHit[2].x() << " " << vHit[2].y() << " " << vHit[2].z() << " " << sqrt(getSqrEffectiveErrorOnZ(mtth1, region)) << " "
554  << vHit[3].x() << " " << vHit[3].y() << " " << vHit[3].z() << " " << sqrt(getSqrEffectiveErrorOnZ(mtth2, region)) << " "
555  << candVtx.X() << " " << candVtx.Y() << " " << candVtx.Z() << " "
556  << fittedPrimaryVertex.X() << " " << fittedPrimaryVertex.Y() << " " << fittedPrimaryVertex.Z() << " "
557 // << candPtPlus << " " << rPlus << " " << plusCenter.X() << " " << plusCenter.Y() << " "
558 // << candPtMinus << " " << rMinus << " " << minusCenter.X() << " " << minusCenter.Y() << " "
559  << nite << " " << chi2 << "\n";
560 #endif
561 #ifdef mydebug_sguazz
562  std::cout << " >>>>> Hit quad fast reco done >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << "\n";
563  uint32_t detid;
564  std::cout << "[SeedForPhotonConversionFromQuadruplets]\n ptth1 " ;
565  detid=ptth1->geographicalId().rawId();
566  // po.print(std::cout , detid );
567  std::cout << " \t " << detid << " " << ptth1->localPosition() << " " << ptth1->globalPosition() ;
568  detid=ptth2->geographicalId().rawId();
569  std::cout << " \n\t ptth2 ";
570  // po.print(std::cout , detid );
571  std::cout << " \t " << detid << " " << ptth2->localPosition() << " " << ptth2->globalPosition()
572  << "\nhelix momentum " << kinePlus.momentum() << " pt " << kinePlus.momentum().perp() << " radius " << 1/kinePlus.transverseCurvature() << " q " << kinePlus.charge();
573  std::cout << " \n\t mtth1 ";
574  detid=mtth1->geographicalId().rawId();
575  std::cout << " \t " << detid << " " << mtth1->localPosition() << " " << mtth1->globalPosition() ;
576  std::cout << " \n\t mtth2 ";
577  detid=mtth2->geographicalId().rawId();
578  // po.print(std::cout , detid );
579  std::cout << " \t " << detid << " " << mtth2->localPosition() << " " << mtth2->globalPosition()
580  << "\nhelix momentum " << kineMinus.momentum() << " pt " << kineMinus.momentum().perp() << " radius " << 1/kineMinus.transverseCurvature() << " q " << kineMinus.charge();
581  std::cout << "\n <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << "\n";
582 #endif
583 
584 
585 
586  bool buildSeedBoolPos = buildSeedBool(seedCollection,phits,ftsPlus,es,applydzCAcut,region, dzcut);
587  bool buildSeedBoolNeg = buildSeedBool(seedCollection,mhits,ftsMinus,es,applydzCAcut,region, dzcut);
588 
589 
590 
591  if( buildSeedBoolPos && buildSeedBoolNeg ){
592  buildSeed(seedCollection,phits,ftsPlus,es,false,region);
593  buildSeed(seedCollection,mhits,ftsMinus,es,false,region);
594  }
595 
596  return 0;
597 
598 }
599 
600 
602  const SeedingHitSet & hits,
603  const GlobalPoint & vertexPos,
604  const edm::EventSetup& es,
605  const float cotTheta) const
606 {
608 
609  SeedingHitSet::ConstRecHitPointer tth1 = hits[0];
610  SeedingHitSet::ConstRecHitPointer tth2 = hits[1];
611 
613  es.get<IdealMagneticFieldRecord>().get(bfield);
614  float nomField = bfield->nominalValue();
615  bool isBOFF = (0==nomField);
616 
617 
618  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField,&*bfield, vertexPos);
619  kine = helix.stateAtVertex();
620 
621  //force the pz/pt equal to the measured one
622  if(fabs(cotTheta)<cotTheta_Max)
623  kine = GlobalTrajectoryParameters(kine.position(),
624  GlobalVector(kine.momentum().x(),kine.momentum().y(),kine.momentum().perp()*cotTheta),
625  kine.charge(),
626  & kine.magneticField()
627  );
628  else
629  kine = GlobalTrajectoryParameters(kine.position(),
630  GlobalVector(kine.momentum().x(),kine.momentum().y(),kine.momentum().perp()*cotTheta_Max),
631  kine.charge(),
632  & kine.magneticField()
633  );
634 
635 #ifdef mydebug_seed
636  uint32_t detid;
637  (*pss) << "[SeedForPhotonConversionFromQuadruplets] initialKinematic tth1 " ;
638  detid=tth1->geographicalId().rawId();
639  po.print(*pss, detid );
640  (*pss) << " \t " << detid << " " << tth1->localPosition() << " " << tth1->globalPosition() ;
641  detid= tth2->geographicalId().rawId();
642  (*pss) << " \n\t tth2 ";
643  po.print(*pss, detid );
644  (*pss) << " \t " << detid << " " << tth2->localPosition() << " " << tth2->globalPosition()
645  << "\nhelix momentum " << kine.momentum() << " pt " << kine.momentum().perp() << " radius " << 1/kine.transverseCurvature();
646 #endif
647 
648  if (isBOFF && (theBOFFMomentum > 0)) {
649  kine = GlobalTrajectoryParameters(kine.position(),
650  kine.momentum().unit() * theBOFFMomentum,
651  kine.charge(),
652  &*bfield);
653  }
654  return kine;
655 }
656 
657 
658 
661  const GlobalVector& vertexBounds,
662  float ptMin,
663  float sinTheta) const
664 {
665  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
666  // information.
667  GlobalError vertexErr( sqr(vertexBounds.x()), 0,
668  sqr(vertexBounds.y()), 0, 0,
669  sqr(vertexBounds.z())
670  );
671 
672 
673  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
674 
675 // FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small,
676 // to avoid instabilities.
677 // N.B. This parameter needs optimising ...
678  float sin2th = sqr(sinTheta);
679  float minC00 = 1.0;
680  C[0][0] = std::max(sin2th/sqr(ptMin), minC00);
681  float zErr = vertexErr.czz();
682  float transverseErr = vertexErr.cxx(); // assume equal cxx cyy
683  C[3][3] = transverseErr;
684  C[4][4] = zErr*sin2th + transverseErr*(1-sin2th);
685 
686  return CurvilinearTrajectoryError(C);
687 }
688 
690  TrajectorySeedCollection & seedCollection,
691  const SeedingHitSet & hits,
692  const FreeTrajectoryState & fts,
693  const edm::EventSetup& es,
694  bool apply_dzCut,
695  const TrackingRegion & region) const
696 {
697  // get tracker
699  es.get<TrackerDigiGeometryRecord>().get(tracker);
700 
701  // get propagator
702  edm::ESHandle<Propagator> propagatorHandle;
703  es.get<TrackingComponentsRecord>().get(thePropagatorLabel, propagatorHandle);
704  const Propagator* propagator = &(*propagatorHandle);
705 
706  // get updator
708 
709  // Now update initial state track using information from seed hits.
710 
711  TrajectoryStateOnSurface updatedState;
713 
714  const TrackingRecHit* hit = 0;
715  for ( unsigned int iHit = 0; iHit < hits.size() && iHit<2; iHit++) {
716  hit = hits[iHit];
717  TrajectoryStateOnSurface state = (iHit==0) ?
718  propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface())
719  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
720 
721  SeedingHitSet::ConstRecHitPointer tth = hits[iHit];
722 
723  SeedingHitSet::RecHitPointer newtth = refitHit( tth, state);
724 
725  updatedState = updator.update(state, *newtth);
726 
727  seedHits.push_back(newtth);
728 #ifdef mydebug_seed
729  uint32_t detid = hit->geographicalId().rawId();
730  (*pss) << "\n[SeedForPhotonConversionFromQuadruplets] hit " << iHit;
731  po.print(*pss, detid);
732  (*pss) << " " << detid << "\t lp " << hit->localPosition()
733  << " tth " << tth->localPosition() << " newtth " << newtth->localPosition() << " state " << state.globalMomentum().perp();
734 #endif
735  }
736 
737  if(!hit) return nullptr;
738 
739  PTrajectoryStateOnDet const & PTraj =
741 
742 
743  seedCollection.push_back( TrajectorySeed(PTraj,seedHits,alongMomentum));
744  return &seedCollection.back();
745 }
746 
747 
748 
749 
750 
752  TrajectorySeedCollection & seedCollection,
753  const SeedingHitSet & hits,
754  const FreeTrajectoryState & fts,
755  const edm::EventSetup& es,
756  bool apply_dzCut,
757  const TrackingRegion & region,
758  double dzcut) const
759 {
760  // get tracker
762  es.get<TrackerDigiGeometryRecord>().get(tracker);
763 
764  // get propagator
765  edm::ESHandle<Propagator> propagatorHandle;
766  es.get<TrackingComponentsRecord>().get(thePropagatorLabel, propagatorHandle);
767  const Propagator* propagator = &(*propagatorHandle);
768 
769  // get cloner (FIXME: add to config)
770  auto TTRHBuilder = "WithTrackAngle";
772  es.get<TransientRecHitRecord>().get(TTRHBuilder, builderH);
773  auto builder = (TkTransientTrackingRecHitBuilder const *)(builderH.product());
774  cloner = (*builder).cloner();
775 
776  // get updator
778 
779  // Now update initial state track using information from seed hits.
780 
781  TrajectoryStateOnSurface updatedState;
783 
784  const TrackingRecHit* hit = 0;
785  for ( unsigned int iHit = 0; iHit < hits.size() && iHit<2; iHit++) {
786  hit = hits[iHit]->hit();
787  TrajectoryStateOnSurface state = (iHit==0) ?
788  propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface())
789  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
790  if (!state.isValid()) {
791  return false;}
792 
793  SeedingHitSet::ConstRecHitPointer tth = hits[iHit];
794 
795  SeedingHitSet::RecHitPointer newtth = refitHit( tth, state);
796 
797 
798  if (!checkHit(state,newtth,es)){
799  return false;
800  }
801 
802  updatedState = updator.update(state, *newtth);
803  if (!updatedState.isValid()){
804  return false;
805  }
806 
807  seedHits.push_back(newtth->hit()->clone());
808  }
809 
810  if(apply_dzCut){
812 
813  double zCA;
814 
815  math::XYZVector EstMomGam(updatedState.globalMomentum().x(),updatedState.globalMomentum().y(),updatedState.globalMomentum().z());
816  math::XYZVector EstPosGam(updatedState.globalPosition().x(),updatedState.globalPosition().y(),updatedState.globalPosition().z());
817 
818  double EstMomGamLength=std::sqrt(EstMomGam.x()*EstMomGam.x()+EstMomGam.y()*EstMomGam.y()+EstMomGam.z()*EstMomGam.z());
819  math::XYZVector EstMomGamNorm(EstMomGam.x()/EstMomGamLength,EstMomGam.y()/EstMomGamLength,EstMomGam.z()/EstMomGamLength);
820 
821  //Calculate dz of point of closest approach of the two lines (WA approach) -> cut on dz
822 
823 
824  const GlobalPoint EstPosGamGlobalPoint(updatedState.globalPosition().x(),updatedState.globalPosition().y(),updatedState.globalPosition().z());
825  const GlobalVector EstMomGamGlobalVector(updatedState.globalMomentum().x(),updatedState.globalMomentum().y(),updatedState.globalMomentum().z());
826 
827 
829  es.get<IdealMagneticFieldRecord>().get(bfield);
830  const MagneticField* magField = bfield.product();
831  TrackCharge qCharge = 0;
832 
833  const GlobalTrajectoryParameters myGlobalTrajectoryParameter(EstPosGamGlobalPoint, EstMomGamGlobalVector, qCharge, magField);
834 
835  AlgebraicSymMatrix66 aCovarianceMatrix;
836 
837  for (int i =0;i<6;++i)
838  for (int j =0;j<6;++j)
839  aCovarianceMatrix(i, j) = 1e-4;
840 
841  CartesianTrajectoryError myCartesianError (aCovarianceMatrix);
842 
843  const FreeTrajectoryState stateForProjectionToBeamLine(myGlobalTrajectoryParameter,myCartesianError);
844 
845  const GlobalPoint BeamSpotGlobalPoint(0,0,0);
846 
847  const reco::BeamSpot::Point BeamSpotPoint(region.origin().x(),region.origin().y(),region.origin().z());
848 
849  TSCBLBuilderNoMaterial tscblBuilder;
850 
851  double CovMatEntry=0.;
853  for (int i=0;i<3;++i) {
854  cov(i,i) = CovMatEntry;
855  }
857 
858  reco::BeamSpot myBeamSpot(BeamSpotPoint, 0.,0.,0.,0., cov,BeamType_);
859 
860  TrajectoryStateClosestToBeamLine tscbl = tscblBuilder(stateForProjectionToBeamLine,myBeamSpot);
861  if (tscbl.isValid()==false) {
862  zCA=0;
863  }
864  else{
865  GlobalPoint v = tscbl.trackStateAtPCA().position(); // Position of closest approach to BS
866  zCA=v.z();
867  }
868 
869 /* //Calculate dz of point of closest approach of the two lines -> cut on dz
870 
871  double newX,newY,newR;
872  double Rbuff=std::sqrt(EstPosGam.x()*EstPosGam.x()+EstPosGam.y()*EstPosGam.y());
873  double deltas,s,sbuff;
874  double rMin=1e9;
875 
876  double InitXp=EstPosGam.x()+1*EstMomGamNorm.x();
877  double InitXm=EstPosGam.x()-1*EstMomGamNorm.x();
878  double InitYp=EstPosGam.y()+1*EstMomGamNorm.y();
879  double InitYm=EstPosGam.y()-1*EstMomGamNorm.y();
880 
881  if(InitXp*InitXp+InitYp*InitYp < InitXm*InitXm+InitYm*InitYm) {s=5; deltas=5;}
882  else {s=-5; deltas=-5;}
883 
884  int nTurns=0;
885  int nIterZ=0;
886  for (int i_dz=0;i_dz<1000;i_dz++){
887  newX=EstPosGam.x()+s*EstMomGamNorm.x();
888  newY=EstPosGam.y()+s*EstMomGamNorm.y();
889  newR=std::sqrt(newX*newX+newY*newY);
890  if(newR>Rbuff) {deltas=-1*deltas/10;nTurns++;}
891  else {Rbuff=newR;}
892  if(newR<rMin) {rMin=newR; sbuff=s;}
893  s=s+deltas;
894  nIterZ++;
895  if(nTurns>1) break;
896  }
897 
898  zCA=EstPosGam.z()+sbuff*EstMomGamNorm.z();
899 */
900 
901 #ifdef mydebug_knuenz
902  std::cout<< "zCA: " << zCA <<std::endl;
903 #endif
904 
905  if(std::fabs(zCA)>dzcut) return false;
906 
907 
908  }
909 
910 
911  return true;
912 }
913 
914 
915 
918  const TrajectoryStateOnSurface &state) const
919 {
920  //const TransientTrackingRecHit* a= hit.get();
921  //return const_cast<TransientTrackingRecHit*> (a);
922  //This was modified otherwise the rechit will have just the local x component and local y=0
923  // To understand how to modify for pixels
924 
925  //const TSiStripRecHit2DLocalPos* b = dynamic_cast<const TSiStripRecHit2DLocalPos*>(a);
926  //return const_cast<TSiStripRecHit2DLocalPos*>(b);
927  return (SeedingHitSet::RecHitPointer)(cloner(*hit,state));
928 }
929 
930 //
931 // Below: stupid utils method by sguazz
932 //
933 //
936  (*pss) << "\n" << s << "\t";
937  for(size_t i=0;i<2;++i)
938  (*pss) << std::setw (60) << d[i] << std::setw(1) << " | ";
939 }
940 
943  (*pss) << "\n" << s << "\t";
944  for(size_t i=0;i<2;++i)
945  (*pss) << std::setw (60) << d[i] << std::setw(1) << " | ";
946 }
947 
949 stupidPrint(const char* s,GlobalPoint* d){
950  (*pss) << "\n" << s << "\t";
951  for(size_t i=0;i<2;++i)
952  (*pss) << std::setw(20) << d[i] << " r " << d[i].perp() << " phi " << d[i].phi() << " | ";
953 }
954 
956 stupidPrint(const char* s, GlobalPoint* d, int n){
957  (*pss) << "\n" << s << "\n";
958  for(int i=0;i<n;++i)
959  (*pss) << std::setw(20) << d[i] << " r " << d[i].perp() << " phi " << d[i].phi() << "\n";
960 }
961 
963 
966  bool swapped = true;
967  int j = 0;
969  while (swapped) {
970  swapped = false;
971  j++;
972  for (int i = 0; i < n - j; i++) {
973  if ( reco::deltaPhi( (arr[i]-vtx).barePhi(), (arr[i + 1]-vtx).barePhi() ) > 0. ) {
974  tmp = arr[i];
975  arr[i] = arr[i + 1];
976  arr[i + 1] = tmp;
977  swapped = true;
978  }
979  }
980  }
981 }
982 
985  bool swapped = true;
986  int j = 0;
988  while (swapped) {
989  swapped = false;
990  j++;
991  for (int i = 0; i < n - j; i++) {
992  if ( reco::deltaPhi( (arr[i]-vtx).barePhi(), (arr[i + 1]-vtx).barePhi() ) < 0. ) {
993  tmp = arr[i];
994  arr[i] = arr[i + 1];
995  arr[i + 1] = tmp;
996  swapped = true;
997  }
998  }
999  }
1000 }
1001 
1002 
1005 
1006  double x[5], y[5], e2y[5];
1007 
1008  //The fit is done filling x with r values, y with z values of the four hits and the vertex
1009  //
1010  //Hits
1011  x[0] = ohit->globalPosition().perp();
1012  y[0] = ohit->globalPosition().z();
1013  e2y[0] = getSqrEffectiveErrorOnZ(ohit, region);
1014  //
1015  x[1] = nohit->globalPosition().perp();
1016  y[1] = nohit->globalPosition().z();
1017  e2y[1] = getSqrEffectiveErrorOnZ(nohit, region);
1018  //
1019  x[2] = nihit->globalPosition().perp();
1020  y[2] = nihit->globalPosition().z();
1021  e2y[2] = getSqrEffectiveErrorOnZ(nihit, region);
1022  //
1023  x[3] = ihit->globalPosition().perp();
1024  y[3] = ihit->globalPosition().z();
1025  e2y[3] = getSqrEffectiveErrorOnZ(ihit, region);
1026  //
1027  //Vertex
1028  x[4] = region.origin().perp();
1029  y[4] = region.origin().z();
1030  double vError = region.originZBound();
1031  if ( vError > 15. ) vError = 1.;
1032  e2y[4] = sqr(vError);
1033 
1034  double e2z0;
1035  double chi2 = verySimpleFit(5, x, y, e2y, z0, e2z0, cotTheta);
1036 
1037  return chi2;
1038 
1039 }
1040 
1041 double SeedForPhotonConversionFromQuadruplets::verySimpleFit(int size, double* ax, double* ay, double* e2y, double& p0, double& e2p0, double& p1){
1042 
1043  //#include "verySimpleFit.icc"
1044  return 0;
1045 }
1046 
1048 
1049  //
1050  //Fit-wise the effective error on Z is the sum in quadrature of the error on Z
1051  //and the error on R correctly projected by using hit-vertex direction
1052 
1053  double sqrProjFactor = sqr((hit->globalPosition().z()-region.origin().z())/(hit->globalPosition().perp()-region.origin().perp()));
1054  return (hit->globalPositionError().czz()+sqrProjFactor*hit->globalPositionError().rerr(hit->globalPosition()));
1055 
1056 }
1057 
1058 bool SeedForPhotonConversionFromQuadruplets::similarQuadExist(Quad & thisQuad, std::vector<Quad>& quadV){
1059 
1060  BOOST_FOREACH( Quad quad, quadV )
1061  {
1062  double dx = thisQuad.x-quad.x;
1063  double dy = thisQuad.y-quad.y;
1064  //double dz = abs(thisQuad.z-quad.z);
1065  //std::cout<<"thisQuad.x="<<thisQuad.x<<" "<<"quad.x="<<quad.x<<" "<<"thisQuad.y="<<thisQuad.y<<" "<<"quad.y="<<quad.y<<" "<<"thisQuad.z"<<thisQuad.z<<" "<<"quad.z="<<quad.z<<" "<<"thisQuad.ptPlus"<<thisQuad.ptPlus<<" "<<"quad.ptPlus="<<quad.ptPlus<<" "<<"thisQuad.ptMinus="<<thisQuad.ptMinus<<" "<<"quad.ptMinus="<<quad.ptMinus<<" "<<"thisQuad.cot="<<thisQuad.cot<<" "<<"quad.cot="<<quad.cot<<std::endl; //ValDebug
1066  //std::cout<<"x1-x2="<<dx<<"y1-y2="<<dy<<"dx*dx+dy*dy="<<dx*dx+dy*dy<<std::endl; //ValDebug
1067  //std::cout<<"thisQuad.ptPlus-quad.ptPlus="<<thisQuad.ptPlus-quad.ptPlus<<"abs(thisQuad.ptPlus-quad.ptPlus)="<<abs(thisQuad.ptPlus-quad.ptPlus)<<std::endl; //ValDebug
1068  //std::cout <<sqrt(dx*dx+dy*dy)<<" <1? "<<dz<<" <3? "<<abs(thisQuad.ptPlus-quad.ptPlus)<<" <0.5? "<<abs(thisQuad.ptMinus-quad.ptMinus)<<" <0.5? "<<abs(thisQuad.cot-quad.cot)<<" <0.3? "<<std::endl; //ValDebug
1069  //if ( sqrt(dx*dx+dy*dy)<1.)
1070  // std::cout <<sqrt(dx*dx+dy*dy)<<" <1? "<<dz<<" <3? "<<abs(thisQuad.ptPlus-quad.ptPlus)<<" <"<<0.5*quad.ptPlus<<"? "<<abs(thisQuad.ptMinus-quad.ptMinus)<<" <"<<0.5*quad.ptMinus<<"? "<<abs(thisQuad.cot-quad.cot)<<" <"<<0.3*quad.cot<<"? "<<std::endl; //ValDebug
1071  // ( sqrt(dx*dx+dy*dy)<1. &&
1072  //z<3. &&
1073  //bs(thisQuad.ptPlus-quad.ptPlus)<0.5*quad.ptPlus &&
1074  //bs(thisQuad.ptMinus-quad.ptMinus)<0.5*quad.ptMinus &&
1075  //bs(thisQuad.cot-quad.cot)<0.3*quad.cot
1076  //
1077  // {
1078  // //std::cout<<"Seed rejected due to arbitration"<<std::endl;
1079  // return true;
1080  // }
1081  if ( sqrt(dx*dx+dy*dy)<1. &&
1082  fabs(thisQuad.ptPlus-quad.ptPlus)<0.5*quad.ptPlus &&
1083  fabs(thisQuad.ptMinus-quad.ptMinus)<0.5*quad.ptMinus
1084  )
1085  {
1086  //std::cout<<"Seed rejected due to arbitration"<<std::endl;
1087  return true;
1088  }
1089  }
1090  quadV.push_back(thisQuad);
1091  return false;
1092 
1093 }
1094 
1096 
1097  double kTWOPI = 2.*kPI_;
1098  double DeltaPhiMan=v1.Phi()-v2.Phi();
1099  while (DeltaPhiMan >= kPI_) DeltaPhiMan -= kTWOPI;
1100  while (DeltaPhiMan < -kPI_) DeltaPhiMan += kTWOPI;
1101 
1102  return DeltaPhiMan;
1103 
1104 }
float originRBound() const
bounds the particle vertex in the transverse plane
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:31
T getParameter(std::string const &) const
T barePhi() const
BeamType
beam spot flags
Definition: BeamSpot.h:26
tuple propagator
int i
Definition: DBlmapReader.cc:9
CurvilinearTrajectoryError initialError(const GlobalVector &vertexBounds, float ptMin, float sinTheta) const
const TrajectorySeed * trajectorySeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &phits, const SeedingHitSet &mhits, const TrackingRegion &region, const edm::Event &ev, const edm::EventSetup &es, std::stringstream &ss, std::vector< Quad > &quadV, edm::ParameterSet &QuadCutPSet)
bool buildSeedBool(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts, const edm::EventSetup &es, bool apply_dzCut, const TrackingRegion &region, double dzcut) const
tuple cfg
Definition: looper.py:293
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
T perp() const
Definition: PV3DBase.h:72
GlobalPoint const & origin() const
double DeltaPhiManual(const math::XYZVector &v1, const math::XYZVector &v2)
void bubbleReverseSortVsPhi(GlobalPoint arr[], int n, GlobalPoint vtx)
double_binary B
Definition: DDStreamer.cc:248
double ptMinus
Definition: Quad.h:9
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
ROOT::Math::SMatrix< double, 6, 6, ROOT::Math::MatRepSym< double, 6 > > AlgebraicSymMatrix66
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
BaseTrackerRecHit const * hit() const final
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:29
bool ev
double ptPlus
Definition: Quad.h:8
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
void bubbleSortVsPhi(GlobalPoint arr[], int n, GlobalPoint vtx)
int ConversionCandidate(math::XYZVector &, double &, double &)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
tuple d
Definition: ztail.py:151
int TrackCharge
Definition: TrackCharge.h:4
void push_back(D *&d)
Definition: OwnVector.h:290
double simpleGetSlope(const SeedingHitSet::ConstRecHitPointer &ohit, const SeedingHitSet::ConstRecHitPointer &nohit, const SeedingHitSet::ConstRecHitPointer &ihit, const SeedingHitSet::ConstRecHitPointer &nihit, const TrackingRegion &region, double &cotTheta, double &z0)
BaseTrackerRecHit const * ConstRecHitPointer
Definition: SeedingHitSet.h:11
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
Definition: KFUpdator.cc:75
GlobalTrajectoryParameters initialKinematic(const SeedingHitSet &hits, const GlobalPoint &vertexPos, const edm::EventSetup &es, const float cotTheta) const
double verySimpleFit(int size, double *ax, double *ay, double *e2y, double &p0, double &e2p0, double &p1)
std::vector< TrajectorySeed > TrajectorySeedCollection
void SetMaxNumberOfIterations(int val)
double x
Definition: Quad.h:5
T sqrt(T t)
Definition: SSEVec.h:18
tuple TTRHBuilder
Definition: HLT_FULL_cff.py:45
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
tuple IP
Definition: listHistos.py:76
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
void print(std::stringstream &ss, const SiStripCluster &clus)
bool checkHit(const TrajectoryStateOnSurface &, const SeedingHitSet::ConstRecHitPointer &hit, const edm::EventSetup &es) const
const TrajectorySeed * buildSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts, const edm::EventSetup &es, bool apply_dzCut, const TrackingRegion &region) const
float originZBound() const
bounds the particle vertex in the longitudinal plane
virtual TrackingRecHit * clone() const =0
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:22
Vector3DBase unit() const
Definition: Vector3DBase.h:57
GlobalPoint position() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
float ptMin() const
minimal pt of interest
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
Definition: Propagator.h:53
double y
Definition: Quad.h:6
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double ptmin
Definition: HydjetWrapper.h:90
tuple SeedComparitorPSet
double p1[4]
Definition: TauolaWrapper.h:89
GlobalVector globalMomentum() const
double getSqrEffectiveErrorOnZ(const SeedingHitSet::ConstRecHitPointer &hit, const TrackingRegion &region)
Square< F >::type sqr(const F &f)
Definition: Square.h:13
bool similarQuadExist(Quad &thisQuad, std::vector< Quad > &quadV)
unsigned int size() const
Definition: SeedingHitSet.h:46
const MagneticField & magneticField() const
tuple cout
Definition: gather_cfg.py:145
DetId geographicalId() const
SeedingHitSet::RecHitPointer refitHit(SeedingHitSet::ConstRecHitPointer hit, const TrajectoryStateOnSurface &state) const
Definition: Quad.h:4
long double T
T x() const
Definition: PV3DBase.h:62
virtual LocalPoint localPosition() const =0
tuple size
Write out results.
virtual LocalPoint localPosition() const final
T get(const Candidate &c)
Definition: component.h:55
Global3DVector GlobalVector
Definition: GlobalVector.h:10
SeedForPhotonConversionFromQuadruplets(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC, const edm::ParameterSet &SeedComparitorPSet)