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 digitsSPD(Int_t nevents, Int_t nfiles)
43 TH1F * hadc = new TH1F ("hadc", "hadc",100, 0, 2);
44 TH1F * hadclog = new TH1F ("hadclog", "hadclog",100, -1, 1);
46 TDirectoryFile *tdf[100];
47 TDirectoryFile *tdfKine[100] ;
50 TTree *ttreeKine[100];
53 TClonesArray *arr= NULL; //
55 //Run loader------------
58 AliRunLoader* rlSig = AliRunLoader::Open(name.Data());
62 gAlice = rlSig->GetAliRun();
64 // Now load kinematics and event header
65 rlSig->LoadKinematics();
67 cout << rlSig->GetNumberOfEvents()<< endl;
68 //----------------------
71 //loop over events in the files
72 for(Int_t event=0; event<nevents; event++){
73 //printf("###event= %d\n", event + file*100);
74 printf("###event= %d\n", event);
76 tdf[event] = GetDirectory(event, "ITS", nfiles);
78 cerr << "Event directory not found in " << nfiles << " files" << endl;
82 ttree[event] = (TTree*)tdf[event]->Get("TreeD");
85 ttree[event]->SetBranchAddress("ITSDigitsSPD", &arr);
88 // Runloader -> gives particle Stack
89 rlSig->GetEvent(event);
90 AliStack * stack = rlSig->Stack();
91 //stack->DumpPStack();
96 for(Int_t iev=0; iev<ttree[event]->GetEntries(); iev++){
97 ttree[event]->GetEntry(iev);
100 for (Int_t j = 0; j < arr->GetEntries(); j++) {
101 AliITSdigit* digit = dynamic_cast<AliITSdigit*> (arr->At(j));
103 hadc->Fill(digit->GetSignal());
104 hadclog->Fill(TMath::Log10(digit->GetSignal()));
112 TFile fc("digits.ITS.SPD.root","RECREATE");