CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
HcalCableMapper Class Reference
Inheritance diagram for HcalCableMapper:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (edm::Event const &iEvent, edm::EventSetup const &iSetup) override
 
void endJob () override
 
 HcalCableMapper (edm::ParameterSet const &conf)
 
 ~HcalCableMapper () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef std::map< HcalDetId, HcalElectronicsIdIdMap
 
typedef std::map< HcalDetId, SampleSetPathSet
 
typedef std::vector< HcalQIESampleSampleSet
 

Private Member Functions

void process (const PathSet &ps, const IdMap &im)
 
template<class DigiCollection >
void record (const DigiCollection &digis)
 

Private Attributes

std::map< HcalDetId, std::vector< SampleSet > > fullHistory_
 
IdMap IdSet
 
const edm::EDGetTokenT< HBHEDigiCollectiontok_hbhe_
 
const edm::EDGetTokenT< HFDigiCollectiontok_hf_
 
const edm::EDGetTokenT< HODigiCollectiontok_ho_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 16 of file HcalCableMapper.cc.

Member Typedef Documentation

◆ IdMap

Definition at line 27 of file HcalCableMapper.cc.

◆ PathSet

typedef std::map<HcalDetId, SampleSet> HcalCableMapper::PathSet
private

Definition at line 26 of file HcalCableMapper.cc.

◆ SampleSet

typedef std::vector<HcalQIESample> HcalCableMapper::SampleSet
private

Definition at line 24 of file HcalCableMapper.cc.

Constructor & Destructor Documentation

◆ HcalCableMapper()

HcalCableMapper::HcalCableMapper ( edm::ParameterSet const &  conf)
explicit

Definition at line 54 of file HcalCableMapper.cc.

55  : tok_hbhe_(consumes<HBHEDigiCollection>(conf.getParameter<edm::InputTag>("hbheLabel"))),
56  tok_ho_(consumes<HODigiCollection>(conf.getParameter<edm::InputTag>("hoLabel"))),
57  tok_hf_(consumes<HFDigiCollection>(conf.getParameter<edm::InputTag>("hfLabel"))) {}
const edm::EDGetTokenT< HFDigiCollection > tok_hf_
const edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
const edm::EDGetTokenT< HODigiCollection > tok_ho_

◆ ~HcalCableMapper()

HcalCableMapper::~HcalCableMapper ( )
overridedefault

Member Function Documentation

◆ analyze()

void HcalCableMapper::analyze ( edm::Event const &  iEvent,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 162 of file HcalCableMapper.cc.

References photonIsolationHIProducer_cfi::hbhe, photonIsolationHIProducer_cfi::hf, photonIsolationHIProducer_cfi::ho, iEvent, record(), tok_hbhe_, tok_hf_, and tok_ho_.

162  {
163  const HBHEDigiCollection &hbhe = iEvent.get(tok_hbhe_);
164  const HFDigiCollection &hf = iEvent.get(tok_hf_);
165  const HODigiCollection &ho = iEvent.get(tok_ho_);
166 
167  record(hbhe);
168  record(hf);
169  record(ho);
170 }
const edm::EDGetTokenT< HFDigiCollection > tok_hf_
const edm::EDGetTokenT< HBHEDigiCollection > tok_hbhe_
void record(const DigiCollection &digis)
int iEvent
Definition: GenABIO.cc:224
const edm::EDGetTokenT< HODigiCollection > tok_ho_

◆ endJob()

void HcalCableMapper::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 172 of file HcalCableMapper.cc.

References HltBtagPostValidation_cff::c, fullHistory_, mps_fire::i, IdSet, cuy::ii, dqmiolumiharvest::j, dqmdumpme::k, GetRecoTauVFromDQM_MC_cff::kk, process(), and alignCSCRings::s.

Referenced by o2olib.O2ORunMgr::executeJob().

172  {
173  std::vector<SampleSet>::iterator j;
174  int c[128];
175  int k, ii, kk;
176  int c_max = 0;
177 
178  std::map<HcalDetId, std::vector<SampleSet>>::iterator i;
179 
180  PathSet consensus;
181 
182  for (i = fullHistory_.begin(); i != fullHistory_.end(); i++) {
183  // i.first --> id
184  // i.second --> vector<SampleSet>
185  SampleSet s;
186  for (k = 0; k < 10; k++) {
187  for (ii = 0; ii < 128; ii++)
188  c[ii] = 0;
189 
190  for (j = i->second.begin(); j != i->second.end(); j++) { // word number
191  if (int(j->size()) > k)
192  c[(*j)[k].adc()]++;
193 
194  } // j loop
195  // sort c-array
196  for (kk = 0; kk < 128; kk++) {
197  if (c[kk] > c[c_max]) {
198  c_max = kk;
199  }
200  }
201 
202  s.push_back(((c_max & 0x7F)));
203 
204  c_max = 0;
205  } // k-loop
206  consensus[i->first] = s;
207 
208  } // i loop
209 
210  process(consensus, IdSet);
211 
212 } // end of endjob
std::vector< HcalQIESample > SampleSet
std::map< HcalDetId, std::vector< SampleSet > > fullHistory_
void process(const PathSet &ps, const IdMap &im)
ii
Definition: cuy.py:589
std::map< HcalDetId, SampleSet > PathSet

◆ process()

void HcalCableMapper::process ( const PathSet ps,
const IdMap im 
)
private

Definition at line 61 of file HcalCableMapper.cc.

References HltBtagPostValidation_cff::c, FCDTask_cfi::crate, createTree::dd, hcalRecHitTable_cff::depth, det_names, runTauDisplay::eid, FCDTask_cfi::fiber, RecoTauValidation_cfi::header, hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by endJob().

61  {
62  PathSet::const_iterator iii;
63  IdMap::const_iterator ij;
64 
65  for (iii = ps.begin(); iii != ps.end(); iii++) {
66  SampleSet ss = iii->second;
67  const HcalDetId dd = iii->first;
68 
69  ij = im.find(dd);
70  HcalElectronicsId eid = ij->second;
71 
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);
90  string eta_sign;
91  std::string det_name;
92  if (det > 4 || det < 0) {
93  char c[20];
94  snprintf(c, 20, "Det=%d", det);
95  det_name = c;
96  } else
97  det_name = det_names[det];
98 
99  if (z_ieta == 1) {
100  eta_sign = "+";
101  } else {
102  eta_sign = "-";
103  }
104  string is_header;
105  if (header == 0x75) {
106  // NO SHIFT
107  if ((spigot == eid.spigot()) && (fiber + 1 == eid.fiberIndex()) && (fiber_chan == eid.fiberChanId()) &&
108  (H_slot == eid.htrSlot()) && (G_Dcc == eid.dccid()) && (crate == eid.readoutVMECrateId()) &&
109  (iphi == dd.iphi()) && (depth == dd.depth()) && (ieta == dd.ietaAbs()) && (TB == eid.htrTopBottom()) &&
110  (det == dd.subdet())) { //&&(z_ieta==dd.zside())
111  edm::LogVerbatim("HcalCableMapper") << "Pathway match";
112  } else {
113  is_header = " Header found";
114 
115  edm::LogVerbatim("HcalCableMapper")
116  << " Digi ID: " << dd << is_header << " ieta: " << eta_sign << ieta << " iphi: " << iphi
117  << " Depth: " << depth << " Detector: " << det_name << " Spigot: " << spigot << "/" << eid.spigot()
118  << " Fiber: " << fiber + 1 << "/" << eid.fiberIndex() << " Fiber Channel: " << fiber_chan << "/"
119  << eid.fiberChanId() << " Crate: " << crate << "/" << eid.readoutVMECrateId() << " Global Dcc: " << G_Dcc
120  << "/" << eid.dccid() << " HTR Slot: " << H_slot << "/ " << eid.htrSlot() << " Top/Bottom: " << TB << "/"
121  << eid.htrTopBottom() << " RBX: " << (RBX_7 * 128 + RBX) << " RM: " << RM + 1 << " RM Card: " << RM_card + 1
122  << " RM Channel: " << RM_chan;
123  }
124  } else if (ieta + 64 == 0x75) {
125  ieta = ((ss[2].adc()) & 0x3F);
126  iphi = ((ss[3].adc()) & 0x7F);
127  depth = ((ss[4].adc()) & 0x7);
128  det = (((ss[4].adc()) >> 3) & 0xF);
129  spigot = ((ss[5].adc()) & 0xF);
130  fiber = (((ss[5].adc()) >> 4) & 0x7);
131  crate = ((ss[6].adc()) & 0x1F);
132  fiber_chan = (((ss[6].adc()) >> 5) & 0x3);
133  G_Dcc = ((ss[7].adc()) & 0x3F);
134  H_slot = ((ss[8].adc()) & 0x1F);
135  TB = (((ss[8].adc()) >> 5) & 0x1);
136  RBX_7 = (((ss[8].adc()) >> 6) & 0x1);
137  RBX = ((ss[9].adc()) & 0x7F);
138 
139  // SHIFT
140  if ((spigot == eid.spigot()) && (fiber + 1 == eid.fiberIndex()) && (fiber_chan == eid.fiberChanId()) &&
141  (H_slot == eid.htrSlot()) && (G_Dcc == eid.dccid()) && (TB == eid.htrTopBottom()) &&
142  (crate == eid.readoutVMECrateId()) && (iphi == dd.iphi()) && (depth == dd.depth()) && (det == dd.subdet()) &&
143  (ieta == dd.ietaAbs())) {
144  edm::LogVerbatim("HcalCableMapper") << "Pathway match (SHIFT)";
145  } else {
146  is_header = " DATA SHIFT";
147 
148  edm::LogVerbatim("HcalCableMapper")
149  << " Digi ID: " << dd << is_header << " ieta: " << eta_sign << ieta << " iphi: " << iphi
150  << " Depth: " << depth << " Detector: " << det_name << " Spigot: " << spigot << "/" << eid.spigot()
151  << " Fiber: " << fiber + 1 << "/" << eid.fiberIndex() << " Fiber Channel: " << fiber_chan << "/"
152  << eid.fiberChanId() << " Crate: " << crate << "/" << eid.readoutVMECrateId() << " Global Dcc: " << G_Dcc
153  << "/" << eid.dccid() << " HTR Slot: " << H_slot << "/ " << eid.htrSlot() << " Top/Bottom: " << TB << "/"
154  << eid.htrTopBottom() << " RBX: " << (RBX_7 * 128 + RBX);
155  }
156  } else {
157  edm::LogVerbatim("HcalCableMapper") << " Digi ID: " << dd << " +NO HEADER+ RBX: " << (RBX_7 * 128 + RBX);
158  }
159  }
160 }
Log< level::Info, true > LogVerbatim
constexpr char const * det_names[]
string dd
Definition: createTree.py:154
std::vector< HcalQIESample > SampleSet
Readout chain identification for Hcal.

◆ record()

template<class DigiCollection >
void HcalCableMapper::record ( const DigiCollection &  digis)
inlineprivate

Definition at line 38 of file HcalCableMapper.cc.

References mps_fire::i, and submitPVResolutionJobs::q.

Referenced by analyze().

38  {
39  for (typename DigiCollection::const_iterator digi = digis.begin(); digi != digis.end(); digi++) {
40  SampleSet q;
41  for (int i = 0; i < digi->size(); i++)
42  q.push_back(digi->sample(i));
43 
44  if (fullHistory_.find(digi->id()) == fullHistory_.end())
45  fullHistory_.insert(std::pair<HcalDetId, std::vector<SampleSet>>(digi->id(), std::vector<SampleSet>()));
46  if (IdSet.find(digi->id()) == IdSet.end())
47  IdSet.insert(std::pair<HcalDetId, HcalElectronicsId>(digi->id(), HcalElectronicsId()));
48  fullHistory_[digi->id()].push_back(q);
49  IdSet[digi->id()] = digi->elecId();
50  }
51  }
std::vector< HcalQIESample > SampleSet
std::map< HcalDetId, std::vector< SampleSet > > fullHistory_
Readout chain identification for Hcal.

Member Data Documentation

◆ fullHistory_

std::map<HcalDetId, std::vector<SampleSet> > HcalCableMapper::fullHistory_
private

Definition at line 31 of file HcalCableMapper.cc.

Referenced by endJob().

◆ IdSet

IdMap HcalCableMapper::IdSet
private

Definition at line 32 of file HcalCableMapper.cc.

Referenced by endJob().

◆ tok_hbhe_

const edm::EDGetTokenT<HBHEDigiCollection> HcalCableMapper::tok_hbhe_
private

Definition at line 33 of file HcalCableMapper.cc.

Referenced by analyze().

◆ tok_hf_

const edm::EDGetTokenT<HFDigiCollection> HcalCableMapper::tok_hf_
private

Definition at line 35 of file HcalCableMapper.cc.

Referenced by analyze().

◆ tok_ho_

const edm::EDGetTokenT<HODigiCollection> HcalCableMapper::tok_ho_
private

Definition at line 34 of file HcalCableMapper.cc.

Referenced by analyze().