CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

AlCaElectronsTest Class Reference

#include <AlCaElectronsTest.h>

Inheritance diagram for AlCaElectronsTest:
edm::EDAnalyzer

List of all members.

Public Member Functions

 AlCaElectronsTest (const edm::ParameterSet &)
virtual void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup)
virtual void beginJob ()
virtual void endJob ()
 ~AlCaElectronsTest ()

Private Member Functions

void fillAroundBarrel (const EcalRecHitCollection *recHits, int eta, int phi)
void fillAroundEndcap (const EcalRecHitCollection *recHits, int ics, int ips)
EcalRecHit getMaximum (const EcalRecHitCollection *recHits)

Private Attributes

edm::InputTag m_barrelAlCa
TH2F * m_barrelGlobalCrystalsEnergy
 ECAL Energy.
TH2F * m_barrelGlobalCrystalsEnergyMap
 ECAL EnergyMap.
TH2F * m_barrelGlobalCrystalsMap
 ECAL map.
TH2F * m_barrelLocalCrystalsEnergy
 local Energy
TH2F * m_barrelLocalCrystalsMap
 local map
edm::InputTag m_endcapAlCa
TH2F * m_endcapGlobalCrystalsEnergy
 ECAL Energy.
TH2F * m_endcapGlobalCrystalsEnergyMap
 ECAL EnergyMap.
TH2F * m_endcapGlobalCrystalsMap
 ECAL map.
TH2F * m_endcapLocalCrystalsEnergy
 local Energy
TH2F * m_endcapLocalCrystalsMap
 local map
std::string m_outputFileName

Detailed Description

Definition at line 32 of file AlCaElectronsTest.h.


Constructor & Destructor Documentation

AlCaElectronsTest::AlCaElectronsTest ( const edm::ParameterSet iConfig) [explicit]

Definition at line 80 of file AlCaElectronsTest.h.

                                                                    :
  m_barrelAlCa (iConfig.getParameter<edm::InputTag> ("alcaBarrelHitCollection")) ,
  m_endcapAlCa (iConfig.getParameter<edm::InputTag> ("alcaEndcapHitCollection")) ,
  m_outputFileName (iConfig.getUntrackedParameter<std::string>
                      ("HistOutFile",std::string ("AlCaElectronsTest.root"))) 
{}
AlCaElectronsTest::~AlCaElectronsTest ( ) [inline]

Definition at line 35 of file AlCaElectronsTest.h.

{}

Member Function Documentation

void AlCaElectronsTest::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 135 of file AlCaElectronsTest.h.

References dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, CaloRecHit::energy(), fillAroundBarrel(), fillAroundEndcap(), edm::Event::getByLabel(), getMaximum(), EcalRecHit::id(), edm::EventBase::id(), edm::HandleBase::isValid(), m_barrelAlCa, m_barrelGlobalCrystalsEnergy, m_barrelGlobalCrystalsMap, m_endcapAlCa, m_endcapGlobalCrystalsEnergy, m_endcapGlobalCrystalsMap, and edm::Handle< T >::product().

{
  //FIXME replace with msg logger
  std::cout << "[AlCaElectronsTest] analysing event " 
            << iEvent.id () << std::endl ;

  //PG get the collections  
  // get Barrel RecHits
  edm::Handle<EBRecHitCollection> barrelRecHitsHandle ;
  iEvent.getByLabel (m_barrelAlCa, barrelRecHitsHandle) ;
  if (!barrelRecHitsHandle.isValid()) {
      std::cerr << "[AlCaElectronsTest] caught std::exception "
                << " in rertieving " << m_barrelAlCa 
                << std::endl ;
      return ;
  } else {
      const EBRecHitCollection* barrelHitsCollection = barrelRecHitsHandle.product () ;
      //PG fill the histo with the maximum
      EcalRecHit barrelMax = getMaximum (barrelHitsCollection) ;
      EBDetId barrelMaxId (barrelMax.id ()) ; 
      m_barrelGlobalCrystalsMap->Fill (
          barrelMaxId.ieta () ,
          barrelMaxId.iphi () 
        ) ;
      m_barrelGlobalCrystalsEnergy->Fill (
          barrelMaxId.ieta () ,
          barrelMaxId.iphi () ,
          barrelMax.energy ()
        ) ;
      fillAroundBarrel (
          barrelHitsCollection, 
          barrelMaxId.ieta (), 
          barrelMaxId.iphi ()
        ) ;
  }
  
  // get Endcap RecHits
  edm::Handle<EERecHitCollection> endcapRecHitsHandle ;
  iEvent.getByLabel (m_endcapAlCa,endcapRecHitsHandle) ;
  if (!endcapRecHitsHandle.isValid()) {
      std::cerr << "[AlCaElectronsTest] caught std::exception " 
                << " in rertieving " << m_endcapAlCa 
                << std::endl ;
      return ;
  } else {
      const EERecHitCollection* endcapHitsCollection = endcapRecHitsHandle.product () ;
      //PG fill the histo with the maximum
      EcalRecHit endcapMax = getMaximum (endcapHitsCollection) ;
      EEDetId endcapMaxId (endcapMax.id ()) ; 
      m_endcapGlobalCrystalsMap->Fill (
          endcapMaxId.ix () ,
          endcapMaxId.iy () 
        ) ;
      m_endcapGlobalCrystalsEnergy->Fill (
          endcapMaxId.ix () ,
          endcapMaxId.iy () ,
          endcapMax.energy ()
        ) ;
      fillAroundEndcap (
          endcapHitsCollection, 
          endcapMaxId.ix (), 
          endcapMaxId.iy ()
        ) ;
  }
}
void AlCaElectronsTest::beginJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 92 of file AlCaElectronsTest.h.

References m_barrelGlobalCrystalsEnergy, m_barrelGlobalCrystalsEnergyMap, m_barrelGlobalCrystalsMap, m_barrelLocalCrystalsEnergy, m_barrelLocalCrystalsMap, m_endcapGlobalCrystalsEnergy, m_endcapGlobalCrystalsEnergyMap, m_endcapGlobalCrystalsMap, m_endcapLocalCrystalsEnergy, and m_endcapLocalCrystalsMap.

{
  m_barrelGlobalCrystalsMap = new TH2F ("m_barrelGlobalCrystalsMap","m_barrelGlobalCrystalsMap",171,-85,86,360,0,360) ;
  m_barrelLocalCrystalsMap = new TH2F ("m_barrelLocalCrystalsMap","m_barrelLocalCrystalsMap",20,-10,10,20,-10,10) ;
  m_endcapGlobalCrystalsMap = new TH2F ("m_endcapGlobalCrystalsMap","m_endcapGlobalCrystalsMap",100,0,100,100,0,100) ;
  m_endcapLocalCrystalsMap = new TH2F ("m_endcapLocalCrystalsMap","m_endcapLocalCrystalsMap",20,-10,10,20,-10,10) ;
  m_barrelGlobalCrystalsEnergy = new TH2F ("m_barrelGlobalCrystalsEnergy","m_barrelGlobalCrystalsEnergy",171,-85,86,360,0,360) ;
  m_barrelLocalCrystalsEnergy = new TH2F ("m_barrelLocalCrystalsEnergy","m_barrelLocalCrystalsEnergy",20,-10,10,20,-10,10) ;
  m_endcapGlobalCrystalsEnergy = new TH2F ("m_endcapGlobalCrystalsEnergy","m_endcapGlobalCrystalsEnergy",100,0,100,100,0,100) ;
  m_endcapLocalCrystalsEnergy = new TH2F ("m_endcapLocalCrystalsEnergy","m_endcapLocalCrystalsEnergy",20,-10,10,20,-10,10) ;
  m_barrelGlobalCrystalsEnergyMap = new TH2F ("m_barrelGlobalCrystalsEnergyMap","m_barrelGlobalCrystalsEnergyMap",171,-85,86,360,0,360) ;
  m_endcapGlobalCrystalsEnergyMap = new TH2F ("m_endcapGlobalCrystalsEnergyMap","m_endcapGlobalCrystalsEnergyMap",100,0,100,100,0,100) ;
   return ;
}
void AlCaElectronsTest::endJob ( void  ) [virtual]
void AlCaElectronsTest::fillAroundBarrel ( const EcalRecHitCollection recHits,
int  eta,
int  phi 
) [private]

Definition at line 229 of file AlCaElectronsTest.h.

References edm::SortedCollection< T, SORT >::begin(), HTMLExport::elem(), edm::SortedCollection< T, SORT >::end(), eta(), EBDetId::ieta(), EBDetId::iphi(), m_barrelGlobalCrystalsEnergyMap, m_barrelLocalCrystalsEnergy, m_barrelLocalCrystalsMap, and phi.

Referenced by analyze().

{
  for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
       elem != recHits->end () ;
       ++elem)
    {
      EBDetId elementId = elem->id () ; 
      m_barrelLocalCrystalsMap->Fill (
        elementId.ieta () - eta ,
        elementId.iphi () - phi 
      ) ;
      m_barrelLocalCrystalsEnergy->Fill (
        elementId.ieta () - eta ,
        elementId.iphi () - phi ,
        elem->energy ()
      ) ;
     m_barrelGlobalCrystalsEnergyMap->Fill (
        elementId.ieta () ,
        elementId.iphi () ,
        elem->energy ()
      ) ;

    }   
  return ;
}
void AlCaElectronsTest::fillAroundEndcap ( const EcalRecHitCollection recHits,
int  ics,
int  ips 
) [private]

Definition at line 260 of file AlCaElectronsTest.h.

References edm::SortedCollection< T, SORT >::begin(), HTMLExport::elem(), edm::SortedCollection< T, SORT >::end(), h2_mapping_cfi::ics, EEDetId::ix(), EEDetId::iy(), m_endcapGlobalCrystalsEnergyMap, m_endcapLocalCrystalsEnergy, and m_endcapLocalCrystalsMap.

Referenced by analyze().

{
  for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
       elem != recHits->end () ;
       ++elem)
    {
      EEDetId elementId = elem->id () ; 
      m_endcapLocalCrystalsMap->Fill (
        elementId.ix () - ics ,
        elementId.iy () - ips 
      ) ;
      m_endcapLocalCrystalsEnergy->Fill (
        elementId.ix () - ics ,
        elementId.iy () - ips ,
        elem->energy ()
      ) ;
      m_endcapGlobalCrystalsEnergyMap->Fill (
        elementId.ix () ,
        elementId.iy () ,
        elem->energy ()
      ) ;
    }   
  return ;
}
EcalRecHit AlCaElectronsTest::getMaximum ( const EcalRecHitCollection recHits) [private]

Definition at line 207 of file AlCaElectronsTest.h.

References edm::SortedCollection< T, SORT >::begin(), HTMLExport::elem(), edm::SortedCollection< T, SORT >::end(), relval_parameters_module::energy, and max().

Referenced by analyze().

{
  double energy = 0. ;
  EcalRecHit max ;
  for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
       elem != recHits->end () ;
       ++elem)
    {
      if (elem->energy () > energy)
        {
          energy = elem->energy () ;
          max = *elem ;
        }        
    }   
  return max ;
}

Member Data Documentation

Definition at line 50 of file AlCaElectronsTest.h.

Referenced by analyze().

ECAL Energy.

Definition at line 63 of file AlCaElectronsTest.h.

Referenced by analyze(), beginJob(), and endJob().

ECAL EnergyMap.

Definition at line 71 of file AlCaElectronsTest.h.

Referenced by beginJob(), endJob(), and fillAroundBarrel().

ECAL map.

Definition at line 55 of file AlCaElectronsTest.h.

Referenced by analyze(), beginJob(), and endJob().

local Energy

Definition at line 65 of file AlCaElectronsTest.h.

Referenced by beginJob(), endJob(), and fillAroundBarrel().

local map

Definition at line 57 of file AlCaElectronsTest.h.

Referenced by beginJob(), endJob(), and fillAroundBarrel().

Definition at line 51 of file AlCaElectronsTest.h.

Referenced by analyze().

ECAL Energy.

Definition at line 67 of file AlCaElectronsTest.h.

Referenced by analyze(), beginJob(), and endJob().

ECAL EnergyMap.

Definition at line 73 of file AlCaElectronsTest.h.

Referenced by beginJob(), endJob(), and fillAroundEndcap().

ECAL map.

Definition at line 59 of file AlCaElectronsTest.h.

Referenced by analyze(), beginJob(), and endJob().

local Energy

Definition at line 69 of file AlCaElectronsTest.h.

Referenced by beginJob(), endJob(), and fillAroundEndcap().

local map

Definition at line 61 of file AlCaElectronsTest.h.

Referenced by beginJob(), endJob(), and fillAroundEndcap().

std::string AlCaElectronsTest::m_outputFileName [private]

Definition at line 52 of file AlCaElectronsTest.h.

Referenced by endJob().