]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG4/JetTasks/AliAnalysisTaskJetCorrections.cxx
Modify terminate to include histograms with clusters and cells global positions,...
[u/mrichter/AliRoot.git] / PWG4 / JetTasks / AliAnalysisTaskJetCorrections.cxx
index b901abc6d2688620ff4c49e328823e9be370b245..686226cb5ca1dc373131dbfc33092dd498dc987b 100644 (file)
@@ -1,41 +1,44 @@
-#include <TROOT.h>
-#include <TSystem.h>
-#include <TInterpreter.h>
-#include <TChain.h>
+// **************************************
+// Task used for estimating a charged to neutral correction
+// sona.pochybova@cern.ch
+// *******************************************
+
+
+/**************************************************************************
+ * 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 <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 "AliAnalysisTaskJetCorrections.h"
 #include "AliAnalysisManager.h"
-#include "AliESDEvent.h"
 #include "AliAODEvent.h"
 #include "AliAODVertex.h"
 #include "AliAODHandler.h"
 #include "AliAODTrack.h"
 #include "AliAODJet.h"
-#include "AliMCEventHandler.h"
-#include "AliMCEvent.h"
-#include "AliStack.h"
-#include "AliGenPythiaEventHeader.h"
-#include "AliGenCocktailEventHeader.h"
-
+//#include "AliMCEvent.h"
 
 #include "AliAnalysisHelperJetTasks.h"
 
@@ -183,42 +186,29 @@ Bool_t AliAnalysisTaskJetCorrections::Notify()
   // Implemented Notify() to read the cross sections
   // and number of trials from pyxsec.root
   // 
+
+
   TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
-  UInt_t   ntrials  = 0;
+  Float_t xsection = 0;
+  Float_t ftrials  = 1;
+
+  Float_t fAvgTrials = 1;
   if(tree){
     TFile *curfile = tree->GetCurrentFile();
     if (!curfile) {
       Error("Notify","No current file");
       return kFALSE;
     }
+    AliAnalysisHelperJetTasks::PythiaInfoFromFile(curfile->GetName(),xsection,ftrials);
+    // construct a poor man average trials 
+    Float_t nEntries = (Float_t)tree->GetTree()->GetEntries();
+    if(ftrials>=nEntries)fAvgTrials = ftrials/nEntries; // CKB take this into account for normalisation
+  }  
+
+  if(xsection>0)fXsection  = xsection;
 
-    TString fileName(curfile->GetName());
-    if(fileName.Contains("AliESDs.root")){
-        fileName.ReplaceAll("AliESDs.root", "pyxsec.root");
-    }
-    else if(fileName.Contains("AliAOD.root")){
-        fileName.ReplaceAll("AliAOD.root", "pyxsec.root");
-    }
-    else if(fileName.Contains("galice.root")){
-        // for running with galice and kinematics alone...                      
-        fileName.ReplaceAll("galice.root", "pyxsec.root");
-    }
-    TFile *fxsec = TFile::Open(fileName.Data());
-    if(!fxsec){
-      Printf("%s:%d %s not found in the Input",(char*)__FILE__,__LINE__,fileName.Data());
-      // no a severe condition
-      return kTRUE;
-    }
-    TTree *xtree = (TTree*)fxsec->Get("Xsection");
-    if(!xtree){
-      Printf("%s:%d tree not found in the pyxsec.root",(char*)__FILE__,__LINE__);
-    }
-    xtree->SetBranchAddress("xsection",&fXsection);
-    xtree->SetBranchAddress("ntrials",&ntrials);
-    xtree->GetEntry(0);
-  }
-  
   return kTRUE;
+
 }
 
 
@@ -228,7 +218,7 @@ void AliAnalysisTaskJetCorrections::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());
@@ -444,11 +434,11 @@ void AliAnalysisTaskJetCorrections::UserExec(Option_t * )
       return;
     }
   
-  AliMCEvent* mcEvent =MCEvent();
-  if(!mcEvent){
-    Printf("%s:%d no mcEvent",(char*)__FILE__,__LINE__);
-    return;
-  }
+//   AliMCEvent* mcEvent =MCEvent();
+//   if(!mcEvent){
+//     Printf("%s:%d no mcEvent",(char*)__FILE__,__LINE__);
+//     return;
+//   }
   
   if (fDebug > 10)Printf("%s:%d",(char*)__FILE__,__LINE__);
 
@@ -956,46 +946,10 @@ void AliAnalysisTaskJetCorrections::UserExec(Option_t * )
 //__________________________________________________________________________________________________________________________________________________
 void AliAnalysisTaskJetCorrections::Terminate(Option_t *)
 {
-  printf("AnalysisJetCorrelation::Terminate()");
+  printf("AnalysisJetCorrections::Terminate()");
 
 } 
 
 //_______________________________________User defined functions_____________________________________________________________________________________
-void AliAnalysisTaskJetCorrections::GetThrustAxis(TVector3 &n01, TVector3 * pTrack,const Int_t &nTracks)
-{
-  //
-  // Getthrust axis
-  // 
-  TVector3 psum;
-  Double_t psum1 = 0;
-  Double_t psum2 = 0;
-  Double_t thrust[kTracks];
-  Double_t th = -3;
-  
-  for(Int_t j = 0; j < nTracks; j++)
-    {
-      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];
-       }
-      
-      thrust[j] = psum1/psum2;
-      
-      if(th == thrust[j]) 
-       break;
-      
-      th = thrust[j];
-      
-      n01 = psum.Unit();
-    }
-}
-//______________________________________________________________________________________________________