CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/RecoEgamma/EgammaHLTAlgos/src/EgammaHLTHcalIsolationDoubleCone.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     EgammaHLTAlgos
00004 // Class  :     EgammaHLTHcalIsolationDoubleCone
00005 // 
00006 // Implementation:
00007 //     use double cone to exclude shower leakage
00008 //     mostly identical to EgammaHLTHcalIsolation, but
00009 //     with an inner exclusion cone 
00010 // Original Author:  
00011 //         Created:  Tue Jun 13 12:16:41 CEST 2006
00012 // $Id: EgammaHLTHcalIsolationDoubleCone.cc,v 1.1 2007/05/31 19:38:50 mpieri Exp $
00013 //
00014 
00015 // include files
00016 
00017 #include "RecoEgamma/EgammaHLTAlgos/interface/EgammaHLTHcalIsolationDoubleCone.h"
00018 
00019 
00020 #define PI 3.141592654
00021 #define TWOPI 6.283185308
00022 
00023 
00024 
00025 float EgammaHLTHcalIsolationDoubleCone::isolPtSum(const reco::RecoCandidate* recocandidate, const HBHERecHitCollection* hbhe, const HFRecHitCollection* hf, const CaloGeometry* geometry){
00026 
00027   float hcalIsol=0.;
00028 
00029   float candSCphi = recocandidate->superCluster()->phi();
00030   float candSCeta = recocandidate->superCluster()->eta();
00031   if(candSCphi<0) candSCphi+=TWOPI;
00032   float conesizeSquared=conesize*conesize;
00033   float exclusionSquared= exclusion*exclusion;
00034 
00035   for(HBHERecHitCollection::const_iterator hbheItr = hbhe->begin(); hbheItr != hbhe->end(); ++hbheItr){
00036     double HcalHit_eta=geometry->getPosition(hbheItr->id()).eta(); //Attention getpos
00037     if(fabs(HcalHit_eta-candSCeta)<conesize) {
00038       float HcalHit_pth=hbheItr->energy()*sin(2*atan(exp(-HcalHit_eta)));
00039       if(HcalHit_pth>ptMin) {
00040         double HcalHit_phi=geometry->getPosition(hbheItr->id()).phi();
00041         float deltaeta=fabs(HcalHit_eta-candSCeta);
00042         if(HcalHit_phi<0) HcalHit_phi+=TWOPI;
00043         float deltaphi=fabs(HcalHit_phi-candSCphi);
00044         if(deltaphi>TWOPI) deltaphi-=TWOPI;
00045         if(deltaphi>PI) deltaphi=TWOPI-deltaphi;
00046         float newDelta= (deltaphi*deltaphi+ deltaeta*deltaeta);
00047         if(newDelta<conesizeSquared && newDelta>exclusionSquared ) hcalIsol+=HcalHit_pth;
00048       }
00049     }      
00050   }
00051 
00052   for(HFRecHitCollection::const_iterator hfItr = hf->begin(); hfItr != hf->end(); ++hfItr){
00053     double HcalHit_eta=geometry->getPosition(hfItr->id()).eta(); //Attention getpos
00054     if(fabs(HcalHit_eta-candSCeta)<conesize) {
00055       float HcalHit_pth=hfItr->energy()*sin(2*atan(exp(-HcalHit_eta)));
00056       if(HcalHit_pth>ptMin) {
00057         double HcalHit_phi=geometry->getPosition(hfItr->id()).phi();
00058         float deltaeta=fabs(HcalHit_eta-candSCeta);
00059         float deltaphi;
00060         if(HcalHit_phi<0) HcalHit_phi+=TWOPI;
00061         if(candSCphi<0) candSCphi+=TWOPI;
00062         deltaphi=fabs(HcalHit_phi-candSCphi);
00063         if(deltaphi>TWOPI) deltaphi-=TWOPI;
00064         if(deltaphi>PI) deltaphi=TWOPI-deltaphi;
00065         float newDelta= (deltaphi*deltaphi+ deltaeta*deltaeta);
00066         if(newDelta<conesizeSquared && newDelta>exclusionSquared ) hcalIsol+=HcalHit_pth;
00067       }
00068     }      
00069   }
00070 
00071 
00072   return hcalIsol;
00073   
00074 }
00075