]> git.uio.no Git - u/mrichter/AliRoot.git/blob - test/vmctest/ppbench/testMD.C
- Adding macros to run MC only (for performance tests)
[u/mrichter/AliRoot.git] / test / vmctest / ppbench / testMD.C
1 // $Id$
2 //
3 // Macro for checking mother-daughter particles relationship in stack.
4 // By A. Morsch, 24/10/2013
5
6 void testMD(Int_t evNumber1 = 0, Int_t evNumber2 = 0) 
7 {
8 // Connect the Root Galice file containing Geometry, Kine and Hits
9
10     AliRunLoader* rl = AliRunLoader::Open("galice.root");
11 //
12     TDatabasePDG*  DataBase = new TDatabasePDG();
13     
14 //
15 //   Loop over events 
16 //
17     rl->LoadKinematics();
18     rl->LoadHeader();    
19     for (Int_t nev = evNumber1; nev <= evNumber2; nev++) {
20         rl->GetEvent(nev);
21         AliStack* stack = rl->Stack();
22         Int_t npart = stack->GetNtrack();
23         if (nev < evNumber1) continue;
24         printf("Event %5d \n", nev);
25 //
26 // Particle loop
27 //       
28         
29         for (Int_t part = 0; part < npart; part++) {
30           TParticle *particle = stack->Particle(part);
31           Int_t pdg  = particle->GetPdgCode();
32           Int_t child1 = particle->GetFirstDaughter();
33           Int_t child2 = particle->GetLastDaughter();
34           if (child1 == -1 || part < 8) continue;
35           
36           for (Int_t i = child1; i<= child2; i++) 
37             {
38               TParticle *daughter = stack->Particle(i);
39               Int_t mo = daughter->GetFirstMother();
40               Int_t dodg = daughter->GetPdgCode();
41               if (mo != part) 
42                 printf("Particle with index %5d (pdg %5d) has daughters from index %5d to %5d, however, daughter %5d (pdg %5d) points back to %5d \n", 
43                        part, pdg, child1, child2, i, dodg, mo);
44             }
45         } // primary loop
46     }
47 }
48
49
50
51
52
53
54