#include <AlCaElectronsTest.h>
Definition at line 32 of file AlCaElectronsTest.h.
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.
{}
void AlCaElectronsTest::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 135 of file AlCaElectronsTest.h.
References ExpressReco_HICollisions_FallBack::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] |
Reimplemented from edm::EDAnalyzer.
Definition at line 112 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 convertSQLitetoXML_cfg::output.
{ TFile output (m_outputFileName.c_str (),"recreate") ; m_barrelGlobalCrystalsMap->Write () ; m_barrelLocalCrystalsMap->Write () ; m_endcapGlobalCrystalsMap->Write () ; m_endcapLocalCrystalsMap->Write () ; m_barrelGlobalCrystalsEnergy->Write () ; m_barrelLocalCrystalsEnergy->Write () ; m_endcapGlobalCrystalsEnergy->Write () ; m_endcapLocalCrystalsEnergy->Write () ; m_barrelGlobalCrystalsEnergyMap->Write () ; m_endcapGlobalCrystalsEnergyMap->Write () ; output.Close () ; //PG save root things return ; }
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(), 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(), 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(), 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 ; }
edm::InputTag AlCaElectronsTest::m_barrelAlCa [private] |
Definition at line 50 of file AlCaElectronsTest.h.
Referenced by analyze().
TH2F* AlCaElectronsTest::m_barrelGlobalCrystalsEnergy [private] |
ECAL Energy.
Definition at line 63 of file AlCaElectronsTest.h.
Referenced by analyze(), beginJob(), and endJob().
TH2F* AlCaElectronsTest::m_barrelGlobalCrystalsEnergyMap [private] |
ECAL EnergyMap.
Definition at line 71 of file AlCaElectronsTest.h.
Referenced by beginJob(), endJob(), and fillAroundBarrel().
TH2F* AlCaElectronsTest::m_barrelGlobalCrystalsMap [private] |
ECAL map.
Definition at line 55 of file AlCaElectronsTest.h.
Referenced by analyze(), beginJob(), and endJob().
TH2F* AlCaElectronsTest::m_barrelLocalCrystalsEnergy [private] |
local Energy
Definition at line 65 of file AlCaElectronsTest.h.
Referenced by beginJob(), endJob(), and fillAroundBarrel().
TH2F* AlCaElectronsTest::m_barrelLocalCrystalsMap [private] |
local map
Definition at line 57 of file AlCaElectronsTest.h.
Referenced by beginJob(), endJob(), and fillAroundBarrel().
edm::InputTag AlCaElectronsTest::m_endcapAlCa [private] |
Definition at line 51 of file AlCaElectronsTest.h.
Referenced by analyze().
TH2F* AlCaElectronsTest::m_endcapGlobalCrystalsEnergy [private] |
ECAL Energy.
Definition at line 67 of file AlCaElectronsTest.h.
Referenced by analyze(), beginJob(), and endJob().
TH2F* AlCaElectronsTest::m_endcapGlobalCrystalsEnergyMap [private] |
ECAL EnergyMap.
Definition at line 73 of file AlCaElectronsTest.h.
Referenced by beginJob(), endJob(), and fillAroundEndcap().
TH2F* AlCaElectronsTest::m_endcapGlobalCrystalsMap [private] |
ECAL map.
Definition at line 59 of file AlCaElectronsTest.h.
Referenced by analyze(), beginJob(), and endJob().
TH2F* AlCaElectronsTest::m_endcapLocalCrystalsEnergy [private] |
local Energy
Definition at line 69 of file AlCaElectronsTest.h.
Referenced by beginJob(), endJob(), and fillAroundEndcap().
TH2F* AlCaElectronsTest::m_endcapLocalCrystalsMap [private] |
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().