]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
fix finding of pad neighbours; remove methods to write them in OCDB
authorppillot <pillot@subatech.in2p3.fr>
Wed, 19 Feb 2014 16:50:51 +0000 (17:50 +0100)
committerlaphecet <laurent.aphecetche@subatech.in2p3.fr>
Wed, 19 Feb 2014 17:35:21 +0000 (18:35 +0100)
Round slates are rotated compared to others so the pad density
increases instead of decreasing when going from left to right:
--> increased number of possible neighbours from 10 to 12 to be
full symmetric (also consider increasing density from bottom to top)
--> corrected possibility to store the neighbours at their
corresponding position in the array (holes filled with invalid pads)

MUON/AliMUONCDB.cxx
MUON/AliMUONCDB.h
MUON/mapping/AliMpVSegmentation.cxx

index d99eba4b0fc0bd9719a9bfc5da81ca091d943b34..d1a2cb5a665e131d9099ea69521c307f002ca8c5 100644 (file)
@@ -1088,82 +1088,6 @@ AliMUONCDB::WriteToCDB(TObject* object, const char* calibpath, Int_t startRun, I
   AliCDBManager::Instance()->Put(object,id,&md);
 }
 
-//_____________________________________________________________________________
-Int_t 
-AliMUONCDB::MakeNeighbourStore(AliMUONVStore& neighbourStore)
-{
-  /// Fill the neighbours store with, for each channel, a TObjArray of its
-  /// neighbouring pads (including itself)
-  
-  AliCodeTimerAutoGeneral("",0);
-  
-  if (!AliMUONCDB::CheckMapping()) return 0;
-  
-  AliInfoGeneral("AliMUONCDB", "Generating NeighbourStore. This will take a while. Please be patient.");
-  
-  Int_t nchannels(0);
-  
-  TObjArray tmp;
-
-  Int_t detElemId;
-  Int_t manuId;
-  
-  AliMpManuIterator it;
-  
-  while ( it.Next(detElemId,manuId) )
-  {
-    const AliMpVSegmentation* seg = 
-      AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId);
-    
-    AliMUONVCalibParam* calibParam = static_cast<AliMUONVCalibParam*>(neighbourStore.FindObject(detElemId,manuId));
-    if (!calibParam)
-    {
-      Int_t dimension(11);
-      Int_t size(AliMpConstants::ManuNofChannels());
-      Int_t defaultValue(-1);
-      Int_t packingFactor(size);
-      
-      calibParam = new AliMUONCalibParamNI(dimension,size,detElemId,manuId,defaultValue,packingFactor);
-      Bool_t ok = neighbourStore.Add(calibParam);
-      if (!ok)
-      {
-        AliErrorGeneral("AliMUONCDB", Form("Could not set DetElemId=%d manuId=%d",detElemId,manuId));
-        return -1;
-      }      
-    }
-    
-    for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel )
-    {
-      AliMpPad pad = seg->PadByLocation(manuId,manuChannel,kFALSE);
-      
-      if (pad.IsValid()) 
-      {
-        ++nchannels;
-
-        seg->GetNeighbours(pad,tmp,true,true);
-        Int_t nofPadNeighbours = tmp.GetEntriesFast();
-            
-        for ( Int_t i = 0; i < nofPadNeighbours; ++i )
-        {
-          AliMpPad* p = static_cast<AliMpPad*>(tmp.UncheckedAt(i));
-          Int_t x;
-//          Bool_t ok =
-              calibParam->PackValues(p->GetManuId(),p->GetManuChannel(),x);
-//          if (!ok)
-//          {
-//            AliError("Could not pack value. Something is seriously wrong. Please check");
-//            StdoutToAliError(pad->Print(););
-//            return -1;
-//          }
-          calibParam->SetValueAsInt(manuChannel,i,x);
-        }
-      }
-    }
-    }
-  
-  return nchannels;
-}
-
 //_____________________________________________________________________________
 void
 AliMUONCDB::WriteLocalTriggerMasks(Int_t startRun, Int_t endRun)
@@ -1243,22 +1167,6 @@ AliMUONCDB::WriteTriggerEfficiency(Int_t startRun, Int_t endRun)
   delete eff;
 }
 
-//_____________________________________________________________________________
-void 
-AliMUONCDB::WriteNeighbours(Int_t startRun, Int_t endRun)
-{
-  /// Write neighbours to OCDB
-  
-  AliMUONVStore* neighbours = Create2DMap();
-  Int_t ngenerated = MakeNeighbourStore(*neighbours);
-  AliInfoGeneral("AliMUONCDB", Form("Ngenerated = %d",ngenerated));
-  if (ngenerated>0)
-  {
-    WriteToCDB("MUON/Calib/Neighbours",neighbours,startRun,endRun,true);
-  }
-  delete neighbours;
-}
-
 //_____________________________________________________________________________
 void 
 AliMUONCDB::WriteHV(Bool_t defaultValues,
@@ -1447,7 +1355,6 @@ AliMUONCDB::WriteTracker(Bool_t defaultValues, Int_t startRun, Int_t endRun)
   WritePedestals(defaultValues,startRun,endRun);
   WriteGains(defaultValues,startRun,endRun);
   WriteCapacitances(defaultValues,startRun,endRun);
-  WriteNeighbours(startRun,endRun);
   WriteOccupancyMap(defaultValues,startRun,endRun);
   WriteRejectList(defaultValues,startRun,endRun);
   WriteConfig(startRun,endRun);
index 2e54fb758f7078c743cd595091eabdd21e7fff0d..b0078ce3694665416828db9b0f3e697371687030 100644 (file)
@@ -39,8 +39,6 @@ namespace AliMUONCDB
   AliMUONRecoParam* LoadRecoParam();
   TClonesArray* LoadAlignmentData();
   
-  Int_t MakeNeighbourStore(AliMUONVStore& neighbourStore);
-
   Int_t MakeHVStore(TMap& aliasMap, Bool_t defaultValues);
   Int_t MakeTriggerDCSStore(TMap& aliasMap, Bool_t defaultValues);
   Int_t MakePedestalStore(AliMUONVStore& pedestalStore, Bool_t defaultValues);
@@ -82,7 +80,6 @@ namespace AliMUONCDB
   void WriteTrigger(Bool_t defaultValues=kTRUE, Int_t startRun=0,Int_t endRun=AliCDBRunRange::Infinity());
   void WriteTracker(Bool_t defaultValues=kTRUE, Int_t startRun=0,Int_t endRun=AliCDBRunRange::Infinity());
   
-  void WriteNeighbours(Int_t startRun=0, Int_t endRun=AliCDBRunRange::Infinity());
   void WriteHV(Bool_t defaultValues, Int_t startRun, Int_t endRun=AliCDBRunRange::Infinity());
   void WritePedestals(Bool_t defaultValues, Int_t startRun, Int_t endRun=AliCDBRunRange::Infinity());
   void WriteGains(Bool_t defaultValues, Int_t startRun, Int_t endRun=AliCDBRunRange::Infinity());
index 8433aec22ba9cba253277076fd14d4a3d49ed580..ceef8bd21f5c8b358bd630f29e78367bf81141cc 100644 (file)
@@ -67,75 +67,75 @@ AliMpVSegmentation::GetNeighbours(const AliMpPad& pad,
   /// testPositions are the positions (L,T,R,B) relative to pad's center (O)
   /// were we'll try to get a neighbouring pad, by getting a little
   /// bit outside the pad itself.
-  /// Note that it's not symmetric as we assume that pad density
-  /// can always decrease when going from left to right (or from bottom to top)
-  /// <pre>
-  /// L--T--R
-  /// |     |
-  /// L     |
-  /// |  O  R
-  /// L     |
-  /// |     |
-  /// L-B-B-R
-  /// </pre>
+  /// The pad density can only decrease when going from left to right except
+  /// for round slates where it is the opposite.
+  /// The pad density can only decrease when going from bottom to top but
+  /// to be symmetric we also consider the opposite.
   /// The order in which we actually test the positions has some importance,
   /// i.e. when using this information to compute status map later on. Here's
   /// the sequence :
   /// <pre>
-  /// 4-- 5-- 6
+  /// 4- 5- 6-7
   /// |       |
-  /// 3       |
-  /// |   0   7
-  /// 2       |
+  /// 3       8
+  /// |   0   |
+  /// 2       9
   /// |       |
-  /// 1-10- 9-8
+  /// 1-12-11-10
   /// </pre>
 
-  static Double_t shiftx[11] = { 0, -1, -1, -1, -1, 0, 1, 1, 1, 1/3.0, -1/3.0 }; 
-  static Double_t shifty[11] = { 0, -1, -1/3.0, 1/3.0, 1, 1, 1, 0, -1, -1, -1 }; 
+  static const Int_t kNofTestPositions(12);
+  static Double_t shiftx[12] = {-1., -1., -1., -1., -1./3., 1./3., 1., 1., 1., 1., 1./3., -1./3.};
+  static Double_t shifty[12] = {-1., -1./3., 1./3., 1., 1., 1., 1., 1./3., -1./3., -1., -1., -1.};
 
-  static const Int_t kNofTestPositions(11);
   static const Double_t kEpsilon(AliMpConstants::LengthTolerance()*2.0);
-  static Int_t centerIndex(-1);
-  
   
   neighbours.Delete();
   neighbours.SetOwner(kTRUE);
   
   if ( ! pad.IsValid() ) return 0;
-    
+  
+  AliMpPad invalid(AliMpPad::Invalid());
+  AliMpPad *previous = &invalid;
   Int_t n(0);
   
-  AliMpPad previous(AliMpPad::Invalid());
+  // consider adding the pad itself
+  if ( includeSelf )
+  {
+    neighbours.Add(new AliMpPad(pad));
+    ++n;
+  }
+  else if ( includeVoid )
+  {
+    neighbours.Add(new AliMpPad(invalid));
+    ++n;
+  }
   
-  for ( Int_t i = 0; i < kNofTestPositions; ++i ) 
+  // add the neighbours (only once)
+  for ( Int_t i = 0; i < kNofTestPositions; ++i )
   {
-    if ( i == centerIndex && !includeSelf )
-    {
-      if ( includeVoid ) 
-      {
-        previous = AliMpPad::Invalid();
-        neighbours.Add(new AliMpPad(previous));
-        ++n;
-      }
-      continue;
-    }
     
-    AliMpPad p 
+    AliMpPad p
       = PadByPosition(pad.GetPositionX() + ( pad.GetDimensionX() + kEpsilon )*shiftx[i], 
                       pad.GetPositionY() + ( pad.GetDimensionY() + kEpsilon )*shifty[i],
                       kFALSE);
     
-    if ( ! p.IsValid() && ! includeVoid ) continue;
-    
-    if ( p != previous || ! previous.IsValid() ) 
+    if ( p.IsValid() && p != *previous )
     {
-      previous = p;
-      neighbours.Add(new AliMpPad(p));
+      previous = new AliMpPad(p);
+      neighbours.Add(previous);
       ++n;
     }
+    else if ( includeVoid )
+    {
+      neighbours.Add(new AliMpPad(invalid));
+      ++n;
+    }
+    
   }
+  
   return n;
+  
 }
 
 //