Update master to aliroot
[u/mrichter/AliRoot.git] / EVE / test-macros / tpc_digi_test.C
CommitLineData
d810d0de 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 *
51346b82 7 * full copyright notice. *
d810d0de 8 **************************************************************************/
cb4245bb 9
915dabe1 10class TTree;
11
d810d0de 12class AliEveTPCData;
915dabe1 13
d810d0de 14AliEveTPCData* x = 0;
915dabe1 15TTree* tree = 0;
16
17void tpc_digi_test()
18{
19 gROOT->Macro("alieve_loadlibs.C");
20 gSystem->Load("libAlieve");
21
22 TFile* f = new TFile("coctail_1k/TPC.Digits.root");
23 tree = (TTree*) gDirectory->Get("Event0/TreeD");
24
d810d0de 25 x = new AliEveTPCData;
915dabe1 26 // x->SetSectorBlockSize(8192);
27 // x->SetLoadThreshold(5);
28 x->CreateAllSectors();
29 x->LoadDigits(tree, kFALSE);
30 gStyle->SetPalette(1, 0);
31
d810d0de 32 AliEveTPCSector2D* s = new AliEveTPCSector2D();
915dabe1 33 s->SetDataSource(x);
34 s->SetMainColor(36);
84aff7a4 35 gEve->AddElement(s);
36 gEve->DrawElement(s);
915dabe1 37}
38
39
40void tpc_digi_pad_dump(Int_t s, Int_t r, Int_t p)
41{
d810d0de 42 if(r >= AliEveTPCSectorData::GetInnSeg().fNRows) {
43 r -= AliEveTPCSectorData::GetInnSeg().fNRows;
915dabe1 44 s += 36;
45 }
46
47 AliSimDigits *digit = 0;
48 tree->GetBranch("Segment")->SetAddress(&digit);
51346b82 49
915dabe1 50 Int_t sbr = (Int_t) tree->GetEntries();
51 for (Int_t ent=0; ent<sbr; ent++) {
52 tree->GetEntry(ent);
53 Int_t sector, row;
d810d0de 54 AliEveTPCSectorData::GetParam().AdjustSectorRow(digit->GetID(), sector, row);
915dabe1 55
56 if(sector != s || row != r)
57 continue;
58
59 printf("Entry = %d, ID = %d, Sec = %d, Row = %d\n",
60 ent, digit->GetID(), sector, row);
61
62 Int_t pad;
63 Short_t time, signal;
64 digit->First();
65 do {
66 pad = digit->CurrentColumn();
67 time = digit->CurrentRow();
68 signal = digit->CurrentDigit();
69
70 if(p == pad)
71 printf("%d %d\n", time, signal);
72
73 } while (digit->Next());
74 }
75}