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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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 beginRun (const edm::Run &, const edm::EventSetup &) override
 
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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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 93 of file HFPreReconstructor.cc.

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

References htopoToken_, inputLabel_, propertiesToken_, and tok_hfQIE10_.

◆ ~HFPreReconstructor()

HFPreReconstructor::~HFPreReconstructor ( )
override

Definition at line 111 of file HFPreReconstructor.cc.

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

Member Function Documentation

◆ beginRun()

void HFPreReconstructor::beginRun ( const edm::Run r,
const edm::EventSetup es 
)
overrideprivate

Definition at line 205 of file HFPreReconstructor.cc.

205 {}

◆ fillDescriptions()

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

Definition at line 268 of file HFPreReconstructor.cc.

268  {
270 
271  desc.add<edm::InputTag>("digiLabel");
272  desc.add<int>("forceSOI", -1);
273  desc.add<int>("soiShift", 0);
274  desc.add<bool>("dropZSmarkedPassed");
275  desc.add<bool>("tsFromDB");
276  desc.add<bool>("sumAllTimeSlices");
277 
278  descriptions.addDefault(desc);
279 }

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

◆ fillInfos()

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

Definition at line 147 of file HFPreReconstructor.cc.

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

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

Referenced by produce().

◆ produce()

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

Definition at line 208 of file HFPreReconstructor.cc.

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

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

◆ sortDataByPmt()

unsigned HFPreReconstructor::sortDataByPmt ( )
private

Definition at line 119 of file HFPreReconstructor.cc.

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

References LEDCalibrationChannels::depth, dqmdumpme::first, mps_fire::i, triggerObjects_cff::id, info(), qie10Infos_, and sortedQIE10Infos_.

Referenced by produce().

Member Data Documentation

◆ dropZSmarkedPassed_

bool HFPreReconstructor::dropZSmarkedPassed_
private

Definition at line 70 of file HFPreReconstructor.cc.

Referenced by fillInfos().

◆ forceSOI_

int HFPreReconstructor::forceSOI_
private

Definition at line 68 of file HFPreReconstructor.cc.

Referenced by fillInfos().

◆ htopoToken_

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

Definition at line 86 of file HFPreReconstructor.cc.

Referenced by fillInfos(), and HFPreReconstructor().

◆ inputLabel_

edm::InputTag HFPreReconstructor::inputLabel_
private

Definition at line 67 of file HFPreReconstructor.cc.

Referenced by HFPreReconstructor().

◆ propertiesToken_

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

Definition at line 87 of file HFPreReconstructor.cc.

Referenced by fillInfos(), and HFPreReconstructor().

◆ qie10Infos_

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

Definition at line 76 of file HFPreReconstructor.cc.

Referenced by fillInfos(), and sortDataByPmt().

◆ reco_

HFPreRecAlgo HFPreReconstructor::reco_
private

Definition at line 74 of file HFPreReconstructor.cc.

Referenced by fillInfos().

◆ soiShift_

int HFPreReconstructor::soiShift_
private

Definition at line 69 of file HFPreReconstructor.cc.

Referenced by fillInfos().

◆ sortedQIE10Infos_

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

Definition at line 77 of file HFPreReconstructor.cc.

Referenced by produce(), and sortDataByPmt().

◆ tok_hfQIE10_

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

Definition at line 75 of file HFPreReconstructor.cc.

Referenced by fillInfos(), and HFPreReconstructor().

◆ tsFromDB_

bool HFPreReconstructor::tsFromDB_
private

Definition at line 71 of file HFPreReconstructor.cc.

Referenced by fillInfos().

HFPreReconstructor::tok_hfQIE10_
edm::EDGetTokenT< QIE10DigiCollection > tok_hfQIE10_
Definition: HFPreReconstructor.cc:75
HFPreRecAlgo::reconstruct
HFQIE10Info reconstruct(const QIE10DataFrame &digi, int tsToUse, const HcalCoder &coder, const HcalChannelProperties &prop) const
Definition: HFPreRecAlgo.cc:12
mps_fire.i
i
Definition: mps_fire.py:428
HFPreReconstructor::reco_
HFPreRecAlgo reco_
Definition: HFPreReconstructor.cc:74
edm::DataFrameContainer::const_iterator
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
Definition: DataFrameContainer.h:61
HFQIE10Info
Definition: HFQIE10Info.h:15
edm
HLT enums.
Definition: AlignableModifier.h:19
HcalTopology
Definition: HcalTopology.h:26
HFPreReconstructor::soiShift_
int soiShift_
Definition: HFPreReconstructor.cc:69
HFPreReconstructor::htopoToken_
edm::ESGetToken< HcalTopology, HcalRecNumberingRecord > htopoToken_
Definition: HFPreReconstructor.cc:86
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HFPreReconstructor::qie10Infos_
std::vector< HFQIE10Info > qie10Infos_
Definition: HFPreReconstructor.cc:76
cms::cuda::assert
assert(be >=bs)
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
HcalChannelPropertiesVec
std::vector< HcalChannelProperties > HcalChannelPropertiesVec
Definition: HcalChannelProperties.h:57
edm::Handle
Definition: AssociativeIterator.h:50
dqmdumpme.first
first
Definition: dqmdumpme.py:55
HcalChannelProperties
Definition: HcalChannelProperties.h:18
HFPreReconstructor::fillInfos
void fillInfos(const edm::Event &e, const edm::EventSetup &eventSetup)
Definition: HFPreReconstructor.cc:147
HFPreReconstructor::QIE10InfoWithId
std::pair< PmtAnodeId, const HFQIE10Info * > QIE10InfoWithId
Definition: HFPreReconstructor.cc:61
HFPreReconstructor::sortedQIE10Infos_
std::vector< QIE10InfoWithId > sortedQIE10Infos_
Definition: HFPreReconstructor.cc:77
HcalTopology::detId2denseId
unsigned int detId2denseId(const DetId &id) const override
return a linear packed id
Definition: HcalTopology.cc:1518
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
HFPreReconstructor::propertiesToken_
edm::ESGetToken< HcalChannelPropertiesVec, HcalChannelPropertiesRecord > propertiesToken_
Definition: HFPreReconstructor.cc:87
HFPreReconstructor::dropZSmarkedPassed_
bool dropZSmarkedPassed_
Definition: HFPreReconstructor.cc:70
HFPreReconstructor::inputLabel_
edm::InputTag inputLabel_
Definition: HFPreReconstructor.cc:67
HcalDetId
Definition: HcalDetId.h:12
edm::DataFrameContainer::begin
const_iterator begin() const
The iterator returned can not safely be used across threads.
Definition: DataFrameContainer.h:149
HFPreReconstructor::tsFromDB_
bool tsFromDB_
Definition: HFPreReconstructor.cc:71
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:120
HcalForward
Definition: HcalAssistant.h:36
HFPreReconstructor::forceSOI_
int forceSOI_
Definition: HFPreReconstructor.cc:68
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
QIE10DataFrame
Definition: QIE10DataFrame.h:11
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
amptDefault_cfi.frame
frame
Definition: amptDefault_cfi.py:12
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HFPreReconstructor::PmtAnodeId
std::pair< HcalDetId, int > PmtAnodeId
Definition: HFPreReconstructor.cc:60
HcalCoderDb
Definition: HcalCoderDb.h:15
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
HFPreReconstructor::sortDataByPmt
unsigned sortDataByPmt()
Definition: HFPreReconstructor.cc:119
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
HFPreRecHit
Definition: HFPreRecHit.h:14
edm::DataFrameContainer::end
const_iterator end() const
Definition: DataFrameContainer.h:152
edm::InputTag
Definition: InputTag.h:15
edm::DataFrameContainer::size
size_type size() const
Definition: DataFrameContainer.h:162
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37