1 void MakeTOFZeroMisAlignment() {
3 // Create TClonesArray of zero misalignment objects for TOF
6 const char* macroname = "MakeTOFZeroMisAlignment.C";
8 TClonesArray *array = new TClonesArray("AliAlignObjParams",2000);
9 TClonesArray &alobj = *array;
11 // Activate CDB storage to load geometry from CDB
12 AliCDBManager* cdb = AliCDBManager::Instance();
13 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
16 AliCDBStorage* storage;
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());
24 storage = cdb->GetStorage(Storage.Data());
26 Error(macroname,"Unable to open storage %s\n",Storage.Data());
29 AliCDBPath path("GRP","Geometry","Data");
30 AliCDBEntry *entry = (AliCDBEntry*)storage->Get(path.GetPath(),cdb->GetRun());
32 Fatal(macroname,"Could not get the specified CDB entry!");
35 TGeoManager* geom = (TGeoManager*) entry->GetObject();
36 AliGeomManager::SetGeometry(geom);
38 AliGeomManager::LoadGeometry(); //load geom from default CDB storage
41 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
42 AliGeomManager::ELayerID idTOF = AliGeomManager::kTOF;
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
50 for (Int_t isect = 0; isect < nSectors; isect++) {
51 TString symname(Form("TOF/sm%02d",isect));
52 new(alobj[j++]) AliAlignObjParams(symname.Data(),
54 dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
61 Int_t nStrips=nstrA+2*nstrB+2*nstrC;
63 for (Int_t isect = 0; isect < nSectors; isect++) {
64 for (Int_t istr = 1; istr <= nStrips; istr++) {
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);
73 if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
75 const char* filename = "TOFzeroMisalignment.root";
76 TFile f(filename,"RECREATE");
78 Error(macroname,"cannot open file for output\n");
81 Info(macroname,"Saving alignment objects to the file %s", filename);
83 f.WriteObject(array,"TOFAlignObjs","kSingleKey");
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);