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 TString evfoldname = AliConfig::GetDefaultEventFolderName();
27 fRunLoader = AliRunLoader::GetRunLoader(evfoldname);
29 fRunLoader = AliRunLoader::Open(inputFile
30 ,AliConfig::GetDefaultEventFolderName()
34 Printf("Can not open session for file %s.",inputFile);
38 if (!fRunLoader->GetAliRun()) {
39 fRunLoader->LoadgAlice();
41 gAlice = fRunLoader->GetAliRun();
43 printf("Could not find AliRun object.\n");
47 fRunLoader->GetEvent(event);
49 AliLoader *loader = fRunLoader->GetLoader("TRDLoader");
51 printf("Can not get TRD loader from Run Loader");
55 // Get the pointer to the detector object
56 trd = (AliTRDv1*) gAlice->GetDetector("TRD");
58 // Get the pointer to the geometry object
60 geo = trd->GetGeometry();
63 printf("Cannot find the geometry\n");
67 TCanvas *c1 = new TCanvas("digits","TRD digits display",0,0,700,730);
68 TView *v = new TView(1);
69 v->SetRange(-430,-560,-430,430,560,1710);
75 Int_t markerColorSignal = 2;
76 Int_t markerColorBgnd = 7;
77 Int_t markerColorMerged = 5;
78 Int_t mask = 10000000;
80 // Create the digits manager
81 AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
82 digitsManager->SetDebug(1);
83 digitsManager->SetSDigits(sdigits);
85 // Read the digits from the file
87 digitsManager->ReadDigits(loader->TreeS());
90 if (!loader->TreeD()) {
94 digitsManager->ReadDigits(loader->TreeD());
97 Int_t totalsignal = 0;
99 Int_t totalmerged = 0;
101 AliTRDparameter *par = new AliTRDparameter("TRDparameter","TRD parameter class");
103 // Loop through all detectors
104 for (Int_t idet = 0; idet < geo->Ndet(); idet++) {
106 printf("<AliTRDdisplayDigits3D> Loading detector %d\n",idet);
107 AliTRDdataArrayI *digits = digitsManager->GetDigits(idet);
109 AliTRDdataArrayI *tracks[kNdict];
110 for (Int_t idict = 0; idict < kNdict; idict++) {
111 tracks[idict] = digitsManager->GetDictionary(idet,idict);
112 tracks[idict]->Expand();
115 Int_t isec = geo->GetSector(idet);
116 Int_t icha = geo->GetChamber(idet);
117 Int_t ipla = geo->GetPlane(idet);
118 Int_t rowMax = par->GetRowMax(ipla,icha,isec);
119 Int_t colMax = par->GetColMax(ipla);
120 Int_t timeMax = par->GetTimeMax();
122 Int_t ndigits = digits->GetOverThreshold(thresh);
126 TPolyMarker3D *pmSignal = new TPolyMarker3D(ndigits);
127 TPolyMarker3D *pmBgnd = new TPolyMarker3D(ndigits);
128 TPolyMarker3D *pmMerged = new TPolyMarker3D(ndigits);
134 for (Int_t time = 0; time < timeMax; time++) {
135 for (Int_t col = 0; col < colMax; col++) {
136 for (Int_t row = 0; row < rowMax; row++) {
140 Int_t amp = digits->GetDataUnchecked(row,col,time);
141 for (idict = 0; idict < kNdict; idict++) {
142 Int_t trk = tracks[idict]->GetDataUnchecked(row,col,time) - 1;
143 if ((idict == 0) && (trk >= mask)) {
146 if ((type == 1) && (trk >= mask)) {
159 geo->Local2Global(idet,loc,glb,par);
165 pmSignal->SetPoint(isignal,x,y,z);
169 else if (type == 2) {
170 pmBgnd->SetPoint(ibgnd,x,y,z);
174 else if (type == 3) {
175 pmMerged->SetPoint(imerged,x,y,z);
186 digits->Compress(1,0);
187 for (idict = 0; idict < kNdict; idict++) {
188 tracks[idict]->Compress(1,0);
191 pmMerged->SetMarkerSize(1);
192 pmMerged->SetMarkerColor(markerColorMerged);
193 pmMerged->SetMarkerStyle(1);
196 pmBgnd->SetMarkerSize(1);
197 pmBgnd->SetMarkerColor(markerColorBgnd);
198 pmBgnd->SetMarkerStyle(1);
201 pmSignal->SetMarkerSize(1);
202 pmSignal->SetMarkerColor(markerColorSignal);
203 pmSignal->SetMarkerStyle(1);
210 TGeometry *geoAlice = gAlice->GetGeometry();
211 TNode *main = (TNode *) ((geoAlice->GetListOfNodes())->First());
212 TIter next(main->GetListOfNodes());
214 while ((module = (TNode *) next())) {
216 sprintf(ch,"%s\n",module->GetTitle());
217 if ((ch[0] == 'T') && ((ch[1] == 'R') || (ch[1] == 'P'))) {
218 module->SetVisibility( 3);
221 module->SetVisibility(-1);
225 geoAlice->Draw("same");
230 printf("<AliTRDdisplayDigits3D> Number of digits:\n");
231 printf(" signal = %d, bgnd = %d, merged = %d\n"
232 ,totalsignal,totalbgnd,totalmerged);