]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HBTAN/AliHBTMonitorFunction.cxx
Sumw2 called by default
[u/mrichter/AliRoot.git] / HBTAN / AliHBTMonitorFunction.cxx
index 10003dfba49cbcadc7b58ffe558b7d6c3056b621..ca8a904049ddeaa24b5f2001aeb65af36a9ea30c 100644 (file)
@@ -1,4 +1,42 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+#include "AliLog.h"
 #include "AliHBTMonitorFunction.h"
+
+//__________________________________________________________________
+////////////////////////////////////////////////////////////////////
+//
+// class AliHBTMonitorFunction
+//
+// class AliHBTMonOneParticleFctn
+// class AliHBTMonTwoParticleFctn
+//
+// class AliHBTMonOneParticleFctn1D
+// class AliHBTMonOneParticleFctn2D
+// class AliHBTMonOneParticleFctn3D
+//
+// class AliHBTMonTwoParticleFctn1D
+// class AliHBTMonTwoParticleFctn2D
+// class AliHBTMonTwoParticleFctn3D
+//
+// Base Classes for monitoring functions
+// author: chajecki@if.pw.edu.pl
+//
 /******************************************************************/
 /*
 Base classes for monitor functions
@@ -19,38 +57,73 @@ Base classes for monitor functions
 Zbigniew.Chajecki@cern.ch
 
 */
-/******************************************************************/
-/******************************************************************/
+///////////////////////////////////////////////////////////////////////
+
 
-#include <Riostream.h>
 ClassImp( AliHBTMonitorFunction )
 
-AliHBTMonitorFunction::AliHBTMonitorFunction()
+AliHBTMonitorFunction::AliHBTMonitorFunction():
+ fParticleCut(new AliAODParticleEmptyCut())
 {
-  fParticleCut = new AliHBTEmptyParticleCut(); //dummy cut
+  //ctor
 }
 /******************************************************************/
-AliHBTMonitorFunction::AliHBTMonitorFunction(const char* name,const char* title):TNamed(name,title)
+AliHBTMonitorFunction::AliHBTMonitorFunction(const char* name,const char* title):
+ TNamed(name,title),
+ fParticleCut(new AliAODParticleEmptyCut())
 {
-  fParticleCut = new AliHBTEmptyParticleCut(); //dummy cut
+  //ctor
+}
+/******************************************************************/
+AliHBTMonitorFunction::AliHBTMonitorFunction(const AliHBTMonitorFunction& /*in*/):
+ TNamed(),
+ fParticleCut(new AliAODParticleEmptyCut())
+{
+  //cpy ctor
+  // We cannot copy because it is a mess with names (histogram and functions)
+  MayNotUse("AliHBTMonitorFunction(const AliHBTMonitorFunction&");
+}
+/******************************************************************/
+AliHBTMonitorFunction& AliHBTMonitorFunction::operator=(const AliHBTMonitorFunction& /*in*/)
+{
+  //assigment operator 
+  // We cannot copy because it is a mess with names (histogram and functions)
+  MayNotUse("operator=");
+  return *this;
 }
 /******************************************************************/
 
 AliHBTMonitorFunction::~AliHBTMonitorFunction()
  {
-  if (fParticleCut) delete fParticleCut;
+  //dtor
+  delete fParticleCut;
  }
 /******************************************************************/
 
-void AliHBTMonitorFunction::
-Write()
+void AliHBTMonitorFunction::Write()
  {
+   //Writes an function to disk
    if (GetResult()) GetResult()->Write();
  }
 /******************************************************************/
 
+void AliHBTMonitorFunction::Init()
+ {
+   //Writes an function to disk
+   AliDebug(1,"Entering");
+   
+   if (GetResult() == 0x0)
+    {
+      Warning("Init","Function has NULL result histogram!");
+      return;
+    }
+   GetResult()->Reset();
+   GetResult()->SetDirectory(0x0);
+   AliDebug(1,"Done");
+ }
 /******************************************************************/
-void AliHBTMonitorFunction::SetParticleCut(AliHBTParticleCut* cut)
+
+void AliHBTMonitorFunction::SetParticleCut(AliAODParticleCut* cut)
 {
 //Sets new Particle Cut. Old one is deleted
 //Note that it is created new object instead of simple pointer set
@@ -66,14 +139,12 @@ void AliHBTMonitorFunction::SetParticleCut(AliHBTParticleCut* cut)
      return;
    }
  delete fParticleCut;
- fParticleCut = (AliHBTParticleCut*)cut->Clone();
+ fParticleCut = (AliAODParticleCut*)cut->Clone();
  
 }
-
 /******************************************************************/
 
-void AliHBTMonitorFunction::
-Rename(const Char_t * name)
+void AliHBTMonitorFunction::Rename(const Char_t * name)
  {
  //renames the function and histograms
   SetName(name);
@@ -83,12 +154,10 @@ Rename(const Char_t * name)
                                            //result histogram
   GetResult()->SetName(numstr.Data());
   GetResult()->SetTitle(numstr.Data());
-  
-  
  }
+/******************************************************************/
 
-void AliHBTMonitorFunction::
-Rename(const Char_t * name, const Char_t * title)
+void AliHBTMonitorFunction::Rename(const Char_t * name, const Char_t * title)
  {
  //renames and retitle the function and histograms
  
@@ -118,38 +187,44 @@ ClassImp( AliHBTMonTwoParticleFctn )  //z.ch.
 /******************************************************************/
 /******************************************************************/
 ClassImp( AliHBTMonOneParticleFctn1D )
-AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D()
+AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D():
+ fResult(0x0)
  {
-   fResult = 0x0;
+   //ctor
  }
+/******************************************************************/
 
-AliHBTMonOneParticleFctn1D::
-AliHBTMonOneParticleFctn1D(Int_t nbins, Double_t maxXval, Double_t minXval)
+AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D(Int_t nbins, Double_t maxXval, Double_t minXval)
  {
+   //ctor
    TString numstr = fName + " Result";  //title and name of the 
                                            //result histogram
-         
    fResult   = new TH1D(numstr.Data(),numstr.Data(),nbins,minXval,maxXval);
+   fResult->Sumw2();
  }
 
-AliHBTMonOneParticleFctn1D::
-AliHBTMonOneParticleFctn1D(const Char_t *name, const Char_t *title,
+AliHBTMonOneParticleFctn1D::AliHBTMonOneParticleFctn1D(const Char_t *name, const Char_t *title,
                     Int_t nbins, Double_t maxXval, Double_t minXval)
        :AliHBTMonOneParticleFctn(name,title)
 {
+  //ctor
    TString numstr = fName + " Result";  //title and name of the 
                                            //result histogram
          
    fResult   = new TH1D(numstr.Data(),numstr.Data(),nbins,minXval,maxXval);
+   fResult->Sumw2();
+   fResult->SetDirectory(0x0);
+   
 }
 /******************************************************************/
 AliHBTMonOneParticleFctn1D::~AliHBTMonOneParticleFctn1D()
 {
-  delete fResult;
+ //dtor
+ delete fResult;
 }
 /******************************************************************/
 
-void AliHBTMonOneParticleFctn1D::ProcessSameEventParticles(AliHBTParticle* particle)
+void AliHBTMonOneParticleFctn1D::Process(AliVAODParticle* particle)
 {
  //Fills the result
    particle = CheckParticle(particle);
@@ -160,26 +235,30 @@ void AliHBTMonOneParticleFctn1D::ProcessSameEventParticles(AliHBTParticle* parti
  
 ClassImp( AliHBTMonOneParticleFctn2D )
 
-AliHBTMonOneParticleFctn2D::
-AliHBTMonOneParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval , 
+AliHBTMonOneParticleFctn2D::AliHBTMonOneParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval , 
                     Int_t nYbins, Double_t maxYval, Double_t minYval)
 
 {
+  //ctor
    TString numstr = fName + " Result";  //title and name of the 
                                            //result histogram
         
    fResult   = new TH2D(numstr.Data(),numstr.Data(),
                            nXbins,minXval,maxXval,
               nYbins,minYval,maxYval);
-              
+   fResult->Sumw2();
+   fResult->SetDirectory(0x0);
 }        
+/******************************************************************/
 
 AliHBTMonOneParticleFctn2D::~AliHBTMonOneParticleFctn2D()
 {
+  //dtor
   delete fResult;
 }
-void AliHBTMonOneParticleFctn2D::ProcessSameEventParticles(AliHBTParticle* particle)
+void AliHBTMonOneParticleFctn2D::Process(AliVAODParticle* particle)
 {
+  //fills the function for one particle
   particle = CheckParticle(particle);
   if(particle) 
    { 
@@ -201,6 +280,7 @@ AliHBTMonOneParticleFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval,
                     Int_t nZbins, Double_t maxZval, Double_t minZval)
 
 {
+  //ctor
    TString numstr = fName + " Result";  //title and name of the 
                                            //result histogram
  
@@ -208,12 +288,15 @@ AliHBTMonOneParticleFctn3D(Int_t nXbins, Double_t maxXval, Double_t minXval,
                            nXbins,minXval,maxXval,
               nYbins,minYval,maxYval,
               nZbins,minZval,maxZval);
+   fResult->Sumw2();
+   fResult->SetDirectory(0x0);
 
 }        
 /******************************************************************/
 
 AliHBTMonOneParticleFctn3D::~AliHBTMonOneParticleFctn3D()
 {
+  //dtor
   delete fResult;
 }
 /******************************************************************/
@@ -227,12 +310,14 @@ ClassImp( AliHBTMonTwoParticleFctn1D)
 AliHBTMonTwoParticleFctn1D::
 AliHBTMonTwoParticleFctn1D(Int_t nbins, Double_t maxval, Double_t minval)
  {
+   //ctor
    TString numstr = fName + " Result";  //title and name of the 
                                            //result histogram
          
    fResult   = new TH1D(numstr.Data(),numstr.Data(),
                            nbins,minval,maxval);
-              
+   fResult->Sumw2();
+   fResult->SetDirectory(0x0);
  }
 
 AliHBTMonTwoParticleFctn1D::
@@ -240,24 +325,28 @@ AliHBTMonTwoParticleFctn1D(const Char_t* name, const Char_t* title,
                     Int_t nbins, Double_t maxval, Double_t minval)
        :AliHBTMonTwoParticleFctn(name,title)
  {
+   //ctor
    TString numstr = fName + " Result";  //title and name of the 
                                            //result histogram
 
    fResult   = new TH1D(numstr.Data(),numstr.Data(),
                            nbins,minval,maxval);
-              
+   fResult->Sumw2();
+   fResult->SetDirectory(0x0);
  }
 
 
 /******************************************************************/
 AliHBTMonTwoParticleFctn1D::~AliHBTMonTwoParticleFctn1D()
 {
+  //dtor
   delete fResult;
 }
 /******************************************************************/
 void AliHBTMonTwoParticleFctn1D::
-ProcessSameEventParticles(AliHBTParticle* trackparticle, AliHBTParticle* partparticle)
+Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
 {
+  //fills the function for one particle
   partparticle  = CheckParticle(partparticle);
   trackparticle = CheckParticle(trackparticle);
   if( partparticle && trackparticle) 
@@ -277,23 +366,27 @@ AliHBTMonTwoParticleFctn2D(Int_t nXbins, Double_t maxXval, Double_t minXval ,
                     Int_t nYbins, Double_t maxYval, Double_t minYval)
 
 {
+  //ctor
    TString numstr = fName + " Result";  //title and name of the 
                                            //result histogram
          
    fResult   = new TH2D(numstr.Data(),numstr.Data(),
                            nXbins,minXval,maxXval,
               nYbins,minYval,maxYval);
-              
+   fResult->Sumw2();
+   fResult->SetDirectory(0x0);
 }        
 /******************************************************************/
 AliHBTMonTwoParticleFctn2D::~AliHBTMonTwoParticleFctn2D()
 {
+  //dtor
   delete fResult;
 }
 /******************************************************************/
 void AliHBTMonTwoParticleFctn2D::
-ProcessSameEventParticles(AliHBTParticle* trackparticle, AliHBTParticle* partparticle)
+Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
 {
+  //fills the function for one particle
   partparticle  = CheckParticle(partparticle);
   trackparticle = CheckParticle(trackparticle);
   if( partparticle && trackparticle) 
@@ -309,8 +402,9 @@ ProcessSameEventParticles(AliHBTParticle* trackparticle, AliHBTParticle* partpar
 ClassImp(AliHBTMonTwoParticleFctn3D)
 
 void AliHBTMonTwoParticleFctn3D::
-ProcessSameEventParticles(AliHBTParticle* trackparticle, AliHBTParticle* partparticle)
+Process(AliVAODParticle* trackparticle, AliVAODParticle* partparticle)
 {
+  //fills the function for one particle
   partparticle  = CheckParticle(partparticle);
   trackparticle = CheckParticle(trackparticle);
   if( partparticle && trackparticle)