]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PYTHIA6/AliGenPythia.cxx
Added CheckKinematicsOnChild() in order to be able to apply some cuts on muons
[u/mrichter/AliRoot.git] / PYTHIA6 / AliGenPythia.cxx
index 1987ec0cdeab5f255fa5187d8182acef7fa1a686..b21c95303d771ae3a71065eeec7d5f046f4d14b3 100644 (file)
@@ -427,10 +427,10 @@ void AliGenPythia::Generate()
 //
 // Switch hadronisation on
 //
-       fPythia->SetMSTJ(1, fHadronisation);
-       
+       fPythia->SetMSTJ(1, 1);
 //
 // .. and perform hadronisation
+//     printf("Calling hadronisation %d\n", fPythia->GetN());
        fPythia->Pyexec();      
        fTrials++;
        fPythia->ImportParticles(fParticles,"All");
@@ -686,19 +686,23 @@ Int_t  AliGenPythia::GenerateMB()
 
     
     Int_t np = (fHadronisation) ? fParticles->GetEntriesFast() : fNpartons;
-    
+
 
     Int_t* pParent = new Int_t[np];
     for (i=0; i< np; i++) pParent[i] = -1;
     if (fProcess == kPyJets || fProcess == kPyDirectGamma) {
        TParticle* jet1 = (TParticle *) fParticles->At(6);
        TParticle* jet2 = (TParticle *) fParticles->At(7);
-       if (!CheckTrigger(jet1, jet2)) {
-           delete pParent;
-           return 0;
-       }
+       if (!CheckTrigger(jet1, jet2)) return 0;
     }
     
+
+    //Introducing child cuts in case kPyW
+    if ( (fProcess == kPyW)  && (fCutOnChild == 1) ) {
+       if ( !CheckKinematicsOnChild() ) return 0;
+    }
+  
+
     for (i = 0; i < np; i++) {
        Int_t trackIt = 0;
        TParticle *  iparticle = (TParticle *) fParticles->At(i);
@@ -938,6 +942,37 @@ Bool_t AliGenPythia::CheckTrigger(TParticle* jet1, TParticle* jet2)
     }
     return triggered;
 }
+
+
+//Checking Kinematics on Child (status code 1, particle code ?, kin cuts
+Bool_t AliGenPythia::CheckKinematicsOnChild(){
+
+    Bool_t checking = kFALSE;
+    Int_t j, kcode, ks, km;
+    Int_t nPartAcc = 0; //number of particles in the acceptance range
+    Int_t numberOfAcceptedParticles = 1;
+    if (fNumberOfAcceptedParticles != 0) { numberOfAcceptedParticles = fNumberOfAcceptedParticles; }
+    Int_t npart = fParticles->GetEntriesFast();
+    
+    for (j = 0; j<npart; j++) {  
+       TParticle *  jparticle = (TParticle *) fParticles->At(j);
+       kcode = TMath::Abs( CheckPDGCode(jparticle->GetPdgCode()) );
+       ks = jparticle->GetStatusCode();
+       km = jparticle->GetFirstMother(); 
+       
+       if( (ks == 1)  &&  (kcode == fPdgCodeParticleforAcceptanceCut)  &&  (KinematicSelection(jparticle,1)) ){
+           nPartAcc++;
+       }
+    }
+  
+    if( numberOfAcceptedParticles <= nPartAcc){
+       checking = kTRUE;
+    }
+    
+    return checking;
+    
+}
+
          
 AliGenPythia& AliGenPythia::operator=(const  AliGenPythia& rhs)
 {