CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ecaldqm::MESetChannel Class Reference

#include <MESetChannel.h>

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

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 (DetId const &_id, int _bin=0) const
 
double getBinEntries (EcalElectronicsId 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 ()
 
- Public Member Functions inherited from ecaldqm::MESet
virtual void book ()
 
virtual void fill (unsigned, double _wx=1., double _wy=1., double _w=1.)
 
virtual void fill (double, double _wy=1., double _w=1.)
 
virtual double getBinContent (unsigned, int _bin=0) const
 
virtual double getBinEntries (unsigned, int _bin=0) const
 
virtual double getBinError (DetId const &, int _bin=0) const
 
virtual double getBinError (EcalElectronicsId const &, int _bin=0) const
 
virtual double getBinError (unsigned, int _bin=0) const
 
BinService::BinningType getBinType () const
 
std::string const & getDir () const
 
virtual MonitorElement const * getME (unsigned _offset) const
 
std::string const & getName () const
 
BinService::ObjectType getObjType () const
 
bool isActive () const
 
 MESet (std::string const &, MEData const &, bool _readOnly=false)
 
void name (std::map< std::string, std::string > const &) const
 
virtual void resetAll (double _content=0., double _err=0., double _entries=0.)
 
virtual void setAxisTitle (std::string const &, int _axis=1)
 
virtual void setBinContent (unsigned, double, double _err=0.)
 
virtual void setBinEntries (DetId const &, double)
 
virtual void setBinEntries (EcalElectronicsId const &, double)
 
virtual void setBinEntries (unsigned, double)
 
virtual void setBinLabel (unsigned, int, std::string const &, int _axis=1)
 
void setDir (std::string const &_dir)
 
void setName (std::string const &_name)
 
virtual ~MESet ()
 

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from ecaldqm::MESet
virtual void fill_ (unsigned, int, double)
 
virtual void fill_ (unsigned, double, double, double)
 
virtual double getBinContent_ (unsigned, int) const
 
virtual double getBinEntries_ (unsigned, int) const
 
virtual double getBinError_ (unsigned, int) const
 
virtual void setBinContent_ (unsigned, int, double, double)
 
virtual void setBinEntries_ (unsigned, int, double)
 
- Protected Attributes inherited from ecaldqm::MESet
bool active_
 
MEData const * data_
 
std::string dir_
 
std::vector< MonitorElement * > mes_
 
std::string name_
 
bool readOnly_
 
- Static Protected Attributes inherited from ecaldqm::MESet
static BinService const * binService_
 
static DQMStoredqmStore_
 

Detailed Description

Definition at line 10 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.

10  :
11  MESet(_fullpath, _data, _readOnly),
12  meTable_()
13  {
14  }
std::map< uint32_t, unsigned > meTable_
Definition: MESetChannel.h:42
MESet(std::string const &, MEData const &, bool _readOnly=false)
Definition: MESet.cc:16
ecaldqm::MESetChannel::~MESetChannel ( )

Definition at line 16 of file MESetChannel.cc.

17  {
18  }

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_, cuy::ins, mes_, meTable_, alignCSCRings::pwd, DQMStore::pwd(), DQMStore::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by fill(), and setBinContent().

161  {
164 
165  MonitorElement* me(dqmStore_->book1D(_name, _name, 1, 0., 1.));
166 
168 
169  if(!me) return meTable_.end();
170 
171  mes_.push_back(me);
172  std::pair<std::map<uint32_t, unsigned>::iterator, bool> ins(meTable_.insert(std::pair<uint32_t, unsigned>(_rawId, mes_.size() - 1)));
173 
174  return ins.first;
175  }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
std::map< uint32_t, unsigned > meTable_
Definition: MESetChannel.h:42
static DQMStore * dqmStore_
Definition: MESet.h:127
std::vector< MonitorElement * > mes_
Definition: MESetChannel.h:41
std::string dir_
Definition: MESet.h:131
tuple ins
Definition: cuy.py:312
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
const std::string & pwd(void) const
Definition: DQMStore.cc:406
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().

144  {
145  using namespace std;
146 
147  vector<MonitorElement*> storeMEs(dqmStore_->getContents(dir_));
148  for(vector<MonitorElement*>::iterator storeItr(storeMEs.begin()); storeItr != storeMEs.end(); ++storeItr){
149  if(find(mes_.begin(), mes_.end(), *storeItr) != mes_.end()) continue;
150 
151  uint32_t id(binService_->idFromName((*storeItr)->getName()));
152  if(id != 0){
153  mes_.push_back(*storeItr);
154  meTable_[id] = mes_.size() - 1;
155  }
156  }
157  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::map< uint32_t, unsigned > meTable_
Definition: MESetChannel.h:42
static DQMStore * dqmStore_
Definition: MESet.h:127
std::vector< MonitorElement * > mes_
Definition: MESetChannel.h:41
std::string dir_
Definition: MESet.h:131
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1502
static BinService const * binService_
Definition: MESet.h:126
uint32_t idFromName(std::string const &) const
void ecaldqm::MESetChannel::clear ( void  ) const
virtual
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.

38  {
39  uint32_t rawId(getIndex_(_id));
40 
41  std::map<uint32_t, unsigned>::iterator tableItr(meTable_.find(rawId));
42  if(tableItr == meTable_.end()){
44  tableItr = append_(name, rawId);
45  }
46  if(tableItr == meTable_.end()) return;
47 
48  mes_.at(tableItr->second)->Fill(0.5, _w);
49  }
std::string channelName(uint32_t, BinningType _btype=kDCC) const
std::map< uint32_t, unsigned > meTable_
Definition: MESetChannel.h:42
std::vector< MonitorElement * > mes_
Definition: MESetChannel.h:41
std::map< uint32_t, unsigned >::iterator append_(std::string const &, uint32_t)
BinService::BinningType btype
Definition: MESet.h:23
uint32_t getIndex_(DetId const &) const
static BinService const * binService_
Definition: MESet.h:126
MEData const * data_
Definition: MESet.h:133
void name(std::map< std::string, std::string > const &) const
Definition: MESet.cc:240
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.

53  {
54  uint32_t rawId(getIndex_(_id));
55 
56  std::map<uint32_t, unsigned>::iterator tableItr(meTable_.find(rawId));
57  if(tableItr == meTable_.end()){
59  tableItr = append_(name, rawId);
60  }
61  if(tableItr == meTable_.end()) return;
62 
63  mes_.at(tableItr->second)->Fill(0.5, _w);
64  }
std::string channelName(uint32_t, BinningType _btype=kDCC) const
std::map< uint32_t, unsigned > meTable_
Definition: MESetChannel.h:42
std::vector< MonitorElement * > mes_
Definition: MESetChannel.h:41
std::map< uint32_t, unsigned >::iterator append_(std::string const &, uint32_t)
BinService::BinningType btype
Definition: MESet.h:23
uint32_t getIndex_(DetId const &) const
static BinService const * binService_
Definition: MESet.h:126
MEData const * data_
Definition: MESet.h:133
void name(std::map< std::string, std::string > const &) const
Definition: MESet.cc:240
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().

120  {
121  uint32_t rawId(getIndex_(_id));
122 
123  std::map<uint32_t, unsigned>::const_iterator tableItr(meTable_.find(rawId));
124 
125  if(tableItr == meTable_.end()) return 0.;
126 
127  return mes_.at(tableItr->second)->getBinContent(1);
128  }
std::map< uint32_t, unsigned > meTable_
Definition: MESetChannel.h:42
std::vector< MonitorElement * > mes_
Definition: MESetChannel.h:41
uint32_t getIndex_(DetId const &) const
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_.

132  {
133  uint32_t rawId(getIndex_(_id));
134 
135  std::map<uint32_t, unsigned>::const_iterator tableItr(meTable_.find(rawId));
136 
137  if(tableItr == meTable_.end()) return 0.;
138 
139  return mes_.at(tableItr->second)->getBinContent(1);
140  }
std::map< uint32_t, unsigned > meTable_
Definition: MESetChannel.h:42
std::vector< MonitorElement * > mes_
Definition: MESetChannel.h:41
uint32_t getIndex_(DetId const &) const
double ecaldqm::MESetChannel::getBinEntries ( DetId const &  _id,
int  _bin = 0 
) const
inlinevirtual

Reimplemented from ecaldqm::MESet.

Definition at line 31 of file MESetChannel.h.

References getBinContent().

31 { return getBinContent(_id, _bin); }
double getBinContent(DetId const &, int _bin=0) const
double ecaldqm::MESetChannel::getBinEntries ( EcalElectronicsId const &  _id,
int  _bin = 0 
) const
inlinevirtual

Reimplemented from ecaldqm::MESet.

Definition at line 32 of file MESetChannel.h.

References getBinContent().

32 { return getBinContent(_id, _bin); }
double getBinContent(DetId const &, int _bin=0) const
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, edm::hlt::Exception, EcalElectronicsMapping::getElectronicsId(), ecaldqm::getElectronicsMap(), EcalDQMBinningService::kCrystal, EcalDQMBinningService::kDCC, EcalDQMBinningService::kSuperCrystal, EcalDQMBinningService::kTCC, EcalDQMBinningService::kTriggerTower, EcalDQMBinningService::nDCC, EcalTriggerElectronicsId::rawId(), EcalElectronicsId::rawId(), DetId::subdetId(), EcalTriggerElectronicsId::tccId(), EcalElectronicsId::towerId(), and EcalTriggerElectronicsId::ttId().

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

179  {
180  switch(data_->btype){
182  return getElectronicsMap()->getElectronicsId(_id).rawId();
184  {
185  if(_id.subdetId() == EcalTriggerTower){
186  EcalTrigTowerDetId ttid(_id);
187  return EcalTriggerElectronicsId(getElectronicsMap()->TCCid(ttid), getElectronicsMap()->iTT(ttid), 1, 1).rawId();
188  }
189  else{
190  EcalTriggerElectronicsId teid(getElectronicsMap()->getTriggerElectronicsId(_id));
191  return EcalTriggerElectronicsId(teid.tccId(), teid.ttId(), 1, 1).rawId();
192  }
193  }
195  {
196  EcalElectronicsId eid(getElectronicsMap()->getElectronicsId(_id));
197  return EcalElectronicsId(eid.dccId(), eid.towerId(), 1, 1).rawId();
198  }
199  case BinService::kTCC:
200  {
201  EcalTriggerElectronicsId teid(getElectronicsMap()->getTriggerElectronicsId(_id));
202  return BinService::nDCC + teid.tccId();
203  }
204  case BinService::kDCC:
205  {
206  EcalElectronicsId eid(getElectronicsMap()->getElectronicsId(_id));
207  return eid.dccId();
208  }
209  default:
210  throw cms::Exception("InvalidConfiguration") << "MESetChannel configured with bin type " << data_->btype;
211  return 0;
212  }
213  }
const EcalElectronicsMapping * getElectronicsMap()
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
BinService::BinningType btype
Definition: MESet.h:23
uint32_t rawId() const
MEData const * data_
Definition: MESet.h:133
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...
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(), edm::hlt::Exception, ecaldqm::getElectronicsMap(), EcalDQMBinningService::kCrystal, EcalDQMBinningService::kDCC, EcalDQMBinningService::kSuperCrystal, EcalDQMBinningService::kTCC, EcalDQMBinningService::kTriggerTower, EcalDQMBinningService::nDCC, EcalElectronicsId::rawId(), EcalTriggerElectronicsId::tccId(), EcalElectronicsId::towerId(), and EcalTriggerElectronicsId::ttId().

217  {
218  switch(data_->btype){
220  return _id.rawId();
222  {
223  EcalTriggerElectronicsId teid(getElectronicsMap()->getTriggerElectronicsId(_id));
224  return EcalTriggerElectronicsId(teid.tccId(), teid.ttId(), 1, 1).rawId();
225  }
227  return EcalElectronicsId(_id.dccId(), _id.towerId(), 1, 1).rawId();
228  case BinService::kTCC:
229  {
230  EcalTriggerElectronicsId teid(getElectronicsMap()->getTriggerElectronicsId(_id));
231  return BinService::nDCC + teid.tccId();
232  }
233  case BinService::kDCC:
234  return _id.dccId();
235  default:
236  throw cms::Exception("InvalidConfiguration") << "MESetChannel configured with bin type " << data_->btype;
237  return 0;
238  }
239  }
const EcalElectronicsMapping * getElectronicsMap()
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
BinService::BinningType btype
Definition: MESet.h:23
MEData const * data_
Definition: MESet.h:133
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...
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().

100  {
101  if(readOnly_) return;
102 
103  if(_content == 0. && _entries == 0.){
104  mes_.clear();
105  meTable_.clear();
106  dqmStore_->rmdir(dir_);
107  return;
108  }
109 
110  for(unsigned iME(0); iME < mes_.size(); iME++){
111  mes_[iME]->setBinContent(1, _content);
112  mes_[iME]->setBinContent(1, _err);
114  mes_[iME]->setBinEntries(1, _entries);
115  }
116  }
bool readOnly_
Definition: MESet.h:136
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2535
MonitorElement::Kind kind
Definition: MESet.h:24
std::map< uint32_t, unsigned > meTable_
Definition: MESetChannel.h:42
static DQMStore * dqmStore_
Definition: MESet.h:127
std::vector< MonitorElement * > mes_
Definition: MESetChannel.h:41
std::string dir_
Definition: MESet.h:131
MEData const * data_
Definition: MESet.h:133
bool ecaldqm::MESetChannel::retrieve ( ) const
virtual

Reimplemented from ecaldqm::MESet.

Definition at line 21 of file MESetChannel.cc.

References ecaldqm::MESet::active_.

22  {
23  active_ = true;
24  return true;
25  }
bool active_
Definition: MESet.h:135
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.

68  {
69  uint32_t rawId(getIndex_(_id));
70 
71  std::map<uint32_t, unsigned>::iterator tableItr(meTable_.find(rawId));
72  if(tableItr == meTable_.end()){
74  tableItr = append_(name, rawId);
75  }
76  if(tableItr == meTable_.end()) return;
77 
78  mes_.at(tableItr->second)->setBinContent(1, _content);
79  mes_.at(tableItr->second)->setBinError(1, _err);
80  }
std::string channelName(uint32_t, BinningType _btype=kDCC) const
std::map< uint32_t, unsigned > meTable_
Definition: MESetChannel.h:42
std::vector< MonitorElement * > mes_
Definition: MESetChannel.h:41
std::map< uint32_t, unsigned >::iterator append_(std::string const &, uint32_t)
BinService::BinningType btype
Definition: MESet.h:23
uint32_t getIndex_(DetId const &) const
static BinService const * binService_
Definition: MESet.h:126
MEData const * data_
Definition: MESet.h:133
void name(std::map< std::string, std::string > const &) const
Definition: MESet.cc:240
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.

84  {
85  uint32_t rawId(getIndex_(_id));
86 
87  std::map<uint32_t, unsigned>::iterator tableItr(meTable_.find(rawId));
88  if(tableItr == meTable_.end()){
90  tableItr = append_(name, rawId);
91  }
92  if(tableItr == meTable_.end()) return;
93 
94  mes_.at(tableItr->second)->setBinContent(1, _content);
95  mes_.at(tableItr->second)->setBinError(1, _err);
96  }
std::string channelName(uint32_t, BinningType _btype=kDCC) const
std::map< uint32_t, unsigned > meTable_
Definition: MESetChannel.h:42
std::vector< MonitorElement * > mes_
Definition: MESetChannel.h:41
std::map< uint32_t, unsigned >::iterator append_(std::string const &, uint32_t)
BinService::BinningType btype
Definition: MESet.h:23
uint32_t getIndex_(DetId const &) const
static BinService const * binService_
Definition: MESet.h:126
MEData const * data_
Definition: MESet.h:133
void name(std::map< std::string, std::string > const &) const
Definition: MESet.cc:240

Member Data Documentation

std::vector<MonitorElement*> ecaldqm::MESetChannel::mes_
mutableprivate

Definition at line 41 of file MESetChannel.h.

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

std::map<uint32_t, unsigned> ecaldqm::MESetChannel::meTable_
mutableprivate

Definition at line 42 of file MESetChannel.h.

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

bool ecaldqm::MESetChannel::readMode_
mutableprivate

Definition at line 45 of file MESetChannel.h.