From Marta
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 12 Jun 2013 20:01:29 +0000 (20:01 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 12 Jun 2013 20:01:29 +0000 (20:01 +0000)
- AliAnalysisTaskRhoBase.h: getters for the name of rho and rho_scaled
- AddTaskRhoSparse.C: do not attach wagon if is already there. Like we also do for the jet finders
- TriggerQA: AddTask, cxx and h files: changed configuration and some names for easier running on lego train

PWGJE/EMCALJetTasks/AliAnalysisTaskRhoBase.h
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalJetTriggerQA.cxx
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalJetTriggerQA.h
PWGJE/EMCALJetTasks/macros/AddTaskEmcalJetTriggerQA.C
PWGJE/EMCALJetTasks/macros/AddTaskRhoSparse.C

index b04bb0a..0b08a09 100644 (file)
@@ -28,6 +28,9 @@ class AliAnalysisTaskRhoBase : public AliAnalysisTaskEmcalJet {
   void                   SetInEventSigmaRho(Double_t s)                        { fInEventSigmaRho      = s    ;                   }
   void                   SetAttachToEvent(Bool_t a)                            { fAttachToEvent        = a    ;                   }
 
+  const TString&         GetRhoName() const                                    { return fRhoName;                                 }
+  const TString&         GetRhoScaledName() const                              { return fRhoScaledName;                           } 
+
  protected:
   void                   ExecOnce();
   Bool_t                 Run();
index b2253c1..7b0d0b1 100644 (file)
@@ -33,12 +33,13 @@ AliAnalysisTaskEmcalJetTriggerQA::AliAnalysisTaskEmcalJetTriggerQA() :
   fDebug(kFALSE),
   fUseAnaUtils(kTRUE),
   fAnalysisUtils(0),
-  fJetsNameCh("Jet_AKTChargedR040_PicoTracks_pT0150_caloClustersCorr_ET0300"),
-  fJetsCh(0),
-  fEtaMaxChJet(0.5),
-  fPhiMinChJet(0.),
-  fPhiMaxChJet(TMath::TwoPi()),
-  fMaxTrackPtChJet(100.),
+  fJetsName2("Jet_AKTChargedR040_PicoTracks_pT0150_caloClustersCorr_ET0300"),
+  fJets2(0),
+  fEtaMinJet2(0.5),
+  fEtaMaxJet2(0.5),
+  fPhiMinJet2(-10.),
+  fPhiMaxJet2(10.),
+  fMaxTrackPtJet2(100.),
   fRhoChName(""),
   fRhoCh(0),
   fRhoChVal(0),
@@ -79,12 +80,13 @@ AliAnalysisTaskEmcalJetTriggerQA::AliAnalysisTaskEmcalJetTriggerQA(const char *n
   fDebug(kFALSE),
   fUseAnaUtils(kTRUE),
   fAnalysisUtils(0),
-  fJetsNameCh("Jet_AKTChargedR040_PicoTracks_pT0150_caloClustersCorr_ET0300"),
-  fJetsCh(0),
-  fEtaMaxChJet(0.5),
-  fPhiMinChJet(0.),
-  fPhiMaxChJet(TMath::TwoPi()),
-  fMaxTrackPtChJet(100.),
+  fJetsName2("Jet_AKTChargedR040_PicoTracks_pT0150_caloClustersCorr_ET0300"),
+  fJets2(0),
+  fEtaMinJet2(0.5),
+  fEtaMaxJet2(0.5),
+  fPhiMinJet2(-10.),
+  fPhiMaxJet2(10.),
+  fMaxTrackPtJet2(100.),
   fRhoChName(""),
   fRhoCh(0),
   fRhoChVal(0),
@@ -299,15 +301,15 @@ void AliAnalysisTaskEmcalJetTriggerQA::LoadExtraBranches() {
   // get charged jets
   //
 
-  if (!fJetsNameCh.IsNull() && !fJetsCh) {
-    fJetsCh = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fJetsNameCh.Data()));
-    if (!fJetsCh) {
-      AliError(Form("%s: Could not retrieve charged jets %s!", GetName(), fJetsNameCh.Data()));
+  if (!fJetsName2.IsNull() && !fJets2) {
+    fJets2 = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fJetsName2.Data()));
+    if (!fJets2) {
+      AliError(Form("%s: Could not retrieve charged jets %s!", GetName(), fJetsName2.Data()));
       return;
     }
-    else if (!fJetsCh->GetClass()->GetBaseClass("AliEmcalJet")) {
-      AliError(Form("%s: Collection %s does not contain AliEmcalJet objects!", GetName(), fJetsNameCh.Data()));
-      fJetsCh = 0;
+    else if (!fJets2->GetClass()->GetBaseClass("AliEmcalJet")) {
+      AliError(Form("%s: Collection %s does not contain AliEmcalJet objects!", GetName(), fJetsName2.Data()));
+      fJets2 = 0;
       return;
     }
   }
@@ -332,9 +334,9 @@ void AliAnalysisTaskEmcalJetTriggerQA::LoadExtraBranches() {
 }
 
 //________________________________________________________________________
-Bool_t AliAnalysisTaskEmcalJetTriggerQA::AcceptChargedJet(const AliEmcalJet *jet) const {
+Bool_t AliAnalysisTaskEmcalJetTriggerQA::AcceptJet2(const AliEmcalJet *jet) const {
 
-  // Accept charged jet
+  // Accept jet in 2nd branch
 
   Bool_t accept = kFALSE;
 
@@ -345,16 +347,17 @@ Bool_t AliAnalysisTaskEmcalJetTriggerQA::AcceptChargedJet(const AliEmcalJet *jet
   if(jet->Area()<fJetAreaCut)
     return accept;
 
-  //Check if jet is within EMCAL acceptance
+  //Check if jet is within fiducial acceptance
   Double_t eta = jet->Eta();
   Double_t phi = jet->Phi();
-  if(TMath::Abs(eta)>fEtaMaxChJet) 
+
+  if(eta<fEtaMinJet2 || eta>fEtaMaxJet2)
     return accept;
 
-  if(phi<fPhiMinChJet || phi>fPhiMaxChJet)
+  if(phi<fPhiMinJet2 || phi>fPhiMaxJet2)
     return accept;
 
-  if (jet->MaxTrackPt() > fMaxTrackPt)
+  if (jet->MaxTrackPt() > fMaxTrackPtJet2)
     return kFALSE;
 
   return kTRUE;
@@ -592,17 +595,17 @@ Bool_t AliAnalysisTaskEmcalJetTriggerQA::FillHistograms()
   nJetsArr->Reset(0);
   
   //Loop over charged jets
-  if (fJetsCh) {
-    const Int_t njetsCh = fJetsCh->GetEntriesFast();
+  if (fJets2) {
+    const Int_t njetsCh = fJets2->GetEntriesFast();
     for (Int_t ij = 0; ij < njetsCh; ij++) {
 
-      AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJetsCh->At(ij));
+      AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets2->At(ij));
       if (!jet) {
        AliError(Form("Could not receive charged jet %d", ij));
        continue;
       }
 
-      if(!AcceptChargedJet(jet)) 
+      if(!AcceptJet2(jet)) 
        continue;
       
       Double_t jetPt = jet->Pt();
@@ -622,7 +625,7 @@ Bool_t AliAnalysisTaskEmcalJetTriggerQA::FillHistograms()
     }
   }
 
-  if(fJets && fJetsCh) {
+  if(fJets && fJets2) {
     fh2PtLeadJet1VsLeadJet2->Fill(ptLeadJet1,ptLeadJet2);
   }
 
@@ -650,7 +653,8 @@ Bool_t AliAnalysisTaskEmcalJetTriggerQA::Run()
   else
     fRhoChVal = fRhoCh->GetVal();
 
-  FindTriggerPatch();
+  if(!fTriggerClass.IsNull())
+    FindTriggerPatch();
 
   return kTRUE;  // If return kFALSE FillHistogram() will NOT be executed.
 }
index cb16503..90aa097 100644 (file)
@@ -30,16 +30,19 @@ class AliAnalysisTaskEmcalJetTriggerQA : public AliAnalysisTaskEmcalJet {
   Bool_t                      SelectEvent();              //decides if event is used for analysis
   void                        FindTriggerPatch();
 
-  Bool_t                      AcceptChargedJet(const AliEmcalJet *jet) const;
+  Bool_t                      AcceptJet2(const AliEmcalJet *jet) const;
 
   //Setters
   void SetDebug(Int_t d)                    { fDebug = d;}
   void SetTriggerClass(const char *n)       { fTriggerClass = n; }
   void SetNFastorPatch(Int_t i)             { fNFastOR = i;}
  
-  void SetJetsChName(const char *n)         { fJetsNameCh = n; }
+  void SetJetsName2(const char *n)          { fJetsName2 = n; }
   void SetRhoChName(const char *n)          { fRhoChName = n; }
-  void SetChargedJetEtaMax(Double_t e)      { fEtaMaxChJet = e;}
+  void SetMinEtaJets2(Double_t p)           { fEtaMinJet2 = p;}
+  void SetMaxEtaJets2(Double_t p)           { fEtaMaxJet2 = p;}
+  void SetMinPhiJets2(Double_t p)           { fPhiMinJet2 = p;}
+  void SetMaxPhiJets2(Double_t p)           { fPhiMaxJet2 = p;}
 
   Double_t GetZ(const AliVParticle *trk, const AliEmcalJet *jet)       const;
   Double_t GetZ(const Double_t trkPx, const Double_t trkPy, const Double_t trkPz, const Double_t jetPx, const Double_t jetPy, const Double_t jetPz) const;
@@ -56,12 +59,13 @@ class AliAnalysisTaskEmcalJetTriggerQA : public AliAnalysisTaskEmcalJet {
   Bool_t            fDebug;                 //  debug level
   Bool_t            fUseAnaUtils;           //  used for LHC13* data
   AliAnalysisUtils *fAnalysisUtils;         //! vertex selection
-  TString           fJetsNameCh;            //  name of charged jet collection
-  TClonesArray     *fJetsCh;                //! list with charged jets
-  Double_t          fEtaMaxChJet;           //  max eta of jet axis, charged jets
-  Double_t          fPhiMinChJet;           //  min phi of jet axis, charged jets
-  Double_t          fPhiMaxChJet;           //  max phi of jet axis, charged jets
-  Double_t          fMaxTrackPtChJet;       //  maximum track pT in jet
+  TString           fJetsName2;             //  name of charged jet collection
+  TClonesArray     *fJets2;                 //! list with charged jets
+  Double_t          fEtaMinJet2;            //  min eta of jet axis, jets in 2nd branch
+  Double_t          fEtaMaxJet2;            //  max eta of jet axis, jets in 2nd branch
+  Double_t          fPhiMinJet2;            //  min phi of jet axis, jets in 2nd branch
+  Double_t          fPhiMaxJet2;            //  max phi of jet axis, jets in 2nd branch
+  Double_t          fMaxTrackPtJet2;        //  maximum track pT in jet
 
   TString           fRhoChName;             //  name of charged rho branch
   AliRhoParameter  *fRhoCh;                 //! event rho charged
index e5e0705..baff329 100644 (file)
@@ -1,12 +1,19 @@
-AliAnalysisTaskEmcalJetTriggerQA* AddTaskEmcalJetTriggerQA(TString kTracksName = "PicoTracks", 
-                                                          TString kClusName = "caloClusterCorr",
-                                                          Double_t R = 0.4, 
-                                                          Double_t ptminTrack = 0.15, 
-                                                          Double_t etminClus = 0.3, 
-                                                          Int_t rhoType = 0,
-                                                          UInt_t type = AliAnalysisTaskEmcal::kEMCAL,
-                                                          TString trigClass = "",
-                                                          TString kEmcalCellsName = "") {
+AliAnalysisTaskEmcalJetTriggerQA* AddTaskEmcalJetTriggerQA(TString     kTracksName         = "PicoTracks", 
+                                                          TString     kClusName           = "caloClusterCorr",
+                                                          Double_t    R                   = 0.4, 
+                                                          Double_t    ptminTrack          = 0.15, 
+                                                          Double_t    etminClus           = 0.3, 
+                                                          Int_t       rhoType             = 0,
+                                                          UInt_t      type                = AliAnalysisTaskEmcal::kEMCAL,
+                                                          TString     trigClass           = "",
+                                                          TString     kEmcalCellsName     = "",
+                                                          const char *CentEst             = "V0A",
+                                                          Int_t       pSel                = AliVEvent::kINT7
+                                                          ) {
+
+  enum AlgoType {kKT, kANTIKT};
+  enum JetType  {kFULLJETS, kCHARGEDJETS, kNEUTRALJETS};
+
 
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr)
@@ -25,48 +32,95 @@ AliAnalysisTaskEmcalJetTriggerQA* AddTaskEmcalJetTriggerQA(TString kTracksName =
       return NULL;
     }
 
+  // #### Add necessary jet finder tasks
+  gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskEmcalJet.C");
+
+  AliEmcalJetTask* jetFinderTask1;
+  AliEmcalJetTask* jetFinderTask2;
+  if(kClusName.IsNull()) {  //particle level jets
+    jetFinderTask1 = AddTaskEmcalJet(kTracksName, "", kANTIKT, R, kFULLJETS, ptminTrack, etminClus);
+    jetFinderTask2 = AddTaskEmcalJet(kTracksName, "", kANTIKT, R, kCHARGEDJETS, ptminTrack, etminClus);
+  }
+  else if(kTracksName.IsNull()) { //neutral/calo jets
+    jetFinderTask1 = AddTaskEmcalJet(kTracksName, kClusName, kANTIKT, R, kNEUTRALJETS, ptminTrack, etminClus);
+    jetFinderTask2 = AddTaskEmcalJet(kTracksName, kClusName, kANTIKT, R, kFULLJETS, ptminTrack, etminClus);
+  }
+  else { //full jets
+    jetFinderTask1 = AddTaskEmcalJet(kTracksName, kClusName, kANTIKT, R, kFULLJETS, ptminTrack, etminClus);
+    jetFinderTask2 = AddTaskEmcalJet(kTracksName, kClusName, kANTIKT, R, kCHARGEDJETS, ptminTrack, etminClus);
+  }
+
+  TString strJets1 = jetFinderTask1->GetName();
+  TString strJets2 = jetFinderTask2->GetName();
 
-  
- TString strJetsFull = "";
- TString strJetsCh = "";
- TString wagonName = Form("DiJetR%03d%spT%04d%sET%04dRhoType%d",(int)(100*R),kTracksName.Data(),(int)(1000.*ptminTrack),kClusName.Data(),(int)(1000.*etminClus),rhoType);
-
- if(kClusName.IsNull()) {  //particle level jets
-   strJetsFull = Form("Jet_AKTFullR%03d_%s_pT%04d",(int)(100*R),kTracksName.Data(),(int)(1000.*ptminTrack));
-   strJetsCh = Form("Jet_AKTChargedR%03d_%s_pT%04d",(int)(100*R),kTracksName.Data(),(int)(1000.*ptminTrack));
-   wagonName = Form("JetTriggerQAR%03d%spT%04dRhoType%dTrigClass%s",(int)(100*R),kTracksName.Data(),(int)(1000.*ptminTrack),rhoType,trigClass.Data());
- }
- else if(kTracksName.IsNull()) { //neutral/calo jets
-   strJetsFull = Form("Jet_AKTNeutralR%03d_%s_pT%04d_%s_ET%04d",(int)(100*R),"PicoTracks",(int)(1000.*ptminTrack),kClusName.Data(),(int)(1000.*etminClus));
-   strJetsCh = Form("Jet_AKTFullR%03d_%s_pT%04d_%s_ET%04d",(int)(100*R),"PicoTracks",(int)(1000.*ptminTrack),"caloClustersCorr",(int)(1000.*etminClus));
-   wagonName = Form("JetTriggerQANeutralR%03d%sET%04dRhoType%dTrigClass%s",(int)(100*R),kClusName.Data(),(int)(1000.*etminClus),rhoType,trigClass.Data());
- }
- else { //full jets
-   strJetsFull = Form("Jet_AKTFullR%03d_%s_pT%04d_%s_ET%04d",(int)(100*R),kTracksName.Data(),(int)(1000.*ptminTrack),kClusName.Data(),(int)(1000.*etminClus));
-   strJetsCh = Form("Jet_AKTChargedR%03d_%s_pT%04d_%s_ET%04d",(int)(100*R),kTracksName.Data(),(int)(1000.*ptminTrack),"caloClustersCorr",(int)(1000.*etminClus));
-   wagonName = Form("JetTriggerQAR%03d%spT%04d%sET%04dRhoType%dTrigClass%s",(int)(100*R),kTracksName.Data(),(int)(1000.*ptminTrack),kClusName.Data(),(int)(1000.*etminClus),rhoType,trigClass.Data());
- }
+  // Add kt jet finder and rho task in case we want background subtraction
+  gROOT->LoadMacro("$ALICE_ROOT/PWGJE/EMCALJetTasks/macros/AddTaskRhoSparse.C");
+  AliEmcalJetTask *jetFinderKt;
+  AliEmcalJetTask *jetFinderAKt;
+  AliAnalysisTaskRhoSparse *rhoTask;
+  if(rhoType==1) {
+    jetFinderKt   = AddTaskEmcalJet(kTracksName, kClusName, kKT, R, kCHARGEDJETS, ptminTrack, etminClus);
+    jetFinderKt->SetMinJetPt(0.);
+    jetFinderAKt  = AddTaskEmcalJet(kTracksName, kClusName, kANTIKT, R, kCHARGEDJETS, ptminTrack, etminClus);
+    TF1 *fScale = new TF1("fScale","1.42",0.,100.);
+    rhoTask = AddTaskRhoSparse(
+                              jetFinderKt->GetName(),
+                              jetFinderAKt->GetName(),
+                              kTracksName,
+                              kClusName,
+                              Form("RhoSparseR%03d",(int)(100*R)),
+                              R,
+                              AliAnalysisTaskEmcal::kTPC,
+                              0.01,
+                              0.15,
+                              0,
+                              fScale,
+                              0,
+                              kTRUE,
+                              Form("RhoSparseR%03d",(int)(100*R)),
+                              kTRUE
+                              );
+    rhoTask->SetCentralityEstimator(CentEst);
+    
+  }
+
+  TString wagonName = Form("TriggerQA_%s_%s_TC%s",strJets1.Data(),strJets2.Data(),trigClass.Data());
 
+  //Configure TriggerQA task
   AliAnalysisTaskEmcalJetTriggerQA *task = new AliAnalysisTaskEmcalJetTriggerQA(wagonName);
   task->SetTracksName(kTracksName.Data());
   task->SetClusName(kClusName.Data());
-  task->SetJetsName(strJetsFull.Data());
-  task->SetJetsChName(strJetsCh.Data());
+  task->SetJetsName(strJets1.Data());
   task->SetJetRadius(R);
   task->SetJetPtCut(0.15);
-  task->SetPercAreaCut(0.557);
+  task->SetPercAreaCut(0.6);
   task->SetTrackPtCut(ptminTrack);
   task->SetClusPtCut(etminClus);
   task->SetAnaType(type);
   task->SetTriggerClass(trigClass.Data());
   task->SetCaloCellsName(kEmcalCellsName.Data());
 
+  task->SetJetsName2(strJets2.Data());
+  if(strJets2.Contains("Charged")) {
+    task->SetMinEtaJets2(-0.9+R);
+    task->SetMaxEtaJets2(0.9-R);
+    task->SetMinPhiJets2(-10.);
+    task->SetMaxPhiJets2(10.);
+  }
+  else {
+    task->SetMinEtaJets2(-0.7+R);
+    task->SetMaxEtaJets2(0.7-R);
+    task->SetMinPhiJets2(1.4+R);
+    task->SetMaxPhiJets2(TMath::Pi()-R);
+  }
+
   if(rhoType==1) {
-    task->SetRhoName("RhoSparse_Scaled");
-    task->SetRhoChName("RhoSparse");
+    task->SetRhoName(taskRho->GetRhoScaledName());
+    task->SetRhoChName(taskRho->GetRhoName());
   }
+  task->SetCentralityEstimator(CentEst);
 
-  task->SelectCollisionCandidates();
+  task->SelectCollisionCandidates(pSel);
 
   mgr->AddTask(task);
 
index ae369a7..d7ffb3f 100644 (file)
@@ -46,6 +46,11 @@ AliAnalysisTaskRhoSparse* AddTaskRhoSparse(
     name += "EMCAL";
   else if (type == AliAnalysisTaskEmcal::kUser) 
     name += "USER";
+
+  AliEmcalJetTask* mgrTask = mgr->GetTask(name.Data());
+  if (mgrTask)
+    return mgrTask;
+
   AliAnalysisTaskRhoSparse *rhotask = new AliAnalysisTaskRhoSparse(name, histo);
   rhotask->SetHistoBins(1000,-0.1,9.9);
   rhotask->SetAnaType(type);