Possibility of vertex cut added.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Oct 2001 08:45:42 +0000 (08:45 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 8 Oct 2001 08:45:42 +0000 (08:45 +0000)
EVGEN/AliGenPythia.cxx
EVGEN/AliGenPythia.h

index 78fa83a..3336bc4 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.40  2001/09/25 11:30:23  morsch
+Pass event vertex to header.
+
 Revision 1.39  2001/07/27 17:09:36  morsch
 Use local SetTrack, KeepTrack and SetHighWaterMark methods
 to delegate either to local stack or to stack owned by AliRun.
@@ -250,9 +253,9 @@ void AliGenPythia::Generate()
 {
 // Generate one event
     fDecayer->ForceDecay();
+
     Float_t polar[3]   =   {0,0,0};
     Float_t origin[3]  =   {0,0,0};
-    Float_t origin0[3] =   {0,0,0};
     Float_t p[3];
 //  converts from mm/c to s
     const Float_t kconv=0.001/2.999792458e8;
@@ -263,7 +266,6 @@ void AliGenPythia::Generate()
     fTrials=0;
 
 //  Set collision vertex position 
-    for (j=0;j<3;j++) origin0[j]=fOrigin[j];
     if(fVertexSmear==kPerEvent) {
        fPythia->SetMSTP(151,1);
        for (j=0;j<3;j++) {
@@ -287,6 +289,16 @@ void AliGenPythia::Generate()
        Int_t i;
        
        Int_t np = fParticles->GetEntriesFast();
+       if (np == 0 ) continue;
+// Get event vertex and discard the event if the Z coord. is too big   
+       TParticle *  iparticle = (TParticle *) fParticles->At(0);
+       Float_t distz = iparticle->Vz()/10. - fOrigin.At(2);
+       if(TMath::Abs(distz)>fCutVertexZ)continue;
+//
+       fEventVertex[0] = iparticle->Vx()/10.;
+       fEventVertex[1] = iparticle->Vy()/10.;  
+       fEventVertex[2] = iparticle->Vz()/10.;
+//
        Int_t* pParent   = new Int_t[np];
        Int_t* pSelected = new Int_t[np];
        Int_t* trackIt   = new Int_t[np];
@@ -296,14 +308,6 @@ void AliGenPythia::Generate()
        }
        printf("\n **************************************************%d\n",np);
        Int_t nc = 0;
-       if (np == 0 ) continue;
-// Get event vertex    
-       TParticle* iparticle;
-       iparticle = (TParticle *) fParticles->At(0);
-       fEventVertex[0] = iparticle->Vx()/10.;
-       fEventVertex[1] = iparticle->Vy()/10.;  
-       fEventVertex[2] = iparticle->Vz()/10.;
-//
        if (fProcess != kPyMb && fProcess != kPyJets && fProcess != kPyDirectGamma) {
            for (i = 0; i<np-1; i++) {
                iparticle = (TParticle *) fParticles->At(i);
@@ -400,16 +404,15 @@ void AliGenPythia::Generate()
                    if (!pSelected[i]) continue;
                    TParticle *  iparticle = (TParticle *) fParticles->At(i);
                    kf = CheckPDGCode(iparticle->GetPdgCode());
-                   p[0]=iparticle->Px();
-                   p[1]=iparticle->Py();
-                   p[2]=iparticle->Pz();
-                   origin[0]=origin0[0]+iparticle->Vx()/10.;
-                   origin[1]=origin0[1]+iparticle->Vy()/10.;
-                   origin[2]=origin0[2]+iparticle->Vz()/10.;
-                   Float_t tof=kconv*iparticle->T();
-                   Int_t ipa = iparticle->GetFirstMother()-1;
+                   p[0] = iparticle->Px();
+                   p[1] = iparticle->Py();
+                   p[2] = iparticle->Pz();
+                   origin[0] = fOrigin[0]+iparticle->Vx()/10.;
+                   origin[1] = fOrigin[1]+iparticle->Vy()/10.;
+                   origin[2] = fOrigin[2]+iparticle->Vz()/10.;
+                   Float_t tof   = kconv*iparticle->T();
+                   Int_t ipa     = iparticle->GetFirstMother()-1;
                    Int_t iparent = (ipa > -1) ? pParent[ipa] : -1;
-//                 printf("\n SetTrack %d %d %d %d", i, iparent, kf, trackIt[i]);
                    SetTrack(fTrackIt*trackIt[i] ,
                                     iparent, kf, p, origin, polar, tof, kPPrimary, nt, 1.);
                    pParent[i] = nt;
@@ -443,7 +446,6 @@ Int_t  AliGenPythia::GenerateMB()
     Float_t p[3];
     Float_t polar[3]   =   {0,0,0};
     Float_t origin[3]  =   {0,0,0};
-    Float_t origin0[3] =   {0,0,0};
 //  converts from mm/c to s
     const Float_t kconv=0.001/2.999792458e8;
     
@@ -470,15 +472,15 @@ Int_t  AliGenPythia::GenerateMB()
 
 //
 // store track information
-           p[0]=iparticle->Px();
-           p[1]=iparticle->Py();
-           p[2]=iparticle->Pz();
-           origin[0]=origin0[0]+iparticle->Vx()/10.;
-           origin[1]=origin0[1]+iparticle->Vy()/10.;
-           origin[2]=origin0[2]+iparticle->Vz()/10.;
+           p[0] = iparticle->Px();
+           p[1] = iparticle->Py();
+           p[2] = iparticle->Pz();
+           origin[0] = fOrigin[0]+iparticle->Vx()/10.;
+           origin[1] = fOrigin[1]+iparticle->Vy()/10.;
+           origin[2] = fOrigin[2]+iparticle->Vz()/10.;
            Float_t tof=kconv*iparticle->T();
            SetTrack(fTrackIt*trackIt, iparent, kf, p, origin, polar,
-                    tof, kPPrimary, nt);
+                        tof, kPPrimary, nt);
            KeepTrack(nt);
            pParent[i] = nt;
        } // select particle
index 957c3ee..5e8ee9d 100644 (file)
@@ -22,6 +22,9 @@ class AliGenPythia : public AliGenMC
     virtual ~AliGenPythia();
     virtual void    Generate();
     virtual void    Init();
+    // set a cut on the Z coord. of the primary vertex (cm)
+    virtual void    SetCutVertexZ(Float_t cut=999999.) {fCutVertexZ = cut;}
+    //
     virtual void    SetEventListRange(Int_t eventFirst=-1, Int_t eventLast=-1);
     // select process type
     virtual void    SetProcess(Process_t proc = kPyCharm) {fProcess = proc;}
@@ -63,7 +66,7 @@ class AliGenPythia : public AliGenMC
     Int_t       fDebugEventFirst; //!First event to debug
     Int_t       fDebugEventLast;  //!Last  event to debug
     TArrayF     fEventVertex;     //!The current event vertex
-    
+    Float_t     fCutVertexZ;      //cut on Z vertex position (cm)
  private:
     // adjust the weight from kinematic cuts
     void   AdjustWeights();