]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MFT/AliMFTPlane.cxx
fix AliHLTGlobalEsdConverterComponent
[u/mrichter/AliRoot.git] / MFT / AliMFTPlane.cxx
index 78fb56f337048697def9f380d17fa413856dfad5..9a5dbd94f93548b5920428a8340bb08832f8032a 100644 (file)
@@ -24,7 +24,6 @@
 #include "TNamed.h"
 #include "THnSparse.h"
 #include "TClonesArray.h"
-#include "AliMFTPlane.h"
 #include "TAxis.h"
 #include "TPave.h"
 #include "TCanvas.h"
 #include "TEllipse.h"
 #include "TMath.h"
 #include "AliLog.h"
+#include "AliMFTConstants.h"
+#include "AliMFTPlane.h"
+
+const Double_t AliMFTPlane::fActiveSuperposition = AliMFTConstants::fActiveSuperposition;
+const Double_t AliMFTPlane::fHeightActive        = AliMFTConstants::fHeightActive;
+const Double_t AliMFTPlane::fHeightReadout       = AliMFTConstants::fHeightReadout;
+const Double_t AliMFTPlane::fSupportExtMargin    = AliMFTConstants::fSupportExtMargin;
 
 ClassImp(AliMFTPlane)
 
@@ -39,7 +45,7 @@ ClassImp(AliMFTPlane)
 
 AliMFTPlane::AliMFTPlane():
   TNamed(),
-  fPlaneNumber(0),
+  fPlaneNumber(-1),
   fZCenter(0), 
   fRMinSupport(0), 
   fRMax(0),
@@ -56,15 +62,11 @@ AliMFTPlane::AliMFTPlane():
   fEquivalentSiliconBeforeBack(0),
   fActiveElements(0),
   fReadoutElements(0),
-  fSupportElements(0)
+  fSupportElements(0),
+  fHasPixelRectangularPatternAlongY(kFALSE),
+  fPlaneIsOdd(kFALSE)
 {
 
-  fPlaneNumber = -1;
-
-  fActiveElements  = new TClonesArray("THnSparseC");
-  fReadoutElements = new TClonesArray("THnSparseC");
-  fSupportElements = new TClonesArray("THnSparseC");
-
   // default constructor
 
 }
@@ -73,7 +75,7 @@ AliMFTPlane::AliMFTPlane():
 
 AliMFTPlane::AliMFTPlane(const Char_t *name, const Char_t *title):
   TNamed(name, title),
-  fPlaneNumber(0),
+  fPlaneNumber(-1),
   fZCenter(0), 
   fRMinSupport(0), 
   fRMax(0),
@@ -90,17 +92,19 @@ AliMFTPlane::AliMFTPlane(const Char_t *name, const Char_t *title):
   fEquivalentSiliconBeforeBack(0),
   fActiveElements(0),
   fReadoutElements(0),
-  fSupportElements(0)
+  fSupportElements(0),
+  fHasPixelRectangularPatternAlongY(kFALSE),
+  fPlaneIsOdd(kFALSE)
 {
 
-  fPlaneNumber = -1;
-
+  // constructor
   fActiveElements  = new TClonesArray("THnSparseC");
   fReadoutElements = new TClonesArray("THnSparseC");
   fSupportElements = new TClonesArray("THnSparseC");
-
-  // default constructor
-
+  fActiveElements->SetOwner(kTRUE);
+  fReadoutElements->SetOwner(kTRUE);
+  fSupportElements->SetOwner(kTRUE);
+  
 }
 
 //====================================================================================================================================================
@@ -122,13 +126,50 @@ AliMFTPlane::AliMFTPlane(const AliMFTPlane& plane):
   fEquivalentSilicon(plane.fEquivalentSilicon),
   fEquivalentSiliconBeforeFront(plane.fEquivalentSiliconBeforeFront),
   fEquivalentSiliconBeforeBack(plane.fEquivalentSiliconBeforeBack),
-  fActiveElements(plane.fActiveElements),
-  fReadoutElements(plane.fReadoutElements),
-  fSupportElements(plane.fSupportElements)
+  fActiveElements(0),
+  fReadoutElements(0),
+  fSupportElements(0),
+  fHasPixelRectangularPatternAlongY(plane.fHasPixelRectangularPatternAlongY),
+  fPlaneIsOdd(plane.fPlaneIsOdd)
 {
 
   // copy constructor
-  
+  fActiveElements  = new TClonesArray(*(plane.fActiveElements));
+  fActiveElements  -> SetOwner(kTRUE);
+  fReadoutElements = new TClonesArray(*(plane.fReadoutElements));
+  fReadoutElements -> SetOwner(kTRUE);
+  fSupportElements = new TClonesArray(*(plane.fSupportElements));
+  fSupportElements -> SetOwner(kTRUE);
+
+       
+}
+
+//====================================================================================================================================================
+
+AliMFTPlane::~AliMFTPlane() {
+
+  AliInfo("Delete AliMFTPlane");
+  if(fActiveElements) fActiveElements->Delete();
+  delete fActiveElements; 
+  if(fReadoutElements) fReadoutElements->Delete();
+  delete fReadoutElements; 
+  if(fSupportElements) fSupportElements->Delete();
+  delete fSupportElements; 
+
+}
+
+//====================================================================================================================================================
+
+void AliMFTPlane::Clear(const Option_t* /*opt*/) {
+
+  AliInfo("Clear AliMFTPlane");
+  if(fActiveElements) fActiveElements->Delete();
+  delete fActiveElements; fActiveElements=NULL;
+  if(fReadoutElements) fReadoutElements->Delete();
+  delete fReadoutElements;  fReadoutElements=NULL; 
+  if(fSupportElements) fSupportElements->Delete();
+  delete fSupportElements;   fSupportElements=NULL;
+
 }
 
 //====================================================================================================================================================
@@ -136,37 +177,44 @@ AliMFTPlane::AliMFTPlane(const AliMFTPlane& plane):
 AliMFTPlane& AliMFTPlane::operator=(const AliMFTPlane& plane) {
 
   // Assignment operator
-
+  
   // check assignement to self
-  if (this == &plane) return *this;
+  if (this != &plane) {
+    
+    // base class assignement
+    TNamed::operator=(plane);
+    
+    // clear memory
+    Clear("");
+    
+    fPlaneNumber                      = plane.fPlaneNumber;
+    fZCenter                          = plane.fZCenter; 
+    fRMinSupport                      = plane.fRMinSupport; 
+    fRMax                             = plane.fRMax;
+    fRMaxSupport                      = plane.fRMaxSupport;
+    fPixelSizeX                       = plane.fPixelSizeX;
+    fPixelSizeY                       = plane.fPixelSizeY; 
+    fThicknessActive                  = plane.fThicknessActive; 
+    fThicknessSupport                 = plane.fThicknessSupport; 
+    fThicknessReadout                 = plane.fThicknessReadout;
+    fZCenterActiveFront               = plane.fZCenterActiveFront;
+    fZCenterActiveBack                = plane.fZCenterActiveBack;
+    fEquivalentSilicon                = plane.fEquivalentSilicon;
+    fEquivalentSiliconBeforeFront     = plane.fEquivalentSiliconBeforeFront;
+    fEquivalentSiliconBeforeBack      = plane.fEquivalentSiliconBeforeBack;
+    fActiveElements = new TClonesArray(*(plane.fActiveElements));
+    fActiveElements -> SetOwner(kTRUE);
+    fReadoutElements = new TClonesArray(*(plane.fReadoutElements));
+    fReadoutElements -> SetOwner(kTRUE);
+    fSupportElements = new TClonesArray(*(plane.fSupportElements));
+    fSupportElements -> SetOwner(kTRUE);
+    fHasPixelRectangularPatternAlongY = plane.fHasPixelRectangularPatternAlongY;
+    fPlaneIsOdd                       = plane.fPlaneIsOdd;
 
-  // base class assignement
-  TNamed::operator=(plane);
+  }
   
-  // clear memory
-  Clear();
-
-  fPlaneNumber                  = plane.fPlaneNumber;
-  fZCenter                      = plane.fZCenter; 
-  fRMinSupport                  = plane.fRMinSupport; 
-  fRMax                         = plane.fRMax;
-  fRMaxSupport                  = plane.fRMaxSupport;
-  fPixelSizeX                   = plane.fPixelSizeX;
-  fPixelSizeY                   = plane.fPixelSizeY; 
-  fThicknessActive              = plane.fThicknessActive; 
-  fThicknessSupport             = plane.fThicknessSupport; 
-  fThicknessReadout             = plane.fThicknessReadout;
-  fZCenterActiveFront           = plane.fZCenterActiveFront;
-  fZCenterActiveBack            = plane.fZCenterActiveBack;
-  fEquivalentSilicon            = plane.fEquivalentSilicon;
-  fEquivalentSiliconBeforeFront = plane.fEquivalentSiliconBeforeFront;
-  fEquivalentSiliconBeforeBack  = plane.fEquivalentSiliconBeforeBack;
-  fActiveElements               = plane.fActiveElements;
-  fReadoutElements              = plane.fReadoutElements;
-  fSupportElements              = plane.fSupportElements;
-
   return *this;
-
+  
 }
 
 //====================================================================================================================================================
@@ -179,7 +227,8 @@ Bool_t AliMFTPlane::Init(Int_t    planeNumber,
                         Double_t pixelSizeY, 
                         Double_t thicknessActive, 
                         Double_t thicknessSupport, 
-                        Double_t thicknessReadout) {
+                        Double_t thicknessReadout,
+                        Bool_t   hasPixelRectangularPatternAlongY) {
 
   AliDebug(1, Form("Initializing Plane Structure for Plane %s", GetName()));
 
@@ -193,21 +242,22 @@ Bool_t AliMFTPlane::Init(Int_t    planeNumber,
   fThicknessSupport = thicknessSupport;
   fThicknessReadout = thicknessReadout;
 
+  fHasPixelRectangularPatternAlongY = hasPixelRectangularPatternAlongY;
+
   fZCenterActiveFront = fZCenter - 0.5*fThicknessSupport - 0.5*fThicknessActive;
   fZCenterActiveBack  = fZCenter + 0.5*fThicknessSupport + 0.5*fThicknessActive;
 
-  if (fRMinSupport <= fRadiusMin) fRMinSupport = fRadiusMin;
-  else {
-    fRMinSupport = fRadiusMin + (fHeightActive-fActiveSuperposition) * Int_t((fRMinSupport-fRadiusMin)/(fHeightActive-fActiveSuperposition));
-  }
-  
   if (fRMax < fRMinSupport+fHeightActive) fRMax = fRMinSupport + fHeightActive;
-  
+
+  Int_t nLaddersWithinPipe = Int_t(fRMinSupport/(fHeightActive-fActiveSuperposition));
+  if (fRMinSupport-nLaddersWithinPipe*(fHeightActive-fActiveSuperposition) > 0.5*(fHeightActive-2*fActiveSuperposition)) fPlaneIsOdd = kTRUE;
+  else fPlaneIsOdd = kFALSE;
+
   fRMax = fRMinSupport + (fHeightActive-fActiveSuperposition) * 
     (Int_t((fRMax-fRMinSupport-fHeightActive)/(fHeightActive-fActiveSuperposition))+1) + fHeightActive;
-  
-  fRMaxSupport = TMath::Sqrt(fHeightActive*(rMax-fHeightActive) + fRMax*fRMax) + fSupportExtMargin;
+
+  fRMaxSupport = TMath::Sqrt(fHeightActive*(2.*rMax-fHeightActive) + fRMax*fRMax) + fSupportExtMargin;
+   
   return kTRUE;
  
 }
@@ -219,39 +269,20 @@ Bool_t AliMFTPlane::CreateStructure() {
   Int_t nBins[3]={0};
   Double_t minPosition[3]={0}, maxPosition[3]={0};
   
-  // ------------------- support element -------------------------------------------------
-  
-  nBins[0] = 1;
-  nBins[1] = 1;
-  nBins[2] = 1;
-  
-  minPosition[0] = -1.*fRMaxSupport;
-  minPosition[1] = -1.*fRMaxSupport;
-  minPosition[2] = fZCenter - 0.5*fThicknessSupport;
-  
-  maxPosition[0] = +1.*fRMaxSupport;
-  maxPosition[1] = +1.*fRMaxSupport;
-  maxPosition[2] = fZCenter + 0.5*fThicknessSupport;
-  
-  new ((*fSupportElements)[fSupportElements->GetEntries()]) THnSparseC(Form("MFTSupportElemHist_%02d%03d", fPlaneNumber, fSupportElements->GetEntries()), 
-                                                                      Form("MFTSupportElemHist_%02d%03d", fPlaneNumber, fSupportElements->GetEntries()), 
-                                                                      3, nBins, minPosition, maxPosition);
-
   // ------------------- det elements: active + readout ----------------------------------
-  
+
   Double_t lowEdgeActive = -1.*fRMax;
   Double_t supEdgeActive = lowEdgeActive + fHeightActive;
+  Double_t zMinFront = fZCenter - 0.5*fThicknessSupport - fThicknessActive;
+  Double_t zMinBack  = fZCenter + 0.5*fThicknessSupport;
   Double_t zMin = 0.;
   Bool_t isFront = kTRUE;
   
-  while (supEdgeActive < fRMax+0.01) {
-    
-    if (isFront) zMin = fZCenter - 0.5*fThicknessSupport - fThicknessActive;
-    else         zMin = fZCenter + 0.5*fThicknessSupport;
+  while (supEdgeActive < 0.5*(fHeightActive+fHeightReadout)) {
     
     Double_t extLimitAtLowEdgeActive = TMath::Sqrt((fRMax-TMath::Abs(lowEdgeActive)) * TMath::Abs(2*fRMax - (fRMax-TMath::Abs(lowEdgeActive))));
     Double_t extLimitAtSupEdgeActive = TMath::Sqrt((fRMax-TMath::Abs(supEdgeActive)) * TMath::Abs(2*fRMax - (fRMax-TMath::Abs(supEdgeActive))));
-    
+
     // creating new det element: active + readout
     
     Double_t extLimitDetElem = TMath::Max(extLimitAtLowEdgeActive, extLimitAtSupEdgeActive);
@@ -261,7 +292,12 @@ Bool_t AliMFTPlane::CreateStructure() {
       nBins[0] = TMath::Nint(2.*extLimitDetElem/fPixelSizeX);
       nBins[1] = TMath::Nint(fHeightActive/fPixelSizeY);
       nBins[2] = 1;
+
+      // element below the pipe
       
+      if (isFront) zMin = zMinFront;
+      else         zMin = zMinBack;
+
       minPosition[0] = -1.*extLimitDetElem;
       minPosition[1] = lowEdgeActive;
       minPosition[2] = zMin;
@@ -273,20 +309,40 @@ Bool_t AliMFTPlane::CreateStructure() {
       new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
                                                                         Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
                                                                         3, nBins, minPosition, maxPosition);
+
+      minPosition[1] = lowEdgeActive-fHeightReadout;
+      maxPosition[1] = lowEdgeActive;
       
-      if (supEdgeActive>0.) {
-       minPosition[1] = supEdgeActive;
-       maxPosition[1] = supEdgeActive+fHeightReadout;
-      }
-      else {
-       minPosition[1] = lowEdgeActive-fHeightReadout;
-       maxPosition[1] = lowEdgeActive;
+      new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
+                                                                          Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
+                                                                          3, nBins, minPosition, maxPosition);
+
+      // specular element above the pipe
+
+      if (fPlaneIsOdd) {
+       if (isFront) zMin = zMinBack;
+       else         zMin = zMinFront;
       }
+
+      minPosition[0] = -1.*extLimitDetElem;
+      minPosition[1] = -1.*supEdgeActive;
+      minPosition[2] = zMin;
+      
+      maxPosition[0] = +1.*extLimitDetElem;
+      maxPosition[1] = -1.*lowEdgeActive;
+      maxPosition[2] = zMin+fThicknessActive; 
       
+      new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
+                                                                        Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
+                                                                        3, nBins, minPosition, maxPosition);
+
+      minPosition[1] = -1.*lowEdgeActive;
+      maxPosition[1] = -1.*(lowEdgeActive-fHeightReadout);
+
       new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
                                                                           Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
                                                                           3, nBins, minPosition, maxPosition);
-      
+
     }
     
     else {     // two elements covering the row
@@ -300,8 +356,11 @@ Bool_t AliMFTPlane::CreateStructure() {
       nBins[1] = TMath::Nint(fHeightActive/fPixelSizeY);
       nBins[2] = 1;
       
-      // left element
+      // left element: y < 0
       
+      if (isFront) zMin = zMinFront;
+      else         zMin = zMinBack;
+
       minPosition[0] = -1.*extLimitDetElem;
       minPosition[1] = lowEdgeActive;
       minPosition[2] = zMin;
@@ -314,21 +373,48 @@ Bool_t AliMFTPlane::CreateStructure() {
                                                                         Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
                                                                         3, nBins, minPosition, maxPosition);   
       
-      if (supEdgeActive>0.) {
-       minPosition[1] = supEdgeActive;
-       maxPosition[1] = supEdgeActive+fHeightReadout;
-      }
-      else {
-       minPosition[1] = lowEdgeActive-fHeightReadout;
-       maxPosition[1] = lowEdgeActive;
-      }
+      minPosition[1] = lowEdgeActive-fHeightReadout;
+      maxPosition[1] = lowEdgeActive;
       
       new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
                                                                           Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
                                                                           3, nBins, minPosition, maxPosition);
+
+      // left element: y > 0
       
-      // right element
+      if (supEdgeActive < 0.5*fHeightActive) {
+       
+       if (fPlaneIsOdd) {
+         if (isFront) zMin = zMinBack;
+         else         zMin = zMinFront;
+       }
+       
+       minPosition[0] = -1.*extLimitDetElem;
+       minPosition[1] = -1.*supEdgeActive;
+       minPosition[2] = zMin;
+       
+       maxPosition[0] = -1.*intLimitDetElem;
+       maxPosition[1] = -1.*lowEdgeActive;
+       maxPosition[2] = zMin+fThicknessActive; 
+       
+       new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
+                                                                          Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
+                                                                          3, nBins, minPosition, maxPosition); 
+       
+       minPosition[1] = -1.*lowEdgeActive;
+       maxPosition[1] = -1.*(lowEdgeActive-fHeightReadout);
+       
+       new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
+                                                                            Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
+                                                                            3, nBins, minPosition, maxPosition);
       
+      }
+
+      // right element: y < 0
+      
+      if (isFront) zMin = zMinFront;
+      else         zMin = zMinBack;
+
       minPosition[0] = +1.*intLimitDetElem;
       minPosition[1] = lowEdgeActive;
       minPosition[2] = zMin;
@@ -341,18 +427,42 @@ Bool_t AliMFTPlane::CreateStructure() {
                                                                         Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
                                                                         3, nBins, minPosition, maxPosition);   
       
-      if (supEdgeActive>0.) {
-       minPosition[1] = supEdgeActive;
-       maxPosition[1] = supEdgeActive+fHeightReadout;
-      }
-      else {
-       minPosition[1] = lowEdgeActive-fHeightReadout;
-       maxPosition[1] = lowEdgeActive;
-      }
-      
+      minPosition[1] = lowEdgeActive-fHeightReadout;
+      maxPosition[1] = lowEdgeActive;
+
       new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
                                                                           Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
                                                                           3, nBins, minPosition, maxPosition);
+
+      // right element: y > 0
+      
+      if (supEdgeActive < 0.5*fHeightActive) {
+
+       if (fPlaneIsOdd) {
+         if (isFront) zMin = zMinBack;
+         else         zMin = zMinFront;
+       }
+       
+       minPosition[0] = +1.*intLimitDetElem;
+       minPosition[1] = -1.*supEdgeActive;
+       minPosition[2] = zMin;
+       
+       maxPosition[0] = +1.*extLimitDetElem;
+       maxPosition[1] = -1.*lowEdgeActive;
+       maxPosition[2] = zMin+fThicknessActive; 
+       
+       new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
+                                                                          Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
+                                                                          3, nBins, minPosition, maxPosition); 
+       
+       minPosition[1] = -1.*lowEdgeActive;
+       maxPosition[1] = -1.*(lowEdgeActive-fHeightReadout);
+       
+       new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
+                                                                            Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
+                                                                            3, nBins, minPosition, maxPosition);
+
+      }
       
     }
     
@@ -362,6 +472,26 @@ Bool_t AliMFTPlane::CreateStructure() {
     
   }
   
+  // ------------------- support element -------------------------------------------------
+  
+  nBins[0] = 1;
+  nBins[1] = 1;
+  nBins[2] = 1;
+  
+  minPosition[0] = -1.*fRMaxSupport;
+  minPosition[1] = -1.*fRMaxSupport;
+  minPosition[2] = fZCenter - 0.5*fThicknessSupport;
+  
+  maxPosition[0] = +1.*fRMaxSupport;
+  maxPosition[1] = +1.*fRMaxSupport;
+  maxPosition[2] = fZCenter + 0.5*fThicknessSupport;
+  
+  new ((*fSupportElements)[fSupportElements->GetEntries()]) THnSparseC(Form("MFTSupportElemHist_%02d%03d", fPlaneNumber, fSupportElements->GetEntries()), 
+                                                                      Form("MFTSupportElemHist_%02d%03d", fPlaneNumber, fSupportElements->GetEntries()), 
+                                                                      3, nBins, minPosition, maxPosition);
+
+  // --------------------------------------------------------------------------------------
+
   AliDebug(1, Form("Structure completed for MFT plane %s", GetName()));
 
   return kTRUE;
@@ -397,7 +527,7 @@ THnSparseC* AliMFTPlane::GetSupportElement(Int_t id) {
 
 //====================================================================================================================================================
 
-void AliMFTPlane::DrawPlane(Char_t *opt) {
+void AliMFTPlane::DrawPlane(Option_t *opt) {
 
   // ------------------- "FRONT" option ------------------
 
@@ -406,8 +536,6 @@ void AliMFTPlane::DrawPlane(Char_t *opt) {
     TCanvas *cnv = new TCanvas("cnv", GetName(), 900, 900);
     cnv->Draw();
 
-    //    printf("Created Canvas\n");
-
     TH2D *h = new TH2D("tmp", GetName(), 
                       1, 1.1*GetSupportElement(0)->GetAxis(0)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(0)->GetXmax(), 
                       1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
@@ -415,7 +543,7 @@ void AliMFTPlane::DrawPlane(Char_t *opt) {
     h->SetYTitle("y [cm]");
     h->Draw();
 
-    printf("Created hist\n");
+    AliInfo("Created hist");
 
     TEllipse *supportExt = new TEllipse(0.0, 0.0, fRMaxSupport, fRMaxSupport);
     TEllipse *supportInt = new TEllipse(0.0, 0.0, fRMinSupport, fRMinSupport);
@@ -423,10 +551,7 @@ void AliMFTPlane::DrawPlane(Char_t *opt) {
     supportExt -> Draw("same");
     supportInt -> Draw("same");
 
-    //    printf("Created Ellipses\n");
-
     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
-      //      printf("Active element %d\n", iEl);
       if (!IsFront(GetActiveElement(iEl))) continue;
       TPave *pave = new TPave(GetActiveElement(iEl)->GetAxis(0)->GetXmin(), 
                              GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
@@ -437,7 +562,6 @@ void AliMFTPlane::DrawPlane(Char_t *opt) {
     }
 
     for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
-      //      printf("Readout element %d\n", iEl);
       if (!IsFront(GetReadoutElement(iEl))) continue;
       TPave *pave = new TPave(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(), 
                              GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
@@ -559,7 +683,7 @@ void AliMFTPlane::DrawPlane(Char_t *opt) {
     cnv->Draw();
 
     TH2D *h = new TH2D("tmp", GetName(), 
-                      1, fZCenter-0.5, fZCenter+0.5, 
+                      1, fZCenter-1.1*(0.5*fThicknessSupport+fThicknessActive), fZCenter+1.1*(0.5*fThicknessSupport+fThicknessActive),
                       1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
     h->SetXTitle("z [cm]");
     h->SetYTitle("y [cm]");
@@ -622,3 +746,28 @@ void AliMFTPlane::DrawPlane(Char_t *opt) {
 
 //====================================================================================================================================================
 
+Int_t AliMFTPlane::GetNumberOfChips(Option_t *opt) {
+
+  Int_t nChips = 0;
+
+  if (!strcmp(opt, "front")) {
+    for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
+      if (!IsFront(GetActiveElement(iEl))) continue;
+      Double_t length = GetActiveElement(iEl)->GetAxis(0)->GetXmax() - GetActiveElement(iEl)->GetAxis(0)->GetXmin();
+      nChips += Int_t (length/AliMFTConstants::fWidthChip) + 1;
+    }
+  }
+
+  else if (!strcmp(opt, "back")) {
+    for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
+      if (IsFront(GetActiveElement(iEl))) continue;
+      Double_t length = GetActiveElement(iEl)->GetAxis(0)->GetXmax() - GetActiveElement(iEl)->GetAxis(0)->GetXmin();
+      nChips += Int_t (length/AliMFTConstants::fWidthChip) + 1;
+    }
+  }
+
+  return nChips;
+
+}
+
+//====================================================================================================================================================