]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MFT/AliMFTSegmentation.cxx
MFT Classes modified for integration with the AOD framework
[u/mrichter/AliRoot.git] / MFT / AliMFTSegmentation.cxx
index fc8986607a7729cc4cc64ca23b41ed72decd4205..5eeecc5a3f98e98ae21fb93fc582193907306cf8 100644 (file)
@@ -45,13 +45,15 @@ AliMFTSegmentation::AliMFTSegmentation():
 
 AliMFTSegmentation::AliMFTSegmentation(const Char_t *nameGeomFile): 
   TObject(),
-  fMFTPlanes(new TClonesArray("AliMFTPlane", fNMaxPlanes))
+  fMFTPlanes(0x0)
 { 
-
+  
   // constructor
-
+  
+  fMFTPlanes = new TClonesArray("AliMFTPlane", fNMaxPlanes);
+  fMFTPlanes -> SetOwner(kTRUE);
   Float_t zCenter, rMin, rMax, pixelSizeX, pixelSizeY, thicknessActive, thicknessSupport, thicknessReadout;
-  Float_t equivalentSilicon, equivalentSiliconBeforeFront, equivalentSiliconBeforeBack;
+  Float_t equivalentSilicon, equivalentSiliconBeforeFront, equivalentSiliconBeforeBack, hasPixelRectangularPatternAlongY;
 
   TFile *geomFile = new TFile(nameGeomFile);
   TNtuple *geomNtuple = (TNtuple*) geomFile->Get("AliMFTGeometry");
@@ -67,6 +69,10 @@ AliMFTSegmentation::AliMFTSegmentation(const Char_t *nameGeomFile):
   geomNtuple -> SetBranchAddress("equivalentSilicon",            &equivalentSilicon);
   geomNtuple -> SetBranchAddress("equivalentSiliconBeforeFront", &equivalentSiliconBeforeFront);
   geomNtuple -> SetBranchAddress("equivalentSiliconBeforeBack",  &equivalentSiliconBeforeBack);
+  if (geomNtuple -> GetBranch("hasPixelRectangularPatternAlongY")) {
+    geomNtuple -> SetBranchAddress("hasPixelRectangularPatternAlongY", &hasPixelRectangularPatternAlongY);
+  }
+  else hasPixelRectangularPatternAlongY = 0.;
   
   Int_t nPlanes = geomNtuple->GetEntries();
 
@@ -74,26 +80,57 @@ AliMFTSegmentation::AliMFTSegmentation(const Char_t *nameGeomFile):
 
     // Create new plane
 
-    printf("Setting segmentation for MFT plane #%02d\n", iPlane);
+    AliInfo(Form("Setting segmentation for MFT plane #%02d\n", iPlane));
 
     geomNtuple -> GetEntry(iPlane);
     zCenter = TMath::Abs(zCenter);
 
     AliMFTPlane *plane = new AliMFTPlane(Form("MFTPlane_%02d", iPlane), Form("MFTPlane_%02d", iPlane));
-    plane -> Init(iPlane, zCenter, rMin, rMax, pixelSizeX, pixelSizeY, thicknessActive, thicknessSupport, thicknessReadout);
+
+    plane -> Init(iPlane, 
+                 zCenter, 
+                 rMin, 
+                 rMax, 
+                 pixelSizeX, 
+                 pixelSizeY, 
+                 thicknessActive, 
+                 thicknessSupport, 
+                 thicknessReadout, 
+                 (hasPixelRectangularPatternAlongY>0.5));
+
     plane -> SetEquivalentSilicon(equivalentSilicon);
     plane -> SetEquivalentSiliconBeforeFront(equivalentSiliconBeforeFront);
     plane -> SetEquivalentSiliconBeforeBack(equivalentSiliconBeforeBack);
     plane -> CreateStructure();
     
     new ((*fMFTPlanes)[fMFTPlanes->GetEntries()]) AliMFTPlane(*plane);
-
+    delete plane;
+    
   }
   
   delete geomFile;
 
-  printf("MFT segmentation set!\n");
+  AliInfo("MFT segmentation set!\n");
+
+}
 
+//====================================================================================================================================================
+
+AliMFTSegmentation::~AliMFTSegmentation() {
+
+  if (fMFTPlanes) fMFTPlanes->Delete();
+  delete fMFTPlanes; 
+  
+}
+
+//====================================================================================================================================================
+
+void AliMFTSegmentation::Clear(const Option_t* /*opt*/) {
+
+  if (fMFTPlanes) fMFTPlanes->Delete();
+  delete fMFTPlanes; 
+  fMFTPlanes = NULL;
+  
 }
 
 //====================================================================================================================================================
@@ -115,6 +152,8 @@ THnSparseC* AliMFTSegmentation::GetDetElem(Int_t detElemID) const {
 
 Bool_t AliMFTSegmentation::Hit2PixelID(Double_t xHit, Double_t yHit, Int_t detElemID, Int_t &xPixel, Int_t &yPixel) {
 
+  // xPixel and yPixel start from 0
+
   THnSparseC *detElem = GetDetElem(detElemID);
 
   if ( xHit<detElem->GetAxis(0)->GetXmin() ||
@@ -131,3 +170,14 @@ Bool_t AliMFTSegmentation::Hit2PixelID(Double_t xHit, Double_t yHit, Int_t detEl
 
 //====================================================================================================================================================
 
+Bool_t AliMFTSegmentation::DoesPixelExist(Int_t detElemID, Int_t xPixel, Int_t yPixel) {
+
+  THnSparseC *detElem = GetDetElem(detElemID);
+
+  if (xPixel>=0 && xPixel<detElem->GetAxis(0)->GetNbins() && yPixel>=0 && yPixel<detElem->GetAxis(1)->GetNbins()) return kTRUE;
+  else return kFALSE;
+
+}
+
+//====================================================================================================================================================
+