1 void MakeTOFZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for TOF
4 TClonesArray *array = new TClonesArray("AliAlignObjParams",2000);
5 TClonesArray &alobj = *array;
6 const char* macroname = "MakeTOFZeroMisAlignment.C";
8 // Activate CDB storage and load geometry from CDB
9 AliCDBManager* cdb = AliCDBManager::Instance();
10 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
13 AliCDBStorage* storage;
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());
21 storage = cdb->GetStorage(Storage.Data());
23 Error(macroname,"Unable to open storage %s\n",Storage.Data());
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!");
30 TGeoManager* geom = (TGeoManager*) entry->GetObject();
31 AliGeomManager::SetGeometry(geom);
33 AliGeomManager::LoadGeometry(); //load geom from default CDB storage
37 AliGeomManager::ELayerID idTOF = AliGeomManager::kTOF;
40 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
46 Int_t nStrips=nstrA+2*nstrB+2*nstrC;
48 for (Int_t isect = 0; isect < nSectors; isect++) {
49 for (Int_t istr = 1; istr <= nStrips; istr++) {
51 if ((isect==13 || isect==14 || isect==15) && (istr >= 39 && istr <= 53)) continue;
52 new(alobj[j++]) AliAlignObjParams(AliGeomManager::SymName(idTOF,strId), AliGeomManager::LayerToVolUID(idTOF,strId), dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
56 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
58 const char* filename = "TOFzeroMisalignment.root";
59 TFile f(filename,"RECREATE");
61 Error(macroname,"cannot open file for output\n");
64 Info(macroname,"Saving alignment objects to the file %s", filename);
66 f.WriteObject(array,"TOFAlignObjs","kSingleKey");
69 // save in CDB storage
70 AliCDBMetaData* md = new AliCDBMetaData();
71 md->SetResponsible("Silvia Arcelli");
72 md->SetComment("Zero misalignment for TOF");
73 md->SetAliRootVersion("HEAD");
74 AliCDBId id("TOF/Align/Data",0,AliCDBRunRange::Infinity());
75 storage->Put(array,id,md);