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

#include <RPCSimAverageNoise.h>

Inheritance diagram for RPCSimAverageNoise:
RPCSim

Public Member Functions

int getClSize (float posX)
 
 RPCSimAverageNoise (const edm::ParameterSet &config)
 
void setRandomEngine (CLHEP::HepRandomEngine &eng)
 
void simulate (const RPCRoll *roll, const edm::PSimHitContainer &rpcHits)
 
void simulateNoise (const RPCRoll *)
 
 ~RPCSimAverageNoise ()
 
- 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
 
std::map< int, std::vector
< double > > 
clsMap
 
double dtimCs
 
CLHEP::RandFlat * flatDistribution
 
CLHEP::RandFlat * flatDistribution2
 
double frate
 
double gate
 
std::ifstream * infile
 
double lbGate
 
int N_hits
 
int nbxing
 
CLHEP::RandPoissonQ * poissonDistribution_
 
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
< 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

Definition at line 30 of file RPCSimAverageNoise.h.

Constructor & Destructor Documentation

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

Definition at line 48 of file RPCSimAverageNoise.cc.

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

48  :
49  RPCSim(config)
50 {
51  aveEff = config.getParameter<double>("averageEfficiency");
52  aveCls = config.getParameter<double>("averageClusterSize");
53  resRPC = config.getParameter<double>("timeResolution");
54  timOff = config.getParameter<double>("timingRPCOffset");
55  dtimCs = config.getParameter<double>("deltatimeAdjacentStrip");
56  resEle = config.getParameter<double>("timeJitter");
57  sspeed = config.getParameter<double>("signalPropagationSpeed");
58  lbGate = config.getParameter<double>("linkGateWidth");
59  rpcdigiprint = config.getParameter<bool>("printOutDigitizer");
60  rate=config.getParameter<double>("Rate");
61  nbxing=config.getParameter<int>("Nbxing");
62  gate=config.getParameter<double>("Gate");
63  frate=config.getParameter<double>("Frate");
64 
65  if (rpcdigiprint) {
66  std::cout <<"Average Efficiency = "<<aveEff<<std::endl;
67  std::cout <<"Average Cluster Size = "<<aveCls<<" strips"<<std::endl;
68  std::cout <<"RPC Time Resolution = "<<resRPC<<" ns"<<std::endl;
69  std::cout <<"RPC Signal formation time = "<<timOff<<" ns"<<std::endl;
70  std::cout <<"RPC adjacent strip delay = "<<dtimCs<<" ns"<<std::endl;
71  std::cout <<"Electronic Jitter = "<<resEle<<" ns"<<std::endl;
72  std::cout <<"Signal propagation time = "<<sspeed<<" x c"<<std::endl;
73  std::cout <<"Link Board Gate Width = "<<lbGate<<" ns"<<std::endl;
74  }
75 
76  _rpcSync = new RPCSynchronizer(config);
77 
78 }
T getParameter(std::string const &) const
RPCSim(const edm::ParameterSet &config)
Definition: RPCSim.cc:5
RPCSynchronizer * _rpcSync
tuple cout
Definition: gather_cfg.py:121
RPCSimAverageNoise::~RPCSimAverageNoise ( )

Definition at line 87 of file RPCSimAverageNoise.cc.

References _rpcSync, flatDistribution, flatDistribution2, and poissonDistribution_.

88 {
89  //Deleting the distribution defined in the constructor
90  delete flatDistribution;
91  delete flatDistribution2;
92  delete poissonDistribution_;
93  delete _rpcSync;
94 }
CLHEP::RandFlat * flatDistribution2
CLHEP::RandFlat * flatDistribution
RPCSynchronizer * _rpcSync
CLHEP::RandPoissonQ * poissonDistribution_

Member Function Documentation

int RPCSimAverageNoise::getClSize ( float  posX)

Definition at line 96 of file RPCSimAverageNoise.cc.

References clsMap, flatDistribution, RPCSimSetUp::getClsMap(), RPCSim::getRPCSimSetUp(), min, and sum_clsize.

Referenced by simulate().

97 {
98 
99  std::map< int, std::vector<double> > clsMap = getRPCSimSetUp()->getClsMap();
100 
101  int cnt = 1;
102  int min = 1;
103  double func=0.0;
104  std::vector<double> sum_clsize;
105 
106  double rr_cl = flatDistribution->fire();
107  if(0.0 <= posX && posX < 0.2) {
108  func = (clsMap[1])[(clsMap[1]).size()-1]*(rr_cl);
109  sum_clsize = clsMap[1];
110  }
111  if(0.2 <= posX && posX < 0.4) {
112  func = (clsMap[2])[(clsMap[2]).size()-1]*(rr_cl);
113  sum_clsize = clsMap[2];
114  }
115  if(0.4 <= posX && posX < 0.6) {
116  func = (clsMap[3])[(clsMap[3]).size()-1]*(rr_cl);
117  sum_clsize = clsMap[3];
118  }
119  if(0.6 <= posX && posX < 0.8) {
120  func = (clsMap[4])[(clsMap[4]).size()-1]*(rr_cl);
121  sum_clsize = clsMap[4];
122  }
123  if(0.8 <= posX && posX < 1.0) {
124  func = (clsMap[5])[(clsMap[5]).size()-1]*(rr_cl);
125  sum_clsize = clsMap[5];
126  }
127 
128  for(vector<double>::iterator iter = sum_clsize.begin();
129  iter != sum_clsize.end(); ++iter){
130  cnt++;
131  if(func > (*iter)){
132  min = cnt;
133  }
134  else if(func < (*iter)){
135  break;
136  }
137  }
138  return min;
139 }
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:47
#define min(a, b)
Definition: mlp_lapack.h:161
std::map< int, std::vector< double > > clsMap
const std::map< int, std::vector< double > > & getClsMap()
Definition: RPCSimSetUp.cc:195
CLHEP::RandFlat * flatDistribution
std::vector< double > sum_clsize
void RPCSimAverageNoise::init ( void  )
inlineprivatevirtual

Implements RPCSim.

Definition at line 47 of file RPCSimAverageNoise.h.

47 {};
void RPCSimAverageNoise::setRandomEngine ( CLHEP::HepRandomEngine &  eng)
virtual

Implements RPCSim.

Definition at line 80 of file RPCSimAverageNoise.cc.

References _rpcSync, flatDistribution, flatDistribution2, poissonDistribution_, and RPCSynchronizer::setRandomEngine().

80  {
81  flatDistribution = new CLHEP::RandFlat(eng);
82  flatDistribution2 = new CLHEP::RandFlat(eng);
83  poissonDistribution_ = new CLHEP::RandPoissonQ(eng);
85 }
CLHEP::RandFlat * flatDistribution2
void setRandomEngine(CLHEP::HepRandomEngine &eng)
CLHEP::RandFlat * flatDistribution
RPCSynchronizer * _rpcSync
CLHEP::RandPoissonQ * poissonDistribution_
void RPCSimAverageNoise::simulate ( const RPCRoll roll,
const edm::PSimHitContainer rpcHits 
)
virtual

Implements RPCSim.

Definition at line 143 of file RPCSimAverageNoise.cc.

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

145 {
148  theDetectorHitMap.clear();
150 
151  const Topology& topology=roll->specs()->topology();
152 
153  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
154  _hit != rpcHits.end(); ++_hit){
155 
156  // Here I hould check if the RPC are up side down;
157  const LocalPoint& entr=_hit->entryPoint();
158  int time_hit = _rpcSync->getSimHitBx(&(*_hit));
159  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
160 
161  // Effinciecy
162 
163  if (flatDistribution->fire() < aveEff) {
164 
165  int centralStrip = topology.channel(entr)+1;
166  int fstrip=centralStrip;
167  int lstrip=centralStrip;
168  // Compute the cluster size
169  double w = flatDistribution->fire(1);
170  if (w < 1.e-10) w=1.e-10;
171  int clsize = this->getClSize(posX);
172 
173  std::vector<int> cls;
174  cls.push_back(centralStrip);
175  if (clsize > 1){
176  for (int cl = 0; cl < (clsize-1)/2; cl++)
177  {
178  if (centralStrip - cl -1 >= 1 ){
179  fstrip = centralStrip-cl-1;
180  cls.push_back(fstrip);
181  }
182  if (centralStrip + cl + 1 <= roll->nstrips() ){
183  lstrip = centralStrip+cl+1;
184  cls.push_back(lstrip);
185  }
186  }
187  if (clsize%2 == 0 ){
188  // insert the last strip according to the
189  // simhit position in the central strip
190  double deltaw=roll->centreOfStrip(centralStrip).x()-entr.x();
191  if (deltaw<0.) {
192  if (lstrip < roll->nstrips() ){
193  lstrip++;
194  cls.push_back(lstrip);
195  }
196  }else{
197  if (fstrip > 1 ){
198  fstrip--;
199  cls.push_back(fstrip);
200  }
201  }
202  }
203  }
204 
205  for (std::vector<int>::iterator i=cls.begin(); i!=cls.end();i++){
206  // Check the timing of the adjacent strip
207  std::pair<int, int> digi(*i,time_hit );
208 
209  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
210  strips.insert(digi);
211  }
212  }
213  }
214 }
float strip(const LocalPoint &lp) const
Definition: RPCRoll.cc:71
int i
Definition: DBlmapReader.cc:9
LocalPoint centreOfStrip(int strip) const
Definition: RPCRoll.cc:52
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
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:57
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
int getClSize(float posX)
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Definition: RPCSim.h:32
RPCDetId id() const
Definition: RPCRoll.cc:24
Container::value_type value_type
float cl
Definition: Combine.cc:71
int getSimHitBx(const PSimHit *)
CLHEP::RandFlat * flatDistribution
RPCSynchronizer * _rpcSync
void clear()
Definition: DetSet.h:70
T x() const
Definition: PV3DBase.h:61
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:70
T w() const
const Topology & topology() const
Definition: RPCRollSpecs.cc:43
void RPCSimAverageNoise::simulateNoise ( const RPCRoll roll)
virtual

Implements RPCSim.

Definition at line 216 of file RPCSimAverageNoise.cc.

References compareJSON::const, flatDistribution2, frate, gate, RPCSim::getRPCSimSetUp(), i, RPCRoll::id(), j, RectangularStripTopology::localPosition(), TrapezoidalStripTopology::localPosition(), N_hits, nbxing, RPCRoll::nstrips(), poissonDistribution_, DetId::rawId(), RPCDetId::region(), RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCSim::strips, RPCRoll::topology(), and vdt::x.

217 {
218  RPCDetId rpcId = roll->id();
219  std::vector<float> vnoise = (getRPCSimSetUp())->getNoise(rpcId.rawId());
220  unsigned int nstrips = roll->nstrips();
221 
222  double area = 0.0;
223 
224  if ( rpcId.region() == 0 )
225  {
226  const RectangularStripTopology* top_ = dynamic_cast<const
227  RectangularStripTopology*>(&(roll->topology()));
228  float xmin = (top_->localPosition(0.)).x();
229  float xmax = (top_->localPosition((float)roll->nstrips())).x();
230  float striplength = (top_->stripLength());
231  area = striplength*(xmax-xmin);
232  }
233  else
234  {
235  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
236  float xmin = (top_->localPosition(0.)).x();
237  float xmax = (top_->localPosition((float)roll->nstrips())).x();
238  float striplength = (top_->stripLength());
239  area = striplength*(xmax-xmin);
240  }
241  for(unsigned int j = 0; j < vnoise.size(); ++j){
242 
243  if(j >= nstrips) break;
244 
245  double ave = frate*vnoise[j]*nbxing*gate*area*1.0e-9;
246  N_hits = poissonDistribution_->fire(ave);
247 
248  for (int i = 0; i < N_hits; i++ ){
249  int time_hit = (static_cast<int>(flatDistribution2->fire((nbxing*gate)/gate))) - nbxing/2;
250  std::pair<int, int> digi(j+1,time_hit);
251  strips.insert(digi);
252  }
253  }
254 }
int i
Definition: DBlmapReader.cc:9
CLHEP::RandFlat * flatDistribution2
const Topology & topology() const
Definition: RPCRoll.cc:30
virtual float stripLength() const
int nstrips() const
Definition: RPCRoll.cc:46
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:47
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:57
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
RPCDetId id() const
Definition: RPCRoll.cc:24
int j
Definition: DBlmapReader.cc:9
string const
Definition: compareJSON.py:14
virtual LocalPoint localPosition(float strip) const
CLHEP::RandPoissonQ * poissonDistribution_
virtual LocalPoint localPosition(float strip) const
x
Definition: VDTMath.h:216
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:67

Member Data Documentation

RPCSynchronizer* RPCSimAverageNoise::_rpcSync
private
double RPCSimAverageNoise::aveCls
private

Definition at line 50 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

double RPCSimAverageNoise::aveEff
private

Definition at line 47 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulate().

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

Definition at line 65 of file RPCSimAverageNoise.h.

Referenced by getClSize().

double RPCSimAverageNoise::dtimCs
private

Definition at line 53 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

CLHEP::RandFlat* RPCSimAverageNoise::flatDistribution
private

Definition at line 73 of file RPCSimAverageNoise.h.

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

CLHEP::RandFlat* RPCSimAverageNoise::flatDistribution2
private

Definition at line 76 of file RPCSimAverageNoise.h.

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

double RPCSimAverageNoise::frate
private

Definition at line 63 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

double RPCSimAverageNoise::gate
private

Definition at line 62 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

std::ifstream* RPCSimAverageNoise::infile
private

Definition at line 67 of file RPCSimAverageNoise.h.

double RPCSimAverageNoise::lbGate
private

Definition at line 56 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

int RPCSimAverageNoise::N_hits
private

Definition at line 59 of file RPCSimAverageNoise.h.

Referenced by simulateNoise().

int RPCSimAverageNoise::nbxing
private

Definition at line 60 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise(), and simulateNoise().

CLHEP::RandPoissonQ* RPCSimAverageNoise::poissonDistribution_
private

Definition at line 77 of file RPCSimAverageNoise.h.

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

double RPCSimAverageNoise::rate
private

Definition at line 61 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

double RPCSimAverageNoise::resEle
private

Definition at line 54 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

double RPCSimAverageNoise::resRPC
private

Definition at line 51 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

bool RPCSimAverageNoise::rpcdigiprint
private

Definition at line 57 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

double RPCSimAverageNoise::sspeed
private

Definition at line 55 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().

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

Definition at line 66 of file RPCSimAverageNoise.h.

Referenced by getClSize().

double RPCSimAverageNoise::timOff
private

Definition at line 52 of file RPCSimAverageNoise.h.

Referenced by RPCSimAverageNoise().