CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
RPCSimAverage Class Reference

#include <RPCSimAverage.h>

Inheritance diagram for RPCSimAverage:
RPCSim

Public Member Functions

int getClSize (float posX, CLHEP::HepRandomEngine *)
 
 RPCSimAverage (const edm::ParameterSet &config)
 
void simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
 
void simulateNoise (const RPCRoll *, CLHEP::HepRandomEngine *) override
 
 ~RPCSimAverage () 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
 
std::map< int, std::vector< double > > clsMap
 
double dtimCs
 
double gate
 
std::ifstream * infile
 
double lbGate
 
int N_hits
 
int nbxing
 
double rate
 
double resEle
 
double resRPC
 
bool rpcdigiprint
 
double sspeed
 
std::vector< double > sum_clsize
 
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
Borislav Pavlov – University of Sofia

Class for the RPC strip response simulation based on a parametrized model (ORCA-based)

Author
Raffaello Trentadue – INFN Bari

Definition at line 27 of file RPCSimAverage.h.

Constructor & Destructor Documentation

◆ RPCSimAverage()

RPCSimAverage::RPCSimAverage ( const edm::ParameterSet config)

Definition at line 39 of file RPCSimAverage.cc.

39  : RPCSim(config) {
40  aveEff = config.getParameter<double>("averageEfficiency");
41  aveCls = config.getParameter<double>("averageClusterSize");
42  resRPC = config.getParameter<double>("timeResolution");
43  timOff = config.getParameter<double>("timingRPCOffset");
44  dtimCs = config.getParameter<double>("deltatimeAdjacentStrip");
45  resEle = config.getParameter<double>("timeJitter");
46  sspeed = config.getParameter<double>("signalPropagationSpeed");
47  lbGate = config.getParameter<double>("linkGateWidth");
48  rpcdigiprint = config.getParameter<bool>("printOutDigitizer");
49  rate = config.getParameter<double>("Rate");
50  nbxing = config.getParameter<int>("Nbxing");
51  gate = config.getParameter<double>("Gate");
52 
53  if (rpcdigiprint) {
54  std::cout << "Average Efficiency = " << aveEff << std::endl;
55  std::cout << "Average Cluster Size = " << aveCls << " strips" << std::endl;
56  std::cout << "RPC Time Resolution = " << resRPC << " ns" << std::endl;
57  std::cout << "RPC Signal formation time = " << timOff << " ns" << std::endl;
58  std::cout << "RPC adjacent strip delay = " << dtimCs << " ns" << std::endl;
59  std::cout << "Electronic Jitter = " << resEle << " ns" << std::endl;
60  std::cout << "Signal propagation time = " << sspeed << " x c" << std::endl;
61  std::cout << "Link Board Gate Width = " << lbGate << " ns" << std::endl;
62  }
63 
65 }

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

◆ ~RPCSimAverage()

RPCSimAverage::~RPCSimAverage ( )
override

Definition at line 67 of file RPCSimAverage.cc.

67 { delete _rpcSync; }

References _rpcSync.

Member Function Documentation

◆ getClSize()

int RPCSimAverage::getClSize ( float  posX,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 69 of file RPCSimAverage.cc.

69  {
70  std::map<int, std::vector<double> > clsMap = getRPCSimSetUp()->getClsMap();
71 
72  int cnt = 1;
73  int min = 1;
74  double func = 0.0;
75  std::vector<double> sum_clsize;
76 
77  double rr_cl = CLHEP::RandFlat::shoot(engine);
78  if (0.0 <= posX && posX < 0.2) {
79  func = (clsMap[1])[(clsMap[1]).size() - 1] * (rr_cl);
80  sum_clsize = clsMap[1];
81  }
82  if (0.2 <= posX && posX < 0.4) {
83  func = (clsMap[2])[(clsMap[2]).size() - 1] * (rr_cl);
84  sum_clsize = clsMap[2];
85  }
86  if (0.4 <= posX && posX < 0.6) {
87  func = (clsMap[3])[(clsMap[3]).size() - 1] * (rr_cl);
88  sum_clsize = clsMap[3];
89  }
90  if (0.6 <= posX && posX < 0.8) {
91  func = (clsMap[4])[(clsMap[4]).size() - 1] * (rr_cl);
92  sum_clsize = clsMap[4];
93  }
94  if (0.8 <= posX && posX < 1.0) {
95  func = (clsMap[5])[(clsMap[5]).size() - 1] * (rr_cl);
96  sum_clsize = clsMap[5];
97  }
98 
99  for (vector<double>::iterator iter = sum_clsize.begin(); iter != sum_clsize.end(); ++iter) {
100  cnt++;
101  if (func > (*iter)) {
102  min = cnt;
103  } else if (func < (*iter)) {
104  break;
105  }
106  }
107  return min;
108 }

References clsMap, TrackCollections2monitor_cff::func, RPCSimSetUp::getClsMap(), RPCSim::getRPCSimSetUp(), min(), RecoTauValidation_cfi::posX, and sum_clsize.

Referenced by simulate().

◆ init()

void RPCSimAverage::init ( void  )
inlineoverrideprivatevirtual

Implements RPCSim.

Definition at line 39 of file RPCSimAverage.h.

39 {};

◆ simulate()

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

Implements RPCSim.

Definition at line 110 of file RPCSimAverage.cc.

112  {
115  theDetectorHitMap.clear();
117 
118  const Topology& topology = roll->specs()->topology();
119 
120  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin(); _hit != rpcHits.end(); ++_hit) {
121  // Here I hould check if the RPC are up side down;
122  const LocalPoint& entr = _hit->entryPoint();
123 
124  // const LocalPoint& exit=_hit->exitPoint();
125 
126  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
127  int time_hit = _rpcSync->getSimHitBx(&(*_hit), engine);
128 
129  // Effinciecy
130 
131  if (CLHEP::RandFlat::shoot(engine) < aveEff) {
132  int centralStrip = topology.channel(entr) + 1;
133  int fstrip = centralStrip;
134  int lstrip = centralStrip;
135  // Compute the cluster size
136  //double w = CLHEP::RandFlat::shoot(engine);
137  //if (w < 1.e-10) w=1.e-10;
138  int clsize = this->getClSize(posX, engine);
139 
140  std::vector<int> cls;
141  cls.push_back(centralStrip);
142  if (clsize > 1) {
143  for (int cl = 0; cl < (clsize - 1) / 2; cl++)
144  if (centralStrip - cl - 1 >= 1) {
145  fstrip = centralStrip - cl - 1;
146  cls.push_back(fstrip);
147  }
148  for (int cl = 0; cl < (clsize - 1) / 2; cl++)
149  if (centralStrip + cl + 1 <= roll->nstrips()) {
150  lstrip = centralStrip + cl + 1;
151  cls.push_back(lstrip);
152  }
153  if (clsize % 2 == 0) {
154  // insert the last strip according to the
155  // simhit position in the central strip
156  double deltaw = roll->centreOfStrip(centralStrip).x() - entr.x();
157  if (deltaw < 0.) {
158  if (lstrip < roll->nstrips()) {
159  lstrip++;
160  cls.push_back(lstrip);
161  }
162  } else {
163  if (fstrip > 1) {
164  fstrip--;
165  cls.push_back(fstrip);
166  }
167  }
168  }
169  }
170 
171  for (std::vector<int>::iterator i = cls.begin(); i != cls.end(); i++) {
172  // Check the timing of the adjacent strip
173  std::pair<int, int> digi(*i, time_hit);
174  theDetectorHitMap.insert(DetectorHitMap::value_type(digi, &(*_hit)));
175  strips.insert(digi);
176  }
177  }
178  }
179 }

References _rpcSync, aveEff, RPCRoll::centreOfStrip(), GetRecoTauVFromDQM_MC_cff::cl, edm::DetSet< T >::clear(), getClSize(), RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBx(), mps_fire::i, RPCRoll::id(), RPCRoll::nstrips(), RecoTauValidation_cfi::posX, DetId::rawId(), RPCSynchronizer::setRPCSimSetUp(), RPCRoll::specs(), RPCRoll::strip(), RPCSim::strips, RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, RPCRollSpecs::topology(), ecaldqm::topology(), and PV3DBase< T, PVType, FrameType >::x().

◆ simulateNoise()

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

Implements RPCSim.

Definition at line 181 of file RPCSimAverage.cc.

181  {
182  RPCDetId rpcId = roll->id();
183  int nstrips = roll->nstrips();
184  double area = 0.0;
185 
186  if (rpcId.region() == 0) {
187  const RectangularStripTopology* top_ = dynamic_cast<const RectangularStripTopology*>(&(roll->topology()));
188  float xmin = (top_->localPosition(0.)).x();
189  float xmax = (top_->localPosition((float)roll->nstrips())).x();
190  float striplength = (top_->stripLength());
191  area = striplength * (xmax - xmin);
192  } else {
193  const TrapezoidalStripTopology* top_ = dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
194  float xmin = (top_->localPosition(0.)).x();
195  float xmax = (top_->localPosition((float)roll->nstrips())).x();
196  float striplength = (top_->stripLength());
197  area = striplength * (xmax - xmin);
198  }
199 
200  double ave = rate * nbxing * gate * area * 1.0e-9;
201 
202  CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
203  N_hits = randPoissonQ.fire();
204 
205  for (int i = 0; i < N_hits; i++) {
206  int strip = static_cast<int>(CLHEP::RandFlat::shoot(engine, 1, nstrips));
207  int time_hit;
208  time_hit = (static_cast<int>(CLHEP::RandFlat::shoot(engine, (nbxing * gate) / gate))) - nbxing / 2;
209  std::pair<int, int> digi(strip, time_hit);
210  strips.insert(digi);
211  }
212 }

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

Member Data Documentation

◆ _rpcSync

RPCSynchronizer* RPCSimAverage::_rpcSync
private

Definition at line 61 of file RPCSimAverage.h.

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

◆ aveCls

double RPCSimAverage::aveCls
private

Definition at line 43 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

◆ aveEff

double RPCSimAverage::aveEff
private

Definition at line 39 of file RPCSimAverage.h.

Referenced by RPCSimAverage(), and simulate().

◆ clsMap

std::map<int, std::vector<double> > RPCSimAverage::clsMap
private

Definition at line 57 of file RPCSimAverage.h.

Referenced by getClSize().

◆ dtimCs

double RPCSimAverage::dtimCs
private

Definition at line 46 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

◆ gate

double RPCSimAverage::gate
private

Definition at line 55 of file RPCSimAverage.h.

Referenced by RPCSimAverage(), and simulateNoise().

◆ infile

std::ifstream* RPCSimAverage::infile
private

Definition at line 59 of file RPCSimAverage.h.

◆ lbGate

double RPCSimAverage::lbGate
private

Definition at line 49 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

◆ N_hits

int RPCSimAverage::N_hits
private

Definition at line 52 of file RPCSimAverage.h.

Referenced by simulateNoise().

◆ nbxing

int RPCSimAverage::nbxing
private

Definition at line 53 of file RPCSimAverage.h.

Referenced by RPCSimAverage(), and simulateNoise().

◆ rate

double RPCSimAverage::rate
private

Definition at line 54 of file RPCSimAverage.h.

Referenced by RPCSimAverage(), and simulateNoise().

◆ resEle

double RPCSimAverage::resEle
private

Definition at line 47 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

◆ resRPC

double RPCSimAverage::resRPC
private

Definition at line 44 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

◆ rpcdigiprint

bool RPCSimAverage::rpcdigiprint
private

Definition at line 50 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

◆ sspeed

double RPCSimAverage::sspeed
private

Definition at line 48 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

◆ sum_clsize

std::vector<double> RPCSimAverage::sum_clsize
private

Definition at line 58 of file RPCSimAverage.h.

Referenced by getClSize().

◆ timOff

double RPCSimAverage::timOff
private

Definition at line 45 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

RPCSynchronizer::setRPCSimSetUp
void setRPCSimSetUp(RPCSimSetUp *simsetup)
Definition: RPCSynchronizer.h:43
RPCSimAverage::resEle
double resEle
Definition: RPCSimAverage.h:47
RPCSim::getRPCSimSetUp
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:45
mps_fire.i
i
Definition: mps_fire.py:355
TrapezoidalStripTopology::stripLength
float stripLength() const override
det heigth (strip length in the middle)
Definition: TrapezoidalStripTopology.h:63
RPCDetId::region
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
min
T min(T a, T b)
Definition: MathUtil.h:58
edm::DetSet::clear
void clear()
Definition: DetSet.h:71
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
RPCSim::RPCSim
RPCSim(const edm::ParameterSet &config)
Definition: RPCSim.cc:5
RPCDetId
Definition: RPCDetId.h:16
RPCSimAverage::getClSize
int getClSize(float posX, CLHEP::HepRandomEngine *)
Definition: RPCSimAverage.cc:69
gather_cfg.cout
cout
Definition: gather_cfg.py:144
RPCSynchronizer
Definition: RPCSynchronizer.h:36
RPCSimAverage::clsMap
std::map< int, std::vector< double > > clsMap
Definition: RPCSimAverage.h:57
RPCSynchronizer::getSimHitBx
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
Definition: RPCSynchronizer.cc:58
RPCSimAverage::aveCls
double aveCls
Definition: RPCSimAverage.h:43
RPCSimAverage::nbxing
int nbxing
Definition: RPCSimAverage.h:53
RPCSimAverage::lbGate
double lbGate
Definition: RPCSimAverage.h:49
DDAxes::x
RPCSim::strips
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:55
RectangularStripTopology::localPosition
LocalPoint localPosition(float strip) const override
Definition: RectangularStripTopology.cc:17
RPCRoll::topology
const Topology & topology() const override
Definition: RPCRoll.cc:18
RPCSimAverage::rate
double rate
Definition: RPCSimAverage.h:54
GetRecoTauVFromDQM_MC_cff.cl
cl
Definition: GetRecoTauVFromDQM_MC_cff.py:38
config
Definition: config.py:1
RPCRoll::id
RPCDetId id() const
Definition: RPCRoll.cc:16
RectangularStripTopology
Definition: RectangularStripTopology.h:11
RPCSim::theDetectorHitMap
DetectorHitMap theDetectorHitMap
Definition: RPCSim.h:68
ecaldqm::topology
const CaloTopology * topology(nullptr)
TrapezoidalStripTopology
Definition: TrapezoidalStripTopology.h:21
RPCSim::theRpcDigiSimLinks
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:70
RPCSimAverage::N_hits
int N_hits
Definition: RPCSimAverage.h:52
RPCRollSpecs::topology
const Topology & topology() const override
Definition: RPCRollSpecs.cc:36
RecoTauValidation_cfi.posX
posX
Definition: RecoTauValidation_cfi.py:288
RPCSimSetUp::getClsMap
const std::map< int, std::vector< double > > & getClsMap()
Definition: RPCSimSetUp.cc:413
Point3DBase< float, LocalTag >
RPCRoll::strip
float strip(const LocalPoint &lp) const
Definition: RPCRoll.cc:35
RPCSimAverage::gate
double gate
Definition: RPCSimAverage.h:55
RPCSimAverage::sspeed
double sspeed
Definition: RPCSimAverage.h:48
RPCRoll::centreOfStrip
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:26
RPCSimAverage::sum_clsize
std::vector< double > sum_clsize
Definition: RPCSimAverage.h:58
RectangularStripTopology::stripLength
float stripLength() const override
Definition: RectangularStripTopology.h:44
RPCSimAverage::dtimCs
double dtimCs
Definition: RPCSimAverage.h:46
RPCRoll::nstrips
int nstrips() const
Definition: RPCRoll.cc:24
RPCSimAverage::timOff
double timOff
Definition: RPCSimAverage.h:45
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
TrackCollections2monitor_cff.func
func
Definition: TrackCollections2monitor_cff.py:359
RPCSimAverage::aveEff
double aveEff
Definition: RPCSimAverage.h:39
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
RPCSimAverage::_rpcSync
RPCSynchronizer * _rpcSync
Definition: RPCSimAverage.h:61
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
RPCRoll::specs
const RPCRollSpecs * specs() const
Definition: RPCRoll.cc:14
TrapezoidalStripTopology::localPosition
LocalPoint localPosition(float strip) const override
Definition: TrapezoidalStripTopology.cc:27
RPCSimAverage::resRPC
double resRPC
Definition: RPCSimAverage.h:44
Topology
Definition: Topology.h:39
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
RPCSimAverage::rpcdigiprint
bool rpcdigiprint
Definition: RPCSimAverage.h:50
RPCSim::RPCDigiSimLinks
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Definition: RPCSim.h:33
custom_jme_cff.area
area
Definition: custom_jme_cff.py:169