LCOV - code coverage report
Current view: top level - HMPID/HMPIDbase - AliHMPIDMisAligner.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 37 2.7 %
Date: 2016-06-14 17:26:59 Functions: 1 5 20.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 2007-2010, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : //========================================================================
      17             : //
      18             : // This class generates misalignment for HMPID. In particular it defines
      19             : // the misalignment in the three canonical scenarios: "ideal", "residual"
      20             : // and "full".
      21             : // It is meant to be run standalone or from the steering macro
      22             : // $ALICE_ROOT/macros/MakeAlignmentObjs.C
      23             : // looping on the detectors.
      24             : //
      25             : //========================================================================
      26             : 
      27             : #include "AliHMPIDMisAligner.h"
      28             : #include "AliGeomManager.h"
      29             : #include "TClonesArray.h"
      30             : #include "TRandom.h"
      31             : #include "TMath.h"
      32             : #include "AliAlignObjMatrix.h"
      33             : #include "AliLog.h"
      34             : 
      35          16 : ClassImp(AliHMPIDMisAligner)
      36             : 
      37             : //_______________________________________________________________________________________
      38           0 : AliHMPIDMisAligner::AliHMPIDMisAligner() : AliMisAligner()
      39           0 : {
      40             :     //
      41             :     // dummy constructor
      42             :     //
      43           0 : }
      44             : 
      45             : //_______________________________________________________________________________________
      46             : TClonesArray* AliHMPIDMisAligner::MakeAlObjsArray() {
      47             :     // builds and returns the array of alignment objects
      48             :     // according to the spcified misalignment scenario
      49             :     // ("ideal", "residual" or "full").
      50             :     //
      51           0 :     if(!AliGeomManager::GetGeometry())
      52             :     {
      53           0 :         AliError("No geometry loaded into AliGeomManager! Returning null pointer!");
      54           0 :         return 0;
      55             :     }
      56             : 
      57           0 :     TClonesArray *array = new TClonesArray("AliAlignObjMatrix",7);
      58             : 
      59             :     AliGeomManager::ELayerID idHMPID =  AliGeomManager::kHMPID;
      60             :     Double_t sigmaTrans, sigmaRotPsi, sigmaRotTheta, sigmaRotPhi;
      61             :     Double_t dX=0., dY=0., dZ=0., dPsi=0., dTheta=0., dPhi=0.; //displacements
      62             : 
      63             :     // TRandom *pRnd   = new TRandom(4357);
      64           0 :     gRandom->SetSeed(4357);
      65             : 
      66           0 :     if(TString(GetMisalType())=="ideal")
      67             :     {
      68             : 
      69           0 :         for (Int_t iCh = 0; iCh < 7; iCh++) {
      70           0 :             new((*array)[iCh]) AliAlignObjMatrix(AliGeomManager::SymName(idHMPID,iCh),
      71           0 :                     AliGeomManager::LayerToVolUID(idHMPID,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE);
      72             :         }
      73             : 
      74           0 :     }else if( TString(GetMisalType())=="residual" || TString(GetMisalType())=="full"){
      75             : 
      76             :         sigmaTrans=4.;       // 4 cm
      77             :         sigmaRotPsi = 0.2;   // degrees
      78             :         sigmaRotTheta = 1.0; // degrees
      79             :         sigmaRotPhi = 0.5;   // degrees
      80             :         
      81           0 :         for (Int_t iCh = 0; iCh < 7; iCh++) {
      82             :           
      83             :             /*dX     = 2 - 2.1*gRandom->Uniform();
      84             :             dY     = 2 - 2.1*gRandom->Uniform();
      85             :             dZ     = 2.0 - 4*gRandom->Uniform();
      86             :             dPsi   = 0.1 - 0.2*gRandom->Uniform();
      87             :             dTheta = 1 - 1.1*gRandom->Uniform();
      88             :             dPhi   = 0.25 - 0.5*gRandom->Uniform();*/
      89             :          
      90           0 :             dX     = sigmaTrans/2 - (sigmaTrans/2+0.1)*gRandom->Uniform();   // -0.1  <---> 2    cm
      91           0 :             dY     = sigmaTrans/2 - (sigmaTrans/2+0.1)*gRandom->Uniform();   // -0.1  <---> 2    cm
      92           0 :             dZ     = (gRandom->Uniform() - 0.5)*sigmaTrans;                  // -2.0  <---> 2    cm
      93           0 :             dPsi   = (gRandom->Uniform() - 0.5)*sigmaRotPsi;                 // -0.1  <---> 0.1  degree
      94           0 :             dTheta = sigmaRotTheta - (sigmaRotTheta+0.1)*gRandom->Uniform(); // -0.1  <---> 1.0  degree
      95           0 :             dPhi   = (gRandom->Uniform() - 0.5)*sigmaRotPhi;                 // -0.25 <---> 0.25 degree  
      96             : 
      97             :             
      98             :             //    dX     = (pRnd->Uniform()-0.5)*sigmaTrans;    dY     = (pRnd->Uniform()-0.5)*sigmaTrans;    dZ     = (pRnd->Uniform()-0.5)*sigmaTrans;
      99             :             //    dPsi   = (pRnd->Uniform()-0.5)*sigmaRot;    dTheta = (pRnd->Uniform()-0.5)*sigmaRot;    dPhi   = (pRnd->Uniform()-0.5)*sigmaRot;
     100           0 :             new((*array)[iCh]) AliAlignObjMatrix(AliGeomManager::SymName(idHMPID,iCh),
     101           0 :                     AliGeomManager::LayerToVolUID(idHMPID,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE);
     102             :         }
     103             :     }else{
     104           0 :         AliError(Form("\"%s\" is not a valid identifier for misalignment types. Exiting ...",GetMisalType()));
     105           0 :         return 0;
     106             :     }
     107             : 
     108           0 :     return array;
     109           0 : }
     110             : 
     111             : //_______________________________________________________________________________________
     112             : AliCDBMetaData* AliHMPIDMisAligner::GetCDBMetaData() const {
     113             :     // Returns the comment and responsible for the
     114             :     // AliCDBMetaData to be associated with the OCDB entry
     115             :     // containing the HMPID array of misalignment objects
     116             :     //
     117           0 :     AliCDBMetaData* md = new AliCDBMetaData();
     118           0 :     md->SetResponsible("HMPID expert means nothing");
     119             : 
     120           0 :     if(TString(GetMisalType())=="ideal")
     121           0 :         md->SetComment("Alignment objects for HMPID ideal misalignment");
     122           0 :     if(TString(GetMisalType())=="residual")
     123           0 :         md->SetComment("Alignment objects for HMPID residual misalignment");
     124           0 :     if(TString(GetMisalType())=="full")
     125           0 :         md->SetComment("Full misalignment objects for HMPID produced with sigmaTrans=1mm and sigmaRot=1mrad");
     126             : 
     127           0 :     return md;
     128           0 : }

Generated by: LCOV version 1.11