]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/testJetFinderBg.C
GeVSim is a simple Monte-Carlo event generator based on the definition of Star MevSim...
[u/mrichter/AliRoot.git] / EMCAL / testJetFinderBg.C
1 void testJetFinderBg(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 //
10 //  Create and configure JetFinder
11 //
12     AliEMCALJetFinder* jetFinder = 
13         new AliEMCALJetFinder("UA1 Jet Finder", "Test");
14 //
15 //  Debug
16     jetFinder->SetDebug(1);
17 //
18 //  Input and fast simulation
19     jetFinder->SetPtCut(2.);
20     jetFinder->SetIncludeK0andN(0);
21 //    jetFinder->SetMomentumSmearing(1);
22 //    jetFinder->SetEfficiencySim(1);
23     jetFinder->SetHadronCorrection(0);
24 //    jetFinder->SetHadronCorrector(AliEMCALHadronCorrectionv0::Instance());
25     jetFinder->SetSamplingFraction(12.9);
26 //
27 //  Parameters for jet finding
28     jetFinder->SetConeRadius(0.5);
29     jetFinder->SetEtSeed(4.);
30     jetFinder->SetMinJetEt(10.);
31     jetFinder->SetMinCellEt(1.);
32
33 //.............
34 //            |
35 //            |
36 //            V
37 //  This part will go into class
38 //
39 //  Open background file
40 //
41 // 
42     printf("\n Opening Background File !!\n");
43     
44     TFile* fileB =  new TFile("bg.root");
45     gAlice = (AliRun*)(fileB->Get("gAlice"));
46     Int_t nparticles = gAlice->GetEvent(0);
47     // Read and save background event
48     jetFinder->FillFromHits();
49     jetFinder->FillFromTracks();
50     jetFinder->SaveBackgroundEvent();
51     delete gAlice;    
52
53
54 //
55 //   Open signal file
56 //
57     printf("\n Opening Signal file !!\n");
58     TFile* fileS =  new TFile("galice.root", "update");
59     gAlice = (AliRun*)(fileS->Get("gAlice"));
60     
61 //
62 //   Loop over signal events 
63 //
64
65     Int_t nhit=0;
66     for (Int_t nev = evNumber1; nev<= evNumber2; nev++) {
67         Int_t nparticles = gAlice->GetEvent(nev);
68         if (nev < evNumber1) continue;
69         if (nparticles <= 0) return;
70 // Load background
71         jetFinder->InitFromBackground();
72 // ECAL information     
73         jetFinder->FillFromHits(1);
74 //                              ^ preserves info from background
75 //      jetFinder->FillFromDigits();
76 // TPC  information
77         jetFinder->FillFromTracks(1, 0);
78 //                                ^ preserves info from hit
79
80 // TPC  information from Hits associated to the EMCAL
81 //      jetFinder->FillFromHitFlaggedTracks(1);
82 //  
83         jetFinder->Find();
84
85 //
86 // Look at results
87         printf("\n Test Jets: %d\n", jetFinder->Njets());
88         Int_t njet = jetFinder->Njets();
89         for (Int_t nj=0; nj<njet; nj++)
90         {
91             printf("\n Jet Energy %5d %8.2f \n", 
92                    nj, jetFinder->JetEnergy(nj));
93             printf("\n Jet Phi    %5d %8.2f %8.2f \n", 
94                    nj, jetFinder->JetPhiL(nj), jetFinder->JetPhiW(nj));
95             printf("\n Jet Eta    %5d %8.2f %8.2f \n", 
96                    nj, jetFinder->JetEtaL(nj), jetFinder->JetEtaW(nj));
97         }
98 //      TCanvas *c1 = new TCanvas("c1","Canvas 1",400,10,600,700);
99 //      (jetFinder->GetLego())->Draw();
100     } // event loop
101
102 //            ^
103 //            |
104 //            |
105 //            |
106 //.............
107     fileB->Close();
108     fileS->Close();
109 }
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125