exp1803_sim_digi.C
1 |
void exp1803_sim_digi(Int_t nEvents = 100) { |
---|---|
2 |
// --------------- Telescope T1 -------------------------------------------
|
3 |
Double_t T1Dl = 0.5; // [cm] |
4 |
Double_t T1PosZ = 10.; // [cm] |
5 |
Double_t T1D1Thick = 0.002; // [cm] |
6 |
Double_t T1D2Thick = 0.1; // [cm] |
7 |
Double_t T1Side = 6.2; // [cm] this parameter should coincide with SD1 side length from /db/QTelescope/QTelescopeParts.xml |
8 |
Double_t T1Aperture = 3.1; // [cm] |
9 |
// --------------- Telescope D1 -------------------------------------------
|
10 |
Double_t D1PosZ = 20.; // [cm] |
11 |
Double_t D1Thick = 0.03; // [cm] |
12 |
// --------------- BeamDet ------------------------------------------------
|
13 |
Double_t BeamDetLToF = 1500.; // [cm] |
14 |
Double_t BeamDetPosZToF = -50; // [cm] |
15 |
Double_t BeamDetLMWPC = 32.; // [cm] |
16 |
Double_t BeamDetPosZMWPC = -8; // [cm] |
17 |
// --------------- Beam start position ------------------------------------
|
18 |
Double_t beamStartPosition = -1600; // [cm] |
19 |
// Double_t beamStartPosition = -150;
|
20 |
// --------------- Target -------------------------------------------------
|
21 |
Double_t targetH2Thickness = 0.4; // [cm] this parameter should coincide with target H2 thickness in /macro/geo/create_target_h2_geo.C |
22 |
//---------------------Files-----------------------------------------------
|
23 |
TString outFile= "sim_digi.root";
|
24 |
TString parFile= "par.root";
|
25 |
TString workDirPath = gSystem->Getenv("VMCWORKDIR");
|
26 |
TString paramFileQTelescope = workDirPath |
27 |
+ "/db/QTelescope/QTelescopeParts.xml";
|
28 |
TString paramFileBeamDet = workDirPath |
29 |
+ "/db/BeamDet/BeamDetParts.xml";
|
30 |
TString targetGeoFileName = workDirPath + "/geometry/target.h2.geo.root";
|
31 |
TString gadastGeoFileName = workDirPath + "/geometry/partOfGadast.v1.geo.root";
|
32 |
TString ndGeoFileName = workDirPath + "/geometry/ND.geo.root";
|
33 |
TString magnetGeoFileName = workDirPath + "/geometry/magnet.geo.root";
|
34 |
// ------------------------------------------------------------------------
|
35 |
|
36 |
// ----- Timer --------------------------------------------------------
|
37 |
TStopwatch timer; |
38 |
timer.Start(); |
39 |
// ------------------------------------------------------------------------
|
40 |
|
41 |
// ----- Create simulation run ----------------------------------------
|
42 |
ERRunSim* run = new ERRunSim();
|
43 |
/** Select transport engine
|
44 |
* TGeant3
|
45 |
* TGeant4
|
46 |
**/
|
47 |
run->SetName("TGeant4"); // Transport engine |
48 |
run->SetOutputFile(outFile.Data()); // Output file
|
49 |
// ------------------------------------------------------------------------
|
50 |
// ----- Runtime database ---------------------------------------------
|
51 |
FairRuntimeDb* rtdb = run->GetRuntimeDb(); |
52 |
//-------- Set MC event header --------------------------------------------
|
53 |
ERDecayMCEventHeader* decayMCheader = new ERDecayMCEventHeader();
|
54 |
run->SetMCEventHeader(decayMCheader); |
55 |
// ----- Create media -------------------------------------------------
|
56 |
run->SetMaterials("media.geo"); // Materials |
57 |
// ----- Create detectors ----------------------------------------------
|
58 |
FairModule* cave= new ERCave("CAVE"); |
59 |
cave->SetGeometryFileName("cave.geo");
|
60 |
run->AddModule(cave); |
61 |
|
62 |
Int_t verbose = 0;
|
63 |
// ----- BeamDet Setup ---------------------------------------------------
|
64 |
ERBeamDetSetup* setupBeamDet = ERBeamDetSetup::Instance(); |
65 |
setupBeamDet->SetXmlParametersFile(paramFileBeamDet); |
66 |
|
67 |
// ----- BeamDet parameters ----------------------------------------------
|
68 |
setupBeamDet->AddToF("ToF1", BeamDetPosZToF - BeamDetLToF); // |
69 |
setupBeamDet->AddToF("ToF1", BeamDetPosZToF); // BeamDet parts should be added in ascending order |
70 |
setupBeamDet->AddMWPC("MWPC1", BeamDetPosZMWPC - BeamDetLMWPC); // of Z-coordinate of part. |
71 |
setupBeamDet->AddMWPC("MWPC1", BeamDetPosZMWPC); // |
72 |
setupBeamDet->SetSensitiveTarget(); |
73 |
|
74 |
// ----- Create target -------------------------------------------------
|
75 |
// FairModule* target = new ERTarget("targetH2", kTRUE, 1);
|
76 |
// target->SetGeometryFileName(targetGeoFileName);
|
77 |
// run->AddModule(target);
|
78 |
|
79 |
// ----- Create Part of Gadast ------------------------------------------
|
80 |
ERGadast* gadast = new ERGadast("PartofGadast", kTRUE, 1); |
81 |
gadast->SetGeometryFileName(gadastGeoFileName); |
82 |
run->AddModule(gadast); |
83 |
|
84 |
// ----- Create Stilbene wall -------------------------------------------
|
85 |
ERND* neutronDetector = new ERND("StilbeneWall", kTRUE, 1); |
86 |
neutronDetector->SetGeometryFileName(ndGeoFileName); |
87 |
run->AddModule(neutronDetector); |
88 |
|
89 |
// ----- Create Magnet geometry -----------------------------------------
|
90 |
FairModule* magnet = new ERTarget("magnet", 1, kTRUE); |
91 |
magnet->SetGeometryFileName(magnetGeoFileName); |
92 |
run->AddModule(magnet); |
93 |
|
94 |
// ----- QTelescope Setup ------------------------------------------------
|
95 |
ERQTelescopeSetup* setupQTelescope = ERQTelescopeSetup::Instance(); |
96 |
setupQTelescope->SetXmlParametersFile(paramFileQTelescope); |
97 |
|
98 |
// ----- T1 parameters ----------------------------------------------------
|
99 |
// ----- T1.1--------------------------------------------------------------
|
100 |
setupQTelescope->AddSi("DoubleSi_SD1", TVector3( T1Side/2 + T1Aperture/2, |
101 |
T1Side/2 - T1Aperture/2, |
102 |
T1PosZ + T1D1Thick/2), "X"); |
103 |
setupQTelescope->AddSi("DoubleSi_SD2", TVector3( T1Side/2 + T1Aperture/2, |
104 |
T1Side/2 - T1Aperture/2, |
105 |
T1PosZ + T1D1Thick +T1Dl + T1D2Thick/2), "X"); |
106 |
// ----- T1.2--------------------------------------------------------------
|
107 |
setupQTelescope->AddSi("DoubleSi_SD1", TVector3( T1Side/2 - T1Aperture/2, |
108 |
-T1Side/2 - T1Aperture/2, |
109 |
T1PosZ + T1D1Thick/2), "X"); |
110 |
setupQTelescope->AddSi("DoubleSi_SD2", TVector3( T1Side/2 - T1Aperture/2, |
111 |
-T1Side/2 - T1Aperture/2, |
112 |
T1PosZ + T1D1Thick +T1Dl + T1D2Thick/2), "X"); |
113 |
// ----- T1.3 -------------------------------------------------------------
|
114 |
setupQTelescope->AddSi("DoubleSi_SD1", TVector3(-T1Side/2 - T1Aperture/2, |
115 |
-T1Side/2 + T1Aperture/2, |
116 |
T1PosZ + T1D1Thick/2), "X"); |
117 |
setupQTelescope->AddSi("DoubleSi_SD2", TVector3(-T1Side/2 - T1Aperture/2, |
118 |
-T1Side/2 + T1Aperture/2, |
119 |
T1PosZ + T1D1Thick +T1Dl + T1D2Thick/2), "X"); |
120 |
// ----- T1.4--------------------------------------------------------------
|
121 |
setupQTelescope->AddSi("DoubleSi_SD1", TVector3(-T1Side/2 + T1Aperture/2, |
122 |
T1Side/2 + T1Aperture/2, |
123 |
T1PosZ + T1D1Thick/2), "X"); |
124 |
setupQTelescope->AddSi("DoubleSi_SD2", TVector3(-T1Side/2 + T1Aperture/2, |
125 |
T1Side/2 + T1Aperture/2, |
126 |
T1PosZ + T1D1Thick +T1Dl + T1D2Thick/2), "X"); |
127 |
|
128 |
// ----- D1 parameters ----------------------------------------------------
|
129 |
setupQTelescope->AddSi("DoubleSi_D1", TVector3( 0, |
130 |
0,
|
131 |
D1PosZ + D1Thick/2), "X"); |
132 |
|
133 |
// ------QTelescope -------------------------------------------------------
|
134 |
ERQTelescope* qtelescope= new ERQTelescope("ERQTelescope", kTRUE,verbose); |
135 |
run->AddModule(qtelescope); |
136 |
|
137 |
// ------BeamDet ----------------------------------------------------------
|
138 |
ERBeamDet* beamdet= new ERBeamDet("ERBeamDet", kTRUE,verbose); |
139 |
run->AddModule(beamdet); |
140 |
|
141 |
FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
|
142 |
|
143 |
// Double_t kinE_MevPerNucleon = 30.;
|
144 |
// Double_t kinE_MevPerNucleonMax = 32.;
|
145 |
Double_t kinE_MevPerNucleon = 1.;
|
146 |
Double_t kinE_MevPerNucleonMax = 32.; |
147 |
// Int_t Z = 1, A = 3, Q = 1;
|
148 |
// TString ionName = "3H";
|
149 |
Int_t Z = 2, A = 6, Q = 2; |
150 |
TString ionName = "6He";
|
151 |
|
152 |
ERIonMixGenerator* generator = new ERIonMixGenerator(ionName, Z, A, Q, 1); |
153 |
// ERIonMixGenerator* generator = new ERIonMixGenerator("Alpha", 2, 4, 2, 1);
|
154 |
|
155 |
// generator->AddBackgroundIon("Triton", 1, 3, 1, 0.2 / 0.20);
|
156 |
// generator->AddBackgroundIon("Alpha", 1, 4, 1, 0.4 / 0.60);
|
157 |
// generator->AddBackgroundIon("HE3", 2, 3, 2, 0.4 / 0.20);
|
158 |
// generator->AddBackgroundIon("Deuteron", 1, 2, 1, 0.2 / 0.20);
|
159 |
// generator->AddBackgroundIon("proton", 1, 1, 1, 0.2 / 0.20);
|
160 |
|
161 |
// generator->AddBackgroundIon("proton", 1, 1, 1, 0.2 / 0.20);
|
162 |
// generator->AddBackgroundIon("8He", 2, 8, 2, 0.2 / 0.40);
|
163 |
// generator->AddBackgroundIon("11Li", 3, 11, 3, 0.2 / 0.40);
|
164 |
// generator->AddBackgroundIon("9Li", 3, 9, 3, 0.1 / 0.40);
|
165 |
|
166 |
// generator->AddBackgroundIon("4He", 2, 4, 2, 20);
|
167 |
// generator->AddBackgroundIon("8He", 2, 8, 2, 0.2/0.8);
|
168 |
// generator->AddBackgroundIon("9Li", 3, 9, 3, 0.05/0.8);
|
169 |
|
170 |
|
171 |
Double32_t kin_energy = kinE_MevPerNucleon * 1e-3 * A; //GeV |
172 |
Double32_t kin_energy_max = kinE_MevPerNucleonMax * 1e-3 * A; //GeV |
173 |
// generator->SetKinE(kin_energy);
|
174 |
// generator->SetPSigmaOverP(0);
|
175 |
generator->SetKinERange(kin_energy, kin_energy_max); |
176 |
Double32_t sigmaTheta = 0.004*TMath::RadToDeg(); |
177 |
generator->SetThetaSigma(0, 0); |
178 |
// generator->SetThetaRange(1.3, 1.3);
|
179 |
// generator->SetPhiRange(0, 360);
|
180 |
// generator->SetPhiRange(0, 270);
|
181 |
// generator->SetPhiRange(45, 45);
|
182 |
// generator->SetBoxXYZ(0, 0, 0, 0, beamStartPosition);
|
183 |
// generator->SetBoxXYZ(-1, -1, -1, -1, -45.);
|
184 |
// generator->SetBoxXYZ(0, 0, 0, 0, -45.);
|
185 |
// generator->SetBoxXYZ(-2, -2, -2, -2, -45.);
|
186 |
// generator->SetBoxXYZ(-1, -1, -1, -1, beamStartPosition);
|
187 |
// generator->SetBoxXYZ(5, 5, 5, 5, beamStartPosition);
|
188 |
// generator->SetBoxXYZ(5, 5, 5, 5, 0.);
|
189 |
generator->SetBoxXYZ(5, 0., 5.5, 1., 2.); |
190 |
|
191 |
// generator->SpreadingOnTarget();
|
192 |
|
193 |
primGen->AddGenerator(generator); |
194 |
run->SetGenerator(primGen); |
195 |
// ------- Decayer --------------------------------------------------------
|
196 |
// Double_t massH5 = 4.8; // [GeV]
|
197 |
Double_t massH5 = (2*939.565 + 2809.431)*0.001; // [GeV] |
198 |
|
199 |
ERDecayer* decayer = new ERDecayer();
|
200 |
ERDecayEXP1803* targetDecay = new ERDecayEXP1803();
|
201 |
targetDecay->SetTargetVolumeName("tubeH2");
|
202 |
targetDecay->SetTargetThickness(targetH2Thickness); |
203 |
// targetDecay->SetH5Mass(massH5);
|
204 |
decayer->AddDecay(targetDecay); |
205 |
run->SetDecayer(decayer); |
206 |
|
207 |
// ------- Magnetic field -------------------------------------------------
|
208 |
ERFieldMap* magField = new ERFieldMap("exp1803Field","A"); //exp1803Field, testField |
209 |
magField->SetVolume("magnet");
|
210 |
run->SetField(magField); |
211 |
// ------- QTelescope Digitizer -------------------------------------------
|
212 |
ERQTelescopeDigitizer* qtelescopeDigitizer = new ERQTelescopeDigitizer(verbose);
|
213 |
qtelescopeDigitizer->SetSiElossThreshold(0);
|
214 |
// qtelescopeDigitizer->SetSiElossThreshold(0.0005);
|
215 |
qtelescopeDigitizer->SetSiElossSigma(0);
|
216 |
qtelescopeDigitizer->SetSiTimeSigma(0);
|
217 |
|
218 |
qtelescopeDigitizer->SetCsIElossThreshold(0);
|
219 |
qtelescopeDigitizer->SetCsIElossSigma(0);
|
220 |
qtelescopeDigitizer->SetCsITimeSigma(0);
|
221 |
run->AddTask(qtelescopeDigitizer); |
222 |
// ------ Gadast Digitizer -----------------------------------------------
|
223 |
ERGadastDigitizer* gadastDigitizer = new ERGadastDigitizer(verbose);
|
224 |
run->AddTask(gadastDigitizer); |
225 |
// ----- BeamDet Digitizer ----------------------------------------------
|
226 |
ERBeamDetDigitizer* beamDetDigitizer = new ERBeamDetDigitizer(verbose);
|
227 |
beamDetDigitizer->SetMWPCElossThreshold(0.0000012); |
228 |
// beamDetDigitizer->SetMWPCElossThreshold(0.00000001);
|
229 |
// beamDetDigitizer->SetToFElossThreshold(0.006);
|
230 |
// beamDetDigitizer->SetToFElossSigmaOverEloss(0);
|
231 |
// beamDetDigitizer->SetToFTimeSigma(1e-10);
|
232 |
beamDetDigitizer->SetToFTimeSigma(0.4/2.35); |
233 |
run->AddTask(beamDetDigitizer); |
234 |
// ------- BeamDet TrackFinder -------------------------------------------
|
235 |
ERBeamDetTrackFinder* trackFinder = new ERBeamDetTrackFinder(verbose);
|
236 |
run->AddTask(trackFinder); |
237 |
// -----------------------BeamDetTrackPID----------------------------------
|
238 |
ERBeamDetPID* pid = new ERBeamDetPID(verbose);
|
239 |
pid->SetIonMassNumber(A); |
240 |
pid->SetBoxPID(0., 1000., 0., 1000.); |
241 |
pid->SetOffsetToF(0.);
|
242 |
pid->SetProbabilityThreshold(0);
|
243 |
run->AddTask(pid); |
244 |
// ------- QTelescope TrackFinder -------------------------------------------
|
245 |
ERQTelescopeTrackFinder* qtelescopeTrackFinder = new ERQTelescopeTrackFinder(verbose);
|
246 |
qtelescopeTrackFinder->SetHitStation("DoubleSi_SD2_XY_1");
|
247 |
qtelescopeTrackFinder->SetHitStation("DoubleSi_SD2_XY_3");
|
248 |
qtelescopeTrackFinder->SetStripEdepRange(0., 100.); // [GeV] |
249 |
qtelescopeTrackFinder->SetTargetPoint(0., 0., 0.); |
250 |
// qtelescopeTrackFinder->SetStripEdepRange(0.0097, 100.); // [GeV]
|
251 |
// qtelescopeTrackFinder->SetEdepDiffXY(5.); // [GeV]
|
252 |
qtelescopeTrackFinder->SetEdepMaxDiffXY(0.5); |
253 |
run->AddTask(qtelescopeTrackFinder); |
254 |
//-------Set visualisation flag to true------------------------------------
|
255 |
run->SetStoreTraj(kTRUE); |
256 |
//-------Set LOG verbosity -----------------------------------------------
|
257 |
FairLogger::GetLogger()->SetLogScreenLevel("INFO");
|
258 |
// ----- Initialize simulation run ------------------------------------
|
259 |
run->Init(); |
260 |
Int_t nSteps = -15000;
|
261 |
// ----- Runtime database ---------------------------------------------
|
262 |
Bool_t kParameterMerged = kTRUE; |
263 |
FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged);
|
264 |
parOut->open(parFile.Data()); |
265 |
rtdb->setOutput(parOut); |
266 |
rtdb->saveOutput(); |
267 |
rtdb->print(); |
268 |
//gMC->SetMaxNStep(nSteps);
|
269 |
// ----- Run simulation ------------------------------------------------
|
270 |
run->Run(nEvents); |
271 |
|
272 |
// TDatabasePDG *tdb = TDatabasePDG::Instance();
|
273 |
// tdb->Print();
|
274 |
|
275 |
// ----- Finish -------------------------------------------------------
|
276 |
timer.Stop(); |
277 |
Double_t rtime = timer.RealTime(); |
278 |
Double_t ctime = timer.CpuTime(); |
279 |
std::cout << std::endl << std::endl; |
280 |
std::cout << "Macro finished succesfully." << std::endl;
|
281 |
std::cout << "Output file is sim.root" << std::endl;
|
282 |
std::cout << "Parameter file is par.root" << std::endl;
|
283 |
std::cout << "Real time " << rtime << " s, CPU time " << ctime |
284 |
<< "s" << std::endl << std::endl;
|
285 |
} |