CMS 3D CMS Logo

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

#include <BeamSplash.h>

Inheritance diagram for BeamSplash:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 BeamSplash (const edm::ParameterSet &)
 
 ~BeamSplash () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

bool filter (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

bool applyfilter
 
edm::InputTag EBRecHitCollection_
 
edm::InputTag EERecHitCollection_
 
double EnergyCutEcal
 
double EnergyCutHcal
 
double EnergyCutTot
 
edm::InputTag HBHERecHitCollection_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter 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
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 31 of file BeamSplash.h.

Constructor & Destructor Documentation

◆ BeamSplash()

BeamSplash::BeamSplash ( const edm::ParameterSet iConfig)
explicit

Definition at line 36 of file BeamSplash.cc.

36  {
37  EBRecHitCollection_ = iConfig.getParameter<edm::InputTag>("ebrechitcollection");
38  EERecHitCollection_ = iConfig.getParameter<edm::InputTag>("eerechitcollection");
39  HBHERecHitCollection_ = iConfig.getParameter<edm::InputTag>("hbherechitcollection");
40 
41  EnergyCutTot = iConfig.getUntrackedParameter<double>("energycuttot");
42  EnergyCutEcal = iConfig.getUntrackedParameter<double>("energycutecal");
43  EnergyCutHcal = iConfig.getUntrackedParameter<double>("energycuthcal");
44  applyfilter = iConfig.getUntrackedParameter<bool>("applyfilter", true);
45 }

References bsc_activity_cfg::applyfilter, edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().

◆ ~BeamSplash()

BeamSplash::~BeamSplash ( )
override

Definition at line 47 of file BeamSplash.cc.

47 {}

Member Function Documentation

◆ filter()

bool BeamSplash::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDFilter.

Definition at line 49 of file BeamSplash.cc.

49  {
50  bool accepted = false;
51 
52  bool acceptedtot = false;
53  bool acceptedEcal = false;
54  bool acceptedHcal = false;
55 
56  int ievt = iEvent.id().event();
57  int irun = iEvent.id().run();
58  int ils = iEvent.luminosityBlock();
59  int ibx = iEvent.bunchCrossing();
60 
61  double totene = 0;
62  double ecalene = 0;
63  double hcalene = 0;
64 
65  Handle<EBRecHitCollection> pEBRecHits;
66  Handle<EERecHitCollection> pEERecHits;
67  Handle<HBHERecHitCollection> pHBHERecHits;
68 
69  const EBRecHitCollection* EBRecHits = nullptr;
70  const EERecHitCollection* EERecHits = nullptr;
71  const HBHERecHitCollection* HBHERecHits = nullptr;
72 
73  if (!EBRecHitCollection_.label().empty() && !EBRecHitCollection_.instance().empty()) {
74  iEvent.getByLabel(EBRecHitCollection_, pEBRecHits);
75  if (pEBRecHits.isValid()) {
76  EBRecHits = pEBRecHits.product(); // get a ptr to the product
77  } else {
78  edm::LogError("EcalRecHitError") << "Error! can't get the product " << EBRecHitCollection_.label();
79  }
80  }
81 
82  if (!EERecHitCollection_.label().empty() && !EERecHitCollection_.instance().empty()) {
83  iEvent.getByLabel(EERecHitCollection_, pEERecHits);
84 
85  if (pEERecHits.isValid()) {
86  EERecHits = pEERecHits.product(); // get a ptr to the product
87  } else {
88  edm::LogError("EcalRecHitError") << "Error! can't get the product " << EERecHitCollection_.label();
89  }
90  }
91 
92  if (!HBHERecHitCollection_.label().empty()) {
93  iEvent.getByLabel(HBHERecHitCollection_, pHBHERecHits);
94 
95  if (pHBHERecHits.isValid()) {
96  HBHERecHits = pHBHERecHits.product(); // get a ptr to the product
97  } else {
98  edm::LogError("HcalRecHitError") << "Error! can't get the product " << HBHERecHitCollection_.label();
99  }
100  }
101 
102  // now sum over them
103  if (EBRecHits) {
104  for (EBRecHitCollection::const_iterator it = EBRecHits->begin(); it != EBRecHits->end(); ++it) {
105  totene += it->energy();
106  ecalene += it->energy();
107  }
108  }
109  if (EERecHits) {
110  for (EERecHitCollection::const_iterator it = EERecHits->begin(); it != EERecHits->end(); ++it) {
111  totene += it->energy();
112  ecalene += it->energy();
113  }
114  }
115  if (HBHERecHits) {
116  for (HBHERecHitCollection::const_iterator it = HBHERecHits->begin(); it != HBHERecHits->end(); ++it) {
117  totene += it->energy();
118  hcalene += it->energy();
119  }
120  }
121 
122  if (totene > EnergyCutTot)
123  acceptedtot = true;
124  if (ecalene > EnergyCutEcal)
125  acceptedEcal = true;
126  if (hcalene > EnergyCutHcal)
127  acceptedHcal = true;
128 
129  accepted = acceptedtot | acceptedEcal | acceptedHcal;
130 
131  if (accepted) {
132  edm::LogVerbatim("BeamSplash") << "!!!!!!!BeamSplash!!!!!!!: run:" << irun << " event:" << ievt << " ls:" << ils
133  << " bx= " << ibx << " totene=" << totene << " ecalene=" << ecalene
134  << " hcalene=" << hcalene;
135  std::cout << "!!!!!!!BeamSplash!!!!!!!: run:" << irun << " event:" << ievt << " ls:" << ils << " bx= " << ibx
136  << " totene=" << totene << " ecalene=" << ecalene << " hcalene=" << hcalene << std::endl;
137  }
138 
139  if (applyfilter)
140  return accepted;
141  else
142  return true;
143 }

References bsc_activity_cfg::applyfilter, gather_cfg::cout, filterRecHits_cfi::EBRecHits, filterRecHits_cfi::EERecHits, egHLT::errCodes::HBHERecHits, iEvent, edm::HandleBase::isValid(), and edm::Handle< T >::product().

Member Data Documentation

◆ applyfilter

bool BeamSplash::applyfilter
private

Definition at line 45 of file BeamSplash.h.

◆ EBRecHitCollection_

edm::InputTag BeamSplash::EBRecHitCollection_
private

Definition at line 39 of file BeamSplash.h.

◆ EERecHitCollection_

edm::InputTag BeamSplash::EERecHitCollection_
private

Definition at line 40 of file BeamSplash.h.

◆ EnergyCutEcal

double BeamSplash::EnergyCutEcal
private

Definition at line 43 of file BeamSplash.h.

◆ EnergyCutHcal

double BeamSplash::EnergyCutHcal
private

Definition at line 44 of file BeamSplash.h.

◆ EnergyCutTot

double BeamSplash::EnergyCutTot
private

Definition at line 42 of file BeamSplash.h.

◆ HBHERecHitCollection_

edm::InputTag BeamSplash::HBHERecHitCollection_
private

Definition at line 41 of file BeamSplash.h.

edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
edm::Handle::product
T const * product() const
Definition: Handle.h:70
edm::InputTag::instance
std::string const & instance() const
Definition: InputTag.h:37
BeamSplash::EnergyCutTot
double EnergyCutTot
Definition: BeamSplash.h:42
BeamSplash::HBHERecHitCollection_
edm::InputTag HBHERecHitCollection_
Definition: BeamSplash.h:41
egHLT::errCodes::HBHERecHits
Definition: EgHLTErrCodes.h:20
BeamSplash::EnergyCutEcal
double EnergyCutEcal
Definition: BeamSplash.h:43
gather_cfg.cout
cout
Definition: gather_cfg.py:144
BeamSplash::EnergyCutHcal
double EnergyCutHcal
Definition: BeamSplash.h:44
edm::SortedCollection< EcalRecHit >
BeamSplash::EBRecHitCollection_
edm::InputTag EBRecHitCollection_
Definition: BeamSplash.h:39
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Handle
Definition: AssociativeIterator.h:50
filterRecHits_cfi.EERecHits
EERecHits
Definition: filterRecHits_cfi.py:9
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
BeamSplash::EERecHitCollection_
edm::InputTag EERecHitCollection_
Definition: BeamSplash.h:40
BeamSplash::applyfilter
bool applyfilter
Definition: BeamSplash.h:45
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15
filterRecHits_cfi.EBRecHits
EBRecHits
Definition: filterRecHits_cfi.py:8