1 void run(Int_t nEvent = 50, Float_t e_cms = 2760) {
3 // example macro for on-the-fly generation of PYTHIA6 events
4 // and analysis with new reader interface and FastJet
7 gSystem->Load("libANALYSIS");
8 gSystem->Load("libANALYSISalice");
9 gSystem->Load("libCGAL");
10 gSystem->Load("libfastjet");
11 gSystem->Load("libsiscone");
12 gSystem->Load("libSISConePlugin");
13 gSystem->Load("libJETANdev");
14 gSystem->Load("libFASTJETANdev");
16 gSystem->Load("libpythia6.so");
17 gSystem->Load("libEGPythia6.so");
18 gSystem->Load("libAliPythia6.so");
21 AliPDG::AddParticlesToPdgDataBase(); // to add some PDF codes to TDatabasePDG
23 // Create random number generator and set seed
24 AliPythiaRndm::SetPythiaRandom(new TRandom3());
25 AliPythiaRndm::GetPythiaRandom()->SetSeed(clock()+gSystem->GetPid());
27 AliPythia6 *pythia=AliPythia6::Instance();
29 pythia->SetCKIN(3,10); // minimum hard pt
30 pythia->SetCKIN(4,1000); // maximum hard pt
32 pythia->SetMDCY(pythia->Pycomp(111),1,0); // switch off pi0 decay
34 pythia->Initialize("CMS","p","p",e_cms);
37 AliFastJetHeaderV1 *header = new AliFastJetHeaderV1;
39 header->SetRadius(0.4);
40 //header->SetGhostEtaMax(2);
41 //header->SetGhostArea(0.05);
42 header->SetAlgorithm(2); // antikt_algorithm = 2, kt = 0 (see fastjet/fastjet/JetDefinition.hh
44 AliFastJetFinder *FastJet = new AliFastJetFinder;
45 FastJet->SetJetHeader(header);
47 AliAODEvent *aod = new AliAODEvent();
48 aod->CreateStdContent();
49 FastJet->ConnectAOD(aod);
51 AliJetCalTrkEvent JetFinderEvent(0,1);
52 TClonesArray *plist = new TClonesArray("TParticle");
53 TClonesArray aliplist("AliMCParticle",1000);
55 for (Int_t iEvent = 0; iEvent < nEvent; iEvent++) {
57 TProcessID::SetObjectCount(0); // Needed for TRefs in AliCalTrkTrack and AliAODJet
59 pythia->GenerateEvent();
61 pythia->GetParticles(plist);
64 JetFinderEvent.Clear();
66 Int_t n_part = plist->GetEntries();
67 for (Int_t i_part = 0; i_part < n_part; i_part++) {
68 part=(TParticle*) plist->At(i_part);
70 if (part->GetStatusCode() >= 10) // Not a final state particle
73 new (aliplist[i_part]) AliMCParticle(part);
75 JetFinderEvent.AddCalTrkTrackKine((AliMCParticle*)aliplist[i_part],1,1);
80 FastJet->SetCalTrkEvent(JetFinderEvent);
81 FastJet->ProcessEvent();
82 if (aod->GetNJets() > 0) {
83 cout << "event " << iEvent << " " << aod->GetNJets() << " jets found" << endl;
84 for (Int_t iJet = 0; iJet < aod->GetNJets(); iJet++) {
85 jet = aod->GetJet(iJet);
86 cout << "\t jet " << iJet << " pt " << jet->Pt() << " eta " << jet->Eta() << " phi " << jet->Phi() << endl;