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 digitsSDD(Int_t nevents, Int_t nfiles)
43 TH1F * hadc = new TH1F ("hadc", "hadc",200, 0, 1300);
44 TH1F * hadclog = new TH1F ("hadclog", "hadclog",200, 1, 3.5);
46 TDirectoryFile *tdf[100];
47 TDirectoryFile *tdfKine[100] ;
50 TTree *ttreeKine[100];
52 TClonesArray *arr= NULL; //
54 //Run loader------------
57 AliRunLoader* rlSig = AliRunLoader::Open(name.Data());
61 gAlice = rlSig->GetAliRun();
63 // Now load kinematics and event header
64 rlSig->LoadKinematics();
66 cout << rlSig->GetNumberOfEvents()<< endl;
67 //----------------------
70 //loop over events in the files
71 for(Int_t event=0; event<nevents; event++){
72 printf("###event= %d\n", event);
74 tdf[event] = GetDirectory(event, "ITS", nfiles);
76 cerr << "Event directory not found in " << nfiles << " files" << endl;
80 ttree[event] = (TTree*)tdf[event]->Get("TreeD");
83 ttree[event]->SetBranchAddress("ITSDigitsSDD", &arr);
85 rlSig->GetEvent(event);
86 AliStack * stack = rlSig->Stack();
92 for(Int_t iev=0; iev<ttree[event]->GetEntries(); iev++){
93 ttree[event]->GetEntry(iev);
96 for (Int_t j = 0; j < arr->GetEntries(); j++) {
97 AliITSdigit* digit = dynamic_cast<AliITSdigit*> (arr->At(j));
99 Int_t label = digit->GetHits();
101 hadc->Fill(digit->GetSignal());
102 hadclog->Fill(TMath::Log10(digit->GetSignal()));
110 TFile fc("digits.ITS.SDD.root","RECREATE");