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
RPCSimSimple Class Reference

#include <RPCSimSimple.h>

Inheritance diagram for RPCSimSimple:
RPCSim

Public Member Functions

 RPCSimSimple (const edm::ParameterSet &config)
 
void setRandomEngine (CLHEP::HepRandomEngine &eng)
 
void simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits)
 
void simulateNoise (const RPCRoll *)
 
 ~RPCSimSimple ()
 
- Public Member Functions inherited from RPCSim
const DigiSimLinksdigiSimLinks () const
 
virtual void fillDigis (int rollDetId, RPCDigiCollection &digis)
 
RPCSimSetUpgetRPCSimSetUp ()
 
const RPCDigiSimLinksrpcDigiSimLinks () const
 
void setRPCSimSetUp (RPCSimSetUp *setup)
 
virtual ~RPCSim ()
 

Private Member Functions

void init ()
 

Private Attributes

RPCSynchronizer_rpcSync
 
CLHEP::RandFlat * flatDistribution1
 
CLHEP::RandFlat * flatDistribution2
 
double gate
 
int N_hits
 
int nbxing
 
CLHEP::RandPoissonQ * poissonDistribution
 
double rate
 

Additional Inherited Members

- Public Types inherited from RPCSim
typedef edm::DetSet
< StripDigiSimLink
DigiSimLinks
 
typedef edm::DetSet
< RPCDigiSimLink
RPCDigiSimLinks
 
- Protected Types inherited from RPCSim
typedef std::multimap
< std::pair< unsigned int, int >
, const PSimHit *, std::less
< std::pair< unsigned int, int > > > 
DetectorHitMap
 
- Protected Member Functions inherited from RPCSim
virtual void addLinks (unsigned int strip, int bx)
 
 RPCSim (const edm::ParameterSet &config)
 
- Protected Attributes inherited from RPCSim
std::set< std::pair< int, int > > strips
 
DetectorHitMap theDetectorHitMap
 
DigiSimLinks theDigiSimLinks
 
RPCDigiSimLinks theRpcDigiSimLinks
 
RPCSimSetUptheSimSetUp
 

Detailed Description

Class for the RPC strip response simulation based on a very simple model

Author
Marcello Maggi – INFN Bari

Definition at line 21 of file RPCSimSimple.h.

Constructor & Destructor Documentation

RPCSimSimple::RPCSimSimple ( const edm::ParameterSet config)

Definition at line 28 of file RPCSimSimple.cc.

References _rpcSync, gate, edm::ParameterSet::getParameter(), nbxing, and rate.

28  : RPCSim(config){
29 
30  rate=config.getParameter<double>("Rate");
31  nbxing=config.getParameter<int>("Nbxing");
32  gate=config.getParameter<double>("Gate");
33 
34  _rpcSync = new RPCSynchronizer(config);
35 }
T getParameter(std::string const &) const
RPCSynchronizer * _rpcSync
Definition: RPCSimSimple.h:35
RPCSim(const edm::ParameterSet &config)
Definition: RPCSim.cc:5
RPCSimSimple::~RPCSimSimple ( )

Definition at line 45 of file RPCSimSimple.cc.

References _rpcSync, flatDistribution1, flatDistribution2, and poissonDistribution.

45  {
46  delete flatDistribution1;
47  delete flatDistribution2;
48  delete poissonDistribution;
49  delete _rpcSync;
50 }
CLHEP::RandFlat * flatDistribution2
Definition: RPCSimSimple.h:44
RPCSynchronizer * _rpcSync
Definition: RPCSimSimple.h:35
CLHEP::RandPoissonQ * poissonDistribution
Definition: RPCSimSimple.h:45
CLHEP::RandFlat * flatDistribution1
Definition: RPCSimSimple.h:43

Member Function Documentation

void RPCSimSimple::init ( void  )
inlineprivatevirtual

Implements RPCSim.

Definition at line 35 of file RPCSimSimple.h.

35 {};
void RPCSimSimple::setRandomEngine ( CLHEP::HepRandomEngine &  eng)
virtual

Implements RPCSim.

Definition at line 37 of file RPCSimSimple.cc.

References _rpcSync, flatDistribution1, flatDistribution2, poissonDistribution, and RPCSynchronizer::setRandomEngine().

37  {
38  flatDistribution1 = new CLHEP::RandFlat(eng);
39  flatDistribution2 = new CLHEP::RandFlat(eng);
40  poissonDistribution = new CLHEP::RandPoissonQ(eng);
42 }
CLHEP::RandFlat * flatDistribution2
Definition: RPCSimSimple.h:44
RPCSynchronizer * _rpcSync
Definition: RPCSimSimple.h:35
CLHEP::RandPoissonQ * poissonDistribution
Definition: RPCSimSimple.h:45
void setRandomEngine(CLHEP::HepRandomEngine &eng)
CLHEP::RandFlat * flatDistribution1
Definition: RPCSimSimple.h:43
void RPCSimSimple::simulate ( const RPCRoll roll,
const edm::PSimHitContainer rpcHits 
)
virtual

Implements RPCSim.

Definition at line 54 of file RPCSimSimple.cc.

References _rpcSync, edm::DetSet< T >::clear(), RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBx(), RPCRoll::id(), DetId::rawId(), RPCSynchronizer::setRPCSimSetUp(), RPCRoll::specs(), RPCSim::strips, RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, and RPCRollSpecs::topology().

56 {
59  theDetectorHitMap.clear();
61 
62  const Topology& topology=roll->specs()->topology();
63  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
64  _hit != rpcHits.end(); ++_hit){
65 
66 
67  // Here I hould check if the RPC are up side down;
68  const LocalPoint& entr=_hit->entryPoint();
69  int time_hit = _rpcSync->getSimHitBx(&(*_hit));
70  // const LocalPoint& exit=_hit->exitPoint();
71 
72  std::pair<int, int> digi(topology.channel(entr)+1,
73  time_hit);
74 
75  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
76  strips.insert(digi);
77  }
78 }
RPCSynchronizer * _rpcSync
Definition: RPCSimSimple.h:35
DetectorHitMap theDetectorHitMap
Definition: RPCSim.h:68
void setRPCSimSetUp(RPCSimSetUp *simsetup)
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:47
const RPCRollSpecs * specs() const
Definition: RPCRoll.cc:18
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:57
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Definition: RPCSim.h:32
RPCDetId id() const
Definition: RPCRoll.cc:24
Container::value_type value_type
int getSimHitBx(const PSimHit *)
void clear()
Definition: DetSet.h:69
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:70
const Topology & topology() const
Definition: RPCRollSpecs.cc:43
void RPCSimSimple::simulateNoise ( const RPCRoll roll)
virtual

Implements RPCSim.

Definition at line 81 of file RPCSimSimple.cc.

References compareJSON::const, flatDistribution1, flatDistribution2, gate, i, RPCRoll::id(), N_hits, nbxing, RPCRoll::nstrips(), poissonDistribution, rate, RPCDetId::region(), RPCSim::strips, RPCRoll::topology(), x, SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.

82 {
83 
84  RPCDetId rpcId = roll->id();
85  int nstrips = roll->nstrips();
86  double area = 0.0;
87 
88  if ( rpcId.region() == 0 )
89  {
90  const RectangularStripTopology* top_ = dynamic_cast<const
91  RectangularStripTopology*>(&(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  else
98  {
99  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
100  float xmin = (top_->localPosition(0.)).x();
101  float xmax = (top_->localPosition((float)roll->nstrips())).x();
102  float striplength = (top_->stripLength());
103  area = striplength*(xmax-xmin);
104  }
105 
106  double ave = rate*nbxing*gate*area*1.0e-9;
107 
108  N_hits = poissonDistribution->fire(ave);
109 
110  for (int i = 0; i < N_hits; i++ ){
111  int strip = static_cast<int>(flatDistribution1->fire(1, nstrips));
112  int time_hit;
113  time_hit = (static_cast<int>(flatDistribution2->fire((nbxing*gate)/gate))) - nbxing/2;
114  std::pair<int, int> digi(strip,time_hit);
115  strips.insert(digi);
116  }
117 }
int i
Definition: DBlmapReader.cc:9
CLHEP::RandFlat * flatDistribution2
Definition: RPCSimSimple.h:44
const Topology & topology() const
Definition: RPCRoll.cc:30
int nstrips() const
Definition: RPCRoll.cc:46
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:57
RPCDetId id() const
Definition: RPCRoll.cc:24
CLHEP::RandPoissonQ * poissonDistribution
Definition: RPCSimSimple.h:45
string const
Definition: compareJSON.py:14
Definition: DDAxes.h:10
CLHEP::RandFlat * flatDistribution1
Definition: RPCSimSimple.h:43
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63

Member Data Documentation

RPCSynchronizer* RPCSimSimple::_rpcSync
private

Definition at line 35 of file RPCSimSimple.h.

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

CLHEP::RandFlat* RPCSimSimple::flatDistribution1
private

Definition at line 43 of file RPCSimSimple.h.

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

CLHEP::RandFlat* RPCSimSimple::flatDistribution2
private

Definition at line 44 of file RPCSimSimple.h.

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

double RPCSimSimple::gate
private

Definition at line 41 of file RPCSimSimple.h.

Referenced by RPCSimSimple(), and simulateNoise().

int RPCSimSimple::N_hits
private

Definition at line 38 of file RPCSimSimple.h.

Referenced by simulateNoise().

int RPCSimSimple::nbxing
private

Definition at line 39 of file RPCSimSimple.h.

Referenced by RPCSimSimple(), and simulateNoise().

CLHEP::RandPoissonQ* RPCSimSimple::poissonDistribution
private

Definition at line 45 of file RPCSimSimple.h.

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

double RPCSimSimple::rate
private

Definition at line 40 of file RPCSimSimple.h.

Referenced by RPCSimSimple(), and simulateNoise().