]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Implementation of a method (RemoveGraphDuplicates) to take away
authorzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 18 Mar 2010 15:52:17 +0000 (15:52 +0000)
committerzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 18 Mar 2010 15:52:17 +0000 (15:52 +0000)
graph points falling within a specified tolerance of the
previous measured point. (Haavard Helstrup).

STEER/AliDCSSensorArray.cxx
STEER/AliDCSSensorArray.h

index f9cb97a7065e5ab39c9931dc1801ab499e30ec81..77a2499b540b87c0e9f586c94f1c860699f7ce16 100644 (file)
@@ -360,6 +360,7 @@ TMap* AliDCSSensorArray::ExtractDCS(TMap *dcsMap, Bool_t keepStart)
  return values;
 }
 
+
 //_____________________________________________________________________________
 TGraph* AliDCSSensorArray::MakeGraph(TObjArray* valueSet, Bool_t keepStart){
   //
@@ -432,6 +433,31 @@ TGraph* AliDCSSensorArray::MakeGraph(TObjArray* valueSet, Bool_t keepStart){
   delete [] y;
   return graph;
 }
+
+//_____________________________________________________________________________
+void AliDCSSensorArray::RemoveGraphDuplicates(Double_t tolerance){
+//
+//   Remove points with same y value as the previous measured point
+//   (to save space for non-fitted graphs -- i.e. last measured point used)
+//
+  Int_t nsensors = fSensors->GetEntries();
+  for ( Int_t isensor=0; isensor<nsensors; isensor++) {
+    AliDCSSensor *entry = (AliDCSSensor*)fSensors->At(isensor);
+    TGraph *graph = entry->GetGraph();
+    Double_t x=-999.,y=-999., x0=-999.,y0=-999.;
+    if (graph) {
+      Int_t npoints=graph->GetN();
+      if (npoints>1) {
+        for (Int_t i=npoints-1;i>0;i--) {
+          graph->GetPoint(i,x,y);
+          graph->GetPoint(i-1,x0,y0);
+          if ( fabs(y-y0) < fabs(tolerance*y0) ) graph->RemovePoint(i);
+        }
+      }
+    }
+   }
+}    
+
   
 //_____________________________________________________________________________
 AliDCSSensor* AliDCSSensorArray::GetSensor(Int_t IdDCS) 
index 8fcb7ffe9c6f86821b99a477130ba64d1abd8c22..dafc394162440a75d75bed7252bc613fc787a389 100644 (file)
@@ -68,6 +68,7 @@ class AliDCSSensorArray : public TNamed {
   void RemoveSensorNum(Int_t ind);
   void RemoveSensor(Int_t IdDCS);
   void AddSensors(AliDCSSensorArray *sensors);
+  void RemoveGraphDuplicates (Double_t tolerance=1e-6);
   TArrayI OutsideThreshold(Double_t threshold, UInt_t timeSec=0, Bool_t below=kTRUE) const;
   Int_t NumSensors() const { return fSensors->GetEntries(); }
   Int_t NumFits() const;