9 #include "CLHEP/Random/RandFlat.h" 10 #include "CLHEP/Random/RandGaussQ.h" 11 #include "CLHEP/Random/RandPoissonQ.h" 22 sigma_t(config.getParameter<double>(
"timeResolution")),
23 sigma_u(config.getParameter<double>(
"phiResolution")),
24 sigma_v(config.getParameter<double>(
"etaResolution")),
25 error_u(config.getParameter<double>(
"phiError")),
26 error_v(config.getParameter<double>(
"etaError")),
27 gaussianSmearing_(config.getParameter<bool>(
"gaussianSmearing")),
28 constPhiSmearing_(config.getParameter<bool>(
"constantPhiSpatialResolution")),
29 corr(config.getParameter<bool>(
"useCorrelation")),
30 etaproj(config.getParameter<bool>(
"useEtaProjectiveGEO")),
31 digitizeOnlyMuons_(config.getParameter<bool>(
"digitizeOnlyMuons")),
32 averageEfficiency_(config.getParameter<double>(
"averageEfficiency")),
35 simulateElectronBkg_(config.getParameter<bool>(
"simulateElectronBkg")),
36 simulateNeutralBkg_(config.getParameter<bool>(
"simulateNeutralBkg")),
37 minBunch_(config.getParameter<
int>(
"minBunch")),
38 maxBunch_(config.getParameter<
int>(
"maxBunch")),
39 instLumi_(config.getParameter<double>(
"instLumi")),
40 rateFact_(config.getParameter<double>(
"rateFact")),
41 referenceInstLumi_(config.getParameter<double>(
"referenceInstLumi"))
45 neuBkg.push_back(0.00386257);
47 neuBkg.push_back(16627700);
50 eleBkg.push_back(0.00171409);
53 eleBkg.push_back(-4327.25);
62 for (
const auto &
hit: simHits)
79 x=CLHEP::RandGaussQ::shoot(engine,
entry.x(), sigma_u_new);
83 x=
entry.x()+(CLHEP::RandFlat::shoot(engine)-0.5)*sigma_u_new;
86 double ex=sigma_u_new;
89 double tof=CLHEP::RandGaussQ::shoot(engine,
hit.timeOfFlight(),
sigma_t);
94 int evtId =
hit.eventId().event();
95 int bx =
hit.eventId().bunchCrossing();
96 int procType =
hit.processType();
98 if(!(evtId == 0 && bx == 0 && procType == 0)) res = 2;
100 digi_.emplace(x,
y,ex,ey,corr,tof,pdgid,res);
102 edm::LogVerbatim(
"ME0PreRecoGaussianModel") <<
"[ME0PreRecoDigi :: simulateSignal] :: simhit in "<<roll->
id()<<
" at loc x = "<<std::setw(8)<<
entry.x()<<
" [cm]" 103 <<
" loc y = "<<std::setw(8)<<
entry.y()<<
" [cm] time = "<<std::setw(8)<<
hit.timeOfFlight()<<
" [ns] pdgid = "<<std::showpos<<std::setw(4)<<
pdgid;
104 edm::LogVerbatim(
"ME0PreRecoGaussianModel") <<
"[ME0PreRecoDigi :: simulateSignal] :: digi in "<<roll->
id()<<
" at loc x = "<<std::setw(8)<<x<<
" [cm] loc y = "<<std::setw(8)<<
y<<
" [cm]" 105 <<
" time = "<<std::setw(8)<<tof<<
" [ns]";
106 edm::LogVerbatim(
"ME0PreRecoGaussianModel") <<
"[ME0PreRecoDigi :: simulateSignal] :: digi in "<<roll->
id()<<
" with DX = "<<std::setw(8)<<(
entry.x()-
x)<<
" [cm]" 107 <<
" DY = "<<std::setw(8)<<(
entry.y()-
y)<<
" [cm] DT = "<<std::setw(8)<<(
hit.timeOfFlight()-tof)<<
" [ns]";
120 if (me0Id.region() == 0) {
throw cms::Exception(
"Geometry") <<
"Asking TrapezoidalStripTopology from a ME0 will fail"; }
124 double bottomLength(
parameters[0]); bottomLength = 2*bottomLength;
125 double topLength(
parameters[1]); topLength = 2*topLength;
126 double height(
parameters[2]); height = 2*height;
127 double myTanPhi = (topLength - bottomLength) / (height * 2);
128 double rollRadius = top_->radius();
129 trArea = height * (topLength + bottomLength) / 2.0;
133 double initialHeight =
sigma_v;
134 if(
sigma_v < 1.0) initialHeight = 1.0;
135 double heightIt = initialHeight;
136 int heightbins = height/heightIt;
138 edm::LogVerbatim(
"ME0PreRecoGaussianModelNoise") <<
"[ME0PreRecoDigi :: sNoise]["<<roll->
id().
rawId()<<
"] :: roll with id = "<<roll->
id();
139 edm::LogVerbatim(
"ME0PreRecoGaussianModelNoise") <<
"[ME0PreRecoDigi :: sNoise]["<<roll->
id().
rawId()<<
"] :: extracting parameters from the TrapezoidalStripTopology";
140 edm::LogVerbatim(
"ME0PreRecoGaussianModelNoise") <<
"[ME0PreRecoDigi :: sNoise]["<<roll->
id().
rawId()<<
"] :: bottom = "<<bottomLength<<
" [cm] top = "<<topLength<<
" [cm] height = "<<height<<
" [cm]" 141 <<
" area = "<<trArea<<
" [cm^2] Rmid = "<<rollRadius<<
" [cm] => Rmin = "<<rollRadius-height*1.0/2.0<<
" [cm] Rmax = "<<rollRadius+height*1.0/2.0<<
" [cm]";
142 edm::LogVerbatim(
"ME0PreRecoGaussianModelNoise") <<
"[ME0PreRecoDigi :: sNoise]["<<roll->
id().
rawId()<<
"] :: heightbins = "<<heightbins;
144 for(
int hx=0; hx<heightbins; ++hx) {
145 double bottomIt = bottomLength + hx *2*
tan(10./180*3.14)*heightIt;
146 double topIt = bottomLength + (hx+1)*2*
tan(10./180*3.14)*heightIt;
147 if(hx==heightbins-1) {
149 heightIt = height-hx*heightIt;
151 double areaIt = heightIt*(bottomIt+topIt)*1.0/2;
153 edm::LogVerbatim(
"ME0PreRecoGaussianModelNoise") <<
"[ME0PreRecoDigi :: sNoise]["<<roll->
id().
rawId()<<
"] :: height = "<<std::setw(12)<<heightIt<<
" [cm] bottom = "<<std::setw(12)<<bottomIt<<
" [cm]" 154 <<
" top = "<<std::setw(12)<<topIt<<
" [cm] area = "<<std::setw(12)<<areaIt<<
" [cm^2] || sin(10) = "<<
sin(10./180*3.14);
156 double myRandY = CLHEP::RandFlat::shoot(engine);
157 double y0_rand = (hx+myRandY)*heightIt;
158 if(hx==heightbins-1) y0_rand = hx*initialHeight + myRandY*heightIt;
159 double yy_rand = (y0_rand-height*1.0/2);
160 double yy_glob = rollRadius + yy_rand;
162 const float rSqrtR = yy_glob *
sqrt(yy_glob);
163 double xMax = topLength/2.0 - (height/2.0 - yy_rand) * myTanPhi;
191 <<
" evaluation of Background Hit Rate at this coord :: "<<std::setw(12)<<averageElectronRatePerRoll<<
" [Hz/cm^2]" 192 <<
" x 9 x 25*10^-9 [s] x Area (of strip = "<<std::setw(12)<<areaIt<<
" [cm^2]) ==> "<<std::setw(12)<<averageElecRate<<
" [hits]";
194 bool ele_eff = (CLHEP::RandFlat::shoot(engine)<averageElecRate)?1:0;
196 edm::LogVerbatim(
"ME0PreRecoGaussianModelNoise") <<
"[ME0PreRecoDigi :: elebkg]["<<roll->
id().
rawId()<<
"] :: myRandY = "<<std::setw(12)<<myRandY<<
" => local y = "<<std::setw(12)<<yy_rand<<
" [cm]" 197 <<
" => global y (global R) = "<<std::setw(12)<<yy_glob<<
" [cm] || Probability = "<<std::setw(12)<<averageElecRate
198 <<
" => efficient? "<<ele_eff<<std::endl;
202 double myRandX = CLHEP::RandFlat::shoot(engine);
203 double xx_rand = 2 * xMax * (myRandX - 0.5);
204 double ex = sigma_u_new;
208 double myrandBX = CLHEP::RandFlat::shoot(engine);
211 double myrandT = CLHEP::RandFlat::shoot(engine);
212 double minBXtime = (bx-0.5)*
bxwidth;
214 double myrandP = CLHEP::RandFlat::shoot(engine);
216 if (myrandP <= 0.5) pdgid = -11;
221 digi_.emplace(xx_rand, yy_rand, ex, ey, corr, time, pdgid, 0);
224 <<
"] =====> electron hit in "<<roll->
id()
225 <<
" pdgid = "<<pdgid<<
" bx = "<<bx
227 <<
" at loc x = "<<xx_rand<<
" loc y = "<<yy_rand
228 <<
" time = "<<time<<
" [ns]";
246 <<
" evaluation of Background Hit Rate at this coord :: "<<std::setw(12)<<averageNeutralRatePerRoll<<
" [Hz/cm^2]" 247 <<
" x 9 x 25*10^-9 [s] x Area (of strip = "<<std::setw(12)<<areaIt<<
" [cm^2]) ==> "<<std::setw(12)<<averageNeutrRate<<
" [hits]";
249 bool neu_eff = (CLHEP::RandFlat::shoot(engine)<averageNeutrRate)?1:0;
251 edm::LogVerbatim(
"ME0PreRecoGaussianModelNoise") <<
"[ME0PreRecoDigi :: neubkg]["<<roll->
id().
rawId()<<
"] :: myRandY = "<<std::setw(12)<<myRandY<<
" => local y = "<<std::setw(12)<<yy_rand<<
" [cm]" 252 <<
" => global y (global R) = "<<std::setw(12)<<yy_glob<<
" [cm] || Probability = "<<std::setw(12)<<averageNeutrRate
253 <<
" => efficient? "<<neu_eff<<std::endl;
257 double myRandX = CLHEP::RandFlat::shoot(engine);
258 double xx_rand = 2 * xMax * (myRandX - 0.5);
259 double ex = sigma_u_new;
263 double myrandBX= CLHEP::RandFlat::shoot(engine);
266 double myrandT = CLHEP::RandFlat::shoot(engine);
267 double minBXtime = (bx-0.5)*
bxwidth;
270 double myrandP = CLHEP::RandFlat::shoot(engine);
271 if (myrandP <= 0.08) pdgid = 2112;
276 digi_.emplace(xx_rand, yy_rand, ex, ey, corr, time, pdgid, 0);
279 <<
"] ======> neutral hit in "<<roll->
id()
280 <<
" pdgid = "<<pdgid<<
" bx = "<<bx
282 <<
" at loc x = "<<xx_rand<<
" loc y = "<<yy_rand
283 <<
" time = "<<time<<
" [ns]";
294 double rollRadius = top_->radius();
295 double Rmax = rollRadius+height;
296 double Rx = rollRadius+
y;
297 double sigma_u_new = Rx/Rmax*
sigma_u;
const ME0EtaPartitionSpecs * specs() const
double averageEfficiency_
std::vector< double > neuBkg
Sin< T >::type sin(const T &t)
const ME0Specs & parameters() const
double correctSigmaU(const ME0EtaPartition *, double)
uint32_t rawId() const
get the raw id
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
void simulateSignal(const ME0EtaPartition *, const edm::PSimHitContainer &, CLHEP::HepRandomEngine *) override
double referenceInstLumi_
std::set< ME0DigiPreReco > digi_
void simulateNoise(const ME0EtaPartition *, CLHEP::HepRandomEngine *) override
ME0PreRecoGaussianModel(const edm::ParameterSet &)
const double Rmax[kNumberCalorimeter]
std::vector< PSimHit > PSimHitContainer
std::vector< double > eleBkg
bool simulateElectronBkg_
const Topology & topology() const override
~ME0PreRecoGaussianModel()