CMS 3D CMS Logo

Public Member Functions | Private Attributes

CastorEventDisplay Class Reference

#include <CastorEventDisplay.h>

Inheritance diagram for CastorEventDisplay:
CastorBaseMonitor

List of all members.

Public Member Functions

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

Private Attributes

float allEnergyEvent
float energy
int ievt_
float maxEnergyEvent
MonitorElementmeCastor3Dhits
MonitorElementmeCastor3DhitsMaxEnergy
MonitorElementmeEVT_
bool offline_
double X_pos
double X_pos_maxE
double Y_pos
double Y_pos_maxE
double Z_pos
double Z_pos_maxE

Detailed Description

Definition at line 21 of file CastorEventDisplay.h.


Constructor & Destructor Documentation

CastorEventDisplay::CastorEventDisplay ( )

Definition at line 16 of file CastorEventDisplay.cc.

References ievt_.

                                       {
  ievt_=0;
}
CastorEventDisplay::~CastorEventDisplay ( )

Definition at line 23 of file CastorEventDisplay.cc.

                                       {
}

Member Function Documentation

void CastorEventDisplay::processEvent ( const CastorRecHitCollection castorHits,
const CaloGeometry caloGeometry 
)

Definition at line 93 of file CastorEventDisplay.cc.

References abs, allEnergyEvent, edm::SortedCollection< T, SORT >::begin(), gather_cfg::cout, CastorBaseMonitor::cpu_timer, edm::CPUTimer::cpuTime(), edm::SortedCollection< T, SORT >::end(), energy, MonitorElement::Fill(), CastorBaseMonitor::fVerbosity, CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), MonitorElement::getTH3F(), ievt_, CastorBaseMonitor::m_dbe, maxEnergyEvent, meCastor3Dhits, meCastor3DhitsMaxEnergy, meEVT_, MonitorElement::Reset(), edm::CPUTimer::reset(), CastorBaseMonitor::showTiming, edm::SortedCollection< T, SORT >::size(), edm::CPUTimer::start(), edm::CPUTimer::stop(), MonitorElement::update(), PV3DBase< T, PVType, FrameType >::x(), X_pos, X_pos_maxE, PV3DBase< T, PVType, FrameType >::y(), Y_pos, Y_pos_maxE, PV3DBase< T, PVType, FrameType >::z(), Z_pos, and Z_pos_maxE.

Referenced by CastorMonitorModule::analyze().

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

   meEVT_->Fill(ievt_);

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

   allEnergyEvent=0.;


  CastorRecHitCollection::const_iterator CASTORiter;

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

       for (CASTORiter=castorHits.begin(); CASTORiter!=castorHits.end(); ++CASTORiter) { 
        
         energy = CASTORiter->energy();    

        HcalCastorDetId CastorID(CASTORiter->detid().rawId());

        //const CaloSubdetectorGeometry* subdetectorGeometry=caloGeometry.getSubdetectorGeometry(CastorID) ; 
        //const CaloCellGeometry* cellGeometry =  subdetectorGeometry->getGeometry(CastorID) ;
        //X_pos = cellGeometry->getPosition().x() ; Y_pos = cellGeometry->getPosition().y() ; 
        //Z_pos = cellGeometry->getPosition().z() ;
       
        X_pos = caloGeometry.getSubdetectorGeometry(CastorID)->getGeometry(CastorID)->getPosition().x() ;
        Y_pos = caloGeometry.getSubdetectorGeometry(CastorID)->getGeometry(CastorID)->getPosition().y() ;
        Z_pos = caloGeometry.getSubdetectorGeometry(CastorID)->getGeometry(CastorID)->getPosition().z() ;
        
        if (energy>0){
         allEnergyEvent= allEnergyEvent+energy ;
         meCastor3Dhits->Fill(std::abs(Z_pos),X_pos,Y_pos, energy);
        }

        if(fVerbosity>0)  std::cout<<"ENERGY="<< energy <<" X_pos="<< X_pos <<" Y_pos="<< Y_pos <<" Z_pos="<< Z_pos << std::endl;   
      } //-- end of for loop


    if(fVerbosity>0)  std::cout<<"TOTAL ENERGY in an event="<< allEnergyEvent << std::endl;



    if (allEnergyEvent > maxEnergyEvent) { 
     maxEnergyEvent = allEnergyEvent;
     meCastor3DhitsMaxEnergy->Reset();
     if(fVerbosity>0) std::cout<<"LARGEST ENERGY in an event="<< maxEnergyEvent << std::endl;
 
     for (CASTORiter=castorHits.begin(); CASTORiter!=castorHits.end(); ++CASTORiter){
       HcalCastorDetId CastorID_maxE(CASTORiter->detid().rawId());
       X_pos_maxE = caloGeometry.getSubdetectorGeometry(CastorID_maxE)->getGeometry(CastorID_maxE)->getPosition().x() ;
       Y_pos_maxE = caloGeometry.getSubdetectorGeometry(CastorID_maxE)->getGeometry(CastorID_maxE)->getPosition().y() ;
       Z_pos_maxE = caloGeometry.getSubdetectorGeometry(CastorID_maxE)->getGeometry(CastorID_maxE)->getPosition().z() ;
       meCastor3DhitsMaxEnergy->Fill(std::abs(Z_pos_maxE),X_pos_maxE,Y_pos_maxE, CASTORiter->energy() );
      }
     meCastor3DhitsMaxEnergy->getTH3F()->SetOption("BOX");
     meCastor3DhitsMaxEnergy->update();
    }
  } 

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


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

Definition at line 26 of file CastorEventDisplay.cc.

Referenced by CastorMonitorModule::reset().

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

Reimplemented from CastorBaseMonitor.

Definition at line 34 of file CastorEventDisplay.cc.

References allEnergyEvent, CastorBaseMonitor::baseFolder_, DQMStore::book3D(), DQMStore::bookInt(), gather_cfg::cout, CastorBaseMonitor::fVerbosity, MonitorElement::getTH3F(), edm::ParameterSet::getUntrackedParameter(), ievt_, CastorBaseMonitor::m_dbe, maxEnergyEvent, meCastor3Dhits, meCastor3DhitsMaxEnergy, meEVT_, NULL, offline_, CastorBaseMonitor::rootFolder_, DQMStore::setCurrentFolder(), X_pos, X_pos_maxE, Y_pos, Y_pos_maxE, Z_pos, and Z_pos_maxE.

Referenced by CastorMonitorModule::CastorMonitorModule().

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

  offline_             = ps.getUntrackedParameter<bool>("OfflineMode", false); 

  if(fVerbosity>0) std::cout << "CastorEventDisplay::setup (start)" << std::endl;
  
  ievt_=0;  allEnergyEvent=0.; maxEnergyEvent=0.;
  X_pos=0.; Y_pos=0.; Z_pos=0.;
  X_pos_maxE=0.; Y_pos_maxE=0.; Z_pos_maxE=0.;

  if ( m_dbe !=NULL ) {    
  m_dbe->setCurrentFolder(baseFolder_);

  meEVT_ = m_dbe->bookInt("EventDisplay Event Number"); // meEVT_->Fill(ievt_);
  
  meCastor3Dhits = m_dbe->book3D("CASTOR 3D hits- cumulative", "CASTOR 3D hits - cumulative", 30, 1420, 1600, 35, -35, 35, 35, -35, 35);


  if( offline_ ){
  //-- swap z and y axis 
  TH3F* Castor3Dhits = meCastor3Dhits->getTH3F();
  Castor3Dhits->GetXaxis()->SetTitle("Z [cm]"); //-- also swap x and z
  Castor3Dhits->GetYaxis()->SetTitle("X [cm]");
  Castor3Dhits->GetZaxis()->SetTitle("Y [cm]");
  }

  meCastor3DhitsMaxEnergy = m_dbe->book3D("CASTOR 3D hits- event with the largest deposited E", "CASTOR 3D hits- event with the largest deposited E",  30, 1420, 1600, 20, -30, 30, 20, -30, 30); //-- swap z and y axis

  if( offline_ ){
  TH3F* Castor3DhitsMaxEnergy = meCastor3DhitsMaxEnergy->getTH3F();
  Castor3DhitsMaxEnergy->GetXaxis()->SetTitle("Z [cm]"); //-- also swap x and z
  Castor3DhitsMaxEnergy->GetYaxis()->SetTitle("X [cm]");
  Castor3DhitsMaxEnergy->GetZaxis()->SetTitle("Y [cm]");
  Castor3DhitsMaxEnergy->SetDrawOption("LEGO2");
  }

 } 

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

  if(fVerbosity>0) std::cout << "CastorEventDisplay::setup (end)" << std::endl;
  
  return;
}

Member Data Documentation

Definition at line 44 of file CastorEventDisplay.h.

Referenced by processEvent(), and setup().

float CastorEventDisplay::energy [private]

Definition at line 43 of file CastorEventDisplay.h.

Referenced by processEvent().

Definition at line 34 of file CastorEventDisplay.h.

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

Definition at line 45 of file CastorEventDisplay.h.

Referenced by processEvent(), and setup().

Definition at line 48 of file CastorEventDisplay.h.

Referenced by processEvent(), and setup().

Definition at line 49 of file CastorEventDisplay.h.

Referenced by processEvent(), and setup().

Definition at line 50 of file CastorEventDisplay.h.

Referenced by processEvent(), and setup().

Definition at line 42 of file CastorEventDisplay.h.

Referenced by setup().

double CastorEventDisplay::X_pos [private]

Definition at line 35 of file CastorEventDisplay.h.

Referenced by processEvent(), and setup().

Definition at line 38 of file CastorEventDisplay.h.

Referenced by processEvent(), and setup().

double CastorEventDisplay::Y_pos [private]

Definition at line 36 of file CastorEventDisplay.h.

Referenced by processEvent(), and setup().

Definition at line 39 of file CastorEventDisplay.h.

Referenced by processEvent(), and setup().

double CastorEventDisplay::Z_pos [private]

Definition at line 37 of file CastorEventDisplay.h.

Referenced by processEvent(), and setup().

Definition at line 40 of file CastorEventDisplay.h.

Referenced by processEvent(), and setup().