]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - TOF/MakeTOFZeroMisAlignment.C
bugfix: corrected calculation of slice and partition from track point Id
[u/mrichter/AliRoot.git] / TOF / MakeTOFZeroMisAlignment.C
... / ...
CommitLineData
1void MakeTOFZeroMisAlignment() {
2 //
3 // Create TClonesArray of zero misalignment objects for TOF
4 //
5
6 const char* macroname = "MakeTOFZeroMisAlignment.C";
7
8 TClonesArray *array = new TClonesArray("AliAlignObjParams",2000);
9 TClonesArray &alobj = *array;
10
11 // Activate CDB storage to load geometry from CDB
12 AliCDBManager* cdb = AliCDBManager::Instance();
13 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
14 cdb->SetRun(0);
15
16 AliCDBStorage* storage;
17
18 if ( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ) {
19 TString Storage = gSystem->Getenv("STORAGE");
20 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
21 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
22 return;
23 }
24 storage = cdb->GetStorage(Storage.Data());
25 if (!storage) {
26 Error(macroname,"Unable to open storage %s\n",Storage.Data());
27 return;
28 }
29 AliCDBPath path("GRP","Geometry","Data");
30 AliCDBEntry *entry = (AliCDBEntry*)storage->Get(path.GetPath(),cdb->GetRun());
31 if (!entry)
32 Fatal(macroname,"Could not get the specified CDB entry!");
33
34 entry->SetOwner(0);
35 TGeoManager* geom = (TGeoManager*) entry->GetObject();
36 AliGeomManager::SetGeometry(geom);
37 } else
38 AliGeomManager::LoadGeometry(); //load geom from default CDB storage
39
40
41 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
42 AliGeomManager::ELayerID idTOF = AliGeomManager::kTOF;
43 Int_t j=0;
44 Int_t nSectors=18;
45
46 Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
47 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
48 UShort_t dvoluid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy vol id
49
50 for (Int_t isect = 0; isect < nSectors; isect++) {
51 TString symname(Form("TOF/sm%02d",isect));
52 new(alobj[j++]) AliAlignObjParams(symname.Data(),
53 dvoluid,
54 dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
55 }
56
57 Int_t strId=-1;
58 Int_t nstrA=15;
59 Int_t nstrB=19;
60 Int_t nstrC=19;
61 Int_t nStrips=nstrA+2*nstrB+2*nstrC;
62
63 for (Int_t isect = 0; isect < nSectors; isect++) {
64 for (Int_t istr = 1; istr <= nStrips; istr++) {
65 strId++;
66 if ((isect==13 || isect==14 || isect==15) && (istr >= 39 && istr <= 53)) continue;
67 new(alobj[j++]) AliAlignObjParams(AliGeomManager::SymName(idTOF,strId),
68 AliGeomManager::LayerToVolUID(idTOF,strId),
69 dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
70 }
71 }
72
73 if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
74 // save on file
75 const char* filename = "TOFzeroMisalignment.root";
76 TFile f(filename,"RECREATE");
77 if(!f){
78 Error(macroname,"cannot open file for output\n");
79 return;
80 }
81 Info(macroname,"Saving alignment objects to the file %s", filename);
82 f.cd();
83 f.WriteObject(array,"TOFAlignObjs","kSingleKey");
84 f.Close();
85 } else {
86 // save in CDB storage
87 AliCDBMetaData* md = new AliCDBMetaData();
88 md->SetResponsible("Silvia Arcelli");
89 md->SetComment("Zero misalignment for TOF");
90 md->SetAliRootVersion("HEAD");
91 AliCDBId id("TOF/Align/Data",0,AliCDBRunRange::Infinity());
92 storage->Put(array,id,md);
93 }
94
95 array->Delete();
96
97}