Usage of 'GetFirstDaughter' within TParticle class


_ROOT Version: 6.14.04
_Platform: Ubuntu
Compiler: Not Provided


Dear Root users,

I am using an adapted version of the pythia tutorial macro provided in the root tutorials. In this macro I am trying to fill a histogram with the transverse momenta of pions with sigma c baryons as mother particles. To achieve this I want to use the GetFirstDaughter command. The code I am using is the following:

void test(Int_t nev  = 10000, Int_t ndeb = 1)
{
   const char *p8dataenv = gSystem->Getenv("PYTHIA8DATA");
   if (!p8dataenv) {
      const char *p8env = gSystem->Getenv("PYTHIA8");
      if (!p8env) {
         Error("pythia8.C",
               "Environment variable PYTHIA8 must contain path to pythia directory!");
         return;
      }
      TString p8d = p8env;
      p8d += "/xmldoc";
      gSystem->Setenv("PYTHIA8DATA", p8d);
   }
   const char* path = gSystem->ExpandPathName("$PYTHIA8DATA");
   if (gSystem->AccessPathName(path)) {
         Error("pythia8.C",
               "Environment variable PYTHIA8DATA must contain path to $PYTHIA8/xmldoc directory !");
      return;
   }
// Load libraries
#ifndef G__WIN32 // Pythia8 is a static library on Windows
   if (gSystem->Getenv("PYTHIA8")) {
      gSystem->Load("$PYTHIA8/lib/libpythia8");
   } else {
      gSystem->Load("libpythia8");
   }
#endif
   gSystem->Load("libEG");
   gSystem->Load("libEGPythia8");

   TH1D* ptPionSigmaH2 = new TH1D("ptPionSigmaH2","pion from #Sigma_{c} p_{t}", 10000, 0., 3);

Float_t etamin = -0.9;
   Float_t etamax = 0.9;

// Array of all particles
   TClonesArray* particles = new TClonesArray("TParticle", 1000);
// Create pythia8 object
   TPythia8* pythia8 = new TPythia8();
// Configure
   pythia8->ReadString("HardQCD:all = on");
   pythia8->ReadString("HardQCD:gg2ccbar = on");
   pythia8->ReadString("HardQCD:qqbar2ccbar = on");
   pythia8->ReadString("phaseSpace:pTHatMin = 50.");
// Initialize
   pythia8->Initialize(2212 /* p */, 2212 /* p */, 10000. /* GeV */);

for (Int_t iev = 0; iev < nev; iev++) {
      pythia8->GenerateEvent();
      if (iev < ndeb) pythia8->EventListing();
      pythia8->ImportParticles(particles,"All");
      Int_t np = particles->GetEntriesFast();
//-------------------------Particle-loop------------------------------
 for (Int_t ip = 0; ip < np; ip++) {
         TParticle* part = (TParticle*) particles->At(ip);
         Int_t pdg = part->GetPdgCode();
         Float_t pt  = part->Pt();
         Float_t eta = part->Eta();

         Int_t daughterindex = part->GetFirstDaughter();
	 if (daughterindex < 0) continue;
	 TParticle* dpart = (TParticle*) particles->At(daughterindex);
	 Int_t dpdg = dpart->GetPdgCode();
	 Float_t dpt = dpart->Pt();
	 Float_t deta = dpart->Eta();

if ( ((dpdg == 211) || (dpdg == -211)) && (pdg == 4112) && (pt >= 0) && ((eta >= etamin) && (eta <= etamax)) && ((deta >= etamin) && (deta <= etamax))) ptPionSigmaH2->Fill(dpt);

The problem is that this code does not seem to find any particles, while when using the GetFirstMother command for the same amount of events (and trying to achieve the same), I do find pions originating from sigma c baryons. I need to be able to do the same using GetFirstDaughter to proceed with my research. Does anyone see what is wrong with my code or know how I could achieve what I want to?

Best regards,

Loek Meijers

You assume that it is the first daughter but it can be the last one (same with searching for the mother, it’s not necessarily the first one, it can be the second one).

Reading your comment, I think I don’t really understand what a ‘first’ or ‘second’ mother is. What I had in mind for the first mother function is that the first mother would be the particle tracing back the track of a particle to the closest vertex and the second mother would be tracing back the first mother particle to its previous vertex, but this seems not to be the case. Would you by any chance be able to explain to me exactly what a first and second mother are? The same goes for daughter?

Best regards,

Loek

The ROOT TParticle:: GetFirstMother(), GetSecondMother(), GetFirstDaughter() and GetLastDaughter() return what PYTHIA 8 Particle:: mother1(), mother2(), daughter1() and daugter2() provided, except that (all? some?) TPythia8 indices (always? usually?) differ by -1 from the original PYTHIA 8 indices (so e.g. 0 becomes -1).

Note that the PYTHIA 8 Particle Properties web page does not describe cases when any of these indices is negative (which you may often find in TPythia8 results).

Note also that the PYTHIA 8 Particle::status() is lost and the ROOT TParticle::GetStatusCode() returns what PYTHIA 8 Particle::isFinal() provided.

Alright thanks for your help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.