CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
GEMSimAverage Class Reference

#include <GEMSimAverage.h>

Inheritance diagram for GEMSimAverage:
GEMSim

Public Member Functions

 GEMSimAverage (const edm::ParameterSet &config)
 
void setRandomEngine (CLHEP::HepRandomEngine &eng)
 
void simulate (const GEMEtaPartition *roll, const edm::PSimHitContainer &rpcHits)
 
void simulateNoise (const GEMEtaPartition *roll)
 
 ~GEMSimAverage ()
 
- Public Member Functions inherited from GEMSim
virtual void fillDigis (int rollDetId, GEMDigiCollection &digis)
 
GEMSimSetUpgetGEMSimSetUp ()
 
void setGEMSimSetUp (GEMSimSetUp *setup)
 
const StripDigiSimLinksstripDigiSimLinks () const
 
virtual ~GEMSim ()
 

Private Member Functions

void init ()
 

Private Attributes

double averageEfficiency_
 
double averageNoiseRate_
 
double averageShapingTime_
 
double bxwidth_
 
CLHEP::RandFlat * flatDistr1_
 
CLHEP::RandFlat * flatDistr2_
 
int maxBunch_
 
int minBunch_
 
CLHEP::RandPoissonQ * poissonDistr_
 
GEMSynchronizersync_
 

Additional Inherited Members

- Public Types inherited from GEMSim
typedef edm::DetSet
< StripDigiSimLink
StripDigiSimLinks
 
- Protected Types inherited from GEMSim
typedef std::multimap
< std::pair< unsigned int, int >
, const PSimHit *, std::less
< std::pair< unsigned int, int > > > 
DetectorHitMap
 
- Protected Member Functions inherited from GEMSim
virtual void addLinks (unsigned int strip, int bx)
 
 GEMSim (const edm::ParameterSet &config)
 
- Protected Attributes inherited from GEMSim
DetectorHitMap detectorHitMap_
 
GEMSimSetUpsimSetUp_
 
StripDigiSimLinks stripDigiSimLinks_
 
std::set< std::pair< int, int > > strips_
 

Detailed Description

Class for the GEM strip response simulation that extends the Trivial model with average parameters for the GEM efficiency, timing and noise

Author
Sven Dildick

Definition at line 24 of file GEMSimAverage.h.

Constructor & Destructor Documentation

GEMSimAverage::GEMSimAverage ( const edm::ParameterSet config)

Definition at line 22 of file GEMSimAverage.cc.

References averageEfficiency_, averageNoiseRate_, averageShapingTime_, bxwidth_, edm::ParameterSet::getParameter(), maxBunch_, minBunch_, and sync_.

22  :
23  GEMSim(config)
24 {
25  averageEfficiency_ = config.getParameter<double>("averageEfficiency");
26  averageShapingTime_ = config.getParameter<double>("averageShapingTime");
27  averageNoiseRate_ = config.getParameter<double>("averageNoiseRate");
28  bxwidth_ = config.getParameter<double>("bxwidth");
29  minBunch_ = config.getParameter<int>("minBunch");
30  maxBunch_ = config.getParameter<int>("maxBunch");
31 
32  sync_ = new GEMSynchronizer(config);
33 }
T getParameter(std::string const &) const
double averageNoiseRate_
Definition: GEMSimAverage.h:45
double averageEfficiency_
Definition: GEMSimAverage.h:43
double averageShapingTime_
Definition: GEMSimAverage.h:44
GEMSim(const edm::ParameterSet &config)
Definition: GEMSim.h:50
GEMSynchronizer * sync_
Definition: GEMSimAverage.h:42
GEMSimAverage::~GEMSimAverage ( )

Definition at line 44 of file GEMSimAverage.cc.

References flatDistr1_, flatDistr2_, poissonDistr_, and sync_.

45 {
46  if (flatDistr1_) delete flatDistr1_;
47  if (flatDistr2_) delete flatDistr2_;
48  if (poissonDistr_) delete poissonDistr_;
49  delete sync_;
50 }
CLHEP::RandFlat * flatDistr2_
Definition: GEMSimAverage.h:52
CLHEP::RandFlat * flatDistr1_
Definition: GEMSimAverage.h:51
CLHEP::RandPoissonQ * poissonDistr_
Definition: GEMSimAverage.h:53
GEMSynchronizer * sync_
Definition: GEMSimAverage.h:42

Member Function Documentation

void GEMSimAverage::init ( void  )
inlineprivatevirtual

Implements GEMSim.

Definition at line 40 of file GEMSimAverage.h.

40 {}
void GEMSimAverage::setRandomEngine ( CLHEP::HepRandomEngine &  eng)
virtual

Implements GEMSim.

Definition at line 35 of file GEMSimAverage.cc.

References flatDistr1_, flatDistr2_, poissonDistr_, GEMSynchronizer::setRandomEngine(), and sync_.

36 {
37  flatDistr1_ = new CLHEP::RandFlat(eng);
38  flatDistr2_ = new CLHEP::RandFlat(eng);
39  poissonDistr_ = new CLHEP::RandPoissonQ(eng);
40  sync_->setRandomEngine(eng);
41 }
CLHEP::RandFlat * flatDistr2_
Definition: GEMSimAverage.h:52
void setRandomEngine(CLHEP::HepRandomEngine &eng)
CLHEP::RandFlat * flatDistr1_
Definition: GEMSimAverage.h:51
CLHEP::RandPoissonQ * poissonDistr_
Definition: GEMSimAverage.h:53
GEMSynchronizer * sync_
Definition: GEMSimAverage.h:42
void GEMSimAverage::simulate ( const GEMEtaPartition roll,
const edm::PSimHitContainer rpcHits 
)
virtual

Implements GEMSim.

Definition at line 52 of file GEMSimAverage.cc.

References funct::abs(), averageEfficiency_, edm::DetSet< T >::clear(), GEMSim::detectorHitMap_, flatDistr1_, GEMSim::getGEMSimSetUp(), GEMSynchronizer::getSimHitBx(), GEMEtaPartition::id(), DetId::rawId(), GEMSynchronizer::setGEMSimSetUp(), GEMEtaPartition::specs(), GEMSim::stripDigiSimLinks_, GEMSim::strips_, sync_, and GEMEtaPartitionSpecs::topology().

54 {
57  detectorHitMap_.clear();
59 
60  const Topology& topology = roll->specs()->topology();
61 
62  for (const auto & hit: simHits)
63  {
64  if (std::abs(hit.particleType()) != 13) continue;
65  // Check GEM efficiency
66  if (flatDistr1_->fire(1) > averageEfficiency_) continue;
67  auto entry = hit.entryPoint();
68 
69  int time_hit = sync_->getSimHitBx(&hit);
70  std::pair<int, int> digi(topology.channel(entry) + 1, time_hit);
71 
73  strips_.insert(digi);
74  }
75 }
DetectorHitMap detectorHitMap_
Definition: GEMSim.h:67
edm::DetSet< StripDigiSimLink > StripDigiSimLinks
Definition: GEMSim.h:30
std::set< std::pair< int, int > > strips_
Definition: GEMSim.h:54
GEMDetId id() const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const Topology & topology() const
double averageEfficiency_
Definition: GEMSimAverage.h:43
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
CLHEP::RandFlat * flatDistr1_
Definition: GEMSimAverage.h:51
Container::value_type value_type
void setGEMSimSetUp(GEMSimSetUp *simsetup)
const GEMEtaPartitionSpecs * specs() const
tuple simHits
Definition: trackerHits.py:16
GEMSimSetUp * getGEMSimSetUp()
Definition: GEMSim.h:44
void clear()
Definition: DetSet.h:69
int getSimHitBx(const PSimHit *)
GEMSynchronizer * sync_
Definition: GEMSimAverage.h:42
StripDigiSimLinks stripDigiSimLinks_
Definition: GEMSim.h:68
void GEMSimAverage::simulateNoise ( const GEMEtaPartition roll)
virtual

Implements GEMSim.

Definition at line 78 of file GEMSimAverage.cc.

References averageNoiseRate_, bxwidth_, edm::hlt::Exception, flatDistr1_, flatDistr2_, i, GEMEtaPartition::id(), maxBunch_, minBunch_, GEMEtaPartition::nstrips(), poissonDistr_, GEMDetId::region(), GEMSim::strips_, GEMEtaPartition::topology(), x, SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.

79 {
80  GEMDetId gemId = roll->id();
81  int nstrips = roll->nstrips();
82  double area = 0.0;
83 
84  if ( gemId.region() == 0 )
85  {
86  throw cms::Exception("Geometry")
87  << "GEMSynchronizer::simulateNoise() - this GEM id is from barrel, which cannot happen.";
88  }
89  else
90  {
91  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
92  float xmin = (top_->localPosition(0.)).x();
93  float xmax = (top_->localPosition((float)roll->nstrips())).x();
94  float striplength = (top_->stripLength());
95  area = striplength*(xmax-xmin);
96  }
97 
98  const int nBxing = maxBunch_ - minBunch_ + 1;
99  double averageNoise = averageNoiseRate_ * nBxing * bxwidth_ * area * 1.0e-9;
100 
101  int n_hits = poissonDistr_->fire(averageNoise);
102 
103  for (int i = 0; i < n_hits; i++ ){
104  int strip = static_cast<int>(flatDistr1_->fire(1,nstrips));
105  int time_hit = static_cast<int>(flatDistr2_->fire(nBxing)) + minBunch_;
106  std::pair<int, int> digi(strip,time_hit);
107  strips_.insert(digi);
108  }
109 }
int i
Definition: DBlmapReader.cc:9
CLHEP::RandFlat * flatDistr2_
Definition: GEMSimAverage.h:52
std::set< std::pair< int, int > > strips_
Definition: GEMSim.h:54
double averageNoiseRate_
Definition: GEMSimAverage.h:45
const Topology & topology() const
GEMDetId id() const
int nstrips() const
Return the chamber this roll belongs to.
CLHEP::RandFlat * flatDistr1_
Definition: GEMSimAverage.h:51
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: GEMDetId.h:53
CLHEP::RandPoissonQ * poissonDistr_
Definition: GEMSimAverage.h:53
Definition: DDAxes.h:10

Member Data Documentation

double GEMSimAverage::averageEfficiency_
private

Definition at line 43 of file GEMSimAverage.h.

Referenced by GEMSimAverage(), and simulate().

double GEMSimAverage::averageNoiseRate_
private

Definition at line 45 of file GEMSimAverage.h.

Referenced by GEMSimAverage(), and simulateNoise().

double GEMSimAverage::averageShapingTime_
private

Definition at line 44 of file GEMSimAverage.h.

Referenced by GEMSimAverage().

double GEMSimAverage::bxwidth_
private

Definition at line 46 of file GEMSimAverage.h.

Referenced by GEMSimAverage(), and simulateNoise().

CLHEP::RandFlat* GEMSimAverage::flatDistr1_
private

Definition at line 51 of file GEMSimAverage.h.

Referenced by setRandomEngine(), simulate(), simulateNoise(), and ~GEMSimAverage().

CLHEP::RandFlat* GEMSimAverage::flatDistr2_
private

Definition at line 52 of file GEMSimAverage.h.

Referenced by setRandomEngine(), simulateNoise(), and ~GEMSimAverage().

int GEMSimAverage::maxBunch_
private

Definition at line 48 of file GEMSimAverage.h.

Referenced by GEMSimAverage(), and simulateNoise().

int GEMSimAverage::minBunch_
private

Definition at line 47 of file GEMSimAverage.h.

Referenced by GEMSimAverage(), and simulateNoise().

CLHEP::RandPoissonQ* GEMSimAverage::poissonDistr_
private

Definition at line 53 of file GEMSimAverage.h.

Referenced by setRandomEngine(), simulateNoise(), and ~GEMSimAverage().

GEMSynchronizer* GEMSimAverage::sync_
private

Definition at line 42 of file GEMSimAverage.h.

Referenced by GEMSimAverage(), setRandomEngine(), simulate(), and ~GEMSimAverage().