CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Attributes

ecaldqm::TowerStatusTask Class Reference

#include <TowerStatusTask.h>

Inheritance diagram for ecaldqm::TowerStatusTask:
ecaldqm::DQWorkerTask ecaldqm::DQWorker

List of all members.

Public Types

enum  MESets {
  kDAQSummary, kDAQSummaryMap, kDAQContents, kDCSSummary,
  kDCSSummaryMap, kDCSContents, nMESets
}

Public Member Functions

void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
void beginRun (const edm::Run &, const edm::EventSetup &)
void bookMEs ()
void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
void endRun (const edm::Run &, const edm::EventSetup &)
void runOnTowerStatus (const std::map< uint32_t, bool > &, int)
 TowerStatusTask (const edm::ParameterSet &, const edm::ParameterSet &)
 ~TowerStatusTask ()

Static Public Member Functions

static void setMEData (std::vector< MEData > &)

Private Attributes

std::map< uint32_t, bool > daqLumiStatus_
std::map< uint32_t, bool > daqRunStatus_
std::map< uint32_t, bool > dcsLumiStatus_
std::map< uint32_t, bool > dcsRunStatus_
bool doDAQInfo_
bool doDCSInfo_

Detailed Description

Definition at line 8 of file TowerStatusTask.h.


Member Enumeration Documentation

Enumerator:
kDAQSummary 
kDAQSummaryMap 
kDAQContents 
kDCSSummary 
kDCSSummaryMap 
kDCSContents 
nMESets 

Reimplemented from ecaldqm::DQWorker.

Definition at line 22 of file TowerStatusTask.h.


Constructor & Destructor Documentation

data refman pasoursint CMSSW_5_2_7_hltpatch2 src DQM EcalBarrelMonitorTasks src TowerStatusTask cc ecaldqm::TowerStatusTask::TowerStatusTask ( const edm::ParameterSet _params,
const edm::ParameterSet _paths 
)

Definition at line 22 of file TowerStatusTask.cc.

References Exception, edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), ecaldqm::kLumiSection, and ecaldqm::kRun.

  {
    collectionMask_ = 
      (0x1 << kRun) |
      (0x1 << kLumiSection);

    edm::ParameterSet const& taskParams(_params.getUntrackedParameterSet(name_));

    doDAQInfo_ = taskParams.getUntrackedParameter<bool>("doDAQInfo");
    doDCSInfo_ = taskParams.getUntrackedParameter<bool>("doDCSInfo");

    if(!doDAQInfo_ && !doDCSInfo_)
      throw cms::Exception("InvalidConfiguration") << "Nonthing to do in TowerStatusTask";
  }

ecaldqm::TowerStatusTask::~TowerStatusTask ( )

Definition at line 44 of file TowerStatusTask.cc.

  {
  }


Member Function Documentation

void ecaldqm::TowerStatusTask::beginLuminosityBlock ( const edm::LuminosityBlock ,
const edm::EventSetup _es 
) [virtual]

Reimplemented from ecaldqm::DQWorker.

Definition at line 109 of file TowerStatusTask.cc.

References daqLumiStatus_, daqRunStatus_, dcsLumiStatus_, dcsRunStatus_, EcalTrigTowerDetId::detIdFromDenseIndex(), doDAQInfo_, doDCSInfo_, edm::EventSetup::get(), edm::ESHandleBase::isValid(), EcalTrigTowerDetId::kEBTotalTowers, EcalScDetId::kSizeForDenseIndexing, DetId::rawId(), ntuplemaker::status, and EcalScDetId::unhashIndex().

  {
    edm::ESHandle<EcalDAQTowerStatus> daqHndl;
    if(doDAQInfo_){
      _es.get<EcalDAQTowerStatusRcd>().get(daqHndl);
      if (!daqHndl.isValid()){
        edm::LogWarning("EventSetup") << "EcalDAQTowerStatus record not valid";
        return;
      }
    }

    edm::ESHandle<EcalDCSTowerStatus> dcsHndl;
    if(doDCSInfo_){
      _es.get<EcalDCSTowerStatusRcd>().get(dcsHndl);
      if (!dcsHndl.isValid()){
        edm::LogWarning("EventSetup") << "EcalDCSTowerStatus record not valid";
        return;
      }
    }

    for(unsigned id(0); id < EcalTrigTowerDetId::kEBTotalTowers; id++){
      EcalTrigTowerDetId ttid(EcalTrigTowerDetId::detIdFromDenseIndex(id));
      if(doDAQInfo_){
        uint16_t status(daqHndl->barrel(id).getStatusCode());
        if(status != 0){
          daqLumiStatus_[ttid.rawId()] = false;
          daqRunStatus_[ttid.rawId()] = false;
        }
      }
      if(doDCSInfo_){
        uint16_t status(dcsHndl->barrel(id).getStatusCode());
        if(status != 0){
          dcsLumiStatus_[ttid.rawId()] = false;
          dcsRunStatus_[ttid.rawId()] = false;
        }
      }
    }

    for(unsigned id(0); id < EcalScDetId::kSizeForDenseIndexing; id++){
      EcalScDetId scid(EcalScDetId::unhashIndex(id));
      if(doDAQInfo_){
        uint16_t status(daqHndl->endcap(id).getStatusCode());
        if(status != 0){
          daqLumiStatus_[scid.rawId()] = false;
          daqRunStatus_[scid.rawId()] = false;
        }
      }
      if(doDCSInfo_){
        uint16_t status(dcsHndl->endcap(id).getStatusCode());
        if(status != 0){
          dcsLumiStatus_[scid.rawId()] = false;
          dcsRunStatus_[scid.rawId()] = false;
        }
      }
    }
  }

void ecaldqm::TowerStatusTask::beginRun ( const edm::Run ,
const edm::EventSetup  
) [virtual]

Reimplemented from ecaldqm::DQWorker.

Definition at line 54 of file TowerStatusTask.cc.

References daqLumiStatus_, daqRunStatus_, dcsLumiStatus_, dcsRunStatus_, EcalTrigTowerDetId::detIdFromDenseIndex(), doDAQInfo_, doDCSInfo_, kDAQContents, kDAQSummary, kDAQSummaryMap, kDCSContents, kDCSSummary, kDCSSummaryMap, EcalTrigTowerDetId::kEBTotalTowers, EcalScDetId::kSizeForDenseIndexing, ecaldqm::DQWorker::MEs_, DetId::rawId(), and EcalScDetId::unhashIndex().

  {
    if(doDAQInfo_){
      MEs_[kDAQSummary]->book();
      MEs_[kDAQSummaryMap]->book();
      MEs_[kDAQContents]->book();

      MEs_[kDAQSummaryMap]->resetAll(-1.);
    }
    if(doDCSInfo_){
      MEs_[kDCSSummary]->book();
      MEs_[kDCSSummaryMap]->book();
      MEs_[kDCSContents]->book();

      MEs_[kDCSSummaryMap]->resetAll(-1.);
    }

    daqLumiStatus_.clear();
    daqRunStatus_.clear();
    dcsLumiStatus_.clear();
    dcsRunStatus_.clear();

    for(unsigned id(0); id < EcalTrigTowerDetId::kEBTotalTowers; id++){
      EcalTrigTowerDetId ttid(EcalTrigTowerDetId::detIdFromDenseIndex(id));
      if(doDAQInfo_){
        daqLumiStatus_[ttid.rawId()] = true;
        daqRunStatus_[ttid.rawId()] = true;
      }
      if(doDCSInfo_){
        dcsLumiStatus_[ttid.rawId()] = true;
        dcsRunStatus_[ttid.rawId()] = true;
      }
    }

    for(unsigned id(0); id < EcalScDetId::kSizeForDenseIndexing; id++){
      EcalScDetId scid(EcalScDetId::unhashIndex(id));
      if(doDAQInfo_){
        daqLumiStatus_[scid.rawId()] = true;
        daqRunStatus_[scid.rawId()] = true;
      }
      if(doDCSInfo_){
        dcsLumiStatus_[scid.rawId()] = true;
        dcsRunStatus_[scid.rawId()] = true;
      }
    }
  }

void ecaldqm::TowerStatusTask::bookMEs ( ) [virtual]

Reimplemented from ecaldqm::DQWorker.

Definition at line 49 of file TowerStatusTask.cc.

  {
  }

void ecaldqm::TowerStatusTask::endLuminosityBlock ( const edm::LuminosityBlock ,
const edm::EventSetup  
) [virtual]
void ecaldqm::TowerStatusTask::endRun ( const edm::Run ,
const edm::EventSetup  
) [virtual]
void ecaldqm::TowerStatusTask::runOnTowerStatus ( const std::map< uint32_t, bool > &  _status,
int  _type 
)

Definition at line 174 of file TowerStatusTask.cc.

References cmsMakeMELists::contents, gather_cfg::cout, ecaldqm::dccId(), EcalElectronicsMapping::dccTowerConstituents(), EcalTriggerTower, ecaldqm::getElectronicsMap(), ecaldqm::DQWorker::initialized_, kDAQContents, kDAQSummary, kDAQSummaryMap, kDCSContents, kDCSSummary, kDCSSummaryMap, EBDetId::kSizeForDenseIndexing, EEDetId::kSizeForDenseIndexing, ecaldqm::DQWorker::MEs_, findQualityFiles::size, ntuplemaker::status, edmLumisInFiles::summary, and ecaldqm::towerId().

Referenced by endLuminosityBlock(), and endRun().

  {
    if(!initialized_) return;

    std::vector<int> activeChannels(54, 0);

    unsigned summary, summaryMap, contents;
    if(_type == 0){
      summary = kDAQSummary;
      summaryMap = kDAQSummaryMap;
      contents = kDAQContents;
    }
    else{
      summary = kDCSSummary;
      summaryMap = kDCSSummaryMap;
      contents = kDCSContents;
    }

    MEs_[summaryMap]->reset();

    for(std::map<uint32_t, bool>::const_iterator stItr(_status.begin()); stItr != _status.end(); ++stItr){
      DetId id(stItr->first);
      bool status(stItr->second);

      std::cout.flush();
      MEs_[summaryMap]->setBinContent(id, status ? 1. : 0.);

      if(status){
        if(id.subdetId() == EcalTriggerTower)
          activeChannels[dccId(id) - 1] += 25;
        else{
          int dccid(dccId(id));
          int towerid(towerId(id));
          activeChannels[dccId(id) - 1] += getElectronicsMap()->dccTowerConstituents(dccid, towerid).size();
        }
      }
    }

    int totalActive(0);
    for(unsigned iDCC(0); iDCC < 54; iDCC++){
      float fraction(float(activeChannels[iDCC]) / float(getElectronicsMap()->dccConstituents(iDCC + 1).size()));
      MEs_[contents]->fill(iDCC + 1, fraction);
      totalActive += activeChannels[iDCC];
    }

    MEs_[summary]->fill(float(totalActive) / float(EBDetId::kSizeForDenseIndexing + EEDetId::kSizeForDenseIndexing));
  }

void ecaldqm::TowerStatusTask::setMEData ( std::vector< MEData > &  _data) [static]

Member Data Documentation

std::map<uint32_t, bool> ecaldqm::TowerStatusTask::daqLumiStatus_ [private]

Definition at line 35 of file TowerStatusTask.h.

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

std::map<uint32_t, bool> ecaldqm::TowerStatusTask::daqRunStatus_ [private]

Definition at line 35 of file TowerStatusTask.h.

Referenced by beginLuminosityBlock(), beginRun(), and endRun().

std::map<uint32_t, bool> ecaldqm::TowerStatusTask::dcsLumiStatus_ [private]

Definition at line 36 of file TowerStatusTask.h.

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

std::map<uint32_t, bool> ecaldqm::TowerStatusTask::dcsRunStatus_ [private]

Definition at line 36 of file TowerStatusTask.h.

Referenced by beginLuminosityBlock(), beginRun(), and endRun().

Definition at line 37 of file TowerStatusTask.h.

Referenced by beginLuminosityBlock(), beginRun(), endLuminosityBlock(), and endRun().

Definition at line 37 of file TowerStatusTask.h.

Referenced by beginLuminosityBlock(), beginRun(), endLuminosityBlock(), and endRun().