test
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
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 ()
 
- 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
 
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
< 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
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 28 of file RPCSimAverage.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file RPCSimAverage.cc.

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

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

Definition at line 70 of file RPCSimAverage.cc.

References _rpcSync.

70  {
71  delete _rpcSync;
72 }
RPCSynchronizer * _rpcSync
Definition: RPCSimAverage.h:65

Member Function Documentation

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

Definition at line 74 of file RPCSimAverage.cc.

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

Referenced by simulate().

75 {
76 
77  std::map< int, std::vector<double> > clsMap = getRPCSimSetUp()->getClsMap();
78 
79  int cnt = 1;
80  int min = 1;
81  double func=0.0;
82  std::vector<double> sum_clsize;
83 
84  double rr_cl = CLHEP::RandFlat::shoot(engine);
85  if(0.0 <= posX && posX < 0.2) {
86  func = (clsMap[1])[(clsMap[1]).size()-1]*(rr_cl);
87  sum_clsize = clsMap[1];
88  }
89  if(0.2 <= posX && posX < 0.4) {
90  func = (clsMap[2])[(clsMap[2]).size()-1]*(rr_cl);
91  sum_clsize = clsMap[2];
92  }
93  if(0.4 <= posX && posX < 0.6) {
94  func = (clsMap[3])[(clsMap[3]).size()-1]*(rr_cl);
95  sum_clsize = clsMap[3];
96  }
97  if(0.6 <= posX && posX < 0.8) {
98  func = (clsMap[4])[(clsMap[4]).size()-1]*(rr_cl);
99  sum_clsize = clsMap[4];
100  }
101  if(0.8 <= posX && posX < 1.0) {
102  func = (clsMap[5])[(clsMap[5]).size()-1]*(rr_cl);
103  sum_clsize = clsMap[5];
104  }
105 
106  for(vector<double>::iterator iter = sum_clsize.begin();
107  iter != sum_clsize.end(); ++iter){
108  cnt++;
109  if(func > (*iter)){
110  min = cnt;
111  }
112  else if(func < (*iter)){
113  break;
114  }
115  }
116  return min;
117 }
std::vector< double > sum_clsize
Definition: RPCSimAverage.h:62
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
const std::map< int, std::vector< double > > & getClsMap()
Definition: RPCSimSetUp.cc:397
T min(T a, T b)
Definition: MathUtil.h:58
std::map< int, std::vector< double > > clsMap
Definition: RPCSimAverage.h:61
void RPCSimAverage::init ( void  )
inlineprivatevirtual

Implements RPCSim.

Definition at line 44 of file RPCSimAverage.h.

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

Implements RPCSim.

Definition at line 121 of file RPCSimAverage.cc.

References _rpcSync, aveEff, RPCRoll::centreOfStrip(), GetRecoTauVFromDQM_MC_cff::cl, edm::DetSet< T >::clear(), 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(), ecaldqm::topology(), and PV3DBase< T, PVType, FrameType >::x().

124 {
127  theDetectorHitMap.clear();
129 
130  const Topology& topology=roll->specs()->topology();
131 
132  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
133  _hit != rpcHits.end(); ++_hit){
134 
135  // Here I hould check if the RPC are up side down;
136  const LocalPoint& entr=_hit->entryPoint();
137 
138  // const LocalPoint& exit=_hit->exitPoint();
139 
140  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
141  int time_hit = _rpcSync->getSimHitBx(&(*_hit), engine);
142 
143  // Effinciecy
144 
145  if (CLHEP::RandFlat::shoot(engine) < aveEff) {
146 
147  int centralStrip = topology.channel(entr)+1;
148  int fstrip=centralStrip;
149  int lstrip=centralStrip;
150  // Compute the cluster size
151  //double w = CLHEP::RandFlat::shoot(engine);
152  //if (w < 1.e-10) w=1.e-10;
153  int clsize = this->getClSize(posX, engine);
154 
155  std::vector<int> cls;
156  cls.push_back(centralStrip);
157  if (clsize > 1){
158  for (int cl = 0; cl < (clsize-1)/2; cl++)
159  if (centralStrip - cl -1 >= 1 ){
160  fstrip = centralStrip-cl-1;
161  cls.push_back(fstrip);
162  }
163  for (int cl = 0; cl < (clsize-1)/2; cl++)
164  if (centralStrip + cl + 1 <= roll->nstrips() ){
165  lstrip = centralStrip+cl+1;
166  cls.push_back(lstrip);
167  }
168  if (clsize%2 == 0 ){
169  // insert the last strip according to the
170  // simhit position in the central strip
171  double deltaw=roll->centreOfStrip(centralStrip).x()-entr.x();
172  if (deltaw<0.) {
173  if (lstrip < roll->nstrips() ){
174  lstrip++;
175  cls.push_back(lstrip);
176  }
177  }else{
178  if (fstrip > 1 ){
179  fstrip--;
180  cls.push_back(fstrip);
181  }
182  }
183  }
184  }
185 
186  for (std::vector<int>::iterator i=cls.begin(); i!=cls.end();i++){
187  // Check the timing of the adjacent strip
188  std::pair<int, int> digi(*i,time_hit);
189  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
190  strips.insert(digi);
191  }
192  }
193  }
194 }
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
int getClSize(float posX, CLHEP::HepRandomEngine *)
CaloTopology const * topology(0)
DetectorHitMap theDetectorHitMap
Definition: RPCSim.h:71
void setRPCSimSetUp(RPCSimSetUp *simsetup)
int nstrips() const
Definition: RPCRoll.cc:46
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
const RPCRollSpecs * specs() const
Definition: RPCRoll.cc:18
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:60
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
edm::DetSet< RPCDigiSimLink > RPCDigiSimLinks
Definition: RPCSim.h:35
RPCDetId id() const
Definition: RPCRoll.cc:24
RPCSynchronizer * _rpcSync
Definition: RPCSimAverage.h:65
void clear()
Definition: DetSet.h:69
T x() const
Definition: PV3DBase.h:62
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:73
const Topology & topology() const
Definition: RPCRollSpecs.cc:43
void RPCSimAverage::simulateNoise ( const RPCRoll roll,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 196 of file RPCSimAverage.cc.

References compareJSON::const, gate, i, RPCRoll::id(), RectangularStripTopology::localPosition(), TrapezoidalStripTopology::localPosition(), N_hits, nbxing, RPCRoll::nstrips(), rate, RPCDetId::region(), RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCSim::strips, RPCRoll::topology(), x, hlt_dqm_clientPB-live_cfg::xmax, and hlt_dqm_clientPB-live_cfg::xmin.

198 {
199 
200  RPCDetId rpcId = roll->id();
201  int nstrips = roll->nstrips();
202  double area = 0.0;
203 
204  if ( rpcId.region() == 0 )
205  {
206  const RectangularStripTopology* top_ = dynamic_cast<const
207  RectangularStripTopology*>(&(roll->topology()));
208  float xmin = (top_->localPosition(0.)).x();
209  float xmax = (top_->localPosition((float)roll->nstrips())).x();
210  float striplength = (top_->stripLength());
211  area = striplength*(xmax-xmin);
212  }
213  else
214  {
215  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
216  float xmin = (top_->localPosition(0.)).x();
217  float xmax = (top_->localPosition((float)roll->nstrips())).x();
218  float striplength = (top_->stripLength());
219  area = striplength*(xmax-xmin);
220  }
221 
222  double ave = rate*nbxing*gate*area*1.0e-9;
223 
224  CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
225  N_hits = randPoissonQ.fire();
226 
227  for (int i = 0; i < N_hits; i++ ){
228  int strip = static_cast<int>(CLHEP::RandFlat::shoot(engine, 1, nstrips));
229  int time_hit;
230  time_hit = (static_cast<int>(CLHEP::RandFlat::shoot(engine, (nbxing*gate)/gate))) - nbxing/2;
231  std::pair<int, int> digi(strip,time_hit);
232  strips.insert(digi);
233  }
234 
235 }
int i
Definition: DBlmapReader.cc:9
const Topology & topology() const
Definition: RPCRoll.cc:30
virtual float stripLength() const
int nstrips() const
Definition: RPCRoll.cc:46
std::set< std::pair< int, int > > strips
Definition: RPCSim.h:60
RPCDetId id() const
Definition: RPCRoll.cc:24
string const
Definition: compareJSON.py:14
virtual LocalPoint localPosition(float strip) const
virtual LocalPoint localPosition(float strip) const
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:63

Member Data Documentation

RPCSynchronizer* RPCSimAverage::_rpcSync
private

Definition at line 65 of file RPCSimAverage.h.

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

double RPCSimAverage::aveCls
private

Definition at line 47 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

double RPCSimAverage::aveEff
private

Definition at line 44 of file RPCSimAverage.h.

Referenced by RPCSimAverage(), and simulate().

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

Definition at line 61 of file RPCSimAverage.h.

Referenced by getClSize().

double RPCSimAverage::dtimCs
private

Definition at line 50 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

double RPCSimAverage::gate
private

Definition at line 59 of file RPCSimAverage.h.

Referenced by RPCSimAverage(), and simulateNoise().

std::ifstream* RPCSimAverage::infile
private

Definition at line 63 of file RPCSimAverage.h.

double RPCSimAverage::lbGate
private

Definition at line 53 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

int RPCSimAverage::N_hits
private

Definition at line 56 of file RPCSimAverage.h.

Referenced by simulateNoise().

int RPCSimAverage::nbxing
private

Definition at line 57 of file RPCSimAverage.h.

Referenced by RPCSimAverage(), and simulateNoise().

double RPCSimAverage::rate
private

Definition at line 58 of file RPCSimAverage.h.

Referenced by RPCSimAverage(), and simulateNoise().

double RPCSimAverage::resEle
private

Definition at line 51 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

double RPCSimAverage::resRPC
private

Definition at line 48 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

bool RPCSimAverage::rpcdigiprint
private

Definition at line 54 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

double RPCSimAverage::sspeed
private

Definition at line 52 of file RPCSimAverage.h.

Referenced by RPCSimAverage().

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

Definition at line 62 of file RPCSimAverage.h.

Referenced by getClSize().

double RPCSimAverage::timOff
private

Definition at line 49 of file RPCSimAverage.h.

Referenced by RPCSimAverage().