]> git.uio.no Git - u/mrichter/AliRoot.git/blame - test/vmctest/scripts/digitsHMPID.C
Separate syswatch for sim. and rec.
[u/mrichter/AliRoot.git] / test / vmctest / scripts / digitsHMPID.C
CommitLineData
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
21TTree* GetTreeD(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 TTree* treeD = (TTree*)file0->Get(Form("Event%d/TreeD",ievent));
35 if (treeD) return treeD;
36 }
37 return 0;
38}
39
40void digitsHMPID(Int_t nevents, Int_t nfiles){
41
42
43 TH1F *hadc = new TH1F("hadc","HMPID digit",200, -100., 3000.);
44 TH1F *hadclog = new TH1F("hadclog","HMPID digit",200, -0., 4.);
45
46 TTree *treeD=0x0;
47
48 TClonesArray *digits =0x0;
49
50 for (Int_t event=0; event<nevents; event++) {
51 cout << "Event " << event << endl;
52
53 treeD = GetTreeD(event, "HMPID", nfiles);
54 if ( ! treeD ) {
55 cerr << "Event directory not found in " << nfiles << " files" << endl;
56 exit(1);
57 }
58
59 digits = NULL;
60 treeD->SetBranchAddress("HMPID4", &digits);
61
62 for(Int_t iev=0; iev<treeD->GetEntries(); iev++){
63 treeD->GetEntry(iev);
64
65
66 for (Int_t j = 0; j < digits->GetEntries(); j++) {
67 AliHMPIDDigit* dig = dynamic_cast<AliHMPIDDigit*> (digits->At(j));
68 hadc->Fill(dig->Q());
69 if(dig->Q()>0.)hadclog->Fill(TMath::Log10(dig->Q()));
70 }
71 }
72 }
73
74 TFile fc("digits.HMPID.root","RECREATE");
75 fc.cd();
76
77 hadc->Write();
78 hadclog->Write();
79
80 fc.Close();
81
82}
83
84
85
86
87
88
89