1 void MakePMDFullMisAlignment(){
2 // Create TClonesArray of full misalignment objects for PMD
5 // Macro to randomly displace the 4 sectors of the PMD
6 // in each plane. Each sector (to be misaligned)
7 // of PMD houses the following :
8 // (a) 6 modules of preshower plane
9 // (b) 6 modules of veto plane
10 // (c) The FEE boards on back plane of each module
11 // (d) 6 modules of convertor plates
12 // The clustering is done module-wise
13 // The actual amount displacement will be provided
14 // by the survey data and has to be converted into
15 // displacement in x,y,z,theta, phi and psi
18 // Now specify the path of the module to be misaligned
19 // as followed in the PMD geant
31 // Misalignment Matrix is expected to be
32 // same for sectors 1 and 4
33 // and for the sectors 2 and 3
34 // As these will be mounted on the same
38 if(!AliGeomManager::GetGeometry()){
39 if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
40 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
41 AliCDBManager::Instance()->SetRun(0);
42 AliGeomManager::LoadGeometry();
44 // needed for the constructors with local coordinates not to fail
46 Float_t max_trans=0.1;
50 const char *Sector1="PMD/Sector1";
51 const char *Sector2="PMD/Sector2";
52 const char *Sector3="PMD/Sector3";
53 const char *Sector4="PMD/Sector4";
57 Double_t dx14, dy14, dz14; // Misalignment in X,Y and Z
58 Double_t dpsi14, dtheta14, dphi14; // Angular displacements
60 Double_t dx23, dy23, dz23; // Misalignment in X,Y and Z
61 Double_t dpsi23, dtheta23, dphi23; // Angular displacements
65 // At present give some random shifts
66 // generated by random numbers
67 // max_trans : Maximun shifts in X,Y,Z in centimeters
68 // max_rot : Maximum shifts in angles in degrees
69 // Double_t max_trans, max_rot;
72 TRandom *rnd = new TRandom(4357);
74 // For sectors 1 and 4
75 // Translation displacement
76 dx14 = (rnd->Uniform()-0.5)*max_trans;
77 dy14 = (rnd->Uniform()-0.5)*max_trans;
78 dz14 = (rnd->Uniform()-0.5)*max_trans;
80 dpsi14 = (rnd->Uniform()-0.5)*max_rot;
81 dtheta14 = (rnd->Uniform()-0.5)*max_rot;
82 dphi14 = (rnd->Uniform()-0.5)*max_rot;
84 // For sectors 2 and 3
85 // Translation displacement
86 dx23 = (rnd->Uniform()-0.5)*max_trans;
87 dy23 = (rnd->Uniform()-0.5)*max_trans;
88 dz23 = (rnd->Uniform()-0.5)*max_trans;
90 dpsi23 = (rnd->Uniform()-0.5)*max_rot;
91 dtheta23 = (rnd->Uniform()-0.5)*max_rot;
92 dphi23 = (rnd->Uniform()-0.5)*max_rot;
95 //Create a TClonesArray of Align Object to store displacement Angles
96 TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
97 TClonesArray &alobj = *array;
101 Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
102 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
103 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
105 new(alobj[0]) AliAlignObjAngles(Sector1, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE);
106 new(alobj[1]) AliAlignObjAngles(Sector2, volid, dx14, dy14, dz14, dpsi14, dtheta14, dphi14, kFALSE);
107 new(alobj[2]) AliAlignObjAngles(Sector3, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
108 new(alobj[3]) AliAlignObjAngles(Sector4, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
110 const char* macroname = "MakePMDFullMisAlignment.C";
111 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
112 // Create a File to store the alignment data
113 const char* filename = "PMDfullMisalignment.root";
114 TFile f(filename,"RECREATE");
116 Error(macroname,"cannot open file for output\n");
119 Info(macroname,"Saving alignment objects to the file %s", filename);
121 f.WriteObject(array,"PMDAlignObjs","kSingleKey");
124 // save in CDB storage
125 TString Storage = gSystem->Getenv("STORAGE");
126 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
127 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
130 Info(macroname,"Saving alignment objects in CDB storage %s",
132 AliCDBManager* cdb = AliCDBManager::Instance();
133 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
135 Error(macroname,"Unable to open storage %s\n",Storage.Data());
138 AliCDBMetaData* md = new AliCDBMetaData();
139 md->SetResponsible("");
140 md->SetComment("Full misalignment for PMD, produced with sigmatr=0.1 and sigmarot=0.1 in the local RS");
141 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
142 AliCDBId id("PMD/Align/Data",0,AliCDBRunRange::Infinity());
143 storage->Put(array,id,md);