CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Types | Protected Attributes | Static Protected Attributes | Friends
RPCLinkSynchroStat Class Reference

#include <RPCLinkSynchroStat.h>

Classes

struct  LessCountSum
 
struct  LessLinkName
 
class  LinkBoard
 
struct  ShortLinkInfo
 
class  SynchroCounts
 

Public Member Functions

void add (const RPCRawSynchro::ProdItem &counts, std::vector< LinkBoardElectronicIndex > &problems)
 
void add (const std::string &lbName, const unsigned int *hits)
 
std::string dumpDelays ()
 
void init (const RPCReadOutMapping *theCabling, bool addChamberInfo)
 
 RPCLinkSynchroStat (bool useFirstHitOnly)
 
virtual ~RPCLinkSynchroStat ()
 

Protected Types

typedef std::pair< LinkBoard, SynchroCountsBoardAndCounts
 

Protected Attributes

std::vector< BoardAndCountstheLinkStatMap
 
unsigned int theLinkStatNavi [MAXDCCINDEX+1][MAXRBCINDEX+1][MAXLINKINDEX+1][MAXLBINDEX+1]
 
bool theUseFirstHitOnly
 

Static Protected Attributes

static const unsigned int DCCINDEXSHIFT = 790
 
static const unsigned int MAXDCCINDEX = 2
 
static const unsigned int MAXLBINDEX = 2
 
static const unsigned int MAXLINKINDEX = 17
 
static const unsigned int MAXRBCINDEX = 35
 

Friends

class RPCLinkSynchroHistoMaker
 

Detailed Description

Definition at line 12 of file RPCLinkSynchroStat.h.

Member Typedef Documentation

Definition at line 69 of file RPCLinkSynchroStat.h.

Constructor & Destructor Documentation

RPCLinkSynchroStat::RPCLinkSynchroStat ( bool  useFirstHitOnly)

Definition at line 118 of file RPCLinkSynchroStat.cc.

References testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, testProducerWithPsetDescEmpty_cfi::i3, MAXDCCINDEX, MAXLBINDEX, MAXLINKINDEX, MAXRBCINDEX, theLinkStatMap, and theLinkStatNavi.

118  : theUseFirstHitOnly(useFirstFitOnly) {
119  for (unsigned int i1 = 0; i1 <= MAXDCCINDEX; ++i1) {
120  for (unsigned int i2 = 0; i2 <= MAXRBCINDEX; i2++) {
121  for (unsigned int i3 = 0; i3 <= MAXLINKINDEX; ++i3) {
122  for (unsigned int i4 = 0; i4 <= MAXLBINDEX; ++i4) {
123  theLinkStatNavi[i1][i2][i3][i4] = 0;
124  }
125  }
126  }
127  }
128  theLinkStatMap.push_back(std::make_pair(LinkBoard("Dummy"), SynchroCounts()));
129 }
unsigned int theLinkStatNavi[MAXDCCINDEX+1][MAXRBCINDEX+1][MAXLINKINDEX+1][MAXLBINDEX+1]
static const unsigned int MAXLINKINDEX
static const unsigned int MAXLBINDEX
static const unsigned int MAXRBCINDEX
static const unsigned int MAXDCCINDEX
std::vector< BoardAndCounts > theLinkStatMap
virtual RPCLinkSynchroStat::~RPCLinkSynchroStat ( )
inlinevirtual

Member Function Documentation

void RPCLinkSynchroStat::add ( const RPCRawSynchro::ProdItem counts,
std::vector< LinkBoardElectronicIndex > &  problems 
)

Definition at line 176 of file RPCLinkSynchroStat.cc.

References LinkBoardElectronicIndex::dccId, DCCINDEXSHIFT, LinkBoardElectronicIndex::dccInputChannelNum, hfClusterShapes_cfi::hits, training_settings::idx, LinkBoardElectronicIndex::lbNumInLink, castor_dqm_sourceclient_file_cfg::path, Skims_PA_cff::paths, LinkBoardElectronicIndex::tbLinkInputNum, theLinkStatMap, theLinkStatNavi, theUseFirstHitOnly, and findQualityFiles::v.

Referenced by RPCMonitorLinkSynchro::analyze(), counter.Counter::register(), SequenceTypes.Task::remove(), SequenceTypes.Task::replace(), and ~RPCLinkSynchroStat().

176  {
177  std::vector<int> hits(theLinkStatMap.size(), 0);
178  std::vector<ShortLinkInfo> slis;
179  for (RPCRawSynchro::ProdItem::const_iterator it = vItem.begin(); it != vItem.end(); ++it) {
180  const LinkBoardElectronicIndex& path = it->first;
181  unsigned int bxDiff = it->second;
182  unsigned int eleCode = (path.dccId - DCCINDEXSHIFT) * 100000 + path.dccInputChannelNum * 1000 +
183  path.tbLinkInputNum * 10 + path.lbNumInLink;
184  unsigned int idx =
186  if (hits[idx] == 0) {
187  ShortLinkInfo sli = {idx, std::vector<unsigned int>(1, eleCode), SynchroCounts()};
188  slis.push_back(sli);
189  hits[idx] = slis.size();
190  } else {
191  std::vector<unsigned int>& v = slis[hits[idx] - 1].hit_paths;
192  std::vector<unsigned int>::iterator iv = lower_bound(v.begin(), v.end(), eleCode);
193  if (iv == v.end() || (*iv) != eleCode)
194  v.insert(iv, eleCode);
195  }
196  slis[hits[idx] - 1].counts.set(bxDiff); // ensure one count per LB per BX
197  }
198 
199  for (std::vector<ShortLinkInfo>::const_iterator ic = slis.begin(); ic != slis.end(); ++ic) {
200  if (theUseFirstHitOnly) {
201  theLinkStatMap[ic->idx].second.increment(ic->counts.firstHit()); // first hit only
202  } else {
203  theLinkStatMap[ic->idx].second += ic->counts;
204  }
205  if (theLinkStatMap[ic->idx].first.paths().size() != ic->hit_paths.size()) {
206  const std::vector<LinkBoardElectronicIndex>& paths = theLinkStatMap[ic->idx].first.paths();
207  problems.insert(problems.end(), paths.begin(), paths.end());
208  }
209  }
210 }
unsigned int theLinkStatNavi[MAXDCCINDEX+1][MAXRBCINDEX+1][MAXLINKINDEX+1][MAXLBINDEX+1]
static const unsigned int DCCINDEXSHIFT
std::vector< BoardAndCounts > theLinkStatMap
void RPCLinkSynchroStat::add ( const std::string &  lbName,
const unsigned int *  hits 
)

Definition at line 18 of file RPCLinkSynchroStat.cc.

References dqmiodumpmetadata::counts, and theLinkStatMap.

Referenced by counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

18  {
19  LinkBoard lb(lbName);
20  SynchroCounts counts(hits);
21  for (std::vector<BoardAndCounts>::iterator it = theLinkStatMap.begin(); it != theLinkStatMap.end(); ++it)
22  if (it->first == lb)
23  it->second += counts;
24 }
std::vector< BoardAndCounts > theLinkStatMap
std::string RPCLinkSynchroStat::dumpDelays ( )

Definition at line 212 of file RPCLinkSynchroStat.cc.

References RPCLinkSynchroStat::LinkBoard::chamberAndPartitions(), dqmiodumpmetadata::counts, spr::find(), training_settings::idx, LogTrace, genParticles_cff::map, RPCLinkSynchroStat::LinkBoard::name(), Skims_PA_cff::paths, RPCLinkSynchroStat::LinkBoard::paths(), RPCLinkSynchroStat::SynchroCounts::print(), str, AlCaHLTBitMon_QueryRunRegistry::string, and theLinkStatMap.

Referenced by ~RPCLinkSynchroStat().

212  {
213  std::ostringstream str;
214  std::vector<BoardAndCounts> sortedStat = theLinkStatMap;
215  stable_sort(sortedStat.begin(), sortedStat.end(), LessCountSum());
216  for (unsigned int idx = 0; idx < sortedStat.size(); ++idx) {
217  const LinkBoard& board = sortedStat[idx].first;
218  const SynchroCounts& counts = sortedStat[idx].second;
219 
220  // DUMP LINKNAME
221  str << std::setw(20) << board.name();
222 
223  // DUMP COUNTS
224  str << " " << counts.print();
225 
226  //PATHS
227  str << " paths: ";
228  const std::vector<LinkBoardElectronicIndex>& paths = board.paths();
229  for (std::vector<LinkBoardElectronicIndex>::const_iterator ip = paths.begin(); ip != paths.end(); ++ip)
230  str << "{" << ip->dccId << "," << std::setw(2) << ip->dccInputChannelNum << "," << std::setw(2)
231  << ip->tbLinkInputNum << "," << ip->lbNumInLink << "}";
232 
233  // DUMP CHAMBERS
234  std::map<std::string, std::vector<std::string> > chMap;
235  const std::vector<LinkBoard::ChamberAndPartition>& chamberAndPartitions = board.chamberAndPartitions();
236  for (std::vector<LinkBoard::ChamberAndPartition>::const_iterator it = chamberAndPartitions.begin();
237  it != chamberAndPartitions.end();
238  ++it) {
239  std::vector<std::string>& partitions = chMap[it->first];
240  if (find(partitions.begin(), partitions.end(), it->second) == partitions.end())
241  partitions.push_back(it->second);
242  }
243  str << " chambers: ";
244  for (std::map<std::string, std::vector<std::string> >::const_iterator im = chMap.begin(); im != chMap.end(); ++im) {
245  str << im->first << "(";
246  for (std::vector<std::string>::const_iterator ip = im->second.begin(); ip != im->second.end(); ++ip) {
247  str << *ip;
248  if ((ip + 1) != (im->second.end()))
249  str << ",";
250  else
251  str << ")";
252  }
253  }
254 
255  str << std::endl;
256  }
257  LogTrace("RPCLinkSynchroStat") << "RPCLinkSynchroStat::dumpDelays, SIZE OF LINKS IS: " << theLinkStatMap.size()
258  << std::endl;
259  return str.str();
260 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
#define LogTrace(id)
std::vector< BoardAndCounts > theLinkStatMap
#define str(s)
void RPCLinkSynchroStat::init ( const RPCReadOutMapping theCabling,
bool  addChamberInfo 
)

Definition at line 131 of file RPCLinkSynchroStat.cc.

References DCCINDEXSHIFT, LinkBoardElectronicIndex::dccInputChannelNum, RPCReadOutMapping::dccList(), training_settings::idx, electronStore::links, FrameHeaderEvents_cfi::partitionName, Skims_PA_cff::paths, AlCaHLTBitMon_QueryRunRegistry::string, theLinkStatMap, and theLinkStatNavi.

Referenced by RPCMonitorLinkSynchro::dqmBeginRun(), and ~RPCLinkSynchroStat().

131  {
132  if (!theCabling)
133  return;
134  std::vector<const DccSpec*> dccs = theCabling->dccList();
135  for (std::vector<const DccSpec*>::const_iterator it1 = dccs.begin(); it1 != dccs.end(); ++it1) {
136  const std::vector<TriggerBoardSpec>& rmbs = (*it1)->triggerBoards();
137  for (std::vector<TriggerBoardSpec>::const_iterator it2 = rmbs.begin(); it2 != rmbs.end(); ++it2) {
138  const std::vector<LinkConnSpec>& links = it2->linkConns();
139  for (std::vector<LinkConnSpec>::const_iterator it3 = links.begin(); it3 != links.end(); ++it3) {
140  const std::vector<LinkBoardSpec>& lbs = it3->linkBoards();
141  for (std::vector<LinkBoardSpec>::const_iterator it4 = lbs.begin(); it4 != lbs.end(); ++it4) {
143  (*it1)->id(), it2->dccInputChannelNum(), it3->triggerBoardInputNumber(), it4->linkBoardNumInLink()};
144  LinkBoard linkBoard(it4->linkBoardName());
145  BoardAndCounts candid = std::make_pair(linkBoard, SynchroCounts());
146  std::vector<BoardAndCounts>::iterator candid_place =
147  lower_bound(theLinkStatMap.begin(), theLinkStatMap.end(), candid, LessLinkName());
148  if (candid_place != theLinkStatMap.end() && candid.first == candid_place->first) {
149  candid_place->first.add(ele);
150  } else {
151  candid_place = theLinkStatMap.insert(candid_place, candid);
152  candid_place->first.add(ele);
153  if (addChamberInfo) {
154  const std::vector<FebConnectorSpec>& febs = it4->febs();
155  for (std::vector<FebConnectorSpec>::const_iterator it5 = febs.begin(); it5 != febs.end(); ++it5) {
156  std::string chamberName = it5->chamber().chamberLocationName();
157  std::string partitionName = it5->feb().localEtaPartitionName();
158  LinkBoard::ChamberAndPartition chamberAndPartition = std::make_pair(chamberName, partitionName);
159  candid_place->first.add(chamberAndPartition);
160  }
161  }
162  }
163  }
164  }
165  }
166  }
167  for (unsigned int idx = 0; idx < theLinkStatMap.size(); ++idx) {
168  const std::vector<LinkBoardElectronicIndex>& paths = theLinkStatMap[idx].first.paths();
169  for (std::vector<LinkBoardElectronicIndex>::const_iterator it = paths.begin(); it != paths.end(); ++it) {
170  theLinkStatNavi[it->dccId - DCCINDEXSHIFT][it->dccInputChannelNum][it->tbLinkInputNum][it->lbNumInLink] = idx;
171  }
172  }
173  // LogTrace("RPCLinkSynchroStat") <<" SIZE OF LINKS IS: " << theLinkStatMap.size() << endl;
174 }
unsigned int theLinkStatNavi[MAXDCCINDEX+1][MAXRBCINDEX+1][MAXLINKINDEX+1][MAXLBINDEX+1]
std::pair< std::string, std::string > ChamberAndPartition
std::vector< const DccSpec * > dccList() const
all FEDs in map
std::pair< LinkBoard, SynchroCounts > BoardAndCounts
static const unsigned int DCCINDEXSHIFT
std::vector< BoardAndCounts > theLinkStatMap

Friends And Related Function Documentation

friend class RPCLinkSynchroHistoMaker
friend

Definition at line 92 of file RPCLinkSynchroStat.h.

Member Data Documentation

const unsigned int RPCLinkSynchroStat::DCCINDEXSHIFT = 790
staticprotected

Definition at line 85 of file RPCLinkSynchroStat.h.

Referenced by add(), and init().

const unsigned int RPCLinkSynchroStat::MAXDCCINDEX = 2
staticprotected

Definition at line 84 of file RPCLinkSynchroStat.h.

Referenced by RPCLinkSynchroStat().

const unsigned int RPCLinkSynchroStat::MAXLBINDEX = 2
staticprotected

Definition at line 88 of file RPCLinkSynchroStat.h.

Referenced by RPCLinkSynchroStat().

const unsigned int RPCLinkSynchroStat::MAXLINKINDEX = 17
staticprotected

Definition at line 87 of file RPCLinkSynchroStat.h.

Referenced by RPCLinkSynchroStat().

const unsigned int RPCLinkSynchroStat::MAXRBCINDEX = 35
staticprotected

Definition at line 86 of file RPCLinkSynchroStat.h.

Referenced by RPCLinkSynchroStat().

std::vector<BoardAndCounts> RPCLinkSynchroStat::theLinkStatMap
protected

Definition at line 90 of file RPCLinkSynchroStat.h.

Referenced by add(), dumpDelays(), init(), and RPCLinkSynchroStat().

unsigned int RPCLinkSynchroStat::theLinkStatNavi[MAXDCCINDEX+1][MAXRBCINDEX+1][MAXLINKINDEX+1][MAXLBINDEX+1]
protected

Definition at line 89 of file RPCLinkSynchroStat.h.

Referenced by add(), init(), and RPCLinkSynchroStat().

bool RPCLinkSynchroStat::theUseFirstHitOnly
protected

Definition at line 82 of file RPCLinkSynchroStat.h.

Referenced by add().