CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
SeedForPhotonConversionFromQuadruplets Class Reference

#include <SeedForPhotonConversionFromQuadruplets.h>

Inheritance diagram for SeedForPhotonConversionFromQuadruplets:
SeedCreator

Public Member Functions

void bubbleReverseSortVsPhi (GlobalPoint arr[], int n, GlobalPoint vtx)
 
void bubbleSortVsPhi (GlobalPoint arr[], int n, GlobalPoint vtx)
 
double getSqrEffectiveErrorOnZ (const TransientTrackingRecHit::ConstRecHitPointer &hit, const TrackingRegion &region)
 
 SeedForPhotonConversionFromQuadruplets (const edm::ParameterSet &cfg)
 
 SeedForPhotonConversionFromQuadruplets (const std::string &propagator="PropagatorWithMaterial", double seedMomentumForBOFF=-5.0)
 
double simpleGetSlope (const TransientTrackingRecHit::ConstRecHitPointer &ohit, const TransientTrackingRecHit::ConstRecHitPointer &nohit, const TransientTrackingRecHit::ConstRecHitPointer &ihit, const TransientTrackingRecHit::ConstRecHitPointer &nihit, const TrackingRegion &region, double &cotTheta, double &z0)
 
void stupidPrint (std::string s, float *d)
 
void stupidPrint (std::string s, double *d)
 
void stupidPrint (const char *s, GlobalPoint *d)
 
void stupidPrint (const char *s, GlobalPoint *d, int n)
 
virtual const TrajectorySeedtrajectorySeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &phits, const SeedingHitSet &mhits, const TrackingRegion &region, const edm::EventSetup &es, std::stringstream &ss, std::vector< Quad > &quadV)
 
virtual const TrajectorySeedtrajectorySeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const TrackingRegion &region, const edm::EventSetup &es, const SeedComparitor *filter)
 
double verySimpleFit (int size, double *ax, double *ay, double *e2y, double &p0, double &e2p0, double &p1)
 
virtual ~SeedForPhotonConversionFromQuadruplets ()
 
- Public Member Functions inherited from SeedCreator
virtual ~SeedCreator ()
 

Static Public Attributes

static const int cotTheta_Max =99999
 

Protected Member Functions

virtual const TrajectorySeedbuildSeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts, const edm::EventSetup &es) const
 
virtual bool checkHit (const TrajectoryStateOnSurface &, const TransientTrackingRecHit::ConstRecHitPointer &hit, const edm::EventSetup &es) const
 
virtual CurvilinearTrajectoryError initialError (const GlobalVector &vertexBounds, float ptMin, float sinTheta) const
 
virtual GlobalTrajectoryParameters initialKinematic (const SeedingHitSet &hits, const GlobalPoint &vertexPos, const edm::EventSetup &es, const float cotTheta) const
 
virtual
TransientTrackingRecHit::RecHitPointer 
refitHit (const TransientTrackingRecHit::ConstRecHitPointer &hit, const TrajectoryStateOnSurface &state) const
 
bool similarQuadExist (Quad &thisQuad, std::vector< Quad > &quadV)
 

Protected Attributes

PrintRecoObjects po
 
std::stringstream * pss
 
double theBOFFMomentum
 
std::string thePropagatorLabel
 

Detailed Description

Definition at line 11 of file SeedForPhotonConversionFromQuadruplets.h.

Constructor & Destructor Documentation

SeedForPhotonConversionFromQuadruplets::SeedForPhotonConversionFromQuadruplets ( const edm::ParameterSet cfg)
inline

Definition at line 15 of file SeedForPhotonConversionFromQuadruplets.h.

15  :
16  thePropagatorLabel(cfg.getParameter<std::string>("propagator")),
17  theBOFFMomentum(cfg.existsAs<double>("SeedMomentumForBOFF") ? cfg.getParameter<double>("SeedMomentumForBOFF") : 5.0)
18  {}
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:187
SeedForPhotonConversionFromQuadruplets::SeedForPhotonConversionFromQuadruplets ( const std::string &  propagator = "PropagatorWithMaterial",
double  seedMomentumForBOFF = -5.0 
)
inline
virtual SeedForPhotonConversionFromQuadruplets::~SeedForPhotonConversionFromQuadruplets ( )
inlinevirtual

Definition at line 25 of file SeedForPhotonConversionFromQuadruplets.h.

25 {}

Member Function Documentation

void SeedForPhotonConversionFromQuadruplets::bubbleReverseSortVsPhi ( GlobalPoint  arr[],
int  n,
GlobalPoint  vtx 
)

Definition at line 429 of file SeedForPhotonConversionFromQuadruplets.cc.

References reco::deltaPhi(), i, j, phi, and tmp.

429  {
430  bool swapped = true;
431  int j = 0;
433  while (swapped) {
434  swapped = false;
435  j++;
436  for (int i = 0; i < n - j; i++) {
437  if ( reco::deltaPhi( (arr[i]-vtx).phi(), (arr[i + 1]-vtx).phi() ) < 0. ) {
438  tmp = arr[i];
439  arr[i] = arr[i + 1];
440  arr[i + 1] = tmp;
441  swapped = true;
442  }
443  }
444  }
445 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
Definition: DDAxes.h:10
void SeedForPhotonConversionFromQuadruplets::bubbleSortVsPhi ( GlobalPoint  arr[],
int  n,
GlobalPoint  vtx 
)

Definition at line 410 of file SeedForPhotonConversionFromQuadruplets.cc.

References reco::deltaPhi(), i, j, phi, and tmp.

410  {
411  bool swapped = true;
412  int j = 0;
414  while (swapped) {
415  swapped = false;
416  j++;
417  for (int i = 0; i < n - j; i++) {
418  if ( reco::deltaPhi( (arr[i]-vtx).phi(), (arr[i + 1]-vtx).phi() ) > 0. ) {
419  tmp = arr[i];
420  arr[i] = arr[i + 1];
421  arr[i + 1] = tmp;
422  swapped = true;
423  }
424  }
425  }
426 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
Definition: DDAxes.h:10
const TrajectorySeed * SeedForPhotonConversionFromQuadruplets::buildSeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits,
const FreeTrajectoryState fts,
const edm::EventSetup es 
) const
protectedvirtual

Definition at line 302 of file SeedForPhotonConversionFromQuadruplets.cc.

References alongMomentum, checkHit(), cond::rpcobgas::detid, TrackingRecHit::geographicalId(), edm::EventSetup::get(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::isValid(), TrackingRecHit::localPosition(), PV3DBase< T, PVType, FrameType >::perp(), trajectoryStateTransform::persistentState(), po, PrintRecoObjects::print(), Propagator::propagate(), LargeD0_PixelPairStep_cff::propagator, edm::OwnVector< T, P >::push_back(), DetId::rawId(), refitHit(), SeedingHitSet::size(), evf::utils::state, thePropagatorLabel, patCandidatesForDimuonsSequences_cff::tracker, and KFUpdator::update().

Referenced by trajectorySeed().

307 {
308  // get tracker
310  es.get<TrackerDigiGeometryRecord>().get(tracker);
311 
312  // get propagator
313  edm::ESHandle<Propagator> propagatorHandle;
314  es.get<TrackingComponentsRecord>().get(thePropagatorLabel, propagatorHandle);
315  const Propagator* propagator = &(*propagatorHandle);
316 
317  // get updator
318  KFUpdator updator;
319 
320  // Now update initial state track using information from seed hits.
321 
322  TrajectoryStateOnSurface updatedState;
324 
325  const TrackingRecHit* hit = 0;
326  for ( unsigned int iHit = 0; iHit < hits.size() && iHit<1; iHit++) {
327  hit = hits[iHit]->hit();
328  TrajectoryStateOnSurface state = (iHit==0) ?
329  propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface())
330  : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
331  if (!state.isValid()) return 0;
332 
334 
335  TransientTrackingRecHit::RecHitPointer newtth = refitHit( tth, state);
336 
337 
338  if (!checkHit(state,newtth,es)) return 0;
339 
340  updatedState = updator.update(state, *newtth);
341  if (!updatedState.isValid()) return 0;
342 
343  seedHits.push_back(newtth->hit()->clone());
344 #ifdef mydebug_seed
345  uint32_t detid = hit->geographicalId().rawId();
346  (*pss) << "\n[SeedForPhotonConversionFromQuadruplets] hit " << iHit;
347  po.print(*pss, detid);
348  (*pss) << " " << detid << "\t lp " << hit->localPosition()
349  << " tth " << tth->localPosition() << " newtth " << newtth->localPosition() << " state " << state.globalMomentum().perp();
350 #endif
351  }
352 
353 
354  PTrajectoryStateOnDet const & PTraj =
356 
357  seedCollection.push_back( TrajectorySeed(PTraj,seedHits,alongMomentum));
358  return &seedCollection.back();
359 }
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
T perp() const
Definition: PV3DBase.h:71
PTrajectoryStateOnDet persistentState(const TrajectoryStateOnSurface &ts, unsigned int detid)
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
void push_back(D *&d)
Definition: OwnVector.h:273
void print(std::stringstream &ss, const SiStripCluster &clus)
virtual TransientTrackingRecHit::RecHitPointer refitHit(const TransientTrackingRecHit::ConstRecHitPointer &hit, const TrajectoryStateOnSurface &state) const
virtual bool checkHit(const TrajectoryStateOnSurface &, const TransientTrackingRecHit::ConstRecHitPointer &hit, const edm::EventSetup &es) const
virtual TrajectoryStateOnSurface propagate(const FreeTrajectoryState &, const Surface &) const
Definition: Propagator.cc:12
const T & get() const
Definition: EventSetup.h:55
char state
Definition: procUtils.cc:75
GlobalVector globalMomentum() const
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
Definition: KFUpdator.cc:10
unsigned int size() const
Definition: SeedingHitSet.h:31
DetId geographicalId() const
virtual LocalPoint localPosition() const =0
virtual bool SeedForPhotonConversionFromQuadruplets::checkHit ( const TrajectoryStateOnSurface ,
const TransientTrackingRecHit::ConstRecHitPointer hit,
const edm::EventSetup es 
) const
inlineprotectedvirtual

Definition at line 61 of file SeedForPhotonConversionFromQuadruplets.h.

Referenced by buildSeed().

64  { return true; }
double SeedForPhotonConversionFromQuadruplets::getSqrEffectiveErrorOnZ ( const TransientTrackingRecHit::ConstRecHitPointer hit,
const TrackingRegion region 
)

Definition at line 492 of file SeedForPhotonConversionFromQuadruplets.cc.

References TrackingRegion::origin(), PV3DBase< T, PVType, FrameType >::perp(), funct::sqr(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by simpleGetSlope(), and trajectorySeed().

492  {
493 
494  //
495  //Fit-wise the effective error on Z is the sum in quadrature of the error on Z
496  //and the error on R correctly projected by using hit-vertex direction
497 
498  double sqrProjFactor = sqr((hit->globalPosition().z()-region.origin().z())/(hit->globalPosition().perp()-region.origin().perp()));
499  return (hit->globalPositionError().czz()+sqrProjFactor*hit->globalPositionError().rerr(hit->globalPosition()));
500 
501 }
T perp() const
Definition: PV3DBase.h:71
virtual GlobalPoint origin() const =0
T z() const
Definition: PV3DBase.h:63
Square< F >::type sqr(const F &f)
Definition: Square.h:13
CurvilinearTrajectoryError SeedForPhotonConversionFromQuadruplets::initialError ( const GlobalVector vertexBounds,
float  ptMin,
float  sinTheta 
) const
protectedvirtual

Definition at line 273 of file SeedForPhotonConversionFromQuadruplets.cc.

References funct::C, GlobalErrorBase< T, ErrorWeightType >::cxx(), GlobalErrorBase< T, ErrorWeightType >::czz(), max(), funct::sqr(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by trajectorySeed().

277 {
278  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
279  // information.
280  GlobalError vertexErr( sqr(vertexBounds.x()), 0,
281  sqr(vertexBounds.y()), 0, 0,
282  sqr(vertexBounds.z())
283  );
284 
285 
286  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();
287 
288 // FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small,
289 // to avoid instabilities.
290 // N.B. This parameter needs optimising ...
291  float sin2th = sqr(sinTheta);
292  float minC00 = 1.0;
293  C[0][0] = std::max(sin2th/sqr(ptMin), minC00);
294  float zErr = vertexErr.czz();
295  float transverseErr = vertexErr.cxx(); // assume equal cxx cyy
296  C[3][3] = transverseErr;
297  C[4][4] = zErr*sin2th + transverseErr*(1-sin2th);
298 
299  return CurvilinearTrajectoryError(C);
300 }
T y() const
Definition: PV3DBase.h:62
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
const T & max(const T &a, const T &b)
T z() const
Definition: PV3DBase.h:63
Square< F >::type sqr(const F &f)
Definition: Square.h:13
T x() const
Definition: PV3DBase.h:61
GlobalTrajectoryParameters SeedForPhotonConversionFromQuadruplets::initialKinematic ( const SeedingHitSet hits,
const GlobalPoint vertexPos,
const edm::EventSetup es,
const float  cotTheta 
) const
protectedvirtual

Definition at line 216 of file SeedForPhotonConversionFromQuadruplets.cc.

References abs, GlobalTrajectoryParameters::charge(), cotTheta_Max, cond::rpcobgas::detid, alignCSCRings::e, GlobalTrajectoryParameters::magneticField(), GlobalTrajectoryParameters::momentum(), PV3DBase< T, PVType, FrameType >::perp(), po, GlobalTrajectoryParameters::position(), PrintRecoObjects::print(), theBOFFMomentum, GlobalTrajectoryParameters::transverseCurvature(), Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

221 {
223 
226 
227 
228  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, es, vertexPos);
229  kine = helix.stateAtVertex().parameters();
230 
231  //force the pz/pt equal to the measured one
232  if(fabs(cotTheta)<cotTheta_Max)
233  kine = GlobalTrajectoryParameters(kine.position(),
234  GlobalVector(kine.momentum().x(),kine.momentum().y(),kine.momentum().perp()*cotTheta),
235  kine.charge(),
236  & kine.magneticField()
237  );
238  else
239  kine = GlobalTrajectoryParameters(kine.position(),
240  GlobalVector(kine.momentum().x(),kine.momentum().y(),kine.momentum().perp()*cotTheta_Max),
241  kine.charge(),
242  & kine.magneticField()
243  );
244 
245 #ifdef mydebug_seed
246  uint32_t detid;
247  (*pss) << "[SeedForPhotonConversionFromQuadruplets] initialKinematic tth1 " ;
248  detid=tth1->geographicalId().rawId();
249  po.print(*pss, detid );
250  (*pss) << " \t " << detid << " " << tth1->localPosition() << " " << tth1->globalPosition() ;
251  detid= tth2->geographicalId().rawId();
252  (*pss) << " \n\t tth2 ";
253  po.print(*pss, detid );
254  (*pss) << " \t " << detid << " " << tth2->localPosition() << " " << tth2->globalPosition()
255  << "\nhelix momentum " << kine.momentum() << " pt " << kine.momentum().perp() << " radius " << 1/kine.transverseCurvature();
256 #endif
257 
259  es.get<IdealMagneticFieldRecord>().get(bfield);
260  bool isBOFF = ( std::abs(bfield->inTesla(GlobalPoint(0,0,0)).z()) < 1e-3 );
261  if (isBOFF && (theBOFFMomentum > 0)) {
262  kine = GlobalTrajectoryParameters(kine.position(),
263  kine.momentum().unit() * theBOFFMomentum,
264  kine.charge(),
265  &*bfield);
266  }
267  return kine;
268 }
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
T perp() const
Definition: PV3DBase.h:71
T y() const
Definition: PV3DBase.h:62
#define abs(x)
Definition: mlp_lapack.h:159
void print(std::stringstream &ss, const SiStripCluster &clus)
Vector3DBase unit() const
Definition: Vector3DBase.h:57
const MagneticField & magneticField() const
T x() const
Definition: PV3DBase.h:61
Global3DVector GlobalVector
Definition: GlobalVector.h:10
TransientTrackingRecHit::RecHitPointer SeedForPhotonConversionFromQuadruplets::refitHit ( const TransientTrackingRecHit::ConstRecHitPointer hit,
const TrajectoryStateOnSurface state 
) const
protectedvirtual

Definition at line 361 of file SeedForPhotonConversionFromQuadruplets.cc.

Referenced by buildSeed().

364 {
365  //const TransientTrackingRecHit* a= hit.get();
366  //return const_cast<TransientTrackingRecHit*> (a);
367  //This was modified otherwise the rechit will have just the local x component and local y=0
368  // To understand how to modify for pixels
369 
370  //const TSiStripRecHit2DLocalPos* b = dynamic_cast<const TSiStripRecHit2DLocalPos*>(a);
371  //return const_cast<TSiStripRecHit2DLocalPos*>(b);
372  return hit->clone(state);
373 }
bool SeedForPhotonConversionFromQuadruplets::similarQuadExist ( Quad thisQuad,
std::vector< Quad > &  quadV 
)
protected

Definition at line 503 of file SeedForPhotonConversionFromQuadruplets.cc.

References abs, Quad::cot, Quad::ptMinus, Quad::ptPlus, mathSSE::sqrt(), Quad::x, Quad::y, and Quad::z.

Referenced by trajectorySeed().

503  {
504 
505  BOOST_FOREACH( Quad quad, quadV )
506  {
507  double dx = thisQuad.x-quad.x;
508  double dy = thisQuad.y-quad.y;
509  double dz = abs(thisQuad.z-quad.z);
510  if ( sqrt(dx*dx+dy*dy)<1. &&
511  dz<3. &&
512  abs(thisQuad.ptPlus-quad.ptPlus)<0.5*quad.ptPlus &&
513  abs(thisQuad.ptMinus-quad.ptMinus)<0.5*quad.ptMinus &&
514  abs(thisQuad.cot-quad.cot)<0.3*quad.cot
515  ) return true;
516  }
517 
518  quadV.push_back(thisQuad);
519  return false;
520 
521 }
double ptMinus
Definition: Quad.h:9
#define abs(x)
Definition: mlp_lapack.h:159
double ptPlus
Definition: Quad.h:8
double cot
Definition: Quad.h:10
double x
Definition: Quad.h:5
T sqrt(T t)
Definition: SSEVec.h:46
double z
Definition: Quad.h:7
double y
Definition: Quad.h:6
Definition: Quad.h:4
double SeedForPhotonConversionFromQuadruplets::simpleGetSlope ( const TransientTrackingRecHit::ConstRecHitPointer ohit,
const TransientTrackingRecHit::ConstRecHitPointer nohit,
const TransientTrackingRecHit::ConstRecHitPointer ihit,
const TransientTrackingRecHit::ConstRecHitPointer nihit,
const TrackingRegion region,
double &  cotTheta,
double &  z0 
)

Definition at line 449 of file SeedForPhotonConversionFromQuadruplets.cc.

References getSqrEffectiveErrorOnZ(), TrackingRegion::origin(), TrackingRegion::originZBound(), PV3DBase< T, PVType, FrameType >::perp(), funct::sqr(), verySimpleFit(), x, detailsBasic3DVector::y, and PV3DBase< T, PVType, FrameType >::z().

Referenced by trajectorySeed().

449  {
450 
451  double x[5], y[5], e2y[5];
452 
453  //The fit is done filling x with r values, y with z values of the four hits and the vertex
454  //
455  //Hits
456  x[0] = ohit->globalPosition().perp();
457  y[0] = ohit->globalPosition().z();
458  e2y[0] = getSqrEffectiveErrorOnZ(ohit, region);
459  //
460  x[1] = nohit->globalPosition().perp();
461  y[1] = nohit->globalPosition().z();
462  e2y[1] = getSqrEffectiveErrorOnZ(nohit, region);
463  //
464  x[2] = nihit->globalPosition().perp();
465  y[2] = nihit->globalPosition().z();
466  e2y[2] = getSqrEffectiveErrorOnZ(nihit, region);
467  //
468  x[3] = ihit->globalPosition().perp();
469  y[3] = ihit->globalPosition().z();
470  e2y[3] = getSqrEffectiveErrorOnZ(ihit, region);
471  //
472  //Vertex
473  x[4] = region.origin().perp();
474  y[4] = region.origin().z();
475  double vError = region.originZBound();
476  if ( vError > 15. ) vError = 1.;
477  e2y[4] = sqr(vError);
478 
479  double e2z0;
480  double chi2 = verySimpleFit(5, x, y, e2y, z0, e2z0, cotTheta);
481 
482  return chi2;
483 
484 }
T perp() const
Definition: PV3DBase.h:71
virtual GlobalPoint origin() const =0
double getSqrEffectiveErrorOnZ(const TransientTrackingRecHit::ConstRecHitPointer &hit, const TrackingRegion &region)
double verySimpleFit(int size, double *ax, double *ay, double *e2y, double &p0, double &e2p0, double &p1)
T z() const
Definition: PV3DBase.h:63
virtual float originZBound() const =0
bounds the particle vertex in the longitudinal plane
Square< F >::type sqr(const F &f)
Definition: Square.h:13
Definition: DDAxes.h:10
void SeedForPhotonConversionFromQuadruplets::stupidPrint ( std::string  s,
float *  d 
)

Definition at line 380 of file SeedForPhotonConversionFromQuadruplets.cc.

References i.

380  {
381  (*pss) << "\n" << s << "\t";
382  for(size_t i=0;i<2;++i)
383  (*pss) << std::setw (60) << d[i] << std::setw(1) << " | ";
384 }
int i
Definition: DBlmapReader.cc:9
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
void SeedForPhotonConversionFromQuadruplets::stupidPrint ( std::string  s,
double *  d 
)

Definition at line 387 of file SeedForPhotonConversionFromQuadruplets.cc.

References i.

387  {
388  (*pss) << "\n" << s << "\t";
389  for(size_t i=0;i<2;++i)
390  (*pss) << std::setw (60) << d[i] << std::setw(1) << " | ";
391 }
int i
Definition: DBlmapReader.cc:9
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
void SeedForPhotonConversionFromQuadruplets::stupidPrint ( const char *  s,
GlobalPoint d 
)

Definition at line 394 of file SeedForPhotonConversionFromQuadruplets.cc.

References i, PV3DBase< T, PVType, FrameType >::perp(), and PV3DBase< T, PVType, FrameType >::phi().

394  {
395  (*pss) << "\n" << s << "\t";
396  for(size_t i=0;i<2;++i)
397  (*pss) << std::setw(20) << d[i] << " r " << d[i].perp() << " phi " << d[i].phi() << " | ";
398 }
int i
Definition: DBlmapReader.cc:9
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
T perp() const
Definition: PV3DBase.h:71
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
void SeedForPhotonConversionFromQuadruplets::stupidPrint ( const char *  s,
GlobalPoint d,
int  n 
)

Definition at line 401 of file SeedForPhotonConversionFromQuadruplets.cc.

References i, n, PV3DBase< T, PVType, FrameType >::perp(), and PV3DBase< T, PVType, FrameType >::phi().

401  {
402  (*pss) << "\n" << s << "\n";
403  for(int i=0;i<n;++i)
404  (*pss) << std::setw(20) << d[i] << " r " << d[i].perp() << " phi " << d[i].phi() << "\n";
405 }
int i
Definition: DBlmapReader.cc:9
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
T perp() const
Definition: PV3DBase.h:71
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
const TrajectorySeed * SeedForPhotonConversionFromQuadruplets::trajectorySeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet phits,
const SeedingHitSet mhits,
const TrackingRegion region,
const edm::EventSetup es,
std::stringstream &  ss,
std::vector< Quad > &  quadV 
)
virtual

Definition at line 26 of file SeedForPhotonConversionFromQuadruplets.cc.

References abs, buildSeed(), Conv4HitsReco::ConversionCandidate(), funct::cos(), gather_cfg::cout, cond::rpcobgas::detid, Conv4HitsReco::Dump(), Conv4HitsReco::GetMinusCenter(), Conv4HitsReco::GetPlusCenter(), getSqrEffectiveErrorOnZ(), initialError(), TrackingRegion::origin(), TrackingRegion::originRBound(), TrackingRegion::originZBound(), colinearityKinematic::Phi, TrackingRegion::ptMin(), ptmin, Conv4HitsReco::SetMaxNumberOfIterations(), similarQuadExist(), simpleGetSlope(), funct::sin(), SeedingHitSet::size(), mathSSE::sqrt(), Quad::x, x, PV3DBase< T, PVType, FrameType >::x(), detailsBasic3DVector::y, PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by PhotonConversionTrajectorySeedProducerFromQuadrupletsAlgo::inspect().

34 {
35 
36  // return 0; //FIXME, remove this line to make the code working.
37 
38  pss = &ss;
39 
40  if ( phits.size() < 2) return 0;
41  if ( mhits.size() < 2) return 0;
42 
43  //PUT HERE THE QUADRUPLET ALGORITHM, AND IN CASE USE THE METHODS ALREADY DEVELOPED, ADAPTING THEM
44 
45  //
46  // Rozzo ma efficace (per ora)
47  //
48 
49 #ifdef mydebug_sguazz
50  std::cout << " --------------------------------------------------------------------------" << "\n";
51  std::cout << " Starting a hit quad fast reco " << "\n";
52  std::cout << " --------------------------------------------------------------------------" << "\n";
53 #endif
54 
55  //
56  // Let's build the 4 hits
61 
62  GlobalPoint vHit[4];
63  vHit[0]=ptth2->globalPosition();
64  vHit[1]=ptth1->globalPosition();
65  vHit[2]=mtth1->globalPosition();
66  vHit[3]=mtth2->globalPosition();
67  //double zErr2[4];
68  //zErr2[0]=ptth2->globalPositionError().czz();
69  //zErr2[1]=ptth1->globalPositionError().czz();
70  //zErr2[2]=mtth1->globalPositionError().czz();
71  //zErr2[3]=mtth2->globalPositionError().czz();
72  //double perpErr2[4];
73  //perpErr2[0]=ptth2->globalPositionError().rerr(ptth2->globalPosition());
74  //perpErr2[1]=ptth1->globalPositionError().rerr(ptth1->globalPosition());
75  //perpErr2[2]=mtth1->globalPositionError().rerr(mtth1->globalPosition());
76  //perpErr2[3]=mtth2->globalPositionError().rerr(mtth2->globalPosition());
77 
78  //Photon source vertex primary vertex
79  GlobalPoint vgPhotVertex=region.origin();
80  TVector3 vPhotVertex(vgPhotVertex.x(), vgPhotVertex.y(), vgPhotVertex.z());
81 
82  TVector3 h1(vHit[0].x(),vHit[0].y(),vHit[0].z());
83  TVector3 h2(vHit[1].x(),vHit[1].y(),vHit[1].z());
84  TVector3 h3(vHit[2].x(),vHit[2].y(),vHit[2].z());
85  TVector3 h4(vHit[3].x(),vHit[3].y(),vHit[3].z());
86 
87  Conv4HitsReco quad(vPhotVertex, h1, h2, h3, h4);
88  quad.SetMaxNumberOfIterations(100);
89 #ifdef mydebug_sguazz
90  quad.Dump();
91 #endif
92  TVector3 candVtx;
93  double candPtPlus, candPtMinus;
94  // double truePtPlus, truePtMinus;
95  double rPlus, rMinus;
96  int nite = quad.ConversionCandidate(candVtx, candPtPlus, candPtMinus);
97 
98  if ( ! (nite && abs(nite) < 25 && nite != -1000 && nite != -2000) ) return 0;
99 
100  TVector3 plusCenter = quad.GetPlusCenter(rPlus);
101  TVector3 minusCenter = quad.GetMinusCenter(rMinus);
102 
103 #ifdef mydebug_sguazz
104  std::cout << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << "\n";
105  std::cout << " >>>>>>>>>>> Conv Cand: " << " Vertex X: " << candVtx.X() << " [cm] Y: " << candVtx.Y() << " [cm] pt+: " << candPtPlus<< " [GeV] pt-: " << candPtMinus << " [GeV]; #its: " << nite << "\n";
106 #endif
107 
108 
109 
110  //Do a very simple fit to estimate the slope
111  double quadPhotCotTheta = 0.;
112  double quadZ0 = 0.;
113  simpleGetSlope(ptth2, ptth1, mtth1, mtth2, region, quadPhotCotTheta, quadZ0);
114 
115 
116  double quadPhotPhi = (candVtx-vPhotVertex).Phi();
117 
118  TVector3 fittedPrimaryVertex(vgPhotVertex.x(), vgPhotVertex.y(),quadZ0);
119 
120  candVtx.SetZ(candVtx.Perp()*quadPhotCotTheta+quadZ0);
121  GlobalPoint convVtxGlobalPoint(candVtx.X(),candVtx.Y(),candVtx.Z());
122 
123  //
124  // Comparing new quad with old quad
125  //
126  //Arbitration
127  Quad thisQuad;
128  thisQuad.x = candVtx.X();
129  thisQuad.y = candVtx.Y();
130  thisQuad.z = candVtx.Z();
131  thisQuad.ptPlus = candPtPlus;
132  thisQuad.ptMinus = candPtMinus;
133  thisQuad.cot = quadPhotCotTheta;
134  if ( similarQuadExist(thisQuad, quadV) ) return 0;
135 
136  // not able to get the mag field... doing the dirty way
137  //
138  // Plus
139  FastHelix helixPlus(ptth2->globalPosition(), ptth1->globalPosition(), convVtxGlobalPoint, es, convVtxGlobalPoint);
140  GlobalTrajectoryParameters kinePlus = helixPlus.stateAtVertex().parameters();
141  kinePlus = GlobalTrajectoryParameters(convVtxGlobalPoint,
142  GlobalVector(candPtPlus*cos(quadPhotPhi),candPtPlus*sin(quadPhotPhi),candPtPlus*quadPhotCotTheta),
143  1,
144  & kinePlus.magneticField()
145  );
146 
147  //
148  // Minus
149  FastHelix helixMinus(mtth2->globalPosition(), mtth1->globalPosition(), convVtxGlobalPoint, es, convVtxGlobalPoint);
150  GlobalTrajectoryParameters kineMinus = helixMinus.stateAtVertex().parameters();
151  kineMinus = GlobalTrajectoryParameters(convVtxGlobalPoint,
152  GlobalVector(candPtMinus*cos(quadPhotPhi),candPtMinus*sin(quadPhotPhi),candPtMinus*quadPhotCotTheta),
153  -1,
154  & kineMinus.magneticField()
155  );
156 
157  float sinThetaPlus = sin(kinePlus.momentum().theta());
158  float sinThetaMinus = sin(kineMinus.momentum().theta());
159  float ptmin = region.ptMin();
160  //vertexBounds da region
161  GlobalVector vertexBounds(region.originRBound(),region.originRBound(),region.originZBound());
162 
163  CurvilinearTrajectoryError errorPlus = initialError(vertexBounds, ptmin, sinThetaPlus);
164  CurvilinearTrajectoryError errorMinus = initialError(vertexBounds, ptmin, sinThetaMinus);
165  FreeTrajectoryState ftsPlus(kinePlus, errorPlus);
166  FreeTrajectoryState ftsMinus(kineMinus, errorMinus);
167 
168  //FIXME: here probably you want to go in parallel with phits and mhits
169  //NB: the seedCollection is filled (the important thing) the return of the last TrajectorySeed is not used, but is needed
170  //to maintain the inheritance
171 
172 #ifdef quadDispLine
173  double vError = region.originZBound();
174  if ( vError > 15. ) vError = 1.;
175  std::cout << "QuadDispLine "
176  << vgPhotVertex.x() << " " << vgPhotVertex.y() << " " << vgPhotVertex.z() << " " << vError << " "
177  << vHit[0].x() << " " << vHit[0].y() << " " << vHit[0].z() << " " << sqrt(getSqrEffectiveErrorOnZ(ptth2, region)) << " "
178  << vHit[1].x() << " " << vHit[1].y() << " " << vHit[1].z() << " " << sqrt(getSqrEffectiveErrorOnZ(ptth1, region)) << " "
179  << vHit[2].x() << " " << vHit[2].y() << " " << vHit[2].z() << " " << sqrt(getSqrEffectiveErrorOnZ(mtth1, region)) << " "
180  << vHit[3].x() << " " << vHit[3].y() << " " << vHit[3].z() << " " << sqrt(getSqrEffectiveErrorOnZ(mtth2, region)) << " "
181  << candVtx.X() << " " << candVtx.Y() << " " << candVtx.Z() << " "
182  << fittedPrimaryVertex.X() << " " << fittedPrimaryVertex.Y() << " " << fittedPrimaryVertex.Z() << " "
183  << candPtPlus << " " << rPlus << " " << plusCenter.X() << " " << plusCenter.Y() << " "
184  << candPtMinus << " " << rMinus << " " << minusCenter.X() << " " << minusCenter.Y() << " "
185  << nite << " " << chi2 << "\n";
186 #endif
187 #ifdef mydebug_sguazz
188  std::cout << " >>>>> Hit quad fast reco done >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << "\n";
189  uint32_t detid;
190  std::cout << "[SeedForPhotonConversionFromQuadruplets]\n ptth1 " ;
191  detid=ptth1->geographicalId().rawId();
192  // po.print(std::cout , detid );
193  std::cout << " \t " << detid << " " << ptth1->localPosition() << " " << ptth1->globalPosition() ;
194  detid=ptth2->geographicalId().rawId();
195  std::cout << " \n\t ptth2 ";
196  // po.print(std::cout , detid );
197  std::cout << " \t " << detid << " " << ptth2->localPosition() << " " << ptth2->globalPosition()
198  << "\nhelix momentum " << kinePlus.momentum() << " pt " << kinePlus.momentum().perp() << " radius " << 1/kinePlus.transverseCurvature() << " q " << kinePlus.charge();
199  std::cout << " \n\t mtth1 ";
200  detid=mtth1->geographicalId().rawId();
201  std::cout << " \t " << detid << " " << mtth1->localPosition() << " " << mtth1->globalPosition() ;
202  std::cout << " \n\t mtth2 ";
203  detid=mtth2->geographicalId().rawId();
204  // po.print(std::cout , detid );
205  std::cout << " \t " << detid << " " << mtth2->localPosition() << " " << mtth2->globalPosition()
206  << "\nhelix momentum " << kineMinus.momentum() << " pt " << kineMinus.momentum().perp() << " radius " << 1/kineMinus.transverseCurvature() << " q " << kineMinus.charge();
207  std::cout << "\n <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << "\n";
208 #endif
209 
210  buildSeed(seedCollection,phits,ftsPlus,es);
211  return buildSeed(seedCollection,mhits,ftsMinus,es);
212 
213 }
virtual CurvilinearTrajectoryError initialError(const GlobalVector &vertexBounds, float ptMin, float sinTheta) const
std::pair< ALIstring, ALIstring > pss
Definition: Fit.h:27
virtual float ptMin() const =0
minimal pt of interest
virtual GlobalPoint origin() const =0
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T y() const
Definition: PV3DBase.h:62
#define abs(x)
Definition: mlp_lapack.h:159
double double double z
double getSqrEffectiveErrorOnZ(const TransientTrackingRecHit::ConstRecHitPointer &hit, const TrackingRegion &region)
double x
Definition: Quad.h:5
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double simpleGetSlope(const TransientTrackingRecHit::ConstRecHitPointer &ohit, const TransientTrackingRecHit::ConstRecHitPointer &nohit, const TransientTrackingRecHit::ConstRecHitPointer &ihit, const TransientTrackingRecHit::ConstRecHitPointer &nihit, const TrackingRegion &region, double &cotTheta, double &z0)
virtual float originRBound() const =0
bounds the particle vertex in the transverse plane
double ptmin
Definition: HydjetWrapper.h:86
virtual float originZBound() const =0
bounds the particle vertex in the longitudinal plane
bool similarQuadExist(Quad &thisQuad, std::vector< Quad > &quadV)
unsigned int size() const
Definition: SeedingHitSet.h:31
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
Definition: Quad.h:4
T x() const
Definition: PV3DBase.h:61
virtual const TrajectorySeed * buildSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const FreeTrajectoryState &fts, const edm::EventSetup &es) const
Global3DVector GlobalVector
Definition: GlobalVector.h:10
virtual const TrajectorySeed* SeedForPhotonConversionFromQuadruplets::trajectorySeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits,
const TrackingRegion region,
const edm::EventSetup es,
const SeedComparitor filter 
)
inlinevirtual

Implements SeedCreator.

Definition at line 34 of file SeedForPhotonConversionFromQuadruplets.h.

39  { return 0;}
double SeedForPhotonConversionFromQuadruplets::verySimpleFit ( int  size,
double *  ax,
double *  ay,
double *  e2y,
double &  p0,
double &  e2p0,
double &  p1 
)

Definition at line 486 of file SeedForPhotonConversionFromQuadruplets.cc.

Referenced by simpleGetSlope().

486  {
487 
488  //#include "RecoTracker/ConversionSeedGenerators/interface/verySimpleFit.icc"
489  return 0;
490 }

Member Data Documentation

const int SeedForPhotonConversionFromQuadruplets::cotTheta_Max =99999
static

Definition at line 13 of file SeedForPhotonConversionFromQuadruplets.h.

Referenced by initialKinematic().

PrintRecoObjects SeedForPhotonConversionFromQuadruplets::po
protected

Definition at line 95 of file SeedForPhotonConversionFromQuadruplets.h.

Referenced by buildSeed(), and initialKinematic().

std::stringstream* SeedForPhotonConversionFromQuadruplets::pss
protected

Definition at line 94 of file SeedForPhotonConversionFromQuadruplets.h.

double SeedForPhotonConversionFromQuadruplets::theBOFFMomentum
protected

Definition at line 92 of file SeedForPhotonConversionFromQuadruplets.h.

Referenced by initialKinematic().

std::string SeedForPhotonConversionFromQuadruplets::thePropagatorLabel
protected

Definition at line 91 of file SeedForPhotonConversionFromQuadruplets.h.

Referenced by buildSeed().