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 #include <simulation.C>
3 
4 void digitization(unsigned seed = 0x12345678)
5 {
6  // Load basic libraries;
7  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
8 
9  // Create generic analysis run manager; configure it for digitization;
10  EicRunAna *fRun = new EicRunAna();
11  fRun->SetInputFile ("simulation.root");
12  fRun->SetOutputFile("digitization.root");
13  fRun->SetSeed(seed);
14 
16  vstHitProducer->DefineKfNodeTemplateXY(0.00058, 0.00058);
17  fRun->AddTask(vstHitProducer);
18 
20  fstHitProducer->DefineKfNodeTemplateXY(0.00058, 0.00058);
21  fRun->AddTask(fstHitProducer);
22 
24  bstHitProducer->DefineKfNodeTemplateXY(0.00058, 0.00058);
25  fRun->AddTask(bstHitProducer);
26 
28  fgtHitProducer->DefineKfNodeTemplateXY(0.0050, 0.0050);
29  fRun->AddTask(fgtHitProducer);
30 
32  bgtHitProducer->DefineKfNodeTemplateXY(0.0050, 0.0050);
33  fRun->AddTask(bgtHitProducer);
34 
35  // "Ideal" TPC digitizer;
36  EicTpcDigiHitProducer* tpcHitProducer = new EicTpcDigiHitProducer();
37  tpcHitProducer->importTpcDigiParameters("tpc-digi-250um.root");
38  fRun->AddTask(tpcHitProducer);
39 
40  // So tune the parameters here once want to use these calorimeters; in fact one should better
41  // play with fast simulation (fake MoCa points) first; add HCal stuff as well;
42 #ifdef _WITH_CALORIMETERS_
43  {
44  // Declare and configure a *standard* calorimeter task; name here should match
45  // calorimeter names in calorimeter.C & simulation.C;
47 
48  // Crystals will be used as sensitive volumes; one can actually add a similar
49  // line to add alveoles to sensitive detector list (here it makes no sense of course);
50  // FIXME: consider no Birk's correction here, add later;
51  bemc->DeclareDigiSensitiveVolume("BemcCrystal");
52 
56 
57  // In [cm]; large value basically means "no attenuation" mode;
58  bemc->SetAttenuationLength(0);
59 
60  bemc->SetCleanupThreshold(1);
61 
62  // Average number of photons which are supposed to be produced per GeV of incoming
63  // particle; in case of a crystal calorimeter with large attenuation length and
64  // 100% registration efficiency (see settings above) this will be roughly the
65  // registered photon count; should be tuned to match typically measured one;
66  //bemc->SetLightYield(20000., 1.);
67  bemc->SetPrimaryLightYield(20000.);
68 
69  // Put some realistic timing numbers here; times in [ns]; light velocity in [cm/ns];
70  bemc->SetTimingGate(0., 100.);
71  bemc->SetDecayConstant(6.5);
72  bemc->SetLightPropagationVelocity(100./7);
73 
74  fRun->AddTask(bemc);
75  }
76  {
77  // Declare and configure a *standard* calorimeter task; name here should match
78  // calorimeter names in calorimeter.C & simulation.C;
80 
81  // Crystals will be used as sensitive volumes; one can actually add a similar
82  // line to add alveoles to sensitive detector list (here it makes no sense of course);
83  femc->DeclareDigiSensitiveVolumePrefix("FemcFiberCore", 12.6);
84 
85  // Number of "primary" photons is calculated based on expected (say, experimentally measured)
86  // light output per GeV of deposited energy; it is assumed that light can be collected on
87  // upstream and downstream ends of "long objects" (like typical calorimeter matrix crystals),
88  // so that attenuation length can be accounted; either end can be a 100% efficient sensor or
89  // a mirror with reflection in the range [0.0 .. 1.0]; sensor (and other types of)
90  // inefficiencies are accounted effectively via light output setting (see below);
93  // Either qAPD or qSiPM; digitization options differ a bit (see below);
95 
96  // In [cm]; large value basically means "no attenuation" mode;
97  femc->SetAttenuationLength(150.);
98  //femc->SetAttenuationLength(75.);
99 
100  // Energy deposits in all GEANT-sensitive volumes (say "caloCrystal" and "caloCellAlveole",
101  // as defined in calorimeter.C fle) will be calculated separately for inspection purposes;
102  femc->RequestEnergyDepositAccounting(1.0, 1000);
103 
104  // Energy deposit plots can be constructed in time and Z ("long" crystal coordinate) bins
105  // and dumped into ROOT output file;
106  //femc->requestTimeSpectra(200., 200);
107  femc->SetZBinning(20);
108 
109  // In [GeV] assuming known light yield (see below); this threshold is used just to
110  // remove very low energy cells; set to ~1MeV for now;
111  //femc->setCleanupThreshold(1E-3);
112  femc->SetCleanupThreshold(1);
113 
114  // APD-related section; see other sources (like PANDA EMC TDR) for exact meaning
115  // and typical values of ENF and ENC;
116  //femc->setApdGainFactor(50);
117  //femc->setApdExcessNoiseFactor(1.);
118  //femc->setApdEquivalentNoiseCharge(4200.);
119  //
120  // SiPM-related section;
121  // Noise, in counts per [ns]; setTimingGate() setting matter (see below);
122  //cemc->setSipmNoiseLevel(40E-3);
123 
124  // Average number of photons which are supposed to be registered per GeV of incoming
125  // particle; 2-d argument is expected sampling fraction (can be on a few percent
126  // level for sampling fiber calorimeters; for crystal ones perhaps always close to
127  // 1.0); these settings are a bit misleading, in a sense that sampling fraction should
128  // be tuned *by hand* to get absolute normalization of reconstructed particle energy
129  // correct; reconstructed light yield should match the expectation (so if one side
130  // is a 70% efficient mirror and the other side is a sensor, this number should better
131  // be renormalized by a factor of 0.85; even if attenuation length in very large);
132  // should perhaps think how to do it better later;
133  //femc->setLightYield(130./((1.0+0.0)/2.0), 1.2E-2);
134  //femc->SetPrimaryLightYield(5.2E4);
135  femc->SetPrimaryLightYield(3.70E4);
136 
137  // Put some realistic timing numbers here; times in [ns]; light velocity in [cm/ns];
138  femc->SetTimingGate(0., 100.);
139  femc->SetDecayConstant(6.5);
140  femc->SetLightPropagationVelocity(100./7);
141 
142  fRun->AddTask(femc);
143  }
144  {
145  // Declare and configure a *standard* calorimeter task; name here should match
146  // calorimeter names in calorimeter.C & simulation.C;
148 
149  // Crystals will be used as sensitive volumes; one can actually add a similar
150  // line to add alveoles to sensitive detector list (here it makes no sense of course);
151  cemc->DeclareDigiSensitiveVolumePrefix("CemcFiberCore", 12.6);
152 
153  // Number of "primary" photons is calculated based on expected (say, experimentally measured)
154  // light output per GeV of deposited energy; it is assumed that light can be collected on
155  // upstream and downstream ends of "long objects" (like typical calorimeter matrix crystals),
156  // so that attenuation length can be accounted; either end can be a 100% efficient sensor or
157  // a mirror with reflection in the range [0.0 .. 1.0]; sensor (and other types of)
158  // inefficiencies are accounted effectively via light output setting (see below);
161  // Either qAPD or qSiPM; digitization options differ a bit (see below);
163 
164  // In [cm]; large value basically means "no attenuation" mode;
165  cemc->SetAttenuationLength(150.);
166  //cemc->SetAttenuationLength(75.);
167 
168  // Energy deposits in all GEANT-sensitive volumes (say "caloCrystal" and "caloCellAlveole",
169  // as defined in calorimeter.C fle) will be calculated separately for inspection purposes;
170  cemc->RequestEnergyDepositAccounting(1.0, 1000);
171 
172  // Energy deposit plots can be constructed in time and Z ("long" crystal coordinate) bins
173  // and dumped into ROOT output file;
174  //cemc->requestTimeSpectra(200., 200);
175  cemc->SetZBinning(20);
176 
177  // In [GeV] assuming known light yield (see below); this threshold is used just to
178  // remove very low energy cells; set to ~1MeV for now;
179  //cemc->setCleanupThreshold(1E-3);
180  cemc->SetCleanupThreshold(1);
181 
182  // APD-related section; see other sources (like PANDA EMC TDR) for exact meaning
183  // and typical values of ENF and ENC;
184  //cemc->setApdGainFactor(50);
185  //cemc->setApdExcessNoiseFactor(1.);
186  //cemc->setApdEquivalentNoiseCharge(4200.);
187  //
188  // SiPM-related section;
189  // Noise, in counts per [ns]; setTimingGate() setting matter (see below);
190  //cemc->setSipmNoiseLevel(40E-3);
191 
192  // Average number of photons which are supposed to be registered per GeV of incoming
193  // particle; 2-d argument is expected sampling fraction (can be on a few percent
194  // level for sampling fiber calorimeters; for crystal ones perhaps always close to
195  // 1.0); these settings are a bit misleading, in a sense that sampling fraction should
196  // be tuned *by hand* to get absolute normalization of reconstructed particle energy
197  // correct; reconstructed light yield should match the expectation (so if one side
198  // is a 70% efficient mirror and the other side is a sensor, this number should better
199  // be renormalized by a factor of 0.85; even if attenuation length in very large);
200  // should perhaps think how to do it better later;
201  //cemc->setLightYield(130./((1.0+0.0)/2.0), 1.2E-2);
202  //cemc->SetPrimaryLightYield(5.2E4);
203  cemc->SetPrimaryLightYield(3.70E4);
204 
205  // Put some realistic timing numbers here; times in [ns]; light velocity in [cm/ns];
206  cemc->SetTimingGate(0., 100.);
207  cemc->SetDecayConstant(6.5);
208  cemc->SetLightPropagationVelocity(100./7);
209 
210  fRun->AddTask(cemc);
211  }
212 #endif
213 
214  // Initialize and run digitization; exit at the end;
215  fRun->Run();
216 } // digitization()