1 //_____________________________________________________________________________
2 Int_t AliTRDdisplayDigits3D(Int_t event = 0, Int_t thresh = 2
3 , Bool_t sdigits = kFALSE)
9 // <event> : Event number
10 // <thresh> : Threshold to suppress the noise
11 // <sdigits> : If kTRUE it will display summable digits, normal digits otherwise.
12 // The signal event is displayed in yellow.
15 Char_t *inputFile = "galice.root";
17 const Int_t kNdict = 3;
26 // Connect the AliRoot file containing Geometry, Kine, Hits, and digits
27 TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(inputFile);
29 printf("Open the ALIROOT-file %s\n",inputFile);
30 gafl = new TFile(inputFile);
33 printf("%s is already open",inputFile);
36 // Get AliRun object from file or create it if not on file
37 gAlice = (AliRun *) gafl->Get("gAlice");
38 if (!gAlice) return 1;
40 // Import the Trees for the event nEvent in the file
41 Int_t nparticles = gAlice->GetEvent(event);
42 if (nparticles <= 0) return 1;
44 // Get the pointer to the detector object
45 trd = (AliTRDv1*) gAlice->GetDetector("TRD");
47 // Get the pointer to the geometry object
49 geo = trd->GetGeometry();
52 printf("Cannot find the geometry\n");
56 TCanvas *c1 = new TCanvas("digits","TRD digits display",0,0,700,730);
57 TView *v = new TView(1);
58 v->SetRange(-430,-560,-430,430,560,1710);
64 Int_t markerColorSignal = 2;
65 Int_t markerColorBgnd = 7;
66 Int_t markerColorMerged = 5;
67 Int_t mask = 10000000;
69 // Create the digits manager
70 AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
71 digitsManager->SetDebug(1);
72 digitsManager->SetSDigits(sdigits);
74 // Read the digits from the file
75 digitsManager->Open(inputFile);
76 digitsManager->ReadDigits();
78 Int_t totalsignal = 0;
80 Int_t totalmerged = 0;
82 AliTRDparameter *par = new AliTRDparameter("TRDparameter","TRD parameter class");
84 // Loop through all detectors
85 for (Int_t idet = 0; idet < geo->Ndet(); idet++) {
87 printf("<AliTRDdisplayDigits3D> Loading detector %d\n",idet);
88 AliTRDdataArrayI *digits = digitsManager->GetDigits(idet);
90 AliTRDdataArrayI *tracks[kNdict];
91 for (Int_t idict = 0; idict < kNdict; idict++) {
92 tracks[idict] = digitsManager->GetDictionary(idet,idict);
93 tracks[idict]->Expand();
96 Int_t isec = geo->GetSector(idet);
97 Int_t icha = geo->GetChamber(idet);
98 Int_t ipla = geo->GetPlane(idet);
99 Int_t rowMax = par->GetRowMax(ipla,icha,isec);
100 Int_t colMax = par->GetColMax(ipla);
101 Int_t timeMax = par->GetTimeMax();
103 Int_t ndigits = digits->GetOverThreshold(thresh);
107 TPolyMarker3D *pmSignal = new TPolyMarker3D(ndigits);
108 TPolyMarker3D *pmBgnd = new TPolyMarker3D(ndigits);
109 TPolyMarker3D *pmMerged = new TPolyMarker3D(ndigits);
115 for (Int_t time = 0; time < timeMax; time++) {
116 for (Int_t col = 0; col < colMax; col++) {
117 for (Int_t row = 0; row < rowMax; row++) {
121 Int_t amp = digits->GetDataUnchecked(row,col,time);
122 for (idict = 0; idict < kNdict; idict++) {
123 Int_t trk = tracks[idict]->GetDataUnchecked(row,col,time) - 1;
124 if ((idict == 0) && (trk >= mask)) {
127 if ((type == 1) && (trk >= mask)) {
140 geo->Local2Global(idet,loc,glb,par);
146 pmSignal->SetPoint(isignal,x,y,z);
150 else if (type == 2) {
151 pmBgnd->SetPoint(ibgnd,x,y,z);
155 else if (type == 3) {
156 pmMerged->SetPoint(imerged,x,y,z);
167 digits->Compress(1,0);
168 for (idict = 0; idict < kNdict; idict++) {
169 tracks[idict]->Compress(1,0);
172 pmMerged->SetMarkerSize(1);
173 pmMerged->SetMarkerColor(markerColorMerged);
174 pmMerged->SetMarkerStyle(1);
177 pmBgnd->SetMarkerSize(1);
178 pmBgnd->SetMarkerColor(markerColorBgnd);
179 pmBgnd->SetMarkerStyle(1);
182 pmSignal->SetMarkerSize(1);
183 pmSignal->SetMarkerColor(markerColorSignal);
184 pmSignal->SetMarkerStyle(1);
191 TGeometry *geoAlice = (TGeometry *) gafl->Get("AliceGeom");
192 TNode *main = (TNode *) ((geoAlice->GetListOfNodes())->First());
193 TIter next(main->GetListOfNodes());
195 while ((module = (TNode *) next())) {
197 sprintf(ch,"%s\n",module->GetTitle());
198 if ((ch[0] == 'T') && ((ch[1] == 'R') || (ch[1] == 'P'))) {
199 module->SetVisibility( 3);
202 module->SetVisibility(-1);
206 geoAlice->Draw("same");
213 printf("<AliTRDdisplayDigits3D> Number of digits:\n");
214 printf(" signal = %d, bgnd = %d, merged = %d\n"
215 ,totalsignal,totalbgnd,totalmerged);