Adding more jet finders to fragmentation task, adding correct retrieval of number...
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 6 Sep 2010 09:16:38 +0000 (09:16 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 6 Sep 2010 09:16:38 +0000 (09:16 +0000)
PWG4/JetTasks/AliAnalysisTaskFragmentationFunction.cxx
PWG4/JetTasks/AliAnalysisTaskFragmentationFunction.h
PWG4/macros/AddTaskFragmentationFunction.C
PWG4/macros/AnalysisTrainPWG4Jets.C

index adf008c..2f4a118 100644 (file)
@@ -79,6 +79,7 @@ AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction()
    ,fDiJetCDFCut(0)
    ,fDiJetKindBins(0)
    ,fFFRadius(0)
+   ,fAvgTrials(0)
    ,fTracksRec(0)
    ,fTracksRecCuts(0)
    ,fTracksGen(0)
@@ -243,6 +244,7 @@ AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const
   ,fDiJetCDFCut(0)
   ,fDiJetKindBins(0)
   ,fFFRadius(0)
+  ,fAvgTrials(0)
   ,fTracksRec(0)
   ,fTracksRecCuts(0)
   ,fTracksGen(0)
@@ -411,6 +413,7 @@ AliAnalysisTaskFragmentationFunction::AliAnalysisTaskFragmentationFunction(const
   ,fDiJetCDFCut(copy.fDiJetCDFCut)
   ,fDiJetKindBins(copy.fDiJetKindBins)
   ,fFFRadius(copy.fFFRadius)
+  ,fAvgTrials(copy.fAvgTrials)
   ,fTracksRec(copy.fTracksRec)
   ,fTracksRecCuts(copy.fTracksRecCuts)
   ,fTracksGen(copy.fTracksGen)
@@ -581,6 +584,7 @@ AliAnalysisTaskFragmentationFunction& AliAnalysisTaskFragmentationFunction::oper
     fDiJetCDFCut                  = o.fDiJetCDFCut;
     fDiJetKindBins                = o.fDiJetKindBins;
     fFFRadius                     = o.fFFRadius;
+    fAvgTrials                    = o.fAvgTrials;
     fTracksRec                    = o.fTracksRec;
     fTracksRecCuts                = o.fTracksRecCuts;
     fTracksGen                    = o.fTracksGen;
@@ -1765,12 +1769,13 @@ Bool_t AliAnalysisTaskFragmentationFunction::Notify()
   //
   // Implemented Notify() to read the cross sections
   // and number of trials from pyxsec.root
-  // (taken from AliAnalysisTaskJetSpectrum)
+  // (taken from AliAnalysisTaskJetSpectrum2)
   // 
   TTree *tree = AliAnalysisManager::GetAnalysisManager()->GetTree();
-  Double_t xsection = 0;
-  UInt_t   ntrials  = 0;
-  Float_t   ftrials  = 0;
+  Float_t xsection = 0;
+  Float_t ftrials  = 1;
+
+  fAvgTrials = 1;
   if(tree){
     TFile *curfile = tree->GetCurrentFile();
     if (!curfile) {
@@ -1781,61 +1786,12 @@ Bool_t AliAnalysisTaskFragmentationFunction::Notify()
       Printf("%s%d No Histogram fh1Xsec",(char*)__FILE__,__LINE__);
       return kFALSE;
     }
-
-    TString fileName(curfile->GetName());
-    if(fileName.Contains("AliESDs.root")){
-        fileName.ReplaceAll("AliESDs.root", "");
-    }
-    else if(fileName.Contains("AliAOD.root")){
-        fileName.ReplaceAll("AliAOD.root", "");
-    }
-    else if(fileName.Contains("AliAODs.root")){
-        fileName.ReplaceAll("AliAODs.root", "");
-    }
-    else if(fileName.Contains("galice.root")){
-        // for running with galice and kinematics alone...                      
-        fileName.ReplaceAll("galice.root", "");
-    }
-    TFile *fxsec = TFile::Open(Form("%s%s",fileName.Data(),"pyxsec.root"));
-    if(!fxsec){
-      if(fDebug>0)Printf("%s:%d %s not found in the Input",(char*)__FILE__,__LINE__,Form("%s%s",fileName.Data(),"pyxsec.root"));
-      // next trial fetch the histgram file
-      fxsec = TFile::Open(Form("%s%s",fileName.Data(),"pyxsec_hists.root"));
-      if(!fxsec){
-       // not a severe condition
-       if(fDebug>0)Printf("%s:%d %s not found in the Input",(char*)__FILE__,__LINE__,Form("%s%s",fileName.Data(),"pyxsec_hists.root"));        
-       return kTRUE;
-      }
-      else{
-       // find the tlist we want to be independtent of the name so use the Tkey
-       TKey* key = (TKey*)fxsec->GetListOfKeys()->At(0); 
-       if(!key){
-         if(fDebug>0)Printf("%s:%d key not found in the file",(char*)__FILE__,__LINE__);       
-         return kTRUE;
-       }
-       TList *list = dynamic_cast<TList*>(key->ReadObj());
-       if(!list){
-         if(fDebug>0)Printf("%s:%d key is not a tlist",(char*)__FILE__,__LINE__);      
-         return kTRUE;
-       }
-       xsection = ((TProfile*)list->FindObject("h1Xsec"))->GetBinContent(1);
-       ftrials  = ((TH1F*)list->FindObject("h1Trials"))->GetBinContent(1);
-      }
-    }
-    else{
-      TTree *xtree = (TTree*)fxsec->Get("Xsection");
-      if(!xtree){
-       Printf("%s:%d tree not found in the pyxsec.root",(char*)__FILE__,__LINE__);
-      }
-      xtree->SetBranchAddress("xsection",&xsection);
-      xtree->SetBranchAddress("ntrials",&ntrials);
-      ftrials = ntrials;
-      xtree->GetEntry(0);
-    }
+    AliAnalysisHelperJetTasks::PythiaInfoFromFile(curfile->GetName(),xsection,ftrials);
     fh1Xsec->Fill("<#sigma>",xsection);
-    fh1Trials->Fill("#sum{ntrials}",ftrials);
+    // construct a poor man average trials 
+    Float_t nEntries = (Float_t)tree->GetTree()->GetEntries();
+    if(ftrials>=nEntries && nEntries>0.)fAvgTrials = ftrials/nEntries;
   }
-  
   return kTRUE;
 }
 
@@ -2322,6 +2278,8 @@ void AliAnalysisTaskFragmentationFunction::UserExec(Option_t *)
 
         fh1PtHard->Fill(ptHard);
         fh1PtHardTrials->Fill(ptHard,nTrials);
+
+        fh1Trials->Fill("#sum{ntrials}",fAvgTrials);
      }
    }
   
index 3577b6e..d65c5ce 100644 (file)
@@ -479,6 +479,8 @@ class AliAnalysisTaskFragmentationFunction : public AliAnalysisTaskSE {
   static  TArrayD* fDiJetBins;   // bining in invmass, etleading, emean
 
   Float_t fFFRadius;        // if radius > 0 construct FF from tracks within cone around jet axis, otherwise use trackRefs  
+
+  Float_t fAvgTrials;       // average number of trials per event
   
   TList* fTracksRec;            //! reconstructed tracks
   TList* fTracksRecCuts;        //! reconstructed tracks after cuts
index 505ce64..c40e1ab 100644 (file)
@@ -28,6 +28,7 @@ AliAnalysisTaskFragmentationFunction *AddTaskFragmentationFunction(UInt_t iFlag=
         
         AliAnalysisTaskFragmentationFunction *ff=0;
 
+        // UA1 Jets
         // only reconstructed (default)
        if(iFlag&(1<<0)) ff = AddTaskFragmentationFunction("jets", "", "", "", filterMask);
         // charged MC tracks and jets
@@ -38,6 +39,24 @@ AliAnalysisTaskFragmentationFunction *AddTaskFragmentationFunction(UInt_t iFlag=
        if(iFlag&(1<<3)) ff = AddTaskFragmentationFunction("jets", "", "KINEb", "KINEb", filterMask);
         // reconstructed charged tracks after cuts, MC jets in acceptance 
        if(iFlag&(1<<4)) ff = AddTaskFragmentationFunction("jets", "jetsMC2b", "AODMCb", "AOD2b", filterMask);
+
+        // kt jets
+        // only reconstructed 
+       if(iFlag&(1<<10)) ff = AddTaskFragmentationFunction("jetsAOD_FASTKT04", "", "", "", filterMask);
+        // charged MC tracks and jets
+       if(iFlag&(1<<11)) ff = AddTaskFragmentationFunction("jetsAOD_FASTKT04", "jetsAODMC2_FASTKT04", "AODMC", "AODMC2", filterMask);
+        // charged MC tracks and jets with acceptance cuts
+       if(iFlag&(1<<12)) ff = AddTaskFragmentationFunction("jetsAOD_FASTKT04", "jetsAODMC2_FASTKT04", "AODMCb", "AODMC2b", filterMask);
+
+        // anti-kt jets
+        // only reconstructed 
+       if(iFlag&(1<<20)) ff = AddTaskFragmentationFunction("jetsAOD_FASTJET04", "", "", "", filterMask);
+        // charged MC tracks and jets
+       if(iFlag&(1<<21)) ff = AddTaskFragmentationFunction("jetsAOD_FASTJET04", "jetsAODMC2_FASTJET04", "AODMC", "AODMC2", filterMask);
+        // charged MC tracks and jets with acceptance cuts
+       if(iFlag&(1<<22)) ff = AddTaskFragmentationFunction("jetsAOD_FASTJET04", "jetsAODMC2_FASTJET04", "AODMCb", "AODMC2b", filterMask);
+
+
        
        return ff;
 }
index e839786..b281b58 100644 (file)
@@ -458,9 +458,17 @@ void AnalysisTrainPWG4Jets(const char *analysis_mode="local",
        taskFrag = AddTaskFragmentationFunction(1<<1,kHighPtFilterMask);
        taskFrag = AddTaskFragmentationFunction(1<<2,kHighPtFilterMask);
        taskFrag = AddTaskFragmentationFunction(1<<3,kHighPtFilterMask);
+       taskFrag = AddTaskFragmentationFunction(1<<11);  // w/o acceptance cuts
+       taskFrag =  AddTaskFragmentationFunction(1<<12);  // with acceptance cuts
+       // anti-kt
+       taskFrag = AddTaskFragmentationFunction(1<<21);  // w/o acceptance cuts
+       taskFrag = AddTaskFragmentationFunction(1<<22);  // with acceptance cuts
+
      }
      else{
        taskFrag = AddTaskFragmentationFunction(1<<0,kHighPtFilterMask);
+       taskFrag = AddTaskFragmentationFunction(1<<10,kHighPtFilterMask);
+       taskFrag = AddTaskFragmentationFunction(1<<20,kHighPtFilterMask);
      }
 
      if (!taskFrag) ::Warning("AnalysisTrainPWG4Jets", "AliAnalysisTaskFragmentationFunction cannot run for this train conditions - EXCLUDED");