]>
Commit | Line | Data |
---|---|---|
1 | void MakeTRDZeroMisAlignment(){ | |
2 | // Create TClonesArray of zero misalignment objects for TRD | |
3 | // | |
4 | const char* macroname = "MakeTRDZeroMisAlignment.C"; | |
5 | TClonesArray *array = new TClonesArray("AliAlignObjParams",1000); | |
6 | TClonesArray &alobj = *array; | |
7 | ||
8 | // Activate CDB storage and load geometry from CDB | |
9 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
10 | if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); | |
11 | cdb->SetRun(0); | |
12 | ||
13 | AliCDBStorage* storage = NULL; | |
14 | ||
15 | if(TString(gSystem->Getenv("TOCDB")) == TString("kTRUE")){ | |
16 | TString Storage = gSystem->Getenv("STORAGE"); | |
17 | if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { | |
18 | Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); | |
19 | return; | |
20 | } | |
21 | storage = cdb->GetStorage(Storage.Data()); | |
22 | if(!storage){ | |
23 | Error(macroname,"Unable to open storage %s\n",Storage.Data()); | |
24 | return; | |
25 | } | |
26 | AliCDBPath path("GRP","Geometry","Data"); | |
27 | AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun()); | |
28 | if(!entry) Fatal(macroname,"Could not get the specified CDB entry!"); | |
29 | entry->SetOwner(0); | |
30 | TGeoManager* geom = (TGeoManager*) entry->GetObject(); | |
31 | AliGeomManager::SetGeometry(geom); | |
32 | }else{ | |
33 | AliGeomManager::LoadGeometry("geometry.root"); //load geom from default CDB storage | |
34 | } | |
35 | ||
36 | Int_t sActive[18]={1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1}; | |
37 | Double_t dx=0.,dy=0.,dz=0.,rx=0.,ry=0.,rz=0.; | |
38 | ||
39 | Int_t j=0; | |
40 | UShort_t volid; | |
41 | const char *symname; | |
42 | ||
43 | // create the supermodules' alignment objects | |
44 | for (Int_t iSect; iSect<18; iSect++) { | |
45 | TString sm_symname(Form("TRD/sm%02d",iSect)); | |
46 | if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue; | |
47 | new(alobj[j++]) AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kTRUE); | |
48 | } | |
49 | ||
50 | // create the chambers' alignment objects | |
51 | Int_t chId; | |
52 | for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) { | |
53 | chId=-1; | |
54 | for (Int_t iSect = 0; iSect < 18; iSect++){ | |
55 | for (Int_t iCh = 0; iCh < 5; iCh++) { | |
56 | chId++; | |
57 | if ((iSect==13 || iSect==14 || iSect==15) && iCh==2) continue; | |
58 | volid = AliGeomManager::LayerToVolUID(iLayer,chId); | |
59 | if( (TString(gSystem->Getenv("REALSETUP")) == TString("kTRUE")) && !sActive[iSect] ) continue; | |
60 | symname = AliGeomManager::SymName(volid); | |
61 | new(alobj[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kTRUE); | |
62 | } | |
63 | } | |
64 | } | |
65 | ||
66 | if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ | |
67 | // save on file | |
68 | const char* filename = "TRDzeroMisalignment.root"; | |
69 | TFile f(filename,"RECREATE"); | |
70 | if(!f){ | |
71 | Error(macroname,"cannot open file for output\n"); | |
72 | return; | |
73 | } | |
74 | Info(macroname,"Saving alignment objects to the file %s", filename); | |
75 | f.cd(); | |
76 | f.WriteObject(array,"TRDAlignObjs","kSingleKey"); | |
77 | f.Close(); | |
78 | }else{ | |
79 | // save in CDB storage | |
80 | Info(macroname,"Saving alignment objects in CDB storage %s", | |
81 | Storage.Data()); | |
82 | AliCDBMetaData* md = new AliCDBMetaData(); | |
83 | md->SetResponsible("Dariusz Miskowiec"); | |
84 | md->SetComment("Zero misalignment for TRD"); | |
85 | md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); | |
86 | AliCDBId id("TRD/Align/Data",0,AliCDBRunRange::Infinity()); | |
87 | storage->Put(array,id,md); | |
88 | } | |
89 | ||
90 | array->Delete(); | |
91 | ||
92 | } | |
93 | ||
94 |