impoved num precision
[u/mrichter/AliRoot.git] / HMPID / MakeHMPIDZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakeHMPIDZeroMisAlignment(){
2 // Create TClonesArray of zero misalignment objects for HMPID
3 //
71efb7b5 4 const char* macroname = "MakeHMPIDZeroMisAlignment.C";
5 // Activate CDB storage and load geometry from CDB
6 AliCDBManager* cdb = AliCDBManager::Instance();
162637e4 7 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
71efb7b5 8 cdb->SetRun(0);
9
10 AliCDBStorage* storage;
11 TString Storage;
12
13 if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){
14 Storage = gSystem->Getenv("STORAGE");
15 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
16 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
17 return;
18 }
19 storage = cdb->GetStorage(Storage.Data());
20 if(!storage){
21 Error(macroname,"Unable to open storage %s\n",Storage.Data());
22 return;
23 }
24 AliCDBPath path("GRP","Geometry","Data");
25 AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
26 if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
27 entry->SetOwner(0);
28 TGeoManager* geom = (TGeoManager*) entry->GetObject();
29 AliGeomManager::SetGeometry(geom);
30 }else{
31 AliGeomManager::LoadGeometry(); //load geom from default CDB storage
32 }
33
d3a9c52a 34 TClonesArray *pCA = new TClonesArray("AliAlignObjMatrix",10);
35
d3a9c52a 36 Double_t dX=0.,dY=0.,dZ=0.,dPsi=0.,dTheta=0.,dPhi=0.;
37
ae079791 38 Int_t idHMPID = AliGeomManager::kHMPID;
d3a9c52a 39 for (Int_t iCh = 0; iCh < 7; iCh++) {
ae079791 40 new((*pCA)[iCh]) AliAlignObjMatrix(AliGeomManager::SymName(idHMPID,iCh),AliGeomManager::LayerToVolUID(idHMPID,iCh),dX,dY,dZ,dPsi,dTheta,dPhi,kTRUE);
d3a9c52a 41 }
42
43// pCA->Print();
a24be56b 44 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
d3a9c52a 45 // save on file
dfe9c69d 46 const char* filename = "HMPIDzeroMisalignment.root";
47 TFile f(filename,"RECREATE");
48 if(!f){
49 Error(macroname,"cannot open file for output\n");
50 return;
51 }
52 Info(macroname,"Saving alignment objects to the file %s", filename);
d3a9c52a 53 f.cd();
54 f.WriteObject(pCA,"HMPIDAlignObjs","kSingleKey");
55 f.Close();
56 }else{
57 // save in CDB storage
dfe9c69d 58 Info(macroname,"Saving alignment objects in CDB storage %s",
59 Storage.Data());
d3a9c52a 60 AliCDBMetaData *pMeta= new AliCDBMetaData();
61 pMeta->SetResponsible("HMPID Expert");
62 pMeta->SetComment("Zero alignment objects for HMPID");
5bd470e1 63 pMeta->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 64 AliCDBId id("HMPID/Align/Data",0,AliCDBRunRange::Infinity());
d3a9c52a 65 storage->Put(pCA,id,pMeta);
66 }
67
68 pCA->Delete();
69}