CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

CastorMonitorModule Class Reference

#include <CastorMonitorModule.h>

Inheritance diagram for CastorMonitorModule:
edm::EDAnalyzer

List of all members.

Public Member Functions

 CastorMonitorModule (const edm::ParameterSet &ps)
 ~CastorMonitorModule ()

Protected Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &eventSetup)
void beginJob ()
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &eventSetup)
void beginRun (const edm::Run &iRun, const edm::EventSetup &eventSetup)
void CheckCastorStatus (const FEDRawDataCollection &rawraw, const HcalUnpackerReport &report, const CastorElectronicsMap &emap, const CastorDigiCollection &castordigi)
void endJob (void)
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &eventSetup)
void endRun (const edm::Run &run, const edm::EventSetup &eventSetup)
bool prescale ()
void reset (void)

Private Attributes

bool actonLS_
MonitorElementCastorEventProduct
const CastorElectronicsMapCastorReadoutMap_
CastorChannelQualitychanquality_
bool checkCASTOR_
edm::ESHandle< CastorDbServiceconditions_
edm::CPUTimer cpu_timer
CastorChannelQualityMonitorCQMon_
CastorDataIntegrityMonitorDataIntMon_
DQMStoredbe_
edm::ESHandle< CastorPedestalsdbPedestals
std::map< uint32_t,
std::vector< HcalCastorDetId > > 
DCCtoCell
CastorDigiMonitorDigiMon_
bool digiOK_
bool dump2database_
CastorEventDisplayEDMon_
bool EDMonOn_
CastorMonitorSelectorevtSel_
bool fedsListed_
float fPedestalNSigmaAverage [14][16]
int fVerbosity
CastorHIMonitorHIMon_
std::map< std::pair< int, int >
, std::vector< HcalCastorDetId > > 
HTRtoCell
int ibunch_
int ievent_
int ievt_
int ievt_pre_
int ilumisec_
edm::InputTag inputLabelBasicJetCASTOR_
edm::InputTag inputLabelCastorBasicJets_
edm::InputTag inputLabelCastorJetIDs_
edm::InputTag inputLabelCastorTowers_
edm::InputTag inputLabelDigi_
edm::InputTag inputLabelJetIdCASTOR_
edm::InputTag inputLabelRaw_
edm::InputTag inputLabelRecHitCASTOR_
edm::InputTag inputLabelReport_
edm::InputTag inputLabelTowerCASTOR_
int irun_
int itime_
bool jetIdOK_
bool jetOK_
CastorLEDMonitorLedMon_
std::vector< HcalGenericDetIdlistEMap
ofstream m_logFile
MonitorElementmeCASTOR_
MonitorElementmeEVT_
MonitorElementmeEvtMask_
MonitorElementmeFEDS_
MonitorElementmeLatency_
MonitorElementmeQuality_
MonitorElementmeRunType_
MonitorElementmeStatus_
MonitorElementmeTrigger_
std::string monitorName_
std::map< HcalCastorDetId,
unsigned int > 
myquality_
int nDigi
int nevt_
int nJet
int nJetId
int nlumisecs_
int nRaw
int nRechit
int nTower
int prescaleEvt_
int prescaleLS_
int prescaleTime_
int prescaleUpdate_
CastorPSMonitorPSMon_
struct {
   double   elapsedTime
   timeval   startTV
   double   updateTime
   timeval   updateTV
   double   vetoTime
psTime_
bool rawOK_
CastorRecHitMonitorRecHitMon_
bool rechitOK_
bool reportOK_
std::string rootFolder_
bool saved_
bool showTiming_
std::map< uint32_t,
std::vector< HcalCastorDetId >
>::iterator 
thisDCC
std::map< std::pair< int, int >
, std::vector< HcalCastorDetId >
>::iterator 
thisHTR
CastorTowerJetMonitorTowerJetMon_
bool towerOK_

Detailed Description

Definition at line 78 of file CastorMonitorModule.h.


Constructor & Destructor Documentation

CastorMonitorModule::CastorMonitorModule ( const edm::ParameterSet ps)

Definition at line 20 of file CastorMonitorModule.cc.

References actonLS_, gather_cfg::cout, CQMon_, dbe_, DigiMon_, dump2database_, EDMon_, EDMonOn_, evtSel_, fedsListed_, fVerbosity, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HIMon_, ibunch_, ievent_, ilumisec_, inputLabelDigi_, inputLabelRaw_, inputLabelRecHitCASTOR_, irun_, itime_, LedMon_, meEvtMask_, meFEDS_, meQuality_, meRunType_, meStatus_, NULL, cppFunctionSkipper::operator, prescaleEvt_, prescaleLS_, prescaleTime_, prescaleUpdate_, PSMon_, psTime_, RecHitMon_, rootFolder_, DQMStore::setCurrentFolder(), CastorChannelQualityMonitor::setup(), CastorEventDisplay::setup(), CastorHIMonitor::setup(), CastorRecHitMonitor::setup(), CastorDigiMonitor::setup(), CastorPSMonitor::setup(), and showTiming_.

                                                                 {



 
  inputLabelRaw_ = ps.getParameter<edm::InputTag>("rawLabel");
  inputLabelDigi_        = ps.getParameter<edm::InputTag>("digiLabel");
  inputLabelRecHitCASTOR_  = ps.getParameter<edm::InputTag>("CastorRecHitLabel"); 
  fVerbosity = ps.getUntrackedParameter<int>("debug", 0);                        //-- show debug 
  showTiming_ = ps.getUntrackedParameter<bool>("showTiming", false);         //-- show CPU time 
  dump2database_   = ps.getUntrackedParameter<bool>("dump2database",false);  //-- dumps output to database file
  EDMonOn_=  ps.getUntrackedParameter<bool>("EDMonitor", false);

 if(fVerbosity>0) std::cout << "CastorMonitorModule Constructor (start)" << std::endl;

  irun_=0; 
  ilumisec_=0; 
  ievent_=0; 
  itime_=0;
  ibunch_=0;
  actonLS_=false;

  meStatus_=0;  meRunType_=0;
  meEvtMask_=0; meFEDS_=0;
  // meLatency_=0;  // PK: eliminate - proposed change from reproducibility tests; is it needed?  
  meQuality_=0;
  fedsListed_ = false;

  RecHitMon_ = NULL; 
  DigiMon_ = NULL; 
  LedMon_ = NULL;    
  PSMon_ = NULL;    
  CQMon_ = NULL;
  EDMon_ = NULL;  
  HIMon_ = NULL; 

  dbe_ = edm::Service<DQMStore>().operator->();

  evtSel_ = new CastorMonitorSelector(ps);

 
 //---------------------- DigiMonitor ----------------------// 
  if ( ps.getUntrackedParameter<bool>("DigiMonitor", false) ) {
    if(fVerbosity>0) std::cout << "CastorMonitorModule: Digi monitor flag is on...." << std::endl;
    DigiMon_ = new CastorDigiMonitor();
    DigiMon_->setup(ps, dbe_);
  }
 //------------------------------------------------------------//

  if ( ps.getUntrackedParameter<bool>("RecHitMonitor", false) ) {
    if(fVerbosity>0) std::cout << "CastorMonitorModule: RecHit monitor flag is on...." << std::endl;
    RecHitMon_ = new CastorRecHitMonitor();
    RecHitMon_->setup(ps, dbe_);
  }
 //-------------------------------------------------------------//
 

  if ( ps.getUntrackedParameter<bool>("HIMonitor", false) ) {
    if(fVerbosity>0) std::cout << "CastorMonitorModule: HI monitor flag is on...." << std::endl;
    HIMon_ = new CastorHIMonitor();
    HIMon_->setup(ps, dbe_);
  }
 //-------------------------------------------------------------//

  if ( ps.getUntrackedParameter<bool>("ChannelQualityMonitor", false) ) {
    if(fVerbosity>0) std::cout << "CastorChannelQualityMonitor: CQ monitor flag is on...." << std::endl;
    CQMon_ = new CastorChannelQualityMonitor();
    CQMon_->setup(ps, dbe_);
  }
 //-------------------------------------------------------------//
  /* // take it away for the time being 
  if ( ps.getUntrackedParameter<bool>("LEDMonitor", false) ) {
    if(fVerbosity>0) std::cout << "CastorMonitorModule: LED monitor flag is on...." << std::endl;
    LedMon_ = new CastorLEDMonitor();
    LedMon_->setup(ps, dbe_);
  }
 //-------------------------------------------------------------//
 */
 //---------------------- PSMonitor ----------------------// 
  if ( ps.getUntrackedParameter<bool>("PSMonitor", false) ) {
    if(fVerbosity>0) std::cout << "CastorMonitorModule: PS monitor flag is on...." << std::endl;
    PSMon_ = new CastorPSMonitor();
    PSMon_->setup(ps, dbe_);
  }
 //------------------------------------------------------------//

 //---------------------- EDMonitor ----------------------// 
  if ( ps.getUntrackedParameter<bool>("EDMonitor", false) ) {
    if(fVerbosity>0) std::cout << "CastorMonitorModule: ED monitor flag is on...." << std::endl;
    EDMon_ = new CastorEventDisplay();
    EDMon_->setup(ps, dbe_);
  }
 //------------------------------------------------------------//





  
  prescaleEvt_ = ps.getUntrackedParameter<int>("diagnosticPrescaleEvt", -1);
  if(fVerbosity>0) std::cout << "===>CastorMonitor event prescale = " << prescaleEvt_ << " event(s)"<< std::endl;

  prescaleLS_ = ps.getUntrackedParameter<int>("diagnosticPrescaleLS", -1);
  if(fVerbosity>0) std::cout << "===>CastorMonitor lumi section prescale = " << prescaleLS_ << " lumi section(s)"<< std::endl;
  if (prescaleLS_>0) actonLS_=true;

  prescaleUpdate_ = ps.getUntrackedParameter<int>("diagnosticPrescaleUpdate", -1);
  if(fVerbosity>0) std::cout << "===>CastorMonitor update prescale = " << prescaleUpdate_ << " update(s)"<< std::endl;

  prescaleTime_ = ps.getUntrackedParameter<int>("diagnosticPrescaleTime", -1);
  if(fVerbosity>1) std::cout << "===>CastorMonitor time prescale = " << prescaleTime_ << " minute(s)"<< std::endl;

  std::string subsystemname = ps.getUntrackedParameter<std::string>("subSystemFolder", "Castor") ;
  if(fVerbosity>0) std::cout << "===>CastorMonitor name = " << subsystemname << std::endl;
  rootFolder_ = subsystemname + "/";
  
 if ( dbe_ != NULL ){
  dbe_->setCurrentFolder(rootFolder_);
  }


  gettimeofday(&psTime_.updateTV,NULL);
  psTime_.updateTime = (psTime_.updateTV.tv_sec*1000.0+psTime_.updateTV.tv_usec/1000.0);
  psTime_.updateTime /= 1000.0;
  psTime_.elapsedTime=0;
  psTime_.vetoTime=psTime_.updateTime;

 if(fVerbosity>0) std::cout << "CastorMonitorModule Constructor (end)" << std::endl;

}
CastorMonitorModule::~CastorMonitorModule ( )

Definition at line 167 of file CastorMonitorModule.cc.

                                         {
  
// if (dbe_){    
//   if(DigiMon_!=NULL)     {  DigiMon_->clearME();}
//   if(RecHitMon_!=NULL)  {  RecHitMon_->clearME();}
//   if(LedMon_!=NULL)     {  LedMon_->clearME();}
//   if(PSMon_!=NULL)     {  LedMon_->clearME();}
//   if(HIMon_!=NULL)     {  HIMon_->clearME();}
//   dbe_->setCurrentFolder(rootFolder_);
//   dbe_->removeContents();
// }
//
//  if(DigiMon_!=NULL)    { delete DigiMon_;   DigiMon_=NULL;     }
//  if(RecHitMon_!=NULL) { delete RecHitMon_; RecHitMon_=NULL; }
//  if(HIMon_!=NULL) { delete HIMon_; HIMon_=NULL; }
//  if(LedMon_!=NULL)    { delete LedMon_;   LedMon_=NULL;     }
//  delete evtSel_; evtSel_ = NULL;

} 

Member Function Documentation

void CastorMonitorModule::analyze ( const edm::Event iEvent,
const edm::EventSetup eventSetup 
) [protected, virtual]

Implements edm::EDAnalyzer.

Definition at line 357 of file CastorMonitorModule.cc.

References edm::EventBase::bunchCrossing(), CastorEventProduct, conditions_, gather_cfg::cout, cpu_timer, edm::CPUTimer::cpuTime(), CQMon_, dbe_, DigiMon_, digiOK_, DO_CASTOR_PED_CALIBMON, DO_CASTOR_RECHITMON, EDMon_, EDMonOn_, edm::EventID::event(), MonitorElement::Fill(), fPedestalNSigmaAverage, fVerbosity, edm::EventSetup::get(), edm::Event::getByLabel(), MonitorElement::getTH2F(), HIMon_, ibunch_, edm::EventBase::id(), ievent_, ievt_, ievt_pre_, ilumisec_, inputLabelDigi_, inputLabelRecHitCASTOR_, irun_, itime_, listEMap, edm::EventBase::luminosityBlock(), meEVT_, meEvtMask_, meStatus_, nevt_, NULL, prescale(), CastorPSMonitor::processEvent(), CastorHIMonitor::processEvent(), CastorRecHitMonitor::processEvent(), CastorDigiMonitor::processEvent(), CastorEventDisplay::processEvent(), CastorChannelQualityMonitor::processEvent(), PSMon_, rawOK_, RecHitMon_, rechitOK_, edm::CPUTimer::reset(), edm::EventID::run(), showTiming_, edm::CPUTimer::start(), edm::CPUTimer::stop(), edm::EventBase::time(), and edm::Timestamp::value().

                                                                                        {

  using namespace edm;


  irun_     = iEvent.id().run();
  ilumisec_ = iEvent.luminosityBlock();
  ievent_   = iEvent.id().event();
  itime_    = iEvent.time().value();
  ibunch_   = iEvent.bunchCrossing();


  if (fVerbosity>0) { 
  std::cout << "==> CastorMonitorModule: evts: "<< nevt_ << ", run: " << irun_ << ", LS: " << ilumisec_ << std::endl;
  std::cout << " evt: " << ievent_ << ", time: " << itime_  <<"\t counter = "<< ievt_pre_<< "\t total count = "<<ievt_<<std::endl; 
  }

  ievt_++;

  ievt_pre_++; // need to increment counter before calling prescale
  if(prescale()) return;


  //  meLatency_->Fill(psTime_.elapsedTime);
 

  int evtMask=DO_CASTOR_RECHITMON|DO_CASTOR_PED_CALIBMON; 
 // add in DO_HCAL_TPMON, DO_HCAL_CTMON ?(in CastorMonitorSelector.h)
  /* FIX
  //  int trigMask=0;
  if(mtccMon_==NULL){
    evtSel_->processEvent(e);
    evtMask = evtSel_->getEventMask();
    //    trigMask =  evtSel_->getTriggerMask();
  }
  */
  if ( dbe_ ){ 
    meStatus_->Fill(1);
    meEvtMask_->Fill(evtMask);
  }
  
  bool rawOK_    = true;
  bool digiOK_   = true;
  bool rechitOK_ = true;

  //-- TAKE IT AWAY for the time being
  //edm::Handle<FEDRawDataCollection> RawData;  
  //iEvent.getByLabel(inputLabelRaw_,RawData);
  //if (!RawData.isValid()) {
  //  rawOK_=false;
  //}

  /*
  edm::Handle<HcalUnpackerReport> report; 
  iEvent.getByType(report);  
  if (!report.isValid()) {
    rawOK_=false;
  }
  else 
    {
      if(!fedsListed_){
        const std::vector<int> feds =  (*report).getFedsUnpacked();    
        for(unsigned int f=0; f<feds.size(); f++){
          meFEDS_->Fill(feds[f]);    
        }
        fedsListed_ = true;
      }
    }
  */
  //---------------------------------------------------------------//
  //-------------------  try to get digis ------------------------//
  //---------------------------------------------------------------//

  edm::Handle<CastorDigiCollection> CastorDigi;
  iEvent.getByLabel(inputLabelDigi_,CastorDigi);
  if (!CastorDigi.isValid()) {
    digiOK_=false;
  }
  

  
  //if ( checkCASTOR_ )
  //  CheckCastorStatus(*RawData,*report,*readoutMap_,*CastorDigi);
  

  //---------------------------------------------------------------//
  //------------------- try to get RecHits ------------------------//
  //---------------------------------------------------------------//
  edm::Handle<CastorRecHitCollection> CastorHits;
  iEvent.getByLabel(inputLabelRecHitCASTOR_,CastorHits);
  if (!CastorHits.isValid()) {
    rechitOK_ = false;
  }


 if(ievt_%10 == 0) {

  TH2F* hCastorEventProduct=CastorEventProduct->getTH2F();
  hCastorEventProduct->SetBinContent(1,1,int(rawOK_));
  hCastorEventProduct->SetBinContent(2,1,int(digiOK_));
  hCastorEventProduct->SetBinContent(3,1,int(rechitOK_));

   if(fVerbosity>0) {
   std::cout << "    RAW Data   ==> " << rawOK_<< std::endl;
   std::cout << "    Digis      ==> " << digiOK_<< std::endl;
   std::cout << "    RecHits    ==> " << rechitOK_<< std::endl;
   }
 
 }

  //------------------------------------------------------------//
  //---------------- Run the configured tasks ------------------//
  //-------------- protect against missing products -----------//
  //-----------------------------------------------------------//

 if (showTiming_){
      cpu_timer.reset(); cpu_timer.start();
  }

  //----------------- Digi monitor task ------------------//
  // if((DigiMon_!=NULL) && (evtMask&DO_CASTOR_PED_CALIBMON) && digiOK_) 
  if(digiOK_) DigiMon_->processEvent(*CastorDigi,*conditions_);
  if (showTiming_){
      cpu_timer.stop();
      if (DigiMon_!=NULL) std::cout <<"TIMER:: DIGI MONITOR ->"<<cpu_timer.cpuTime()<<std::endl;
      cpu_timer.reset(); cpu_timer.start();
    }


 //----------------- Rec Hit monitor task -------------------------//
  //  if((RecHitMon_ != NULL) && (evtMask&DO_CASTOR_RECHITMON) && rechitOK_) 
 if(rechitOK_) RecHitMon_->processEvent(*CastorHits);
 if (showTiming_){
      cpu_timer.stop();
      if (RecHitMon_!=NULL) std::cout <<"TIMER:: RECHIT MONITOR ->"<<cpu_timer.cpuTime()<<std::endl;
      cpu_timer.reset(); cpu_timer.start();
    }
 
   //----------------- Channel Quality Monitor task -------------------------//
 if(rechitOK_) CQMon_->processEvent(*CastorHits);
 if (showTiming_){
      cpu_timer.stop();
      if (CQMon_!=NULL) std::cout <<"TIMER:: CHANNELQUALITY MONITOR ->"<<cpu_timer.cpuTime()<<std::endl;
      cpu_timer.reset(); cpu_timer.start();
    }
 
 /*
  //---------------- LED monitor task ------------------------//
  //  if((LedMon_!=NULL) && (evtMask&DO_HCAL_LED_CALIBMON) && digiOK_)
  if(digiOK_) LedMon_->processEvent(*CastorDigi,*conditions_);
   if (showTiming_){
       cpu_timer.stop();
       if (LedMon_!=NULL) std::cout <<"TIMER:: LED MONITOR ->"<<cpu_timer.cpuTime()<<std::endl;
       cpu_timer.reset(); cpu_timer.start();
     }
 */
 //---------------- Pulse Shape monitor task ------------------------//
 
  edm::ESHandle<CastorElectronicsMap> refEMap;
  eventSetup.get<CastorElectronicsMapRcd>().get(refEMap);
  const CastorElectronicsMap* myRefEMap = refEMap.product();
  listEMap = myRefEMap->allPrecisionId();
  if(digiOK_) PSMon_->processEvent(*CastorDigi,*conditions_, listEMap, ibunch_, fPedestalNSigmaAverage);  
  if (showTiming_) {
      cpu_timer.stop();
      if (PSMon_!=NULL) std::cout <<"TIMER:: PULSE SHAPE  ->"<<cpu_timer.cpuTime()<<std::endl;
      cpu_timer.reset(); cpu_timer.start();
    }


  //---------------- EventDisplay monitor task ------------------------//
  edm::ESHandle<CaloGeometry> caloGeometry;
  eventSetup.get<CaloGeometryRecord>().get(caloGeometry);
  
 if(rechitOK_ && EDMonOn_) EDMon_->processEvent(*CastorHits, *caloGeometry);
 if (showTiming_){
      cpu_timer.stop();
      if (EDMon_!=NULL) std::cout <<"TIMER:: EVENTDISPLAY MONITOR ->"<<cpu_timer.cpuTime()<<std::endl;
      cpu_timer.reset(); cpu_timer.start();
    }   

//----------------- Heavy Ion monitor task -------------------------//
 if(rechitOK_ && digiOK_ ) HIMon_->processEvent(*CastorHits, *CastorDigi, *conditions_);
 if (showTiming_){
      cpu_timer.stop();
      if (HIMon_!=NULL) std::cout <<"TIMER:: HI MONITOR ->"<<cpu_timer.cpuTime()<<std::endl;
      cpu_timer.reset(); cpu_timer.start();
    }


  if(fVerbosity>0 && ievt_%100 == 0)
    std::cout << "CastorMonitorModule: processed " << ievt_ << " events" << std::endl;
  

  meEVT_->Fill(ievt_);



  return;
}
void CastorMonitorModule::beginJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 191 of file CastorMonitorModule.cc.

References DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookInt(), CastorEventProduct, gather_cfg::cout, dbe_, MonitorElement::Fill(), fVerbosity, MonitorElement::getTH2F(), ievt_, ievt_pre_, meCASTOR_, meEVT_, meEvtMask_, meFEDS_, meQuality_, meRunType_, meStatus_, NULL, rootFolder_, and DQMStore::setCurrentFolder().

                                  {
  ievt_ = 0;
  ievt_pre_=0;

  if(fVerbosity>0) std::cout << "CastorMonitorModule::beginJob (start)" << std::endl;

  if ( dbe_ != NULL ){
  

    dbe_->setCurrentFolder(rootFolder_+"CastorEventProducts");
    meEVT_ = dbe_->bookInt("Event Number"); 
    CastorEventProduct =dbe_->book2D("CastorEventProduct","CastorEventProduct",3,0,3,1,0,1);
    TH2F* hCastorEventProduct =CastorEventProduct->getTH2F();
    hCastorEventProduct->GetXaxis()->SetBinLabel(1,"RawData");
    hCastorEventProduct->GetXaxis()->SetBinLabel(2,"CastorDigi");
    hCastorEventProduct->GetXaxis()->SetBinLabel(3,"CastorRecHits");
    hCastorEventProduct->GetYaxis()->SetBinLabel(1,"Status");
    hCastorEventProduct->SetBinContent(1,1,-1);
    hCastorEventProduct->SetBinContent(2,1,-1);
    hCastorEventProduct->SetBinContent(3,1,-1);
    hCastorEventProduct->SetOption("textcolz");


    dbe_->setCurrentFolder(rootFolder_+"DQM Job Status" );
    meStatus_  = dbe_->bookInt("STATUS");
    meRunType_ = dbe_->bookInt("RUN TYPE");
    meEvtMask_ = dbe_->bookInt("EVT MASK");
    meFEDS_    = dbe_->book1D("FEDs Unpacked","FEDs Unpacked",100,660,759);
    meCASTOR_ = dbe_->bookInt("CASTORpresent");
    //   meLatency_ = dbe_->book1D("Process Latency","Process Latency",2000,0,10); // PK: eliminate
    meQuality_ = dbe_->book1D("Quality Status","Quality Status",100,0,1);
    meStatus_->Fill(0);
    meRunType_->Fill(-1);
    meEvtMask_->Fill(-1);
    meCASTOR_->Fill(0); 
    }
  else{
    if(fVerbosity>0) std::cout << "CastorMonitorModule::beginJob - NO DQMStore service" << std::endl; 
  }
 
 if(fVerbosity>0) std::cout << "CastorMonitorModule::beginJob (end)" << std::endl;

  return;
} 
void CastorMonitorModule::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup eventSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 283 of file CastorMonitorModule.cc.

References actonLS_, and prescale().

                                                                             {
  
  if(actonLS_ && !prescale()){
  }
}
void CastorMonitorModule::beginRun ( const edm::Run iRun,
const edm::EventSetup eventSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 243 of file CastorMonitorModule.cc.

References conditions_, gather_cfg::cout, dbPedestals, fedsListed_, fPedestalNSigmaAverage, fVerbosity, edm::EventSetup::get(), CastorPedestal::getWidth(), edm::ESHandleBase::isValid(), HcalCastorDetId::module(), reset(), HcalCastorDetId::sector(), and mathSSE::sqrt().

                                                                                  {

  fedsListed_ = false;
  reset();

  iSetup.get<CastorDbRecord>().get(conditions_);
  
  iSetup.get<CastorPedestalsRcd>().get(dbPedestals);
  if(!dbPedestals.isValid() && fVerbosity>0)    std::cout << "CASTOR  has no CastorPedestals in the CondDB !!!" << std::endl;
 
  float        sigma_averaged;
  unsigned int iChannel  = 0;
  std::vector<DetId> channels = dbPedestals->getAllChannels();
  
  for (std::vector<DetId>::iterator ch=channels.begin(); ch!=channels.end(); ch++) {
    const CastorPedestal * pedestals_mean  = dbPedestals->getValues(*ch);
    sigma_averaged = 0.;

    for (short unsigned int iCapId = 0; iCapId < 4; iCapId++){
      sigma_averaged += sqrt(pedestals_mean->getWidth(iCapId));
    };

    fPedestalNSigmaAverage[HcalCastorDetId(*ch).module()-1][HcalCastorDetId(*ch).sector()-1] = sigma_averaged/4;
    iChannel++;
  };

  if(iChannel<224 && fVerbosity>0)  std::cout << "There are less that 224 channels in CastorPedestalsRcd record !!!" << std::endl;

  return;
}
void CastorMonitorModule::CheckCastorStatus ( const FEDRawDataCollection rawraw,
const HcalUnpackerReport report,
const CastorElectronicsMap emap,
const CastorDigiCollection castordigi 
) [protected]

Definition at line 632 of file CastorMonitorModule.cc.

{
  
  //vector<int> fedUnpackList;
  // for (int i=FEDNumbering::getHcalFEDIds().first; i<=FEDNumbering::getHcalFEDIds().second; i++) 
  //   {
  //     fedUnpackList.push_back(i);
  //   }
  // for (std::vector<int>::const_iterator i=fedUnpackList.begin(); i!=fedUnpackList.end();++i) 
  //   {
  //     const FEDRawData& fed = RawData.FEDData(*i);
  //     if (fed.size()<12) continue; //-- Was 16 !      
  //     const HcalDCCHeader* dccHeader=(const HcalDCCHeader*)(fed.data());
  //    if (!dccHeader) return;
  //    int dccid=dccHeader->getSourceId();
    
  //     ////---- Castor FED numbering of DCCs= [690 -693]  
  //    if (dccid >= 690 && dccid <=693){
  //    if ( CastorDigi.size()>0){
  //      meCASTOR_->Fill(1); 
  //     }
  //    else {meCASTOR_->Fill(0);  }  
  //     }
  //    else{ meCASTOR_->Fill(-1); }
  //  }
  return;
}
void CastorMonitorModule::endJob ( void  ) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 316 of file CastorMonitorModule.cc.

References CQMon_, DigiMon_, CastorBaseMonitor::done(), CastorDigiMonitor::done(), CastorLEDMonitor::done(), EDMon_, HIMon_, LedMon_, NULL, PSMon_, and RecHitMon_.

                                     {
 
  //if ( meStatus_ ) meStatus_->Fill(2);
 
  if(RecHitMon_!=NULL) RecHitMon_->done();
  if(DigiMon_!=NULL) DigiMon_->done();
  if(LedMon_!=NULL) LedMon_->done();
  if(CQMon_!=NULL) CQMon_->done();
  if(PSMon_!=NULL) PSMon_->done();
  if(EDMon_!=NULL) EDMon_->done();
  if(HIMon_!=NULL) RecHitMon_->done();

  /* LEAVE IT OUT FOR THE MOMENT
  // TO DUMP THE OUTPUT TO DATABASE FILE
  if (dump2database_){
    
    } 
  */
  return;
}
void CastorMonitorModule::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup eventSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 295 of file CastorMonitorModule.cc.

References actonLS_, and prescale().

                                                                           {
  if(actonLS_ && !prescale()){
  }
}
void CastorMonitorModule::endRun ( const edm::Run run,
const edm::EventSetup eventSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 305 of file CastorMonitorModule.cc.

References gather_cfg::cout, DigiMon_, fVerbosity, and NULL.

{
  if (fVerbosity>0)  std::cout <<"CastorMonitorModule::endRun(...) "<<std::endl;
  if (DigiMon_!=NULL) //************ DigiMon_->fillPedestalHistos(); //FIX
  return;
}
bool CastorMonitorModule::prescale ( ) [protected]

in seconds

Definition at line 578 of file CastorMonitorModule.cc.

References gather_cfg::cout, fVerbosity, ievent_, ievt_pre_, ilumisec_, NULL, prescaleEvt_, prescaleLS_, prescaleTime_, prescaleUpdate_, psTime_, and cond::rpcobgas::time.

Referenced by analyze(), beginLuminosityBlock(), and endLuminosityBlock().

{
  if (fVerbosity>0) std::cout <<"CastorMonitorModule::prescale"<<std::endl;
  
  gettimeofday(&psTime_.updateTV,NULL);
  double time = (psTime_.updateTV.tv_sec*1000.0+psTime_.updateTV.tv_usec/1000.0);
  time/= (1000.0); 
  psTime_.elapsedTime = time - psTime_.updateTime;
  psTime_.updateTime = time;
  bool evtPS =    prescaleEvt_>0;
  bool lsPS =     prescaleLS_>0;
  bool timePS =   prescaleTime_>0;
  bool updatePS = prescaleUpdate_>0;

  if(!evtPS && !lsPS && !timePS && !updatePS)
    {
      return false;
    }
  if(lsPS && (ilumisec_%prescaleLS_)!=0) lsPS = false; //-- LS veto
  //if(evtPS && (ievent_%prescaleEvt_)!=0) evtPS = false; //evt # veto
  if (evtPS && (ievt_pre_%prescaleEvt_)!=0) evtPS = false;
  if(timePS)
    {
      double elapsed = (psTime_.updateTime - psTime_.vetoTime)/60.0;
      if(elapsed<prescaleTime_){
        timePS = false;  //-- timestamp veto
        psTime_.vetoTime = psTime_.updateTime;
      }
    } 

  //  if(prescaleUpdate_>0 && (nupdates_%prescaleUpdate_)==0) updatePS=false; ///need to define what "updates" means
  
  if (fVerbosity>0) 
    {
      std::cout<<"CastorMonitorModule::prescale  evt: "<<ievent_<<"/"<<evtPS<<", ";
      std::cout <<"ls: "<<ilumisec_<<"/"<<lsPS<<",";
      std::cout <<"time: "<<psTime_.updateTime - psTime_.vetoTime<<"/"<<timePS<<std::endl;
    }  
  if(evtPS || lsPS || timePS) return false;
  return true;
} 
void CastorMonitorModule::reset ( void  ) [protected]

Member Data Documentation

Definition at line 228 of file CastorMonitorModule.h.

Referenced by analyze(), and beginJob().

Definition at line 246 of file CastorMonitorModule.h.

Definition at line 275 of file CastorMonitorModule.h.

Definition at line 262 of file CastorMonitorModule.h.

Definition at line 245 of file CastorMonitorModule.h.

Referenced by analyze(), and beginRun().

Definition at line 171 of file CastorMonitorModule.h.

Referenced by analyze().

Definition at line 234 of file CastorMonitorModule.h.

Referenced by analyze(), CastorMonitorModule(), endJob(), and reset().

Definition at line 240 of file CastorMonitorModule.h.

Definition at line 183 of file CastorMonitorModule.h.

Referenced by analyze(), beginJob(), and CastorMonitorModule().

Definition at line 249 of file CastorMonitorModule.h.

Referenced by beginRun().

std::map<uint32_t, std::vector<HcalCastorDetId> > CastorMonitorModule::DCCtoCell [private]

Definition at line 215 of file CastorMonitorModule.h.

Definition at line 235 of file CastorMonitorModule.h.

Referenced by analyze(), CastorMonitorModule(), endJob(), endRun(), and reset().

Definition at line 155 of file CastorMonitorModule.h.

Referenced by analyze().

Definition at line 273 of file CastorMonitorModule.h.

Referenced by CastorMonitorModule().

Definition at line 238 of file CastorMonitorModule.h.

Referenced by analyze(), CastorMonitorModule(), endJob(), and reset().

Definition at line 270 of file CastorMonitorModule.h.

Referenced by analyze(), and CastorMonitorModule().

Definition at line 176 of file CastorMonitorModule.h.

Definition at line 232 of file CastorMonitorModule.h.

Referenced by CastorMonitorModule().

Definition at line 192 of file CastorMonitorModule.h.

Referenced by beginRun(), and CastorMonitorModule().

Definition at line 254 of file CastorMonitorModule.h.

Referenced by analyze(), and beginRun().

Definition at line 239 of file CastorMonitorModule.h.

Referenced by analyze(), CastorMonitorModule(), endJob(), and reset().

std::map<std::pair <int,int> , std::vector<HcalCastorDetId> > CastorMonitorModule::HTRtoCell [private]

Definition at line 217 of file CastorMonitorModule.h.

Definition at line 186 of file CastorMonitorModule.h.

Referenced by analyze(), and CastorMonitorModule().

Definition at line 186 of file CastorMonitorModule.h.

Referenced by analyze(), CastorMonitorModule(), and prescale().

Definition at line 190 of file CastorMonitorModule.h.

Referenced by analyze(), and beginJob().

Definition at line 191 of file CastorMonitorModule.h.

Referenced by analyze(), beginJob(), and prescale().

Definition at line 186 of file CastorMonitorModule.h.

Referenced by analyze(), CastorMonitorModule(), and prescale().

Definition at line 200 of file CastorMonitorModule.h.

Definition at line 203 of file CastorMonitorModule.h.

Definition at line 204 of file CastorMonitorModule.h.

Definition at line 202 of file CastorMonitorModule.h.

Definition at line 197 of file CastorMonitorModule.h.

Referenced by analyze(), and CastorMonitorModule().

Definition at line 201 of file CastorMonitorModule.h.

Definition at line 195 of file CastorMonitorModule.h.

Referenced by CastorMonitorModule().

Definition at line 198 of file CastorMonitorModule.h.

Referenced by analyze(), and CastorMonitorModule().

Definition at line 196 of file CastorMonitorModule.h.

Definition at line 199 of file CastorMonitorModule.h.

Definition at line 186 of file CastorMonitorModule.h.

Referenced by analyze(), and CastorMonitorModule().

Definition at line 186 of file CastorMonitorModule.h.

Referenced by analyze(), and CastorMonitorModule().

Definition at line 159 of file CastorMonitorModule.h.

Definition at line 158 of file CastorMonitorModule.h.

Definition at line 236 of file CastorMonitorModule.h.

Referenced by CastorMonitorModule(), endJob(), and reset().

Definition at line 256 of file CastorMonitorModule.h.

Referenced by analyze().

ofstream CastorMonitorModule::m_logFile [private]

Definition at line 259 of file CastorMonitorModule.h.

Definition at line 267 of file CastorMonitorModule.h.

Referenced by beginJob().

Definition at line 243 of file CastorMonitorModule.h.

Referenced by analyze(), and beginJob().

Definition at line 224 of file CastorMonitorModule.h.

Referenced by analyze(), beginJob(), and CastorMonitorModule().

Definition at line 221 of file CastorMonitorModule.h.

Referenced by beginJob(), and CastorMonitorModule().

Definition at line 226 of file CastorMonitorModule.h.

Definition at line 227 of file CastorMonitorModule.h.

Referenced by beginJob(), and CastorMonitorModule().

Definition at line 223 of file CastorMonitorModule.h.

Referenced by beginJob(), and CastorMonitorModule().

Definition at line 222 of file CastorMonitorModule.h.

Referenced by analyze(), beginJob(), and CastorMonitorModule().

Definition at line 225 of file CastorMonitorModule.h.

std::string CastorMonitorModule::monitorName_ [private]

Definition at line 142 of file CastorMonitorModule.h.

std::map<HcalCastorDetId, unsigned int> CastorMonitorModule::myquality_ [private]

Definition at line 274 of file CastorMonitorModule.h.

Definition at line 162 of file CastorMonitorModule.h.

Definition at line 148 of file CastorMonitorModule.h.

Referenced by analyze().

Definition at line 165 of file CastorMonitorModule.h.

Definition at line 166 of file CastorMonitorModule.h.

Definition at line 149 of file CastorMonitorModule.h.

Definition at line 161 of file CastorMonitorModule.h.

Definition at line 163 of file CastorMonitorModule.h.

Definition at line 164 of file CastorMonitorModule.h.

Definition at line 135 of file CastorMonitorModule.h.

Referenced by CastorMonitorModule(), and prescale().

Definition at line 136 of file CastorMonitorModule.h.

Referenced by CastorMonitorModule(), and prescale().

Definition at line 137 of file CastorMonitorModule.h.

Referenced by CastorMonitorModule(), and prescale().

Definition at line 138 of file CastorMonitorModule.h.

Referenced by CastorMonitorModule(), and prescale().

Definition at line 237 of file CastorMonitorModule.h.

Referenced by analyze(), CastorMonitorModule(), endJob(), and reset().

struct { ... } CastorMonitorModule::psTime_ [private]

Referenced by CastorMonitorModule(), and prescale().

Definition at line 153 of file CastorMonitorModule.h.

Referenced by analyze().

Definition at line 233 of file CastorMonitorModule.h.

Referenced by analyze(), CastorMonitorModule(), endJob(), and reset().

Definition at line 156 of file CastorMonitorModule.h.

Referenced by analyze().

Definition at line 154 of file CastorMonitorModule.h.

std::string CastorMonitorModule::rootFolder_ [private]

Definition at line 188 of file CastorMonitorModule.h.

Referenced by beginJob(), and CastorMonitorModule().

Definition at line 150 of file CastorMonitorModule.h.

Definition at line 170 of file CastorMonitorModule.h.

Referenced by analyze(), and CastorMonitorModule().

Definition at line 175 of file CastorMonitorModule.h.

std::map<uint32_t, std::vector<HcalCastorDetId> >::iterator CastorMonitorModule::thisDCC [private]

Definition at line 216 of file CastorMonitorModule.h.

std::map<std::pair <int,int> , std::vector<HcalCastorDetId> >::iterator CastorMonitorModule::thisHTR [private]

Definition at line 218 of file CastorMonitorModule.h.

Definition at line 241 of file CastorMonitorModule.h.

Definition at line 157 of file CastorMonitorModule.h.

Definition at line 178 of file CastorMonitorModule.h.

Definition at line 175 of file CastorMonitorModule.h.

Definition at line 177 of file CastorMonitorModule.h.