Updating limits to cope both with p-A and A-p ZDC timing
[u/mrichter/AliRoot.git] / PHOS / MakePHOSZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakePHOSZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for PHOS
3 //
6fce62af 4 const char* macroname = "MakePHOSZeroMisAlignment.C";
3c759505 5 const AliPHOSGeometry *phosGeom = AliPHOSGeometry::GetInstance("IHEP", "IHEP");
6 if (!phosGeom) {
7 Error("MakePHOSFullMisAlignment", "Cannot obtain AliPHOSGeometry singleton\n");
8 return;
9 }
10
11 AliPHOSEMCAGeometry *emca = phosGeom->GetEMCAGeometry();
90dbf5fb 12 TClonesArray *array = new TClonesArray("AliAlignObjParams", 16 + phosGeom->GetNModules() *
3c759505 13 emca->GetNStripX() * emca->GetNStripZ());
d3a9c52a 14 TClonesArray &alobj = *array;
15
d3a9c52a 16 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
d3a9c52a 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);
d3a9c52a 20
a3627590 21 Int_t i=0 ;
d3a9c52a 22 // Alignment for 5 PHOS modules
90dbf5fb 23 new(alobj[i++]) AliAlignObjParams("PHOS/Module1",
d3a9c52a 24 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 25 new(alobj[i++]) AliAlignObjParams("PHOS/Module2",
d3a9c52a 26 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 27 new(alobj[i++]) AliAlignObjParams("PHOS/Module3",
d3a9c52a 28 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 29 new(alobj[i++]) AliAlignObjParams("PHOS/Module4",
d3a9c52a 30 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 31 new(alobj[i++]) AliAlignObjParams("PHOS/Module5",
d3a9c52a 32 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
33
a3627590 34 // Alignment of CPV modules
90dbf5fb 35 new(alobj[i++]) AliAlignObjParams("PHOS/Module1/CPV",
a3627590 36 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 37 new(alobj[i++]) AliAlignObjParams("PHOS/Module2/CPV",
a3627590 38 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 39 new(alobj[i++]) AliAlignObjParams("PHOS/Module3/CPV",
a3627590 40 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 41 new(alobj[i++]) AliAlignObjParams("PHOS/Module4/CPV",
a3627590 42 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 43 new(alobj[i++]) AliAlignObjParams("PHOS/Module5/CPV",
a3627590 44 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
45
46
d3a9c52a 47 // Alignment for PHOS cradle
90dbf5fb 48 new(alobj[i++]) AliAlignObjParams("PHOS/Cradle0",
d3a9c52a 49 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 50 new(alobj[i++]) AliAlignObjParams("PHOS/Cradle1",
d3a9c52a 51 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
52
53 // Alignment for cradle wheels
90dbf5fb 54 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel0",
d3a9c52a 55 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 56 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel1",
d3a9c52a 57 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 58 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel2",
d3a9c52a 59 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
90dbf5fb 60 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel3",
d3a9c52a 61 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
62
3c759505 63 AliPHOSSurvey geodesicData;
64 geodesicData.CreateNullObjects(alobj, phosGeom);
d3a9c52a 65
a24be56b 66 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
d3a9c52a 67 // save on file
dfe9c69d 68 const char* filename = "PHOSzeroMisalignment.root";
69 TFile f(filename,"RECREATE");
70 if(!f){
71 Error(macroname,"cannot open file for output\n");
72 return;
73 }
74 Info(macroname,"Saving alignment objects to the file %s", filename);
d3a9c52a 75 f.cd();
76 f.WriteObject(array,"PHOSAlignObjs","kSingleKey");
77 f.Close();
78 }else{
79 // save in CDB storage
dfe9c69d 80 TString Storage = gSystem->Getenv("STORAGE");
81 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
82 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
83 return;
84 }
85 Info(macroname,"Saving alignment objects in CDB storage %s",
86 Storage.Data());
87 AliCDBManager* cdb = AliCDBManager::Instance();
88 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
89 if(!storage){
90 Error(macroname,"Unable to open storage %s\n",Storage.Data());
91 return;
92 }
d3a9c52a 93 AliCDBMetaData *md= new AliCDBMetaData();
94 md->SetResponsible("Yuri Kharlov");
95 md->SetComment("Zero misalignment objects");
3c759505 96 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 97 AliCDBId id("PHOS/Align/Data",0,AliCDBRunRange::Infinity());
d3a9c52a 98 storage->Put(array,id, md);
99 }
100
101 array->Delete();
102
103}