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 | 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
 
 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)
 

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::HepMCProduct
hepMCproductLabel_
 
double hexside_
 
double hexwidth_
 
bool method2_
 
double tan30deg_
 
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
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

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

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

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 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::HepMCProduct > hepMCproductLabel_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
HGCalTBCheckGunPostion::~HGCalTBCheckGunPostion ( )
override

Definition at line 90 of file HGCalTBCheckGunPosition.cc.

90 {}

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.

56 {}
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.

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 57 of file HGCalTBCheckGunPosition.cc.

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

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

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 }
void addDefault(ParameterSetDescription const &psetDescription)
bool HGCalTBCheckGunPostion::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::stream::EDFilterBase.

Definition at line 97 of file HGCalTBCheckGunPosition.cc.

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

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 }
Log< level::Info, true > LogVerbatim
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::EDGetTokenT< edm::HepMCProduct > hepMCproductLabel_
bool isValid() const
Definition: HandleBase.h:70

Member Data Documentation

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

Definition at line 61 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

double HGCalTBCheckGunPostion::hexside_
private

Definition at line 63 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

double HGCalTBCheckGunPostion::hexwidth_
private

Definition at line 63 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

bool HGCalTBCheckGunPostion::method2_
private

Definition at line 62 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

double HGCalTBCheckGunPostion::tan30deg_
private

Definition at line 63 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

bool HGCalTBCheckGunPostion::verbosity_
private

Definition at line 62 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().