CMS 3D CMS Logo

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

#include <DQM/SiStripMonitorCluster/interface/SiStripDaqInfo.h>

Inheritance diagram for SiStripDaqInfo:
edm::EDAnalyzer

Classes

struct  SubDetMEs
 

Public Member Functions

 SiStripDaqInfo (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~SiStripDaqInfo ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

void analyze (edm::Event const &, edm::EventSetup const &)
 Analyze. More...
 
void beginJob ()
 BeginJob. More...
 
void beginRun (edm::Run const &run, edm::EventSetup const &eSetup)
 Begin Run. More...
 
void bookStatus ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &iSetup)
 End Of Luminosity. More...
 
void endRun (edm::Run const &run, edm::EventSetup const &eSetup)
 EndRun. More...
 
void fillDummyStatus ()
 
void findExcludedModule (unsigned short fed_id)
 
void readFedIds (const edm::ESHandle< SiStripFedCabling > &fedcabling)
 
void readSubdetFedFractions (std::vector< int > &fed_ids)
 

Private Attributes

bool bookedStatus_
 
MonitorElementDaqFraction_
 
DQMStoredqmStore_
 
edm::ESHandle< SiStripFedCablingfedCabling_
 
unsigned long long m_cacheID_
 
int nFedTotal
 
std::map< std::string,
std::vector< unsigned short > > 
subDetFedMap
 
std::map< std::string, SubDetMEsSubDetMEsMap
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Description: Checks the # of SiStrip FEDs from DAQ Usage: <usage>

Definition at line 40 of file SiStripDaqInfo.h.

Constructor & Destructor Documentation

SiStripDaqInfo::SiStripDaqInfo ( const edm::ParameterSet ps)

Constructor.

Definition at line 32 of file SiStripDaqInfo.cc.

References bookedStatus_, dqmStore_, nFedTotal, and cppFunctionSkipper::operator.

32  {
33  // Create MessageSender
34  edm::LogInfo( "SiStripDaqInfo") << "SiStripDaqInfo::Deleting SiStripDaqInfo ";
35 
36  // get back-end interface
38  nFedTotal = 0;
39  bookedStatus_ = false;
40 }
DQMStore * dqmStore_
SiStripDaqInfo::~SiStripDaqInfo ( )
virtual

Destructor.

Definition at line 41 of file SiStripDaqInfo.cc.

41  {
42  edm::LogInfo("SiStripDaqInfo") << "SiStripDaqInfo::Deleting SiStripDaqInfo ";
43 
44 }

Member Function Documentation

void SiStripDaqInfo::analyze ( edm::Event const &  event,
edm::EventSetup const &  eSetup 
)
privatevirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 158 of file SiStripDaqInfo.cc.

158  {
159 }
void SiStripDaqInfo::beginJob ( void  )
privatevirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 48 of file SiStripDaqInfo.cc.

48  {
49 
50 }
void SiStripDaqInfo::beginRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
privatevirtual

Begin Run.

Reimplemented from edm::EDAnalyzer.

Definition at line 109 of file SiStripDaqInfo.cc.

References bookedStatus_, bookStatus(), DaqFraction_, fedCabling_, MonitorElement::Fill(), fillDummyStatus(), edm::EventSetup::find(), edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::EventSetup::get(), edm::ESHandleBase::isValid(), m_cacheID_, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, nFedTotal, readFedIds(), readSubdetFedFractions(), and MonitorElement::Reset().

109  {
110  edm::LogInfo ("SiStripDaqInfo") <<"SiStripDaqInfo:: Begining of Run";
111 
112  // Check latest Fed cabling and create TrackerMapCreator
113  unsigned long long cacheID = eSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
114  if (m_cacheID_ != cacheID) {
115  m_cacheID_ = cacheID;
116 
117  eSetup.get<SiStripFedCablingRcd>().get(fedCabling_);
118 
120  }
121  if (!bookedStatus_) bookStatus();
122  if (nFedTotal == 0) {
123  fillDummyStatus();
124  edm::LogInfo ("SiStripDaqInfo") <<" SiStripDaqInfo::No FEDs Connected!!!";
125  return;
126  }
127 
128  float nFEDConnected = 0.0;
129  const int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
130  const int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
131 
133  if( eSetup.find( recordKey ) != 0) {
134 
135  edm::ESHandle<RunInfo> sumFED;
136  eSetup.get<RunInfoRcd>().get(sumFED);
137 
138  if ( sumFED.isValid() ) {
139  std::vector<int> FedsInIds= sumFED->m_fed_in;
140  for(unsigned int it = 0; it < FedsInIds.size(); ++it) {
141  int fedID = FedsInIds[it];
142 
143  if(fedID>=siStripFedIdMin && fedID<=siStripFedIdMax) ++nFEDConnected;
144  }
145  edm::LogInfo ("SiStripDaqInfo") <<" SiStripDaqInfo::Total # of FEDs " << nFedTotal
146  << " Connected FEDs " << nFEDConnected;
147  if (nFEDConnected > 0) {
148  DaqFraction_->Reset();
149  DaqFraction_->Fill(nFEDConnected/nFedTotal);
150  readSubdetFedFractions(FedsInIds);
151  }
152  }
153  }
154 }
void readFedIds(const edm::ESHandle< SiStripFedCabling > &fedcabling)
void Fill(long long x)
edm::ESHandle< SiStripFedCabling > fedCabling_
void readSubdetFedFractions(std::vector< int > &fed_ids)
void fillDummyStatus()
MonitorElement * DaqFraction_
bool isValid() const
Definition: ESHandle.h:37
unsigned long long m_cacheID_
void Reset(void)
reset ME (ie. contents, errors, etc)
static HCTypeTag findType(char const *iTypeName)
find a type based on the types name, if not found will return default HCTypeTag
Definition: HCTypeTag.cc:129
void SiStripDaqInfo::bookStatus ( )
private

Definition at line 54 of file SiStripDaqInfo.cc.

References bookedStatus_, DQMStore::bookFloat(), DQMStore::cd(), SiStripDaqInfo::SubDetMEs::ConnectedFeds, DaqFraction_, SiStripDaqInfo::SubDetMEs::DaqFractionME, dqmStore_, SiStripUtility::getTopFolderPath(), DQMStore::setCurrentFolder(), and SubDetMEsMap.

Referenced by beginRun(), and fillDummyStatus().

54  {
55  edm::LogInfo( "SiStripDcsInfo") << " SiStripDaqInfo::bookStatus " << bookedStatus_;
56  if (!bookedStatus_) {
57  dqmStore_->cd();
58  std::string strip_dir = "";
59  SiStripUtility::getTopFolderPath(dqmStore_, "SiStrip", strip_dir);
60  if (strip_dir.size() > 0) dqmStore_->setCurrentFolder(strip_dir+"/EventInfo");
61  else dqmStore_->setCurrentFolder("SiStrip/EventInfo");
62 
63 
64  DaqFraction_= dqmStore_->bookFloat("DAQSummary");
65 
66  dqmStore_->cd();
67  if (strip_dir.size() > 0) dqmStore_->setCurrentFolder(strip_dir+"/EventInfo/DAQContents");
68  else dqmStore_->setCurrentFolder("SiStrip/EventInfo/DAQContents");
69 
70  std::vector<std::string> det_type;
71  det_type.push_back("TIB");
72  det_type.push_back("TOB");
73  det_type.push_back("TIDF");
74  det_type.push_back("TIDB");
75  det_type.push_back("TECF");
76  det_type.push_back("TECB");
77 
78  for ( std::vector<std::string>::iterator it = det_type.begin(); it != det_type.end(); it++) {
79  std::string det = (*it);
80 
81  SubDetMEs local_mes;
82  std::string me_name;
83  me_name = "SiStrip_" + det;
84  local_mes.DaqFractionME = dqmStore_->bookFloat(me_name);
85  local_mes.ConnectedFeds = 0;
86  SubDetMEsMap.insert(make_pair(det, local_mes));
87  }
88  bookedStatus_ = true;
89  dqmStore_->cd();
90  }
91 }
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:406
MonitorElement * bookFloat(const char *name)
Book float.
Definition: DQMStore.cc:654
DQMStore * dqmStore_
std::map< std::string, SubDetMEs > SubDetMEsMap
MonitorElement * DaqFraction_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
static void getTopFolderPath(DQMStore *dqm_store, std::string type, std::string &path)
void SiStripDaqInfo::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  iSetup 
)
privatevirtual

End Of Luminosity.

Reimplemented from edm::EDAnalyzer.

Definition at line 164 of file SiStripDaqInfo.cc.

164  {
165  edm::LogInfo( "SiStripDaqInfo") << "SiStripDaqInfo::endLuminosityBlock";
166 }
void SiStripDaqInfo::endRun ( edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
privatevirtual

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 170 of file SiStripDaqInfo.cc.

170  {
171  edm::LogInfo ("SiStripDaqInfo") <<"SiStripDaqInfo::EndRun";
172 }
void SiStripDaqInfo::fillDummyStatus ( )
private

Definition at line 95 of file SiStripDaqInfo.cc.

References bookedStatus_, bookStatus(), DaqFraction_, MonitorElement::Fill(), MonitorElement::Reset(), and SubDetMEsMap.

Referenced by beginRun().

95  {
96  if (!bookedStatus_) bookStatus();
97  if (bookedStatus_) {
98  for (std::map<std::string, SubDetMEs>::iterator it = SubDetMEsMap.begin(); it != SubDetMEsMap.end(); it++) {
99  it->second.DaqFractionME->Reset();
100  it->second.DaqFractionME->Fill(-1.0);
101  }
102  DaqFraction_->Reset();
103  DaqFraction_->Fill(-1.0);
104  }
105 }
void Fill(long long x)
std::map< std::string, SubDetMEs > SubDetMEsMap
MonitorElement * DaqFraction_
void Reset(void)
reset ME (ie. contents, errors, etc)
void SiStripDaqInfo::findExcludedModule ( unsigned short  fed_id)
private

Definition at line 244 of file SiStripDaqInfo.cc.

References DQMStore::bookInt(), DQMStore::cd(), DQMStore::dirExists(), dqmStore_, fedCabling_, MonitorElement::Fill(), DQMStore::get(), MonitorElement::getIntValue(), SiStripFolderOrganizer::getSubDetFolder(), SiStripUtility::goToDir(), DQMStore::pwd(), MonitorElement::Reset(), SiStripUtility::setBadModuleFlag(), DQMStore::setCurrentFolder(), and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by readSubdetFedFractions().

244  {
245  dqmStore_->cd();
246  std::string mdir = "MechanicalView";
247  if (!SiStripUtility::goToDir(dqmStore_, mdir)) {
248  dqmStore_->setCurrentFolder("SiStrip/"+mdir);
249  }
250  std::string mechanical_dir = dqmStore_->pwd();
251  const std::vector<FedChannelConnection> fedChannels = fedCabling_->connections(fed_id);
252  int ichannel = 0;
253  std::string tag = "ExcludedFedChannel";
254  std::string bad_module_folder;
255  for (std::vector<FedChannelConnection>::const_iterator iconn = fedChannels.begin();
256  iconn < fedChannels.end(); iconn++){
257  if (!iconn->isConnected()) continue;
258  uint32_t detId = iconn->detId();
259  if (detId == 0 || detId == 0xFFFFFFFF) continue;
260 
261  ichannel++;
262  if (ichannel == 1) {
263  std::string subdet_folder ;
264  SiStripFolderOrganizer folder_organizer;
265  folder_organizer.getSubDetFolder(detId,subdet_folder);
266  if (!dqmStore_->dirExists(subdet_folder)) {
267  subdet_folder = mechanical_dir + subdet_folder.substr(subdet_folder.find(mdir)+mdir.size());
268  }
269  bad_module_folder = subdet_folder + "/" + "BadModuleList";
270  dqmStore_->setCurrentFolder(bad_module_folder);
271  }
272  std::ostringstream detid_str;
273  detid_str << detId;
274  std::string full_path = bad_module_folder + "/" + detid_str.str();
275  MonitorElement* me = dqmStore_->get(full_path);
276  uint16_t flag = 0;
277  if (me) {
278  flag = me->getIntValue();
279  me->Reset();
280  } else me = dqmStore_->bookInt(detid_str.str());
282  me->Fill(flag);
283  }
284  dqmStore_->cd();
285 }
static void setBadModuleFlag(std::string &hname, uint16_t &flg)
long int flag
Definition: mlp_lapack.h:47
void getSubDetFolder(const uint32_t &detid, std::string &folder_name)
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:406
void Fill(long long x)
edm::ESHandle< SiStripFedCabling > fedCabling_
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
DQMStore * dqmStore_
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:493
int64_t getIntValue(void) const
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:624
void Reset(void)
reset ME (ie. contents, errors, etc)
static bool goToDir(DQMStore *dqm_store, std::string name)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
const std::string & pwd(void) const
Definition: DQMStore.cc:401
void SiStripDaqInfo::readFedIds ( const edm::ESHandle< SiStripFedCabling > &  fedcabling)
private

Definition at line 176 of file SiStripDaqInfo.cc.

References fedCabling_, SiStripUtility::getSubDetectorTag(), nFedTotal, xuti::subdet_tag(), and subDetFedMap.

Referenced by beginRun().

176  {
177  const std::vector<uint16_t>& feds = fedCabling_->feds();
178 
179  nFedTotal = feds.size();
180  for(std::vector<unsigned short>::const_iterator ifed = feds.begin(); ifed != feds.end(); ifed++){
181  const std::vector<FedChannelConnection> fedChannels = fedCabling_->connections( *ifed );
182  for (std::vector<FedChannelConnection>::const_iterator iconn = fedChannels.begin(); iconn < fedChannels.end(); iconn++){
183  if (!iconn->isConnected()) continue;
184  uint32_t detId = iconn->detId();
185  if (detId == 0 || detId == 0xFFFFFFFF) continue;
186  std::string subdet_tag;
187  SiStripUtility::getSubDetectorTag(detId,subdet_tag);
188  subDetFedMap[subdet_tag].push_back(*ifed);
189  break;
190  }
191  }
192 }
static void getSubDetectorTag(uint32_t det_id, std::string &subdet_tag)
edm::ESHandle< SiStripFedCabling > fedCabling_
const std::string subdet_tag("SubDet")
std::map< std::string, std::vector< unsigned short > > subDetFedMap
void SiStripDaqInfo::readSubdetFedFractions ( std::vector< int > &  fed_ids)
private

Definition at line 196 of file SiStripDaqInfo.cc.

References findExcludedModule(), python.multivaluedict::map(), FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, mergeVDriftHistosByStation::name, subDetFedMap, and SubDetMEsMap.

Referenced by beginRun().

196  {
197 
198  const int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
199  const int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
200 
201  // initialiase
202  for (std::map<std::string, std::vector<unsigned short> >::const_iterator it = subDetFedMap.begin();
203  it != subDetFedMap.end(); it++) {
204  std::string name = it->first;
205  std::map<std::string, SubDetMEs>::iterator iPos = SubDetMEsMap.find(name);
206  if (iPos == SubDetMEsMap.end()) continue;
207  iPos->second.ConnectedFeds = 0;
208  }
209  // count sub detector feds
210 
211 
212  for (std::map<std::string, std::vector<unsigned short> >::const_iterator it = subDetFedMap.begin();
213  it != subDetFedMap.end(); it++) {
214  std::string name = it->first;
215  std::vector<unsigned short> subdetIds = it->second;
216  std::map<std::string, SubDetMEs>::iterator iPos = SubDetMEsMap.find(name);
217  if (iPos == SubDetMEsMap.end()) continue;
218  iPos->second.ConnectedFeds = 0;
219  for (std::vector<unsigned short>::iterator iv = subdetIds.begin();
220  iv != subdetIds.end(); iv++) {
221  bool fedid_found = false;
222  for(unsigned int it = 0; it < fed_ids.size(); ++it) {
223  unsigned short fedID = fed_ids[it];
224  if(fedID < siStripFedIdMin || fedID > siStripFedIdMax) continue;
225  if ((*iv) == fedID) {
226  fedid_found = true;
227  iPos->second.ConnectedFeds++;
228  break;
229  }
230  }
231  if (!fedid_found) findExcludedModule((*iv));
232  }
233  int nFedsConnected = iPos->second.ConnectedFeds;
234  int nFedSubDet = subdetIds.size();
235  if (nFedSubDet > 0) {
236  iPos->second.DaqFractionME->Reset();
237  iPos->second.DaqFractionME->Fill(nFedsConnected*1.0/nFedSubDet);
238  }
239  }
240 }
std::map< std::string, SubDetMEs > SubDetMEsMap
std::map< std::string, std::vector< unsigned short > > subDetFedMap
void findExcludedModule(unsigned short fed_id)

Member Data Documentation

bool SiStripDaqInfo::bookedStatus_
private

Definition at line 89 of file SiStripDaqInfo.h.

Referenced by beginRun(), bookStatus(), fillDummyStatus(), and SiStripDaqInfo().

MonitorElement* SiStripDaqInfo::DaqFraction_
private

Definition at line 78 of file SiStripDaqInfo.h.

Referenced by beginRun(), bookStatus(), and fillDummyStatus().

DQMStore* SiStripDaqInfo::dqmStore_
private

Definition at line 77 of file SiStripDaqInfo.h.

Referenced by bookStatus(), findExcludedModule(), and SiStripDaqInfo().

edm::ESHandle< SiStripFedCabling > SiStripDaqInfo::fedCabling_
private

Definition at line 91 of file SiStripDaqInfo.h.

Referenced by beginRun(), findExcludedModule(), and readFedIds().

unsigned long long SiStripDaqInfo::m_cacheID_
private

Definition at line 87 of file SiStripDaqInfo.h.

Referenced by beginRun().

int SiStripDaqInfo::nFedTotal
private

Definition at line 88 of file SiStripDaqInfo.h.

Referenced by beginRun(), readFedIds(), and SiStripDaqInfo().

std::map<std::string,std::vector<unsigned short> > SiStripDaqInfo::subDetFedMap
private

Definition at line 75 of file SiStripDaqInfo.h.

Referenced by readFedIds(), and readSubdetFedFractions().

std::map<std::string, SubDetMEs> SiStripDaqInfo::SubDetMEsMap
private

Definition at line 85 of file SiStripDaqInfo.h.

Referenced by bookStatus(), fillDummyStatus(), and readSubdetFedFractions().