CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
HFPreReconstructor Class Reference

#include <RecoLocalCalo/HcalRecProducers/src/HFPreReconstructor.cc>

Inheritance diagram for HFPreReconstructor:
edm::stream::EDProducer<>

Public Member Functions

 HFPreReconstructor (const edm::ParameterSet &)
 
 ~HFPreReconstructor () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Types

typedef std::pair< HcalDetId, int > PmtAnodeId
 
typedef std::pair< PmtAnodeId, const HFQIE10Info * > QIE10InfoWithId
 

Private Member Functions

void fillInfos (const edm::Event &e, const edm::EventSetup &eventSetup)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
unsigned sortDataByPmt ()
 

Private Attributes

bool dropZSmarkedPassed_
 
int forceSOI_
 
edm::ESGetToken< HcalTopology, HcalRecNumberingRecordhtopoToken_
 
edm::InputTag inputLabel_
 
edm::ESGetToken< HcalChannelPropertiesVec, HcalChannelPropertiesRecordpropertiesToken_
 
std::vector< HFQIE10Infoqie10Infos_
 
HFPreRecAlgo reco_
 
int soiShift_
 
std::vector< QIE10InfoWithIdsortedQIE10Infos_
 
edm::EDGetTokenT< QIE10DigiCollectiontok_hfQIE10_
 
bool tsFromDB_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: Phase 1 HF reco with QIE 10 and split-anode readout

Implementation: [Notes on implementation]

Definition at line 52 of file HFPreReconstructor.cc.

Member Typedef Documentation

◆ PmtAnodeId

typedef std::pair<HcalDetId, int> HFPreReconstructor::PmtAnodeId
private

Definition at line 60 of file HFPreReconstructor.cc.

◆ QIE10InfoWithId

typedef std::pair<PmtAnodeId, const HFQIE10Info*> HFPreReconstructor::QIE10InfoWithId
private

Definition at line 61 of file HFPreReconstructor.cc.

Constructor & Destructor Documentation

◆ HFPreReconstructor()

HFPreReconstructor::HFPreReconstructor ( const edm::ParameterSet conf)
explicit

Definition at line 92 of file HFPreReconstructor.cc.

References htopoToken_, inputLabel_, propertiesToken_, and tok_hfQIE10_.

93  : inputLabel_(conf.getParameter<edm::InputTag>("digiLabel")),
94  forceSOI_(conf.getParameter<int>("forceSOI")),
95  soiShift_(conf.getParameter<int>("soiShift")),
96  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed")),
97  tsFromDB_(conf.getParameter<bool>("tsFromDB")),
98  reco_(conf.getParameter<bool>("sumAllTimeSlices")) {
99  // Describe consumed data
100  tok_hfQIE10_ = consumes<QIE10DigiCollection>(inputLabel_);
101 
102  // Register the product
103  produces<HFPreRecHitCollection>();
104 
105  // ES tokens
106  htopoToken_ = esConsumes<HcalTopology, HcalRecNumberingRecord>();
107  propertiesToken_ = esConsumes<HcalChannelPropertiesVec, HcalChannelPropertiesRecord>();
108 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< HcalChannelPropertiesVec, HcalChannelPropertiesRecord > propertiesToken_
edm::InputTag inputLabel_
edm::EDGetTokenT< QIE10DigiCollection > tok_hfQIE10_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > htopoToken_

◆ ~HFPreReconstructor()

HFPreReconstructor::~HFPreReconstructor ( )
override

Definition at line 110 of file HFPreReconstructor.cc.

110  {
111  // do anything here that needs to be done at destruction time
112  // (e.g. close files, deallocate resources etc.)
113 }

Member Function Documentation

◆ fillDescriptions()

void HFPreReconstructor::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 265 of file HFPreReconstructor.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

265  {
267 
268  desc.add<edm::InputTag>("digiLabel");
269  desc.add<int>("forceSOI", -1);
270  desc.add<int>("soiShift", 0);
271  desc.add<bool>("dropZSmarkedPassed");
272  desc.add<bool>("tsFromDB");
273  desc.add<bool>("sumAllTimeSlices");
274 
275  descriptions.addDefault(desc);
276 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ fillInfos()

void HFPreReconstructor::fillInfos ( const edm::Event e,
const edm::EventSetup eventSetup 
)
private

Definition at line 146 of file HFPreReconstructor.cc.

References edm::DataFrameContainer::begin(), HcalChannelProperties::channelCoder, HcalTopology::detId2denseId(), dropZSmarkedPassed_, MillePedeFileConverter_cfg::e, edm::DataFrameContainer::end(), options_cfi::eventSetup, HcalRecoParam::firstSample(), forceSOI_, amptDefault_cfi::frame, HcalForward, htopoToken_, info(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, HcalChannelProperties::paramTs, propertiesToken_, qie10Infos_, reco_, HFPreRecAlgo::reconstruct(), HcalChannelProperties::shape, edm::DataFrameContainer::size(), soiShift_, tok_hfQIE10_, and tsFromDB_.

Referenced by produce().

146  {
147  using namespace edm;
148 
149  // Clear the collection we want to fill in this method
150  qie10Infos_.clear();
151 
152  // Get the calibrations
153  const HcalTopology& htopo = eventSetup.getData(htopoToken_);
155 
156  // Get the input collection
158  e.getByToken(tok_hfQIE10_, digi);
159 
160  const unsigned inputSize = digi->size();
161  if (inputSize) {
162  // Process the digis and fill out the HFQIE10Info vector
163  qie10Infos_.reserve(inputSize);
164 
165  for (QIE10DigiCollection::const_iterator it = digi->begin(); it != digi->end(); ++it) {
166  const QIE10DataFrame& frame(*it);
167  const HcalDetId cell(frame.id());
168 
169  // Protection against calibration channels which are not
170  // in the database but can still come in the QIE10DataFrame
171  // in the laser calibs, etc.
172  if (cell.subdet() != HcalSubdetector::HcalForward)
173  continue;
174 
175  // Check zero suppression
177  if (frame.zsMarkAndPass())
178  continue;
179 
180  // Look up the channel properties. This lookup is O(1).
181  const HcalChannelProperties& properties(prop.at(htopo.detId2denseId(cell)));
182 
183  // ADC decoding tool
184  const HcalCoderDb coder(*properties.channelCoder, *properties.shape);
185 
186  int tsToUse = forceSOI_;
187  if (tsToUse < 0) {
188  if (tsFromDB_) {
189  tsToUse = properties.paramTs->firstSample();
190  } else {
191  // Get the "sample of interest" from the data frame itself
192  tsToUse = frame.presamples();
193  }
194  }
195 
196  // Reconstruct the charge, energy, etc
197  const HFQIE10Info& info = reco_.reconstruct(frame, tsToUse + soiShift_, coder, properties);
198  if (info.id().rawId())
199  qie10Infos_.push_back(info);
200  }
201  }
202 }
std::vector< HFQIE10Info > qie10Infos_
static const TGPicture * info(bool iBackgroundIsBlack)
unsigned int detId2denseId(const DetId &id) const override
return a linear packed id
edm::ESGetToken< HcalChannelPropertiesVec, HcalChannelPropertiesRecord > propertiesToken_
std::vector< HcalChannelProperties > HcalChannelPropertiesVec
const_iterator end() const
const_iterator begin() const
The iterator returned can not safely be used across threads.
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
HLT enums.
edm::EDGetTokenT< QIE10DigiCollection > tok_hfQIE10_
HFQIE10Info reconstruct(const QIE10DataFrame &digi, int tsToUse, const HcalCoder &coder, const HcalChannelProperties &prop) const
Definition: HFPreRecAlgo.cc:12
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > htopoToken_

◆ produce()

void HFPreReconstructor::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
overrideprivate

Definition at line 205 of file HFPreReconstructor.cc.

References cms::cuda::assert(), MillePedeFileConverter_cfg::e, options_cfi::eventSetup, fillInfos(), dqmdumpme::first, mps_fire::i, eostools::move(), MillePedeFileConverter_cfg::out, edm::second(), sortDataByPmt(), and sortedQIE10Infos_.

205  {
206  // Process the input data
208 
209  // Create a new output collection
210  std::unique_ptr<HFPreRecHitCollection> out(std::make_unique<HFPreRecHitCollection>());
211 
212  // Fill the output collection
213  const unsigned pmtCount = sortDataByPmt();
214  if (pmtCount) {
215  out->reserve(pmtCount);
216  const unsigned sz = sortedQIE10Infos_.size();
217  HcalDetId previousBaseId(sortedQIE10Infos_[0].first.first);
218  unsigned nFound = 1;
219  for (unsigned i = 1; i <= sz; ++i) {
220  bool appendData = i == sz;
221  if (i < sz) {
222  const HcalDetId baseId(sortedQIE10Infos_[i].first.first);
223  if (baseId == previousBaseId)
224  ++nFound;
225  else {
226  appendData = true;
227  previousBaseId = baseId;
228  }
229  }
230 
231  if (appendData) {
232  // If we have found more than two QIE10 with the same base id,
233  // there is a bug somewhere in the dataframe. We can't do
234  // anything useful about it here. Once we make sure that
235  // everything works as expected, this assertion can be removed.
236  assert(nFound <= 2);
237 
238  const HFQIE10Info* first = nullptr;
239  const HFQIE10Info* second = sortedQIE10Infos_[i - 1].second;
240 
241  if (nFound >= 2)
242  first = sortedQIE10Infos_[i - 2].second;
243  else if (sortedQIE10Infos_[i - 1].first.second < 3) {
244  // Only one QIE10 readout found for this PMT.
245  // Arrange for depth 1 and 2 to be "first".
246  first = second;
247  second = nullptr;
248  }
249 
250  out->push_back(HFPreRecHit(sortedQIE10Infos_[i - nFound].first.first, first, second));
251 
252  // Reset the QIE find count for this base id
253  nFound = 1;
254  }
255  }
256 
257  assert(out->size() == pmtCount);
258  }
259 
260  // Add the output collection to the event record
261  e.put(std::move(out));
262 }
assert(be >=bs)
std::vector< QIE10InfoWithId > sortedQIE10Infos_
U second(std::pair< T, U > const &p)
void fillInfos(const edm::Event &e, const edm::EventSetup &eventSetup)
def move(src, dest)
Definition: eostools.py:511

◆ sortDataByPmt()

unsigned HFPreReconstructor::sortDataByPmt ( )
private

Definition at line 118 of file HFPreReconstructor.cc.

References hcalRecHitTable_cff::depth, dqmdumpme::first, mps_fire::i, EcalPhiSymFlatTableProducers_cfi::id, info(), qie10Infos_, jetUpdater_cfi::sort, and sortedQIE10Infos_.

Referenced by produce().

118  {
119  sortedQIE10Infos_.clear();
120  unsigned pmtCount = 0;
121  const unsigned sz = qie10Infos_.size();
122  if (sz) {
123  // Perform sorting
124  sortedQIE10Infos_.reserve(sz);
125  const HFQIE10Info* info = &qie10Infos_[0];
126  for (unsigned i = 0; i < sz; ++i) {
127  const HcalDetId id(info[i].id());
128  sortedQIE10Infos_.push_back(QIE10InfoWithId(PmtAnodeId(id.baseDetId(), id.depth()), info + i));
129  }
131 
132  // Count the PMTs
133  HcalDetId previousBaseId(sortedQIE10Infos_[0].first.first);
134  pmtCount = 1;
135  for (unsigned i = 1; i < sz; ++i) {
136  const HcalDetId baseId(sortedQIE10Infos_[i].first.first);
137  if (baseId != previousBaseId) {
138  previousBaseId = baseId;
139  ++pmtCount;
140  }
141  }
142  }
143  return pmtCount;
144 }
std::vector< HFQIE10Info > qie10Infos_
static const TGPicture * info(bool iBackgroundIsBlack)
std::vector< QIE10InfoWithId > sortedQIE10Infos_
std::pair< PmtAnodeId, const HFQIE10Info * > QIE10InfoWithId
std::pair< HcalDetId, int > PmtAnodeId

Member Data Documentation

◆ dropZSmarkedPassed_

bool HFPreReconstructor::dropZSmarkedPassed_
private

Definition at line 69 of file HFPreReconstructor.cc.

Referenced by fillInfos().

◆ forceSOI_

int HFPreReconstructor::forceSOI_
private

Definition at line 67 of file HFPreReconstructor.cc.

Referenced by fillInfos().

◆ htopoToken_

edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> HFPreReconstructor::htopoToken_
private

Definition at line 85 of file HFPreReconstructor.cc.

Referenced by fillInfos(), and HFPreReconstructor().

◆ inputLabel_

edm::InputTag HFPreReconstructor::inputLabel_
private

Definition at line 66 of file HFPreReconstructor.cc.

Referenced by HFPreReconstructor().

◆ propertiesToken_

edm::ESGetToken<HcalChannelPropertiesVec, HcalChannelPropertiesRecord> HFPreReconstructor::propertiesToken_
private

Definition at line 86 of file HFPreReconstructor.cc.

Referenced by fillInfos(), and HFPreReconstructor().

◆ qie10Infos_

std::vector<HFQIE10Info> HFPreReconstructor::qie10Infos_
private

Definition at line 75 of file HFPreReconstructor.cc.

Referenced by fillInfos(), and sortDataByPmt().

◆ reco_

HFPreRecAlgo HFPreReconstructor::reco_
private

Definition at line 73 of file HFPreReconstructor.cc.

Referenced by fillInfos().

◆ soiShift_

int HFPreReconstructor::soiShift_
private

Definition at line 68 of file HFPreReconstructor.cc.

Referenced by fillInfos().

◆ sortedQIE10Infos_

std::vector<QIE10InfoWithId> HFPreReconstructor::sortedQIE10Infos_
private

Definition at line 76 of file HFPreReconstructor.cc.

Referenced by produce(), and sortDataByPmt().

◆ tok_hfQIE10_

edm::EDGetTokenT<QIE10DigiCollection> HFPreReconstructor::tok_hfQIE10_
private

Definition at line 74 of file HFPreReconstructor.cc.

Referenced by fillInfos(), and HFPreReconstructor().

◆ tsFromDB_

bool HFPreReconstructor::tsFromDB_
private

Definition at line 70 of file HFPreReconstructor.cc.

Referenced by fillInfos().