Updated comment.
[u/mrichter/AliRoot.git] / GRP / MakeSTRUCTFullMisAlignment.C
1 void MakeSTRUCTFullMisAlignment(){
2   // Create TClonesArray of full misalignment objects for all STRUCTures
3   // (presently this includes only FRAME)
4   // Full alignment objects for FRAME segments are built by
5   // averaging in each supermodule the values produced by the
6   // ANSYS finite-elements simulation
7   //
8   const char* macroname = "MakeSTRUCTFullMisAlignment.C";
9   TClonesArray *array = new TClonesArray("AliAlignObjParams",20);
10
11   // the following hardcoded values have been obtained by taking the output of the ANSYS simulation
12   // (finite elements simulation of deformations for given loads) and recalculating the avarege
13   // displacement of the center of each space-frame sector
14   ((*array)[0]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO0_1",0,0.13375,-0.0275,0,0,0,0,kTRUE);
15   ((*array)[1]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO1_1",0,0.25125,0.00125,0,0,0,0,kTRUE);
16   ((*array)[2]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO2_1",0,0.2325,-0.03625,0,0,0,0,kTRUE);
17   ((*array)[3]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO3_1",0,0.17,-0.14375,0,0,0,0,kTRUE);
18   ((*array)[4]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO4_1",0,0.1475,-0.2,0,0,0,0,kTRUE);
19   ((*array)[5]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO5_1",0,0.12625,-0.13375,0,0,0,0,kTRUE);
20   ((*array)[6]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO6_1",0,0.06375,-0.02125,0,0,0,0,kTRUE);
21   ((*array)[7]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO7_1",0,0.0475,0.015,0,0,0,0,kTRUE);
22   ((*array)[8]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO8_1",0,0.1775,-0.0175,0,0,0,0,kTRUE);
23   ((*array)[9]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO9_1",0,0.32375,-0.03125,0,0,0,0,kTRUE);
24   ((*array)[10]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO10_1",0,0.35125,-0.0325,0,0,0,0,kTRUE);
25   ((*array)[11]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO11_1",0,0.285,-0.105,0,0,0,0,kTRUE);
26   ((*array)[12]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO12_1",0,0.205,-0.24375,0,0,0,0,kTRUE);
27   ((*array)[13]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO13_1",0,0.1775,-0.32,0,0,0,0,kTRUE);
28   ((*array)[14]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO14_1",0,0.1525,-0.25375,0,0,0,0,kTRUE);
29   ((*array)[15]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO15_1",0,0.07625,-0.1225,0,0,0,0,kTRUE);
30   ((*array)[16]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO16_1",0,0.0075,-0.04875,0,0,0,0,kTRUE);
31   ((*array)[17]) = new AliAlignObjParams("ALIC_1/B077_1/BSEGMO17_1",0,0.01375,-0.04125,0,0,0,0,kTRUE);
32
33   if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
34     // save on file
35     const char* filename = "STRUCTfullMisalignment.root";
36     TFile f(filename,"RECREATE");
37     if(!f){
38       Error(macroname,"cannot open file for output\n");
39       return;
40     }
41     Info(macroname,"Saving alignment objects in %s", filename);
42     f.cd();
43     f.WriteObject(array,"STRUCTAlignObjs","kSingleKey");
44     f.Close();
45   }else{
46     // save in CDB storage
47     TString Storage = gSystem->Getenv("STORAGE");
48     if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
49       Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
50       return;
51     }
52     Info(macroname,"Saving alignment objects in CDB storage %s",Storage.Data());
53     AliCDBManager* cdb = AliCDBManager::Instance();
54     AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
55     if(!storage){
56       Error(macroname,"Unable to open storage %s\n",Storage.Data());
57       return;
58     }
59     AliCDBMetaData* md = new AliCDBMetaData();
60     md->SetResponsible("Grosso Raffaele");
61     md->SetComment("Full misalignment for FRAME, including dead weight and full weight deformations derived from ANSYS finiteelements simulation: dispmap corrected excel worksheet from Werner Riegler");
62     md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
63     AliCDBId id("GRP/Align/Data",0,AliCDBRunRange::Infinity());
64     storage->Put(array,id,md);
65   }
66
67   array->Delete();
68
69 }
70