]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MFT/AliMFTPlane.cxx
2212f810f02268a35baae413d3c46604ff6f06dc
[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     TH2D *h = new TH2D("tmp", GetName(), 
407                        1, 1.1*GetSupportElement(0)->GetAxis(0)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(0)->GetXmax(), 
408                        1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
409     h->SetXTitle("x [cm]");
410     h->SetYTitle("y [cm]");
411     h->Draw();
412
413     AliInfo("Created hist");
414
415     TEllipse *supportExt = new TEllipse(0.0, 0.0, fRMaxSupport, fRMaxSupport);
416     TEllipse *supportInt = new TEllipse(0.0, 0.0, fRMinSupport, fRMinSupport);
417     supportExt->SetFillColor(kCyan-10);
418     supportExt -> Draw("same");
419     supportInt -> Draw("same");
420
421     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
422       if (!IsFront(GetActiveElement(iEl))) continue;
423       TPave *pave = new TPave(GetActiveElement(iEl)->GetAxis(0)->GetXmin(), 
424                               GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
425                               GetActiveElement(iEl)->GetAxis(0)->GetXmax(), 
426                               GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
427       pave -> SetFillColor(kGreen);
428       pave -> Draw("same");
429     }
430
431     for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
432       if (!IsFront(GetReadoutElement(iEl))) continue;
433       TPave *pave = new TPave(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(), 
434                               GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
435                               GetReadoutElement(iEl)->GetAxis(0)->GetXmax(), 
436                               GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
437       pave -> SetFillColor(kRed);
438       pave -> Draw("same");
439     }
440
441   }
442     
443   // ------------------- "BACK" option ------------------
444
445   else if (!strcmp(opt, "back")) {
446
447     TCanvas *cnv = new TCanvas("cnv", GetName(), 900, 900);
448     cnv->Draw();
449     
450     TH2D *h = new TH2D("tmp", GetName(), 
451                        1, 1.1*GetSupportElement(0)->GetAxis(0)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(0)->GetXmax(), 
452                        1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
453     h->SetXTitle("x [cm]");
454     h->SetYTitle("y [cm]");
455     h->Draw();
456
457     TEllipse *supportExt = new TEllipse(0.0, 0.0, fRMaxSupport, fRMaxSupport);
458     TEllipse *supportInt = new TEllipse(0.0, 0.0, fRMinSupport, fRMinSupport);
459     supportExt -> SetFillColor(kCyan-10);
460     supportExt -> Draw("same");
461     supportInt -> Draw("same");
462
463     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
464       if (IsFront(GetActiveElement(iEl))) continue;
465       TPave *pave = new TPave(GetActiveElement(iEl)->GetAxis(0)->GetXmin(), 
466                               GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
467                               GetActiveElement(iEl)->GetAxis(0)->GetXmax(), 
468                               GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
469       pave -> SetFillColor(kGreen);
470       pave -> Draw("same");
471     }
472
473     for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
474       if (IsFront(GetReadoutElement(iEl))) continue;
475       TPave *pave = new TPave(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(), 
476                               GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
477                               GetReadoutElement(iEl)->GetAxis(0)->GetXmax(), 
478                               GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
479       pave -> SetFillColor(kRed);
480       pave -> Draw("same");
481     }
482
483   }
484
485   // ------------------- "BOTH" option ------------------
486
487   else if (!strcmp(opt, "both")) {
488
489     TCanvas *cnv = new TCanvas("cnv", GetName(), 900, 900);
490     cnv->Draw();
491
492     TH2D *h = new TH2D("tmp", GetName(), 
493                        1, 1.1*GetSupportElement(0)->GetAxis(0)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(0)->GetXmax(), 
494                        1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
495     h->SetXTitle("x [cm]");
496     h->SetYTitle("y [cm]");
497     h->Draw();
498
499     TEllipse *supportExt = new TEllipse(0.0, 0.0, fRMaxSupport, fRMaxSupport);
500     TEllipse *supportInt = new TEllipse(0.0, 0.0, fRMinSupport, fRMinSupport);
501     supportExt -> SetFillColor(kCyan-10);
502     supportExt -> Draw("same");
503     supportInt -> Draw("same");
504
505     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
506       if (IsFront(GetActiveElement(iEl)) && GetActiveElement(iEl)->GetAxis(0)->GetXmin()<0.) {
507         TPave *pave = new TPave(GetActiveElement(iEl)->GetAxis(0)->GetXmin(), 
508                                 GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
509                                 TMath::Min(GetActiveElement(iEl)->GetAxis(0)->GetXmax(), 0.),
510                                 GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
511         pave -> SetFillColor(kGreen);
512         pave -> Draw("same");
513       }
514       else if (!IsFront(GetActiveElement(iEl)) && GetActiveElement(iEl)->GetAxis(0)->GetXmax()>0.) {
515         TPave *pave = new TPave(TMath::Max(GetActiveElement(iEl)->GetAxis(0)->GetXmin(), 0.), 
516                                 GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
517                                 GetActiveElement(iEl)->GetAxis(0)->GetXmax(), 
518                                 GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
519         pave -> SetFillColor(kGreen);
520         pave -> Draw("same");
521       }
522     }
523     
524     for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
525       if (IsFront(GetReadoutElement(iEl)) && GetReadoutElement(iEl)->GetAxis(0)->GetXmin()<0.) {
526         TPave *pave = new TPave(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(), 
527                                 GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
528                                 TMath::Min(GetReadoutElement(iEl)->GetAxis(0)->GetXmax(), 0.), 
529                                 GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
530         pave -> SetFillColor(kRed);
531         pave -> Draw("same");
532       }
533       else if (!IsFront(GetReadoutElement(iEl)) && GetReadoutElement(iEl)->GetAxis(0)->GetXmax()>0.) {
534         TPave *pave = new TPave(TMath::Max(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(), 0.),  
535                                 GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
536                                 GetReadoutElement(iEl)->GetAxis(0)->GetXmax(), 
537                                 GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
538         pave -> SetFillColor(kRed);
539         pave -> Draw("same");
540       }
541     }
542     
543   }
544
545   // ------------------- "PROFILE" option ------------------
546
547   else if (!strcmp(opt, "profile")) {
548
549     TCanvas *cnv = new TCanvas("cnv", GetName(), 300, 900);
550     cnv->Draw();
551
552     TH2D *h = new TH2D("tmp", GetName(), 
553                        1, fZCenter-0.5, fZCenter+0.5, 
554                        1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
555     h->SetXTitle("z [cm]");
556     h->SetYTitle("y [cm]");
557     h->Draw();
558
559     TPave *supportExt = new TPave(GetSupportElement(0)->GetAxis(2)->GetXmin(), -fRMaxSupport, 
560                                   GetSupportElement(0)->GetAxis(2)->GetXmax(),  fRMaxSupport);
561     TPave *supportInt = new TPave(GetSupportElement(0)->GetAxis(2)->GetXmin(), -fRMinSupport, 
562                                   GetSupportElement(0)->GetAxis(2)->GetXmax(),  fRMinSupport);
563     supportExt -> SetFillColor(kCyan-10);
564     supportInt -> SetFillColor(kCyan-10);
565     supportExt -> SetBorderSize(1);
566     supportInt -> SetBorderSize(1);
567     supportExt -> Draw("same");
568     supportInt -> Draw("same");
569
570     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
571       TPave * pave = 0;
572       if (IsFront(GetActiveElement(iEl))) {
573         pave = new TPave(GetActiveElement(iEl)->GetAxis(2)->GetXmax() - 
574                          5*(GetActiveElement(iEl)->GetAxis(2)->GetXmax()-GetActiveElement(iEl)->GetAxis(2)->GetXmin()), 
575                          GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
576                          GetActiveElement(iEl)->GetAxis(2)->GetXmax(), 
577                          GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
578       }
579       else {
580         pave = new TPave(GetActiveElement(iEl)->GetAxis(2)->GetXmin(), 
581                          GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
582                          GetActiveElement(iEl)->GetAxis(2)->GetXmin() + 
583                          5*(GetActiveElement(iEl)->GetAxis(2)->GetXmax()-GetActiveElement(iEl)->GetAxis(2)->GetXmin()), 
584                          GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
585       } 
586       pave -> SetFillColor(kGreen);
587       pave -> Draw("same");
588     }
589     
590     for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
591       TPave *pave = 0;
592       if (IsFront(GetReadoutElement(iEl))) {
593         pave = new TPave(GetReadoutElement(iEl)->GetAxis(2)->GetXmax() - 
594                          5*(GetReadoutElement(iEl)->GetAxis(2)->GetXmax()-GetReadoutElement(iEl)->GetAxis(2)->GetXmin()), 
595                          GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
596                          GetReadoutElement(iEl)->GetAxis(2)->GetXmax(), 
597                          GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
598       }
599       else {
600         pave = new TPave(GetReadoutElement(iEl)->GetAxis(2)->GetXmin(), 
601                          GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
602                          GetReadoutElement(iEl)->GetAxis(2)->GetXmin() + 
603                          5*(GetReadoutElement(iEl)->GetAxis(2)->GetXmax()-GetReadoutElement(iEl)->GetAxis(2)->GetXmin()), 
604                          GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
605       } 
606       pave -> SetFillColor(kRed);
607       pave -> Draw("same");
608     }
609     
610   }
611
612 }
613
614 //====================================================================================================================================================
615
616 Int_t AliMFTPlane::GetNumberOfChips(Option_t *opt) {
617
618   Int_t nChips = 0;
619
620   if (!strcmp(opt, "front")) {
621     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
622       if (!IsFront(GetActiveElement(iEl))) continue;
623       Double_t length = GetActiveElement(iEl)->GetAxis(0)->GetXmax() - GetActiveElement(iEl)->GetAxis(0)->GetXmin();
624       nChips += Int_t (length/AliMFTConstants::fWidthChip) + 1;
625     }
626   }
627
628   else if (!strcmp(opt, "back")) {
629     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
630       if (IsFront(GetActiveElement(iEl))) continue;
631       Double_t length = GetActiveElement(iEl)->GetAxis(0)->GetXmax() - GetActiveElement(iEl)->GetAxis(0)->GetXmin();
632       nChips += Int_t (length/AliMFTConstants::fWidthChip) + 1;
633     }
634   }
635
636   return nChips;
637
638 }
639
640 //====================================================================================================================================================