From Redmer:
authormvl <mvl@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Sep 2013 20:56:36 +0000 (20:56 +0000)
committermvl <mvl@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Sep 2013 20:56:36 +0000 (20:56 +0000)
-fix for compatibility issues with new base classes (rho classes)
-jet matching task: bugfixes and new features

PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskJetMatching.cxx
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskJetMatching.h
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskRhoVnModulation.h
PWGJE/EMCALJetTasks/macros/AddTaskJetMatching.C
PWGJE/EMCALJetTasks/macros/AddTaskLocalRho.C
PWGJE/EMCALJetTasks/macros/AddTaskRhoVnModulation.C

index 0ed4cfc..a8765b9 100644 (file)
@@ -28,6 +28,7 @@
 // emcal jet framework includes
 #include <AliEmcalJet.h>
 #include <AliAnalysisTaskJetMatching.h>
+#include <AliLocalRhoParameter.h>
 
 class AliAnalysisTaskJetMatching;
 using namespace std;
@@ -35,13 +36,13 @@ using namespace std;
 ClassImp(AliAnalysisTaskJetMatching)
 
 AliAnalysisTaskJetMatching::AliAnalysisTaskJetMatching() : AliAnalysisTaskEmcalJetDev("AliAnalysisTaskJetMatching", kTRUE), 
-    fDebug(0), fSourceJets(0), fSourceJetsName(0), fTargetJets(0), fTargetJetsName(0), fMatchedJets(0), fMatchedJetsName(GetName()), fUseScaledRho(0), fMatchingScheme(kGeoEtaPhi), fDuplicateJetRecoveryMode(kDoNothing), fUseEmcalBaseJetCuts(kFALSE), fSourceBKG(kNoSourceBKG), fTargetBKG(kNoTargetBKG), fLocalJetMinEta(-10), fLocalJetMaxEta(-10), fLocalJetMinPhi(-10), fLocalJetMaxPhi(-10), fOutputList(0), fHistUnsortedCorrelation(0), fHistMatchedCorrelation(0), fHistSourceJetPt(0), fHistTargetJetPt(0), fHistMatchedJetPt(0), fHistNoConstSourceJet(0), fHistNoConstTargetJet(0), fHistNoConstMatchJet(0), fProfFracPtMatched(0), fProfFracPtJets(0), fProfFracNoMatched(0), fProfFracNoJets(0), fHistAnalysisSummary(0), fProfQAMatched(0), fProfQA(0), fNoMatchedJets(100), fMatchEta(.03), fMatchPhi(.03), fMatchR(.03), fMatchArea(0), fMaxRelEnergyDiff(.1), fMaxAbsEnergyDiff(5) {
+    fDebug(0), fSourceJets(0), fSourceJetsName(0), fTargetJets(0), fTargetJetsName(0), fMatchedJets(0), fMatchedJetsName(GetName()), fSourceRho(0), fSourceRhoName(0), fTargetRho(0), fTargetRhoName(0), fUseScaledRho(0), fSourceRadius(0.3), fTargetRadius(0.3), fMatchingScheme(kGeoEtaPhi), fDuplicateJetRecoveryMode(kDoNothing), fUseEmcalBaseJetCuts(kFALSE), fSourceBKG(kNoSourceBKG), fTargetBKG(kNoTargetBKG), fLocalJetMinEta(-10), fLocalJetMaxEta(-10), fLocalJetMinPhi(-10), fLocalJetMaxPhi(-10), fOutputList(0), fHistUnsortedCorrelation(0), fHistMatchedCorrelation(0), fHistSourceJetPt(0), fHistTargetJetPt(0), fHistMatchedJetPt(0), fHistNoConstSourceJet(0), fHistNoConstTargetJet(0), fHistNoConstMatchJet(0), fProfFracPtMatched(0), fProfFracPtJets(0), fProfFracNoMatched(0), fProfFracNoJets(0), fHistAnalysisSummary(0), fProfQAMatched(0), fProfQA(0), fNoMatchedJets(100), fMatchEta(.3), fMatchPhi(.3), fMatchR(.08), fMatchArea(0), fMaxRelEnergyDiff(.1), fMaxAbsEnergyDiff(5), fMatchConstituents(kTRUE), fMinFracRecoveredConstituents(.5) {
     // default constructor
     ClearMatchedJetsCache();
 }
 //_____________________________________________________________________________
 AliAnalysisTaskJetMatching::AliAnalysisTaskJetMatching(const char* name) : AliAnalysisTaskEmcalJetDev(name, kTRUE),
-    fDebug(0), fSourceJets(0), fSourceJetsName(0), fTargetJets(0), fTargetJetsName(0), fMatchedJets(0), fMatchedJetsName(GetName()), fUseScaledRho(0), fMatchingScheme(kGeoEtaPhi), fDuplicateJetRecoveryMode(kDoNothing), fUseEmcalBaseJetCuts(kFALSE), fSourceBKG(kNoSourceBKG), fTargetBKG(kNoTargetBKG), fLocalJetMinEta(-10), fLocalJetMaxEta(-10), fLocalJetMinPhi(-10), fLocalJetMaxPhi(-10), fOutputList(0), fHistUnsortedCorrelation(0), fHistMatchedCorrelation(0), fHistSourceJetPt(0), fHistTargetJetPt(0), fHistMatchedJetPt(0), fHistNoConstSourceJet(0), fHistNoConstTargetJet(0), fHistNoConstMatchJet(0), fProfFracPtMatched(0), fProfFracPtJets(0), fProfFracNoMatched(0), fProfFracNoJets(0), fHistAnalysisSummary(0), fProfQAMatched(0), fProfQA(0), fNoMatchedJets(100), fMatchEta(.03), fMatchPhi(.03), fMatchR(.03), fMatchArea(0), fMaxRelEnergyDiff(.1), fMaxAbsEnergyDiff(5) {
+    fDebug(0), fSourceJets(0), fSourceJetsName(0), fTargetJets(0), fTargetJetsName(0), fMatchedJets(0), fMatchedJetsName(GetName()), fSourceRho(0), fSourceRhoName(0), fTargetRho(0), fTargetRhoName(0), fUseScaledRho(0), fSourceRadius(0.3), fTargetRadius(0.3), fMatchingScheme(kGeoEtaPhi), fDuplicateJetRecoveryMode(kDoNothing), fUseEmcalBaseJetCuts(kFALSE), fSourceBKG(kNoSourceBKG), fTargetBKG(kNoTargetBKG), fLocalJetMinEta(-10), fLocalJetMaxEta(-10), fLocalJetMinPhi(-10), fLocalJetMaxPhi(-10), fOutputList(0), fHistUnsortedCorrelation(0), fHistMatchedCorrelation(0), fHistSourceJetPt(0), fHistTargetJetPt(0), fHistMatchedJetPt(0), fHistNoConstSourceJet(0), fHistNoConstTargetJet(0), fHistNoConstMatchJet(0), fProfFracPtMatched(0), fProfFracPtJets(0), fProfFracNoMatched(0), fProfFracNoJets(0), fHistAnalysisSummary(0), fProfQAMatched(0), fProfQA(0), fNoMatchedJets(100), fMatchEta(.3), fMatchPhi(.3), fMatchR(.08), fMatchArea(0), fMaxRelEnergyDiff(.1), fMaxAbsEnergyDiff(5), fMatchConstituents(kTRUE), fMinFracRecoveredConstituents(0.5) {
     // constructor
     ClearMatchedJetsCache();
     DefineInput(0, TChain::Class());
@@ -68,6 +69,20 @@ void AliAnalysisTaskJetMatching::ExecOnce()
     if (!(InputEvent()->FindListObject(fMatchedJetsName))) InputEvent()->AddObject(fMatchedJets);
     else AliFatal(Form("%s: Object with name %s already in event! Aborting", GetName(), fMatchedJetsName.Data()));
     FillAnalysisSummaryHistogram();
+    switch (fSourceBKG) {
+        case kSourceLocalRho : {
+            fSourceRho = dynamic_cast<AliLocalRhoParameter*>(InputEvent()->FindListObject(fSourceRhoName));
+            if(!fSourceRho) AliFatal(Form("%s: Object with name %s requested but not found! Aborting", GetName(), fSourceRhoName.Data()));
+        } break;
+        default : break;
+    }
+    switch (fTargetBKG) {
+        case kTargetLocalRho : {
+            fTargetRho = dynamic_cast<AliLocalRhoParameter*>(InputEvent()->FindListObject(fTargetRhoName));
+            if(!fTargetRho) AliFatal(Form("%s: Object with name %s requested but not found! Aborting", GetName(), fTargetRhoName.Data()));
+        } break;
+        default : break;
+    }
     AliAnalysisTaskEmcalJetDev::ExecOnce(); // init base class
 }
 //_____________________________________________________________________________
@@ -158,12 +173,9 @@ Bool_t AliAnalysisTaskJetMatching::Run()
         case kGeoRArea : {
             DoGeometricMatchingR(kTRUE);
             } break;
-        case kDeepMatching : {
-            DoGeometricMatchingEtaPhi();
-            } break;
        default : break;
     }
-    if(fMatchedJetContainer[1][0]) {       // if matched jets are found, fill some more histograms
+    if(fMatchedJetContainer[1][0]) {
         switch (fDuplicateJetRecoveryMode) {
             case kDoNothing : break;
             default : {
@@ -172,13 +184,7 @@ Bool_t AliAnalysisTaskJetMatching::Run()
             }
         }
     }
-    // if required do deep matching, i.e. match constituents in source and target jets 
-    switch (fMatchingScheme) {
-        case kDeepMatching : {
-            DoDeepMatching();
-            break; }
-        default : break;
-    }
+    if(fMatchConstituents) DoDeepMatching();
     // stream data to output
     PostMatchedJets();
     FillMatchedJetHistograms();
@@ -196,17 +202,24 @@ void AliAnalysisTaskJetMatching::DoGeometricMatchingEtaPhi(Bool_t pairCuts)
     for(Int_t i(0); i < iSource; i++) {
         AliEmcalJet* sourceJet(static_cast<AliEmcalJet*>(fSourceJets->At(i)));
         if(!PassesCuts(sourceJet)) continue;
+        if(fUseEmcalBaseJetCuts && !AcceptJet(sourceJet, 0)) continue;
         for(Int_t j(0); j < iTarget; j++) {
             AliEmcalJet* targetJet(static_cast<AliEmcalJet*>(fTargetJets->At(j)));
             if(!PassesCuts(targetJet)) continue;
-            if((TMath::Abs(sourceJet->Eta() - targetJet->Eta()) < fMatchEta ) && (TMath::Abs(sourceJet->Phi()-targetJet->Phi()) < fMatchPhi)) {
-                if(pairCuts && !PassesCuts(sourceJet, targetJet)) continue;
-                fMatchedJetContainer[fNoMatchedJets][0] = sourceJet;
-                fMatchedJetContainer[fNoMatchedJets][1] = targetJet;
-                fNoMatchedJets++;
-                if(fNoMatchedJets > 99) {
-                    AliError(Form("%s: Found too many matched jets (> 100). Adjust matching criteria !", GetName()));
-                    return;
+            if (fUseEmcalBaseJetCuts && !AcceptJet(targetJet, 1)) continue;
+            if((TMath::Abs(sourceJet->Eta() - targetJet->Eta()) < fMatchEta )) {
+                Double_t sourcePhi(sourceJet->Phi()), targetPhi(targetJet->Phi());
+                if(TMath::Abs(sourcePhi-targetPhi) > TMath::Abs(sourcePhi-targetPhi+TMath::TwoPi())) sourcePhi+=TMath::TwoPi();
+                if(TMath::Abs(sourcePhi-targetPhi) > TMath::Abs(sourcePhi-targetPhi-TMath::TwoPi())) sourcePhi-=TMath::TwoPi();
+                if(TMath::Abs(sourcePhi-targetPhi) < fMatchPhi) {
+                    if(pairCuts && !PassesCuts(sourceJet, targetJet)) continue;
+                    fMatchedJetContainer[fNoMatchedJets][0] = sourceJet;
+                    fMatchedJetContainer[fNoMatchedJets][1] = targetJet;
+                    fNoMatchedJets++;
+                    if(fNoMatchedJets > 99) {
+                        AliError(Form("%s: Found too many matched jets (> 100). Adjust matching criteria !", GetName()));
+                        return;
+                    }
                 }
             }
         }
@@ -222,15 +235,12 @@ void AliAnalysisTaskJetMatching::DoGeometricMatchingR(Bool_t pairCuts)
     for(Int_t i(0); i < iSource; i++) {
         AliEmcalJet* sourceJet(static_cast<AliEmcalJet*>(fSourceJets->At(i)));
         if(!PassesCuts(sourceJet)) continue;
+        else if (fUseEmcalBaseJetCuts && !AcceptJet(sourceJet, 0)) continue;
         for(Int_t j(0); j < iTarget; j++) {
             AliEmcalJet* targetJet(static_cast<AliEmcalJet*>(fTargetJets->At(j)));
             if(!PassesCuts(targetJet)) continue;
-            Double_t etaS(sourceJet->Eta()), etaT(targetJet->Eta());
-            Double_t phiS(sourceJet->Phi()), phiT(targetJet->Phi());
-            // if necessary change phase
-            if(TMath::Abs(phiS-phiT) > TMath::Abs(phiS-phiT + TMath::TwoPi())) phiS+=TMath::TwoPi();
-            if(TMath::Abs(phiS-phiT) > TMath::Abs(phiS-phiT - TMath::TwoPi())) phiS-=TMath::TwoPi();
-            if(TMath::Sqrt(TMath::Abs((etaS-etaT)*(etaS-etaT)+(phiS-phiT)*(phiS-phiT)) <= fMatchR)) {
+            else if (fUseEmcalBaseJetCuts && !AcceptJet(targetJet, 1)) continue;
+            if(GetR(sourceJet, targetJet) <= fMatchR) {
                 if(pairCuts && !PassesCuts(sourceJet, targetJet)) continue;
                 fMatchedJetContainer[fNoMatchedJets][0] = sourceJet;
                 fMatchedJetContainer[fNoMatchedJets][1] = targetJet;
@@ -273,16 +283,25 @@ void AliAnalysisTaskJetMatching::DoDeepMatching()
                     }
                 }
             }
+            if((float)overlap/(float)iSJ < fMinFracRecoveredConstituents) {
+                if(fDebug > 0) printf("  \n > Purging jet, recovered constituents ratio  %i / %i = %.2f < \n ", overlap, iSJ, (float)overlap/(float)iSJ);
+                fMatchedJetContainer[i][0] = 0x0;
+                fMatchedJetContainer[i][1] = 0x0;
+                continue;
+            }
             if(sourceJet->Pt() > 0) {
-                fProfFracPtMatched->Fill(sourceJet->Pt(), targetPt / sourceJet->Pt());
-                fProfFracPtJets->Fill(sourceJet->Pt(), targetJet->Pt() / sourceJet->Pt());
-                fProfFracNoMatched->Fill(sourceJet->Pt(), (double)overlap / (double)sourceJet->GetNumberOfTracks());
-                fProfFracNoJets->Fill(sourceJet->Pt(), (double)targetJet->GetNumberOfTracks() / (double)sourceJet->GetNumberOfTracks());
+                Double_t sourceRho(0), targetRho(0);
+                if(fSourceRho) sourceRho = fSourceRho->GetLocalVal(sourceJet->Phi(), fSourceRadius)*sourceJet->Area();
+                if(fTargetRho) targetRho = fTargetRho->GetLocalVal(targetJet->Phi(), fTargetRadius)*targetJet->Area();
+                fProfFracPtMatched->Fill(sourceJet->Pt()-sourceRho, (targetPt-targetRho) / (sourceJet->Pt()-sourceRho));
+                fProfFracPtJets->Fill(sourceJet->Pt()-sourceRho, (targetJet->Pt()-targetRho) / (sourceJet->Pt()-sourceRho));
+                fProfFracNoMatched->Fill(sourceJet->Pt()-sourceRho, (double)overlap / (double)sourceJet->GetNumberOfTracks());
+                fProfFracNoJets->Fill(sourceJet->Pt()-sourceRho, (double)targetJet->GetNumberOfTracks() / (double)sourceJet->GetNumberOfTracks());
             }
             if(fDebug > 0) {
                 printf("\n\n > Jet a has %i constituents \n", iSJ);
                 printf(" > Jet b has %i constituents \n", iTJ);
-                printf("  -OVERLAP %i tracks-\n\n", overlap);
+                printf(" - OVERLAP %i tracks - \n", overlap);
             }
         }
     }
@@ -292,20 +311,23 @@ void AliAnalysisTaskJetMatching::DuplicateJetRecovery()
 {
     // find target jets that have been matched to a source jet more than once - uses nested loops!
     if(fDebug > 0) printf("__FILE__ = %s \n __LINE __ %i , __FUNC__ %s \n ", __FILE__, __LINE__, __func__);
-    Int_t iDuplicateJets(0);            // counter for duplicate jets
     for(Int_t i(0); i < fNoMatchedJets; i++) {
         for(Int_t j(i+1); j < fNoMatchedJets; j++) {
-            if(fMatchedJetContainer[i][1] == fMatchedJetContainer[j][1]) {
-                iDuplicateJets++;
-                switch (fDuplicateJetRecoveryMode) {
-                    case kTraceDuplicates : { 
-                        printf(" > found duplicate jet <\n");
-                        break; }
-                    case kRemoveDuplicates : { 
-                         fMatchedJetContainer[j][1] = NULL;
-                         break; }
-                    default : break;
+            if(fMatchedJetContainer[i][0] == fMatchedJetContainer[j][0]) {
+                // found source with two targets, now see which target is closer to the source
+                if(!(fMatchedJetContainer[i][0] && fMatchedJetContainer[i][1] && fMatchedJetContainer[j][0] && fMatchedJetContainer[j][1] )) continue;
+                Double_t rA(GetR(fMatchedJetContainer[i][0], fMatchedJetContainer[i][1]));
+                Double_t rB(GetR(fMatchedJetContainer[j][0], fMatchedJetContainer[j][1]));
+                if (rA > rB) {  // jet two is far away, purge it from both target and source list
+                    fMatchedJetContainer[j][0] = 0x0;
+                    fMatchedJetContainer[j][1] = 0x0;
+                } else {                // jet one is far away, purge it from both target and source list
+                    fMatchedJetContainer[i][0] = fMatchedJetContainer[j][0];
+                    fMatchedJetContainer[i][1] = fMatchedJetContainer[j][1];
+                    fMatchedJetContainer[j][0] = 0x0;
+                    fMatchedJetContainer[j][1] = 0x0;
                 }
+                if(fDebug > 0) printf(" found duplicate jet, chose %.2f over %.2f \n" , (rB > rA) ? rA : rB, (rB > rA) ? rB : rA);
             }
         }
     }
@@ -366,18 +388,20 @@ void AliAnalysisTaskJetMatching::FillMatchedJetHistograms() const
     for(Int_t i(0); i < fSourceJets->GetEntriesFast(); i++) {
         AliEmcalJet* source = static_cast<AliEmcalJet*>(fSourceJets->At(i));
         if(!source) continue;
-        fHistSourceJetPt->Fill(source->Pt());
+        Double_t sourceRho(0), targetRho(0);
+        if(fSourceRho) sourceRho = fSourceRho->GetLocalVal(source->Phi(), fSourceRadius)*source->Area();
+        fHistSourceJetPt->Fill(source->Pt()-sourceRho);
         fHistNoConstSourceJet->Fill(source->GetNumberOfConstituents());
         for(Int_t j(0); j < fTargetJets->GetEntriesFast(); j++) {
             AliEmcalJet* target = static_cast<AliEmcalJet*>(fTargetJets->At(j));
             if(target) {
-            fProfQA->Fill(0.5, TMath::Abs(source->Pt()-target->Pt()));
-            fProfQA->Fill(1.5, TMath::Abs(source->Eta()-target->Eta()));
-            fProfQA->Fill(2.5, TMath::Abs(source->Phi()-target->Phi()));
+                if(fTargetRho) targetRho = fTargetRho->GetLocalVal(target->Phi(), fTargetRadius)*target->Area();
+                fProfQA->Fill(0.5, TMath::Abs((source->Pt()-sourceRho)-(target->Pt()-targetRho)));  
+                fProfQA->Fill(1.5, TMath::Abs(source->Eta()-target->Eta()));
+                fProfQA->Fill(2.5, TMath::Abs(source->Phi()-target->Phi()));
                 fHistUnsortedCorrelation->Fill(PhaseShift(source->Phi()-target->Phi(), 2));
                 if(j==0) {
-                    fHistTargetJetPt->Fill(target->Pt());
+                    fHistTargetJetPt->Fill(target->Pt()-targetRho);
                     fHistNoConstTargetJet->Fill(target->GetNumberOfConstituents());
                 }
             }
@@ -385,10 +409,13 @@ void AliAnalysisTaskJetMatching::FillMatchedJetHistograms() const
     }
     for(Int_t i(0); i < fNoMatchedJets; i++) {
         if(fMatchedJetContainer[i][0] && fMatchedJetContainer[i][1]) {
+            Double_t sourceRho(0), targetRho(0);
+            if(fSourceRho) sourceRho = fSourceRho->GetLocalVal(fMatchedJetContainer[i][0]->Phi(), fSourceRadius)*fMatchedJetContainer[i][0]->Area();
+            if(fTargetRho) targetRho = fSourceRho->GetLocalVal(fMatchedJetContainer[i][1]->Phi(), fTargetRadius)*fMatchedJetContainer[i][1]->Area();
             fHistMatchedCorrelation->Fill(PhaseShift(fMatchedJetContainer[i][0]->Phi()-fMatchedJetContainer[i][1]->Phi(), 2));
-            fHistMatchedJetPt->Fill(fMatchedJetContainer[i][1]->Pt());
-            fHistNoConstMatchJet->Fill(fMatchedJetContainer[i][1]->Pt());
-            fProfQAMatched->Fill(0.5, TMath::Abs(fMatchedJetContainer[i][0]->Pt()-fMatchedJetContainer[i][1]->Pt()));
+            fHistMatchedJetPt->Fill(fMatchedJetContainer[i][1]->Pt()-targetRho);
+            fHistNoConstMatchJet->Fill(fMatchedJetContainer[i][1]->Pt()-targetRho);
+            fProfQAMatched->Fill(0.5, TMath::Abs((fMatchedJetContainer[i][0]->Pt()-sourceRho)-(fMatchedJetContainer[i][1]->Pt()-targetRho)));
             fProfQAMatched->Fill(1.5, TMath::Abs(fMatchedJetContainer[i][0]->Eta()-fMatchedJetContainer[i][1]->Eta()));
             fProfQAMatched->Fill(2.5, TMath::Abs(fMatchedJetContainer[i][0]->Phi()-fMatchedJetContainer[i][1]->Phi()));
         }
index 3fbfedc..b9dfa55 100644 (file)
@@ -47,12 +47,19 @@ class AliAnalysisTaskJetMatching : public AliAnalysisTaskEmcalJetDev
             }
             return x; }
         /* inline */    Bool_t CompareTracks(AliVParticle* a, AliVParticle* b) const {
-//            printf("dEta %.2f \t dPhi %.2f \n", a->Eta()-b->Eta(), a->Phi()-b->Phi());
             return (TMath::AreEqualAbs(a->Pt(), b->Pt(), 1e-2) && TMath::AreEqualAbs(a->Eta(), b->Eta(), 1e-2) && TMath::AreEqualAbs(a->Phi(), b->Phi(), 1e-2)) ? kTRUE : kFALSE; }
+        /* inline */    Double_t GetR(AliVParticle* a, AliVParticle* b) const {
+               if(!(a&&b)) return 999;
+               Double_t phiA(a->Phi()), phiB(b->Phi()), etaA(a->Eta()), etaB(b->Eta());
+               if(TMath::Abs(phiA-phiB) > TMath::Abs(phiA-phiB + TMath::TwoPi())) phiA+=TMath::TwoPi();
+               if(TMath::Abs(phiA-phiB) > TMath::Abs(phiA-phiB - TMath::TwoPi())) phiA-=TMath::TwoPi();
+               return TMath::Sqrt(TMath::Abs((etaA-etaB)*(etaA-etaB)+(phiA-phiB)*(phiA-phiB))); }
 
         // setters - setup how to run
         void                    SetDebugMode(Int_t d)                           {fDebug = d;}
         void                    SetMatchingScheme(matchingSceme m)              {fMatchingScheme = m;}
+        void                    SetMatchConstituents(Bool_t m)                  {fMatchConstituents = m;}
+        void                    SetMinFracRecoveredConstituents(Float_t f)      {fMinFracRecoveredConstituents = f;}
         void                    SetDuplicateRecoveryScheme(duplicateRecovery d) {fDuplicateJetRecoveryMode = d;}
         void                    SetUseEmcalBaseJetCuts(Bool_t b)                {fUseEmcalBaseJetCuts = b;}
         void                    SetSourceBKG(sourceBKG b)                       {fSourceBKG = b;}
@@ -60,6 +67,10 @@ class AliAnalysisTaskJetMatching : public AliAnalysisTaskEmcalJetDev
         void                    SetSourceJetsName(const char* n)                {fSourceJetsName = n;}
         void                    SetTargetJetsName(const char* n)                {fTargetJetsName = n; }
         void                    SetMatchedJetsName(const char* n)               {fMatchedJetsName = n;}
+        void                    SetSourceLocalRhoName(const char* n)            {fSourceRhoName = n;}
+        void                    SetTargetLocalRhoName(const char* n)            {fTargetRhoName = n;}
+        void                    SetSourceRadius(Float_t r)                      {fSourceRadius = r;}
+        void                    SetTargetRadius(Float_t r)                      {fTargetRadius = r;}
         void                    SetMatchEta(Float_t f)                          {fMatchEta = f;}
         void                    SetMatchPhi(Float_t f)                          {fMatchPhi = f;}
         void                    SetMatchR(Float_t f)                            {fMatchR = f;}
@@ -100,7 +111,13 @@ class AliAnalysisTaskJetMatching : public AliAnalysisTaskEmcalJetDev
         TString                 fTargetJetsName;        // name of array with target jets
         TClonesArray*           fMatchedJets;           //! final list of matched jets which is added to event
         TString                 fMatchedJetsName;       // name of list of matched jets
+        AliLocalRhoParameter*   fSourceRho;             //! source rho
+        TString                 fSourceRhoName;         // source rho  name
+        AliLocalRhoParameter*   fTargetRho;             //! target rho
+        TString                 fTargetRhoName;         // target rho name
         Bool_t                  fUseScaledRho;          // use scaled rho
+        Float_t                 fSourceRadius;          // source radius 
+        Float_t                 fTargetRadius;          // target radius
         matchingSceme           fMatchingScheme;        // select your favorite matching algorithm
         duplicateRecovery       fDuplicateJetRecoveryMode;      // what to do with duplicate matches
         Bool_t                  fUseEmcalBaseJetCuts;   // use the emcal jet base class for jet cuts
@@ -137,11 +154,13 @@ class AliAnalysisTaskJetMatching : public AliAnalysisTaskEmcalJetDev
         Float_t                 fMatchArea;             // max relative area mismatch between matched jets
         Float_t                 fMaxRelEnergyDiff;      // max relative energy difference between matched jets
         Float_t                 fMaxAbsEnergyDiff;      // max absolute energy difference between matched jets
+        Bool_t                  fMatchConstituents;     // match constituents
+        Float_t                 fMinFracRecoveredConstituents;  // minimium fraction of constituents that needs to be found
 
         AliAnalysisTaskJetMatching(const AliAnalysisTaskJetMatching&);                  // not implemented
         AliAnalysisTaskJetMatching& operator=(const AliAnalysisTaskJetMatching&);       // not implemented
 
-        ClassDef(AliAnalysisTaskJetMatching, 3);
+        ClassDef(AliAnalysisTaskJetMatching, 4);
 };
 
 #endif
index f56d9ff..66816a0 100644 (file)
@@ -14,6 +14,7 @@
 #include <TMath.h>
 #include <TRandom3.h>
 #include <AliJetContainer.h>
+#include <AliParticleContainer.h>
 
 class TF1;
 class THF1;
@@ -102,7 +103,7 @@ class AliAnalysisTaskRhoVnModulation : public AliAnalysisTaskEmcalJetDev {
         void                    SetExplicitOutlierCutForYear(Int_t y)           {fExplicitOutlierCut = y;}
         // getters - these are used as well by AliAnalyisTaskJetFlow, so be careful when changing them
         TString                 GetJetsName() const                             {return GetJetContainer()->GetArrayName(); }
-        TString                 GetTracksName() const                           {return fTracks->GetName(); }
+        TString                 GetTracksName() const                           {return GetParticleContainer()->GetArrayName(); }
         TString                 GetLocalRhoName() const                         {return fLocalRhoName; }
         TArrayI*                GetCentralityClasses() const                    {return fCentralityClasses;}
         TArrayD*                GetPtBinsHybrids() const                        {return fPtBinsHybrids; }
index 3e02345..301b09b 100644 (file)
@@ -1,4 +1,4 @@
-/* AddTask macro for class AddTaskJetMatching.C
+/* AddTask macro for class AliAnalysisTaskJetMatching
  * Redmer Alexander Bertens, rbertens@cern.ch
  * Utrecht University, Utrecht, Netherlands             */
 
@@ -6,9 +6,16 @@ AliAnalysisTaskJetMatching* AddTaskJetMatching(
         const char* sourceJets  = "SourceJets", // source jets
         const char* targetJets  = "TargetJets", // target jets
         const char* matchedJets = "MatchedJets",// matched jets
-        UInt_t matchingScheme   = AliAnalysisTaskJetMatching::kDeepMatching,
-        UInt_t duplicateRecovery= AliAnalysisTaskJetMatching::kDoNothing,
+        UInt_t matchingScheme   = AliAnalysisTaskJetMatching::kGeoEtaPhi,
+        UInt_t duplicateRecovery= AliAnalysisTaskJetMatching::kTraceDuplicates,
+        Bool_t matchConstituents= kTRUE,
+        Float_t minFrReCon      = .7,
         const char *name        = "AliAnalysisTaskJetMatching",
+        Bool_t cut              = kFALSE,
+        UInt_t  sourceType      = AliAnalysisTaskEmcal::kTPC,
+        Float_t sourceRadius    = 0.4,
+        UInt_t targetType       = AliAnalysisTaskEmcal::kTPC,
+        Float_t targetRadius    = 0.4
   )
 { 
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
@@ -17,11 +24,24 @@ AliAnalysisTaskJetMatching* AddTaskJetMatching(
 
   AliAnalysisTaskJetMatching* jetTask = new AliAnalysisTaskJetMatching(name);
   jetTask->SetDebugMode(-1);
+  jetTask->SetMatchConstituents(matchConstituents);
+  jetTask->SetMinFracRecoveredConstituents(minFrReCon);
   jetTask->SetSourceJetsName(sourceJets);
   jetTask->SetTargetJetsName(targetJets);
   jetTask->SetMatchedJetsName(matchedJets);
   jetTask->SetMatchingScheme(matchingScheme);
   jetTask->SetDuplicateRecoveryScheme(duplicateRecovery);
+  // if we want the jet package to cut on the source and target jets
+  jetTask->SetUseEmcalBaseJetCuts(cut);
+  if(cut) {
+      jetTask->AddJetContainer(Form("sourceJets%s", "container"));
+      jetTask->SetAnaType(sourceType, 0);
+      jetTask->SetJetRadius(sourceRadius, 0);
+      jetTask->AddJetContainer(Form("targetJets%s", "container"));
+      jetTask->SetAnaType(targetType, 1);
+      jetTask->SetJetRadius(targetRadius, 1);
+  }
+  
   mgr->AddTask(jetTask);
   // Create containers for input/output
   AliAnalysisDataContainer *cinput1  = mgr->GetCommonInputContainer()  ;
index 6c5955e..27366f8 100644 (file)
@@ -48,10 +48,10 @@ AliAnalysisTaskLocalRho* AddTaskLocalRho(
 
   AliAnalysisTaskLocalRho* jetTask = new AliAnalysisTaskLocalRho(name, runMode);
   // inherited setters
+  jetTask->SetJetsName(njets);
   jetTask->SetAnaType(type);
   jetTask->SetTracksName(ntracks);
   jetTask->SetClusName(nclusters);
-  jetTask->SetJetsName(njets);
   jetTask->SetRhoName(nrho);
   jetTask->SetLocalRhoName(lrho);
   jetTask->SetJetRadius(jetradius);
index 58d9647..620d7b8 100644 (file)
@@ -65,10 +65,10 @@ AliAnalysisTaskRhoVnModulation* AddTaskRhoVnModulation(
 
   AliAnalysisTaskRhoVnModulation* jetTask = new AliAnalysisTaskRhoVnModulation(name, runMode);
   // inherited setters
+  jetTask->SetJetsName(njets);
   jetTask->SetAnaType(type);
   jetTask->SetTracksName(ntracks);
   jetTask->SetClusName(nclusters);
-  jetTask->SetJetsName(njets);
   jetTask->SetRhoName(nrho);
   jetTask->SetJetRadius(jetradius);
   jetTask->SetJetPtCut(jetptcut);