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 | Protected Member Functions | Protected Attributes
RPCSimModelTiming Class Reference

#include <RPCSimModelTiming.h>

Inheritance diagram for RPCSimModelTiming:
RPCSim

Public Member Functions

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

Protected Member Functions

void init () override
 
- Protected Member Functions inherited from RPCSim
virtual void addLinks (unsigned int strip, int bx)
 
 RPCSim (const edm::ParameterSet &config)
 

Protected Attributes

RPCSynchronizer_rpcSync
 
double aveCls
 
double aveEff
 
std::vector< double > clsForDetId
 
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
 
- Protected Attributes inherited from RPCSim
std::set< RPCDigiirpc_digis
 
std::set< std::pair< int, int > > strips
 
DetectorHitMap theDetectorHitMap
 
DigiSimLinks theDigiSimLinks
 
RPCDigiSimLinks theRpcDigiSimLinks
 
RPCSimSetUptheSimSetUp
 

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
 

Detailed Description

Definition at line 31 of file RPCSimModelTiming.h.

Constructor & Destructor Documentation

RPCSimModelTiming::RPCSimModelTiming ( const edm::ParameterSet config)

Definition at line 39 of file RPCSimModelTiming.cc.

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

39  : RPCSim(config)
40 {
41  aveEff = config.getParameter<double>("averageEfficiency");
42  aveCls = config.getParameter<double>("averageClusterSize");
43  resRPC = config.getParameter<double>("timeResolution");
44  timOff = config.getParameter<double>("timingRPCOffset");
45  dtimCs = config.getParameter<double>("deltatimeAdjacentStrip");
46  resEle = config.getParameter<double>("timeJitter");
47  sspeed = config.getParameter<double>("signalPropagationSpeed");
48  lbGate = config.getParameter<double>("linkGateWidth");
49  rpcdigiprint = config.getParameter<bool>("printOutDigitizer");
50 
51  rate=config.getParameter<double>("Rate");
52  nbxing=config.getParameter<int>("Nbxing");
53  gate=config.getParameter<double>("Gate");
54  frate=config.getParameter<double>("Frate");
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 
69 }
T getParameter(std::string const &) const
RPCSim(const edm::ParameterSet &config)
Definition: RPCSim.cc:5
RPCSynchronizer * _rpcSync
tuple cout
Definition: gather_cfg.py:145
RPCSimModelTiming::~RPCSimModelTiming ( )

Definition at line 71 of file RPCSimModelTiming.cc.

References _rpcSync.

72 {
73  delete _rpcSync;
74 }
RPCSynchronizer * _rpcSync

Member Function Documentation

int RPCSimModelTiming::getClSize ( uint32_t  id,
float  posX,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 239 of file RPCSimModelTiming.cc.

References clsForDetId, RecoJets_EventContent_cff::func, RPCSimSetUp::getCls(), RPCSim::getRPCSimSetUp(), i, min(), and sum_clsize.

Referenced by simulate().

240 {
241  std::vector<double> clsForDetId = getRPCSimSetUp()->getCls(id);
242 
243  int cnt = 1;
244  int min = 1;
245  double func=0.0;
246  std::vector<double> sum_clsize;
247 
248  sum_clsize.clear();
249  sum_clsize = clsForDetId;
250  int vectOffset(0);
251 
252  double rr_cl = CLHEP::RandFlat::shoot(engine);
253 
254  if(0.0 <= posX && posX < 0.2) {
255  func = clsForDetId[19]*(rr_cl);
256  vectOffset = 0;
257  }
258  if(0.2 <= posX && posX < 0.4) {
259  func = clsForDetId[39]*(rr_cl);
260  vectOffset = 20;
261  }
262  if(0.4 <= posX && posX < 0.6) {
263  func = clsForDetId[59]*(rr_cl);
264  vectOffset = 40;
265  }
266  if(0.6 <= posX && posX < 0.8) {
267  func = clsForDetId[79]*(rr_cl);
268  vectOffset = 60;
269  }
270  if(0.8 <= posX && posX < 1.0) {
271  func = clsForDetId[89]*(rr_cl);
272  vectOffset = 80;
273  }
274 
275 
276  for(int i = vectOffset; i<(vectOffset+20); i++){
277  cnt++;
278  if(func > clsForDetId[i]){
279  min = cnt;
280  }
281  else if(func < clsForDetId[i]){
282  break;
283  }
284  }
285  return min;
286 }
int i
Definition: DBlmapReader.cc:9
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
std::vector< double > clsForDetId
std::vector< double > sum_clsize
const std::vector< double > & getCls(uint32_t id)
Definition: RPCSimSetUp.cc:408
T min(T a, T b)
Definition: MathUtil.h:58
void RPCSimModelTiming::init ( void  )
inlineoverrideprotectedvirtual

Implements RPCSim.

Definition at line 44 of file RPCSimModelTiming.h.

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

Implements RPCSim.

Definition at line 76 of file RPCSimModelTiming.cc.

References _rpcSync, RPCRoll::centreOfStrip(), Topology::channel(), GetRecoTauVFromDQM_MC_cff::cl, edm::DetSet< T >::clear(), getClSize(), RPCSim::getRPCSimSetUp(), RPCSynchronizer::getSimHitBxAndTimingForIRPC(), RPCSynchronizer::getSmearedTime(), RPCDigi::hasTime(), i, RPCRoll::id(), RPCSim::irpc_digis, RPCRoll::nstrips(), HLT_25ns10e33_v2_cff::particleType, DetId::rawId(), RPCSynchronizer::setRPCSimSetUp(), RPCDigi::setTime(), RPCRoll::specs(), RPCRoll::strip(), RPCSim::theDetectorHitMap, RPCSim::theRpcDigiSimLinks, RPCRollSpecs::topology(), ecaldqm::topology(), and PV3DBase< T, PVType, FrameType >::x().

79 {
80 
83  theDetectorHitMap.clear();
85 
86  RPCDetId rpcId = roll->id();
87  RPCGeomServ RPCname(rpcId);
88  //std::string nameRoll = RPCname.name();
89 
90  const Topology& topology=roll->specs()->topology();
91 
92  for (edm::PSimHitContainer::const_iterator _hit = rpcHits.begin();
93  _hit != rpcHits.end(); ++_hit){
94 
95  if(_hit-> particleType() == 11) continue;
96  // Here I hould check if the RPC are up side down;
97  const LocalPoint& entr=_hit->entryPoint();
98 
99  int time_hit = _rpcSync->getSimHitBxAndTimingForIRPC(&(*_hit), engine);
100  double precise_time = _rpcSync->getSmearedTime();
101 
102  float posX = roll->strip(_hit->localPosition()) - static_cast<int>(roll->strip(_hit->localPosition()));
103 
104  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
105 
106  // Effinciecy
107  int centralStrip = topology.channel(entr)+1;;
108  float fire = CLHEP::RandFlat::shoot(engine);
109 
110  if (fire < veff[centralStrip-1]) {
111 
112  int fstrip=centralStrip;
113  int lstrip=centralStrip;
114 
115  // Compute the cluster size
116  // double w = CLHEP::RandFlat::shoot(engine);
117  //if (w < 1.e-10) w=1.e-10;
118 // int clsize = this->getClSize(posX, engine); // This is for one and the same cls for all the chambers
119  int clsize = this->getClSize(rpcId.rawId(),posX, engine); // This is for cluster size chamber by chamber
120  std::vector<int> cls;
121  cls.push_back(centralStrip);
122  if (clsize > 1){
123  for (int cl = 0; cl < (clsize-1)/2; cl++){
124  if (centralStrip - cl -1 >= 1 ){
125  fstrip = centralStrip-cl-1;
126  cls.push_back(fstrip);
127  }
128  if (centralStrip + cl + 1 <= roll->nstrips() ){
129  lstrip = centralStrip+cl+1;
130  cls.push_back(lstrip);
131  }
132  }
133  if (clsize%2 == 0 ){
134  // insert the last strip according to the
135  // simhit position in the central strip
136  double deltaw=roll->centreOfStrip(centralStrip).x()-entr.x();
137  if (deltaw<0.) {
138  if (lstrip < roll->nstrips() ){
139  lstrip++;
140  cls.push_back(lstrip);
141  }
142  }else{
143  if (fstrip > 1 ){
144  fstrip--;
145  cls.push_back(fstrip);
146  }
147  }
148  }
149  }
150 
151  for (std::vector<int>::iterator i=cls.begin(); i!=cls.end();i++){
152  // Check the timing of the adjacent strip
153  if(*i != centralStrip){
154  if(CLHEP::RandFlat::shoot(engine) < veff[*i-1]){
155  std::pair<int, int> digi(*i,time_hit);
156  RPCDigi adigi(*i,time_hit);
157  adigi.hasTime(true);
158  adigi.setTime(precise_time);
159  irpc_digis.insert(adigi);
160 
161  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
162  }
163  }
164  else {
165  std::pair<int, int> digi(*i,time_hit);
166  RPCDigi adigi(*i,time_hit);
167  adigi.hasTime(true);
168  adigi.setTime(precise_time);
169  irpc_digis.insert(adigi);
170  theDetectorHitMap.insert(DetectorHitMap::value_type(digi,&(*_hit)));
171  }
172  }
173  }
174  }
175 }
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
CaloTopology const * topology(0)
DetectorHitMap theDetectorHitMap
Definition: RPCSim.h:72
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
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
double getSmearedTime() const
virtual int channel(const LocalPoint &p) const =0
int getClSize(uint32_t id, float posX, CLHEP::HepRandomEngine *)
std::set< RPCDigi > irpc_digis
Definition: RPCSim.h:61
RPCSynchronizer * _rpcSync
void clear()
Definition: DetSet.h:69
T x() const
Definition: PV3DBase.h:62
RPCDigiSimLinks theRpcDigiSimLinks
Definition: RPCSim.h:74
int getSimHitBxAndTimingForIRPC(const PSimHit *, CLHEP::HepRandomEngine *)
const Topology & topology() const
Definition: RPCRollSpecs.cc:43
void RPCSimModelTiming::simulateNoise ( const RPCRoll roll,
CLHEP::HepRandomEngine *  engine 
)
overridevirtual

Implements RPCSim.

Definition at line 177 of file RPCSimModelTiming.cc.

References compareJSON::const, frate, gate, RPCSim::getRPCSimSetUp(), i, RPCRoll::id(), RPCSim::irpc_digis, j, RectangularStripTopology::localPosition(), TrapezoidalStripTopology::localPosition(), N_hits, nbxing, RPCRoll::nstrips(), DetId::rawId(), RPCDetId::region(), RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), RPCRoll::topology(), x, hlt_dqm_clientPB-live_cfg::xmax, and hlt_dqm_clientPB-live_cfg::xmin.

179 {
180 //std::cout<<"RPCSimModelTiming::simulateNoise"<<std::endl;
181 
182 RPCDetId rpcId = roll->id();
183 //std::cout<<"RPCSimModelTiming::simulateNoise X1"<<std::endl;
184  RPCGeomServ RPCname(rpcId);
185 //std::cout<<"RPCSimModelTiming::simulateNoise X2"<<std::endl;
186 // std::cout<<"rpcId.rawId() = "<<rpcId.rawId()<<std::endl;
187  std::vector<float> vnoise = (getRPCSimSetUp())->getNoise(rpcId.rawId());
188 //std::cout<<"RPCSimModelTiming::simulateNoise X3"<<std::endl;
189  std::vector<float> veff = (getRPCSimSetUp())->getEff(rpcId.rawId());
190 //std::cout<<"RPCSimModelTiming::simulateNoise X4"<<std::endl;
191  unsigned int nstrips = roll->nstrips();
192  double area = 0.0;
193 
194  if ( rpcId.region() == 0 )
195  {
196  const RectangularStripTopology* top_ = dynamic_cast<const
197  RectangularStripTopology*>(&(roll->topology()));
198  float xmin = (top_->localPosition(0.)).x();
199  float xmax = (top_->localPosition((float)roll->nstrips())).x();
200  float striplength = (top_->stripLength());
201  area = striplength*(xmax-xmin);
202  }
203  else
204  {
205  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology()));
206  float xmin = (top_->localPosition(0.)).x();
207  float xmax = (top_->localPosition((float)roll->nstrips())).x();
208  float striplength = (top_->stripLength());
209  area = striplength*(xmax-xmin);
210  }
211 
212  for(unsigned int j = 0; j < vnoise.size(); ++j){
213 
214  if(j >= nstrips) break;
215 
216  double ave =
217  vnoise[j]*nbxing*gate*area*1.0e-9*frate/((float)roll->nstrips());
218 
219  CLHEP::RandPoissonQ randPoissonQ(*engine, ave);
220  N_hits = randPoissonQ.fire();
221  for (int i = 0; i < N_hits; i++ ){
222 
223 
224  double precise_time = CLHEP::RandFlat::shoot(engine, (nbxing*gate)/gate);
225  int time_hit = (static_cast<int>(precise_time)) - nbxing/2;
226 // std::pair<int, int> digi(j+1,time_hit);
227 // strips.insert(digi);
228  RPCDigi adigi(j+1,time_hit);
229  irpc_digis.insert(adigi);
230 
231  }
232  }
233 
234 
235 
236 }
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
RPCSimSetUp * getRPCSimSetUp()
Definition: RPCSim.h:50
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
RPCDetId id() const
Definition: RPCRoll.cc:24
int j
Definition: DBlmapReader.cc:9
std::set< RPCDigi > irpc_digis
Definition: RPCSim.h:61
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* RPCSimModelTiming::_rpcSync
protected

Definition at line 67 of file RPCSimModelTiming.h.

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

double RPCSimModelTiming::aveCls
protected

Definition at line 47 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

double RPCSimModelTiming::aveEff
protected

Definition at line 44 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

std::vector<double> RPCSimModelTiming::clsForDetId
protected

Definition at line 64 of file RPCSimModelTiming.h.

Referenced by getClSize().

std::map< int, std::vector<double> > RPCSimModelTiming::clsMap
protected

Definition at line 62 of file RPCSimModelTiming.h.

double RPCSimModelTiming::dtimCs
protected

Definition at line 50 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

double RPCSimModelTiming::frate
protected

Definition at line 60 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming(), and simulateNoise().

double RPCSimModelTiming::gate
protected

Definition at line 59 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming(), and simulateNoise().

std::ifstream* RPCSimModelTiming::infile
protected

Definition at line 65 of file RPCSimModelTiming.h.

double RPCSimModelTiming::lbGate
protected

Definition at line 53 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

int RPCSimModelTiming::N_hits
protected

Definition at line 56 of file RPCSimModelTiming.h.

Referenced by simulateNoise().

int RPCSimModelTiming::nbxing
protected

Definition at line 57 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming(), and simulateNoise().

double RPCSimModelTiming::rate
protected

Definition at line 58 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

double RPCSimModelTiming::resEle
protected

Definition at line 51 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

double RPCSimModelTiming::resRPC
protected

Definition at line 48 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

bool RPCSimModelTiming::rpcdigiprint
protected

Definition at line 54 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

double RPCSimModelTiming::sspeed
protected

Definition at line 52 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().

std::vector<double> RPCSimModelTiming::sum_clsize
protected

Definition at line 63 of file RPCSimModelTiming.h.

Referenced by getClSize().

double RPCSimModelTiming::timOff
protected

Definition at line 49 of file RPCSimModelTiming.h.

Referenced by RPCSimModelTiming().