CMS 3D CMS Logo

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

SingleEleCalibSelector Class Reference

#include <SingleEleCalibSelector.h>

List of all members.

Public Types

typedef reco::GsfElectronCollection collection
typedef container::const_iterator const_iterator
typedef std::vector< const
reco::GsfElectron * > 
container
typedef reco::GsfElectronRef electron

Public Member Functions

const_iterator begin () const
const_iterator end () const
void select (edm::Handle< collection >, const edm::Event &, const edm::EventSetup &)
 SingleEleCalibSelector (const edm::ParameterSet &iConfig)
 ctor
 ~SingleEleCalibSelector ()
 dtor

Private Member Functions

double EnergyNxN (const std::vector< DetId > &vNxN, const EBRecHitCollection *EBhits, const EERecHitCollection *EEhits)
DetId findMaxHit (const std::vector< std::pair< DetId, float > > &v1, const EBRecHitCollection *EBhits, const EERecHitCollection *EEhits)

Private Attributes

double E3x3OE5x5Max_
double E3x3OE5x5Min_
double E3x3OPinMax_
double E3x3OPinMin_
double E5x5OPoutMax_
double E5x5OPoutMin_
edm::InputTag EBrecHitLabel_
edm::InputTag EErecHitLabel_
double ESCOPinMax_
double ESCOPinMin_
double ESeedOPoutMax_
double ESeedOPoutMin_
double PinMPoutOPinMax_
double PinMPoutOPinMin_
container selected_
edm::ESHandle< CaloTopologytheCaloTopology
 the selected collection

Detailed Description

Definition at line 19 of file SingleEleCalibSelector.h.


Member Typedef Documentation

Definition at line 23 of file SingleEleCalibSelector.h.

typedef container::const_iterator SingleEleCalibSelector::const_iterator

Definition at line 26 of file SingleEleCalibSelector.h.

Definition at line 25 of file SingleEleCalibSelector.h.

Definition at line 24 of file SingleEleCalibSelector.h.


Constructor & Destructor Documentation

SingleEleCalibSelector::SingleEleCalibSelector ( const edm::ParameterSet iConfig)

ctor

Definition at line 27 of file SingleEleCalibSelector.cc.

References E3x3OE5x5Max_, E3x3OE5x5Min_, E3x3OPinMax_, E3x3OPinMin_, E5x5OPoutMax_, E5x5OPoutMin_, EBrecHitLabel_, EErecHitLabel_, ESCOPinMax_, ESCOPinMin_, ESeedOPoutMax_, ESeedOPoutMin_, edm::ParameterSet::getParameter(), PinMPoutOPinMax_, and PinMPoutOPinMin_.

 {
   ESCOPinMin_      = iConfig.getParameter<double>("ESCOPinMin");
   ESCOPinMax_      = iConfig.getParameter<double>("ESCOPinMax");
   ESeedOPoutMin_   = iConfig.getParameter<double>("ESeedOPoutMin");
   ESeedOPoutMax_   = iConfig.getParameter<double>("ESeedOPoutMax");  
   PinMPoutOPinMin_ = iConfig.getParameter<double>("PinMPoutOPinMin");
   PinMPoutOPinMax_ = iConfig.getParameter<double>("PinMPoutOPinMax");   
   E5x5OPoutMin_    = iConfig.getParameter<double>("E5x5OPoutMin");
   E5x5OPoutMax_    = iConfig.getParameter<double>("E5x5OPoutMax");
   E3x3OPinMin_     = iConfig.getParameter<double>("E3x3OPinMin");
   E3x3OPinMax_     = iConfig.getParameter<double>("E3x3OPinMax");
   E3x3OE5x5Min_    = iConfig.getParameter<double>("E3x3OE5x5Min");
   E3x3OE5x5Max_    = iConfig.getParameter<double>("E3x3OE5x5Max"); 
   EBrecHitLabel_   = iConfig.getParameter<edm::InputTag> ("alcaBarrelHitCollection"); 
   EErecHitLabel_   = iConfig.getParameter<edm::InputTag> ("alcaEndcapHitCollection"); 
 }
SingleEleCalibSelector::~SingleEleCalibSelector ( )

dtor

Definition at line 115 of file SingleEleCalibSelector.cc.

{}

Member Function Documentation

const_iterator SingleEleCalibSelector::begin ( ) const [inline]

Definition at line 33 of file SingleEleCalibSelector.h.

References selected_.

{ return selected_.begin(); }
const_iterator SingleEleCalibSelector::end ( ) const [inline]

Definition at line 34 of file SingleEleCalibSelector.h.

References selected_.

{ return selected_.end(); }
double SingleEleCalibSelector::EnergyNxN ( const std::vector< DetId > &  vNxN,
const EBRecHitCollection EBhits,
const EERecHitCollection EEhits 
) [private]

Definition at line 170 of file SingleEleCalibSelector.cc.

References EcalBarrel, and edm::SortedCollection< T, SORT >::find().

Referenced by select().

{
  double dummy = 0.;
  int window_size = vNxN.size(); 
  for (int ixtal = 0; ixtal < window_size; ixtal++){ 
    if (vNxN[ixtal].subdetId() == EcalBarrel) 
      { 
        EBRecHitCollection::const_iterator it_rechit; 
        it_rechit = EBhits->find(vNxN[ixtal]);
        dummy+= it_rechit->energy(); 
      } 
    else 
      { 
        EERecHitCollection::const_iterator it_rechit;
        it_rechit = EEhits->find(vNxN[ixtal]); 
        dummy+= it_rechit->energy(); 
      } 
  }
  
  return dummy;
}
DetId SingleEleCalibSelector::findMaxHit ( const std::vector< std::pair< DetId, float > > &  v1,
const EBRecHitCollection EBhits,
const EERecHitCollection EEhits 
) [private]

Definition at line 123 of file SingleEleCalibSelector.cc.

References EcalBarrel, edm::SortedCollection< T, SORT >::end(), and edm::SortedCollection< T, SORT >::find().

Referenced by select().

{
  double currEnergy = 0. ;
  DetId maxHit ;
  for (std::vector<std::pair<DetId,float> >::const_iterator idsIt = v1.begin () ; 
       idsIt != v1.end () ; ++idsIt)
    {
      if (idsIt->first.subdetId () == EcalBarrel) 
        {              
          EBRecHitCollection::const_iterator itrechit ;
          itrechit = EBhits->find ((*idsIt).first) ;
          if (itrechit == EBhits->end () )
            {
              edm::LogInfo ("reading") << "[findMaxHit] rechit not found! " ;
              continue ;
            }
//FIXME: use fraction ??
          if (itrechit->energy () > currEnergy)
            {
              currEnergy = itrechit->energy () ;
              maxHit= (*idsIt).first ;
            }
        }
      else 
        {     
          EERecHitCollection::const_iterator itrechit ;
          itrechit = EEhits->find ((*idsIt).first) ;
          if (itrechit == EEhits->end () )
            {
              edm::LogInfo ("reading")<< "[findMaxHit] rechit not found! " ;
              continue ;
            }
          
          if (itrechit->energy () > currEnergy)
            {
              currEnergy=itrechit->energy () ;
              maxHit= (*idsIt).first ;
            }
        }
    }
  return maxHit ;
}
void SingleEleCalibSelector::select ( edm::Handle< collection inputHandle,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)

Definition at line 51 of file SingleEleCalibSelector.cc.

References gather_cfg::cout, E3x3OE5x5Max_, E3x3OE5x5Min_, E3x3OPinMax_, E3x3OPinMin_, E5x5OPoutMax_, E5x5OPoutMin_, EBrecHitLabel_, DetId::Ecal, EErecHitLabel_, EnergyNxN(), ESCOPinMax_, ESCOPinMin_, ESeedOPoutMax_, ESeedOPoutMin_, findMaxHit(), edm::EventSetup::get(), edm::Event::getByLabel(), CaloSubdetectorTopology::getWindow(), DetId::null(), PinMPoutOPinMax_, PinMPoutOPinMin_, edm::Handle< T >::product(), selected_, DetId::subdetId(), and theCaloTopology.

{
  selected_.clear();

  //Get the EB rechit collection
  edm::Handle<EBRecHitCollection> barrelRecHitsHandle ;
  iEvent.getByLabel (EBrecHitLabel_, barrelRecHitsHandle) ;
  const EBRecHitCollection* EBHitsColl = barrelRecHitsHandle.product () ; 

  //Get the EE rechit collection
  edm::Handle<EERecHitCollection> endcapRecHitsHandle ;
  iEvent.getByLabel (EErecHitLabel_, endcapRecHitsHandle) ;
  const EERecHitCollection* EEHitsColl = endcapRecHitsHandle.product () ; 
  
  //To deal with Geometry
  iSetup.get<CaloTopologyRecord>().get(theCaloTopology); 

  //Loop over electrons
  for( collection::const_iterator ele = (*inputHandle).begin(); ele != (*inputHandle).end(); ++ ele ){
     
    //Find DetID max hit
    DetId maxHitId = findMaxHit((*ele).superCluster()->hitsAndFractions(),EBHitsColl,EEHitsColl);
    
    if(maxHitId.null()){std::cout<<" Null Id"<<std::endl; continue;}

    // Find 3x3 and 5x5 windows around xtal max and compute E3x3,E5x5
    double E5x5 = 0.; 
    double E3x3 = 0.; 
  
    const CaloSubdetectorTopology* topology = theCaloTopology->getSubdetectorTopology(DetId::Ecal,maxHitId.subdetId()); 
    int WindowSize = 5;
    std::vector<DetId> m5x5aroundMax = topology->getWindow(maxHitId,WindowSize,WindowSize); 
    E5x5 = EnergyNxN(m5x5aroundMax,EBHitsColl,EEHitsColl);
    WindowSize = 3;
    std::vector<DetId> m3x3aroundMax = topology->getWindow(maxHitId,WindowSize,WindowSize); 
    E3x3 = EnergyNxN(m3x3aroundMax,EBHitsColl,EEHitsColl);

    double pin = ele->trackMomentumAtVtx ().R () ;
    double piMpoOpi = (pin - ele->trackMomentumOut ().R ()) / pin ;
    double E5x5OPout = E5x5/ele->trackMomentumOut ().R () ;
    double E3x3OPin = E3x3/pin;
    double E3x3OE5x5 = E3x3/E5x5;
    double EseedOPout = ele->eSeedClusterOverPout () ;
    double EoPin = ele->eSuperClusterOverP () ;      
  
    if ( piMpoOpi > PinMPoutOPinMin_ && piMpoOpi < PinMPoutOPinMax_ && 
         EseedOPout > ESeedOPoutMin_ && EseedOPout < ESeedOPoutMax_ &&
         EoPin > ESCOPinMin_ && EoPin < ESCOPinMax_ &&
         E5x5OPout > E5x5OPoutMin_ && E5x5OPout < E5x5OPoutMax_ && 
         E3x3OPin > E3x3OPinMin_ && E3x3OPin < E3x3OPinMax_ &&
         E3x3OE5x5 > E3x3OE5x5Min_ && E3x3OE5x5 < E3x3OE5x5Max_)
      {
        selected_.push_back( & (*ele) );
      }
  }
   
  return ;
}       

Member Data Documentation

Definition at line 53 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

Definition at line 52 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

Definition at line 53 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

Definition at line 52 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

Definition at line 53 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

Definition at line 52 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

Definition at line 54 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

Definition at line 55 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

Definition at line 53 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

Definition at line 52 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

Definition at line 53 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

Definition at line 52 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

Definition at line 53 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

Definition at line 52 of file SingleEleCalibSelector.h.

Referenced by select(), and SingleEleCalibSelector().

Definition at line 40 of file SingleEleCalibSelector.h.

Referenced by begin(), end(), and select().

the selected collection

Definition at line 42 of file SingleEleCalibSelector.h.

Referenced by select().