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)
 
void setParticleDataTable (const ParticleDataTable *pdt)
 
 SiLinearChargeDivider (const edm::ParameterSet &conf, CLHEP::HepRandomEngine &)
 
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[])
 
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
 
CLHEP::HepRandomEngine & rndEngine
 
const ParticleDataTabletheParticleDataTable
 

Static Private Attributes

static float decoValues [651]
 
static float 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,
CLHEP::HepRandomEngine &  eng 
)

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  rndEngine(eng),
23  // Geant4 engine used to fluctuate the charge from segment to segment
25 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const ParticleDataTable * theParticleDataTable
CLHEP::HepRandomEngine & rndEngine
std::unique_ptr< SiG4UniversalFluctuation > fluctuate
SiLinearChargeDivider::~SiLinearChargeDivider ( )
virtual

Definition at line 27 of file SiLinearChargeDivider.cc.

27  {
28 }

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())
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
Local3DPoint localPosition() const
Definition: PSimHit.h:44
static float decoValues[651]
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:75
Definition: DDAxes.h:10
SiChargeDivider::ionization_type SiLinearChargeDivider::divide ( const PSimHit hit,
const LocalVector driftdir,
double  moduleThickness,
const StripGeomDetUnit det 
)
virtual

Implements SiChargeDivider.

Definition at line 31 of file SiLinearChargeDivider.cc.

References 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__().

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

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

Referenced by divide().

56  {
57  return pos.x()+(thickness/2.-pos.z())*drift.x()/drift.z();
58  }
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[] 
)
private

Definition at line 96 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)/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:35
Local3DPoint localPosition() const
Definition: PSimHit.h:44
static float peakValues[921]
float energyLoss() const
The energy deposit in the PSimHit, in ???.
Definition: PSimHit.h:75
Definition: DDAxes.h:10
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 62 of file SiLinearChargeDivider.h.

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

Referenced by divide().

62  {
63  return (peakMode ? PeakShape(hit,det) : DeconvolutionShape(hit,det));
64  }
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 SiLinearChargeDivider::decoValues
staticprivate

Definition at line 72 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 54 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 SiLinearChargeDivider::peakValues
staticprivate

Definition at line 70 of file SiLinearChargeDivider.h.

Referenced by PeakShape().

CLHEP::HepRandomEngine& SiLinearChargeDivider::rndEngine
private

Definition at line 52 of file SiLinearChargeDivider.h.

const ParticleDataTable* SiLinearChargeDivider::theParticleDataTable
private

Definition at line 50 of file SiLinearChargeDivider.h.

Referenced by divide(), and setParticleDataTable().