]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG4/JetTasks/AliAnalysisTaskThreeJets.cxx
fixed coding violations, comments on the data members by sona to follow
[u/mrichter/AliRoot.git] / PWG4 / JetTasks / AliAnalysisTaskThreeJets.cxx
index 96e856164f69178a61236e6222631d1cb149d53e..8ae04a3392fff1f2a26078e3dd971772223c0920 100644 (file)
@@ -1,53 +1,52 @@
-#include <TROOT.h>
-#include <TSystem.h>
-#include <TInterpreter.h>
-#include <TChain.h>
+
+// ******
+// Task for topological study of three jet events by sona
+// *****
+// *****
+// *****
+
+
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+
 #include <TFile.h>
 #include <TH1F.h>
-#include <TH1.h>
-#include <TH2.h>
 #include <TH2F.h>
-#include <TH3F.h>
 #include <TList.h>
 #include <TTree.h>
-#include <TBranch.h>
 #include <TLorentzVector.h>
 #include <TClonesArray.h>
-#include <TObjArray.h>
 #include <TRefArray.h>
-#include <TArrayD.h>
-#include <fstream>
 #include <TVector3.h>
 #include <TVectorD.h>
 #include <TMatrixDSym.h>
 #include <TMatrixDSymEigen.h>
-#include <TStyle.h>
 #include <TProfile.h>
-#include  "TDatabasePDG.h"
 
 #include "AliAnalysisTaskThreeJets.h"
 #include "AliAnalysisManager.h"
-#include "AliJetFinder.h"
-#include "AliJetReader.h"
-#include "AliJetHeader.h"
-#include "AliJetReaderHeader.h"
-#include "AliUA1JetHeaderV1.h"
-#include "AliESDEvent.h"
 #include "AliAODEvent.h"
 #include "AliAODVertex.h"
 #include "AliAODHandler.h"
 #include "AliAODTrack.h"
 #include "AliAODJet.h"
-#include "AliMCEventHandler.h"
+#include "AliGenPythiaEventHeader.h"
 #include "AliMCEvent.h"
 #include "AliStack.h"
-#include "AliGenPythiaEventHeader.h"
-#include "AliJetKineReaderHeader.h"
-#include "AliGenCocktailEventHeader.h"
-#include "AliAODPid.h"
-#include "AliExternalTrackParam.h"
 
-#include "AliAnalysisTaskJetSpectrum.h"
 
 #include "AliAnalysisHelperJetTasks.h"
 
@@ -258,7 +257,7 @@ void AliAnalysisTaskThreeJets::UserCreateOutputObjects()
   //
   // Create the output container
   //
-  Printf("Analysing event  %s :: # %5d\n", gSystem->pwd(), (Int_t) fEntry);
+  //  Printf("Analysing event  %s :: # %5d\n", gSystem->pwd(), (Int_t) fEntry);
 
   if(fUseAODInput){
     fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
@@ -1105,6 +1104,9 @@ void AliAnalysisTaskThreeJets::Terminate(Option_t *)
 //_______________________________________User defined functions_____________________________________________________________________________________
 void AliAnalysisTaskThreeJets::FillTopology(TH2F * Dalitz, TH1F * fhMu34, TH1F * fhMu45, TH1F * fhMu35, Double_t * x, TVector3 * pRest, Double_t xsection)
 {
+  //
+  // fill the topology histos
+  //
   Dalitz->Fill(x[0], x[1], xsection);
   fhMu35->Fill(TMath::Sqrt(x[0]*x[2]*(1-(pRest[0].Unit()).Dot(pRest[2].Unit()))/2), xsection);
   fhMu34->Fill(TMath::Sqrt(x[0]*x[1]*(1-(pRest[0].Unit()).Dot(pRest[1].Unit()))/2), xsection);
@@ -1177,16 +1179,25 @@ Bool_t AliAnalysisTaskThreeJets::IsPrimChar(TParticle* aParticle, Int_t aTotalPr
 
 //______________________________________________________________________________________________________
 
-void AliAnalysisTaskThreeJets::GetThrustAxis(TVector3 &n01, TVector3 * pTrack, Int_t &nTracks)
+
+void AliAnalysisTaskThreeJets::GetThrustAxis(TVector3 &n01, TVector3 * pTrack, const Int_t &nTracks)
 {
+  //
+  // fetch the thrust axis
+  //
   TVector3 psum;
   Double_t psum1 = 0;
   Double_t psum2 = 0;
   Double_t thrust[kTracks];
   Double_t th = -3;
+  Double_t tpom = -1;
+  Int_t j = 0;
+
   
-  for(Int_t j = 0; j < nTracks; j++)
+  //  for(Int_t j = 0; j < nTracks; j++)
+  while(TMath::Abs(th-tpom) > 10e-7 && j < nTracks)
     {
+      th = tpom;
       psum.SetXYZ(0., 0., 0.);
       psum1 = 0;
       psum2 = 0;
@@ -1201,12 +1212,13 @@ void AliAnalysisTaskThreeJets::GetThrustAxis(TVector3 &n01, TVector3 * pTrack, I
       
       thrust[j] = psum1/psum2;
       
-      if(th == thrust[j]) 
-       break;
+      //      if(th == thrust[j]) 
+      //       break;
       
-      th = thrust[j];
+      tpom = thrust[j];
       
       n01 = psum.Unit();
+      j++;
     }
 }
 
@@ -1215,11 +1227,13 @@ void AliAnalysisTaskThreeJets::GetThrustAxis(TVector3 &n01, TVector3 * pTrack, I
 void AliAnalysisTaskThreeJets::GetEventShapes(TVector3 &n01, TVector3 * pTrack, Int_t nTracks, Double_t * eventShapes)
 {       
   TVector3 psum;
+  TVector3 pTrackPerp[kTracks];
   Double_t psum1 = 0;
   Double_t psum2 = 0;
   Double_t thrust[kTracks];
   Double_t th = -3;
-  
+  Double_t tpom = -1;
+
   //Sphericity calculation
   TMatrixDSym m(3);
   Double_t s00 = 0;
@@ -1237,32 +1251,41 @@ void AliAnalysisTaskThreeJets::GetEventShapes(TVector3 &n01, TVector3 * pTrack,
   Double_t ptot = 0;
   
   Double_t c = -10;
-  
-  for(Int_t j = 0; j < nTracks; j++)
+
+//
+//loop for thrust calculation  
+//
+  Int_t k = 0;
+  while(TMath::Abs(th-tpom) > 10e-7 && k < nTracks)
     {  
+      th = tpom;
       psum.SetXYZ(0., 0., 0.);
       psum1 = 0;
       psum2 = 0;
       for(Int_t i = 0; i < nTracks; i++)
        {
-         psum1 += (TMath::Abs(n01.Dot(pTrack[i])));
-         psum2 += pTrack[i].Mag();
-         
-         if (n01.Dot(pTrack[i]) > 0) psum += pTrack[i];
-         if (n01.Dot(pTrack[i]) < 0) psum -= pTrack[i];
+         pTrackPerp[i].SetXYZ(pTrack[i].X(), pTrack[i].Y(), 0);
+
+         psum1 += (TMath::Abs(n01.Dot(pTrackPerp[i])));
+         psum2 += pTrackPerp[i].Mag();
+
+         if (n01.Dot(pTrackPerp[i]) > 0) psum += pTrackPerp[i];
+         if (n01.Dot(pTrackPerp[i]) < 0) psum -= pTrackPerp[i];
        }
       
-      thrust[j] = psum1/psum2;
-      if(th == thrust[j]) 
-       break;
-      
-      th = thrust[j];
+      thrust[k] = psum1/psum2;
       
+      tpom = thrust[k];
       n01 = psum.Unit();
+      k++;
+//      Printf("========== %d +++ th :: %f, tpom :: %f=============\n", k, th, tpom);
     }
 
   eventShapes[0] = th;
 
+//
+//other event shapes variables
+//
   for(Int_t j = 0; j < nTracks; j++)
     {  
       s00 = s00 + (pTrack[j].Px()*pTrack[j].Px())/pTrack[j].Mag();
@@ -1280,7 +1303,7 @@ void AliAnalysisTaskThreeJets::GetEventShapes(TVector3 &n01, TVector3 * pTrack,
       ptot += pTrack[j].Mag();
     }
 
-  if(ptot !=0)
+  if(ptot < 10e-10 && ptot > 0.)
     {
       m(0,0) = s00/ptot;
       m(0,1) = s01/ptot;
@@ -1300,32 +1323,34 @@ void AliAnalysisTaskThreeJets::GetEventShapes(TVector3 &n01, TVector3 * pTrack,
       Double_t sphericity = (3/2)*(eigenVal(2)+eigenVal(1));
       eventShapes[1] = sphericity;
 
-      Double_t aplaarity = (3/2)*(eigenVal(2));
-      eventShapes[2] = aplaarity;
+      Double_t aplanarity = (3/2)*(eigenVal(2));
+      eventShapes[2] = aplanarity;
 
       c = 3*(eigenVal(0)*eigenVal(1)+eigenVal(0)*eigenVal(2)+eigenVal(1)*eigenVal(2));
       eventShapes[3] = c;
     }
 }
   
+
+
 //__________________________________________________________________________________________________________________________
 
-Double_t AliAnalysisTaskThreeJets::Exponent(Double_t x, Double_t * par)
+Double_t AliAnalysisTaskThreeJets::Exponent(Double_t x,const Double_t * const par) const
 {
   return par[0]*TMath::Power(1/TMath::E(), TMath::Power(par[1]/x, par[2])+0.5*TMath::Power((x-par[3])/par[0], 2))+par[4]*x;
 }
 
-Double_t AliAnalysisTaskThreeJets::Exponent2(Double_t x, Double_t * par)
+Double_t AliAnalysisTaskThreeJets::Exponent2(Double_t x,const Double_t * const par) const
 {
   return par[0]*TMath::Power(1/TMath::E(), TMath::Power(par[1]/x, par[2]))+par[3]*x;
 }
 
-Double_t AliAnalysisTaskThreeJets::Gauss(Double_t x, Double_t * par)
+Double_t AliAnalysisTaskThreeJets::Gauss(Double_t x,const Double_t * const par) const
 {
   return 1/(par[1])*TMath::Power(1/TMath::E(), 0.5*(x-par[0])*(x-par[0])/(par[1]*par[1]));
 }
 
-Double_t AliAnalysisTaskThreeJets::Total(Double_t x, Double_t * par)
+Double_t AliAnalysisTaskThreeJets::Total(Double_t x,const Double_t * const par) const
 {
   return Exponent(x, par)+Gauss(x, &par[4]);
 }