]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/tof_raw.C
Merge of EVE-dev branch.
[u/mrichter/AliRoot.git] / EVE / alice-macros / tof_raw.C
1 void tof_raw(const char *input = "raw.root",
2              const char *geometry = "geometry.root",
3              Int_t  event = 0,
4              Bool_t newDecoder = kFALSE)
5 {
6
7   TClonesArray *array = 0x0;
8
9   if (gSystem->AccessPathName(input, kReadPermission))
10   {
11     Error("tof_raw", "file '%s' not found.", input);
12     return;
13   }
14
15   TGeoManager *localGeoManager = (TGeoManager*)gEve->GetGeometry(geometry);
16   if (!localGeoManager) {
17     printf("ERROR: no TGeo\n");
18   }
19
20   AliRawReader *rawReader = NULL;
21   TString fileName(input);
22   if (fileName.EndsWith("/")) {
23     rawReader = new AliRawReaderFile(fileName);
24   } else if (fileName.EndsWith(".root")) {
25     rawReader = new AliRawReaderRoot(fileName);
26   } else if (!fileName.IsNull()) {
27     rawReader = new AliRawReaderDate(fileName);
28     rawReader->SelectEvents(7);
29   }
30
31   AliEveTOFDigitsInfo* di = new AliEveTOFDigitsInfo();
32
33   for (Int_t ev=0; rawReader->NextEvent(); ev++) {
34     if (ev==event) {
35
36       if (di) {
37         di->Delete();
38         di = new AliEveTOFDigitsInfo();
39       }
40
41       di->ReadRaw(rawReader, newDecoder);
42       continue;
43     }
44
45     else continue;
46
47   }
48
49   AliTOFGeometry* g = new AliTOFGeometry();
50  
51   gStyle->SetPalette(1, 0);
52   gEve->DisableRedraw();
53
54   TEveElementList* ll = new TEveElementList("TOF");
55   ll->SetTitle("TOF detector");
56   ll->SetMainColor(2);
57   gEve->AddElement(ll);
58
59   for(Int_t iSector=0; iSector<g->NSectors(); iSector++) {
60
61     array = di->GetDigits(iSector);
62
63     AliEveTOFSector* m = new AliEveTOFSector(localGeoManager,iSector,array);
64
65     gEve->AddElement(m, ll);
66
67   }
68
69   gEve->EnableRedraw();
70
71 }