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 11 of file RPCLinkSynchroStat.h.

Member Typedef Documentation

◆ BoardAndCounts

Definition at line 68 of file RPCLinkSynchroStat.h.

Constructor & Destructor Documentation

◆ RPCLinkSynchroStat()

RPCLinkSynchroStat::RPCLinkSynchroStat ( bool  useFirstHitOnly)

Definition at line 116 of file RPCLinkSynchroStat.cc.

116  : theUseFirstHitOnly(useFirstFitOnly) {
117  for (unsigned int i1 = 0; i1 <= MAXDCCINDEX; ++i1) {
118  for (unsigned int i2 = 0; i2 <= MAXRBCINDEX; i2++) {
119  for (unsigned int i3 = 0; i3 <= MAXLINKINDEX; ++i3) {
120  for (unsigned int i4 = 0; i4 <= MAXLBINDEX; ++i4) {
121  theLinkStatNavi[i1][i2][i3][i4] = 0;
122  }
123  }
124  }
125  }
126  theLinkStatMap.push_back(std::make_pair(LinkBoard("Dummy"), SynchroCounts()));
127 }

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

◆ ~RPCLinkSynchroStat()

virtual RPCLinkSynchroStat::~RPCLinkSynchroStat ( )
inlinevirtual

Definition at line 15 of file RPCLinkSynchroStat.h.

15 {}

Member Function Documentation

◆ add() [1/2]

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

Definition at line 174 of file RPCLinkSynchroStat.cc.

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

References DCCINDEXSHIFT, hfClusterShapes_cfi::hits, heavyIonCSV_trainingSettings::idx, if(), gpuVertexFinder::iv, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, castor_dqm_sourceclient_file_cfg::path, Skims_PA_cff::paths, edmOneToOneComparison::problems, theLinkStatMap, theLinkStatNavi, theUseFirstHitOnly, and findQualityFiles::v.

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

◆ add() [2/2]

void RPCLinkSynchroStat::add ( const std::string &  lbName,
const unsigned int *  hits 
)

Definition at line 18 of file RPCLinkSynchroStat.cc.

18  {
19  LinkBoard lb(lbName);
20  SynchroCounts counts(hits);
21  for (auto it = theLinkStatMap.begin(); it != theLinkStatMap.end(); ++it)
22  if (it->first == lb)
23  it->second += counts;
24 }

References dqmiodumpmetadata::counts, hfClusterShapes_cfi::hits, and theLinkStatMap.

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

◆ dumpDelays()

std::string RPCLinkSynchroStat::dumpDelays ( )

Definition at line 210 of file RPCLinkSynchroStat.cc.

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

References RPCLinkSynchroStat::LinkBoard::chamberAndPartitions(), dqmiodumpmetadata::counts, spr::find(), heavyIonCSV_trainingSettings::idx, LogTrace, RPCLinkSynchroStat::LinkBoard::name(), Skims_PA_cff::paths, RPCLinkSynchroStat::LinkBoard::paths(), str, and theLinkStatMap.

◆ init()

void RPCLinkSynchroStat::init ( const RPCReadOutMapping theCabling,
bool  addChamberInfo 
)

Definition at line 129 of file RPCLinkSynchroStat.cc.

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

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

Referenced by RPCMonitorLinkSynchro::dqmBeginRun().

Friends And Related Function Documentation

◆ RPCLinkSynchroHistoMaker

friend class RPCLinkSynchroHistoMaker
friend

Definition at line 91 of file RPCLinkSynchroStat.h.

Member Data Documentation

◆ DCCINDEXSHIFT

const unsigned int RPCLinkSynchroStat::DCCINDEXSHIFT = 790
staticprotected

Definition at line 84 of file RPCLinkSynchroStat.h.

Referenced by add(), and init().

◆ MAXDCCINDEX

const unsigned int RPCLinkSynchroStat::MAXDCCINDEX = 2
staticprotected

Definition at line 83 of file RPCLinkSynchroStat.h.

Referenced by RPCLinkSynchroStat().

◆ MAXLBINDEX

const unsigned int RPCLinkSynchroStat::MAXLBINDEX = 2
staticprotected

Definition at line 87 of file RPCLinkSynchroStat.h.

Referenced by RPCLinkSynchroStat().

◆ MAXLINKINDEX

const unsigned int RPCLinkSynchroStat::MAXLINKINDEX = 17
staticprotected

Definition at line 86 of file RPCLinkSynchroStat.h.

Referenced by RPCLinkSynchroStat().

◆ MAXRBCINDEX

const unsigned int RPCLinkSynchroStat::MAXRBCINDEX = 35
staticprotected

Definition at line 85 of file RPCLinkSynchroStat.h.

Referenced by RPCLinkSynchroStat().

◆ theLinkStatMap

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

◆ theLinkStatNavi

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

Definition at line 88 of file RPCLinkSynchroStat.h.

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

◆ theUseFirstHitOnly

bool RPCLinkSynchroStat::theUseFirstHitOnly
protected

Definition at line 81 of file RPCLinkSynchroStat.h.

Referenced by add().

RPCLinkSynchroStat::MAXLINKINDEX
static const unsigned int MAXLINKINDEX
Definition: RPCLinkSynchroStat.h:86
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
testProducerWithPsetDescEmpty_cfi.i3
i3
Definition: testProducerWithPsetDescEmpty_cfi.py:47
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
gpuVertexFinder::iv
int32_t *__restrict__ iv
Definition: gpuClusterTracksDBSCAN.h:42
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
if
if(0==first)
Definition: CAHitNtupletGeneratorKernelsImpl.h:58
AlignmentPI::partitions
partitions
Definition: AlignmentPayloadInspectorHelper.h:48
findQualityFiles.v
v
Definition: findQualityFiles.py:179
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
LinkBoardElectronicIndex::dccInputChannelNum
int dccInputChannelNum
Definition: LinkBoardElectronicIndex.h:12
RPCLinkSynchroStat::LinkBoard::ChamberAndPartition
std::pair< std::string, std::string > ChamberAndPartition
Definition: RPCLinkSynchroStat.h:30
str
#define str(s)
Definition: TestProcessor.cc:53
RPCLinkSynchroStat::DCCINDEXSHIFT
static const unsigned int DCCINDEXSHIFT
Definition: RPCLinkSynchroStat.h:84
RPCLinkSynchroStat::MAXDCCINDEX
static const unsigned int MAXDCCINDEX
Definition: RPCLinkSynchroStat.h:83
RPCLinkSynchroStat::MAXLBINDEX
static const unsigned int MAXLBINDEX
Definition: RPCLinkSynchroStat.h:87
RPCLinkSynchroStat::BoardAndCounts
std::pair< LinkBoard, SynchroCounts > BoardAndCounts
Definition: RPCLinkSynchroStat.h:68
pfDeepBoostedJetPreprocessParams_cfi.lower_bound
lower_bound
Definition: pfDeepBoostedJetPreprocessParams_cfi.py:15
RPCLinkSynchroStat::MAXRBCINDEX
static const unsigned int MAXRBCINDEX
Definition: RPCLinkSynchroStat.h:85
FrameHeaderEvents_cfi.partitionName
partitionName
Definition: FrameHeaderEvents_cfi.py:5
RPCLinkSynchroStat::theLinkStatMap
std::vector< BoardAndCounts > theLinkStatMap
Definition: RPCLinkSynchroStat.h:89
RPCReadOutMapping::dccList
std::vector< const DccSpec * > dccList() const
all FEDs in map
Definition: RPCReadOutMapping.cc:26
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LinkBoardElectronicIndex
Definition: LinkBoardElectronicIndex.h:10
electronStore.links
links
Definition: electronStore.py:149
dqmiodumpmetadata.counts
counts
Definition: dqmiodumpmetadata.py:25
edmOneToOneComparison.problems
problems
Definition: edmOneToOneComparison.py:170
Skims_PA_cff.paths
paths
Definition: Skims_PA_cff.py:18
RPCLinkSynchroStat::theLinkStatNavi
unsigned int theLinkStatNavi[MAXDCCINDEX+1][MAXRBCINDEX+1][MAXLINKINDEX+1][MAXLBINDEX+1]
Definition: RPCLinkSynchroStat.h:88
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
RPCLinkSynchroStat::theUseFirstHitOnly
bool theUseFirstHitOnly
Definition: RPCLinkSynchroStat.h:81