CMS 3D CMS Logo

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

#include <DQMSourceEleCalib.h>

Inheritance diagram for DQMSourceEleCalib:
edm::EDAnalyzer

Public Member Functions

 DQMSourceEleCalib (const edm::ParameterSet &)
 
 ~DQMSourceEleCalib ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 
void beginJob ()
 
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 
void endJob ()
 
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
 
void endRun (const edm::Run &r, const edm::EventSetup &c)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Member Functions

void fillAroundBarrel (const EcalRecHitCollection *, int, int)
 fills local occupancy graphs More...
 
void fillAroundEndcap (const EcalRecHitCollection *, int, int)
 
DetId findMaxHit (const std::vector< std::pair< DetId, float > > &, const EcalRecHitCollection *, const EcalRecHitCollection *)
 find the MOX More...
 

Private Attributes

DQMStoredbe_
 
MonitorElementElectronsNumber_
 Number of electrons. More...
 
MonitorElementESCoP_
 ESCoP. More...
 
int eventCounter_
 
std::string fileName_
 Output file name if required. More...
 
std::string folderName_
 DQM folder name. More...
 
MonitorElementHitsVsAssociatedHits_
 recHits over associated recHits More...
 
MonitorElementLocalOccupancyEB_
 
MonitorElementLocalOccupancyEE_
 
MonitorElementOccupancyEB_
 Occupancy. More...
 
MonitorElementOccupancyEEM_
 
MonitorElementOccupancyEEP_
 
unsigned int prescaleFactor_
 Monitor every prescaleFactor_ events. More...
 
edm::InputTag productMonitoredEB_
 object to monitor More...
 
edm::InputTag productMonitoredEE_
 object to monitor More...
 
edm::InputTag productMonitoredElectrons_
 electrons to monitor More...
 
MonitorElementrecHitsPerElectron_
 Number of recHits per electron. More...
 
bool saveToFile_
 Write to file. More...
 

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)
 

Detailed Description

Definition at line 24 of file DQMSourceEleCalib.h.

Constructor & Destructor Documentation

DQMSourceEleCalib::DQMSourceEleCalib ( const edm::ParameterSet ps)

Definition at line 44 of file DQMSourceEleCalib.cc.

References dbe_, fileName_, folderName_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), cmsCodeRules.cppFunctionSkipper::operator, prescaleFactor_, productMonitoredEB_, productMonitoredEE_, productMonitoredElectrons_, and saveToFile_.

44  :
46 {
48  folderName_ = ps.getUntrackedParameter<string>("FolderName","ALCAStreamEcalSingleEle");
49  productMonitoredEB_= ps.getParameter<edm::InputTag>("AlCaStreamEBTag");
50  productMonitoredEE_= ps.getParameter<edm::InputTag>("AlCaStreamEETag");
51 
52  saveToFile_=ps.getUntrackedParameter<bool>("SaveToFile",false);
53  fileName_= ps.getUntrackedParameter<string>("FileName","MonitorAlCaEcalSingleEle.root");
54  productMonitoredElectrons_ = ps.getParameter<InputTag>("electronCollection");
55  prescaleFactor_ = ps.getUntrackedParameter<unsigned int>("prescaleFactor",1);
56 
57 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string fileName_
Output file name if required.
edm::InputTag productMonitoredElectrons_
electrons to monitor
edm::InputTag productMonitoredEE_
object to monitor
bool saveToFile_
Write to file.
std::string folderName_
DQM folder name.
edm::InputTag productMonitoredEB_
object to monitor
unsigned int prescaleFactor_
Monitor every prescaleFactor_ events.
DQMSourceEleCalib::~DQMSourceEleCalib ( )

Definition at line 60 of file DQMSourceEleCalib.cc.

61 {}

Member Function Documentation

void DQMSourceEleCalib::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Implements edm::EDAnalyzer.

Definition at line 98 of file DQMSourceEleCalib.cc.

References DetId::det(), EcalBarrel, EcalEndcap, ElectronsNumber_, ESCoP_, eventCounter_, MonitorElement::Fill(), fillAroundBarrel(), fillAroundEndcap(), findMaxHit(), edm::Event::getByLabel(), HitsVsAssociatedHits_, EBDetId::ieta(), EBDetId::iphi(), edm::HandleBase::isValid(), EEDetId::ix(), EEDetId::iy(), siStripFEDMonitor_P5_cff::Max, OccupancyEB_, OccupancyEEM_, OccupancyEEP_, edm::Handle< T >::product(), productMonitoredEB_, productMonitoredEE_, productMonitoredElectrons_, recHitsPerElectron_, and DetId::subdetId().

99  {
100 
101 // if (eventCounter_% prescaleFactor_ ) return; //FIXME
102  eventCounter_++;
103  int numberOfHits=0;
104  int numberOfElectrons=0;
105  int numberOfAssociatedHits = 0;
106  //reads the recHits
109 
110  iEvent.getByLabel(productMonitoredEB_, rhEB);
111  iEvent.getByLabel(productMonitoredEE_, rhEE);
112 
114 
115  //reads the electrons
117  iEvent.getByLabel (productMonitoredElectrons_, pElectrons) ;
118 
119  if (pElectrons.isValid()){
120  ElectronsNumber_->Fill(pElectrons->size()+0.1);
121  numberOfElectrons = pElectrons->size();
122  for (reco::GsfElectronCollection::const_iterator eleIt = pElectrons->begin();
123  eleIt!= pElectrons->end(); ++eleIt){
124  ESCoP_->Fill(eleIt->eSuperClusterOverP());
125  numberOfAssociatedHits+= eleIt->superCluster()->size();
126  DetId Max = findMaxHit (eleIt->superCluster ()->hitsAndFractions (),
127  rhEB.product(), rhEE.product()) ;
128  if (!Max.det()) continue;
129  if (Max.subdetId()==EcalBarrel) {
130  EBDetId EBMax (Max);
131  fillAroundBarrel (rhEB.product(),EBMax.ieta(),EBMax.iphi());
132  }
133  if (Max.subdetId()==EcalEndcap) {
134  EEDetId EEMax (Max);
135  fillAroundEndcap (rhEE.product(),EEMax.ix(),EEMax.iy());
136  }
137  }
138  }//is valid electron
139 
140  // fill EB histos
141  if (rhEB.isValid())
142  {
143  numberOfHits+= rhEB->size();
144  for(itb=rhEB->begin(); itb!=rhEB->end(); ++itb){
145  EBDetId id(itb->id());
146  OccupancyEB_->Fill(id.iphi(),id.ieta());
147  } // Eb rechits
148  } //is Valid
149  if (rhEE.isValid())
150  {
151  numberOfHits+= rhEE->size();
152  for (itb = rhEE->begin(); itb!=rhEE->end(); ++itb){
153  EEDetId id (itb->id());
154  if (id.zside()>0){
155  OccupancyEEP_->Fill(id.ix(),id.iy());
156  } //zside>0
157  else if (id.zside()<0){
158  OccupancyEEM_->Fill(id.ix(),id.iy());
159  } //zside<0
160 
161  }//EE reChit
162  }//is Valid
163  if (numberOfElectrons) recHitsPerElectron_->Fill((double)numberOfHits/((double)numberOfElectrons));
164  if (numberOfHits) HitsVsAssociatedHits_->Fill((double)numberOfAssociatedHits/((double)numberOfHits));
165 } //end of the analyzer
MonitorElement * ESCoP_
ESCoP.
std::vector< T >::const_iterator const_iterator
edm::InputTag productMonitoredElectrons_
electrons to monitor
void Fill(long long x)
edm::InputTag productMonitoredEE_
object to monitor
MonitorElement * OccupancyEEM_
int iEvent
Definition: GenABIO.cc:243
MonitorElement * HitsVsAssociatedHits_
recHits over associated recHits
MonitorElement * OccupancyEEP_
bool isValid() const
Definition: HandleBase.h:76
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
void fillAroundEndcap(const EcalRecHitCollection *, int, int)
MonitorElement * recHitsPerElectron_
Number of recHits per electron.
edm::InputTag productMonitoredEB_
object to monitor
void fillAroundBarrel(const EcalRecHitCollection *, int, int)
fills local occupancy graphs
Definition: DetId.h:20
MonitorElement * OccupancyEB_
Occupancy.
DetId findMaxHit(const std::vector< std::pair< DetId, float > > &, const EcalRecHitCollection *, const EcalRecHitCollection *)
find the MOX
T const * product() const
Definition: Handle.h:74
MonitorElement * ElectronsNumber_
Number of electrons.
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
void DQMSourceEleCalib::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file DQMSourceEleCalib.cc.

References DQMStore::book1D(), DQMStore::book2D(), dbe_, ElectronsNumber_, ESCoP_, folderName_, HitsVsAssociatedHits_, LocalOccupancyEB_, LocalOccupancyEE_, OccupancyEB_, OccupancyEEM_, OccupancyEEP_, recHitsPerElectron_, and DQMStore::setCurrentFolder().

65  {
66 
67  // create and cd into new folder
69 
70  recHitsPerElectron_ = dbe_->book1D("recHitsPerElectron_","recHitPerElectron",
71  200,0,200);
72  ElectronsNumber_ = dbe_->book1D("ElectronsNumber_","electrons in the event",
73  40,0,40);
74  ESCoP_ = dbe_->book1D ("ESCoP","ESCoP",50,0,5);
75 
76  OccupancyEB_= dbe_->book2D("OccupancyEB_","OccupancyEB",360,1,361,171,-85,86);
77  OccupancyEEP_= dbe_->book2D("OccupancyEEP_","Occupancy EE Plus",100,1,101,100,1,101);
78  OccupancyEEM_= dbe_->book2D("OccupancyEEM_","Occupancy EE Minus",100,1,101,100,1,101);
79  HitsVsAssociatedHits_ = dbe_->book1D ("HitsVsAssociatedHits_","HitsVsAssociatedHits",100,0,5);
80  LocalOccupancyEB_ = dbe_->book2D ("LocalOccupancyEB_","Local occupancy Barrel",9,-4,5,9,-4,5);
81  LocalOccupancyEE_ = dbe_->book2D ("LocalOccupancyEE_","Local occupancy Endcap",9,-4,5,9,-4,5);
82 
83 }
MonitorElement * ESCoP_
ESCoP.
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:514
MonitorElement * LocalOccupancyEE_
MonitorElement * OccupancyEEM_
MonitorElement * HitsVsAssociatedHits_
recHits over associated recHits
std::string folderName_
DQM folder name.
MonitorElement * OccupancyEEP_
MonitorElement * recHitsPerElectron_
Number of recHits per electron.
MonitorElement * OccupancyEB_
Occupancy.
MonitorElement * ElectronsNumber_
Number of electrons.
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:642
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
MonitorElement * LocalOccupancyEB_
void DQMSourceEleCalib::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 91 of file DQMSourceEleCalib.cc.

92  {
93 
94 }
void DQMSourceEleCalib::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 86 of file DQMSourceEleCalib.cc.

86  {
87 
88 }
void DQMSourceEleCalib::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 179 of file DQMSourceEleCalib.cc.

References dbe_, fileName_, DQMStore::save(), and saveToFile_.

179  {
180 
181  if (saveToFile_) {
182  dbe_->save(fileName_);
183  }
184 
185 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:1898
std::string fileName_
Output file name if required.
bool saveToFile_
Write to file.
void DQMSourceEleCalib::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 171 of file DQMSourceEleCalib.cc.

172  {
173 }
void DQMSourceEleCalib::endRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 175 of file DQMSourceEleCalib.cc.

175  {
176 
177 }
void DQMSourceEleCalib::fillAroundBarrel ( const EcalRecHitCollection recHits,
int  eta,
int  phi 
)
private

fills local occupancy graphs

Definition at line 241 of file DQMSourceEleCalib.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), eta(), MonitorElement::Fill(), EBDetId::ieta(), EBDetId::iphi(), LocalOccupancyEB_, phi, and mathSSE::return().

Referenced by analyze().

242 {
243 
244  for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
245  elem != recHits->end () ;
246  ++elem)
247  {
248  EBDetId elementId = elem->id () ;
250  elementId.ieta () - eta ,
251  elementId.iphi () - phi ,
252  elem->energy ()
253  ) ;
254  }
255  return ;
256 }
std::vector< T >::const_iterator const_iterator
T eta() const
return((rh^lh)&mask)
void Fill(long long x)
int iphi() const
get the crystal iphi
Definition: EBDetId.h:46
int ieta() const
get the crystal ieta
Definition: EBDetId.h:44
const_iterator end() const
const_iterator begin() const
MonitorElement * LocalOccupancyEB_
Definition: DDAxes.h:10
void DQMSourceEleCalib::fillAroundEndcap ( const EcalRecHitCollection recHits,
int  ics,
int  ips 
)
private

Definition at line 263 of file DQMSourceEleCalib.cc.

References edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), MonitorElement::Fill(), h2_mapping_cfi::ics, EEDetId::ix(), EEDetId::iy(), LocalOccupancyEE_, and mathSSE::return().

Referenced by analyze().

264 {
265  for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
266  elem != recHits->end () ;
267  ++elem)
268  {
269  EEDetId elementId = elem->id () ;
271  elementId.ix () - ics ,
272  elementId.iy () - ips ,
273  elem->energy ()
274  ) ;
275  }
276  return ;
277 }
int ix() const
Definition: EEDetId.h:71
MonitorElement * LocalOccupancyEE_
std::vector< T >::const_iterator const_iterator
return((rh^lh)&mask)
void Fill(long long x)
int iy() const
Definition: EEDetId.h:77
const_iterator end() const
const_iterator begin() const
DetId DQMSourceEleCalib::findMaxHit ( const std::vector< std::pair< DetId, float > > &  v1,
const EcalRecHitCollection EBhits,
const EcalRecHitCollection EEhits 
)
private

find the MOX

Definition at line 189 of file DQMSourceEleCalib.cc.

References EcalBarrel, edm::SortedCollection< T, SORT >::end(), and edm::SortedCollection< T, SORT >::find().

Referenced by analyze().

192 {
193 
194  double currEnergy = 0. ;
195  DetId maxHit ;
196  for (std::vector<std::pair<DetId,float> >::const_iterator idsIt = v1.begin () ;
197  idsIt != v1.end () ; ++idsIt)
198  {
199 
200  if (idsIt->first.subdetId () == EcalBarrel)
201  {
203  itrechit = EBhits->find ((*idsIt).first) ;
204  if (itrechit == EBhits->end () )
205  {
206  edm::LogInfo ("reading")
207  << "[findMaxHit] rechit not found! " ;
208  continue ;
209  }
210 //FIXME: wnat to use the fraction i.e. .second??
211  if (itrechit->energy () > currEnergy)
212  {
213  currEnergy = itrechit->energy () ;
214  maxHit= (*idsIt).first ;
215  }
216  }
217  else
218  {
220  itrechit = EEhits->find ((*idsIt).first) ;
221  if (itrechit == EEhits->end () )
222  {
223  edm::LogInfo ("reading")
224  << "[findMaxHit] rechit not found! " ;
225  continue ;
226  }
227 
228 //FIXME: wnat to use the fraction i.e. .second??
229  if (itrechit->energy () > currEnergy)
230  {
231  currEnergy=itrechit->energy () ;
232  maxHit= (*idsIt).first ;
233  }
234  }
235  }
236  return maxHit ;
237 }
std::vector< T >::const_iterator const_iterator
const_iterator end() const
Definition: DetId.h:20
iterator find(key_type k)

Member Data Documentation

DQMStore* DQMSourceEleCalib::dbe_
private

Definition at line 60 of file DQMSourceEleCalib.h.

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

MonitorElement* DQMSourceEleCalib::ElectronsNumber_
private

Number of electrons.

Definition at line 66 of file DQMSourceEleCalib.h.

Referenced by analyze(), and beginJob().

MonitorElement* DQMSourceEleCalib::ESCoP_
private

ESCoP.

Definition at line 68 of file DQMSourceEleCalib.h.

Referenced by analyze(), and beginJob().

int DQMSourceEleCalib::eventCounter_
private

Definition at line 61 of file DQMSourceEleCalib.h.

Referenced by analyze().

std::string DQMSourceEleCalib::fileName_
private

Output file name if required.

Definition at line 97 of file DQMSourceEleCalib.h.

Referenced by DQMSourceEleCalib(), and endJob().

std::string DQMSourceEleCalib::folderName_
private

DQM folder name.

Definition at line 91 of file DQMSourceEleCalib.h.

Referenced by beginJob(), and DQMSourceEleCalib().

MonitorElement* DQMSourceEleCalib::HitsVsAssociatedHits_
private

recHits over associated recHits

Definition at line 77 of file DQMSourceEleCalib.h.

Referenced by analyze(), and beginJob().

MonitorElement* DQMSourceEleCalib::LocalOccupancyEB_
private

Definition at line 73 of file DQMSourceEleCalib.h.

Referenced by beginJob(), and fillAroundBarrel().

MonitorElement* DQMSourceEleCalib::LocalOccupancyEE_
private

Definition at line 74 of file DQMSourceEleCalib.h.

Referenced by beginJob(), and fillAroundEndcap().

MonitorElement* DQMSourceEleCalib::OccupancyEB_
private

Occupancy.

Definition at line 70 of file DQMSourceEleCalib.h.

Referenced by analyze(), and beginJob().

MonitorElement* DQMSourceEleCalib::OccupancyEEM_
private

Definition at line 72 of file DQMSourceEleCalib.h.

Referenced by analyze(), and beginJob().

MonitorElement* DQMSourceEleCalib::OccupancyEEP_
private

Definition at line 71 of file DQMSourceEleCalib.h.

Referenced by analyze(), and beginJob().

unsigned int DQMSourceEleCalib::prescaleFactor_
private

Monitor every prescaleFactor_ events.

Definition at line 88 of file DQMSourceEleCalib.h.

Referenced by DQMSourceEleCalib().

edm::InputTag DQMSourceEleCalib::productMonitoredEB_
private

object to monitor

Definition at line 80 of file DQMSourceEleCalib.h.

Referenced by analyze(), and DQMSourceEleCalib().

edm::InputTag DQMSourceEleCalib::productMonitoredEE_
private

object to monitor

Definition at line 83 of file DQMSourceEleCalib.h.

Referenced by analyze(), and DQMSourceEleCalib().

edm::InputTag DQMSourceEleCalib::productMonitoredElectrons_
private

electrons to monitor

Definition at line 85 of file DQMSourceEleCalib.h.

Referenced by analyze(), and DQMSourceEleCalib().

MonitorElement* DQMSourceEleCalib::recHitsPerElectron_
private

Number of recHits per electron.

Definition at line 64 of file DQMSourceEleCalib.h.

Referenced by analyze(), and beginJob().

bool DQMSourceEleCalib::saveToFile_
private

Write to file.

Definition at line 94 of file DQMSourceEleCalib.h.

Referenced by DQMSourceEleCalib(), and endJob().