CMS 3D CMS Logo

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 simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
 
void simulateNoise (const RPCRoll *, CLHEP::HepRandomEngine *) override
 
 ~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 () override
 

Private Attributes

RPCSynchronizer_rpcSync
 
double gate
 
int N_hits
 
int nbxing
 
double rate
 

Additional Inherited Members

- Public Types inherited from RPCSim
typedef edm::DetSet< StripDigiSimLinkDigiSimLinks
 
typedef edm::DetSet< RPCDigiSimLinkRPCDigiSimLinks
 
- 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< RPCDigiirpc_digis
 
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 19 of file RPCSimSimple.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file RPCSimSimple.cc.

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

20  : RPCSim(config){
21 
22  rate=config.getParameter<double>("Rate");
23  nbxing=config.getParameter<int>("Nbxing");
24  gate=config.getParameter<double>("Gate");
25 
26  _rpcSync = new RPCSynchronizer(config);
27 }
T getParameter(std::string const &) const
RPCSynchronizer * _rpcSync
Definition: RPCSimSimple.h:32
RPCSim(const edm::ParameterSet &config)
Definition: RPCSim.cc:5
RPCSimSimple::~RPCSimSimple ( )

Definition at line 29 of file RPCSimSimple.cc.

References _rpcSync.

29  {
30  delete _rpcSync;
31 }
RPCSynchronizer * _rpcSync
Definition: RPCSimSimple.h:32

Member Function Documentation

void RPCSimSimple::init ( void  )
inlineoverrideprivatevirtual

Implements RPCSim.

Definition at line 32 of file RPCSimSimple.h.

32 {};
void RPCSimSimple::simulate ( const RPCRoll roll,
const edm::PSimHitContainer rpcHits,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 35 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, RPCRollSpecs::topology(), and ecaldqm::topology().

38 {
41  theDetectorHitMap.clear();
43 
44  const Topology& topology=roll->specs()->topology();
45  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
46  _hit != rpcHits.end(); ++_hit){
47 
48 
49  // Here I hould check if the RPC are up side down;
50  const LocalPoint& entr=_hit->entryPoint();
51  int time_hit = _rpcSync->getSimHitBx(&(*_hit), engine);
52  // const LocalPoint& exit=_hit->exitPoint();
53 
54  std::pair<int, int> digi(topology.channel(entr)+1,
55  time_hit);
56 
57  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
58  strips.insert(digi);
59  }
60 }
CaloTopology const * topology(0)
RPCSynchronizer * _rpcSync
Definition: RPCSimSimple.h:32
DetectorHitMap theDetectorHitMap
Definition: RPCSim.h:72
void setRPCSimSetUp(RPCSimSetUp *simsetup)
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
const RPCRollSpecs * specs() const
Definition: RPCRoll.cc:18
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:60
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Definition: RPCSim.h:35
RPCDetId id() const
Definition: RPCRoll.cc:24
void clear()
Definition: DetSet.h:69
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:74
const Topology & topology() const
Definition: RPCRollSpecs.cc:43
void RPCSimSimple::simulateNoise ( const RPCRoll roll,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 63 of file RPCSimSimple.cc.

References gate, i, RPCRoll::id(), RectangularStripTopology::localPosition(), TrapezoidalStripTopology::localPosition(), N_hits, nbxing, RPCRoll::nstrips(), rate, RPCDetId::region(), digi_MixPreMix_cfi::strip, RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCSim::strips, RPCRoll::topology(), x, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

65 {
66 
67  RPCDetId rpcId = roll->id();
68  int nstrips = roll->nstrips();
69  double area = 0.0;
70 
71  if ( rpcId.region() == 0 )
72  {
73  const RectangularStripTopology* top_ = dynamic_cast<const
74  RectangularStripTopology*>(&(roll->topology()));
75  float xmin = (top_->localPosition(0.)).x();
76  float xmax = (top_->localPosition((float)roll->nstrips())).x();
77  float striplength = (top_->stripLength());
78  area = striplength*(xmax-xmin);
79  }
80  else
81  {
82  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
83  float xmin = (top_->localPosition(0.)).x();
84  float xmax = (top_->localPosition((float)roll->nstrips())).x();
85  float striplength = (top_->stripLength());
86  area = striplength*(xmax-xmin);
87  }
88 
89  double ave = rate*nbxing*gate*area*1.0e-9;
90 
91  CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
92  N_hits = randPoissonQ.fire();
93 
94  for (int i = 0; i < N_hits; i++ ){
95  int strip = static_cast<int>(CLHEP::RandFlat::shoot(engine, 1, nstrips));
96  int time_hit;
97  time_hit = (static_cast<int>(CLHEP::RandFlat::shoot(engine, (nbxing*gate)/gate))) - nbxing/2;
98  std::pair<int, int> digi(strip,time_hit);
99  strips.insert(digi);
100  }
101 }
int i
Definition: DBlmapReader.cc:9
const Topology & topology() const
Definition: RPCRoll.cc:30
virtual float stripLength() const
int nstrips() const
Definition: RPCRoll.cc:46
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:60
RPCDetId id() const
Definition: RPCRoll.cc:24
virtual LocalPoint localPosition(float strip) const
virtual LocalPoint localPosition(float strip) const
virtual float stripLength() const
det heigth (strip length in the middle)
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 32 of file RPCSimSimple.h.

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

double RPCSimSimple::gate
private

Definition at line 38 of file RPCSimSimple.h.

Referenced by RPCSimSimple(), and simulateNoise().

int RPCSimSimple::N_hits
private

Definition at line 35 of file RPCSimSimple.h.

Referenced by simulateNoise().

int RPCSimSimple::nbxing
private

Definition at line 36 of file RPCSimSimple.h.

Referenced by RPCSimSimple(), and simulateNoise().

double RPCSimSimple::rate
private

Definition at line 37 of file RPCSimSimple.h.

Referenced by RPCSimSimple(), and simulateNoise().