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