]> git.uio.no Git - u/mrichter/AliRoot.git/blob - VZERO/AliVZEROMisAligner.cxx
Fix related to the HV treatment in the VZERO preprocessor. In sync with the new EOR...
[u/mrichter/AliRoot.git] / VZERO / AliVZEROMisAligner.cxx
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 VZERO. 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 "AliVZEROMisAligner.h"
28 #include "AliGeomManager.h"
29 #include "AliMathBase.h"
30 #include "TClonesArray.h"
31 #include "TRandom.h"
32 #include "AliAlignObjParams.h"
33 #include "AliLog.h"
34
35 ClassImp(AliVZEROMisAligner)
36
37     //_______________________________________________________________________________________
38 AliVZEROMisAligner::AliVZEROMisAligner() : AliMisAligner()
39 {
40     //
41     // dummy constructor
42     //
43 }
44
45 //_______________________________________________________________________________________
46 TClonesArray* AliVZEROMisAligner::MakeAlObjsArray() {
47     // builds and returns the array of alignment objects
48     // according to the spcified misalignment scenario
49     // ("ideal", "residual" or "full").
50     //
51     TClonesArray *array = new TClonesArray("AliAlignObjParams",2);
52     TClonesArray &alobj = *array;
53
54     Double_t dx, dy, dz, dpsi, dtheta, dphi;
55     gRandom->SetSeed(4321);
56     Double_t sigmatr; // max shift in cm
57     Double_t sigmarot; // max rot in degrees
58
59     TString v0alignable[2]={"VZERO/V0C", "VZERO/V0A"};
60
61     Int_t iIndex=0; // VZERO is not indexed
62     AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
63     UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
64
65     if(TString(GetMisalType())=="ideal")
66     {
67
68         for(Int_t ii=0; ii<2; ii++)
69             new(alobj[ii]) AliAlignObjParams(v0alignable[ii].Data(), volid, 0., 0., 0., 0., 0., 0., kTRUE);
70
71     }else if(TString(GetMisalType())=="residual" || TString(GetMisalType())=="full"){
72
73         if(!AliGeomManager::GetGeometry())
74         {
75             AliError("No geometry loaded into AliGeomManager! Returning null pointer!");
76             return 0;
77         }
78
79         sigmatr = 0.1;
80         sigmarot = 0.5;
81
82         for(Int_t ii=0; ii<2; ii++)
83         {
84             dx = AliMathBase::TruncatedGaus(0.,sigmatr, 3*sigmatr);
85             dy = AliMathBase::TruncatedGaus(0.,sigmatr, 3*sigmatr);
86             dz = AliMathBase::TruncatedGaus(0.,sigmatr, 3*sigmatr);
87             dpsi   = AliMathBase::TruncatedGaus(0.,sigmarot, 3*sigmarot);
88             dtheta = AliMathBase::TruncatedGaus(0.,sigmarot, 3*sigmarot);
89             dphi   = AliMathBase::TruncatedGaus(0.,sigmarot, 3*sigmarot);
90             new(alobj[ii]) AliAlignObjParams(v0alignable[ii].Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
91         }
92
93     }else{
94         AliError(Form("\"%s\" is not a valid identifier for misalignment types. Exiting ...",GetMisalType()));
95         return 0;
96     }
97
98     return array;
99 }
100
101 //_______________________________________________________________________________________
102 AliCDBMetaData* AliVZEROMisAligner::GetCDBMetaData() const {
103     // Returns the comment and responsible for the
104     // AliCDBMetaData to be associated with the OCDB entry
105     // containing the VZERO array of misalignment objects
106     //
107     AliCDBMetaData* md = new AliCDBMetaData();
108     md->SetResponsible("Brigitte Cheynis");
109
110     if(TString(GetMisalType())=="ideal")
111         md->SetComment("Alignment objects for VZERO ideal misalignment");
112     if(TString(GetMisalType())=="residual")
113         md->SetComment("Alignment objects for VZERO residual misalignment");
114     if(TString(GetMisalType())=="full")
115         md->SetComment("Alignment objects for VZERO full misalignment");
116
117     return md;
118 }