]>
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 digitsTPC(Int_t nevents, Int_t nfiles) | |
41 | { | |
42 | ||
43 | TH1F * hadclog = new TH1F ("hadclog", "hadclog",100, -1,3.5 ); | |
44 | TH1F * hadc = new TH1F ("hadc", "hadc",200, -100,1100 ); | |
45 | ||
46 | TH1F * hRow = new TH1F ("hRow", "hRow",120, -100, 1100); | |
47 | TH1F * hCol = new TH1F ("hCol", "hCol",100, -5, 194); | |
48 | TH1F * hndig = new TH1F ("hndig", "hndig",120, -100000, 100000); | |
49 | TH1F * hSize = new TH1F ("hSize", "hSize",100, 1000, 5000); | |
50 | ||
51 | ||
52 | TDirectoryFile *tdf[100]; | |
53 | TDirectoryFile *tdfKine[100] ; | |
54 | ||
55 | TTree *ttree[100]; | |
56 | TTree *ttreeKine[100]; | |
57 | ||
58 | AliSimDigits *digits= NULL; | |
59 | ||
60 | ||
61 | Int_t numberhits=0; | |
62 | ||
63 | ||
64 | //Run loader------------ | |
65 | TString name; | |
66 | name = "galice.root"; | |
67 | AliRunLoader* rlSig = AliRunLoader::Open(name.Data()); | |
68 | ||
69 | // gAlice | |
70 | rlSig->LoadgAlice(); | |
71 | gAlice = rlSig->GetAliRun(); | |
72 | ||
73 | // Now load kinematics and event header | |
74 | rlSig->LoadKinematics(); | |
75 | rlSig->LoadHeader(); | |
76 | cout << rlSig->GetNumberOfEvents()<< endl; | |
77 | //---------------------- | |
78 | ||
79 | //loop over events in the files | |
80 | for(Int_t event=0; event<nevents; event++){ | |
81 | printf("###event= %d\n", event); | |
82 | ||
83 | tdf[event] = GetDirectory(event, "TPC", nfiles); | |
84 | if ( ! tdf[event] ) { | |
85 | cerr << "Event directory not found in " << nfiles << " files" << endl; | |
86 | exit(1); | |
87 | } | |
88 | ||
89 | ttree[event] = (TTree*)tdf[event]->Get("TreeD"); | |
90 | ||
91 | digits = NULL; | |
92 | ttree[event]->SetBranchAddress("Segment", &digits); | |
93 | ||
94 | // Runloader -> gives particle Stack | |
95 | rlSig->GetEvent(event); | |
96 | AliStack * stack = rlSig->Stack(); | |
97 | //stack->DumpPStack(); | |
98 | ||
99 | Short_t digitValue=0; | |
100 | Int_t iRow=0; | |
101 | Int_t iColumn=0; | |
102 | Short_t ndig =0; | |
103 | Int_t digSize =0; | |
104 | ||
105 | // loop over tracks | |
106 | for(Int_t iev=0; iev<ttree[event]->GetEntries(); iev++){ | |
107 | ttree[event]->GetEntry(iev); | |
108 | digits->First(); | |
109 | ||
110 | iRow=digits->CurrentRow(); | |
111 | digitValue = digits->CurrentDigit(); | |
112 | iColumn=digits->CurrentColumn(); | |
113 | ndig=digits->GetDigits(); | |
114 | digSize=digits->GetDigitSize(); | |
115 | ||
116 | if(digitValue>0.)hadclog->Fill(TMath::Log10(digitValue)); | |
117 | hadc->Fill(digitValue); | |
118 | hRow->Fill(iRow); | |
119 | hCol->Fill(iColumn); | |
120 | hndig->Fill(ndig); | |
121 | hSize->Fill(digSize); | |
122 | ||
123 | while (digits->Next()){ | |
124 | ||
125 | digitValue = digits->CurrentDigit(); | |
126 | iRow=digits->CurrentRow(); | |
127 | iColumn=digits->CurrentColumn(); | |
128 | ndig=digits->GetDigits(); | |
129 | digSize=digits->GetDigitSize(); | |
130 | ||
131 | if(digitValue>0.)hadclog->Fill(TMath::Log10(digitValue)); | |
132 | hadc->Fill(digitValue); | |
133 | hRow->Fill(iRow); | |
134 | hCol->Fill(iColumn); | |
135 | hndig->Fill(ndig); | |
136 | hSize->Fill(digSize); | |
137 | //cout << digSize << endl; | |
138 | } | |
139 | } | |
140 | } | |
141 | ||
142 | TFile fc("digits.TPC.root","RECREATE"); | |
143 | fc.cd(); | |
144 | ||
145 | hadclog->Write(); | |
146 | hadc->Write(); | |
147 | hRow->Write(); | |
148 | hCol->Write(); | |
149 | hndig->Write(); | |
150 | hSize->Write(); | |
151 | ||
152 | fc.Close(); | |
153 | ||
154 | } |