]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/Macros/AliTRDdisplayDigits3D.C
Using the corrected version of MeanMaterialBudget (Yuri)
[u/mrichter/AliRoot.git] / TRD / Macros / AliTRDdisplayDigits3D.C
CommitLineData
00653a86 1//_____________________________________________________________________________
fcb33df6 2Int_t AliTRDdisplayDigits3D(Int_t event = 0, Int_t thresh = 4
00653a86 3 , Bool_t sdigits = kFALSE)
4{
5 //
6 // TRD digits display
7 //
8 // Input parameter:
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.
13 //
14
15 Char_t *inputFile = "galice.root";
16
00653a86 17 // Define the objects
18 AliTRDv1 *trd;
19 AliTRDgeometry *geo;
20
fcb33df6 21 TString evfoldname = AliConfig::GetDefaultEventFolderName();
22 AliRunLoader *runLoader = AliRunLoader::GetRunLoader(evfoldname);
23 if (!runLoader) {
24 runLoader = AliRunLoader::Open(inputFile
25 ,AliConfig::GetDefaultEventFolderName()
26 ,"UPDATE");
00653a86 27 }
fcb33df6 28 if (!runLoader) {
29 printf("Can not open session for file %s.",inputFile);
a328fff9 30 return kFALSE;
31 }
32
fcb33df6 33 if (!runLoader->GetAliRun()) {
34 runLoader->LoadgAlice();
a328fff9 35 }
fcb33df6 36 gAlice = runLoader->GetAliRun();
a328fff9 37 if (!gAlice) {
38 printf("Could not find AliRun object.\n");
39 return kFALSE;
00653a86 40 }
41
fcb33df6 42 runLoader->GetEvent(event);
a328fff9 43
fcb33df6 44 AliLoader *loader = runLoader->GetLoader("TRDLoader");
a328fff9 45 if (!loader) {
46 printf("Can not get TRD loader from Run Loader");
47 }
48 loader->LoadDigits();
00653a86 49
50 // Get the pointer to the detector object
51 trd = (AliTRDv1*) gAlice->GetDetector("TRD");
52
53 // Get the pointer to the geometry object
54 if (trd) {
55 geo = trd->GetGeometry();
56 }
57 else {
58 printf("Cannot find the geometry\n");
59 return 1;
60 }
61
417be34b 62 AliCDBManager *cdbManager = AliCDBManager::Instance();
63 cdbManager->SetDefaultStorage("local://$ALICE_ROOT");
64 AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
65 calibration->SetRun(0);
66
00653a86 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);
fcb33df6 70 v->SetParallel();
00653a86 71 c1->Clear();
72 c1->SetFillColor(1);
73 c1->SetTheta(90.0);
74 c1->SetPhi(0.0);
75
76 Int_t markerColorSignal = 2;
77 Int_t markerColorBgnd = 7;
78 Int_t markerColorMerged = 5;
79 Int_t mask = 10000000;
80
81 // Create the digits manager
82 AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager();
00653a86 83 digitsManager->SetSDigits(sdigits);
84
85 // Read the digits from the file
a328fff9 86 if (sdigits) {
87 digitsManager->ReadDigits(loader->TreeS());
88 }
89 else {
90 if (!loader->TreeD()) {
91 printf("mist\n");
92 return kFALSE;
93 }
94 digitsManager->ReadDigits(loader->TreeD());
95 }
00653a86 96
97 Int_t totalsignal = 0;
98 Int_t totalbgnd = 0;
99 Int_t totalmerged = 0;
417be34b 100 Int_t timeMax = calibration->GetNumberOfTimeBins();
00653a86 101
102 // Loop through all detectors
103 for (Int_t idet = 0; idet < geo->Ndet(); idet++) {
104
105 printf("<AliTRDdisplayDigits3D> Loading detector %d\n",idet);
106 AliTRDdataArrayI *digits = digitsManager->GetDigits(idet);
107 digits->Expand();
00653a86 108
109 Int_t isec = geo->GetSector(idet);
110 Int_t icha = geo->GetChamber(idet);
111 Int_t ipla = geo->GetPlane(idet);
417be34b 112 AliTRDpadPlane *padPlane = new AliTRDpadPlane(ipla,icha);
113 Int_t rowMax = padPlane->GetNrows();
114 Int_t colMax = padPlane->GetNcols();
00653a86 115
116 Int_t ndigits = digits->GetOverThreshold(thresh);
117
118 if (ndigits > 0) {
119
120 TPolyMarker3D *pmSignal = new TPolyMarker3D(ndigits);
00653a86 121 Int_t isignal = 0;
00653a86 122
123 for (Int_t time = 0; time < timeMax; time++) {
124 for (Int_t col = 0; col < colMax; col++) {
125 for (Int_t row = 0; row < rowMax; row++) {
126
00653a86 127 Int_t amp = digits->GetDataUnchecked(row,col,time);
00653a86 128
129 if (amp > thresh) {
130
a5cadd36 131 Double_t glb[3];
132 Double_t loc[3];
00653a86 133
134 loc[0] = row;
135 loc[1] = col;
136 loc[2] = time;
417be34b 137 geo->Local2Global(idet,loc,glb);
a5cadd36 138 Double_t x = glb[0];
139 Double_t y = glb[1];
140 Double_t z = glb[2];
00653a86 141
fcb33df6 142 pmSignal->SetPoint(isignal,x,y,z);
143 isignal++;
144 totalsignal++;
00653a86 145
146 }
147
148 }
149 }
150 }
151
152 digits->Compress(1,0);
00653a86 153
154 pmSignal->SetMarkerSize(1);
155 pmSignal->SetMarkerColor(markerColorSignal);
156 pmSignal->SetMarkerStyle(1);
157 pmSignal->Draw();
158
159 }
160
161 }
162
417be34b 163 delete padPlane;
164
a328fff9 165 TGeometry *geoAlice = gAlice->GetGeometry();
00653a86 166 TNode *main = (TNode *) ((geoAlice->GetListOfNodes())->First());
167 TIter next(main->GetListOfNodes());
168 TNode *module = 0;
169 while ((module = (TNode *) next())) {
170 Char_t ch[100];
171 sprintf(ch,"%s\n",module->GetTitle());
172 if ((ch[0] == 'T') && ((ch[1] == 'R') || (ch[1] == 'P'))) {
173 module->SetVisibility( 3);
174 }
175 else {
176 module->SetVisibility(-1);
177 }
178 }
179
180 geoAlice->Draw("same");
181
182 c1->Modified();
183 c1->Update();
184
00653a86 185 return 0;
186
187}
188