]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/MakeEMCALZeroMisAlignment.C
Added class to read reconstruction parameters from OCDB (Yuri)
[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("AliAlignObjAngles",10);
5   TClonesArray &alobj = *array;
6
7   if(!gGeoManager) TGeoManager::Import("geometry.root");
8   // needed for the constructors with local coordinates not to fail
9
10   AliAlignObjAngles a;
11
12   Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
13
14   const TString fbasepath = "EMCAL/FullSupermodule";
15   const TString hbasepath = "EMCAL/HalfSupermodule";
16   TString pathstr;
17
18   Int_t iIndex=0; // let all modules have index=0 in a layer with no LUT
19   AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
20   UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
21
22   Int_t i;
23   Int_t j=0;
24
25   for(i=0; i<10; i++){
26     pathstr=fbasepath;
27     pathstr+=(i+1);
28     new(alobj[j++]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
29   }
30
31   for(i=0; i<2; i++){
32     pathstr=hbasepath;
33     pathstr+=(i+1);
34     new(alobj[j++]) AliAlignObjAngles(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
35   }
36
37   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
38     // save on file
39     TFile f("EMCALzeroMisalignment.root","RECREATE");
40     if(!f) cerr<<"cannot open file for output\n";
41     f.cd();
42     f.WriteObject(array,"EMCALAlignObjs","kSingleKey");
43     f.Close();
44   }else{
45     // save in CDB storage
46     const char* Storage = gSystem->Getenv("STORAGE");
47     AliCDBManager* cdb = AliCDBManager::Instance();
48     AliCDBStorage* storage = cdb->GetStorage(Storage);
49     AliCDBMetaData* md = new AliCDBMetaData();
50     md->SetResponsible("Jennifer Clay");
51     md->SetComment("Zero misalignment for EMCAL");
52     md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
53     AliCDBId id("EMCAL/Align/Data",0,9999999);
54     storage->Put(array,id,md);
55   }
56
57   array->Delete();
58
59 }
60