LCOV - code coverage report
Current view: top level - TPC/TPCbase - AliTPCExBTwist.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 14 48 29.2 %
Date: 2016-06-14 17:26:59 Functions: 3 10 30.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, 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             : /// \class AliTPCExBTwist
      17             : /// \brief AliTPCExBTwist class
      18             : 
      19             : 
      20             : #include "AliMagF.h"
      21             : #include "TGeoGlobalMagField.h"
      22             : #include "AliTPCcalibDB.h"
      23             : #include "AliTPCParam.h"
      24             : #include "AliLog.h"
      25             : 
      26             : #include "AliTPCExBTwist.h"
      27             : 
      28             : AliTPCExBTwist::AliTPCExBTwist()
      29           6 :   : AliTPCCorrection("exb_twist","ExB twist"),
      30           6 :     fC1(0.),fC2(0.),
      31           6 :     fXTwist(0.),fYTwist(0.)
      32          30 : {
      33             :   /// default constructor
      34             : 
      35          12 : }
      36             : 
      37           0 : AliTPCExBTwist::~AliTPCExBTwist() {
      38             :   /// default destructor
      39             : 
      40           0 : }
      41             : 
      42             : Bool_t AliTPCExBTwist::AddCorrectionCompact(AliTPCCorrection* corr, Double_t weight){
      43             :   /// Add correction  and make them compact
      44             :   /// Assumptions:
      45             :   ///  - origin of distortion/correction are additive
      46             :   ///  - only correction ot the same type supported ()
      47             : 
      48           0 :   if (corr==NULL) {
      49           0 :     AliError("Zerro pointer - correction");
      50           0 :     return kFALSE;
      51             :   }
      52           0 :   AliTPCExBTwist * corrC = dynamic_cast< AliTPCExBTwist*>(corr);
      53           0 :   if (corrC == NULL) return kFALSE;
      54           0 :   fXTwist+=weight*corrC->fXTwist;        // Twist of E to B field in X-Z [rad]
      55           0 :   fYTwist+=weight*corrC->fYTwist;        // Twist of E to B field in Y-Z [rad]
      56           0 :   return kTRUE;
      57           0 : }
      58             : 
      59             : 
      60             : 
      61             : void AliTPCExBTwist::Init() {
      62             :   /// Initialization funtion
      63             : 
      64          12 :   AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
      65           6 :   if (!magF) AliError("Magneticd field - not initialized");
      66           6 :   Double_t bzField = magF->SolenoidField()/10.; //field in T
      67           6 :   AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters();
      68           6 :   if (!param) AliError("Parameters - not initialized");
      69           6 :   Double_t vdrift = param->GetDriftV()/1000000.; // [cm/us]   // From dataBase: to be updated: per second (ideally)
      70             :   Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
      71           6 :   Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ;
      72             :   // Correction Terms for effective omegaTau; obtained by a laser calibration run
      73           6 :   SetOmegaTauT1T2(wt,fT1,fT2);
      74             : 
      75             : 
      76           6 : }
      77             : 
      78             : void AliTPCExBTwist::Update(const TTimeStamp &/*timeStamp*/) {
      79             :   /// Update function
      80             : 
      81           0 :   AliMagF* magF= (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
      82           0 :   if (!magF) AliError("Magneticd field - not initialized");
      83           0 :   Double_t bzField = magF->SolenoidField()/10.; //field in T
      84           0 :   AliTPCParam *param= AliTPCcalibDB::Instance()->GetParameters();
      85           0 :   if (!param) AliError("Parameters - not initialized");
      86           0 :   Double_t vdrift = param->GetDriftV()/1000000.; // [cm/us]   // From dataBase: to be updated: per second (ideally)
      87             :   Double_t ezField = 400; // [V/cm]   // to be updated: never (hopefully)
      88           0 :   Double_t wt = -10.0 * (bzField*10) * vdrift / ezField ;
      89             :   // Correction Terms for effective omegaTau; obtained by a laser calibration run
      90           0 :   SetOmegaTauT1T2(wt,fT1,fT2);
      91             : 
      92             : 
      93           0 : }
      94             : 
      95             : 
      96             : 
      97             : void AliTPCExBTwist::GetCorrection(const Float_t x[],const Short_t roc,Float_t dx[]) {
      98             :   /// Calculates the correction of a mismatch between the E and B field axis
      99             : 
     100           0 :   const Float_t zstart=x[2];
     101           0 :   const Float_t zend  =(roc%36<18?fgkTPCZ0:-fgkTPCZ0);
     102           0 :   const Float_t zdrift=zstart-zend;
     103             : 
     104           0 :   dx[0]=(fC2*fXTwist-fC1*fYTwist)*zdrift;
     105           0 :   dx[1]=(fC1*fXTwist+fC2*fYTwist)*zdrift;
     106           0 :   dx[2]=0.;
     107           0 : }
     108             : 
     109             : void AliTPCExBTwist::Print(const Option_t* option) const {
     110             :   /// Print function to check the settings (e.g. the twist in the X direction)
     111             :   /// option=="a" prints the C0 and C1 coefficents for calibration purposes
     112             : 
     113           0 :   TString opt = option; opt.ToLower();
     114           0 :   printf("%s\n",GetTitle());
     115             : 
     116           0 :   printf(" - Twist settings: X-Twist: %1.5f rad, Y-Twist: %1.5f rad \n",fXTwist,fYTwist);
     117           0 :   if (opt.Contains("a")) { // Print all details
     118           0 :     printf(" - T1: %1.4f, T2: %1.4f \n",fT1,fT2);
     119           0 :     printf(" - C1: %1.4f, C2: %1.4f \n",fC1,fC2);
     120             :   }
     121             : 
     122             : 
     123           0 : }

Generated by: LCOV version 1.11