1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //====================================================================================================================================================
18 // Segmentation class for the planes of the ALICE Muon Forward Tracker
20 // Contact author: antonio.uras@cern.ch
22 //====================================================================================================================================================
26 #include "TClonesArray.h"
28 #include "AliMFTPlane.h"
29 #include "AliMFTSegmentation.h"
31 ClassImp(AliMFTSegmentation)
33 //====================================================================================================================================================
35 AliMFTSegmentation::AliMFTSegmentation():
40 // default constructor
44 //====================================================================================================================================================
46 AliMFTSegmentation::AliMFTSegmentation(const Char_t *nameGeomFile):
48 fMFTPlanes(new TClonesArray("AliMFTPlane", fNMaxPlanes))
53 Float_t zCenter, rMin, rMax, pixelSizeX, pixelSizeY, thicknessActive, thicknessSupport, thicknessReadout;
54 Float_t equivalentSilicon, equivalentSiliconBeforeFront, equivalentSiliconBeforeBack, hasPixelRectangularPatternAlongY;
56 TFile *geomFile = new TFile(nameGeomFile);
57 TNtuple *geomNtuple = (TNtuple*) geomFile->Get("AliMFTGeometry");
59 geomNtuple -> SetBranchAddress("zCenter", &zCenter);
60 geomNtuple -> SetBranchAddress("rMin", &rMin);
61 geomNtuple -> SetBranchAddress("rMax", &rMax);
62 geomNtuple -> SetBranchAddress("pixelSizeX", &pixelSizeX);
63 geomNtuple -> SetBranchAddress("pixelSizeY", &pixelSizeY);
64 geomNtuple -> SetBranchAddress("thicknessActive", &thicknessActive);
65 geomNtuple -> SetBranchAddress("thicknessSupport", &thicknessSupport);
66 geomNtuple -> SetBranchAddress("thicknessReadout", &thicknessReadout);
67 geomNtuple -> SetBranchAddress("equivalentSilicon", &equivalentSilicon);
68 geomNtuple -> SetBranchAddress("equivalentSiliconBeforeFront", &equivalentSiliconBeforeFront);
69 geomNtuple -> SetBranchAddress("equivalentSiliconBeforeBack", &equivalentSiliconBeforeBack);
70 if (geomNtuple -> GetBranch("hasPixelRectangularPatternAlongY")) {
71 geomNtuple -> SetBranchAddress("hasPixelRectangularPatternAlongY", &hasPixelRectangularPatternAlongY);
73 else hasPixelRectangularPatternAlongY = 0.;
75 Int_t nPlanes = geomNtuple->GetEntries();
77 for (Int_t iPlane=0; iPlane<nPlanes; iPlane++) {
81 printf("Setting segmentation for MFT plane #%02d\n", iPlane);
83 geomNtuple -> GetEntry(iPlane);
84 zCenter = TMath::Abs(zCenter);
86 AliMFTPlane *plane = new AliMFTPlane(Form("MFTPlane_%02d", iPlane), Form("MFTPlane_%02d", iPlane));
97 (hasPixelRectangularPatternAlongY>0.5));
99 plane -> SetEquivalentSilicon(equivalentSilicon);
100 plane -> SetEquivalentSiliconBeforeFront(equivalentSiliconBeforeFront);
101 plane -> SetEquivalentSiliconBeforeBack(equivalentSiliconBeforeBack);
102 plane -> CreateStructure();
104 new ((*fMFTPlanes)[fMFTPlanes->GetEntries()]) AliMFTPlane(*plane);
110 printf("MFT segmentation set!\n");
114 //====================================================================================================================================================
116 THnSparseC* AliMFTSegmentation::GetDetElem(Int_t detElemID) const {
120 Int_t planeNb = detElemID/fNMaxDetElemPerPlane;
121 Int_t detElemNb = detElemID - planeNb*fNMaxDetElemPerPlane;
123 THnSparseC *detElem = GetPlane(planeNb)->GetActiveElement(detElemNb);
129 //====================================================================================================================================================
131 Bool_t AliMFTSegmentation::Hit2PixelID(Double_t xHit, Double_t yHit, Int_t detElemID, Int_t &xPixel, Int_t &yPixel) {
133 // xPixel and yPixel start from 0
135 THnSparseC *detElem = GetDetElem(detElemID);
137 if ( xHit<detElem->GetAxis(0)->GetXmin() ||
138 xHit>detElem->GetAxis(0)->GetXmax() ||
139 yHit<detElem->GetAxis(1)->GetXmin() ||
140 yHit>detElem->GetAxis(1)->GetXmax() ) return kFALSE;
142 xPixel = detElem->GetAxis(0)->FindBin(xHit) - 1;
143 yPixel = detElem->GetAxis(1)->FindBin(yHit) - 1;
149 //====================================================================================================================================================
151 Bool_t AliMFTSegmentation::DoesPixelExist(Int_t detElemID, Int_t xPixel, Int_t yPixel) {
153 THnSparseC *detElem = GetDetElem(detElemID);
155 if (xPixel>=0 && xPixel<detElem->GetAxis(0)->GetNbins() && yPixel>=0 && yPixel<detElem->GetAxis(1)->GetNbins()) return kTRUE;
160 //====================================================================================================================================================