Full set of updated misalignment macros (Raffaele)
[u/mrichter/AliRoot.git] / VZERO / MakeVZEROZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakeVZEROZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for VZERO
3 //
4 if(!gGeoManager) TGeoManager::Import("geometry.root");
5 // needed for the constructors with local coordinates not to fail
6
7 TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
8 TClonesArray &alobj = *array;
9
10 AliAlignObjAngles a;
11
12 Double_t dx, dy, dz, dpsi, dtheta, dphi;
13
14 Int_t iIndex=0;
15 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
16 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
17
18 TString V0right("VZERO/V0C");
19 new(alobj[0]) AliAlignObjAngles(V0right.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
20 TString V0left("VZERO/V0A");
21 new(alobj[1]) AliAlignObjAngles(V0left.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE);
22
23 if(!gSystem->Getenv("$TOCDB")){
24 // save on file
25 TFile f("V0zeroMisalignment.root","RECREATE");
26 if(!f) cerr<<"cannot open file for output\n";
27 f.cd();
28 f.WriteObject(array,"V0ZeroAlObjs ","kSingleKey");
29 f.Close();
30 }else{
31 // save in CDB storage
32 const char* Storage = gSystem->Getenv("$STORAGE");
33 AliCDBManager* cdb = AliCDBManager::Instance();
34 AliCDBStorage* storage = cdb->GetStorage(Storage);
35 AliCDBMetaData* md = new AliCDBMetaData();
36 md->SetResponsible("Brigitte Cheynis");
37 md->SetComment("Alignment objects for V0 zero-misalignment");
38 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
39 AliCDBId id("VZERO/Align/Data",0,9999999);
40 storage->Put(array,id,md);
41 }
42
43 array->Delete();
44
45}
46