CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

ElectronSeedGenerator Class Reference

#include <ElectronSeedGenerator.h>

List of all members.

Public Types

typedef
TransientTrackingRecHit::ConstRecHitPointer 
ConstRecHitPointer
typedef edm::OwnVector
< TrackingRecHit
PRecHitContainer
typedef
TransientTrackingRecHit::RecHitContainer 
RecHitContainer
typedef
TransientTrackingRecHit::RecHitPointer 
RecHitPointer

Public Member Functions

 ElectronSeedGenerator (const edm::ParameterSet &)
void run (edm::Event &, const edm::EventSetup &setup, const reco::SuperClusterRefVector &, const std::vector< float > &hoe1s, const std::vector< float > &hoe2s, TrajectorySeedCollection *seeds, reco::ElectronSeedCollection &)
void setupES (const edm::EventSetup &setup)
 ~ElectronSeedGenerator ()

Private Member Functions

void addSeed (reco::ElectronSeed &seed, const SeedWithInfo *info, bool positron, reco::ElectronSeedCollection &out)
bool prepareElTrackSeed (ConstRecHitPointer outerhit, ConstRecHitPointer innerhit, const GlobalPoint &vertexPos)
void seedsFromRecHits (std::vector< std::pair< RecHitWithDist, ConstRecHitPointer > > &elePixelHits, PropagationDirection &dir, const GlobalPoint &vertexPos, const reco::ElectronSeed::CaloClusterRef &cluster, reco::ElectronSeedCollection &out, bool positron)
void seedsFromThisCluster (edm::Ref< reco::SuperClusterCollection > seedCluster, float hoe1, float hoe2, reco::ElectronSeedCollection &out)
void seedsFromTrajectorySeeds (const std::vector< SeedWithInfo > &elePixelSeeds, const reco::ElectronSeed::CaloClusterRef &cluster, float hoe1, float hoe2, reco::ElectronSeedCollection &out, bool positron)

Private Attributes

edm::InputTag beamSpotTag_
unsigned long long cacheIDCkfComp_
unsigned long long cacheIDMagField_
unsigned long long cacheIDNavSchool_
unsigned long long cacheIDTrkGeom_
double deltaPhi1Coef1_
double deltaPhi1Coef2_
float deltaPhi1High_
float deltaPhi1Low_
float deltaPhi2B_
float deltaPhi2F_
float deltaZ1WithVertex_
bool dynamicphiroad_
bool fromTrackerSeeds_
float highPtThreshold_
float lowPtThreshold_
PixelHitMatchermyMatchEle
PixelHitMatchermyMatchPos
float nSigmasDeltaZ1_
float phiMax2B_
float phiMax2F_
float phiMin2B_
float phiMin2F_
PTrajectoryStateOnDetpts_
PRecHitContainer recHits_
float sizeWindowENeg_
edm::Handle< reco::BeamSpottheBeamSpot
TrajectorySeedCollectiontheInitialSeedColl
edm::ESHandle< MagneticFieldtheMagField
const MeasurementTrackertheMeasurementTracker
std::string theMeasurementTrackerName
const NavigationSchooltheNavigationSchool
PropagatorWithMaterialthePropagator
const edm::EventSetuptheSetup
edm::ESHandle< TrackerGeometrytheTrackerGeometry
KFUpdatortheUpdator
edm::Handle< std::vector
< reco::Vertex > > 
theVertices
TrajectoryStateTransform transformer_
bool useRecoVertex_
edm::InputTag verticesTag_

Detailed Description

Class to generate the trajectory seed from two hits in the pixel detector which have been found compatible with an ECAL cluster.

Author:
U.Berthon, C.Charlot, LLR Palaiseau
Version:
1st Version May 30, 2006

Description: Top algorithm producing ElectronSeeds, ported from ORCA

Implementation: future redesign...

Definition at line 48 of file ElectronSeedGenerator.h.


Member Typedef Documentation

Definition at line 53 of file ElectronSeedGenerator.h.

Definition at line 52 of file ElectronSeedGenerator.h.

Definition at line 55 of file ElectronSeedGenerator.h.

Definition at line 54 of file ElectronSeedGenerator.h.


Constructor & Destructor Documentation

ElectronSeedGenerator::ElectronSeedGenerator ( const edm::ParameterSet pset)

Definition at line 54 of file ElectronSeedGenerator.cc.

References beamSpotTag_, deltaPhi1Coef1_, deltaPhi1Coef2_, deltaPhi1High_, deltaPhi1Low_, deltaPhi2B_, deltaPhi2F_, deltaZ1WithVertex_, dynamicphiroad_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), highPtThreshold_, lowPtThreshold_, myMatchEle, myMatchPos, phiMax2B_, phiMax2F_, phiMin2B_, phiMin2F_, theMeasurementTrackerName, theUpdator, useRecoVertex_, and verticesTag_.

 : dynamicphiroad_(pset.getParameter<bool>("dynamicPhiRoad")),
   fromTrackerSeeds_(pset.getParameter<bool>("fromTrackerSeeds")),
   useRecoVertex_(false),
   verticesTag_("offlinePrimaryVerticesWithBS"),
   beamSpotTag_("offlineBeamSpot"),
   lowPtThreshold_(pset.getParameter<double>("LowPtThreshold")),
   highPtThreshold_(pset.getParameter<double>("HighPtThreshold")),
   nSigmasDeltaZ1_(pset.getParameter<double>("nSigmasDeltaZ1")),
   deltaZ1WithVertex_(0.5),
   sizeWindowENeg_(pset.getParameter<double>("SizeWindowENeg")),
   deltaPhi1Low_(pset.getParameter<double>("DeltaPhi1Low")),
   deltaPhi1High_(pset.getParameter<double>("DeltaPhi1High")),
   deltaPhi1Coef1_(0.), deltaPhi1Coef2_(0.),
   myMatchEle(0), myMatchPos(0),
   thePropagator(0),
   theMeasurementTracker(0),
   theSetup(0), pts_(0),
   cacheIDMagField_(0),/*cacheIDGeom_(0),*/cacheIDNavSchool_(0),cacheIDCkfComp_(0),cacheIDTrkGeom_(0)
 {
  // so that deltaPhi1 = deltaPhi1Coef1_ + deltaPhi1Coef2_/clusterEnergyT
  if (dynamicphiroad_)
   {
    deltaPhi1Coef2_ = (deltaPhi1Low_-deltaPhi1High_)/(1./lowPtThreshold_-1./highPtThreshold_) ;
    deltaPhi1Coef1_ = deltaPhi1Low_ - deltaPhi1Coef2_/lowPtThreshold_ ;
   }

  // use of a theMeasurementTrackerName
  if (pset.exists("measurementTrackerName"))
   { theMeasurementTrackerName = pset.getParameter<std::string>("measurementTrackerName") ; }

  // use of reco vertex
  if (pset.exists("useRecoVertex"))
   { useRecoVertex_ = pset.getParameter<bool>("useRecoVertex") ; }
  if (pset.exists("vertices"))
   { verticesTag_ = pset.getParameter<edm::InputTag>("vertices") ; }
  if (pset.exists("deltaZ1WithVertex"))
   { deltaZ1WithVertex_ = pset.getParameter<double>("deltaZ1WithVertex") ; }

  // new beamSpot tag
  if (pset.exists("beamSpot"))
   { beamSpotTag_ = pset.getParameter<edm::InputTag>("beamSpot") ; }

  // new B/F configurables
  if (pset.exists("DeltaPhi2"))
   { deltaPhi2B_ = deltaPhi2F_ = pset.getParameter<double>("DeltaPhi2") ; }
  else
   {
    deltaPhi2B_ = pset.getParameter<double>("DeltaPhi2B") ;
    deltaPhi2F_ = pset.getParameter<double>("DeltaPhi2F") ;
   }
  if (pset.exists("PhiMin2"))
   { phiMin2B_ = phiMin2F_ = pset.getParameter<double>("PhiMin2") ; }
  else
   {
    phiMin2B_ = pset.getParameter<double>("PhiMin2B") ;
    phiMin2F_ = pset.getParameter<double>("PhiMin2F") ;
   }
  if (pset.exists("PhiMax2"))
   { phiMax2B_ = phiMax2F_ = pset.getParameter<double>("PhiMax2") ; }
  else
   {
    phiMax2B_ = pset.getParameter<double>("PhiMax2B") ;
    phiMax2F_ = pset.getParameter<double>("PhiMax2F") ;
   }

  // Instantiate the pixel hit matchers
  myMatchEle = new PixelHitMatcher
   ( pset.getParameter<double>("ePhiMin1"),
                 pset.getParameter<double>("ePhiMax1"),
                 phiMin2B_, phiMax2B_, phiMin2F_, phiMax2F_,
     pset.getParameter<double>("z2MinB"),
     pset.getParameter<double>("z2MaxB"),
     pset.getParameter<double>("r2MinF"),
     pset.getParameter<double>("r2MaxF"),
     pset.getParameter<double>("rMinI"),
     pset.getParameter<double>("rMaxI"),
     pset.getParameter<bool>("searchInTIDTEC") ) ;

  myMatchPos = new PixelHitMatcher
   ( pset.getParameter<double>("pPhiMin1"),
                 pset.getParameter<double>("pPhiMax1"),
                 phiMin2B_, phiMax2B_, phiMin2F_, phiMax2F_,
     pset.getParameter<double>("z2MinB"),
     pset.getParameter<double>("z2MaxB"),
     pset.getParameter<double>("r2MinF"),
     pset.getParameter<double>("r2MaxF"),
     pset.getParameter<double>("rMinI"),
     pset.getParameter<double>("rMaxI"),
     pset.getParameter<bool>("searchInTIDTEC") ) ;

  theUpdator = new KFUpdator() ;
 }
ElectronSeedGenerator::~ElectronSeedGenerator ( )

Definition at line 148 of file ElectronSeedGenerator.cc.

References myMatchEle, myMatchPos, thePropagator, and theUpdator.

 {
  delete myMatchEle ;
  delete myMatchPos ;
  delete thePropagator ;
  delete theUpdator ;
 }

Member Function Documentation

void ElectronSeedGenerator::addSeed ( reco::ElectronSeed seed,
const SeedWithInfo info,
bool  positron,
reco::ElectronSeedCollection out 
) [private]

Definition at line 478 of file ElectronSeedGenerator.cc.

References reco::ElectronSeed::caloCluster(), SeedWithInfo::dPhi1(), reco::ElectronSeed::dPhi2(), SeedWithInfo::dPhi2(), reco::ElectronSeed::dPhi2Pos(), SeedWithInfo::dRz1(), SeedWithInfo::dRz2(), reco::ElectronSeed::dRz2(), reco::ElectronSeed::dRz2Pos(), equivalent(), reco::ElectronSeed::hitsMask(), infinity, reco::ElectronSeed::setNegAttributes(), and reco::ElectronSeed::setPosAttributes().

 {
  if (!info)
   { out.push_back(seed) ; return ; }

  if (positron)
   { seed.setPosAttributes(info->dRz2(),info->dPhi2(),info->dRz1(),info->dPhi1()) ; }
  else
   { seed.setNegAttributes(info->dRz2(),info->dPhi2(),info->dRz1(),info->dPhi1()) ; }
  reco::ElectronSeedCollection::iterator resItr ;
  for ( resItr=out.begin() ; resItr!=out.end() ; ++resItr )
   {
    if ( (seed.caloCluster()==resItr->caloCluster()) &&
         (seed.hitsMask()==resItr->hitsMask()) &&
         equivalent(seed,*resItr) )
     {
      if (positron)
       {
        if ( resItr->dRz2Pos()==std::numeric_limits<float>::infinity() &&
             resItr->dRz2()!=std::numeric_limits<float>::infinity() )
         {
          resItr->setPosAttributes(info->dRz2(),info->dPhi2(),info->dRz1(),info->dPhi1()) ;
          seed.setNegAttributes(resItr->dRz2(),resItr->dPhi2(),resItr->dRz1(),resItr->dPhi1()) ;
          break ;
         }
        else
         {
          if ( resItr->dRz2Pos()!=std::numeric_limits<float>::infinity() )
           {
            if ( resItr->dRz2Pos()!=seed.dRz2Pos() )
             {
              edm::LogWarning("ElectronSeedGenerator|BadValue")
               <<"this similar old seed already has another dRz2Pos"
               <<"\nold seed mask/dRz2/dPhi2/dRz2Pos/dPhi2Pos: "<<(unsigned int)resItr->hitsMask()<<"/"<<resItr->dRz2()<<"/"<<resItr->dPhi2()<<"/"<<resItr->dRz2Pos()<<"/"<<resItr->dPhi2Pos()
               <<"\nnew seed mask/dRz2/dPhi2/dRz2Pos/dPhi2Pos: "<<(unsigned int)seed.hitsMask()<<"/"<<seed.dRz2()<<"/"<<seed.dPhi2()<<"/"<<seed.dRz2Pos()<<"/"<<seed.dPhi2Pos() ;
             }
//            else
//             {
//              edm::LogWarning("ElectronSeedGenerator|UnexpectedValue")
//               <<"this old seed already knows its dRz2Pos, we suspect duplicates in input trajectry seeds"
//               <<"\nold seed mask/dRz2/dPhi2/dRz2Pos/dPhi2Pos: "<<(unsigned int)resItr->hitsMask()<<"/"<<resItr->dRz2()<<"/"<<resItr->dPhi2()<<"/"<<resItr->dRz2Pos()<<"/"<<resItr->dPhi2Pos()
//               <<"\nnew seed mask/dRz2/dPhi2/dRz2Pos/dPhi2Pos: "<<(unsigned int)seed.hitsMask()<<"/"<<seed.dRz2()<<"/"<<seed.dPhi2()<<"/"<<seed.dRz2Pos()<<"/"<<seed.dPhi2Pos() ;
//             }
            }
//          if (resItr->dRz2()==std::numeric_limits<float>::infinity())
//           {
//            edm::LogWarning("ElectronSeedGenerator|BadValue")
//             <<"this old seed has no dRz2, we suspect duplicates in input trajectry seeds"
//             <<"\nold seed mask/dRz2/dPhi2/dRz2Pos/dPhi2Pos: "<<(unsigned int)resItr->hitsMask()<<"/"<<resItr->dRz2()<<"/"<<resItr->dPhi2()<<"/"<<resItr->dRz2Pos()<<"/"<<resItr->dPhi2Pos()
//             <<"\nnew seed mask/dRz2/dPhi2/dRz2Pos/dPhi2Pos: "<<(unsigned int)seed.hitsMask()<<"/"<<seed.dRz2()<<"/"<<seed.dPhi2()<<"/"<<seed.dRz2Pos()<<"/"<<seed.dPhi2Pos() ;
//           }
         }
       }
      else
       {
        if ( resItr->dRz2()==std::numeric_limits<float>::infinity()
          && resItr->dRz2Pos()!=std::numeric_limits<float>::infinity() )
         {
          resItr->setNegAttributes(info->dRz2(),info->dPhi2(),info->dRz1(),info->dPhi1()) ;
          seed.setPosAttributes(resItr->dRz2Pos(),resItr->dPhi2Pos(),resItr->dRz1Pos(),resItr->dPhi1Pos()) ;
          break ;
         }
        else
         {
          if ( resItr->dRz2()!=std::numeric_limits<float>::infinity() )
           {
            if (resItr->dRz2()!=seed.dRz2())
             {
              edm::LogWarning("ElectronSeedGenerator|BadValue")
               <<"this old seed already has another dRz2"
               <<"\nold seed mask/dRz2/dPhi2/dRz2Pos/dPhi2Pos: "<<(unsigned int)resItr->hitsMask()<<"/"<<resItr->dRz2()<<"/"<<resItr->dPhi2()<<"/"<<resItr->dRz2Pos()<<"/"<<resItr->dPhi2Pos()
               <<"\nnew seed mask/dRz2/dPhi2/dRz2Pos/dPhi2Pos: "<<(unsigned int)seed.hitsMask()<<"/"<<seed.dRz2()<<"/"<<seed.dPhi2()<<"/"<<seed.dRz2Pos()<<"/"<<seed.dPhi2Pos() ;
             }
    //        else
    //         {
    //          edm::LogWarning("ElectronSeedGenerator|UnexpectedValue")
    //           <<"this old seed already knows its dRz2, we suspect duplicates in input trajectry seeds"
    //           <<"\nold seed mask/dRz2/dPhi2/dRz2Pos/dPhi2Pos: "<<(unsigned int)resItr->hitsMask()<<"/"<<resItr->dRz2()<<"/"<<resItr->dPhi2()<<"/"<<resItr->dRz2Pos()<<"/"<<resItr->dPhi2Pos()
    //           <<"\nnew seed mask/dRz2/dPhi2/dRz2Pos/dPhi2Pos: "<<(unsigned int)seed.hitsMask()<<"/"<<seed.dRz2()<<"/"<<seed.dPhi2()<<"/"<<seed.dRz2Pos()<<"/"<<seed.dPhi2Pos() ;
    //          seed.setPosAttributes(resItr->dRz2Pos(),resItr->dPhi2Pos(),resItr->dRz1Pos(),resItr->dPhi1Pos()) ;
    //         }
           }
//          if (resItr->dRz2Pos()==std::numeric_limits<float>::infinity())
//           {
//            edm::LogWarning("ElectronSeedGenerator|BadValue")
//             <<"this old seed has no dRz2Pos"
//             <<"\nold seed mask/dRz2/dPhi2/dRz2Pos/dPhi2Pos: "<<(unsigned int)resItr->hitsMask()<<"/"<<resItr->dRz2()<<"/"<<resItr->dPhi2()<<"/"<<resItr->dRz2Pos()<<"/"<<resItr->dPhi2Pos()
//             <<"\nnew seed mask/dRz2/dPhi2/dRz2Pos/dPhi2Pos: "<<(unsigned int)seed.hitsMask()<<"/"<<seed.dRz2()<<"/"<<seed.dPhi2()<<"/"<<seed.dRz2Pos()<<"/"<<seed.dPhi2Pos() ;
//           }
         }
       }
     }
   }

  out.push_back(seed) ;
 }
bool ElectronSeedGenerator::prepareElTrackSeed ( ConstRecHitPointer  outerhit,
ConstRecHitPointer  innerhit,
const GlobalPoint vertexPos 
) [private]

Definition at line 579 of file ElectronSeedGenerator.cc.

References TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), LogDebug, and PV3DBase< T, PVType, FrameType >::perp().

 {

  // debug prints
  LogDebug("") <<"[ElectronSeedGenerator::prepareElTrackSeed] inner PixelHit   x,y,z "<<innerhit->globalPosition();
  LogDebug("") <<"[ElectronSeedGenerator::prepareElTrackSeed] outer PixelHit   x,y,z "<<outerhit->globalPosition();

  pts_=0;
  recHits_.clear();

  SiPixelRecHit *pixhit=0;
  SiStripMatchedRecHit2D *striphit=0;
  const SiPixelRecHit* constpixhit = dynamic_cast <const SiPixelRecHit*> (innerhit->hit());
  if (constpixhit) {
    pixhit=new SiPixelRecHit(*constpixhit);
    recHits_.push_back(pixhit);
  } else  return false;
  constpixhit =  dynamic_cast <const SiPixelRecHit *> (outerhit->hit());
  if (constpixhit) {
    pixhit=new SiPixelRecHit(*constpixhit);
    recHits_.push_back(pixhit);
  } else {
    const SiStripMatchedRecHit2D * conststriphit=dynamic_cast <const SiStripMatchedRecHit2D *> (outerhit->hit());
    if (conststriphit) {
      striphit = new SiStripMatchedRecHit2D(*conststriphit);
      recHits_.push_back(striphit);
    } else return false;
  }

  typedef TrajectoryStateOnSurface     TSOS;

  // make a spiral
  FastHelix helix(outerhit->globalPosition(),innerhit->globalPosition(),vertexPos,*theSetup);
  if ( !helix.isValid()) {
    return false;
  }
  FreeTrajectoryState fts = helix.stateAtVertex();
  TSOS propagatedState = thePropagator->propagate(fts,innerhit->det()->surface()) ;
  if (!propagatedState.isValid())
    return false;
  TSOS updatedState = theUpdator->update(propagatedState, *innerhit);

  TSOS propagatedState_out = thePropagator->propagate(updatedState,outerhit->det()->surface()) ;
  if (!propagatedState_out.isValid())
    return false;
  TSOS updatedState_out = theUpdator->update(propagatedState_out, *outerhit);
  // debug prints
  LogDebug("") <<"[ElectronSeedGenerator::prepareElTrackSeed] final TSOS, position: "<<updatedState_out.globalPosition()<<" momentum: "<<updatedState_out.globalMomentum();
  LogDebug("") <<"[ElectronSeedGenerator::prepareElTrackSeed] final TSOS Pt: "<<updatedState_out.globalMomentum().perp();
  pts_ =  transformer_.persistentState(updatedState_out, outerhit->geographicalId().rawId());

  return true;
 }
void ElectronSeedGenerator::run ( edm::Event e,
const edm::EventSetup setup,
const reco::SuperClusterRefVector sclRefs,
const std::vector< float > &  hoe1s,
const std::vector< float > &  hoe2s,
TrajectorySeedCollection seeds,
reco::ElectronSeedCollection out 
)

Definition at line 231 of file ElectronSeedGenerator.cc.

References edm::Event::getByLabel(), i, edm::EventBase::id(), LogDebug, HcalObjRepresent::setup(), and edm::RefVector< C, T, F >::size().

Referenced by ElectronSeedProducer::produce().

 {
  theInitialSeedColl = seeds ;
//  bool duplicateTrajectorySeeds =false ;
//  unsigned int i,j ;
//  for (i=0;i<seeds->size();++i)
//    for (j=i+1;j<seeds->size();++j)
//     {
//      const TrajectorySeed & s1 =(*seeds)[i] ;
//      const TrajectorySeed & s2 =(*seeds)[j] ;
//      if ( equivalent(s1,s2) )
//       {
//        const PTrajectoryStateOnDet & ss1 = s1.startingState() ;
//        const LocalTrajectoryParameters & p1 = ss1.parameters() ;
//        const PTrajectoryStateOnDet & ss2 = s2.startingState() ;
//        const LocalTrajectoryParameters & p2 = ss2.parameters() ;
//        duplicateTrajectorySeeds = true ;
//        std::cout<<"Same hits for "
//          <<"\n  s["<<i<<"] ("<<s1.direction()<<"/"<<ss1.detId()<<"/"<<ss1.surfaceSide()<<"/"<<p1.charge()<<"/"<<p1.position()<<"/"<<p1.momentum()<<")"
//          <<"\n  s["<<j<<"] ("<<s2.direction()<<"/"<<ss2.detId()<<"/"<<ss2.surfaceSide()<<"/"<<p2.charge()<<"/"<<p2.position()<<"/"<<p2.momentum()<<")"
//          <<std::endl ;
//       }
//     }
//  if (duplicateTrajectorySeeds)
//   { edm::LogWarning("ElectronSeedGenerator|DuplicateTrajectorySeeds")<<"We see several identical trajectory seeds." ; }


  theSetup= &setup;
  NavigationSetter theSetter(*theNavigationSchool);

  // get initial TrajectorySeeds if necessary
  //  if (fromTrackerSeeds_) e.getByLabel(initialSeeds_, theInitialSeedColl);

  // get the beamspot from the Event:
  //e.getByType(theBeamSpot);
  e.getByLabel(beamSpotTag_,theBeamSpot);

  // if required get the vertices
  if (useRecoVertex_) e.getByLabel(verticesTag_,theVertices);

  if (!fromTrackerSeeds_)
   { theMeasurementTracker->update(e) ; }

  for  (unsigned int i=0;i<sclRefs.size();++i) {
    // Find the seeds
    recHits_.clear();

    LogDebug ("run") << "new cluster, calling seedsFromThisCluster";
    seedsFromThisCluster(sclRefs[i],hoe1s[i],hoe2s[i],out);
  }

  LogDebug ("run") << ": For event "<<e.id();
  LogDebug ("run") <<"Nr of superclusters after filter: "<<sclRefs.size()
   <<", no. of ElectronSeeds found  = " << out.size();
}
void ElectronSeedGenerator::seedsFromRecHits ( std::vector< std::pair< RecHitWithDist, ConstRecHitPointer > > &  elePixelHits,
PropagationDirection dir,
const GlobalPoint vertexPos,
const reco::ElectronSeed::CaloClusterRef cluster,
reco::ElectronSeedCollection out,
bool  positron 
) [private]

Definition at line 434 of file ElectronSeedGenerator.cc.

References LogDebug, reco::ElectronSeed::setCaloCluster(), and v.

 {
  if (!pixelHits.empty())
   { LogDebug("ElectronSeedGenerator") << "Compatible "<<(positron?"positron":"electron")<<" hits found." ; }

  std::vector<std::pair<RecHitWithDist,ConstRecHitPointer> >::iterator v ;
  for ( v = pixelHits.begin() ; v != pixelHits.end() ; v++ )
   {
    if (!positron)
     { (*v).first.invert() ; }
    if (!prepareElTrackSeed((*v).first.recHit(),(*v).second,vertexPos))
     { continue ; }
    reco::ElectronSeed seed(*pts_,recHits_,dir) ;
    seed.setCaloCluster(cluster) ;
    addSeed(seed,0,positron,out) ;
    delete pts_;
    pts_=0;
   }
 }
void ElectronSeedGenerator::seedsFromThisCluster ( edm::Ref< reco::SuperClusterCollection seedCluster,
float  hoe1,
float  hoe2,
reco::ElectronSeedCollection out 
) [private]

Definition at line 290 of file ElectronSeedGenerator.cc.

References alongMomentum, dir, ele_convert(), eta(), and mathSSE::sqrt().

{
  float clusterEnergy = seedCluster->energy() ;
  GlobalPoint clusterPos
    ( seedCluster->position().x(),
      seedCluster->position().y(),
      seedCluster->position().z() ) ;
  reco::ElectronSeed::CaloClusterRef caloCluster(seedCluster) ;

  //LogDebug("") << "[ElectronSeedGenerator::seedsFromThisCluster] new supercluster with energy: " << clusterEnergy ;
  //LogDebug("") << "[ElectronSeedGenerator::seedsFromThisCluster] and position: " << clusterPos ;

  if (dynamicphiroad_)
   {
    float clusterEnergyT = clusterEnergy / cosh( EleRelPoint(clusterPos,theBeamSpot->position()).eta() ) ;

    float deltaPhi1 ;
    if (clusterEnergyT < lowPtThreshold_)
     { deltaPhi1= deltaPhi1Low_ ; }
    else if (clusterEnergyT > highPtThreshold_)
     { deltaPhi1= deltaPhi1High_ ; }
    else
     { deltaPhi1 = deltaPhi1Coef1_ + deltaPhi1Coef2_/clusterEnergyT ; }

    float ephimin1 = -deltaPhi1*sizeWindowENeg_ ;
    float ephimax1 =  deltaPhi1*(1.-sizeWindowENeg_);
    float pphimin1 = -deltaPhi1*(1.-sizeWindowENeg_);
    float pphimax1 =  deltaPhi1*sizeWindowENeg_;

    float phimin2B  = -deltaPhi2B_/2. ;
    float phimax2B  =  deltaPhi2B_/2. ;
    float phimin2F  = -deltaPhi2F_/2. ;
    float phimax2F  =  deltaPhi2F_/2. ;


    myMatchEle->set1stLayer(ephimin1,ephimax1);
    myMatchPos->set1stLayer(pphimin1,pphimax1);
    myMatchEle->set2ndLayer(phimin2B,phimax2B, phimin2F,phimax2F);
    myMatchPos->set2ndLayer(phimin2B,phimax2B, phimin2F,phimax2F);
   }

  PropagationDirection dir = alongMomentum ;

  if (!useRecoVertex_) // here use the beam spot position
   {
    double sigmaZ=theBeamSpot->sigmaZ();
    double sigmaZ0Error=theBeamSpot->sigmaZ0Error();
    double sq=sqrt(sigmaZ*sigmaZ+sigmaZ0Error*sigmaZ0Error);
    double myZmin1=theBeamSpot->position().z()-nSigmasDeltaZ1_*sq;
    double myZmax1=theBeamSpot->position().z()+nSigmasDeltaZ1_*sq;

    GlobalPoint vertexPos ;
    ele_convert(theBeamSpot->position(),vertexPos) ;

    myMatchEle->set1stLayerZRange(myZmin1,myZmax1);
    myMatchPos->set1stLayerZRange(myZmin1,myZmax1);

    if (!fromTrackerSeeds_)
     {
      // try electron
      std::vector<std::pair<RecHitWithDist,ConstRecHitPointer> > elePixelHits
       = myMatchEle->compatibleHits(clusterPos,vertexPos,clusterEnergy,-1.) ;
      GlobalPoint eleVertex(theBeamSpot->position().x(),theBeamSpot->position().y(),myMatchEle->getVertex()) ;
      seedsFromRecHits(elePixelHits,dir,eleVertex,caloCluster,out,false) ;
      // try positron
      std::vector<std::pair<RecHitWithDist,ConstRecHitPointer> > posPixelHits
       = myMatchPos->compatibleHits(clusterPos,vertexPos,clusterEnergy,1.) ;
      GlobalPoint posVertex(theBeamSpot->position().x(),theBeamSpot->position().y(),myMatchPos->getVertex()) ;
      seedsFromRecHits(posPixelHits,dir,posVertex,caloCluster,out,true) ;
     }
    else
     {
      // try electron
      std::vector<SeedWithInfo> elePixelSeeds
       = myMatchEle->compatibleSeeds(theInitialSeedColl,clusterPos,vertexPos,clusterEnergy,-1.) ;
      seedsFromTrajectorySeeds(elePixelSeeds,caloCluster,hoe1,hoe2,out,false) ;
      // try positron
      std::vector<SeedWithInfo> posPixelSeeds
       = myMatchPos->compatibleSeeds(theInitialSeedColl,clusterPos,vertexPos,clusterEnergy,1.) ;
      seedsFromTrajectorySeeds(posPixelSeeds,caloCluster,hoe1,hoe2,out,true) ;
     }

   }
  else // here we use the reco vertices
   {

    myMatchEle->setUseRecoVertex(true) ; //Hit matchers need to know that the vertex is known
    myMatchPos->setUseRecoVertex(true) ;

    const  std::vector<reco::Vertex> * vtxCollection = theVertices.product() ;
    std::vector<reco::Vertex>::const_iterator vtxIter ;
    for (vtxIter = vtxCollection->begin(); vtxIter != vtxCollection->end() ; vtxIter++)
     {

      GlobalPoint vertexPos(vtxIter->position().x(),vtxIter->position().y(),vtxIter->position().z());
      double myZmin1, myZmax1 ;
      if (vertexPos.z()==theBeamSpot->position().z())
       { // in case vetex not found
        double sigmaZ=theBeamSpot->sigmaZ();
        double sigmaZ0Error=theBeamSpot->sigmaZ0Error();
        double sq=sqrt(sigmaZ*sigmaZ+sigmaZ0Error*sigmaZ0Error);
        myZmin1=theBeamSpot->position().z()-nSigmasDeltaZ1_*sq;
        myZmax1=theBeamSpot->position().z()+nSigmasDeltaZ1_*sq;
       }
      else
       { // a vertex has been recoed
        myZmin1=vtxIter->position().z()-deltaZ1WithVertex_;
        myZmax1=vtxIter->position().z()+deltaZ1WithVertex_;
       }

      myMatchEle->set1stLayerZRange(myZmin1,myZmax1);
      myMatchPos->set1stLayerZRange(myZmin1,myZmax1);

      if (!fromTrackerSeeds_)
       {
        // try electron
        std::vector<std::pair<RecHitWithDist,ConstRecHitPointer> > elePixelHits
         = myMatchEle->compatibleHits(clusterPos,vertexPos,clusterEnergy,-1.) ;
        seedsFromRecHits(elePixelHits,dir,vertexPos,caloCluster,out,false) ;
        // try positron
              std::vector<std::pair<RecHitWithDist,ConstRecHitPointer> > posPixelHits
               = myMatchPos->compatibleHits(clusterPos,vertexPos,clusterEnergy,1.) ;
        seedsFromRecHits(posPixelHits,dir,vertexPos,caloCluster,out,true) ;
       }
      else
       {
        // try electron
        std::vector<SeedWithInfo> elePixelSeeds
         = myMatchEle->compatibleSeeds(theInitialSeedColl,clusterPos,vertexPos,clusterEnergy,-1.) ;
        seedsFromTrajectorySeeds(elePixelSeeds,caloCluster,hoe1,hoe2,out,false) ;
        // try positron
        std::vector<SeedWithInfo> posPixelSeeds
         = myMatchPos->compatibleSeeds(theInitialSeedColl,clusterPos,vertexPos,clusterEnergy,1.) ;
        seedsFromTrajectorySeeds(posPixelSeeds,caloCluster,hoe1,hoe2,out,true) ;
       }
     }
   }

  return ;
 }
void ElectronSeedGenerator::seedsFromTrajectorySeeds ( const std::vector< SeedWithInfo > &  elePixelSeeds,
const reco::ElectronSeed::CaloClusterRef cluster,
float  hoe1,
float  hoe2,
reco::ElectronSeedCollection out,
bool  positron 
) [private]

Definition at line 459 of file ElectronSeedGenerator.cc.

References LogDebug, asciidump::s, and reco::ElectronSeed::setCaloCluster().

 {
  if (!pixelSeeds.empty())
   { LogDebug("ElectronSeedGenerator") << "Compatible "<<(positron?"positron":"electron")<<" seeds found." ; }

  std::vector<SeedWithInfo>::const_iterator s;
  for ( s = pixelSeeds.begin() ; s != pixelSeeds.end() ; s++ )
   {
    reco::ElectronSeed seed(s->seed()) ;
    seed.setCaloCluster(cluster,s->hitsMask(),s->subDet2(),s->subDet1(),hoe1,hoe2) ;
    addSeed(seed,&*s,positron,out) ;
   }
 }
void ElectronSeedGenerator::setupES ( const edm::EventSetup setup)

Definition at line 156 of file ElectronSeedGenerator.cc.

References alongMomentum, cacheIDCkfComp_, edm::eventsetup::EventSetupRecord::cacheIdentifier(), cacheIDMagField_, cacheIDNavSchool_, cacheIDTrkGeom_, fromTrackerSeeds_, edm::EventSetup::get(), myMatchEle, myMatchPos, edm::ESHandle< T >::product(), PixelHitMatcher::setES(), theMagField, theMeasurementTracker, theMeasurementTrackerName, theNavigationSchool, thePropagator, and theTrackerGeometry.

Referenced by ElectronSeedProducer::produce().

                                                              {

  // get records if necessary (called once per event)
  bool tochange=false;

  if (cacheIDMagField_!=setup.get<IdealMagneticFieldRecord>().cacheIdentifier()) {
    setup.get<IdealMagneticFieldRecord>().get(theMagField);
    cacheIDMagField_=setup.get<IdealMagneticFieldRecord>().cacheIdentifier();
    if (thePropagator) delete thePropagator;
    thePropagator = new PropagatorWithMaterial(alongMomentum,.000511,&(*theMagField));
    tochange=true;
  }

  if (!fromTrackerSeeds_ && cacheIDCkfComp_!=setup.get<CkfComponentsRecord>().cacheIdentifier()) {
    edm::ESHandle<MeasurementTracker> measurementTrackerHandle;
    setup.get<CkfComponentsRecord>().get(theMeasurementTrackerName,measurementTrackerHandle);
    cacheIDCkfComp_=setup.get<CkfComponentsRecord>().cacheIdentifier();
    theMeasurementTracker = measurementTrackerHandle.product();
    tochange=true;
  }

  //edm::ESHandle<TrackerGeometry> trackerGeometryHandle;
  if (cacheIDTrkGeom_!=setup.get<TrackerDigiGeometryRecord>().cacheIdentifier()) {
    cacheIDTrkGeom_=setup.get<TrackerDigiGeometryRecord>().cacheIdentifier();
    setup.get<TrackerDigiGeometryRecord>().get(theTrackerGeometry);
    tochange=true; //FIXME
  }

  if (tochange) {
    myMatchEle->setES(&(*theMagField),theMeasurementTracker,theTrackerGeometry.product());
    myMatchPos->setES(&(*theMagField),theMeasurementTracker,theTrackerGeometry.product());
  }

  if (cacheIDNavSchool_!=setup.get<NavigationSchoolRecord>().cacheIdentifier()) {
    edm::ESHandle<NavigationSchool> nav;
    setup.get<NavigationSchoolRecord>().get("SimpleNavigationSchool", nav);
    cacheIDNavSchool_=setup.get<NavigationSchoolRecord>().cacheIdentifier();
    theNavigationSchool = nav.product();
  }

//  if (cacheIDGeom_!=setup.get<TrackerRecoGeometryRecord>().cacheIdentifier()) {
//    setup.get<TrackerRecoGeometryRecord>().get( theGeomSearchTracker );
//    cacheIDGeom_=setup.get<TrackerRecoGeometryRecord>().cacheIdentifier();
//  }

}

Member Data Documentation

Definition at line 82 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

unsigned long long ElectronSeedGenerator::cacheIDCkfComp_ [private]

Definition at line 127 of file ElectronSeedGenerator.h.

Referenced by setupES().

unsigned long long ElectronSeedGenerator::cacheIDMagField_ [private]

Definition at line 124 of file ElectronSeedGenerator.h.

Referenced by setupES().

unsigned long long ElectronSeedGenerator::cacheIDNavSchool_ [private]

Definition at line 126 of file ElectronSeedGenerator.h.

Referenced by setupES().

unsigned long long ElectronSeedGenerator::cacheIDTrkGeom_ [private]

Definition at line 128 of file ElectronSeedGenerator.h.

Referenced by setupES().

Definition at line 98 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 99 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 93 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 93 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 94 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 95 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 87 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 74 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 75 of file ElectronSeedGenerator.h.

Referenced by setupES().

Definition at line 85 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 84 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 101 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator(), setupES(), and ~ElectronSeedGenerator().

Definition at line 102 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator(), setupES(), and ~ElectronSeedGenerator().

Definition at line 86 of file ElectronSeedGenerator.h.

Definition at line 90 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 92 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 89 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 91 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 121 of file ElectronSeedGenerator.h.

Definition at line 120 of file ElectronSeedGenerator.h.

Definition at line 88 of file ElectronSeedGenerator.h.

Definition at line 81 of file ElectronSeedGenerator.h.

Definition at line 105 of file ElectronSeedGenerator.h.

Definition at line 107 of file ElectronSeedGenerator.h.

Referenced by setupES().

Definition at line 114 of file ElectronSeedGenerator.h.

Referenced by setupES().

Definition at line 113 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator(), and setupES().

Definition at line 115 of file ElectronSeedGenerator.h.

Referenced by setupES().

Definition at line 111 of file ElectronSeedGenerator.h.

Referenced by setupES(), and ~ElectronSeedGenerator().

Definition at line 117 of file ElectronSeedGenerator.h.

Definition at line 108 of file ElectronSeedGenerator.h.

Referenced by setupES().

Definition at line 110 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator(), and ~ElectronSeedGenerator().

Definition at line 78 of file ElectronSeedGenerator.h.

Definition at line 118 of file ElectronSeedGenerator.h.

Definition at line 77 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().

Definition at line 79 of file ElectronSeedGenerator.h.

Referenced by ElectronSeedGenerator().