CMS 3D CMS Logo

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

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

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

Public Member Functions

 HFPhase1Reconstructor (const edm::ParameterSet &)
 
 ~HFPhase1Reconstructor () 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 Member Functions

void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::string algoConfigClass_
 
bool checkChannelQualityForDepth3and4_
 
edm::ESGetToken< HcalDbService, HcalDbRecordconditionsToken_
 
std::unique_ptr< HcalHF_PETalgorithmhfPET_
 
std::unique_ptr< HcalHF_S9S1algorithmhfS8S1_
 
std::unique_ptr< HcalHF_S9S1algorithmhfS9S1_
 
std::unique_ptr< HFStripFilterhfStripFilter_
 
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcdqualToken_
 
std::unique_ptr< AbsHFPhase1Algoreco_
 
std::unique_ptr< AbsHcalAlgoDatarecoConfig_
 
edm::ESGetToken< HFPhase1PMTParams, HFPhase1PMTParamsRcdrecoConfigToken_
 
bool runHFStripFilter_
 
bool setNoiseFlags_
 
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcdsevToken_
 
edm::EDGetTokenT< HFPreRecHitCollectiontok_PreRecHit_
 
bool useChannelQualityFromDB_
 

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 53 of file HFPhase1Reconstructor.cc.

Constructor & Destructor Documentation

◆ HFPhase1Reconstructor()

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

Definition at line 92 of file HFPhase1Reconstructor.cc.

References algoConfigClass_, conditionsToken_, Exception, edm::ParameterSet::getParameter(), hfPET_, hfS8S1_, hfS9S1_, hfStripFilter_, HFStripFilter::parseParameterSet(), qualToken_, reco_, recoConfigToken_, runHFStripFilter_, setNoiseFlags_, sevToken_, and tok_PreRecHit_.

93  : algoConfigClass_(conf.getParameter<std::string>("algoConfigClass")),
94  setNoiseFlags_(conf.getParameter<bool>("setNoiseFlags")),
95  runHFStripFilter_(conf.getParameter<bool>("runHFStripFilter")),
96  useChannelQualityFromDB_(conf.getParameter<bool>("useChannelQualityFromDB")),
97  checkChannelQualityForDepth3and4_(conf.getParameter<bool>("checkChannelQualityForDepth3and4")),
99  // Check that the reco algorithm has been successfully configured
100  if (!reco_.get())
101  throw cms::Exception("HFPhase1BadConfig") << "Invalid HFPhase1Reconstructor algorithm configuration" << std::endl;
102 
103  if (reco_->isConfigurable()) {
104  if ("HFPhase1PMTParams" != algoConfigClass_) {
105  throw cms::Exception("HBHEPhase1BadConfig")
106  << "Invalid HBHEPhase1Reconstructor \"algoConfigClass\" parameter value \"" << algoConfigClass_ << '"'
107  << std::endl;
108  }
109  recoConfigToken_ = esConsumes<edm::Transition::BeginRun>();
110  }
111 
112  // Configure the noise cleanup algorithms
113  if (setNoiseFlags_) {
114  const edm::ParameterSet& psS9S1 = conf.getParameter<edm::ParameterSet>("S9S1stat");
115  hfS9S1_ = std::make_unique<HcalHF_S9S1algorithm>(psS9S1.getParameter<std::vector<double> >("short_optimumSlope"),
116  psS9S1.getParameter<std::vector<double> >("shortEnergyParams"),
117  psS9S1.getParameter<std::vector<double> >("shortETParams"),
118  psS9S1.getParameter<std::vector<double> >("long_optimumSlope"),
119  psS9S1.getParameter<std::vector<double> >("longEnergyParams"),
120  psS9S1.getParameter<std::vector<double> >("longETParams"),
121  psS9S1.getParameter<int>("HcalAcceptSeverityLevel"),
122  psS9S1.getParameter<bool>("isS8S1"));
123 
124  const edm::ParameterSet& psS8S1 = conf.getParameter<edm::ParameterSet>("S8S1stat");
125  hfS8S1_ = std::make_unique<HcalHF_S9S1algorithm>(psS8S1.getParameter<std::vector<double> >("short_optimumSlope"),
126  psS8S1.getParameter<std::vector<double> >("shortEnergyParams"),
127  psS8S1.getParameter<std::vector<double> >("shortETParams"),
128  psS8S1.getParameter<std::vector<double> >("long_optimumSlope"),
129  psS8S1.getParameter<std::vector<double> >("longEnergyParams"),
130  psS8S1.getParameter<std::vector<double> >("longETParams"),
131  psS8S1.getParameter<int>("HcalAcceptSeverityLevel"),
132  psS8S1.getParameter<bool>("isS8S1"));
133 
134  const edm::ParameterSet& psPET = conf.getParameter<edm::ParameterSet>("PETstat");
135  hfPET_ = std::make_unique<HcalHF_PETalgorithm>(psPET.getParameter<std::vector<double> >("short_R"),
136  psPET.getParameter<std::vector<double> >("shortEnergyParams"),
137  psPET.getParameter<std::vector<double> >("shortETParams"),
138  psPET.getParameter<std::vector<double> >("long_R"),
139  psPET.getParameter<std::vector<double> >("longEnergyParams"),
140  psPET.getParameter<std::vector<double> >("longETParams"),
141  psPET.getParameter<int>("HcalAcceptSeverityLevel"),
142  psPET.getParameter<std::vector<double> >("short_R_29"),
143  psPET.getParameter<std::vector<double> >("long_R_29"));
144 
145  // Configure HFStripFilter
146  if (runHFStripFilter_) {
147  const edm::ParameterSet& psStripFilter = conf.getParameter<edm::ParameterSet>("HFStripFilter");
149  }
150  }
151 
152  // Describe consumed data
153  tok_PreRecHit_ = consumes<HFPreRecHitCollection>(conf.getParameter<edm::InputTag>("inputLabel"));
154 
155  // Register the product
156  produces<HFRecHitCollection>();
157 
158  // ES tokens
159  conditionsToken_ = esConsumes<HcalDbService, HcalDbRecord>();
160  qualToken_ = esConsumes<HcalChannelQuality, HcalChannelQualityRcd>(edm::ESInputTag("", "withTopo"));
161  sevToken_ = esConsumes<HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd>();
162 }
edm::ESGetToken< HFPhase1PMTParams, HFPhase1PMTParamsRcd > recoConfigToken_
edm::ESGetToken< HcalDbService, HcalDbRecord > conditionsToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::unique_ptr< HcalHF_PETalgorithm > hfPET_
std::unique_ptr< HFStripFilter > hfStripFilter_
std::unique_ptr< AbsHFPhase1Algo > reco_
std::unique_ptr< AbsHFPhase1Algo > parseHFPhase1AlgoDescription(const edm::ParameterSet &ps)
static std::unique_ptr< HFStripFilter > parseParameterSet(const edm::ParameterSet &ps)
std::unique_ptr< HcalHF_S9S1algorithm > hfS8S1_
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > qualToken_
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > sevToken_
edm::EDGetTokenT< HFPreRecHitCollection > tok_PreRecHit_
std::unique_ptr< HcalHF_S9S1algorithm > hfS9S1_

◆ ~HFPhase1Reconstructor()

HFPhase1Reconstructor::~HFPhase1Reconstructor ( )
override

Definition at line 164 of file HFPhase1Reconstructor.cc.

164  {
165  // do anything here that needs to be done at destruction time
166  // (e.g. close files, deallocate resources etc.)
167 }

Member Function Documentation

◆ beginRun()

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

Definition at line 169 of file HFPhase1Reconstructor.cc.

References Exception, edm::EventSetup::getData(), reco_, recoConfig_, and recoConfigToken_.

169  {
170  if (reco_->isConfigurable()) {
171  recoConfig_ = std::make_unique<HFPhase1PMTParams>(es.getData(recoConfigToken_));
172  if (!reco_->configure(recoConfig_.get()))
173  throw cms::Exception("HFPhase1BadConfig")
174  << "Failed to configure HFPhase1Reconstructor algorithm from EventSetup" << std::endl;
175  }
176 }
edm::ESGetToken< HFPhase1PMTParams, HFPhase1PMTParamsRcd > recoConfigToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::unique_ptr< AbsHcalAlgoData > recoConfig_
std::unique_ptr< AbsHFPhase1Algo > reco_

◆ fillDescriptions()

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

Definition at line 280 of file HFPhase1Reconstructor.cc.

References add_param_set, edm::ConfigurationDescriptions::addDefault(), submitPVResolutionJobs::desc, HFStripFilter::fillDescription(), fillDescriptionForParseHFPhase1AlgoDescription(), HLT_2024v11_cff::PETstat, HLT_2024v11_cff::S8S1stat, HLT_2024v11_cff::S9S1stat, and AlCaHLTBitMon_QueryRunRegistry::string.

280  {
282 
283  desc.add<edm::InputTag>("inputLabel");
284  desc.add<std::string>("algoConfigClass");
285  desc.add<bool>("setNoiseFlags");
286  desc.add<bool>("runHFStripFilter", false);
287  desc.add<bool>("useChannelQualityFromDB");
288  desc.add<bool>("checkChannelQualityForDepth3and4");
291 
295 
296  descriptions.addDefault(desc);
297 }
static edm::ParameterSetDescription fillDescription()
#define add_param_set(name)
void addDefault(ParameterSetDescription const &psetDescription)
edm::ParameterSetDescription fillDescriptionForParseHFPhase1AlgoDescription()

◆ produce()

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

Definition at line 179 of file HFPhase1Reconstructor.cc.

References funct::abs(), b, edm::SortedCollection< T, SORT >::begin(), checkChannelQualityForDepth3and4_, submitPVValidationJobs::conditions, conditionsToken_, hcalRecHitTable_cff::depth, HcalSeverityLevelComputer::dropChannel(), MillePedeFileConverter_cfg::e, edm::SortedCollection< T, SORT >::end(), options_cfi::eventSetup, HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), hfPET_, hfS8S1_, hfS9S1_, hfStripFilter_, mps_fire::i, HFRecHit::id(), hcalRecHitTable_cff::ieta, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, eostools::move(), qualToken_, nano_mu_digi_cff::rawId, DetId::rawId(), reco_, runHFStripFilter_, HcalDetId::secondAnodeId(), setNoiseFlags_, sevToken_, edm::SortedCollection< T, SORT >::size(), tok_PreRecHit_, and useChannelQualityFromDB_.

179  {
180  using namespace edm;
181 
182  // Fetch the calibrations
184  const HcalChannelQuality* myqual = &eventSetup.getData(qualToken_);
185  const HcalSeverityLevelComputer* mySeverity = &eventSetup.getData(sevToken_);
186 
187  // Get the input data
189  e.getByToken(tok_PreRecHit_, preRecHits);
190 
191  // Create a new output collection
192  std::unique_ptr<HFRecHitCollection> rec(std::make_unique<HFRecHitCollection>());
193  rec->reserve(preRecHits->size());
194 
195  // Iterate over the input and fill the output collection
196  for (HFPreRecHitCollection::const_iterator it = preRecHits->begin(); it != preRecHits->end(); ++it) {
197  // The check whether this PMT is single-anode one should go here.
198  // Fix this piece of code if/when mixed-anode readout configurations
199  // become available.
200  const bool thisIsSingleAnodePMT = false;
201 
202  // Check if the anodes were tagged bad in the database
203  bool taggedBadByDb[2] = {false, false};
205  if (checkChannelQualityForDepth3and4_ && !thisIsSingleAnodePMT) {
206  HcalDetId anodeIds[2];
207  anodeIds[0] = it->id();
208  anodeIds[1] = anodeIds[0].secondAnodeId();
209  for (unsigned i = 0; i < 2; ++i) {
210  const HcalChannelStatus* mydigistatus = myqual->getValues(anodeIds[i].rawId());
211  taggedBadByDb[i] = mySeverity->dropChannel(mydigistatus->getValue());
212  }
213  } else {
214  const HcalChannelStatus* mydigistatus = myqual->getValues(it->id().rawId());
215  const bool b = mySeverity->dropChannel(mydigistatus->getValue());
216  taggedBadByDb[0] = b;
217  taggedBadByDb[1] = b;
218  }
219  }
220 
221  // Reconstruct the rechit
222  const HFRecHit& rh =
223  reco_->reconstruct(*it, conditions->getHcalCalibrations(it->id()), taggedBadByDb, thisIsSingleAnodePMT);
224 
225  // The rechit will have the id of 0 if the algorithm
226  // decides that it should be dropped
227  if (rh.id().rawId())
228  rec->push_back(rh);
229  }
230 
231  // At this point, the rechits contain energy, timing,
232  // as well as proper auxiliary words. We do still need
233  // to set certain flags using the noise cleanup algoritms.
234 
235  // The following flags require the full set of rechits.
236  // These flags need to be set consecutively.
237  if (setNoiseFlags_) {
238  // Step 1: Set PET flag (short fibers of |ieta|==29)
239  for (HFRecHitCollection::iterator i = rec->begin(); i != rec->end(); ++i) {
240  int depth = i->id().depth();
241  int ieta = i->id().ieta();
242  // Short fibers and all channels at |ieta|=29 use PET settings in Algo 3
243  if (depth == 2 || abs(ieta) == 29)
244  hfPET_->HFSetFlagFromPET(*i, *rec, myqual, mySeverity);
245  }
246 
247  // Step 2: Set S8S1 flag (short fibers or |ieta|==29)
248  for (HFRecHitCollection::iterator i = rec->begin(); i != rec->end(); ++i) {
249  int depth = i->id().depth();
250  int ieta = i->id().ieta();
251  // Short fibers and all channels at |ieta|=29 use PET settings in Algo 3
252  if (depth == 2 || abs(ieta) == 29)
253  hfS8S1_->HFSetFlagFromS9S1(*i, *rec, myqual, mySeverity);
254  }
255 
256  // Step 3: Set S9S1 flag (long fibers)
257  for (HFRecHitCollection::iterator i = rec->begin(); i != rec->end(); ++i) {
258  int depth = i->id().depth();
259  int ieta = i->id().ieta();
260  // Short fibers and all channels at |ieta|=29 use PET settings in Algo 3
261  if (depth == 1 && abs(ieta) != 29)
262  hfS9S1_->HFSetFlagFromS9S1(*i, *rec, myqual, mySeverity);
263  }
264 
265  // Step 4: Run HFStripFilter if requested
266  if (runHFStripFilter_)
267  hfStripFilter_->runFilter(*rec, myqual);
268  }
269 
270  // Add the output collection to the event record
271  e.put(std::move(rec));
272 }
edm::ESGetToken< HcalDbService, HcalDbRecord > conditionsToken_
size_type size() const
std::vector< T >::const_iterator const_iterator
const Item * getValues(DetId fId, bool throwOnFail=true) const
constexpr HcalDetId secondAnodeId() const
second PMT anode detId for HF dual channels
Definition: HcalDetId.h:241
std::unique_ptr< HcalHF_PETalgorithm > hfPET_
std::unique_ptr< HFStripFilter > hfStripFilter_
constexpr HcalDetId id() const
Definition: HFRecHit.h:26
std::unique_ptr< AbsHFPhase1Algo > reco_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::unique_ptr< HcalHF_S9S1algorithm > hfS8S1_
const_iterator begin() const
uint32_t getValue() const
std::vector< T >::iterator iterator
const_iterator end() const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
double b
Definition: hdecay.h:120
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > qualToken_
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > sevToken_
HLT enums.
edm::EDGetTokenT< HFPreRecHitCollection > tok_PreRecHit_
std::unique_ptr< HcalHF_S9S1algorithm > hfS9S1_
def move(src, dest)
Definition: eostools.py:511
bool dropChannel(const uint32_t &mystatus) const

Member Data Documentation

◆ algoConfigClass_

std::string HFPhase1Reconstructor::algoConfigClass_
private

Definition at line 65 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor().

◆ checkChannelQualityForDepth3and4_

bool HFPhase1Reconstructor::checkChannelQualityForDepth3and4_
private

Definition at line 69 of file HFPhase1Reconstructor.cc.

Referenced by produce().

◆ conditionsToken_

edm::ESGetToken<HcalDbService, HcalDbRecord> HFPhase1Reconstructor::conditionsToken_
private

Definition at line 84 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

◆ hfPET_

std::unique_ptr<HcalHF_PETalgorithm> HFPhase1Reconstructor::hfPET_
private

Definition at line 80 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

◆ hfS8S1_

std::unique_ptr<HcalHF_S9S1algorithm> HFPhase1Reconstructor::hfS8S1_
private

Definition at line 79 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

◆ hfS9S1_

std::unique_ptr<HcalHF_S9S1algorithm> HFPhase1Reconstructor::hfS9S1_
private

Definition at line 78 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

◆ hfStripFilter_

std::unique_ptr<HFStripFilter> HFPhase1Reconstructor::hfStripFilter_
private

Definition at line 81 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

◆ qualToken_

edm::ESGetToken<HcalChannelQuality, HcalChannelQualityRcd> HFPhase1Reconstructor::qualToken_
private

Definition at line 85 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

◆ reco_

std::unique_ptr<AbsHFPhase1Algo> HFPhase1Reconstructor::reco_
private

Definition at line 73 of file HFPhase1Reconstructor.cc.

Referenced by beginRun(), HFPhase1Reconstructor(), and produce().

◆ recoConfig_

std::unique_ptr<AbsHcalAlgoData> HFPhase1Reconstructor::recoConfig_
private

Definition at line 74 of file HFPhase1Reconstructor.cc.

Referenced by beginRun().

◆ recoConfigToken_

edm::ESGetToken<HFPhase1PMTParams, HFPhase1PMTParamsRcd> HFPhase1Reconstructor::recoConfigToken_
private

Definition at line 75 of file HFPhase1Reconstructor.cc.

Referenced by beginRun(), and HFPhase1Reconstructor().

◆ runHFStripFilter_

bool HFPhase1Reconstructor::runHFStripFilter_
private

Definition at line 67 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

◆ setNoiseFlags_

bool HFPhase1Reconstructor::setNoiseFlags_
private

Definition at line 66 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

◆ sevToken_

edm::ESGetToken<HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd> HFPhase1Reconstructor::sevToken_
private

Definition at line 86 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

◆ tok_PreRecHit_

edm::EDGetTokenT<HFPreRecHitCollection> HFPhase1Reconstructor::tok_PreRecHit_
private

Definition at line 72 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

◆ useChannelQualityFromDB_

bool HFPhase1Reconstructor::useChannelQualityFromDB_
private

Definition at line 68 of file HFPhase1Reconstructor.cc.

Referenced by produce().