20 void endJob()
override;
25 typedef std::map<HcalDetId, SampleSet>
PathSet;
26 typedef std::map<HcalDetId, HcalElectronicsId>
IdMap;
36 template <
class DigiCollection>
37 void record(
const DigiCollection &digis) {
38 for (
typename DigiCollection::const_iterator digi = digis.begin(); digi != digis.end(); digi++) {
40 for (
int i = 0;
i < digi->size();
i++)
41 q.push_back(digi->sample(
i));
43 if (fullHistory_.find(digi->id()) == fullHistory_.end())
44 fullHistory_.insert(std::pair<
HcalDetId, std::vector<SampleSet>>(digi->id(), std::vector<SampleSet>()));
45 if (IdSet.find(digi->id()) == IdSet.end())
46 IdSet.insert(std::pair<HcalDetId, HcalElectronicsId>(digi->id(),
HcalElectronicsId()));
47 fullHistory_[digi->id()].push_back(q);
48 IdSet[digi->id()] = digi->elecId();
59 constexpr
char const *
det_names[] = {
"Zero",
"HcalBarrel",
"HcalEndcap",
"HcalForward",
"HcalOuter"};
62 PathSet::const_iterator iii;
63 IdMap::const_iterator ij;
65 for (iii = ps.begin(); iii != ps.end(); iii++) {
72 int header = ((ss[0].adc()) & 0x7F);
73 int ieta = ((ss[1].adc()) & 0x3F);
74 int z_ieta = (((ss[1].adc()) >> 6) & 0x1);
75 int iphi = ((ss[2].adc()) & 0x7F);
76 int depth = ((ss[3].adc()) & 0x7);
77 int det = (((ss[3].adc()) >> 3) & 0xF);
78 int spigot = ((ss[4].adc()) & 0xF);
79 int fiber = (((ss[4].adc()) >> 4) & 0x7);
80 int crate = ((ss[5].adc()) & 0x1F);
81 int fiber_chan = (((ss[5].adc()) >> 5) & 0x3);
82 int G_Dcc = ((ss[6].adc()) & 0x3F);
83 int H_slot = ((ss[7].adc()) & 0x1F);
84 int TB = (((ss[7].adc()) >> 5) & 0x1);
85 int RBX_7 = (((ss[7].adc()) >> 6) & 0x1);
86 int RBX = ((ss[8].adc()) & 0x7F);
87 int RM = ((ss[9].adc()) & 0x3);
88 int RM_card = (((ss[9].adc()) >> 2) & 0x3);
89 int RM_chan = (((ss[9].adc()) >> 4) & 0x7);
92 if (det > 4 || det < 0) {
94 snprintf(c, 20,
"Det=%d", det);
105 if (header == 0x75) {
111 std::cout <<
"Pathway match" << std::endl;
113 is_header =
" Header found";
115 std::cout <<
" Digi ID: " << dd << is_header <<
" ieta: " << eta_sign << ieta <<
" iphi: " << iphi
116 <<
" Depth: " << depth <<
" Detector: " << det_name <<
" Spigot: " << spigot <<
"/" << eid.
spigot()
117 <<
" Fiber: " << fiber + 1 <<
"/" << eid.
fiberIndex() <<
" Fiber Channel: " << fiber_chan <<
"/"
119 <<
" Global Dcc: " << G_Dcc <<
"/" << eid.
dccid() <<
" HTR Slot: " << H_slot <<
"/ " << eid.
htrSlot()
120 <<
" Top/Bottom: " << TB <<
"/" << eid.
htrTopBottom() <<
" RBX: " << (RBX_7 * 128 + RBX)
121 <<
" RM: " << RM + 1 <<
" RM Card: " << RM_card + 1 <<
" RM Channel: " << RM_chan << std::endl;
123 }
else if (ieta + 64 == 0x75) {
124 ieta = ((ss[2].adc()) & 0x3F);
125 iphi = ((ss[3].adc()) & 0x7F);
126 depth = ((ss[4].adc()) & 0x7);
127 det = (((ss[4].adc()) >> 3) & 0xF);
128 spigot = ((ss[5].adc()) & 0xF);
129 fiber = (((ss[5].adc()) >> 4) & 0x7);
130 crate = ((ss[6].adc()) & 0x1F);
131 fiber_chan = (((ss[6].adc()) >> 5) & 0x3);
132 G_Dcc = ((ss[7].adc()) & 0x3F);
133 H_slot = ((ss[8].adc()) & 0x1F);
134 TB = (((ss[8].adc()) >> 5) & 0x1);
135 RBX_7 = (((ss[8].adc()) >> 6) & 0x1);
136 RBX = ((ss[9].adc()) & 0x7F);
143 std::cout <<
"Pathway match (SHIFT)" << std::endl;
145 is_header =
" DATA SHIFT";
147 std::cout <<
" Digi ID: " << dd << is_header <<
" ieta: " << eta_sign << ieta <<
" iphi: " << iphi
148 <<
" Depth: " << depth <<
" Detector: " << det_name <<
" Spigot: " << spigot <<
"/" << eid.
spigot()
149 <<
" Fiber: " << fiber + 1 <<
"/" << eid.
fiberIndex() <<
" Fiber Channel: " << fiber_chan <<
"/"
151 <<
" Global Dcc: " << G_Dcc <<
"/" << eid.
dccid() <<
" HTR Slot: " << H_slot <<
"/ " << eid.
htrSlot()
152 <<
" Top/Bottom: " << TB <<
"/" << eid.
htrTopBottom() <<
" RBX: " << (RBX_7 * 128 + RBX) << std::endl;
155 std::cout <<
" Digi ID: " << dd <<
" +NO HEADER+ "
156 <<
" RBX: " << (RBX_7 * 128 + RBX) << std::endl;
176 std::vector<SampleSet>::iterator
j;
181 std::map<HcalDetId, std::vector<SampleSet>>::iterator
i;
185 for (i = fullHistory_.begin(); i != fullHistory_.end(); i++) {
189 for (k = 0; k < 10; k++) {
190 for (ii = 0; ii < 128; ii++)
193 for (j = i->second.begin(); j != i->second.end(); j++) {
194 if (
int(j->size()) > k)
199 for (kk = 0; kk < 128; kk++) {
200 if (c[kk] > c[c_max]) {
205 s.push_back(((c_max & 0x7F)));
209 consensus[i->first] =
s;
const edm::EventSetup & c
constexpr int ietaAbs() const
get the absolute value of the cell ieta
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< HODigiCollection > tok_ho_
edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
constexpr int dccid() const
get the (Hcal local) DCC id for VME, crate number for uTCA
constexpr char const * det_names[]
void record(const DigiCollection &digis)
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
constexpr HcalSubdetector subdet() const
get the subdetector
constexpr int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
std::vector< HcalQIESample > SampleSet
edm::EDGetTokenT< HFDigiCollection > tok_hf_
constexpr int iphi() const
get the cell iphi
std::map< HcalDetId, std::vector< SampleSet > > fullHistory_
constexpr int htrSlot() const
get the htr slot
void process(const PathSet &ps, const IdMap &im)
constexpr int readoutVMECrateId() const
get the readout VME crate number
constexpr int spigot() const
get the spigot (input number on DCC, AMC card number for uTCA)
std::map< HcalDetId, HcalElectronicsId > IdMap
HcalCableMapper(edm::ParameterSet const &conf)
constexpr int fiberIndex() const
get the fiber index. For VME 1-8 (which of eight fibers carried by a spigot), for uTCA fibers are zer...
std::map< HcalDetId, SampleSet > PathSet
T getParameter(std::string const &) const
constexpr int fiberChanId() const
get the fiber channel id (which of channels on a fiber)
constexpr int depth() const
get the tower depth
Readout chain identification for Hcal.
void analyze(edm::Event const &e, edm::EventSetup const &c) override