CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ecaldqm::MESetChannel Class Reference

#include <MESetChannel.h>

Inheritance diagram for ecaldqm::MESetChannel:
ecaldqm::MESet

List of all members.

Public Member Functions

void checkDirectory () const
void clear () const
void fill (DetId const &, double _w=1., double _unused1=0., double _unused2=0.)
void fill (EcalElectronicsId const &, double _w=1., double _unused1=0., double _unused2=0.)
double getBinContent (DetId const &, int _bin=0) const
double getBinContent (EcalElectronicsId const &, int _bin=0) const
double getBinEntries (EcalElectronicsId const &_id, int _bin=0) const
double getBinEntries (DetId const &_id, int _bin=0) const
 MESetChannel (std::string const &, MEData const &, bool _readOnly=false)
void reset (double _content=0., double _err=0., double _entries=0.)
bool retrieve () const
void setBinContent (DetId const &, double, double _err=0.)
void setBinContent (EcalElectronicsId const &, double, double _err=0.)
 ~MESetChannel ()

Private Member Functions

std::map< uint32_t, unsigned >
::iterator 
append_ (std::string const &, uint32_t)
uint32_t getIndex_ (EcalElectronicsId const &) const
uint32_t getIndex_ (DetId const &) const

Private Attributes

std::vector< MonitorElement * > mes_
std::map< uint32_t, unsigned > meTable_
bool readMode_

Detailed Description

Definition at line 11 of file MESetChannel.h.


Constructor & Destructor Documentation

ecaldqm::MESetChannel::MESetChannel ( std::string const &  _fullpath,
MEData const &  _data,
bool  _readOnly = false 
)

Definition at line 10 of file MESetChannel.cc.

                                                                                             :
    MESet(_fullpath, _data, _readOnly),
    meTable_()
  {
  }
ecaldqm::MESetChannel::~MESetChannel ( )

Definition at line 16 of file MESetChannel.cc.

  {
  }

Member Function Documentation

std::map< uint32_t, unsigned >::iterator ecaldqm::MESetChannel::append_ ( std::string const &  _name,
uint32_t  _rawId 
) [private]

Definition at line 160 of file MESetChannel.cc.

References DQMStore::book1D(), ecaldqm::MESet::dir_, ecaldqm::MESet::dqmStore_, mes_, meTable_, DQMStore::pwd(), alignCSCRings::pwd, DQMStore::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by fill(), and setBinContent().

  {
    std::string pwd(dqmStore_->pwd());
    dqmStore_->setCurrentFolder(dir_);

    MonitorElement* me(dqmStore_->book1D(_name, _name, 1, 0., 1.));

    dqmStore_->setCurrentFolder(pwd);

    if(!me) return meTable_.end();

    mes_.push_back(me);
    std::pair<std::map<uint32_t, unsigned>::iterator, bool> ins(meTable_.insert(std::pair<uint32_t, unsigned>(_rawId, mes_.size() - 1)));
    
    return ins.first;
  }
void ecaldqm::MESetChannel::checkDirectory ( ) const

Definition at line 143 of file MESetChannel.cc.

References ecaldqm::MESet::binService_, ecaldqm::MESet::dir_, ecaldqm::MESet::dqmStore_, spr::find(), DQMStore::getContents(), EcalDQMBinningService::idFromName(), mes_, and meTable_.

Referenced by ecaldqm::DQWorkerClient::endLuminosityBlock().

  {
    using namespace std;

    vector<MonitorElement*> storeMEs(dqmStore_->getContents(dir_));
    for(vector<MonitorElement*>::iterator storeItr(storeMEs.begin()); storeItr != storeMEs.end(); ++storeItr){
      if(find(mes_.begin(), mes_.end(), *storeItr) != mes_.end()) continue;

      uint32_t id(binService_->idFromName((*storeItr)->getName()));
      if(id != 0){
        mes_.push_back(*storeItr);
        meTable_[id] = mes_.size() - 1;
      }
    }
  }
void ecaldqm::MESetChannel::clear ( void  ) const [virtual]
void ecaldqm::MESetChannel::fill ( EcalElectronicsId const &  _id,
double  _w = 1.,
double  _unused1 = 0.,
double  _unused2 = 0. 
) [virtual]

Reimplemented from ecaldqm::MESet.

Definition at line 52 of file MESetChannel.cc.

References append_(), ecaldqm::MESet::binService_, ecaldqm::MEData::btype, EcalDQMBinningService::channelName(), ecaldqm::MESet::data_, getIndex_(), mes_, meTable_, ecaldqm::MESet::name(), and AlCaHLTBitMon_QueryRunRegistry::string.

  {
    uint32_t rawId(getIndex_(_id));

    std::map<uint32_t, unsigned>::iterator tableItr(meTable_.find(rawId));
    if(tableItr == meTable_.end()){
      std::string name(binService_->channelName(rawId, data_->btype));
      tableItr = append_(name, rawId);
    }
    if(tableItr == meTable_.end()) return;

    mes_.at(tableItr->second)->Fill(0.5, _w);
  }
void ecaldqm::MESetChannel::fill ( DetId const &  _id,
double  _w = 1.,
double  _unused1 = 0.,
double  _unused2 = 0. 
) [virtual]

Reimplemented from ecaldqm::MESet.

Definition at line 37 of file MESetChannel.cc.

References append_(), ecaldqm::MESet::binService_, ecaldqm::MEData::btype, EcalDQMBinningService::channelName(), ecaldqm::MESet::data_, getIndex_(), mes_, meTable_, ecaldqm::MESet::name(), and AlCaHLTBitMon_QueryRunRegistry::string.

  {
    uint32_t rawId(getIndex_(_id));

    std::map<uint32_t, unsigned>::iterator tableItr(meTable_.find(rawId));
    if(tableItr == meTable_.end()){
      std::string name(binService_->channelName(rawId, data_->btype));
      tableItr = append_(name, rawId);
    }
    if(tableItr == meTable_.end()) return;

    mes_.at(tableItr->second)->Fill(0.5, _w);
  }
double ecaldqm::MESetChannel::getBinContent ( DetId const &  _id,
int  _bin = 0 
) const [virtual]

Reimplemented from ecaldqm::MESet.

Definition at line 119 of file MESetChannel.cc.

References getIndex_(), mes_, and meTable_.

Referenced by getBinEntries().

  {
    uint32_t rawId(getIndex_(_id));

    std::map<uint32_t, unsigned>::const_iterator tableItr(meTable_.find(rawId));

    if(tableItr == meTable_.end()) return 0.;

    return mes_.at(tableItr->second)->getBinContent(1);
  }
double ecaldqm::MESetChannel::getBinContent ( EcalElectronicsId const &  _id,
int  _bin = 0 
) const [virtual]

Reimplemented from ecaldqm::MESet.

Definition at line 131 of file MESetChannel.cc.

References getIndex_(), mes_, and meTable_.

  {
    uint32_t rawId(getIndex_(_id));

    std::map<uint32_t, unsigned>::const_iterator tableItr(meTable_.find(rawId));

    if(tableItr == meTable_.end()) return 0.;

    return mes_.at(tableItr->second)->getBinContent(1);
  }
double ecaldqm::MESetChannel::getBinEntries ( EcalElectronicsId const &  _id,
int  _bin = 0 
) const [inline, virtual]

Reimplemented from ecaldqm::MESet.

Definition at line 33 of file MESetChannel.h.

:
    std::map<uint32_t, unsigned>::iterator append_(std::string const&, uint32_t);
double ecaldqm::MESetChannel::getBinEntries ( DetId const &  _id,
int  _bin = 0 
) const [inline, virtual]

Reimplemented from ecaldqm::MESet.

Definition at line 32 of file MESetChannel.h.

References getBinContent().

{ return getBinContent(_id, _bin); }
uint32_t ecaldqm::MESetChannel::getIndex_ ( DetId const &  _id) const [private]

Definition at line 178 of file MESetChannel.cc.

References ecaldqm::MEData::btype, ecaldqm::MESet::data_, EcalElectronicsId::dccId(), EcalTriggerTower, Exception, EcalElectronicsMapping::getElectronicsId(), ecaldqm::getElectronicsMap(), EcalDQMBinningService::kCrystal, EcalDQMBinningService::kDCC, EcalDQMBinningService::kSuperCrystal, EcalDQMBinningService::kTCC, EcalDQMBinningService::kTriggerTower, EcalDQMBinningService::nDCC, EcalElectronicsId::rawId(), EcalTriggerElectronicsId::rawId(), DetId::subdetId(), EcalTriggerElectronicsId::tccId(), EcalElectronicsId::towerId(), and EcalTriggerElectronicsId::ttId().

Referenced by fill(), getBinContent(), and setBinContent().

  {
    switch(data_->btype){
    case BinService::kCrystal:
      return getElectronicsMap()->getElectronicsId(_id).rawId();
    case BinService::kTriggerTower:
      {
        if(_id.subdetId() == EcalTriggerTower){
          EcalTrigTowerDetId ttid(_id);
          return EcalTriggerElectronicsId(getElectronicsMap()->TCCid(ttid), getElectronicsMap()->iTT(ttid), 1, 1).rawId();
        }
        else{
          EcalTriggerElectronicsId teid(getElectronicsMap()->getTriggerElectronicsId(_id));
          return EcalTriggerElectronicsId(teid.tccId(), teid.ttId(), 1, 1).rawId();
        }
      }
    case BinService::kSuperCrystal:
      {
        EcalElectronicsId eid(getElectronicsMap()->getElectronicsId(_id));
        return EcalElectronicsId(eid.dccId(), eid.towerId(), 1, 1).rawId();
      }
    case BinService::kTCC:
      {
        EcalTriggerElectronicsId teid(getElectronicsMap()->getTriggerElectronicsId(_id));
        return BinService::nDCC + teid.tccId();
      }
    case BinService::kDCC:
      {
        EcalElectronicsId eid(getElectronicsMap()->getElectronicsId(_id));
        return eid.dccId();
      }
    default:
      throw cms::Exception("InvalidConfiguration") << "MESetChannel configured with bin type " << data_->btype;
      return 0;
    }
  }
uint32_t ecaldqm::MESetChannel::getIndex_ ( EcalElectronicsId const &  _id) const [private]

Definition at line 216 of file MESetChannel.cc.

References ecaldqm::MEData::btype, ecaldqm::MESet::data_, EcalElectronicsId::dccId(), Exception, ecaldqm::getElectronicsMap(), EcalDQMBinningService::kCrystal, EcalDQMBinningService::kDCC, EcalDQMBinningService::kSuperCrystal, EcalDQMBinningService::kTCC, EcalDQMBinningService::kTriggerTower, EcalDQMBinningService::nDCC, EcalElectronicsId::rawId(), EcalTriggerElectronicsId::tccId(), EcalElectronicsId::towerId(), and EcalTriggerElectronicsId::ttId().

  {
    switch(data_->btype){
    case BinService::kCrystal:
      return _id.rawId();
    case BinService::kTriggerTower:
      {
        EcalTriggerElectronicsId teid(getElectronicsMap()->getTriggerElectronicsId(_id));
        return EcalTriggerElectronicsId(teid.tccId(), teid.ttId(), 1, 1).rawId();
      }
    case BinService::kSuperCrystal:
      return EcalElectronicsId(_id.dccId(), _id.towerId(), 1, 1).rawId();
    case BinService::kTCC:
      {
        EcalTriggerElectronicsId teid(getElectronicsMap()->getTriggerElectronicsId(_id));
        return BinService::nDCC + teid.tccId();
      }
    case BinService::kDCC:
      return _id.dccId();
    default:
      throw cms::Exception("InvalidConfiguration") << "MESetChannel configured with bin type " << data_->btype;
      return 0;
    }
  }
void ecaldqm::MESetChannel::reset ( double  _content = 0.,
double  _err = 0.,
double  _entries = 0. 
) [virtual]

Reimplemented from ecaldqm::MESet.

Definition at line 99 of file MESetChannel.cc.

References ecaldqm::MESet::data_, ecaldqm::MESet::dir_, MonitorElement::DQM_KIND_TPROFILE, ecaldqm::MESet::dqmStore_, ecaldqm::MEData::kind, mes_, meTable_, ecaldqm::MESet::readOnly_, and DQMStore::rmdir().

  {
    if(readOnly_) return;

    if(_content == 0. && _entries == 0.){
      mes_.clear();
      meTable_.clear();
      dqmStore_->rmdir(dir_);
      return;
    }

    for(unsigned iME(0); iME < mes_.size(); iME++){
      mes_[iME]->setBinContent(1, _content);
      mes_[iME]->setBinContent(1, _err);
      if(data_->kind == MonitorElement::DQM_KIND_TPROFILE)
        mes_[iME]->setBinEntries(1, _entries);
    }
  }
bool ecaldqm::MESetChannel::retrieve ( ) const [virtual]

Reimplemented from ecaldqm::MESet.

Definition at line 21 of file MESetChannel.cc.

References ecaldqm::MESet::active_.

  {
    active_ = true;
    return true;
  }
void ecaldqm::MESetChannel::setBinContent ( EcalElectronicsId const &  _id,
double  _content,
double  _err = 0. 
) [virtual]

Reimplemented from ecaldqm::MESet.

Definition at line 83 of file MESetChannel.cc.

References append_(), ecaldqm::MESet::binService_, ecaldqm::MEData::btype, EcalDQMBinningService::channelName(), ecaldqm::MESet::data_, getIndex_(), mes_, meTable_, ecaldqm::MESet::name(), and AlCaHLTBitMon_QueryRunRegistry::string.

  {
    uint32_t rawId(getIndex_(_id));

    std::map<uint32_t, unsigned>::iterator tableItr(meTable_.find(rawId));
    if(tableItr == meTable_.end()){
      std::string name(binService_->channelName(rawId, data_->btype));
      tableItr = append_(name, rawId);
    }
    if(tableItr == meTable_.end()) return;

    mes_.at(tableItr->second)->setBinContent(1, _content);
    mes_.at(tableItr->second)->setBinError(1, _err);
  }
void ecaldqm::MESetChannel::setBinContent ( DetId const &  _id,
double  _content,
double  _err = 0. 
) [virtual]

Reimplemented from ecaldqm::MESet.

Definition at line 67 of file MESetChannel.cc.

References append_(), ecaldqm::MESet::binService_, ecaldqm::MEData::btype, EcalDQMBinningService::channelName(), ecaldqm::MESet::data_, getIndex_(), mes_, meTable_, ecaldqm::MESet::name(), and AlCaHLTBitMon_QueryRunRegistry::string.

  {
    uint32_t rawId(getIndex_(_id));

    std::map<uint32_t, unsigned>::iterator tableItr(meTable_.find(rawId));
    if(tableItr == meTable_.end()){
      std::string name(binService_->channelName(rawId, data_->btype));
      tableItr = append_(name, rawId);
    }
    if(tableItr == meTable_.end()) return;

    mes_.at(tableItr->second)->setBinContent(1, _content);
    mes_.at(tableItr->second)->setBinError(1, _err);
  }

Member Data Documentation

std::vector<MonitorElement*> ecaldqm::MESetChannel::mes_ [mutable, private]

Reimplemented from ecaldqm::MESet.

Definition at line 42 of file MESetChannel.h.

Referenced by append_(), checkDirectory(), clear(), fill(), getBinContent(), reset(), and setBinContent().

std::map<uint32_t, unsigned> ecaldqm::MESetChannel::meTable_ [mutable, private]

Definition at line 43 of file MESetChannel.h.

Referenced by append_(), checkDirectory(), clear(), fill(), getBinContent(), reset(), and setBinContent().

bool ecaldqm::MESetChannel::readMode_ [mutable, private]

Definition at line 46 of file MESetChannel.h.