sim_digi.C
1 |
|
---|---|
2 |
void sim_digi (Int_t nEvents = 100000) { |
3 |
//----------------------------------
|
4 |
Double_t BeamDetLToF = 1232.0; // [cm] 12348 |
5 |
Double_t BeamDetPosZToF = -95.3; // [cm] |
6 |
Double_t BeamDetPosZ1MWPC = -81.5; // [cm] |
7 |
Double_t BeamDetPosZ2MWPC = -27.; // [cm] |
8 |
// --------------- Beam start position ------------------------------------
|
9 |
Double_t beamStartPosition = -1600.; // [cm] |
10 |
// --------------- Target -------------------------------------------------
|
11 |
Double_t targetD2Thickness = 0.42; // [cm] this parameter should coincide with target H2 thickness in /macro/geo/create_target_D2_geo.C |
12 |
//---------------------Files-----------------------------------------------
|
13 |
TString outFile= "sim_digi.root";
|
14 |
TString parFile= "par.root";
|
15 |
TString workDirPath = gSystem->Getenv("VMCWORKDIR");
|
16 |
// TString paramFileQTelescope = workDirPath
|
17 |
// + "/db/QTelescope/QTelescopeParts3.xml";
|
18 |
TString paramFileQTelescope = workDirPath |
19 |
+ "/db/QTelescope/QTelescopeParts_10he.xml";
|
20 |
TString paramFileBeamDet = workDirPath |
21 |
+ "/db/BeamDet/BeamDetParts.xml";
|
22 |
TString targetGeoFileName = workDirPath + "/geometry/target.T.gas.root";
|
23 |
// TString targetGeoFileName = workDirPath + "/geometry/target.D2.gas.root";
|
24 |
TString ndGeoFileName = workDirPath + "/geometry/ND.geo.root";
|
25 |
|
26 |
|
27 |
// ----- Timer --------------------------------------------------------
|
28 |
TStopwatch timer; |
29 |
timer.Start(); |
30 |
// ------------------------------------------------------------------------
|
31 |
// ----- Create simulation run ----------------------------------------
|
32 |
ERRunSim* run = new ERRunSim();
|
33 |
/** Select transport engine
|
34 |
* TGeant3
|
35 |
* TGeant4exp1904_sim_digi.C
|
36 |
**/
|
37 |
run->SetName("TGeant4"); // Transport engine |
38 |
run->SetOutputFile(outFile.Data()); // Output file
|
39 |
// ------------------------------------------------------------------------
|
40 |
// ----- Runtime database ---------------------------------------------
|
41 |
FairRuntimeDb* rtdb = run->GetRuntimeDb(); |
42 |
//-------- Set MC event header --------------------------------------------
|
43 |
ER10Heto8HeEventHeader* decayMCheader = new ER10Heto8HeEventHeader();
|
44 |
run->SetMCEventHeader(decayMCheader); |
45 |
// ----- Create media -------------------------------------------------
|
46 |
run->SetMaterials("media.geo"); // Materials |
47 |
// ----- Create detectors ----------------------------------------------
|
48 |
FairModule* cave= new ERCave("CAVE"); |
49 |
cave->SetGeometryFileName("cave.geo");
|
50 |
run->AddModule(cave); |
51 |
|
52 |
Int_t verbose = 0;
|
53 |
// ----- BeamDet Setup ---------------------------------------------------
|
54 |
ERBeamDetSetup* setupBeamDet = ERBeamDetSetup::Instance(); |
55 |
setupBeamDet->SetXmlParametersFile(paramFileBeamDet); |
56 |
|
57 |
// ----- BeamDet parameters ----------------------------------------------
|
58 |
setupBeamDet->AddToF("ToF1", BeamDetPosZToF - BeamDetLToF);
|
59 |
setupBeamDet->AddToF("ToF1", BeamDetPosZToF); // BeamDet parts should be added in ascending order |
60 |
setupBeamDet->AddMWPC("MWPC1", BeamDetPosZ1MWPC); // of Z-coordinate of part. |
61 |
setupBeamDet->SetMWPCnumberingInvOrderX(); |
62 |
|
63 |
setupBeamDet->AddMWPC("MWPC1", BeamDetPosZ2MWPC); //должно быть MWPC2??? |
64 |
setupBeamDet->SetMWPCnumberingInvOrderX(); |
65 |
|
66 |
//setupBeamDet->SetSensitiveTarget();
|
67 |
|
68 |
// ----- Create target -------------------------------------------------
|
69 |
FairModule* target = new ERTarget("target", kTRUE, 1); |
70 |
target->SetGeometryFileName(targetGeoFileName); |
71 |
run->AddModule(target); |
72 |
|
73 |
// ----- QTelescope Setup ------------------------------------------------
|
74 |
ERQTelescopeSetup* setupQTelescope = ERQTelescopeSetup::Instance(); |
75 |
setupQTelescope->SetXMLParametersFile(paramFileQTelescope); |
76 |
setupQTelescope->SetGeoName("QTelescopeTmp");
|
77 |
|
78 |
// ----- instead of annular parameters ----------------------------------------------------
|
79 |
Double_t xPos, yPos, zPos; |
80 |
xPos = 0.;
|
81 |
yPos = 0.;
|
82 |
zPos = -10.05; |
83 |
TVector3 rotationC(0., 0., 0.); |
84 |
ERGeoSubAssembly* assembly_proton= new ERGeoSubAssembly("Telescope_proton", TVector3(xPos, yPos, zPos), rotationC); |
85 |
|
86 |
ERQTelescopeGeoComponentDoubleSi* det_proton = new ERQTelescopeGeoComponentDoubleSi("DoubleSi", "DoubleSi_DSD", |
87 |
TVector3(0., 0., 0.), TVector3(), "X"); |
88 |
|
89 |
assembly_proton->AddComponent(det_proton); |
90 |
|
91 |
setupQTelescope->AddSubAssembly(assembly_proton); |
92 |
|
93 |
// ----- square telescope parameters ----------------------------------------------------
|
94 |
Double_t x,y,z_d1,z_d2,z; |
95 |
x = 0.;
|
96 |
y = 0.;
|
97 |
z = 25.15; |
98 |
z_d1 = 0.75; |
99 |
z_d2 = 1.05; |
100 |
TVector3 fZeroRotation(0., 0., 0.); |
101 |
ERGeoSubAssembly* assembly_he8 = new ERGeoSubAssembly("Telescope_he8", TVector3(x, y, z), fZeroRotation); |
102 |
ERQTelescopeGeoComponentSingleSi* det_he8_X = new ERQTelescopeGeoComponentSingleSi("SingleSi", "SingleSi_SSD20", |
103 |
TVector3(0., 0., 0.), TVector3(), "X"); |
104 |
ERQTelescopeGeoComponentSingleSi* det_he8_Y1 = new ERQTelescopeGeoComponentSingleSi("SingleSi", "SingleSi_SSD20_1", |
105 |
TVector3(0., 0., z_d1), TVector3(), "Y"); |
106 |
ERQTelescopeGeoComponentSingleSi* det_he8_Y2 = new ERQTelescopeGeoComponentSingleSi("SingleSi", "SingleSi_SSD20_2", |
107 |
TVector3(0., 0., z_d1+z_d2), TVector3(), "Y"); |
108 |
ERQTelescopeGeoComponentSingleSi* det_he8_Y3 = new ERQTelescopeGeoComponentSingleSi("SingleSi", "SingleSi_SSD20_3", |
109 |
TVector3(0., 0., z_d1+z_d2*2), TVector3(), "Y"); |
110 |
ERQTelescopeGeoComponentSingleSi* det_he8_Y4 = new ERQTelescopeGeoComponentSingleSi("SingleSi", "SingleSi_SSD20_4", |
111 |
TVector3(0., 0., z_d1+z_d2*3), TVector3(), "Y"); |
112 |
ERQTelescopeGeoComponentSingleSi* det_he8_Y5 = new ERQTelescopeGeoComponentSingleSi("SingleSi", "SingleSi_SSD20_5", |
113 |
TVector3(0., 0., z_d1+z_d2*4), TVector3(), "Y"); |
114 |
|
115 |
assembly_he8->AddComponent(det_he8_X); |
116 |
assembly_he8->AddComponent(det_he8_Y1); |
117 |
assembly_he8->AddComponent(det_he8_Y2); |
118 |
assembly_he8->AddComponent(det_he8_Y3); |
119 |
assembly_he8->AddComponent(det_he8_Y4); |
120 |
assembly_he8->AddComponent(det_he8_Y5); |
121 |
|
122 |
setupQTelescope->AddSubAssembly(assembly_he8); |
123 |
|
124 |
|
125 |
// ------QTelescope -------------------------------------------------------
|
126 |
ERQTelescope* qtelescope= new ERQTelescope("ERQTelescope", kTRUE,verbose); |
127 |
run->AddModule(qtelescope); |
128 |
// ------BeamDet ----------------------------------------------------------
|
129 |
ERBeamDet* beamdet= new ERBeamDet("ERBeamDet", kTRUE,verbose); |
130 |
run->AddModule(beamdet); |
131 |
// ------ND ---------------------------------------------------------------
|
132 |
ERND* nd= new ERND("ERND", kTRUE,verbose); |
133 |
nd->SetGeometryFileName(ndGeoFileName); |
134 |
run->AddModule(nd); |
135 |
//-------------------------------------------------------------------------
|
136 |
FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
|
137 |
|
138 |
Double_t kinE_MevPerNucleon = 21.5; |
139 |
|
140 |
Int_t Z = 2, A = 8, Q = 2; |
141 |
TString ionName = "8He";
|
142 |
ERIonMixGenerator* generator = new ERIonMixGenerator(ionName, Z, A, Q, 1); |
143 |
Double32_t kin_energy = kinE_MevPerNucleon * 1e-3 * A; //GeV |
144 |
generator->SetKinE(kin_energy); |
145 |
generator->SetPSigmaOverP(0);
|
146 |
Double32_t sigmaTheta = 0.004*TMath::RadToDeg(); |
147 |
|
148 |
generator->SetThetaSigma(0, sigmaTheta);
|
149 |
generator->SetPhiRange(0, 360); |
150 |
generator->SetBoxXYZ(0, 0, 0., 0., beamStartPosition); |
151 |
generator->SpreadingOnTarget(); |
152 |
|
153 |
primGen->AddGenerator(generator); |
154 |
run->SetGenerator(primGen); |
155 |
|
156 |
/////////////////////////////////////////////////////////////////////////////
|
157 |
// ------- Decayer --------------------------------------------------------
|
158 |
|
159 |
Double_t massHe10 = 9.36268;//7.5061760; // [GeV] 10He |
160 |
ERDecayer* decayer = new ERDecayer();
|
161 |
|
162 |
ERDecay10Heto8He* targetDecay = new ERDecay10Heto8He();
|
163 |
targetDecay->SetHe10Mass(massHe10); |
164 |
// // ERDecayEXP1811* targetDecay = new ERDecayEXP1811();
|
165 |
// // targetDecay->SetH7Mass(massHe10);
|
166 |
|
167 |
targetDecay->SetInteractionVolumeName("tubeD2");
|
168 |
targetDecay->SetNuclearInteractionLength(20.); |
169 |
targetDecay->SetAngularDistribution("cos_tetta_cross.txt");
|
170 |
// targetDecay->SetDecayFile("pmom-pv-1_short.dat", 0.0005 /*excitation in file [GeV]*/);
|
171 |
targetDecay->SetDecayFile("10he_int-3030_short.dat", 0.001 /*excitation in file [GeV]*/); |
172 |
//targetDecay->SetH7Exitation(0.0004, 0.00002355, 1);
|
173 |
//targetDecay->SetH7Exitation(0.0012, 0.0002355, 1);
|
174 |
targetDecay->SetMinStep(1e-1); |
175 |
targetDecay->SetMaxPathLength(2./*2e-4 * 10 * 1.1*/); |
176 |
|
177 |
decayer->AddDecay(targetDecay); |
178 |
run->SetDecayer(decayer); |
179 |
|
180 |
// ------- QTelescope Digitizer -------------------------------------------
|
181 |
ERQTelescopeDigitizer* qtelescopeDigitizer = new ERQTelescopeDigitizer(verbose);
|
182 |
qtelescopeDigitizer->SetSiElossThreshold(0);
|
183 |
qtelescopeDigitizer->SetSiElossSigma(0);
|
184 |
qtelescopeDigitizer->SetSiTimeSigma(0);
|
185 |
qtelescopeDigitizer->SetCsIElossThreshold(0);
|
186 |
qtelescopeDigitizer->SetCsIElossSigma(0);
|
187 |
qtelescopeDigitizer->SetCsITimeSigma(0);
|
188 |
run->AddTask(qtelescopeDigitizer); |
189 |
|
190 |
// ----- BeamDet Digitizer ----------------------------------------------
|
191 |
ERBeamDetDigitizer* beamDetDigitizer = new ERBeamDetDigitizer(verbose);
|
192 |
//beamDetDigitizer->SetMWPCElossThreshold(0.006);
|
193 |
//beamDetDigitizer->SetToFElossThreshold(0.006);
|
194 |
//beamDetDigitizer->SetToFElossSigmaOverEloss(0);
|
195 |
//beamDetDigitizer->SetToFTimeSigma(1e-10);
|
196 |
run->AddTask(beamDetDigitizer); |
197 |
// ------------------------------------------------------------------------
|
198 |
ERNDDigitizer* ndDigitizer = new ERNDDigitizer(1); |
199 |
ndDigitizer->SetEdepError(0.0,0.04,0.02); |
200 |
ndDigitizer->SetLYError(0.0,0.04,0.02); |
201 |
ndDigitizer->SetTimeError(0.001); |
202 |
ndDigitizer->SetQuenchThreshold(0.005); |
203 |
ndDigitizer->SetLYThreshold(0.004); |
204 |
ndDigitizer->SetProbabilityB(0.1); |
205 |
ndDigitizer->SetProbabilityC(0.3); |
206 |
run->AddTask(ndDigitizer); |
207 |
//-------Set visualisation flag to true------------------------------------
|
208 |
//run->SetStoreTraj(kTRUE);
|
209 |
|
210 |
//-------Set LOG verbosity -----------------------------------------------
|
211 |
FairLogger::GetLogger()->SetLogScreenLevel("INFO");
|
212 |
|
213 |
// ----- Initialize simulation run ------------------------------------
|
214 |
run->Init(); |
215 |
Int_t nSteps = -15000;
|
216 |
|
217 |
// ----- Runtime database ---------------------------------------------
|
218 |
Bool_t kParameterMerged = kTRUE; |
219 |
FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged);
|
220 |
parOut->open(parFile.Data()); |
221 |
rtdb->setOutput(parOut); |
222 |
rtdb->saveOutput(); |
223 |
rtdb->print(); |
224 |
|
225 |
run->CreateGeometryFile("setup_exp1904.root");
|
226 |
|
227 |
// ----- Run simulation ------------------------------------------------
|
228 |
run->Run(nEvents); |
229 |
|
230 |
// ----- Finish -------------------------------------------------------
|
231 |
timer.Stop(); |
232 |
Double_t rtime = timer.RealTime(); |
233 |
Double_t ctime = timer.CpuTime(); |
234 |
cout << endl << endl; |
235 |
cout << "Macro finished succesfully." << endl;
|
236 |
cout << "Output file is " << outFile << endl;
|
237 |
cout << "Parameter file is " << parFile << endl;
|
238 |
cout << "Real time " << rtime << " s, CPU time " << ctime |
239 |
<< "s" << endl << endl;
|
240 |
TDatabasePDG *tdb = TDatabasePDG::Instance(); |
241 |
// tdb->Print();
|
242 |
} |
243 |
|
244 |
|