EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
digitization.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file digitization.C
1 
2 //
3 // Converts MC points to hits in calorimeter cells; allows to account
4 // for light output per GeV of deposited energy, noise, attenuation length, etc.;
5 //
6 
8 {
9  // Create generic analysis run manager; configure it for digitization;
10  auto fRun = new EicRunAna();
11  fRun->SetInputFile ("simulation.root");
12  fRun->SetOutputFile("digitization.root");
13 
14  // Declare and configure a *standard* calorimeter digitization task; detector name here
15  // should match calorimeter names in calorimeter.C & simulation.C;
16  auto calo = new EicCalorimeterDigiHitProducer("CALORIMETER");
17 
18  // Crystals will be used as sensitive volumes; one can actually add a similar
19  // line to add alveoles to sensitive detector list (here it makes no sense of course);
20  // FIXME: consider no Birk's correction here, add later;
21  calo->DeclareDigiSensitiveVolume("CaloCrystal");
22  //calo->DeclareDigiSensitiveVolume("CaloCellAlveole");
23 
24  // Number of "primary" photons is calculated based on expected (say, experimentally measured)
25  // light output per GeV of deposited energy; it is assumed that light can be collected on
26  // upstream and downstream ends of "long objects" (like typical calorimeter matrix crystals),
27  // so that attenuation length can be accounted; either end can be a 100% efficient sensor or
28  // a mirror with reflection in the range [0.0 .. 1.0]; sensor (and other types of)
29  // inefficiencies are accounted effectively via light output setting (see below);
30  calo->ConfigureUpstreamSensorGroup (CalorimeterSensorGroup::Reflection, 1.0);
31  calo->ConfigureDownstreamSensorGroup(CalorimeterSensorGroup::Sensor);
32  // Either qAPD or qSiPM; digitization options differ a bit (see below);
33  calo->SetSensorType(CalorimeterDigiParData::APD);
34 
35  // In [cm]; 0 or large value basically means "no attenuation" mode;
36  calo->SetAttenuationLength(0);
37 
38  // Energy deposits in all GEANT-sensitive volumes (say "CaloCrystal" and "CaloCellAlveole",
39  // as defined in calorimeter.C file) will be calculated separately for inspection purposes;
40  calo->RequestEnergyDepositAccounting();
41 
42  // Energy deposit plots can be constructed in time and Z ("long" crystal coordinate) bins
43  // and dumped into ROOT output file;
44  //calo->RequestTimeSpectra(200., 200);
45  //calo->SetZCoordBinning(20);
46 
47  // In photons; this threshold is used just to remove very low energy cells;
48  calo->SetCleanupThreshold(1);
49 
50  // APD-related section; see other sources (like PANDA EMC TDR) for exact meaning
51  // and typical values of ENF and ENC;
52  //calo->SetApdGainFactor(50);
53  //calo->SetApdExcessNoiseFactor(1.);
54  //calo->SetApdEquivalentNoiseCharge(4200.);
55  //
56  // SiPM-related section;
57  // Noise, in counts per [ns]; setTimingGate() setting matter (see below);
58  //cemc->SetSipmNoiseLevel(40E-3);
59 
60  // Average number of photons which are supposed to be produced per GeV of dE/dx energy
61  // deposited by incoming particle; in case of a crystal calorimeter with large attenuation
62  // length and 100% registration efficiency at upstream and downstream sensor ends (see
63  // settings above) this will per definition be roughly the registered photon count for
64  // 1 GeV energy electron; the number should be tuned to match typically *measured* one;
65  calo->SetPrimaryLightYield(20000.);
66 
67  // Put some realistic timing numbers here; times in [ns]; light velocity in [cm/ns];
68  calo->SetTimingGate(0., 100.);
69  calo->SetDecayConstant(6.5);
70  calo->SetLightPropagationVelocity(100./7);
71 
72  fRun->AddTask(calo);
73 
74  // Initialize and run digitization; exit at the end;
75  fRun->Run();
76 } // digitization()