CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
AlCaElectronsTest Class Reference

#include <AlCaElectronsTest.h>

Inheritance diagram for AlCaElectronsTest:
edm::EDAnalyzer edm::EDConsumerBase

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 ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
< EBRecHitCollection
m_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
< EERecHitCollection
m_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::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

Detailed Description

Definition at line 33 of file AlCaElectronsTest.h.

Constructor & Destructor Documentation

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

Definition at line 81 of file AlCaElectronsTest.h.

81  :
82  m_barrelAlCa (consumes<EBRecHitCollection>(iConfig.getParameter<edm::InputTag> ("alcaBarrelHitCollection"))) ,
83  m_endcapAlCa (consumes<EERecHitCollection>(iConfig.getParameter<edm::InputTag> ("alcaEndcapHitCollection"))) ,
85  ("HistOutFile",std::string ("AlCaElectronsTest.root")))
86 {}
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string m_outputFileName
edm::EDGetTokenT< EERecHitCollection > m_endcapAlCa
edm::EDGetTokenT< EBRecHitCollection > m_barrelAlCa
AlCaElectronsTest::~AlCaElectronsTest ( )
inline

Definition at line 36 of file AlCaElectronsTest.h.

36 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 136 of file AlCaElectronsTest.h.

References dtNoiseDBValidation_cfg::cerr, gather_cfg::cout, EcalRecHit::energy(), fillAroundBarrel(), fillAroundEndcap(), edm::Event::getByToken(), getMaximum(), edm::EventBase::id(), EcalRecHit::id(), edm::HandleBase::isValid(), HLT_25ns14e33_v1_cff::labels, edm::EDConsumerBase::labelsForToken(), m_barrelAlCa, m_barrelGlobalCrystalsEnergy, m_barrelGlobalCrystalsMap, m_endcapAlCa, m_endcapGlobalCrystalsEnergy, m_endcapGlobalCrystalsMap, edm::EDConsumerBase::Labels::module, edm::Handle< T >::product(), and mathSSE::return().

138 {
139  //FIXME replace with msg logger
140  std::cout << "[AlCaElectronsTest] analysing event "
141  << iEvent.id () << std::endl ;
142 
143  //PG get the collections
144  // get Barrel RecHits
145  edm::Handle<EBRecHitCollection> barrelRecHitsHandle ;
146  iEvent.getByToken (m_barrelAlCa, barrelRecHitsHandle) ;
147  if (!barrelRecHitsHandle.isValid()) {
149  labelsForToken(m_barrelAlCa, labels);
150  std::cerr << "[AlCaElectronsTest] caught std::exception "
151  << " in rertieving " << labels.module
152  << std::endl ;
153  return ;
154  } else {
155  const EBRecHitCollection* barrelHitsCollection = barrelRecHitsHandle.product () ;
156  //PG fill the histo with the maximum
157  EcalRecHit barrelMax = getMaximum (barrelHitsCollection) ;
158  EBDetId barrelMaxId (barrelMax.id ()) ;
160  barrelMaxId.ieta () ,
161  barrelMaxId.iphi ()
162  ) ;
164  barrelMaxId.ieta () ,
165  barrelMaxId.iphi () ,
166  barrelMax.energy ()
167  ) ;
169  barrelHitsCollection,
170  barrelMaxId.ieta (),
171  barrelMaxId.iphi ()
172  ) ;
173  }
174 
175  // get Endcap RecHits
176  edm::Handle<EERecHitCollection> endcapRecHitsHandle ;
177  iEvent.getByToken (m_endcapAlCa,endcapRecHitsHandle) ;
178  if (!endcapRecHitsHandle.isValid()) {
180  labelsForToken(m_endcapAlCa, labels);
181  std::cerr << "[AlCaElectronsTest] caught std::exception "
182  << " in rertieving " << labels.module
183  << std::endl ;
184  return ;
185  } else {
186  const EERecHitCollection* endcapHitsCollection = endcapRecHitsHandle.product () ;
187  //PG fill the histo with the maximum
188  EcalRecHit endcapMax = getMaximum (endcapHitsCollection) ;
189  EEDetId endcapMaxId (endcapMax.id ()) ;
191  endcapMaxId.ix () ,
192  endcapMaxId.iy ()
193  ) ;
195  endcapMaxId.ix () ,
196  endcapMaxId.iy () ,
197  endcapMax.energy ()
198  ) ;
200  endcapHitsCollection,
201  endcapMaxId.ix (),
202  endcapMaxId.iy ()
203  ) ;
204  }
205 }
void fillAroundBarrel(const EcalRecHitCollection *recHits, int eta, int phi)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
TH2F * m_endcapGlobalCrystalsEnergy
ECAL Energy.
return((rh^lh)&mask)
TH2F * m_barrelGlobalCrystalsMap
ECAL map.
float energy() const
Definition: EcalRecHit.h:68
edm::EDGetTokenT< EERecHitCollection > m_endcapAlCa
bool isValid() const
Definition: HandleBase.h:75
void fillAroundEndcap(const EcalRecHitCollection *recHits, int ics, int ips)
DetId id() const
get the id
Definition: EcalRecHit.h:76
T const * product() const
Definition: Handle.h:81
TH2F * m_endcapGlobalCrystalsMap
ECAL map.
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
edm::EventID id() const
Definition: EventBase.h:60
tuple cout
Definition: gather_cfg.py:121
TH2F * m_barrelGlobalCrystalsEnergy
ECAL Energy.
edm::EDGetTokenT< EBRecHitCollection > m_barrelAlCa
EcalRecHit getMaximum(const EcalRecHitCollection *recHits)
void AlCaElectronsTest::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 93 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, and mathSSE::return().

94 {
95  m_barrelGlobalCrystalsMap = new TH2F ("m_barrelGlobalCrystalsMap","m_barrelGlobalCrystalsMap",171,-85,86,360,0,360) ;
96  m_barrelLocalCrystalsMap = new TH2F ("m_barrelLocalCrystalsMap","m_barrelLocalCrystalsMap",20,-10,10,20,-10,10) ;
97  m_endcapGlobalCrystalsMap = new TH2F ("m_endcapGlobalCrystalsMap","m_endcapGlobalCrystalsMap",100,0,100,100,0,100) ;
98  m_endcapLocalCrystalsMap = new TH2F ("m_endcapLocalCrystalsMap","m_endcapLocalCrystalsMap",20,-10,10,20,-10,10) ;
99  m_barrelGlobalCrystalsEnergy = new TH2F ("m_barrelGlobalCrystalsEnergy","m_barrelGlobalCrystalsEnergy",171,-85,86,360,0,360) ;
100  m_barrelLocalCrystalsEnergy = new TH2F ("m_barrelLocalCrystalsEnergy","m_barrelLocalCrystalsEnergy",20,-10,10,20,-10,10) ;
101  m_endcapGlobalCrystalsEnergy = new TH2F ("m_endcapGlobalCrystalsEnergy","m_endcapGlobalCrystalsEnergy",100,0,100,100,0,100) ;
102  m_endcapLocalCrystalsEnergy = new TH2F ("m_endcapLocalCrystalsEnergy","m_endcapLocalCrystalsEnergy",20,-10,10,20,-10,10) ;
103  m_barrelGlobalCrystalsEnergyMap = new TH2F ("m_barrelGlobalCrystalsEnergyMap","m_barrelGlobalCrystalsEnergyMap",171,-85,86,360,0,360) ;
104  m_endcapGlobalCrystalsEnergyMap = new TH2F ("m_endcapGlobalCrystalsEnergyMap","m_endcapGlobalCrystalsEnergyMap",100,0,100,100,0,100) ;
105  return ;
106 }
TH2F * m_endcapGlobalCrystalsEnergyMap
ECAL EnergyMap.
TH2F * m_endcapGlobalCrystalsEnergy
ECAL Energy.
return((rh^lh)&mask)
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
void AlCaElectronsTest::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 113 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, convertSQLitetoXML_cfg::output, and mathSSE::return().

114 {
115  TFile output (m_outputFileName.c_str (),"recreate") ;
116  m_barrelGlobalCrystalsMap->Write () ;
117  m_barrelLocalCrystalsMap->Write () ;
118  m_endcapGlobalCrystalsMap->Write () ;
119  m_endcapLocalCrystalsMap->Write () ;
120  m_barrelGlobalCrystalsEnergy->Write () ;
121  m_barrelLocalCrystalsEnergy->Write () ;
122  m_endcapGlobalCrystalsEnergy->Write () ;
123  m_endcapLocalCrystalsEnergy->Write () ;
126  output.Close () ;
127  //PG save root things
128  return ;
129 }
TH2F * m_endcapGlobalCrystalsEnergyMap
ECAL EnergyMap.
TH2F * m_endcapGlobalCrystalsEnergy
ECAL Energy.
std::string m_outputFileName
return((rh^lh)&mask)
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
void AlCaElectronsTest::fillAroundBarrel ( const EcalRecHitCollection recHits,
int  eta,
int  phi 
)
private

Definition at line 234 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, phi, and mathSSE::return().

Referenced by analyze().

235 {
236  for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
237  elem != recHits->end () ;
238  ++elem)
239  {
240  EBDetId elementId = elem->id () ;
242  elementId.ieta () - eta ,
243  elementId.iphi () - phi
244  ) ;
246  elementId.ieta () - eta ,
247  elementId.iphi () - phi ,
248  elem->energy ()
249  ) ;
251  elementId.ieta () ,
252  elementId.iphi () ,
253  elem->energy ()
254  ) ;
255 
256  }
257  return ;
258 }
std::vector< EcalRecHit >::const_iterator const_iterator
T eta() const
return((rh^lh)&mask)
int iphi() const
get the crystal iphi
Definition: EBDetId.h:53
int ieta() const
get the crystal ieta
Definition: EBDetId.h:51
TH2F * m_barrelLocalCrystalsMap
local map
const_iterator end() const
TH2F * m_barrelGlobalCrystalsEnergyMap
ECAL EnergyMap.
TH2F * m_barrelLocalCrystalsEnergy
local Energy
const_iterator begin() const
Definition: DDAxes.h:10
void AlCaElectronsTest::fillAroundEndcap ( const EcalRecHitCollection recHits,
int  ics,
int  ips 
)
private

Definition at line 265 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, m_endcapLocalCrystalsMap, and mathSSE::return().

Referenced by analyze().

266 {
267  for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
268  elem != recHits->end () ;
269  ++elem)
270  {
271  EEDetId elementId = elem->id () ;
273  elementId.ix () - ics ,
274  elementId.iy () - ips
275  ) ;
277  elementId.ix () - ics ,
278  elementId.iy () - ips ,
279  elem->energy ()
280  ) ;
282  elementId.ix () ,
283  elementId.iy () ,
284  elem->energy ()
285  ) ;
286  }
287  return ;
288 }
int ix() const
Definition: EEDetId.h:76
TH2F * m_endcapGlobalCrystalsEnergyMap
ECAL EnergyMap.
std::vector< EcalRecHit >::const_iterator const_iterator
return((rh^lh)&mask)
TH2F * m_endcapLocalCrystalsEnergy
local Energy
int iy() const
Definition: EEDetId.h:82
const_iterator end() const
const_iterator begin() const
TH2F * m_endcapLocalCrystalsMap
local map
EcalRecHit AlCaElectronsTest::getMaximum ( const EcalRecHitCollection recHits)
private

Definition at line 212 of file AlCaElectronsTest.h.

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

Referenced by analyze().

213 {
214  double energy = 0. ;
215  EcalRecHit max ;
216  for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
217  elem != recHits->end () ;
218  ++elem)
219  {
220  if (elem->energy () > energy)
221  {
222  energy = elem->energy () ;
223  max = *elem ;
224  }
225  }
226  return max ;
227 }
std::vector< EcalRecHit >::const_iterator const_iterator
const_iterator end() const
const_iterator begin() const

Member Data Documentation

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

Definition at line 51 of file AlCaElectronsTest.h.

Referenced by analyze().

TH2F* AlCaElectronsTest::m_barrelGlobalCrystalsEnergy
private

ECAL Energy.

Definition at line 64 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_barrelGlobalCrystalsEnergyMap
private

ECAL EnergyMap.

Definition at line 72 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_barrelGlobalCrystalsMap
private

ECAL map.

Definition at line 56 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_barrelLocalCrystalsEnergy
private

local Energy

Definition at line 66 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_barrelLocalCrystalsMap
private

local map

Definition at line 58 of file AlCaElectronsTest.h.

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

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

Definition at line 52 of file AlCaElectronsTest.h.

Referenced by analyze().

TH2F* AlCaElectronsTest::m_endcapGlobalCrystalsEnergy
private

ECAL Energy.

Definition at line 68 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_endcapGlobalCrystalsEnergyMap
private

ECAL EnergyMap.

Definition at line 74 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_endcapGlobalCrystalsMap
private

ECAL map.

Definition at line 60 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_endcapLocalCrystalsEnergy
private

local Energy

Definition at line 70 of file AlCaElectronsTest.h.

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

TH2F* AlCaElectronsTest::m_endcapLocalCrystalsMap
private

local map

Definition at line 62 of file AlCaElectronsTest.h.

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

std::string AlCaElectronsTest::m_outputFileName
private

Definition at line 53 of file AlCaElectronsTest.h.

Referenced by endJob().