]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MFT/AliMFTPlane.cxx
Fix Coverity
[u/mrichter/AliRoot.git] / MFT / AliMFTPlane.cxx
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 *                                                                        *
4 * Author: The ALICE Off-line Project.                                    *
5 * Contributors are mentioned in the code where appropriate.              *
6 *                                                                        *
7 * Permission to use, copy, modify and distribute this software and its   *
8 * documentation strictly for non-commercial purposes is hereby granted   *
9 * without fee, provided that the above copyright notice appears in all   *
10 * copies and that both the copyright notice and this permission notice   *
11 * appear in the supporting documentation. The authors make no claims     *
12 * about the suitability of this software for any purpose. It is          *
13 * provided "as is" without express or implied warranty.                  *
14 **************************************************************************/
15
16 //====================================================================================================================================================
17 //
18 //      Class for the description of the structure for the planes of the ALICE Muon Forward Tracker
19 //
20 //      Contact author: antonio.uras@cern.ch
21 //
22 //====================================================================================================================================================
23
24 #include "TNamed.h"
25 #include "THnSparse.h"
26 #include "TClonesArray.h"
27 #include "AliMFTPlane.h"
28 #include "TAxis.h"
29 #include "TPave.h"
30 #include "TCanvas.h"
31 #include "TH2D.h"
32 #include "TEllipse.h"
33 #include "TMath.h"
34 #include "AliLog.h"
35
36 ClassImp(AliMFTPlane)
37
38 //====================================================================================================================================================
39
40 AliMFTPlane::AliMFTPlane():
41   TNamed(),
42   fPlaneNumber(0),
43   fZCenter(0), 
44   fRMinSupport(0), 
45   fRMax(0),
46   fRMaxSupport(0),
47   fPixelSizeX(0), 
48   fPixelSizeY(0), 
49   fThicknessActive(0), 
50   fThicknessSupport(0), 
51   fThicknessReadout(0),
52   fZCenterActiveFront(0),
53   fZCenterActiveBack(0),
54   fEquivalentSilicon(0),
55   fEquivalentSiliconBeforeFront(0),
56   fEquivalentSiliconBeforeBack(0),
57   fActiveElements(0),
58   fReadoutElements(0),
59   fSupportElements(0)
60 {
61
62   fPlaneNumber = -1;
63
64   fActiveElements  = new TClonesArray("THnSparseC");
65   fReadoutElements = new TClonesArray("THnSparseC");
66   fSupportElements = new TClonesArray("THnSparseC");
67
68   // default constructor
69
70 }
71
72 //====================================================================================================================================================
73
74 AliMFTPlane::AliMFTPlane(const Char_t *name, const Char_t *title):
75   TNamed(name, title),
76   fPlaneNumber(0),
77   fZCenter(0), 
78   fRMinSupport(0), 
79   fRMax(0),
80   fRMaxSupport(0),
81   fPixelSizeX(0), 
82   fPixelSizeY(0), 
83   fThicknessActive(0), 
84   fThicknessSupport(0), 
85   fThicknessReadout(0),
86   fZCenterActiveFront(0),
87   fZCenterActiveBack(0),
88   fEquivalentSilicon(0),
89   fEquivalentSiliconBeforeFront(0),
90   fEquivalentSiliconBeforeBack(0),
91   fActiveElements(0),
92   fReadoutElements(0),
93   fSupportElements(0)
94 {
95
96   fPlaneNumber = -1;
97
98   fActiveElements  = new TClonesArray("THnSparseC");
99   fReadoutElements = new TClonesArray("THnSparseC");
100   fSupportElements = new TClonesArray("THnSparseC");
101
102   // default constructor
103
104 }
105
106 //====================================================================================================================================================
107
108 AliMFTPlane::AliMFTPlane(const AliMFTPlane& plane):
109   TNamed(plane),
110   fPlaneNumber(plane.fPlaneNumber),
111   fZCenter(plane.fZCenter), 
112   fRMinSupport(plane.fRMinSupport), 
113   fRMax(plane.fRMax),
114   fRMaxSupport(plane.fRMaxSupport),
115   fPixelSizeX(plane.fPixelSizeX), 
116   fPixelSizeY(plane.fPixelSizeY), 
117   fThicknessActive(plane.fThicknessActive), 
118   fThicknessSupport(plane.fThicknessSupport), 
119   fThicknessReadout(plane.fThicknessReadout),
120   fZCenterActiveFront(plane.fZCenterActiveFront),
121   fZCenterActiveBack(plane.fZCenterActiveBack),
122   fEquivalentSilicon(plane.fEquivalentSilicon),
123   fEquivalentSiliconBeforeFront(plane.fEquivalentSiliconBeforeFront),
124   fEquivalentSiliconBeforeBack(plane.fEquivalentSiliconBeforeBack),
125   fActiveElements(plane.fActiveElements),
126   fReadoutElements(plane.fReadoutElements),
127   fSupportElements(plane.fSupportElements)
128 {
129
130   // copy constructor
131   
132 }
133
134 //====================================================================================================================================================
135
136 AliMFTPlane& AliMFTPlane::operator=(const AliMFTPlane& plane) {
137
138   // Assignment operator
139
140   // check assignement to self
141   if (this == &plane) return *this;
142
143   // base class assignement
144   TNamed::operator=(plane);
145   
146   // clear memory
147   Clear();
148
149   fPlaneNumber                  = plane.fPlaneNumber;
150   fZCenter                      = plane.fZCenter; 
151   fRMinSupport                  = plane.fRMinSupport; 
152   fRMax                         = plane.fRMax;
153   fRMaxSupport                  = plane.fRMaxSupport;
154   fPixelSizeX                   = plane.fPixelSizeX;
155   fPixelSizeY                   = plane.fPixelSizeY; 
156   fThicknessActive              = plane.fThicknessActive; 
157   fThicknessSupport             = plane.fThicknessSupport; 
158   fThicknessReadout             = plane.fThicknessReadout;
159   fZCenterActiveFront           = plane.fZCenterActiveFront;
160   fZCenterActiveBack            = plane.fZCenterActiveBack;
161   fEquivalentSilicon            = plane.fEquivalentSilicon;
162   fEquivalentSiliconBeforeFront = plane.fEquivalentSiliconBeforeFront;
163   fEquivalentSiliconBeforeBack  = plane.fEquivalentSiliconBeforeBack;
164   fActiveElements               = plane.fActiveElements;
165   fReadoutElements              = plane.fReadoutElements;
166   fSupportElements              = plane.fSupportElements;
167
168   return *this;
169
170 }
171
172 //====================================================================================================================================================
173
174 Bool_t AliMFTPlane::Init(Int_t    planeNumber,
175                          Double_t zCenter, 
176                          Double_t rMin, 
177                          Double_t rMax, 
178                          Double_t pixelSizeX, 
179                          Double_t pixelSizeY, 
180                          Double_t thicknessActive, 
181                          Double_t thicknessSupport, 
182                          Double_t thicknessReadout) {
183
184   AliDebug(1, Form("Initializing Plane Structure for Plane %s", GetName()));
185
186   fPlaneNumber      = planeNumber;
187   fZCenter          = zCenter;
188   fRMinSupport      = rMin;
189   fRMax             = rMax;
190   fPixelSizeX       = pixelSizeX;
191   fPixelSizeY       = pixelSizeY;
192   fThicknessActive  = thicknessActive;
193   fThicknessSupport = thicknessSupport;
194   fThicknessReadout = thicknessReadout;
195
196   fZCenterActiveFront = fZCenter - 0.5*fThicknessSupport - 0.5*fThicknessActive;
197   fZCenterActiveBack  = fZCenter + 0.5*fThicknessSupport + 0.5*fThicknessActive;
198
199   if (fRMinSupport <= fRadiusMin) fRMinSupport = fRadiusMin;
200   else {
201     fRMinSupport = fRadiusMin + (fHeightActive-fActiveSuperposition) * Int_t((fRMinSupport-fRadiusMin)/(fHeightActive-fActiveSuperposition));
202   }
203   
204   if (fRMax < fRMinSupport+fHeightActive) fRMax = fRMinSupport + fHeightActive;
205   
206   fRMax = fRMinSupport + (fHeightActive-fActiveSuperposition) * 
207     (Int_t((fRMax-fRMinSupport-fHeightActive)/(fHeightActive-fActiveSuperposition))+1) + fHeightActive;
208   
209   fRMaxSupport = TMath::Sqrt(fHeightActive*(rMax-fHeightActive) + fRMax*fRMax) + fSupportExtMargin;
210  
211   return kTRUE;
212  
213 }
214
215 //====================================================================================================================================================
216
217 Bool_t AliMFTPlane::CreateStructure() {
218
219   Int_t nBins[3]={0};
220   Double_t minPosition[3]={0}, maxPosition[3]={0};
221   
222   // ------------------- support element -------------------------------------------------
223   
224   nBins[0] = 1;
225   nBins[1] = 1;
226   nBins[2] = 1;
227   
228   minPosition[0] = -1.*fRMaxSupport;
229   minPosition[1] = -1.*fRMaxSupport;
230   minPosition[2] = fZCenter - 0.5*fThicknessSupport;
231   
232   maxPosition[0] = +1.*fRMaxSupport;
233   maxPosition[1] = +1.*fRMaxSupport;
234   maxPosition[2] = fZCenter + 0.5*fThicknessSupport;
235   
236   new ((*fSupportElements)[fSupportElements->GetEntries()]) THnSparseC(Form("MFTSupportElemHist_%02d%03d", fPlaneNumber, fSupportElements->GetEntries()), 
237                                                                        Form("MFTSupportElemHist_%02d%03d", fPlaneNumber, fSupportElements->GetEntries()), 
238                                                                        3, nBins, minPosition, maxPosition);
239
240   // ------------------- det elements: active + readout ----------------------------------
241   
242   Double_t lowEdgeActive = -1.*fRMax;
243   Double_t supEdgeActive = lowEdgeActive + fHeightActive;
244   Double_t zMin = 0.;
245   Bool_t isFront = kTRUE;
246   
247   while (supEdgeActive < fRMax+0.01) {
248     
249     if (isFront) zMin = fZCenter - 0.5*fThicknessSupport - fThicknessActive;
250     else         zMin = fZCenter + 0.5*fThicknessSupport;
251     
252     Double_t extLimitAtLowEdgeActive = TMath::Sqrt((fRMax-TMath::Abs(lowEdgeActive)) * TMath::Abs(2*fRMax - (fRMax-TMath::Abs(lowEdgeActive))));
253     Double_t extLimitAtSupEdgeActive = TMath::Sqrt((fRMax-TMath::Abs(supEdgeActive)) * TMath::Abs(2*fRMax - (fRMax-TMath::Abs(supEdgeActive))));
254     
255     // creating new det element: active + readout
256     
257     Double_t extLimitDetElem = TMath::Max(extLimitAtLowEdgeActive, extLimitAtSupEdgeActive);
258     
259     if (supEdgeActive<-1.*fRMinSupport+0.01 || lowEdgeActive>1.*fRMinSupport-0.01) {     // single element covering the row
260       
261       nBins[0] = TMath::Nint(2.*extLimitDetElem/fPixelSizeX);
262       nBins[1] = TMath::Nint(fHeightActive/fPixelSizeY);
263       nBins[2] = 1;
264       
265       minPosition[0] = -1.*extLimitDetElem;
266       minPosition[1] = lowEdgeActive;
267       minPosition[2] = zMin;
268       
269       maxPosition[0] = +1.*extLimitDetElem;
270       maxPosition[1] = supEdgeActive;
271       maxPosition[2] = zMin+fThicknessActive; 
272       
273       new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
274                                                                          Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
275                                                                          3, nBins, minPosition, maxPosition);
276       
277       if (supEdgeActive>0.) {
278         minPosition[1] = supEdgeActive;
279         maxPosition[1] = supEdgeActive+fHeightReadout;
280       }
281       else {
282         minPosition[1] = lowEdgeActive-fHeightReadout;
283         maxPosition[1] = lowEdgeActive;
284       }
285       
286       new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
287                                                                            Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
288                                                                            3, nBins, minPosition, maxPosition);
289       
290     }
291     
292     else {     // two elements covering the row
293       
294       Double_t intLimitAtLowEdge = 0., intLimitAtSupEdge = 0.;
295       if (fRMinSupport-TMath::Abs(lowEdgeActive)>0.) intLimitAtLowEdge = TMath::Sqrt((fRMinSupport-TMath::Abs(lowEdgeActive)) * TMath::Abs(2*fRMinSupport - (fRMinSupport-TMath::Abs(lowEdgeActive))));
296       if (fRMinSupport-TMath::Abs(supEdgeActive)>0.) intLimitAtSupEdge = TMath::Sqrt((fRMinSupport-TMath::Abs(supEdgeActive)) * TMath::Abs(2*fRMinSupport - (fRMinSupport-TMath::Abs(supEdgeActive))));
297       Double_t intLimitDetElem = TMath::Max(intLimitAtLowEdge, intLimitAtSupEdge);
298       
299       nBins[0] = TMath::Nint((extLimitDetElem-intLimitDetElem)/fPixelSizeX);
300       nBins[1] = TMath::Nint(fHeightActive/fPixelSizeY);
301       nBins[2] = 1;
302       
303       // left element
304       
305       minPosition[0] = -1.*extLimitDetElem;
306       minPosition[1] = lowEdgeActive;
307       minPosition[2] = zMin;
308       
309       maxPosition[0] = -1.*intLimitDetElem;
310       maxPosition[1] = supEdgeActive;
311       maxPosition[2] = zMin+fThicknessActive; 
312       
313       new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
314                                                                          Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
315                                                                          3, nBins, minPosition, maxPosition);   
316       
317       if (supEdgeActive>0.) {
318         minPosition[1] = supEdgeActive;
319         maxPosition[1] = supEdgeActive+fHeightReadout;
320       }
321       else {
322         minPosition[1] = lowEdgeActive-fHeightReadout;
323         maxPosition[1] = lowEdgeActive;
324       }
325       
326       new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
327                                                                            Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
328                                                                            3, nBins, minPosition, maxPosition);
329       
330       // right element
331       
332       minPosition[0] = +1.*intLimitDetElem;
333       minPosition[1] = lowEdgeActive;
334       minPosition[2] = zMin;
335       
336       maxPosition[0] = +1.*extLimitDetElem;
337       maxPosition[1] = supEdgeActive;
338       maxPosition[2] = zMin+fThicknessActive; 
339       
340       new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
341                                                                          Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
342                                                                          3, nBins, minPosition, maxPosition);   
343       
344       if (supEdgeActive>0.) {
345         minPosition[1] = supEdgeActive;
346         maxPosition[1] = supEdgeActive+fHeightReadout;
347       }
348       else {
349         minPosition[1] = lowEdgeActive-fHeightReadout;
350         maxPosition[1] = lowEdgeActive;
351       }
352       
353       new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
354                                                                            Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
355                                                                            3, nBins, minPosition, maxPosition);
356       
357     }
358     
359     lowEdgeActive += fHeightActive - fActiveSuperposition;
360     supEdgeActive = lowEdgeActive + fHeightActive;
361     isFront = !isFront;
362     
363   }
364   
365   AliDebug(1, Form("Structure completed for MFT plane %s", GetName()));
366
367   return kTRUE;
368   
369 }
370
371 //====================================================================================================================================================
372
373 THnSparseC* AliMFTPlane::GetActiveElement(Int_t id) {
374
375   if (id<0 || id>=GetNActiveElements()) return NULL;
376   else return (THnSparseC*) fActiveElements->At(id);
377
378 }
379
380 //====================================================================================================================================================
381
382 THnSparseC* AliMFTPlane::GetReadoutElement(Int_t id) {
383
384   if (id<0 || id>=GetNReadoutElements()) return NULL;
385   else return (THnSparseC*) fReadoutElements->At(id);
386
387 }
388
389 //====================================================================================================================================================
390
391 THnSparseC* AliMFTPlane::GetSupportElement(Int_t id) {
392
393   if (id<0 || id>=GetNSupportElements()) return NULL;
394   else return (THnSparseC*) fSupportElements->At(id);
395
396 }
397
398 //====================================================================================================================================================
399
400 void AliMFTPlane::DrawPlane(Char_t *opt) {
401
402   // ------------------- "FRONT" option ------------------
403
404   if (!strcmp(opt, "front")) {
405
406     TCanvas *cnv = new TCanvas("cnv", GetName(), 900, 900);
407     cnv->Draw();
408
409     //    printf("Created Canvas\n");
410
411     TH2D *h = new TH2D("tmp", GetName(), 
412                        1, 1.1*GetSupportElement(0)->GetAxis(0)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(0)->GetXmax(), 
413                        1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
414     h->SetXTitle("x [cm]");
415     h->SetYTitle("y [cm]");
416     h->Draw();
417
418     printf("Created hist\n");
419
420     TEllipse *supportExt = new TEllipse(0.0, 0.0, fRMaxSupport, fRMaxSupport);
421     TEllipse *supportInt = new TEllipse(0.0, 0.0, fRMinSupport, fRMinSupport);
422     supportExt->SetFillColor(kCyan-10);
423     supportExt -> Draw("same");
424     supportInt -> Draw("same");
425
426     //    printf("Created Ellipses\n");
427
428     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
429       //      printf("Active element %d\n", iEl);
430       if (!IsFront(GetActiveElement(iEl))) continue;
431       TPave *pave = new TPave(GetActiveElement(iEl)->GetAxis(0)->GetXmin(), 
432                               GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
433                               GetActiveElement(iEl)->GetAxis(0)->GetXmax(), 
434                               GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
435       pave -> SetFillColor(kGreen);
436       pave -> Draw("same");
437     }
438
439     for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
440       //      printf("Readout element %d\n", iEl);
441       if (!IsFront(GetReadoutElement(iEl))) continue;
442       TPave *pave = new TPave(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(), 
443                               GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
444                               GetReadoutElement(iEl)->GetAxis(0)->GetXmax(), 
445                               GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
446       pave -> SetFillColor(kRed);
447       pave -> Draw("same");
448     }
449
450   }
451     
452   // ------------------- "BACK" option ------------------
453
454   else if (!strcmp(opt, "back")) {
455
456     TCanvas *cnv = new TCanvas("cnv", GetName(), 900, 900);
457     cnv->Draw();
458     
459     TH2D *h = new TH2D("tmp", GetName(), 
460                        1, 1.1*GetSupportElement(0)->GetAxis(0)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(0)->GetXmax(), 
461                        1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
462     h->SetXTitle("x [cm]");
463     h->SetYTitle("y [cm]");
464     h->Draw();
465
466     TEllipse *supportExt = new TEllipse(0.0, 0.0, fRMaxSupport, fRMaxSupport);
467     TEllipse *supportInt = new TEllipse(0.0, 0.0, fRMinSupport, fRMinSupport);
468     supportExt -> SetFillColor(kCyan-10);
469     supportExt -> Draw("same");
470     supportInt -> Draw("same");
471
472     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
473       if (IsFront(GetActiveElement(iEl))) continue;
474       TPave *pave = new TPave(GetActiveElement(iEl)->GetAxis(0)->GetXmin(), 
475                               GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
476                               GetActiveElement(iEl)->GetAxis(0)->GetXmax(), 
477                               GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
478       pave -> SetFillColor(kGreen);
479       pave -> Draw("same");
480     }
481
482     for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
483       if (IsFront(GetReadoutElement(iEl))) continue;
484       TPave *pave = new TPave(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(), 
485                               GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
486                               GetReadoutElement(iEl)->GetAxis(0)->GetXmax(), 
487                               GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
488       pave -> SetFillColor(kRed);
489       pave -> Draw("same");
490     }
491
492   }
493
494   // ------------------- "BOTH" option ------------------
495
496   else if (!strcmp(opt, "both")) {
497
498     TCanvas *cnv = new TCanvas("cnv", GetName(), 900, 900);
499     cnv->Draw();
500
501     TH2D *h = new TH2D("tmp", GetName(), 
502                        1, 1.1*GetSupportElement(0)->GetAxis(0)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(0)->GetXmax(), 
503                        1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
504     h->SetXTitle("x [cm]");
505     h->SetYTitle("y [cm]");
506     h->Draw();
507
508     TEllipse *supportExt = new TEllipse(0.0, 0.0, fRMaxSupport, fRMaxSupport);
509     TEllipse *supportInt = new TEllipse(0.0, 0.0, fRMinSupport, fRMinSupport);
510     supportExt -> SetFillColor(kCyan-10);
511     supportExt -> Draw("same");
512     supportInt -> Draw("same");
513
514     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
515       if (IsFront(GetActiveElement(iEl)) && GetActiveElement(iEl)->GetAxis(0)->GetXmin()<0.) {
516         TPave *pave = new TPave(GetActiveElement(iEl)->GetAxis(0)->GetXmin(), 
517                                 GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
518                                 TMath::Min(GetActiveElement(iEl)->GetAxis(0)->GetXmax(), 0.),
519                                 GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
520         pave -> SetFillColor(kGreen);
521         pave -> Draw("same");
522       }
523       else if (!IsFront(GetActiveElement(iEl)) && GetActiveElement(iEl)->GetAxis(0)->GetXmax()>0.) {
524         TPave *pave = new TPave(TMath::Max(GetActiveElement(iEl)->GetAxis(0)->GetXmin(), 0.), 
525                                 GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
526                                 GetActiveElement(iEl)->GetAxis(0)->GetXmax(), 
527                                 GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
528         pave -> SetFillColor(kGreen);
529         pave -> Draw("same");
530       }
531     }
532     
533     for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
534       if (IsFront(GetReadoutElement(iEl)) && GetReadoutElement(iEl)->GetAxis(0)->GetXmin()<0.) {
535         TPave *pave = new TPave(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(), 
536                                 GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
537                                 TMath::Min(GetReadoutElement(iEl)->GetAxis(0)->GetXmax(), 0.), 
538                                 GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
539         pave -> SetFillColor(kRed);
540         pave -> Draw("same");
541       }
542       else if (!IsFront(GetReadoutElement(iEl)) && GetReadoutElement(iEl)->GetAxis(0)->GetXmax()>0.) {
543         TPave *pave = new TPave(TMath::Max(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(), 0.),  
544                                 GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
545                                 GetReadoutElement(iEl)->GetAxis(0)->GetXmax(), 
546                                 GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
547         pave -> SetFillColor(kRed);
548         pave -> Draw("same");
549       }
550     }
551     
552   }
553
554   // ------------------- "PROFILE" option ------------------
555
556   else if (!strcmp(opt, "profile")) {
557
558     TCanvas *cnv = new TCanvas("cnv", GetName(), 300, 900);
559     cnv->Draw();
560
561     TH2D *h = new TH2D("tmp", GetName(), 
562                        1, fZCenter-0.5, fZCenter+0.5, 
563                        1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
564     h->SetXTitle("z [cm]");
565     h->SetYTitle("y [cm]");
566     h->Draw();
567
568     TPave *supportExt = new TPave(GetSupportElement(0)->GetAxis(2)->GetXmin(), -fRMaxSupport, 
569                                   GetSupportElement(0)->GetAxis(2)->GetXmax(),  fRMaxSupport);
570     TPave *supportInt = new TPave(GetSupportElement(0)->GetAxis(2)->GetXmin(), -fRMinSupport, 
571                                   GetSupportElement(0)->GetAxis(2)->GetXmax(),  fRMinSupport);
572     supportExt -> SetFillColor(kCyan-10);
573     supportInt -> SetFillColor(kCyan-10);
574     supportExt -> SetBorderSize(1);
575     supportInt -> SetBorderSize(1);
576     supportExt -> Draw("same");
577     supportInt -> Draw("same");
578
579     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
580       TPave * pave = 0;
581       if (IsFront(GetActiveElement(iEl))) {
582         pave = new TPave(GetActiveElement(iEl)->GetAxis(2)->GetXmax() - 
583                          5*(GetActiveElement(iEl)->GetAxis(2)->GetXmax()-GetActiveElement(iEl)->GetAxis(2)->GetXmin()), 
584                          GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
585                          GetActiveElement(iEl)->GetAxis(2)->GetXmax(), 
586                          GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
587       }
588       else {
589         pave = new TPave(GetActiveElement(iEl)->GetAxis(2)->GetXmin(), 
590                          GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
591                          GetActiveElement(iEl)->GetAxis(2)->GetXmin() + 
592                          5*(GetActiveElement(iEl)->GetAxis(2)->GetXmax()-GetActiveElement(iEl)->GetAxis(2)->GetXmin()), 
593                          GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
594       } 
595       pave -> SetFillColor(kGreen);
596       pave -> Draw("same");
597     }
598     
599     for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
600       TPave *pave = 0;
601       if (IsFront(GetReadoutElement(iEl))) {
602         pave = new TPave(GetReadoutElement(iEl)->GetAxis(2)->GetXmax() - 
603                          5*(GetReadoutElement(iEl)->GetAxis(2)->GetXmax()-GetReadoutElement(iEl)->GetAxis(2)->GetXmin()), 
604                          GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
605                          GetReadoutElement(iEl)->GetAxis(2)->GetXmax(), 
606                          GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
607       }
608       else {
609         pave = new TPave(GetReadoutElement(iEl)->GetAxis(2)->GetXmin(), 
610                          GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
611                          GetReadoutElement(iEl)->GetAxis(2)->GetXmin() + 
612                          5*(GetReadoutElement(iEl)->GetAxis(2)->GetXmax()-GetReadoutElement(iEl)->GetAxis(2)->GetXmin()), 
613                          GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
614       } 
615       pave -> SetFillColor(kRed);
616       pave -> Draw("same");
617     }
618     
619   }
620
621 }
622
623 //====================================================================================================================================================
624