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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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
 
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
 
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)
 
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::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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

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 ( const edm::ParameterSet iConfig)
explicit

Definition at line 79 of file HGCalTBCheckGunPosition.cc.

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

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

Definition at line 93 of file HGCalTBCheckGunPosition.cc.

93 {}

Member Function Documentation

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 56 of file HGCalTBCheckGunPosition.cc.

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 54 of file HGCalTBCheckGunPosition.cc.

54 {}
void HGCalTBCheckGunPostion::beginStream ( edm::StreamID  )
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 50 of file HGCalTBCheckGunPosition.cc.

References filter().

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 58 of file HGCalTBCheckGunPosition.cc.

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 55 of file HGCalTBCheckGunPosition.cc.

55 {}
void HGCalTBCheckGunPostion::endStream ( )
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 52 of file HGCalTBCheckGunPosition.cc.

52 {}
void HGCalTBCheckGunPostion::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 159 of file HGCalTBCheckGunPosition.cc.

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

160  {
161  // The following says we do not know what parameters are allowed so do no
162  // validation
163  // Please change this to state exactly what you do use, even if it is no
164  // parameters
166  desc.setUnknown();
167  descriptions.addDefault(desc);
168 }
void addDefault(ParameterSetDescription const &psetDescription)
bool HGCalTBCheckGunPostion::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 100 of file HGCalTBCheckGunPosition.cc.

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

Referenced by beginStream().

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

Member Data Documentation

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

Definition at line 63 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

double HGCalTBCheckGunPostion::hexside_
private

Definition at line 65 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

double HGCalTBCheckGunPostion::hexwidth_
private

Definition at line 65 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

bool HGCalTBCheckGunPostion::method2_
private

Definition at line 64 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

double HGCalTBCheckGunPostion::tan30deg_
private

Definition at line 65 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

bool HGCalTBCheckGunPostion::verbosity_
private

Definition at line 64 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().