]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/trd_analyse.C
New detector AD
[u/mrichter/AliRoot.git] / EVE / alice-macros / trd_analyse.C
1 /**************************************************************************
2  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
3  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
4  * full copyright notice.                                                 *
5  **************************************************************************/
6
7 #if !defined(__CINT__) || defined(__MAKECINT__)
8 #include <TEvePointSet.h>
9
10 #include <AliPID.h>
11 #include <AliTRDhit.h>
12 #include <AliTRDarrayADC.h>
13 #include <AliTRDcluster.h>
14 #include <AliTRDtrackV1.h>
15 #include <AliTRDReconstructor.h>
16 #include <AliTRDrecoParam.h>
17 #include <AliTRDseedV1.h>
18 #include <AliEveTRDData.h>
19 #endif
20
21 //
22 // How to access the basic TRD data structures when a 
23 // pointer to an Eve opject is available. One can get a 
24 // valid pointer from the event display by accessing the 
25 // function ExportToCINT 
26 // 
27 // Usage:
28 // .L trd_analyse.C
29 // analyseXXX(ptr)
30 // 
31 // Author:
32 // Alex Bercuci (A.Bercuci@gsi.de)
33 // 
34
35 //_______________________________________________________
36 void analyseHits(AliEveTRDHits *hits = 0x0)
37 {
38 // Simple print hits from a detector
39
40   if(!hits) {
41     Info("analyseHits", "Invalid hits set.");
42     return;
43   }
44
45   AliTRDhit *h = 0x0;
46   for(Int_t ih=0; ih<hits->GetN(); ih++){
47     hits->PointSelected(ih);
48   }
49 }
50
51 /* Obsolete code
52  * 
53  * 
54 //_______________________________________________________
55 void analyseDigits(AliEveTRDDigits *digits = 0x0)
56 {
57 // Simple print digits from a detector
58
59   if(!digits) {
60     Info("analyseDigits", "Invalid digits set.");
61     return;
62   }
63
64   Int_t adc ;
65   AliTRDdataArrayI *data = digits->GetData();
66   Int_t nrows = data->GetNrow(),
67         ncols = data->GetNcol(),
68         ntbs  = data->GetNtime();
69   data->Expand();
70   printf("nrows[%d] ncols[%d] ntbs[%d]\n", nrows, ncols, ntbs);
71   for (Int_t  row = 0;  row <  nrows;  row++)
72   for (Int_t  col = 0;  col <  ncols;  col++)
73     for (Int_t time = 0; time < ntbs; time++) {
74       if((adc = data->GetDataUnchecked(row, col, time)) <= 1) continue;
75       printf("r[%d] c[%d] t[%d] ADC[%d]\n", row, col, time, adc);
76     }
77   data->Compress(1);
78 }
79 */
80
81 //_______________________________________________________
82 void analyseClusters(TEvePointSet *points = 0x0)
83 {
84 // print some info about clusters in one detector or 
85 // attached to tracks.
86   if(!points) {
87     Info("analyseClusters", "Invalid clusters set.");
88     return;
89   }
90
91   AliTRDcluster *c = 0x0;
92   for(Int_t ic=0; ic<points->Size(); ic++){
93     if(!(c = (AliTRDcluster*)points->GetPointId(ic))) continue;
94   
95     c->Print();
96   }
97 }
98
99 //_______________________________________________________
100 void analyseTracklet(AliEveTRDTracklet *line)
101 {
102 // print tracklet information
103   if(!line) {
104     Info("analyseTracklet", "Invalid tracklet.");
105     return;
106   }
107   
108   AliTRDseedV1 *tracklet = 0x0;
109   tracklet = (AliTRDseedV1*)line->GetUserData();
110   tracklet->Print();
111 }
112
113 //_______________________________________________________
114 void analyseTrack(AliEveTRDTrack *line)
115 {
116 // print tracklet information
117   if(!line) {
118     Info("analyseTrack", "Invalid track.");
119     return;
120   }
121   
122   AliTRDtrackV1 *track = 0x0;
123   track = (AliTRDtrackV1*)line->GetUserData();
124   
125   AliTRDReconstructor *rec = new AliTRDReconstructor();
126   rec->SetRecoParam(AliTRDrecoParam::GetLowFluxParam());
127   track->SetReconstructor(rec);
128
129   rec->SetOption("!nn");
130   track->CookPID();
131   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");
132
133   rec->SetOption("nn");
134   track->CookPID();
135   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");
136 }
137
138 //_______________________________________________________
139 void trd_analyse()
140 {
141   Info("trd_analyse", "******************************");
142   Info("trd_analyse", "Example function which shows how to analyse TRD data exported from the EVE display.");
143   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.");
144   Info("trd_analyse", "E.g. If \"tracklet\" is a pointer to a TRD track than one can call :"); 
145   Info("trd_analyse", "analyseTrack(track)");
146
147   //gROOT->LoadMacro("$ALICE_ROOT/EVE/alice-macros/trd_analyse.C");
148   return;
149 }