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