Added reference from vertex to candidate (Andrea)
[u/mrichter/AliRoot.git] / PHOS / MakePHOSFullMisAlignment.C
CommitLineData
1895a097 1void MakePHOSFullMisAlignment(){
2 // Create TClonesArray of full misalignment objects for PHOS
3 //
3c759505 4 const AliPHOSGeometry *phosGeom = AliPHOSGeometry::GetInstance("IHEP", "IHEP");
5 if (!phosGeom) {
6 Error("MakePHOSFullMisAlignment", "Cannot obtain AliPHOSGeometry singleton\n");
7 return;
8 }
9
10 AliPHOSEMCAGeometry *emca = phosGeom->GetEMCAGeometry();
90dbf5fb 11 TClonesArray *array = new TClonesArray("AliAlignObjParams", 16 + phosGeom->GetNModules() *
3c759505 12 emca->GetNStripX() * emca->GetNStripZ());
1895a097 13 TClonesArray &alobj = *array;
14
1895a097 15 Double_t dpsi=0., dtheta=0., dphi=0.;
16 Double_t displacement = 10;
1895a097 17 Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
ae079791 18 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
19 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
a45bb6dc 20 Int_t i=0 ;
1895a097 21
22 // Alignment for 5 PHOS modules
90dbf5fb 23 new(alobj[i++]) AliAlignObjParams("PHOS/Module1",
1895a097 24 volid, -20., -10., 0., dpsi, dtheta, 5, kTRUE);
90dbf5fb 25 new(alobj[i++]) AliAlignObjParams("PHOS/Module2",
1895a097 26 volid, -10., 0., -10., dpsi, dtheta, 2, kTRUE);
90dbf5fb 27 new(alobj[i++]) AliAlignObjParams("PHOS/Module3",
1895a097 28 volid, 5., -10., 10., dpsi, dtheta, 0, kTRUE);
90dbf5fb 29 new(alobj[i++]) AliAlignObjParams("PHOS/Module4",
1895a097 30 volid, +10., -0., -10., dpsi, dtheta, 2, kTRUE);
90dbf5fb 31 new(alobj[i++]) AliAlignObjParams("PHOS/Module5",
1895a097 32 volid, +20., -10., 0., dpsi, dtheta, 5, kTRUE);
33
a45bb6dc 34 Double_t dx=0., dy=0., dz=0. ;
35 // Alignment of CPV modules
90dbf5fb 36 new(alobj[i++]) AliAlignObjParams("PHOS/Module1/CPV",
a45bb6dc 37 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 38 new(alobj[i++]) AliAlignObjParams("PHOS/Module2/CPV",
a45bb6dc 39 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 40 new(alobj[i++]) AliAlignObjParams("PHOS/Module3/CPV",
a45bb6dc 41 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 42 new(alobj[i++]) AliAlignObjParams("PHOS/Module4/CPV",
a45bb6dc 43 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 44 new(alobj[i++]) AliAlignObjParams("PHOS/Module5/CPV",
a45bb6dc 45 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
46
1895a097 47 // Alignment for PHOS cradle
90dbf5fb 48 new(alobj[i++]) AliAlignObjParams("PHOS/Cradle0",
1895a097 49 volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 50 new(alobj[i++]) AliAlignObjParams("PHOS/Cradle1",
1895a097 51 volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
52
53 // Alignment for cradle wheels
90dbf5fb 54 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel0",
1895a097 55 volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 56 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel1",
1895a097 57 volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 58 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel2",
1895a097 59 volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 60 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel3",
1895a097 61 volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
62
c0d56e82 63// AliPHOSSurvey geodesicData("phos_mod3_survey.txt");
90dbf5fb 64// geodesicData.CreateAliAlignObjParams(alobj);
c0d56e82 65
66 AliPHOSSurvey1 geodesicData("phos_mod3_survey_EDMS.txt", "T1_");
90dbf5fb 67 geodesicData.CreateAliAlignObjParams(alobj);
3c759505 68
1895a097 69 // ************************* 2nd step ***************
70
dfe9c69d 71 const char* macroname = "MakePHOSFullMisAlignment.C";
a24be56b 72 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
1895a097 73 // save on file
dfe9c69d 74 const char* filename = "PHOSfullMisalignment.root";
75 TFile f(filename,"RECREATE");
76 if(!f){
77 Error(macroname,"cannot open file for output\n");
78 return;
79 }
80 Info(macroname,"Saving alignment objects to the file %s", filename);
1895a097 81 f.cd();
dfe9c69d 82 f.WriteObject(array,"PHOSAlignObjs","kSingleKey");
1895a097 83 f.Close();
84 }else{
85 // save in CDB storage
dfe9c69d 86 TString Storage = gSystem->Getenv("STORAGE");
87 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
88 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
89 return;
90 }
91 Info(macroname,"Saving alignment objects in CDB storage %s",
92 Storage.Data());
93 AliCDBManager* cdb = AliCDBManager::Instance();
94 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
95 if(!storage){
96 Error(macroname,"Unable to open storage %s\n",Storage.Data());
97 return;
98 }
1895a097 99 AliCDBMetaData *md= new AliCDBMetaData();
100 md->SetResponsible("Yuri Kharlov");
101 md->SetComment("Alignment objects for fully misaligned geometry");
3c759505 102 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 103 AliCDBId id("PHOS/Align/Data",0,AliCDBRunRange::Infinity());
1895a097 104 storage->Put(array,id, md);
105 }
106
107 array->Delete();
108
109}