]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
AliAlignObjAngles becomes AliAlignObjParams (Raffaele)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 28 Aug 2007 15:47:57 +0000 (15:47 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 28 Aug 2007 15:47:57 +0000 (15:47 +0000)
64 files changed:
EMCAL/Align/Data/Run0_999999999_v0_s0.root [new file with mode: 0644]
EMCAL/Align/Data/Run0_9999999_v0_s0.root [deleted file]
EMCAL/MakeEMCALFullMisAlignment.C
EMCAL/MakeEMCALResMisAlignment.C
EMCAL/MakeEMCALZeroMisAlignment.C
FMD/Align/Data/Run0_999999999_v0_s0.root [new file with mode: 0644]
FMD/Align/Data/Run0_9999999_v0_s0.root [deleted file]
FMD/MakeFMDFullMisAlignment.C
FMD/MakeFMDResMisAlignment.C
FMD/MakeFMDZeroMisAlignment.C
GRP/Align/Data/Run0_999999999_v0_s0.root [new file with mode: 0644]
HMPID/Align/Data/Run0_999999999_v0_s0.root
HMPID/MakeHMPIDFullMisAlignment.C
HMPID/MakeHMPIDResMisAlignment.C
HMPID/MakeHMPIDZeroMisAlignment.C
ITS/Align/Data/Run0_999999999_v0_s0.root
ITS/MakeITSFullMisAlignment.C
ITS/MakeITSResMisAlignment.C
ITS/MakeITSZeroMisAlignment.C
MUON/Align/Data/Run0_0_v0_s0.root [deleted file]
MUON/Align/Data/Run0_999999999_v0_s0.root [new file with mode: 0644]
MUON/MakeMUONFullMisAlignment.C
MUON/MakeMUONResMisAlignment.C
MUON/MakeMUONZeroMisAlignment.C
PHOS/Align/Data/Run0_999999999_v0_s0.root [new file with mode: 0644]
PHOS/Align/Data/Run0_9999999_v0_s0.root [deleted file]
PHOS/MakePHOSZeroMisAlignment.C
PMD/Align/Data/Run0_999999999_v0_s0.root [new file with mode: 0644]
PMD/Align/Data/Run0_9999999_v0_s0.root [deleted file]
PMD/MakePMDFullMisAlignment.C
PMD/MakePMDResMisAlignment.C
PMD/MakePMDZeroMisAlignment.C
T0/Align/Data/Run0_999999999_v0_s0.root
T0/MakeT0FullMisAlignment.C
T0/MakeT0ResMisAlignment.C
T0/MakeT0ZeroMisAlignment.C
TOF/Align/Data/Run0_999999999_v0_s0.root [new file with mode: 0644]
TOF/Align/Data/Run0_9999999_v0_s0.root [deleted file]
TOF/MakeTOFFullMisAlignment.C
TOF/MakeTOFResMisAlignment.C
TOF/MakeTOFZeroMisAlignment.C
TPC/Align/Data/Run0_999999999_v0_s0.root [new file with mode: 0644]
TPC/Align/Data/Run0_9999999_v0_s0.root [deleted file]
TPC/MakeTPCFullMisAlignment.C
TPC/MakeTPCResMisAlignment.C
TPC/MakeTPCZeroMisAlignment.C
TRD/Align/Data/Run0_999999999_v0_s0.root [new file with mode: 0644]
TRD/Align/Data/Run0_9999999_v0_s0.root [deleted file]
TRD/MakeTRDFullMisAlignment.C
TRD/MakeTRDResMisAlignment.C
TRD/MakeTRDZeroMisAlignment.C
VZERO/Align/Data/Run0_999999999_v0_s0.root [new file with mode: 0644]
VZERO/Align/Data/Run0_9999999_v0_s0.root [deleted file]
VZERO/MakeVZEROFullMisAlignment.C
VZERO/MakeVZEROResMisAlignment.C
VZERO/MakeVZEROZeroMisAlignment.C
ZDC/Align/Data/Run0_0_v0_s0.root [deleted file]
ZDC/Align/Data/Run0_999999999_v0_s0.root [new file with mode: 0644]
ZDC/MakeZDCFullMisAlignment.C
ZDC/MakeZDCResMisAlignment.C
ZDC/MakeZDCZeroMisAlignment.C
macros/MakeAllDETsFullMisAlignment.C
macros/MakeAllDETsResMisAlignment.C
macros/MakeAllDETsZeroMisAlignment.C

diff --git a/EMCAL/Align/Data/Run0_999999999_v0_s0.root b/EMCAL/Align/Data/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..0d202e5
Binary files /dev/null and b/EMCAL/Align/Data/Run0_999999999_v0_s0.root differ
diff --git a/EMCAL/Align/Data/Run0_9999999_v0_s0.root b/EMCAL/Align/Data/Run0_9999999_v0_s0.root
deleted file mode 100755 (executable)
index e94c52c..0000000
Binary files a/EMCAL/Align/Data/Run0_9999999_v0_s0.root and /dev/null differ
index 404f094790a639ff9fc472c0ca4635980e2a8755..6d4a60a61449c1106d42cc9ac22f02fbbf8ddeb3 100644 (file)
@@ -3,14 +3,35 @@ void MakeEMCALFullMisAlignment(){
   //
   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
+  const char* macroname = "MakeEMCALFullMisAlignment.C";
 
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  AliAlignObjParams a;
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
 
   Double_t dx, dy, dz, dpsi, dtheta, dphi;
   TRandom *rnd   = new TRandom(4321);
@@ -54,7 +75,6 @@ void MakeEMCALFullMisAlignment(){
     new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
   }
 
-  const char* macroname = "MakeEMCALFullMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "EMCALfullMisalignment.root";
@@ -69,19 +89,6 @@ void MakeEMCALFullMisAlignment(){
     f.Close();
   }else{
     // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-         Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData* md = new AliCDBMetaData();
     md->SetResponsible("Jennifer Clay");
     md->SetComment("Full misalignment for EMCAL");
index 7812ab72ff8ddb6618cfb9f0b85f2b1228922e97..90d6e24ba1ac306ff8387089952f34a140e91c25 100644 (file)
@@ -3,14 +3,35 @@ void MakeEMCALResMisAlignment(){
   //
   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
+  const char* macroname = "MakeEMCALResMisAlignment.C";
 
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  AliAlignObjParams a;
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
 
   Double_t dx, dy, dz, dpsi, dtheta, dphi;
 
@@ -56,7 +77,6 @@ void MakeEMCALResMisAlignment(){
     new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
   }
 
-  const char* macroname = "MakeEMCALResMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "EMCALresidualMisalignment.root";
@@ -71,19 +91,6 @@ void MakeEMCALResMisAlignment(){
     f.Close();
   }else{
     // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-        Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData* md = new AliCDBMetaData();
     md->SetResponsible("Jennifer Clay");
     md->SetComment("Residual misalignment for EMCAL, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
index 8b739617d6999a2c96442ca2cc0a4a2dc3bb7d83..0509ef086fda70962e43efbece2eb1a2c48bc673 100644 (file)
@@ -3,14 +3,7 @@ void MakeEMCALZeroMisAlignment(){
   //
   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
-
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  AliAlignObjParams a;
+  const char* macroname = "MakeEMCALZeroMisAlignment.C";
 
   Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
 
@@ -37,7 +30,6 @@ void MakeEMCALZeroMisAlignment(){
     new(alobj[j++]) AliAlignObjParams(pathstr, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
   }
 
-  const char* macroname = "MakeEMCALZeroMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "EMCALzeroMisalignment.root";
diff --git a/FMD/Align/Data/Run0_999999999_v0_s0.root b/FMD/Align/Data/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..ad46699
Binary files /dev/null and b/FMD/Align/Data/Run0_999999999_v0_s0.root differ
diff --git a/FMD/Align/Data/Run0_9999999_v0_s0.root b/FMD/Align/Data/Run0_9999999_v0_s0.root
deleted file mode 100644 (file)
index cde3a5a..0000000
Binary files a/FMD/Align/Data/Run0_9999999_v0_s0.root and /dev/null differ
index c37269dc7637e5aef815ff95f21e63cc17c0a86d..5901041da886ac848351daffd1b99592b838fe27 100644 (file)
@@ -1,13 +1,35 @@
 void MakeFMDFullMisAlignment(){
   // Create TClonesArray of full misalignment objects for FMD
   //
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  const char* macroname = "MakeFMDFullMisAlignment.C";
+
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  TString Storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
   
   gSystem->Load("libFMDutil.so");
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
@@ -15,8 +37,7 @@ void MakeFMDFullMisAlignment(){
     AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root","FMDfullMisalignment.root");
   }else{
     // save in CDB storage
-    const char* Storage = gSystem->Getenv("STORAGE");
-    AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root", Storage);
+    AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root", Storage.Data());
   }
 
   // fRunMax should be changed in the constructor
index 276cd5bb25a5037bd96366fd9ade99e8f86c8a89..15e2121faa2239385057be1126220dbe949f757a 100644 (file)
@@ -2,12 +2,35 @@ void MakeFMDResMisAlignment()
 {
   // Create TClonesArray of residual misalignment objects for FMD
   //
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-    AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
+  const char* macroname = "MakeFMDResMisAlignment.C";
+
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  TString Storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
   
   gSystem->Load("libFMDutil.so");
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
@@ -15,8 +38,7 @@ void MakeFMDResMisAlignment()
     AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root","FMDresidualMisalignment.root");
   }else{
     // save in CDB storage
-    const char* Storage = gSystem->Getenv("STORAGE");
-    AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root", Storage);
+    AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root", Storage.Data());
   }
 
   // fRunMax should be changed in the constructor
index 678c4a4b7931dc8b10bd1e38033acb5e45234b87..7ef9a67b4eec51983f5c70ffafc5d751a94fc8ef 100644 (file)
@@ -2,12 +2,35 @@ void MakeFMDZeroMisAlignment()
 {
   // Create TClonesArray of zero-misalignment objects for FMD
   //
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
+  const char* macroname = "MakeFMDZeroMisAlignment.C";
+
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  TString Storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
   
   gSystem->Load("libFMDutil.so");
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
@@ -15,8 +38,7 @@ void MakeFMDZeroMisAlignment()
     AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root","FMDAlignObjs.root");
   }else{
     // save in CDB storage
-    const char* Storage = gSystem->Getenv("STORAGE");
-    AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root", Storage);
+    AliFMDAlignFaker faker(AliFMDAlignFaker::kAll, "geometry.root", Storage.Data());
   }
 
   // fRunMax should be changed in the constructor
diff --git a/GRP/Align/Data/Run0_999999999_v0_s0.root b/GRP/Align/Data/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..0b2a627
Binary files /dev/null and b/GRP/Align/Data/Run0_999999999_v0_s0.root differ
index 23a76c0132180c68197e4c65979170c60f8ca47d..e060f1e40bc72e8ec3731453e58817a6dc0e99f5 100644 (file)
Binary files a/HMPID/Align/Data/Run0_999999999_v0_s0.root and b/HMPID/Align/Data/Run0_999999999_v0_s0.root differ
index 6f5546c75558db9b762fef2cb341482ffb2a8a79..236ace0ab42c1e2783e884fb9dfdfc631168cae5 100644 (file)
@@ -9,8 +9,6 @@ void MakeHMPIDFullMisAlignment(){
   
   TRandom *pRnd   = new TRandom(4357);
 
-  AliAlignObjMatrix o;
   Int_t idHMPID =  AliGeomManager::kHMPID;
   for (Int_t iCh = 0; iCh < 7; iCh++) {
     dX     = (pRnd->Uniform()-0.5)*sigmaTrans;    dY     = (pRnd->Uniform()-0.5)*sigmaTrans;    dZ     = (pRnd->Uniform()-0.5)*sigmaTrans;
index a9aac1403d49ef63e14d61efdde413c30f6d6b96..4f050d6bcf88ca3c32638eff8e8eb260dd45593f 100644 (file)
@@ -9,8 +9,6 @@ void MakeHMPIDResMisAlignment(){
   
   TRandom *pRnd   = new TRandom(4357);
 
-  AliAlignObjMatrix o;
   Int_t idHMPID =  AliGeomManager::kHMPID;
   for (Int_t iCh = 0; iCh < 7; iCh++) {
     dX     = (pRnd->Uniform()-0.5)*sigmaTrans;    dY     = (pRnd->Uniform()-0.5)*sigmaTrans;    dZ     = (pRnd->Uniform()-0.5)*sigmaTrans;
index 609efb58c3b13fa7af18cbae8527056cbc46ade3..c372b8b36a3dd8ff8d1269ee5f85cd1569b519e7 100644 (file)
@@ -3,8 +3,6 @@ void MakeHMPIDZeroMisAlignment(){
   //
   TClonesArray *pCA = new TClonesArray("AliAlignObjMatrix",10);
   
-  AliAlignObjMatrix o;
-
   Double_t dX=0.,dY=0.,dZ=0.,dPsi=0.,dTheta=0.,dPhi=0.;
  
   Int_t idHMPID =  AliGeomManager::kHMPID;
index a5d7d2a41d9f9e3c7772d0007aa87cbfb1260fe7..ef1c32bc6e37f636c5cea7cf7191c7c6737f6fe2 100644 (file)
Binary files a/ITS/Align/Data/Run0_999999999_v0_s0.root and b/ITS/Align/Data/Run0_999999999_v0_s0.root differ
index 7560cccd83f362930c36d09cde5618af29c4c877..44ed65410a28709c99719ddafda568351e82bfac 100644 (file)
@@ -3,14 +3,35 @@ void MakeITSFullMisAlignment(){
   //
   TClonesArray *array = new TClonesArray("AliAlignObjParams",4000);
   TClonesArray &alobj = *array;
+  const char* macroname = "MakeITSFullMisAlignment.C";
    
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
 
   Double_t globalZ = 0.015; // in cm, = 150 microns
   Double_t mecanicalPrec = 0.0020;
@@ -26,7 +47,6 @@ void MakeITSFullMisAlignment(){
 
 
   TRandom *rnd   = new TRandom(65416087);
-  AliAlignObjParams a;
 
   Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
 
@@ -92,7 +112,6 @@ void MakeITSFullMisAlignment(){
     }
   }
 
-  const char* macroname = "MakeITSFullMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "ITSfullMisalignment.root";
@@ -107,19 +126,6 @@ void MakeITSFullMisAlignment(){
     f.Close();
   }else{
     // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-        Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData *md= new AliCDBMetaData();
     md->SetResponsible("Ludovic Gaudichet");
     md->SetComment("Alignment objects with actual ITS misalignment");
index e0c2532807b1de17f790852f9325d78d51e68f36..4e11ac3c4ce935a185795536d301b7ba5418db00 100644 (file)
@@ -3,14 +3,35 @@ void MakeITSResMisAlignment(){
   //
   TClonesArray *array = new TClonesArray("AliAlignObjParams",4000);
   TClonesArray &alobj = *array;
+  const char* macroname = "MakeITSResMisAlignment.C";
    
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
 
   Double_t globalZ = 0.005; // in cm, = 50 microns
   Double_t resFact = 0.7;
@@ -23,7 +44,6 @@ void MakeITSResMisAlignment(){
   Double_t ssdZ    = 0.010;
 
   TRandom *rnd   = new TRandom(65416087);
-  AliAlignObjParams a;
 
   Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
   AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; 
@@ -94,7 +114,6 @@ void MakeITSResMisAlignment(){
     }
   }
 
-  const char* macroname = "MakeITSResMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "ITSresidualMisalignment.root";
@@ -109,19 +128,6 @@ void MakeITSResMisAlignment(){
     f.Close();
   }else{
     // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-        Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData *md= new AliCDBMetaData();
     md->SetResponsible("Ludovic Gaudichet");
     md->SetComment("Alignment objects with actual ITS misalignment");
index bf7b66097ee477a3d7a19610a79196ac173d7393..7d112ae83739b1fb04c059f970464a9c992fcc21 100644 (file)
@@ -3,16 +3,8 @@ void MakeITSZeroMisAlignment(){
   //
   TClonesArray *array = new TClonesArray("AliAlignObjParams",4000);
   TClonesArray &alobj = *array;
-   
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  const char* macroname = "MakeITSZeroMisAlignment.C";
 
-  AliAlignObjParams a;
 
   Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0., globalZ=0.;
   AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; 
@@ -59,7 +51,6 @@ void MakeITSZeroMisAlignment(){
     }
   }
 
-  const char* macroname = "MakeITSZeroMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "ITSzeroMisalignment.root";
diff --git a/MUON/Align/Data/Run0_0_v0_s0.root b/MUON/Align/Data/Run0_0_v0_s0.root
deleted file mode 100644 (file)
index 692e8c1..0000000
Binary files a/MUON/Align/Data/Run0_0_v0_s0.root and /dev/null differ
diff --git a/MUON/Align/Data/Run0_999999999_v0_s0.root b/MUON/Align/Data/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..7044be5
Binary files /dev/null and b/MUON/Align/Data/Run0_999999999_v0_s0.root differ
index 07bf9872d73d97db9826ec7e17d88931e3c0d900..448435affa43fbf9d8871f51377d91cbaa4ada00 100644 (file)
 
 void MakeMUONFullMisAlignment()
 {
-  // Load geometry, if not yet loaded,
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-    AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
+  const char* macroname = "MakeMUONFullMisAlignment.C";
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
 
   AliMUONGeometryTransformer transformer;
   transformer.LoadGeometryData();
@@ -57,8 +78,8 @@ void MakeMUONFullMisAlignment()
     = misAligner.MisAlign(&transformer, true);
   const TClonesArray* array = newTransform->GetMisAlignmentData();
   
-  const char* macroname = "MakeMUONFullMisAlignment.C";
   if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
+    // Save in file
     const char* filename = "MUONfullMisalignment.root";
     TFile f(filename,"RECREATE");
     if(!f){
@@ -71,19 +92,7 @@ void MakeMUONFullMisAlignment()
     f.Close();
   }
   else {
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-        Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
+    // Save in CDB storage
     AliCDBMetaData* cdbData = new AliCDBMetaData();
     cdbData->SetResponsible("Dimuon Offline project");
     cdbData->SetComment("MUON alignment objects with full misalignment");
index bcc9fc08c2b524b5eb464f5bb103599621b37277..9ecdf62666857bf3c5597a6fa13536fe2f7d8e84 100644 (file)
 
 void MakeMUONResMisAlignment()
 {
-  // Load geometry, if not yet loaded,
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-    AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
+  const char* macroname = "MakeMUONResMisAlignment.C";
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
 
   AliMUONGeometryTransformer transformer;
   transformer.LoadGeometryData();
@@ -56,8 +77,8 @@ void MakeMUONResMisAlignment()
     = misAligner.MisAlign(&transformer, true);
   const TClonesArray* array = newTransform->GetMisAlignmentData();
 
-  const char* macroname = "MakeMUONResMisAlignment.C";
   if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
+    // Save in file
     const char* filename = "MUONresidualMisalignment.root";
     TFile f(filename,"RECREATE");
     if(!f){
@@ -68,21 +89,8 @@ void MakeMUONResMisAlignment()
     f.cd();
     f.WriteObject(array,"MUONAlignObjs","kSingleKey");
     f.Close();
-  }
-  else {
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-        Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
+  } else {
+    // Save in CDB storage
     AliCDBMetaData* cdbData = new AliCDBMetaData();
     cdbData->SetResponsible("Dimuon Offline project");
     cdbData->SetComment("MUON alignment objects with residual misalignment");
index 8de69b7da355518dd263ae4a728e1ae700a42a2a..28e3a6633db2e895f5ded80427477cc152f99070 100644 (file)
 
 void MakeMUONZeroMisAlignment()
 {
-  // Load geometry, if not yet loaded,
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
+  const char* macroname = "MakeMUONZeroMisAlignment.C";
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
 
   AliMUONGeometryTransformer transformer;
   transformer.LoadGeometryData();
   TClonesArray* array = transformer.CreateZeroAlignmentData();;
 
-  const char* macroname = "MakeMUONZeroMisAlignment.C";
   if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
     // Create a file to store the alignment data
     const char* filename = "MUONZeroMisalignment.root";
@@ -65,19 +85,6 @@ void MakeMUONZeroMisAlignment()
     f.Close();
   } else {
     // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-        Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData* cdbData = new AliCDBMetaData();
     cdbData->SetResponsible("Dimuon Offline project");
     cdbData->SetComment("MUON alignment objects with zero misalignment");
diff --git a/PHOS/Align/Data/Run0_999999999_v0_s0.root b/PHOS/Align/Data/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..ce50b7b
Binary files /dev/null and b/PHOS/Align/Data/Run0_999999999_v0_s0.root differ
diff --git a/PHOS/Align/Data/Run0_9999999_v0_s0.root b/PHOS/Align/Data/Run0_9999999_v0_s0.root
deleted file mode 100644 (file)
index a8243c4..0000000
Binary files a/PHOS/Align/Data/Run0_9999999_v0_s0.root and /dev/null differ
index 72032a068af12e8f2416bf5e8095013995329cc5..e15c2ae9022c6c711ebfbea9ca241cd07bb90610 100644 (file)
@@ -1,6 +1,7 @@
 void MakePHOSZeroMisAlignment(){
   // Create TClonesArray of zero misalignment objects for PHOS
   //
+  const char* macroname = "MakePHOSZeroMisAlignment.C";
   const AliPHOSGeometry *phosGeom = AliPHOSGeometry::GetInstance("IHEP", "IHEP");
   if (!phosGeom) {
     Error("MakePHOSFullMisAlignment", "Cannot obtain AliPHOSGeometry singleton\n");
@@ -62,7 +63,6 @@ void MakePHOSZeroMisAlignment(){
   AliPHOSSurvey geodesicData;
   geodesicData.CreateNullObjects(alobj, phosGeom);
 
-  const char* macroname = "MakePHOSZeroMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "PHOSzeroMisalignment.root";
diff --git a/PMD/Align/Data/Run0_999999999_v0_s0.root b/PMD/Align/Data/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..4157b59
Binary files /dev/null and b/PMD/Align/Data/Run0_999999999_v0_s0.root differ
diff --git a/PMD/Align/Data/Run0_9999999_v0_s0.root b/PMD/Align/Data/Run0_9999999_v0_s0.root
deleted file mode 100644 (file)
index 6e04b6f..0000000
Binary files a/PMD/Align/Data/Run0_9999999_v0_s0.root and /dev/null differ
index b9ab263afb2ae7475507396f638f9b7f5c8c9468..ebf2c86ca2dce962361c7e7604e77c85f39ced4f 100644 (file)
@@ -35,18 +35,39 @@ void MakePMDFullMisAlignment(){
     // Steel plate 
  */
   
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
+  const char* macroname = "MakePMDFullMisAlignment.C";
+
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
   }
-  // needed for the constructors with local coordinates not to fail
 
   Float_t max_trans=0.1;
   Float_t max_rot=0.1;
 
-  TString path;
   const char *Sector1="PMD/Sector1"; 
   const char *Sector2="PMD/Sector2"; 
   const char *Sector3="PMD/Sector3"; 
@@ -96,8 +117,6 @@ void MakePMDFullMisAlignment(){
   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
   
-  AliAlignObjParams o;
-  
   Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
   AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
   UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
@@ -107,7 +126,6 @@ void MakePMDFullMisAlignment(){
   new(alobj[2]) AliAlignObjParams(Sector3, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
   new(alobj[3]) AliAlignObjParams(Sector4, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
   
-  const char* macroname = "MakePMDFullMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // Create a File to store the alignment data
     const char* filename = "PMDfullMisalignment.root";
@@ -122,19 +140,6 @@ void MakePMDFullMisAlignment(){
     f.Close();
   }else{
   // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-        Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData* md = new AliCDBMetaData();
     md->SetResponsible("");
     md->SetComment("Full misalignment for PMD, produced with sigmatr=0.1 and sigmarot=0.1 in the local RS");
index e95c29d6c93fb1b8742494a9eba8373e7a7dab9e..5ed470c975c2543648b1ebbbf823463bb3c4aff6 100644 (file)
@@ -34,18 +34,39 @@ void MakePMDResMisAlignment(){
     // Steel plate 
  */
   
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  const char* macroname = "MakePMDResMisAlignment.C";
+
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
 
   Float_t max_trans=0.1;
   Float_t max_rot=0.1;
 
-  TString path;
   const char *Sector1="PMD/Sector1"; 
   const char *Sector2="PMD/Sector2";
   const char *Sector3="PMD/Sector3"; 
@@ -95,8 +116,6 @@ void MakePMDResMisAlignment(){
   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
   
-  AliAlignObjParams o;
-  
   Int_t iIndex=0; //  let all modules have index=0 in a layer with no LUT
   AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
   UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
@@ -106,7 +125,6 @@ void MakePMDResMisAlignment(){
   new(alobj[2]) AliAlignObjParams(Sector3, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
   new(alobj[3]) AliAlignObjParams(Sector4, volid, dx23, dy23, dz23, dpsi23, dtheta23, dphi23, kFALSE);
   
-  const char* macroname = "MakePMDResMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // Create a File to store the alignment data
     const char* filename = "PMDresidualMisalignment.root";
@@ -121,19 +139,6 @@ void MakePMDResMisAlignment(){
     f.Close();
   }else{
   // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-        Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData* md = new AliCDBMetaData();
     md->SetResponsible("");
     md->SetComment("Residual misalignment for PMD, produced with sigmatr=0.1 and sigmarot=0.1 in the local RS");
index 9174eab87f201a15aafa2a625aacc8d691d21944..547011e3ad550c69b1fd301ea060925efc98b8ae 100644 (file)
@@ -33,21 +33,13 @@ void MakePMDZeroMisAlignment(){
     // As these will be mounted on the same
     // Steel plate 
  */
-  
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+
+  const char* macroname = "MakePMDZeroMisAlignment.C";
 
   //Create a TClonesArray of Align Object to store displacement Angles
   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
   
-  AliAlignObjParams o;
-  
   Int_t iIndex=0; //  let all modules have index=0 in a layer with no LUT
   AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
   UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
@@ -59,7 +51,6 @@ void MakePMDZeroMisAlignment(){
     new(alobj[j++]) AliAlignObjParams(snSector.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
   }
 
-  const char* macroname = "MakePMDZeroMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // Create a File to store the alignment data
     const char* filename = "PMDzeroMisalignment.root";
index a5372c504ba89b1fb5d462f2e48a69074a3c2ab4..befb95260f8ae68bd79683a5610bde0c44438df9 100644 (file)
Binary files a/T0/Align/Data/Run0_999999999_v0_s0.root and b/T0/Align/Data/Run0_999999999_v0_s0.root differ
index 56b9d2b26121ace1f4164898d1931654729be382..32cb09509609ce4081106a7ccd75bd27443c93f3 100644 (file)
@@ -4,15 +4,6 @@ void MakeT0FullMisAlignment(){
   TClonesArray *array = new TClonesArray("AliAlignObjParams",30);
   TClonesArray &alobj = *array;
 
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-    AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-
-  AliAlignObjParams a;
-
   Double_t dx, dy, dz, dpsi, dtheta, dphi;
   TRandom *rnd   = new TRandom(4321);
   Double_t sigmatr = 0.05; // sigma for shifts in cm
index 097d3ec856f7c2c451a47831ce0b0ed2b6fd361e..5a89ebd0986a83c148770be804134cf7adb457ca 100644 (file)
@@ -4,16 +4,6 @@ void MakeT0ResMisAlignment(){
   TClonesArray *array = new TClonesArray("AliAlignObjParams",30);
   TClonesArray &alobj = *array;
 
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
-
-  AliAlignObjParams a;
-
   Double_t dx, dy, dz, dpsi, dtheta, dphi;
   TRandom *rnd   = new TRandom(4321);
   Double_t sigmatr = 0.05; // max shift in cm
index eeeeb840f6dc1349b885affbbca1f6df758b7563..7b0f991d178bdad29838cd29446103724110a0ee 100644 (file)
@@ -4,8 +4,6 @@ void MakeT0ZeroMisAlignment(){
   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
 
-  AliAlignObjParams a;
-
   Double_t dx=0, dy=0, dz=0, dpsi=0, dtheta=0, dphi=0;
 
   TString symName, sn;
diff --git a/TOF/Align/Data/Run0_999999999_v0_s0.root b/TOF/Align/Data/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..830dcc8
Binary files /dev/null and b/TOF/Align/Data/Run0_999999999_v0_s0.root differ
diff --git a/TOF/Align/Data/Run0_9999999_v0_s0.root b/TOF/Align/Data/Run0_9999999_v0_s0.root
deleted file mode 100644 (file)
index 086ce13..0000000
Binary files a/TOF/Align/Data/Run0_9999999_v0_s0.root and /dev/null differ
index 75a6e5442e945ad9bb87433dd9ac3193ea00be92..3861fe05fe4eda4a94eb1fd04397a3642a36216a 100644 (file)
 void MakeTOFFullMisAlignment(){
   // Create TClonesArray of full misalignment objects for TOF
+  // Expects to read objects for FRAME
   // 
   TClonesArray *array = new TClonesArray("AliAlignObjParams",2000);
-  TClonesArray &alobj = *array;
-   
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-    AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
+  const char* macroname = "MakeTOFFullMisAlignment.C";
+  
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
+                 
+  // load FRAME full misalignment objects (if needed, the macro
+  // for FRAME has to be run in advance) and apply them to geometry
+  Info(macroname,"Loading FRAME alignment objects from CDB storage %s",
+      Storage.Data());
+  AliCDBPath fpath("GRP","Align","Data");
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    AliCDBEntry *eFrame = storage->Get(fpath.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    TClonesArray* arFrame = (TClonesArray*) eFrame->GetObject();
+    arFrame->Sort();
+    Int_t nvols = arFrame->GetEntriesFast();
+    Bool_t flag = kTRUE;
+    for(Int_t j=0; j<nvols; j++)
+      {
+       AliAlignObj* alobj = (AliAlignObj*) arFrame->UncheckedAt(j);
+       if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE;
+      }
+    if(!flag)
+      Fatal(macroname,"Error in the application of FRAME alignment objects");
+  }else{
+    AliCDBEntry *eFrame = cdb->Get(fpath.GetPath());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    TClonesArray* arFrame = (TClonesArray*) eFrame->GetObject();
+    arFrame->Sort();
+    Int_t nvols = arFrame->GetEntriesFast();
+    Bool_t flag = kTRUE;
+    for(Int_t j=0; j<nvols; j++)
+      {
+       AliAlignObj* alobj = (AliAlignObj*) arFrame->UncheckedAt(j);
+       if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE;
+      }
+    if(!flag)
+      Fatal(macroname,"Error in the application of FRAME alignment objects");
   }
 
-  AliAlignObjParams a;
-  Double_t sfdpsi=0.,sfdtheta=0.,sfdphi=0.;
+  //Produce objects for TOF supermodules
   Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
   AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
   UShort_t dvoluid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy vol id 
 
-  // FRAME part !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-  const char* basepath ="ALIC_1/B077_1/BSEGMO";
-  TString segmpath;
-
-  // for dead weight !!!! carefull: in mm
-  ifstream dw_file("/home/rgrosso/MacroAllineamento010207/disp_deadweight.txt", ios::in);
-  if(!dw_file) {cerr<<"cannot open dead weight file for input\n"; return;}
-  TArrayD dwdx(36);
-  TArrayD dwdy(36);
-  TArrayD dwdz(36);
-  TArrayD dwdrot(36);
-  // for additional load
-  ifstream orig_file("/home/rgrosso/MacroAllineamento010207/disp_full.txt", ios::in);
-//   ifstream orig_file("disp_full_nohmpid.txt", ios::in);
-  if(!orig_file) {cerr<<"cannot open file for input\n"; return;}
-  TArrayD adx(36);
-  TArrayD ady(36);
-  TArrayD adz(36);
-  TArrayD adrot(36);
-  // avarage displacements
-  Double_t mean_dx[18];
-  Double_t mean_dy[18];
-  Double_t idx[18];
-  Double_t idy[18];
-  Double_t newx[18];
-  Double_t newy[18];
-
-  string buffer;
-  Int_t point;
-  Double_t dx,dy,dz,drot;
-
-  // fill in from file the array for dead weight deformations
-  dw_file>>point>>dx>>dy>>dz>>drot;
-  dwdx.AddAt(dx,point-1);dwdy.AddAt(dy,point-1);dwdz.AddAt(dz,point-1);dwdrot.AddAt(drot,point-1);
-  while(getline(dw_file,buffer))
-    {
-      dw_file>>point>>dx>>dy>>dz>>drot;
-      dwdx.AddAt(dx,point-1);dwdy.AddAt(dy,point-1);dwdz.AddAt(dz,point-1);dwdrot.AddAt(drot,point-1);
-    }
-
-  // fill in from file the array for remaining load deformations
-  orig_file>>point>>dx>>dy>>dz>>drot;
-  adx.AddAt(dx,point-1);ady.AddAt(dy,point-1);adz.AddAt(dz,point-1);adrot.AddAt(drot,point-1);
-  while(getline(orig_file,buffer))
-    {
-      orig_file>>point>>dx>>dy>>dz>>drot;
-      adx.AddAt(dx,point-1);ady.AddAt(dy,point-1);adz.AddAt(dz,point-1);adrot.AddAt(drot,point-1);
-    }
-
-  //calculate the displacement of the center of the sm neglecting rotations,
-  //thus as average of the four surrounding point for dw + other load
-  // Prepare also to plot with respect to ideal circle.
-  Double_t cx=0.5;  //just for plotting
-  Double_t cy=0.5;
-  Double_t rr=0.3;
-  Double_t kk = TMath::Pi()*20./180.;
-  Double_t scale = 100./4000.;
-  TPolyMarker* iddu = new TPolyMarker(18,newx,newy);
-  TPolyMarker* disp = new TPolyMarker(18,newx,newy);
-
-  Int_t sm,outc,outclw; //outer number counterclock and clockwise
-  for(sm=0; sm<18; sm++){
-    outc=5-sm;
-    if(outc<1) outc+=18;
-    outclw=outc-1;
-    if(outclw<1) outclw+=18;
-    mean_dx[sm]=0.125*(adx[outc-1]+adx[outclw-1]+adx[outc+18-1]+adx[outclw+18-1]+dwdx[outc-1]+dwdx[outclw-1]+dwdx[outc+18-1]+dwdx[outclw+18-1]);
-    mean_dy[sm]=0.125*(ady[outc-1]+ady[outclw-1]+ady[outc+18-1]+ady[outclw+18-1]+dwdy[outc-1]+dwdy[outclw-1]+dwdy[outc+18-1]+dwdy[outclw+18-1]);
-    idx[sm]=cx+rr*TMath::Sin(sm*kk);
-    idy[sm]=cy+rr*TMath::Cos(sm*kk);
-    newx[sm]=idx[sm]+scale*mean_dx[sm];
-    newy[sm]=idy[sm]+scale*mean_dy[sm];
-    iddu->SetPoint(sm,idx[sm],idy[sm]);
-    disp->SetPoint(sm,newx[sm],newy[sm]);
-    
-    segmpath=basepath;
-    segmpath+=sm;
-    segmpath+="_1";
-    cout<<segmpath.Data()<<"  "<<dvoluid<<"  "<<mean_dx[sm]*0.1<<"  "<<mean_dy[sm]*0.1<<"  "<<dz<<"  "<<sfdpsi<<"  "<<sfdtheta<<"  "<<sfdphi<<endl;
-    new(alobj[sm]) AliAlignObjParams(segmpath.Data(), dvoluid, mean_dx[sm]*0.1,
-                    mean_dy[sm]*0.1, dz, sfdpsi, sfdtheta, sfdphi, kTRUE);
-  }
-  
-  for(Int_t k=0; k<18; k++){
-    AliAlignObjParams* smobj = (AliAlignObjParams*)array->UncheckedAt(k);
-    if(!smobj->ApplyToGeometry()){
-      cout<<"application of object "<<k<<" failed!"<<endl;
-      return;
-    }
-  }
-  gGeoManager->Export("./geom_misalBSEGMO.root");
-  
-  AliGeomManager::LoadGeometry("./geom_misalBSEGMO.root");
-
-  // TOF part !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   Int_t nSMTOF = 18;
-  Int_t i;
-  Int_t j=18;
-  Double_t tofdx, tofdy, tofdz, dpsi, dtheta, dphi;
+  Int_t j=0;
+  Double_t smdx, smdy, smdz, dpsi, dtheta, dphi;
   TRandom *rnd   = new TRandom(2345);
   Double_t sigmatr = 0.4; // max shift in cm w.r.t. local ideal RS
   Double_t sigmarot = 0.06; // max rot in deg w.r.t. local ideal RS (~ 1 mrad)
   
-  for(i=0; i<18; i++) {
+  for(Int_t i=0; i<nSMTOF; i++) {
     TString symname(Form("TOF/sm%02d",i));
-    tofdx = rnd->Gaus(0.,sigmatr);
-    tofdy = rnd->Gaus(0.,sigmatr);
-    tofdz =0;
+    smdx = rnd->Gaus(0.,sigmatr);
+    smdy = rnd->Gaus(0.,sigmatr);
+    smdz =0;
     dpsi = 0.;
     dtheta = rnd->Gaus(0.,sigmarot);
     dphi = 0.;
-    new(alobj[j++]) AliAlignObjParams(symname.Data(), dvoluid, tofdx, tofdy, tofdz, dpsi, dtheta, dphi, kFALSE);
+    new((*array)[j++]) AliAlignObjParams(symname.Data(), dvoluid, smdx, smdy, smdz, dpsi, dtheta, dphi, kFALSE);
   }
-  for(Int_t k=18; k<36; k++){
-    AliAlignObjParams* smobj = (AliAlignObjParams*)array->UncheckedAt(k);
+  // Apply objects for TOF supermodules 
+  for(Int_t i=0; i<nSMTOF; i++){
+    AliAlignObjParams* smobj = (AliAlignObjParams*)array->UncheckedAt(i);
     if(!smobj->ApplyToGeometry()){
-      cout<<"application of object "<<k<<" failed!"<<endl;
+      cout<<"application of object "<<i<<" failed!"<<endl;
       return;
     }
   }
-  gGeoManager->Export("./geom_misalBSEGMO_tofSM.root");
 
-  AliGeomManager::LoadGeometry("./geom_misalBSEGMO_tofSM.root");
-  // tof strips as in residual
+  //Produce objects for TOF strips (same sigmas as for residual misalignment)
   AliGeomManager::ELayerID idTOF = AliGeomManager::kTOF;
 
   Double_t sdx=0.; 
@@ -157,47 +116,34 @@ void MakeTOFFullMisAlignment(){
     sdpsi = 0.;
     sdtheta = 0.;
     sdphi = 0.;
-    new(alobj[j++]) AliAlignObjParams(AliGeomManager::SymName(idTOF,i), AliGeomManager::LayerToVolUID(idTOF,i), sdx, sdy, sdz, sdpsi, sdtheta, sdphi, kFALSE);
+    new((*array)[j++]) AliAlignObjParams(AliGeomManager::SymName(idTOF,i), AliGeomManager::LayerToVolUID(idTOF,i), sdx, sdy, sdz, sdpsi, sdtheta, sdphi, kFALSE);
   }
 
-  const char* macroname = "MakeTOFFullMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
-    // save on file
+    // save in file
     const char* filename = "TOFfullMisalignment.root";
     TFile f(filename,"RECREATE");
     if(!f){
       Error(macroname,"cannot open file for output\n");
       return;
     }
-    Info(macroname,"Saving alignment objects to the file %s", filename);
+    Info(macroname,"Saving alignment objects in file %s", filename);
     f.cd();
     f.WriteObject(array,"TOFAlignObjs","kSingleKey");
     f.Close();
   }else{
     // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
     Info(macroname,"Saving alignment objects in CDB storage %s",
         Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData* md = new AliCDBMetaData();
     md->SetResponsible("Silvia Arcelli");
-    md->SetComment("Full misalignment for TOF and FRAME");
+    md->SetComment("Full misalignment for TOF");
     md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
     AliCDBId id("TOF/Align/Data",0,AliCDBRunRange::Infinity());
     storage->Put(array,id,md);
   }
 
   array->Delete();
-  gGeoManager = 0x0;
 
 }
 
index c5b80b9478b771e7f3589e7af9439634b5e79660..35672865de66db6d237c063b6d98cfea5dc042d6 100644 (file)
@@ -4,15 +4,35 @@ void MakeTOFResMisAlignment(){
   TClonesArray *array = new TClonesArray("AliAlignObjParams",2000);
   TClonesArray &alobj = *array;
    
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  const char* macroname = "MakeTOFResMisAlignment.C";
 
-  AliAlignObjParams a;
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
 
   AliGeomManager::ELayerID idTOF = AliGeomManager::kTOF;
   Int_t i;
@@ -22,7 +42,7 @@ void MakeTOFResMisAlignment(){
   Double_t dz=0.;
   Double_t  dpsi, dtheta, dphi;
   TRandom *rnd   = new TRandom(4357);
-  Double_t sigmatr = 0.1; // max shift in cm w.r.t. local ideal RS
+  Double_t sigmatr = 0.1; // sigma (in cm) for shift w.r.t. local ideal RS
 
   for(i=0; i<AliGeomManager::LayerSize(idTOF); i++) {
     dx = 0;
@@ -35,7 +55,6 @@ void MakeTOFResMisAlignment(){
     j++;
   }
 
-  const char* macroname = "MakeTOFResMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "TOFresidualMisalignment.root";
@@ -50,19 +69,6 @@ void MakeTOFResMisAlignment(){
     f.Close();
   }else{
     // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-        Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData* md = new AliCDBMetaData();
     md->SetResponsible("Silvia Arcelli");
     md->SetComment("Residual misalignment for TOF, sigmatr=1mm in the local RS");
index ee9426584bb54d5ddb09b7dc5fb1cb229013d7de..e2d00e55e181cd3d6b138f7debdfba6e44e59475 100644 (file)
@@ -3,17 +3,9 @@ void MakeTOFZeroMisAlignment(){
   //
   TClonesArray *array = new TClonesArray("AliAlignObjParams",2000);
   TClonesArray &alobj = *array;
-   
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
-
-  AliAlignObjParams a;
+  const char* macroname = "MakeTOFZeroMisAlignment.C";
 
+   
   AliGeomManager::ELayerID idTOF = AliGeomManager::kTOF;
   Int_t i;
   Int_t j=0;
@@ -23,7 +15,6 @@ void MakeTOFZeroMisAlignment(){
     new(alobj[j++]) AliAlignObjParams(AliGeomManager::SymName(idTOF,i), AliGeomManager::LayerToVolUID(idTOF,i), dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
   }
 
-  const char* macroname = "MakeTOFZeroMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "TOFzeroMisalignment.root";
diff --git a/TPC/Align/Data/Run0_999999999_v0_s0.root b/TPC/Align/Data/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..ab4e208
Binary files /dev/null and b/TPC/Align/Data/Run0_999999999_v0_s0.root differ
diff --git a/TPC/Align/Data/Run0_9999999_v0_s0.root b/TPC/Align/Data/Run0_9999999_v0_s0.root
deleted file mode 100644 (file)
index 3052cb6..0000000
Binary files a/TPC/Align/Data/Run0_9999999_v0_s0.root and /dev/null differ
index dbae0686e8fced91aa4e29f1f82fe6f767fb2dc4..427e90bfd2cd717144aed9ebffd2d140cbe2210f 100644 (file)
@@ -1,19 +1,39 @@
 void MakeTPCFullMisAlignment(){
   // Create TClonesArray of full misalignment objects for TPC
   //
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
-
+  const char* macroname = "MakeTPCFullMisAlignment.C";
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
+                 
   TClonesArray *array = new TClonesArray("AliAlignObjParams",100);
   TClonesArray &alobj = *array;
   
   TRandom *rnd   = new TRandom(4357);
-  AliAlignObjParams o;
   Int_t j = 0;
   Double_t dx, dy, dz, dpsi, dtheta, dphi;
 
@@ -39,8 +59,6 @@ void MakeTPCFullMisAlignment(){
     }
   }
 
-
-  const char* macroname = "MakeTPCFullMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "TPCfullMisalignment.root";
@@ -55,19 +73,6 @@ void MakeTPCFullMisAlignment(){
     f.Close();
   }else{
     // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-        Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData* md = new AliCDBMetaData();
     md->SetResponsible("Marian Ivanov");
     md->SetComment("Full misalignment for TPC, sigmatr=0.01 and sigmarot=0.6 in the local RS");
index 62dabeb5d14bf46d7c913ca2bf25cd5e8c0edc2c..2c2598bad53eaa2b323e9979bbf0627076be47bf 100644 (file)
@@ -1,19 +1,40 @@
 void MakeTPCResMisAlignment(){
   // Create TClonesArray of residual misalignment objects for TPC
   //
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  const char* macroname = "MakeTPCResMisAlignment.C";
+
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
 
   TClonesArray *array = new TClonesArray("AliAlignObjParams",100);
   TClonesArray &alobj = *array;
   
   TRandom *rnd   = new TRandom(4357);
-  AliAlignObjParams o;
   Double_t dx, dy, dz, dpsi, dtheta, dphi;
   Int_t j = 0;
 
@@ -39,8 +60,6 @@ void MakeTPCResMisAlignment(){
     }
   }
 
-
-  const char* macroname = "MakeTPCResMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "TPCresidualMisalignment.root";
@@ -55,19 +74,6 @@ void MakeTPCResMisAlignment(){
     f.Close();
   }else{
     // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-        Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData* md = new AliCDBMetaData();
     md->SetResponsible("Marian Ivanov");
     md->SetComment("Residual misalignment for TPC, sigmatr=0.01 and sigmarot=0.6 in the local RS");
index 183c32f602557bffd87d19f66844d19cda404cd3..bb7febc662ef6f3f752baecdccfbf2ed55abb6a3 100644 (file)
@@ -1,18 +1,11 @@
 void MakeTPCZeroMisAlignment(){
   // Create TClonesArray of zero misalignment objects for TPC
   //
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  const char* macroname = "MakeTPCZeroMisAlignment.C";
 
   TClonesArray *array = new TClonesArray("AliAlignObjParams",100);
   TClonesArray &alobj = *array;
   
-  AliAlignObjParams o;
   Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
   Int_t j = 0;
 
@@ -27,8 +20,6 @@ void MakeTPCZeroMisAlignment(){
     }
   }
 
-
-  const char* macroname = "MakeTPCZeroMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "TPCzeroMisalignment.root";
diff --git a/TRD/Align/Data/Run0_999999999_v0_s0.root b/TRD/Align/Data/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..be8188c
Binary files /dev/null and b/TRD/Align/Data/Run0_999999999_v0_s0.root differ
diff --git a/TRD/Align/Data/Run0_9999999_v0_s0.root b/TRD/Align/Data/Run0_9999999_v0_s0.root
deleted file mode 100644 (file)
index 9890fe9..0000000
Binary files a/TRD/Align/Data/Run0_9999999_v0_s0.root and /dev/null differ
index 0318bb1f0bf868ad9c460c43afaa121c594b0fe8..d60f2928926db7ecccac2180b129745ca28649e5 100644 (file)
@@ -1,11 +1,74 @@
 void MakeTRDFullMisAlignment(){
   // Create TClonesArray of full misalignment objects for TRD
+  // Expects to read objects for FRAME
   // 
   TClonesArray *array = new TClonesArray("AliAlignObjParams",1000);
-  TClonesArray &alobj = *array;
-   
-  AliAlignObjParams a;
+  const char* macroname = "MakeTRDFullMisAlignment.C";
+
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
+                 
+  // load FRAME full misalignment objects (if needed, the macro
+  // for FRAME has to be ran in advance) and apply them to geometry
+  Info(macroname,"Loading FRAME alignment objects from CDB storage %s",
+      Storage.Data());
+  AliCDBPath fpath("GRP","Align","Data");
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    AliCDBEntry *eFrame = storage->Get(fpath.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    TClonesArray* arFrame = (TClonesArray*) eFrame->GetObject();
+    arFrame->Sort();
+    Int_t nvols = arFrame->GetEntriesFast();
+    Bool_t flag = kTRUE;
+    for(Int_t j=0; j<nvols; j++)
+      {
+       AliAlignObj* alobj = (AliAlignObj*) arFrame->UncheckedAt(j);
+       if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE;
+      }
+    if(!flag)
+      Fatal(macroname,"Error in the application of FRAME objects");
+  }else{
+    AliCDBEntry *eFrame = cdb->Get(fpath.GetPath());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    TClonesArray* arFrame = (TClonesArray*) eFrame->GetObject();
+    arFrame->Sort();
+    Int_t nvols = arFrame->GetEntriesFast();
+    Bool_t flag = kTRUE;
+    for(Int_t j=0; j<nvols; j++)
+      {
+       AliAlignObj* alobj = (AliAlignObj*) arFrame->UncheckedAt(j);
+       if (alobj->ApplyToGeometry() == kFALSE) flag = kFALSE;
+      }
+    if(!flag)
+      Fatal(macroname,"Error in the application of FRAME objects");
+  }
 
+   
   // sigmas for the supermodules
   Double_t smdx=0.3; // 3 mm
   Double_t smdy=0.3; // 3 mm
@@ -30,8 +93,6 @@ void MakeTRDFullMisAlignment(){
   UShort_t volid;
   const char *symname;
 
-  AliGeomManager::LoadGeometry("./geom_misalBSEGMO.root"); // geometry where the BSEGMO volumes have been misaligned
-
   // create the supermodules' alignment objects
   for (int i; i<18; i++) {
     TString sm_symname(Form("TRD/sm%02d",i));
@@ -44,7 +105,7 @@ void MakeTRDFullMisAlignment(){
     rx*=smrx;
     ry*=smry;
     rz*=smrz;
-    new(alobj[j++]) AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kFALSE);
+    new((*array)[j++]) AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kFALSE);
   }
 
   for(Int_t k=0; k<18; k++){
@@ -54,8 +115,7 @@ void MakeTRDFullMisAlignment(){
       return;
     }
   }
-  gGeoManager->Export("./geom_misalBSEGMO_trdSM.root");
-  AliGeomManager::LoadGeometry("./geom_misalBSEGMO_trdSM.root");
+
   // create the chambers' alignment objects
   ran = new TRandom(4357);
   for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) {
@@ -71,11 +131,10 @@ void MakeTRDFullMisAlignment(){
       rz*=chrz;
       volid = AliGeomManager::LayerToVolUID(iLayer,iModule);
       symname = AliGeomManager::SymName(volid);
-      new(alobj[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kFALSE);
+      new((*array)[j++]) AliAlignObjParams(symname,volid,dx,dy,dz,rx,ry,rz,kFALSE);
     }
   }
 
-  const char* macroname = "MakeTRDFullMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "TRDfullMisalignment.root";
@@ -90,19 +149,8 @@ void MakeTRDFullMisAlignment(){
     f.Close();
   }else{
     // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
     Info(macroname,"Saving alignment objects in CDB storage %s",
         Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData* md = new AliCDBMetaData();
     md->SetResponsible("Dariusz Miskowiec");
     md->SetComment("Full misalignment for TRD");
@@ -112,7 +160,6 @@ void MakeTRDFullMisAlignment(){
   }
 
   array->Delete();
-  gGeoManager = 0x0;
 }
 
 
index 7b31aefc3e62638ea4a255da30fc02d4f89e8377..b73d7e3b2ca2aacc6c4bbc24e623a5b41aecaf5f 100644 (file)
@@ -1,18 +1,37 @@
 void MakeTRDResMisAlignment(){
   // Create TClonesArray of residual misalignment objects for TRD
   //
+  const char* macroname = "MakeTRDResMisAlignment.C";
   TClonesArray *array = new TClonesArray("AliAlignObjParams",1000);
   TClonesArray &alobj = *array;
    
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
-
-  AliAlignObjParams a;
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
 
   // sigmas for the chambers
   Double_t chdx=0.002; // 20 microns
@@ -22,19 +41,26 @@ void MakeTRDResMisAlignment(){
   Double_t chry=0.3/1000/TMath::Pi()*180; // 0.3 mrad
   Double_t chrz=0.1/1000/TMath::Pi()*180; // 0.1 mrad
 
-  Double_t dx,dy,dz,rx,ry,rz;
+  Double_t dx=0.,dy=0.,dz=0.,rx=0.,ry=0.,rz=0.;
 
   Int_t j=0;
   TRandom *ran = new TRandom(4357);
   UShort_t volid;
-  const char *path;
+  const char* symname; 
 
+  // create the supermodules' alignment objects
+  for (int i; i<18; i++) {
+    TString sm_symname(Form("TRD/sm%02d",i));
+    new((*array)[j++])
+      AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kTRUE);
+  }
   // create the chambers' alignment objects
   for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) {
     for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(iLayer); iModule++) {
-      ran.Rannor(dx,rx);
-      ran.Rannor(dy,ry);
-      ran.Rannor(dz,rz);
+      ran->Rannor(dx,rx);
+      ran->Rannor(dy,ry);
+      ran->Rannor(dz,rz);
       dx*=chdx;
       dy*=chdy;
       dz*=chdz;
@@ -47,7 +73,6 @@ void MakeTRDResMisAlignment(){
     }
   }
 
-  const char* macroname = "MakeTRDResMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "TRDresidualMisalignment.root";
@@ -62,19 +87,6 @@ void MakeTRDResMisAlignment(){
     f.Close();
   }else{
     // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-        Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData* md = new AliCDBMetaData();
     md->SetResponsible("Dariusz Miskowiec");
     md->SetComment("Residual misalignment for TRD");
index afeeab85db23f6a673abb3fa89ca8a6cd54b88ce..6a81f23670e5c0bae16b9750be7d38ea4a39b29a 100644 (file)
@@ -1,18 +1,10 @@
 void MakeTRDZeroMisAlignment(){
   // Create TClonesArray of zero misalignment objects for TRD
   //
+  const char* macroname = "MakeTRDZeroMisAlignment.C";
   TClonesArray *array = new TClonesArray("AliAlignObjParams",1000);
   TClonesArray &alobj = *array;
    
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
-
-  AliAlignObjParams a;
 
   Double_t dx=0.,dy=0.,dz=0.,rx=0.,ry=0.,rz=0.;
 
@@ -20,7 +12,13 @@ void MakeTRDZeroMisAlignment(){
   UShort_t volid;
   const char *symname;
 
-  // create the chambers' alignment objects
+  // create the supermodules' alignment objects
+  for (int i; i<18; i++) {
+    TString sm_symname(Form("TRD/sm%02d",i));
+    new(alobj[j++]) AliAlignObjParams(sm_symname.Data(),0,dx,dy,dz,rx,ry,rz,kTRUE);
+  }
+  
+   // create the chambers' alignment objects
   for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) {
     for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(iLayer); iModule++) {
       volid = AliGeomManager::LayerToVolUID(iLayer,iModule);
@@ -29,7 +27,6 @@ void MakeTRDZeroMisAlignment(){
     }
   }
 
-  const char* macroname = "MakeTRDZeroMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "TRDzeroMisalignment.root";
diff --git a/VZERO/Align/Data/Run0_999999999_v0_s0.root b/VZERO/Align/Data/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..d2953b1
Binary files /dev/null and b/VZERO/Align/Data/Run0_999999999_v0_s0.root differ
diff --git a/VZERO/Align/Data/Run0_9999999_v0_s0.root b/VZERO/Align/Data/Run0_9999999_v0_s0.root
deleted file mode 100644 (file)
index 9ad094e..0000000
Binary files a/VZERO/Align/Data/Run0_9999999_v0_s0.root and /dev/null differ
index beb81e6b9cb41f759688b42b21a1ddc1450ee2c7..6e3003541fa90105a2917674140448b566aaace9 100644 (file)
@@ -1,26 +1,44 @@
 void MakeVZEROFullMisAlignment(){
   // Create TClonesArray of full misalignment objects for VZERO
   // 
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  const char* macroname = "MakeVZEROFullMisAlignment.C";
 
   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
 
-  AliAlignObjParams a;
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
 
   Double_t dx, dy, dz, dpsi, dtheta, dphi;
   TRandom *rnd   = new TRandom(4321);
   Double_t sigmatr = 0.1; // max shift in cm
   Double_t sigmarot = 0.5; // max rot in degrees
 
-  // null shifts and rotations
-
   const char *V0right="VZERO/V0C";
   const char *V0left="VZERO/V0A";
 
@@ -45,7 +63,6 @@ void MakeVZEROFullMisAlignment(){
   new(alobj[1]) AliAlignObjParams(V0left, volid, dx, dy, dz, dpsi, dtheta,
                                   dphi,kFALSE);
 
-  const char* macroname = "MakeVZEROFullMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "VZEROfullMisalignment.root";
@@ -60,19 +77,6 @@ void MakeVZEROFullMisAlignment(){
     f.Close();
   }else{
     // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-        Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData* md = new AliCDBMetaData();
     md->SetResponsible("Brigitte Cheynis");
     md->SetComment("Alignment objects for V0 full misalignment");
index fb4084b9ffb57269979ada32ab6bcdf555fa609a..ec7214d572b96ec52f953728478a1098c4a5908b 100644 (file)
@@ -1,18 +1,38 @@
 void MakeVZEROResMisAlignment(){
   // Create TClonesArray of residual misalignment objects for VZERO
   //
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  const char* macroname = "MakeVZEROResMisAlignment.C";
 
   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
 
-  AliAlignObjParams a;
+  // Activate CDB storage and load geometry from CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  AliCDBStorage* storage;
+  
+  if( gSystem->Getenv("TOCDB") == TString("kTRUE") ){
+    TString Storage = gSystem->Getenv("STORAGE");
+    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+      return;
+    }
+    storage = cdb->GetStorage(Storage.Data());
+    if(!storage){
+      Error(macroname,"Unable to open storage %s\n",Storage.Data());
+      return;
+    }
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    AliGeomManager::SetGeometry(geom);
+  }else{
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }    
 
   Double_t dx, dy, dz, dpsi, dtheta, dphi;
   TRandom *rnd   = new TRandom(4321);
@@ -41,7 +61,6 @@ void MakeVZEROResMisAlignment(){
   dphi = rnd->Gaus(0.,sigmarot);
   new(alobj[1]) AliAlignObjParams(V0left, volid, dx, dy, dz, dpsi, dtheta, dphi,kFALSE);
 
-  const char* macroname = "MakeVZEROResMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "VZEROresidualMisalignment.root";
@@ -56,19 +75,6 @@ void MakeVZEROResMisAlignment(){
     f.Close();
   }else{
     // save in CDB storage
-    TString Storage = gSystem->Getenv("STORAGE");
-    if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
-      Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
-      return;
-    }
-    Info(macroname,"Saving alignment objects in CDB storage %s",
-        Storage.Data());
-    AliCDBManager* cdb = AliCDBManager::Instance();
-    AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
-    if(!storage){
-      Error(macroname,"Unable to open storage %s\n",Storage.Data());
-      return;
-    }
     AliCDBMetaData* md = new AliCDBMetaData();
     md->SetResponsible("Brigitte Cheynis");
     md->SetComment("Alignment objects for V0 residual misalignment");
index 0ecdd800751c5fb9635a5fcd8cc7df628c41a1cc..1fc782ea7b6ebbbed6f716acdcf6fcda206f1fcf 100644 (file)
@@ -1,19 +1,11 @@
 void MakeVZEROZeroMisAlignment(){
   // Create TClonesArray of zero misalignment objects for VZERO
   //
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  const char* macroname = "MakeVZEROZeroMisAlignment.C";
 
   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
 
-  AliAlignObjParams a;
-
   Double_t dx, dy, dz, dpsi, dtheta, dphi;
 
   Int_t iIndex=0;
@@ -25,7 +17,6 @@ void MakeVZEROZeroMisAlignment(){
   TString V0left("VZERO/V0A");
   new(alobj[1]) AliAlignObjParams(V0left.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE);
 
-  const char* macroname = "MakeVZEROZeroMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save on file
     const char* filename = "VZEROzeroMisalignment.root";
diff --git a/ZDC/Align/Data/Run0_0_v0_s0.root b/ZDC/Align/Data/Run0_0_v0_s0.root
deleted file mode 100644 (file)
index 15f1f19..0000000
Binary files a/ZDC/Align/Data/Run0_0_v0_s0.root and /dev/null differ
diff --git a/ZDC/Align/Data/Run0_999999999_v0_s0.root b/ZDC/Align/Data/Run0_999999999_v0_s0.root
new file mode 100644 (file)
index 0000000..b1322b2
Binary files /dev/null and b/ZDC/Align/Data/Run0_999999999_v0_s0.root differ
index e6020725161c47b3cfaca602d731d54f245a49cb..e79f6eb3ed461e6f1b1c1dc58be8aaaa06c562ba 100644 (file)
@@ -1,19 +1,11 @@
 void MakeZDCFullMisAlignment(){
   // Create TClonesArray of full misalignment objects for ZDC
   //
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  const char* macroname = "MakeZDCFullMisAlignment.C";
 
   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
 
-  AliAlignObjParams a;
-
   Double_t dx=0., dy=2., dz=0.;
   Double_t dpsi=0., dtheta=0., dphi=0.;
 
@@ -27,7 +19,6 @@ void MakeZDCFullMisAlignment(){
   new(alobj[0]) AliAlignObjParams(ZDCn, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
   new(alobj[1]) AliAlignObjParams(ZDCp, volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE);
 
-  const char* macroname = "MakeZDCFullMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save in file
     const char* filename = "ZDCfullMisalignment.root";
index ea80762eaea0435bfbde40ac190b139607e62122..c9c42462e5f9fd1dde85ef553e99504581183a02 100644 (file)
@@ -1,19 +1,11 @@
 void MakeZDCResMisAlignment(){
   // Create TClonesArray of residual misalignment objects for ZDC
   // 
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  const char* macroname = "MakeZDCResMisAlignment.C";
 
   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
 
-  AliAlignObjParams a;
-
   Double_t dx=0., dy=0.05, dz=0.;
   Double_t dpsi=0., dtheta=0., dphi=0.;
 
@@ -27,7 +19,6 @@ void MakeZDCResMisAlignment(){
   new(alobj[0]) AliAlignObjParams(ZDCn, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
   new(alobj[1]) AliAlignObjParams(ZDCp, volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE);
 
-  const char* macroname = "MakeZDCResMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save in file
     const char* filename = "ZDCresidualMisalignment.root";
index fddda319ce52db5485d3bc5fe5b34df63b7f03d8..227b18d5305f96799b06ba49c4c1d66f59202a30 100644 (file)
@@ -1,19 +1,11 @@
 void MakeZDCZeroMisAlignment(){
   // Create TClonesArray of zero misalignment objects for ZDC
   // 
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
-  }
-  // needed for the constructors with local coordinates not to fail
+  const char* macroname = "MakeZDCZeroMisAlignment.C";
 
   TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
   TClonesArray &alobj = *array;
 
-  AliAlignObjParams a;
-
   Double_t dx=0., dy=0., dz=0.;
   Double_t dpsi=0., dtheta=0., dphi=0.;
 
@@ -27,7 +19,6 @@ void MakeZDCZeroMisAlignment(){
   new(alobj[0]) AliAlignObjParams(ZDCn, volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
   new(alobj[1]) AliAlignObjParams(ZDCp, volid, dx, dy, dz, dpsi, dtheta, dphi,kTRUE);
 
-  const char* macroname = "MakeZDCZeroMisAlignment.C";
   if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
     // save in file
     const char* filename = "ZDCzeroMisalignment.root";
index cb08f64fea46c0c8a002131614689c85cee39be0..4d2ed9f2a6dc57ae3a3d7a425c7d7b56ec2f4c3e 100644 (file)
@@ -1,5 +1,7 @@
+const char* GetARversion();
+
 void MakeAllDETsFullMisAlignment(Char_t* CDBstorage = "local://$HOME/Full"){
-  // Make full misalignment objects for all detectors
+   // Make full misalignment objects for all detectors
   // Pass different "CDBstorage" argument if needed (e.g. to fill
   // conditions' data base on alien) or set it to null string to have
   // the objects saved locally on file 
@@ -7,24 +9,48 @@ void MakeAllDETsFullMisAlignment(Char_t* CDBstorage = "local://$HOME/Full"){
   // in charge of producing the full misalignment objects as 
   // $ALICE_ROOT/DET/MakeDETFullMisAlignment.C
   //
+  const char* macroname="MakeAllDETsFullMisAlignment.C";
+
   TString strStorage(CDBstorage);
   if(strStorage.IsNull()){
     gSystem->Setenv("TOCDB","kFALSE");
   }else{  
     gSystem->Setenv("TOCDB","kTRUE");
     gSystem->Setenv("STORAGE",strStorage.Data());
-    gSystem->Setenv("ARVERSION","v4-05-08");
+    gSystem->Setenv("ARVERSION",GetARversion());
   }
 
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
+  // Load geometry from CDB updating it if we are producing the
+  // alignment objects for the CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  if(strStorage.IsNull()){ //if we produce the objects into a file
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }else{ // if we produce the objects in a CDB storage
+    // update geometry in it
+    Info(macroname,"Updating geometry in CDB storage %s",strStorage.Data());
+    gROOT->ProcessLine(".L $ALICE_ROOT/GRP/UpdateCDBIdealGeom.C");
+    UpdateCDBIdealGeom(strStorage.Data());
+    // load the same geometry from given CDB storage
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBStorage* storage = cdb->GetStorage(strStorage.Data());
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Couldn't load geometry data from CDB!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    if (!geom) Fatal(macroname,"Couldn't find TGeoManager in the specified CDB entry!");
+    AliGeomManager::SetGeometry(geom);
   }
+   
+  // run macro for non-sensitive modules
+  // (presently generates only FRAME alignment objects)
+  gSystem->Exec("aliroot -b -q $ALICE_ROOT/GRP/MakeSTRUCTFullMisAlignment.C");
 
-  TString dets = "EMCAL,FMD,ITS,MUON,PHOS,PMD,HMPID,T0,TOF,TPC,TRD,VZERO,ZDC";
-  TObjArray *detArray = dets.Tokenize(',');
+  // run macros for sensitive modules
+  TString sModules="EMCAL,FMD,HMPID,ITS,MUON,PMD,PHOS,T0,TRD,TPC,TOF,VZERO,ZDC";
+  TObjArray *detArray = sModules.Tokenize(',');
   TIter iter(detArray);
   TObjString *ostr;
   TString exec_det_macro;
@@ -42,3 +68,24 @@ void MakeAllDETsFullMisAlignment(Char_t* CDBstorage = "local://$HOME/Full"){
 
   return;
 }
+
+const char* GetARversion(){
+  // Get AliRoot version from $ALICE_ROOT/CVS/Repository file
+  // It's the best we can do without a GetVersion() method
+  TFile *fv= TFile::Open("$ALICE_ROOT/CVS/Repository?filetype=raw","READ");
+  Int_t size = fv->GetSize();
+  char *buf = new Char_t[size];
+  memset(buf, '\0', size);
+  fv->Seek(0);
+  const char* alirootv;
+  if ( fv->ReadBuffer(buf, size) ) {
+    Printf("Error reading AliRoot version from file to buffer!");
+    alirootv = "";
+  }
+  if(buf=="AliRoot"){
+    alirootv="HEAD";
+  }else{
+    alirootv = buf;
+  }
+  return alirootv;
+}
index fb9a284c0905e0a022776be41e3c40ac7fd17b3b..80646dfdaae715b8bb9141afba4c4396476d2512 100644 (file)
@@ -1,3 +1,5 @@
+const char* GetARversion();
+
 void MakeAllDETsResMisAlignment(Char_t* CDBstorage = "local://$HOME/Residual"){
   // Make residual misalignment objects for all detectors
   // Pass different "CDBstorage" argument if needed (e.g. to fill
@@ -7,24 +9,48 @@ void MakeAllDETsResMisAlignment(Char_t* CDBstorage = "local://$HOME/Residual"){
   // in charge of producing the residual misalignment objects as 
   // $ALICE_ROOT/DET/MakeDETResidualMisAlignment.C
   //
+  const char* macroname="MakeAllDETsResMisAlignment.C";
+
   TString strStorage(CDBstorage);
   if(strStorage.IsNull()){
     gSystem->Setenv("TOCDB","kFALSE");
   }else{  
     gSystem->Setenv("TOCDB","kTRUE");
     gSystem->Setenv("STORAGE",strStorage.Data());
-    gSystem->Setenv("ARVERSION","v4-05-08");
+    gSystem->Setenv("ARVERSION",GetARversion());
   }
 
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
+  // Load geometry from CDB updating it if we are producing the
+  // alignment objects for the CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  if(strStorage.IsNull()){ //if we produce the objects into a file
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }else{ // if we produce the objects in a CDB storage
+    // update geometry in it
+    Info(macroname,"Updating geometry in CDB storage %s",strStorage.Data());
+    gROOT->ProcessLine(".L $ALICE_ROOT/GRP/UpdateCDBIdealGeom.C");
+    UpdateCDBIdealGeom(strStorage.Data());
+    // load the same geometry from given CDB storage
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBStorage* storage = cdb->GetStorage(strStorage.Data());
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Couldn't load geometry data from CDB!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    if (!geom) Fatal(macroname,"Couldn't find TGeoManager in the specified CDB entry!");
+    AliGeomManager::SetGeometry(geom);
   }
+  
+  // run macro for non-sensitive modules
+  // (presently generates only FRAME alignment objects)
+  gSystem->Exec("aliroot -b -q $ALICE_ROOT/GRP/MakeSTRUCTResMisAlignment.C");
 
-  TString dets="EMCAL,FMD,HMPID,ITS,MUON,PHOS,PMD,T0,TOF,TPC,TRD,VZERO,ZDC";
-  TObjArray *detArray = dets.Tokenize(',');
+  // run macros for sensitive modules
+  TString sModules="EMCAL,FMD,HMPID,ITS,MUON,PMD,PHOS,T0,TRD,TPC,TOF,VZERO,ZDC";
+  TObjArray *detArray = sModules.Tokenize(',');
   TIter iter(detArray);
   TObjString *ostr;
   TString exec_det_macro;
@@ -42,3 +68,24 @@ void MakeAllDETsResMisAlignment(Char_t* CDBstorage = "local://$HOME/Residual"){
 
   return;
 }
+
+const char* GetARversion(){
+  // Get AliRoot version from $ALICE_ROOT/CVS/Repository file
+  // It's the best we can do without a GetVersion() method
+  TFile *fv= TFile::Open("$ALICE_ROOT/CVS/Repository?filetype=raw","READ");
+  Int_t size = fv->GetSize();
+  char *buf = new Char_t[size];
+  memset(buf, '\0', size);
+  fv->Seek(0);
+  const char* alirootv;
+  if ( fv->ReadBuffer(buf, size) ) {
+    Printf("Error reading AliRoot version from file to buffer!");
+    alirootv = "";
+  }
+  if(buf=="AliRoot"){
+    alirootv="HEAD";
+  }else{
+    alirootv = buf;
+  }
+  return alirootv;
+}
index 8d426053dd6d0fa4c2f112ecce9c6786ddbf5be9..37daf1dd174b138129c4d64813ad99a35ed48326 100644 (file)
@@ -1,28 +1,53 @@
-void MakeAllDETsZeroMisAlignment(Char_t* CDBstorage = "local://$HOME/Zero"){
+const char* GetARversion();
+
+void MakeAllDETsZeroMisAlignment(Char_t* CDBstorage = "local://$ALICE_ROOT"){
   // Make zero misalignment objects for all detectors
   // Pass different "CDBstorage" argument if needed (e.g. to fill
   // conditions' data base on alien) or set it to null string to have
   // the objects saved locally on file 
   //
+  const char* macroname="MakeAllDETsZeroMisAlignment.C";
+
   TString strStorage(CDBstorage);
   if(strStorage.IsNull()){
     gSystem->Setenv("TOCDB","kFALSE");
   }else{  
     gSystem->Setenv("TOCDB","kTRUE");
     gSystem->Setenv("STORAGE",strStorage.Data());
-    gSystem->Setenv("ARVERSION","v4-05-08");
+    gSystem->Setenv("ARVERSION",GetARversion());
   }
 
-  if(!AliGeomManager::GetGeometry()){
-    if(!(AliCDBManager::Instance())->IsDefaultStorageSet())
-      AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-      AliCDBManager::Instance()->SetRun(0);
-    AliGeomManager::LoadGeometry();
+  // Load geometry from CDB updating it if we are producing the
+  // alignment objects for the CDB
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
+  cdb->SetRun(0);
+  
+  if(strStorage.IsNull()){ //if we produce the objects into a file
+    AliGeomManager::LoadGeometry(); //load geom from default CDB storage
+  }else{ // if we produce the objects in a CDB storage
+    // update geometry in it
+    Info(macroname,"Updating geometry in CDB storage %s",strStorage.Data());
+    gROOT->ProcessLine(".L $ALICE_ROOT/GRP/UpdateCDBIdealGeom.C");
+    UpdateCDBIdealGeom(strStorage.Data(),"$ALICE_ROOT/macros/Config.C");    
+    // load the same geometry from given CDB storage
+    AliCDBPath path("GRP","Geometry","Data");
+    AliCDBStorage* storage = cdb->GetStorage(strStorage.Data());
+    AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
+    if(!entry) Fatal(macroname,"Couldn't load geometry data from CDB!");
+    entry->SetOwner(0);
+    TGeoManager* geom = (TGeoManager*) entry->GetObject();
+    if (!geom) Fatal(macroname,"Couldn't find TGeoManager in the specified CDB entry!");
+    AliGeomManager::SetGeometry(geom);
   }
+  
+  // run macro for non-sensitive modules
+  // (presently generates only FRAME alignment objects)
+  gSystem->Exec("aliroot -b -q $ALICE_ROOT/GRP/MakeSTRUCTZeroMisAlignment.C");
 
-
-  TString dets="EMCAL,FMD,HMPID,ITS,MUON,PMD,PHOS,T0,TRD,TPC,TOF,VZERO,ZDC";
-  TObjArray *detArray = dets.Tokenize(',');
+  // run macros for sensitive modules
+  TString sModules="EMCAL,FMD,HMPID,ITS,MUON,PMD,PHOS,T0,TRD,TPC,TOF,VZERO,ZDC";
+  TObjArray *detArray = sModules.Tokenize(',');
   TIter iter(detArray);
   TObjString *ostr;
   TString exec_det_macro;
@@ -40,3 +65,24 @@ void MakeAllDETsZeroMisAlignment(Char_t* CDBstorage = "local://$HOME/Zero"){
 
   return;
 }
+
+const char* GetARversion(){
+  // Get AliRoot version from $ALICE_ROOT/CVS/Repository file
+  // It's the best we can do without a GetVersion() method
+  TFile *fv= TFile::Open("$ALICE_ROOT/CVS/Repository?filetype=raw","READ");
+  Int_t size = fv->GetSize();
+  char *buf = new Char_t[size];
+  memset(buf, '\0', size);
+  fv->Seek(0);
+  const char* alirootv;
+  if ( fv->ReadBuffer(buf, size) ) {
+    Printf("Error reading AliRoot version from file to buffer!");
+    alirootv = "";
+  }
+  if(buf=="AliRoot"){
+    alirootv="HEAD";
+  }else{
+    alirootv = buf;
+  }
+  return alirootv;
+}