area of Mathieson parametrized; hit ctor change eloss to qdc; Helix removed
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDParam.cxx
index 1fa574c..f5bc54b 100644 (file)
@@ -35,7 +35,13 @@ AliHMPIDParam::AliHMPIDParam():TNamed("RichParam","default version")
 // 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++) fM[i]=(TGeoHMatrix*)gGeoManager->GetVolume("ALIC")->GetNode(Form("HMPID_%i",i))->GetMatrix();
+  for(Int_t i=0;i<7;i++) 
+    if(gGeoManager)
+      fM[i]=(TGeoHMatrix*)gGeoManager->GetVolume("ALIC")->GetNode(Form("HMPID_%i",i))->GetMatrix();
+    else{
+      fM[i]=new TGeoHMatrix;
+      IdealPosition(i,fM[i]);
+    } 
   fgInstance=this; 
 }//ctor
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -46,6 +52,30 @@ void AliHMPIDParam::Print(Option_t* opt) const
   for(Int_t i=0;i<7;i++) fM[i]->Print(opt);
 }//Print()
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+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 
+  switch(iCh){
+    case 0:                pMatrix->RotateY(kAngHor);  pMatrix->RotateZ(-kAngVer);  break; //right and down 
+    case 1:                                            pMatrix->RotateZ(-kAngVer);  break; //down              
+    case 2:                pMatrix->RotateY(kAngHor);                               break; //right 
+    case 3:                                                                         break; //no rotation
+    case 4:                pMatrix->RotateY(-kAngHor);                              break; //left   
+    case 5:                                            pMatrix->RotateZ(kAngVer);   break; //up
+    case 6:                pMatrix->RotateY(-kAngHor); pMatrix->RotateZ(kAngVer);   break; //left and up 
+  }
+  pMatrix->RotateZ(kAngCom);     //apply common rotation  in XY plane    
+   
+}
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Int_t AliHMPIDParam::Stack(Int_t evt,Int_t tid)
 {
 // Prints some useful info from stack