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