LCOV - code coverage report
Current view: top level - ITSMFT/MFT/MFTbase - AliMFTPlane.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 5 467 1.1 %
Date: 2016-06-14 17:26:59 Functions: 5 23 21.7 %

          Line data    Source code
       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          14 : const Double_t AliMFTPlane::fActiveSuperposition = AliMFTConstants::fActiveSuperposition;
      38          14 : const Double_t AliMFTPlane::fHeightActive        = AliMFTConstants::fHeightActive;
      39          14 : const Double_t AliMFTPlane::fHeightReadout       = AliMFTConstants::fHeightReadout;
      40          14 : const Double_t AliMFTPlane::fSupportExtMargin    = AliMFTConstants::fSupportExtMargin;
      41             : 
      42          14 : ClassImp(AliMFTPlane)
      43             : 
      44             : //====================================================================================================================================================
      45             : 
      46             : AliMFTPlane::AliMFTPlane():
      47           0 :   TNamed(),
      48           0 :   fPlaneNumber(-1),
      49           0 :   fZCenter(0), 
      50           0 :   fRMinSupport(0), 
      51           0 :   fRMax(0),
      52           0 :   fRMaxSupport(0),
      53           0 :   fPixelSizeX(0), 
      54           0 :   fPixelSizeY(0), 
      55           0 :   fThicknessActive(0), 
      56           0 :   fThicknessSupport(0), 
      57           0 :   fThicknessReadout(0),
      58           0 :   fZCenterActiveFront(0),
      59           0 :   fZCenterActiveBack(0),
      60           0 :   fEquivalentSilicon(0),
      61           0 :   fEquivalentSiliconBeforeFront(0),
      62           0 :   fEquivalentSiliconBeforeBack(0),
      63           0 :   fActiveElements(0),
      64           0 :   fReadoutElements(0),
      65           0 :   fSupportElements(0),
      66           0 :   fHasPixelRectangularPatternAlongY(kFALSE),
      67           0 :   fPlaneIsOdd(kFALSE)
      68           0 : {
      69             : 
      70             :   // default constructor
      71             : 
      72           0 : }
      73             : 
      74             : //====================================================================================================================================================
      75             : 
      76             : AliMFTPlane::AliMFTPlane(const Char_t *name, const Char_t *title):
      77           0 :   TNamed(name, title),
      78           0 :   fPlaneNumber(-1),
      79           0 :   fZCenter(0), 
      80           0 :   fRMinSupport(0), 
      81           0 :   fRMax(0),
      82           0 :   fRMaxSupport(0),
      83           0 :   fPixelSizeX(0), 
      84           0 :   fPixelSizeY(0), 
      85           0 :   fThicknessActive(0), 
      86           0 :   fThicknessSupport(0), 
      87           0 :   fThicknessReadout(0),
      88           0 :   fZCenterActiveFront(0),
      89           0 :   fZCenterActiveBack(0),
      90           0 :   fEquivalentSilicon(0),
      91           0 :   fEquivalentSiliconBeforeFront(0),
      92           0 :   fEquivalentSiliconBeforeBack(0),
      93           0 :   fActiveElements(0),
      94           0 :   fReadoutElements(0),
      95           0 :   fSupportElements(0),
      96           0 :   fHasPixelRectangularPatternAlongY(kFALSE),
      97           0 :   fPlaneIsOdd(kFALSE)
      98           0 : {
      99             : 
     100             :   // constructor
     101           0 :   fActiveElements  = new TClonesArray("THnSparseC");
     102           0 :   fReadoutElements = new TClonesArray("THnSparseC");
     103           0 :   fSupportElements = new TClonesArray("THnSparseC");
     104           0 :   fActiveElements->SetOwner(kTRUE);
     105           0 :   fReadoutElements->SetOwner(kTRUE);
     106           0 :   fSupportElements->SetOwner(kTRUE);
     107             :   
     108           0 : }
     109             : 
     110             : //====================================================================================================================================================
     111             : 
     112             : AliMFTPlane::AliMFTPlane(const AliMFTPlane& plane):
     113           0 :   TNamed(plane),
     114           0 :   fPlaneNumber(plane.fPlaneNumber),
     115           0 :   fZCenter(plane.fZCenter), 
     116           0 :   fRMinSupport(plane.fRMinSupport), 
     117           0 :   fRMax(plane.fRMax),
     118           0 :   fRMaxSupport(plane.fRMaxSupport),
     119           0 :   fPixelSizeX(plane.fPixelSizeX), 
     120           0 :   fPixelSizeY(plane.fPixelSizeY), 
     121           0 :   fThicknessActive(plane.fThicknessActive), 
     122           0 :   fThicknessSupport(plane.fThicknessSupport), 
     123           0 :   fThicknessReadout(plane.fThicknessReadout),
     124           0 :   fZCenterActiveFront(plane.fZCenterActiveFront),
     125           0 :   fZCenterActiveBack(plane.fZCenterActiveBack),
     126           0 :   fEquivalentSilicon(plane.fEquivalentSilicon),
     127           0 :   fEquivalentSiliconBeforeFront(plane.fEquivalentSiliconBeforeFront),
     128           0 :   fEquivalentSiliconBeforeBack(plane.fEquivalentSiliconBeforeBack),
     129           0 :   fActiveElements(0),
     130           0 :   fReadoutElements(0),
     131           0 :   fSupportElements(0),
     132           0 :   fHasPixelRectangularPatternAlongY(plane.fHasPixelRectangularPatternAlongY),
     133           0 :   fPlaneIsOdd(plane.fPlaneIsOdd)
     134           0 : {
     135             : 
     136             :   // copy constructor
     137           0 :   fActiveElements  = new TClonesArray(*(plane.fActiveElements));
     138           0 :   fActiveElements  -> SetOwner(kTRUE);
     139           0 :   fReadoutElements = new TClonesArray(*(plane.fReadoutElements));
     140           0 :   fReadoutElements -> SetOwner(kTRUE);
     141           0 :   fSupportElements = new TClonesArray(*(plane.fSupportElements));
     142           0 :   fSupportElements -> SetOwner(kTRUE);
     143             : 
     144             :         
     145           0 : }
     146             : 
     147             : //====================================================================================================================================================
     148             : 
     149           0 : AliMFTPlane::~AliMFTPlane() {
     150             : 
     151           0 :   AliInfo("Delete AliMFTPlane");
     152           0 :   if(fActiveElements) fActiveElements->Delete();
     153           0 :   delete fActiveElements; 
     154           0 :   if(fReadoutElements) fReadoutElements->Delete();
     155           0 :   delete fReadoutElements; 
     156           0 :   if(fSupportElements) fSupportElements->Delete();
     157           0 :   delete fSupportElements; 
     158             : 
     159           0 : }
     160             : 
     161             : //====================================================================================================================================================
     162             : 
     163             : void AliMFTPlane::Clear(const Option_t* /*opt*/) {
     164             : 
     165           0 :   AliInfo("Clear AliMFTPlane");
     166           0 :   if(fActiveElements) fActiveElements->Delete();
     167           0 :   delete fActiveElements; fActiveElements=NULL;
     168           0 :   if(fReadoutElements) fReadoutElements->Delete();
     169           0 :   delete fReadoutElements;  fReadoutElements=NULL; 
     170           0 :   if(fSupportElements) fSupportElements->Delete();
     171           0 :   delete fSupportElements;   fSupportElements=NULL;
     172             : 
     173           0 : }
     174             : 
     175             : //====================================================================================================================================================
     176             : 
     177             : AliMFTPlane& AliMFTPlane::operator=(const AliMFTPlane& plane) {
     178             : 
     179             :   // Assignment operator
     180             :   
     181             :   // check assignement to self
     182           0 :   if (this != &plane) {
     183             :     
     184             :     // base class assignement
     185           0 :     TNamed::operator=(plane);
     186             :     
     187             :     // clear memory
     188           0 :     Clear("");
     189             :     
     190           0 :     fPlaneNumber                      = plane.fPlaneNumber;
     191           0 :     fZCenter                          = plane.fZCenter; 
     192           0 :     fRMinSupport                      = plane.fRMinSupport; 
     193           0 :     fRMax                             = plane.fRMax;
     194           0 :     fRMaxSupport                      = plane.fRMaxSupport;
     195           0 :     fPixelSizeX                       = plane.fPixelSizeX;
     196           0 :     fPixelSizeY                       = plane.fPixelSizeY; 
     197           0 :     fThicknessActive                  = plane.fThicknessActive; 
     198           0 :     fThicknessSupport                 = plane.fThicknessSupport; 
     199           0 :     fThicknessReadout                 = plane.fThicknessReadout;
     200           0 :     fZCenterActiveFront               = plane.fZCenterActiveFront;
     201           0 :     fZCenterActiveBack                = plane.fZCenterActiveBack;
     202           0 :     fEquivalentSilicon                = plane.fEquivalentSilicon;
     203           0 :     fEquivalentSiliconBeforeFront     = plane.fEquivalentSiliconBeforeFront;
     204           0 :     fEquivalentSiliconBeforeBack      = plane.fEquivalentSiliconBeforeBack;
     205           0 :     fActiveElements = new TClonesArray(*(plane.fActiveElements));
     206           0 :     fActiveElements -> SetOwner(kTRUE);
     207           0 :     fReadoutElements = new TClonesArray(*(plane.fReadoutElements));
     208           0 :     fReadoutElements -> SetOwner(kTRUE);
     209           0 :     fSupportElements = new TClonesArray(*(plane.fSupportElements));
     210           0 :     fSupportElements -> SetOwner(kTRUE);
     211           0 :     fHasPixelRectangularPatternAlongY = plane.fHasPixelRectangularPatternAlongY;
     212           0 :     fPlaneIsOdd                       = plane.fPlaneIsOdd;
     213             : 
     214           0 :   }
     215             :   
     216           0 :   return *this;
     217             :   
     218           0 : }
     219             : 
     220             : //====================================================================================================================================================
     221             : 
     222             : Bool_t AliMFTPlane::Init(Int_t    planeNumber,
     223             :                          Double_t zCenter, 
     224             :                          Double_t rMin, 
     225             :                          Double_t rMax, 
     226             :                          Double_t pixelSizeX, 
     227             :                          Double_t pixelSizeY, 
     228             :                          Double_t thicknessActive, 
     229             :                          Double_t thicknessSupport, 
     230             :                          Double_t thicknessReadout,
     231             :                          Bool_t   hasPixelRectangularPatternAlongY) {
     232             : 
     233           0 :   AliDebug(1, Form("Initializing Plane Structure for Plane %s", GetName()));
     234             : 
     235           0 :   fPlaneNumber      = planeNumber;
     236           0 :   fZCenter          = zCenter;
     237           0 :   fRMinSupport      = rMin;
     238           0 :   fRMax             = rMax;
     239           0 :   fPixelSizeX       = pixelSizeX;
     240           0 :   fPixelSizeY       = pixelSizeY;
     241           0 :   fThicknessActive  = thicknessActive;
     242           0 :   fThicknessSupport = thicknessSupport;
     243           0 :   fThicknessReadout = thicknessReadout;
     244             : 
     245           0 :   fHasPixelRectangularPatternAlongY = hasPixelRectangularPatternAlongY;
     246             : 
     247           0 :   fZCenterActiveFront = fZCenter - 0.5*fThicknessSupport - 0.5*fThicknessActive;
     248           0 :   fZCenterActiveBack  = fZCenter + 0.5*fThicknessSupport + 0.5*fThicknessActive;
     249             : 
     250           0 :   if (fRMax < fRMinSupport+fHeightActive) fRMax = fRMinSupport + fHeightActive;
     251             : 
     252           0 :   Int_t nLaddersWithinPipe = Int_t(fRMinSupport/(fHeightActive-fActiveSuperposition));
     253           0 :   if (fRMinSupport-nLaddersWithinPipe*(fHeightActive-fActiveSuperposition) > 0.5*(fHeightActive-2*fActiveSuperposition)) fPlaneIsOdd = kTRUE;
     254           0 :   else fPlaneIsOdd = kFALSE;
     255             : 
     256           0 :   fRMax = fRMinSupport + (fHeightActive-fActiveSuperposition) * 
     257           0 :     (Int_t((fRMax-fRMinSupport-fHeightActive)/(fHeightActive-fActiveSuperposition))+1) + fHeightActive;
     258             : 
     259           0 :   fRMaxSupport = TMath::Sqrt(fHeightActive*(2.*rMax-fHeightActive) + fRMax*fRMax) + fSupportExtMargin;
     260             :    
     261           0 :   return kTRUE;
     262             :  
     263             : }
     264             : 
     265             : //====================================================================================================================================================
     266             : 
     267             : Bool_t AliMFTPlane::CreateStructure() {
     268             : 
     269           0 :   Int_t nBins[3]={0};
     270           0 :   Double_t minPosition[3]={0}, maxPosition[3]={0};
     271             :   
     272             :   // ------------------- det elements: active + readout ----------------------------------
     273             : 
     274           0 :   Double_t lowEdgeActive = -1.*fRMax;
     275           0 :   Double_t supEdgeActive = lowEdgeActive + fHeightActive;
     276           0 :   Double_t zMinFront = fZCenter - 0.5*fThicknessSupport - fThicknessActive;
     277           0 :   Double_t zMinBack  = fZCenter + 0.5*fThicknessSupport;
     278             :   Double_t zMin = 0.;
     279             :   Bool_t isFront = kTRUE;
     280             :   
     281           0 :   while (lowEdgeActive < 0) {
     282             :     
     283           0 :     Double_t extLimitAtLowEdgeActive = TMath::Sqrt((fRMax-TMath::Abs(lowEdgeActive)) * TMath::Abs(2*fRMax - (fRMax-TMath::Abs(lowEdgeActive))));
     284           0 :     Double_t extLimitAtSupEdgeActive = TMath::Sqrt((fRMax-TMath::Abs(supEdgeActive)) * TMath::Abs(2*fRMax - (fRMax-TMath::Abs(supEdgeActive))));
     285             : 
     286             :     // creating new det element: active + readout
     287             :     
     288           0 :     Double_t extLimitDetElem = TMath::Max(extLimitAtLowEdgeActive, extLimitAtSupEdgeActive);
     289             :     
     290           0 :     if (supEdgeActive<-1.*fRMinSupport+0.01 || lowEdgeActive>1.*fRMinSupport-0.01) {     // single element covering the row
     291             :       
     292           0 :       nBins[0] = TMath::Nint(2.*extLimitDetElem/fPixelSizeX);
     293           0 :       nBins[1] = TMath::Nint(fHeightActive/fPixelSizeY);
     294           0 :       nBins[2] = 1;
     295             : 
     296             :       // element below the pipe
     297             :       
     298           0 :       if (isFront) zMin = zMinFront;
     299             :       else         zMin = zMinBack;
     300             : 
     301           0 :       minPosition[0] = -1.*extLimitDetElem;
     302           0 :       minPosition[1] = lowEdgeActive;
     303           0 :       minPosition[2] = zMin;
     304             :       
     305           0 :       maxPosition[0] = +1.*extLimitDetElem;
     306           0 :       maxPosition[1] = supEdgeActive;
     307           0 :       maxPosition[2] = zMin+fThicknessActive; 
     308             :       
     309           0 :       new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
     310           0 :                                                                          Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
     311           0 :                                                                          3, nBins, minPosition, maxPosition);
     312             : 
     313           0 :       minPosition[1] = lowEdgeActive-fHeightReadout;
     314           0 :       maxPosition[1] = lowEdgeActive;
     315             :       
     316           0 :       new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
     317           0 :                                                                            Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
     318             :                                                                            3, nBins, minPosition, maxPosition);
     319             : 
     320             :       // specular element above the pipe
     321             : 
     322           0 :       if (fPlaneIsOdd) {
     323           0 :         if (isFront) zMin = zMinBack;
     324             :         else         zMin = zMinFront;
     325             :       }
     326             : 
     327           0 :       minPosition[0] = -1.*extLimitDetElem;
     328           0 :       minPosition[1] = -1.*supEdgeActive;
     329           0 :       minPosition[2] = zMin;
     330             :       
     331           0 :       maxPosition[0] = +1.*extLimitDetElem;
     332           0 :       maxPosition[1] = -1.*lowEdgeActive;
     333           0 :       maxPosition[2] = zMin+fThicknessActive; 
     334             :       
     335           0 :       new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
     336           0 :                                                                          Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
     337             :                                                                          3, nBins, minPosition, maxPosition);
     338             : 
     339           0 :       minPosition[1] = -1.*lowEdgeActive;
     340           0 :       maxPosition[1] = -1.*(lowEdgeActive-fHeightReadout);
     341             : 
     342           0 :       new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
     343           0 :                                                                            Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
     344             :                                                                            3, nBins, minPosition, maxPosition);
     345             : 
     346             :     }
     347             :     
     348             :     else {     // two elements covering the row
     349             :       
     350             :       Double_t intLimitAtLowEdge = 0., intLimitAtSupEdge = 0.;
     351           0 :       if (fRMinSupport-TMath::Abs(lowEdgeActive)>0.) intLimitAtLowEdge = TMath::Sqrt((fRMinSupport-TMath::Abs(lowEdgeActive)) * TMath::Abs(2*fRMinSupport - (fRMinSupport-TMath::Abs(lowEdgeActive))));
     352           0 :       if (fRMinSupport-TMath::Abs(supEdgeActive)>0.) intLimitAtSupEdge = TMath::Sqrt((fRMinSupport-TMath::Abs(supEdgeActive)) * TMath::Abs(2*fRMinSupport - (fRMinSupport-TMath::Abs(supEdgeActive))));
     353           0 :       Double_t intLimitDetElem = TMath::Max(intLimitAtLowEdge, intLimitAtSupEdge);
     354             :       
     355           0 :       nBins[0] = TMath::Nint((extLimitDetElem-intLimitDetElem)/fPixelSizeX);
     356           0 :       nBins[1] = TMath::Nint(fHeightActive/fPixelSizeY);
     357           0 :       nBins[2] = 1;
     358             :       
     359             :       // left element: y < 0
     360             :       
     361           0 :       if (isFront) zMin = zMinFront;
     362             :       else         zMin = zMinBack;
     363             : 
     364           0 :       minPosition[0] = -1.*extLimitDetElem;
     365           0 :       minPosition[1] = lowEdgeActive;
     366           0 :       minPosition[2] = zMin;
     367             :       
     368           0 :       maxPosition[0] = -1.*intLimitDetElem;
     369           0 :       maxPosition[1] = supEdgeActive;
     370           0 :       maxPosition[2] = zMin+fThicknessActive; 
     371             :       
     372           0 :       new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
     373           0 :                                                                          Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
     374           0 :                                                                          3, nBins, minPosition, maxPosition);   
     375             :       
     376           0 :       minPosition[1] = lowEdgeActive-fHeightReadout;
     377           0 :       maxPosition[1] = lowEdgeActive;
     378             :       
     379           0 :       new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
     380           0 :                                                                            Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
     381             :                                                                            3, nBins, minPosition, maxPosition);
     382             : 
     383             :       // left element: y > 0
     384             :       
     385           0 :       if (supEdgeActive < 0.5*fHeightActive) {
     386             :         
     387           0 :         if (fPlaneIsOdd) {
     388           0 :           if (isFront) zMin = zMinBack;
     389             :           else         zMin = zMinFront;
     390             :         }
     391             :         
     392           0 :         minPosition[0] = -1.*extLimitDetElem;
     393           0 :         minPosition[1] = -1.*supEdgeActive;
     394           0 :         minPosition[2] = zMin;
     395             :         
     396           0 :         maxPosition[0] = -1.*intLimitDetElem;
     397           0 :         maxPosition[1] = -1.*lowEdgeActive;
     398           0 :         maxPosition[2] = zMin+fThicknessActive; 
     399             :         
     400           0 :         new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
     401           0 :                                                                            Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
     402             :                                                                            3, nBins, minPosition, maxPosition); 
     403             :         
     404           0 :         minPosition[1] = -1.*lowEdgeActive;
     405           0 :         maxPosition[1] = -1.*(lowEdgeActive-fHeightReadout);
     406             :         
     407           0 :         new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
     408           0 :                                                                              Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
     409             :                                                                              3, nBins, minPosition, maxPosition);
     410             :       
     411             :       }
     412             : 
     413             :       // right element: y < 0
     414             :       
     415           0 :       if (isFront) zMin = zMinFront;
     416             :       else         zMin = zMinBack;
     417             : 
     418           0 :       minPosition[0] = +1.*intLimitDetElem;
     419           0 :       minPosition[1] = lowEdgeActive;
     420           0 :       minPosition[2] = zMin;
     421             :       
     422           0 :       maxPosition[0] = +1.*extLimitDetElem;
     423           0 :       maxPosition[1] = supEdgeActive;
     424           0 :       maxPosition[2] = zMin+fThicknessActive; 
     425             :       
     426           0 :       new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
     427           0 :                                                                          Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
     428             :                                                                          3, nBins, minPosition, maxPosition);   
     429             :       
     430           0 :       minPosition[1] = lowEdgeActive-fHeightReadout;
     431           0 :       maxPosition[1] = lowEdgeActive;
     432             : 
     433           0 :       new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
     434           0 :                                                                            Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
     435             :                                                                            3, nBins, minPosition, maxPosition);
     436             : 
     437             :       // right element: y > 0
     438             :       
     439           0 :       if (supEdgeActive < 0.5*fHeightActive) {
     440             : 
     441           0 :         if (fPlaneIsOdd) {
     442           0 :           if (isFront) zMin = zMinBack;
     443             :           else         zMin = zMinFront;
     444             :         }
     445             :         
     446           0 :         minPosition[0] = +1.*intLimitDetElem;
     447           0 :         minPosition[1] = -1.*supEdgeActive;
     448           0 :         minPosition[2] = zMin;
     449             :         
     450           0 :         maxPosition[0] = +1.*extLimitDetElem;
     451           0 :         maxPosition[1] = -1.*lowEdgeActive;
     452           0 :         maxPosition[2] = zMin+fThicknessActive; 
     453             :         
     454           0 :         new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
     455           0 :                                                                            Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()), 
     456             :                                                                            3, nBins, minPosition, maxPosition); 
     457             :         
     458           0 :         minPosition[1] = -1.*lowEdgeActive;
     459           0 :         maxPosition[1] = -1.*(lowEdgeActive-fHeightReadout);
     460             :         
     461           0 :         new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
     462           0 :                                                                              Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()), 
     463             :                                                                              3, nBins, minPosition, maxPosition);
     464             : 
     465             :       }
     466             :       
     467             :     }
     468             :     
     469           0 :     lowEdgeActive += fHeightActive - fActiveSuperposition;
     470           0 :     supEdgeActive = lowEdgeActive + fHeightActive;
     471           0 :     isFront = !isFront;
     472             :     
     473             :   }
     474             :   
     475             :   // ------------------- support element -------------------------------------------------
     476             :   
     477           0 :   nBins[0] = 1;
     478           0 :   nBins[1] = 1;
     479           0 :   nBins[2] = 1;
     480             :   
     481           0 :   minPosition[0] = -1.*fRMaxSupport;
     482           0 :   minPosition[1] = -1.*fRMaxSupport;
     483           0 :   minPosition[2] = fZCenter - 0.5*fThicknessSupport;
     484             :   
     485           0 :   maxPosition[0] = +1.*fRMaxSupport;
     486           0 :   maxPosition[1] = +1.*fRMaxSupport;
     487           0 :   maxPosition[2] = fZCenter + 0.5*fThicknessSupport;
     488             :   
     489           0 :   new ((*fSupportElements)[fSupportElements->GetEntries()]) THnSparseC(Form("MFTSupportElemHist_%02d%03d", fPlaneNumber, fSupportElements->GetEntries()), 
     490           0 :                                                                        Form("MFTSupportElemHist_%02d%03d", fPlaneNumber, fSupportElements->GetEntries()), 
     491           0 :                                                                        3, nBins, minPosition, maxPosition);
     492             : 
     493             :   // --------------------------------------------------------------------------------------
     494             : 
     495           0 :   AliDebug(1, Form("Structure completed for MFT plane %s", GetName()));
     496             : 
     497           0 :   return kTRUE;
     498             :   
     499           0 : }
     500             : 
     501             : //====================================================================================================================================================
     502             : 
     503             : THnSparseC* AliMFTPlane::GetActiveElement(Int_t id) {
     504             : 
     505           0 :   if (id<0 || id>=GetNActiveElements()) return NULL;
     506           0 :   else return (THnSparseC*) fActiveElements->At(id);
     507             : 
     508           0 : }
     509             : 
     510             : //====================================================================================================================================================
     511             : 
     512             : THnSparseC* AliMFTPlane::GetReadoutElement(Int_t id) {
     513             : 
     514           0 :   if (id<0 || id>=GetNReadoutElements()) return NULL;
     515           0 :   else return (THnSparseC*) fReadoutElements->At(id);
     516             : 
     517           0 : }
     518             : 
     519             : //====================================================================================================================================================
     520             : 
     521             : THnSparseC* AliMFTPlane::GetSupportElement(Int_t id) {
     522             : 
     523           0 :   if (id<0 || id>=GetNSupportElements()) return NULL;
     524           0 :   else return (THnSparseC*) fSupportElements->At(id);
     525             : 
     526           0 : }
     527             : 
     528             : //====================================================================================================================================================
     529             : 
     530             : void AliMFTPlane::DrawPlane(Option_t *opt) {
     531             : 
     532             :   // ------------------- "FRONT" option ------------------
     533             : 
     534           0 :   if (!strcmp(opt, "front")) {
     535             : 
     536           0 :     TCanvas *cnv = new TCanvas("cnv", GetName(), 900, 900);
     537           0 :     cnv->Draw();
     538             : 
     539           0 :     TH2D *h = new TH2D("tmp", GetName(), 
     540           0 :                        1, 1.1*GetSupportElement(0)->GetAxis(0)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(0)->GetXmax(), 
     541           0 :                        1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
     542           0 :     h->SetXTitle("x [cm]");
     543           0 :     h->SetYTitle("y [cm]");
     544           0 :     h->Draw();
     545             : 
     546           0 :     AliInfo("Created hist");
     547             : 
     548           0 :     TEllipse *supportExt = new TEllipse(0.0, 0.0, fRMaxSupport, fRMaxSupport);
     549           0 :     TEllipse *supportInt = new TEllipse(0.0, 0.0, fRMinSupport, fRMinSupport);
     550           0 :     supportExt->SetFillColor(kCyan-10);
     551           0 :     supportExt -> Draw("same");
     552           0 :     supportInt -> Draw("same");
     553             : 
     554           0 :     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
     555           0 :       if (!IsFront(GetActiveElement(iEl))) continue;
     556           0 :       TPave *pave = new TPave(GetActiveElement(iEl)->GetAxis(0)->GetXmin(), 
     557           0 :                               GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
     558           0 :                               GetActiveElement(iEl)->GetAxis(0)->GetXmax(), 
     559           0 :                               GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
     560           0 :       pave -> SetFillColor(kGreen);
     561           0 :       pave -> Draw("same");
     562           0 :     }
     563             : 
     564           0 :     for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
     565           0 :       if (!IsFront(GetReadoutElement(iEl))) continue;
     566           0 :       TPave *pave = new TPave(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(), 
     567           0 :                               GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
     568           0 :                               GetReadoutElement(iEl)->GetAxis(0)->GetXmax(), 
     569           0 :                               GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
     570           0 :       pave -> SetFillColor(kRed);
     571           0 :       pave -> Draw("same");
     572           0 :     }
     573             : 
     574           0 :   }
     575             :     
     576             :   // ------------------- "BACK" option ------------------
     577             : 
     578           0 :   else if (!strcmp(opt, "back")) {
     579             : 
     580           0 :     TCanvas *cnv = new TCanvas("cnv", GetName(), 900, 900);
     581           0 :     cnv->Draw();
     582             :     
     583           0 :     TH2D *h = new TH2D("tmp", GetName(), 
     584           0 :                        1, 1.1*GetSupportElement(0)->GetAxis(0)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(0)->GetXmax(), 
     585           0 :                        1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
     586           0 :     h->SetXTitle("x [cm]");
     587           0 :     h->SetYTitle("y [cm]");
     588           0 :     h->Draw();
     589             : 
     590           0 :     TEllipse *supportExt = new TEllipse(0.0, 0.0, fRMaxSupport, fRMaxSupport);
     591           0 :     TEllipse *supportInt = new TEllipse(0.0, 0.0, fRMinSupport, fRMinSupport);
     592           0 :     supportExt -> SetFillColor(kCyan-10);
     593           0 :     supportExt -> Draw("same");
     594           0 :     supportInt -> Draw("same");
     595             : 
     596           0 :     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
     597           0 :       if (IsFront(GetActiveElement(iEl))) continue;
     598           0 :       TPave *pave = new TPave(GetActiveElement(iEl)->GetAxis(0)->GetXmin(), 
     599           0 :                               GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
     600           0 :                               GetActiveElement(iEl)->GetAxis(0)->GetXmax(), 
     601           0 :                               GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
     602           0 :       pave -> SetFillColor(kGreen);
     603           0 :       pave -> Draw("same");
     604           0 :     }
     605             : 
     606           0 :     for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
     607           0 :       if (IsFront(GetReadoutElement(iEl))) continue;
     608           0 :       TPave *pave = new TPave(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(), 
     609           0 :                               GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
     610           0 :                               GetReadoutElement(iEl)->GetAxis(0)->GetXmax(), 
     611           0 :                               GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
     612           0 :       pave -> SetFillColor(kRed);
     613           0 :       pave -> Draw("same");
     614           0 :     }
     615             : 
     616           0 :   }
     617             : 
     618             :   // ------------------- "BOTH" option ------------------
     619             : 
     620           0 :   else if (!strcmp(opt, "both")) {
     621             : 
     622           0 :     TCanvas *cnv = new TCanvas("cnv", GetName(), 900, 900);
     623           0 :     cnv->Draw();
     624             : 
     625           0 :     TH2D *h = new TH2D("tmp", GetName(), 
     626           0 :                        1, 1.1*GetSupportElement(0)->GetAxis(0)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(0)->GetXmax(), 
     627           0 :                        1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
     628           0 :     h->SetXTitle("x [cm]");
     629           0 :     h->SetYTitle("y [cm]");
     630           0 :     h->Draw();
     631             : 
     632           0 :     TEllipse *supportExt = new TEllipse(0.0, 0.0, fRMaxSupport, fRMaxSupport);
     633           0 :     TEllipse *supportInt = new TEllipse(0.0, 0.0, fRMinSupport, fRMinSupport);
     634           0 :     supportExt -> SetFillColor(kCyan-10);
     635           0 :     supportExt -> Draw("same");
     636           0 :     supportInt -> Draw("same");
     637             : 
     638           0 :     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
     639           0 :       if (IsFront(GetActiveElement(iEl)) && GetActiveElement(iEl)->GetAxis(0)->GetXmin()<0.) {
     640           0 :         TPave *pave = new TPave(GetActiveElement(iEl)->GetAxis(0)->GetXmin(), 
     641           0 :                                 GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
     642           0 :                                 TMath::Min(GetActiveElement(iEl)->GetAxis(0)->GetXmax(), 0.),
     643           0 :                                 GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
     644           0 :         pave -> SetFillColor(kGreen);
     645           0 :         pave -> Draw("same");
     646           0 :       }
     647           0 :       else if (!IsFront(GetActiveElement(iEl)) && GetActiveElement(iEl)->GetAxis(0)->GetXmax()>0.) {
     648           0 :         TPave *pave = new TPave(TMath::Max(GetActiveElement(iEl)->GetAxis(0)->GetXmin(), 0.), 
     649           0 :                                 GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
     650           0 :                                 GetActiveElement(iEl)->GetAxis(0)->GetXmax(), 
     651           0 :                                 GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
     652           0 :         pave -> SetFillColor(kGreen);
     653           0 :         pave -> Draw("same");
     654           0 :       }
     655             :     }
     656             :     
     657           0 :     for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
     658           0 :       if (IsFront(GetReadoutElement(iEl)) && GetReadoutElement(iEl)->GetAxis(0)->GetXmin()<0.) {
     659           0 :         TPave *pave = new TPave(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(), 
     660           0 :                                 GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
     661           0 :                                 TMath::Min(GetReadoutElement(iEl)->GetAxis(0)->GetXmax(), 0.), 
     662           0 :                                 GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
     663           0 :         pave -> SetFillColor(kRed);
     664           0 :         pave -> Draw("same");
     665           0 :       }
     666           0 :       else if (!IsFront(GetReadoutElement(iEl)) && GetReadoutElement(iEl)->GetAxis(0)->GetXmax()>0.) {
     667           0 :         TPave *pave = new TPave(TMath::Max(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(), 0.),  
     668           0 :                                 GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
     669           0 :                                 GetReadoutElement(iEl)->GetAxis(0)->GetXmax(), 
     670           0 :                                 GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
     671           0 :         pave -> SetFillColor(kRed);
     672           0 :         pave -> Draw("same");
     673           0 :       }
     674             :     }
     675             :     
     676           0 :   }
     677             : 
     678             :   // ------------------- "PROFILE" option ------------------
     679             : 
     680           0 :   else if (!strcmp(opt, "profile")) {
     681             : 
     682           0 :     TCanvas *cnv = new TCanvas("cnv", GetName(), 300, 900);
     683           0 :     cnv->Draw();
     684             : 
     685           0 :     TH2D *h = new TH2D("tmp", GetName(), 
     686           0 :                        1, fZCenter-0.5, fZCenter+0.5, 
     687           0 :                        1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
     688           0 :     h->SetXTitle("z [cm]");
     689           0 :     h->SetYTitle("y [cm]");
     690           0 :     h->Draw();
     691             : 
     692           0 :     TPave *supportExt = new TPave(GetSupportElement(0)->GetAxis(2)->GetXmin(), -fRMaxSupport, 
     693           0 :                                   GetSupportElement(0)->GetAxis(2)->GetXmax(),  fRMaxSupport);
     694           0 :     TPave *supportInt = new TPave(GetSupportElement(0)->GetAxis(2)->GetXmin(), -fRMinSupport, 
     695           0 :                                   GetSupportElement(0)->GetAxis(2)->GetXmax(),  fRMinSupport);
     696           0 :     supportExt -> SetFillColor(kCyan-10);
     697           0 :     supportInt -> SetFillColor(kCyan-10);
     698           0 :     supportExt -> SetBorderSize(1);
     699           0 :     supportInt -> SetBorderSize(1);
     700           0 :     supportExt -> Draw("same");
     701           0 :     supportInt -> Draw("same");
     702             : 
     703           0 :     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
     704             :       TPave * pave = 0;
     705           0 :       if (IsFront(GetActiveElement(iEl))) {
     706           0 :         pave = new TPave(GetActiveElement(iEl)->GetAxis(2)->GetXmax() - 
     707           0 :                          5*(GetActiveElement(iEl)->GetAxis(2)->GetXmax()-GetActiveElement(iEl)->GetAxis(2)->GetXmin()), 
     708           0 :                          GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
     709           0 :                          GetActiveElement(iEl)->GetAxis(2)->GetXmax(), 
     710           0 :                          GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
     711           0 :       }
     712             :       else {
     713           0 :         pave = new TPave(GetActiveElement(iEl)->GetAxis(2)->GetXmin(), 
     714           0 :                          GetActiveElement(iEl)->GetAxis(1)->GetXmin(), 
     715           0 :                          GetActiveElement(iEl)->GetAxis(2)->GetXmin() + 
     716           0 :                          5*(GetActiveElement(iEl)->GetAxis(2)->GetXmax()-GetActiveElement(iEl)->GetAxis(2)->GetXmin()), 
     717           0 :                          GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
     718             :       } 
     719           0 :       pave -> SetFillColor(kGreen);
     720           0 :       pave -> Draw("same");
     721             :     }
     722             :     
     723           0 :     for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
     724             :       TPave *pave = 0;
     725           0 :       if (IsFront(GetReadoutElement(iEl))) {
     726           0 :         pave = new TPave(GetReadoutElement(iEl)->GetAxis(2)->GetXmax() - 
     727           0 :                          5*(GetReadoutElement(iEl)->GetAxis(2)->GetXmax()-GetReadoutElement(iEl)->GetAxis(2)->GetXmin()), 
     728           0 :                          GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
     729           0 :                          GetReadoutElement(iEl)->GetAxis(2)->GetXmax(), 
     730           0 :                          GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
     731           0 :       }
     732             :       else {
     733           0 :         pave = new TPave(GetReadoutElement(iEl)->GetAxis(2)->GetXmin(), 
     734           0 :                          GetReadoutElement(iEl)->GetAxis(1)->GetXmin(), 
     735           0 :                          GetReadoutElement(iEl)->GetAxis(2)->GetXmin() + 
     736           0 :                          5*(GetReadoutElement(iEl)->GetAxis(2)->GetXmax()-GetReadoutElement(iEl)->GetAxis(2)->GetXmin()), 
     737           0 :                          GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
     738             :       } 
     739           0 :       pave -> SetFillColor(kRed);
     740           0 :       pave -> Draw("same");
     741             :     }
     742             :     
     743           0 :   }
     744             : 
     745           0 : }
     746             : 
     747             : //====================================================================================================================================================
     748             : 
     749             : Int_t AliMFTPlane::GetNumberOfChips(Option_t *opt) {
     750             : 
     751             :   Int_t nChips = 0;
     752             : 
     753           0 :   if (!strcmp(opt, "front")) {
     754           0 :     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
     755           0 :       if (!IsFront(GetActiveElement(iEl))) continue;
     756           0 :       Double_t length = GetActiveElement(iEl)->GetAxis(0)->GetXmax() - GetActiveElement(iEl)->GetAxis(0)->GetXmin();
     757           0 :       nChips += Int_t (length/AliMFTConstants::fWidthChip) + 1;
     758           0 :     }
     759           0 :   }
     760             : 
     761           0 :   else if (!strcmp(opt, "back")) {
     762           0 :     for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
     763           0 :       if (IsFront(GetActiveElement(iEl))) continue;
     764           0 :       Double_t length = GetActiveElement(iEl)->GetAxis(0)->GetXmax() - GetActiveElement(iEl)->GetAxis(0)->GetXmin();
     765           0 :       nChips += Int_t (length/AliMFTConstants::fWidthChip) + 1;
     766           0 :     }
     767           0 :   }
     768             : 
     769           0 :   return nChips;
     770             : 
     771             : }
     772             : 
     773             : //====================================================================================================================================================

Generated by: LCOV version 1.11