CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

DQMSourceEleCalib Class Reference

#include <DQMSourceEleCalib.h>

Inheritance diagram for DQMSourceEleCalib:
edm::EDAnalyzer

List of all members.

Public Member Functions

 DQMSourceEleCalib (const edm::ParameterSet &)
 ~DQMSourceEleCalib ()

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)

Private Member Functions

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

Private Attributes

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

Detailed Description

* DQM Source for phi symmetry stream

Date:
2009/12/14 22:22:17
Revision:
1.3
Author:
Stefano Argiro' Andrea Gozzelino - Universita  e INFN Torino

Definition at line 24 of file DQMSourceEleCalib.h.


Constructor & Destructor Documentation

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

Definition at line 60 of file DQMSourceEleCalib.cc.

{}

Member Function Documentation

void DQMSourceEleCalib::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

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

                                                         {
 
//  if (eventCounter_% prescaleFactor_ ) return; //FIXME
  eventCounter_++;
  int numberOfHits=0;
  int numberOfElectrons=0;
  int numberOfAssociatedHits = 0;
  //reads the recHits
  edm::Handle<EcalRecHitCollection> rhEB;
  edm::Handle<EcalRecHitCollection> rhEE;
 
  iEvent.getByLabel(productMonitoredEB_, rhEB); 
  iEvent.getByLabel(productMonitoredEE_, rhEE);

  EcalRecHitCollection::const_iterator itb;

  //reads the electrons
  edm::Handle<reco::GsfElectronCollection> pElectrons ;
  iEvent.getByLabel (productMonitoredElectrons_, pElectrons) ;
  
  if (pElectrons.isValid()){
    ElectronsNumber_->Fill(pElectrons->size()+0.1);
    numberOfElectrons = pElectrons->size();
    for (reco::GsfElectronCollection::const_iterator eleIt = pElectrons->begin();
        eleIt!= pElectrons->end(); ++eleIt){
    ESCoP_->Fill(eleIt->eSuperClusterOverP());
    numberOfAssociatedHits+= eleIt->superCluster()->size();
    DetId Max = findMaxHit (eleIt->superCluster ()->hitsAndFractions (), 
                             rhEB.product(),  rhEE.product()) ;
    if (!Max.det()) continue;
    if (Max.subdetId()==EcalBarrel) {
            EBDetId EBMax (Max);
            fillAroundBarrel (rhEB.product(),EBMax.ieta(),EBMax.iphi());
    }
    if (Max.subdetId()==EcalEndcap) {
            EEDetId EEMax (Max);
            fillAroundEndcap (rhEE.product(),EEMax.ix(),EEMax.iy());
    }
   }
  }//is valid electron

  // fill EB histos
  if (rhEB.isValid())
  {
    numberOfHits+= rhEB->size();
    for(itb=rhEB->begin(); itb!=rhEB->end(); ++itb){
      EBDetId id(itb->id());
      OccupancyEB_->Fill(id.iphi(),id.ieta());
    } // Eb rechits
   } //is Valid
   if (rhEE.isValid())
   {
     numberOfHits+= rhEE->size();
     for (itb = rhEE->begin(); itb!=rhEE->end(); ++itb){
       EEDetId id (itb->id());
       if (id.zside()>0){
               OccupancyEEP_->Fill(id.ix(),id.iy());
       } //zside>0
       else if (id.zside()<0){
               OccupancyEEM_->Fill(id.ix(),id.iy());
       } //zside<0
      
    }//EE reChit
   }//is Valid
   if (numberOfElectrons) recHitsPerElectron_->Fill((double)numberOfHits/((double)numberOfElectrons));
   if (numberOfHits) HitsVsAssociatedHits_->Fill((double)numberOfAssociatedHits/((double)numberOfHits));
} //end of the analyzer
void DQMSourceEleCalib::beginJob ( void  ) [protected, virtual]

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

                                {

  // create and cd into new folder
  dbe_->setCurrentFolder(folderName_);

  recHitsPerElectron_ = dbe_->book1D("recHitsPerElectron_","recHitPerElectron",
                                        200,0,200);
  ElectronsNumber_ = dbe_->book1D("ElectronsNumber_","electrons in the event",
                                   40,0,40);
  ESCoP_ = dbe_->book1D ("ESCoP","ESCoP",50,0,5);

  OccupancyEB_= dbe_->book2D("OccupancyEB_","OccupancyEB",360,1,361,171,-85,86);
  OccupancyEEP_= dbe_->book2D("OccupancyEEP_","Occupancy EE Plus",100,1,101,100,1,101);
  OccupancyEEM_= dbe_->book2D("OccupancyEEM_","Occupancy EE Minus",100,1,101,100,1,101);
  HitsVsAssociatedHits_ = dbe_->book1D ("HitsVsAssociatedHits_","HitsVsAssociatedHits",100,0,5);
  LocalOccupancyEB_ = dbe_->book2D ("LocalOccupancyEB_","Local occupancy Barrel",9,-4,5,9,-4,5); 
  LocalOccupancyEE_ = dbe_->book2D ("LocalOccupancyEE_","Local occupancy Endcap",9,-4,5,9,-4,5); 

}
void DQMSourceEleCalib::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 91 of file DQMSourceEleCalib.cc.

                                {
  
}
void DQMSourceEleCalib::beginRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 86 of file DQMSourceEleCalib.cc.

                                                                           {

}
void DQMSourceEleCalib::endJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 179 of file DQMSourceEleCalib.cc.

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

                              {
  
  if (saveToFile_) {
     dbe_->save(fileName_);
  }
  
}
void DQMSourceEleCalib::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 171 of file DQMSourceEleCalib.cc.

                                                                     {
}
void DQMSourceEleCalib::endRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 175 of file DQMSourceEleCalib.cc.

                                                                     {

}
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_, and phi.

Referenced by analyze().

{

  for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
       elem != recHits->end () ;
       ++elem)
    {
      EBDetId elementId = elem->id () ; 
      LocalOccupancyEB_->Fill (
        elementId.ieta () - eta ,
        elementId.iphi () - phi ,
        elem->energy ()
      ) ;
    }   
  return ;
}
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(), and LocalOccupancyEE_.

Referenced by analyze().

{
  for (EcalRecHitCollection::const_iterator elem = recHits->begin () ;
       elem != recHits->end () ;
       ++elem)
    {
      EEDetId elementId = elem->id () ; 
      LocalOccupancyEE_->Fill (
        elementId.ix () - ics ,
        elementId.iy () - ips ,
        elem->energy ()
      ) ;
    }   
  return ;
}
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().

{

  double currEnergy = 0. ;
  DetId maxHit ;
  for (std::vector<std::pair<DetId,float> >::const_iterator idsIt = v1.begin () ; 
       idsIt != v1.end () ; ++idsIt)
    {
            
     if (idsIt->first.subdetId () == EcalBarrel) 
       {              
         EcalRecHitCollection::const_iterator itrechit ;
         itrechit = EBhits->find ((*idsIt).first) ;
         if (itrechit == EBhits->end () )
           {
             edm::LogInfo ("reading")
             << "[findMaxHit] rechit not found! " ;
             continue ;
           }
//FIXME: wnat to use the fraction i.e. .second??
         if (itrechit->energy () > currEnergy)
           {
             currEnergy = itrechit->energy () ;
             maxHit= (*idsIt).first ;
           }
       }
     else 
       {     
         EcalRecHitCollection::const_iterator itrechit ;
         itrechit = EEhits->find ((*idsIt).first) ;
         if (itrechit == EEhits->end () )
           {
             edm::LogInfo ("reading")
             << "[findMaxHit] rechit not found! " ;
             continue ;
           }
              
//FIXME: wnat to use the fraction i.e. .second??
         if (itrechit->energy () > currEnergy)
           {
            currEnergy=itrechit->energy () ;
            maxHit= (*idsIt).first ;
           }
       }
    }
  return maxHit ;
}

Member Data Documentation

Definition at line 60 of file DQMSourceEleCalib.h.

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

Number of electrons.

Definition at line 66 of file DQMSourceEleCalib.h.

Referenced by analyze(), and beginJob().

ESCoP.

Definition at line 68 of file DQMSourceEleCalib.h.

Referenced by analyze(), and beginJob().

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

recHits over associated recHits

Definition at line 77 of file DQMSourceEleCalib.h.

Referenced by analyze(), and beginJob().

Definition at line 73 of file DQMSourceEleCalib.h.

Referenced by beginJob(), and fillAroundBarrel().

Definition at line 74 of file DQMSourceEleCalib.h.

Referenced by beginJob(), and fillAroundEndcap().

Occupancy.

Definition at line 70 of file DQMSourceEleCalib.h.

Referenced by analyze(), and beginJob().

Definition at line 72 of file DQMSourceEleCalib.h.

Referenced by analyze(), and beginJob().

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

object to monitor

Definition at line 80 of file DQMSourceEleCalib.h.

Referenced by analyze(), and DQMSourceEleCalib().

object to monitor

Definition at line 83 of file DQMSourceEleCalib.h.

Referenced by analyze(), and DQMSourceEleCalib().

electrons to monitor

Definition at line 85 of file DQMSourceEleCalib.h.

Referenced by analyze(), and DQMSourceEleCalib().

Number of recHits per electron.

Definition at line 64 of file DQMSourceEleCalib.h.

Referenced by analyze(), and beginJob().

Write to file.

Definition at line 94 of file DQMSourceEleCalib.h.

Referenced by DQMSourceEleCalib(), and endJob().