CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
GEMSignalModel Class Reference

#include <GEMSignalModel.h>

Inheritance diagram for GEMSignalModel:
GEMDigiModel

Public Member Functions

 GEMSignalModel (const edm::ParameterSet &)
 
int getSimHitBx (const PSimHit *, CLHEP::HepRandomEngine *)
 
void simulate (const GEMEtaPartition *, const edm::PSimHitContainer &, CLHEP::HepRandomEngine *, Strips &, DetectorHitMap &) override
 
std::vector< std::pair< int,
int > > 
simulateClustering (const GEMStripTopology *, const PSimHit *, const int, CLHEP::HepRandomEngine *)
 
 ~GEMSignalModel () override
 
- Public Member Functions inherited from GEMDigiModel
void setGeometry (const GEMGeometry *geom)
 
virtual ~GEMDigiModel ()
 

Private Attributes

double averageEfficiency_
 
double averageShapingTime_
 
bool bx0filter_
 
const double cspeed
 
bool digitizeOnlyMuons_
 
const double elecEffLowCoeff
 
const double elecEffLowParam0
 
const double elecEffMidCoeff
 
const double elecEffMidParam0
 
const double elecEffMidParam1
 
const double elecMomCut1
 
const double elecMomCut2
 
const double momConvFact
 
const int muonPdgId
 
double resolutionX_
 
double signalPropagationSpeed_
 
double timeJitter_
 
double timeResolution_
 

Additional Inherited Members

- Protected Member Functions inherited from GEMDigiModel
 GEMDigiModel (const edm::ParameterSet &)
 
- Protected Attributes inherited from GEMDigiModel
const GEMGeometrygeometry_
 

Detailed Description

Class for the GEM strip intrinsic noise simulation based on a very simple model Originally comes from GEMSimpleModel

Author
Sven Dildick by Roumyana Hadjiiska by Yechan Kang

Class for the GEM strip response simulation based on a very simple model Originally comes from GEMSimpleModel

Author
Sven Dildick by Roumyana Hadjiiska by Yechan Kang

Definition at line 24 of file GEMSignalModel.h.

Constructor & Destructor Documentation

GEMSignalModel::GEMSignalModel ( const edm::ParameterSet config)

Definition at line 16 of file GEMSignalModel.cc.

17  : GEMDigiModel(config),
18  averageEfficiency_(config.getParameter<double>("averageEfficiency")),
19  averageShapingTime_(config.getParameter<double>("averageShapingTime")),
20  timeResolution_(config.getParameter<double>("timeResolution")),
21  timeJitter_(config.getParameter<double>("timeJitter")),
22  signalPropagationSpeed_(config.getParameter<double>("signalPropagationSpeed")),
23  bx0filter_(config.getParameter<bool>("bx0filter")),
24  digitizeOnlyMuons_(config.getParameter<bool>("digitizeOnlyMuons")),
25  resolutionX_(config.getParameter<double>("resolutionX")),
26  muonPdgId(13),
28  momConvFact(1000.),
29  elecMomCut1(1.96e-03),
30  elecMomCut2(10.e-03),
31  elecEffLowCoeff(1.7e-05),
32  elecEffLowParam0(2.1),
33  elecEffMidCoeff(1.34),
34  elecEffMidParam0(-5.75e-01),
35  elecEffMidParam1(7.96e-01) {}
const double elecMomCut1
double averageEfficiency_
const double elecEffMidParam1
const double elecEffMidCoeff
const double cspeed
double signalPropagationSpeed_
const double elecEffLowCoeff
const double elecEffLowParam0
const double elecMomCut2
const double elecEffMidParam0
double timeResolution_
GEMDigiModel(const edm::ParameterSet &)
Definition: GEMDigiModel.h:48
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:63
double averageShapingTime_
const int muonPdgId
const double momConvFact
GEMSignalModel::~GEMSignalModel ( )
override

Definition at line 37 of file GEMSignalModel.cc.

37 {}

Member Function Documentation

int GEMSignalModel::getSimHitBx ( const PSimHit simhit,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 81 of file GEMSignalModel.cc.

References averageShapingTime_, makePileupJSON::bx, cspeed, PSimHit::detUnitId(), GEMGeometry::etaPartition(), Exception, GEMDigiModel::geometry_, gpuClustering::id, PSimHit::localPosition(), LogDebug, signalPropagationSpeed_, mathSSE::sqrt(), timeJitter_, PSimHit::timeOfFlight(), timeResolution_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by simulate().

81  {
82  int bx = -999;
83  const LocalPoint simHitPos(simhit->localPosition());
84  const float tof(simhit->timeOfFlight());
85  // random Gaussian time correction due to electronics jitter
86  float randomJitterTime = CLHEP::RandGaussQ::shoot(engine, 0., timeJitter_);
87  const GEMDetId id(simhit->detUnitId());
88  const GEMEtaPartition* roll(geometry_->etaPartition(id));
89  if (!roll) {
90  throw cms::Exception("Geometry") << "GEMSignalModel::getSimHitBx() - GEM simhit id does not match any GEM roll id: "
91  << id << "\n";
92  return 999;
93  }
94  if (roll->id().region() == 0) {
95  throw cms::Exception("Geometry")
96  << "GEMSignalModel::getSimHitBx() - this GEM id is from barrel, which cannot happen: " << roll->id() << "\n";
97  }
98  const int nstrips = roll->nstrips();
99  float middleStrip = nstrips / 2.;
100  const LocalPoint& middleOfRoll = roll->centreOfStrip(middleStrip);
101  const GlobalPoint& globMiddleRol = roll->toGlobal(middleOfRoll);
102  double muRadius = sqrt(globMiddleRol.x() * globMiddleRol.x() + globMiddleRol.y() * globMiddleRol.y() +
103  globMiddleRol.z() * globMiddleRol.z());
104  double timeCalibrationOffset_ = muRadius / cspeed; //[ns]
105 
106  const GEMStripTopology* top(dynamic_cast<const GEMStripTopology*>(&(roll->topology())));
107  const float halfStripLength(0.5 * top->stripLength());
108  const float distanceFromEdge(halfStripLength - simHitPos.y());
109 
110  // signal propagation speed in material in [cm/ns]
111  double signalPropagationSpeedTrue = signalPropagationSpeed_ * cspeed;
112 
113  // average time for the signal to propagate from the SimHit to the top of a strip
114  const float averagePropagationTime(distanceFromEdge / signalPropagationSpeedTrue);
115  // random Gaussian time correction due to the finite timing resolution of the detector
116  float randomResolutionTime = CLHEP::RandGaussQ::shoot(engine, 0., timeResolution_);
117  const float simhitTime(tof + averageShapingTime_ + randomResolutionTime + averagePropagationTime + randomJitterTime);
118  float referenceTime = 0.;
119  referenceTime = timeCalibrationOffset_ + halfStripLength / signalPropagationSpeedTrue + averageShapingTime_;
120  const float timeDifference(simhitTime - referenceTime);
121  // assign the bunch crossing
122  bx = static_cast<int>(std::round((timeDifference) / 25.));
123 
124  // check time
125  LogDebug("GEMDigiProducer") << "checktime "
126  << "bx = " << bx << "\tdeltaT = " << timeDifference << "\tsimT = " << simhitTime
127  << "\trefT = " << referenceTime << "\ttof = " << tof
128  << "\tavePropT = " << averagePropagationTime
129  << "\taveRefPropT = " << halfStripLength / signalPropagationSpeedTrue << "\n";
130  return bx;
131 }
uint16_t *__restrict__ id
T y() const
Definition: PV3DBase.h:60
const double cspeed
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
Definition: GEMGeometry.cc:77
double signalPropagationSpeed_
float timeOfFlight() const
Definition: PSimHit.h:73
Local3DPoint localPosition() const
Definition: PSimHit.h:52
T sqrt(T t)
Definition: SSEVec.h:19
T z() const
Definition: PV3DBase.h:61
double timeResolution_
const GEMGeometry * geometry_
Definition: GEMDigiModel.h:47
double averageShapingTime_
T x() const
Definition: PV3DBase.h:59
unsigned int detUnitId() const
Definition: PSimHit.h:97
#define LogDebug(id)
void GEMSignalModel::simulate ( const GEMEtaPartition roll,
const edm::PSimHitContainer simHits,
CLHEP::HepRandomEngine *  engine,
Strips strips_,
DetectorHitMap detectorHitMap_ 
)
overridevirtual

Implements GEMDigiModel.

Definition at line 39 of file GEMSignalModel.cc.

References funct::abs(), averageEfficiency_, makePileupJSON::bx, bx0filter_, digitizeOnlyMuons_, elecEffLowCoeff, elecEffLowParam0, elecEffMidCoeff, elecEffMidParam0, elecEffMidParam1, elecMomCut1, elecMomCut2, funct::exp(), getSimHitBx(), log, momConvFact, muonPdgId, simulateClustering(), and GEMEtaPartition::topology().

43  {
44  bool digiMuon = false;
45  bool digiElec = false;
46  const GEMStripTopology* top(dynamic_cast<const GEMStripTopology*>(&(roll->topology())));
47  for (const auto& hit : simHits) {
48  if (std::abs(hit.particleType()) != muonPdgId && digitizeOnlyMuons_)
49  continue;
50  double elecEff = 0.;
51  double partMom = hit.pabs();
52  double checkMuonEff = CLHEP::RandFlat::shoot(engine, 0., 1.);
53  double checkElecEff = CLHEP::RandFlat::shoot(engine, 0., 1.);
54  if (std::abs(hit.particleType()) == muonPdgId && checkMuonEff < averageEfficiency_)
55  digiMuon = true;
56  if (std::abs(hit.particleType()) != muonPdgId) //consider all non muon particles with gem efficiency to electrons
57  {
58  if (partMom <= elecMomCut1)
59  elecEff = elecEffLowCoeff * std::exp(elecEffLowParam0 * partMom * momConvFact);
60  if (partMom > elecMomCut1 && partMom < elecMomCut2)
63  if (partMom > elecMomCut2)
64  elecEff = 1.;
65  if (checkElecEff < elecEff)
66  digiElec = true;
67  }
68  if (!(digiMuon || digiElec))
69  continue;
70  const int bx(getSimHitBx(&hit, engine));
71  if (bx != 0 and bx0filter_)
72  continue;
73  const std::vector<std::pair<int, int> >& cluster(simulateClustering(top, &hit, bx, engine));
74  for (const auto& digi : cluster) {
75  detectorHitMap_.emplace(digi, &hit);
76  strips_.emplace(digi);
77  }
78  }
79 }
const double elecMomCut1
static std::vector< std::string > checklist log
double averageEfficiency_
const double elecEffMidParam1
const double elecEffMidCoeff
std::vector< std::pair< int, int > > simulateClustering(const GEMStripTopology *, const PSimHit *, const int, CLHEP::HepRandomEngine *)
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
const double elecEffLowCoeff
const double elecEffLowParam0
const double elecMomCut2
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const double elecEffMidParam0
int getSimHitBx(const PSimHit *, CLHEP::HepRandomEngine *)
const Topology & topology() const override
tuple simHits
Definition: trackerHits.py:16
const int muonPdgId
const double momConvFact
std::vector< std::pair< int, int > > GEMSignalModel::simulateClustering ( const GEMStripTopology top,
const PSimHit simHit,
const int  bx,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 133 of file GEMSignalModel.cc.

References funct::abs(), GEMStripTopology::channel(), PSimHit::entryPoint(), PSimHit::exitPoint(), resolutionX_, digitizers_cfi::strip, and PV3DBase< T, PVType, FrameType >::x().

Referenced by simulate().

136  {
137  const LocalPoint& hit_entry(simHit->entryPoint());
138  const LocalPoint& hit_exit(simHit->exitPoint());
139 
140  LocalPoint start_point, end_point;
141  if (hit_entry.x() < hit_exit.x()) {
142  start_point = hit_entry;
143  end_point = hit_exit;
144  } else {
145  start_point = hit_exit;
146  end_point = hit_entry;
147  }
148 
149  // Add Gaussian noise to the points towards outside.
150  float smeared_start_x = start_point.x() - std::abs(CLHEP::RandGaussQ::shoot(engine, 0, resolutionX_));
151  float smeared_end_x = end_point.x() + std::abs(CLHEP::RandGaussQ::shoot(engine, 0, resolutionX_));
152 
153  LocalPoint smeared_start_point(smeared_start_x, start_point.y(), start_point.z());
154  LocalPoint smeared_end_point(smeared_end_x, end_point.y(), end_point.z());
155 
156  int cluster_start = top->channel(smeared_start_point);
157  int cluster_end = top->channel(smeared_end_point);
158 
159  std::vector<std::pair<int, int> > cluster;
160  for (int strip = cluster_start; strip <= cluster_end; strip++) {
161  cluster.emplace_back(strip, bx);
162  }
163 
164  return cluster;
165 }
int channel(const LocalPoint &) const override
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:46
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T x() const
Definition: PV3DBase.h:59
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:43

Member Data Documentation

double GEMSignalModel::averageEfficiency_
private

Definition at line 41 of file GEMSignalModel.h.

Referenced by simulate().

double GEMSignalModel::averageShapingTime_
private

Definition at line 42 of file GEMSignalModel.h.

Referenced by getSimHitBx().

bool GEMSignalModel::bx0filter_
private

Definition at line 46 of file GEMSignalModel.h.

Referenced by simulate().

const double GEMSignalModel::cspeed
private

Definition at line 51 of file GEMSignalModel.h.

Referenced by getSimHitBx().

bool GEMSignalModel::digitizeOnlyMuons_
private

Definition at line 47 of file GEMSignalModel.h.

Referenced by simulate().

const double GEMSignalModel::elecEffLowCoeff
private

Definition at line 55 of file GEMSignalModel.h.

Referenced by simulate().

const double GEMSignalModel::elecEffLowParam0
private

Definition at line 56 of file GEMSignalModel.h.

Referenced by simulate().

const double GEMSignalModel::elecEffMidCoeff
private

Definition at line 57 of file GEMSignalModel.h.

Referenced by simulate().

const double GEMSignalModel::elecEffMidParam0
private

Definition at line 58 of file GEMSignalModel.h.

Referenced by simulate().

const double GEMSignalModel::elecEffMidParam1
private

Definition at line 59 of file GEMSignalModel.h.

Referenced by simulate().

const double GEMSignalModel::elecMomCut1
private

Definition at line 53 of file GEMSignalModel.h.

Referenced by simulate().

const double GEMSignalModel::elecMomCut2
private

Definition at line 54 of file GEMSignalModel.h.

Referenced by simulate().

const double GEMSignalModel::momConvFact
private

Definition at line 52 of file GEMSignalModel.h.

Referenced by simulate().

const int GEMSignalModel::muonPdgId
private

Definition at line 50 of file GEMSignalModel.h.

Referenced by simulate().

double GEMSignalModel::resolutionX_
private

Definition at line 48 of file GEMSignalModel.h.

Referenced by simulateClustering().

double GEMSignalModel::signalPropagationSpeed_
private

Definition at line 45 of file GEMSignalModel.h.

Referenced by getSimHitBx().

double GEMSignalModel::timeJitter_
private

Definition at line 44 of file GEMSignalModel.h.

Referenced by getSimHitBx().

double GEMSignalModel::timeResolution_
private

Definition at line 43 of file GEMSignalModel.h.

Referenced by getSimHitBx().