CMS 3D CMS Logo

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 simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
 
void simulateNoise (const RPCRoll *, CLHEP::HepRandomEngine *) override
 
 ~RPCSimParam () override
 
- 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 aveCls
 
double aveEff
 
double dtimCs
 
double gate
 
double lbGate
 
int N_hits
 
int nbxing
 
double rate
 
double resEle
 
double resRPC
 
bool rpcdigiprint
 
double sspeed
 
double timOff
 

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

Author
Marcello Maggi – INFN Bari

Definition at line 20 of file RPCSimParam.h.

Constructor & Destructor Documentation

◆ RPCSimParam()

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

Definition at line 12 of file RPCSimParam.cc.

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

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

◆ ~RPCSimParam()

RPCSimParam::~RPCSimParam ( )
override

Definition at line 41 of file RPCSimParam.cc.

References _rpcSync.

41 { delete _rpcSync; }
RPCSynchronizer * _rpcSync
Definition: RPCSimParam.h:48

Member Function Documentation

◆ init()

void RPCSimParam::init ( void  )
inlineoverrideprivatevirtual

Implements RPCSim.

Definition at line 30 of file RPCSimParam.h.

30 {};

◆ simulate()

void RPCSimParam::simulate ( const RPCRoll roll,
const edm::PSimHitContainer rpcHits,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 43 of file RPCSimParam.cc.

References _rpcSync, aveCls, aveEff, haddnano::cl, edm::DetSet< T >::clear(), MillePedeFileConverter_cfg::e, RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBx(), mps_fire::i, dqm-mbProfile::log, nano_mu_digi_cff::roll, RPCSynchronizer::setRPCSimSetUp(), RPCSim::strips, RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, w(), and PV3DBase< T, PVType, FrameType >::x().

43  {
46  theDetectorHitMap.clear();
47  theRpcDigiSimLinks = RPCDigiSimLinks(roll->id().rawId());
48 
49  const Topology& topology = roll->specs()->topology();
50 
51  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit) {
52  // Here I hould check if the RPC are up side down;
53  const LocalPoint& entr = _hit->entryPoint();
54  int time_hit = _rpcSync->getSimHitBx(&(*_hit), engine);
55 
56  // Effinciecy
57  float eff = CLHEP::RandFlat::shoot(engine);
58  if (eff < aveEff) {
59  int centralStrip = topology.channel(entr) + 1;
60  int fstrip = centralStrip;
61  int lstrip = centralStrip;
62  // Compute the cluster size
63  double w = CLHEP::RandFlat::shoot(engine);
64  if (w < 1.e-10)
65  w = 1.e-10;
66  int clsize = static_cast<int>(-1. * aveCls * log(w) + 1.);
67  std::vector<int> cls;
68  cls.push_back(centralStrip);
69  if (clsize > 1) {
70  for (int cl = 0; cl < (clsize - 1) / 2; cl++)
71  if (centralStrip - cl - 1 >= 1) {
72  fstrip = centralStrip - cl - 1;
73  cls.push_back(fstrip);
74  }
75  for (int cl = 0; cl < (clsize - 1) / 2; cl++)
76  if (centralStrip + cl + 1 <= roll->nstrips()) {
77  lstrip = centralStrip + cl + 1;
78  cls.push_back(lstrip);
79  }
80  if (clsize % 2 == 0) {
81  // insert the last strip according to the
82  // simhit position in the central strip
83  double deltaw = roll->centreOfStrip(centralStrip).x() - entr.x();
84  if (deltaw < 0.) {
85  if (lstrip < roll->nstrips()) {
86  lstrip++;
87  cls.push_back(lstrip);
88  }
89  } else {
90  if (fstrip > 1) {
91  fstrip--;
92  cls.push_back(fstrip);
93  }
94  }
95  }
96  }
97 
98  for (std::vector<int>::iterator i = cls.begin(); i != cls.end(); i++) {
99  // Check the timing of the adjacent strip
100  std::pair<unsigned int, int> digi(*i, time_hit);
101 
102  theDetectorHitMap.insert(DetectorHitMap::value_type(digi, &(*_hit)));
103  strips.insert(digi);
104  }
105  }
106  }
107 }
double aveEff
Definition: RPCSimParam.h:30
T w() const
DetectorHitMap theDetectorHitMap
Definition: RPCSim.h:68
void setRPCSimSetUp(RPCSimSetUp *simsetup)
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:45
double aveCls
Definition: RPCSimParam.h:34
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
T x() const
Definition: PV3DBase.h:59
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Definition: RPCSim.h:33
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:55
void clear()
Definition: DetSet.h:71
RPCSynchronizer * _rpcSync
Definition: RPCSimParam.h:48
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:70

◆ simulateNoise()

void RPCSimParam::simulateNoise ( const RPCRoll roll,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 109 of file RPCSimParam.cc.

References custom_jme_cff::area, gate, mps_fire::i, RectangularStripTopology::localPosition(), TrapezoidalStripTopology::localPosition(), N_hits, nbxing, rate, RPCDetId::region(), nano_mu_digi_cff::roll, nano_mu_digi_cff::strip, RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCSim::strips, x, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

109  {
110  RPCDetId rpcId = roll->id();
111  int nstrips = roll->nstrips();
112  double area = 0.0;
113 
114  if (rpcId.region() == 0) {
115  const RectangularStripTopology* top_ = dynamic_cast<const RectangularStripTopology*>(&(roll->topology()));
116  float xmin = (top_->localPosition(0.)).x();
117  float xmax = (top_->localPosition((float)roll->nstrips())).x();
118  float striplength = (top_->stripLength());
119  area = striplength * (xmax - xmin);
120  } else {
121  const TrapezoidalStripTopology* top_ = dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
122  float xmin = (top_->localPosition(0.)).x();
123  float xmax = (top_->localPosition((float)roll->nstrips())).x();
124  float striplength = (top_->stripLength());
125  area = striplength * (xmax - xmin);
126  }
127 
128  double ave = rate * nbxing * gate * area * 1.0e-9;
129 
130  CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
131  N_hits = randPoissonQ.fire();
132 
133  for (int i = 0; i < N_hits; i++) {
134  int strip = static_cast<int>(CLHEP::RandFlat::shoot(engine, 1, nstrips));
135  int time_hit;
136  time_hit = (static_cast<int>(CLHEP::RandFlat::shoot(engine, (nbxing * gate) / gate))) - nbxing / 2;
137  std::pair<int, int> digi(strip, time_hit);
138  strips.insert(digi);
139  }
140 }
LocalPoint localPosition(float strip) const override
double gate
Definition: RPCSimParam.h:46
float stripLength() const override
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:55
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
float stripLength() const override
det heigth (strip length in the middle)
double rate
Definition: RPCSimParam.h:45
LocalPoint localPosition(float strip) const override

Member Data Documentation

◆ _rpcSync

RPCSynchronizer* RPCSimParam::_rpcSync
private

Definition at line 48 of file RPCSimParam.h.

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

◆ aveCls

double RPCSimParam::aveCls
private

Definition at line 34 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulate().

◆ aveEff

double RPCSimParam::aveEff
private

Definition at line 30 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulate().

◆ dtimCs

double RPCSimParam::dtimCs
private

Definition at line 37 of file RPCSimParam.h.

Referenced by RPCSimParam().

◆ gate

double RPCSimParam::gate
private

Definition at line 46 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulateNoise().

◆ lbGate

double RPCSimParam::lbGate
private

Definition at line 40 of file RPCSimParam.h.

Referenced by RPCSimParam().

◆ N_hits

int RPCSimParam::N_hits
private

Definition at line 43 of file RPCSimParam.h.

Referenced by simulateNoise().

◆ nbxing

int RPCSimParam::nbxing
private

Definition at line 44 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulateNoise().

◆ rate

double RPCSimParam::rate
private

Definition at line 45 of file RPCSimParam.h.

Referenced by RPCSimParam(), and simulateNoise().

◆ resEle

double RPCSimParam::resEle
private

Definition at line 38 of file RPCSimParam.h.

Referenced by RPCSimParam().

◆ resRPC

double RPCSimParam::resRPC
private

Definition at line 35 of file RPCSimParam.h.

Referenced by RPCSimParam().

◆ rpcdigiprint

bool RPCSimParam::rpcdigiprint
private

Definition at line 41 of file RPCSimParam.h.

Referenced by RPCSimParam().

◆ sspeed

double RPCSimParam::sspeed
private

Definition at line 39 of file RPCSimParam.h.

Referenced by RPCSimParam().

◆ timOff

double RPCSimParam::timOff
private

Definition at line 36 of file RPCSimParam.h.

Referenced by RPCSimParam().