]>
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 digitsSSD(Int_t nevents, Int_t nfiles) | |
41 | { | |
42 | ||
43 | TH1F * hadc = new TH1F ("hadc", "hadc",200, 0, 4500); | |
44 | TH1F * hadclog = new TH1F ("hadclog", "hadclog",200, -1, 4); | |
45 | ||
46 | TDirectoryFile *tdf[100]; | |
47 | TDirectoryFile *tdfKine[100] ; | |
48 | ||
49 | TTree *ttree[100]; | |
50 | TTree *ttreeKine[100]; | |
51 | ||
52 | ||
53 | TClonesArray *arr= NULL; // | |
54 | ||
55 | ||
56 | ||
57 | //Run loader------------ | |
58 | TString name; | |
59 | name = "galice.root"; | |
60 | AliRunLoader* rlSig = AliRunLoader::Open(name.Data()); | |
61 | ||
62 | // gAlice | |
63 | rlSig->LoadgAlice(); | |
64 | gAlice = rlSig->GetAliRun(); | |
65 | ||
66 | // Now load kinematics and event header | |
67 | rlSig->LoadKinematics(); | |
68 | rlSig->LoadHeader(); | |
69 | cout << rlSig->GetNumberOfEvents()<< endl; | |
70 | //---------------------- | |
71 | ||
72 | //loop over events in the files | |
73 | for(Int_t event=0; event<nevents; event++){ | |
74 | //printf("###event= %d\n", event +file*100); | |
75 | printf("###event= %d\n", event); | |
76 | ||
77 | // tdf[event] = (TDirectoryFile*)file0->Get(Form("Event%d",event+file*100)); | |
78 | tdf[event] = GetDirectory(event, "ITS", nfiles); | |
79 | if ( ! tdf[event] ) { | |
80 | cerr << "Event directory not found in " << nfiles << " files" << endl; | |
81 | exit(1); | |
82 | } | |
83 | ||
84 | ttree[event] = (TTree*)tdf[event]->Get("TreeD"); | |
85 | ||
86 | arr = NULL; | |
87 | ttree[event]->SetBranchAddress("ITSDigitsSSD", &arr); | |
88 | ||
89 | ||
90 | // Runloader -> gives particle Stack | |
91 | rlSig->GetEvent(event); | |
92 | AliStack * stack = rlSig->Stack(); | |
93 | //stack->DumpPStack(); | |
94 | ||
95 | ||
96 | // loop over tracks | |
97 | Int_t NumberPrim=0; | |
98 | for(Int_t iev=0; iev<ttree[event]->GetEntries(); iev++){ | |
99 | ttree[event]->GetEntry(iev); | |
100 | ||
101 | ||
102 | for (Int_t j = 0; j < arr->GetEntries(); j++) { | |
103 | AliITSdigit* digit = dynamic_cast<AliITSdigit*> (arr->At(j)); | |
104 | if (digit){ | |
105 | ||
106 | hadc->Fill(digit->GetSignal()); | |
107 | hadclog->Fill(TMath::Log10(digit->GetSignal())); | |
108 | } | |
109 | } | |
110 | } | |
111 | ||
112 | ||
113 | ||
114 | } | |
115 | ||
116 | TFile fc("digits.ITS.SSD.root","RECREATE"); | |
117 | fc.cd(); | |
118 | ||
119 | hadc->Write(); | |
120 | hadclog->Write(); | |
121 | ||
122 | fc.Close(); | |
123 | ||
124 | } |