CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
AlCaElectronsTest Class Reference

#include <AlCaElectronsTest.h>

Inheritance diagram for AlCaElectronsTest:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 AlCaElectronsTest (const edm::ParameterSet &)
 
void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
void beginJob () override
 
 ~AlCaElectronsTest ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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::EDGetTokenT< EBRecHitCollectionm_barrelAlCa
 
TH2F * m_barrelGlobalCrystalsEnergy
 ECAL Energy. More...
 
TH2F * m_barrelGlobalCrystalsEnergyMap
 ECAL EnergyMap. More...
 
TH2F * m_barrelGlobalCrystalsMap
 ECAL map. More...
 
TH2F * m_barrelLocalCrystalsEnergy
 local Energy More...
 
TH2F * m_barrelLocalCrystalsMap
 local map More...
 
edm::EDGetTokenT< EERecHitCollectionm_endcapAlCa
 
TH2F * m_endcapGlobalCrystalsEnergy
 ECAL Energy. More...
 
TH2F * m_endcapGlobalCrystalsEnergyMap
 ECAL EnergyMap. More...
 
TH2F * m_endcapGlobalCrystalsMap
 ECAL map. More...
 
TH2F * m_endcapLocalCrystalsEnergy
 local Energy More...
 
TH2F * m_endcapLocalCrystalsMap
 local map More...
 
std::string m_outputFileName
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 35 of file AlCaElectronsTest.h.

Constructor & Destructor Documentation

◆ AlCaElectronsTest()

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

Definition at line 75 of file AlCaElectronsTest.h.

References TFileService::kSharedResource.

76  : m_barrelAlCa(consumes<EBRecHitCollection>(iConfig.getParameter<edm::InputTag>("alcaBarrelHitCollection"))),
77  m_endcapAlCa(consumes<EERecHitCollection>(iConfig.getParameter<edm::InputTag>("alcaEndcapHitCollection"))),
79  iConfig.getUntrackedParameter<std::string>("HistOutFile", std::string("AlCaElectronsTest.root"))) {
80  usesResource(TFileService::kSharedResource);
81 }
static const std::string kSharedResource
Definition: TFileService.h:76
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string m_outputFileName
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< EERecHitCollection > m_endcapAlCa
edm::EDGetTokenT< EBRecHitCollection > m_barrelAlCa

◆ ~AlCaElectronsTest()

AlCaElectronsTest::~AlCaElectronsTest ( )
default

Member Function Documentation

◆ analyze()

void AlCaElectronsTest::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 111 of file AlCaElectronsTest.h.

References EcalRecHit::energy(), fillAroundBarrel(), fillAroundEndcap(), getMaximum(), EcalRecHit::id(), iEvent, edm::HandleBase::isValid(), SummaryClient_cfi::labels, edm::EDConsumerBase::labelsForToken(), m_barrelAlCa, m_barrelGlobalCrystalsEnergy, m_barrelGlobalCrystalsMap, m_endcapAlCa, m_endcapGlobalCrystalsEnergy, m_endcapGlobalCrystalsMap, and edm::Handle< T >::product().

111  {
112  //FIXME replace with msg logger
113  edm::LogVerbatim("ElectronsTest") << "[AlCaElectronsTest] analysing event " << iEvent.id();
114 
115  //PG get the collections
116  // get Barrel RecHits
117  edm::Handle<EBRecHitCollection> barrelRecHitsHandle;
118  iEvent.getByToken(m_barrelAlCa, barrelRecHitsHandle);
119  if (!barrelRecHitsHandle.isValid()) {
122  edm::LogError("ElectronsTest") << "[AlCaElectronsTest] caught std::exception in rertieving " << labels.module;
123  return;
124  } else {
125  const EBRecHitCollection* barrelHitsCollection = barrelRecHitsHandle.product();
126  //PG fill the histo with the maximum
127  EcalRecHit barrelMax = getMaximum(barrelHitsCollection);
128  EBDetId barrelMaxId(barrelMax.id());
129  m_barrelGlobalCrystalsMap->Fill(barrelMaxId.ieta(), barrelMaxId.iphi());
130  m_barrelGlobalCrystalsEnergy->Fill(barrelMaxId.ieta(), barrelMaxId.iphi(), barrelMax.energy());
131  fillAroundBarrel(barrelHitsCollection, barrelMaxId.ieta(), barrelMaxId.iphi());
132  }
133 
134  // get Endcap RecHits
135  edm::Handle<EERecHitCollection> endcapRecHitsHandle;
136  iEvent.getByToken(m_endcapAlCa, endcapRecHitsHandle);
137  if (!endcapRecHitsHandle.isValid()) {
140  edm::LogError("ElectronsTest") << "[AlCaElectronsTest] caught std::exception in rertieving " << labels.module;
141  return;
142  } else {
143  const EERecHitCollection* endcapHitsCollection = endcapRecHitsHandle.product();
144  //PG fill the histo with the maximum
145  EcalRecHit endcapMax = getMaximum(endcapHitsCollection);
146  EEDetId endcapMaxId(endcapMax.id());
147  m_endcapGlobalCrystalsMap->Fill(endcapMaxId.ix(), endcapMaxId.iy());
148  m_endcapGlobalCrystalsEnergy->Fill(endcapMaxId.ix(), endcapMaxId.iy(), endcapMax.energy());
149  fillAroundEndcap(endcapHitsCollection, endcapMaxId.ix(), endcapMaxId.iy());
150  }
151 }
Log< level::Info, true > LogVerbatim
void fillAroundBarrel(const EcalRecHitCollection *recHits, int eta, int phi)
T const * product() const
Definition: Handle.h:70
TH2F * m_endcapGlobalCrystalsEnergy
ECAL Energy.
Log< level::Error, false > LogError
int iEvent
Definition: GenABIO.cc:224
TH2F * m_barrelGlobalCrystalsMap
ECAL map.
edm::EDGetTokenT< EERecHitCollection > m_endcapAlCa
void fillAroundEndcap(const EcalRecHitCollection *recHits, int ics, int ips)
DetId id() const
get the id
Definition: EcalRecHit.h:78
bool isValid() const
Definition: HandleBase.h:70
TH2F * m_endcapGlobalCrystalsMap
ECAL map.
TH2F * m_barrelGlobalCrystalsEnergy
ECAL Energy.
float energy() const
Definition: EcalRecHit.h:69
edm::EDGetTokenT< EBRecHitCollection > m_barrelAlCa
EcalRecHit getMaximum(const EcalRecHitCollection *recHits)
void labelsForToken(EDGetToken iToken, Labels &oLabels) const

◆ beginJob()

void AlCaElectronsTest::beginJob ( )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 85 of file AlCaElectronsTest.h.

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

85  {
88  fs->make<TH2F>("m_barrelGlobalCrystalsMap", "m_barrelGlobalCrystalsMap", 171, -85, 86, 360, 0, 360);
90  fs->make<TH2F>("m_barrelLocalCrystalsMap", "m_barrelLocalCrystalsMap", 20, -10, 10, 20, -10, 10);
92  fs->make<TH2F>("m_endcapGlobalCrystalsMap", "m_endcapGlobalCrystalsMap", 100, 0, 100, 100, 0, 100);
94  fs->make<TH2F>("m_endcapLocalCrystalsMap", "m_endcapLocalCrystalsMap", 20, -10, 10, 20, -10, 10);
96  fs->make<TH2F>("m_barrelGlobalCrystalsEnergy", "m_barrelGlobalCrystalsEnergy", 171, -85, 86, 360, 0, 360);
98  fs->make<TH2F>("m_barrelLocalCrystalsEnergy", "m_barrelLocalCrystalsEnergy", 20, -10, 10, 20, -10, 10);
100  fs->make<TH2F>("m_endcapGlobalCrystalsEnergy", "m_endcapGlobalCrystalsEnergy", 100, 0, 100, 100, 0, 100);
102  fs->make<TH2F>("m_endcapLocalCrystalsEnergy", "m_endcapLocalCrystalsEnergy", 20, -10, 10, 20, -10, 10);
104  fs->make<TH2F>("m_barrelGlobalCrystalsEnergyMap", "m_barrelGlobalCrystalsEnergyMap", 171, -85, 86, 360, 0, 360);
106  fs->make<TH2F>("m_endcapGlobalCrystalsEnergyMap", "m_endcapGlobalCrystalsEnergyMap", 100, 0, 100, 100, 0, 100);
107 }
TH2F * m_endcapGlobalCrystalsEnergyMap
ECAL EnergyMap.
TH2F * m_endcapGlobalCrystalsEnergy
ECAL Energy.
TH2F * m_endcapLocalCrystalsEnergy
local Energy
TH2F * m_barrelGlobalCrystalsMap
ECAL map.
TH2F * m_barrelLocalCrystalsMap
local map
TH2F * m_endcapGlobalCrystalsMap
ECAL map.
TH2F * m_barrelGlobalCrystalsEnergyMap
ECAL EnergyMap.
TH2F * m_barrelGlobalCrystalsEnergy
ECAL Energy.
TH2F * m_barrelLocalCrystalsEnergy
local Energy
TH2F * m_endcapLocalCrystalsMap
local map

◆ fillAroundBarrel()

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

Definition at line 169 of file AlCaElectronsTest.h.

References PVValHelper::eta, EBDetId::ieta(), EBDetId::iphi(), m_barrelGlobalCrystalsEnergyMap, m_barrelLocalCrystalsEnergy, m_barrelLocalCrystalsMap, phi, and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by analyze().

169  {
170  for (EcalRecHitCollection::const_iterator elem = recHits->begin(); elem != recHits->end(); ++elem) {
171  EBDetId elementId = elem->id();
172  m_barrelLocalCrystalsMap->Fill(elementId.ieta() - eta, elementId.iphi() - phi);
173  m_barrelLocalCrystalsEnergy->Fill(elementId.ieta() - eta, elementId.iphi() - phi, elem->energy());
174  m_barrelGlobalCrystalsEnergyMap->Fill(elementId.ieta(), elementId.iphi(), elem->energy());
175  }
176  return;
177 }
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
std::vector< EcalRecHit >::const_iterator const_iterator
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
TH2F * m_barrelLocalCrystalsMap
local map
TH2F * m_barrelGlobalCrystalsEnergyMap
ECAL EnergyMap.
TH2F * m_barrelLocalCrystalsEnergy
local Energy

◆ fillAroundEndcap()

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

Definition at line 181 of file AlCaElectronsTest.h.

References Ecal07UnpackerData_cfi::ics, EEDetId::ix(), EEDetId::iy(), m_endcapGlobalCrystalsEnergyMap, m_endcapLocalCrystalsEnergy, m_endcapLocalCrystalsMap, and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by analyze().

181  {
182  for (EcalRecHitCollection::const_iterator elem = recHits->begin(); elem != recHits->end(); ++elem) {
183  EEDetId elementId = elem->id();
184  m_endcapLocalCrystalsMap->Fill(elementId.ix() - ics, elementId.iy() - ips);
185  m_endcapLocalCrystalsEnergy->Fill(elementId.ix() - ics, elementId.iy() - ips, elem->energy());
186  m_endcapGlobalCrystalsEnergyMap->Fill(elementId.ix(), elementId.iy(), elem->energy());
187  }
188  return;
189 }
TH2F * m_endcapGlobalCrystalsEnergyMap
ECAL EnergyMap.
int ix() const
Definition: EEDetId.h:77
std::vector< EcalRecHit >::const_iterator const_iterator
TH2F * m_endcapLocalCrystalsEnergy
local Energy
int iy() const
Definition: EEDetId.h:83
TH2F * m_endcapLocalCrystalsMap
local map

◆ getMaximum()

EcalRecHit AlCaElectronsTest::getMaximum ( const EcalRecHitCollection recHits)
private

Definition at line 155 of file AlCaElectronsTest.h.

References hcalRecHitTable_cff::energy, SiStripPI::max, and FastTrackerRecHitMaskProducer_cfi::recHits.

Referenced by analyze().

155  {
156  double energy = 0.;
157  EcalRecHit max;
158  for (EcalRecHitCollection::const_iterator elem = recHits->begin(); elem != recHits->end(); ++elem) {
159  if (elem->energy() > energy) {
160  energy = elem->energy();
161  max = *elem;
162  }
163  }
164  return max;
165 }
std::vector< EcalRecHit >::const_iterator const_iterator

Member Data Documentation

◆ m_barrelAlCa

edm::EDGetTokenT<EBRecHitCollection> AlCaElectronsTest::m_barrelAlCa
private

Definition at line 47 of file AlCaElectronsTest.h.

Referenced by analyze().

◆ m_barrelGlobalCrystalsEnergy

TH2F* AlCaElectronsTest::m_barrelGlobalCrystalsEnergy
private

ECAL Energy.

Definition at line 60 of file AlCaElectronsTest.h.

Referenced by analyze(), and beginJob().

◆ m_barrelGlobalCrystalsEnergyMap

TH2F* AlCaElectronsTest::m_barrelGlobalCrystalsEnergyMap
private

ECAL EnergyMap.

Definition at line 68 of file AlCaElectronsTest.h.

Referenced by beginJob(), and fillAroundBarrel().

◆ m_barrelGlobalCrystalsMap

TH2F* AlCaElectronsTest::m_barrelGlobalCrystalsMap
private

ECAL map.

Definition at line 52 of file AlCaElectronsTest.h.

Referenced by analyze(), and beginJob().

◆ m_barrelLocalCrystalsEnergy

TH2F* AlCaElectronsTest::m_barrelLocalCrystalsEnergy
private

local Energy

Definition at line 62 of file AlCaElectronsTest.h.

Referenced by beginJob(), and fillAroundBarrel().

◆ m_barrelLocalCrystalsMap

TH2F* AlCaElectronsTest::m_barrelLocalCrystalsMap
private

local map

Definition at line 54 of file AlCaElectronsTest.h.

Referenced by beginJob(), and fillAroundBarrel().

◆ m_endcapAlCa

edm::EDGetTokenT<EERecHitCollection> AlCaElectronsTest::m_endcapAlCa
private

Definition at line 48 of file AlCaElectronsTest.h.

Referenced by analyze().

◆ m_endcapGlobalCrystalsEnergy

TH2F* AlCaElectronsTest::m_endcapGlobalCrystalsEnergy
private

ECAL Energy.

Definition at line 64 of file AlCaElectronsTest.h.

Referenced by analyze(), and beginJob().

◆ m_endcapGlobalCrystalsEnergyMap

TH2F* AlCaElectronsTest::m_endcapGlobalCrystalsEnergyMap
private

ECAL EnergyMap.

Definition at line 70 of file AlCaElectronsTest.h.

Referenced by beginJob(), and fillAroundEndcap().

◆ m_endcapGlobalCrystalsMap

TH2F* AlCaElectronsTest::m_endcapGlobalCrystalsMap
private

ECAL map.

Definition at line 56 of file AlCaElectronsTest.h.

Referenced by analyze(), and beginJob().

◆ m_endcapLocalCrystalsEnergy

TH2F* AlCaElectronsTest::m_endcapLocalCrystalsEnergy
private

local Energy

Definition at line 66 of file AlCaElectronsTest.h.

Referenced by beginJob(), and fillAroundEndcap().

◆ m_endcapLocalCrystalsMap

TH2F* AlCaElectronsTest::m_endcapLocalCrystalsMap
private

local map

Definition at line 58 of file AlCaElectronsTest.h.

Referenced by beginJob(), and fillAroundEndcap().

◆ m_outputFileName

std::string AlCaElectronsTest::m_outputFileName
private

Definition at line 49 of file AlCaElectronsTest.h.