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 (int particleId, 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

int chargedivisionsPerStrip
 
edm::ParameterSet conf_
 
double cosmicShift
 
double deltaCut
 
SiG4UniversalFluctuationfluctuate
 
bool fluctuateCharge
 
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 25 of file SiLinearChargeDivider.h.

Constructor & Destructor Documentation

SiLinearChargeDivider::SiLinearChargeDivider ( const edm::ParameterSet conf,
CLHEP::HepRandomEngine &  eng 
)

Definition at line 7 of file SiLinearChargeDivider.cc.

References chargedivisionsPerStrip, conf_, cosmicShift, deltaCut, fluctuate, fluctuateCharge, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), peakMode, and rndEngine.

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

Definition at line 31 of file SiLinearChargeDivider.cc.

References fluctuate.

31  {
32  delete fluctuate;
33 }
SiG4UniversalFluctuation * fluctuate

Member Function Documentation

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

Definition at line 127 of file SiLinearChargeDivider.cc.

References cosmicShift, decoValues, PSimHit::energyLoss(), PSimHit::localPosition(), mag(), GeomDet::surface(), PSimHit::tof(), Surface::toGlobal(), and vdt::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())*10)+300;
131  if(x < 0 || x > 650) return 0;
132  return hit->energyLoss()*decoValues[x];
133 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
float tof() const
deprecated name for timeOfFlight()
Definition: PSimHit.h:72
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
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
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
x
Definition: VDTMath.h:216
SiChargeDivider::ionization_type SiLinearChargeDivider::divide ( const PSimHit hit,
const LocalVector driftdir,
double  moduleThickness,
const StripGeomDetUnit det 
)
virtual

Implements SiChargeDivider.

Definition at line 36 of file SiLinearChargeDivider.cc.

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

36  {
37 
38  // computes the number of segments from number of segments per strip times number of strips.
39  int NumberOfSegmentation =
40  (int)(1 + chargedivisionsPerStrip*fabs(driftXPos(hit->exitPoint(), driftdir, moduleThickness)-
41  driftXPos(hit->entryPoint(), driftdir, moduleThickness) )
42  /det.specificTopology().localPitch(hit->localPosition()) );
43 
44  // Eloss in GeV
45  float eLoss = hit->energyLoss();
46 
47  // signal after pulse shape correction
48  float decSignal = TimeResponse(hit, det);
49 
50  // Prepare output
51  ionization_type _ionization_points;
52  _ionization_points.resize(NumberOfSegmentation);
53 
54  // Fluctuate charge in track subsegments
55  LocalVector direction = hit->exitPoint() - hit->entryPoint();
56  float* eLossVector = new float[NumberOfSegmentation];
57  if( fluctuateCharge ) {
58  fluctuateEloss(hit->particleType(), hit->pabs(), eLoss, direction.mag(), NumberOfSegmentation, eLossVector);
59  // Save the energy of each segment
60  for ( int i = 0; i != NumberOfSegmentation; i++) {
61  // take energy value from vector eLossVector,
62  _ionization_points[i] = EnergyDepositUnit(eLossVector[i]*decSignal/eLoss,
63  hit->entryPoint()+float((i+0.5)/NumberOfSegmentation)*direction);
64  }
65  } else {
66  // Save the energy of each segment
67  for ( int i = 0; i != NumberOfSegmentation; i++) {
68  // take energy value from eLoss average over n.segments.
69  _ionization_points[i] = EnergyDepositUnit(decSignal/float(NumberOfSegmentation),
70  hit->entryPoint()+float((i+0.5)/NumberOfSegmentation)*direction);
71  }
72  }
73 
74  delete[] eLossVector;
75  return _ionization_points;
76 }
int i
Definition: DBlmapReader.cc:9
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.
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:66
Local3DPoint localPosition() const
Definition: PSimHit.h:44
float pabs() const
fast and more accurate access to momentumAtEntry().mag()
Definition: PSimHit.h:63
std::vector< EnergyDepositUnit > ionization_type
void fluctuateEloss(int particleId, float momentum, float eloss, float length, int NumberOfSegmentation, float elossVector[])
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:63
T x() const
Definition: PV3DBase.h:61
void SiLinearChargeDivider::fluctuateEloss ( int  particleId,
float  momentum,
float  eloss,
float  length,
int  NumberOfSegmentation,
float  elossVector[] 
)
private

Definition at line 78 of file SiLinearChargeDivider.cc.

References deltaCut, alignCSCRings::e, fluctuate, i, LogDebug, SiG4UniversalFluctuation::SampleFluctuations(), and theParticleDataTable.

Referenced by divide().

80  {
81 
82  // Get the nass if the particle, in MeV.
83  // Protect from particles with Mass = 0, assuming then the pion mass
84  assert(theParticleDataTable != 0);
85  ParticleData const * particle = theParticleDataTable->particle( pid );
86  double particleMass = particle ? particle->mass()*1000 : 139.57;
87  if(!particle) {
88  LogDebug("SiLinearChargeDivider") << "Cannot find particle of type "<<pid
89  << " in the PDT we assign to this particle the mass of the Pion";
90  }
91  if(fabs(particleMass)<1.e-6 || pid == 22) particleMass = 139.57;
92 
93  // Generate charge fluctuations.
94  float sum=0.;
95  double deltaCutoff;
96  double mom = particleMomentum*1000.;
97  double seglen = length/NumberOfSegs*10.;
98  double segeloss = (1000.*eloss)/NumberOfSegs;
99  for (int i=0;i<NumberOfSegs;i++) {
100  // The G4 routine needs momentum in MeV, mass in MeV, delta-cut in MeV,
101  // track segment length in mm, segment eloss in MeV
102  // Returns fluctuated eloss in MeV
103  // the cutoff is sometimes redefined inside, so fix it.
104  deltaCutoff = deltaCut;
105  sum += (elossVector[i] = fluctuate->SampleFluctuations(mom,particleMass,deltaCutoff,seglen,segeloss)/1000.);
106  }
107 
108  if(sum>0.) { // If fluctuations give eloss>0.
109  // Rescale to the same total eloss
110  float ratio = eloss/sum;
111  for (int ii=0;ii<NumberOfSegs;ii++) elossVector[ii]= ratio*elossVector[ii];
112  } else { // If fluctuations gives 0 eloss
113  float averageEloss = eloss/NumberOfSegs;
114  for (int ii=0;ii<NumberOfSegs;ii++) elossVector[ii]= averageEloss;
115  }
116  return;
117 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
const ParticleDataTable * theParticleDataTable
double SampleFluctuations(const double momentum, const double mass, double &tmax, const double length, const double meanLoss)
HepPDT::ParticleData ParticleData
SiG4UniversalFluctuation * fluctuate
float SiLinearChargeDivider::PeakShape ( const PSimHit hit,
const StripGeomDetUnit det 
)
private

Definition at line 119 of file SiLinearChargeDivider.cc.

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

Referenced by TimeResponse().

119  {
120  // x is difference between the tof and the tof for a photon (reference)
121  // converted into a bin number
122  int x = int(((det.surface().toGlobal(hit->localPosition()).mag()/30.) + cosmicShift - hit->tof())*2)+120;
123  if(x < 0 || x > 920) return 0;
124  return hit->energyLoss()*peakValues[x];
125 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
float tof() const
deprecated name for timeOfFlight()
Definition: PSimHit.h:72
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
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
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
x
Definition: VDTMath.h:216
void SiLinearChargeDivider::setParticleDataTable ( const ParticleDataTable pdt)
inlinevirtual

Implements SiChargeDivider.

Definition at line 38 of file SiLinearChargeDivider.h.

References theParticleDataTable.

38 { 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

int SiLinearChargeDivider::chargedivisionsPerStrip
private

Definition at line 46 of file SiLinearChargeDivider.h.

Referenced by divide(), and SiLinearChargeDivider().

edm::ParameterSet SiLinearChargeDivider::conf_
private

Definition at line 42 of file SiLinearChargeDivider.h.

Referenced by SiLinearChargeDivider().

double SiLinearChargeDivider::cosmicShift
private

Definition at line 48 of file SiLinearChargeDivider.h.

Referenced by DeconvolutionShape(), PeakShape(), and SiLinearChargeDivider().

float SiLinearChargeDivider::decoValues
staticprivate

Definition at line 71 of file SiLinearChargeDivider.h.

Referenced by DeconvolutionShape().

double SiLinearChargeDivider::deltaCut
private

Definition at line 47 of file SiLinearChargeDivider.h.

Referenced by fluctuateEloss(), and SiLinearChargeDivider().

SiG4UniversalFluctuation* SiLinearChargeDivider::fluctuate
private
bool SiLinearChargeDivider::fluctuateCharge
private

Definition at line 45 of file SiLinearChargeDivider.h.

Referenced by divide(), and SiLinearChargeDivider().

bool SiLinearChargeDivider::peakMode
private

Definition at line 44 of file SiLinearChargeDivider.h.

Referenced by SiLinearChargeDivider(), and TimeResponse().

float SiLinearChargeDivider::peakValues
staticprivate

Definition at line 69 of file SiLinearChargeDivider.h.

Referenced by PeakShape().

CLHEP::HepRandomEngine& SiLinearChargeDivider::rndEngine
private

Definition at line 53 of file SiLinearChargeDivider.h.

Referenced by SiLinearChargeDivider().

const ParticleDataTable* SiLinearChargeDivider::theParticleDataTable
private

Definition at line 49 of file SiLinearChargeDivider.h.

Referenced by fluctuateEloss(), and setParticleDataTable().