CMS 3D CMS Logo

Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes

SeedForPhotonConversion1Leg Class Reference

#include <SeedForPhotonConversion1Leg.h>

List of all members.

Public Member Functions

 SeedForPhotonConversion1Leg (const edm::ParameterSet &cfg)
 SeedForPhotonConversion1Leg (const std::string &propagator="PropagatorWithMaterial", double seedMomentumForBOFF=-5.0)
const TrajectorySeedtrajectorySeed (TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits, const GlobalPoint &vertex, const GlobalVector &vertexBounds, float ptmin, const edm::EventSetup &es, float cotTheta, std::stringstream &ss)
 ~SeedForPhotonConversion1Leg ()

Static Public Attributes

static const int cotTheta_Max = 99999

Protected Member Functions

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

Protected Attributes

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

Detailed Description

Definition at line 19 of file SeedForPhotonConversion1Leg.h.


Constructor & Destructor Documentation

SeedForPhotonConversion1Leg::SeedForPhotonConversion1Leg ( const edm::ParameterSet cfg) [inline]

Definition at line 23 of file SeedForPhotonConversion1Leg.h.

                                                           :
    thePropagatorLabel(cfg.getParameter<std::string>("propagator")),
    theBOFFMomentum(cfg.existsAs<double>("SeedMomentumForBOFF") ? cfg.getParameter<double>("SeedMomentumForBOFF") : 5.0)
      {}
SeedForPhotonConversion1Leg::SeedForPhotonConversion1Leg ( const std::string &  propagator = "PropagatorWithMaterial",
double  seedMomentumForBOFF = -5.0 
) [inline]

Definition at line 28 of file SeedForPhotonConversion1Leg.h.

   : thePropagatorLabel(propagator), theBOFFMomentum(seedMomentumForBOFF) { }
SeedForPhotonConversion1Leg::~SeedForPhotonConversion1Leg ( ) [inline]

Definition at line 33 of file SeedForPhotonConversion1Leg.h.

{}

Member Function Documentation

const TrajectorySeed * SeedForPhotonConversion1Leg::buildSeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits,
const FreeTrajectoryState fts,
const edm::EventSetup es 
) const [protected]

Definition at line 132 of file SeedForPhotonConversion1Leg.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(), thePropagatorLabel, and patCandidatesForDimuonsSequences_cff::tracker.

Referenced by trajectorySeed().

{
  // get tracker
  edm::ESHandle<TrackerGeometry> tracker;
  es.get<TrackerDigiGeometryRecord>().get(tracker);
  
  // get propagator
  edm::ESHandle<Propagator>  propagatorHandle;
  es.get<TrackingComponentsRecord>().get(thePropagatorLabel, propagatorHandle);
  const Propagator*  propagator = &(*propagatorHandle);
  
  // get updator
  KFUpdator  updator;
  
  // Now update initial state track using information from seed hits.
  
  TrajectoryStateOnSurface updatedState;
  edm::OwnVector<TrackingRecHit> seedHits;
  
  const TrackingRecHit* hit = 0;
  for ( unsigned int iHit = 0; iHit < hits.size() && iHit<1; iHit++) {
    hit = hits[iHit]->hit();
    TrajectoryStateOnSurface state = (iHit==0) ? 
      propagator->propagate(fts,tracker->idToDet(hit->geographicalId())->surface())
      : propagator->propagate(updatedState, tracker->idToDet(hit->geographicalId())->surface());
    if (!state.isValid()) return 0;
    
    TransientTrackingRecHit::ConstRecHitPointer tth = hits[iHit]; 
    
    TransientTrackingRecHit::RecHitPointer newtth =  refitHit( tth, state);

    
    if (!checkHit(state,newtth,es)) return 0;

    updatedState =  updator.update(state, *newtth);
    if (!updatedState.isValid()) return 0;
    
    seedHits.push_back(newtth->hit()->clone());
#ifdef mydebug_seed
    uint32_t detid = hit->geographicalId().rawId();
    (*pss) << "\n[SeedForPhotonConversion1Leg] hit " << iHit;
    po.print(*pss, detid);
    (*pss) << " "  << detid << "\t lp " << hit->localPosition()
           << " tth " << tth->localPosition() << " newtth " << newtth->localPosition() << " state " << state.globalMomentum().perp();
#endif
  } 
  
  
  PTrajectoryStateOnDet const & PTraj =
      trajectoryStateTransform::persistentState(updatedState, hit->geographicalId().rawId());
  
  seedCollection.push_back( TrajectorySeed(PTraj,seedHits,alongMomentum));
  return &seedCollection.back();
}
bool SeedForPhotonConversion1Leg::checkHit ( const TrajectoryStateOnSurface ,
const TransientTrackingRecHit::ConstRecHitPointer hit,
const edm::EventSetup es 
) const [inline, protected]

Definition at line 47 of file SeedForPhotonConversion1Leg.h.

Referenced by buildSeed().

                                                       { return true; }
CurvilinearTrajectoryError SeedForPhotonConversion1Leg::initialError ( const GlobalVector vertexBounds,
float  ptMin,
float  sinTheta 
) const [protected]

Definition at line 103 of file SeedForPhotonConversion1Leg.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().

{
  // Set initial uncertainty on track parameters, using only P.V. constraint and no hit
  // information.
  GlobalError vertexErr( sqr(vertexBounds.x()), 0, 
                         sqr(vertexBounds.y()), 0, 0,
                         sqr(vertexBounds.z())
                         );
  
 
  AlgebraicSymMatrix55 C = ROOT::Math::SMatrixIdentity();

// FIXME: minC00. Prevent apriori uncertainty in 1/P from being too small, 
// to avoid instabilities.
// N.B. This parameter needs optimising ...
  float sin2th = sqr(sinTheta);
  float minC00 = 1.0;
  C[0][0] = std::max(sin2th/sqr(ptMin), minC00);
  float zErr = vertexErr.czz();
  float transverseErr = vertexErr.cxx(); // assume equal cxx cyy
  C[3][3] = transverseErr;
  C[4][4] = zErr*sin2th + transverseErr*(1-sin2th);

  return CurvilinearTrajectoryError(C);
}
GlobalTrajectoryParameters SeedForPhotonConversion1Leg::initialKinematic ( const SeedingHitSet hits,
const GlobalPoint vertexPos,
const edm::EventSetup es,
const float  cotTheta 
) const [protected]

Definition at line 44 of file SeedForPhotonConversion1Leg.cc.

References GlobalTrajectoryParameters::charge(), cotTheta_Max, cond::rpcobgas::detid, edm::EventSetup::get(), 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().

Referenced by trajectorySeed().

{
  GlobalTrajectoryParameters kine;

  TransientTrackingRecHit::ConstRecHitPointer tth1 = hits[0];
  TransientTrackingRecHit::ConstRecHitPointer tth2 = hits[1];

   // FIXME optimize: move outside loop
    edm::ESHandle<MagneticField> bfield;
    es.get<IdealMagneticFieldRecord>().get(bfield);
    float nomField = bfield->nominalValue();

  FastHelix helix(tth2->globalPosition(), tth1->globalPosition(), vertexPos, nomField, &*bfield, vertexPos);
  kine = helix.stateAtVertex();

  //force the pz/pt equal to the measured one
  if(fabs(cotTheta)<cotTheta_Max)
    kine = GlobalTrajectoryParameters(kine.position(),
                                      GlobalVector(kine.momentum().x(),kine.momentum().y(),kine.momentum().perp()*cotTheta),
                                      kine.charge(),
                                      & kine.magneticField()
                                      );
  else
    kine = GlobalTrajectoryParameters(kine.position(),
                                      GlobalVector(kine.momentum().x(),kine.momentum().y(),kine.momentum().perp()*cotTheta_Max),
                                      kine.charge(),
                                      & kine.magneticField()
                                      );

#ifdef mydebug_seed
  uint32_t detid;
  (*pss) << "[SeedForPhotonConversion1Leg] initialKinematic tth1 " ;
  detid=tth1->geographicalId().rawId();
  po.print(*pss, detid );
  (*pss) << " \t " << detid << " " << tth1->localPosition()  << " " << tth1->globalPosition()    ;
  detid= tth2->geographicalId().rawId();
  (*pss) << " \n\t tth2 ";
  po.print(*pss, detid );
  (*pss) << " \t " << detid << " " << tth2->localPosition()  << " " << tth2->globalPosition()  
         << "\nhelix momentum " << kine.momentum() << " pt " << kine.momentum().perp() << " radius " << 1/kine.transverseCurvature(); 
#endif

  bool isBOFF =(0==nomField);;
  if (isBOFF && (theBOFFMomentum > 0)) {
    kine = GlobalTrajectoryParameters(kine.position(),
                              kine.momentum().unit() * theBOFFMomentum,
                              kine.charge(),
                              &*bfield);
  }
  return kine;
}
TransientTrackingRecHit::RecHitPointer SeedForPhotonConversion1Leg::refitHit ( const TransientTrackingRecHit::ConstRecHitPointer hit,
const TrajectoryStateOnSurface state 
) const [protected]

Definition at line 191 of file SeedForPhotonConversion1Leg.cc.

Referenced by buildSeed().

{
  //const TransientTrackingRecHit* a= hit.get();
  //return const_cast<TransientTrackingRecHit*> (a);
  //This was modified otherwise the rechit will have just the local x component and local y=0
  // To understand how to modify for pixels

  //const TSiStripRecHit2DLocalPos* b = dynamic_cast<const TSiStripRecHit2DLocalPos*>(a);
  //return const_cast<TSiStripRecHit2DLocalPos*>(b);
  return hit->clone(state);
}
const TrajectorySeed * SeedForPhotonConversion1Leg::trajectorySeed ( TrajectorySeedCollection seedCollection,
const SeedingHitSet hits,
const GlobalPoint vertex,
const GlobalVector vertexBounds,
float  ptmin,
const edm::EventSetup es,
float  cotTheta,
std::stringstream &  ss 
)

Definition at line 22 of file SeedForPhotonConversion1Leg.cc.

References buildSeed(), error, initialError(), initialKinematic(), GlobalTrajectoryParameters::momentum(), funct::sin(), SeedingHitSet::size(), and PV3DBase< T, PVType, FrameType >::theta().

Referenced by PhotonConversionTrajectorySeedProducerFromSingleLegAlgo::inspectTrack().

{
  pss = &ss;
  if ( hits.size() < 2) return 0;

  GlobalTrajectoryParameters kine = initialKinematic(hits, vertex, es, cotTheta);
  float sinTheta = sin(kine.momentum().theta());

  CurvilinearTrajectoryError error = initialError(vertexBounds, ptmin,  sinTheta);
  FreeTrajectoryState fts(kine, error);

  return buildSeed(seedCollection,hits,fts,es); 
}

Member Data Documentation

const int SeedForPhotonConversion1Leg::cotTheta_Max = 99999 [static]

Definition at line 21 of file SeedForPhotonConversion1Leg.h.

Referenced by initialKinematic().

Definition at line 78 of file SeedForPhotonConversion1Leg.h.

Referenced by buildSeed(), and initialKinematic().

std::stringstream* SeedForPhotonConversion1Leg::pss [protected]

Definition at line 77 of file SeedForPhotonConversion1Leg.h.

Definition at line 75 of file SeedForPhotonConversion1Leg.h.

Referenced by initialKinematic().

Definition at line 74 of file SeedForPhotonConversion1Leg.h.

Referenced by buildSeed().