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)
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,
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);
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);
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());
/// 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;
+
}
//