12 return o1.first < o2.first;
15 return o1.second.sum() < o2.second.sum();
27 for (
auto it = theChamberAndPartitions.begin(); it != theChamberAndPartitions.end(); ++it) {
31 theChamberAndPartitions.push_back(
part);
36 for (
auto it = theElePaths.begin(); it != theElePaths.end(); ++it) {
41 theElePaths.push_back(ele);
46 for (
unsigned int i = 0;
i < 8; ++
i)
54 theCounts[bxDiff] = 1;
63 for (
unsigned int i = 0;
i < 8; ++
i)
70 for (
unsigned int i = 0;
i < 8; ++
i)
77 for (
unsigned int i = 0;
i < 8; ++
i)
83 unsigned int sum = mom0();
84 return sum == 0 ? 0. : mom1() / sum;
92 double mean = mom1() / sum;
93 for (
int i = 0;
i < 8; ++
i)
100 std::ostringstream
str;
101 str <<
" mean: " << std::setw(8) <<
mean();
102 str <<
" rms: " << std::setw(8) <<
rms();
104 for (
int i = 0;
i < 8; ++
i)
105 str <<
" " << std::setw(4) << theCounts[
i];
110 for (
unsigned int idx = 0;
idx < 8; ++
idx)
111 if (theCounts[
idx] !=
o.theCounts[
idx])
120 for (
unsigned int i4 = 0; i4 <=
MAXLBINDEX; ++i4) {
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());
144 std::vector<BoardAndCounts>::iterator candid_place =
146 if (candid_place !=
theLinkStatMap.end() && candid.first == candid_place->first) {
147 candid_place->first.add(ele);
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();
157 candid_place->first.add(chamberAndPartition);
167 for (
auto it =
paths.begin(); it !=
paths.end(); ++it) {
176 std::vector<ShortLinkInfo> slis;
177 for (
auto it = vItem.begin(); it != vItem.end(); ++it) {
179 unsigned int bxDiff = it->second;
181 path.tbLinkInputNum * 10 +
path.lbNumInLink;
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);
194 slis[
hits[
idx] - 1].counts.set(bxDiff);
197 for (
auto ic = slis.begin(); ic != slis.end(); ++ic) {
203 if (
theLinkStatMap[ic->idx].first.paths().size() != ic->hit_paths.size()) {
204 const std::vector<LinkBoardElectronicIndex>&
paths =
theLinkStatMap[ic->idx].first.paths();
211 std::ostringstream
str;
213 stable_sort(sortedStat.begin(), sortedStat.end(),
LessCountSum());
214 for (
unsigned int idx = 0;
idx < sortedStat.size(); ++
idx) {
219 str << std::setw(20) << board.
name();
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 <<
"}";
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];
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) {
244 if ((ip + 1) != (im->second.end()))
253 LogTrace(
"RPCLinkSynchroStat") <<
"RPCLinkSynchroStat::dumpDelays, SIZE OF LINKS IS: " <<
theLinkStatMap.size()
bool operator()(const BoardAndCounts &o1, const BoardAndCounts &o2)
const std::string & name() const
void init(const RPCReadOutMapping *theCabling, bool addChamberInfo)
std::string print() const
bool operator()(const BoardAndCounts &o1, const BoardAndCounts &o2)
unsigned int theLinkStatNavi[MAXDCCINDEX+1][MAXRBCINDEX+1][MAXLINKINDEX+1][MAXLBINDEX+1]
std::pair< std::string, std::string > ChamberAndPartition
static const unsigned int MAXLINKINDEX
void increment(unsigned int bxDiff)
const std::vector< ChamberAndPartition > & chamberAndPartitions() const
static const unsigned int MAXLBINDEX
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
unsigned int firstHit() const
std::pair< LinkBoard, SynchroCounts > BoardAndCounts
RPCLinkSynchroStat(bool useFirstHitOnly)
SynchroCounts & operator+=(const SynchroCounts &rhs)
std::vector< std::pair< LinkBoardElectronicIndex, int > > ProdItem
static const unsigned int MAXRBCINDEX
void set(unsigned int bxDiff)
std::vector< const DccSpec * > dccList() const
all FEDs in map
static const unsigned int DCCINDEXSHIFT
bool operator==(const SynchroCounts &) const
const std::vector< LinkBoardElectronicIndex > & paths() const
void add(const RPCRawSynchro::ProdItem &counts, std::vector< LinkBoardElectronicIndex > &problems)
static const unsigned int MAXDCCINDEX
int add(const ChamberAndPartition &part)
std::vector< unsigned int > theCounts
std::vector< BoardAndCounts > theLinkStatMap
unsigned int mom0() const