CMS 3D CMS Logo

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

#include <RPCSimAverageNoise.h>

Inheritance diagram for RPCSimAverageNoise:
RPCSim

Public Member Functions

int getClSize (float posX, CLHEP::HepRandomEngine *)
 
 RPCSimAverageNoise (const edm::ParameterSet &config)
 
void simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits, CLHEP::HepRandomEngine *) override
 
void simulateNoise (const RPCRoll *, CLHEP::HepRandomEngine *) override
 
 ~RPCSimAverageNoise () 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 frate
 
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

Definition at line 27 of file RPCSimAverageNoise.h.

Constructor & Destructor Documentation

◆ RPCSimAverageNoise()

RPCSimAverageNoise::RPCSimAverageNoise ( const edm::ParameterSet config)

Definition at line 39 of file RPCSimAverageNoise.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  frate = config.getParameter<double>("Frate");
53 
54  if (rpcdigiprint) {
55  std::cout << "Average Efficiency = " << aveEff << std::endl;
56  std::cout << "Average Cluster Size = " << aveCls << " strips" << std::endl;
57  std::cout << "RPC Time Resolution = " << resRPC << " ns" << std::endl;
58  std::cout << "RPC Signal formation time = " << timOff << " ns" << std::endl;
59  std::cout << "RPC adjacent strip delay = " << dtimCs << " ns" << std::endl;
60  std::cout << "Electronic Jitter = " << resEle << " ns" << std::endl;
61  std::cout << "Signal propagation time = " << sspeed << " x c" << std::endl;
62  std::cout << "Link Board Gate Width = " << lbGate << " ns" << std::endl;
63  }
64 
66 }

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

◆ ~RPCSimAverageNoise()

RPCSimAverageNoise::~RPCSimAverageNoise ( )
override

Definition at line 68 of file RPCSimAverageNoise.cc.

68 { delete _rpcSync; }

References _rpcSync.

Member Function Documentation

◆ getClSize()

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

Definition at line 70 of file RPCSimAverageNoise.cc.

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

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

Referenced by simulate().

◆ init()

void RPCSimAverageNoise::init ( void  )
inlineoverrideprivatevirtual

Implements RPCSim.

Definition at line 39 of file RPCSimAverageNoise.h.

39 {};

◆ simulate()

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

Implements RPCSim.

Definition at line 111 of file RPCSimAverageNoise.cc.

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

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 RPCSimAverageNoise::simulateNoise ( const RPCRoll roll,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 180 of file RPCSimAverageNoise.cc.

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

References custom_jme_cff::area, frate, gate, RPCSim::getRPCSimSetUp(), mps_fire::i, RPCRoll::id(), dqmiolumiharvest::j, RectangularStripTopology::localPosition(), TrapezoidalStripTopology::localPosition(), N_hits, nbxing, RPCRoll::nstrips(), DetId::rawId(), RPCDetId::region(), RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCSim::strips, RPCRoll::topology(), x, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

Member Data Documentation

◆ _rpcSync

RPCSynchronizer* RPCSimAverageNoise::_rpcSync
private

Definition at line 62 of file RPCSimAverageNoise.h.

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

◆ aveCls

double RPCSimAverageNoise::aveCls
private

Definition at line 43 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ aveEff

double RPCSimAverageNoise::aveEff
private

Definition at line 39 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulate().

◆ clsMap

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

Definition at line 58 of file RPCSimAverageNoise.h.

Referenced by getClSize().

◆ dtimCs

double RPCSimAverageNoise::dtimCs
private

Definition at line 46 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ frate

double RPCSimAverageNoise::frate
private

Definition at line 56 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

◆ gate

double RPCSimAverageNoise::gate
private

Definition at line 55 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

◆ infile

std::ifstream* RPCSimAverageNoise::infile
private

Definition at line 60 of file RPCSimAverageNoise.h.

◆ lbGate

double RPCSimAverageNoise::lbGate
private

Definition at line 49 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ N_hits

int RPCSimAverageNoise::N_hits
private

Definition at line 52 of file RPCSimAverageNoise.h.

Referenced by simulateNoise().

◆ nbxing

int RPCSimAverageNoise::nbxing
private

Definition at line 53 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

◆ rate

double RPCSimAverageNoise::rate
private

Definition at line 54 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ resEle

double RPCSimAverageNoise::resEle
private

Definition at line 47 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ resRPC

double RPCSimAverageNoise::resRPC
private

Definition at line 44 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ rpcdigiprint

bool RPCSimAverageNoise::rpcdigiprint
private

Definition at line 50 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ sspeed

double RPCSimAverageNoise::sspeed
private

Definition at line 48 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

◆ sum_clsize

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

Definition at line 59 of file RPCSimAverageNoise.h.

Referenced by getClSize().

◆ timOff

double RPCSimAverageNoise::timOff
private

Definition at line 45 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

RPCSimAverageNoise::aveCls
double aveCls
Definition: RPCSimAverageNoise.h:43
RPCSynchronizer::setRPCSimSetUp
void setRPCSimSetUp(RPCSimSetUp *simsetup)
Definition: RPCSynchronizer.h:43
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
RPCSim::RPCSim
RPCSim(const edm::ParameterSet &config)
Definition: RPCSim.cc:5
RPCDetId
Definition: RPCDetId.h:16
gather_cfg.cout
cout
Definition: gather_cfg.py:144
RPCSynchronizer
Definition: RPCSynchronizer.h:36
RPCSynchronizer::getSimHitBx
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
Definition: RPCSynchronizer.cc:58
RPCSimAverageNoise::dtimCs
double dtimCs
Definition: RPCSimAverageNoise.h:46
RPCSimAverageNoise::frate
double frate
Definition: RPCSimAverageNoise.h:56
RPCSimAverageNoise::sum_clsize
std::vector< double > sum_clsize
Definition: RPCSimAverageNoise.h:59
RPCSimAverageNoise::sspeed
double sspeed
Definition: RPCSimAverageNoise.h:48
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
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
RPCSimAverageNoise::timOff
double timOff
Definition: RPCSimAverageNoise.h:45
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
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
RPCRoll::centreOfStrip
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:26
RectangularStripTopology::stripLength
float stripLength() const override
Definition: RectangularStripTopology.h:44
RPCSimAverageNoise::aveEff
double aveEff
Definition: RPCSimAverageNoise.h:39
RPCSimAverageNoise::rpcdigiprint
bool rpcdigiprint
Definition: RPCSimAverageNoise.h:50
RPCRoll::nstrips
int nstrips() const
Definition: RPCRoll.cc:24
RPCSimAverageNoise::resEle
double resEle
Definition: RPCSimAverageNoise.h:47
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
TrackCollections2monitor_cff.func
func
Definition: TrackCollections2monitor_cff.py:359
RPCSimAverageNoise::clsMap
std::map< int, std::vector< double > > clsMap
Definition: RPCSimAverageNoise.h:58
RPCSimAverageNoise::gate
double gate
Definition: RPCSimAverageNoise.h:55
RPCSimAverageNoise::resRPC
double resRPC
Definition: RPCSimAverageNoise.h:44
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
RPCRoll::specs
const RPCRollSpecs * specs() const
Definition: RPCRoll.cc:14
RPCSimAverageNoise::N_hits
int N_hits
Definition: RPCSimAverageNoise.h:52
RPCSimAverageNoise::_rpcSync
RPCSynchronizer * _rpcSync
Definition: RPCSimAverageNoise.h:62
RPCSimAverageNoise::rate
double rate
Definition: RPCSimAverageNoise.h:54
TrapezoidalStripTopology::localPosition
LocalPoint localPosition(float strip) const override
Definition: TrapezoidalStripTopology.cc:27
Topology
Definition: Topology.h:39
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
RPCSim::RPCDigiSimLinks
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Definition: RPCSim.h:33
custom_jme_cff.area
area
Definition: custom_jme_cff.py:169
RPCSimAverageNoise::lbGate
double lbGate
Definition: RPCSimAverageNoise.h:49
RPCSimAverageNoise::getClSize
int getClSize(float posX, CLHEP::HepRandomEngine *)
Definition: RPCSimAverageNoise.cc:70
RPCSimAverageNoise::nbxing
int nbxing
Definition: RPCSimAverageNoise.h:53