CMS 3D CMS Logo

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

#include <SiLinearChargeDivider.h>

Inheritance diagram for SiLinearChargeDivider:
SiChargeDivider

Public Member Functions

SiChargeDivider::ionization_type divide (const PSimHit *, const LocalVector &, double, const StripGeomDetUnit &det, CLHEP::HepRandomEngine *)
 
void setParticleDataTable (const ParticleDataTable *pdt)
 
 SiLinearChargeDivider (const edm::ParameterSet &conf)
 
virtual ~SiLinearChargeDivider ()
 
- Public Member Functions inherited from SiChargeDivider
virtual ~SiChargeDivider ()
 

Private Member Functions

float DeconvolutionShape (const PSimHit *, const StripGeomDetUnit &det)
 
float driftXPos (const Local3DPoint &pos, const LocalVector &drift, double thickness)
 
void fluctuateEloss (double const particleMass, float momentum, float eloss, float length, int NumberOfSegmentation, float elossVector[], CLHEP::HepRandomEngine *)
 
float PeakShape (const PSimHit *, const StripGeomDetUnit &det)
 
float TimeResponse (const PSimHit *hit, const StripGeomDetUnit &det)
 

Private Attributes

const int chargedivisionsPerStrip
 
const double cosmicShift
 
const double deltaCut
 
std::unique_ptr
< SiG4UniversalFluctuation
fluctuate
 
const bool fluctuateCharge
 
const bool peakMode
 
const ParticleDataTabletheParticleDataTable
 

Static Private Attributes

static float const decoValues [651]
 
static float const peakValues [921]
 

Additional Inherited Members

- Public Types inherited from SiChargeDivider
typedef std::vector
< EnergyDepositUnit
ionization_type
 

Detailed Description

Concrete implementation of SiChargeDivider. It divides the charge on the line connecting entry and exit point of the SimTrack in the Silicon. Effects that are considered here are:

Definition at line 27 of file SiLinearChargeDivider.h.

Constructor & Destructor Documentation

SiLinearChargeDivider::SiLinearChargeDivider ( const edm::ParameterSet conf)

Definition at line 7 of file SiLinearChargeDivider.cc.

7  :
8  // Run APV in peak instead of deconvolution mode, which degrades the time resolution.
9  peakMode(conf.getParameter<bool>("APVpeakmode")),
10  // Enable interstrip Landau fluctuations within a cluster.
11  fluctuateCharge(conf.getParameter<bool>("LandauFluctuations")),
12  // Number of segments per strip into which charge is divided during
13  // simulation. If large, precision of simulation improves.
14  chargedivisionsPerStrip(conf.getParameter<int>("chargeDivisionsPerStrip")),
15  // delta cutoff in MeV, has to be same as in Geant (0.120425 MeV corresponding to 100um range for electrons)
16  deltaCut(conf.getParameter<double>("DeltaProductionCut")),
17  //Offset for digitization during the MTCC and in general for taking cosmic particle
18  //The value to be used it must be evaluated and depend on the volume defnition used
19  //for the cosimc generation (Considering only the tracker the value is 11 ns)
20  cosmicShift(conf.getUntrackedParameter<double>("CosmicDelayShift")),
22  // Geant4 engine used to fluctuate the charge from segment to segment
24 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const ParticleDataTable * theParticleDataTable
std::unique_ptr< SiG4UniversalFluctuation > fluctuate
SiLinearChargeDivider::~SiLinearChargeDivider ( )
virtual

Definition at line 26 of file SiLinearChargeDivider.cc.

26  {
27 }

Member Function Documentation

float SiLinearChargeDivider::DeconvolutionShape ( const PSimHit hit,
const StripGeomDetUnit det 
)
private

Definition at line 135 of file SiLinearChargeDivider.cc.

References cosmicShift, decoValues, PSimHit::energyLoss(), PSimHit::localPosition(), mag(), GeomDet::surface(), PSimHit::tof(), Surface::toGlobal(), and x.

Referenced by TimeResponse().

135  {
136  // x is difference between the tof and the tof for a photon (reference)
137  // converted into a bin number
138  int x = int(((det.surface().toGlobal(hit->localPosition()).mag()/30.) + cosmicShift - hit->tof())*10)+300;
139  if(x < 0 || x > 650) return 0;
140  return hit->energyLoss()*decoValues[x];
141 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
float tof() const
deprecated name for timeOfFlight()
Definition: PSimHit.h:72
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
static float const decoValues[651]
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
Local3DPoint localPosition() const
Definition: PSimHit.h:44
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:75
SiChargeDivider::ionization_type SiLinearChargeDivider::divide ( const PSimHit hit,
const LocalVector driftdir,
double  moduleThickness,
const StripGeomDetUnit det,
CLHEP::HepRandomEngine *  engine 
)
virtual

Implements SiChargeDivider.

Definition at line 30 of file SiLinearChargeDivider.cc.

References assert(), chargedivisionsPerStrip, driftXPos(), PSimHit::energyLoss(), PSimHit::entryPoint(), PSimHit::exitPoint(), fluctuateCharge, fluctuateEloss(), i, StripTopology::localPitch(), PSimHit::localPosition(), LogDebug, PV3DBase< T, PVType, FrameType >::mag(), PSimHit::pabs(), PSimHit::particleType(), StripGeomDetUnit::specificTopology(), theParticleDataTable, and TimeResponse().

Referenced by cuy.FindIssue::__init__().

30  {
31 
32  // signal after pulse shape correction
33  float const decSignal = TimeResponse(hit, det);
34 
35  // if out of time go home!
36  if (0==decSignal) return ionization_type();
37 
38  // Get the nass if the particle, in MeV.
39  // Protect from particles with Mass = 0, assuming then the pion mass
41  ParticleData const * particle = theParticleDataTable->particle( hit->particleType() );
42  double const particleMass = particle ? particle->mass()*1000 : 139.57;
43  double const particleCharge = particle ? particle->charge() : 1.;
44 
45  if(!particle) {
46  LogDebug("SiLinearChargeDivider") << "Cannot find particle of type "<< hit->particleType()
47  << " in the PDT we assign to this particle the mass and charge of the Pion";
48  }
49 
50  int NumberOfSegmentation =
51  // if neutral: just one deposit....
52  (fabs(particleMass)<1.e-6 || particleCharge==0) ? 1 :
53  // computes the number of segments from number of segments per strip times number of strips.
54  (int)(1 + chargedivisionsPerStrip*fabs(driftXPos(hit->exitPoint(), driftdir, moduleThickness)-
55  driftXPos(hit->entryPoint(), driftdir, moduleThickness) )
56  /det.specificTopology().localPitch(hit->localPosition()) );
57 
58 
59  // Eloss in GeV
60  float eLoss = hit->energyLoss();
61 
62 
63  // Prepare output
64  ionization_type _ionization_points;
65  _ionization_points.resize(NumberOfSegmentation);
66 
67  // Fluctuate charge in track subsegments
68  LocalVector direction = hit->exitPoint() - hit->entryPoint();
69  if (NumberOfSegmentation <=1) {
70  // here I need a random... not 0.5
71  _ionization_points[0] = EnergyDepositUnit(eLoss*decSignal/eLoss,
72  hit->entryPoint()+0.5f*direction);
73  }else {
74  float eLossVector[NumberOfSegmentation];
75  if( fluctuateCharge ) {
76  fluctuateEloss(particleMass, hit->pabs(), eLoss, direction.mag(), NumberOfSegmentation, eLossVector, engine);
77  // Save the energy of each segment
78  for ( int i = 0; i != NumberOfSegmentation; i++) {
79  // take energy value from vector eLossVector,
80  _ionization_points[i] = EnergyDepositUnit(eLossVector[i]*decSignal/eLoss,
81  hit->entryPoint()+float((i+0.5)/NumberOfSegmentation)*direction);
82  }
83  } else {
84  // Save the energy of each segment
85  for ( int i = 0; i != NumberOfSegmentation; i++) {
86  // take energy value from eLoss average over n.segments.
87  _ionization_points[i] = EnergyDepositUnit(decSignal/float(NumberOfSegmentation),
88  hit->entryPoint()+float((i+0.5)/NumberOfSegmentation)*direction);
89  }
90  }
91  }
92  return _ionization_points;
93 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
const ParticleDataTable * theParticleDataTable
assert(m_qm.get())
float TimeResponse(const PSimHit *hit, const StripGeomDetUnit &det)
float driftXPos(const Local3DPoint &pos, const LocalVector &drift, double thickness)
void fluctuateEloss(double const particleMass, float momentum, float eloss, float length, int NumberOfSegmentation, float elossVector[], CLHEP::HepRandomEngine *)
virtual const StripTopology & specificTopology() const
Returns a reference to the strip proxy topology.
virtual float localPitch(const LocalPoint &) const =0
Local3DPoint exitPoint() const
Exit point in the local Det frame.
Definition: PSimHit.h:38
T mag() const
Definition: PV3DBase.h:67
Local3DPoint localPosition() const
Definition: PSimHit.h:44
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:63
HepPDT::ParticleData ParticleData
std::vector< EnergyDepositUnit > ionization_type
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:75
int particleType() const
Definition: PSimHit.h:85
Local3DPoint entryPoint() const
Entry point in the local Det frame.
Definition: PSimHit.h:35
float SiLinearChargeDivider::driftXPos ( const Local3DPoint pos,
const LocalVector drift,
double  thickness 
)
inlineprivate

Definition at line 55 of file SiLinearChargeDivider.h.

References PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by divide().

55  {
56  return pos.x()+(thickness/2.-pos.z())*drift.x()/drift.z();
57  }
T z() const
Definition: PV3DBase.h:64
T x() const
Definition: PV3DBase.h:62
void SiLinearChargeDivider::fluctuateEloss ( double const  particleMass,
float  momentum,
float  eloss,
float  length,
int  NumberOfSegmentation,
float  elossVector[],
CLHEP::HepRandomEngine *  engine 
)
private

Definition at line 95 of file SiLinearChargeDivider.cc.

References deltaCut, fluctuate, i, and cuy::ii.

Referenced by divide().

98  {
99 
100 
101  // Generate charge fluctuations.
102  float sum=0.;
103  double deltaCutoff;
104  double mom = particleMomentum*1000.;
105  double seglen = length/NumberOfSegs*10.;
106  double segeloss = (1000.*eloss)/NumberOfSegs;
107  for (int i=0;i<NumberOfSegs;i++) {
108  // The G4 routine needs momentum in MeV, mass in MeV, delta-cut in MeV,
109  // track segment length in mm, segment eloss in MeV
110  // Returns fluctuated eloss in MeV
111  // the cutoff is sometimes redefined inside, so fix it.
112  deltaCutoff = deltaCut;
113  sum += (elossVector[i] = fluctuate->SampleFluctuations(mom,particleMass,deltaCutoff,seglen,segeloss, engine)/1000.);
114  }
115 
116  if(sum>0.) { // If fluctuations give eloss>0.
117  // Rescale to the same total eloss
118  float ratio = eloss/sum;
119  for (int ii=0;ii<NumberOfSegs;ii++) elossVector[ii]= ratio*elossVector[ii];
120  } else { // If fluctuations gives 0 eloss
121  float averageEloss = eloss/NumberOfSegs;
122  for (int ii=0;ii<NumberOfSegs;ii++) elossVector[ii]= averageEloss;
123  }
124  return;
125 }
int i
Definition: DBlmapReader.cc:9
int ii
Definition: cuy.py:588
std::unique_ptr< SiG4UniversalFluctuation > fluctuate
float SiLinearChargeDivider::PeakShape ( const PSimHit hit,
const StripGeomDetUnit det 
)
private

Definition at line 127 of file SiLinearChargeDivider.cc.

References cosmicShift, PSimHit::energyLoss(), PSimHit::localPosition(), mag(), peakValues, GeomDet::surface(), PSimHit::tof(), Surface::toGlobal(), and x.

Referenced by TimeResponse().

127  {
128  // x is difference between the tof and the tof for a photon (reference)
129  // converted into a bin number
130  int x = int(((det.surface().toGlobal(hit->localPosition()).mag()/30.) + cosmicShift - hit->tof())*2)+120;
131  if(x < 0 || x > 920) return 0;
132  return hit->energyLoss()*peakValues[x];
133 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
float tof() const
deprecated name for timeOfFlight()
Definition: PSimHit.h:72
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
Local3DPoint localPosition() const
Definition: PSimHit.h:44
static float const peakValues[921]
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:75
void SiLinearChargeDivider::setParticleDataTable ( const ParticleDataTable pdt)
inlinevirtual

Implements SiChargeDivider.

Definition at line 40 of file SiLinearChargeDivider.h.

References theParticleDataTable.

40 { theParticleDataTable = pdt; }
const ParticleDataTable * theParticleDataTable
float SiLinearChargeDivider::TimeResponse ( const PSimHit hit,
const StripGeomDetUnit det 
)
inlineprivate

Definition at line 61 of file SiLinearChargeDivider.h.

References DeconvolutionShape(), peakMode, and PeakShape().

Referenced by divide().

61  {
62  return (peakMode ? PeakShape(hit,det) : DeconvolutionShape(hit,det));
63  }
float PeakShape(const PSimHit *, const StripGeomDetUnit &det)
float DeconvolutionShape(const PSimHit *, const StripGeomDetUnit &det)

Member Data Documentation

const int SiLinearChargeDivider::chargedivisionsPerStrip
private

Definition at line 46 of file SiLinearChargeDivider.h.

Referenced by divide().

const double SiLinearChargeDivider::cosmicShift
private

Definition at line 48 of file SiLinearChargeDivider.h.

Referenced by DeconvolutionShape(), and PeakShape().

float const SiLinearChargeDivider::decoValues
staticprivate

Definition at line 71 of file SiLinearChargeDivider.h.

Referenced by DeconvolutionShape().

const double SiLinearChargeDivider::deltaCut
private

Definition at line 47 of file SiLinearChargeDivider.h.

Referenced by fluctuateEloss().

std::unique_ptr<SiG4UniversalFluctuation> SiLinearChargeDivider::fluctuate
private

Definition at line 53 of file SiLinearChargeDivider.h.

Referenced by fluctuateEloss().

const bool SiLinearChargeDivider::fluctuateCharge
private

Definition at line 45 of file SiLinearChargeDivider.h.

Referenced by divide().

const bool SiLinearChargeDivider::peakMode
private

Definition at line 44 of file SiLinearChargeDivider.h.

Referenced by TimeResponse().

float const SiLinearChargeDivider::peakValues
staticprivate

Definition at line 69 of file SiLinearChargeDivider.h.

Referenced by PeakShape().

const ParticleDataTable* SiLinearChargeDivider::theParticleDataTable
private

Definition at line 50 of file SiLinearChargeDivider.h.

Referenced by divide(), and setParticleDataTable().