1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 // Macro to generate histograms from digits
19 // By E. Sicking, CERN
21 TDirectoryFile* GetDirectory(Int_t ievent, const TString& detName, Int_t nfiles)
23 for (Int_t file =0; file<nfiles; file++) {
24 TString filename(detName);
26 filename += ".Digits.root";
29 filename += TString(Form(".Digits%d.root",file));
32 TFile* file0 = TFile::Open(filename.Data());
34 TDirectoryFile* dir = (TDirectoryFile*)file0->Get(Form("Event%d",ievent));
40 void digitsTPC(Int_t nevents, Int_t nfiles)
43 TH1F * hadclog = new TH1F ("hadclog", "hadclog",100, -1,3.5 );
44 TH1F * hadc = new TH1F ("hadc", "hadc",200, -100,1100 );
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);
52 TDirectoryFile *tdf[100];
53 TDirectoryFile *tdfKine[100] ;
56 TTree *ttreeKine[100];
58 AliSimDigits *digits= NULL;
64 //Run loader------------
67 AliRunLoader* rlSig = AliRunLoader::Open(name.Data());
71 gAlice = rlSig->GetAliRun();
73 // Now load kinematics and event header
74 rlSig->LoadKinematics();
76 cout << rlSig->GetNumberOfEvents()<< endl;
77 //----------------------
79 //loop over events in the files
80 for(Int_t event=0; event<nevents; event++){
81 printf("###event= %d\n", event);
83 tdf[event] = GetDirectory(event, "TPC", nfiles);
85 cerr << "Event directory not found in " << nfiles << " files" << endl;
89 ttree[event] = (TTree*)tdf[event]->Get("TreeD");
92 ttree[event]->SetBranchAddress("Segment", &digits);
94 // Runloader -> gives particle Stack
95 rlSig->GetEvent(event);
96 AliStack * stack = rlSig->Stack();
97 //stack->DumpPStack();
106 for(Int_t iev=0; iev<ttree[event]->GetEntries(); iev++){
107 ttree[event]->GetEntry(iev);
110 iRow=digits->CurrentRow();
111 digitValue = digits->CurrentDigit();
112 iColumn=digits->CurrentColumn();
113 ndig=digits->GetDigits();
114 digSize=digits->GetDigitSize();
116 if(digitValue>0.)hadclog->Fill(TMath::Log10(digitValue));
117 hadc->Fill(digitValue);
121 hSize->Fill(digSize);
123 while (digits->Next()){
125 digitValue = digits->CurrentDigit();
126 iRow=digits->CurrentRow();
127 iColumn=digits->CurrentColumn();
128 ndig=digits->GetDigits();
129 digSize=digits->GetDigitSize();
131 if(digitValue>0.)hadclog->Fill(TMath::Log10(digitValue));
132 hadc->Fill(digitValue);
136 hSize->Fill(digSize);
137 //cout << digSize << endl;
142 TFile fc("digits.TPC.root","RECREATE");