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

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
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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. 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::InputTag 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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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.

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

Definition at line 35 of file AlCaElectronsTest.h.

35 {}

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 benchmark_cfg::cerr, gather_cfg::cout, CaloRecHit::energy(), fillAroundBarrel(), fillAroundEndcap(), edm::Event::getByLabel(), getMaximum(), edm::EventBase::id(), EcalRecHit::id(), edm::HandleBase::isValid(), m_barrelAlCa, m_barrelGlobalCrystalsEnergy, m_barrelGlobalCrystalsMap, m_endcapAlCa, m_endcapGlobalCrystalsEnergy, m_endcapGlobalCrystalsMap, edm::Handle< T >::product(), and mathSSE::return().

137 {
138  //FIXME replace with msg logger
139  std::cout << "[AlCaElectronsTest] analysing event "
140  << iEvent.id () << std::endl ;
141 
142  //PG get the collections
143  // get Barrel RecHits
144  edm::Handle<EBRecHitCollection> barrelRecHitsHandle ;
145  iEvent.getByLabel (m_barrelAlCa, barrelRecHitsHandle) ;
146  if (!barrelRecHitsHandle.isValid()) {
147  std::cerr << "[AlCaElectronsTest] caught std::exception "
148  << " in rertieving " << m_barrelAlCa
149  << std::endl ;
150  return ;
151  } else {
152  const EBRecHitCollection* barrelHitsCollection = barrelRecHitsHandle.product () ;
153  //PG fill the histo with the maximum
154  EcalRecHit barrelMax = getMaximum (barrelHitsCollection) ;
155  EBDetId barrelMaxId (barrelMax.id ()) ;
157  barrelMaxId.ieta () ,
158  barrelMaxId.iphi ()
159  ) ;
161  barrelMaxId.ieta () ,
162  barrelMaxId.iphi () ,
163  barrelMax.energy ()
164  ) ;
166  barrelHitsCollection,
167  barrelMaxId.ieta (),
168  barrelMaxId.iphi ()
169  ) ;
170  }
171 
172  // get Endcap RecHits
173  edm::Handle<EERecHitCollection> endcapRecHitsHandle ;
174  iEvent.getByLabel (m_endcapAlCa,endcapRecHitsHandle) ;
175  if (!endcapRecHitsHandle.isValid()) {
176  std::cerr << "[AlCaElectronsTest] caught std::exception "
177  << " in rertieving " << m_endcapAlCa
178  << std::endl ;
179  return ;
180  } else {
181  const EERecHitCollection* endcapHitsCollection = endcapRecHitsHandle.product () ;
182  //PG fill the histo with the maximum
183  EcalRecHit endcapMax = getMaximum (endcapHitsCollection) ;
184  EEDetId endcapMaxId (endcapMax.id ()) ;
186  endcapMaxId.ix () ,
187  endcapMaxId.iy ()
188  ) ;
190  endcapMaxId.ix () ,
191  endcapMaxId.iy () ,
192  endcapMax.energy ()
193  ) ;
195  endcapHitsCollection,
196  endcapMaxId.ix (),
197  endcapMaxId.iy ()
198  ) ;
199  }
200 }
void fillAroundBarrel(const EcalRecHitCollection *recHits, int eta, int phi)
TH2F * m_endcapGlobalCrystalsEnergy
ECAL Energy.
edm::InputTag m_barrelAlCa
return((rh^lh)&mask)
TH2F * m_barrelGlobalCrystalsMap
ECAL map.
float energy() const
Definition: CaloRecHit.h:19
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
void fillAroundEndcap(const EcalRecHitCollection *recHits, int ics, int ips)
DetId id() const
get the id
Definition: EcalRecHit.h:74
T const * product() const
Definition: Handle.h:74
TH2F * m_endcapGlobalCrystalsMap
ECAL map.
edm::EventID id() const
Definition: EventBase.h:56
tuple cout
Definition: gather_cfg.py:41
TH2F * m_barrelGlobalCrystalsEnergy
ECAL Energy.
edm::InputTag m_endcapAlCa
EcalRecHit getMaximum(const EcalRecHitCollection *recHits)
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, m_endcapLocalCrystalsMap, and mathSSE::return().

93 {
94  m_barrelGlobalCrystalsMap = new TH2F ("m_barrelGlobalCrystalsMap","m_barrelGlobalCrystalsMap",171,-85,86,360,0,360) ;
95  m_barrelLocalCrystalsMap = new TH2F ("m_barrelLocalCrystalsMap","m_barrelLocalCrystalsMap",20,-10,10,20,-10,10) ;
96  m_endcapGlobalCrystalsMap = new TH2F ("m_endcapGlobalCrystalsMap","m_endcapGlobalCrystalsMap",100,0,100,100,0,100) ;
97  m_endcapLocalCrystalsMap = new TH2F ("m_endcapLocalCrystalsMap","m_endcapLocalCrystalsMap",20,-10,10,20,-10,10) ;
98  m_barrelGlobalCrystalsEnergy = new TH2F ("m_barrelGlobalCrystalsEnergy","m_barrelGlobalCrystalsEnergy",171,-85,86,360,0,360) ;
99  m_barrelLocalCrystalsEnergy = new TH2F ("m_barrelLocalCrystalsEnergy","m_barrelLocalCrystalsEnergy",20,-10,10,20,-10,10) ;
100  m_endcapGlobalCrystalsEnergy = new TH2F ("m_endcapGlobalCrystalsEnergy","m_endcapGlobalCrystalsEnergy",100,0,100,100,0,100) ;
101  m_endcapLocalCrystalsEnergy = new TH2F ("m_endcapLocalCrystalsEnergy","m_endcapLocalCrystalsEnergy",20,-10,10,20,-10,10) ;
102  m_barrelGlobalCrystalsEnergyMap = new TH2F ("m_barrelGlobalCrystalsEnergyMap","m_barrelGlobalCrystalsEnergyMap",171,-85,86,360,0,360) ;
103  m_endcapGlobalCrystalsEnergyMap = new TH2F ("m_endcapGlobalCrystalsEnergyMap","m_endcapGlobalCrystalsEnergyMap",100,0,100,100,0,100) ;
104  return ;
105 }
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 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, convertSQLitetoXML_cfg::output, and mathSSE::return().

113 {
114  TFile output (m_outputFileName.c_str (),"recreate") ;
115  m_barrelGlobalCrystalsMap->Write () ;
116  m_barrelLocalCrystalsMap->Write () ;
117  m_endcapGlobalCrystalsMap->Write () ;
118  m_endcapLocalCrystalsMap->Write () ;
119  m_barrelGlobalCrystalsEnergy->Write () ;
120  m_barrelLocalCrystalsEnergy->Write () ;
121  m_endcapGlobalCrystalsEnergy->Write () ;
122  m_endcapLocalCrystalsEnergy->Write () ;
125  output.Close () ;
126  //PG save root things
127  return ;
128 }
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 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, phi, and mathSSE::return().

Referenced by analyze().

230 {
231  for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
232  elem != recHits->end () ;
233  ++elem)
234  {
235  EBDetId elementId = elem->id () ;
237  elementId.ieta () - eta ,
238  elementId.iphi () - phi
239  ) ;
241  elementId.ieta () - eta ,
242  elementId.iphi () - phi ,
243  elem->energy ()
244  ) ;
246  elementId.ieta () ,
247  elementId.iphi () ,
248  elem->energy ()
249  ) ;
250 
251  }
252  return ;
253 }
std::vector< T >::const_iterator const_iterator
T eta() const
return((rh^lh)&mask)
int iphi() const
get the crystal iphi
Definition: EBDetId.h:46
int ieta() const
get the crystal ieta
Definition: EBDetId.h:44
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 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, m_endcapLocalCrystalsMap, and mathSSE::return().

Referenced by analyze().

261 {
262  for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
263  elem != recHits->end () ;
264  ++elem)
265  {
266  EEDetId elementId = elem->id () ;
268  elementId.ix () - ics ,
269  elementId.iy () - ips
270  ) ;
272  elementId.ix () - ics ,
273  elementId.iy () - ips ,
274  elem->energy ()
275  ) ;
277  elementId.ix () ,
278  elementId.iy () ,
279  elem->energy ()
280  ) ;
281  }
282  return ;
283 }
int ix() const
Definition: EEDetId.h:71
TH2F * m_endcapGlobalCrystalsEnergyMap
ECAL EnergyMap.
std::vector< T >::const_iterator const_iterator
return((rh^lh)&mask)
TH2F * m_endcapLocalCrystalsEnergy
local Energy
int iy() const
Definition: EEDetId.h:77
const_iterator end() const
const_iterator begin() const
TH2F * m_endcapLocalCrystalsMap
local map
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().

208 {
209  double energy = 0. ;
210  EcalRecHit max ;
211  for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
212  elem != recHits->end () ;
213  ++elem)
214  {
215  if (elem->energy () > energy)
216  {
217  energy = elem->energy () ;
218  max = *elem ;
219  }
220  }
221  return max ;
222 }
std::vector< T >::const_iterator const_iterator
const T & max(const T &a, const T &b)
const_iterator end() const
const_iterator begin() const

Member Data Documentation

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().