exp1803_sim_digi_T1pos.C
1 |
void exp1803_sim_digi_T1pos(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 |
// ----- QTelescope Setup ------------------------------------------------
|
80 |
ERQTelescopeSetup* setupQTelescope = ERQTelescopeSetup::Instance(); |
81 |
setupQTelescope->SetXmlParametersFile(paramFileQTelescope); |
82 |
|
83 |
// ----- T1 parameters ----------------------------------------------------
|
84 |
TVector3 T1Rotation(0., 0., 0); |
85 |
Double_t xPos, yPos, zPos; |
86 |
TVector3* T1Translation; |
87 |
// ----- T1.1--------------------------------------------------------------
|
88 |
setupQTelescope->AddSi("DoubleSi_SD1", TVector3(5, 2, T1PosZ + T1D1Thick/2), T1Rotation,"X"); |
89 |
setupQTelescope->AddSi("DoubleSi_SD2", TVector3(5, 2, T1PosZ + T1D1Thick +T1Dl + T1D2Thick/2), T1Rotation, "X"); |
90 |
|
91 |
// ------QTelescope -------------------------------------------------------
|
92 |
ERQTelescope* qtelescope= new ERQTelescope("ERQTelescope", kTRUE,verbose); |
93 |
run->AddModule(qtelescope); |
94 |
|
95 |
// ------BeamDet ----------------------------------------------------------
|
96 |
ERBeamDet* beamdet= new ERBeamDet("ERBeamDet", kTRUE,verbose); |
97 |
run->AddModule(beamdet); |
98 |
|
99 |
FairPrimaryGenerator* primGen = new FairPrimaryGenerator();
|
100 |
|
101 |
Double_t kinE_MevPerNucleon = 1.;
|
102 |
Double_t kinE_MevPerNucleonMax = 32.; |
103 |
Int_t Z = 2, A = 6, Q = 2; |
104 |
TString ionName = "6He";
|
105 |
|
106 |
ERIonMixGenerator* generator = new ERIonMixGenerator(ionName, Z, A, Q, 1); |
107 |
// ERIonMixGenerator* generator2 = new ERIonMixGenerator("Triton", 1, 3, 1, 1);
|
108 |
ERIonMixGenerator* generator2 = new ERIonMixGenerator("HE3", 2, 3, 2, 1); |
109 |
|
110 |
// generator->AddBackgroundIon("Triton", 1, 3, 1, 0.2 / 0.20);
|
111 |
generator->AddBackgroundIon("Alpha", 1, 4, 1, 0.4 / 0.60); |
112 |
// generator->AddBackgroundIon("HE3", 2, 3, 2, 0.2 / 0.20);
|
113 |
generator->AddBackgroundIon("Deuteron", 1, 2, 1, 0.2 / 0.20); |
114 |
generator->AddBackgroundIon("proton", 1, 1, 1, 0.2 / 0.20); |
115 |
|
116 |
Double32_t kin_energy = kinE_MevPerNucleon * 1e-3 * A; //GeV |
117 |
Double32_t kin_energy_max = kinE_MevPerNucleonMax * 1e-3 * A; //GeV |
118 |
generator->SetKinERange(0.001, 0.02); |
119 |
Double32_t sigmaTheta = 0.004*TMath::RadToDeg(); |
120 |
generator->SetThetaSigma(0, 0); |
121 |
// generator->SetThetaRange(15, 18);
|
122 |
generator->SetThetaRange(16, 18); |
123 |
generator->SetPhiRange(0, 270); |
124 |
generator->SetBoxXYZ(2, 2, 2, 2, 2.); |
125 |
|
126 |
generator2->SetKinERange(0.001, 0.03); |
127 |
generator2->SetThetaSigma(0, 0); |
128 |
generator2->SetThetaRange(10, 12); |
129 |
generator2->SetPhiRange(90, 360); |
130 |
// generator2->SetBoxXYZ(5, 2, 5, 2, 2.);
|
131 |
generator2->SetBoxXYZ(8, 2, 8, 2, 2.); |
132 |
|
133 |
|
134 |
primGen->AddGenerator(generator); |
135 |
primGen->AddGenerator(generator2); |
136 |
run->SetGenerator(primGen); |
137 |
// run->SetGenerator(primGen);
|
138 |
// ------- Decayer --------------------------------------------------------
|
139 |
Double_t massH5 = (2*939.565 + 2809.431)*0.001; // [GeV] |
140 |
|
141 |
ERDecayer* decayer = new ERDecayer();
|
142 |
ERDecayEXP1803* targetDecay = new ERDecayEXP1803();
|
143 |
targetDecay->SetTargetVolumeName("tubeH2");
|
144 |
targetDecay->SetTargetThickness(targetH2Thickness); |
145 |
decayer->AddDecay(targetDecay); |
146 |
run->SetDecayer(decayer); |
147 |
|
148 |
// ------- QTelescope Digitizer -------------------------------------------
|
149 |
ERQTelescopeDigitizer* qtelescopeDigitizer = new ERQTelescopeDigitizer(verbose);
|
150 |
qtelescopeDigitizer->SetSiElossThreshold(0);
|
151 |
qtelescopeDigitizer->SetSiElossSigma(0);
|
152 |
qtelescopeDigitizer->SetSiTimeSigma(0);
|
153 |
|
154 |
qtelescopeDigitizer->SetCsIElossThreshold(0);
|
155 |
qtelescopeDigitizer->SetCsIElossSigma(0);
|
156 |
qtelescopeDigitizer->SetCsITimeSigma(0);
|
157 |
run->AddTask(qtelescopeDigitizer); |
158 |
|
159 |
// ----- BeamDet Digitizer ----------------------------------------------
|
160 |
ERBeamDetDigitizer* beamDetDigitizer = new ERBeamDetDigitizer(verbose);
|
161 |
beamDetDigitizer->SetMWPCElossThreshold(0.0000012); |
162 |
beamDetDigitizer->SetToFTimeSigma(0.4/2.35); |
163 |
run->AddTask(beamDetDigitizer); |
164 |
|
165 |
// ------- BeamDet TrackFinder -------------------------------------------
|
166 |
ERBeamDetTrackFinder* trackFinder = new ERBeamDetTrackFinder(verbose);
|
167 |
run->AddTask(trackFinder); |
168 |
|
169 |
// ------- QTelescope TrackFinder -------------------------------------------
|
170 |
ERQTelescopeTrackFinder* qtelescopeTrackFinder = new ERQTelescopeTrackFinder(verbose);
|
171 |
qtelescopeTrackFinder->SetHitStation("DoubleSi_SD2_XY_1");
|
172 |
qtelescopeTrackFinder->SetStripEdepRange(0., 100.); // [GeV] |
173 |
qtelescopeTrackFinder->SetTargetPoint(0., 0., 0.); |
174 |
// qtelescopeTrackFinder->SetStripEdepRange(0.016, 100.); // [GeV]
|
175 |
qtelescopeTrackFinder->SetEdepMaxDiffXY(0.5); |
176 |
run->AddTask(qtelescopeTrackFinder); |
177 |
//-------Set visualisation flag to true------------------------------------
|
178 |
run->SetStoreTraj(kTRUE); |
179 |
//-------Set LOG verbosity -----------------------------------------------
|
180 |
FairLogger::GetLogger()->SetLogScreenLevel("INFO");
|
181 |
// ----- Initialize simulation run ------------------------------------
|
182 |
run->Init(); |
183 |
Int_t nSteps = -15000;
|
184 |
// ----- Runtime database ---------------------------------------------
|
185 |
Bool_t kParameterMerged = kTRUE; |
186 |
FairParRootFileIo* parOut = new FairParRootFileIo(kParameterMerged);
|
187 |
parOut->open(parFile.Data()); |
188 |
rtdb->setOutput(parOut); |
189 |
rtdb->saveOutput(); |
190 |
rtdb->print(); |
191 |
//gMC->SetMaxNStep(nSteps);
|
192 |
// ----- Run simulation ------------------------------------------------
|
193 |
run->Run(nEvents); |
194 |
|
195 |
// ----- Finish -------------------------------------------------------
|
196 |
timer.Stop(); |
197 |
Double_t rtime = timer.RealTime(); |
198 |
Double_t ctime = timer.CpuTime(); |
199 |
std::cout << std::endl << std::endl; |
200 |
std::cout << "Macro finished succesfully." << std::endl;
|
201 |
std::cout << "Output file is sim.root" << std::endl;
|
202 |
std::cout << "Parameter file is par.root" << std::endl;
|
203 |
std::cout << "Real time " << rtime << " s, CPU time " << ctime |
204 |
<< "s" << std::endl << std::endl;
|
205 |
} |