39 if (0 == strncmp(
"/eos",
fextFile,4) ) {
40 TString tmp = gSystem->Getenv(
"EOSSHIP");
43 LOGF(info,
"Open external file with charm or beauty hadrons on eos: %s", tmp.Data());
45 LOG(FATAL) <<
"Error opening input file. You may have forgotten to provide a krb5 token. Try kinit username@lxplus.cern.ch";
48 LOGF(info,
"Open external file with charm or beauty hadrons: %s",
fextFile);
51 LOG(FATAL) <<
"Error opening input file";
55 LOG(FATAL) <<
"File is corrupted";
64 fTree->SetBranchAddress(
"E",&
hE);
65 fTree->SetBranchAddress(
"M",&
hM);
70 fTree->SetBranchAddress(
"mE",&
mE);
71 if (
fTree->GetBranch(
"k")){
72 fTree->SetBranchAddress(
"k",&
ck);
73 if (
fTree->GetBranch(
"a0")){
74 for(Int_t i=0; i<16; i++){
75 TString na =
"a";na+=i;
77 TString ns =
"s";ns+=i;
84 fPythia->readString(
"ProcessLevel:all = off");
88 n =
fPythia->particleData.nextId(n);
90 Pythia8::ParticleDataEntry* p =
fPythia->particleData.particleDataEntryPtr(n);
93 Pythia8::ParticleDataEntry* p =
fPythia->particleData.particleDataEntryPtr(n);
95 Pythia8::ParticleDataEntryPtr p =
fPythia->particleData.particleDataEntryPtr(n);
99 std::string particle = std::to_string(n)+
":mayDecay = false";
101 LOGF(info,
"Made %s stable for Pythia, should decay in Geant4", p->name().c_str());
107 fPythia->settings.mode(
"Beams:idB", 2212);
108 fPythia->settings.mode(
"Beams:frameType", 2);
110 fPythia->settings.parm(
"Beams:eB",0.);
115 TGeoVolume* top = gGeoManager->GetTopVolume();
118 LOGF(error,
"target not found, %s, program will crash",
targetName.Data());
120 Double_t z_middle = target->GetMatrix()->GetTranslation()[2];
121 TGeoBBox* sha = (TGeoBBox*)target->GetVolume()->GetShape();
122 startZ = z_middle - sha->GetDZ();
123 endZ = z_middle + sha->GetDZ();
148 Double_t x,y,z,px,py,pz,dl,e,tof;
156 if (
fn==
fNevents) {LOG(WARNING) <<
"End of input file. Rewind.";}
160 if (
int(
mE[0])== 0){ l =
true; }
162 if (
int(fabs(
hid[0]) ) == 431){ isDs =
true; }
164 if (
int(
mE[0])== 0){ l =
true; }
166 if (
int(fabs(
hid[0]) ) == 431 || isDs ){
167 Double_t rnr = gRandom->Uniform(0,1);
178 Double_t prob2int = -1.;
182 Double_t zinterStart =
start[2];
184 Int_t nInter =
ck[0];
if (nInter>16){nInter=16;}
185 for( Int_t nI=0; nI<nInter; nI++){
188 Int_t intLengthFactor = 1;
189 if (TMath::Abs(
ancestors[nI]) < 1000){intLengthFactor = 1.16;}
193 while (prob2int<rndm) {
195 zinter = gRandom->Uniform(zinterStart,
end[2]);
196 Double_t point[3]={
xOff,
yOff,zinter};
198 Double_t interLength =
mparam[8] * intLengthFactor * 1.7;
199 TGeoNode *node = gGeoManager->FindNode(point[0],point[1],point[2]);
200 TGeoMaterial *mat = 0;
201 if (node && !gGeoManager->IsOutside()) {
202 mat = node->GetVolume()->GetMaterial();
203 Double_t n = mat->GetDensity()/mat->GetA();
204 sigma = 1./(n*mat->GetIntLen())/
mbarn;
209 rndm = gRandom->Uniform(0.,1.);
212 zinterStart = zinter;
216 for(Int_t c=0; c<2; c++){
223 fPythia->event.append(
id, 1, 0, 0,
hpx[0],
hpy[0],
hpz[0],
hE[0],
hM[0], 0., 9. );
225 Double_t tau0 =
fPythia->particleData.tau0(
id);
226 dl = gRandom->Exp(tau0) /
hM[0];
228 Int_t addedParticles = 0;
238 cpg->AddTrack(
id,px,py,pz,x/
cm,y/
cm,z/
cm,-1,
false);
241 for(Int_t ii=1; ii<
fPythia->event.size(); ii++){
243 Bool_t wanttracking=
false;
244 if(
fPythia->event[ii].isFinal()){ wanttracking=
true; }
251 z =
fPythia->event[ii].zProd()+zinter;
252 x =
fPythia->event[ii].xProd();
253 y =
fPythia->event[ii].yProd();
260 im =
fPythia->event[ii].mother1()+key;
263 cpg->AddTrack(
id,px,py,pz,x/
cm,y/
cm,z/
cm,im,wanttracking,e,tof,1.);
266 key+=addedParticles-1;