]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/testJetFinder.C
Moved the EMCAL back to 60 < phi < 180
[u/mrichter/AliRoot.git] / EMCAL / testJetFinder.C
1 void testJetFinder(Int_t evNumber1=0, Int_t evNumber2=0) 
2 {
3 //*-- Author: Andreas Morsch (CERN)
4 // Dynamically link some shared libs                    
5     if (gClassTable->GetID("AliRun") < 0) {
6         gROOT->LoadMacro("../macros/loadlibs.C");
7         loadlibs();
8     }
9 // Connect the Root Galice file containing Geometry, Kine and Hits
10
11     TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
12
13     
14     if (!file) {
15         printf("\n Creating galice.root \n");
16         file = new TFile("galice.root", "update");
17     } else {
18         printf("\n galice.root found in file list");
19     }
20     
21 // Get AliRun object from file or create it if not on file
22     if (!gAlice) {
23         gAlice = (AliRun*)(file->Get("gAlice"));
24         if (gAlice) printf("AliRun object found on file\n");
25         if (!gAlice) {
26             printf("\n create new gAlice object");
27             gAlice = new AliRun("gAlice","Alice test program");
28         }
29     }
30 //
31 //  Create and configure jet finder
32     AliEMCALJetFinder* jetFinder = 
33         new AliEMCALJetFinder("UA1 Jet Finder", "Test");
34     jetFinder->SetDebug(1);
35     jetFinder->SetConeRadius(0.5);
36     jetFinder->SetEtSeed(4.);
37     jetFinder->SetMinJetEt(10.);
38     jetFinder->SetMinCellEt(1.);
39     jetFinder->SetPtCut(2.);
40 //    jetFinder->SetMomentumSmearing(1);
41 //    jetFinder->SetEfficiencySim(1);
42     jetFinder->SetHadronCorrection(0);
43 //    jetFinder->SetHadronCorrector(AliEMCALHadronCorrectionv0::Instance());
44     jetFinder->SetSamplingFraction(12.9);
45 //
46 //  I/O
47     jetFinder->SetOutputFileName("jets.root");
48 //
49 //  Initialization    
50     jetFinder->Init();
51 //
52 //   Loop over events 
53 //
54
55     Int_t nhit=0;
56     for (Int_t nev = evNumber1; nev<= evNumber2; nev++) {
57         file->cd();
58         Int_t nparticles = gAlice->GetEvent(nev);
59         if (nev < evNumber1) continue;
60         if (nparticles <= 0) return;
61 // ECAL information     
62         jetFinder->FillFromHits();
63 //      jetFinder->FillFromDigits();
64 // TPC  information
65         jetFinder->FillFromTracks(1, 0);
66 //                                ^ preserves info from hit
67
68 // TPC  information from Hits associated to the EMCAL
69 //      jetFinder->FillFromHitFlaggedTracks(1);
70 //  
71         jetFinder->Find();
72
73 //
74 // Look at results
75         printf("\n Test Jets: %d\n", jetFinder->Njets());
76         Int_t njet = jetFinder->Njets();
77         for (Int_t nj=0; nj<njet; nj++)
78         {
79             printf("\n Jet Energy %5d %8.2f \n", 
80                    nj, jetFinder->JetEnergy(nj));
81             printf("\n Jet Phi    %5d %8.2f %8.2f \n", 
82                    nj, jetFinder->JetPhiL(nj), jetFinder->JetPhiW(nj));
83             printf("\n Jet Eta    %5d %8.2f %8.2f \n", 
84                    nj, jetFinder->JetEtaL(nj), jetFinder->JetEtaW(nj));
85         }
86 //      TCanvas *c1 = new TCanvas("c1","Canvas 1",400,10,600,700);
87 //      (jetFinder->GetLego())->Draw();
88     } // event loop
89 }
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105