- Store cross-Section and number of binary collisions as a function of impact parameter
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 11 Jun 2001 13:09:23 +0000 (13:09 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 11 Jun 2001 13:09:23 +0000 (13:09 +0000)
- Pass AliGenHijingEventHeader to gAlice.

EVGEN/AliGenHijing.cxx
EVGEN/AliGenHijing.h

index b9332f3..21e5974 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.21  2001/02/28 17:35:24  morsch
+Consider elastic interactions (ks = 1 and ks = 11) as spectator (Chiara Oppedisano)
+
 Revision 1.20  2001/02/14 15:50:40  hristov
 The last particle in event marked using SetHighWaterMark
 
@@ -97,6 +100,7 @@ AliGenerator interface class to HIJING using THijing (test version)
 #include <TArrayI.h>
 #include <TParticle.h>
 #include <THijing.h>
+#include <TGraph.h>
 
 
  ClassImp(AliGenHijing)
@@ -116,15 +120,17 @@ AliGenHijing::AliGenHijing(Int_t npart)
     SetImpactParameterRange();
     SetTarget();
     SetProjectile();
-    fKeep=0;
-    fQuench=1;
-    fShadowing=1;
-    fTrigger=0;
-    fDecaysOff=1;
-    fEvaluate=0;
-    fSelectAll=0;
-    fFlavor=0;
-    fSpectators=1;
+    fKeep       = 0;
+    fQuench     = 1;
+    fShadowing  = 1;
+    fTrigger    = 0;
+    fDecaysOff  = 1;
+    fEvaluate   = 0;
+    fSelectAll  = 0;
+    fFlavor     = 0;
+    fSpectators = 1;
+    fDsigmaDb   = 0;  
+    fDnDb       = 0; 
 //
 // Set random number generator   
     sRandom = fRandom;
@@ -139,6 +145,8 @@ AliGenHijing::AliGenHijing(const AliGenHijing & Hijing)
 AliGenHijing::~AliGenHijing()
 {
 // Destructor
+    if ( fDsigmaDb) delete  fDsigmaDb;  
+    if ( fDnDb)     delete  fDnDb;  
 }
 
 void AliGenHijing::Init()
@@ -159,7 +167,6 @@ void AliGenHijing::Init()
     fHijing->SetIHPR2(6,  fShadowing);
     fHijing->SetIHPR2(12, fDecaysOff);    
     fHijing->SetIHPR2(21, fKeep);
-    fHijing->Rluset(50,0);
     fHijing->Initialize();
 
     
@@ -174,58 +181,57 @@ void AliGenHijing::Generate()
 {
 // Generate one event
 
-  Float_t polar[3] =   {0,0,0};
-  Float_t origin[3]=   {0,0,0};
-  Float_t origin0[3]=  {0,0,0};
+  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], random[6];
   Float_t tof;
 
   static TClonesArray *particles;
 //  converts from mm/c to s
-  const Float_t kconv=0.001/2.999792458e8;
+  const Float_t kconv = 0.001/2.999792458e8;
 //
-  Int_t nt=0;
-  Int_t jev=0;
+  Int_t nt  = 0;
+  Int_t jev = 0;
   Int_t j, kf, ks, imo;
-  kf=0;
+  kf = 0;
     
-  if(!particles) particles=new TClonesArray("TParticle",10000);
+  if(!particles) particles = new TClonesArray("TParticle",10000);
     
-  fTrials=0;
-  for (j=0;j<3;j++) origin0[j]=fOrigin[j];
-  if(fVertexSmear==kPerEvent) {
+  fTrials = 0;
+  for (j = 0;j < 3; j++) origin0[j] = fOrigin[j];
+  if(fVertexSmear == kPerEvent) {
        Rndm(random,6);
-       for (j=0;j<3;j++) {
-      origin0[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
+       for (j=0; j < 3; j++) {
+           origin0[j] += fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
                TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
-//             fHijing->SetMSTP(151,0);
        }
-  } else if (fVertexSmear==kPerTrack) {
+  } else if (fVertexSmear == kPerTrack) {
 //         fHijing->SetMSTP(151,0);
-    for (j=0;j<3;j++) {
+      for (j = 0; j < 3; j++) {
 //           fHijing->SetPARP(151+j, fOsigma[j]*10.);
-    }
+      }
   }
   while(1)
-    {
-
+  {
+//    Generate one event
       fHijing->GenerateEvent();
       fTrials++;
       fHijing->ImportParticles(particles,"All");
       Int_t np = particles->GetEntriesFast();
       printf("\n **************************************************%d\n",np);
-      Int_t nc=0;
+      Int_t nc = 0;
       if (np == 0 ) continue;
       Int_t i;
       Int_t * newPos = new Int_t[np];
 
-      for (i = 0; i<np; i++) *(newPos+i)=i;
+      for (i = 0; i < np; i++) *(newPos+i) = i;
 //
 //      First write parent particles
 //
 
-      for (i = 0; i<np; i++) {
-        TParticle *  iparticle       = (TParticle *) particles->At(i);
+      for (i = 0; i < np; i++) {
+         TParticle *  iparticle       = (TParticle *) particles->At(i);
 // Is this a parent particle ?
         if (Stable(iparticle)) continue;
 //
@@ -244,29 +250,29 @@ void AliGenHijing::Generate()
 // Put particle on the stack if it is either selected or it is the mother of at least one seleted particle
 //
         if (selected || hasSelectedDaughters) {
-          nc++;
-          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;
-          tof=kconv*iparticle->T();
-          imo=-1;
-          if (hasMother) {
-            imo=iparticle->GetFirstMother();
-            TParticle* mother= (TParticle *) particles->At(imo);
-            imo = (mother->GetPdgCode() != 92) ? imo=*(newPos+imo) : -1;
-          }
+           nc++;
+           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;
+           tof = kconv*iparticle->T();
+           imo = -1;
+           if (hasMother) {
+               imo = iparticle->GetFirstMother();
+               TParticle* mother = (TParticle *) particles->At(imo);
+               imo = (mother->GetPdgCode() != 92) ? imo =* (newPos+imo) : -1;
+           }
 // Put particle on the stack ... 
 //             printf("\n set track mother: %d %d %d %d %d %d ",i,imo, kf, nt+1, selected, hasSelectedDaughters);
-
-          gAlice->SetTrack(0,imo,kf,p,origin,polar,
-                           tof,kPPrimary,nt);
+           
+           gAlice->SetTrack(0,imo,kf,p,origin,polar,
+                            tof,kPPrimary,nt);
 // ... and keep it there
-          gAlice->KeepTrack(nt);
+           gAlice->KeepTrack(nt);
 //
-          *(newPos+i)=nt;
+           *(newPos+i)=nt;
         } // selected
       } // particle loop parents
 //
@@ -283,37 +289,34 @@ void AliGenHijing::Generate()
         kf        = iparticle->GetPdgCode();
         ks        = iparticle->GetStatusCode();
         if (!fSelectAll) {
-          selected = KinematicSelection(iparticle)&&SelectFlavor(kf);
-         if (!fSpectators && selected) selected = (ks != 0 && ks != 1 && ks != 10
-                                                   && ks != 11);
+           selected = KinematicSelection(iparticle)&&SelectFlavor(kf);
+           if (!fSpectators && selected) selected = (ks != 0 && ks != 1 && ks != 10
+                                                     && ks != 11);
         }
 //
 // Put particle on the stack if selected
 //
         if (selected) {
-          nc++;
-          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;
-          tof=kconv*iparticle->T();
-          imo=-1;
-        
-          if (hasMother) {
-            imo=iparticle->GetFirstMother();
-            TParticle* mother= (TParticle *) particles->At(imo);
-            imo = (mother->GetPdgCode() != 92) ? imo=*(newPos+imo) : -1;
-          }   
+           nc++;
+           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;
+           tof = kconv*iparticle->T();
+           imo = -1;
+           
+           if (hasMother) {
+               imo = iparticle->GetFirstMother();
+               TParticle* mother = (TParticle *) particles->At(imo);
+               imo = (mother->GetPdgCode() != 92) ? imo=*(newPos+imo) : -1;
+           }   
 // Put particle on the stack
-          gAlice->SetTrack(fTrackIt,imo,kf,p,origin,polar,
-                           tof,kPNoProcess,nt);
-//                                 tof,"Secondary",nt);
-
-//             printf("\n set track final: %d %d %d",imo, kf, nt);
-          gAlice->KeepTrack(nt);
-          *(newPos+i)=nt;
+           gAlice->SetTrack(fTrackIt,imo,kf,p,origin,polar,
+                            tof,kPNoProcess,nt);
+           gAlice->KeepTrack(nt);
+           *(newPos+i)=nt;
         } // selected
       } // particle loop final state
  
@@ -321,29 +324,30 @@ void AliGenHijing::Generate()
 
       printf("\n I've put %i particles on the stack \n",nc);
       if (nc > 0) {
-        jev+=nc;
-        if (jev >= fNpart || fNpart == -1) {
-          fKineBias=Float_t(fNpart)/Float_t(fTrials);
-          printf("\n Trials: %i %i %i\n",fTrials, fNpart, jev);
-          break;
-        }
+         jev += nc;
+         if (jev >= fNpart || fNpart == -1) {
+             fKineBias = Float_t(fNpart)/Float_t(fTrials);
+             printf("\n Trials: %i %i %i\n",fTrials, fNpart, jev);
+             break;
+         }
       }
-    } // event loop
-  fHijing->Rluget(50,-1);
+  } // event loop
+  MakeHeader();
+  
   gAlice->SetHighWaterMark(nt);
 }
 
 Bool_t AliGenHijing::KinematicSelection(TParticle *particle)
 {
 // Perform kinematic selection
-    Double_t px=particle->Px();
-    Double_t py=particle->Py();
-    Double_t pz=particle->Pz();
-    Double_t  e=particle->Energy();
+    Double_t px = particle->Px();
+    Double_t py = particle->Py();
+    Double_t pz = particle->Pz();
+    Double_t  e = particle->Energy();
 
 //
 //  transverse momentum cut    
-    Double_t pt=TMath::Sqrt(px*px+py*py);
+    Double_t pt = TMath::Sqrt(px*px+py*py);
     if (pt > fPtMax || pt < fPtMin) 
     {
 //     printf("\n failed pt cut %f %f %f \n",pt,fPtMin,fPtMax);
@@ -351,7 +355,7 @@ Bool_t AliGenHijing::KinematicSelection(TParticle *particle)
     }
 //
 // momentum cut
-    Double_t p=TMath::Sqrt(px*px+py*py+pz*pz);
+    Double_t p = TMath::Sqrt(px*px+py*py+pz*pz);
     if (p > fPMax || p < fPMin) 
     {
 //     printf("\n failed p cut %f %f %f \n",p,fPMin,fPMax);
@@ -371,8 +375,8 @@ Bool_t AliGenHijing::KinematicSelection(TParticle *particle)
 //
 // rapidity cut
     Double_t y;
-    if(e<=pz) y = 99;
-    else if (e<=-pz)  y = -99;
+    if(e <= pz) y = 99;
+    else if (e <= -pz)  y = -99;
     else y = 0.5*TMath::Log((e+pz)/(e-pz));
     if (y > fYMax || y < fYMin)
     {
@@ -401,46 +405,64 @@ void AliGenHijing::EvaluateCrossSections()
 {
 //     Glauber Calculation of geometrical x-section
 //
-    Float_t xTot=0.;          // barn
-    Float_t xTotHard=0.;      // barn 
-    Float_t xPart=0.;         // barn
-    Float_t xPartHard=0.;     // barn 
-    Float_t sigmaHard=0.1;    // mbarn
-    Float_t bMin=0.;
-    Float_t bMax=fHijing->GetHIPR1(34)+fHijing->GetHIPR1(35);
-    const Float_t kdib=0.2;
-    Int_t   kMax=Int_t((bMax-bMin)/kdib)+1;
+    Float_t xTot       = 0.;          // barn
+    Float_t xTotHard   = 0.;          // barn 
+    Float_t xPart      = 0.;          // barn
+    Float_t xPartHard  = 0.;          // barn 
+    Float_t sigmaHard  = 0.1;         // mbarn
+    Float_t bMin       = 0.;
+    Float_t bMax       = fHijing->GetHIPR1(34)+fHijing->GetHIPR1(35);
+    const Float_t kdib = 0.2;
+    Int_t   kMax       = Int_t((bMax-bMin)/kdib)+1;
 
 
     printf("\n Projectile Radius (fm): %f \n",fHijing->GetHIPR1(34));
     printf("\n Target     Radius (fm): %f \n",fHijing->GetHIPR1(35));    
     Int_t i;
-    Float_t oldvalue=0.;
+    Float_t oldvalue= 0.;
+
+    Float_t* b   = new Float_t[kMax];
+    Float_t* si1 = new Float_t[kMax];    
+    Float_t* si2 = new Float_t[kMax];    
     
-    for (i=0; i<kMax; i++)
+    for (i = 0; i < kMax; i++)
     {
-       Float_t xb=bMin+i*kdib;
+       Float_t xb  = bMin+i*kdib;
        Float_t ov;
        ov=fHijing->Profile(xb);
-       Float_t gb =  2.*0.01*fHijing->GetHIPR1(40)*kdib*xb*(1.-TMath::Exp(-fHijing->GetHINT1(12)*ov));
-       Float_t gbh = 2.*0.01*fHijing->GetHIPR1(40)*kdib*xb*sigmaHard*ov;
+       Float_t gb  =  2.*0.01*fHijing->GetHIPR1(40)*kdib*xb*(1.-TMath::Exp(-fHijing->GetHINT1(12)*ov));
+       Float_t gbh =  2.*0.01*fHijing->GetHIPR1(40)*kdib*xb*sigmaHard*ov;
        xTot+=gb;
-       xTotHard+=gbh;
+       xTotHard += gbh;
        if (xb > fMinImpactParam && xb < fMaxImpactParam)
        {
-           xPart+=gb;
-           xPartHard+=gbh;
+           xPart += gb;
+           xPartHard += gbh;
        }
        
        if(oldvalue) if ((xTot-oldvalue)/oldvalue<0.0001) break;
-       oldvalue=xTot;
+       oldvalue = xTot;
        printf("\n Total cross section (barn): %d %f %f \n",i, xb, xTot);
        printf("\n Hard  cross section (barn): %d %f %f \n\n",i, xb, xTotHard);
+       if (i>0) {
+           si1[i] = gb/kdib;
+           si2[i] = gbh/gb;
+           b[i]  = xb;
+       }
     }
+
     printf("\n Total cross section (barn): %f \n",xTot);
     printf("\n Hard  cross section (barn): %f \n \n",xTotHard);
     printf("\n Partial       cross section (barn): %f %f \n",xPart, xPart/xTot*100.);
     printf("\n Partial  hard cross section (barn): %f %f \n",xPartHard, xPartHard/xTotHard*100.);
+
+//  Store result as a graph
+    b[0] = 0;
+    si1[0] = 0;
+    si2[0]=si2[1];
+    
+    fDsigmaDb  = new TGraph(i, b, si1);
+    fDnDb      = new TGraph(i, b, si2);
 }
 
 Bool_t AliGenHijing::DaughtersSelection(TParticle* iparticle, TClonesArray* particles)
@@ -449,17 +471,17 @@ Bool_t AliGenHijing::DaughtersSelection(TParticle* iparticle, TClonesArray* part
 // Looks recursively if one of the daughters has been selected
 //
 //    printf("\n Consider daughters %d:",iparticle->GetPdgCode());
-    Int_t imin=-1;
-    Int_t imax=-1;
+    Int_t imin = -1;
+    Int_t imax = -1;
     Int_t i;
-    Bool_t hasDaughters= (iparticle->GetFirstDaughter() >=0);
-    Bool_t selected=kFALSE;
+    Bool_t hasDaughters = (iparticle->GetFirstDaughter() >=0);
+    Bool_t selected = kFALSE;
     if (hasDaughters) {
-       imin=iparticle->GetFirstDaughter();
-       imax=iparticle->GetLastDaughter();       
-       for (i=imin; i<= imax; i++){
-           TParticle *  jparticle       = (TParticle *) particles->At(i);      
-           Int_t ip=jparticle->GetPdgCode();
+       imin = iparticle->GetFirstDaughter();
+       imax = iparticle->GetLastDaughter();       
+       for (i = imin; i <= imax; i++){
+           TParticle *  jparticle = (TParticle *) particles->At(i);    
+           Int_t ip = jparticle->GetPdgCode();
            if (KinematicSelection(jparticle)&&SelectFlavor(ip)) {
                selected=kTRUE; break;
            }
@@ -468,7 +490,6 @@ Bool_t AliGenHijing::DaughtersSelection(TParticle* iparticle, TClonesArray* part
     } else {
        return kFALSE;
     }
-
     return selected;
 }
 
@@ -481,7 +502,7 @@ Bool_t AliGenHijing::SelectFlavor(Int_t pid)
 // 5: beauty
     if (fFlavor == 0) return kTRUE;
     
-    Int_t ifl=TMath::Abs(pid/100);
+    Int_t ifl = TMath::Abs(pid/100);
     if (ifl > 10) ifl/=10;
     return (fFlavor == ifl);
 }
@@ -504,19 +525,18 @@ Bool_t AliGenHijing::Stable(TParticle*  particle)
 void AliGenHijing::MakeHeader()
 {
 // Builds the event header, to be called after each event
-    AliGenHijingEventHeader* header = new AliGenHijingEventHeader("Hijing");
-//    header->SetDate(date);
-//    header->SetRunNumber(run);
-//    header->SetEventNumber(event);
-    header->SetNProduced(fHijing->GetNATT());
-    header->SetImpactParameter(fHijing->GetHINT1(19));
-    header->SetTotalEnergy(fHijing->GetEATT());
-    header->SetHardScatters(fHijing->GetJATT());
-    header->SetParticipants(fHijing->GetNP(), fHijing->GetNT());
-    header->SetCollisions(fHijing->GetN0(),
+    AliGenEventHeader* header = new AliGenHijingEventHeader("Hijing");
+   ((AliGenHijingEventHeader*) header)->SetNProduced(fHijing->GetNATT());
+   ((AliGenHijingEventHeader*) header)->SetImpactParameter(fHijing->GetHINT1(19));
+   ((AliGenHijingEventHeader*) header)->SetTotalEnergy(fHijing->GetEATT());
+   ((AliGenHijingEventHeader*) header)->SetHardScatters(fHijing->GetJATT());
+   ((AliGenHijingEventHeader*) header)->SetParticipants(fHijing->GetNP(), fHijing->GetNT());
+   ((AliGenHijingEventHeader*) header)->SetCollisions(fHijing->GetN0(),
                          fHijing->GetN01(),
                          fHijing->GetN10(),
                          fHijing->GetN11());
+   gAlice->SetGenEventHeader(header);
+   
 }
 
 AliGenHijing& AliGenHijing::operator=(const  AliGenHijing& rhs)
index 542c809..2beee69 100644 (file)
@@ -17,6 +17,7 @@ class THijing;
 class TArrayI;
 class TParticle;
 class TClonesArray;
+class TGraph;
 
 class AliGenHijing : public AliGenerator
 {
@@ -59,6 +60,8 @@ class AliGenHijing : public AliGenerator
     AliGenHijing &  operator=(const AliGenHijing & rhs);
 // Physics Routines        
     virtual void EvaluateCrossSections();
+    virtual TGraph* CrossSection()     {return fDsigmaDb;}
+    virtual TGraph* BinaryCollisions() {return fDnDb;}    
  protected:
     Bool_t SelectFlavor(Int_t pid);
     void   MakeHeader();
@@ -91,7 +94,8 @@ class AliGenHijing : public AliGenerator
     Float_t     fPtHardMin;      // lower pT-hard cut 
     Float_t     fPtHardMax;      // higher pT-hard cut
     Int_t       fSpectators;     // put spectators on stack
-
+    TGraph*     fDsigmaDb;       // dSigma/db for the system
+    TGraph*     fDnDb;           // dNBinaryCollisions/db    
  private:
     // check if particle is selected as parent particle
     Bool_t ParentSelected(Int_t ip);