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
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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)
 

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

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

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter<>
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::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<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>
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)
 
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

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 77 of file HGCalTBCheckGunPosition.cc.

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

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hepMCproductLabel_, hexside_, hexwidth_, method2_, tan30deg_, and verbosity_.

◆ ~HGCalTBCheckGunPostion()

HGCalTBCheckGunPostion::~HGCalTBCheckGunPostion ( )
override

Definition at line 90 of file HGCalTBCheckGunPosition.cc.

90 {}

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 152 of file HGCalTBCheckGunPosition.cc.

152  {
153  // The following says we do not know what parameters are allowed so do no
154  // validation
155  // Please change this to state exactly what you do use, even if it is no
156  // parameters
158  desc.setUnknown();
159  descriptions.addDefault(desc);
160 }

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

◆ filter()

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

Implements edm::stream::EDFilterBase.

Definition at line 97 of file HGCalTBCheckGunPosition.cc.

97  {
99  iEvent.getByToken(hepMCproductLabel_, hepmc);
100 #ifdef DebugLog
101  if (verbosity_)
102  edm::LogVerbatim("HGCSim") << "isHandle valid: " << isHandle valid;
103 #endif
104  double x(0), y(0);
105 
106  if (hepmc.isValid()) {
107  const HepMC::GenEvent* Evt = hepmc->GetEvent();
108 
109 #ifdef DebugLog
110  if (verbosity_)
111  edm::LogVerbatim("HGCSim") << "vertex " << Evt->vertices_size();
112 #endif
113  for (HepMC::GenEvent::vertex_const_iterator p = Evt->vertices_begin(); p != Evt->vertices_end(); ++p) {
114  x = (*p)->position().x() / 10.; // in cm
115  y = (*p)->position().y() / 10.; // in cm
116 #ifdef DebugLog
117  z = (*p)->position().z() / 10.; // in cm
118  if (verbosity_)
119  edm::LogVerbatim("HGCSim") << " x: " << (*p)->position().x() << ":" << x << " y: " << (*p)->position().y()
120  << ":" << y << " z: " << (*p)->position().z() << ":" << z;
121 #endif
122  }
123  } // if (genEventInfoHandle.isValid())
124 
125  bool flag(false);
126  if (method2_) {
127  bool cond1 = y == 0 && x >= (-hexside_ * sqrt(3) / 2.);
128  bool cond2 = ((y + hexside_) >= -x / sqrt(3)) && (y < 0 && x < 0);
129  bool cond3 = (y * sqrt(3) >= (x - hexside_ * sqrt(3))) && (y < 0 && x > 0);
130  bool cond4 = y == 0 && x <= (hexside_ * sqrt(3) / 2.);
131  bool cond5 = (-y * sqrt(3) >= (x - hexside_ * sqrt(3))) && (y > 0 && x > 0);
132  bool cond6 = ((y - hexside_) <= x / sqrt(3)) && (y > 0 && x < 0);
133  flag = cond1 || cond2 || cond3 || cond4 || cond5 || cond6;
134  } else {
135  double absx = std::abs(x);
136  double absy = std::abs(y);
137  if (absx <= hexwidth_ && absy <= hexside_) {
138  if (absy <= hexwidth_ * tan30deg_ || absx <= (2. * hexwidth_ - absy / tan30deg_))
139  flag = true;
140  }
141  }
142 
143 #ifdef DebugLog
144  if (verbosity_)
145  edm::LogVerbatim("HGCSim") << "Selection Flag " << flag;
146 #endif
147  return flag;
148 }

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

Member Data Documentation

◆ hepMCproductLabel_

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

Definition at line 61 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

◆ hexside_

double HGCalTBCheckGunPostion::hexside_
private

Definition at line 63 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

◆ hexwidth_

double HGCalTBCheckGunPostion::hexwidth_
private

Definition at line 63 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

◆ method2_

bool HGCalTBCheckGunPostion::method2_
private

Definition at line 62 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

◆ tan30deg_

double HGCalTBCheckGunPostion::tan30deg_
private

Definition at line 63 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

◆ verbosity_

bool HGCalTBCheckGunPostion::verbosity_
private

Definition at line 62 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

DDAxes::y
HGCalTBCheckGunPostion::hepMCproductLabel_
edm::EDGetTokenT< edm::HepMCProduct > hepMCproductLabel_
Definition: HGCalTBCheckGunPosition.cc:61
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HGCalTBCheckGunPostion::tan30deg_
double tan30deg_
Definition: HGCalTBCheckGunPosition.cc:63
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DDAxes::x
edm::Handle< edm::HepMCProduct >
validateGeometry_cfg.valid
valid
Definition: validateGeometry_cfg.py:21
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
HGCalTBCheckGunPostion::method2_
bool method2_
Definition: HGCalTBCheckGunPosition.cc:62
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
HGCalTBCheckGunPostion::hexwidth_
double hexwidth_
Definition: HGCalTBCheckGunPosition.cc:63
HGCalTBCheckGunPostion::hexside_
double hexside_
Definition: HGCalTBCheckGunPosition.cc:63
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::LogVerbatim
Definition: MessageLogger.h:297
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition: ParameterSetDescription.cc:39
edm::HepMCProduct::GetEvent
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:34
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HGCalTBCheckGunPostion::verbosity_
bool verbosity_
Definition: HGCalTBCheckGunPosition.cc:62
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
edm::InputTag
Definition: InputTag.h:15
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116