]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/trd_analyse.C
Coverity fix
[u/mrichter/AliRoot.git] / EVE / alice-macros / trd_analyse.C
1 //
2 // How to access the basic TRD data structures when a 
3 // pointer to an Eve opject is available. One can get a 
4 // valid pointer from the event display by accessing the 
5 // function ExportToCINT 
6 // 
7 // Usage:
8 // .L trd_analyse.C
9 // analyseXXX(ptr)
10 // 
11 // Author:
12 // Alex Bercuci (A.Bercuci@gsi.de)
13 // 
14
15 //_______________________________________________________
16 void analyseHits(AliEveTRDHits *hits = 0x0)
17 {
18 // Simple print hits from a detector
19
20   if(!hits) {
21     Info("analyseHits", "Invalid hits set.");
22     return;
23   }
24
25   AliTRDhit *h = 0x0;
26   for(Int_t ih=0; ih<hits->GetN(); ih++){
27     hits->PointSelected(ih);
28   }
29 }
30
31 //_______________________________________________________
32 void analyseDigits(AliEveTRDDigits *digits = 0x0)
33 {
34 // Simple print digits from a detector
35
36   if(!digits) {
37     Info("analyseDigits", "Invalid digits set.");
38     return;
39   }
40
41   Int_t adc ;
42   AliTRDdataArrayI *data = digits->GetData();
43   Int_t nrows = data->GetNrow(),
44         ncols = data->GetNcol(),
45         ntbs  = data->GetNtime();
46   data->Expand();
47   printf("nrows[%d] ncols[%d] ntbs[%d]\n", nrows, ncols, ntbs);
48   for (Int_t  row = 0;  row <  nrows;  row++)
49   for (Int_t  col = 0;  col <  ncols;  col++)
50     for (Int_t time = 0; time < ntbs; time++) {
51       if((adc = data->GetDataUnchecked(row, col, time)) <= 1) continue;
52       printf("r[%d] c[%d] t[%d] ADC[%d]\n", row, col, time, adc);
53     }
54   data->Compress(1);
55 }
56
57 //_______________________________________________________
58 void analyseClusters(TEvePointSet *points = 0x0)
59 {
60 // print some info about clusters in one detector or 
61 // attached to tracks.
62   if(!points) {
63     Info("analyseClusters", "Invalid clusters set.");
64     return;
65   }
66
67   AliTRDcluster *c = 0x0;
68   for(Int_t ic=0; ic<points->Size(); ic++){
69     if(!(c = (AliTRDcluster*)points->GetPointId(ic))) continue;
70   
71     c->Print();
72   }
73 }
74
75 //_______________________________________________________
76 void analyseTracklet(AliEveTRDTracklet *line)
77 {
78 // print tracklet information
79   if(!line) {
80     Info("analyseTracklet", "Invalid tracklet.");
81     return;
82   }
83   
84   AliTRDseedV1 *tracklet = 0x0;
85   tracklet = (AliTRDseedV1*)line->GetUserData();
86   tracklet->Print();
87 }
88
89 //_______________________________________________________
90 void analyseTrack(AliEveTRDTrack *line)
91 {
92 // print tracklet information
93   if(!line) {
94     Info("analyseTrack", "Invalid track.");
95     return;
96   }
97   
98   AliTRDtrackV1 *track = 0x0;
99   track = (AliTRDtrackV1*)line->GetUserData();
100   
101   AliTRDReconstructor *rec = new AliTRDReconstructor();
102   rec->SetRecoParam(AliTRDrecoParam::GetLowFluxParam());
103   track->SetReconstructor(rec);
104
105   rec->SetOption("!nn");
106   track->CookPID();
107   printf("PID LQ : "); for(int is=0; is<AliPID::kSPECIES; is++) printf("%s[%5.2f] ", AliPID::ParticleName(is), 1.E2*track->GetPID(is)); printf("\n");
108
109   rec->SetOption("nn");
110   track->CookPID();
111   printf("PID NN : "); for(int is=0; is<AliPID::kSPECIES; is++) printf("%s[%5.2f] ", AliPID::ParticleName(is), 1.E2*track->GetPID(is)); printf("\n");
112 }
113
114 //_______________________________________________________
115 void trd_analyse()
116 {
117   Info("trd_analyse", "******************************");
118   Info("trd_analyse", "Example function which shows how to analyse TRD data exported from the EVE display.");
119   Info("trd_analyse", "Usage : Load the macro. Select a TRD data object (digits, clusters, tracklet, track) and call the function \"ExportToCINT()\". Afterwards call the appropiate function (analyseXXX()) on the pointer.");
120   Info("trd_analyse", "E.g. If \"tracklet\" is a pointer to a TRD track than one can call :"); 
121   Info("trd_analyse", "analyseTrack(track)");
122
123   //gROOT->LoadMacro("$ALICE_ROOT/EVE/alice-macros/trd_analyse.C");
124   return;
125 }