CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
BeamSplash Class Reference

#include <BeamSplash.h>

Inheritance diagram for BeamSplash:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 BeamSplash (const edm::ParameterSet &)
 
 ~BeamSplash () override
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
 EDFilter (const EDFilter &)=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 EDFilteroperator= (const EDFilter &)=delete
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
 EDFilterBase (const EDFilterBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDFilterBaseoperator= (const EDFilterBase &)=delete
 
 ~EDFilterBase () 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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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::stream::EDFilter<>
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
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase 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::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
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...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 31 of file BeamSplash.h.

Constructor & Destructor Documentation

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

Definition at line 36 of file BeamSplash.cc.

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

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 }
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag HBHERecHitCollection_
Definition: BeamSplash.h:41
double EnergyCutEcal
Definition: BeamSplash.h:43
double EnergyCutHcal
Definition: BeamSplash.h:44
edm::InputTag EERecHitCollection_
Definition: BeamSplash.h:40
double EnergyCutTot
Definition: BeamSplash.h:42
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool applyfilter
Definition: BeamSplash.h:45
edm::InputTag EBRecHitCollection_
Definition: BeamSplash.h:39
BeamSplash::~BeamSplash ( )
override

Definition at line 47 of file BeamSplash.cc.

47 {}

Member Function Documentation

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

Implements edm::stream::EDFilterBase.

Definition at line 49 of file BeamSplash.cc.

References bsc_activity_cfg::applyfilter, edm::SortedCollection< T, SORT >::begin(), edm::EventBase::bunchCrossing(), gather_cfg::cout, egHLT::errCodes::EBRecHits, egHLT::errCodes::EERecHits, edm::SortedCollection< T, SORT >::end(), edm::EventID::event(), edm::Event::getByLabel(), egHLT::errCodes::HBHERecHits, edm::EventBase::id(), edm::HandleBase::isValid(), edm::EventBase::luminosityBlock(), edm::Handle< T >::product(), and edm::EventID::run().

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 }
RunNumber_t run() const
Definition: EventID.h:38
Log< level::Info, true > LogVerbatim
EventNumber_t event() const
Definition: EventID.h:40
edm::InputTag HBHERecHitCollection_
Definition: BeamSplash.h:41
double EnergyCutEcal
Definition: BeamSplash.h:43
std::vector< EcalRecHit >::const_iterator const_iterator
int bunchCrossing() const
Definition: EventBase.h:64
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:61
Log< level::Error, false > LogError
double EnergyCutHcal
Definition: BeamSplash.h:44
edm::InputTag EERecHitCollection_
Definition: BeamSplash.h:40
bool isValid() const
Definition: HandleBase.h:70
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:500
double EnergyCutTot
Definition: BeamSplash.h:42
const_iterator end() const
T const * product() const
Definition: Handle.h:70
std::string const & label() const
Definition: InputTag.h:36
edm::EventID id() const
Definition: EventBase.h:59
bool applyfilter
Definition: BeamSplash.h:45
tuple cout
Definition: gather_cfg.py:144
std::string const & instance() const
Definition: InputTag.h:37
const_iterator begin() const
edm::InputTag EBRecHitCollection_
Definition: BeamSplash.h:39

Member Data Documentation

bool BeamSplash::applyfilter
private

Definition at line 45 of file BeamSplash.h.

edm::InputTag BeamSplash::EBRecHitCollection_
private

Definition at line 39 of file BeamSplash.h.

edm::InputTag BeamSplash::EERecHitCollection_
private

Definition at line 40 of file BeamSplash.h.

double BeamSplash::EnergyCutEcal
private

Definition at line 43 of file BeamSplash.h.

double BeamSplash::EnergyCutHcal
private

Definition at line 44 of file BeamSplash.h.

double BeamSplash::EnergyCutTot
private

Definition at line 42 of file BeamSplash.h.

edm::InputTag BeamSplash::HBHERecHitCollection_
private

Definition at line 41 of file BeamSplash.h.