]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TTherminator/AliGenTherminator.cxx
New temperature sensor configuration (bad sensors removed)
[u/mrichter/AliRoot.git] / TTherminator / AliGenTherminator.cxx
index 004564af140bcf38f85f5bb8cac489341e43d314..1ca439ebde12545db32679c23162e3c2d8f1e6ef 100644 (file)
@@ -100,6 +100,9 @@ void AliGenTherminator::Generate()
   Int_t np = fParticles.GetEntriesFast();
   AliWarning(Form("Imported %d particles", np));
 
+  Int_t *idsOnStack;
+  idsOnStack = new Int_t[np];
+
   TParticle *iparticle;
   Double_t evrot = gRandom->Rndm()*TMath::Pi();
   
@@ -128,24 +131,25 @@ void AliGenTherminator::Generate()
       
       Double_t vphi = TMath::ATan2(iparticle->Vy(), iparticle->Vx());
       Double_t vrho = TMath::Hypot(iparticle->Vx(), iparticle->Vy());
-      origin[0] = origin0[0]+vrho*TMath::Cos(vphi + evrot);
-      origin[1] = origin0[1]+vrho*TMath::Sin(vphi + evrot);
-      origin[2] = origin0[2]+iparticle->Vz();
+      origin[0] = vrho*TMath::Cos(vphi + evrot);
+      origin[1] = vrho*TMath::Sin(vphi + evrot);
+      origin[2] = iparticle->Vz();
       
       imo = -1;
       TParticle* mother = 0;
       if (hasMother) {
        imo = iparticle->GetFirstMother();
-       mother = (TParticle *) fParticles->At(imo);
+       mother = (TParticle *) fParticles.At(imo);
       } // if has mother   
       Bool_t tFlag = (!hasDaughter);
       
-      printf("Pushing Track %d with status %d mother %d\n", kf, tFlag, imo);
-      PushTrack(tFlag,imo,kf,
+      printf("Pushing Track %d with status %d mother %d\n", kf, tFlag, imo>=0?idsOnStack[imo]:imo);
+      PushTrack(tFlag,imo>=0?idsOnStack[imo]:imo,kf,
                p[0],p[1],p[2],energy,
-               origin[0],origin[1],origin[2],iparticle->T()*0.197327*1e-13/300000000,
+               origin[0],origin[1],origin[2],iparticle->T(),
                polar[0],polar[1],polar[2],
                hasMother ? kPDecay:kPNoProcess,nt);
+      idsOnStack[i] = nt;
       fNprimaries++;
       KeepTrack(nt);
     }
@@ -180,16 +184,18 @@ void AliGenTherminator::Generate()
       TParticle* mother = 0;
       if (hasMother) {
        imo = iparticle->GetFirstMother();
-       mother = (TParticle *) fParticles->At(imo);
+       mother = (TParticle *) fParticles.At(imo);
       } // if has mother   
       Bool_t tFlag = (hasDaughter);
       
-      printf("Pushing Track %d with status %d mother %d\n", kf, tFlag, imo);
-      PushTrack(tFlag,imo,kf,
+      printf("Found mother %i with true id %i\n", imo, imo>=0?idsOnStack[imo]:imo);
+      printf("Pushing Track %d with status %d mother %d\n", kf, tFlag, imo>=0?idsOnStack[imo]:imo);
+      PushTrack(tFlag,imo>=0?idsOnStack[imo]:imo,kf,
                p[0],p[1],p[2],energy,
-               origin[0],origin[1],origin[2],iparticle->T()*0.197327*1e-13/300000000,
+               origin[0],origin[1],origin[2],iparticle->T(),
                polar[0],polar[1],polar[2],
                hasMother ? kPDecay:kPNoProcess,nt);
+      idsOnStack[i] = nt;
       fNprimaries++;
       KeepTrack(nt);
 
@@ -198,13 +204,13 @@ void AliGenTherminator::Generate()
       origin[2] = origin0[2]+iparticle->Vz();
 
       imo = nt;
-      mother = (TParticle *) fParticles->At(nt);
+      //      mother = (TParticle *) fParticles.At(nt);
       tFlag = (!hasDaughter);
       
       printf("Pushing Track %d with status %d mother %d\n", kf, tFlag, imo);
       PushTrack(tFlag,imo,kf,
                p[0],p[1],p[2],energy,
-               origin[0],origin[1],origin[2],iparticle->T()*0.197327*1e-13/300000000,
+               origin[0],origin[1],origin[2],iparticle->T(),
                polar[0],polar[1],polar[2],
                hasMother ? kPDecay:kPNoProcess,nt);
       fNprimaries++;
@@ -212,6 +218,8 @@ void AliGenTherminator::Generate()
     }
   }
 
+
+
   SetHighWaterMark(fNprimaries);
 
   TArrayF eventVertex;
@@ -270,6 +278,8 @@ void AliGenTherminator::Generate()
   AddHeader(header);
   fCollisionGeometry = (AliGenHijingEventHeader*)  header;
 
+  delete idsOnStack;
+
   //  gAlice->SetGenEventHeader(header); 
 }