CMS 3D CMS Logo

Public Member Functions | Private Attributes

CastorRecHitMonitor Class Reference

#include <CastorRecHitMonitor.h>

Inheritance diagram for CastorRecHitMonitor:
CastorBaseMonitor

List of all members.

Public Member Functions

 CastorRecHitMonitor ()
void processEvent (const CastorRecHitCollection &castorHits)
void reset ()
void setup (const edm::ParameterSet &ps, DQMStore *dbe)
 ~CastorRecHitMonitor ()

Private Attributes

float allEnergyModule [14]
float allEnergySector [16]
struct {
   MonitorElement *   meCastorRecHitsOccupancy
   std::map< HcalCastorDetId,
MonitorElement * >   meRECHIT_E
   MonitorElement *   meRECHIT_E_all
   MonitorElement *   meRECHIT_E_modules
   MonitorElement *   meRECHIT_E_relative_modules
   MonitorElement *   meRECHIT_E_relative_sectors
   MonitorElement *   meRECHIT_E_sectors
   MonitorElement *   meRECHIT_MAP_CHAN_E
   MonitorElement *   meRECHIT_N_event
   MonitorElement *   meRECHIT_N_modules
   MonitorElement *   meRECHIT_N_sectors
   std::map< HcalCastorDetId,
MonitorElement * >   meRECHIT_T
   MonitorElement *   meRECHIT_T_all
castorHists
float channel
bool doPerChannel_
float energy
float energyInEachChannel [14][16]
int ievt_
MonitorElementmeEVT_
int module
int sector
float time
float totEnergy
int zside

Detailed Description

Definition at line 9 of file CastorRecHitMonitor.h.


Constructor & Destructor Documentation

CastorRecHitMonitor::CastorRecHitMonitor ( )

Definition at line 16 of file CastorRecHitMonitor.cc.

References doPerChannel_, and ievt_.

                                         {
  doPerChannel_ = true;
  //  occThresh_ = 1;
  ievt_=0; 
}
CastorRecHitMonitor::~CastorRecHitMonitor ( )

Definition at line 25 of file CastorRecHitMonitor.cc.

                                         {
}

Member Function Documentation

void CastorRecHitMonitor::processEvent ( const CastorRecHitCollection castorHits)

Definition at line 172 of file CastorRecHitMonitor.cc.

References allEnergyModule, allEnergySector, CastorBaseMonitor::baseFolder_, edm::SortedCollection< T, SORT >::begin(), castorHists, channel, gather_cfg::cout, CastorBaseMonitor::cpu_timer, edm::CPUTimer::cpuTime(), doPerChannel_, edm::SortedCollection< T, SORT >::end(), energy, energyInEachChannel, MonitorElement::Fill(), CastorBaseMonitor::fVerbosity, errorMatrix2Lands_multiChannel::id, ievt_, CastorBaseMonitor::m_dbe, meEVT_, text2workspace::mod, module, edm::CPUTimer::reset(), sector, CastorBaseMonitor::showTiming, edm::SortedCollection< T, SORT >::size(), edm::CPUTimer::start(), edm::CPUTimer::stop(), time, and totEnergy.

Referenced by CastorMonitorModule::analyze().

                                                                               {

  if(fVerbosity>0) std::cout << "==>CastorRecHitMonitor::processEvent !!!"<< std::endl;
       

  ievt_++; totEnergy=0.;

   meEVT_->Fill(ievt_);



  if(!m_dbe) { 
    if(fVerbosity>0) std::cout <<"CastorRecHitMonitor::processEvent => DQMStore is not instantiated !!!"<<std::endl;  
    return; 
  }

  CastorRecHitCollection::const_iterator CASTORiter;
  if (showTiming)  { cpu_timer.reset(); cpu_timer.start(); } 

  //castorHists.meRECHIT_N_event->Fill(castorHits.size());
   int iHit=0;

     if(castorHits.size()>0)
    {    
       if(fVerbosity>0) std::cout << "==>CastorRecHitMonitor::processEvent: castorHits.size()>0 !!!" << std::endl; 

      for (CASTORiter=castorHits.begin(); CASTORiter!=castorHits.end(); ++CASTORiter) { 
  
      energy = CASTORiter->energy();    
      time = CASTORiter->time();
      
      HcalCastorDetId id(CASTORiter->detid().rawId());
      //float zside  = id.zside(); 
      module = (int)id.module(); //-- get module
      sector = (int)id.sector(); //-- get sector 
      channel = 16*(module-1)+sector; //-- define channel

      if (energy>0.) { 
      castorHists.meRECHIT_E_all->Fill(energy);
      castorHists.meRECHIT_T_all->Fill(time);
      castorHists.meRECHIT_MAP_CHAN_E->Fill(channel,energy);
      castorHists.meRECHIT_E_modules->Fill(module-1, energy);
      castorHists.meRECHIT_E_sectors->Fill(sector-1, energy);
      castorHists.meRECHIT_N_modules->Fill(module-1);
      castorHists.meRECHIT_N_sectors->Fill(sector-1);     
      iHit++;
     }

      if(energy<0) energy=0;

      energyInEachChannel[module-1][sector-1] += energy; 
     
      castorHists.meCastorRecHitsOccupancy->Fill(module-1,sector-1, energy); 

        castorHists.meRECHIT_N_event->Fill(iHit);

      if( doPerChannel_) 
         CastorRecHitPerChan::perChanHists<CastorRecHit>(*CASTORiter, castorHists.meRECHIT_E, castorHists.meRECHIT_T, m_dbe, baseFolder_); 
     }

      for(int mod=0; mod<14;mod++)
        for(int sec=0; sec<16;sec++)
          totEnergy+=energyInEachChannel[mod][sec];

       for(int mod=0; mod<14;mod++)
       allEnergyModule[mod]= energyInEachChannel[mod][0]+energyInEachChannel[mod][1]+energyInEachChannel[mod][2]+energyInEachChannel[mod][3]+
                          energyInEachChannel[mod][4]+energyInEachChannel[mod][5]+energyInEachChannel[mod][6]+energyInEachChannel[mod][7]+
                          energyInEachChannel[mod][8]+energyInEachChannel[mod][9]+energyInEachChannel[mod][10]+energyInEachChannel[mod][11]+
                           energyInEachChannel[mod][12]+energyInEachChannel[mod][13]+energyInEachChannel[mod][14]+energyInEachChannel[mod][15];
                         
       for(int sec=0; sec<16;sec++)
       allEnergySector[sec]= energyInEachChannel[0][sec]+energyInEachChannel[1][sec]+energyInEachChannel[2][sec]+energyInEachChannel[3][sec]+
                          energyInEachChannel[4][sec]+energyInEachChannel[5][sec]+energyInEachChannel[6][sec]+energyInEachChannel[7][sec]+
                          energyInEachChannel[8][sec]+energyInEachChannel[9][sec]+energyInEachChannel[10][sec]+energyInEachChannel[11][sec]+
                          energyInEachChannel[12][sec]+energyInEachChannel[13][sec];


       for(int mod=0; mod<14;mod++)
      castorHists.meRECHIT_E_relative_modules->getTH1F()->SetBinContent(mod+1,allEnergyModule[mod]/totEnergy);
      for(int sec=0; sec<16;sec++)
        castorHists.meRECHIT_E_relative_sectors->getTH1F()->SetBinContent(sec+1,allEnergySector[sec]/totEnergy); 

  

   }

  else { if(fVerbosity>0) std::cout<<"CastorRecHitMonitor::processEvent NO Castor RecHits !!!"<<std::endl; }

  if (showTiming) { 
      cpu_timer.stop(); std::cout << " TIMER::CastorRecHit -> " << cpu_timer.cpuTime() << std::endl; 
      cpu_timer.reset(); cpu_timer.start();  
    }
    
 
  return;
}
void CastorRecHitMonitor::reset ( void  )

Definition at line 28 of file CastorRecHitMonitor.cc.

Referenced by CastorMonitorModule::reset().

                               {
}
void CastorRecHitMonitor::setup ( const edm::ParameterSet ps,
DQMStore dbe 
) [virtual]

Reimplemented from CastorBaseMonitor.

Definition at line 36 of file CastorRecHitMonitor.cc.

References allEnergyModule, allEnergySector, CastorBaseMonitor::baseFolder_, DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookInt(), castorHists, gather_cfg::cout, doPerChannel_, energyInEachChannel, CastorBaseMonitor::fVerbosity, edm::ParameterSet::getUntrackedParameter(), ievt_, CastorBaseMonitor::m_dbe, meEVT_, text2workspace::mod, NULL, CastorBaseMonitor::rootFolder_, sector, DQMStore::setCurrentFolder(), totEnergy, and zside.

Referenced by CastorMonitorModule::CastorMonitorModule().

                                                                       {
  
  CastorBaseMonitor::setup(ps,dbe);
  baseFolder_ = rootFolder_+"CastorRecHitMonitor";

   if(fVerbosity>0) std::cout << "CastorRecHitMonitor::setup (start)" << std::endl;
  
  if ( ps.getUntrackedParameter<bool>("RecHitsPerChannel", false) ){
    doPerChannel_ = true;
  }
    
  ievt_=0; module=0; sector=0; zside=0; totEnergy=0.;

  
   for (int mod=0; mod<14; mod++){
     for (int sec=0; sec<16; sec++){
          energyInEachChannel[mod][sec] = 0.;
          allEnergyModule[mod]=0;
          allEnergySector[sec]=0;
      }
    }
  
  if ( m_dbe !=NULL ) {    
 m_dbe->setCurrentFolder(baseFolder_);
meEVT_ = m_dbe->bookInt("RecHit Event Number"); // meEVT_->Fill(ievt_);
castorHists.meRECHIT_E_all = m_dbe->book1D("CastorRecHit Energies- above threshold on RecHitEnergy","CastorRecHit Energies- above threshold on RecHitEnergy",150,0,150);
castorHists.meRECHIT_T_all = m_dbe->book1D("CastorRecHit Times- above threshold on RecHitEnergy","CastorRecHit Times- above threshold on RecHitEnergy",300,-100,100);    
castorHists.meRECHIT_MAP_CHAN_E = m_dbe->book1D("CastorRecHit Energy in each channel- above threshold","CastorRecHit Energy in each channel- above threshold",224,0,224);
castorHists.meRECHIT_E_modules = m_dbe->book1D("CastorRecHit Energy in modules- above threshold","CastorRecHit Energy in modules- above threshold", 14, 0, 14);
castorHists.meRECHIT_E_sectors = m_dbe->book1D("CastorRecHit Energy in sectors- above threshold","CastorRecHit Energy in sectors- above threshold", 16, 0, 16);

castorHists.meRECHIT_N_modules = m_dbe->book1D("Number of CastorRecHits in modules- above threshold","Number of CastorRecHits in modules- above threshold", 14, 0, 14);
castorHists.meRECHIT_N_sectors = m_dbe->book1D("Number of CastorRecHits in sectors- above threshold","Number of CastorRecHits in sectors- above threshold", 16, 0, 16);
castorHists.meCastorRecHitsOccupancy = m_dbe->book2D("CastorRecHits Occupancy Map", "CastorRecHits Occupancy Map", 14, 0,14, 16, 0,16);
castorHists.meRECHIT_N_event = m_dbe->book1D("Number of CASTOR RecHits per event- above threshold","Number of CASTOR RecHits per event- above threshold", 23, 0, 230);

 m_dbe->setCurrentFolder(baseFolder_+"/EnergyFraction");
castorHists.meRECHIT_E_relative_modules = m_dbe->book1D("Fraction of the total energy in CASTOR modules","Fraction of the total energy in CASTOR modules", 14, 0, 14);
castorHists.meRECHIT_E_relative_sectors = m_dbe->book1D("Fraction of the total energy in CASTOR sectors","Fraction of the total energy in CASTOR sectors", 16, 0, 16);
/*
castorHists.meRECHIT_E_relative_modules->getTH1F()->GetYaxis()->SetTitle("fraction of the total energy");
castorHists.meRECHIT_E_relative_sectors->getTH1F()->GetYaxis()->SetTitle("fraction of the total energy");
 
   char ibin1[1024];
    for(int i=0; i<14; i++){
     sprintf(ibin1,"%i", i+1);
     castorHists.meRECHIT_E_relative_modules->getTH1F()->GetXaxis()->SetBinLabel(i+1,ibin1);
    }
   char ibin2[1024];
    for(int i=0; i<16; i++){
     sprintf(ibin2,"%i", i+1);
     castorHists.meRECHIT_E_relative_sectors->getTH1F()->GetXaxis()->SetBinLabel(i+1,ibin2);
    }
*/

  } 



  else{
  if(fVerbosity>0) std::cout << "CastorRecHitMonitor::setup - NO DQMStore service" << std::endl; 
 }

  if(fVerbosity>0) std::cout << "CastorRecHitMonitor::setup (end)" << std::endl;

  return;
}

Member Data Documentation

Definition at line 37 of file CastorRecHitMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 38 of file CastorRecHitMonitor.h.

Referenced by processEvent(), and setup().

struct { ... } CastorRecHitMonitor::castorHists [private]

Referenced by processEvent(), and setup().

Definition at line 28 of file CastorRecHitMonitor.h.

Referenced by processEvent().

Definition at line 20 of file CastorRecHitMonitor.h.

Referenced by CastorRecHitMonitor(), processEvent(), and setup().

float CastorRecHitMonitor::energy [private]

Definition at line 31 of file CastorRecHitMonitor.h.

Referenced by processEvent().

Definition at line 33 of file CastorRecHitMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 22 of file CastorRecHitMonitor.h.

Referenced by CastorRecHitMonitor(), processEvent(), and setup().

Definition at line 51 of file CastorRecHitMonitor.h.

Definition at line 56 of file CastorRecHitMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 53 of file CastorRecHitMonitor.h.

Definition at line 42 of file CastorRecHitMonitor.h.

Definition at line 45 of file CastorRecHitMonitor.h.

Definition at line 47 of file CastorRecHitMonitor.h.

Definition at line 48 of file CastorRecHitMonitor.h.

Definition at line 46 of file CastorRecHitMonitor.h.

Definition at line 44 of file CastorRecHitMonitor.h.

Definition at line 52 of file CastorRecHitMonitor.h.

Definition at line 49 of file CastorRecHitMonitor.h.

Definition at line 50 of file CastorRecHitMonitor.h.

Definition at line 53 of file CastorRecHitMonitor.h.

Definition at line 43 of file CastorRecHitMonitor.h.

Definition at line 25 of file CastorRecHitMonitor.h.

Referenced by processEvent().

Definition at line 26 of file CastorRecHitMonitor.h.

Referenced by processEvent(), and setup().

float CastorRecHitMonitor::time [private]

Definition at line 32 of file CastorRecHitMonitor.h.

Referenced by processEvent().

Definition at line 34 of file CastorRecHitMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 27 of file CastorRecHitMonitor.h.

Referenced by setup().