42 fInputFile(new TFile(fileName)),
44 fParticles(new TClonesArray(
"PParticle",100))
47 fInputTree = (TTree*) fInputFile->Get(
"data");
48 fInputTree->SetBranchAddress(
"Particles", &fParticles);
65 cout <<
"-E MpdPlutoGenerator: Input file nor open!" << endl;
70 if ( iEvent > fInputTree->GetEntries() ) {
71 cout <<
"-E MpdPlutoGenerator: No more events in input file!" << endl;
77 fInputTree->GetEntry(iEvent++);
81 TDatabasePDG* dataBase = TDatabasePDG::Instance();
84 Int_t nParts = fParticles->GetEntriesFast();
87 for (Int_t iPart=0; iPart < nParts; iPart++) {
88 PParticle* part = (PParticle*) fParticles->At(iPart);
89 Int_t pdgType = dataBase->ConvertGeant3ToPdg( part->ID() );
93 cout <<
"-W MpdPlutoGenerator: Unknown type " << part->ID()
94 <<
", skipping particle." << endl;
98 TLorentzVector mom = part->Vect4();
99 Double_t px = mom.Px();
100 Double_t py = mom.Py();
101 Double_t pz = mom.Pz();
103 TVector3 vertex = part->getVertex();
104 Double_t vx = vertex.x();
105 Double_t vy = vertex.y();
106 Double_t vz = vertex.z();
112 Double_t gammaCM = TMath::Sqrt( 1. / ( 1. - betaCM*betaCM) );
115 Double_t mass = dataBase->GetParticle(pdgType)->Mass();
116 Double_t e =
sqrt( mass*mass + px*px + py*py + pz*pz );
117 pz = gammaCM * ( pz - betaCM * e );
123 Int_t parentIndx = part->GetParentIndex();
124 primGen->AddTrack(pdgType, px, py, pz, vx, vy, vz, -parentIndx-10);