]>
Commit | Line | Data |
---|---|---|
1 | void MakeZDCZeroMisAlignment(){ | |
2 | // Create TClonesArray of zero misalignment objects for ZDC | |
3 | // | |
4 | if(!AliGeomManager::GetGeometry()){ | |
5 | if(!(AliCDBManager::Instance())->IsDefaultStorageSet()) | |
6 | AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT"); | |
7 | AliCDBManager::Instance()->SetRun(0); | |
8 | AliGeomManager::LoadGeometry(); | |
9 | } | |
10 | // needed for the constructors with local coordinates not to fail | |
11 | ||
12 | TClonesArray *array = new TClonesArray("AliAlignObjParams",10); | |
13 | TClonesArray &alobj = *array; | |
14 | ||
15 | AliAlignObjParams a; | |
16 | ||
17 | Double_t dx=0., dy=0., dz=0.; | |
18 | Double_t dpsi=0., dtheta=0., dphi=0.; | |
19 | ||
20 | const char *ZDCn="ZDC/NeutronZDC"; | |
21 | const char *ZDCp="ZDC/ProtonZDC"; | |
22 | ||
23 | UShort_t iIndex=0; | |
24 | AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; | |
25 | UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex); | |
26 | ||
27 | new(alobj[0]) AliAlignObjParams(ZDCn, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); | |
28 | new(alobj[1]) AliAlignObjParams(ZDCp, volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE); | |
29 | ||
30 | const char* macroname = "MakeZDCZeroMisAlignment.C"; | |
31 | if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){ | |
32 | // save in file | |
33 | const char* filename = "ZDCzeroMisalignment.root"; | |
34 | TFile f(filename,"RECREATE"); | |
35 | if(!f){ | |
36 | Error(macroname,"cannot open file for output\n"); | |
37 | return; | |
38 | } | |
39 | Info(macroname,"Saving alignment objects to the file %s", filename); | |
40 | f.cd(); | |
41 | f.WriteObject(array,"ZDCAlignObjs","kSingleKey"); | |
42 | f.Close(); | |
43 | }else{ | |
44 | // save in CDB storage | |
45 | TString Storage = gSystem->Getenv("STORAGE"); | |
46 | if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { | |
47 | Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); | |
48 | return; | |
49 | } | |
50 | Info(macroname,"Saving alignment objects in CDB storage %s", | |
51 | Storage.Data()); | |
52 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
53 | AliCDBStorage* storage = cdb->GetStorage(Storage.Data()); | |
54 | if(!storage){ | |
55 | Error(macroname,"Unable to open storage %s\n",Storage.Data()); | |
56 | return; | |
57 | } | |
58 | AliCDBMetaData* md = new AliCDBMetaData(); | |
59 | md->SetResponsible("Chiara Oppedisano"); | |
60 | md->SetComment("Alignment objects for ZDC zero misalignment"); | |
61 | md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); | |
62 | AliCDBId id("ZDC/Align/Data",0,AliCDBRunRange::Infinity()); | |
63 | storage->Put(array,id,md); | |
64 | } | |
65 | ||
66 | array->Delete(); | |
67 | ||
68 | } | |
69 |