CMS 3D CMS Logo

GlobalGsfElectronAlgo Class Reference

Class to reconstruct electron tracks from electron pixel seeds keep track of information about the initiating supercluster. More...

#include <RecoEgamma/EgammaElectronAlgos/interface/GlobalGsfElectronAlgo.h>

List of all members.

Public Member Functions

 GlobalGsfElectronAlgo (const edm::ParameterSet &conf, double maxEOverPBarrel, double maxEOverPEndcaps, double minEOverPBarrel, double minEOverPEndcaps, double maxDeltaEta, double maxDeltaPhi, bool highPtPresel, double highPtMin, bool applyEtaCorrection, bool applyAmbResolution)
void run (edm::Event &, reco::GsfElectronCollection &)
void setupES (const edm::EventSetup &setup)
 ~GlobalGsfElectronAlgo ()

Private Member Functions

bool calculateTSOS (const reco::GsfTrack &t, const reco::SuperCluster &theClus, const math::XYZPoint &bs)
GlobalVector computeMode (const TrajectoryStateOnSurface &tsos)
void createElectron (const reco::SuperClusterRef &scRef, const reco::GsfTrackRef &trackRef, reco::GsfElectronCollection &outEle)
bool preSelection (const reco::SuperCluster &clus)
void process (edm::Handle< reco::GsfTrackCollection > tracksH, edm::Handle< reco::SuperClusterCollection > superClustersBarrelH, edm::Handle< reco::SuperClusterCollection > superClustersEndcapH, const math::XYZPoint &bs, reco::GsfElectronCollection &outEle)
void resolveElectrons (std::vector< reco::GsfElectron > &, reco::GsfElectronCollection &outEle)
const reco::GsfTrackRef superClusterMatching (reco::SuperClusterRef sc, edm::Handle< reco::GsfTrackCollection > tracks)

Private Attributes

bool applyAmbResolution_
bool applyEtaCorrection_
edm::InputTag barrelSuperClusters_
unsigned long long cacheIDGeom_
unsigned long long cacheIDMagField_
unsigned long long cacheIDTDGeom_
edm::InputTag endcapSuperClusters_
const GsfPropagatorAdaptergeomPropBw_
const GsfPropagatorAdaptergeomPropFw_
edm::InputTag hcalRecHits_
double highPtMin_
bool highPtPreselection_
TrajectoryStateOnSurface innTSOS_
double maxDeltaEta_
double maxDeltaPhi_
double maxEOverPBarrel_
double maxEOverPEndcaps_
HBHERecHitMetaCollectionmhbhe_
double minEOverPBarrel_
double minEOverPEndcaps_
const
MultiTrajectoryStateTransform
mtsTransform_
TrajectoryStateOnSurface outTSOS_
GlobalPoint sclPos_
TrajectoryStateOnSurface sclTSOS_
TrajectoryStateOnSurface seedTSOS_
int subdet_
edm::ESHandle< CaloGeometrytheCaloGeom
edm::ESHandle< MagneticFieldtheMagField
edm::ESHandle< TrackerGeometrytrackerHandle_
edm::InputTag tracks_
GlobalVector vtxMom_
TrajectoryStateOnSurface vtxTSOS_


Detailed Description

Class to reconstruct electron tracks from electron pixel seeds keep track of information about the initiating supercluster.

Description: top algorithm producing TrackCandidate and Electron objects from supercluster driven pixel seeded Ckf tracking.

Author:
U.Berthon, C.Charlot, LLR Palaiseau
Version:
2nd Version Oct 10, 2006

Definition at line 35 of file GlobalGsfElectronAlgo.h.


Constructor & Destructor Documentation

GlobalGsfElectronAlgo::GlobalGsfElectronAlgo ( const edm::ParameterSet conf,
double  maxEOverPBarrel,
double  maxEOverPEndcaps,
double  minEOverPBarrel,
double  minEOverPEndcaps,
double  maxDeltaEta,
double  maxDeltaPhi,
bool  highPtPresel,
double  highPtMin,
bool  applyEtaCorrection,
bool  applyAmbResolution 
)

Definition at line 85 of file GlobalGsfElectronAlgo.cc.

References barrelSuperClusters_, endcapSuperClusters_, geomPropBw_, geomPropFw_, edm::ParameterSet::getParameter(), hcalRecHits_, mtsTransform_, and tracks_.

00090                                                                                                 :  
00091   maxEOverPBarrel_(maxEOverPBarrel), maxEOverPEndcaps_(maxEOverPEndcaps), 
00092   minEOverPBarrel_(minEOverPBarrel), minEOverPEndcaps_(minEOverPEndcaps), 
00093   maxDeltaEta_(maxDeltaEta), maxDeltaPhi_(maxDeltaPhi),
00094   highPtPreselection_(highPtPresel), highPtMin_(highPtMin),
00095   applyEtaCorrection_(applyEtaCorrection), applyAmbResolution_(applyAmbResolution),
00096   cacheIDGeom_(0),cacheIDTDGeom_(0),cacheIDMagField_(0)
00097 {   
00098  // this is the new version allowing to configurate the algo
00099   // interfaces still need improvement!!
00100   mtsTransform_ = new MultiTrajectoryStateTransform;
00101   geomPropBw_=0;        
00102   geomPropFw_=0;        
00103 
00104   // get nested parameter set for the TransientInitialStateEstimator
00105   ParameterSet tise_params = conf.getParameter<ParameterSet>("TransientInitialStateEstimatorParameters") ;
00106   
00107   // get input collections
00108   hcalRecHits_ = conf.getParameter<edm::InputTag>("hcalRecHits");
00109   tracks_ = conf.getParameter<edm::InputTag>("tracks");  
00110   barrelSuperClusters_ = conf.getParameter<edm::InputTag>("barrelSuperClusters");
00111   endcapSuperClusters_ = conf.getParameter<edm::InputTag>("endcapSuperClusters");
00112 }

GlobalGsfElectronAlgo::~GlobalGsfElectronAlgo (  ) 

Definition at line 114 of file GlobalGsfElectronAlgo.cc.

References geomPropBw_, geomPropFw_, and mtsTransform_.

00114                                               {
00115   delete geomPropBw_;
00116   delete geomPropFw_;
00117   delete mtsTransform_;
00118 }


Member Function Documentation

bool GlobalGsfElectronAlgo::calculateTSOS ( const reco::GsfTrack t,
const reco::SuperCluster theClus,
const math::XYZPoint bs 
) [private]

Definition at line 348 of file GlobalGsfElectronAlgo.cc.

References MultiTrajectoryStateTransform::innerStateOnSurface(), innTSOS_, TrajectoryStateOnSurface::isValid(), mtsTransform_, MultiTrajectoryStateTransform::outerStateOnSurface(), outTSOS_, edm::ESHandle< T >::product(), sclTSOS_, reco::SuperCluster::seed(), seedTSOS_, theMagField, trackerHandle_, vtxTSOS_, reco::CaloCluster::x(), reco::CaloCluster::y(), and reco::CaloCluster::z().

Referenced by process().

00349            {
00350 
00351     //at innermost point
00352     innTSOS_ = mtsTransform_->innerStateOnSurface(t, *(trackerHandle_.product()), theMagField.product());
00353     if (!innTSOS_.isValid()) return false;
00354 
00355     //at vertex
00356     // innermost state propagation to the beam spot position
00357     vtxTSOS_ 
00358       = TransverseImpactPointExtrapolator(*geomPropBw_).extrapolate(innTSOS_,GlobalPoint(bsPosition.x(),bsPosition.y(),bsPosition.z()));
00359     if (!vtxTSOS_.isValid()) vtxTSOS_=innTSOS_;
00360 
00361     //at seed
00362     outTSOS_ 
00363       = mtsTransform_->outerStateOnSurface(t, *(trackerHandle_.product()), theMagField.product());
00364     if (!outTSOS_.isValid()) return false;
00365     
00366     //    TrajectoryStateOnSurface seedTSOS 
00367     seedTSOS_ 
00368      = TransverseImpactPointExtrapolator(*geomPropFw_).extrapolate(outTSOS_,GlobalPoint(theClus.seed()->position().x(),theClus.seed()->position().y(),theClus.seed()->position().z()));
00369     if (!seedTSOS_.isValid()) seedTSOS_=outTSOS_;
00370 
00371     //at scl
00372    sclTSOS_ 
00373     = TransverseImpactPointExtrapolator(*geomPropFw_).extrapolate(innTSOS_,GlobalPoint(theClus.x(),theClus.y(),theClus.z()));
00374     if (!sclTSOS_.isValid()) sclTSOS_=outTSOS_;
00375     return true;
00376 }

GlobalVector GlobalGsfElectronAlgo::computeMode ( const TrajectoryStateOnSurface tsos  )  [private]

Definition at line 267 of file GlobalGsfElectronAlgo.cc.

References TrajectoryStateOnSurface::components(), TrajectoryStateOnSurface::isValid(), SingleGaussianState1D::mean(), and GaussianSumUtilities1D::mode().

Referenced by createElectron(), process(), and superClusterMatching().

00267                                                                                     {
00268 
00269   // mode computation for momentum cartesian co-ordinates
00270   // change to 5D in local parameters??
00271   float mode_Px = 0.;
00272   float mode_Py = 0.;
00273   float mode_Pz = 0.;
00274   if ( tsos.isValid() ){
00275     std::vector<TrajectoryStateOnSurface> components(tsos.components());
00276     unsigned int numb = components.size();
00277     std::vector<SingleGaussianState1D> pxStates; pxStates.reserve(numb);
00278     std::vector<SingleGaussianState1D> pyStates; pyStates.reserve(numb);
00279     std::vector<SingleGaussianState1D> pzStates; pzStates.reserve(numb);
00280     for ( std::vector<TrajectoryStateOnSurface>::const_iterator ic=components.begin();
00281           ic!=components.end(); ++ic ) {
00282       GlobalVector momentum(ic->globalMomentum());
00283       AlgebraicSymMatrix66 cov(ic->cartesianError().matrix());
00284       pxStates.push_back(SingleGaussianState1D(momentum.x(),cov(3,3),ic->weight()));
00285       pyStates.push_back(SingleGaussianState1D(momentum.y(),cov(4,4),ic->weight()));
00286       pzStates.push_back(SingleGaussianState1D(momentum.z(),cov(5,5),ic->weight()));
00287     }
00288     MultiGaussianState1D pxState(pxStates);
00289     MultiGaussianState1D pyState(pyStates);
00290     MultiGaussianState1D pzState(pzStates);
00291     GaussianSumUtilities1D pxUtils(pxState);
00292     GaussianSumUtilities1D pyUtils(pyState);
00293     GaussianSumUtilities1D pzUtils(pzState);
00294     mode_Px = pxUtils.mode().mean();
00295     mode_Py = pyUtils.mode().mean();
00296     mode_Pz = pzUtils.mode().mean();
00297   } else edm::LogInfo("") << "tsos not valid!!";
00298   return GlobalVector(mode_Px,mode_Py,mode_Pz); 
00299 
00300 }

void GlobalGsfElectronAlgo::createElectron ( const reco::SuperClusterRef scRef,
const reco::GsfTrackRef trackRef,
reco::GsfElectronCollection outEle 
) [private]

Definition at line 303 of file GlobalGsfElectronAlgo.cc.

References applyEtaCorrection_, computeMode(), ElectronEnergyCorrector::correct(), ElectronMomentumCorrector::correct(), ElectronClassification::correct(), ECALPositionCalculator::ecalEta(), ECALPositionCalculator::ecalPhi(), TrajectoryStateOnSurface::globalPosition(), innTSOS_, PV3DBase< T, PVType, FrameType >::mag(), mhbhe_, outTSOS_, pi, edm::ESHandle< T >::product(), scale, sclPos_, sclTSOS_, seedTSOS_, reco::GsfElectron::setDeltaEtaSuperClusterAtVtx(), reco::GsfElectron::setDeltaPhiSuperClusterAtVtx(), theCaloGeom, theMagField, reco::btau::trackEta, reco::btau::trackPhi, vtxMom_, vtxTSOS_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by process().

00303                                                                                                                                      {
00304       GlobalVector innMom=computeMode(innTSOS_);
00305       GlobalPoint innPos=innTSOS_.globalPosition();
00306       GlobalVector seedMom=computeMode(seedTSOS_);
00307       GlobalPoint  seedPos=seedTSOS_.globalPosition();
00308       GlobalVector sclMom=computeMode(sclTSOS_);    
00309 
00310       GlobalPoint  vtxPos=vtxTSOS_.globalPosition();
00311       GlobalVector outMom=computeMode(outTSOS_);
00312       GlobalPoint  outPos=outTSOS_.globalPosition();
00313 
00314       //create electron
00315       double scale = (*scRef).energy()/vtxMom_.mag();    
00316       math::XYZTLorentzVectorD momentum= math::XYZTLorentzVector(vtxMom_.x()*scale,
00317                                                                  vtxMom_.y()*scale,
00318                                                                  vtxMom_.z()*scale,
00319                                                                  (*scRef).energy());
00320       // should be coming from supercluster!
00321      HoECalculator calc(theCaloGeom);
00322      double HoE=calc(&(*scRef),mhbhe_);
00323      GsfElectron ele(momentum,scRef,trackRef,sclPos_,sclMom,seedPos,seedMom,innPos,innMom,vtxPos,vtxMom_,outPos,outMom,HoE);
00324 
00325       //and set various properties
00326       ECALPositionCalculator ecpc;
00327       float trackEta=ecpc.ecalEta(trackRef->innerMomentum(),trackRef->innerPosition());
00328       float trackPhi=ecpc.ecalPhi(theMagField.product(), trackRef->innerMomentum(),trackRef->innerPosition(),trackRef->charge());
00329 
00330       ele.setDeltaEtaSuperClusterAtVtx((*scRef).position().eta() - trackEta);
00331       float dphi = (*scRef).position().phi() - trackPhi;
00332       if (fabs(dphi)>CLHEP::pi)
00333         dphi = dphi < 0? CLHEP::twopi + dphi : dphi - CLHEP::twopi;
00334       ele.setDeltaPhiSuperClusterAtVtx(dphi);
00335 
00336       // set corrections + classification
00337       ElectronClassification theClassifier;
00338       theClassifier.correct(ele);
00339       ElectronEnergyCorrector theEnCorrector;
00340       theEnCorrector.correct(ele, applyEtaCorrection_);
00341       ElectronMomentumCorrector theMomCorrector;
00342       theMomCorrector.correct(ele,vtxTSOS_);
00343 
00344 
00345       outEle.push_back(ele);
00346 }

bool GlobalGsfElectronAlgo::preSelection ( const reco::SuperCluster clus  )  [private]

Definition at line 219 of file GlobalGsfElectronAlgo.cc.

References EcalBarrel, EcalEndcap, reco::CaloCluster::energy(), reco::CaloCluster::eta(), PV3DBase< T, PVType, FrameType >::eta(), highPtMin_, highPtPreselection_, LogDebug, PV3DBase< T, PVType, FrameType >::mag(), maxDeltaEta_, maxDeltaPhi_, maxEOverPBarrel_, maxEOverPEndcaps_, minEOverPBarrel_, minEOverPEndcaps_, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), reco::CaloCluster::phi(), pi, r2, sclPos_, funct::sqrt(), subdet_, vtxMom_, reco::CaloCluster::x(), reco::CaloCluster::y(), and reco::CaloCluster::z().

Referenced by process().

00220 {
00221 
00222   LogDebug("")<< "========== preSelection ==========";
00223 
00224   double rt2 = clus.x()*clus.x() + clus.y()*clus.y();
00225   double r2 = rt2 + clus.z()*clus.z();
00226   double Et =clus.energy()*sqrt(rt2/r2);
00227 
00228   // pt min
00229   LogDebug("") << "pT : " << vtxMom_.perp();
00230 
00231   // E/p cut
00232   LogDebug("") << "E/p : " << clus.energy()/vtxMom_.mag();
00233 
00234   // no E/p preselection for high pT electrons
00235   if (!highPtPreselection_ || Et <= highPtMin_) {
00236     if ((subdet_==EcalBarrel) && (clus.energy()/vtxMom_.mag() > maxEOverPBarrel_)) return false;
00237     if ((subdet_==EcalEndcap) && (clus.energy()/vtxMom_.mag() > maxEOverPEndcaps_)) return false;
00238     if ((subdet_==EcalBarrel) && (clus.energy()/vtxMom_.mag() < minEOverPBarrel_)) return false;
00239     if ((subdet_==EcalEndcap) && (clus.energy()/vtxMom_.mag() < minEOverPEndcaps_)) return false;
00240   }
00241   LogDebug("") << "E/p criteria is satisfied ";
00242 
00243   // delta eta criteria
00244   double etaclu = clus.eta();
00245   double etatrk = sclPos_.eta();
00246   double deta = etaclu-etatrk;
00247   LogDebug("") << "delta eta : " << deta;
00248   if (fabs(deta) > maxDeltaEta_) return false;
00249   LogDebug("") << "Delta eta criteria is satisfied ";
00250 
00251   // delta phi criteria
00252   double phiclu = clus.phi();
00253   double phitrk = sclPos_.phi();
00254   double dphi = phiclu-phitrk;
00255   if (fabs(dphi)>CLHEP::pi)
00256     dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi;
00257   LogDebug("") << "delta phi : " << dphi;
00258   if (fabs(dphi) > maxDeltaPhi_) return false;
00259   LogDebug("") << "Delta phi criteria is satisfied ";
00260 
00261   LogDebug("") << "electron has passed preselection criteria ";
00262   LogDebug("") << "=================================================";
00263   return true;  
00264 
00265 }  

void GlobalGsfElectronAlgo::process ( edm::Handle< reco::GsfTrackCollection tracksH,
edm::Handle< reco::SuperClusterCollection superClustersBarrelH,
edm::Handle< reco::SuperClusterCollection superClustersEndcapH,
const math::XYZPoint bs,
reco::GsfElectronCollection outEle 
) [private]

Definition at line 442 of file GlobalGsfElectronAlgo.cc.

References calculateTSOS(), edm::RefVector< C, T, F >::clear(), computeMode(), createElectron(), TrajectoryStateOnSurface::globalPosition(), i, edm::Ref< C, T, F >::isNull(), preSelection(), edm::RefVector< C, T, F >::push_back(), sclPos_, sclTSOS_, reco::SuperCluster::seed(), edm::RefVector< C, T, F >::size(), subdet_, superClusterMatching(), vtxMom_, vtxTSOS_, and z.

Referenced by run().

00446                                                             {
00447   
00448   
00449   if (tracksH->size() == 0) {
00450     //std::cout << "Electron lost: no track found. " << std::endl;
00451   } else {
00452     //std::cout << "Number of tracks: " << tracksH->size() << std::endl;
00453   }
00454   
00455   //std::cout << "SuperCluster: " << superClustersBarrelH->size() << "  " << 
00456   //  superClustersEndcapH->size() << std::endl;        
00457 
00458   reco::SuperClusterRefVector superClusters;
00459 
00460   for(int z=0; z<2; ++z) {
00461 
00462     superClusters.clear();
00463     if (z == 0) {
00464       for(reco::SuperClusterCollection::size_type i= 0; i<superClustersBarrelH->size(); ++i){
00465         reco::SuperClusterRef cluster(superClustersBarrelH, i);
00466         superClusters.push_back(cluster);
00467       }
00468       //std::cout << superClustersBarrelH->size() << std::endl;
00469     }
00470     
00471     if (z == 1) {
00472       for(reco::SuperClusterCollection::size_type i= 0; i<superClustersEndcapH->size(); ++i){
00473         reco::SuperClusterRef cluster(superClustersEndcapH, i);
00474         superClusters.push_back(cluster);
00475       }
00476       //std::cout << superClustersEndcapH->size() << std::endl;
00477     }
00478     
00479     //================= loop over SuperClusters ===============
00480 
00481     for(unsigned int i=0; i< superClusters.size(); ++i) {
00482 
00483       //std::cout << "Start matching " << std::endl;    
00484       reco::SuperClusterRef scRef = superClusters[i];
00485       reco::SuperCluster theClus = (*scRef);
00486       reco::GsfTrackRef trackRef = superClusterMatching(scRef, tracksH);
00487       
00488       if(trackRef.isNull()) {
00489         //std::cout << "Electron lost: no supercluster match found: " << tracksH->size() << std::endl;
00490         continue;
00491       }
00492       std::vector<DetId> vecId=theClus.seed()->getHitsByDetId();
00493       subdet_ =vecId[0].subdetId();  
00494 
00495     
00496       // calculate Trajectory StatesOnSurface....
00497       if (!calculateTSOS((*trackRef),theClus,bsPosition)) continue;
00498 
00499       vtxMom_=computeMode(vtxTSOS_);
00500       sclPos_=sclTSOS_.globalPosition();
00501       if (preSelection(theClus)) {
00502         // interface to be improved...
00503         createElectron(scRef,trackRef,outEle);
00504         //LogInfo("")<<"Constructed new electron with energy  "<< (*sclAss)[seed]->energy();
00505       }
00506     }  
00507   }
00508 }

void GlobalGsfElectronAlgo::resolveElectrons ( std::vector< reco::GsfElectron > &  ,
reco::GsfElectronCollection outEle 
) [private]

Referenced by run().

void GlobalGsfElectronAlgo::run ( edm::Event e,
reco::GsfElectronCollection outEle 
)

Definition at line 144 of file GlobalGsfElectronAlgo.cc.

References applyAmbResolution_, barrelSuperClusters_, endcapSuperClusters_, edm::Event::getByLabel(), edm::Event::getByType(), hcalRecHits_, edm::Event::id(), it, LogDebug, mhbhe_, process(), edm::Handle< T >::product(), resolveElectrons(), and tracks_.

Referenced by GlobalGsfElectronProducer::produce().

00144                                                                          {
00145 
00146   // get the input 
00147   edm::Handle<GsfTrackCollection> tracksH;
00148   e.getByLabel(tracks_,tracksH);
00149   
00150   // for HoE calculation
00151   edm::Handle<HBHERecHitCollection> hbhe;
00152   mhbhe_=0;
00153   bool got = e.getByLabel(hcalRecHits_,hbhe);  
00154   if (got) mhbhe_=  new HBHERecHitMetaCollection(*hbhe);
00155 
00156   // get the beamspot from the Event:
00157   edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
00158   e.getByType(recoBeamSpotHandle);
00159   const math::XYZPoint bsPosition = recoBeamSpotHandle->position();
00160 
00161   // temporay array for electron before amb. solving
00162   std::vector<GsfElectron> tempEle;
00163   
00164   // create electrons 
00165   edm::Handle<SuperClusterCollection> superClustersBarrelH; 
00166   e.getByLabel(barrelSuperClusters_,superClustersBarrelH);
00167   
00168   edm::Handle<SuperClusterCollection> superClustersEndcapH; 
00169   e.getByLabel(endcapSuperClusters_, superClustersEndcapH);
00170 
00171   process(tracksH, 
00172           superClustersBarrelH, 
00173           superClustersEndcapH,   
00174           bsPosition,
00175           tempEle);
00176  
00177   std::ostringstream str;
00178 
00179   str << "\n========== GlobalGsfElectronAlgo Info (before amb. solving) ==========";
00180   str << "\nEvent " << e.id();
00181   str << "\nNumber of final electron tracks: " << tracksH.product()->size();
00182   str << "\nNumber of final electrons: " << tempEle.size();
00183   for (vector<GsfElectron>::const_iterator it = tempEle.begin(); it != tempEle.end(); it++) {
00184     str << "\nNew electron with charge, pt, eta, phi : "  << it->charge() << " , " 
00185         << it->pt() << " , " << it->eta() << " , " << it->phi();
00186   }
00187  
00188   str << "\n=================================================";
00189   LogDebug("GlobalGsfElectronAlgo") << str.str();
00190 
00191   std::ostringstream str2;
00192 
00193   if (applyAmbResolution_) {
00194   
00195     resolveElectrons(tempEle, outEle);
00196 
00197     str2 << "\n========== GlobalGsfElectronAlgo Info (after amb. solving) ==========";
00198     str2 << "\nEvent " << e.id();
00199     str2 << "\nNumber of final electron tracks: " << tracksH.product()->size();
00200     str2 << "\nNumber of final electrons: " << outEle.size();
00201     for (vector<GsfElectron>::const_iterator it = outEle.begin(); it != outEle.end(); it++) {
00202       str2 << "\nNew electron with charge, pt, eta, phi : "  << it->charge() << " , " 
00203           << it->pt() << " , " << it->eta() << " , " << it->phi();
00204     }
00205 
00206     str2 << "\n=================================================";
00207     LogDebug("GlobalGsfElectronAlgo") << str2.str();
00208 
00209   } else {
00210   
00211     outEle = tempEle;
00212   
00213   }
00214   
00215   delete mhbhe_;
00216   return;
00217 }

void GlobalGsfElectronAlgo::setupES ( const edm::EventSetup setup  ) 

Definition at line 120 of file GlobalGsfElectronAlgo.cc.

References alongMomentum, AnalyticalPropagator_cfi::AnalyticalPropagator, cacheIDGeom_, cacheIDMagField_, cacheIDTDGeom_, geomPropBw_, geomPropFw_, edm::EventSetup::get(), oppositeToMomentum, edm::ESHandle< T >::product(), theCaloGeom, theMagField, and trackerHandle_.

Referenced by GlobalGsfElectronProducer::produce().

00120                                                            {
00121 
00122   // get EventSetupRecords if needed
00123   if (cacheIDMagField_!=es.get<IdealMagneticFieldRecord>().cacheIdentifier()){
00124     cacheIDMagField_=es.get<IdealMagneticFieldRecord>().cacheIdentifier();
00125     es.get<IdealMagneticFieldRecord>().get(theMagField);
00126     if (geomPropBw_) delete geomPropBw_;
00127     geomPropBw_ = new GsfPropagatorAdapter(AnalyticalPropagator(theMagField.product(), oppositeToMomentum));
00128     if (geomPropFw_) delete geomPropFw_;
00129     geomPropFw_ = new GsfPropagatorAdapter(AnalyticalPropagator(theMagField.product(), alongMomentum));
00130   }
00131   if (cacheIDTDGeom_!=es.get<TrackerDigiGeometryRecord>().cacheIdentifier()){
00132     cacheIDTDGeom_=es.get<TrackerDigiGeometryRecord>().cacheIdentifier();
00133     es.get<TrackerDigiGeometryRecord>().get(trackerHandle_);
00134   }
00135 
00136   if (cacheIDGeom_!=es.get<CaloGeometryRecord>().cacheIdentifier()){
00137     cacheIDGeom_=es.get<CaloGeometryRecord>().cacheIdentifier();
00138     es.get<CaloGeometryRecord>().get(theCaloGeom);
00139   }
00140   
00141 
00142 }

const reco::GsfTrackRef GlobalGsfElectronAlgo::superClusterMatching ( reco::SuperClusterRef  sc,
edm::Handle< reco::GsfTrackCollection tracks 
) [private]

Definition at line 511 of file GlobalGsfElectronAlgo.cc.

References computeMode(), funct::cos(), dPhi(), i, MultiTrajectoryStateTransform::innerStateOnSurface(), TrajectoryStateOnSurface::isValid(), PV3DBase< T, PVType, FrameType >::mag(), min, mtsTransform_, MultiTrajectoryStateTransform::outerStateOnSurface(), edm::ESHandle< T >::product(), funct::sin(), theMagField, track, and trackerHandle_.

Referenced by process().

00511                                                                                                             {
00512 
00513   double minDr = 0.5;
00514   double minDeop = 10.;
00515   //reco::SuperClusterRef theClus = edm::Ref<SuperClusterCollection>();
00516   reco::GsfTrackRef theTrack = edm::Ref<reco::GsfTrackCollection>();
00517 
00518 
00519   for(reco::GsfTrackCollection::size_type i=0; i<tracks->size(); ++i){
00520     reco::GsfTrackRef track(tracks, i);
00521     math::XYZVector trackGlobalDir(track->momentum());   
00522     math::XYZVector clusterGlobalDir(sc->x() - track->vx(), sc->y() - track->vy(), sc->z() - track->vz());
00523     //math::XYZVector clusterGlobalPos(sc->x(), sc->y(), sc->z());
00524     
00525     double clusEt = sc->energy()*sin(clusterGlobalDir.theta());
00526     double clusEstimatedCurvature = clusEt/0.3/4*100;  //4 tesla (temporary solution)
00527     double DphiBending = sc->position().rho()/2./clusEstimatedCurvature; //ecal radius
00528 
00529 
00530     double tmpDr = ROOT::Math::VectorUtil::DeltaR(clusterGlobalDir, trackGlobalDir);
00531     if ( !(tmpDr < minDr) ) continue;
00532 
00533     TrajectoryStateOnSurface innTSOS = mtsTransform_->innerStateOnSurface(*track, *(trackerHandle_.product()), theMagField.product());
00534     GlobalVector innMom=computeMode(innTSOS);
00535 
00536     TrajectoryStateOnSurface outTSOS = mtsTransform_->outerStateOnSurface(*track, *(trackerHandle_.product()), theMagField.product());
00537     if (!outTSOS.isValid())   continue;
00538 
00539     TrajectoryStateOnSurface seedTSOS = TransverseImpactPointExtrapolator(*geomPropFw_).extrapolate(outTSOS,GlobalPoint(sc->seed()->position().x(),sc->seed()->position().y(),sc->seed()->position().z()));
00540     if (!seedTSOS.isValid()) seedTSOS=outTSOS;
00541 
00542     GlobalVector seedMom=computeMode(seedTSOS);
00543 
00544     double eOverPin  = sc->energy()/innMom.mag();
00545     //    double eOverPout = sc->seed()->energy()/seedMom.mag();
00546  
00547     double Deta = fabs(clusterGlobalDir.eta() - trackGlobalDir.eta());
00548     double dPhi = fabs(acos(cos(clusterGlobalDir.phi() - trackGlobalDir.phi())));
00549     float dPhi1 = fabs(dPhi - DphiBending);
00550     float dPhi2 = fabs(dPhi + DphiBending);
00551 
00552     //    if( !(eOverPout>0.5) ) continue;
00553     if( !(eOverPin<5) )  continue;
00554     if( !(min(dPhi1,dPhi2) < 0.1) )  continue;
00555     if( !(Deta < 0.02) ) continue;
00556 
00557     //    cout << " in matchbox, dphi, deta: " << Dphi << " , " << Deta << endl;
00558     //    cout << " in matchbox, E/Pin, out: " << eOverPin << " , " << eOverPout << endl;
00559 
00560     if( fabs(eOverPin-1.) < minDeop){
00561       minDeop = fabs(eOverPin-1.) ;
00562       theTrack = track;
00563     }
00564   }
00565 
00566   //cout << " in matchbox, minD(eop): " << minDeop << endl;
00567   //std::cout << "returning null ref" << std::endl;
00568   return theTrack;
00569 }


Member Data Documentation

bool GlobalGsfElectronAlgo::applyAmbResolution_ [private]

Definition at line 100 of file GlobalGsfElectronAlgo.h.

Referenced by run().

bool GlobalGsfElectronAlgo::applyEtaCorrection_ [private]

Definition at line 97 of file GlobalGsfElectronAlgo.h.

Referenced by createElectron().

edm::InputTag GlobalGsfElectronAlgo::barrelSuperClusters_ [private]

Definition at line 103 of file GlobalGsfElectronAlgo.h.

Referenced by GlobalGsfElectronAlgo(), and run().

unsigned long long GlobalGsfElectronAlgo::cacheIDGeom_ [private]

Definition at line 128 of file GlobalGsfElectronAlgo.h.

Referenced by setupES().

unsigned long long GlobalGsfElectronAlgo::cacheIDMagField_ [private]

Definition at line 130 of file GlobalGsfElectronAlgo.h.

Referenced by setupES().

unsigned long long GlobalGsfElectronAlgo::cacheIDTDGeom_ [private]

Definition at line 129 of file GlobalGsfElectronAlgo.h.

Referenced by setupES().

edm::InputTag GlobalGsfElectronAlgo::endcapSuperClusters_ [private]

Definition at line 104 of file GlobalGsfElectronAlgo.h.

Referenced by GlobalGsfElectronAlgo(), and run().

const GsfPropagatorAdapter* GlobalGsfElectronAlgo::geomPropBw_ [private]

Definition at line 113 of file GlobalGsfElectronAlgo.h.

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

const GsfPropagatorAdapter* GlobalGsfElectronAlgo::geomPropFw_ [private]

Definition at line 114 of file GlobalGsfElectronAlgo.h.

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

edm::InputTag GlobalGsfElectronAlgo::hcalRecHits_ [private]

Definition at line 106 of file GlobalGsfElectronAlgo.h.

Referenced by GlobalGsfElectronAlgo(), and run().

double GlobalGsfElectronAlgo::highPtMin_ [private]

Definition at line 94 of file GlobalGsfElectronAlgo.h.

Referenced by preSelection().

bool GlobalGsfElectronAlgo::highPtPreselection_ [private]

Definition at line 93 of file GlobalGsfElectronAlgo.h.

Referenced by preSelection().

TrajectoryStateOnSurface GlobalGsfElectronAlgo::innTSOS_ [private]

Definition at line 120 of file GlobalGsfElectronAlgo.h.

Referenced by calculateTSOS(), and createElectron().

double GlobalGsfElectronAlgo::maxDeltaEta_ [private]

Definition at line 87 of file GlobalGsfElectronAlgo.h.

Referenced by preSelection().

double GlobalGsfElectronAlgo::maxDeltaPhi_ [private]

Definition at line 90 of file GlobalGsfElectronAlgo.h.

Referenced by preSelection().

double GlobalGsfElectronAlgo::maxEOverPBarrel_ [private]

Definition at line 81 of file GlobalGsfElectronAlgo.h.

Referenced by preSelection().

double GlobalGsfElectronAlgo::maxEOverPEndcaps_ [private]

Definition at line 82 of file GlobalGsfElectronAlgo.h.

Referenced by preSelection().

HBHERecHitMetaCollection* GlobalGsfElectronAlgo::mhbhe_ [private]

Definition at line 126 of file GlobalGsfElectronAlgo.h.

Referenced by createElectron(), and run().

double GlobalGsfElectronAlgo::minEOverPBarrel_ [private]

Definition at line 84 of file GlobalGsfElectronAlgo.h.

Referenced by preSelection().

double GlobalGsfElectronAlgo::minEOverPEndcaps_ [private]

Definition at line 85 of file GlobalGsfElectronAlgo.h.

Referenced by preSelection().

const MultiTrajectoryStateTransform* GlobalGsfElectronAlgo::mtsTransform_ [private]

Definition at line 112 of file GlobalGsfElectronAlgo.h.

Referenced by calculateTSOS(), GlobalGsfElectronAlgo(), superClusterMatching(), and ~GlobalGsfElectronAlgo().

TrajectoryStateOnSurface GlobalGsfElectronAlgo::outTSOS_ [private]

Definition at line 121 of file GlobalGsfElectronAlgo.h.

Referenced by calculateTSOS(), and createElectron().

GlobalPoint GlobalGsfElectronAlgo::sclPos_ [private]

Definition at line 118 of file GlobalGsfElectronAlgo.h.

Referenced by createElectron(), preSelection(), and process().

TrajectoryStateOnSurface GlobalGsfElectronAlgo::sclTSOS_ [private]

Definition at line 123 of file GlobalGsfElectronAlgo.h.

Referenced by calculateTSOS(), createElectron(), and process().

TrajectoryStateOnSurface GlobalGsfElectronAlgo::seedTSOS_ [private]

Definition at line 124 of file GlobalGsfElectronAlgo.h.

Referenced by calculateTSOS(), and createElectron().

int GlobalGsfElectronAlgo::subdet_ [private]

Definition at line 117 of file GlobalGsfElectronAlgo.h.

Referenced by preSelection(), and process().

edm::ESHandle<CaloGeometry> GlobalGsfElectronAlgo::theCaloGeom [private]

Definition at line 109 of file GlobalGsfElectronAlgo.h.

Referenced by createElectron(), and setupES().

edm::ESHandle<MagneticField> GlobalGsfElectronAlgo::theMagField [private]

Definition at line 108 of file GlobalGsfElectronAlgo.h.

Referenced by calculateTSOS(), createElectron(), setupES(), and superClusterMatching().

edm::ESHandle<TrackerGeometry> GlobalGsfElectronAlgo::trackerHandle_ [private]

Definition at line 110 of file GlobalGsfElectronAlgo.h.

Referenced by calculateTSOS(), setupES(), and superClusterMatching().

edm::InputTag GlobalGsfElectronAlgo::tracks_ [private]

Definition at line 105 of file GlobalGsfElectronAlgo.h.

Referenced by GlobalGsfElectronAlgo(), and run().

GlobalVector GlobalGsfElectronAlgo::vtxMom_ [private]

Definition at line 119 of file GlobalGsfElectronAlgo.h.

Referenced by createElectron(), preSelection(), and process().

TrajectoryStateOnSurface GlobalGsfElectronAlgo::vtxTSOS_ [private]

Definition at line 122 of file GlobalGsfElectronAlgo.h.

Referenced by calculateTSOS(), createElectron(), and process().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:21:39 2009 for CMSSW by  doxygen 1.5.4