]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/MakeEMCALZeroMisAlignment.C
bugfix: corrected defines to use right default algorithms
[u/mrichter/AliRoot.git] / EMCAL / MakeEMCALZeroMisAlignment.C
1 void MakeEMCALZeroMisAlignment(){
2   // Create TClonesArray of zero misalignment objects for EMCAL
3   //
4   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
5   TClonesArray &alobj = *array;
6   const char* macroname = "MakeEMCALZeroMisAlignment.C";
7
8   Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
9
10   const TString fbasepath = "EMCAL/FullSupermodule";
11   const TString hbasepath = "EMCAL/HalfSupermodule";
12   TString pathstr;
13
14   Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT
15   AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
16   UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
17
18   Int_t i;
19   Int_t j=0;
20
21   for(i=0; i<10; i++){
22     pathstr=fbasepath;
23     pathstr+=(i+1);
24     new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
25   }
26
27   for(i=0; i<2; i++){
28     pathstr=hbasepath;
29     pathstr+=(i+1);
30     new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
31   }
32
33   if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
34     // save on file
35     const char* filename = "EMCALzeroMisalignment.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 to the file %s", filename);
42     f.cd();
43     f.WriteObject(array,"EMCALAlignObjs","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",
53       Storage.Data());
54     AliCDBManager* cdb = AliCDBManager::Instance();
55     AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
56     if(!storage){
57       Error(macroname,"Unable to open storage %s\n",Storage.Data());
58       return;
59     }
60     AliCDBMetaData* md = new AliCDBMetaData();
61     md->SetResponsible("Jennifer Clay");
62     md->SetComment("Zero misalignment for EMCAL");
63     md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
64     AliCDBId id("EMCAL/Align/Data",0,AliCDBRunRange::Infinity());
65     storage->Put(array,id,md);
66   }
67
68   array->Delete();
69
70 }
71