]>
Commit | Line | Data |
---|---|---|
0866e534 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | // $Id$ | |
17 | ||
18 | // Macro to generate histograms from digits | |
19 | // By E. Sicking, CERN | |
20 | ||
21 | TDirectoryFile* GetDirectory(Int_t ievent, const TString& detName, Int_t nfiles) | |
22 | { | |
23 | for (Int_t file =0; file<nfiles; file++) { | |
24 | TString filename(detName); | |
25 | if ( file == 0 ) { | |
26 | filename += ".Digits.root"; | |
27 | } | |
28 | else { | |
29 | filename += TString(Form(".Digits%d.root",file)); | |
30 | } | |
31 | ||
32 | TFile* file0 = TFile::Open(filename.Data()); | |
33 | ||
34 | TDirectoryFile* dir = (TDirectoryFile*)file0->Get(Form("Event%d",ievent)); | |
35 | if (dir) return dir; | |
36 | } | |
37 | return 0; | |
38 | } | |
39 | ||
40 | void digitsSDD(Int_t nevents, Int_t nfiles) | |
41 | { | |
42 | ||
43 | TH1F * hadc = new TH1F ("hadc", "hadc",200, 0, 1300); | |
44 | TH1F * hadclog = new TH1F ("hadclog", "hadclog",200, 1, 3.5); | |
45 | ||
46 | TDirectoryFile *tdf[100]; | |
47 | TDirectoryFile *tdfKine[100] ; | |
48 | ||
49 | TTree *ttree[100]; | |
50 | TTree *ttreeKine[100]; | |
51 | ||
52 | TClonesArray *arr= NULL; // | |
53 | ||
54 | //Run loader------------ | |
55 | TString name; | |
56 | name = "galice.root"; | |
57 | AliRunLoader* rlSig = AliRunLoader::Open(name.Data()); | |
58 | ||
59 | // gAlice | |
60 | rlSig->LoadgAlice(); | |
61 | gAlice = rlSig->GetAliRun(); | |
62 | ||
63 | // Now load kinematics and event header | |
64 | rlSig->LoadKinematics(); | |
65 | rlSig->LoadHeader(); | |
66 | cout << rlSig->GetNumberOfEvents()<< endl; | |
67 | //---------------------- | |
68 | ||
69 | ||
70 | //loop over events in the files | |
71 | for(Int_t event=0; event<nevents; event++){ | |
72 | printf("###event= %d\n", event); | |
73 | ||
74 | tdf[event] = GetDirectory(event, "ITS", nfiles); | |
75 | if ( ! tdf[event] ) { | |
76 | cerr << "Event directory not found in " << nfiles << " files" << endl; | |
77 | exit(1); | |
78 | } | |
79 | ||
80 | ttree[event] = (TTree*)tdf[event]->Get("TreeD"); | |
81 | ||
82 | arr = NULL; | |
83 | ttree[event]->SetBranchAddress("ITSDigitsSDD", &arr); | |
84 | ||
85 | rlSig->GetEvent(event); | |
86 | AliStack * stack = rlSig->Stack(); | |
87 | ||
88 | ||
89 | ||
90 | // loop over tracks | |
91 | Int_t NumberPrim=0; | |
92 | for(Int_t iev=0; iev<ttree[event]->GetEntries(); iev++){ | |
93 | ttree[event]->GetEntry(iev); | |
94 | ||
95 | ||
96 | for (Int_t j = 0; j < arr->GetEntries(); j++) { | |
97 | AliITSdigit* digit = dynamic_cast<AliITSdigit*> (arr->At(j)); | |
98 | if (digit){ | |
99 | Int_t label = digit->GetHits(); | |
100 | ||
101 | hadc->Fill(digit->GetSignal()); | |
102 | hadclog->Fill(TMath::Log10(digit->GetSignal())); | |
103 | ||
104 | } | |
105 | } | |
106 | } | |
107 | ||
108 | } | |
109 | ||
110 | TFile fc("digits.ITS.SDD.root","RECREATE"); | |
111 | fc.cd(); | |
112 | ||
113 | hadc->Write(); | |
114 | hadclog->Write(); | |
115 | ||
116 | fc.Close(); | |
117 | ||
118 | } |