Skip to content

Commit

Permalink
Merge pull request cms-sw#64 from dildick/Update-GEM-digitizer-for-GE…
Browse files Browse the repository at this point in the history
…21-hits

Extended2023, bx and cls bug fixed.
  • Loading branch information
Sven Dildick committed Jan 20, 2014
2 parents b2c4832 + b45b5f1 commit a8ee610
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 27 deletions.
1 change: 0 additions & 1 deletion SimMuon/GEMDigitizer/interface/GEMDigiProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class GEMDigiProducer : public edm::EDProducer
std::string digiModelString_;

GEMDigiModel* gemDigiModel_;
std::vector<double> neutronGammaRoll_;

};

Expand Down
9 changes: 5 additions & 4 deletions SimMuon/GEMDigitizer/interface/GEMSimpleModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "SimMuon/GEMDigitizer/interface/GEMDigiModel.h"

class GEMGeometry;

namespace CLHEP
{
class HepRandomEngine;
Expand Down Expand Up @@ -50,7 +49,8 @@ class GEMSimpleModel: public GEMDigiModel
double averageShapingTime_;
double timeResolution_;
double timeJitter_;
double timeCalibrationOffset_;
double timeCalibrationOffset1_;
double timeCalibrationOffset23_;
double averageNoiseRate_;
double averageClusterSize_;
double signalPropagationSpeed_;
Expand All @@ -59,7 +59,9 @@ class GEMSimpleModel: public GEMDigiModel
int minBunch_;
int maxBunch_;
bool digitizeOnlyMuons_;
std::vector<double> neutronGammaRoll_;
std::vector<double> neutronGammaRoll1_;
std::vector<double> neutronGammaRoll2_;
std::vector<double> neutronGammaRoll3_;
bool doNoiseCLS_;
double minPabsNoiseCLS_;
bool simulateIntrinsicNoise_;
Expand All @@ -76,4 +78,3 @@ class GEMSimpleModel: public GEMDigiModel
#endif



11 changes: 7 additions & 4 deletions SimMuon/GEMDigitizer/python/muonGEMDigis_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,24 @@
timeResolution = cms.double(5),
timeJitter = cms.double(1.0),
averageShapingTime = cms.double(50.0),
timeCalibrationOffset = cms.double(19.9),
timeCalibrationOffset1 = cms.double(19.9),
timeCalibrationOffset23 = cms.double(27.7),
averageClusterSize = cms.double(1.5),
averageEfficiency = cms.double(0.98),
averageNoiseRate = cms.double(0.001), #intrinsic noise
numberOfStripsPerPartition = cms.int32(384),
# numberOfStripsPerPartition = cms.int32(384),
bxwidth = cms.int32(25),
minBunch = cms.int32(-5), ## in terms of 25 ns
maxBunch = cms.int32(3),
inputCollection = cms.string('g4SimHitsMuonGEMHits'),
digiModelString = cms.string('Simple'),
digitizeOnlyMuons = cms.bool(False),
# neutronGammaRoll = cms.vdouble(18., 23., 30., 39., 45., 52., 62., 76)#, #n and gamma bkg per roll
neutronGammaRoll = cms.vdouble(69.3, 74.0, 101.7, 121.1, 145.5, 143.8, 199.1, 314.1), #n, gamma and charged prtcls bkg per roll
neutronGammaRoll1 = cms.vdouble(69.3, 74.0, 101.7, 121.1, 145.5, 143.8, 199.1, 314.1), #n, gamma and charged prtcls bkg per roll of station1
neutronGammaRoll2 = cms.vdouble(69.3, 74.0, 101.7, 121.1, 145.5, 143.8, 199.1, 314.1), #n, gamma and charged prtcls bkg per roll of station2
neutronGammaRoll3 = cms.vdouble(69.3, 74.0, 101.7, 121.1, 145.5, 143.8, 199.1, 314.1, 314.1, 314.1, 314.1, 314.1), # bkg/roll of station3
doNoiseCLS = cms.bool(True),
minPabsNoiseCLS = cms.double(0.), #do cls>=1 for the particles with |p|> minPabsNoiseCLS
minPabsNoiseCLS = cms.double(0.),
simulateIntrinsicNoise = cms.bool(False),
scaleLumi = cms.double(1.)

Expand Down
1 change: 0 additions & 1 deletion SimMuon/GEMDigitizer/src/GEMDigiProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
GEMDigiProducer::GEMDigiProducer(const edm::ParameterSet& ps)
: collectionXF_(ps.getParameter<std::string>("inputCollection"))
, digiModelString_(ps.getParameter<std::string>("digiModelString"))
, neutronGammaRoll_(ps.getParameter<std::vector<double> > ("neutronGammaRoll"))
{
produces<GEMDigiCollection>();
produces<StripDigiSimLinks>("GEM");
Expand Down
59 changes: 42 additions & 17 deletions SimMuon/GEMDigitizer/src/GEMSimpleModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ GEMDigiModel(config)
, averageShapingTime_(config.getParameter<double> ("averageShapingTime"))
, timeResolution_(config.getParameter<double> ("timeResolution"))
, timeJitter_(config.getParameter<double> ("timeJitter"))
, timeCalibrationOffset_(config.getParameter<double> ("timeCalibrationOffset"))
, timeCalibrationOffset1_(config.getParameter<double> ("timeCalibrationOffset1"))
, timeCalibrationOffset23_(config.getParameter<double> ("timeCalibrationOffset23"))
, averageNoiseRate_(config.getParameter<double> ("averageNoiseRate"))
, averageClusterSize_(config.getParameter<double> ("averageClusterSize"))
, signalPropagationSpeed_(config.getParameter<double> ("signalPropagationSpeed"))
Expand All @@ -34,7 +35,9 @@ GEMDigiModel(config)
, minBunch_(config.getParameter<int> ("minBunch"))
, maxBunch_(config.getParameter<int> ("maxBunch"))
, digitizeOnlyMuons_(config.getParameter<bool> ("digitizeOnlyMuons"))
, neutronGammaRoll_(config.getParameter<std::vector<double>>("neutronGammaRoll"))
, neutronGammaRoll1_(config.getParameter<std::vector<double>>("neutronGammaRoll1"))
, neutronGammaRoll2_(config.getParameter<std::vector<double>>("neutronGammaRoll2"))
, neutronGammaRoll3_(config.getParameter<std::vector<double>>("neutronGammaRoll3"))
, doNoiseCLS_(config.getParameter<bool> ("doNoiseCLS"))
, scaleLumi_(config.getParameter<double> ("scaleLumi"))
{
Expand Down Expand Up @@ -109,16 +112,14 @@ int GEMSimpleModel::getSimHitBx(const PSimHit* simhit)
if (!roll)
{
throw cms::Exception("Geometry")
<< "GEMSimpleModel::getSimHitBx() - GEM simhit id does not match any GEM roll id: " << id
<< "\n";
<< "GEMSimpleModel::getSimHitBx() - GEM simhit id does not match any GEM roll id: " << id << "\n";
return 999;
}

if (roll->id().region() == 0)
{
throw cms::Exception("Geometry")
<< "GEMSimpleModel::getSimHitBx() - this GEM id is from barrel, which cannot happen: "
<< roll->id() << "\n";
<< "GEMSimpleModel::getSimHitBx() - this GEM id is from barrel, which cannot happen: " << roll->id() << "\n";
}

const TrapezoidalStripTopology* top(dynamic_cast<const TrapezoidalStripTopology*> (&(roll->topology())));
Expand All @@ -136,7 +137,17 @@ int GEMSimpleModel::getSimHitBx(const PSimHit* simhit)
const float randomResolutionTime(gauss2_->fire(0., timeResolution_));

const float simhitTime(tof + averageShapingTime_ + randomResolutionTime + averagePropagationTime + randomJitterTime);
const float referenceTime(timeCalibrationOffset_ + halfStripLength / signalPropagationSpeedTrue + averageShapingTime_);

float referenceTime = 0.;
if (id.station() == 1)
{
referenceTime = timeCalibrationOffset1_ + halfStripLength / signalPropagationSpeedTrue + averageShapingTime_;
}
if (id.station() == 2 || id.station() == 3)
{
referenceTime = timeCalibrationOffset23_ + halfStripLength / signalPropagationSpeedTrue + averageShapingTime_;
}

const float timeDifference(cosmics_ ? (simhitTime - referenceTime) / COSMIC_PAR : simhitTime - referenceTime);

// assign the bunch crossing
Expand All @@ -163,16 +174,29 @@ void GEMSimpleModel::simulateNoise(const GEMEtaPartition* roll)

if (gemId.region() == 0)
{
throw cms::Exception("Geometry")
<< "GEMSynchronizer::simulateNoise() - this GEM id is from barrel, which cannot happen.";
throw cms::Exception("Geometry") << "GEMSynchronizer::simulateNoise() - this GEM id is from barrel, which cannot happen.";
}

const TrapezoidalStripTopology* top_(dynamic_cast<const TrapezoidalStripTopology*> (&(roll->topology())));
const float striplength(top_->stripLength());
trStripArea = (roll->pitch()) * striplength;
trArea = trStripArea * nstrips;

const int nBxing(maxBunch_ - minBunch_ + 1);
double averageNoiseRatePerRoll = neutronGammaRoll_[rollNumb - 1];
double averageNoiseRatePerRoll = 0.;

if(gemId.station() == 1)
{
averageNoiseRatePerRoll = neutronGammaRoll1_[rollNumb - 1];
}
if(gemId.station() == 2)
{
averageNoiseRatePerRoll = neutronGammaRoll2_[rollNumb - 1];
}
if(gemId.station() == 3)
{
averageNoiseRatePerRoll = neutronGammaRoll3_[rollNumb - 1];
}

//simulate intrinsic noise
if(simulateIntrinsicNoise_)
Expand All @@ -181,6 +205,7 @@ void GEMSimpleModel::simulateNoise(const GEMEtaPartition* roll)
for(int j = 0; j < nstrips; ++j)
{
const int n_intrHits = poisson_->fire(aveIntrinsicNoisPerStrip);

for (int k = 0; k < n_intrHits; k++ )
{
const int time_hit(static_cast<int> (flat2_->fire(nBxing)) + minBunch_);
Expand All @@ -193,6 +218,7 @@ void GEMSimpleModel::simulateNoise(const GEMEtaPartition* roll)
//simulate bkg contribution
const double averageNoise(averageNoiseRatePerRoll * nBxing * bxwidth_ * trArea * 1.0e-9 * scaleLumi_);
const int n_hits(poisson_->fire(averageNoise));

for (int i = 0; i < n_hits; ++i)
{
const int centralStrip(static_cast<int> (flat1_->fire(1, nstrips)));
Expand All @@ -215,7 +241,7 @@ void GEMSimpleModel::simulateNoise(const GEMEtaPartition* roll)
if (clusterSize % 2 != 0)
{
int clsR = (clusterSize - 1) / 2;
for (int i = 1; i < clsR; ++i)
for (int i = 1; i <= clsR; ++i)
{
if (flat1_->fire(1) < averageEfficiency_ && (centralStrip - i > 0))
cluster_.push_back(std::pair<int, int>(centralStrip - i, time_hit));
Expand All @@ -230,7 +256,7 @@ void GEMSimpleModel::simulateNoise(const GEMEtaPartition* roll)
{
if (flat1_->fire(1) < averageEfficiency_ && (centralStrip - 1 > 0))
cluster_.push_back(std::pair<int, int>(centralStrip - 1, time_hit));
for (int i = 1; i < clsR; ++i)
for (int i = 1; i <= clsR; ++i)
{
if (flat1_->fire(1) < averageEfficiency_ && (centralStrip - 1 - i > 0))
cluster_.push_back(std::pair<int, int>(centralStrip - 1 - i, time_hit));
Expand All @@ -253,8 +279,7 @@ void GEMSimpleModel::simulateNoise(const GEMEtaPartition* roll)
return;
}

std::vector<std::pair<int, int> > GEMSimpleModel::simulateClustering(const GEMEtaPartition* roll,
const PSimHit* simHit, const int bx)
std::vector<std::pair<int, int> > GEMSimpleModel::simulateClustering(const GEMEtaPartition* roll, const PSimHit* simHit, const int bx)
{
const StripTopology& topology = roll->specificTopology();
const LocalPoint& hit_position(simHit->localPosition());
Expand Down Expand Up @@ -290,7 +315,7 @@ std::vector<std::pair<int, int> > GEMSimpleModel::simulateClustering(const GEMEt
if (clusterSize % 2 != 0)
{
int clsR = (clusterSize - 1) / 2;
for (int i = 1; i < clsR; ++i)
for (int i = 1; i <= clsR; ++i)
{
if (flat1_->fire(1) < averageEfficiency_ && (centralStrip - i > 0))
cluster_.push_back(std::pair<int, int>(centralStrip - i, bx));
Expand All @@ -306,7 +331,7 @@ std::vector<std::pair<int, int> > GEMSimpleModel::simulateClustering(const GEMEt
{
if (flat1_->fire(1) < averageEfficiency_ && (centralStrip - 1 > 0))
cluster_.push_back(std::pair<int, int>(centralStrip - 1, bx));
for (int i = 1; i < clsR; ++i)
for (int i = 1; i <= clsR; ++i)
{
if (flat1_->fire(1) < averageEfficiency_ && (centralStrip - 1 - i > 0))
cluster_.push_back(std::pair<int, int>(centralStrip - 1 - i, bx));
Expand All @@ -318,7 +343,7 @@ std::vector<std::pair<int, int> > GEMSimpleModel::simulateClustering(const GEMEt
{
if (flat1_->fire(1) < averageEfficiency_ && (centralStrip + 1 <= nstrips))
cluster_.push_back(std::pair<int, int>(centralStrip + 1, bx));
for (int i = 1; i < clsR; ++i)
for (int i = 1; i <= clsR; ++i)
{
if (flat1_->fire(1) < averageEfficiency_ && (centralStrip + 1 + i <= nstrips))
cluster_.push_back(std::pair<int, int>(centralStrip + 1 + i, bx));
Expand Down

0 comments on commit a8ee610

Please sign in to comment.