]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCParam.cxx
Adding the document - naming convention for trending variables.
[u/mrichter/AliRoot.git] / TPC / AliTPCParam.cxx
index e3e242cb18763cf2c8ad61019cc1327e1c4d3cd1..37a82d86ae02f9622d47945f51732de53bb5d7e2 100644 (file)
@@ -32,8 +32,9 @@
 
 #include <TGeoManager.h>
 #include <TGeoPhysicalNode.h>
+#include <TString.h>
 #include "AliAlignObj.h"
-#include "AliAlignObjAngles.h"
+#include "AliAlignObjParams.h"
 #include "AliLog.h"
 
 ClassImp(AliTPCParam)
@@ -115,6 +116,11 @@ AliTPCParam::AliTPCParam()
             fADCDynRange(0.),
             fTotalNormFac(0.),
             fNoiseNormFac(0.),
+            fNominalVoltage(),
+            fMaxVoltageDeviation(40.),
+            fMaxDipVoltage(2.),
+            fMaxHVfractionBad(.4),
+            fVoltageDipScanPeriod(1.),
             fNResponseMax(0),
             fResponseThreshold(0.),
             fCurrentMax(0),
@@ -143,29 +149,10 @@ AliTPCParam::~AliTPCParam()
   if (fResponseWeight!=0) delete [] fResponseWeight;
   if (fRotAngle      !=0) delete [] fRotAngle;
 
-  if (fTrackingMatrix) {
-    for(Int_t i = 0; i < fNSector; i++)
-      delete fTrackingMatrix[i];
-    delete [] fTrackingMatrix;
-  }
-
-  if (fClusterMatrix) {
-    for(Int_t i = 0; i < fNSector; i++)
-      delete fClusterMatrix[i];
-    delete [] fClusterMatrix;
-  }
-
-  if (fGlobalMatrix) {
-    for(Int_t i = 0; i < fNSector; i++)
-      delete fGlobalMatrix[i];
-    delete [] fGlobalMatrix;
-  }
+  CleanGeoMatrices();
 
 }
 
-
-
-
 Int_t  AliTPCParam::Transform0to1(Float_t *xyz, Int_t * index)  const
 {
   //
@@ -196,7 +183,8 @@ Int_t  AliTPCParam::Transform0to1(Float_t *xyz, Int_t * index)  const
       if (xyz[2]<0)    sector+=(fNOuterSector>>1);            
     }
     else   
-      if (xyz[2]<0) sector+=(fNInnerSector>>1);    
+      if (xyz[2]<0) sector+=(fNInnerSector>>1);  
+  if (sector<0 || sector>=fNSector) AliError(Form("Wrong sector %d",sector));
   index[1]=sector; // calculated sector number
   index[0]=1; // indicates system after transformation
   return sector;
@@ -509,6 +497,14 @@ void AliTPCParam::SetDefault()
   SetMaxTBin(kMaxTBin);
   SetADCSat(kADCSat);
   SetADCDynRange(kADCDynRange);
+  for (UInt_t i=0; i<36; i++)
+  {
+    SetNominalVoltage(1196.0, i);
+  }
+  for (UInt_t i=36; i<72; i++)
+  {
+    SetNominalVoltage(1417.0, i);
+  }
 //   //set magnetic field
 //   SetBField(kBField);
 //   SetNPrimLoss(kNPrimLoss);
@@ -595,8 +591,8 @@ Bool_t AliTPCParam::Update()
   //
   //response data
   //
-  if (fResponseBin==0) delete [] fResponseBin;
-  if (fResponseWeight==0) delete [] fResponseBin;
+  if (fResponseBin) delete [] fResponseBin;
+  if (fResponseWeight) delete [] fResponseWeight;
   fResponseBin    = new Int_t[3*fNResponseMax];
   fResponseWeight = new Float_t[fNResponseMax];
 
@@ -606,7 +602,31 @@ Bool_t AliTPCParam::Update()
   return kTRUE;
 }
 
+void AliTPCParam::CleanGeoMatrices(){
+  //
+  // clean geo matrices
+  //
 
+  if (fTrackingMatrix) {
+    for(Int_t i = 0; i < fNSector; i++)
+      delete fTrackingMatrix[i];
+    delete [] fTrackingMatrix;
+  }
+  
+  if (fClusterMatrix) {
+    for(Int_t i = 0; i < fNSector; i++)
+      delete fClusterMatrix[i];
+    delete [] fClusterMatrix;
+  }
+  
+  if (fGlobalMatrix) {
+    for(Int_t i = 0; i < fNSector; i++)
+      delete fGlobalMatrix[i];
+    delete [] fGlobalMatrix;
+  }
+  
+  return;
+}
 
 Bool_t AliTPCParam::ReadGeoMatrices(){
   //
@@ -615,14 +635,21 @@ Bool_t AliTPCParam::ReadGeoMatrices(){
   if (!gGeoManager){
     AliFatal("Geo manager not initialized\n");
   }
-  AliAlignObjAngles o;
+  AliAlignObjParams o;
   //
-  if (fTrackingMatrix) delete [] fTrackingMatrix;
+
+  // clean geo matrices
+  CleanGeoMatrices();
+
+  // create new geo matrices
   fTrackingMatrix = new TGeoHMatrix*[fNSector];
-  if (fClusterMatrix) delete [] fClusterMatrix;
   fClusterMatrix = new TGeoHMatrix*[fNSector];
-  if (fGlobalMatrix) delete [] fGlobalMatrix;
   fGlobalMatrix = new TGeoHMatrix*[fNSector];
+  for (Int_t isec=0; isec<fNSector; isec++) {
+    fGlobalMatrix[isec] = 0;
+    fClusterMatrix[isec]= 0;
+    fTrackingMatrix[isec]=0;
+  }   
   //
   for (Int_t isec=0; isec<fNSector; isec++) {
     fGlobalMatrix[isec] = 0;
@@ -641,13 +668,19 @@ Bool_t AliTPCParam::ReadGeoMatrices(){
     }
 
     UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iModule);
-    const char *symname = AliGeomManager::SymName(volid);
-    TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(symname);
-    const char *path = symname;
-    if(pne) path=pne->GetTitle();
-    if (!gGeoManager->cd(path)) return kFALSE;      
+    TGeoPNEntry* pne = gGeoManager->GetAlignableEntryByUID(volid);
+    if(!pne)
+    {
+      AliError(Form("Alignable entry for volume ID %d not in geometry. Exiting!",volid));
+      return kFALSE;
+    }
+    const char *path = pne->GetTitle();
+    if (!gGeoManager->cd(path)) return kFALSE;
     TGeoHMatrix *m = gGeoManager->GetCurrentMatrix();
+    // Since GEANT4 does not allow reflections, in this case the reflection
+    // component if the matrix is embedded by TGeo inside TGeoScaledShape
+    if (gGeoManager->GetCurrentVolume()->GetShape()->IsReflected()) 
+       m->ReflectZ(kFALSE, kTRUE);
     //
     TGeoRotation mchange; 
     mchange.RotateY(90); mchange.RotateX(90);
@@ -804,7 +837,7 @@ Float_t AliTPCParam::GetChamberCenter(Int_t isec, Float_t * center) const
     if (center){
       center[0] = kROCcenterIn;
       center[1] = 0; 
-      center[2] = -5.51; 
+      center[2] = -5.51-0.08
     }
     return kROCcenterIn;
   }
@@ -812,11 +845,9 @@ Float_t AliTPCParam::GetChamberCenter(Int_t isec, Float_t * center) const
     if (center){
       center[0] = kROCcenterOut;
       center[1] = 0; 
-      center[2] = -5.61; 
+      center[2] = -5.61-0.08
     }
     return kROCcenterOut;
   }
 }
 
-
-