]>
Commit | Line | Data |
---|---|---|
b355f61e | 1 | void MakeTOFZeroMisAlignment(){ |
b355f61e | 2 | // Create TClonesArray of zero misalignment objects for TOF |
d3a9c52a | 3 | // |
90dbf5fb | 4 | TClonesArray *array = new TClonesArray("AliAlignObjParams",2000); |
b355f61e | 5 | TClonesArray &alobj = *array; |
6fce62af | 6 | const char* macroname = "MakeTOFZeroMisAlignment.C"; |
b355f61e | 7 | |
a24be56b | 8 | // Activate CDB storage and load geometry from CDB |
9 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
10 | if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT"); | |
11 | cdb->SetRun(0); | |
12 | ||
13 | AliCDBStorage* storage; | |
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(); //load geom from default CDB storage | |
34 | } | |
35 | ||
6fce62af | 36 | |
ae079791 | 37 | AliGeomManager::ELayerID idTOF = AliGeomManager::kTOF; |
b355f61e | 38 | Int_t j=0; |
a24be56b | 39 | Int_t strId=-1; |
b355f61e | 40 | Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.; |
41 | ||
a24be56b | 42 | |
43 | Int_t sActive[18]={0,1,1,0,0,0,1,1,0,1,1,1,1,0,0,1,1,1}; | |
44 | ||
45 | Int_t nstrA=15; | |
46 | Int_t nstrB=19; | |
47 | Int_t nstrC=19; | |
48 | Int_t nSectors=18; | |
49 | Int_t nStrips=nstrA+2*nstrB+2*nstrC; | |
50 | ||
51 | for (Int_t isect = 0; isect < nSectors; isect++) { | |
52 | for (Int_t istr = 1; istr <= nStrips; istr++) { | |
53 | strId++; | |
85ce4b22 | 54 | if ((isect==13 || isect==14 || isect==15) && (istr >= 39 && istr <= 53)) continue; |
55 | if( (TString(gSystem->Getenv("PARTGEOM")) == TString("kTRUE")) && !sActive[isect] ) continue; | |
a24be56b | 56 | new(alobj[j++]) AliAlignObjParams(AliGeomManager::SymName(idTOF,strId), AliGeomManager::LayerToVolUID(idTOF,strId), dx, dy, dz, dpsi, dtheta, dphi, kTRUE); |
57 | } | |
b355f61e | 58 | } |
59 | ||
a24be56b | 60 | if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ |
d3a9c52a | 61 | // save on file |
dfe9c69d | 62 | const char* filename = "TOFzeroMisalignment.root"; |
63 | TFile f(filename,"RECREATE"); | |
64 | if(!f){ | |
65 | Error(macroname,"cannot open file for output\n"); | |
66 | return; | |
67 | } | |
68 | Info(macroname,"Saving alignment objects to the file %s", filename); | |
d3a9c52a | 69 | f.cd(); |
70 | f.WriteObject(array,"TOFAlignObjs","kSingleKey"); | |
71 | f.Close(); | |
72 | }else{ | |
73 | // save in CDB storage | |
d3a9c52a | 74 | AliCDBMetaData* md = new AliCDBMetaData(); |
75 | md->SetResponsible("Silvia Arcelli"); | |
76 | md->SetComment("Zero misalignment for TOF"); | |
77 | md->SetAliRootVersion("HEAD"); | |
dfe9c69d | 78 | AliCDBId id("TOF/Align/Data",0,AliCDBRunRange::Infinity()); |
d3a9c52a | 79 | storage->Put(array,id,md); |
80 | } | |
b355f61e | 81 | |
82 | array->Delete(); | |
83 | ||
84 | } | |
85 | ||
86 |