]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDParam.cxx
Bug in area evaluation for reconstruction of ring. Important for PbPb events (high...
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDParam.cxx
index f5bc54b6fb021221ffd7e434fbeacfb9b1986e18..f8b8414475c50a1e1fdcb4d06d328af6f1c9ac09 100644 (file)
 #include <AliRunLoader.h>  //Stack()
 #include <AliStack.h>      //Stack()
 #include <TParticle.h>     //Stack()    
-#include "AliHMPIDHelix.h"  //TestTrans()
-
+#include <TGeoPhysicalNode.h> //ctor
+#include <TGeoBBox.h>
 ClassImp(AliHMPIDParam)
 
+
+Float_t AliHMPIDParam::fgkMinPcX[]={0.,0.,0.,0.,0.,0.};
+Float_t AliHMPIDParam::fgkMaxPcX[]={0.,0.,0.,0.,0.,0.};
+Float_t AliHMPIDParam::fgkMinPcY[]={0.,0.,0.,0.,0.,0.};
+Float_t AliHMPIDParam::fgkMaxPcY[]={0.,0.,0.,0.,0.,0.};
+
+Float_t AliHMPIDParam::fgCellX=0.;
+Float_t AliHMPIDParam::fgCellY=0.;
+
+Float_t AliHMPIDParam::fgPcX=0;
+Float_t AliHMPIDParam::fgPcY=0;
+
+Float_t AliHMPIDParam::fgAllX=0;
+Float_t AliHMPIDParam::fgAllY=0;
+
+Int_t AliHMPIDParam::fgSigmas=4;
+
 AliHMPIDParam* AliHMPIDParam::fgInstance=0x0;        //singleton pointer               
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-AliHMPIDParam::AliHMPIDParam():TNamed("RichParam","default version") 
+AliHMPIDParam::AliHMPIDParam(Bool_t noGeo=kFALSE):TNamed("HmpidParam","default version") 
 {
 // Here all the intitializition is taken place when AliHMPIDParam::Instance() is invoked for the first time.
-// In particulare, matrices to be used for LORS<->MARS trasnformations are initialized from TGeo structure.    
+// In particular, matrices to be used for LORS<->MARS trasnformations are initialized from TGeo structure.    
 // Note that TGeoManager should be already initialized from geometry.root file  
-  fX=0.5*AliHMPIDDigit::SizeAllX();
-  fY=0.5*AliHMPIDDigit::SizeAllY();
-  for(Int_t i=0;i<7;i++) 
-    if(gGeoManager)
-      fM[i]=(TGeoHMatrix*)gGeoManager->GetVolume("ALIC")->GetNode(Form("HMPID_%i",i))->GetMatrix();
-    else{
+
+  Float_t dead=2.6;// cm of the dead zones between PCs-> See 2CRC2099P1
+  
+  if(noGeo==kFALSE && !gGeoManager)  
+  {
+    TGeoManager::Import("geometry.root");
+    if(!gGeoManager) AliFatal("!!!!!!No geometry loaded!!!!!!!");
+  }
+  
+  fgCellX=0.8;fgCellY=0.84;
+  
+  if(!noGeo==kTRUE){
+    TGeoVolume *pCellVol = gGeoManager->GetVolume("Hcel");
+    if(pCellVol) {
+      TGeoBBox *bcell = (TGeoBBox *)pCellVol->GetShape();
+      fgCellX=2.*bcell->GetDX(); fgCellY = 2.*bcell->GetDY();  // overwrite the values with the read ones
+    }
+  }    
+  fgPcX=80.*fgCellX; fgPcY = 48.*fgCellY;
+  fgAllX=2.*fgPcX+dead;
+  fgAllY=3.*fgPcY+2.*dead;
+
+  fgkMinPcX[1]=fgPcX+dead; fgkMinPcX[3]=fgkMinPcX[1];  fgkMinPcX[5]=fgkMinPcX[3];
+  fgkMaxPcX[0]=fgPcX; fgkMaxPcX[2]=fgkMaxPcX[0];  fgkMaxPcX[4]=fgkMaxPcX[2];
+  fgkMaxPcX[1]=fgAllX; fgkMaxPcX[3]=fgkMaxPcX[1];  fgkMaxPcX[5]=fgkMaxPcX[3];
+
+  fgkMinPcY[2]=fgPcY+dead; fgkMinPcY[3]=fgkMinPcY[2];  
+  fgkMinPcY[4]=2.*fgPcY+2.*dead; fgkMinPcY[5]=fgkMinPcY[4];
+  fgkMaxPcY[0]=fgPcY; fgkMaxPcY[1]=fgkMaxPcY[0];  
+  fgkMaxPcY[2]=2.*fgPcY+dead; fgkMaxPcY[3]=fgkMaxPcY[2]; 
+  fgkMaxPcY[4]=fgAllY; fgkMaxPcY[5]=fgkMaxPcY[4];   
+    
+  fX=0.5*SizeAllX();
+  fY=0.5*SizeAllY();
+  
+  for(Int_t i=kMinCh;i<=kMaxCh;i++) 
+    if(gGeoManager && gGeoManager->IsClosed()) {
+      TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(Form("/HMPID/Chamber%i",i));
+      if (!pne) {
+        AliErrorClass(Form("The symbolic volume %s does not correspond to any physical entry!",Form("HMPID_%i",i)));
+        fM[i]=new TGeoHMatrix;
+        IdealPosition(i,fM[i]);
+      } else {
+        TGeoPhysicalNode *pnode = pne->GetPhysicalNode();
+        if(pnode) fM[i]=pnode->GetMatrix();
+        else {
+          fM[i]=new TGeoHMatrix;
+          IdealPosition(i,fM[i]);
+        }
+      }
+    } else{
       fM[i]=new TGeoHMatrix;
       IdealPosition(i,fM[i]);
     } 
@@ -57,12 +119,12 @@ void AliHMPIDParam::IdealPosition(Int_t iCh, TGeoHMatrix *pMatrix)
 // Construct ideal position matrix for a given chamber
 // Arguments: iCh- chamber ID; pMatrix- pointer to precreated unity matrix where to store the results
 //   Returns: none
-  const Double_t kAngHor=19.5; //  horizontal angle between chambers  19.5 grad
-  const Double_t kAngVer=20;   //  vertical angle between chambers    20   grad     
-  const Double_t kAngCom=30;   //  common HMPID rotation with respect to x axis  30   grad     
-  const Double_t trans[3]={490,0,0}; //center of the chamber is on window-gap surface
-  pMatrix->RotateY(90);           //rotate around y since initial position is in XY plane -> now in YZ plane
-  pMatrix->SetTranslation(trans); //now plane in YZ is shifted along x 
+  const Double_t kAngHor=19.5;        //  horizontal angle between chambers  19.5 grad
+  const Double_t kAngVer=20;          //  vertical angle between chambers    20   grad     
+  const Double_t kAngCom=30;          //  common HMPID rotation with respect to x axis  30   grad     
+  const Double_t kTrans[3]={490,0,0}; //  center of the chamber is on window-gap surface
+  pMatrix->RotateY(90);               //  rotate around y since initial position is in XY plane -> now in YZ plane
+  pMatrix->SetTranslation(kTrans);    //  now plane in YZ is shifted along x 
   switch(iCh){
     case 0:                pMatrix->RotateY(kAngHor);  pMatrix->RotateZ(-kAngVer);  break; //right and down 
     case 1:                                            pMatrix->RotateZ(-kAngVer);  break; //down