]>
Commit | Line | Data |
---|---|---|
1 | void MakeITSZeroMisAlignment(){ | |
2 | // Create TClonesArray of zero misalignment objects for ITS | |
3 | // | |
4 | TClonesArray *array = new TClonesArray("AliAlignObjParams",4000); | |
5 | TClonesArray &alobj = *array; | |
6 | const char* macroname = "MakeITSZeroMisAlignment.C"; | |
7 | ||
8 | ||
9 | Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0., globalZ=0.; | |
10 | AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; | |
11 | ||
12 | Int_t j = 0; | |
13 | ||
14 | new(alobj[j]) AliAlignObjParams("ITS", 0, dx, dy, globalZ, dpsi, dtheta, dphi, kTRUE); | |
15 | j++; | |
16 | ||
17 | for ( Int_t l = AliGeomManager::kSPD1; l <= AliGeomManager::kSSD2; l++) { | |
18 | ||
19 | printf("%i modules in layer %i\n", AliGeomManager::LayerSize(l), l); | |
20 | for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(l); iModule++) { | |
21 | ||
22 | iLayer = AliGeomManager::kInvalidLayer; | |
23 | ||
24 | switch (l) { | |
25 | case 1: { | |
26 | iLayer = AliGeomManager::kSPD1; | |
27 | }; break; | |
28 | case 2: { | |
29 | iLayer = AliGeomManager::kSPD2; | |
30 | }; break; | |
31 | case 3: { | |
32 | iLayer = AliGeomManager::kSDD1; | |
33 | }; break; | |
34 | case 4: { | |
35 | iLayer = AliGeomManager::kSDD2; | |
36 | }; break; | |
37 | case 5: { | |
38 | iLayer = AliGeomManager::kSSD1; | |
39 | }; break; | |
40 | case 6: { | |
41 | iLayer = AliGeomManager::kSSD2; | |
42 | }; break; | |
43 | default: Printf("Wrong layer index in ITS (%d) !",l); | |
44 | }; | |
45 | UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iModule); | |
46 | const char *symname = AliGeomManager::SymName(volid); | |
47 | ||
48 | new(alobj[j]) AliAlignObjParams(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); | |
49 | j++; | |
50 | ||
51 | } | |
52 | } | |
53 | ||
54 | if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ | |
55 | // save on file | |
56 | const char* filename = "ITSzeroMisalignment.root"; | |
57 | TFile f(filename,"RECREATE"); | |
58 | if(!f){ | |
59 | Error(macroname,"cannot open file for output\n"); | |
60 | return; | |
61 | } | |
62 | Info(macroname,"Saving alignment objects to the file %s", filename); | |
63 | f.cd(); | |
64 | f.WriteObject(array,"ITSAlignObjs","kSingleKey"); | |
65 | f.Close(); | |
66 | }else{ | |
67 | // save in CDB storage | |
68 | TString Storage = gSystem->Getenv("STORAGE"); | |
69 | if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { | |
70 | Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); | |
71 | return; | |
72 | } | |
73 | Info(macroname,"Saving alignment objects in CDB storage %s", | |
74 | Storage.Data()); | |
75 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
76 | AliCDBStorage* storage = cdb->GetStorage(Storage.Data()); | |
77 | if(!storage){ | |
78 | Error(macroname,"Unable to open storage %s\n",Storage.Data()); | |
79 | return; | |
80 | } | |
81 | AliCDBMetaData *md= new AliCDBMetaData(); | |
82 | md->SetResponsible("Ludovic Gaudichet"); | |
83 | md->SetComment("Alignment objects with zero ITS misalignment"); | |
84 | md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); | |
85 | AliCDBId id("ITS/Align/Data",0,AliCDBRunRange::Infinity()); | |
86 | storage->Put(array,id, md); | |
87 | } | |
88 | ||
89 | array->Delete(); | |
90 | ||
91 | } | |
92 | ||
93 |