]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MFT/AliMFT.cxx
Coverity fixed
[u/mrichter/AliRoot.git] / MFT / AliMFT.cxx
index 1a23486c8eef49d845ed907f5c21743a4e8a1c3b..1a6ae165f24045e2a9a25812098aac14598d8077 100644 (file)
@@ -63,7 +63,7 @@ AliMFT::AliMFT():
   fChargeDispersion(0),
   fSingleStepForChargeDispersion(0),
   fNStepForChargeDispersion(0),
-  fDensitySiOverSupport(10)
+  fDensitySupportOverSi(0.1)
 {
 
   // default constructor
@@ -86,7 +86,7 @@ AliMFT::AliMFT(const Char_t *name, const Char_t *title):
   fChargeDispersion(0),
   fSingleStepForChargeDispersion(0),
   fNStepForChargeDispersion(0),
-  fDensitySiOverSupport(10)
+  fDensitySupportOverSi(0.1)
 {
 
   fNameGeomFile = "AliMFTGeometry.root";
@@ -113,7 +113,7 @@ AliMFT::AliMFT(const Char_t *name, const Char_t *title, Char_t *nameGeomFile):
   fChargeDispersion(0),
   fSingleStepForChargeDispersion(0),
   fNStepForChargeDispersion(0),
-  fDensitySiOverSupport(10)
+  fDensitySupportOverSi(0.1)
 {
 
   fNameGeomFile = nameGeomFile;
@@ -175,7 +175,7 @@ void AliMFT::CreateMaterials() {
   AliMaterial(++matId, "Readout", aSi,   zSi,    dSi,    radSi,  absSi  );  
   AliMedium(kReadout,  "Readout", matId, unsens, isxfld, sxmgmx, tmaxfdSi, stemaxSi, deemaxSi, epsilSi, stminSi);
 
-  AliMaterial(++matId, "Support", aSi,   zSi,    dSi/fDensitySiOverSupport, fDensitySiOverSupport*radSi, fDensitySiOverSupport*absSi);  
+  AliMaterial(++matId, "Support", aSi,   zSi,    dSi*fDensitySupportOverSi, radSi/fDensitySupportOverSi, absSi/fDensitySupportOverSi);  
   AliMedium(kSupport,  "Support", matId, unsens, isxfld,  sxmgmx,    tmaxfdSi, stemaxSi, deemaxSi, epsilSi, stminSi);
     
   AliInfo("End MFT materials");
@@ -205,6 +205,8 @@ void AliMFT::StepManager() {
 
   // Full Step Manager
 
+  AliDebug(2, Form("Entering StepManager: gMC->CurrentVolName() = %s", gMC->CurrentVolName()));
+
   if (!fSegmentation) AliFatal("No segmentation available");    // DO WE HAVE A SEGMENTATION???
 
   if (!(this->IsActive())) return;
@@ -247,8 +249,8 @@ void AliMFT::StepManager() {
   gMC->TrackPosition(position);
   gMC->TrackMomentum(momentum);
 
-  AliDebug(1, Form("AliMFT::StepManager()->%s Hit #%06d (z=%f) belongs to track %02d\n", 
-                  gMC->CurrentVolName(), fNhits, position.Z(), gAlice->GetMCApp()->GetCurrentTrackNumber())); 
+  AliDebug(1, Form("AliMFT::StepManager()->%s Hit #%06d (x=%f, y=%f, z=%f) belongs to track %02d\n", 
+                  gMC->CurrentVolName(), fNhits, position.X(), position.Y(), position.Z(), gAlice->GetMCApp()->GetCurrentTrackNumber())); 
 
   hit.SetPosition(position);
   hit.SetTOF(gMC->TrackTime());
@@ -309,6 +311,8 @@ TGeoVolumeAssembly* AliMFT::CreateVol() {
                                                    plane->GetRMaxSupport(),
                                                    0.5*(plane->GetSupportElement(0)->GetAxis(2)->GetXmax() - 
                                                         plane->GetSupportElement(0)->GetAxis(2)->GetXmin()) );
+    AliDebug(2, Form("Created vol %s", supportElem->GetName()));
+    supportElem->SetLineColor(kCyan-9);
     vol -> AddNode(supportElem, 0, new TGeoTranslation(origin[0], origin[1], origin[2]));
 
     AliDebug(1, "support elements created!");
@@ -328,6 +332,8 @@ TGeoVolumeAssembly* AliMFT::CreateVol() {
       for (Int_t iSlice=0; iSlice<fNSlices; iSlice++) {
        origin[2] = -0.5*(plane->GetActiveElement(iActive)->GetAxis(2)->GetXmin() + 2*dz*(iSlice+1) + plane->GetActiveElement(iActive)->GetAxis(2)->GetXmin() + 2*dz*(iSlice) );
        TGeoVolume *activeElem = gGeoManager->MakeBox(Form("MFT_plane%02d_active%03d_slice%02d", iPlane, iActive, iSlice), silicon, dx, dy, dz);
+       AliDebug(2, Form("Created vol %s", activeElem->GetName()));
+       activeElem->SetLineColor(kGreen);
        vol -> AddNode(activeElem, 0, new TGeoTranslation(origin[0], origin[1], origin[2]));
       }
 
@@ -348,6 +354,8 @@ TGeoVolumeAssembly* AliMFT::CreateVol() {
       origin[2] = -0.5*(plane->GetReadoutElement(iReadout)->GetAxis(2)->GetXmax() + plane->GetReadoutElement(iReadout)->GetAxis(2)->GetXmin());
 
       TGeoVolume *readoutElem = gGeoManager->MakeBox(Form("MFT_plane%02d_readout%03d", iPlane, iReadout), readout, dx, dy, dz);
+      AliDebug(2, Form("Created vol %s", readoutElem->GetName()));
+      readoutElem->SetLineColor(kRed);
       vol -> AddNode(readoutElem, 0, new TGeoTranslation(origin[0], origin[1], origin[2]));
       
     }
@@ -491,13 +499,62 @@ void AliMFT::Hits2SDigitsLocal(TClonesArray *hits, const TObjArray *pSDig, Int_t
     }
 
     for (Int_t iSideDigit=0; iSideDigit<fSideDigits->GetEntries(); iSideDigit++) {
-      AliMFTDigit *newDigit = (AliMFTDigit*) fSideDigits->At(iSideDigit);
-      new ((*pSDigList[sDigit.GetPlane()])[pSDigList[sDigit.GetPlane()]->GetEntries()]) AliMFTDigit(*newDigit);
+      AliMFTDigit *newSDigit = (AliMFTDigit*) fSideDigits->At(iSideDigit);
+      new ((*pSDigList[sDigit.GetPlane()])[pSDigList[sDigit.GetPlane()]->GetEntries()]) AliMFTDigit(*newSDigit);
     }
 
-    fSideDigits->Clear();    
+    fSideDigits->Delete();  
 
   }
+
+  // ------------ In case we should simulate a rectangular pattern of pixel...
+  
+  for (Int_t iPlane=0; iPlane<fNPlanes; iPlane++) { 
+    if (fSegmentation->GetPlane(iPlane)->HasPixelRectangularPatternAlongY()) {
+      Int_t nSDigits = pSDigList[iPlane]->GetEntries();
+      for (Int_t iSDigit=0; iSDigit<nSDigits; iSDigit++) {
+       AliMFTDigit *mySDig = (AliMFTDigit*) (pSDigList[iPlane]->At(iSDigit));
+       if (mySDig->GetPixelX()%2 == mySDig->GetPixelY()%2) {   // both pair or both odd
+         Int_t xPixelNew = mySDig->GetPixelX();
+         Int_t yPixelNew = mySDig->GetPixelY()+1;
+         if (fSegmentation->DoesPixelExist(mySDig->GetDetElemID(), xPixelNew, yPixelNew)) {
+           AliMFTDigit newSDigit;
+           newSDigit.SetEloss(0.);
+           newSDigit.SetDetElemID(mySDig->GetDetElemID());
+           newSDigit.SetPlane(iPlane);
+           newSDigit.SetPixID(xPixelNew, yPixelNew, 0);
+           newSDigit.SetPixWidth(fSegmentation->GetPixelSizeX(newSDigit.GetDetElemID()), 
+                                 fSegmentation->GetPixelSizeY(newSDigit.GetDetElemID()),
+                                 fSegmentation->GetPixelSizeZ(newSDigit.GetDetElemID()));  
+           newSDigit.SetPixCenter(fSegmentation->GetPixelCenterX(newSDigit.GetDetElemID(), xPixelNew), 
+                                  fSegmentation->GetPixelCenterY(newSDigit.GetDetElemID(), yPixelNew),
+                                  fSegmentation->GetPixelCenterZ(newSDigit.GetDetElemID(), 0)); 
+           new ((*pSDigList[iPlane])[pSDigList[iPlane]->GetEntries()]) AliMFTDigit(newSDigit);
+         }
+       }
+       else {   // pair-odd
+         Int_t xPixelNew = mySDig->GetPixelX();
+         Int_t yPixelNew = mySDig->GetPixelY()-1;
+         if (fSegmentation->DoesPixelExist(mySDig->GetDetElemID(), xPixelNew, yPixelNew)) {
+           AliMFTDigit newSDigit;
+           newSDigit.SetEloss(0.);
+           newSDigit.SetDetElemID(mySDig->GetDetElemID());
+           newSDigit.SetPlane(iPlane);
+           newSDigit.SetPixID(xPixelNew, yPixelNew, 0);
+           newSDigit.SetPixWidth(fSegmentation->GetPixelSizeX(newSDigit.GetDetElemID()), 
+                                 fSegmentation->GetPixelSizeY(newSDigit.GetDetElemID()),
+                                 fSegmentation->GetPixelSizeZ(newSDigit.GetDetElemID()));  
+           newSDigit.SetPixCenter(fSegmentation->GetPixelCenterX(newSDigit.GetDetElemID(), xPixelNew), 
+                                  fSegmentation->GetPixelCenterY(newSDigit.GetDetElemID(), yPixelNew),
+                                  fSegmentation->GetPixelCenterZ(newSDigit.GetDetElemID(), 0)); 
+           new ((*pSDigList[iPlane])[pSDigList[iPlane]->GetEntries()]) AliMFTDigit(newSDigit);
+         }
+       }
+      }
+    }
+  }
+
+  //------------------------------------------------------------------------
   
   AliDebug(1,"Stop Hits2SDigitsLocal");