1 #if !defined(__CINT__) || defined(__MAKECINT__)
8 #include <TDatabasePDG.h>
12 #include "AliRunLoader.h"
13 #include "AliHeader.h"
16 #include "AliGenAmpt.h"
23 MyHeader() : fNATT(0), fEATT(0),fJATT(0),fNT(0),fNP(0),fN0(0),fN01(0),fN10(0),fN11(0),fBB(0),fRP(0) {;}
24 virtual ~MyHeader() {;}
36 ClassDef(MyHeader,1) // My header class
39 class MyNuc : public TObject
42 MyNuc(Int_t pid=0, Int_t st=0, Int_t type=0, Double_t x=0, Double_t y=0, Double_t z=0) :
43 TObject(), fPid(pid), fSt(st), fType(type), fX(x), fY(y), fZ(z) {;}
44 Double_t X() const { return fX; }
45 Double_t Y() const { return fY; }
46 Double_t Z() const { return fZ; }
47 Int_t Pid() const { return fPid; }
48 Int_t St() const { return fSt; }
49 Int_t Type() const { return fType; }
57 ClassDef(MyNuc,1) // My nucleon class in cartesian coordinates
60 class MyPart : public TObject
63 MyPart(Int_t pid=0, Int_t st=0, Int_t type=0, Double_t pt=0, Double_t eta=0, Double_t phi=0) :
64 TObject(), fPid(pid), fSt(st), fType(type), fPt(pt), fEta(eta), fPhi(phi) {;}
65 Double_t Px() const { return fPt*TMath::Cos(fPhi); }
66 Double_t Py() const { return fPt*TMath::Sin(fPhi); }
67 Double_t Pz() const { return fPt*TMath::SinH(fEta); }
68 Double_t Pt() const { return fPt; }
69 Double_t Eta() const { return fEta; }
70 Double_t Phi() const { return fPhi; }
71 Int_t Pid() const { return fPid; }
72 Int_t St() const { return fSt; }
73 Int_t Type() const { return fType; }
81 ClassDef(MyPart,1) // My particle class in cylindrical coordinates
84 void createAmptMC(Int_t nEvents,
85 const char *outFileName = "amptout.root");
87 void anaAmptMC(Int_t nEvents,
88 const char *inFileNames = "/eliza6/alice/loizides/ampt/run_1/ampt*.root");
90 //-----------------------------------------------------------------------------------------------------
92 void createAmptMC(Int_t nEvents,
93 const char *outFileName)
95 TClass::GetClass("MyNuc")->IgnoreTObjectStreamer();
96 TClass::GetClass("MyPart")->IgnoreTObjectStreamer();
98 AliPDG::AddParticlesToPdgDataBase();
99 TDatabasePDG::Instance();
102 TFolder *folder = new TFolder("myfolder","myfolder");
103 AliRunLoader* rl = new AliRunLoader(folder);
106 AliStack* stack = rl->Stack();
107 //AliHeader* rheader = rl->GetHeader();
109 AliGenAmpt *genHi = new AliGenAmpt(-1);
110 genHi->SetStack(stack);
111 genHi->SetEnergyCMS(2760);
112 genHi->SetReferenceFrame("CMS");
113 genHi->SetProjectile("A", 208, 82);
114 genHi->SetTarget ("A", 208, 82);
115 genHi->SetPtHardMin (2);
116 genHi->SetImpactParameterRange(0.,30);
117 genHi->SetJetQuenching(0); // enable jet quenching
118 genHi->SetShadowing(1); // enable shadowing
119 genHi->SetDecaysOff(1); // neutral pion and heavy particle decays switched off
120 genHi->SetSpectators(1); // track spectators
121 genHi->SetIsoft(1); // standard AMPT
122 genHi->SetXmu(3.2264); // parton xsection
123 genHi->SetNtMax(3); // time bins
124 if (0) { //RHIC settings
125 genHi->SetAlpha(0.47140452);
126 genHi->SetStringFrag(2.2,0.5);
130 TClonesArray *inucs = new TClonesArray("TParticle",10000);
131 TClonesArray *parts = new TClonesArray("MyPart",10000);
132 TClonesArray *nucs = new TClonesArray("MyNuc",500);
133 MyHeader *myheader = new MyHeader;
135 TFile *outFile = TFile::Open(outFileName, "RECREATE");
136 outFile->SetCompressionLevel(5);
137 TDirectory::TContext context(outFile);
139 TTree *tree = new TTree("ampt", "AMPT tree");
140 tree->Branch("parts",&parts, 256*1024, 99);
141 tree->Branch("nucs",&nucs, 64*1024, 99);
142 tree->Branch("info",&myheader, 32*1024, 99);
144 // create events and fill them
145 for (Int_t iEvent = 0; iEvent < nEvents; ++iEvent) {
147 cout << "Event " << iEvent+1 << "/" << nEvents << endl;;
151 const TClonesArray *iarr = genHi->GetParticles();
153 for(Int_t i=0;i<iarr->GetEntriesFast();++i) {
154 TParticle *p = (TParticle*)iarr->At(i);
155 new((*parts)[i]) MyPart(p->GetPdgCode(),
163 TAmpt *ampt = genHi->Ampt();
165 ampt->ImportNucleons(inucs);
167 for(Int_t i=0;i<inucs->GetEntriesFast();++i) {
168 TParticle *p = (TParticle*)inucs->At(i);
169 new((*nucs)[i]) MyNuc(p->GetPdgCode(),
177 myheader->fNATT=ampt->GetNATT();
178 myheader->fEATT=ampt->GetEATT();
179 myheader->fJATT=ampt->GetJATT();
180 myheader->fNT=ampt->GetNT();
181 myheader->fNP=ampt->GetNP();
182 myheader->fN0=ampt->GetN0();
183 myheader->fN01=ampt->GetN01();
184 myheader->fN10=ampt->GetN10();
185 myheader->fN11=ampt->GetN11();
186 myheader->fBB=ampt->GetBB();
187 myheader->fRP=ampt->GetPhi();
190 } // end of event loop
195 //-----------------------------------------------------------------------------------------------------
197 void anaAmptMC(Int_t nEvents,
198 const char *inFileNames)
201 TChain *c = new TChain("ampt");
205 TClonesArray *parts = 0;
206 TClonesArray *nucs = 0;
209 c->SetBranchAddress("info",&info);
210 c->SetBranchAddress("nucs",&nucs);
211 c->SetBranchAddress("parts",&parts);
213 Int_t nRead = nEvents;
215 nRead = c->GetEntries();
216 else if (0 && (nRead>c->GetEntries()))
217 nRead = c->GetEntries();
219 for (Int_t ev=0;ev<nRead;++ev) {
222 Int_t fAN=0, fBN=0, fAStat[250], fBStat[250];
223 Double_t fXA[250], fXB[250], fYA[250], fYB[250];
224 for (Int_t k=0;k<nucs->GetEntries();++k) {
225 MyNuc *n = (MyNuc*)nucs->At(k);
239 // Glauber calculation
240 Double_t fXSect = 65; //mbarn
241 Double_t d2 = (Double_t)fXSect/(TMath::Pi()*10); // in fm^2
243 // For each of the A nucleons in nucleus B
244 for (Int_t i = 0; i<fBN; i++) {
245 for (Int_t j = 0 ; j < fAN ;j++) {
246 Double_t dx = fXB[i]-fXA[j];
247 Double_t dy = fYB[i]-fYA[j];
248 Double_t dij = dx*dx+dy*dy;
257 for (Int_t i = 0; i<fAN; i++) {
262 for (Int_t i = 0; i<fBN; i++) {
267 cout << ev << " : " << info->fBB << " np " << npart << " vs " << info->fNP+info->fNT << endl;