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 ()
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilterBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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

virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void beginStream (edm::StreamID) override
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
virtual void endRun (edm::Run const &, edm::EventSetup const &) override
 
virtual void endStream () override
 
virtual 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
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 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

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 40 of file HGCalTBCheckGunPosition.cc.

Constructor & Destructor Documentation

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

Definition at line 76 of file HGCalTBCheckGunPosition.cc.

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

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

Definition at line 89 of file HGCalTBCheckGunPosition.cc.

89 { }

Member Function Documentation

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 55 of file HGCalTBCheckGunPosition.cc.

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 53 of file HGCalTBCheckGunPosition.cc.

53 {}
virtual void HGCalTBCheckGunPostion::beginStream ( edm::StreamID  )
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 49 of file HGCalTBCheckGunPosition.cc.

References filter().

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 56 of file HGCalTBCheckGunPosition.cc.

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

Reimplemented from edm::stream::EDFilterBase.

Definition at line 54 of file HGCalTBCheckGunPosition.cc.

54 {}
virtual void HGCalTBCheckGunPostion::endStream ( )
inlineoverrideprivatevirtual

Reimplemented from edm::stream::EDFilterBase.

Definition at line 51 of file HGCalTBCheckGunPosition.cc.

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

Definition at line 153 of file HGCalTBCheckGunPosition.cc.

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

153  {
154  //The following says we do not know what parameters are allowed so do no validation
155  // Please change this to state exactly what you do use, even if it is no parameters
157  desc.setUnknown();
158  descriptions.addDefault(desc);
159 }
void addDefault(ParameterSetDescription const &psetDescription)
bool HGCalTBCheckGunPostion::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Definition at line 96 of file HGCalTBCheckGunPosition.cc.

References funct::abs(), gather_cfg::cout, 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().

97  {
99  iEvent.getByToken(hepMCproductLabel_, hepmc);
100 #ifdef DebugLog
101  if (verbosity_)
102  std::cout << "isHandle valid: " << isHandle valid << std::endl;
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  std::cout << "vertex " << Evt->vertices_size() << std::endl;
112 #endif
113  for (HepMC::GenEvent::vertex_const_iterator p = Evt->vertices_begin();
114  p != Evt->vertices_end(); ++p) {
115  x = (*p)->position().x()/10.; // in cm
116  y = (*p)->position().y()/10.; // in cm
117 #ifdef DebugLog
118  z = (*p)->position().z()/10.; // in cm
119  if (verbosity_)
120  std::cout << " x: " << (*p)->position().x() << ":" << x
121  << " y: " << (*p)->position().y() << ":" << y
122  << " z: " << (*p)->position().z() << ":" << z
123  << std::endl;
124 #endif
125  }
126  }//if (genEventInfoHandle.isValid())
127 
128  bool flag(false);
129  if (method2_) {
130  bool cond1 = y==0 && x >=(-hexside_ * sqrt(3)/2.);
131  bool cond2 = ((y+hexside_) >= -x/sqrt(3)) && (y<0&&x<0);
132  bool cond3 = (y*sqrt(3) >= (x - hexside_*sqrt(3))) && (y<0 && x>0);
133  bool cond4 = y==0 && x <=(hexside_ * sqrt(3)/2.);
134  bool cond5 = (-y*sqrt(3) >= (x - hexside_*sqrt(3))) && (y>0&&x>0);
135  bool cond6 = ((y-hexside_) <= x/sqrt(3)) && (y>0&&x<0);
136  flag = cond1 || cond2 || cond3 || cond4 || cond5 || cond6;
137  } else {
138  double absx = std::abs(x);
139  double absy = std::abs(y);
140  if (absx <= hexwidth_ && absy <= hexside_) {
141  if (absy <= hexwidth_*tan30deg_ ||
142  absx <= (2.*hexwidth_ - absy/tan30deg_)) flag = true;
143  }
144  }
145 
146 #ifdef DebugLog
147  if (verbosity_) std::cout << "Selection Flag " << flag << std::endl;
148 #endif
149  return flag;
150 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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 60 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

double HGCalTBCheckGunPostion::hexside_
private

Definition at line 62 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

double HGCalTBCheckGunPostion::hexwidth_
private

Definition at line 62 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

bool HGCalTBCheckGunPostion::method2_
private

Definition at line 61 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

double HGCalTBCheckGunPostion::tan30deg_
private

Definition at line 62 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().

bool HGCalTBCheckGunPostion::verbosity_
private

Definition at line 61 of file HGCalTBCheckGunPosition.cc.

Referenced by filter(), and HGCalTBCheckGunPostion().