]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/test-macros/tpc_digi_test.C
Put all classes in Alieve/ sub-module out of the Alieve namespace and
[u/mrichter/AliRoot.git] / EVE / test-macros / tpc_digi_test.C
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 * 
8  **************************************************************************/
9 class TTree;
10
11 namespace Alieve {
12 class AliEveTPCData;
13 }
14
15 AliEveTPCData*  x = 0;
16 TTree*            tree = 0;
17
18 void tpc_digi_test()
19 {
20   gROOT->Macro("alieve_loadlibs.C");
21   gSystem->Load("libAlieve");
22
23   TFile* f = new TFile("coctail_1k/TPC.Digits.root");
24   tree = (TTree*) gDirectory->Get("Event0/TreeD");
25
26   x = new AliEveTPCData;
27   // x->SetSectorBlockSize(8192);
28   // x->SetLoadThreshold(5);
29   x->CreateAllSectors();
30   x->LoadDigits(tree, kFALSE);
31   gStyle->SetPalette(1, 0);
32
33   AliEveTPCSector2D* s = new AliEveTPCSector2D();
34   s->SetDataSource(x);
35   s->SetMainColor(36);
36   gEve->AddElement(s);
37   gEve->DrawElement(s);
38 }
39
40
41 void tpc_digi_pad_dump(Int_t s, Int_t r, Int_t p)
42 {
43   if(r >= AliEveTPCSectorData::GetInnSeg().fNRows) {
44     r -= AliEveTPCSectorData::GetInnSeg().fNRows;
45     s += 36;
46   }
47
48   AliSimDigits *digit = 0;
49   tree->GetBranch("Segment")->SetAddress(&digit);
50   
51   Int_t sbr = (Int_t) tree->GetEntries();
52   for (Int_t ent=0; ent<sbr; ent++) {
53     tree->GetEntry(ent);
54     Int_t sector, row;
55     AliEveTPCSectorData::GetParam().AdjustSectorRow(digit->GetID(), sector, row);
56
57     if(sector != s || row != r)
58       continue;
59
60     printf("Entry = %d, ID = %d, Sec = %d, Row = %d\n",
61            ent, digit->GetID(), sector, row);
62
63     Int_t pad;
64     Short_t time, signal;
65     digit->First();
66     do {
67       pad    = digit->CurrentColumn();
68       time   = digit->CurrentRow();
69       signal = digit->CurrentDigit();
70
71       if(p == pad)
72         printf("%d %d\n", time, signal);
73
74     } while (digit->Next());
75   }
76 }