]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenHBTosl.cxx
Put back the doxygen comments in MUONTRGda.cxx
[u/mrichter/AliRoot.git] / EVGEN / AliGenHBTosl.cxx
index 54974053897794a58b1e82d6101b7444321d70a7..7d763d215903175dbb3a9c74580e58f3778ce40b 100644 (file)
@@ -1,4 +1,23 @@
+/**************************************************************************
+ * 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 "AliGenHBTosl.h" 
+#include "AliLog.h"
+
 //__________________________________________________________
 /////////////////////////////////////////////////////////////
 //                                                         //
 
 
 /***********************************************************/
+using std::cout;
+using std::endl;
+using std::ofstream;
+using std::ios;
 ClassImp(AliGenHBTosl)
 
 AliGenHBTosl::AliGenHBTosl():
@@ -81,9 +104,11 @@ AliGenHBTosl::AliGenHBTosl():
  fQRange(0.06),
  fQNBins(60),
  fGenerator(0x0),
+ fStackBuffer(0),
  fBufferSize(5),
  fNBinsToScale(Int_t(fQNBins*0.1)),
  fDebug(0),
+ fSignalShapeCreated(0),
  fMaxIterations(1000),
  fMaxChiSquereChange(0.01),
  fMaxChiSquerePerNDF(1.5), 
@@ -93,6 +118,7 @@ AliGenHBTosl::AliGenHBTosl():
  fSamplePhiMax(TMath::TwoPi()+0.01),
  fSignalRegion(0.0),
  fMinFill(1000),
+ fSwapped(0),
  fLogFile(0x0)
 {
 //default constructor
@@ -110,6 +136,7 @@ AliGenHBTosl::AliGenHBTosl(Int_t n, Int_t pid):
  fQRange(0.06),
  fQNBins(60),
  fGenerator(0x0),
+ fStackBuffer(0),
  fBufferSize(5),
  fNBinsToScale(Int_t(fQNBins*0.1)),
  fDebug(0),
@@ -123,10 +150,43 @@ AliGenHBTosl::AliGenHBTosl(Int_t n, Int_t pid):
  fSamplePhiMax(TMath::TwoPi()+0.01),
  fSignalRegion(0.0),
  fMinFill(1000),
+ fSwapped(0),
  fLogFile(0x0)
 {
 //default constructor
 }
+
+AliGenHBTosl::AliGenHBTosl(const AliGenHBTosl & hbt):
+ AliGenerator(-1),
+ fQCoarseBackground(0x0),
+ fQCoarseSignal(0x0),
+ fQSignal(0x0),
+ fQBackground(0x0),
+ fQSecondSignal(0x0),
+ fQSecondBackground(0x0),
+ fQRange(0.06),
+ fQNBins(60),
+ fGenerator(0x0),
+ fStackBuffer(0),
+ fBufferSize(5),
+ fNBinsToScale(Int_t(fQNBins*0.1)),
+ fDebug(0),
+ fSignalShapeCreated(kFALSE),
+ fMaxIterations(1000),
+ fMaxChiSquereChange(0.01),
+ fMaxChiSquerePerNDF(1.5),
+ fQRadius(8.0),
+ fPID(kPiPlus),
+ fSamplePhiMin(-0.01),
+ fSamplePhiMax(TMath::TwoPi()+0.01),
+ fSignalRegion(0.0),
+ fMinFill(1000),
+ fSwapped(0),
+ fLogFile(0x0)
+{
+// Copy constructor
+    hbt.Copy(*this);
+}
 /***********************************************************/
 
 AliGenHBTosl::~AliGenHBTosl()
@@ -317,7 +377,7 @@ void AliGenHBTosl::Generate()
   }
  
  fGenerator->Generate();
- Int_t j = 0, ntr = 0;
+ Int_t ntr = 0;
  if ( genstack->GetNtrack() < fNpart/2)
   {
     Warning("Generate","************************************************************");
@@ -370,7 +430,7 @@ void AliGenHBTosl::Generate()
  
  char msg[1000];
  logfile<<endl;
- sprintf(msg,"\n");
+ snprintf(msg,1000, "\n");
  Int_t middlebin = fQNBins/2;
  
  for (Int_t k = middlebin-5; k < middlebin+5; k++)
@@ -378,21 +438,21 @@ void AliGenHBTosl::Generate()
      Double_t tx = work->GetXaxis()->GetBinCenter(30);
      Double_t ty = work->GetYaxis()->GetBinCenter(30);
      Double_t tz = work->GetZaxis()->GetBinCenter(k);
-     sprintf(msg,"% 6.5f ",GetQOutQSideQLongCorrTheorValue(tx,ty,tz));
+     snprintf(msg,1000, "% 6.5f ",GetQOutQSideQLongCorrTheorValue(tx,ty,tz));
      logfile<<msg;
    }
  logfile<<endl;
   
  for (Int_t k = middlebin-5; k < middlebin+5; k++)
   {
-    sprintf(msg,"% 6.5f ",work->GetBinContent(30,30,k));
+    snprintf(msg,1000, "% 6.5f ",work->GetBinContent(30,30,k));
     logfile<<msg;
   }
  logfile<<endl;
 
  for (Int_t k = middlebin-5; k < middlebin+5; k++)
   {
-    sprintf(msg,"% 6.5f ",chiarray[30][30][k]);
+    snprintf(msg, 1000, "% 6.5f ",chiarray[30][30][k]);
     logfile<<msg;
   }
  logfile<<endl;
@@ -464,7 +524,7 @@ void AliGenHBTosl::Generate()
      Double_t qoutc  = work->GetXaxis()->GetBinCenter(xmax);
      
 
-     sprintf(msg,"Generate Fill bin chi2(%d,%d,%d)=%f",xmax,ymax,zmax,chiarray[xmax][ymax][zmax]);
+     snprintf(msg,1000, "Generate Fill bin chi2(%d,%d,%d)=%f",xmax,ymax,zmax,chiarray[xmax][ymax][zmax]);
      logfile<<msg;
      
      qout  = gRandom->Uniform(qoutc -binwdh, qoutc +binwdh);
@@ -472,9 +532,11 @@ void AliGenHBTosl::Generate()
      qlong = gRandom->Uniform(qlongc-binwdh, qlongc+binwdh);
 
      TParticle* first = 0;
-     while (j < genstack->GetNtrack())
+     Int_t jj = 0;
+     
+     while (jj < genstack->GetNtrack())
       {
-        TParticle* tmpp = genstack->Particle(j++);
+        TParticle* tmpp = genstack->Particle(jj++);
         if (tmpp->GetPdgCode() == fPID)
          {
            if (CheckParticle(tmpp,0x0,stack) == kFALSE)
@@ -590,7 +652,7 @@ void AliGenHBTosl::GetOneD(TParticle* first, TParticle* second,Double_t qinv)
 //        TParticle(pdg, is, parent, -1, kFirstDaughter, kLastDaughter,
 //                px, py, pz, e, vx, vy, vz, tof);
  
-  if (GetDebug()) Info("GetOneD","Randomized qinv = %f, obtained = %f",qinv,GetQInv(first,second));
+  AliDebug(1,Form("Randomized qinv = %f, obtained = %f",qinv,GetQInv(first,second)));
 
 }
 /***********************************************************/
@@ -714,7 +776,7 @@ Int_t AliGenHBTosl::GetThreeD(TParticle* first,TParticle* second, Double_t qout,
   second->SetMomentum(vector.X(),vector.Y(),vector.Z(),e);
   
 ////////////  
-  if ( GetDebug() > 3 )
+  if ( AliDebugLevel() > 3 )
    {
      e=TMath::Sqrt(m2+px*px);  
      TParticle* f = new TParticle(first->GetPdgCode(),0,-1,-1,-1,-1, px , 0.0, 0.0, e,0.0,0.0,0.0,0.0);
@@ -840,21 +902,21 @@ void AliGenHBTosl::StartSignal()
     {
       c1->cd();
       char buff[50];
-      sprintf(buff,"QTWorkPass2.%3d.root",counter);
+      snprintf(buff,50, "QTWorkPass2.%3d.root",counter);
       TFile* file = TFile::Open(buff,"update");
       work->Write();
       work->SetDirectory(0x0);
       file->Close();
       delete file;
 
-      sprintf(buff,"QTBackgroundPass2.%3d.root",counter);
+      snprintf(buff,50, "QTBackgroundPass2.%3d.root",counter);
       file = TFile::Open(buff,"update");
       fQBackground->Write();
       fQBackground->SetDirectory(0x0);
       file->Close();
       delete file;
 
-      sprintf(buff,"QTSignalPass2.%3d.root",counter);
+      snprintf(buff,50, "QTSignalPass2.%3d.root",counter);
       file = TFile::Open(buff,"update");
       fQSignal->Write();
       fQSignal->SetDirectory(0x0);
@@ -902,21 +964,21 @@ void AliGenHBTosl::StartSignal()
       Double_t tx = work->GetXaxis()->GetBinCenter(30);
       Double_t ty = work->GetYaxis()->GetBinCenter(30);
       Double_t tz = work->GetZaxis()->GetBinCenter(k);
-      sprintf(msg,"% 6.5f ",GetQOutQSideQLongCorrTheorValue(tx,ty,tz));
+      snprintf(msg,1000, "% 6.5f ",GetQOutQSideQLongCorrTheorValue(tx,ty,tz));
       logfile<<msg;
     }
    logfile<<endl;
 
    for (Int_t k = 25; k < 36; k++)
     {
-      sprintf(msg,"%6.5f ",work->GetBinContent(30,30,k));
+      snprintf(msg, 1000, "%6.5f ",work->GetBinContent(30,30,k));
       logfile<<msg;
     }
    logfile<<endl;
 
    for (Int_t k = 25; k < 36; k++)
     {
-      sprintf(msg,"% 6.5f ",chiarray[30][30][k]);
+      snprintf(msg,1000, "% 6.5f ",chiarray[30][30][k]);
       logfile<<msg;
     }
    logfile<<endl;
@@ -1234,7 +1296,7 @@ void AliGenHBTosl::StartSignalPass1()
     
     for (Int_t k = 1; k<=fQNBins; k++)
       {
-       for (Int_t j = 1; j<=fQNBins; j++)
+       for (j = 1; j<=fQNBins; j++)
          {  
            for (Int_t i = 1; i<=fQNBins; i++)
              {
@@ -1278,7 +1340,7 @@ void AliGenHBTosl::FillCoarseSignal()
        }  
     }   
  
-  //if (GetDebug()) 
+  //if (AliDebugLevel()) 
   TestCoarseSignal();
  
   Info("FillCoarseSignal","DONE"); 
@@ -1507,7 +1569,7 @@ void  AliGenHBTosl::GetQOutQSideQLong(TParticle* f, TParticle* s,Double_t& out,
   }
 
  Double_t beta = pzsum/esum;
- Double_t gamma = 1.0/TMath::Sqrt(1.0 - beta*beta);
+ Double_t gamma = 1.0/TMath::Sqrt((1.-beta)*(1.+beta));
 
  lon = gamma * ( pzdiff - beta*ediff );
 
@@ -1523,22 +1585,22 @@ Double_t AliGenHBTosl::Scale(TH3D* num, TH3D* den)
  //Calculates the factor that should be used to scale
  //quatience of num and den to 1 at tail
 
-  if (GetDebug()) Info("Scale","Entered Scale()");
+  AliDebug(1,"Entered");
   if(!num)
    {
-     Error("Scale","No numerator");
+     AliError("No numerator");
      return 0.0;
    }
   if(!den)
    {
-     Error("Scale","No denominator");
+     AliError("No denominator");
      return 0.0;
    }
 
   if(fNBinsToScale < 1)
    {
+    AliError("Number of bins for scaling is smaller than 1");
     return 0.0;
-    Error("Scale","Number of bins for scaling is smaller thnan 1");
    }
   Int_t fNBinsToScaleX = fNBinsToScale;
   Int_t fNBinsToScaleY = fNBinsToScale;
@@ -1547,25 +1609,25 @@ Double_t AliGenHBTosl::Scale(TH3D* num, TH3D* den)
   Int_t nbinsX = num->GetNbinsX();
   if (fNBinsToScaleX > nbinsX) 
    {
-    Error("Scale","Number of X bins for scaling is bigger thnan number of bins in histograms");
+    AliError("Number of X bins for scaling is bigger thnan number of bins in histograms");
     return 0.0;
    }
    
   Int_t nbinsY = num->GetNbinsX();
   if (fNBinsToScaleY > nbinsY) 
    {
-    Error("Scale","Number of Y bins for scaling is bigger thnan number of bins in histograms");
+    AliError("Number of Y bins for scaling is bigger thnan number of bins in histograms");
     return 0.0;
    }
 
   Int_t nbinsZ = num->GetNbinsZ();
   if (fNBinsToScaleZ > nbinsZ) 
    {
-    Error("Scale","Number of Z bins for scaling is bigger thnan number of bins in histograms");
+    AliError("Number of Z bins for scaling is bigger thnan number of bins in histograms");
     return 0.0;
    }
 
-  if (GetDebug()>0) Info("Scale","No errors detected");
+  AliDebug(1,"No errors detected");
 
   Int_t offsetX = nbinsX - fNBinsToScaleX - 1; //bin that we start loop over bins in axis X
   Int_t offsetY = nbinsY - fNBinsToScaleY - 1; //bin that we start loop over bins in axis Y
@@ -1586,14 +1648,13 @@ Double_t AliGenHBTosl::Scale(TH3D* num, TH3D* den)
          }
        }
   
-  if(GetDebug() > 0) 
-    Info("Scale","numsum=%f densum=%f fNBinsToScaleX=%d fNBinsToScaleY=%d fNBinsToScaleZ=%d",
-          numsum,densum,fNBinsToScaleX,fNBinsToScaleY,fNBinsToScaleZ);
+  AliDebug(1,Form("numsum=%f densum=%f fNBinsToScaleX=%d fNBinsToScaleY=%d fNBinsToScaleZ=%d",
+          numsum,densum,fNBinsToScaleX,fNBinsToScaleY,fNBinsToScaleZ));
   
   if (numsum == 0) return 0.0;
   Double_t ret = densum/numsum;
 
-  if(GetDebug() > 0) Info("Scale","returning %f",ret);
+  AliDebug(1,Form("returning %f",ret));
   return ret;
    
 }
@@ -1712,7 +1773,7 @@ void AliGenHBTosl::Rotate(TVector3& relvector, TVector3& vector)
 //In other words: To make equations easier
 
   static TVector3 first;
-  if (GetDebug()
+  if (AliDebugLevel()>=1
    {
      first.SetXYZ(relvector.x(),relvector.y(),relvector.z());
    }
@@ -1729,14 +1790,14 @@ void AliGenHBTosl::Rotate(TVector3& relvector, TVector3& vector)
   vector.RotateY(rotAngleY);
   vector.RotateZ(rotAngleZ);
   
-  if (GetDebug()>5)
+  if (AliDebugLevel()>5)
    {
     TVector3 test(firstPx,0.0,0.0);
     test.RotateY(rotAngleY);
     test.RotateZ(rotAngleZ);
-    ::Info("Rotate","Rotation test: px %f %f",first.x(),test.x());
-    ::Info("Rotate","Rotation test: py %f %f",first.y(),test.y());
-    ::Info("Rotate","Rotation test: pz %f %f",first.z(),test.z());
+    AliInfo(Form("Rotation test: px %f %f",first.x(),test.x()));
+    AliInfo(Form("Rotation test: py %f %f",first.y(),test.y()));
+    AliInfo(Form("Rotation test: pz %f %f",first.z(),test.z()));
    }
 }
 /***********************************************************/
@@ -1755,11 +1816,11 @@ Double_t AliGenHBTosl::Rotate(Double_t x,Double_t y,Double_t z)
   TVector3 v(x,y,z);
   Double_t a1 = -TMath::ATan2(v.Y(),v.X());
   
-  if (GetDebug()>5)
+  if (AliDebugLevel()>5)
    {
-     ::Info("Rotate","Xpr = %f  Ypr = %f",xprime,yprime);
-     ::Info("Rotate","Calc sin = %f, and %f",sinphi,TMath::Sin(a1));
-     ::Info("Rotate","Calc cos = %f, and %f",cosphi,TMath::Cos(a1));
+     AliInfo(Form("Xpr = %f  Ypr = %f",xprime,yprime));
+     AliInfo(Form("Calc sin = %f, and %f",sinphi,TMath::Sin(a1)));
+     AliInfo(Form("Calc cos = %f, and %f",cosphi,TMath::Cos(a1)));
    }
 
   Double_t xprimezlength = TMath::Hypot(xprime,z);
@@ -1770,7 +1831,7 @@ Double_t AliGenHBTosl::Rotate(Double_t x,Double_t y,Double_t z)
   
   Double_t xbis = sintheta*z + costheta*(cosphi*x - sinphi*y);
   
-  ::Info("Rotate","Calculated rot %f, modulus %f",xbis,TMath::Sqrt(x*x+y*y+z*z));
+  AliInfo(Form("Calculated rot %f, modulus %f",xbis,TMath::Sqrt(x*x+y*y+z*z)));
   return xbis;
 }
 /***********************************************************/
@@ -1816,7 +1877,7 @@ Bool_t AliGenHBTosl::CheckParticle(TParticle* p, TParticle* aupair ,AliStack* st
 {
  //Checks if a given particle is falling into signal region with any other particle
  //already existing on stack
- return kFALSE;
 //PH return kFALSE;
   
  if (fSignalRegion <=0) return kFALSE;
  
@@ -1880,3 +1941,20 @@ void AliGenHBTosl::SwapGeneratingHistograms()
   fSwapped = kTRUE;
   
 }
+
+AliGenHBTosl& AliGenHBTosl::operator=(const  AliGenHBTosl& rhs)
+{
+// Assignment operator
+    rhs.Copy(*this);
+    return *this;
+}
+
+void AliGenHBTosl::Copy(TObject&) const
+{
+    //
+    // Copy 
+    //
+    Fatal("Copy","Not implemented!\n");
+}
+
+