CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CastorDigiMonitor Class Reference

#include <CastorDigiMonitor.h>

Inheritance diagram for CastorDigiMonitor:
CastorBaseMonitor

List of all members.

Public Member Functions

 CastorDigiMonitor ()
void done ()
void processEvent (const CastorDigiCollection &cast, const CastorDbService &cond)
void reset ()
void setup (const edm::ParameterSet &ps, DQMStore *dbe)
 ~CastorDigiMonitor ()

Private Member Functions

void perChanHists (std::vector< HcalCastorDetId > detID, std::vector< int > capID, std::vector< float > peds, std::map< HcalCastorDetId, std::map< int, MonitorElement * > > &toolP, std::string baseFolder)

Private Attributes

std::vector< int > capID_
struct {
   MonitorElement *   ALLPEDS
   MonitorElement *   PEDESTAL_REFS
   MonitorElement *   PEDRMS
   std::map< HcalCastorDetId,
std::map< int, MonitorElement * > >   PEDVALS
   std::map< HcalCastorDetId,
std::map< int, MonitorElement * > >   SUBVALS
   MonitorElement *   WIDTH_REFS
castHists
const CastorQIECoderchannelCoder_
std::vector< HcalCastorDetIddetID_
bool doFCpeds_
bool doPerChannel_
int ievt_
MonitorElementmeEVT_
std::map< HcalCastorDetId,
std::map< int, MonitorElement * >
>::iterator 
meo_
std::string outputFile_
MonitorElementPEDESTAL_REFS
std::vector< float > pedVals_
std::map< HcalCastorDetId, bool > REG
const CastorQIEShapeshape_
MonitorElementWIDTH_REFS

Detailed Description

Definition at line 15 of file CastorDigiMonitor.h.


Constructor & Destructor Documentation

CastorDigiMonitor::CastorDigiMonitor ( )

Definition at line 16 of file CastorDigiMonitor.cc.

References doPerChannel_.

{ doPerChannel_ = false;  }
CastorDigiMonitor::~CastorDigiMonitor ( )

Definition at line 22 of file CastorDigiMonitor.cc.

                                      {
}

Member Function Documentation

void CastorDigiMonitor::done ( ) [virtual]

Reimplemented from CastorBaseMonitor.

Definition at line 188 of file CastorDigiMonitor.cc.

Referenced by CastorMonitorModule::endJob().

                            {
  return;
}
void CastorDigiMonitor::perChanHists ( std::vector< HcalCastorDetId detID,
std::vector< int >  capID,
std::vector< float >  peds,
std::map< HcalCastorDetId, std::map< int, MonitorElement * > > &  toolP,
std::string  baseFolder 
) [private]
Parameters:
baseFolder/// std::map<HcalCastorDetId, std::map<int, MonitorElement*> > &toolS,

Definition at line 197 of file CastorDigiMonitor.cc.

References DQMStore::book1D(), gather_cfg::cout, cond::rpcobgas::detid, MonitorElement::Fill(), CastorBaseMonitor::fVerbosity, i, CastorBaseMonitor::m_dbe, mergeVDriftHistosByStation::name, NULL, REG, and DQMStore::setCurrentFolder().

Referenced by processEvent().

 {
  
  if(m_dbe) m_dbe->setCurrentFolder(baseFolder);

  for(unsigned int d=0; d<detID.size(); d++){
    HcalCastorDetId detid = detID[d];
    int capid = capID[d];
    float pedVal = peds[d];
    bool gotit=false;
    if(REG[detid]) gotit=true;
    
    if(gotit){
      std::map<int, MonitorElement*> _mei = toolP[detid];
      if(_mei[capid]==NULL){
        if(fVerbosity>0) std::cout<<"CastorDigiMonitor::perChanHists  This histo is NULL!!??"<< std::endl;
      }
      else _mei[capid]->Fill(pedVal);
      
    }
    else{
      if(m_dbe){
        std::map<int,MonitorElement*> insertP; //-- Pedestal values in ADC
        
        for(int i=0; i<4; i++){
          char name[1024];
          sprintf(name,"Castor Digi Value (ADC) zside=%d module=%d sector=%d CAPID=%d",
                  detid.zside(),detid.module(),detid.sector(),i);      
          insertP[i] =  m_dbe->book1D(name,name,10,-0.5,9.5);
          
        }
        
        insertP[capid]->Fill(pedVal);
        toolP[detid] = insertP;
      }
      REG[detid] = true;
    }
  }
}
void CastorDigiMonitor::processEvent ( const CastorDigiCollection cast,
const CastorDbService cond 
)

Definition at line 90 of file CastorDigiMonitor.cc.

References HcalQIESample::adc(), CastorBaseMonitor::baseFolder_, edm::SortedCollection< T, SORT >::begin(), HcalQIESample::capid(), capID_, castHists, gather_cfg::cout, CastorBaseMonitor::cpu_timer, edm::CPUTimer::cpuTime(), detID_, doFCpeds_, doPerChannel_, edm::SortedCollection< T, SORT >::end(), MonitorElement::Fill(), CastorBaseMonitor::fVerbosity, i, CastorDataFrame::id(), ievt_, j, CastorBaseMonitor::m_dbe, meEVT_, pedVals_, perChanHists(), edm::CPUTimer::reset(), CastorDataFrame::sample(), CastorBaseMonitor::showTiming, edm::SortedCollection< T, SORT >::size(), CastorDataFrame::size(), edm::CPUTimer::start(), and edm::CPUTimer::stop().

Referenced by CastorMonitorModule::analyze().

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

 
  meEVT_->Fill(ievt_);
  
  //if(!shape_) shape_ = cond.getCastorShape(); // this one is generic


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


  CaloSamples tool;  
 
  if(castorDigis.size()>0) {

   for (CastorDigiCollection::const_iterator j=castorDigis.begin(); j!=castorDigis.end(); j++){
      const CastorDataFrame digi = (const CastorDataFrame)(*j); 
 

       detID_.clear(); capID_.clear(); pedVals_.clear();



      // const CastorCalibrations& calibrations = cond.getCastorCalibrations(digi.id().rawId());
      // const CastorPedestal* ped              = cond.getPedestal(digi.id()); 
      // const CastorPedestalWidth* pedw        = cond.getPedestalWidth(digi.id());
       // const CastorPedestal* ped = cond.getPedestal(digi.id()); 
       // const CastorPedestalWidth* pedw = cond.getPedestalWidth(digi.id());
      
       /*
      if(doFCpeds_){
        channelCoder_ = cond.getCastorCoder(digi.id());
        CastorCoderDb coderDB(*channelCoder_, *shape_);
        coderDB.adc2fC(digi,tool);
      }
     
     
       for(int capID=0; capID<4; capID++){
            float pedvalue=0;    
            if(ped) pedvalue=ped->getValue(capID);
            castHists.PEDESTAL_REFS->Fill(pedvalue);
            PEDESTAL_REFS->Fill(pedvalue);
           float width=0;
           if(pedw) width = pedw->getWidth(capID);
           castHists.WIDTH_REFS->Fill(width);
           WIDTH_REFS->Fill(width);
    }
     */
     
 
       
       //      if(ievt_ %1000 == 0 )           // PK: skip limited number of events
      //   { 
      for (int i=0; i<digi.size(); i++) {
        if(doFCpeds_) pedVals_.push_back(tool[i]); // default is FALSE
        else pedVals_.push_back(digi.sample(i).adc());
        detID_.push_back(digi.id());
        capID_.push_back(digi.sample(i).capid());
        castHists.ALLPEDS->Fill(pedVals_[i]);
      }
      
      //      }      

      //      if( ievt_%100 == 0 && doPerChannel_) perChanHists(detID_,capID_,pedVals_,castHists.PEDVALS, baseFolder_);
      if( doPerChannel_) perChanHists(detID_,capID_,pedVals_,castHists.PEDVALS, baseFolder_); // PK: no special event selection done

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

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

  ievt_++;
  return;
}
void CastorDigiMonitor::reset ( void  )

Definition at line 29 of file CastorDigiMonitor.cc.

Referenced by CastorMonitorModule::reset().

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

Reimplemented from CastorBaseMonitor.

Definition at line 35 of file CastorDigiMonitor.cc.

References CastorBaseMonitor::baseFolder_, DQMStore::book1D(), DQMStore::bookInt(), castHists, gather_cfg::cout, doFCpeds_, doPerChannel_, MonitorElement::Fill(), CastorBaseMonitor::fVerbosity, edm::ParameterSet::getUntrackedParameter(), ievt_, CastorBaseMonitor::m_dbe, meEVT_, NULL, outputFile_, CastorBaseMonitor::rootFolder_, and DQMStore::setCurrentFolder().

Referenced by CastorMonitorModule::CastorMonitorModule().

                                                                     {
  CastorBaseMonitor::setup(ps,dbe);
  baseFolder_ = rootFolder_+"CastorDigiMonitor";
   
  if(fVerbosity>0) std::cout << "CastorDigiMonitor::setup (start)" << std::endl;

  doPerChannel_ = ps.getUntrackedParameter<bool>("DigiPerChannel", false);
  doFCpeds_ = ps.getUntrackedParameter<bool>("DigiInFC", true);

  ievt_=0;

  if ( m_dbe !=NULL ) {
    m_dbe->setCurrentFolder(baseFolder_);
    meEVT_ = m_dbe->bookInt("Digi Task Event Number");
    meEVT_->Fill(ievt_);
        
    m_dbe->setCurrentFolder(baseFolder_);
  
    std::string type = "Castor Digis ADC counts";
    castHists.ALLPEDS =  m_dbe->book1D(type,type,130,0,130);
    
    //type = "Castor Pedestal Mean Reference Values - from CondDB";
    //castHists.PEDESTAL_REFS = m_dbe->book1D(type,type,50,0,50);
    //type = "Castor Pedestal RMS Reference Values - from CondDB";
    //castHists.WIDTH_REFS = m_dbe->book1D(type,type,20,0,10); 
 
}

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

 
  outputFile_ = ps.getUntrackedParameter<std::string>("PedestalFile", "");
  if ( outputFile_.size() != 0 ) { if(fVerbosity>0) std::cout << "Castor Pedestal Calibrations will be saved to " << outputFile_.c_str() << std::endl;}


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

  return;
}

Member Data Documentation

Definition at line 59 of file CastorDigiMonitor.h.

std::vector<int> CastorDigiMonitor::capID_ [private]

Definition at line 38 of file CastorDigiMonitor.h.

Referenced by processEvent().

struct { ... } CastorDigiMonitor::castHists [private]

Referenced by processEvent(), and setup().

Definition at line 44 of file CastorDigiMonitor.h.

Definition at line 37 of file CastorDigiMonitor.h.

Referenced by processEvent().

Definition at line 35 of file CastorDigiMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 34 of file CastorDigiMonitor.h.

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

int CastorDigiMonitor::ievt_ [private]

Definition at line 49 of file CastorDigiMonitor.h.

Referenced by processEvent(), and setup().

Definition at line 48 of file CastorDigiMonitor.h.

Referenced by processEvent(), and setup().

std::map<HcalCastorDetId, std::map<int,MonitorElement*> >::iterator CastorDigiMonitor::meo_ [private]

Definition at line 36 of file CastorDigiMonitor.h.

std::string CastorDigiMonitor::outputFile_ [private]

Definition at line 41 of file CastorDigiMonitor.h.

Referenced by setup().

Definition at line 52 of file CastorDigiMonitor.h.

Definition at line 60 of file CastorDigiMonitor.h.

Definition at line 56 of file CastorDigiMonitor.h.

std::vector<float> CastorDigiMonitor::pedVals_ [private]

Definition at line 39 of file CastorDigiMonitor.h.

Referenced by processEvent().

std::map<HcalCastorDetId,bool> CastorDigiMonitor::REG [private]

Definition at line 51 of file CastorDigiMonitor.h.

Referenced by perChanHists().

Definition at line 43 of file CastorDigiMonitor.h.

Definition at line 57 of file CastorDigiMonitor.h.

Definition at line 53 of file CastorDigiMonitor.h.