196 {
198
199
200
201 Double_t start[3] = {0., 0.,
startZ};
202 Double_t end[3] = {0., 0.,
endZ};
203 char ts[20];
204
205
206 Int_t idbase = 1200;
208 Double_t bparam = 0.;
209 Double_t mparam[10];
211 cout << "Info GenieGenerator: MaterialBudget " << start[2] << " - "
212 << end[2] << endl;
213 cout << "Info GenieGenerator: MaterialBudget " << bparam << endl;
214 cout << "Info GenieGenerator: MaterialBudget 0 " << mparam[0] << endl;
215 cout << "Info GenieGenerator: MaterialBudget 1 " << mparam[1] << endl;
216 cout << "Info GenieGenerator: MaterialBudget 2 " << mparam[2] << endl;
217 cout << "Info GenieGenerator: MaterialBudget 3 " << mparam[3] << endl;
218 cout << "Info GenieGenerator: MaterialBudget 4 " << mparam[4] << endl;
219 cout << "Info GenieGenerator: MaterialBudget 5 " << mparam[5] << endl;
220 cout << "Info GenieGenerator: MaterialBudget 6 " << mparam[6] << endl;
221 cout << "Info GenieGenerator: MaterialBudget " << mparam[0] * mparam[4]
222 << endl;
223
224
225 printf("Reading (log10(p),log10(pt)) Hists from file: %s\n",
227 for (Int_t idnu = 12; idnu < 17; idnu += 2) {
228 for (Int_t idadd = -1;
idadd < 2;
idadd += 2) {
229 Int_t
idhnu =
static_cast<int>(idbase + idnu);
230 if (idadd < 0)
idhnu += 1000;
231 sprintf(ts, "%d", idhnu);
232
234 TH2* h2tmp =
dynamic_cast<TH2*
>(
fInputFile->Get(ts));
235 printf("HISTID=%d, Title:%s\n", idhnu, h2tmp->GetTitle());
236 sprintf(ts, "px_%d", idhnu);
237
238
240 Int_t nbinx = h2tmp->GetNbinsX();
241
242
243 for (Int_t k = 1;
k < nbinx + 1;
k += 1) {
244 sprintf(ts, "h%d%d", idhnu, k);
245
247 }
248 }
249 }
250 }
252 }
253
255 LOG(warning) << "End of input file. Rewind.";
256 }
260 LOG(info) <<
"Info GenieGenerator: neutrino event-nr " <<
fn << endl;
261 }
262
263
264 Double_t mparam[10];
265 Double_t pout[3] = {0., 0., -1.};
266 Double_t txnu = 0;
267 Double_t tynu = 0;
268
269 while (pout[2] < 0.) {
270
271 Int_t
idhnu = TMath::Abs(
neu) + idbase;
274 Double_t pl10 = log10(
pzv);
276 if (nbx < 1) nbx = 1;
277 if (nbx > nbinmx) nbx = nbinmx;
279
280 Double_t
pt = pow(10., ptlog10) - 0.01;
281
282 Double_t phi = gRandom->Uniform(0., 2 * TMath::Pi());
283 pout[0] = cos(phi) *
pt;
284 pout[1] = sin(phi) *
pt;
286
287 if (pout[2] >= 0.) {
288 pout[2] = TMath::Sqrt(pout[2]);
289 if (gRandom->Uniform(-1., 1.) < 0.) pout[0] = -pout[0];
290 if (gRandom->Uniform(-1., 1.) < 0.) pout[1] = -pout[1];
291
292 start[0] = (pout[0] / pout[2]) * (start[2] -
ztarget);
293 start[1] = (pout[1] / pout[2]) * (start[2] -
ztarget);
294 txnu = pout[0] / pout[2];
295 tynu = pout[1] / pout[2];
296 end[0] = txnu * (end[2] -
ztarget);
297 end[1] = tynu * (end[2] -
ztarget);
299 }
300 }
301
302 Double_t prob2int = -1.;
306 while (prob2int < gRandom->Uniform(0., 1.)) {
308
309 z = gRandom->Uniform(start[2], end[2]);
312 if (mparam[6] < 0.5) {
313
314
315 prob2int = 2.;
316 } else {
317
318
319 TGeoNode* node = gGeoManager->FindNode(x, y, z);
320 TGeoMaterial* mat = nullptr;
321 if (node && !gGeoManager->IsOutside()) {
322 mat = node->GetVolume()->GetMaterial();
323
324
325 prob2int = mat->GetDensity() / mparam[7];
326 if (prob2int > 1.)
327 LOG(warning) << " GenieGenerator: prob2int > Maximum density????"
328 << prob2int << " maxrho:" << mparam[7]
329 << " material: " << mat->GetName() << endl;
330 } else {
331 prob2int = 0.;
332 }
333 }
334 }
335
337 Double_t tof = TMath::Sqrt(x * x + y * y + zrelative * zrelative) /
339 cpg->AddTrack(
340 neu, pout[0], pout[1], pout[2], x, y, z, -1,
false,
341 TMath::Sqrt(pout[0] * pout[0] + pout[1] * pout[1] + pout[2] * pout[2]),
342 tof, mparam[0] * mparam[4]);
347
349 Int_t oLPdgCode =
neu;
351 oLPdgCode = copysign(TMath::Abs(
neu) - 1,
neu);
352 }
354 oLPdgCode = 11;
355 }
356 cpg->AddTrack(oLPdgCode, pp[0], pp[1], pp[2], x, y, z, 0,
true,
El, tof,
357 mparam[0] * mparam[4]);
359
360 for (
int i = 0;
i <
nf;
i++) {
362 cpg->AddTrack(
pdgf[i], pp[0], pp[1], pp[2], x, y, z, 0,
true,
Ef[i], tof,
363 mparam[0] * mparam[4]);
365
366 }
367
368 }
369 return kTRUE;
370}
Bool_t ReadEventGeometryDriver(FairPrimaryGenerator *)
std::vector< double > Rotate(Double_t x, Double_t y, Double_t z, Double_t px, Double_t py, Double_t pz)
TH1D * pyslice[3000][100]
void IncrementCounter(const std::string &name, Long64_t delta=1)
double MeanMaterialBudget(std::span< const double, 3 > start, std::span< const double, 3 > end, std::span< double, 10 > mparam)