CMS 3D CMS Logo

Public Member Functions | Public Attributes

GsfElectronAlgo::ElectronData Struct Reference

List of all members.

Public Member Functions

void calculateMode (const MultiTrajectoryStateMode *mtsMode)
Candidate::LorentzVector calculateMomentum ()
bool calculateTSOS (const MultiTrajectoryStateTransform *, GsfConstraintAtVertex *)
void checkCtfTrack (edm::Handle< reco::TrackCollection > currentCtfTracks)
void computeCharge (int &charge, reco::GsfElectron::ChargeInfo &info)
 ElectronData (const reco::GsfElectronCoreRef &core, const reco::BeamSpot &bs)
CaloClusterPtr getEleBasicCluster (const MultiTrajectoryStateTransform *)
 ~ElectronData ()

Public Attributes

const reco::BeamSpot beamSpot
TrajectoryStateOnSurface constrainedVtxTSOS
const reco::GsfElectronCoreRef coreRef
reco::TrackRef ctfTrackRef
GlobalVector eleMom
GlobalPoint elePos
TrajectoryStateOnSurface eleTSOS
const reco::GsfTrackRef gsfTrackRef
GlobalVector innMom
GlobalPoint innPos
TrajectoryStateOnSurface innTSOS
GlobalVector outMom
GlobalPoint outPos
TrajectoryStateOnSurface outTSOS
GlobalVector sclMom
GlobalPoint sclPos
TrajectoryStateOnSurface sclTSOS
GlobalVector seedMom
GlobalPoint seedPos
TrajectoryStateOnSurface seedTSOS
float shFracInnerHits
const reco::SuperClusterRef superClusterRef
GlobalVector vtxMom
GlobalVector vtxMomWithConstraint
GlobalPoint vtxPos
TrajectoryStateOnSurface vtxTSOS

Detailed Description

Definition at line 260 of file GsfElectronAlgo.cc.


Constructor & Destructor Documentation

GsfElectronAlgo::ElectronData::ElectronData ( const reco::GsfElectronCoreRef core,
const reco::BeamSpot bs 
)

Definition at line 300 of file GsfElectronAlgo.cc.

 : coreRef(core),
   gsfTrackRef(coreRef->gsfTrack()),
   superClusterRef(coreRef->superCluster()),
   ctfTrackRef(coreRef->ctfTrack()), shFracInnerHits(coreRef->ctfGsfOverlap()),
   beamSpot(bs)
 {}
GsfElectronAlgo::ElectronData::~ElectronData ( )

Definition at line 309 of file GsfElectronAlgo.cc.

 {}

Member Function Documentation

void GsfElectronAlgo::ElectronData::calculateMode ( const MultiTrajectoryStateMode mtsMode)
Candidate::LorentzVector GsfElectronAlgo::ElectronData::calculateMomentum ( )

Definition at line 505 of file GsfElectronAlgo.cc.

References pileupReCalc_HLTpaths::scale.

Referenced by GsfElectronAlgo::createElectron().

 {
  double scale = superClusterRef->energy()/vtxMom.mag() ;
  return Candidate::LorentzVector
   ( vtxMom.x()*scale,vtxMom.y()*scale,vtxMom.z()*scale,
     superClusterRef->energy() ) ;
 }
bool GsfElectronAlgo::ElectronData::calculateTSOS ( const MultiTrajectoryStateTransform mtsTransform,
GsfConstraintAtVertex constraintAtVtx 
)

Definition at line 454 of file GsfElectronAlgo.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, GsfConstraintAtVertex::constrainAtBeamSpot(), ele_convert(), MultiTrajectoryStateTransform::extrapolatedState(), MultiTrajectoryStateTransform::innerStateOnSurface(), MultiTrajectoryStateTransform::outerStateOnSurface(), and funct::true.

Referenced by GsfElectronAlgo::completeElectrons().

 {
  //at innermost point
  innTSOS = mtsTransform->innerStateOnSurface(*gsfTrackRef);
  if (!innTSOS.isValid()) return false;

  //at vertex
  // innermost state propagation to the beam spot position
  GlobalPoint bsPos ;
  ele_convert(beamSpot.position(),bsPos) ;
  vtxTSOS = mtsTransform->extrapolatedState(innTSOS,bsPos) ;
  if (!vtxTSOS.isValid()) vtxTSOS=innTSOS;

  //at seed
  outTSOS = mtsTransform->outerStateOnSurface(*gsfTrackRef);
  if (!outTSOS.isValid()) return false;

  //    TrajectoryStateOnSurface seedTSOS
  seedTSOS = mtsTransform->extrapolatedState(outTSOS,
           GlobalPoint(superClusterRef->seed()->position().x(),
               superClusterRef->seed()->position().y(),
                 superClusterRef->seed()->position().z()));
  if (!seedTSOS.isValid()) seedTSOS=outTSOS;

  // at scl
  sclTSOS = mtsTransform->extrapolatedState(innTSOS,GlobalPoint(superClusterRef->x(),superClusterRef->y(),superClusterRef->z()));
  if (!sclTSOS.isValid()) sclTSOS=outTSOS;

  // constrained momentum
  constrainedVtxTSOS = constraintAtVtx->constrainAtBeamSpot(*gsfTrackRef,beamSpot);

  return true ;
 }
void GsfElectronAlgo::ElectronData::checkCtfTrack ( edm::Handle< reco::TrackCollection currentCtfTracks)

Definition at line 312 of file GsfElectronAlgo.cc.

References abs, TrackingRecHit::all, dPhi(), reco::HitPattern::getHitPattern(), min, pi, reco::HitPattern::pixelHitFilter(), edm::Handle< T >::product(), mathSSE::sqrt(), reco::HitPattern::stripTIBHitFilter(), and reco::HitPattern::stripTIDHitFilter().

Referenced by GsfElectronAlgo::createElectron().

 {
  if (!ctfTrackRef.isNull()) return ;

  // Code below from Puneeth Kalavase

  shFracInnerHits = 0 ;
  const TrackCollection * ctfTrackCollection = currentCtfTracks.product() ;

  // get the Hit Pattern for the gsfTrack
  const HitPattern & gsfHitPattern = gsfTrackRef->hitPattern() ;

  unsigned int counter ;
  TrackCollection::const_iterator ctfTkIter ;
  for ( ctfTkIter = ctfTrackCollection->begin() , counter = 0 ;
        ctfTkIter != ctfTrackCollection->end() ; ctfTkIter++, counter++ )
   {

    double dEta = gsfTrackRef->eta() - ctfTkIter->eta() ;
    double dPhi = gsfTrackRef->phi() - ctfTkIter->phi() ;
    double pi = acos(-1.);
    if(std::abs(dPhi) > pi) dPhi = 2*pi - std::abs(dPhi) ;

    // dont want to look at every single track in the event!
    if (sqrt(dEta*dEta + dPhi*dPhi) > 0.3) continue ;

    unsigned int shared = 0 ;
    int gsfHitCounter = 0 ;
    int numGsfInnerHits = 0 ;
    int numCtfInnerHits = 0 ;

    // get the CTF Track Hit Pattern
    const HitPattern & ctfHitPattern = ctfTkIter->hitPattern() ;

    trackingRecHit_iterator elHitsIt ;
    for ( elHitsIt = gsfTrackRef->recHitsBegin() ;
          elHitsIt != gsfTrackRef->recHitsEnd() ;
          elHitsIt++, gsfHitCounter++ )
     {
      if (!((**elHitsIt).isValid()))  //count only valid Hits
       { continue ; }

      // look only in the pixels/TIB/TID
      uint32_t gsfHit = gsfHitPattern.getHitPattern(gsfHitCounter) ;
      if (!(gsfHitPattern.pixelHitFilter(gsfHit) ||
          gsfHitPattern.stripTIBHitFilter(gsfHit) ||
          gsfHitPattern.stripTIDHitFilter(gsfHit) ) )
       { continue ; }

      numGsfInnerHits++ ;

      int ctfHitsCounter = 0 ;
      numCtfInnerHits = 0 ;
      trackingRecHit_iterator ctfHitsIt ;
      for ( ctfHitsIt = ctfTkIter->recHitsBegin() ;
            ctfHitsIt != ctfTkIter->recHitsEnd() ;
            ctfHitsIt++, ctfHitsCounter++ )
       {
        if(!((**ctfHitsIt).isValid())) //count only valid Hits!
         { continue ; }

        uint32_t ctfHit = ctfHitPattern.getHitPattern(ctfHitsCounter);
        if( !(ctfHitPattern.pixelHitFilter(ctfHit) ||
              ctfHitPattern.stripTIBHitFilter(ctfHit) ||
              ctfHitPattern.stripTIDHitFilter(ctfHit) ) )
         { continue ; }

        numCtfInnerHits++ ;

        if( (**elHitsIt).sharesInput(&(**ctfHitsIt),TrackingRecHit::all) )
         {
          shared++ ;
          break ;
         }

       } //ctfHits iterator

     } //gsfHits iterator

    if ((numGsfInnerHits==0)||(numCtfInnerHits==0))
     { continue ; }

    if ( static_cast<float>(shared)/min(numGsfInnerHits,numCtfInnerHits) > shFracInnerHits )
     {
      shFracInnerHits = static_cast<float>(shared)/min(numGsfInnerHits, numCtfInnerHits);
      ctfTrackRef = TrackRef(currentCtfTracks,counter);
     }
   } //ctfTrack iterator
 }
void GsfElectronAlgo::ElectronData::computeCharge ( int &  charge,
reco::GsfElectron::ChargeInfo info 
)

Definition at line 403 of file GsfElectronAlgo.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, ele_convert(), reco::GsfElectron::ChargeInfo::isGsfCtfConsistent, reco::GsfElectron::ChargeInfo::isGsfCtfScPixConsistent, reco::GsfElectron::ChargeInfo::isGsfScPixConsistent, normalized_phi(), PV3DBase< T, PVType, FrameType >::phi(), and reco::GsfElectron::ChargeInfo::scPixCharge.

Referenced by GsfElectronAlgo::createElectron().

 {
  // determine charge from SC
  GlobalPoint orig, scpos ;
  ele_convert(beamSpot.position(),orig) ;
  ele_convert(superClusterRef->position(),scpos) ;
  GlobalVector scvect(scpos-orig) ;
  GlobalPoint inntkpos = innTSOS.globalPosition() ;
  GlobalVector inntkvect = GlobalVector(inntkpos-orig) ;
  float dPhiInnEle=normalized_phi(scvect.phi()-inntkvect.phi()) ;
  if(dPhiInnEle>0) info.scPixCharge = -1 ;
  else info.scPixCharge = 1 ;

  // flags
  int chargeGsf = gsfTrackRef->charge() ;
  info.isGsfScPixConsistent = ((chargeGsf*info.scPixCharge)>0) ;
  info.isGsfCtfConsistent = (ctfTrackRef.isNonnull()&&((chargeGsf*ctfTrackRef->charge())>0)) ;
  info.isGsfCtfScPixConsistent = (info.isGsfScPixConsistent&&info.isGsfCtfConsistent) ;

  // default charge
  if (info.isGsfScPixConsistent||ctfTrackRef.isNull())
   { charge = info.scPixCharge ; }
  else
   { charge = ctfTrackRef->charge() ; }
 }
CaloClusterPtr GsfElectronAlgo::ElectronData::getEleBasicCluster ( const MultiTrajectoryStateTransform mtsTransform)

Definition at line 430 of file GsfElectronAlgo.cc.

References abs, SiPixelRawToDigiRegional_cfi::beamSpot, dPhi(), MultiTrajectoryStateTransform::extrapolatedState(), and MultiTrajectoryStateTransform::outerStateOnSurface().

Referenced by GsfElectronAlgo::createElectron().

 {
  CaloClusterPtr eleRef ;
  TrajectoryStateOnSurface tempTSOS ;
  TrajectoryStateOnSurface outTSOS = mtsTransform->outerStateOnSurface(*gsfTrackRef) ;
  float dphimin = 1.e30 ;
  for (CaloCluster_iterator bc=superClusterRef->clustersBegin(); bc!=superClusterRef->clustersEnd(); bc++)
   {
    GlobalPoint posclu((*bc)->position().x(),(*bc)->position().y(),(*bc)->position().z()) ;
    tempTSOS = mtsTransform->extrapolatedState(outTSOS,posclu) ;
    if (!tempTSOS.isValid()) tempTSOS=outTSOS ;
    GlobalPoint extrap = tempTSOS.globalPosition() ;
    float dphi = EleRelPointPair(posclu,extrap,beamSpot.position()).dPhi() ;
    if (std::abs(dphi)<dphimin)
     {
      dphimin = std::abs(dphi) ;
      eleRef = (*bc);
      eleTSOS = tempTSOS ;
     }
   }
  return eleRef ;
 }

Member Data Documentation

Definition at line 268 of file GsfElectronAlgo.cc.

Definition at line 291 of file GsfElectronAlgo.cc.

Definition at line 263 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 266 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 294 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 295 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 290 of file GsfElectronAlgo.cc.

Definition at line 264 of file GsfElectronAlgo.cc.

Definition at line 294 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 295 of file GsfElectronAlgo.cc.

Definition at line 285 of file GsfElectronAlgo.cc.

Definition at line 294 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 295 of file GsfElectronAlgo.cc.

Definition at line 286 of file GsfElectronAlgo.cc.

Definition at line 294 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 295 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 288 of file GsfElectronAlgo.cc.

Definition at line 294 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 295 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 289 of file GsfElectronAlgo.cc.

Definition at line 267 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 265 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 294 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 296 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 295 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().

Definition at line 287 of file GsfElectronAlgo.cc.

Referenced by GsfElectronAlgo::createElectron().