]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Propagated changes of interface of calibration stores (Laurent)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 17 Jun 2007 20:40:41 +0000 (20:40 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 17 Jun 2007 20:40:41 +0000 (20:40 +0000)
MUON/AliMUON2DStoreValidator.cxx
MUON/AliMUON2DStoreValidator.h
MUON/AliMUONCDB.cxx
MUON/AliMUONCDB.h
MUON/AliMUONCalibrationData.cxx
MUON/AliMUONCalibrationData.h

index 370545b7c41f0d3dbbde45e8544d254cf39ea7f3..f8b79ad46be94dbe0069702b2dd364ce41ba3ac6 100644 (file)
@@ -21,7 +21,7 @@
 #include "AliMUONCheckItem.h"
 #include "AliMUONCheckItemIterator.h"
 #include "AliMpConstants.h"
-#include "AliMUONV2DStore.h"
+#include "AliMUONVStore.h"
 #include "AliMUONVCalibParam.h"
 #include "AliMpDEManager.h"
 #include "AliMpIntPair.h"
@@ -34,7 +34,9 @@
 /// \class AliMUON2DStoreValidator
 ///
 /// Determine which channels, manus, DEs, stations are missing
-/// from a 2DStore. This is mainly to be used during (shuttle) preprocessing
+/// from a VStore, which must be 2D, and the 2 dimensions must be
+/// (detElemId,manuId).
+/// This is mainly to be used during (shuttle) preprocessing
 /// to insure that what we'll put in the CDB is as complete as possible,
 /// and to detect possible problem.
 ///
 /// The list of missing things is kept in a structure of objects defined as :
 /// 
 /// fMissing = TObjArray[0..N tracking chambers]
+///
 /// fMissing[iChamber] = AliMUONCheckItem which contains n AliMUONCheckItem, 
 /// where n is the number of DE for that chamber
+///
 /// fMissing[iChamber]->GetItem(de) = AliMUONCheckItem which contains m
 /// AliMUONCheckItem where m is the number of Manu for that DE
+///
 /// fMissing[iChamber]->GetItem(de)->GetItem(manu) = AliMUONCheckItem which 
 /// contains k TObjString = Form("%d",manuChannel)
 ///
@@ -295,7 +300,7 @@ AliMUON2DStoreValidator::Report(TList& lines, const TObjArray& chambers)
 
 //_____________________________________________________________________________
 TObjArray* 
-AliMUON2DStoreValidator::Validate(const AliMUONV2DStore& store)
+AliMUON2DStoreValidator::Validate(const AliMUONVStore& store)
 {                                  
   /// Validate the store. Check only the presence of all manus (i.e.
   /// check nothing about the values themselves)
@@ -306,7 +311,7 @@ AliMUON2DStoreValidator::Validate(const AliMUONV2DStore& store)
 
 //_____________________________________________________________________________
 TObjArray* 
-AliMUON2DStoreValidator::Validate(const AliMUONV2DStore& store,
+AliMUON2DStoreValidator::Validate(const AliMUONVStore& store,
                                   Bool_t (*check)(const AliMUONVCalibParam&,Int_t))
 {
   /// Validate the store. 
@@ -327,7 +332,7 @@ AliMUON2DStoreValidator::Validate(const AliMUONV2DStore& store,
     Int_t detElemId = p->GetFirst();
     Int_t manuId = p->GetSecond();
     AliMUONVCalibParam* test = 
-      static_cast<AliMUONVCalibParam*>(store.Get(detElemId,manuId));
+      static_cast<AliMUONVCalibParam*>(store.FindObject(detElemId,manuId));
     if (!test)
     {
       // completely missing manu
@@ -354,7 +359,7 @@ AliMUON2DStoreValidator::Validate(const AliMUONV2DStore& store,
 
 //_____________________________________________________________________________
 TObjArray* 
-AliMUON2DStoreValidator::Validate(const AliMUONV2DStore& store,
+AliMUON2DStoreValidator::Validate(const AliMUONVStore& store,
                                   Float_t invalidFloatValue)
 {
   /// Validate the store. 
@@ -375,7 +380,7 @@ AliMUON2DStoreValidator::Validate(const AliMUONV2DStore& store,
     Int_t detElemId = p->GetFirst();
     Int_t manuId = p->GetSecond();
     AliMUONVCalibParam* test = 
-      static_cast<AliMUONVCalibParam*>(store.Get(detElemId,manuId));
+      static_cast<AliMUONVCalibParam*>(store.FindObject(detElemId,manuId));
     if (!test)
     {
       // completely missing manu
index 28841ddd932fc2b8aa23f60e8c59660011b74547..7a78688f5929359f7523dcbd96ff6a369696c63b 100644 (file)
@@ -17,7 +17,7 @@
 #  include "TObject.h"
 #endif
 
-class AliMUONV2DStore;
+class AliMUONVStore;
 class TList;
 class TObjArray;
 class AliMUONCheckItem;
@@ -29,15 +29,15 @@ public:
   AliMUON2DStoreValidator();
   virtual ~AliMUON2DStoreValidator();
   
-  TObjArray* Validate(const AliMUONV2DStore& store, Float_t invalidFloatValue);
+  TObjArray* Validate(const AliMUONVStore& store, Float_t invalidFloatValue);
 
-  TObjArray* Validate(const AliMUONV2DStore& store);
+  TObjArray* Validate(const AliMUONVStore& store);
   
-  TObjArray* Validate(const AliMUONV2DStore& store, 
+  TObjArray* Validate(const AliMUONVStore& store, 
                       Bool_t (*check)(const AliMUONVCalibParam&,Int_t));
 
   /// Return statuses
-  AliMUONV2DStore* GetStatus() const { return fStatus; }
+  AliMUONVStore* GetStatus() const { return fStatus; }
   
   /// Reports what is missing, trying to be as concise as possible.
   void Report(TList& lines) const;
@@ -65,7 +65,7 @@ private:
 private:
   TList* fManuList; //!< List of (DE,manuID) pairs.
   TObjArray* fChambers; //!< Array of AliMUONCheckItem.
-  AliMUONV2DStore* fStatus; //!< Statuses
+  AliMUONVStore* fStatus; //!< Statuses
   
   ClassDef(AliMUON2DStoreValidator,2) // Validator of 2DStore
 };
index be4e4823ea0becfa885c62371733f4e155c5ccee..e1ac639f93ffd441737059d2fccaa4dd5a0ff37e 100644 (file)
 #include "AliMUONCalibParamNI.h"
 #include "AliMUONConstants.h"
 #include "AliMUONHVNamer.h"
-#include "AliMUONObjectPair.h"
 #include "AliMUONTriggerEfficiencyCells.h"
 #include "AliMUONTriggerLut.h"
-#include "AliMUONV2DStore.h"
+#include "AliMUONVStore.h"
 #include "AliMUONVCalibParam.h"
 #include "AliMUONVCalibParam.h"
-#include "AliMUONVDataIterator.h"
+#include "AliMpConstants.h"
 #include "AliMpDDLStore.h"
 #include "AliMpDEIterator.h"
 #include "AliMpDEManager.h"
 ClassImp(AliMUONCDB)
 /// \endcond
 
-const Int_t AliMUONCDB::fgkMaxNofChannelsPerManu=64;
-
 namespace
 {
 //_____________________________________________________________________________
-void getBoundaries(const AliMUONV2DStore& store,
+void getBoundaries(const AliMUONVStore& store,
                    Float_t& x0min, Float_t& x0max,
                    Float_t& x1min, Float_t& x1max)
 {
@@ -85,17 +82,13 @@ void getBoundaries(const AliMUONV2DStore& store,
   x1min=1E30;
   x1max=-1E30;
   
-  AliMUONVDataIterator* it = store.Iterator();
-  
-  AliMUONObjectPair* p;
+  TIter next(store.CreateIterator());
+  AliMUONVCalibParam* value;
   
-  while ( ( p = dynamic_cast<AliMUONObjectPair*>(it->Next() ) ) )
+  while ( ( value = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
   {
-    AliMpIntPair* dm = dynamic_cast<AliMpIntPair*>(p->Key());
-    AliMUONVCalibParam* value = dynamic_cast<AliMUONVCalibParam*>(p->Value());
-    
-    Int_t detElemId = dm->GetFirst();
-    Int_t manuId = dm->GetSecond();
+    Int_t detElemId = value->ID0();
+    Int_t manuId = value->ID1();
     
     const AliMpVSegmentation* seg = 
       AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
@@ -116,7 +109,6 @@ void getBoundaries(const AliMUONV2DStore& store,
         x1max = TMath::Max(x1max,x1);
       }
     }
-    if (it->IsOwner()) delete p;
   }  
 }
 
@@ -126,7 +118,7 @@ void getBoundaries(const AliMUONV2DStore& store,
 AliMUONCDB::AliMUONCDB(const char* cdbpath)
 : TObject(),
   fCDBPath(cdbpath),
-  fManuList(AliMpManuList::ManuList())
+  fManuList(0x0)
 {
     /// ctor
 }
@@ -139,8 +131,22 @@ AliMUONCDB::~AliMUONCDB()
 }
 
 //_____________________________________________________________________________
-AliMUONV2DStore* 
-AliMUONCDB::Diff(AliMUONV2DStore& store1, AliMUONV2DStore& store2, 
+TList*
+AliMUONCDB::ManuList()
+{
+  /// return (and create if necessary) the list of (de,manu) pairs
+  if (!fManuList) 
+  {
+    AliInfo("Generating ManuList...");
+    fManuList = AliMpManuList::ManuList();
+    AliInfo("Manu List generated.");
+  }
+  return fManuList;
+}
+
+//_____________________________________________________________________________
+AliMUONVStore* 
+AliMUONCDB::Diff(AliMUONVStore& store1, AliMUONVStore& store2, 
                  const char* opt)
 {
   /// creates a store which contains store1-store2
@@ -157,33 +163,18 @@ AliMUONCDB::Diff(AliMUONV2DStore& store1, AliMUONV2DStore& store2,
     return 0x0;
   }
   
-  AliMUONV2DStore* d = static_cast<AliMUONV2DStore*>(store1.Clone());
+  AliMUONVStore* d = static_cast<AliMUONVStore*>(store1.Clone());
   
-  AliMUONVDataIterator* it = d->Iterator();
+  TIter next(d->CreateIterator());
   
-  AliMUONObjectPair* p;
+  AliMUONVCalibParam* param;
   
-  while ( ( p = dynamic_cast<AliMUONObjectPair*>(it->Next() ) ) )
+  while ( ( param = dynamic_cast<AliMUONVCalibParam*>(next() ) ) )
   {
-    AliMpIntPair* dm = dynamic_cast<AliMpIntPair*>(p->Key());
-    //FIXME: this might happen (if a full manu is missing, for instance)
-    //handle it.
-    if (!dm) 
-    {
-      cerr << "dm is null : FIXME: this might happen !" << endl;
-      delete d; 
-      return 0;
-    }
-    AliMUONVCalibParam* param = dynamic_cast<AliMUONVCalibParam*>(p->Value());
-    //FIXMENOT: this should *not* happen
-    if (!param) 
-    {
-      cerr << "param is null" << endl;
-      delete d;
-      return 0;
-    }
+    Int_t detElemId = param->ID0();
+    Int_t manuId = param->ID1();
     
-    AliMUONVCalibParam* param2 = dynamic_cast<AliMUONVCalibParam*>(store2.Get(dm->GetFirst(),dm->GetSecond()));
+    AliMUONVCalibParam* param2 = dynamic_cast<AliMUONVCalibParam*>(store2.FindObject(detElemId,manuId));
     //FIXME: this might happen. Handle it.
     if (!param2) 
     {
@@ -215,14 +206,13 @@ AliMUONCDB::Diff(AliMUONV2DStore& store1, AliMUONV2DStore& store2,
         param->SetValueAsFloat(i,j,value);
       }      
     }
-    if (it->IsOwner()) delete p;
   }
   return d;
 }
 
 //_____________________________________________________________________________
 void 
-AliMUONCDB::Plot(const AliMUONV2DStore& store, const char* name, Int_t nbins)
+AliMUONCDB::Plot(const AliMUONVStore& store, const char* name, Int_t nbins)
 {
   /// Make a plot of the first 1 or 2 dimensions of the AliMUONVCalibParam
   /// contained inside store.
@@ -256,7 +246,7 @@ AliMUONCDB::Plot(const AliMUONV2DStore& store, const char* name, Int_t nbins)
                   nbins,x1min,x1max);
   }
   
-  TIter next(fManuList);
+  TIter next(ManuList());
   AliMpIntPair* p;
   Int_t n(0);
   Int_t nPerStation[7];
@@ -273,7 +263,7 @@ AliMUONCDB::Plot(const AliMUONV2DStore& store, const char* name, Int_t nbins)
       AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
     
     AliMUONVCalibParam* value = 
-      dynamic_cast<AliMUONVCalibParam*>(store.Get(detElemId,manuId));
+      dynamic_cast<AliMUONVCalibParam*>(store.FindObject(detElemId,manuId));
     
     if (value)
     {
@@ -316,7 +306,6 @@ AliMUONCDB::MakeHVStore(TMap& aliasMap, Bool_t defaultValues)
   /// Create a HV store
   
   AliMUONHVNamer hvNamer;
-  TRandom random;
   
   TObjArray* aliases = hvNamer.GenerateAliases();
   
@@ -337,7 +326,7 @@ AliMUONCDB::MakeHVStore(TMap& aliasMap, Bool_t defaultValues)
       
       if (!defaultValues)
       {
-        Float_t r = random.Uniform();
+        Float_t r = gRandom->Uniform();
         if ( r < 0.007 ) value = kFALSE;      
       } 
       
@@ -356,7 +345,7 @@ AliMUONCDB::MakeHVStore(TMap& aliasMap, Bool_t defaultValues)
       for ( UInt_t timeStamp = 0; timeStamp < 60*15; timeStamp += 120 )
       {
         Float_t value = 1500;
-        if (!defaultValues) value = random.Gaus(1750,62.5);
+        if (!defaultValues) value = gRandom->Gaus(1750,62.5);
         AliDCSValue* dcsValue = new AliDCSValue(value,timeStamp);
         valueSet->Add(dcsValue);
       }
@@ -374,22 +363,20 @@ AliMUONCDB::MakeHVStore(TMap& aliasMap, Bool_t defaultValues)
 
 //_____________________________________________________________________________
 Int_t 
-AliMUONCDB::MakePedestalStore(AliMUONV2DStore& pedestalStore, Bool_t defaultValues)
+AliMUONCDB::MakePedestalStore(AliMUONVStore& pedestalStore, Bool_t defaultValues)
 {
   /// Create a pedestal store. if defaultValues=true, ped.mean=ped.sigma=1,
   /// otherwise mean and sigma are from a gaussian (with parameters
   /// defined below by the kPedestal* constants)
   
-  TIter next(fManuList);
+  TIter next(ManuList());
   
   AliMpIntPair* p;
   
   Int_t nchannels(0);
   Int_t nmanus(0);
   
-  Bool_t replace = kFALSE;
-  
-  const Int_t kChannels(64);
+  const Int_t kChannels(AliMpConstants::ManuNofChannels());
   const Float_t kPedestalMeanMean(200);
   const Float_t kPedestalMeanSigma(10);
   const Float_t kPedestalSigmaMean(1.0);
@@ -398,12 +385,12 @@ AliMUONCDB::MakePedestalStore(AliMUONV2DStore& pedestalStore, Bool_t defaultValu
   while ( ( p = (AliMpIntPair*)next() ) )
   {
     ++nmanus;
-    AliMUONVCalibParam* ped = new AliMUONCalibParamNF(2,kChannels,AliMUONVCalibParam::InvalidFloatValue());
-    
-    Int_t detElemId = p->GetFirst();
-        
+
+    Int_t detElemId = p->GetFirst();    
     Int_t manuId = p->GetSecond();
     
+    AliMUONVCalibParam* ped = new AliMUONCalibParamNF(2,kChannels,detElemId,manuId,AliMUONVCalibParam::InvalidFloatValue());
+    
     const AliMpVSegmentation* seg = 
       AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
     
@@ -439,7 +426,7 @@ AliMUONCDB::MakePedestalStore(AliMUONV2DStore& pedestalStore, Bool_t defaultValu
       ped->SetValueAsFloat(manuChannel,1,sigmaPedestal);
       
     }
-    Bool_t ok = pedestalStore.Set(detElemId,manuId,ped,replace);
+    Bool_t ok = pedestalStore.Add(ped);
     if (!ok)
     {
       AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
@@ -453,22 +440,20 @@ AliMUONCDB::MakePedestalStore(AliMUONV2DStore& pedestalStore, Bool_t defaultValu
 
 //_____________________________________________________________________________
 Int_t 
-AliMUONCDB::MakeCapacitanceStore(AliMUONV1DStore& capaStore, Bool_t defaultValues)
+AliMUONCDB::MakeCapacitanceStore(AliMUONVStore& capaStore, Bool_t defaultValues)
 {
   /// Create a capacitance store. if defaultValues=true, all capa are 1.0,
   /// otherwise they are from a gaussian with parameters defined in the
   /// kCapa* constants below.
   
-  TIter next(fManuList);
+  TIter next(ManuList());
   
   AliMpIntPair* p;
   
   Int_t nchannels(0);
   Int_t nmanus(0);
   Int_t nmanusOK(0); // manus for which we got the serial number
-  
-  Bool_t replace = kFALSE;
-  
+    
   const Float_t kCapaMean(1.0);
   const Float_t kCapaSigma(0.5);
   
@@ -482,17 +467,19 @@ AliMUONCDB::MakeCapacitanceStore(AliMUONV1DStore& capaStore, Bool_t defaultValue
     AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); 
     Int_t serialNumber = de->GetManuSerialFromId(manuId);
       
-    if ( serialNumber > 0 ) ++nmanusOK;
+    if ( serialNumber <= 0 ) continue;
+    
+    ++nmanusOK;
     
     const AliMpVSegmentation* seg = 
       AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
 
-    AliMUONVCalibParam* capa = static_cast<AliMUONVCalibParam*>(capaStore.Get(serialNumber));
+    AliMUONVCalibParam* capa = static_cast<AliMUONVCalibParam*>(capaStore.FindObject(serialNumber));
     
     if (!capa)
     {
-      capa = new AliMUONCalibParamNF(1,fgkMaxNofChannelsPerManu,1.0);
-      Bool_t ok = capaStore.Set(serialNumber,capa,replace);
+      capa = new AliMUONCalibParamNF(1,AliMpConstants::ManuNofChannels(),serialNumber,0,1.0);
+      Bool_t ok = capaStore.Add(capa);
       if (!ok)
       {
         AliError(Form("Could not set serialNumber=%d manuId=%d",serialNumber,manuId));
@@ -539,21 +526,19 @@ AliMUONCDB::MakeCapacitanceStore(AliMUONV1DStore& capaStore, Bool_t defaultValue
 
 //_____________________________________________________________________________
 Int_t 
-AliMUONCDB::MakeGainStore(AliMUONV2DStore& gainStore, Bool_t defaultValues)
+AliMUONCDB::MakeGainStore(AliMUONVStore& gainStore, Bool_t defaultValues)
 {  
   /// Create a gain store. if defaultValues=true, all gain are 1.0,
   /// otherwise they are from a gaussian with parameters defined in the
   /// kGain* constants below.
   
-  TIter next(fManuList);
+  TIter next(ManuList());
   
   AliMpIntPair* p;
   
   Int_t nchannels(0);
   Int_t nmanus(0);
-  
-  Bool_t replace = kFALSE;
-  
+    
   const Double_t kSaturation(3000);
   const Double_t kGainMean(1.0);
   const Double_t kGainSigma(0.05);
@@ -561,13 +546,17 @@ AliMUONCDB::MakeGainStore(AliMUONV2DStore& gainStore, Bool_t defaultValues)
   while ( ( p = (AliMpIntPair*)next() ) )
   {
     ++nmanus;
-    AliMUONVCalibParam* gain = 
-      new AliMUONCalibParamNF(2,fgkMaxNofChannelsPerManu,
-                              AliMUONVCalibParam::InvalidFloatValue());
 
     Int_t detElemId = p->GetFirst();
     Int_t manuId = p->GetSecond();
 
+    AliMUONVCalibParam* gain = 
+      new AliMUONCalibParamNF(2,AliMpConstants::ManuNofChannels(),
+                              detElemId,
+                              manuId,
+                              AliMUONVCalibParam::InvalidFloatValue());
+
+
     const AliMpVSegmentation* seg = 
       AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
 
@@ -597,7 +586,7 @@ AliMUONCDB::MakeGainStore(AliMUONV2DStore& gainStore, Bool_t defaultValues)
       gain->SetValueAsFloat(manuChannel,1,saturation);
       
     }
-    Bool_t ok = gainStore.Set(detElemId,manuId,gain,replace);
+    Bool_t ok = gainStore.Add(gain);
     if (!ok)
     {
       AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
@@ -610,7 +599,7 @@ AliMUONCDB::MakeGainStore(AliMUONV2DStore& gainStore, Bool_t defaultValues)
 
 //_____________________________________________________________________________
 Int_t
-AliMUONCDB::MakeLocalTriggerMaskStore(AliMUONV1DStore& localBoardMasks) const
+AliMUONCDB::MakeLocalTriggerMaskStore(AliMUONVStore& localBoardMasks) const
 {
   /// Generate local trigger masks store. All masks are set to FFFF
   
@@ -619,7 +608,7 @@ AliMUONCDB::MakeLocalTriggerMaskStore(AliMUONV1DStore& localBoardMasks) const
   // one single container (localBoardMasks)
   for ( Int_t i = 1; i <= 234; ++i )
   {
-    AliMUONVCalibParam* localBoard = new AliMUONCalibParamNI(1,8);
+    AliMUONVCalibParam* localBoard = new AliMUONCalibParamNI(1,8,i,0,0);
     for ( Int_t x = 0; x < 2; ++x )
     {
       for ( Int_t y = 0; y < 4; ++y )
@@ -629,27 +618,27 @@ AliMUONCDB::MakeLocalTriggerMaskStore(AliMUONV1DStore& localBoardMasks) const
         ++ngenerated;
       }
     }
-    localBoardMasks.Set(i,localBoard,kFALSE);
+    localBoardMasks.Add(localBoard);
   }
   return ngenerated;
 }
 
 //_____________________________________________________________________________
 Int_t
-AliMUONCDB::MakeRegionalTriggerMaskStore(AliMUONV1DStore& rtm) const
+AliMUONCDB::MakeRegionalTriggerMaskStore(AliMUONVStore& rtm) const
 {
   /// Make a regional trigger masks store. All masks are set to 3F
   
   Int_t ngenerated(0);
   for ( Int_t i = 0; i < 16; ++i )
   {
-    AliMUONVCalibParam* regionalBoard = new AliMUONCalibParamNI(1,16);
+    AliMUONVCalibParam* regionalBoard = new AliMUONCalibParamNI(1,16,i,0,0);
     for ( Int_t j = 0; j < 16; ++j )
     {
       regionalBoard->SetValueAsInt(j,0,0x3F);
       ++ngenerated;
     }
-    rtm.Set(i,regionalBoard,kFALSE);
+    rtm.Add(regionalBoard);
   }
   
   return ngenerated;
@@ -718,16 +707,18 @@ AliMUONCDB::WriteToCDB(const char* calibpath, TObject* object,
 
 //_____________________________________________________________________________
 Int_t 
-AliMUONCDB::MakeNeighbourStore(AliMUONV2DStore& neighbourStore)
+AliMUONCDB::MakeNeighbourStore(AliMUONVStore& neighbourStore)
 {
   /// Fill the neighbours store with, for each channel, a TObjArray of its
   /// neighbouring pads (including itself)
   
+  AliInfo("Generating NeighbourStore. This will take a while. Please be patient.");
+  
   TStopwatch timer;
   
   timer.Start(kTRUE);
   
-  TIter next(fManuList);
+  TIter next(ManuList());
   
   AliMpIntPair* p;
   
@@ -743,16 +734,16 @@ AliMUONCDB::MakeNeighbourStore(AliMUONV2DStore& neighbourStore)
     const AliMpVSegmentation* seg = 
       AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
     
-    AliMUONVCalibParam* calibParam = static_cast<AliMUONVCalibParam*>(neighbourStore.Get(detElemId,manuId));
+    AliMUONVCalibParam* calibParam = static_cast<AliMUONVCalibParam*>(neighbourStore.FindObject(detElemId,manuId));
     if (!calibParam)
     {
       Int_t dimension(11);
-      Int_t size(64);
+      Int_t size(AliMpConstants::ManuNofChannels());
       Int_t defaultValue(-1);
-      Int_t packingFactor(64);
+      Int_t packingFactor(size);
       
-      calibParam = new AliMUONCalibParamNI(dimension,size,defaultValue,packingFactor);
-      Bool_t ok = neighbourStore.Set(detElemId,manuId,calibParam,kFALSE);
+      calibParam = new AliMUONCalibParamNI(dimension,size,detElemId,manuId,defaultValue,packingFactor);
+      Bool_t ok = neighbourStore.Add(calibParam);
       if (!ok)
       {
         AliError(Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
@@ -760,7 +751,7 @@ AliMUONCDB::MakeNeighbourStore(AliMUONV2DStore& neighbourStore)
       }      
     }
     
-    for ( Int_t manuChannel = 0; manuChannel < 64; ++manuChannel )
+    for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel )
     {
       AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId,manuChannel),kFALSE);
       
@@ -779,6 +770,7 @@ AliMUONCDB::MakeNeighbourStore(AliMUONV2DStore& neighbourStore)
           if (!ok)
           {
             AliError("Could not pack value. Something is seriously wrong. Please check");
+            StdoutToAliError(pad->Print(););
             return -1;
           }
           calibParam->SetValueAsInt(manuChannel,i,x);
@@ -798,7 +790,7 @@ AliMUONCDB::WriteLocalTriggerMasks(Int_t startRun, Int_t endRun)
 {  
   /// Write local trigger masks to OCDB
   
-  AliMUONV1DStore* ltm = new AliMUON1DArray(235);
+  AliMUONVStore* ltm = new AliMUON1DArray(235);
   Int_t ngenerated = MakeLocalTriggerMaskStore(*ltm);
   AliInfo(Form("Ngenerated = %d",ngenerated));
   if (ngenerated>0)
@@ -814,7 +806,7 @@ AliMUONCDB::WriteRegionalTriggerMasks(Int_t startRun, Int_t endRun)
 {  
   /// Write regional trigger masks to OCDB
   
-  AliMUONV1DStore* rtm = new AliMUON1DArray(16);
+  AliMUONVStore* rtm = new AliMUON1DArray(16);
   Int_t ngenerated = MakeRegionalTriggerMaskStore(*rtm);
   AliInfo(Form("Ngenerated = %d",ngenerated));
   if (ngenerated>0)
@@ -830,7 +822,7 @@ AliMUONCDB::WriteGlobalTriggerMasks(Int_t startRun, Int_t endRun)
 {  
   /// Write global trigger masks to OCDB
   
-  AliMUONVCalibParam* gtm = new AliMUONCalibParamNI(1,16);
+  AliMUONVCalibParam* gtm = new AliMUONCalibParamNI(1,16,1,0,0);
 
   Int_t ngenerated = MakeGlobalTriggerMaskStore(*gtm);
   AliInfo(Form("Ngenerated = %d",ngenerated));
@@ -875,7 +867,7 @@ AliMUONCDB::WriteNeighbours(Int_t startRun, Int_t endRun)
 {
   /// Write neighbours to OCDB
   
-  AliMUONV2DStore* neighbours = new AliMUON2DMap(kTRUE);
+  AliMUONVStore* neighbours = new AliMUON2DMap(kTRUE);
   Int_t ngenerated = MakeNeighbourStore(*neighbours);
   AliInfo(Form("Ngenerated = %d",ngenerated));
   if (ngenerated>0)
@@ -915,7 +907,7 @@ AliMUONCDB::WritePedestals(Bool_t defaultValues,
   /// store them into CDB located at cdbpath, with a validity period
   /// ranging from startRun to endRun
   
-  AliMUONV2DStore* pedestalStore = new AliMUON2DMap(true);
+  AliMUONVStore* pedestalStore = new AliMUON2DMap(true);
   Int_t ngenerated = MakePedestalStore(*pedestalStore,defaultValues);
   AliInfo(Form("Ngenerated = %d",ngenerated));
   WriteToCDB("MUON/Calib/Pedestals",pedestalStore,startRun,endRun,defaultValues);
@@ -933,7 +925,7 @@ AliMUONCDB::WriteGains(Bool_t defaultValues,
   /// store them into CDB located at cdbpath, with a validity period
   /// ranging from startRun to endRun
   
-  AliMUONV2DStore* gainStore = new AliMUON2DMap(true);
+  AliMUONVStore* gainStore = new AliMUON2DMap(true);
   Int_t ngenerated = MakeGainStore(*gainStore,defaultValues);
   AliInfo(Form("Ngenerated = %d",ngenerated));  
   WriteToCDB("MUON/Calib/Gains",gainStore,startRun,endRun,defaultValues);
@@ -950,7 +942,7 @@ AliMUONCDB::WriteCapacitances(Bool_t defaultValues,
   /// store them into CDB located at cdbpath, with a validity period
   /// ranging from startRun to endRun
   
-  AliMUONV1DStore* capaStore = new AliMUON1DMap(16828);
+  AliMUONVStore* capaStore = new AliMUON1DMap(16828);
   Int_t ngenerated = MakeCapacitanceStore(*capaStore,defaultValues);
   AliInfo(Form("Ngenerated = %d",ngenerated));
   WriteToCDB("MUON/Calib/Capacitances",capaStore,startRun,endRun,defaultValues);
index bc0ade173fb931550fa55de6f48355a6f6c32cb3..c1b29953ef7d1dff195643c3f76d8a0ce985126b 100644 (file)
@@ -15,8 +15,8 @@
 #include <TString.h>
 
 class TList;
-class AliMUONV1DStore;
-class AliMUONV2DStore;
+class AliMUONVStore;
+class AliMUONVStore;
 class TMap;
 class AliMUONVCalibParam;
 class AliMUONTriggerLut;
@@ -32,24 +32,24 @@ public:
   AliMUONCDB(const char* cdbpath = "local://$ALICE_ROOT");
   virtual ~AliMUONCDB();
   
-  Int_t MakeNeighbourStore(AliMUONV2DStore& neighbourStore);
+  Int_t MakeNeighbourStore(AliMUONVStore& neighbourStore);
 
   Int_t MakeHVStore(TMap& aliasMap, Bool_t defaultValues);
-  Int_t MakePedestalStore(AliMUONV2DStore& pedestalStore, Bool_t defaultValues);
-  Int_t MakeCapacitanceStore(AliMUONV1DStore& capaStore, Bool_t defaultValues);
-  Int_t MakeGainStore(AliMUONV2DStore& gainStore, Bool_t defaultValues);
+  Int_t MakePedestalStore(AliMUONVStore& pedestalStore, Bool_t defaultValues);
+  Int_t MakeCapacitanceStore(AliMUONVStore& capaStore, Bool_t defaultValues);
+  Int_t MakeGainStore(AliMUONVStore& gainStore, Bool_t defaultValues);
   
-  Int_t MakeLocalTriggerMaskStore(AliMUONV1DStore& ltm) const;
-  Int_t MakeRegionalTriggerMaskStore(AliMUONV1DStore& rtm) const;
+  Int_t MakeLocalTriggerMaskStore(AliMUONVStore& ltm) const;
+  Int_t MakeRegionalTriggerMaskStore(AliMUONVStore& rtm) const;
   Int_t MakeGlobalTriggerMaskStore(AliMUONVCalibParam& gtm) const;
   AliMUONTriggerLut* MakeTriggerLUT(const char* file="$(ALICE_ROOT)/MUON/data/lutAptLpt1Hpt1p7.root") const;
   AliMUONTriggerEfficiencyCells* MakeTriggerEfficiency(const char* file="$ALICE_ROOT/MUON/data/efficiencyCells.dat") const;
 
   /// Compute the difference between two (compatible) stores
-  AliMUONV2DStore* Diff(AliMUONV2DStore& store1, AliMUONV2DStore& store2, 
+  AliMUONVStore* Diff(AliMUONVStore& store1, AliMUONVStore& store2, 
                         const char* opt="abs");
     
-  void Plot(const AliMUONV2DStore& store, const char* name, Int_t nbins=512);
+  void Plot(const AliMUONVStore& store, const char* name, Int_t nbins=512);
 
   void WriteToCDB(const char* calibpath, TObject* object, 
                   Int_t startRun, Int_t endRun, Bool_t defaultValues);
@@ -75,10 +75,11 @@ private:
   /// Not implemented
   AliMUONCDB& operator=(const AliMUONCDB& rhs);
   
+  TList* ManuList();
+  
 private:
   TString fCDBPath; //!< where to write stuff
   TList* fManuList; //!< full list of manus
-  static const Int_t fgkMaxNofChannelsPerManu; //!< 64
   
   ClassDef(AliMUONCDB,0) // Helper class to experience OCDB
 };
index 0be3ad8d01bc4112e6394aca55b958de5b3cf9a7..848508307fb9fe9b3cc0fec7ee67695f2ba42e71 100644 (file)
@@ -22,8 +22,8 @@
 #include "AliLog.h"
 #include "AliMUONTriggerEfficiencyCells.h"
 #include "AliMUONTriggerLut.h"
-#include "AliMUONV1DStore.h"
-#include "AliMUONV2DStore.h"
+#include "AliMUONVStore.h"
+#include "AliMUONVStore.h"
 #include "AliMUONVCalibParam.h"
 #include "Riostream.h"
 #include "TMap.h"
@@ -144,17 +144,17 @@ AliMUONCalibrationData::Gains(Int_t detElemId, Int_t manuId) const
 /// Note that, unlike the DeadChannel case, if the result is 0x0, that's an
 /// error (meaning that we should get gains for all channels).
 
-  AliMUONV2DStore* gains = Gains();
+  AliMUONVStore* gains = Gains();
   if (!gains)
   {
     return 0x0;
   }
   
-  return static_cast<AliMUONVCalibParam*>(gains->Get(detElemId,manuId));
+  return static_cast<AliMUONVCalibParam*>(gains->FindObject(detElemId,manuId));
 }
 
 //_____________________________________________________________________________
-AliMUONV1DStore*
+AliMUONVStore*
 AliMUONCalibrationData::Capacitances() const
 {
   /// Create (if needed) and return the internal store for capacitances.
@@ -162,7 +162,7 @@ AliMUONCalibrationData::Capacitances() const
 }
 
 //_____________________________________________________________________________
-AliMUONV2DStore*
+AliMUONVStore*
 AliMUONCalibrationData::Neighbours() const
 {
   /// Create (if needed) and return the internal store for neighbours.
@@ -170,7 +170,7 @@ AliMUONCalibrationData::Neighbours() const
 }
 
 //_____________________________________________________________________________
-AliMUONV2DStore*
+AliMUONVStore*
 AliMUONCalibrationData::Gains() const
 {
   /// Create (if needed) and return the internal store for gains.
@@ -178,7 +178,7 @@ AliMUONCalibrationData::Gains() const
 }
 
 //_____________________________________________________________________________
-AliMUONV2DStore*
+AliMUONVStore*
 AliMUONCalibrationData::OnDemandNeighbours() const
 {
   /// Create (if needed) and return the internal store for neighbours.
@@ -188,7 +188,7 @@ AliMUONCalibrationData::OnDemandNeighbours() const
     AliCDBEntry* entry = GetEntry("MUON/Calib/Neighbours");
     if (entry)
     {
-      fNeighbours = dynamic_cast<AliMUONV2DStore*>(entry->GetObject());
+      fNeighbours = dynamic_cast<AliMUONVStore*>(entry->GetObject());
       if (!fNeighbours)
       {
         AliError("Neighbours not of the expected type !!!");
@@ -203,7 +203,7 @@ AliMUONCalibrationData::OnDemandNeighbours() const
 }
 
 //_____________________________________________________________________________
-AliMUONV1DStore*
+AliMUONVStore*
 AliMUONCalibrationData::OnDemandCapacitances() const
 {
   /// Create (if needed) and return the internal store for capacitances.
@@ -213,7 +213,7 @@ AliMUONCalibrationData::OnDemandCapacitances() const
     AliCDBEntry* entry = GetEntry("MUON/Calib/Capacitances");
     if (entry)
     {
-      fCapacitances = dynamic_cast<AliMUONV1DStore*>(entry->GetObject());
+      fCapacitances = dynamic_cast<AliMUONVStore*>(entry->GetObject());
       if (!fCapacitances)
       {
         AliError("Capacitances not of the expected type !!!");
@@ -228,7 +228,7 @@ AliMUONCalibrationData::OnDemandCapacitances() const
 }
 
 //_____________________________________________________________________________
-AliMUONV2DStore*
+AliMUONVStore*
 AliMUONCalibrationData::OnDemandGains() const
 {
 /// Create (if needed) and return the internal store for gains.
@@ -238,7 +238,7 @@ AliMUONCalibrationData::OnDemandGains() const
     AliCDBEntry* entry = GetEntry("MUON/Calib/Gains");
     if (entry)
     {
-      fGains = dynamic_cast<AliMUONV2DStore*>(entry->GetObject());
+      fGains = dynamic_cast<AliMUONVStore*>(entry->GetObject());
       if (!fGains)
       {
         AliError("Gains not of the expected type !!!");
@@ -293,7 +293,7 @@ AliMUONCalibrationData::LocalTriggerBoardMasks(Int_t localBoardNumber) const
 {
 /// Return the masks for a given trigger local board.
 
-  AliMUONV1DStore* store = OnDemandLocalTriggerBoardMasks();
+  AliMUONVStore* store = OnDemandLocalTriggerBoardMasks();
   if (!store)
   {
     AliError("Could not get LocalTriggerBoardMasks");
@@ -301,7 +301,7 @@ AliMUONCalibrationData::LocalTriggerBoardMasks(Int_t localBoardNumber) const
   }
   
   AliMUONVCalibParam* ltbm = 
-    static_cast<AliMUONVCalibParam*>(store->Get(localBoardNumber));
+    static_cast<AliMUONVCalibParam*>(store->FindObject(localBoardNumber));
   if (!ltbm)
   {
     AliError(Form("Could not get mask for localBoardNumber=%d",localBoardNumber));
@@ -310,7 +310,7 @@ AliMUONCalibrationData::LocalTriggerBoardMasks(Int_t localBoardNumber) const
 }
 
 //_____________________________________________________________________________
-AliMUONV1DStore*
+AliMUONVStore*
 AliMUONCalibrationData::OnDemandLocalTriggerBoardMasks() const
 {
 /// Create (if needed) and return the internal store for LocalTriggerBoardMasks.
@@ -320,7 +320,7 @@ AliMUONCalibrationData::OnDemandLocalTriggerBoardMasks() const
     AliCDBEntry* entry = GetEntry("MUON/Calib/LocalTriggerBoardMasks");
     if (entry)
     {
-      fLocalTriggerBoardMasks = dynamic_cast<AliMUONV1DStore*>(entry->GetObject());
+      fLocalTriggerBoardMasks = dynamic_cast<AliMUONVStore*>(entry->GetObject());
       if (!fLocalTriggerBoardMasks)
       {
         AliError("fLocalTriggerBoardMasks not of the expected type !!!");
@@ -335,7 +335,7 @@ AliMUONCalibrationData::OnDemandLocalTriggerBoardMasks() const
 }
 
 //_____________________________________________________________________________
-AliMUONV2DStore*
+AliMUONVStore*
 AliMUONCalibrationData::OnDemandPedestals() const
 {
 /// Create (if needed) and return the internal storage for pedestals.
@@ -345,7 +345,7 @@ AliMUONCalibrationData::OnDemandPedestals() const
     AliCDBEntry* entry = GetEntry("MUON/Calib/Pedestals");
     if (entry)
     {
-      fPedestals = dynamic_cast<AliMUONV2DStore*>(entry->GetObject());
+      fPedestals = dynamic_cast<AliMUONVStore*>(entry->GetObject());
       if (!fPedestals)
       {
         AliError("fPedestals not of the expected type !!!");
@@ -377,7 +377,7 @@ AliMUONCalibrationData::Print(Option_t*) const
 }
 
 //_____________________________________________________________________________
-AliMUONV2DStore*
+AliMUONVStore*
 AliMUONCalibrationData::Pedestals() const
 {
   /// Return pedestals
@@ -392,13 +392,13 @@ AliMUONCalibrationData::Pedestals(Int_t detElemId, Int_t manuId) const
 /// A return value of 0x0 is considered an error, meaning we should get
 /// pedestals for all channels.
 
-  AliMUONV2DStore* pedestals = OnDemandPedestals();
+  AliMUONVStore* pedestals = OnDemandPedestals();
   if (!pedestals) 
   {
     return 0x0;
   }
   
-  return static_cast<AliMUONVCalibParam*>(pedestals->Get(detElemId,manuId));
+  return static_cast<AliMUONVCalibParam*>(pedestals->FindObject(detElemId,manuId));
 }
 
 //_____________________________________________________________________________
@@ -407,7 +407,7 @@ AliMUONCalibrationData::RegionalTriggerBoardMasks(Int_t index) const
 {
 /// Return the masks for a given trigger regional board.
 
-  AliMUONV1DStore* store = OnDemandRegionalTriggerBoardMasks();
+  AliMUONVStore* store = OnDemandRegionalTriggerBoardMasks();
   
   if (!store)
   {
@@ -416,7 +416,7 @@ AliMUONCalibrationData::RegionalTriggerBoardMasks(Int_t index) const
   }
   
   AliMUONVCalibParam* rtbm = 
-    static_cast<AliMUONVCalibParam*>(store->Get(index));
+    static_cast<AliMUONVCalibParam*>(store->FindObject(index));
   if (!rtbm)
   {
     AliError(Form("Could not get mask for regionalBoard index=%d",index));
@@ -425,7 +425,7 @@ AliMUONCalibrationData::RegionalTriggerBoardMasks(Int_t index) const
 }
 
 //_____________________________________________________________________________
-AliMUONV1DStore*
+AliMUONVStore*
 AliMUONCalibrationData::OnDemandRegionalTriggerBoardMasks() const
 {
 /// Create (if needed) and return the internal store for RegionalTriggerBoardMasks.
@@ -435,7 +435,7 @@ AliMUONCalibrationData::OnDemandRegionalTriggerBoardMasks() const
     AliCDBEntry* entry = GetEntry("MUON/Calib/RegionalTriggerBoardMasks");
     if (entry)
     {
-      fRegionalTriggerBoardMasks = dynamic_cast<AliMUONV1DStore*>(entry->GetObject());
+      fRegionalTriggerBoardMasks = dynamic_cast<AliMUONVStore*>(entry->GetObject());
       if (!fRegionalTriggerBoardMasks)
       {
         AliError("fRegionalTriggerBoardMasks not of the expected type !!!");
index 5093468c8dd9aff594f42a50f0ba738324d16c46..161172ac15458bda68572040f5d67aa4e450ee7b 100644 (file)
@@ -19,8 +19,8 @@
 class AliCDBEntry;
 class AliMUONTriggerEfficiencyCells;
 class AliMUONTriggerLut;
-class AliMUONV1DStore;
-class AliMUONV2DStore;
+class AliMUONVStore;
+class AliMUONVStore;
 class AliMUONVCalibParam;
 class TMap;
 
@@ -35,11 +35,11 @@ public:
   AliMUONCalibrationData(Int_t runNumber=-1, Bool_t deferredInitialization=kTRUE);
   virtual ~AliMUONCalibrationData();
 
-  AliMUONV2DStore* Neighbours() const;
+  AliMUONVStore* Neighbours() const;
   
-  AliMUONV1DStore* Capacitances() const;
+  AliMUONVStore* Capacitances() const;
   
-  AliMUONV2DStore* Gains() const;
+  AliMUONVStore* Gains() const;
   
   /// Get the Gain calibration object for channels within (detElemId,manuId).
   AliMUONVCalibParam* Gains(Int_t detElemId, Int_t manuId) const;
@@ -56,7 +56,7 @@ public:
   /// Whether this object is valid or not (might be invalid if fetching from CDB failed).
   Bool_t IsValid() const { return fIsValid; }
   
-  AliMUONV2DStore* Pedestals() const;
+  AliMUONVStore* Pedestals() const;
   
   /// Get the Pedestal calibration object for channels within (detElemId,manuId).
   AliMUONVCalibParam* Pedestals(Int_t detElemId, Int_t manuId) const;
@@ -86,32 +86,32 @@ protected:
   
 private:
   AliCDBEntry* GetEntry(const char* path) const;
-  AliMUONV2DStore* OnDemandNeighbours() const;
-  AliMUONV1DStore* OnDemandCapacitances() const;
-  AliMUONV2DStore* OnDemandGains() const;
-  AliMUONV2DStore* OnDemandPedestals() const;
+  AliMUONVStore* OnDemandNeighbours() const;
+  AliMUONVStore* OnDemandCapacitances() const;
+  AliMUONVStore* OnDemandGains() const;
+  AliMUONVStore* OnDemandPedestals() const;
   TMap* OnDemandHV() const;
   AliMUONVCalibParam* OnDemandGlobalTriggerBoardMasks() const;
-  AliMUONV1DStore* OnDemandRegionalTriggerBoardMasks() const;
-  AliMUONV1DStore* OnDemandLocalTriggerBoardMasks() const;
+  AliMUONVStore* OnDemandRegionalTriggerBoardMasks() const;
+  AliMUONVStore* OnDemandLocalTriggerBoardMasks() const;
   AliMUONTriggerLut* OnDemandTriggerLut() const;
   AliMUONTriggerEfficiencyCells* OnDemandTriggerEfficiency() const;
   
 private:  
   mutable Bool_t fIsValid; ///<  Whether we were able to correctly initialize
   Int_t fRunNumber; ///<  The run number for which we hold calibrations
-  mutable AliMUONV2DStore* fGains; //!< Gains
-  mutable AliMUONV2DStore* fPedestals; //!< Pedestals
+  mutable AliMUONVStore* fGains; //!< Gains
+  mutable AliMUONVStore* fPedestals; //!< Pedestals
   mutable TMap* fHV; //!< HV
-  mutable AliMUONV1DStore* fLocalTriggerBoardMasks; //!< Local trigger board maska
-  mutable AliMUONV1DStore* fRegionalTriggerBoardMasks; //!< Regional trigger board maska
+  mutable AliMUONVStore* fLocalTriggerBoardMasks; //!< Local trigger board maska
+  mutable AliMUONVStore* fRegionalTriggerBoardMasks; //!< Regional trigger board maska
   mutable AliMUONVCalibParam* fGlobalTriggerBoardMasks; //!< Global trigger board maska
   mutable AliMUONTriggerLut* fTriggerLut; //!< TRigger LUTs
   mutable AliMUONTriggerEfficiencyCells* fTriggerEfficiency; //!< Trigger efficiency cells
-  mutable AliMUONV1DStore* fCapacitances; //!< Manu capacitances
-  mutable AliMUONV2DStore* fNeighbours; //!< list of neighbours for all channels
+  mutable AliMUONVStore* fCapacitances; //!< Manu capacitances
+  mutable AliMUONVStore* fNeighbours; //!< list of neighbours for all channels
   
-  ClassDef(AliMUONCalibrationData,6) // Storage for all MUON calibration data.
+  ClassDef(AliMUONCalibrationData,7) // Storage for all MUON calibration data.
 };
 
 #endif