]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ZDC/AliZDCMisAligner.cxx
bugfix: correct range of DDL for specified detector
[u/mrichter/AliRoot.git] / ZDC / AliZDCMisAligner.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 ZDC. 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 "AliZDCMisAligner.h"
28 #include "AliGeomManager.h"
29 #include "TClonesArray.h"
30 #include "AliAlignObjParams.h"
31 #include "AliLog.h"
32
33 ClassImp(AliZDCMisAligner)
34
35     //_______________________________________________________________________________________
36 AliZDCMisAligner::AliZDCMisAligner() : AliMisAligner()
37 {
38     //
39     // dummy constructor
40     //
41 }
42
43 //_______________________________________________________________________________________
44 TClonesArray* AliZDCMisAligner::MakeAlObjsArray() {
45     // builds and returns the array of alignment objects
46     // according to the spcified misalignment scenario
47     // ("ideal", "residual" or "full").
48     //
49     TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
50     TClonesArray &alobj = *array;
51
52     Double_t dx,dy,dz,dpsi,dtheta,dphi;
53     if(TString(GetMisalType())=="ideal")
54     {
55         dx=0., dy=0., dz=0.;
56         dpsi=0., dtheta=0., dphi=0.;
57     }else if(TString(GetMisalType())=="residual" || TString(GetMisalType())=="full")
58     {
59         dx=0., dy=0.05, dz=0.;
60         dpsi=0., dtheta=0., dphi=0.;
61     }else{
62         AliError(Form("\"%s\" is not a valid identifier for misalignment types. Exiting ...",GetMisalType()));
63         return 0;
64     }
65
66     const char *zdcCn="ZDC/NeutronZDC_C";
67     const char *zdcCp="ZDC/ProtonZDC_C";
68     const char *zdcAn="ZDC/NeutronZDC_A";
69     const char *zdcAp="ZDC/ProtonZDC_A";
70
71     UShort_t iIndex=0;
72     AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
73     UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
74
75     new(alobj[0]) AliAlignObjParams(zdcCn, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
76     new(alobj[1]) AliAlignObjParams(zdcCp, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
77     new(alobj[2]) AliAlignObjParams(zdcAn, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
78     new(alobj[3]) AliAlignObjParams(zdcAp, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
79
80     return array;
81 }
82
83 //_______________________________________________________________________________________
84 AliCDBMetaData* AliZDCMisAligner::GetCDBMetaData() const {
85     // Returns the comment and responsible for the
86     // AliCDBMetaData to be associated with the OCDB entry
87     // containing the ZDC array of misalignment objects
88     //
89     AliCDBMetaData* md = new AliCDBMetaData();
90     md->SetResponsible("Chiara Oppedisano");
91
92     if(TString(GetMisalType())=="ideal")
93         md->SetComment("Alignment objects for ZDC ideal misalignment");
94     if(TString(GetMisalType())=="residual")
95         md->SetComment("Alignment objects for ZDC residual misalignment");
96     if(TString(GetMisalType())=="full")
97         md->SetComment("Alignment objects for ZDC full misalignment");
98
99     return md;
100 }