From: hristov Date: Wed, 14 Dec 2005 13:52:56 +0000 (+0000) Subject: Normalized positive PID weights (conditional probabilities) X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=d27bbc792b25b22e621a3e7f664b7764d36aea33;p=u%2Fmrichter%2FAliRoot.git Normalized positive PID weights (conditional probabilities) --- diff --git a/STEER/AliESDtrack.cxx b/STEER/AliESDtrack.cxx index 0270c607c1e..9e937108b45 100644 --- a/STEER/AliESDtrack.cxx +++ b/STEER/AliESDtrack.cxx @@ -29,6 +29,33 @@ ClassImp(AliESDtrack) +void SetPIDValues(Float_t * dest, const Double_t * src, Int_t n) { + // This function copies "n" PID weights from "scr" to "dest" + // and normalizes their sum to 1 thus producing conditional probabilities. + // The negative weights are set to 0. + // In case all the weights are non-positive they are replaced by + // uniform probabilities + + if (n<=0) return; + + Float_t uniform = 1./(Float_t)n; + + Float_t sum = 0; + for (Int_t i=0; i=0) { + sum+=src[i]; + dest[i] = src[i]; + } + else { + dest[i] = 0; + } + + if(sum>0) + for (Int_t i=0; i