]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Consolidation of the classes used to get the calibration data stores from OCDB and...
authorlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 5 Nov 2009 17:40:25 +0000 (17:40 +0000)
committerlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 5 Nov 2009 17:40:25 +0000 (17:40 +0000)
This is particularly important for AmoreMCH.
Note that AliMUONTrackerIO has been improved as well (e.g. we no longer have multiple temporary TString objects)
While doing so, two bugs were corrected :

- Bug fix : corrected the interpretation of the HV switches (important both for QA and reco)

- Bug fix : corrected the display of the config in mchview which was wrong (again, important for AmoreMCH)

19 files changed:
MUON/AliMUONMchViewApplication.cxx
MUON/AliMUONMchViewApplication.h
MUON/AliMUONPadStatusMaker.cxx
MUON/AliMUONPadStatusMaker.h
MUON/AliMUONPainterDataSourceFrame.cxx
MUON/AliMUONTrackerACFDataMaker.cxx [deleted file]
MUON/AliMUONTrackerACFDataMaker.h [deleted file]
MUON/AliMUONTrackerConditionDataMaker.cxx [new file with mode: 0644]
MUON/AliMUONTrackerConditionDataMaker.h [new file with mode: 0644]
MUON/AliMUONTrackerIO.cxx
MUON/AliMUONTrackerIO.h
MUON/AliMUONTrackerOCDBDataMaker.cxx [deleted file]
MUON/AliMUONTrackerOCDBDataMaker.h [deleted file]
MUON/CMake_libMUONgraphics.txt
MUON/MUONgraphicsLinkDef.h
MUON/MUONrecLinkDef.h
MUON/libMUONgraphics.pkg
MUON/libMUONrec.pkg
MUON/mchview.cxx

index fdf57a7ffb85cf89e6f3053be653bda480e0595c..9476c89f7e870fd0430eb5429ea2834f4267f5f3 100644 (file)
@@ -414,6 +414,14 @@ AliMUONMchViewApplication::ReleaseNotes()
   
   TGTextView* rn = new TGTextView(t);
 
+  rn->AddLine("1.02");
+  rn->AddLine("");
+  rn->AddLine("Internal change (merging of AliMUONTrackerACFDataMaker and AliMUONTrackerOCDBDataMaker into AliMUONTrackerConditionDataMaker)");
+  rn->AddLine("Added --ocdb option");
+  rn->AddLine("Corrected the display of the configuration");
+  rn->AddLine("Corrected the interpretation of the switches for the HV display");
+  rn->AddLine("");
+  
   rn->AddLine("1.01");
   rn->AddLine("");
   rn->AddLine("Added the configuration as a possible OCDB data source");
index 8b1260a613630c2fdafea2e245ef568b524707be..2260ff9b1da7db6ceb68855aee153c85de6f2aaf 100644 (file)
@@ -30,7 +30,7 @@ public:
   void HandleMenu(Int_t i);
 
   /// Return the version number of the mchview application
-  static const char* Version() { return "1.01"; }
+  static const char* Version() { return "1.02"; }
   
   /// Return the SVN revision  and version number of the mchview application
   static const char* FullVersion() { return Form("mchview Version %s ($Id$)",Version()); }
index f0fee0f561aaf06fad1fe51026e78ddf3bf549cb..6b8c3abaa75418db5d0e385a490cfcab2f359532 100644 (file)
@@ -264,6 +264,49 @@ AliMUONPadStatusMaker::HVSt12Status(Int_t detElemId, Int_t sector,
   return error;
 }
 
+//_____________________________________________________________________________
+Float_t
+AliMUONPadStatusMaker::SwitchValue(const TObjArray& dcsArray)
+{
+  /// Loop over the dcs value for a single switch to decide whether
+  /// we should consider it on or off
+  
+  // we'll count the number of ON/OFF for this pad, to insure
+  // consistency (i.e. if status changed during the run, we should
+  // at least notify this fact ;-) and hope it's not the norm)
+  Int_t nTrue(0);
+  Int_t nFalse(0);
+  TIter next(&dcsArray);
+  AliDCSValue* val;
+  
+  while ( ( val = static_cast<AliDCSValue*>(next()) ) )
+  {
+    if ( val->GetBool() )
+    {
+      ++nTrue;
+    }
+    else
+    {
+      ++nFalse;
+    }
+  }
+  
+  if ( (nTrue>0 && nFalse>0) )
+  {
+    // change of state during the run, consider it off
+    return 0.0;
+  }
+  
+  if ( nFalse ) 
+  {
+    /// switch = FALSE means the HV was flowding up to the PCB.
+    /// i.e. switch = FALSE = ON
+    return 1.0;    
+  }
+  
+  return 0.0;
+}
+
 //_____________________________________________________________________________
 Bool_t 
 AliMUONPadStatusMaker::HVSt345Status(Int_t detElemId, Int_t pcbIndex,
@@ -348,34 +391,8 @@ AliMUONPadStatusMaker::HVSt345Status(Int_t detElemId, Int_t pcbIndex,
     }
     else
     {
-      // we'll count the number of ON/OFF for this pad, to insure
-      // consistency (i.e. if status changed during the run, we should
-      // at least notify this fact ;-) and hope it's not the norm)
-      Int_t nTrue(0);
-      Int_t nFalse(0);
-      TIter next(values);
-      AliDCSValue* val;
-      
-      while ( ( val = static_cast<AliDCSValue*>(next()) ) )
-      {
-        if ( val->GetBool() )
-        {
-          ++nTrue;
-        }
-        else
-        {
-          ++nFalse;
-        }
-      }
-      
-      if ( (nTrue>0 && nFalse>0) )
-      {
-        AliWarning(Form("Status of HV Switch %s changed during this run nTrue=%d nFalse=%d! Will consider it OFF",
-                        hvSwitch.Data(),nTrue,nFalse));
-        error = kTRUE;
-      }
-      
-      if ( nFalse ) hvSwitchON = kFALSE;
+      Float_t sv = SwitchValue(*values);
+      if ( sv < 0.99 ) hvSwitchON = kFALSE;
     }
   }
   return error;
index fc62a331d3f3256e66d5881c688e4912b12af4ea..528533625547dedacbe84b5431e4b6063877e2ad 100644 (file)
@@ -113,6 +113,8 @@ public:
 
   void Report(UInt_t mask);
   
+  static Float_t SwitchValue(const TObjArray& dcsArray);
+  
 private:
   /// Not implemented
   AliMUONPadStatusMaker(const AliMUONPadStatusMaker&);
index d48913bf33941835affcdecbff944ccde2632626..4047a8212b1a6f15369b3e8c179337e69be65fd1 100644 (file)
@@ -24,9 +24,8 @@
 #include "AliMUONPainterHelper.h"
 #include "AliMUONPainterDataRegistry.h"
 #include "AliMUONRecoParam.h"
-#include "AliMUONTrackerACFDataMaker.h"
+#include "AliMUONTrackerConditionDataMaker.h"
 #include "AliMUONTrackerDataMaker.h"
-#include "AliMUONTrackerOCDBDataMaker.h"
 #include "AliRawReader.h"
 #include <TGButton.h>
 #include <TGComboBox.h>
@@ -174,14 +173,14 @@ AliMUONPainterDataSourceFrame::AliMUONPainterDataSourceFrame(const TGWindow* p,
     
     /// OCDB selection
     
+  fOCDBTypes->AddEntry("Config",7);
+  fOCDBTypes->AddEntry("Occupancy",4);
+  fOCDBTypes->AddEntry("HV",3);
   fOCDBTypes->AddEntry("Pedestals",0);
   fOCDBTypes->AddEntry("Gains",1);
-  fOCDBTypes->AddEntry("Capacitances",2);
-  fOCDBTypes->AddEntry("HV",3);
-  fOCDBTypes->AddEntry("Occupancy",4);
   fOCDBTypes->AddEntry("StatusMap",5);
   fOCDBTypes->AddEntry("Status",6);
-  fOCDBTypes->AddEntry("Config",7);
+  fOCDBTypes->AddEntry("Capacitances",2);
   fOCDBTypes->Select(0);
   fOCDBTypes->Resize(100,20);
     
@@ -209,14 +208,14 @@ AliMUONPainterDataSourceFrame::AliMUONPainterDataSourceFrame(const TGWindow* p,
     TGButton* openButtonACF = new TGPictureButton(fACFSelector,
                                                   gClient->GetPicture("fileopen.xpm"));
     openButtonACF->SetToolTipText("Click to open file dialog");
-    
-    fACFTypes->AddEntry("Pedestals",0);
-    fACFTypes->AddEntry("Gains",1);
-  fACFTypes->AddEntry("Capacitances",2);
-  fACFTypes->AddEntry("HV",3);
+
+  fACFTypes->AddEntry("Config",7);
   fACFTypes->AddEntry("Occupancy",4);
-    fACFTypes->Select(0);
-    fACFTypes->Resize(100,20);
+  fACFTypes->AddEntry("Pedestals",0);
+  fACFTypes->AddEntry("Gains",1);
+  fACFTypes->AddEntry("Capacitances",2);
+  fACFTypes->Select(0);
+  fACFTypes->Resize(100,20);
     
     fACFSelector->AddFrame(openButtonACF,new TGLayoutHints(kLHintsTop,5,5,5,5));                                      
     fACFSelector->AddFrame(fACFPath, new TGLayoutHints(kLHintsExpandX | kLHintsTop,5,5,5,5));
@@ -384,8 +383,8 @@ AliMUONPainterDataSourceFrame::CreateACFDataSource(const TString& acfPath, const
 {
   /// Create an ACF data source for a given (path,type) 
 
-  AliMUONVTrackerDataMaker* reader = new AliMUONTrackerACFDataMaker(acfPath.Data(),
-                                                                    type.Data());
+  AliMUONVTrackerDataMaker* reader = new AliMUONTrackerConditionDataMaker(acfPath.Data(),
+                                                                          type.Data());
   
   if ( reader->IsValid() ) 
   {
@@ -416,9 +415,9 @@ AliMUONPainterDataSourceFrame::CreateOCDBDataSource(const TString& cdbPath,
 {
   /// Create an OCDB data source for a given (path,runnumber,type) triplet
   
-  AliMUONVTrackerDataMaker* reader = new AliMUONTrackerOCDBDataMaker(cdbPath.Data(),
-                                                                       runNumber,
-                                                                       type.Data());
+  AliMUONVTrackerDataMaker* reader = new AliMUONTrackerConditionDataMaker(runNumber,
+                                                                          cdbPath.Data(),
+                                                                          type.Data());
   
   if ( reader->IsValid() ) 
   {
diff --git a/MUON/AliMUONTrackerACFDataMaker.cxx b/MUON/AliMUONTrackerACFDataMaker.cxx
deleted file mode 100644 (file)
index cf349fd..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/**************************************************************************
-* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
-*                                                                        *
-* Author: The ALICE Off-line Project.                                    *
-* Contributors are mentioned in the code where appropriate.              *
-*                                                                        *
-* Permission to use, copy, modify and distribute this software and its   *
-* documentation strictly for non-commercial purposes is hereby granted   *
-* without fee, provided that the above copyright notice appears in all   *
-* copies and that both the copyright notice and this permission notice   *
-* appear in the supporting documentation. The authors make no claims     *
-* about the suitability of this software for any purpose. It is          *
-* provided "as is" without express or implied warranty.                  *
-**************************************************************************/
-
-// $Id$
-
-#include "AliMUONTrackerACFDataMaker.h"
-
-#include "AliMUONTrackerData.h"
-#include "AliMUONTrackerIO.h"
-#include "AliMUON2DMap.h"
-#include "AliMUON1DMap.h"
-#include "AliLog.h"
-#include <TString.h>
-#include <TSystem.h>
-#include "AliMUONTrackerOCDBDataMaker.h"
-
-///\class AliMUONTrackerACFDataMaker
-///
-/// Producer of AliMUONVTrackerData from ASCII calibration files
-///
-///\author Laurent Aphecetche, Subatech
-
-///\cond CLASSIMP
-ClassImp(AliMUONTrackerACFDataMaker)
-///\endcond
-
-//_____________________________________________________________________________
-AliMUONTrackerACFDataMaker::AliMUONTrackerACFDataMaker(const char* acfPath,
-                                                        const char* type)
-: AliMUONVTrackerDataMaker(),
-  fIsValid(kTRUE),
-  fData(0x0),
-  fSource(Form("%s-%s",acfPath,type))
-{
-    /// Ctor
-
-    static Int_t number(0);
-    
-    ++number;
-    
-    AliMUONVStore* store(0x0);
-    
-    TString stype(type);
-    stype.ToUpper();
-    TString filename(gSystem->ExpandPathName(acfPath));
-    
-    if ( stype == "PEDESTALS" )
-    {
-      fData = AliMUONTrackerOCDBDataMaker::CreateDataPedestals(number);
-      store = new AliMUON2DMap(kTRUE);
-      AliMUONTrackerIO::ReadPedestals(filename.Data(),*store);
-    }
-    else if ( stype == "GAINS" ) 
-    {
-      fData = AliMUONTrackerOCDBDataMaker::CreateDataGains(number);
-      AliMUONVStore* gains = new AliMUON2DMap(kTRUE);
-      TString comment;
-      AliMUONTrackerIO::ReadGains(filename.Data(),*gains,comment);
-      store = AliMUONTrackerOCDBDataMaker::PatchGainStore(*gains);
-      delete gains;      
-    }
-    else if ( stype == "CAPACITANCES" )
-    {
-      fData = AliMUONTrackerOCDBDataMaker::CreateDataCapacitances(number);
-      store = new AliMUON1DMap(20000);
-      AliMUONTrackerIO::ReadCapacitances(filename.Data(),*store);
-    }
-    else if ( stype == "OCCUPANCY" )
-    {
-      store = new AliMUON2DMap(true);
-      AliMUONTrackerIO::ReadOccupancy(filename.Data(),*store);
-      fData = new AliMUONTrackerData(Form("OCC%d",number),"OccupancyMap",*store);
-      fData->SetDimensionName(0,"One");
-      fData->SetDimensionName(1,"Zero");
-    }
-  
-    if (!store)
-    {
-      fIsValid = kFALSE;
-      delete fData;
-      fData = 0x0;
-      AliError("Could not create store");
-      return;
-    }
-    
-  if (stype != "OCCUPANCY" ) 
-  {
-    fData->Add(*store);
-  }
-  
-  delete store;
-}
-
-//_____________________________________________________________________________
-AliMUONTrackerACFDataMaker::~AliMUONTrackerACFDataMaker()
-{
-  /// dtor
-  delete fData;
-}
-
-//_____________________________________________________________________________
-Long64_t 
-AliMUONTrackerACFDataMaker::Merge(TCollection*)
-{
-  /// Merge
-  AliError("Not implemented. Does it have sense ?");
-  return 0;
-}
-
diff --git a/MUON/AliMUONTrackerACFDataMaker.h b/MUON/AliMUONTrackerACFDataMaker.h
deleted file mode 100644 (file)
index 9b3eb23..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef ALIMUONTRACKERACFDATAMAKER_H
-#define ALIMUONTRACKERACFDATAMAKER_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
-* See cxx source for full Copyright notice                               */
-
-// $Id$
-
-/// \ingroup graphics
-/// \class AliMUONTrackerACFDataMaker
-/// \brief
-/// 
-// Author Laurent Aphecetche, Subatech
-
-#ifndef ALIMUONVTrackerDataMaker_H
-#  include "AliMUONVTrackerDataMaker.h"
-#endif
-#ifndef ROOT_TString
-#  include "TString.h"
-#endif
-
-class AliMUONTrackerACFDataMaker : public AliMUONVTrackerDataMaker
-{
-public:
-  AliMUONTrackerACFDataMaker(const char* acfPath="",
-                               const char* type="");
-  virtual ~AliMUONTrackerACFDataMaker();
-  
-  /// Whether we've been properly initialized or not
-  Bool_t IsValid() const { return fIsValid; }
-  
-  /// Return our data
-  virtual AliMUONVTrackerData* Data() const { return fData; }
-  
-  /// We are not runnable (i.e. # of event is fixed = 1)
-  virtual Bool_t IsRunnable() const { return kFALSE; }
-  
-  /// We cannot be running as we are not runnable...
-  virtual Bool_t IsRunning() const { return kFALSE; }
-  
-  /// N/A
-  virtual void SetRunning(Bool_t /*flag*/) {}
-  
-  /// N/A
-  virtual Bool_t ProcessEvent() { return kTRUE; }
-  
-  /// N/A
-  virtual void Rewind() { }
-  
-  /// Set our source URI
-  virtual void SetSource(const char* source) { fSource = source; }
-  
-  /// Get our source URI
-  virtual TString Source() const { return fSource; }
-  
-  /// Number of events is always 1
-    Int_t NumberOfEvents() const { return 1; }
-
-  virtual Long64_t Merge(TCollection* li);
-  
-private:
-  /// Not implemented
-  AliMUONTrackerACFDataMaker(const AliMUONTrackerACFDataMaker& rhs);
-  /// Not implemented
-  AliMUONTrackerACFDataMaker& operator=(const AliMUONTrackerACFDataMaker& rhs);
-  
-private:
-  Bool_t fIsValid; ///< whether we have valid data
-  AliMUONVTrackerData* fData; ///< our data
-  TString fSource; ///< our source
-  
-  ClassDef(AliMUONTrackerACFDataMaker,2) // Producer of AliMUONVTrackerData from ACF
-};
-
-#endif
diff --git a/MUON/AliMUONTrackerConditionDataMaker.cxx b/MUON/AliMUONTrackerConditionDataMaker.cxx
new file mode 100644 (file)
index 0000000..b63731b
--- /dev/null
@@ -0,0 +1,567 @@
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+*                                                                        *
+* Author: The ALICE Off-line Project.                                    *
+* Contributors are mentioned in the code where appropriate.              *
+*                                                                        *
+* Permission to use, copy, modify and distribute this software and its   *
+* documentation strictly for non-commercial purposes is hereby granted   *
+* without fee, provided that the above copyright notice appears in all   *
+* copies and that both the copyright notice and this permission notice   *
+* appear in the supporting documentation. The authors make no claims     *
+* about the suitability of this software for any purpose. It is          *
+* provided "as is" without express or implied warranty.                  *
+**************************************************************************/
+
+// $Id$
+
+#include "AliMUONTrackerConditionDataMaker.h"
+
+///\class AliMUONTrackerConditionDataMaker
+///
+/// Producer of AliMUONVTrackerData from OCDB or Ascii file condition data
+///
+/// \author Laurent Aphecetche, Subatech
+
+///\cond CLASSIMP
+ClassImp(AliMUONTrackerConditionDataMaker)
+///\endcond
+
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
+#include "AliDCSValue.h"
+#include "AliLog.h"
+#include "AliMpManuIterator.h"
+#include "AliMUON2DMap.h"
+#include "AliMUONCalibParamND.h"
+#include "AliMUONCalibParamNF.h"
+#include "AliMUONCalibParamNI.h"
+#include "AliMUONCalibrationData.h"
+#include "AliMUONDigitCalibrator.h"
+#include "AliMUONPadStatusMaker.h"
+#include "AliMUONPadStatusMapMaker.h"
+#include "AliMUONTrackerData.h"
+#include "AliMUONTrackerIO.h"
+#include "AliMpArrayI.h"
+#include "AliMpConstants.h"
+#include "AliMpDCSNamer.h"
+#include "AliMpDDLStore.h"
+#include "AliMpDEManager.h"
+#include "AliMpDetElement.h"
+#include "TClass.h"
+#include "TMap.h"
+#include "TObjString.h"
+#include "Riostream.h"
+#include "TString.h"
+#include <sstream>
+
+//_____________________________________________________________________________
+AliMUONTrackerConditionDataMaker::AliMUONTrackerConditionDataMaker(Int_t runNumber, const char* ocdbPath, const char* type):
+AliMUONVTrackerDataMaker(),
+fData(0x0),
+fSource(Form("%s-%010d-%s",ocdbPath,runNumber,type))
+{
+  /// ctor from OCDB
+
+  AliCDBStorage* storage = AliCDBManager::Instance()->GetDefaultStorage();
+       
+       AliCDBManager::Instance()->SetDefaultStorage(ocdbPath);
+
+  Int_t startOfValidity;
+  AliMUONVStore* store = CreateStore(runNumber,ocdbPath,type,startOfValidity);
+  AliInfo(Form("runNumber=%d ocdbPath=%s type=%s startOfValidity=%d store=%p",
+               runNumber,ocdbPath,type,startOfValidity,store));
+  if ( store )
+  {
+    fData = CreateData(type,*store,startOfValidity);
+  }  
+
+  delete store;
+  
+  AliCDBManager::Instance()->SetDefaultStorage(storage);
+}
+
+//_____________________________________________________________________________
+AliMUONTrackerConditionDataMaker::AliMUONTrackerConditionDataMaker(const char* filename, const char* type):
+AliMUONVTrackerDataMaker(),
+fData(0x0),
+fSource(Form("%s-%s",filename,type))
+{
+  /// ctor from an ASCII file
+  
+  TString sFilename(gSystem->ExpandPathName(filename));
+  
+  std::ifstream in(sFilename.Data());
+  if (in.good()) 
+  {
+    std::ostringstream stream;
+    char line[1024];
+    while ( in.getline(line,1024) )
+    {
+      stream << line << "\n";    
+    }
+  
+    in.close();
+  
+    Int_t dummy;
+    
+    AliMUONVStore* store = CreateStore(-1,stream.str().c_str(),type,dummy);
+    
+    if ( store )
+    {
+      fData = CreateData(type,*store,dummy);
+    }
+    delete store;
+  }
+}
+
+//_____________________________________________________________________________
+AliMUONTrackerConditionDataMaker::AliMUONTrackerConditionDataMaker(const char* data, const char* type, Bool_t) :
+AliMUONVTrackerDataMaker(),
+fData(0x0),
+fSource(Form("direct-%s",type))
+{
+  /// ctor from a string containing the ASCII data
+  /// the last parameter is there just to distinguish this ctor from the previous one
+  
+  Int_t dummy;
+  
+  AliMUONVStore* store = CreateStore(-1,data,type,dummy);
+  
+  if ( store )
+  {
+    fData = CreateData(type,*store,dummy);
+  }
+  delete store;
+  
+}
+
+//_____________________________________________________________________________
+AliMUONTrackerConditionDataMaker::~AliMUONTrackerConditionDataMaker()
+{
+  /// dtor
+  delete fData;
+}
+
+
+//_____________________________________________________________________________
+AliMUONVTrackerData*
+AliMUONTrackerConditionDataMaker::CreateData(const char* type, AliMUONVStore& store, Int_t startOfValidity)
+{
+  /// Create the data source 
+  AliMUONVTrackerData* data(0x0);
+  
+  TString stype(type);
+  stype.ToUpper();
+  
+  if ( stype == "CAPACITANCES" )
+  {    
+    data = new AliMUONTrackerData(Form("CAPA%d",startOfValidity),"Capacitances",2,kTRUE);
+    data->SetDimensionName(0,"Capa");
+    data->SetDimensionName(1,"Injection gain");    
+  }
+  else if ( stype == "CONFIG" ) 
+  {
+    data = new AliMUONTrackerData(Form("CONFIG%d",startOfValidity),"Configuration",1);
+    data->SetDimensionName(0,"there");
+    data->DisableChannelLevel();
+  }
+  else if ( stype == "GAINS" ) 
+  {
+    data = new AliMUONTrackerData(Form("GAIN%d",startOfValidity),"Gains",7,kTRUE);
+    data->SetDimensionName(0,"gain");
+    data->SetDimensionName(1,"a1");
+    data->SetDimensionName(2,"a2");
+    data->SetDimensionName(3,"thres");
+    data->SetDimensionName(4,"qual1");
+    data->SetDimensionName(5,"qual2");
+    data->SetDimensionName(6,"sat");    
+  }
+  else if ( stype == "HV" ) 
+  {
+    data = new AliMUONTrackerData(Form("HV%d",startOfValidity),"High Voltages",1); //,!isSingleEvent);
+               data->SetDimensionName(0,"HV");
+  }
+  else if ( stype == "OCCUPANCY" ) 
+  {
+    data = new AliMUONTrackerData(Form("OCC%d",startOfValidity),"OccupancyMap",store);
+    data->SetDimensionName(0,"One");
+    return data; // important to return now to avoid the data->Add(store) later on...
+  }
+  else if ( stype == "PEDESTALS" ) 
+  {
+    data  = new AliMUONTrackerData(Form("PED%d",startOfValidity),"Pedestals",2,kTRUE);
+    data->SetDimensionName(0,"Mean");
+    data->SetDimensionName(1,"Sigma");    
+  }
+  else if ( stype == "STATUS" ) 
+  {
+    data = new AliMUONTrackerData(Form("STATUS%d",startOfValidity),"Status",1,kTRUE);
+    data->SetDimensionName(0,"Bits");
+  }
+  else if ( stype == "STATUSMAP" ) 
+  {
+    data = new AliMUONTrackerData(Form("STATUSMAP%d",startOfValidity),"Status map",2,kTRUE);
+    data->SetDimensionName(0,"Bits");
+    data->SetDimensionName(1,"Dead");
+  }
+
+  if (!data)
+  {
+    AliErrorClass(Form("Could not create data for type=%s",type));
+    return 0x0;
+  }
+  
+  data->Add(store);
+  
+  return data;
+}
+
+//_____________________________________________________________________________
+AliMUONVStore*
+AliMUONTrackerConditionDataMaker::CreateHVStore(TMap& m)
+{
+  /// Create a store from hv values
+  
+  AliMUONVStore* store = new AliMUON2DMap(kTRUE);
+  
+  TIter next(&m);
+  TObjString* s;
+  AliMpDCSNamer hvNamer("TRACKER");
+  
+  while ( ( s = static_cast<TObjString*>(next()) ) )
+  {
+    TString name(s->String());
+    
+    Int_t hvIndex = hvNamer.DCSIndexFromDCSAlias(name.Data());
+
+    if ( hvIndex >= 0 )
+    {
+      // skip switches
+      continue;      
+    }
+
+    Int_t detElemId = hvNamer.DetElemIdFromDCSAlias(name.Data());
+    
+    if ( !AliMpDEManager::IsValidDetElemId(detElemId) )
+    {
+      AliErrorClass(Form("Got an invalid DE = %d from alias = %s",
+                         detElemId,name.Data()));
+      continue;
+    }
+    
+    Int_t nPCBs = hvNamer.NumberOfPCBs(detElemId);
+    Int_t nindex = nPCBs ? nPCBs : 1;
+    
+    AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
+    
+    for ( int i = 0 ; i < nindex; ++i )
+    {
+      Float_t switchValue(1.0);
+      
+      if ( nPCBs ) 
+      {
+        TString switchName(hvNamer.DCSSwitchName(detElemId,i));
+
+        TPair* p = static_cast<TPair*>(m.FindObject(switchName.Data()));
+        TObjArray* a = static_cast<TObjArray*>(p->Value());
+        
+        switchValue = AliMUONPadStatusMaker::SwitchValue(*a);                                           
+      }
+      
+      const AliMpArrayI* manus = de->ManusForHV(i);
+      
+      if (!manus) continue;
+      
+      TPair* p = static_cast<TPair*>(m.FindObject(name.Data()));
+      TObjArray* a = static_cast<TObjArray*>(p->Value());
+      TIter n2(a);
+      AliDCSValue* v;
+      Float_t hvValue(0);
+      Int_t n(0);
+      while ( ( v = static_cast<AliDCSValue*>(n2()) ) )
+      {
+        hvValue += v->GetFloat();
+        ++n;
+      }
+      hvValue *= switchValue;  
+      
+      if ( n ) hvValue /= n;
+      
+      Int_t nofChannels(AliMpConstants::ManuNofChannels());
+      
+      for ( Int_t k = 0 ; k < manus->GetSize(); ++k )
+      {
+        Int_t manuId = manus->GetValue(k);
+        AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(store->FindObject(detElemId,manuId));
+        if ( ! param ) 
+        {
+          param = new AliMUONCalibParamND(1,nofChannels,detElemId,manuId,0);
+          store->Add(param);
+        }
+        for ( Int_t j = 0 ; j < nofChannels; ++j )
+        {
+          param->SetValueAsDouble(j,0,hvValue);
+        }
+      }
+    }
+  }
+  
+  return store;
+  
+}
+
+//_____________________________________________________________________________
+AliMUONVStore*
+AliMUONTrackerConditionDataMaker::CreateStatusStore(Int_t runNumber)
+{
+  /// Get the status store
+  
+  AliMUONDigitCalibrator calibrator(runNumber);
+  
+  AliMUONVStore* sm = new AliMUON2DMap(kTRUE);
+  
+  AliMpManuIterator it;
+  Int_t detElemId, manuId;
+  
+  while (it.Next(detElemId,manuId))
+  {
+    AliMUONVCalibParam* np = new AliMUONCalibParamNI(1,AliMpConstants::ManuNofChannels(),detElemId,manuId);
+    for ( Int_t i = 0; i < np->Size(); ++i ) 
+    {
+      Int_t value = calibrator.PadStatus(detElemId,manuId,i);
+      np->SetValueAsInt(i,0,value); // "raw" value of the status
+    }
+    sm->Add(np);
+  }
+  
+  return sm;
+}
+
+//_____________________________________________________________________________
+AliMUONVStore*
+AliMUONTrackerConditionDataMaker::CreateStatusMapStore(Int_t runNumber)
+{
+  /// Get the status map, and polish it a bit for representation purposes
+  
+  AliMUONDigitCalibrator calibrator(runNumber);
+  
+  AliMUONVStore* sm = new AliMUON2DMap(kTRUE);
+  
+  AliMpManuIterator it;
+  Int_t detElemId, manuId;
+  
+  while (it.Next(detElemId,manuId))
+  {
+    AliMUONVCalibParam* np = new AliMUONCalibParamNI(2,AliMpConstants::ManuNofChannels(),detElemId,manuId);
+    for ( Int_t i = 0; i < np->Size(); ++i ) 
+    {
+      Int_t value = calibrator.StatusMap(detElemId,manuId,i);
+      Int_t channelIsDead = ( value & AliMUONPadStatusMapMaker::SelfDeadMask() );
+      np->SetValueAsInt(i,0,value); // "raw" value of the status map
+      np->SetValueAsInt(i,1,channelIsDead); // simple 0 or 1 for this channel
+    }
+    sm->Add(np);
+  }
+  
+  return sm;
+}
+
+//_____________________________________________________________________________
+AliMUONVStore*
+AliMUONTrackerConditionDataMaker::CreateStore(Int_t runNumber, 
+                                              const char* source, 
+                                              const char* type, 
+                                              Int_t& startOfValidity)
+{
+  /// Create the store by reading it from OCDB or from an ASCII file
+  
+  TString stype(type);
+  stype.ToUpper();
+  
+  AliMUONVStore* store(0x0);
+  
+  startOfValidity = 0;
+  
+  Bool_t ocdb = (runNumber>=0);
+  
+  if ( stype == "CAPACITANCES" )
+  {    
+    if ( ocdb ) 
+    {
+      store = AliMUONCalibrationData::CreateCapacitances(runNumber,&startOfValidity);    
+    }
+    else
+    {
+      store = new AliMUON2DMap(20000);
+      AliMUONTrackerIO::DecodeCapacitances(source,*store);
+    }
+  }
+  else if ( stype == "CONFIG" ) 
+  {
+    AliMUONVStore* tmp(0x0);
+    if ( ocdb ) 
+    {
+      tmp = AliMUONCalibrationData::CreateConfig(runNumber,&startOfValidity);
+    }
+    else
+    {
+      tmp = new AliMUON2DMap(kTRUE);
+      Bool_t changed(kFALSE);
+      AliMUONTrackerIO::DecodeConfig(source,*tmp,changed);
+    }
+    if ( tmp ) 
+    {
+      store = ExpandConfig(*tmp);      
+    }
+    delete tmp;
+  }
+  else if ( stype == "GAINS" ) 
+  {
+    AliMUONVStore* gains(0x0);
+    if ( ocdb ) 
+    {
+      gains = AliMUONCalibrationData::CreateGains(runNumber,&startOfValidity);
+    }
+    else
+    {
+      gains = new AliMUON2DMap(kTRUE);
+      TString comment;
+      AliMUONTrackerIO::DecodeGains(source,*gains,comment);
+    }
+    store = PatchGainStore(*gains);
+    delete gains;
+  }
+  else if ( stype == "OCCUPANCY" ) 
+  {
+    if ( ocdb ) 
+    {
+      store = AliMUONCalibrationData::CreateOccupancyMap(runNumber,&startOfValidity);
+    }
+    else
+    {
+      store = new AliMUON2DMap(kTRUE);
+      AliMUONTrackerIO::DecodeOccupancy(source,*store);
+    }
+  }
+  else if ( stype == "PEDESTALS" ) 
+  {
+    if ( ocdb ) 
+    {
+      store = AliMUONCalibrationData::CreatePedestals(runNumber,&startOfValidity);
+    }
+    else
+    {
+      store = new AliMUON2DMap(kTRUE);
+      AliMUONTrackerIO::DecodePedestals(source,*store);
+    }
+  }
+  
+  /// Below are source that can only be accessed from OCDB
+  if (!store && !ocdb) 
+  {
+    return 0x0;
+  }
+  
+  if ( stype == "HV" ) 
+  {
+    TMap* m = AliMUONCalibrationData::CreateHV(runNumber,&startOfValidity);
+               store = CreateHVStore(*m);
+    delete m;
+  }
+  else if ( stype == "STATUS" ) 
+  {
+    store = CreateStatusStore(runNumber);
+  }
+  else if ( stype == "STATUSMAP" ) 
+  {
+    store = CreateStatusMapStore(runNumber);
+  }
+  
+  return store;
+}
+
+//_____________________________________________________________________________
+AliMUONVStore*
+AliMUONTrackerConditionDataMaker::ExpandConfig(const AliMUONVStore& manuConfig)
+{
+  /// Convert the config from manu level to channel level (just to
+  /// be able to add it correctly to the trackerdata...)
+  
+  AliMUONVStore* store = manuConfig.Create();
+  
+  TIter next(manuConfig.CreateIterator());
+  AliMUONVCalibParam* p;
+  
+  while ( ( p = static_cast<AliMUONVCalibParam*>(next()) ) )
+  {
+    AliMUONVCalibParam* c = new AliMUONCalibParamNF(1,AliMpConstants::ManuNofChannels(),p->ID0(),p->ID1(),0.0);
+    
+    AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(p->ID0());
+    
+    for ( Int_t i = 0; i < c->Size(); ++i ) 
+    {
+      if ( de->IsExistingChannel(p->ID1(),i) )
+      {
+        c->SetValueAsFloat(i,0,1.0);        
+      }
+    }
+    
+    store->Add(c);
+  }
+  return store;
+}
+
+//_____________________________________________________________________________
+Long64_t 
+AliMUONTrackerConditionDataMaker::Merge(TCollection*)
+{
+  /// Merge
+  AliError("Not implemented. Does it have sense ?");
+  return 0;
+}
+
+//_____________________________________________________________________________
+AliMUONVStore*
+AliMUONTrackerConditionDataMaker::PatchGainStore(const AliMUONVStore& gains)
+{
+  /// Polish the gain store : 
+  /// a) adding a dimension, computed from a1, and called gain = 1/a1/0.2 
+  ///     where 0.2 is internal capa in pF, and gain is then in mV/fC
+  /// b) splitting the quality in two
+  
+  AliMUONVStore* store = gains.Create();
+  
+  TIter next(gains.CreateIterator());
+  AliMUONVCalibParam* param;
+  
+  while ( ( param = static_cast<AliMUONVCalibParam*>(next()) ) ) 
+  {
+    AliMUONVCalibParam* nd = new AliMUONCalibParamND(param->Dimension()+2,
+                                                     param->Size(),
+                                                     param->ID0(),
+                                                     param->ID1());
+    for ( Int_t i = 0; i < param->Size(); ++i ) 
+    {
+      
+      Int_t qual = param->ValueAsInt(i,3);
+                       Int_t q1 = (qual & 0xF0) >> 4;  // linear fit quality
+                       Int_t q2 = qual & 0xF;          // parabolic fit quality
+                       Double_t gain = 0.0;
+      
+      if ( param->ValueAsFloat(i,0) > 1E-9 ) gain = 1.0/param->ValueAsFloat(i,0)/0.2;
+                       
+      nd->SetValueAsDouble(i,0,gain); // gain
+      nd->SetValueAsDouble(i,1,param->ValueAsFloat(i,0)); // a1
+      nd->SetValueAsDouble(i,2,param->ValueAsFloat(i,1)); // a2
+      nd->SetValueAsInt(i,3,param->ValueAsInt(i,2)); // thres
+      nd->SetValueAsInt(i,4,q1); // qual1
+      nd->SetValueAsInt(i,5,q2); // qual2
+      nd->SetValueAsInt(i,6,param->ValueAsInt(i,4)); // sat
+    }
+    store->Add(nd);
+  }
+  
+  return store;
+}
+
diff --git a/MUON/AliMUONTrackerConditionDataMaker.h b/MUON/AliMUONTrackerConditionDataMaker.h
new file mode 100644 (file)
index 0000000..90a56e6
--- /dev/null
@@ -0,0 +1,88 @@
+#ifndef ALIMUONTRACKERCONDITIONDATAMAKER_H
+#define ALIMUONTRACKERCONDITIONDATAMAKER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice                               */
+
+// $Id$
+
+/// \ingroup rec
+/// \class AliMUONTrackerConditionDataMaker
+/// \brief Producer of AliMUONVTrackerData from OCDB or ASCII condition files
+/// 
+/// Author Laurent Aphecetche
+
+#ifndef ALIMUONVTRACKERDATAMAKER_H
+#  include "AliMUONVTrackerDataMaker.h"
+#endif
+#ifndef ROOT_TString
+#  include "TString.h"
+#endif
+
+class AliMUONVStore;
+class TMap;
+
+class AliMUONTrackerConditionDataMaker : public AliMUONVTrackerDataMaker
+{
+public:
+  AliMUONTrackerConditionDataMaker(Int_t runNumber, const char* ocdbPath, const char* type);
+  AliMUONTrackerConditionDataMaker(const char* filename, const char* type);
+  AliMUONTrackerConditionDataMaker(const char* data, const char* type, Bool_t);
+  virtual ~AliMUONTrackerConditionDataMaker();
+  
+  static AliMUONVStore* CreateStore(Int_t runNumber, const char* source, const char* type, Int_t& startOfValidity);
+  
+  static AliMUONVTrackerData* CreateData(const char* type, AliMUONVStore& source, Int_t startOfValidity);
+    
+  /// Whether we've been properly initialized or not
+  Bool_t IsValid() const { return (fData != 0x0); }
+  
+  /// Return our data
+  virtual AliMUONVTrackerData* Data() const { return fData; }
+  
+  /// We are not runnable (i.e. # of event is fixed = 1)
+  virtual Bool_t IsRunnable() const { return kFALSE; }
+  
+  /// We cannot be running as we are not runnable...
+  virtual Bool_t IsRunning() const { return kFALSE; }
+  
+  /// N/A
+  virtual void SetRunning(Bool_t /*flag*/) {}
+  
+  /// N/A
+  virtual Bool_t ProcessEvent() { return kTRUE; }
+  
+  /// N/A
+  virtual void Rewind() { }
+  
+  /// Set our source URI
+  virtual void SetSource(const char* source) { fSource = source; }
+  
+  /// Get our source URI
+  virtual TString Source() const { return fSource.Data(); }
+  
+  /// Number of events is always 1
+  Int_t NumberOfEvents() const { return 1; }
+  
+  virtual Long64_t Merge(TCollection* li);
+
+private:
+
+  AliMUONTrackerConditionDataMaker(const AliMUONTrackerConditionDataMaker& rhs);
+  AliMUONTrackerConditionDataMaker& operator=(const AliMUONTrackerConditionDataMaker& rhs);
+  
+  static AliMUONVStore* CreateHVStore(TMap& m);
+  static AliMUONVStore* CreateStatusMapStore(Int_t runNumber);
+  static AliMUONVStore* CreateStatusStore(Int_t runNumber);
+  static AliMUONVStore* PatchGainStore(const AliMUONVStore& gains);
+  static AliMUONVStore* ExpandConfig(const AliMUONVStore& config);
+  
+private:
+  AliMUONVTrackerData* fData; ///< our data
+  TString fSource; ///< source name
+  
+  ClassDef(AliMUONTrackerConditionDataMaker,1) // Producer of AliMUONVTrackerData from condition data (either OCDB or ascii files)
+};
+
+#endif
+
index c14047ad8434675034a3102beb7844ad1ae5a3d8..def0cdebfb68eddcb2b02aff4f001c51c3f07d2b 100644 (file)
@@ -79,17 +79,16 @@ AliMUONTrackerIO::ReadOccupancy(const char* filename,AliMUONVStore& occupancyMap
   char line[1024];
   while ( in.getline(line,1024) )
        stream << line << "\n";
-  datastring = TString(stream.str().c_str());
   
   in.close();
   
-  return DecodeOccupancy(datastring,occupancyMap);
+  return DecodeOccupancy(stream.str().c_str(),occupancyMap);
   
 }
 
 //_____________________________________________________________________________
 Int_t 
-AliMUONTrackerIO::DecodeOccupancy(TString data, AliMUONVStore& occupancyMap)
+AliMUONTrackerIO::DecodeOccupancy(const char* data, AliMUONVStore& occupancyMap)
 {
   /// Decode occupancy string created append values to the occupancyMap store.
   /// Expected format of the file is :
@@ -102,7 +101,7 @@ AliMUONTrackerIO::DecodeOccupancy(TString data, AliMUONVStore& occupancyMap)
   }
   
   char line[1024];
-  istringstream in(data.Data());
+  istringstream in(data);
   
   Int_t n(0);
   
@@ -172,22 +171,20 @@ AliMUONTrackerIO::ReadPedestals(const char* filename, AliMUONVStore& pedStore)
     return kCannotOpenFile;
   }
   
-  TString datastring;
   ostringstream stream;
   char line[1024];
   while ( in.getline(line,1024) )
        stream << line << "\n";
-  datastring = TString(stream.str().c_str());
   
   in.close();
 
-  return DecodePedestals(datastring,pedStore);
+  return DecodePedestals(stream.str().c_str(),pedStore);
   
 }
 
 //_____________________________________________________________________________
 Int_t 
-AliMUONTrackerIO::DecodePedestals(TString data, AliMUONVStore& pedStore)
+AliMUONTrackerIO::DecodePedestals(const char* data, AliMUONVStore& pedStore)
 {
   /// Read pedestal Data (produced by the MUONTRKda.exe program for instance)
   /// and append the read values into the given VStore
@@ -198,7 +195,7 @@ AliMUONTrackerIO::DecodePedestals(TString data, AliMUONVStore& pedStore)
   Int_t busPatchID, manuID, manuChannel;
   Float_t pedMean, pedSigma;
   Int_t n(0);
-  istringstream in(data.Data());
+  istringstream in(data);
   
   while ( in.getline(line,1024) )
   {
@@ -255,31 +252,29 @@ AliMUONTrackerIO::ReadGains(const char* filename, AliMUONVStore& gainStore,
     return kCannotOpenFile;
   }
   
-  TString datastring;
   ostringstream stream;
   char line[1024];
   while ( in.getline(line,1024) )
        stream << line << "\n";
-  datastring = TString(stream.str().c_str());
   
   in.close();
   
-  return DecodeGains(datastring,gainStore,comment);
+  return DecodeGains(stream.str().c_str(),gainStore,comment);
 
 }
 
 //_____________________________________________________________________________
 Int_t 
-AliMUONTrackerIO::DecodeGains(TString data, AliMUONVStore& gainStore,
-                            TString& comment)
+AliMUONTrackerIO::DecodeGains(const char* data, AliMUONVStore& gainStore,
+                              TString& comment)
 {
   /// Read gain file (produced by the MUONTRKda.exe program for instance)
   /// and append the read values into the given VStore
-  /// To be used when the input is a TString (for instance when getting data 
+  /// To be used when the input is a string (for instance when getting data 
   /// from AMORE DB).
   
   char line[1024];
-  istringstream in(data.Data());
+  istringstream in(data);
   Int_t busPatchID, manuID, manuChannel;
   Float_t a0, a1;
   Int_t thres;
@@ -326,7 +321,7 @@ AliMUONTrackerIO::DecodeGains(TString data, AliMUONVStore& gainStore,
             in.getline(line,1024);
             in.getline(line,1024);
             // then get run and dac values
-           Int_t iDAC(0);
+            Int_t iDAC(0);
             for ( Int_t i = 0; i < nDAC; ++i ) 
             {
               in.getline(line,1024);
@@ -402,20 +397,44 @@ AliMUONTrackerIO::DecodeGains(TString data, AliMUONVStore& gainStore,
 
 //_____________________________________________________________________________
 Int_t
-AliMUONTrackerIO::ReadCapacitances(const char* file, AliMUONVStore& capaStore)
+AliMUONTrackerIO::ReadCapacitances(const char* filename, AliMUONVStore& capaStore)
 {
   /// Read capacitance file
   /// and append the read values into the given VStore
   
-  ifstream in(gSystem->ExpandPathName(file));
-  if (in.bad()) return kCannotOpenFile;
+  TString sFilename(gSystem->ExpandPathName(filename));
+  
+  std::ifstream in(sFilename.Data());
+  if (!in.good()) 
+  {
+    return kCannotOpenFile;
+  }
+  
+  ostringstream stream;
+  char line[1024];
+  while ( in.getline(line,1024) )
+       stream << line << "\n";
+  
+  in.close();
+  
+  return DecodeCapacitances(stream.str().c_str(),capaStore);
+}
+
+//_____________________________________________________________________________
+Int_t
+AliMUONTrackerIO::DecodeCapacitances(const char* data, AliMUONVStore& capaStore)
+{
+  /// Read capacitances and append the read values into the given VStore
+  /// To be used when the input is a string (for instance when getting data 
+  /// from AMORE DB).
   
   Int_t ngenerated(0);
   
   char line[1024];
   Int_t serialNumber(-1);
   AliMUONVCalibParam* param(0x0);
-  
+  istringstream in(data);
+
   while ( in.getline(line,1024,'\n') )
   {
     if ( isdigit(line[0]) ) 
@@ -447,8 +466,6 @@ AliMUONTrackerIO::ReadCapacitances(const char* file, AliMUONVStore& capaStore)
     ++ngenerated;
   }
   
-  in.close();
-  
   return ngenerated;
 }
 
@@ -472,21 +489,19 @@ AliMUONTrackerIO::ReadConfig(const char* filename, AliMUONVStore& confStore, Boo
     return kCannotOpenFile;
   }
   
-  TString datastring;
   ostringstream stream;
   char line[1024];
   while ( in.getline(line,1024) )
        stream << line << "\n";
-  datastring = TString(stream.str().c_str());
   
   in.close();
   
-  return DecodeConfig(datastring,confStore,changed);
+  return DecodeConfig(stream.str().c_str(),confStore,changed);
 }
 
 //_____________________________________________________________________________
 Int_t 
-AliMUONTrackerIO::DecodeConfig(TString data, AliMUONVStore& confStore, Bool_t& changed)
+AliMUONTrackerIO::DecodeConfig(const char* data, AliMUONVStore& confStore, Bool_t& changed)
 {
   /// Read config data (produced by the MUONTRKda.exe program for instance)
   /// and append the read values into the given VStore
@@ -498,7 +513,7 @@ AliMUONTrackerIO::DecodeConfig(TString data, AliMUONVStore& confStore, Bool_t& c
   char line[1024];
   Int_t busPatchID, manuID;
   Int_t n(0);
-  istringstream in(data.Data());
+  istringstream in(data);
   
   while ( in.getline(line,1024) )
   {
@@ -537,7 +552,7 @@ AliMUONTrackerIO::DecodeConfig(TString data, AliMUONVStore& confStore, Bool_t& c
 
 //_____________________________________________________________________________
 Int_t 
-AliMUONTrackerIO::WriteConfig(ofstream& out, AliMUONVStore& confStore)
+AliMUONTrackerIO::WriteConfig(ofstream& out, const AliMUONVStore& confStore)
 {
   /// Write the conf store as an ASCII file
   /// Note that we are converting (back) the detElemId into a busPatchId
index ee61b0d93424ab7d272dc817e58454c813251fc7..77eb37bfd05525340ded513975fffe79d185215a 100644 (file)
@@ -26,19 +26,20 @@ public:
   virtual ~AliMUONTrackerIO();
 
   static Int_t ReadConfig(const char* filename, AliMUONVStore& confStore, Bool_t& changed);
-  static Int_t DecodeConfig(TString data, AliMUONVStore& confStore, Bool_t& changed);
-  static Int_t WriteConfig(ofstream& out, AliMUONVStore& confStore);
+  static Int_t DecodeConfig(const char* data, AliMUONVStore& confStore, Bool_t& changed);
+  static Int_t WriteConfig(ofstream& out, const AliMUONVStore& confStore);
   
   static Int_t ReadPedestals(const char* filename, AliMUONVStore& pedStore);
-  static Int_t DecodePedestals(TString data, AliMUONVStore& pedStore);
+  static Int_t DecodePedestals(const char* data, AliMUONVStore& pedStore);
   
   static Int_t ReadGains(const char* filename, AliMUONVStore& gainStore, TString& comment);
-  static Int_t DecodeGains(TString data, AliMUONVStore& gainStore, TString& comment);
+  static Int_t DecodeGains(const char* data, AliMUONVStore& gainStore, TString& comment);
   
   static Int_t ReadOccupancy(const char* filename, AliMUONVStore& occupancyMap);
-  static Int_t DecodeOccupancy(TString data, AliMUONVStore& occupancyMap);
+  static Int_t DecodeOccupancy(const char* data, AliMUONVStore& occupancyMap);
   
   static Int_t ReadCapacitances(const char* filename, AliMUONVStore& capaStore);
+  static Int_t DecodeCapacitances(const char* data, AliMUONVStore& capaStore);
   
   /// Error code constants
   enum ErrorCode
diff --git a/MUON/AliMUONTrackerOCDBDataMaker.cxx b/MUON/AliMUONTrackerOCDBDataMaker.cxx
deleted file mode 100644 (file)
index a443260..0000000
+++ /dev/null
@@ -1,390 +0,0 @@
-/**************************************************************************
-* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
-*                                                                        *
-* Author: The ALICE Off-line Project.                                    *
-* Contributors are mentioned in the code where appropriate.              *
-*                                                                        *
-* Permission to use, copy, modify and distribute this software and its   *
-* documentation strictly for non-commercial purposes is hereby granted   *
-* without fee, provided that the above copyright notice appears in all   *
-* copies and that both the copyright notice and this permission notice   *
-* appear in the supporting documentation. The authors make no claims     *
-* about the suitability of this software for any purpose. It is          *
-* provided "as is" without express or implied warranty.                  *
-**************************************************************************/
-
-// $Id$
-
-#include "AliMUONTrackerOCDBDataMaker.h"
-
-#include "AliCDBManager.h"
-#include "AliCDBStorage.h"
-#include "AliDCSValue.h"
-#include "AliLog.h"
-#include "AliMUON2DMap.h"
-#include "AliMUONCalibParamND.h"
-#include "AliMUONCalibParamNI.h"
-#include "AliMUONCalibrationData.h"
-#include "AliMUONDigitCalibrator.h"
-#include "AliMUONPadStatusMapMaker.h"
-#include "AliMUONTrackerData.h"
-#include "AliMUONVStore.h"
-#include "AliMpConstants.h"
-#include "AliMpDDLStore.h"
-#include "AliMpDetElement.h"
-#include "AliMpDEManager.h"
-#include "AliMpDCSNamer.h"
-#include "AliMpManuIterator.h"
-#include "Riostream.h"
-#include <TClass.h>
-#include <TMap.h>
-#include <TObjArray.h>
-#include <TObjString.h>
-#include <TString.h>
-
-///\class AliMUONTrackerOCDBDataMaker
-///
-/// Producer of AliMUONVTrackerData from OCDB data
-///
-///\author Laurent Aphecetche, Subatech
-
-///\cond CLASSIMP
-ClassImp(AliMUONTrackerOCDBDataMaker)
-///\endcond
-
-//_____________________________________________________________________________
-AliMUONTrackerOCDBDataMaker::AliMUONTrackerOCDBDataMaker(const char* ocdbPath,
-                                                           Int_t runNumber,
-                                                           const char* type)
-: AliMUONVTrackerDataMaker(),
-  fIsValid(kTRUE),
-  fData(0x0),
-  fSource(Form("%s-%010d-%s",ocdbPath,runNumber,type))
-{
-       /// Ctor
-       AliCDBStorage* storage = AliCDBManager::Instance()->GetDefaultStorage();
-       
-       AliCDBManager::Instance()->SetDefaultStorage(ocdbPath);
-       
-       AliMUONVStore* store(0x0);
-       
-       TString stype(type);
-       stype.ToUpper();
-       Bool_t isSingleEvent(kTRUE);
-       Int_t startOfValidity(0);
-       
-       if ( stype == "PEDESTALS" )
-       {
-               store = AliMUONCalibrationData::CreatePedestals(runNumber,&startOfValidity);
-               fData = CreateDataPedestals(startOfValidity);
-       }
-  else if ( stype == "CONFIG" ) 
-  {
-    store = AliMUONCalibrationData::CreateConfig(runNumber,&startOfValidity);
-    fData = new AliMUONTrackerData(Form("CONFIG%d",startOfValidity),"Configuration",1);
-    fData->SetDimensionName(0,"there");
-    fData->DisableChannelLevel();
-  }
-       else if ( stype == "OCCUPANCY" )
-       {
-               store = AliMUONCalibrationData::CreateOccupancyMap(runNumber,&startOfValidity);
-    
-    if (store)
-    {
-      fData = new AliMUONTrackerData(Form("OCC%d",runNumber),"OccupancyMap",*store);
-      fData->SetDimensionName(0,"One");
-      fData->SetDimensionName(1,"Zero");
-    }
-       }
-       else if ( stype == "GAINS" ) 
-       {
-    AliMUONVStore* gains = AliMUONCalibrationData::CreateGains(runNumber,&startOfValidity);
-    store = PatchGainStore(*gains);
-    delete gains;
-               fData = CreateDataGains(startOfValidity);
-       }
-       else if ( stype == "CAPACITANCES" )
-       {
-               store = AliMUONCalibrationData::CreateCapacitances(runNumber,&startOfValidity);
-               fData = CreateDataCapacitances(startOfValidity);
-       }
-       else if ( stype == "HV" )
-       {
-               TMap* m = AliMUONCalibrationData::CreateHV(runNumber,&startOfValidity);
-               fData = new AliMUONTrackerData(Form("HV%d",startOfValidity),"High Voltages",1,!isSingleEvent);
-               fData->SetDimensionName(0,"HV");
-               store = CreateHVStore(*m);
-               delete m;
-       }
-  else if ( stype == "STATUSMAP" )
-  {
-    fData = new AliMUONTrackerData(Form("STATUSMAP%d",runNumber),"Status map",2,kTRUE);
-    fData->SetDimensionName(0,"Bits");
-    fData->SetDimensionName(1,"Dead");
-    store = CreateStatusMapStore(runNumber);
-  }
-  else if ( stype == "STATUS" )
-  {
-    fData = new AliMUONTrackerData(Form("STATUS%d",runNumber),"Status",1,kTRUE);
-    fData->SetDimensionName(0,"Bits");
-    store = CreateStatusStore(runNumber);
-  }
-
-       AliCDBManager::Instance()->SetDefaultStorage(storage);
-       
-       if (!store)
-       {
-               fIsValid = kFALSE;
-               delete fData;
-               fData = 0x0;
-               AliError("Could not create store");
-               return;
-       }
-       
-  if ( stype != "OCCUPANCY" )
-  {
-    fData->Add(*store);
-       }
-  
-       delete store;
-}
-
-//_____________________________________________________________________________
-AliMUONTrackerOCDBDataMaker::~AliMUONTrackerOCDBDataMaker()
-{
-  /// dtor
-  delete fData;
-}
-
-//_____________________________________________________________________________
-AliMUONVTrackerData*
-AliMUONTrackerOCDBDataMaker::CreateDataCapacitances(Int_t runNumber)
-{
-  /// Create data to hold capa values
-  
-  AliMUONVTrackerData* data = new AliMUONTrackerData(Form("CAPA%d",runNumber),"Capacitances",2,kTRUE);
-  data->SetDimensionName(0,"Capa");
-  data->SetDimensionName(1,"Injection gain");
-  return data;
-}
-
-//_____________________________________________________________________________
-AliMUONVTrackerData*
-AliMUONTrackerOCDBDataMaker::CreateDataGains(Int_t runNumber)
-{
-  /// Create data to hold gains values
-  
-  AliMUONVTrackerData* data = new AliMUONTrackerData(Form("GAIN%d",runNumber),"Gains",7,kTRUE);
-  data->SetDimensionName(0,"gain");
-  data->SetDimensionName(1,"a1");
-  data->SetDimensionName(2,"a2");
-  data->SetDimensionName(3,"thres");
-  data->SetDimensionName(4,"qual1");
-  data->SetDimensionName(5,"qual2");
-  data->SetDimensionName(6,"sat");
-  return data;
-}
-
-//_____________________________________________________________________________
-AliMUONVStore*
-AliMUONTrackerOCDBDataMaker::PatchGainStore(AliMUONVStore& gains)
-{
-  /// Polish the gain store : 
-  /// a) adding a dimension, computed from a1, and called gain = 1/a1/0.2 
-  ///     where 0.2 is internal capa in pF, and gain is then in mV/fC
-  /// b) splitting the quality in two
-  
-  AliMUONVStore* store = gains.Create();
-  
-  TIter next(gains.CreateIterator());
-  AliMUONVCalibParam* param;
-  
-  while ( ( param = static_cast<AliMUONVCalibParam*>(next()) ) ) 
-  {
-    AliMUONVCalibParam* nd = new AliMUONCalibParamND(param->Dimension()+2,
-                                                     param->Size(),
-                                                     param->ID0(),
-                                                     param->ID1());
-    for ( Int_t i = 0; i < param->Size(); ++i ) 
-    {
-
-      Int_t qual = param->ValueAsInt(i,3);
-                       Int_t q1 = (qual & 0xF0) >> 4;  // linear fit quality
-                       Int_t q2 = qual & 0xF;          // parabolic fit quality
-                       Double_t gain = 0.0;
-      
-      if ( param->ValueAsFloat(i,0) > 1E-9 ) gain = 1.0/param->ValueAsFloat(i,0)/0.2;
-                       
-      nd->SetValueAsDouble(i,0,gain); // gain
-      nd->SetValueAsDouble(i,1,param->ValueAsFloat(i,0)); // a1
-      nd->SetValueAsDouble(i,2,param->ValueAsFloat(i,1)); // a2
-      nd->SetValueAsInt(i,3,param->ValueAsInt(i,2)); // thres
-      nd->SetValueAsInt(i,4,q1); // qual1
-      nd->SetValueAsInt(i,5,q2); // qual2
-      nd->SetValueAsInt(i,6,param->ValueAsInt(i,4)); // sat
-    }
-    store->Add(nd);
-  }
-  
-  return store;
-}
-
-//_____________________________________________________________________________
-AliMUONVTrackerData*
-AliMUONTrackerOCDBDataMaker::CreateDataPedestals(Int_t runNumber)
-{
-  /// Create data to hold pedestal values
-  
-  AliMUONVTrackerData* data  = new AliMUONTrackerData(Form("PED%d",runNumber),"Pedestals",2,kTRUE);
-  data->SetDimensionName(0,"Mean");
-  data->SetDimensionName(1,"Sigma");
-  return data;
-}
-
-//_____________________________________________________________________________
-AliMUONVStore*
-AliMUONTrackerOCDBDataMaker::CreateStatusStore(Int_t runNumber)
-{
-  /// Get the status store
-  
-  AliMUONDigitCalibrator calibrator(runNumber);
-  
-  AliMUONVStore* sm = new AliMUON2DMap(kTRUE);
-  
-  AliMpManuIterator it;
-  Int_t detElemId, manuId;
-  
-  while (it.Next(detElemId,manuId))
-  {
-    AliMUONVCalibParam* np = new AliMUONCalibParamNI(1,AliMpConstants::ManuNofChannels(),detElemId,manuId);
-    for ( Int_t i = 0; i < np->Size(); ++i ) 
-    {
-      Int_t value = calibrator.PadStatus(detElemId,manuId,i);
-      np->SetValueAsInt(i,0,value); // "raw" value of the status
-    }
-    sm->Add(np);
-  }
-  
-  return sm;
-}
-
-//_____________________________________________________________________________
-AliMUONVStore*
-AliMUONTrackerOCDBDataMaker::CreateStatusMapStore(Int_t runNumber)
-{
-  /// Get the status map, and polish it a bit for representation purposes
-
-  AliMUONDigitCalibrator calibrator(runNumber);
-  
-  AliMUONVStore* sm = new AliMUON2DMap(kTRUE);
-  
-  AliMpManuIterator it;
-  Int_t detElemId, manuId;
-  
-  while (it.Next(detElemId,manuId))
-  {
-    AliMUONVCalibParam* np = new AliMUONCalibParamNI(2,AliMpConstants::ManuNofChannels(),detElemId,manuId);
-    for ( Int_t i = 0; i < np->Size(); ++i ) 
-    {
-      Int_t value = calibrator.StatusMap(detElemId,manuId,i);
-      Int_t channelIsDead = ( value & AliMUONPadStatusMapMaker::SelfDeadMask() );
-      np->SetValueAsInt(i,0,value); // "raw" value of the status map
-      np->SetValueAsInt(i,1,channelIsDead); // simple 0 or 1 for this channel
-    }
-    sm->Add(np);
-  }
-  
-  return sm;
-}
-
-//_____________________________________________________________________________
-AliMUONVStore*
-AliMUONTrackerOCDBDataMaker::CreateHVStore(TMap& m)
-{
-  /// Create a store from hv values
-  
-  AliMUONVStore* store = new AliMUON2DMap(kTRUE);
-  
-  TIter next(&m);
-  TObjString* s;
-  AliMpDCSNamer hvNamer("TRACKER");
-  
-  while ( ( s = static_cast<TObjString*>(next()) ) )
-  {
-    TString name(s->String());
-
-    Int_t detElemId = hvNamer.DetElemIdFromDCSAlias(name.Data());
-    
-    if ( !AliMpDEManager::IsValidDetElemId(detElemId) )
-    {
-      AliErrorClass(Form("Got an invalid DE = %d from alias = %s",
-                         detElemId,name.Data()));
-      continue;
-    }
-    
-    Int_t nindex = 1;
-    Int_t hvIndex = hvNamer.DCSIndexFromDCSAlias(name.Data());
-    
-    if ( hvIndex > 0 && detElemId >= 500 ) 
-    {
-      AliFatalClass("FIXME"); // there's now switch aliases which should be taken into account
-    }
-
-    if ( hvIndex == -2 ) // we should consider switch alias there...
-    {
-      nindex = hvNamer.NumberOfPCBs(detElemId);
-      hvIndex = 0;
-    }
-
-    AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
-
-    for ( int i = 0 ; i < nindex; ++i )
-    {
-      Int_t index = hvIndex + i ;
-      
-      const AliMpArrayI* manus = de->ManusForHV(index);
-      
-      TPair* p = static_cast<TPair*>(m.FindObject(name.Data()));
-      TObjArray* a = static_cast<TObjArray*>(p->Value());
-      TIter n2(a);
-      AliDCSValue* v;
-      Float_t hvValue(0);
-      Int_t n(0);
-      while ( ( v = static_cast<AliDCSValue*>(n2()) ) )
-      {
-        hvValue += v->GetFloat();  
-        ++n;
-      }
-      if ( n ) hvValue /= n;
-      
-      Int_t nofChannels(AliMpConstants::ManuNofChannels());
-      
-      for ( Int_t k = 0 ; k < manus->GetSize(); ++k )
-      {
-        Int_t manuId = manus->GetValue(k);
-        AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(store->FindObject(detElemId,manuId));
-        if ( ! param ) 
-        {
-          param = new AliMUONCalibParamND(1,nofChannels,detElemId,manuId,0);
-          store->Add(param);
-        }
-        for ( Int_t j = 0 ; j < nofChannels; ++j )
-        {
-          param->SetValueAsDouble(j,0,hvValue);
-        }
-      }
-    }
-  }
-  
-  return store;
-  
-}
-
-//_____________________________________________________________________________
-Long64_t 
-AliMUONTrackerOCDBDataMaker::Merge(TCollection*)
-{
-  /// Merge
-  AliError("Not implemented. Does it have sense ?");
-  return 0;
-}
diff --git a/MUON/AliMUONTrackerOCDBDataMaker.h b/MUON/AliMUONTrackerOCDBDataMaker.h
deleted file mode 100644 (file)
index 615c5e8..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef ALIMUONTRACKEROCDBDATAMAKER_H
-#define ALIMUONTRACKEROCDBDATAMAKER_H
-
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
-* See cxx source for full Copyright notice                               */
-
-// $Id$
-
-/// \ingroup graphics
-/// \class AliMUONTrackerOCDBDataMaker
-/// \brief
-/// 
-// Author Laurent Aphecetche, Subatech
-
-#ifndef ALIMUONVTrackerDataMaker_H
-#  include "AliMUONVTrackerDataMaker.h"
-#endif
-#ifndef ROOT_TString
-#  include "TString.h"
-#endif
-
-class TMap;
-class AliMUONVStore;
-
-class AliMUONTrackerOCDBDataMaker : public AliMUONVTrackerDataMaker
-{
-public:
-  AliMUONTrackerOCDBDataMaker(const char* ocdbPath="",
-                               Int_t runNumber=0,
-                               const char* type="");
-  virtual ~AliMUONTrackerOCDBDataMaker();
-  
-  /// Whether we've been properly initialized or not
-  Bool_t IsValid() const { return fIsValid; }
-  
-  /// Return our data
-  virtual AliMUONVTrackerData* Data() const { return fData; }
-  
-  /// We are not runnable (i.e. # of event is fixed = 1)
-  virtual Bool_t IsRunnable() const { return kFALSE; }
-  
-  /// We cannot be running as we are not runnable...
-  virtual Bool_t IsRunning() const { return kFALSE; }
-  
-  /// N/A
-  virtual void SetRunning(Bool_t /*flag*/) {}
-  
-  /// N/A
-  virtual Bool_t ProcessEvent() { return kTRUE; }
-  
-  /// N/A
-  virtual void Rewind() { }
-  
-  /// Set our source URI
-  virtual void SetSource(const char* source) { fSource = source; }
-  
-  /// Get our source URI
-  virtual TString Source() const { return fSource; }
-  
-  /// Number of events is always 1
-    Int_t NumberOfEvents() const { return 1; }
-
-  virtual Long64_t Merge(TCollection* li);
-
-  static AliMUONVStore* CreateHVStore(TMap& hvMap);
-
-  static AliMUONVTrackerData* CreateDataPedestals(Int_t runNumber);
-  static AliMUONVTrackerData* CreateDataGains(Int_t runNumber);
-  static AliMUONVTrackerData* CreateDataCapacitances(Int_t runNumber);
-  
-  static AliMUONVStore* CreateStatusMapStore(Int_t runNumber);
-  static AliMUONVStore* CreateStatusStore(Int_t runNumber);
-
-  static AliMUONVStore* PatchGainStore(AliMUONVStore& gains);
-  
-private:
-  /// Not implemented
-  AliMUONTrackerOCDBDataMaker(const AliMUONTrackerOCDBDataMaker& rhs);
-  /// Not implemented
-  AliMUONTrackerOCDBDataMaker& operator=(const AliMUONTrackerOCDBDataMaker& rhs);
-  
-  
-private:
-  Bool_t fIsValid; ///< whether we have valid data
-  AliMUONVTrackerData* fData; ///< our data
-  TString fSource; ///< our source
-  
-  ClassDef(AliMUONTrackerOCDBDataMaker,2) // Producer of AliMUONVTrackerData from OCDB
-};
-
-#endif
index 700a8b6020d989194fcbd4a559d002699dd9becf..08103b648396843825ec2df9206763268aaaa094 100644 (file)
@@ -24,13 +24,11 @@ set(SRCS
   AliMUONAttPainterSelectorFrame.cxx 
   AliMUONPainterDataSourceFrame.cxx 
   AliMUONPainterDataSourceItem.cxx 
-  AliMUONTrackerOCDBDataMaker.cxx 
   AliMUONPainterEnv.cxx 
   AliMUONMchViewApplication.cxx 
   AliMUONTrackerDataHistogrammer.cxx 
   AliMUONTrackerDataWrapper.cxx 
   AliMUONTrackerDataCompareDialog.cxx 
-  AliMUONTrackerACFDataMaker.cxx
   AliMUONContourPainter.cxx
   AliMUONPolygon.cxx
   AliMUONContour.cxx
index 9d9e4e52b3035c745eb0adb10d6a078346f7175b..089242958cfd762c275620f24b616ca459ec1548 100644 (file)
 #pragma link C++ class AliMUONAttPainterSelectorFrame+;
 #pragma link C++ class AliMUONPainterDataSourceFrame+;
 #pragma link C++ class AliMUONPainterDataSourceItem+;
-#pragma link C++ class AliMUONTrackerOCDBDataMaker+;
 #pragma link C++ class AliMUONPainterEnv+;
 #pragma link C++ class AliMUONMchViewApplication+;
 #pragma link C++ class AliMUONTrackerDataHistogrammer+;
 #pragma link C++ class AliMUONTrackerDataWrapper+;
 #pragma link C++ class AliMUONTrackerDataCompareDialog+;
-#pragma link C++ class AliMUONTrackerACFDataMaker+;
 #pragma link C++ class AliMUONContourPainter+;
 #pragma link C++ class AliMUONPolygon+;
 #pragma link C++ class AliMUONContour+;
index 70f8dd75e3dbc57e6c0345ff85f8fc3f23c60d61..517616461555098979f0b61595b24483bb15032c 100644 (file)
@@ -72,6 +72,7 @@
 
 #pragma link C++ class AliMUONVTrackerDataMaker+;
 #pragma link C++ class AliMUONTrackerDataMaker+;
+#pragma link C++ class AliMUONTrackerConditionDataMaker+;
 
 #pragma link C++ class AliMUONQAMappingCheck+;
 
index ca1d4bc9f2c12a6baa18d35927f72855e6c98969..4d5e3ce23cbba34170656e2ec0ad8bb5cf1896eb 100644 (file)
@@ -24,13 +24,11 @@ SRCS:=  AliMUONVPainter.cxx \
   AliMUONAttPainterSelectorFrame.cxx \
   AliMUONPainterDataSourceFrame.cxx \
   AliMUONPainterDataSourceItem.cxx \
-  AliMUONTrackerOCDBDataMaker.cxx \
   AliMUONPainterEnv.cxx \
   AliMUONMchViewApplication.cxx \
   AliMUONTrackerDataHistogrammer.cxx \
   AliMUONTrackerDataWrapper.cxx \
   AliMUONTrackerDataCompareDialog.cxx \
-  AliMUONTrackerACFDataMaker.cxx \
   AliMUONContourPainter.cxx \
   AliMUONPolygon.cxx \
   AliMUONContour.cxx \
index d6ec11d768f2373fdbfea07b8c626c14ce2c79dd..0d597248047c9b65e17d754929796bee66c60c0d 100644 (file)
@@ -53,7 +53,8 @@ SRCS:= AliMUONReconstructor.cxx \
        AliMUONVTrackerDataMaker.cxx \
        AliMUONTrackerDataMaker.cxx \
        AliMUONQAMappingCheck.cxx \
-       AliMUONCDB.cxx
+       AliMUONCDB.cxx \
+       AliMUONTrackerConditionDataMaker.cxx
        
 HDRS:= $(SRCS:.cxx=.h)
 
index b0debd5b0380f427a4dab4bb68387b2c9c75248d..0ae4d893ee5fb3b5f9b80465f58b37f8be9f3728 100644 (file)
@@ -52,6 +52,7 @@ Int_t Usage()
   cout << "  --asciimapping : load mapping from ASCII files instead of OCDB (for debug and experts only...)" << endl;
   cout << "  --de detElemId : start by displaying the given detection element instead of the default view (which is all the chambers)" << endl;
   cout << "  --chamber chamberId (from 1 to 10) : start by displaying the given chamber instead of the default view (which is all the chambers)" << endl;
+  cout << "  --ocdb ocdbPath : read the mapping from the given OCDB" << endl;
   return -1;
 }
 
@@ -73,6 +74,7 @@ int main(int argc, char** argv)
   Int_t gix, giy;
   Int_t gox,goy;
   Bool_t ASCIImapping(kFALSE);
+  TString defaultOCDB("local://$ALICE_ROOT/OCDB");
   
   for ( Int_t i = 0; i <= args.GetLast(); ++i ) 
   {
@@ -108,6 +110,13 @@ int main(int argc, char** argv)
       nok += 2;
       ++i;      
     }
+    else if ( a == "--ocdb" )
+    {
+      defaultOCDB = static_cast<TObjString*>(args.At(i+1))->String();
+      cout << "Using default storage  = " << defaultOCDB.Data() << endl;
+      nok += 2;
+      ++i;
+    }
     else
     {
       return Usage();
@@ -121,7 +130,7 @@ int main(int argc, char** argv)
   
   AliWarningGeneral("main","FIXME ? Remove default storage and run number from here...");
   
-  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+  AliCDBManager::Instance()->SetDefaultStorage(defaultOCDB.Data());
   AliCDBManager::Instance()->SetRun(0);
  
   if ( ASCIImapping )