]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/scripts/MakeLego.C
.so cleanup: more less-obvious cleanup
[u/mrichter/AliRoot.git] / FMD / scripts / MakeLego.C
1 //____________________________________________________________________
2 //
3 // $Id$
4 //
5 // Script to make ROOT files with LEGO information histograms
6 //
7 TH1*
8 process(TFile* file, const char* name, const char* opt) 
9 {
10   TH2F*  h2d = static_cast<TH2F*>(file->Get(name));
11   if (!h2d) {
12     Error("process", "Couldn't get %s from %s", name, file->GetName());
13     return 0;
14   }
15   TH1D*  h1d = h2d->ProjectionY();
16   h1d->SetTitle(Form("%s", h1d->GetTitle()));
17   h1d->Scale(1. / 360.);
18
19   return h1d;
20   
21   return heta;
22 }
23
24 //____________________________________________________________________
25 void
26 MakeLego(const Char_t* what) 
27 {
28   TString config("FMD/scripts/ConfigInner.C");
29   TString opt(what);
30   if      (opt == "ITS") 
31     config = "FMD/scripts/ConfigItsOnly.C";
32   else if (opt == "PIPE") 
33     config = "FMD/scripts/ConfigPipeOnly.C";
34   else if (opt == "FMD") 
35     config = "FMD/scripts/ConfigFmdOnly.C";
36   else if (opt == "Nothing") 
37     config = "FMD/scripts/ConfigNothing.C";
38   else 
39     opt = "Inner";
40   
41       
42   cout << "Running AliRun::RunLego(" << config
43        << ",180,0,180,360,0,360,0,10000,0,10000); " << endl;
44   
45   gAlice->RunLego(config.Data(), 180, 0, 180, 360, 0, 360, 0, 100000,
46                   100000000, 0);
47   
48   TFile* galice   = TFile::Open("galice.root", "READ");
49   TFile* output   = TFile::Open(Form("Lego_%s.root", opt.Data()),"RECREATE");
50   TH1F* habso_eta = process(galice, "habso", opt.Data());
51   TH1F* hradl_eta = process(galice, "hradl", opt.Data());
52   TH1F* hgcm2_eta = process(galice, "hgcm2", opt.Data());
53   hgcm2_eta->Draw();
54   
55   output->Write();
56   output->Close();
57   galice->Close();  
58 }
59 //____________________________________________________________________
60 //
61 // EOF
62 //