CMS 3D CMS Logo

AlCaElectronsTest Class Reference

#include <Calibration/EcalAlCaRecoProducers/src/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 (const edm::EventSetup &iSetup)
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 36 of file AlCaElectronsTest.h.


Constructor & Destructor Documentation

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

Definition at line 84 of file AlCaElectronsTest.h.

00084                                                                     :
00085   m_barrelAlCa (iConfig.getParameter<edm::InputTag> ("alcaBarrelHitCollection")) ,
00086   m_endcapAlCa (iConfig.getParameter<edm::InputTag> ("alcaEndcapHitCollection")) ,
00087   m_outputFileName (iConfig.getUntrackedParameter<std::string>
00088                       ("HistOutFile",std::string ("AlCaElectronsTest.root"))) 
00089 {}

AlCaElectronsTest::~AlCaElectronsTest (  )  [inline]

Definition at line 39 of file AlCaElectronsTest.h.

00039 {}


Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 139 of file AlCaElectronsTest.h.

References TestMuL1L2Filter_cff::cerr, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), CaloRecHit::energy(), fillAroundBarrel(), fillAroundEndcap(), edm::Event::getByLabel(), getMaximum(), EcalRecHit::id(), edm::Event::id(), edm::Handle< T >::isValid(), m_barrelAlCa, m_barrelGlobalCrystalsEnergy, m_barrelGlobalCrystalsMap, m_endcapAlCa, m_endcapGlobalCrystalsEnergy, m_endcapGlobalCrystalsMap, and edm::Handle< T >::product().

00141 {
00142   //FIXME replace with msg logger
00143   std::cout << "[AlCaElectronsTest] analysing event " 
00144             << iEvent.id () << std::endl ;
00145 
00146   //PG get the collections  
00147   // get Barrel RecHits
00148   Handle<EBRecHitCollection> barrelRecHitsHandle ;
00149   iEvent.getByLabel (m_barrelAlCa, barrelRecHitsHandle) ;
00150   if (!barrelRecHitsHandle.isValid()) {
00151       std::cerr << "[AlCaElectronsTest] caught std::exception "
00152                 << " in rertieving " << m_barrelAlCa 
00153                 << std::endl ;
00154       return ;
00155   } else {
00156       const EBRecHitCollection* barrelHitsCollection = barrelRecHitsHandle.product () ;
00157       //PG fill the histo with the maximum
00158       EcalRecHit barrelMax = getMaximum (barrelHitsCollection) ;
00159       EBDetId barrelMaxId (barrelMax.id ()) ; 
00160       m_barrelGlobalCrystalsMap->Fill (
00161           barrelMaxId.ieta () ,
00162           barrelMaxId.iphi () 
00163         ) ;
00164       m_barrelGlobalCrystalsEnergy->Fill (
00165           barrelMaxId.ieta () ,
00166           barrelMaxId.iphi () ,
00167           barrelMax.energy ()
00168         ) ;
00169       fillAroundBarrel (
00170           barrelHitsCollection, 
00171           barrelMaxId.ieta (), 
00172           barrelMaxId.iphi ()
00173         ) ;
00174   }
00175   
00176   // get Endcap RecHits
00177   Handle<EERecHitCollection> endcapRecHitsHandle ;
00178   iEvent.getByLabel (m_endcapAlCa,endcapRecHitsHandle) ;
00179   if (!endcapRecHitsHandle.isValid()) {
00180       std::cerr << "[AlCaElectronsTest] caught std::exception " 
00181                 << " in rertieving " << m_endcapAlCa 
00182                 << std::endl ;
00183       return ;
00184   } else {
00185       const EERecHitCollection* endcapHitsCollection = endcapRecHitsHandle.product () ;
00186       //PG fill the histo with the maximum
00187       EcalRecHit endcapMax = getMaximum (endcapHitsCollection) ;
00188       EEDetId endcapMaxId (endcapMax.id ()) ; 
00189       m_endcapGlobalCrystalsMap->Fill (
00190           endcapMaxId.ix () ,
00191           endcapMaxId.iy () 
00192         ) ;
00193       m_endcapGlobalCrystalsEnergy->Fill (
00194           endcapMaxId.ix () ,
00195           endcapMaxId.iy () ,
00196           endcapMax.energy ()
00197         ) ;
00198       fillAroundEndcap (
00199           endcapHitsCollection, 
00200           endcapMaxId.ix (), 
00201           endcapMaxId.iy ()
00202         ) ;
00203   }
00204 }

void AlCaElectronsTest::beginJob ( const edm::EventSetup iSetup  )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 96 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.

00097 {
00098   m_barrelGlobalCrystalsMap = new TH2F ("m_barrelGlobalCrystalsMap","m_barrelGlobalCrystalsMap",171,-85,86,360,0,360) ;
00099   m_barrelLocalCrystalsMap = new TH2F ("m_barrelLocalCrystalsMap","m_barrelLocalCrystalsMap",20,-10,10,20,-10,10) ;
00100   m_endcapGlobalCrystalsMap = new TH2F ("m_endcapGlobalCrystalsMap","m_endcapGlobalCrystalsMap",100,0,100,100,0,100) ;
00101   m_endcapLocalCrystalsMap = new TH2F ("m_endcapLocalCrystalsMap","m_endcapLocalCrystalsMap",20,-10,10,20,-10,10) ;
00102   m_barrelGlobalCrystalsEnergy = new TH2F ("m_barrelGlobalCrystalsEnergy","m_barrelGlobalCrystalsEnergy",171,-85,86,360,0,360) ;
00103   m_barrelLocalCrystalsEnergy = new TH2F ("m_barrelLocalCrystalsEnergy","m_barrelLocalCrystalsEnergy",20,-10,10,20,-10,10) ;
00104   m_endcapGlobalCrystalsEnergy = new TH2F ("m_endcapGlobalCrystalsEnergy","m_endcapGlobalCrystalsEnergy",100,0,100,100,0,100) ;
00105   m_endcapLocalCrystalsEnergy = new TH2F ("m_endcapLocalCrystalsEnergy","m_endcapLocalCrystalsEnergy",20,-10,10,20,-10,10) ;
00106   m_barrelGlobalCrystalsEnergyMap = new TH2F ("m_barrelGlobalCrystalsEnergyMap","m_barrelGlobalCrystalsEnergyMap",171,-85,86,360,0,360) ;
00107   m_endcapGlobalCrystalsEnergyMap = new TH2F ("m_endcapGlobalCrystalsEnergyMap","m_endcapGlobalCrystalsEnergyMap",100,0,100,100,0,100) ;
00108    return ;
00109 }

void AlCaElectronsTest::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 116 of file AlCaElectronsTest.h.

References m_barrelGlobalCrystalsEnergy, m_barrelGlobalCrystalsEnergyMap, m_barrelGlobalCrystalsMap, m_barrelLocalCrystalsEnergy, m_barrelLocalCrystalsMap, m_endcapGlobalCrystalsEnergy, m_endcapGlobalCrystalsEnergyMap, m_endcapGlobalCrystalsMap, m_endcapLocalCrystalsEnergy, m_endcapLocalCrystalsMap, m_outputFileName, and output().

00117 {      
00118    TFile output (m_outputFileName.c_str (),"recreate") ;
00119    m_barrelGlobalCrystalsMap->Write () ;
00120    m_barrelLocalCrystalsMap->Write () ;
00121    m_endcapGlobalCrystalsMap->Write () ;
00122    m_endcapLocalCrystalsMap->Write () ;   
00123    m_barrelGlobalCrystalsEnergy->Write () ;
00124    m_barrelLocalCrystalsEnergy->Write () ;
00125    m_endcapGlobalCrystalsEnergy->Write () ;
00126    m_endcapLocalCrystalsEnergy->Write () ;   
00127    m_barrelGlobalCrystalsEnergyMap->Write () ;
00128    m_endcapGlobalCrystalsEnergyMap->Write () ;
00129    output.Close () ;
00130    //PG save root things
00131    return ;
00132 }

void AlCaElectronsTest::fillAroundBarrel ( const EcalRecHitCollection recHits,
int  eta,
int  phi 
) [private]

Definition at line 233 of file AlCaElectronsTest.h.

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

Referenced by analyze().

00234 {
00235   for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
00236        elem != recHits->end () ;
00237        ++elem)
00238     {
00239       EBDetId elementId = elem->id () ; 
00240       m_barrelLocalCrystalsMap->Fill (
00241         elementId.ieta () - eta ,
00242         elementId.iphi () - phi 
00243       ) ;
00244       m_barrelLocalCrystalsEnergy->Fill (
00245         elementId.ieta () - eta ,
00246         elementId.iphi () - phi ,
00247         elem->energy ()
00248       ) ;
00249      m_barrelGlobalCrystalsEnergyMap->Fill (
00250         elementId.ieta () ,
00251         elementId.iphi () ,
00252         elem->energy ()
00253       ) ;
00254 
00255     }   
00256   return ;
00257 }

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

Definition at line 264 of file AlCaElectronsTest.h.

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

Referenced by analyze().

00265 {
00266   for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
00267        elem != recHits->end () ;
00268        ++elem)
00269     {
00270       EEDetId elementId = elem->id () ; 
00271       m_endcapLocalCrystalsMap->Fill (
00272         elementId.ix () - ics ,
00273         elementId.iy () - ips 
00274       ) ;
00275       m_endcapLocalCrystalsEnergy->Fill (
00276         elementId.ix () - ics ,
00277         elementId.iy () - ips ,
00278         elem->energy ()
00279       ) ;
00280       m_endcapGlobalCrystalsEnergyMap->Fill (
00281         elementId.ix () ,
00282         elementId.iy () ,
00283         elem->energy ()
00284       ) ;
00285     }   
00286   return ;
00287 }

EcalRecHit AlCaElectronsTest::getMaximum ( const EcalRecHitCollection recHits  )  [private]

Definition at line 211 of file AlCaElectronsTest.h.

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

Referenced by analyze().

00212 {
00213   double energy = 0. ;
00214   EcalRecHit max ;
00215   for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
00216        elem != recHits->end () ;
00217        ++elem)
00218     {
00219       if (elem->energy () > energy)
00220         {
00221           energy = elem->energy () ;
00222           max = *elem ;
00223         }        
00224     }   
00225   return max ;
00226 }


Member Data Documentation

edm::InputTag AlCaElectronsTest::m_barrelAlCa [private]

Definition at line 54 of file AlCaElectronsTest.h.

Referenced by analyze().

TH2F* AlCaElectronsTest::m_barrelGlobalCrystalsEnergy [private]

ECAL Energy.

Definition at line 67 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_barrelGlobalCrystalsEnergyMap [private]

ECAL EnergyMap.

Definition at line 75 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_barrelGlobalCrystalsMap [private]

ECAL map.

Definition at line 59 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_barrelLocalCrystalsEnergy [private]

local Energy

Definition at line 69 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_barrelLocalCrystalsMap [private]

local map

Definition at line 61 of file AlCaElectronsTest.h.

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

edm::InputTag AlCaElectronsTest::m_endcapAlCa [private]

Definition at line 55 of file AlCaElectronsTest.h.

Referenced by analyze().

TH2F* AlCaElectronsTest::m_endcapGlobalCrystalsEnergy [private]

ECAL Energy.

Definition at line 71 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_endcapGlobalCrystalsEnergyMap [private]

ECAL EnergyMap.

Definition at line 77 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_endcapGlobalCrystalsMap [private]

ECAL map.

Definition at line 63 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_endcapLocalCrystalsEnergy [private]

local Energy

Definition at line 73 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_endcapLocalCrystalsMap [private]

local map

Definition at line 65 of file AlCaElectronsTest.h.

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

std::string AlCaElectronsTest::m_outputFileName [private]

Definition at line 56 of file AlCaElectronsTest.h.

Referenced by endJob().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:13:55 2009 for CMSSW by  doxygen 1.5.4