LCOV - code coverage report
Current view: top level - MUON/MUONgeometry - AliMUONGeometryMisAligner.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 211 0.5 %
Date: 2016-06-14 17:26:59 Functions: 1 20 5.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *      SigmaEffect_thetadegrees                                          * 
       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 purpeateose. It is      *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : // $Id$
      17             : //
      18             : //-----------------------------------------------------------------------------
      19             : /// \class AliMUONGeometryMisAligner
      20             : ///
      21             : /// This performs the misalignment on an existing muon arm geometry
      22             : /// based on the standard definition of the detector elements in 
      23             : /// $ALICE_ROOT/MUON/data
      24             : ///
      25             : /// --> User has to specify the magnitude of the alignments, in the Cartesian 
      26             : /// co-ordiantes (which are used to apply translation misalignments) and in the
      27             : /// spherical co-ordinates (which are used to apply angular displacements)
      28             : ///
      29             : /// --> If the constructor is used with no arguments, user has to set 
      30             : /// misalignment ranges by hand using the methods : 
      31             : /// SetApplyMisAlig, SetMaxCartMisAlig, SetMaxAngMisAlig, SetXYAngMisAligFactor
      32             : /// (last method takes account of the fact that the misalingment is greatest in 
      33             : /// the XY plane, since the detection elements are fixed to a support structure
      34             : /// in this plane. Misalignments in the XZ and YZ plane will be very small 
      35             : /// compared to those in the XY plane, which are small already - of the order 
      36             : /// of microns)
      37             : ///
      38             : /// Note : If the detection elements are allowed to be misaligned in all
      39             : /// directions, this has consequences for the alignment algorithm
      40             : /// (AliMUONAlignment), which needs to know the number of free parameters. 
      41             : /// Eric only allowed 3 :  x,y,theta_xy, but in principle z and the other 
      42             : /// two angles are alignable as well.
      43             : ///
      44             : /// \author Bruce Becker, Javier Castillo
      45             : //-----------------------------------------------------------------------------
      46             : 
      47             : #include "AliMUONGeometryMisAligner.h"
      48             : #include "AliMUONGeometryTransformer.h"
      49             : #include "AliMUONGeometryModuleTransformer.h"
      50             : #include "AliMUONGeometryDetElement.h"
      51             : #include "AliMUONGeometryBuilder.h"
      52             : #include "AliMpExMap.h"
      53             : #include "AliMpExMapIterator.h"
      54             : 
      55             : #include "AliAlignObjMatrix.h"
      56             : #include "AliMathBase.h"
      57             : #include "AliLog.h"
      58             : 
      59             : #include <TClonesArray.h>
      60             : #include <TGeoMatrix.h>
      61             : #include <TMatrixDSym.h>
      62             : #include <TMath.h>
      63             : #include <TRandom.h>
      64             : #include <Riostream.h>
      65             : 
      66             : /// \cond CLASSIMP
      67          18 : ClassImp(AliMUONGeometryMisAligner)
      68             : /// \endcond
      69             : 
      70             : //______________________________________________________________________________
      71             : AliMUONGeometryMisAligner::AliMUONGeometryMisAligner(Double_t cartXMisAligM, Double_t cartXMisAligW, Double_t cartYMisAligM, Double_t cartYMisAligW, Double_t angMisAligM, Double_t angMisAligW)
      72           0 :   : TObject(),
      73           0 :     fUseUni(kFALSE),
      74           0 :     fUseGaus(kTRUE),
      75           0 :     fXYAngMisAligFactor(0.0),
      76           0 :     fZCartMisAligFactor(0.0)
      77           0 : {
      78             :   /// Standard constructor
      79           0 :   for (Int_t i=0; i<6; i++){
      80           0 :     for (Int_t j=0; j<2; j++){
      81           0 :       fDetElemMisAlig[i][j] = 0.0;
      82           0 :       fModuleMisAlig[i][j] = 0.0;
      83             :     }
      84             :   }
      85           0 :   fDetElemMisAlig[0][0] = cartXMisAligM; 
      86           0 :   fDetElemMisAlig[0][1] = cartXMisAligW; 
      87           0 :   fDetElemMisAlig[1][0] = cartYMisAligM; 
      88           0 :   fDetElemMisAlig[1][1] = cartYMisAligW; 
      89           0 :   fDetElemMisAlig[5][0] = angMisAligM; 
      90           0 :   fDetElemMisAlig[5][1] = angMisAligW;
      91             : 
      92           0 : }
      93             : 
      94             : //______________________________________________________________________________
      95             : AliMUONGeometryMisAligner::AliMUONGeometryMisAligner(Double_t cartMisAligM, Double_t cartMisAligW, Double_t angMisAligM, Double_t angMisAligW)
      96           0 :   : TObject(), 
      97           0 :     fUseUni(kFALSE),
      98           0 :     fUseGaus(kTRUE),
      99           0 :     fXYAngMisAligFactor(0.0),
     100           0 :     fZCartMisAligFactor(0.0)
     101           0 : {
     102             :   /// Standard constructor
     103           0 :   for (Int_t i=0; i<6; i++){
     104           0 :     for (Int_t j=0; j<2; j++){
     105           0 :       fDetElemMisAlig[i][j] = 0.0;
     106           0 :       fModuleMisAlig[i][j] = 0.0;
     107             :     }
     108             :   }
     109           0 :   fDetElemMisAlig[0][0] = cartMisAligM; 
     110           0 :   fDetElemMisAlig[0][1] = cartMisAligW; 
     111           0 :   fDetElemMisAlig[1][0] = cartMisAligM; 
     112           0 :   fDetElemMisAlig[1][1] = cartMisAligW; 
     113           0 :   fDetElemMisAlig[5][0] = angMisAligM; 
     114           0 :   fDetElemMisAlig[5][1] = angMisAligW;
     115             : 
     116           0 : }
     117             : 
     118             : //______________________________________________________________________________
     119             : AliMUONGeometryMisAligner::AliMUONGeometryMisAligner(Double_t cartMisAlig, Double_t angMisAlig)
     120           0 :   : TObject(), 
     121           0 :     fUseUni(kTRUE),
     122           0 :     fUseGaus(kFALSE),
     123           0 :     fXYAngMisAligFactor(0.0),
     124           0 :     fZCartMisAligFactor(0.0)
     125           0 : {
     126             :   /// Standard constructor
     127           0 :   for (Int_t i=0; i<6; i++){
     128           0 :     for (Int_t j=0; j<2; j++){
     129           0 :       fDetElemMisAlig[i][j] = 0.0;
     130           0 :       fModuleMisAlig[i][j] = 0.0;
     131             :     }
     132             :   }
     133           0 :   fDetElemMisAlig[0][1] = cartMisAlig; 
     134           0 :   fDetElemMisAlig[1][1] = cartMisAlig; 
     135           0 :   fDetElemMisAlig[5][1] = angMisAlig;
     136             : 
     137           0 : }
     138             : 
     139             : //_____________________________________________________________________________
     140             : AliMUONGeometryMisAligner::AliMUONGeometryMisAligner()
     141           0 :   : TObject(), 
     142           0 :     fUseUni(kTRUE),
     143           0 :     fUseGaus(kFALSE),
     144           0 :     fXYAngMisAligFactor(0.0),
     145           0 :     fZCartMisAligFactor(0.0)
     146           0 : {
     147             :   /// Default constructor
     148           0 :   for (Int_t i=0; i<6; i++){
     149           0 :     for (Int_t j=0; j<2; j++){
     150           0 :       fDetElemMisAlig[i][j] = 0.0;
     151           0 :       fModuleMisAlig[i][j] = 0.0;
     152             :     }
     153             :   }
     154           0 : }
     155             : 
     156             : //______________________________________________________________________________
     157             : AliMUONGeometryMisAligner::~AliMUONGeometryMisAligner()
     158           0 : {
     159             : /// Destructor
     160             : 
     161           0 : }
     162             : 
     163             : //_________________________________________________________________________
     164             : void
     165             : AliMUONGeometryMisAligner::SetXYAngMisAligFactor(Double_t factor)
     166             : {
     167             :   /// Set XY angular misalign factor 
     168             : 
     169           0 :   if (TMath::Abs(factor) > 1.0 && factor > 0.){
     170           0 :     fXYAngMisAligFactor = factor;
     171           0 :     fDetElemMisAlig[3][0] = fDetElemMisAlig[5][0]*factor; // These lines were 
     172           0 :     fDetElemMisAlig[3][1] = fDetElemMisAlig[5][1]*factor; // added to keep
     173           0 :     fDetElemMisAlig[4][0] = fDetElemMisAlig[5][0]*factor; // backward 
     174           0 :     fDetElemMisAlig[4][1] = fDetElemMisAlig[5][1]*factor; // compatibility 
     175           0 :   }
     176             :   else
     177           0 :     AliError(Form("Invalid XY angular misalign factor, %f", factor));
     178           0 : }
     179             : 
     180             : //_________________________________________________________________________
     181             : void AliMUONGeometryMisAligner::SetZCartMisAligFactor(Double_t factor) 
     182             : {
     183             :   /// Set XY angular misalign factor 
     184           0 :   if (TMath::Abs(factor)<1.0 && factor>0.) {
     185           0 :     fZCartMisAligFactor = factor;
     186           0 :     fDetElemMisAlig[2][0] = fDetElemMisAlig[0][0];        // These lines were added to 
     187           0 :     fDetElemMisAlig[2][1] = fDetElemMisAlig[0][1]*factor; // keep backward compatibility
     188           0 :   }
     189             :   else
     190           0 :     AliError(Form("Invalid Z cartesian misalign factor, %f", factor));
     191           0 : }
     192             : 
     193             : //_________________________________________________________________________
     194             : void AliMUONGeometryMisAligner::GetUniMisAlign(Double_t cartMisAlig[3], Double_t angMisAlig[3], const Double_t lParMisAlig[6][2]) const
     195             : {
     196             :   /// Misalign using uniform distribution
     197             :   /**
     198             :     misalign the centre of the local transformation
     199             :     rotation axes : 
     200             :     fAngMisAlig[1,2,3] = [x,y,z]
     201             :     Assume that misalignment about the x and y axes (misalignment of z plane)
     202             :     is much smaller, since the entire detection plane has to be moved (the 
     203             :     detection elements are on a support structure), while rotation of the x-y
     204             :     plane is more free.
     205             :   */
     206           0 :   cartMisAlig[0] = gRandom->Uniform(-lParMisAlig[0][1]+lParMisAlig[0][0], lParMisAlig[0][0]+lParMisAlig[0][1]);
     207           0 :   cartMisAlig[1] = gRandom->Uniform(-lParMisAlig[1][1]+lParMisAlig[1][0], lParMisAlig[1][0]+lParMisAlig[1][1]);
     208           0 :   cartMisAlig[2] = gRandom->Uniform(-lParMisAlig[2][1]+lParMisAlig[2][0], lParMisAlig[2][0]+lParMisAlig[2][1]);  
     209             :  
     210           0 :   angMisAlig[0] = gRandom->Uniform(-lParMisAlig[3][1]+lParMisAlig[3][0], lParMisAlig[3][0]+lParMisAlig[3][1]);
     211           0 :   angMisAlig[1] = gRandom->Uniform(-lParMisAlig[4][1]+lParMisAlig[4][0], lParMisAlig[4][0]+lParMisAlig[4][1]);
     212           0 :   angMisAlig[2] = gRandom->Uniform(-lParMisAlig[5][1]+lParMisAlig[5][0], lParMisAlig[5][0]+lParMisAlig[5][1]);       // degrees
     213           0 : }
     214             : 
     215             : //_________________________________________________________________________
     216             : void AliMUONGeometryMisAligner::GetGausMisAlign(Double_t cartMisAlig[3], Double_t angMisAlig[3], const Double_t lParMisAlig[6][2]) const
     217             : {
     218             :   /// Misalign using gaussian distribution
     219             :   /**
     220             :     misalign the centre of the local transformation
     221             :     rotation axes : 
     222             :     fAngMisAlig[1,2,3] = [x,y,z]
     223             :     Assume that misalignment about the x and y axes (misalignment of z plane)
     224             :     is much smaller, since the entire detection plane has to be moved (the 
     225             :     detection elements are on a support structure), while rotation of the x-y
     226             :     plane is more free.
     227             :   */
     228           0 :   cartMisAlig[0] = AliMathBase::TruncatedGaus(lParMisAlig[0][0], lParMisAlig[0][1], 3.*lParMisAlig[0][1]);
     229           0 :   cartMisAlig[1] = AliMathBase::TruncatedGaus(lParMisAlig[1][0], lParMisAlig[1][1], 3.*lParMisAlig[1][1]);
     230           0 :   cartMisAlig[2] = AliMathBase::TruncatedGaus(lParMisAlig[2][0], lParMisAlig[2][1], 3.*lParMisAlig[2][1]);
     231             :  
     232           0 :   angMisAlig[0] = AliMathBase::TruncatedGaus(lParMisAlig[3][0], lParMisAlig[3][1], 3.*lParMisAlig[3][1]);
     233           0 :   angMisAlig[1] = AliMathBase::TruncatedGaus(lParMisAlig[4][0], lParMisAlig[4][1], 3.*lParMisAlig[4][1]);
     234           0 :   angMisAlig[2] = AliMathBase::TruncatedGaus(lParMisAlig[5][0], lParMisAlig[5][1], 3.*lParMisAlig[5][1]);       // degrees
     235           0 : }
     236             : 
     237             : //_________________________________________________________________________
     238             : TGeoCombiTrans AliMUONGeometryMisAligner::MisAlignDetElem(const TGeoCombiTrans & transform) const
     239             : {
     240             :   /// Misalign given transformation and return the misaligned transformation. 
     241             :   /// Use misalignment parameters for detection elements.
     242             :   /// Note that applied misalignments are small deltas with respect to the detection 
     243             :   /// element own ideal local reference frame. Thus deltaTransf represents 
     244             :   /// the transformation to go from the misaligned d.e. local coordinates to the 
     245             :   /// ideal d.e. local coordinates. 
     246             :   /// Also note that this -is not- what is in the ALICE alignment framework known 
     247             :   /// as local nor global (see AliMUONGeometryMisAligner::MisAlign) 
     248             :   
     249           0 :   Double_t cartMisAlig[3] = {0,0,0};
     250           0 :   Double_t angMisAlig[3] = {0,0,0};
     251             : 
     252           0 :   if (fUseUni) { 
     253           0 :     GetUniMisAlign(cartMisAlig,angMisAlig,fDetElemMisAlig);
     254           0 :   }
     255             :   else { 
     256           0 :     if (!fUseGaus) {
     257           0 :       AliWarning("Neither uniform nor gausian distribution is set! Will use gausian...");
     258           0 :     } 
     259           0 :     GetGausMisAlign(cartMisAlig,angMisAlig,fDetElemMisAlig);
     260             :   }
     261             : 
     262           0 :   TGeoTranslation deltaTrans(cartMisAlig[0], cartMisAlig[1], cartMisAlig[2]);
     263           0 :   TGeoRotation deltaRot;
     264           0 :   deltaRot.RotateX(angMisAlig[0]);
     265           0 :   deltaRot.RotateY(angMisAlig[1]);
     266           0 :   deltaRot.RotateZ(angMisAlig[2]);
     267             : 
     268           0 :   TGeoCombiTrans deltaTransf(deltaTrans,deltaRot);
     269           0 :   TGeoHMatrix newTransfMat = transform * deltaTransf;
     270             :     
     271           0 :   AliInfo(Form("Rotated DE by %f about Z axis.", angMisAlig[2]));
     272             : 
     273           0 :   return TGeoCombiTrans(newTransfMat);
     274           0 : }
     275             : 
     276             : //_________________________________________________________________________
     277             : TGeoCombiTrans AliMUONGeometryMisAligner::MisAlignModule(const TGeoCombiTrans & transform) const
     278             : {
     279             :   /// Misalign given transformation and return the misaligned transformation. 
     280             :   /// Use misalignment parameters for modules.
     281             :   /// Note that applied misalignments are small deltas with respect to the module 
     282             :   /// own ideal local reference frame. Thus deltaTransf represents 
     283             :   /// the transformation to go from the misaligned module local coordinates to the 
     284             :   /// ideal module local coordinates. 
     285             :   /// Also note that this -is not- what is in the ALICE alignment framework known 
     286             :   /// as local nor global (see AliMUONGeometryMisAligner::MisAlign) 
     287             :   
     288           0 :   Double_t cartMisAlig[3] = {0,0,0};
     289           0 :   Double_t angMisAlig[3] = {0,0,0};
     290             : 
     291           0 :   if (fUseUni) { 
     292           0 :     GetUniMisAlign(cartMisAlig,angMisAlig,fModuleMisAlig);
     293           0 :   }
     294             :   else { 
     295           0 :     if (!fUseGaus) {
     296           0 :       AliWarning("Neither uniform nor gausian distribution is set! Will use gausian...");
     297           0 :     } 
     298           0 :     GetGausMisAlign(cartMisAlig,angMisAlig,fModuleMisAlig);
     299             :   }
     300             : 
     301           0 :   TGeoTranslation deltaTrans(cartMisAlig[0], cartMisAlig[1], cartMisAlig[2]);
     302           0 :   TGeoRotation deltaRot;
     303           0 :   deltaRot.RotateX(angMisAlig[0]);
     304           0 :   deltaRot.RotateY(angMisAlig[1]);
     305           0 :   deltaRot.RotateZ(angMisAlig[2]);
     306             : 
     307           0 :   TGeoCombiTrans deltaTransf(deltaTrans,deltaRot);
     308           0 :   TGeoHMatrix newTransfMat = transform * deltaTransf;
     309             : 
     310           0 :   AliInfo(Form("Rotated Module by %f about Z axis.", angMisAlig[2]));
     311             : 
     312           0 :   return TGeoCombiTrans(newTransfMat);
     313           0 : }
     314             : 
     315             : //______________________________________________________________________
     316             : AliMUONGeometryTransformer *
     317             : AliMUONGeometryMisAligner::MisAlign(const AliMUONGeometryTransformer *
     318             :                                     transformer, Bool_t verbose)
     319             : {
     320             :   /// Takes the internal geometry module transformers, copies them to
     321             :   /// new geometry module transformers. 
     322             :   /// Calculates  module misalignment parameters and applies these
     323             :   /// to the new module transformer.
     324             :   /// Calculates the module misalignment delta transformation in the 
     325             :   /// Alice Alignment Framework newTransf = delta * oldTransf.
     326             :   /// Add a module misalignment to the new geometry transformer.
     327             :   /// Gets the Detection Elements from the module transformer. 
     328             :   /// Calculates misalignment parameters and applies these
     329             :   /// to the local transformation of the Detection Element.
     330             :   /// Obtains the new global transformation by multiplying the new 
     331             :   /// module transformer transformation with the new local transformation. 
     332             :   /// Applies the new global transform to a new detection element.
     333             :   /// Adds the new detection element to a new module transformer.
     334             :   /// Calculates the d.e. misalignment delta transformation in the 
     335             :   /// Alice Alignment Framework (newGlobalTransf = delta * oldGlobalTransf).
     336             :   /// Add a d.e. misalignment to the new geometry transformer.
     337             :   /// Adds the new module transformer to a new geometry transformer.
     338             :   /// Returns the new geometry transformer.
     339             : 
     340             : 
     341             :   AliMUONGeometryTransformer *newGeometryTransformer =
     342           0 :     new AliMUONGeometryTransformer();
     343           0 :   for (Int_t iMt = 0; iMt < transformer->GetNofModuleTransformers(); iMt++)
     344             :     {                           // module transformers
     345             :       const AliMUONGeometryModuleTransformer *kModuleTransformer =
     346           0 :         transformer->GetModuleTransformer(iMt, true);
     347             :       
     348             :       AliMUONGeometryModuleTransformer *newModuleTransformer =
     349           0 :         new AliMUONGeometryModuleTransformer(iMt);
     350           0 :       newGeometryTransformer->AddModuleTransformer(newModuleTransformer);
     351             : 
     352           0 :       TGeoCombiTrans moduleTransform =
     353           0 :         TGeoCombiTrans(*kModuleTransformer->GetTransformation());
     354             :       // New module transformation
     355           0 :       TGeoCombiTrans newModuleTransform = MisAlignModule(moduleTransform);
     356           0 :       newModuleTransformer->SetTransformation(newModuleTransform);
     357             : 
     358             :       // Get delta transformation: 
     359             :       // Tdelta = Tnew * Told.inverse
     360           0 :       TGeoHMatrix deltaModuleTransform = 
     361           0 :         AliMUONGeometryBuilder::Multiply(
     362             :           newModuleTransform, 
     363           0 :           kModuleTransformer->GetTransformation()->Inverse());
     364             : 
     365             :       // Create module mis alignment matrix
     366           0 :       newGeometryTransformer
     367           0 :         ->AddMisAlignModule(kModuleTransformer->GetModuleId(), deltaModuleTransform);
     368             : 
     369           0 :       AliMpExMap *detElements = kModuleTransformer->GetDetElementStore();
     370             : 
     371           0 :       if (verbose)
     372           0 :         AliInfo(Form("%i DEs in old GeometryStore  %i",detElements->GetSize(), iMt));
     373             : 
     374           0 :       TIter next(detElements->CreateIterator());
     375             :       AliMUONGeometryDetElement *detElement;
     376             :       
     377           0 :       while ( ( detElement = static_cast<AliMUONGeometryDetElement*>(next()) ) )
     378             :       {
     379             :           /// make a new detection element
     380             :           AliMUONGeometryDetElement *newDetElement =
     381           0 :             new AliMUONGeometryDetElement(detElement->GetId(),
     382           0 :                                           detElement->GetVolumePath());
     383             : 
     384             :           // local transformation of this detection element.
     385           0 :           TGeoCombiTrans localTransform
     386           0 :             = TGeoCombiTrans(*detElement->GetLocalTransformation());
     387           0 :           TGeoCombiTrans newLocalTransform = MisAlignDetElem(localTransform);
     388           0 :           newDetElement->SetLocalTransformation(newLocalTransform);
     389             : 
     390             : 
     391             :           // global transformation
     392           0 :           TGeoHMatrix newGlobalTransform =
     393           0 :             AliMUONGeometryBuilder::Multiply(newModuleTransform,
     394             :                                              newLocalTransform);
     395           0 :           newDetElement->SetGlobalTransformation(newGlobalTransform);
     396             :           
     397             :           // add this det element to module
     398           0 :           newModuleTransformer->GetDetElementStore()->Add(newDetElement->GetId(),
     399           0 :                                                           newDetElement);
     400             : 
     401             :           // In the Alice Alignment Framework misalignment objects store
     402             :           // global delta transformation
     403             :           // Get detection "intermediate" global transformation
     404           0 :           TGeoHMatrix newOldGlobalTransform = newModuleTransform * localTransform;
     405             :           // Get detection element global delta transformation: 
     406             :           // Tdelta = Tnew * Told.inverse
     407           0 :           TGeoHMatrix  deltaGlobalTransform
     408           0 :             = AliMUONGeometryBuilder::Multiply(
     409           0 :                 newGlobalTransform, 
     410           0 :                 newOldGlobalTransform.Inverse());
     411             :           
     412             :           // Create mis alignment matrix
     413           0 :           newGeometryTransformer
     414           0 :             ->AddMisAlignDetElement(detElement->GetId(), deltaGlobalTransform);
     415           0 :         }
     416             : 
     417             :       
     418           0 :       if (verbose)
     419           0 :         AliInfo(Form("Added module transformer %i to the transformer", iMt));
     420           0 :       newGeometryTransformer->AddModuleTransformer(newModuleTransformer);
     421           0 :     }
     422           0 :   return newGeometryTransformer;
     423           0 : }
     424             : 
     425             : 
     426             : void AliMUONGeometryMisAligner::SetAlignmentResolution(const TClonesArray* misAlignArray, Int_t rChId, Double_t rChResX, Double_t rChResY, Double_t rDeResX, Double_t rDeResY){
     427             : 
     428           0 :   Int_t chIdMin = (rChId<0)? 0 : rChId;
     429           0 :   Int_t chIdMax = (rChId<0)? 9 : rChId;
     430           0 :   Double_t chResX = (rChResX<0)? fModuleMisAlig[0][1] : rChResX;
     431           0 :   Double_t chResY = (rChResY<0)? fModuleMisAlig[1][1] : rChResY;
     432           0 :   Double_t deResX = (rDeResX<0)? fDetElemMisAlig[0][1] : rDeResX;
     433           0 :   Double_t deResY = (rDeResY<0)? fDetElemMisAlig[1][1] : rDeResY;
     434             : 
     435           0 :   TMatrixDSym mChCorrMatrix(6);
     436           0 :   mChCorrMatrix[0][0]=chResX*chResX;
     437           0 :   mChCorrMatrix[1][1]=chResY*chResY;
     438             :   //  mChCorrMatrix.Print();
     439             : 
     440           0 :   TMatrixDSym mDECorrMatrix(6);
     441           0 :   mDECorrMatrix[0][0]=deResX*deResX;
     442           0 :   mDECorrMatrix[1][1]=deResY*deResY;
     443             :   //  mDECorrMatrix.Print();
     444             : 
     445             :   AliAlignObjMatrix *alignMat = 0x0;
     446             : 
     447           0 :   for(Int_t chId=chIdMin; chId<=chIdMax; chId++) {
     448           0 :     TString chName1;
     449           0 :     TString chName2;
     450           0 :     if (chId<4){
     451           0 :       chName1 = Form("GM%d",chId);
     452           0 :       chName2 = Form("GM%d",chId);
     453             :     } else {
     454           0 :       chName1 = Form("GM%d",4+(chId-4)*2);
     455           0 :       chName2 = Form("GM%d",4+(chId-4)*2+1);
     456             :     }
     457             :     
     458           0 :     for (int i=0; i<misAlignArray->GetEntries(); i++) {
     459           0 :       alignMat = (AliAlignObjMatrix*)misAlignArray->At(i);
     460           0 :       TString volName(alignMat->GetSymName());
     461           0 :       if((volName.Contains(chName1)&&
     462           0 :           ((volName.Last('/')==volName.Index(chName1)+chName1.Length())||
     463           0 :            (volName.Length()==volName.Index(chName1)+chName1.Length())))||
     464           0 :          (volName.Contains(chName2)&&
     465           0 :           ((volName.Last('/')==volName.Index(chName2)+chName2.Length())||
     466           0 :            (volName.Length()==volName.Index(chName2)+chName2.Length())))){
     467           0 :         volName.Remove(0,volName.Last('/')+1);
     468           0 :         if (volName.Contains("GM")) {
     469             :           //    alignMat->Print("NULL");
     470           0 :           alignMat->SetCorrMatrix(mChCorrMatrix);
     471           0 :         } else if (volName.Contains("DE")) {
     472             :           //    alignMat->Print("NULL");
     473           0 :           alignMat->SetCorrMatrix(mDECorrMatrix);
     474             :         }
     475             :       }
     476           0 :     }
     477           0 :   }
     478           0 : }
     479             : 
     480             : 
     481             : 

Generated by: LCOV version 1.11