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

#include <RPCSimParam.h>

Inheritance diagram for RPCSimParam:
RPCSim

Public Member Functions

 RPCSimParam (const edm::ParameterSet &config)
 
void setRandomEngine (CLHEP::HepRandomEngine &eng)
 
void simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits)
 
void simulateNoise (const RPCRoll *)
 
 ~RPCSimParam ()
 
- 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
 
double aveCls
 
double aveEff
 
double dtimCs
 
CLHEP::RandFlat * flatDistribution1
 
CLHEP::RandFlat * flatDistribution2
 
CLHEP::RandFlat * flatDistribution_
 
double gate
 
double lbGate
 
int N_hits
 
int nbxing
 
CLHEP::RandPoissonQ * poissonDistribution
 
double rate
 
double resEle
 
double resRPC
 
bool rpcdigiprint
 
double sspeed
 
double timOff
 

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 parametrized model (ORCA-based)

Author
Marcello Maggi – INFN Bari

Definition at line 22 of file RPCSimParam.h.

Constructor & Destructor Documentation

RPCSimParam::RPCSimParam ( const edm::ParameterSet config)

Definition at line 19 of file RPCSimParam.cc.

References _rpcSync, aveCls, aveEff, gather_cfg::cout, dtimCs, gate, edm::ParameterSet::getParameter(), lbGate, nbxing, rate, resEle, resRPC, rpcdigiprint, sspeed, and timOff.

19  : RPCSim(config){
20  aveEff = config.getParameter<double>("averageEfficiency");
21  aveCls = config.getParameter<double>("averageClusterSize");
22  resRPC = config.getParameter<double>("timeResolution");
23  timOff = config.getParameter<double>("timingRPCOffset");
24  dtimCs = config.getParameter<double>("deltatimeAdjacentStrip");
25  resEle = config.getParameter<double>("timeJitter");
26  sspeed = config.getParameter<double>("signalPropagationSpeed");
27  lbGate = config.getParameter<double>("linkGateWidth");
28  rpcdigiprint = config.getParameter<bool>("printOutDigitizer");
29 
30  rate=config.getParameter<double>("Rate");
31  nbxing=config.getParameter<int>("Nbxing");
32  gate=config.getParameter<double>("Gate");
33 
34  if (rpcdigiprint) {
35  std::cout <<"Average Efficiency = "<<aveEff<<std::endl;
36  std::cout <<"Average Cluster Size = "<<aveCls<<" strips"<<std::endl;
37  std::cout <<"RPC Time Resolution = "<<resRPC<<" ns"<<std::endl;
38  std::cout <<"RPC Signal formation time = "<<timOff<<" ns"<<std::endl;
39  std::cout <<"RPC adjacent strip delay = "<<dtimCs<<" ns"<<std::endl;
40  std::cout <<"Electronic Jitter = "<<resEle<<" ns"<<std::endl;
41  std::cout <<"Signal propagation time = "<<sspeed<<" x c"<<std::endl;
42  std::cout <<"Link Board Gate Width = "<<lbGate<<" ns"<<std::endl;
43  }
44 
45  _rpcSync = new RPCSynchronizer(config);
46 }
bool rpcdigiprint
Definition: RPCSimParam.h:46
double resEle
Definition: RPCSimParam.h:43
T getParameter(std::string const &) const
double aveEff
Definition: RPCSimParam.h:36
double gate
Definition: RPCSimParam.h:51
double aveCls
Definition: RPCSimParam.h:39
double resRPC
Definition: RPCSimParam.h:40
double dtimCs
Definition: RPCSimParam.h:42
double timOff
Definition: RPCSimParam.h:41
RPCSim(const edm::ParameterSet &config)
Definition: RPCSim.cc:5
double lbGate
Definition: RPCSimParam.h:45
tuple cout
Definition: gather_cfg.py:121
RPCSynchronizer * _rpcSync
Definition: RPCSimParam.h:53
double rate
Definition: RPCSimParam.h:50
double sspeed
Definition: RPCSimParam.h:44
RPCSimParam::~RPCSimParam ( )

Definition at line 57 of file RPCSimParam.cc.

References _rpcSync, flatDistribution1, flatDistribution2, flatDistribution_, and poissonDistribution.

57  {
58  delete flatDistribution_;
59  delete flatDistribution1;
60  delete flatDistribution2;
61  delete poissonDistribution;
62  delete _rpcSync;
63 }
CLHEP::RandFlat * flatDistribution1
Definition: RPCSimParam.h:57
CLHEP::RandPoissonQ * poissonDistribution
Definition: RPCSimParam.h:59
CLHEP::RandFlat * flatDistribution2
Definition: RPCSimParam.h:58
CLHEP::RandFlat * flatDistribution_
Definition: RPCSimParam.h:56
RPCSynchronizer * _rpcSync
Definition: RPCSimParam.h:53

Member Function Documentation

void RPCSimParam::init ( void  )
inlineprivatevirtual

Implements RPCSim.

Definition at line 36 of file RPCSimParam.h.

36 {};
void RPCSimParam::setRandomEngine ( CLHEP::HepRandomEngine &  eng)
virtual

Implements RPCSim.

Definition at line 48 of file RPCSimParam.cc.

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

48  {
49  flatDistribution_ = new CLHEP::RandFlat(eng);
50  flatDistribution1 = new CLHEP::RandFlat(eng);
51  flatDistribution2 = new CLHEP::RandFlat(eng);
52  poissonDistribution = new CLHEP::RandPoissonQ(eng);
54 }
CLHEP::RandFlat * flatDistribution1
Definition: RPCSimParam.h:57
CLHEP::RandPoissonQ * poissonDistribution
Definition: RPCSimParam.h:59
void setRandomEngine(CLHEP::HepRandomEngine &eng)
CLHEP::RandFlat * flatDistribution2
Definition: RPCSimParam.h:58
CLHEP::RandFlat * flatDistribution_
Definition: RPCSimParam.h:56
RPCSynchronizer * _rpcSync
Definition: RPCSimParam.h:53
void RPCSimParam::simulate ( const RPCRoll roll,
const edm::PSimHitContainer rpcHits 
)
virtual

Implements RPCSim.

Definition at line 67 of file RPCSimParam.cc.

References _rpcSync, aveCls, aveEff, RPCRoll::centreOfStrip(), GetRecoTauVFromDQM_MC_cff::cl, edm::DetSet< T >::clear(), alignCSCRings::e, flatDistribution_, RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBx(), i, RPCRoll::id(), create_public_lumi_plots::log, RPCRoll::nstrips(), DetId::rawId(), RPCSynchronizer::setRPCSimSetUp(), RPCRoll::specs(), RPCSim::strips, RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, RPCRollSpecs::topology(), w(), and PV3DBase< T, PVType, FrameType >::x().

69 {
72  theDetectorHitMap.clear();
74 
75  const Topology& topology=roll->specs()->topology();
76 
77  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
78  _hit != rpcHits.end(); ++_hit){
79 
80  // Here I hould check if the RPC are up side down;
81  const LocalPoint& entr=_hit->entryPoint();
82  int time_hit = _rpcSync->getSimHitBx(&(*_hit));
83 
84  // Effinciecy
85  float eff = flatDistribution_->fire(1);
86  if (eff < aveEff) {
87 
88  int centralStrip = topology.channel(entr)+1;
89  int fstrip=centralStrip;
90  int lstrip=centralStrip;
91  // Compute the cluster size
92  double w = flatDistribution_->fire(1);
93  if (w < 1.e-10) w=1.e-10;
94  int clsize = static_cast<int>( -1.*aveCls*log(w)+1.);
95  std::vector<int> cls;
96  cls.push_back(centralStrip);
97  if (clsize > 1){
98  for (int cl = 0; cl < (clsize-1)/2; cl++)
99  if (centralStrip - cl -1 >= 1 ){
100  fstrip = centralStrip-cl-1;
101  cls.push_back(fstrip);
102  }
103  for (int cl = 0; cl < (clsize-1)/2; cl++)
104  if (centralStrip + cl + 1 <= roll->nstrips() ){
105  lstrip = centralStrip+cl+1;
106  cls.push_back(lstrip);
107  }
108  if (clsize%2 == 0 ){
109  // insert the last strip according to the
110  // simhit position in the central strip
111  double deltaw=roll->centreOfStrip(centralStrip).x()-entr.x();
112  if (deltaw<0.) {
113  if (lstrip < roll->nstrips() ){
114  lstrip++;
115  cls.push_back(lstrip);
116  }
117  }else{
118  if (fstrip > 1 ){
119  fstrip--;
120  cls.push_back(fstrip);
121  }
122  }
123  }
124  }
125 
126  for (std::vector<int>::iterator i=cls.begin(); i!=cls.end();i++){
127  // Check the timing of the adjacent strip
128  std::pair<unsigned int, int> digi(*i,time_hit);
129 
130  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
131  strips.insert(digi);
132  }
133  }
134  }
135 }
int i
Definition: DBlmapReader.cc:9
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:52
double aveEff
Definition: RPCSimParam.h:36
DetectorHitMap theDetectorHitMap
Definition: RPCSim.h:68
void setRPCSimSetUp(RPCSimSetUp *simsetup)
int nstrips() const
Definition: RPCRoll.cc:46
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:47
const RPCRollSpecs * specs() const
Definition: RPCRoll.cc:18
double aveCls
Definition: RPCSimParam.h:39
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
CLHEP::RandFlat * flatDistribution_
Definition: RPCSimParam.h:56
T w() const
RPCSynchronizer * _rpcSync
Definition: RPCSimParam.h:53
T x() const
Definition: PV3DBase.h:62
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:70
const Topology & topology() const
Definition: RPCRollSpecs.cc:43
void RPCSimParam::simulateNoise ( const RPCRoll roll)
virtual

Implements RPCSim.

Definition at line 138 of file RPCSimParam.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.

139 {
140 
141  RPCDetId rpcId = roll->id();
142  int nstrips = roll->nstrips();
143  double area = 0.0;
144 
145  if ( rpcId.region() == 0 )
146  {
147  const RectangularStripTopology* top_ = dynamic_cast<const
148  RectangularStripTopology*>(&(roll->topology()));
149  float xmin = (top_->localPosition(0.)).x();
150  float xmax = (top_->localPosition((float)roll->nstrips())).x();
151  float striplength = (top_->stripLength());
152  area = striplength*(xmax-xmin);
153  }
154  else
155  {
156  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
157  float xmin = (top_->localPosition(0.)).x();
158  float xmax = (top_->localPosition((float)roll->nstrips())).x();
159  float striplength = (top_->stripLength());
160  area = striplength*(xmax-xmin);
161  }
162 
163  double ave = rate*nbxing*gate*area*1.0e-9;
164 
165  N_hits = poissonDistribution->fire(ave);
166 
167  for (int i = 0; i < N_hits; i++ ){
168  int strip = static_cast<int>(flatDistribution1->fire(1,nstrips));
169  int time_hit;
170  time_hit = (static_cast<int>(flatDistribution2->fire((nbxing*gate)/gate))) - nbxing/2;
171  std::pair<int, int> digi(strip,time_hit);
172  strips.insert(digi);
173  }
174 
175 }
int i
Definition: DBlmapReader.cc:9
const Topology & topology() const
Definition: RPCRoll.cc:30
CLHEP::RandFlat * flatDistribution1
Definition: RPCSimParam.h:57
double gate
Definition: RPCSimParam.h:51
int nstrips() const
Definition: RPCRoll.cc:46
CLHEP::RandPoissonQ * poissonDistribution
Definition: RPCSimParam.h:59
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:57
RPCDetId id() const
Definition: RPCRoll.cc:24
string const
Definition: compareJSON.py:14
CLHEP::RandFlat * flatDistribution2
Definition: RPCSimParam.h:58
Definition: DDAxes.h:10
double rate
Definition: RPCSimParam.h:50
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63

Member Data Documentation

RPCSynchronizer* RPCSimParam::_rpcSync
private

Definition at line 53 of file RPCSimParam.h.

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

double RPCSimParam::aveCls
private

Definition at line 39 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulate().

double RPCSimParam::aveEff
private

Definition at line 36 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulate().

double RPCSimParam::dtimCs
private

Definition at line 42 of file RPCSimParam.h.

Referenced by RPCSimParam().

CLHEP::RandFlat* RPCSimParam::flatDistribution1
private

Definition at line 57 of file RPCSimParam.h.

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

CLHEP::RandFlat* RPCSimParam::flatDistribution2
private

Definition at line 58 of file RPCSimParam.h.

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

CLHEP::RandFlat* RPCSimParam::flatDistribution_
private

Definition at line 56 of file RPCSimParam.h.

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

double RPCSimParam::gate
private

Definition at line 51 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulateNoise().

double RPCSimParam::lbGate
private

Definition at line 45 of file RPCSimParam.h.

Referenced by RPCSimParam().

int RPCSimParam::N_hits
private

Definition at line 48 of file RPCSimParam.h.

Referenced by simulateNoise().

int RPCSimParam::nbxing
private

Definition at line 49 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulateNoise().

CLHEP::RandPoissonQ* RPCSimParam::poissonDistribution
private

Definition at line 59 of file RPCSimParam.h.

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

double RPCSimParam::rate
private

Definition at line 50 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulateNoise().

double RPCSimParam::resEle
private

Definition at line 43 of file RPCSimParam.h.

Referenced by RPCSimParam().

double RPCSimParam::resRPC
private

Definition at line 40 of file RPCSimParam.h.

Referenced by RPCSimParam().

bool RPCSimParam::rpcdigiprint
private

Definition at line 46 of file RPCSimParam.h.

Referenced by RPCSimParam().

double RPCSimParam::sspeed
private

Definition at line 44 of file RPCSimParam.h.

Referenced by RPCSimParam().

double RPCSimParam::timOff
private

Definition at line 41 of file RPCSimParam.h.

Referenced by RPCSimParam().