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

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_
 
std::unique_ptr< HcalHF_PETalgorithmhfPET_
 
std::unique_ptr< HcalHF_S9S1algorithmhfS8S1_
 
std::unique_ptr< HcalHF_S9S1algorithmhfS9S1_
 
std::unique_ptr< HFStripFilterhfStripFilter_
 
std::unique_ptr< AbsHFPhase1Algoreco_
 
std::unique_ptr< AbsHcalAlgoDatarecoConfig_
 
bool runHFStripFilter_
 
bool setNoiseFlags_
 
edm::EDGetTokenT< HFPreRecHitCollectiontok_PreRecHit_
 
bool useChannelQualityFromDB_
 

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

Constructor & Destructor Documentation

◆ HFPhase1Reconstructor()

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

Definition at line 87 of file HFPhase1Reconstructor.cc.

88  : algoConfigClass_(conf.getParameter<std::string>("algoConfigClass")),
89  setNoiseFlags_(conf.getParameter<bool>("setNoiseFlags")),
90  runHFStripFilter_(conf.getParameter<bool>("runHFStripFilter")),
91  useChannelQualityFromDB_(conf.getParameter<bool>("useChannelQualityFromDB")),
92  checkChannelQualityForDepth3and4_(conf.getParameter<bool>("checkChannelQualityForDepth3and4")),
94  // Check that the reco algorithm has been successfully configured
95  if (!reco_.get())
96  throw cms::Exception("HFPhase1BadConfig") << "Invalid HFPhase1Reconstructor algorithm configuration" << std::endl;
97 
98  // Configure the noise cleanup algorithms
99  if (setNoiseFlags_) {
100  const edm::ParameterSet& psS9S1 = conf.getParameter<edm::ParameterSet>("S9S1stat");
101  hfS9S1_ = std::make_unique<HcalHF_S9S1algorithm>(psS9S1.getParameter<std::vector<double> >("short_optimumSlope"),
102  psS9S1.getParameter<std::vector<double> >("shortEnergyParams"),
103  psS9S1.getParameter<std::vector<double> >("shortETParams"),
104  psS9S1.getParameter<std::vector<double> >("long_optimumSlope"),
105  psS9S1.getParameter<std::vector<double> >("longEnergyParams"),
106  psS9S1.getParameter<std::vector<double> >("longETParams"),
107  psS9S1.getParameter<int>("HcalAcceptSeverityLevel"),
108  psS9S1.getParameter<bool>("isS8S1"));
109 
110  const edm::ParameterSet& psS8S1 = conf.getParameter<edm::ParameterSet>("S8S1stat");
111  hfS8S1_ = std::make_unique<HcalHF_S9S1algorithm>(psS8S1.getParameter<std::vector<double> >("short_optimumSlope"),
112  psS8S1.getParameter<std::vector<double> >("shortEnergyParams"),
113  psS8S1.getParameter<std::vector<double> >("shortETParams"),
114  psS8S1.getParameter<std::vector<double> >("long_optimumSlope"),
115  psS8S1.getParameter<std::vector<double> >("longEnergyParams"),
116  psS8S1.getParameter<std::vector<double> >("longETParams"),
117  psS8S1.getParameter<int>("HcalAcceptSeverityLevel"),
118  psS8S1.getParameter<bool>("isS8S1"));
119 
120  const edm::ParameterSet& psPET = conf.getParameter<edm::ParameterSet>("PETstat");
121  hfPET_ = std::make_unique<HcalHF_PETalgorithm>(psPET.getParameter<std::vector<double> >("short_R"),
122  psPET.getParameter<std::vector<double> >("shortEnergyParams"),
123  psPET.getParameter<std::vector<double> >("shortETParams"),
124  psPET.getParameter<std::vector<double> >("long_R"),
125  psPET.getParameter<std::vector<double> >("longEnergyParams"),
126  psPET.getParameter<std::vector<double> >("longETParams"),
127  psPET.getParameter<int>("HcalAcceptSeverityLevel"),
128  psPET.getParameter<std::vector<double> >("short_R_29"),
129  psPET.getParameter<std::vector<double> >("long_R_29"));
130 
131  // Configure HFStripFilter
132  if (runHFStripFilter_) {
133  const edm::ParameterSet& psStripFilter = conf.getParameter<edm::ParameterSet>("HFStripFilter");
135  }
136  }
137 
138  // Describe consumed data
139  tok_PreRecHit_ = consumes<HFPreRecHitCollection>(conf.getParameter<edm::InputTag>("inputLabel"));
140 
141  // Register the product
142  produces<HFRecHitCollection>();
143 }

References edm::ParameterSet::getParameter(), hfPET_, hfS8S1_, hfS9S1_, hfStripFilter_, HFStripFilter::parseParameterSet(), reco_, runHFStripFilter_, setNoiseFlags_, and tok_PreRecHit_.

◆ ~HFPhase1Reconstructor()

HFPhase1Reconstructor::~HFPhase1Reconstructor ( )
override

Definition at line 145 of file HFPhase1Reconstructor.cc.

145  {
146  // do anything here that needs to be done at destruction time
147  // (e.g. close files, deallocate resources etc.)
148 }

Member Function Documentation

◆ beginRun()

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

Definition at line 150 of file HFPhase1Reconstructor.cc.

150  {
151  if (reco_->isConfigurable()) {
153  if (!recoConfig_.get())
154  throw cms::Exception("HFPhase1BadConfig")
155  << "Invalid HFPhase1Reconstructor \"algoConfigClass\" parameter value \"" << algoConfigClass_ << '"'
156  << std::endl;
157  if (!reco_->configure(recoConfig_.get()))
158  throw cms::Exception("HFPhase1BadConfig")
159  << "Failed to configure HFPhase1Reconstructor algorithm from EventSetup" << std::endl;
160  }
161 }

References algoConfigClass_, Exception, fetchHcalAlgoData(), reco_, and recoConfig_.

◆ fillDescriptions()

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

Definition at line 272 of file HFPhase1Reconstructor.cc.

272  {
274 
275  desc.add<edm::InputTag>("inputLabel");
276  desc.add<std::string>("algoConfigClass");
277  desc.add<bool>("setNoiseFlags");
278  desc.add<bool>("runHFStripFilter", false);
279  desc.add<bool>("useChannelQualityFromDB");
280  desc.add<bool>("checkChannelQualityForDepth3and4");
283 
287 
288  descriptions.addDefault(desc);
289 }

References edm::ParameterSetDescription::add(), add_param_set, edm::ConfigurationDescriptions::addDefault(), HFStripFilter::fillDescription(), fillDescriptionForParseHFPhase1AlgoDescription(), HLT_2018_cff::PETstat, HLT_2018_cff::S8S1stat, HLT_2018_cff::S9S1stat, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ produce()

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

Definition at line 164 of file HFPhase1Reconstructor.cc.

164  {
165  using namespace edm;
166 
167  // Fetch the calibrations
168  ESHandle<HcalDbService> conditions;
169  eventSetup.get<HcalDbRecord>().get(conditions);
170 
172  eventSetup.get<HcalChannelQualityRcd>().get("withTopo", p);
173  const HcalChannelQuality* myqual = p.product();
174 
176  eventSetup.get<HcalSeverityLevelComputerRcd>().get(mycomputer);
177  const HcalSeverityLevelComputer* mySeverity = mycomputer.product();
178 
179  // Get the input data
181  e.getByToken(tok_PreRecHit_, preRecHits);
182 
183  // Create a new output collection
184  std::unique_ptr<HFRecHitCollection> rec(std::make_unique<HFRecHitCollection>());
185  rec->reserve(preRecHits->size());
186 
187  // Iterate over the input and fill the output collection
188  for (HFPreRecHitCollection::const_iterator it = preRecHits->begin(); it != preRecHits->end(); ++it) {
189  // The check whether this PMT is single-anode one should go here.
190  // Fix this piece of code if/when mixed-anode readout configurations
191  // become available.
192  const bool thisIsSingleAnodePMT = false;
193 
194  // Check if the anodes were tagged bad in the database
195  bool taggedBadByDb[2] = {false, false};
197  if (checkChannelQualityForDepth3and4_ && !thisIsSingleAnodePMT) {
198  HcalDetId anodeIds[2];
199  anodeIds[0] = it->id();
200  anodeIds[1] = anodeIds[0].secondAnodeId();
201  for (unsigned i = 0; i < 2; ++i) {
202  const HcalChannelStatus* mydigistatus = myqual->getValues(anodeIds[i].rawId());
203  taggedBadByDb[i] = mySeverity->dropChannel(mydigistatus->getValue());
204  }
205  } else {
206  const HcalChannelStatus* mydigistatus = myqual->getValues(it->id().rawId());
207  const bool b = mySeverity->dropChannel(mydigistatus->getValue());
208  taggedBadByDb[0] = b;
209  taggedBadByDb[1] = b;
210  }
211  }
212 
213  // Reconstruct the rechit
214  const HFRecHit& rh =
215  reco_->reconstruct(*it, conditions->getHcalCalibrations(it->id()), taggedBadByDb, thisIsSingleAnodePMT);
216 
217  // The rechit will have the id of 0 if the algorithm
218  // decides that it should be dropped
219  if (rh.id().rawId())
220  rec->push_back(rh);
221  }
222 
223  // At this point, the rechits contain energy, timing,
224  // as well as proper auxiliary words. We do still need
225  // to set certain flags using the noise cleanup algoritms.
226 
227  // The following flags require the full set of rechits.
228  // These flags need to be set consecutively.
229  if (setNoiseFlags_) {
230  // Step 1: Set PET flag (short fibers of |ieta|==29)
231  for (HFRecHitCollection::iterator i = rec->begin(); i != rec->end(); ++i) {
232  int depth = i->id().depth();
233  int ieta = i->id().ieta();
234  // Short fibers and all channels at |ieta|=29 use PET settings in Algo 3
235  if (depth == 2 || abs(ieta) == 29)
236  hfPET_->HFSetFlagFromPET(*i, *rec, myqual, mySeverity);
237  }
238 
239  // Step 2: Set S8S1 flag (short fibers or |ieta|==29)
240  for (HFRecHitCollection::iterator i = rec->begin(); i != rec->end(); ++i) {
241  int depth = i->id().depth();
242  int ieta = i->id().ieta();
243  // Short fibers and all channels at |ieta|=29 use PET settings in Algo 3
244  if (depth == 2 || abs(ieta) == 29)
245  hfS8S1_->HFSetFlagFromS9S1(*i, *rec, myqual, mySeverity);
246  }
247 
248  // Step 3: Set S9S1 flag (long fibers)
249  for (HFRecHitCollection::iterator i = rec->begin(); i != rec->end(); ++i) {
250  int depth = i->id().depth();
251  int ieta = i->id().ieta();
252  // Short fibers and all channels at |ieta|=29 use PET settings in Algo 3
253  if (depth == 1 && abs(ieta) != 29)
254  hfS9S1_->HFSetFlagFromS9S1(*i, *rec, myqual, mySeverity);
255  }
256 
257  // Step 4: Run HFStripFilter if requested
258  if (runHFStripFilter_)
259  hfStripFilter_->runFilter(*rec, myqual);
260  }
261 
262  // Add the output collection to the event record
263  e.put(std::move(rec));
264 }

References funct::abs(), b, edm::SortedCollection< T, SORT >::begin(), checkChannelQualityForDepth3and4_, LEDCalibrationChannels::depth, HcalSeverityLevelComputer::dropChannel(), MillePedeFileConverter_cfg::e, edm::SortedCollection< T, SORT >::end(), edm::EventSetup::get(), get, HcalDbService::getHcalCalibrations(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), hfPET_, hfS8S1_, hfS9S1_, hfStripFilter_, mps_fire::i, HFRecHit::id(), LEDCalibrationChannels::ieta, eostools::move(), AlCaHLTBitMon_ParallelJobs::p, edm::ESHandle< T >::product(), DetId::rawId(), reco_, runHFStripFilter_, HcalDetId::secondAnodeId(), setNoiseFlags_, edm::SortedCollection< T, SORT >::size(), tok_PreRecHit_, and useChannelQualityFromDB_.

Member Data Documentation

◆ algoConfigClass_

std::string HFPhase1Reconstructor::algoConfigClass_
private

Definition at line 66 of file HFPhase1Reconstructor.cc.

Referenced by beginRun().

◆ checkChannelQualityForDepth3and4_

bool HFPhase1Reconstructor::checkChannelQualityForDepth3and4_
private

Definition at line 70 of file HFPhase1Reconstructor.cc.

Referenced by 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().

◆ reco_

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

Definition at line 74 of file HFPhase1Reconstructor.cc.

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

◆ recoConfig_

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

Definition at line 75 of file HFPhase1Reconstructor.cc.

Referenced by beginRun().

◆ runHFStripFilter_

bool HFPhase1Reconstructor::runHFStripFilter_
private

Definition at line 68 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

◆ setNoiseFlags_

bool HFPhase1Reconstructor::setNoiseFlags_
private

Definition at line 67 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

◆ tok_PreRecHit_

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

Definition at line 73 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

◆ useChannelQualityFromDB_

bool HFPhase1Reconstructor::useChannelQualityFromDB_
private

Definition at line 69 of file HFPhase1Reconstructor.cc.

Referenced by produce().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
mps_fire.i
i
Definition: mps_fire.py:355
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
HFPhase1Reconstructor::hfStripFilter_
std::unique_ptr< HFStripFilter > hfStripFilter_
Definition: HFPhase1Reconstructor.cc:81
HFPhase1Reconstructor::recoConfig_
std::unique_ptr< AbsHcalAlgoData > recoConfig_
Definition: HFPhase1Reconstructor.cc:75
HcalChannelQualityRcd
Definition: HcalChannelQualityRcd.h:8
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HFRecHit::id
constexpr HcalDetId id() const
Definition: HFRecHit.h:26
edm::SortedCollection::size
size_type size() const
Definition: SortedCollection.h:215
HFPhase1Reconstructor::hfS9S1_
std::unique_ptr< HcalHF_S9S1algorithm > hfS9S1_
Definition: HFPhase1Reconstructor.cc:78
HcalChannelQuality
Definition: HcalChannelQuality.h:17
HFPhase1Reconstructor::hfS8S1_
std::unique_ptr< HcalHF_S9S1algorithm > hfS8S1_
Definition: HFPhase1Reconstructor.cc:79
HLT_2018_cff.S9S1stat
S9S1stat
Definition: HLT_2018_cff.py:7151
edm::Handle
Definition: AssociativeIterator.h:50
HcalCondObjectContainer::getValues
const Item * getValues(DetId fId, bool throwOnFail=true) const
Definition: HcalCondObjectContainer.h:159
HcalDbService::getHcalCalibrations
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
Definition: HcalDbService.cc:65
HFPhase1Reconstructor::useChannelQualityFromDB_
bool useChannelQualityFromDB_
Definition: HFPhase1Reconstructor.cc:69
HFRecHit
Definition: HFRecHit.h:11
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
fillDescriptionForParseHFPhase1AlgoDescription
edm::ParameterSetDescription fillDescriptionForParseHFPhase1AlgoDescription()
Definition: parseHFPhase1AlgoDescription.cc:80
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
HcalChannelStatus
Definition: HcalChannelStatus.h:13
HcalSeverityLevelComputer
Definition: HcalSeverityLevelComputer.h:24
edm::ESHandle< HcalDbService >
b
double b
Definition: hdecay.h:118
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
HcalSeverityLevelComputer::dropChannel
bool dropChannel(const uint32_t &mystatus) const
Definition: HcalSeverityLevelComputer.cc:395
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HcalChannelStatus::getValue
uint32_t getValue() const
Definition: HcalChannelStatus.h:60
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
parseHFPhase1AlgoDescription
std::unique_ptr< AbsHFPhase1Algo > parseHFPhase1AlgoDescription(const edm::ParameterSet &ps)
Definition: parseHFPhase1AlgoDescription.cc:10
edm::ParameterSet
Definition: ParameterSet.h:36
HFPhase1Reconstructor::reco_
std::unique_ptr< AbsHFPhase1Algo > reco_
Definition: HFPhase1Reconstructor.cc:74
edm::SortedCollection::iterator
std::vector< T >::iterator iterator
Definition: SortedCollection.h:81
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
fetchHcalAlgoData
std::unique_ptr< AbsHcalAlgoData > fetchHcalAlgoData(const std::string &className, const edm::EventSetup &es)
Definition: fetchHcalAlgoData.cc:21
HFPhase1Reconstructor::tok_PreRecHit_
edm::EDGetTokenT< HFPreRecHitCollection > tok_PreRecHit_
Definition: HFPhase1Reconstructor.cc:73
HcalDetId
Definition: HcalDetId.h:12
HFStripFilter::fillDescription
static edm::ParameterSetDescription fillDescription()
Definition: HFStripFilter.cc:356
get
#define get
HFPhase1Reconstructor::hfPET_
std::unique_ptr< HcalHF_PETalgorithm > hfPET_
Definition: HFPhase1Reconstructor.cc:80
HFPhase1Reconstructor::runHFStripFilter_
bool runHFStripFilter_
Definition: HFPhase1Reconstructor.cc:68
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HLT_2018_cff.S8S1stat
S8S1stat
Definition: HLT_2018_cff.py:7173
HLT_2018_cff.PETstat
PETstat
Definition: HLT_2018_cff.py:7138
add_param_set
#define add_param_set(name)
Definition: HFPhase1Reconstructor.cc:266
eostools.move
def move(src, dest)
Definition: eostools.py:511
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
HFPhase1Reconstructor::checkChannelQualityForDepth3and4_
bool checkChannelQualityForDepth3and4_
Definition: HFPhase1Reconstructor.cc:70
Exception
Definition: hltDiff.cc:246
HFPhase1Reconstructor::algoConfigClass_
std::string algoConfigClass_
Definition: HFPhase1Reconstructor.cc:66
HFStripFilter::parseParameterSet
static std::unique_ptr< HFStripFilter > parseParameterSet(const edm::ParameterSet &ps)
Definition: HFStripFilter.cc:344
cms::Exception
Definition: Exception.h:70
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HcalDbRecord
Definition: HcalDbRecord.h:30
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::InputTag
Definition: InputTag.h:15
HcalSeverityLevelComputerRcd
Definition: HcalSeverityLevelComputerRcd.h:23
HcalDetId::secondAnodeId
constexpr HcalDetId secondAnodeId() const
second PMT anode detId for HF dual channels
Definition: HcalDetId.h:241
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
HFPhase1Reconstructor::setNoiseFlags_
bool setNoiseFlags_
Definition: HFPhase1Reconstructor.cc:67