]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/MUONGenerateGeometryData.C
Adding ruleckecher files into the distribbution
[u/mrichter/AliRoot.git] / MUON / MUONGenerateGeometryData.C
index 03310ec5dcff30db66ad5fa440896c5738880499..c6e6d20c3f6c421daee478c51184c5f58c4c0a9c 100644 (file)
 
 // $Id$
 //
-// Macro for generating the geometry data files:
-// (volpath.dat, transform.dat, svmap.dat)
-// and local CDB storage with zero-misalignment
-// To be run from aliroot:
-// .x MUONGenerateGeometryData.C
-//
-// The generated files do not replace the existing ones
-// but have different names (with extension ".out").
-//
-//  Author: I. Hrivnacova, IPN Orsay
+/// \ingroup macros
+/// \file MUONGenerateGeometryData.C
+/// \brief Macro for generating the geometry data files:
+///  transform.dat, svmap.dat.
+///
+/// To be run from aliroot:
+///
+/// .x MUONGenerateGeometryData.C
+///
+/// The generated files do not replace the existing ones
+/// but have different names (with extension ".out").
+///
+/// \author: I. Hrivnacova, IPN Orsay
+
+#if !defined(__CINT__) || defined(__MAKECINT__)
+
+#include "AliMUON.h"
+#include "AliMUONGeometryBuilder.h"
+#include "AliMUONGeometryTransformer.h"
+
+#include "AliRun.h"
+#include "AliCDBManager.h"
+#include "AliMC.h"
+
+#include <Riostream.h>
+#include <TROOT.h>
+#include <TInterpreter.h>
 
-void MUONGenerateGeometryData(Bool_t volpaths = true,
-                              Bool_t transforms = true, 
+#endif
+
+void MUONGenerateGeometryData(Bool_t transforms = true, 
                               Bool_t svmaps = true,
-                             Bool_t zeroAlign = true)
+                              Bool_t writeEnvelopes = true)
 {
+/// \param transforms      option to generete transform.dat
+/// \param svmaps          option to generete svmap.dat
+/// \param writeEnvelope   option to include virtual envelopes
+///                        in the volume paths
+
+  // Default CDB and run number
+  AliCDBManager* man = AliCDBManager::Instance();
+  man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+  man->SetRun(0);
+
   // Initialize
-  gAlice->Init("$ALICE_ROOT/MUON/Config.C");
+  TString configFileName = "$ALICE_ROOT/MUON/Config.C";
+  gROOT->LoadMacro(configFileName.Data());
+  gInterpreter->ProcessLine(gAlice->GetConfigFunction());
+  gAlice->GetMCApp()->Init();
   cout << "Init done " << endl;
 
   // Get MUON detector
   AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
   if (!muon) {
-    AliFatal("MUON detector not defined.");
-    return 0;
+    cerr << "MUON detector not defined." << endl;
+    return;
   }  
 
   // Get geometry builder
   AliMUONGeometryBuilder* builder = muon ->GetGeometryBuilder();
-  
-  if (volpaths) {
-    cout << "Generating volpath file ..." << endl;
-    builder->GetTransformer()->WriteVolumePaths("volpath.dat.out");
-  }  
 
   if (transforms) {
     cout << "Generating transformation file ..." << endl;
@@ -57,26 +83,6 @@ void MUONGenerateGeometryData(Bool_t volpaths = true,
 
   if (svmaps) {
     cout << "Generating svmaps file ..." << endl;
-    builder->WriteSVMaps();
-  }  
-
-  if (zeroAlign) {
-    cout << "Generating CDB storage with zero misalignment data ..." << endl;
-   
-    // Create zero alignment data
-    TClonesArray* array 
-      = builder->GetTransformer()->CreateZeroAlignmentData();
-   
-    // CDB manager
-    AliCDBManager* cdbManager = AliCDBManager::Instance();
-    cdbManager->SetDefaultStorage("local://$ALICE_ROOT");
-  
-    AliCDBMetaData* cdbData = new AliCDBMetaData();
-    cdbData->SetResponsible("Dimuon Offline project");
-    cdbData->SetComment("MUON alignment objects for ideal geometry");
-    AliCDBId id("MUON/Align/Data", 0, 0); 
-    cdbManager->Put(array, id, cdbData);
-    
-    delete array;
+    builder->WriteSVMaps("svmap.dat.out", true, writeEnvelopes);
   }  
 }