/// Object to hold the probability to reject elements during reconstruction.
///
/// Those elements are either channels, manus,
-/// bus patches, detection elements, or all the four.
+/// bus patches, detection elements, pcbs (for slats) and HV channels,
+/// or all of them.
+///
/// (we do not consider the next level, chamber, because if a full
/// chamber is missing, we assume we'll remove that run from the
/// list of usable runs anyway).
#include "AliMUONRejectList.h"
+#include "AliLog.h"
+#include "AliMpArea.h"
#include "AliMpConstants.h"
+#include "AliMpDCSNamer.h"
+#include "AliMpDDLStore.h"
+#include "AliMpDEStore.h"
+#include "AliMpDetElement.h"
+#include "AliMpMotifPosition.h"
+#include "AliMpPCB.h"
+#include "AliMpSegmentation.h"
+#include "AliMpSlat.h"
+#include "AliMpVSegmentation.h"
#include "AliMUON2DMap.h"
#include "AliMUONCalibParamNF.h"
#include "Riostream.h"
#include "TMath.h"
+using std::cout;
+using std::endl;
/// \cond CLASSIMP
ClassImp(AliMUONRejectList)
/// \endcond
{
/// Copy src into dest
delete[] dest;
- dest = new UInt_t[n];
- memcpy(src,dest,n*sizeof(UInt_t));
+ dest = 0;
+ if ( src && n )
+ {
+ dest = new UInt_t[n];
+ memcpy(dest,src,n*sizeof(UInt_t));
+ }
}
void Copy(UInt_t n, Float_t* src, Float_t*& dest)
{
/// Copy src into dest
delete[] dest;
- dest = new Float_t[n];
- memcpy(src,dest,n*sizeof(Float_t));
+ dest = 0;
+ if ( src && n )
+ {
+ dest = new Float_t[n];
+ memcpy(dest,src,n*sizeof(Float_t));
+ }
}
}
//_____________________________________________________________________________
AliMUONRejectList::AliMUONRejectList(const AliMUONRejectList& rl)
: TObject(rl),
-fIsBinary(kTRUE),
-fMaxNofDEs(),
-fMaxNofBPs(),
-fMaxNofManus(),
-fNofDEs(),
-fNofBPs(),
-fNofManus(0),
+fIsBinary(rl.fIsBinary),
+fMaxNofDEs(rl.fMaxNofDEs),
+fMaxNofBPs(rl.fMaxNofBPs),
+fMaxNofManus(rl.fMaxNofManus),
+fNofDEs(rl.fNofDEs),
+fNofBPs(rl.fNofBPs),
+fNofManus(rl.fNofManus),
fDEIds(0x0),
fDEProbas(0x0),
fBPIds(0x0),
fChannels(0x0)
{
/// Copy ctor
- rl.CopyTo(*this);
+
+ ::Copy(rl.fMaxNofDEs,rl.fDEIds,fDEIds);
+ ::Copy(rl.fMaxNofDEs,rl.fDEProbas,fDEProbas);
+ ::Copy(rl.fMaxNofBPs,rl.fBPIds,fBPIds);
+ ::Copy(rl.fMaxNofBPs,rl.fBPProbas,fBPProbas);
+ ::Copy(rl.fMaxNofManus,rl.fManuIds,fManuIds);
+ ::Copy(rl.fMaxNofManus,rl.fManuProbas,fManuProbas);
+
+ if ( rl.fChannels )
+ {
+ fChannels = static_cast<AliMUONVStore*>(rl.fChannels->Clone());
+ }
}
//_____________________________________________________________________________
/// assignement operator
if ( this != &rl )
{
- rl.CopyTo(*this);
+ static_cast<TObject&>(*this)=rl;
+
+ fIsBinary = rl.fIsBinary;
+ fMaxNofDEs = rl.fMaxNofDEs;
+ fMaxNofBPs = rl.fMaxNofBPs;
+ fMaxNofManus = rl.fMaxNofManus;
+ fNofDEs = rl.fNofDEs;
+ fNofBPs = rl.fNofBPs;
+ fNofManus = rl.fNofManus;
+
+ ::Copy(rl.fMaxNofDEs,rl.fDEIds,fDEIds);
+ ::Copy(rl.fMaxNofDEs,rl.fDEProbas,fDEProbas);
+ ::Copy(rl.fMaxNofBPs,rl.fBPIds,fBPIds);
+ ::Copy(rl.fMaxNofBPs,rl.fBPProbas,fBPProbas);
+ ::Copy(rl.fMaxNofManus,rl.fManuIds,fManuIds);
+ ::Copy(rl.fMaxNofManus,rl.fManuProbas,fManuProbas);
+
+ delete fChannels;
+ fChannels = 0x0;
+
+ if ( rl.fChannels )
+ {
+ fChannels = static_cast<AliMUONVStore*>(rl.fChannels->Clone());
+ }
+
}
return *this;
}
-//_____________________________________________________________________________
-void
-AliMUONRejectList::CopyTo(AliMUONRejectList& rl) const
-{
- /// Copy this to rl
- TObject::Copy(rl);
-
- rl.fIsBinary = fIsBinary;
-
- ::Copy(rl.fMaxNofDEs,fDEIds,rl.fDEIds);
- ::Copy(rl.fMaxNofDEs,fDEProbas,rl.fDEProbas);
- ::Copy(rl.fMaxNofBPs,fBPIds,rl.fBPIds);
- ::Copy(rl.fMaxNofBPs,fBPProbas,rl.fBPProbas);
- ::Copy(rl.fMaxNofManus,fManuIds,rl.fManuIds);
- ::Copy(rl.fMaxNofManus,fManuProbas,rl.fManuProbas);
-
- delete rl.fChannels;
- rl.fChannels = static_cast<AliMUONVStore*>(fChannels->Clone());
-}
-
//_____________________________________________________________________________
AliMUONRejectList::~AliMUONRejectList()
{
ZeroOrOne(proba);
}
+//_____________________________________________________________________________
+void AliMUONRejectList::SetPCBProbability(Int_t detElemId, Int_t pcbNumber, Float_t proba)
+{
+ /// Set the probability to reject all the manus of a given (slat) PCB
+ AliMpSegmentation* seg = AliMpSegmentation::Instance();
+ AliMp::CathodType ct[] = { AliMp::kCath0, AliMp::kCath1 };
+
+ for ( Int_t i = 0; i < 2; ++i )
+ {
+ const AliMpVSegmentation* vseg = seg->GetMpSegmentation(detElemId,ct[i]);
+ if (!vseg)
+ {
+ AliError(Form("Could not get segmentation of DE %d",detElemId));
+ continue;
+ }
+ const AliMpSlat* slat = seg->GetSlat(vseg);
+ if (!slat)
+ {
+ AliError(Form("Could not get slat from DE %d",detElemId));
+ continue;
+ }
+ AliMpPCB* pcb = slat->GetPCB(pcbNumber);
+ for ( Int_t j = 0; j < pcb->GetSize(); ++j )
+ {
+ AliMpMotifPosition* mp = pcb->GetMotifPosition(j);
+ SetManuProbability(detElemId,mp->GetID(),proba);
+ }
+ }
+}
+
+//_____________________________________________________________________________
+void AliMUONRejectList::SetHVProbability(const char* dcsName, Float_t proba)
+{
+ /// Set the probability to reject all the manus of a given HV part
+ /// Caution : the dcs string is a dcs NAME, _not_ an alias
+
+ AliMpDCSNamer hv("TRACKER");
+
+ TString alias = hv.DCSAliasFromName(dcsName);
+
+ Int_t detElemId = hv.DetElemIdFromDCSAlias(alias.Data());
+ Int_t index = hv.DCSIndexFromDCSAlias(alias.Data());
+
+ AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
+
+ const AliMpArrayI* manus = de->ManusForHV(index);
+
+ for ( Int_t i = 0; i < manus->GetSize(); ++ i )
+ {
+ Int_t manuId = manus->GetValue(i);
+ SetManuProbability(detElemId,manuId,proba);
+ }
+}
+
//_____________________________________________________________________________
void
AliMUONRejectList::Print(Option_t* opt) const