All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
RealisticCaloDigiSilicon.cc
Go to the documentation of this file.
1 // Calorimeter digitiser for the IDC ECAL and HCAL
2 // For other detectors/models SimpleCaloDigi should be used
4 
5 #include <marlin/Global.h>
6 
7 #include <iostream>
8 #include <string>
9 #include <algorithm>
10 #include <assert.h>
11 
12 #include "CLHEP/Random/RandPoisson.h"
13 #include "CLHEP/Random/RandGauss.h"
14 
15 using namespace std;
16 using namespace lcio ;
17 using namespace marlin ;
18 
20 
21 RealisticCaloDigiSilicon::RealisticCaloDigiSilicon() : RealisticCaloDigi::Processor("RealisticCaloDigiSilicon") {
22  _description = "Digitization of silicon simcalo hits" ;
23  registerProcessorParameter("silicon_pairEnergy" ,
24  "energy required to create e-h pair in silicon (in eV)" ,
25  _ehEnergy,
26  (float)3.6);
27 }
28 
29 float RealisticCaloDigiSilicon::convertEnergy( float energy, int inUnit ) const { // convert energy from input to output scale (MIP)
30  // converts input energy to MIP scale
31  if ( inUnit==MIP ) return energy;
32  else if ( inUnit==GEVDEP ) return energy/_calib_mip;
33  else streamlog_out (ERROR) << "RealisticCaloDigiSilicon::convertEnergy - unknown unit " << inUnit << std::endl;
34  assert (0);
35 }
36 
37 
39  // applies extra digitisation to silicon hits
40  // input energy in deposited GeV
41  // output is MIP scale
42  float smeared_energy(energy);
43  if ( _ehEnergy>0 ) {
44  // calculate #e-h pairs
45  float nehpairs = 1e9*energy/_ehEnergy; // check units of energy! _ehEnergy is in eV, energy in GeV
46  // fluctuate it by Poisson (actually an overestimate: Fano factor actually makes it smaller, however even this overstimated effect is tiny for our purposes)
47  smeared_energy *= CLHEP::RandPoisson::shoot( nehpairs )/nehpairs;
48  }
49 
50  return smeared_energy/_calib_mip; // convert to MIP units
51 }
52 
53 
float digitiseDetectorEnergy(float energy) const
RealisticCaloDigiSilicon aRealisticCaloDigiSilicon
float convertEnergy(float energy, int inputUnit) const