1 |
konec |
1.1 |
#include "UserCode/L1RpcTriggerAnalysis/interface/Pattern.h"
|
2 |
|
|
|
3 |
|
|
#include "DataFormats/MuonDetId/interface/MuonSubdetId.h"
|
4 |
|
|
#include "DataFormats/MuonDetId/interface/RPCDetId.h"
|
5 |
|
|
#include "DataFormats/MuonDetId/interface/CSCDetId.h"
|
6 |
|
|
#include "DataFormats/MuonDetId/interface/DTChamberId.h"
|
7 |
|
|
#include "UserCode/L1RpcTriggerAnalysis/interface/RPCDetIdUtil.h"
|
8 |
|
|
#include "UserCode/L1RpcTriggerAnalysis/interface/DTphDigiSpec.h"
|
9 |
|
|
#include "UserCode/L1RpcTriggerAnalysis/interface/CSCDigiSpec.h"
|
10 |
|
|
#include "UserCode/L1RpcTriggerAnalysis/interface/RPCDigiSpec.h"
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
bool Pattern::add ( std::pair<uint32_t, unsigned int > aData)
|
14 |
|
|
{
|
15 |
|
|
for (DataType::const_iterator it=theData.begin(); it!= theData.end(); it++) {
|
16 |
|
|
if (it->first == aData.first) {
|
17 |
|
|
return false;
|
18 |
|
|
}
|
19 |
|
|
}
|
20 |
|
|
theData.push_back(aData);
|
21 |
|
|
return true;
|
22 |
|
|
}
|
23 |
|
|
|
24 |
konec |
1.2 |
bool Pattern::add ( std::vector<Pattern> & vpat, std::pair<uint32_t, unsigned int > aData)
|
25 |
|
|
{
|
26 |
|
|
bool allOK = true;
|
27 |
|
|
std::vector<Pattern> copied;
|
28 |
|
|
for (std::vector<Pattern>::iterator ip = vpat.begin(); ip != vpat.end(); ++ip) {
|
29 |
|
|
if (! ip->add(aData) ) {
|
30 |
|
|
allOK = false;
|
31 |
|
|
Pattern modified = *ip;
|
32 |
|
|
for (auto ic =modified.theData.begin(); ic!=modified.theData.end(); ic++) {
|
33 |
|
|
if (ic->first==aData.first) {ic->second = aData.second; break; }
|
34 |
|
|
}
|
35 |
|
|
copied.push_back(modified);
|
36 |
|
|
}
|
37 |
|
|
}
|
38 |
|
|
if (copied.size() != 0) vpat.insert(vpat.end(), copied.begin(), copied.end());
|
39 |
|
|
return allOK;
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
konec |
1.1 |
std::ostream & operator << (std::ostream &out, const Pattern &o)
|
45 |
|
|
{
|
46 |
|
|
out <<" Pattern: size: "<<o.size();
|
47 |
|
|
for (Pattern::DataType::const_iterator it=o.theData.begin(); it!= o.theData.end(); it++) {
|
48 |
|
|
DetId detId( it->first);
|
49 |
|
|
switch (detId.subdetId()) {
|
50 |
|
|
case MuonSubdetId::RPC: { out << std::endl <<" RPC: "<<RPCDigiSpec(it->first, it->second); break; }
|
51 |
|
|
case MuonSubdetId::DT: { out << std::endl <<" DT: "<<DTphDigiSpec(it->first, it->second); break; }
|
52 |
|
|
case MuonSubdetId::CSC: { out << std::endl <<" CSC: "<<CSCDigiSpec(it->first, it->second); break; }
|
53 |
|
|
};
|
54 |
|
|
}
|
55 |
|
|
return out;
|
56 |
|
|
}
|
57 |
|
|
|