]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Aux.getters for MP2 record
authorshahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 5 May 2012 23:18:05 +0000 (23:18 +0000)
committershahoian <shahoian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 5 May 2012 23:18:05 +0000 (23:18 +0000)
STEER/STEER/AliMillePedeRecord.cxx
STEER/STEER/AliMillePedeRecord.h

index c79e02271c633b112ceff1f4233e5045b16f41d6..fc07b161e2ef460744ead6fbb3edea012716e266 100644 (file)
@@ -105,6 +105,98 @@ void AliMillePedeRecord::Print(const Option_t *) const
   //
 }
 
+//_____________________________________________________________________________________________
+Double_t AliMillePedeRecord::GetGloResWProd(Int_t indx) const
+{
+  // get sum of derivative over global variable indx * res. at point * weight
+  if (!fSize) {AliInfo("No data"); return 0;}
+  int cnt=0;
+  double prodsum = 0.0;
+  //  
+  while(cnt<fSize) {
+    //
+    Double_t resid = fValue[cnt++];
+    while(!IsWeight(cnt)) cnt++;
+    Double_t weight = GetValue(cnt++);
+    Double_t *derGlo = GetValue()+cnt;
+    int    *indGlo = GetIndex()+cnt;
+    int     nGlo = 0;
+    while(!IsResidual(cnt) && cnt<fSize) {nGlo++; cnt++;} 
+    for (int i=nGlo;i--;) if (indGlo[i]==indx) prodsum += resid*weight*derGlo[i];
+    //
+  }
+  return prodsum;
+}
+
+//_____________________________________________________________________________________________
+Double_t AliMillePedeRecord::GetGlobalDeriv(Int_t pnt, Int_t indx) const
+{
+  // get derivative over global variable indx at point pnt
+  if (!fSize) {AliError("No data"); return 0;}
+  int cnt=0,point=0;
+  //  
+  while(cnt<fSize) {
+    //
+    cnt++;
+    while(!IsWeight(cnt)) cnt++;
+    cnt++;
+    Double_t *derGlo = GetValue()+cnt;
+    int    *indGlo = GetIndex()+cnt;
+    int     nGlo = 0;
+    while(!IsResidual(cnt) && cnt<fSize) {nGlo++; cnt++;} 
+    //
+    if (pnt != point++) continue;
+    for (int i=nGlo;i--;) if (indGlo[i]==indx) return derGlo[i];
+    break;
+  }
+  return 0;
+  //
+}
+
+//_____________________________________________________________________________________________
+Double_t AliMillePedeRecord::GetLocalDeriv(Int_t pnt, Int_t indx) const
+{
+  // get derivative over local variable indx at point pnt
+  if (!fSize) {AliError("No data"); return 0;}
+  int cnt=0,point=0;
+  //  
+  while(cnt<fSize) {
+    //
+    cnt++;
+    Double_t *derLoc = GetValue()+cnt;
+    int    *indLoc = GetIndex()+cnt;
+    int     nLoc = 0;
+    while(!IsWeight(cnt)) {nLoc++;cnt++;}
+    cnt++;
+    while(!IsResidual(cnt) && cnt<fSize) cnt++;
+    if (pnt != point++) continue;
+    for (int i=nLoc;i--;) if (indLoc[i]==indx) return derLoc[i];
+    break;
+  }
+  return 0;
+  //
+}
+
+//_____________________________________________________________________________________________
+Double_t AliMillePedeRecord::GetResidual(Int_t pnt) const
+{
+  // get residual at point pnt
+  if (!fSize) {AliError("No data"); return 0;}
+  int cnt=0,point=0;
+  //  
+  while(cnt<fSize) {
+    //
+    Double_t resid = fValue[cnt++];
+    while(!IsWeight(cnt)) cnt++;
+    cnt++;
+    while(!IsResidual(cnt) && cnt<fSize) cnt++;
+    if (pnt != point++) continue;
+    return resid;
+  }
+  return 0;
+  //
+}
+
 //_____________________________________________________________________________________________
 void AliMillePedeRecord::ExpandDtBuffer(Int_t bfsize)
 {
index e47d17f1e9050314b131b348ee7e866fbea9c099..11bdc55182b83e1ad00e41a453e4ee1356617bd5 100644 (file)
@@ -54,6 +54,12 @@ class AliMillePedeRecord : public TObject
   UInt_t     GetRunID()                                      const {return fRunID;}
   void       SetRunID(UInt_t run)                                  {fRunID = run;}  
   //
+  // Aux methods
+  Double_t   GetGlobalDeriv(Int_t pnt, Int_t indx)           const;
+  Double_t   GetLocalDeriv(Int_t pnt, Int_t indx)            const;
+  Double_t   GetResidual(Int_t pnt)                          const;
+  Double_t   GetGloResWProd(Int_t indx)                      const;
+  //
  protected:
   Int_t      GetDtBufferSize()                               const {return GetUniqueID()&0x0000ffff;}
   Int_t      GetGrBufferSize()                               const {return GetUniqueID()>>16;}