19 void endJob ()
override;
24 typedef std::map<HcalDetId,SampleSet>
PathSet;
25 typedef std::map<HcalDetId,HcalElectronicsId>
IdMap;
27 void process(
const PathSet& ps,
const IdMap& im);
38 template <
class DigiCollection>
39 void record(
const DigiCollection& digis) {
41 for (
typename DigiCollection::const_iterator digi=digis.begin(); digi!=digis.end(); digi++) {
44 for (
int i=0;
i<digi->size();
i++)
45 q.push_back(digi->sample(
i));
47 if (fullHistory_.find(digi->id())==fullHistory_.end()) fullHistory_.insert(std::pair<
HcalDetId,std::vector<SampleSet> >(digi->id(),std::vector<SampleSet>()));
48 if (IdSet.find(digi->id())==IdSet.end()) IdSet.insert(std::pair<HcalDetId,HcalElectronicsId>(digi->id(),
HcalElectronicsId()));
49 fullHistory_[digi->id()].push_back(q);
50 IdSet[digi->id()]=digi->elecId();
65 constexpr char const*
det_names[] = {
"Zero",
"HcalBarrel",
"HcalEndcap",
"HcalForward",
"HcalOuter"};
71 PathSet::const_iterator iii;
72 IdMap::const_iterator ij;
74 for (iii=ps.begin();iii!=ps.end();iii++){
83 int header = ((ss[0].adc())&0x7F);
84 int ieta = ((ss[1].adc())&0x3F);
85 int z_ieta = (((ss[1].adc())>>6)&0x1);
86 int iphi = ((ss[2].adc())&0x7F);
87 int depth = ((ss[3].adc())&0x7);
88 int det = (((ss[3].adc())>>3)&0xF);
89 int spigot = ((ss[4].adc())&0xF);
90 int fiber = (((ss[4].adc())>>4)&0x7);
91 int crate = ((ss[5].adc())&0x1F);
92 int fiber_chan= (((ss[5].adc())>>5)&0x3);
93 int G_Dcc = ((ss[6].adc())&0x3F);
94 int H_slot = ((ss[7].adc())&0x1F);
95 int TB = (((ss[7].adc())>>5)&0x1);
96 int RBX_7 = (((ss[7].adc())>>6)&0x1);
97 int RBX = ((ss[8].adc())&0x7F);
98 int RM = ((ss[9].adc())&0x3);
99 int RM_card= (((ss[9].adc())>>2)&0x3);
100 int RM_chan= (((ss[9].adc())>>4)&0x7);
103 if (det>4 || det<0) {
105 snprintf(c,20,
"Det=%d",det);
112 }
else{eta_sign =
"-";}
121 is_header=
" Header found";
123 std::cout <<
" Digi ID: " << dd << is_header<<
" ieta: "<< eta_sign << ieta <<
" iphi: "<< iphi <<
" Depth: " << depth <<
" Detector: " << det_name <<
" Spigot: "<< spigot<<
"/"<<eid.
spigot() <<
" Fiber: " << fiber+1<<
"/"<<eid.
fiberIndex() <<
" Fiber Channel: "<< fiber_chan <<
"/"<<eid.
fiberChanId()<<
" Crate: " << crate<<
"/"<<eid.
readoutVMECrateId() <<
" Global Dcc: " << G_Dcc <<
"/"<<eid.
dccid() <<
" HTR Slot: " << H_slot <<
"/ " <<eid.
htrSlot()<<
" Top/Bottom: " << TB<<
"/"<< eid.
htrTopBottom() <<
" RBX: " << (RBX_7*128+RBX) <<
" RM: " << RM+1 <<
" RM Card: " << RM_card+1 <<
" RM Channel: " << RM_chan << std::endl;
125 }
else if (ieta+64==0x75){
127 ieta = ((ss[2].adc())&0x3F);
128 z_ieta = (((ss[2].adc())>>6)&0x1);
129 iphi = ((ss[3].adc())&0x7F);
130 depth = ((ss[4].adc())&0x7);
131 det = (((ss[4].adc())>>3)&0xF);
132 spigot = ((ss[5].adc())&0xF);
133 fiber = (((ss[5].adc())>>4)&0x7);
134 crate = ((ss[6].adc())&0x1F);
135 fiber_chan= (((ss[6].adc())>>5)&0x3);
136 G_Dcc = ((ss[7].adc())&0x3F);
137 H_slot = ((ss[8].adc())&0x1F);
138 TB = (((ss[8].adc())>>5)&0x1);
139 RBX_7 = (((ss[8].adc())>>6)&0x1);
140 RBX = ((ss[9].adc())&0x7F);
146 std::cout <<
"Pathway match (SHIFT)"<<std::endl;
150 is_header=
" DATA SHIFT";
152 std::cout <<
" Digi ID: " << dd << is_header<<
" ieta: "<< eta_sign << ieta <<
" iphi: "<< iphi <<
" Depth: " << depth <<
" Detector: " << det_name <<
" Spigot: "<< spigot<<
"/"<<eid.
spigot() <<
" Fiber: " << fiber+1<<
"/"<<eid.
fiberIndex() <<
" Fiber Channel: "<< fiber_chan <<
"/"<<eid.
fiberChanId()<<
" Crate: " << crate<<
"/"<<eid.
readoutVMECrateId() <<
" Global Dcc: " << G_Dcc <<
"/"<<eid.
dccid() <<
" HTR Slot: " << H_slot <<
"/ " <<eid.
htrSlot()<<
" Top/Bottom: " << TB<<
"/"<< eid.
htrTopBottom() <<
" RBX: " << (RBX_7*128+RBX) << std::endl;
155 }
else {
std::cout<<
" Digi ID: " <<dd <<
" +NO HEADER+ " <<
" RBX: " << (RBX_7*128+RBX) << std::endl;
183 std::vector<SampleSet>::iterator j;
188 std::map<HcalDetId,std::vector<SampleSet> >::iterator
i;
192 for (i=fullHistory_.begin(); i!=fullHistory_.end(); i++) {
196 for (k=0; k<10; k++) {
197 for (ii=0; ii<128; ii++) c[ii]=0;
199 for (j=i->second.begin();j!=i->second.end();j++){
200 if (
int(j->size())>k)
206 for (kk=0;kk<128;kk++){
212 s.push_back(((c_max&0x7F)));
216 consensus[i->first]=
s;
T getParameter(std::string const &) const
HcalSubdetector subdet() const
get the subdetector
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
void record(const DigiCollection &digis)
std::map< HcalDetId, std::vector< SampleSet > > fullHistory_
constexpr int htrTopBottom() const
get the htr top/bottom (1=top/0=bottom), valid for VME
std::vector< HcalQIESample > SampleSet
int depth() const
get the tower depth
edm::EDGetTokenT< HFDigiCollection > tok_hf_
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
std::map< HcalDetId, SampleSet > PathSet
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)
int ietaAbs() const
get the absolute value of the cell ieta
int iphi() const
get the cell iphi
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...
constexpr int fiberChanId() const
get the fiber channel id (which of channels on a fiber)
Readout chain identification for Hcal.
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
void analyze(edm::Event const &e, edm::EventSetup const &c) override