]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONCalibParam2F.cxx
Speeding up the map creation by using a pre-computed Neighbours list, store in OCDB...
[u/mrichter/AliRoot.git] / MUON / AliMUONCalibParam2F.cxx
index 36d765266c0e1cee8f55abf021c1c39433817a10..815d5130f377dc5996dc22d94d6ecaa65c528743 100644 (file)
@@ -24,7 +24,6 @@
 
 ///
 /// \class AliMUONCalibParam2F
-/// \brief Implementation of AliMUONVCalibParam for pair of floats.
 ///
 /// Handle the case of 2 floating point parameters per channel.
 /// Conceptually, this class is the equivalent of a vector or float pairs,
@@ -47,7 +46,7 @@ AliMUONCalibParam2F::AliMUONCalibParam2F()
 }
 
 //_____________________________________________________________________________
-AliMUONCalibParam2F::AliMUONCalibParam2F(Int_t theSize, Int_t fillWithValue) 
+AliMUONCalibParam2F::AliMUONCalibParam2F(Int_t theSize, Float_t fillWithValue) 
 : AliMUONVCalibParam(),
   fSize(theSize),
   fN(fSize*Dimension()),
@@ -60,7 +59,10 @@ AliMUONCalibParam2F::AliMUONCalibParam2F(Int_t theSize, Int_t fillWithValue)
   if ( fN > 0 )
   {
     fValues = new Float_t[fN];
-    memset(fValues,fillWithValue,fN*sizeof(Float_t));
+    for ( Int_t i = 0; i < fN; ++i )
+    {
+      fValues[i] = fillWithValue;
+    }
   }
 }
 
@@ -134,21 +136,41 @@ void
 AliMUONCalibParam2F::Print(Option_t* opt) const
 {
 /// Output this object to stdout.
-/// If opt=="full", then all channels are printed, otherwise
-/// only the general characteristics are printed.
+/// If opt=="full", then all channels are printed, 
+/// if opt=="mean", only the mean and sigma value are printed,
+/// otherwise only the general characteristics are printed.
 
   TString sopt(opt);
   sopt.ToUpper();
   cout << "AliMUONCalibParam2F - Size=" << Size()
-    << " Dimension=" << Dimension()
-    << endl;
+    << " Dimension=" << Dimension();
   if ( sopt.Contains("FULL") )
   {
+    cout << endl;
     for ( Int_t i = 0; i < Size(); ++i )
     {
-      cout << setw(6) << ValueAsFloat(i,0) << "," << ValueAsFloat(i,1) << endl;
+      cout << Form("CH %3d %e %e",i,ValueAsFloat(i,0),ValueAsFloat(i,1)) << endl;
     }
   }
+  if ( sopt.Contains("MEAN") )
+  {
+    Float_t mean(0);
+    Float_t v2(0);
+    
+    Int_t n = Size();
+    
+    for ( Int_t i = 0; i < Size(); ++i )
+    {
+      Float_t v = ValueAsFloat(i);
+      mean += v;
+      v2 += v*v;
+    }
+    mean /= n;
+    float sigma = 0;
+    if ( n > 1 ) sigma = TMath::Sqrt( (v2-n*mean*mean)/(n-1) );
+    cout << Form(" Mean=%f Sigma=%f",mean,sigma) << endl;
+  }
+  
 }
 
 //_____________________________________________________________________________