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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HFPhase1Reconstructor (const edm::ParameterSet &)
 
 ~HFPhase1Reconstructor () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 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 & itemsToGetFrom (BranchType iType) 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
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) 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 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< AbsHFPhase1Algoreco_
 
std::unique_ptr< AbsHcalAlgoDatarecoConfig_
 
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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
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 53 of file HFPhase1Reconstructor.cc.

Constructor & Destructor Documentation

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

Definition at line 85 of file HFPhase1Reconstructor.cc.

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

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

Definition at line 145 of file HFPhase1Reconstructor.cc.

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

Member Function Documentation

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

Definition at line 155 of file HFPhase1Reconstructor.cc.

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

156 {
157  if (reco_->isConfigurable())
158  {
160  if (!recoConfig_.get())
161  throw cms::Exception("HFPhase1BadConfig")
162  << "Invalid HFPhase1Reconstructor \"algoConfigClass\" parameter value \""
163  << algoConfigClass_ << '"' << std::endl;
164  if (!reco_->configure(recoConfig_.get()))
165  throw cms::Exception("HFPhase1BadConfig")
166  << "Failed to configure HFPhase1Reconstructor algorithm from EventSetup"
167  << std::endl;
168  }
169 }
std::unique_ptr< AbsHcalAlgoData > fetchHcalAlgoData(const std::string &className, const edm::EventSetup &es)
std::unique_ptr< AbsHcalAlgoData > recoConfig_
std::unique_ptr< AbsHFPhase1Algo > reco_
void HFPhase1Reconstructor::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 291 of file HFPhase1Reconstructor.cc.

References edm::ParameterSetDescription::add(), add_param_set, edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, fillDescriptionForParseHFPhase1AlgoDescription(), HcalHitReconstructor_hf_cfi::PETstat, HcalHitReconstructor_hf_cfi::S8S1stat, HcalHitReconstructor_hf_cfi::S9S1stat, and AlCaHLTBitMon_QueryRunRegistry::string.

292 {
294 
295  desc.add<edm::InputTag>("inputLabel");
296  desc.add<std::string>("algoConfigClass");
297  desc.add<bool>("setNoiseFlags");
298  desc.add<bool>("useChannelQualityFromDB");
299  desc.add<bool>("checkChannelQualityForDepth3and4");
301 
305 
306  descriptions.addDefault(desc);
307 }
#define add_param_set(name)
void addDefault(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::ParameterSetDescription fillDescriptionForParseHFPhase1AlgoDescription()
void HFPhase1Reconstructor::produce ( edm::Event e,
const edm::EventSetup eventSetup 
)
overrideprivate

Definition at line 173 of file HFPhase1Reconstructor.cc.

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

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

Member Data Documentation

std::string HFPhase1Reconstructor::algoConfigClass_
private

Definition at line 66 of file HFPhase1Reconstructor.cc.

Referenced by beginRun().

bool HFPhase1Reconstructor::checkChannelQualityForDepth3and4_
private

Definition at line 69 of file HFPhase1Reconstructor.cc.

Referenced by produce().

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

Definition at line 79 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

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

Definition at line 78 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

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

Definition at line 77 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

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

Definition at line 73 of file HFPhase1Reconstructor.cc.

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

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

Definition at line 74 of file HFPhase1Reconstructor.cc.

Referenced by beginRun().

bool HFPhase1Reconstructor::setNoiseFlags_
private

Definition at line 67 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

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

Definition at line 72 of file HFPhase1Reconstructor.cc.

Referenced by HFPhase1Reconstructor(), and produce().

bool HFPhase1Reconstructor::useChannelQualityFromDB_
private

Definition at line 68 of file HFPhase1Reconstructor.cc.

Referenced by produce().