]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PYTHIA6/AliGenPythiaPlus.cxx
monitor dQdl (PID) at TRD entrance
[u/mrichter/AliRoot.git] / PYTHIA6 / AliGenPythiaPlus.cxx
index 22bf4a5fb1014bf079e851ded1fdbf65d1aa3477..4a19b5fc1627a53e29b0e2f735334ba5b33be3bf 100644 (file)
@@ -375,6 +375,9 @@ void AliGenPythiaPlus::Init()
        fParentSelect[1] =   421;
        fParentSelect[2] =   431;
        fParentSelect[3] =  4122;
+       fParentSelect[4] =  4232;
+       fParentSelect[5] =  4132;
+       fParentSelect[6] =  4332;
        fFlavorSelect    =  4;  
        break;
     case kPyD0PbPbMNR:
@@ -395,7 +398,12 @@ void AliGenPythiaPlus::Init()
        fParentSelect[0] =   431;
        fFlavorSelect    =   4; 
        break;
+    case kPyLambdacppMNR:
+       fParentSelect[0] =  4122;
+       fFlavorSelect    =   4; 
+       break;      
     case kPyBeauty:
+    case kPyBeautyJets:
     case kPyBeautyPbPbMNR:
     case kPyBeautypPbMNR:
     case kPyBeautyppMNR:
@@ -423,6 +431,7 @@ void AliGenPythiaPlus::Init()
     case kPyJpsi:
        fParentSelect[0] = 443;
        break;
+    case kPyMbAtlasTuneMC09:
     case kPyMbDefault:
     case kPyMb:
     case kPyMbWithDirectPhoton:
@@ -488,9 +497,9 @@ void AliGenPythiaPlus::Generate()
     
     fDecayer->ForceDecay();
 
-    Float_t polar[3]   =   {0,0,0};
-    Float_t origin[3]  =   {0,0,0};
-    Float_t p[4];
+    Double_t polar[3]   =   {0,0,0};
+    Double_t origin[3]  =   {0,0,0};
+    Double_t p[4];
 //  converts from mm/c to s
     const Float_t kconv=0.001/2.999792458e8;
 //
@@ -526,8 +535,8 @@ void AliGenPythiaPlus::Generate()
            }
            fNpartons = fPythia->GetNumberOfParticles();
        } else {
-           printf("Loading Event %d\n",AliRunLoader::GetRunLoader()->GetEventNumber());
-           fRL->GetEvent(AliRunLoader::GetRunLoader()->GetEventNumber());
+           printf("Loading Event %d\n",AliRunLoader::Instance()->GetEventNumber());
+           fRL->GetEvent(AliRunLoader::Instance()->GetEventNumber());
            fPythia->SetNumberOfParticles(0);
            fPythia->LoadEvent(fRL->Stack(), 0 , 1);
            fPythia->EditEventList(21);
@@ -739,7 +748,7 @@ void AliGenPythiaPlus::Generate()
                    origin[1] = fVertex[1]+iparticle->Vy()/10; // [cm]
                    origin[2] = fVertex[2]+iparticle->Vz()/10; // [cm]
                    
-                   Float_t tof   = kconv*iparticle->T();
+                   Float_t tof   = fTime + kconv*iparticle->T();
                    Int_t ipa = (fPythia->Version() == 6) ? (iparticle->GetFirstMother() - 1) :(iparticle->GetFirstMother()) ;
                    Int_t iparent = (ipa > -1) ? pParent[ipa] : -1;
  
@@ -847,8 +856,10 @@ Int_t  AliGenPythiaPlus::GenerateMB()
            }
        }
       }
-      if(!ok)
-       return 0;
+      if(!ok){
+         delete [] pParent;
+         return 0;
+      }
     }
     
     
@@ -882,8 +893,10 @@ Int_t  AliGenPythiaPlus::GenerateMB()
       if(!okd && iphcand != -1) // execute rotation in phi 
           RotatePhi(iphcand,okd);
       
-      if(!okd)
-       return 0;
+      if(!okd) {
+         delete[] pParent;
+         return 0;
+      }
     }
     
     if (fTriggerParticle) {
@@ -907,23 +920,45 @@ Int_t  AliGenPythiaPlus::GenerateMB()
     // Check if there is a ccbar or bbbar pair with at least one of the two
     // in fYMin < y < fYMax
     if (fProcess == kPyCharmppMNRwmi || fProcess == kPyBeautyppMNRwmi) {
-      TParticle *hvq;
+      TParticle *partCheck;
+      TParticle *mother;
       Bool_t  theQ=kFALSE,theQbar=kFALSE,inYcut=kFALSE;
-      Float_t yQ;  
-      Int_t   pdgQ;
+      Bool_t  theChild=kFALSE;
+      Float_t y;  
+      Int_t   pdg,mpdg,mpdgUpperFamily;
       for(i=0; i<np; i++) {
-       hvq = (TParticle*)fParticles.At(i);
-       pdgQ = hvq->GetPdgCode();  
-       if(TMath::Abs(pdgQ) != fFlavorSelect) continue; 
-       if(pdgQ>0) { theQ=kTRUE; } else { theQbar=kTRUE; }
-       yQ = 0.5*TMath::Log((hvq->Energy()+hvq->Pz()+1.e-13)/
-                           (hvq->Energy()-hvq->Pz()+1.e-13));
-       if(yQ>fYMin && yQ<fYMax) inYcut=kTRUE;
+       partCheck = (TParticle*)fParticles.At(i);
+       pdg = partCheck->GetPdgCode();  
+       if(TMath::Abs(pdg) == fFlavorSelect) { // quark  
+         if(pdg>0) { theQ=kTRUE; } else { theQbar=kTRUE; }
+         y = 0.5*TMath::Log((partCheck->Energy()+partCheck->Pz()+1.e-13)/
+                            (partCheck->Energy()-partCheck->Pz()+1.e-13));
+         if(y>fYMin && y<fYMax) inYcut=kTRUE;
+       }
+
+       if(fCutOnChild && TMath::Abs(pdg) == fPdgCodeParticleforAcceptanceCut) {
+         Int_t mi = partCheck->GetFirstMother() - 1;
+         if(mi<0) continue;
+         mother = (TParticle*)fParticles.At(mi);
+         mpdg=TMath::Abs(mother->GetPdgCode());
+         mpdgUpperFamily=(mpdg>1000 ? mpdg+1000 : mpdg+100); // keep e from c from b
+         if ( ParentSelected(mpdg) || 
+             (fFlavorSelect==5 && ParentSelected(mpdgUpperFamily))) {
+           if (KinematicSelection(partCheck,1)) {
+             theChild=kTRUE;
+           }
+         }
+       }
       }
-      if (!theQ || !theQbar || !inYcut) {
+      if (!theQ || !theQbar || !inYcut) { // one of the c/b conditions not satisfied
        delete[] pParent;
        return 0;
       }
+      if (fCutOnChild && !theChild) { // one of the child conditions not satisfied
+       delete[] pParent;
+       return 0;       
+      }
+
     }
 
     //Introducing child cuts in case kPyW, kPyZ, kPyMb, and kPyMbNonDiff
@@ -969,7 +1004,7 @@ Int_t  AliGenPythiaPlus::GenerateMB()
            origin[1] = fVertex[1]+iparticle->Vy()/10; // [cm]
            origin[2] = fVertex[2]+iparticle->Vz()/10; // [cm]
            
-           Float_t tof = fEventTime + kconv * iparticle->T();
+           Float_t tof = fTime + fEventTime + kconv * iparticle->T();
 
            PushTrack(fTrackIt*trackIt, iparent, kf, 
                      p[0], p[1], p[2], p[3], 
@@ -982,17 +1017,18 @@ Int_t  AliGenPythiaPlus::GenerateMB()
            //
            // Special Treatment to store color-flow
            //
+           /*
            if (ks == 3 || ks == 13 || ks == 14) {
                TParticle* particle = 0;
                if (fStack) {
                    particle = fStack->Particle(nt);
                } else {
-                   particle = gAlice->Stack()->Particle(nt);
+                   particle = AliRunLoader::Instance()->Stack()->Particle(nt);
                }
-//             particle->SetFirstDaughter(fPythia->GetK(2, i));
-//             particle->SetLastDaughter(fPythia->GetK(3, i));         
+               particle->SetFirstDaughter(fPythia->GetK(2, i));
+               particle->SetLastDaughter(fPythia->GetK(3, i));         
            }
-           
+           */  
            KeepTrack(nt);
            pParent[i] = nt;
            SetHighWaterMark(nt);
@@ -1067,7 +1103,7 @@ void AliGenPythiaPlus::MakeHeader()
 //
 // Event Vertex 
     fHeader->SetPrimaryVertex(fVertex);
-    
+    fHeader->SetInteractionTime(fTime+fEventTime);    
 //
 // Number of primaries
     fHeader->SetNProduced(fNprimaries);
@@ -1106,8 +1142,9 @@ void AliGenPythiaPlus::MakeHeader()
 // Store quenching parameters
 //
     if (fQuench){
-       Double_t z[4];
-       Double_t xp, yp;
+        Double_t z[4] = {0.};
+       Double_t xp = 0.;
+       Double_t yp = 0.;
        if (fQuench == 1) {
            // Pythia::Quench()
            fPythia->GetQuenchingParameters(xp, yp, z);
@@ -1135,7 +1172,7 @@ void AliGenPythiaPlus::MakeHeader()
     fHeader = 0x0;
 }
 
-Bool_t AliGenPythiaPlus::CheckTrigger(TParticle* jet1, TParticle* jet2)
+Bool_t AliGenPythiaPlus::CheckTrigger(const TParticle* jet1, const TParticle* jet2)
 {
 // Check the kinematic trigger condition
 //
@@ -1304,7 +1341,7 @@ void AliGenPythiaPlus::GetSubEventTime()
 
 
 
-Bool_t AliGenPythiaPlus::IsInEMCAL(Float_t phi, Float_t eta)
+Bool_t AliGenPythiaPlus::IsInEMCAL(Float_t phi, Float_t eta) const
 {
   // Is particle in EMCAL acceptance? 
   // phi in degrees, etamin=-etamax
@@ -1315,7 +1352,7 @@ Bool_t AliGenPythiaPlus::IsInEMCAL(Float_t phi, Float_t eta)
     return kFALSE;
 }
 
-Bool_t AliGenPythiaPlus::IsInPHOS(Float_t phi, Float_t eta)
+Bool_t AliGenPythiaPlus::IsInPHOS(Float_t phi, Float_t eta) const
 {
   // Is particle in PHOS acceptance? 
   // Acceptance slightly larger considered.