]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/MakeEMCALZeroMisAlignment.C
AliAlignObjAngles becomes AliAlignObjParams (Raffaele)
[u/mrichter/AliRoot.git] / EMCAL / MakeEMCALZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakeEMCALZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for EMCAL
3 //
90dbf5fb 4 TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
d3a9c52a 5 TClonesArray &alobj = *array;
6
dfe9c69d 7 if(!AliGeomManager::GetGeometry()){
8 if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
9 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
10 AliCDBManager::Instance()->SetRun(0);
11 AliGeomManager::LoadGeometry();
12 }
90dbf5fb 13 AliAlignObjParams a;
d3a9c52a 14
15 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
16
17 const TString fbasepath = "EMCAL/FullSupermodule";
18 const TString hbasepath = "EMCAL/HalfSupermodule";
19 TString pathstr;
20
21 Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT
ae079791 22 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
23 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
d3a9c52a 24
25 Int_t i;
26 Int_t j=0;
27
28 for(i=0; i<10; i++){
29 pathstr=fbasepath;
30 pathstr+=(i+1);
90dbf5fb 31 new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
d3a9c52a 32 }
33
34 for(i=0; i<2; i++){
35 pathstr=hbasepath;
36 pathstr+=(i+1);
90dbf5fb 37 new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
d3a9c52a 38 }
39
dfe9c69d 40 const char* macroname = "MakeEMCALZeroMisAlignment.C";
5bd470e1 41 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
d3a9c52a 42 // save on file
dfe9c69d 43 const char* filename = "EMCALzeroMisalignment.root";
44 TFile f(filename,"RECREATE");
45 if(!f){
46 Error(macroname,"cannot open file for output\n");
47 return;
48 }
49 Info(macroname,"Saving alignment objects to the file %s", filename);
d3a9c52a 50 f.cd();
51 f.WriteObject(array,"EMCALAlignObjs","kSingleKey");
52 f.Close();
53 }else{
54 // save in CDB storage
dfe9c69d 55 TString Storage = gSystem->Getenv("STORAGE");
56 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
57 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
58 return;
59 }
60 Info(macroname,"Saving alignment objects in CDB storage %s",
61 Storage.Data());
d3a9c52a 62 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 63 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
64 if(!storage){
65 Error(macroname,"Unable to open storage %s\n",Storage.Data());
66 return;
67 }
d3a9c52a 68 AliCDBMetaData* md = new AliCDBMetaData();
69 md->SetResponsible("Jennifer Clay");
70 md->SetComment("Zero misalignment for EMCAL");
5bd470e1 71 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 72 AliCDBId id("EMCAL/Align/Data",0,AliCDBRunRange::Infinity());
d3a9c52a 73 storage->Put(array,id,md);
74 }
75
76 array->Delete();
77
78}
79