CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HGCalTBCheckGunPostion Class Reference
Inheritance diagram for HGCalTBCheckGunPostion:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HGCalTBCheckGunPostion (const edm::ParameterSet &)
 
 ~HGCalTBCheckGunPostion () override=default
 
- 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
 
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 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void beginStream (edm::StreamID) override
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endStream () override
 
bool filter (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

const edm::EDGetTokenT< edm::HepMCProducthepMCproductLabel_
 
double hexside_
 
double hexwidth_
 
const edm::InputTag labelGen_
 
const bool method2_
 
double tan30deg_
 
const bool verbosity_
 

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
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
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< Bconsumes (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 ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
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

Geometry/HGCalTestBeam/plugins/HGCalTBCheckGunPostion.cc

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 42 of file HGCalTBCheckGunPosition.cc.

Constructor & Destructor Documentation

◆ HGCalTBCheckGunPostion()

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

Definition at line 78 of file HGCalTBCheckGunPosition.cc.

References hexside_, hexwidth_, and tan30deg_.

79  : labelGen_(iConfig.getParameter<edm::InputTag>("HepMCProductLabel")),
80  verbosity_(iConfig.getUntrackedParameter<bool>("Verbosity", false)),
81  method2_(iConfig.getUntrackedParameter<bool>("Method2", false)),
82  hepMCproductLabel_(consumes<edm::HepMCProduct>(labelGen_)) {
83  // now do what ever initialization is needed
84  // hexside = 7; //cm - check it
85  tan30deg_ = 0.5773502693;
86  hexwidth_ = 6.185;
87  hexside_ = 2.0 * hexwidth_ * tan30deg_;
88 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< edm::HepMCProduct > hepMCproductLabel_

◆ ~HGCalTBCheckGunPostion()

HGCalTBCheckGunPostion::~HGCalTBCheckGunPostion ( )
overridedefault

Member Function Documentation

◆ beginLuminosityBlock()

void HGCalTBCheckGunPostion::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 56 of file HGCalTBCheckGunPosition.cc.

56 {}

◆ beginRun()

void HGCalTBCheckGunPostion::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 54 of file HGCalTBCheckGunPosition.cc.

54 {}

◆ beginStream()

void HGCalTBCheckGunPostion::beginStream ( edm::StreamID  )
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 50 of file HGCalTBCheckGunPosition.cc.

50 {}

◆ endLuminosityBlock()

void HGCalTBCheckGunPostion::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 57 of file HGCalTBCheckGunPosition.cc.

57 {}

◆ endRun()

void HGCalTBCheckGunPostion::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 55 of file HGCalTBCheckGunPosition.cc.

55 {}

◆ endStream()

void HGCalTBCheckGunPostion::endStream ( )
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 52 of file HGCalTBCheckGunPosition.cc.

52 {}

◆ fillDescriptions()

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

Definition at line 149 of file HGCalTBCheckGunPosition.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

149  {
150  // The following says we do not know what parameters are allowed so do no
151  // validation
152  // Please change this to state exactly what you do use, even if it is no
153  // parameters
155  desc.setUnknown();
156  descriptions.addDefault(desc);
157 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ filter()

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

Implements edm::stream::EDFilterBase.

Definition at line 95 of file HGCalTBCheckGunPosition.cc.

References funct::abs(), RemoveAddSevLevel::flag, edm::HepMCProduct::GetEvent(), hepMCproductLabel_, hexside_, hexwidth_, iEvent, edm::HandleBase::isValid(), method2_, AlCaHLTBitMon_ParallelJobs::p, mathSSE::sqrt(), tan30deg_, verbosity_, x, y, and z.

95  {
97 #ifdef EDM_ML_DEBUG
98  if (verbosity_)
99  edm::LogVerbatim("HGCSim") << "is hepmc Handle valid: " << hepmc.isValid();
100 #endif
101  double x(0), y(0);
102 
103  if (hepmc.isValid()) {
104  const HepMC::GenEvent* Evt = hepmc->GetEvent();
105 
106 #ifdef EDM_ML_DEBUG
107  if (verbosity_)
108  edm::LogVerbatim("HGCSim") << "vertex " << Evt->vertices_size();
109 #endif
110  for (HepMC::GenEvent::vertex_const_iterator p = Evt->vertices_begin(); p != Evt->vertices_end(); ++p) {
111  x = (*p)->position().x() / 10.; // in cm
112  y = (*p)->position().y() / 10.; // in cm
113 #ifdef EDM_ML_DEBUG
114  double z = (*p)->position().z() / 10.; // in cm
115  if (verbosity_)
116  edm::LogVerbatim("HGCSim") << " x: " << (*p)->position().x() << ":" << x << " y: " << (*p)->position().y()
117  << ":" << y << " z: " << (*p)->position().z() << ":" << z;
118 #endif
119  }
120  } // if (genEventInfoHandle.isValid())
121 
122  bool flag(false);
123  if (method2_) {
124  bool cond1 = y == 0 && x >= (-hexside_ * sqrt(3) / 2.);
125  bool cond2 = ((y + hexside_) >= -x / sqrt(3)) && (y < 0 && x < 0);
126  bool cond3 = (y * sqrt(3) >= (x - hexside_ * sqrt(3))) && (y < 0 && x > 0);
127  bool cond4 = y == 0 && x <= (hexside_ * sqrt(3) / 2.);
128  bool cond5 = (-y * sqrt(3) >= (x - hexside_ * sqrt(3))) && (y > 0 && x > 0);
129  bool cond6 = ((y - hexside_) <= x / sqrt(3)) && (y > 0 && x < 0);
130  flag = cond1 || cond2 || cond3 || cond4 || cond5 || cond6;
131  } else {
132  double absx = std::abs(x);
133  double absy = std::abs(y);
134  if (absx <= hexwidth_ && absy <= hexside_) {
135  if (absy <= hexwidth_ * tan30deg_ || absx <= (2. * hexwidth_ - absy / tan30deg_))
136  flag = true;
137  }
138  }
139 
140 #ifdef EDM_ML_DEBUG
141  if (verbosity_)
142  edm::LogVerbatim("HGCSim") << "Selection Flag " << flag;
143 #endif
144  return flag;
145 }
Log< level::Info, true > LogVerbatim
int iEvent
Definition: GenABIO.cc:224
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const edm::EDGetTokenT< edm::HepMCProduct > hepMCproductLabel_
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:37
bool isValid() const
Definition: HandleBase.h:70

Member Data Documentation

◆ hepMCproductLabel_

const edm::EDGetTokenT<edm::HepMCProduct> HGCalTBCheckGunPostion::hepMCproductLabel_
private

Definition at line 63 of file HGCalTBCheckGunPosition.cc.

Referenced by filter().

◆ hexside_

double HGCalTBCheckGunPostion::hexside_
private

Definition at line 64 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

◆ hexwidth_

double HGCalTBCheckGunPostion::hexwidth_
private

Definition at line 64 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

◆ labelGen_

const edm::InputTag HGCalTBCheckGunPostion::labelGen_
private

Definition at line 61 of file HGCalTBCheckGunPosition.cc.

◆ method2_

const bool HGCalTBCheckGunPostion::method2_
private

Definition at line 62 of file HGCalTBCheckGunPosition.cc.

Referenced by filter().

◆ tan30deg_

double HGCalTBCheckGunPostion::tan30deg_
private

Definition at line 64 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

◆ verbosity_

const bool HGCalTBCheckGunPostion::verbosity_
private

Definition at line 62 of file HGCalTBCheckGunPosition.cc.

Referenced by filter().