test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HFPreReconstructor (const edm::ParameterSet &)
 
 ~HFPreReconstructor ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector
< edm::ProductResolverIndex >
const & 
indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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 & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Types

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

Private Member Functions

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

Private Attributes

bool dropZSmarkedPassed_
 
edm::InputTag inputLabel_
 
std::unique_ptr< HcalRecoParamsparamTS_
 
std::vector< HFQIE10Infoqie10Infos_
 
HFPreRecAlgo reco_
 
std::vector< QIE10InfoWithIdsortedQIE10Infos_
 
edm::EDGetTokenT
< QIE10DigiCollection
tok_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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

Detailed Description

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

Implementation: [Notes on implementation]

Definition at line 48 of file HFPreReconstructor.cc.

Member Typedef Documentation

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

Definition at line 57 of file HFPreReconstructor.cc.

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

Definition at line 58 of file HFPreReconstructor.cc.

Constructor & Destructor Documentation

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

Definition at line 85 of file HFPreReconstructor.cc.

References inputLabel_, and tok_hfQIE10_.

86  : inputLabel_(conf.getParameter<edm::InputTag>("digiLabel")),
87  dropZSmarkedPassed_(conf.getParameter<bool>("dropZSmarkedPassed")),
88  tsFromDB_(conf.getParameter<bool>("tsFromDB")),
89  reco_(conf.getParameter<bool>("sumAllTimeSlices"))
90 {
91  // Describe consumed data
92  tok_hfQIE10_ = consumes<QIE10DigiCollection>(inputLabel_);
93 
94  // Register the product
95  produces<HFPreRecHitCollection>();
96 }
T getParameter(std::string const &) const
edm::InputTag inputLabel_
edm::EDGetTokenT< QIE10DigiCollection > tok_hfQIE10_
HFPreReconstructor::~HFPreReconstructor ( )

Definition at line 99 of file HFPreReconstructor.cc.

100 {
101 
102  // do anything here that needs to be done at destruction time
103  // (e.g. close files, deallocate resources etc.)
104 
105 }

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 206 of file HFPreReconstructor.cc.

References edm::EventSetup::get(), AlCaHLTBitMon_ParallelJobs::p, paramTS_, edm::ESHandle< class >::product(), and tsFromDB_.

207 {
208  if (tsFromDB_)
209  {
211  es.get<HcalRecoParamsRcd>().get(p);
212  paramTS_ = std::make_unique<HcalRecoParams>(*p.product());
213  }
214 }
std::unique_ptr< HcalRecoParams > paramTS_
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
void HFPreReconstructor::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 287 of file HFPreReconstructor.cc.

References edm::ParameterSetDescription::add(), and edm::ConfigurationDescriptions::addDefault().

288 {
290 
291  desc.add<edm::InputTag>("digiLabel");
292  desc.add<bool>("dropZSmarkedPassed");
293  desc.add<bool>("tsFromDB");
294  desc.add<bool>("sumAllTimeSlices");
295 
296  descriptions.addDefault(desc);
297 }
void addDefault(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void HFPreReconstructor::fillInfos ( const edm::Event e,
const edm::EventSetup eventSetup 
)
private

Definition at line 146 of file HFPreReconstructor.cc.

References dropZSmarkedPassed_, HcalRecoParam::firstSample(), edm::EventSetup::get(), edm::Event::getByToken(), paramTS_, QIE10DataFrame::presamples(), qie10Infos_, reco_, HFPreRecAlgo::reconstruct(), tok_hfQIE10_, tsFromDB_, and QIE10DataFrame::zsMarkAndPass().

Referenced by produce().

147 {
148  using namespace edm;
149 
150  // Clear the collection we want to fill in this method
151  qie10Infos_.clear();
152 
153  // Get the Hcal topology if needed
155  if (tsFromDB_)
156  {
157  eventSetup.get<HcalRecNumberingRecord>().get(htopo);
158  paramTS_->setTopo(htopo.product());
159  }
160 
161  // Get the calibrations
162  ESHandle<HcalDbService> conditions;
163  eventSetup.get<HcalDbRecord>().get(conditions);
164 
165  // Get the input collection
167  e.getByToken(tok_hfQIE10_, digi);
168 
169  const unsigned inputSize = digi->size();
170  if (inputSize)
171  {
172  // Process the digis and fill out the HFQIE10Info vector
173  qie10Infos_.reserve(inputSize);
174 
175  for (QIE10DigiCollection::const_iterator it = digi->begin();
176  it != digi->end(); ++it)
177  {
178  const QIE10DataFrame& frame(*it);
179 
180  // Check zero suppression
182  if (frame.zsMarkAndPass())
183  continue;
184 
185  const HcalDetId cell(it->id());
186  const HcalCalibrations& calibrations(conditions->getHcalCalibrations(cell));
187  const HcalQIECoder* channelCoder = conditions->getHcalCoder(cell);
188  const HcalQIEShape* shape = conditions->getHcalShape(channelCoder);
189  const HcalCoderDb coder(*channelCoder, *shape);
190 
191  // Get the "sample of interest" from the data frame itself
192  int tsToUse = frame.presamples();
193  if (tsFromDB_)
194  {
195  const HcalRecoParam* param_ts = paramTS_->getValues(cell.rawId());
196  tsToUse = param_ts->firstSample();
197  }
198 
199  // Reconstruct the charge, energy, etc
200  qie10Infos_.push_back(reco_.reconstruct(frame, tsToUse, coder, calibrations));
201  }
202  }
203 }
HFQIE10Info reconstruct(const QIE10DataFrame &digi, int tsToUse, const HcalCoder &coder, const HcalCalibrations &calibs) const
Definition: HFPreRecAlgo.cc:12
unsigned int firstSample() const
Definition: HcalRecoParam.h:32
std::vector< HFQIE10Info > qie10Infos_
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
std::unique_ptr< HcalRecoParams > paramTS_
const T & get() const
Definition: EventSetup.h:56
edm::EDGetTokenT< QIE10DigiCollection > tok_hfQIE10_
void HFPreReconstructor::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
overrideprivatevirtual

Implements edm::stream::EDProducerBase.

Definition at line 218 of file HFPreReconstructor.cc.

References assert(), fillInfos(), plotBeamSpotDB::first, i, eostools::move(), GenerateHcalLaserBadRunList::out, edm::Event::put(), edm::second(), sortDataByPmt(), and sortedQIE10Infos_.

219 {
220  // Process the input data
221  fillInfos(e, eventSetup);
222 
223  // Create a new output collection
224  std::unique_ptr<HFPreRecHitCollection> out(std::make_unique<HFPreRecHitCollection>());
225 
226  // Fill the output collection
227  const unsigned pmtCount = sortDataByPmt();
228  if (pmtCount)
229  {
230  out->reserve(pmtCount);
231  const unsigned sz = sortedQIE10Infos_.size();
232  HcalDetId previousBaseId(sortedQIE10Infos_[0].first.first);
233  unsigned nFound = 1;
234  for (unsigned i=1; i<=sz; ++i)
235  {
236  bool appendData = i == sz;
237  if (i < sz)
238  {
239  const HcalDetId baseId(sortedQIE10Infos_[i].first.first);
240  if (baseId == previousBaseId)
241  ++nFound;
242  else
243  {
244  appendData = true;
245  previousBaseId = baseId;
246  }
247  }
248 
249  if (appendData)
250  {
251  // If we have found more than two QIE10 with the same base id,
252  // there is a bug somewhere in the dataframe. We can't do
253  // anything useful about it here. Once we make sure that
254  // everything works as expected, this assertion can be removed.
255  assert(nFound <= 2);
256 
257  const HFQIE10Info* first = 0;
258  const HFQIE10Info* second = sortedQIE10Infos_[i-1].second;
259 
260  if (nFound >= 2)
261  first = sortedQIE10Infos_[i-2].second;
262  else if (sortedQIE10Infos_[i-1].first.second < 3)
263  {
264  // Only one QIE10 readout found for this PMT.
265  // Arrange for depth 1 and 2 to be "first".
266  first = second;
267  second = 0;
268  }
269 
270  out->push_back(HFPreRecHit(sortedQIE10Infos_[i-nFound].first.first,
271  first, second));
272 
273  // Reset the QIE find count for this base id
274  nFound = 1;
275  }
276  }
277 
278  assert(out->size() == pmtCount);
279  }
280 
281  // Add the output collection to the event record
282  e.put(std::move(out));
283 }
int i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
assert(m_qm.get())
std::vector< QIE10InfoWithId > sortedQIE10Infos_
U second(std::pair< T, U > const &p)
def move
Definition: eostools.py:510
void fillInfos(const edm::Event &e, const edm::EventSetup &eventSetup)
unsigned HFPreReconstructor::sortDataByPmt ( )
private

Definition at line 112 of file HFPreReconstructor.cc.

References HLT_25ns10e33_v2_cff::depth, plotBeamSpotDB::first, i, info(), qie10Infos_, and sortedQIE10Infos_.

Referenced by produce().

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

Member Data Documentation

bool HFPreReconstructor::dropZSmarkedPassed_
private

Definition at line 65 of file HFPreReconstructor.cc.

Referenced by fillInfos().

edm::InputTag HFPreReconstructor::inputLabel_
private

Definition at line 64 of file HFPreReconstructor.cc.

Referenced by HFPreReconstructor().

std::unique_ptr<HcalRecoParams> HFPreReconstructor::paramTS_
private

Definition at line 73 of file HFPreReconstructor.cc.

Referenced by beginRun(), and fillInfos().

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

Definition at line 71 of file HFPreReconstructor.cc.

Referenced by fillInfos(), and sortDataByPmt().

HFPreRecAlgo HFPreReconstructor::reco_
private

Definition at line 69 of file HFPreReconstructor.cc.

Referenced by fillInfos().

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

Definition at line 72 of file HFPreReconstructor.cc.

Referenced by produce(), and sortDataByPmt().

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

Definition at line 70 of file HFPreReconstructor.cc.

Referenced by fillInfos(), and HFPreReconstructor().

bool HFPreReconstructor::tsFromDB_
private

Definition at line 66 of file HFPreReconstructor.cc.

Referenced by beginRun(), and fillInfos().