From aa9da5009bf22dca3882efdf6f00281641c8bbd8 Mon Sep 17 00:00:00 2001 From: morsch Date: Tue, 5 Jan 2010 09:55:17 +0000 Subject: [PATCH] Event header is created and written. --- THerwig/AliGenHerwig.cxx | 79 +++++++++++++++++++++++++++------------- THerwig/AliGenHerwig.h | 7 ++-- THerwig/THerwig6.cxx | 2 +- THerwig/THerwig6.h | 3 +- 4 files changed, 61 insertions(+), 30 deletions(-) diff --git a/THerwig/AliGenHerwig.cxx b/THerwig/AliGenHerwig.cxx index eada69cb627..d6d2f76dcb1 100644 --- a/THerwig/AliGenHerwig.cxx +++ b/THerwig/AliGenHerwig.cxx @@ -28,6 +28,7 @@ #include #include "AliGenHerwig.h" +#include "AliGenHerwigEventHeader.h" #include "AliHerwigRndm.h" #include "AliMC.h" #include "AliRun.h" @@ -69,7 +70,8 @@ ClassImp(AliGenHerwig) fEtaMinGamma(-20.), fEtaMaxGamma(20.), fPhiMinGamma(0.), - fPhiMaxGamma(2. * TMath::Pi()) + fPhiMaxGamma(2. * TMath::Pi()), + fHeader(0) { // Constructor fEnergyCMS = 14000; @@ -107,8 +109,9 @@ AliGenHerwig::AliGenHerwig(Int_t npart) fPhiMaxParton(2.* TMath::Pi()), fEtaMinGamma(-20.), fEtaMaxGamma(20.), - fPhiMinGamma(0.), - fPhiMaxGamma(2. * TMath::Pi()) + fPhiMinGamma(0.), + fPhiMaxGamma(2. * TMath::Pi()), + fHeader(0) { fEnergyCMS = 14000; SetTarget(); @@ -267,10 +270,9 @@ void AliGenHerwig::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 p[4], random[6]; + Float_t polar[3] = {0,0,0}; + Float_t origin[3] = {0,0,0}; + Float_t p[4]; static TClonesArray *particles; // converts from mm/c to s @@ -278,20 +280,15 @@ void AliGenHerwig::Generate() // Int_t nt=0; Int_t jev=0; - Int_t j, kf, ks, imo; + Int_t kf, ks, imo; kf=0; if(!particles) particles=new TClonesArray("TParticle",10000); 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())* - TMath::Sqrt(-2*TMath::Log(random[2*j+1])); - } - } + + // Set collision vertex position + if (fVertexSmear == kPerEvent) Vertex(); while(1) { @@ -304,9 +301,9 @@ void AliGenHerwig::Generate() //Check hard partons or direct gamma in kine range if (fProcess == kHeJets || fProcess == kHeDirectGamma) { - TParticle* parton1 = (TParticle *) particles->At(6); - TParticle* parton2 = (TParticle *) particles->At(7); - if (!CheckParton(parton1, parton2)) continue ; + TParticle* parton1 = (TParticle *) particles->At(6); + TParticle* parton2 = (TParticle *) particles->At(7); + if (!CheckParton(parton1, parton2)) continue ; } // @@ -317,8 +314,9 @@ void AliGenHerwig::Generate() } - Int_t nc=0; - + Int_t nc = 0; + fNprimaries = 0; + Int_t * newPos = new Int_t[np]; for (Int_t i = 0; iPy(); p[2]=iparticle->Pz(); p[3]=iparticle->Energy(); - origin[0]=origin0[0]+iparticle->Vx()/10; - origin[1]=origin0[1]+iparticle->Vy()/10; - origin[2]=origin0[2]+iparticle->Vz()/10; + + origin[0] = fVertex[0] + iparticle->Vx()/10; // [cm] + origin[1] = fVertex[1] + iparticle->Vy()/10; // [cm] + origin[2] = fVertex[2] + iparticle->Vz()/10; // [cm] + Float_t tof = kconv*iparticle->T(); Int_t iparent = (imo > -1) ? newPos[imo] : -1; Int_t trackIt = (ks == 1) && fTrackIt; @@ -349,10 +349,10 @@ void AliGenHerwig::Generate() kPPrimary, nt, fHerwig->GetEVWGT(), ks); KeepTrack(nt); newPos[i]=nt; + fNprimaries++; } // end of if: selection of particle } // end of for: particle loop if (newPos) delete[] newPos; - // MakeHeader(); if (nc > 0) { jev+=nc; if (jev >= fNpart || fNpart == -1) { @@ -361,6 +361,9 @@ void AliGenHerwig::Generate() } } } +// + MakeHeader(); +// SetHighWaterMark(nt); // adjust weight due to kinematic selection AdjustWeights(); @@ -502,3 +505,29 @@ void AliGenHerwig::FinishRunJimmy() } + +void AliGenHerwig::MakeHeader() +{ +// +// Make header for the simulated event +// + if (fHeader) delete fHeader; + fHeader = new AliGenHerwigEventHeader("Herwig"); +// +// Event type + ((AliGenHerwigEventHeader*) fHeader)->SetProcessType(fHerwig->GetIHPRO()); +// +// Number of trials + ((AliGenHerwigEventHeader*) fHeader)->SetTrials(fTrials); +// +// Event Vertex + fHeader->SetPrimaryVertex(fVertex); + +// +// Number of primaries + fHeader->SetNProduced(fNprimaries); +// Pass header +// + AddHeader(fHeader); + fHeader = 0x0; +} diff --git a/THerwig/AliGenHerwig.h b/THerwig/AliGenHerwig.h index d3a706ee194..04f5eadbaf1 100644 --- a/THerwig/AliGenHerwig.h +++ b/THerwig/AliGenHerwig.h @@ -17,6 +17,7 @@ #include class THerwig6; +class AliGenHerwigEventHeader; class TArrayI; class TParticle; class TClonesArray; @@ -82,11 +83,11 @@ class AliGenHerwig : public AliGenMC protected: Bool_t SelectFlavor(Int_t pid); - + void MakeHeader(); protected: TString fAutPDF; // PDF group Int_t fModPDF; // PDF set - StrucFunc_t fStrucFunc; //Structure Function + StrucFunc_t fStrucFunc; // Structure Function Int_t fKeep; // Flag to keep full event information Int_t fDecaysOff; // Flag to turn off decays of pi0, K_s, D, Lambda, sigma Int_t fTrigger; // Trigger type @@ -116,7 +117,7 @@ class AliGenHerwig : public AliGenMC Float_t fEtaMaxGamma; // Maximum eta of triggered gamma Float_t fPhiMinGamma; // Minimum phi of triggered gamma Float_t fPhiMaxGamma; // Maximum phi of triggered gamma - + AliGenHerwigEventHeader* fHeader; //! Event header private: AliGenHerwig(const AliGenHerwig &Herwig); AliGenHerwig & operator=(const AliGenHerwig & rhs); diff --git a/THerwig/THerwig6.cxx b/THerwig/THerwig6.cxx index f29f1438393..a56f07c2951 100644 --- a/THerwig/THerwig6.cxx +++ b/THerwig/THerwig6.cxx @@ -687,7 +687,7 @@ double THerwig6::GetYBMAX () const { return HWHARD.YBMAX; } void THerwig6::SetYBMAX (double d) { HWHARD.YBMAX = d; } double THerwig6::GetZJMAX () const { return HWHARD.ZJMAX; } void THerwig6::SetZJMAX (double d) { HWHARD.ZJMAX = d; } - +int THerwig6::GetIHPRO () const { return HWHARD.IHPRO; } // /HWPROP/ double THerwig6::GetRMASS (int i) const { return HWPROP.RMASS[i]; } void THerwig6::SetRMASS (int i, double r) { HWPROP.RMASS[i] = r; } diff --git a/THerwig/THerwig6.h b/THerwig/THerwig6.h index 06d6246f015..8ecddf43264 100644 --- a/THerwig/THerwig6.h +++ b/THerwig/THerwig6.h @@ -173,7 +173,8 @@ public: void SetYBMAX (double d); double GetZJMAX () const; void SetZJMAX (double d); - + int GetIHPRO () const; + // /HWPROP/ double GetRMASS (int i) const; void SetRMASS (int i, double r); -- 2.39.3