test
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 | 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,
SynchroCounts
BoardAndCounts
 

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 103 of file RPCLinkSynchroStat.cc.

References MAXDCCINDEX, MAXLBINDEX, MAXLINKINDEX, MAXRBCINDEX, theLinkStatMap, and theLinkStatNavi.

104  : theUseFirstHitOnly(useFirstFitOnly)
105 {
106  for (unsigned int i1=0; i1<=MAXDCCINDEX; ++i1) {
107  for (unsigned int i2=0; i2<=MAXRBCINDEX; i2++) {
108  for (unsigned int i3=0; i3 <=MAXLINKINDEX; ++i3) {
109  for (unsigned int i4=0; i4<=MAXLBINDEX; ++i4) {
110  theLinkStatNavi[i1][i2][i3][i4]=0;
111  }
112  }
113  }
114  }
115  theLinkStatMap.push_back( std::make_pair(LinkBoard("Dummy"), SynchroCounts()) );
116 }
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

Definition at line 17 of file RPCLinkSynchroStat.h.

17 {}

Member Function Documentation

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

Definition at line 162 of file RPCLinkSynchroStat.cc.

References LinkBoardElectronicIndex::dccId, DCCINDEXSHIFT, LinkBoardElectronicIndex::dccInputChannelNum, customizeTrackingMonitorSeedNumber::idx, reco::if(), LinkBoardElectronicIndex::lbNumInLink, fed_dqm_sourceclient-live_cfg::path, mergeAndRegister::paths, LinkBoardElectronicIndex::tbLinkInputNum, theLinkStatMap, theLinkStatNavi, theUseFirstHitOnly, and findQualityFiles::v.

Referenced by RPCMonitorLinkSynchro::analyze(), and counter.Counter::register().

163 {
164  std::vector< int > hits(theLinkStatMap.size(),0);
165  std::vector<ShortLinkInfo> slis;
166  for ( RPCRawSynchro::ProdItem::const_iterator it = vItem.begin(); it != vItem.end(); ++it) {
167  const LinkBoardElectronicIndex & path = it->first;
168  unsigned int bxDiff = it->second;
169  unsigned int eleCode = (path.dccId-DCCINDEXSHIFT)*100000 + path.dccInputChannelNum*1000 + path.tbLinkInputNum*10+path.lbNumInLink;
170  unsigned int idx = theLinkStatNavi[path.dccId-DCCINDEXSHIFT][path.dccInputChannelNum][path.tbLinkInputNum][path.lbNumInLink];
171  if (hits[idx]==0) {
172  ShortLinkInfo sli = { idx, std::vector<unsigned int>(1, eleCode), SynchroCounts() };
173  slis.push_back( sli );
174  hits[idx]=slis.size();
175  }
176  else {
177  std::vector<unsigned int> & v = slis[hits[idx]-1].hit_paths;
178  std::vector<unsigned int>::iterator iv = lower_bound (v.begin(), v.end(), eleCode);
179  if (iv == v.end() || (*iv) != eleCode) v.insert(iv,eleCode);
180  }
181  slis[hits[idx]-1].counts.set(bxDiff); // ensure one count per LB per BX
182  }
183 
184  for (std::vector<ShortLinkInfo>::const_iterator ic = slis.begin(); ic !=slis.end(); ++ic) {
185  if (theUseFirstHitOnly) {
186  theLinkStatMap[ic->idx].second.increment( ic->counts.firstHit() ); // first hit only
187  } else {
188  theLinkStatMap[ic->idx].second += ic->counts;
189  }
190  if (theLinkStatMap[ ic->idx].first.paths().size() != ic->hit_paths.size()) {
191  const std::vector<LinkBoardElectronicIndex> & paths = theLinkStatMap[ ic->idx].first.paths();
192  problems.insert(problems.end(),paths.begin(),paths.end());
193  }
194  }
195 
196 }
unsigned int theLinkStatNavi[MAXDCCINDEX+1][MAXRBCINDEX+1][MAXLINKINDEX+1][MAXLBINDEX+1]
static const unsigned int DCCINDEXSHIFT
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
if(dp >Float(M_PI)) dp-
std::vector< BoardAndCounts > theLinkStatMap
void RPCLinkSynchroStat::add ( const std::string &  lbName,
const unsigned int *  hits 
)

Definition at line 14 of file RPCLinkSynchroStat.cc.

References theLinkStatMap.

Referenced by counter.Counter::register().

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

Definition at line 198 of file RPCLinkSynchroStat.cc.

References RPCLinkSynchroStat::LinkBoard::chamberAndPartitions(), spr::find(), customizeTrackingMonitorSeedNumber::idx, LogTrace, RPCLinkSynchroStat::LinkBoard::name(), RPCLinkSynchroStat::LinkBoard::paths(), mergeAndRegister::paths, RPCLinkSynchroStat::SynchroCounts::print(), AlCaHLTBitMon_QueryRunRegistry::string, and theLinkStatMap.

199 {
200  std::ostringstream str;
201  std::vector<BoardAndCounts> sortedStat = theLinkStatMap;
202  stable_sort(sortedStat.begin(),sortedStat.end(),LessCountSum());
203  for (unsigned int idx=0; idx<sortedStat.size(); ++idx) {
204  const LinkBoard & board = sortedStat[idx].first;
205  const SynchroCounts & counts = sortedStat[idx].second;
206 
207  // DUMP LINKNAME
208  str << std::setw(20) << board.name();
209 
210  // DUMP COUNTS
211  str <<" "<<counts.print();
212 
213  //PATHS
214  str <<" paths: ";
215  const std::vector<LinkBoardElectronicIndex> & paths=board.paths();
216  for (std::vector<LinkBoardElectronicIndex>::const_iterator ip=paths.begin(); ip!=paths.end();++ip)
217  str<<"{"<<ip->dccId<<","<<std::setw(2)<<ip->dccInputChannelNum<<","<<std::setw(2)<<ip->tbLinkInputNum<<","<<ip->lbNumInLink<<"}";
218 
219  // DUMP CHAMBERS
220  std::map<std::string,std::vector<std::string> > chMap;
221  const std::vector<LinkBoard::ChamberAndPartition> & chamberAndPartitions = board.chamberAndPartitions();
222  for (std::vector<LinkBoard::ChamberAndPartition>::const_iterator it=chamberAndPartitions.begin(); it!=chamberAndPartitions.end();++it) {
223  std::vector<std::string> & partitions = chMap[it->first];
224  if (find(partitions.begin(), partitions.end(), it->second) == partitions.end()) partitions.push_back(it->second);
225  }
226  str << " chambers: ";
227  for (std::map<std::string,std::vector<std::string> >::const_iterator im=chMap.begin(); im != chMap.end(); ++im) {
228  str <<im->first<<"(";
229  for (std::vector<std::string>::const_iterator ip=im->second.begin(); ip != im->second.end(); ++ip) { str << *ip; if ((ip+1)!= (im->second.end()) ) str<<","; else str <<")"; }
230  }
231 
232 
233  str <<std::endl;
234  }
235  LogTrace("RPCLinkSynchroStat") <<"RPCLinkSynchroStat::dumpDelays, SIZE OF LINKS IS: " << theLinkStatMap.size() << std::endl;
236  return str.str();
237 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
#define LogTrace(id)
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
std::vector< BoardAndCounts > theLinkStatMap
void RPCLinkSynchroStat::init ( const RPCReadOutMapping theCabling,
bool  addChamberInfo 
)

Definition at line 118 of file RPCLinkSynchroStat.cc.

References DCCINDEXSHIFT, LinkBoardElectronicIndex::dccInputChannelNum, RPCReadOutMapping::dccList(), customizeTrackingMonitorSeedNumber::idx, electronStore::links, mergeAndRegister::paths, AlCaHLTBitMon_QueryRunRegistry::string, theLinkStatMap, and theLinkStatNavi.

Referenced by RPCMonitorLinkSynchro::dqmBeginRun().

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

Friends And Related Function Documentation

friend class RPCLinkSynchroHistoMaker
friend

Definition at line 84 of file RPCLinkSynchroStat.h.

Member Data Documentation

const unsigned int RPCLinkSynchroStat::DCCINDEXSHIFT =790
staticprotected

Definition at line 77 of file RPCLinkSynchroStat.h.

Referenced by add(), and init().

const unsigned int RPCLinkSynchroStat::MAXDCCINDEX =2
staticprotected

Definition at line 76 of file RPCLinkSynchroStat.h.

Referenced by RPCLinkSynchroStat().

const unsigned int RPCLinkSynchroStat::MAXLBINDEX =2
staticprotected

Definition at line 80 of file RPCLinkSynchroStat.h.

Referenced by RPCLinkSynchroStat().

const unsigned int RPCLinkSynchroStat::MAXLINKINDEX =17
staticprotected

Definition at line 79 of file RPCLinkSynchroStat.h.

Referenced by RPCLinkSynchroStat().

const unsigned int RPCLinkSynchroStat::MAXRBCINDEX =35
staticprotected

Definition at line 78 of file RPCLinkSynchroStat.h.

Referenced by RPCLinkSynchroStat().

std::vector<BoardAndCounts> RPCLinkSynchroStat::theLinkStatMap
protected
unsigned int RPCLinkSynchroStat::theLinkStatNavi[MAXDCCINDEX+1][MAXRBCINDEX+1][MAXLINKINDEX+1][MAXLBINDEX+1]
protected

Definition at line 81 of file RPCLinkSynchroStat.h.

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

bool RPCLinkSynchroStat::theUseFirstHitOnly
protected

Definition at line 74 of file RPCLinkSynchroStat.h.

Referenced by add().