]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG4/macros/AddTaskJets.C
Added method to add a default set of jet fidners for a deltaAOD
[u/mrichter/AliRoot.git] / PWG4 / macros / AddTaskJets.C
index ba5cdd71ff6334885e893f228eedbb193c3bac9e..2c1da874e6f48715da010f12bad6f742b5ee9d1e 100644 (file)
@@ -3,6 +3,89 @@ AliJetFinder *CreateJetFinder(Char_t *jf,Float_t radius = -1);
 \r
 AliAnalysisTaskJets *AddTaskJets(Char_t *jr, Char_t *jf,Float_t radius = -1); // for the new AF\r
 \r
+AliAnalysisTaskJets *AddTaskJets(){\r
+  // fills the standard "jets" branch in the AOD\r
+  // need the ESDFilter to run before, to access the AODtracks\r
+  // Tracks selected by the first Filter (1<<0)\r
+  // needs to be adapted for different cuts\r
+  \r
+  // UA1 as standard chosen, since it is the most robust and simple JF\r
+  // R = 0.4 suffficient to provide accurate jet axis for correlation studies\r
+  // energy resolution suffers a little\r
+  // Acceptance of jets not limited by the Jet Finder but should be done\r
+  // by user to abs(eta) < 0.5 \r
+\r
+  return AddTaskJets("AOD","UA1",0.4);\r
+\r
+}\r
+\r
+\r
+\r
+Int_t AddTaskJetsDelta(char *nonStdFile = ""){\r
+\r
+  // Adds a whole set of jet finders  all to be written\r
+  // to a delta AOD\r
+  \r
+  // this can in principle be done also with on the fly \r
+  // if we have an ESD input jet fidner task does automatically fetch the ouput aod\r
+\r
+   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();\r
+   if (!mgr) {\r
+      ::Error("AddTaskJetsDelta", "No analysis manager to connect to.");\r
+      return 0;\r
+   }  \r
+   \r
+   // Check the analysis type using the event handlers connected to the analysis manager.\r
+   //==============================================================================\r
+   if (!mgr->GetInputEventHandler()) {\r
+      ::Error("AddTaskJetsDelta", "This task requires an input event handler");\r
+      return 0;\r
+   }\r
+\r
+  AliAODHandler *aodh = (AliAODHandler*)mgr->GetOutputEventHandler();\r
+  if (!aodh) {\r
+    ::Error("AddTaskJetsDelta", "This task needs an output event handler");\r
+    return 0;\r
+  }   \r
+\r
+\r
+\r
+  TString type = mgr->GetInputEventHandler()->GetDataType();\r
+\r
+  AliAnalysisTaskJets *jetana = 0;\r
+  Int_t iCount = 0;\r
+\r
+\r
+  const char *cJF[3]        = {"UA1","UA1","UA1"};\r
+  const Float_t radius[3]   = {0.4, 0.7, 1.0};\r
+  // flag first bit AOD, second bit AODMC2 third bit AODMC2\r
+  // i.e. 7 all, 6 only MC2 and MC\r
+  // this stay at three\r
+  const UInt_t  flag[3]     = {6,7,7};\r
+  const char *cReader[3] = {"AOD","AODMC","AODMC2"};  \r
+\r
+  for(int i = 0; i< 3;i++){\r
+    for(int ib = 0;ib<3;ib++){\r
+      if(flag[i]&(1<<ib)){\r
+       jetana = AddTaskJets(cReader[ib],cJF[i],radius[i]);\r
+       if(jetana){\r
+         char *cRadius = "";\r
+         if(radius[i]>0)cRadius = Form("%02d",(int)(radius[i]*10));\r
+         jetana->SetNonStdBranch(Form("jets%s_%s%s",cReader[ib],cJF[i],cRadius));\r
+         iCount++;\r
+       }\r
+      }\r
+    }\r
+  }\r
+    \r
+  Printf("Added %d JetFinders",iCount);\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
 AliAnalysisTaskJets *AddTaskJets(Char_t *jr, Char_t *jf, Float_t radius)\r
 {\r
   // Creates a jet finder task, configures it and adds it to the analysis manager.\r
@@ -43,13 +126,17 @@ AliAnalysisTaskJets *AddTaskJets(Char_t *jr, Char_t *jf, Float_t radius)
    char *cRadius = "";\r
    if(radius>0)cRadius = Form("%02d",(int)(radius*10));\r
 \r
-   jetana = new AliAnalysisTaskJets(Form("JetAnalysis%s%s%s",jr,jf,cRadius));\r
+   jetana = new AliAnalysisTaskJets(Form("JetAnalysis%s_%s%s",jr,jf,cRadius));\r
    TString type = mgr->GetInputEventHandler()->GetDataType();\r
    if (type == "AOD") jetana->SetNonStdBranch(Form("jets%s",jf));\r
-\r
    \r
-   AliAnalysisDataContainer *cout_jet = mgr->CreateContainer(Form("jethist%s%s%s",jr,jf,cRadius), TList::Class(),\r
-                                                            AliAnalysisManager::kOutputContainer, Form("jethist%s_%s%s.root",jr,jf,cRadius));\r
+   TString c_jr(jr);\r
+   c_jr.ToLower();\r
+   TString c_jf(jf);\r
+   c_jf.ToLower();\r
+\r
+   AliAnalysisDataContainer *cout_jet = mgr->CreateContainer(Form("jethist_%s_%s%s",c_jr.Data(),c_jf.Data(),cRadius), TList::Class(),\r
+                                                            AliAnalysisManager::kOutputContainer, Form("jethist_%s_%s%s.root",c_jr.Data(),c_jf.Data(),cRadius));\r
    // Connect jet finder to task.\r
    jetana->SetJetFinder(jetFinder);\r
    jetana->SetConfigFile("");\r
@@ -76,7 +163,6 @@ AliJetFinder *CreateJetFinder(Char_t *jf,Float_t radius){
     jh->SetRadius(0.7);\r
     \r
     jetFinder = new AliCdfJetFinder();\r
-    jetFinder->SetOutputFile("jets.root");\r
     if (jh) jetFinder->SetJetHeader(jh);\r
     break;\r
 \r
@@ -90,8 +176,8 @@ AliJetFinder *CreateJetFinder(Char_t *jf,Float_t radius){
     if (jh) jetFinder->SetJetHeader(jh);\r
     break;\r
 \r
-\r
   case "FASTJET":\r
+    // DEFAULT is ANTI KT\r
     AliFastJetHeaderV1 *jh = new AliFastJetHeaderV1();\r
     jh->SetRparam(0.4); // setup parameters                                  \r
     if(radius>0)jh->SetRparam(radius);\r
@@ -107,11 +193,13 @@ AliJetFinder *CreateJetFinder(Char_t *jf,Float_t radius){
     jh->SetRadius(0.4);\r
     if(radius>0)jh->SetRadius(radius);\r
     jh->SetEtSeed(4.);\r
+    jh->SetEtSeed(4.);\r
+    jh->SetNAcceptJets(6);\r
     jh->SetLegoNbinPhi(432);\r
     jh->SetLegoNbinEta(274);\r
     jh->SetLegoEtaMin(-2);\r
     jh->SetLegoEtaMax(+2);\r
-    jh->SetMinJetEt(10.);\r
+    jh->SetMinJetEt(5.);\r
     jh->SetJetEtaMax(1.5);\r
     jh->SetJetEtaMin(-1.5);\r
 \r
@@ -126,11 +214,12 @@ AliJetFinder *CreateJetFinder(Char_t *jf,Float_t radius){
     jh->SetRadius(1.0);\r
     if(radius>0)jh->SetRadius(radius);\r
     jh->SetEtSeed(4.);\r
+    jh->SetNAcceptJets(6);\r
     jh->SetLegoNbinPhi(432);\r
     jh->SetLegoNbinEta(274);\r
     jh->SetLegoEtaMin(-2);\r
     jh->SetLegoEtaMax(+2);\r
-    jh->SetMinJetEt(10.);\r
+    jh->SetMinJetEt(5.);\r
     jh->SetJetEtaMax(1.5);\r
     jh->SetJetEtaMin(-1.5);\r
     jetFinder = new AliUA1JetFinderV1();\r