]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/test-macros/tpc_digi_test.C
Geometry for MFT (Brigitte)
[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
10 class TTree;
11
12 class AliEveTPCData;
13
14 AliEveTPCData*  x = 0;
15 TTree*            tree = 0;
16
17 void 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
25   x = new AliEveTPCData;
26   // x->SetSectorBlockSize(8192);
27   // x->SetLoadThreshold(5);
28   x->CreateAllSectors();
29   x->LoadDigits(tree, kFALSE);
30   gStyle->SetPalette(1, 0);
31
32   AliEveTPCSector2D* s = new AliEveTPCSector2D();
33   s->SetDataSource(x);
34   s->SetMainColor(36);
35   gEve->AddElement(s);
36   gEve->DrawElement(s);
37 }
38
39
40 void tpc_digi_pad_dump(Int_t s, Int_t r, Int_t p)
41 {
42   if(r >= AliEveTPCSectorData::GetInnSeg().fNRows) {
43     r -= AliEveTPCSectorData::GetInnSeg().fNRows;
44     s += 36;
45   }
46
47   AliSimDigits *digit = 0;
48   tree->GetBranch("Segment")->SetAddress(&digit);
49
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;
54     AliEveTPCSectorData::GetParam().AdjustSectorRow(digit->GetID(), sector, row);
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 }