Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Me0 digitizer constand phi smearing 800 #13478

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions SimMuon/GEMDigitizer/interface/ME0PreRecoGaussianModel.h
Expand Up @@ -24,19 +24,19 @@ class ME0PreRecoGaussianModel: public ME0DigiPreRecoModel
~ME0PreRecoGaussianModel();

void simulateSignal(const ME0EtaPartition*, const edm::PSimHitContainer&, CLHEP::HepRandomEngine*) override;

void simulateNoise(const ME0EtaPartition*, CLHEP::HepRandomEngine*) override;

double correctSigmaU(const ME0EtaPartition*, double);
void setup() {}

private:
double sigma_t;
double sigma_u;
double sigma_v;
bool gaussianSmearing_;
double constPhiSmearing_;
bool corr;
bool etaproj;
bool digitizeOnlyMuons_;
bool gaussianSmearing_;
double averageEfficiency_;
// bool simulateIntrinsicNoise_; // not implemented
// double averageNoiseRate_; // not implemented
Expand Down
1 change: 1 addition & 0 deletions SimMuon/GEMDigitizer/python/muonME0DigisPreReco_cfi.py
Expand Up @@ -7,6 +7,7 @@
timeResolution = cms.double(0.001), # in ns
phiResolution = cms.double(0.05), # in cm average resolution along local x in case of no correlation
etaResolution = cms.double(1.), # in cm average resolution along local y in case of no correlation
constantPhiSpatialResolution = cms.bool(False),
useCorrelation = cms.bool(False),
useEtaProjectiveGEO = cms.bool(False),
averageEfficiency = cms.double(0.98),
Expand Down
31 changes: 25 additions & 6 deletions SimMuon/GEMDigitizer/src/ME0PreRecoGaussianModel.cc
Expand Up @@ -22,10 +22,11 @@ ME0PreRecoGaussianModel::ME0PreRecoGaussianModel(const edm::ParameterSet& config
sigma_t(config.getParameter<double>("timeResolution")),
sigma_u(config.getParameter<double>("phiResolution")),
sigma_v(config.getParameter<double>("etaResolution")),
gaussianSmearing_(config.getParameter<bool>("gaussianSmearing")),
constPhiSmearing_(config.getParameter<bool>("constantPhiSpatialResolution")),
corr(config.getParameter<bool>("useCorrelation")),
etaproj(config.getParameter<bool>("useEtaProjectiveGEO")),
digitizeOnlyMuons_(config.getParameter<bool>("digitizeOnlyMuons")),
gaussianSmearing_(config.getParameter<bool>("gaussianSmearing")),
averageEfficiency_(config.getParameter<double>("averageEfficiency")),
// simulateIntrinsicNoise_(config.getParameter<bool>("simulateIntrinsicNoise")),
// averageNoiseRate_(config.getParameter<double>("averageNoiseRate")),
Expand Down Expand Up @@ -59,15 +60,19 @@ for (const auto & hit: simHits)
// create digi
auto entry = hit.entryPoint();
double x=0.0, y=0.0;

double sigma_u_new = sigma_u;
if(constPhiSmearing_) sigma_u_new = correctSigmaU(roll, entry.y());

if(gaussianSmearing_) { // Gaussian Smearing
x=CLHEP::RandGaussQ::shoot(engine, entry.x(), sigma_u);
x=CLHEP::RandGaussQ::shoot(engine, entry.x(), sigma_u_new);
y=CLHEP::RandGaussQ::shoot(engine, entry.y(), sigma_v);
}
else { // Uniform Smearing ... use the sigmas as boundaries
x=entry.x()+(CLHEP::RandFlat::shoot(engine)-0.5)*sigma_u;
x=entry.x()+(CLHEP::RandFlat::shoot(engine)-0.5)*sigma_u_new;
y=entry.y()+(CLHEP::RandFlat::shoot(engine)-0.5)*sigma_v;
}
double ex=sigma_u;
double ex=sigma_u_new;
double ey=sigma_v;
double corr=0.;
double tof=CLHEP::RandGaussQ::shoot(engine, hit.timeOfFlight(), sigma_t);
Expand Down Expand Up @@ -134,6 +139,10 @@ void ME0PreRecoGaussianModel::simulateNoise(const ME0EtaPartition* roll, CLHEP::
// max length in x for given y coordinate (cfr trapezoidal eta partition)
double xMax = topLength/2.0 - (height/2.0 - yy_rand) * myTanPhi;

double sigma_u_new = sigma_u;
if(constPhiSmearing_) sigma_u_new = correctSigmaU(roll, yy_rand);


// 1) Intrinsic Noise ... Not implemented right now
// ------------------------------------------------
// if (simulateIntrinsicNoise_)
Expand Down Expand Up @@ -169,7 +178,7 @@ void ME0PreRecoGaussianModel::simulateNoise(const ME0EtaPartition* roll, CLHEP::
//calculate xx_rand at a given yy_rand
double myRandX = CLHEP::RandFlat::shoot(engine);
double xx_rand = 2 * xMax * (myRandX - 0.5);
double ex = sigma_u;
double ex = sigma_u_new;
double ey = sigma_v;
double corr = 0.;
// extract random BX
Expand Down Expand Up @@ -217,7 +226,7 @@ void ME0PreRecoGaussianModel::simulateNoise(const ME0EtaPartition* roll, CLHEP::
//calculate xx_rand at a given yy_rand
double myRandX = CLHEP::RandFlat::shoot(engine);
double xx_rand = 2 * xMax * (myRandX - 0.5);
double ex = sigma_u;
double ex = sigma_u_new;
double ey = sigma_v;
double corr = 0.;
// extract random BX
Expand All @@ -242,3 +251,13 @@ void ME0PreRecoGaussianModel::simulateNoise(const ME0EtaPartition* roll, CLHEP::
} // end loop over strips (= pseudo rolls)
}

double ME0PreRecoGaussianModel::correctSigmaU(const ME0EtaPartition* roll, double y) {
const TrapezoidalStripTopology* top_(dynamic_cast<const TrapezoidalStripTopology*>(&(roll->topology())));
auto& parameters(roll->specs()->parameters());
double height(parameters[2]); // height = height from Center of Roll
double rollRadius = top_->radius(); // rollRadius = Radius at Center of Roll
double Rmax = rollRadius+height; // MaxRadius = Radius at top of Roll
double Rx = rollRadius+y; // y in [-height,+height]
double sigma_u_new = Rx/Rmax*sigma_u;
return sigma_u_new;
}