spd tracklets-vs-cluster cut in event selection; truncated mean for HighMultTrigger
authormverweij <marta.verweij@cern.ch>
Wed, 29 Oct 2014 13:13:03 +0000 (14:13 +0100)
committermverweij <marta.verweij@cern.ch>
Wed, 29 Oct 2014 13:13:20 +0000 (14:13 +0100)
PWG/EMCAL/AliAnalysisTaskEmcal.cxx
PWG/EMCAL/AliAnalysisTaskEmcal.h
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalHighMultTrigger.cxx
PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskEmcalHighMultTrigger.h

index 7117c95..b7abab1 100644 (file)
@@ -58,6 +58,7 @@ AliAnalysisTaskEmcal::AliAnalysisTaskEmcal() :
   fMinNTrack(0),
   fUseAliAnaUtils(kFALSE),
   fRejectPileup(kFALSE),
+  fTklVsClusSPDCut(kFALSE),
   fAliAnalysisUtils(0x0),
   fOffTrigger(AliVEvent::kAny),
   fTrigClass(),
@@ -142,6 +143,7 @@ AliAnalysisTaskEmcal::AliAnalysisTaskEmcal(const char *name, Bool_t histo) :
   fMinNTrack(0),
   fUseAliAnaUtils(kFALSE),
   fRejectPileup(kFALSE),
+  fTklVsClusSPDCut(kFALSE),
   fAliAnalysisUtils(0x0),
   fOffTrigger(AliVEvent::kAny),
   fTrigClass(),
@@ -374,6 +376,7 @@ void AliAnalysisTaskEmcal::UserCreateOutputObjects()
   fHistEventRejection->GetXaxis()->SetBinLabel(10,"PileUp");
   fHistEventRejection->GetXaxis()->SetBinLabel(11,"EvtPlane");
   fHistEventRejection->GetXaxis()->SetBinLabel(12,"SelPtHardBin");
+  fHistEventRejection->GetXaxis()->SetBinLabel(13,"Bkg evt");
   fHistEventRejection->GetYaxis()->SetTitle("counts");
   fOutput->Add(fHistEventRejection);
 
@@ -861,6 +864,11 @@ Bool_t AliAnalysisTaskEmcal::IsEventSelected()
       if (fGeneralHistograms) fHistEventRejection->Fill("PileUp",1);
       return kFALSE;
     }
+
+    if(fTklVsClusSPDCut && fAliAnalysisUtils->IsSPDClusterVsTrackletBG(InputEvent())) {
+      if (fGeneralHistograms) fHistEventRejection->Fill("Bkg evt",1);
+      return kFALSE;
+    }
   }
 
   if ((fMinVz != -999) && (fMaxVz != -999)) {
index 38d2726..817396d 100644 (file)
@@ -85,6 +85,7 @@ class AliAnalysisTaskEmcal : public AliAnalysisTaskSE {
   void                        SetTriggerTypeSel(TriggerType t)                      { fTriggerTypeSel    = t                              ; } 
   void                        SetUseAliAnaUtils(Bool_t b, Bool_t bRejPilup = kTRUE) { fUseAliAnaUtils    = b ; fRejectPileup = bRejPilup  ; }
   void                        SetVzRange(Double_t min, Double_t max)                { fMinVz             = min  ; fMaxVz   = max          ; }
+  void                        SetUseSPDTrackletVsClusterBG(Bool_t b)                { fTklVsClusSPDCut   = b                              ; }
 
  protected:
   void                        SetRejectionReasonLabels(TAxis* axis);
@@ -133,6 +134,7 @@ class AliAnalysisTaskEmcal : public AliAnalysisTaskSE {
   Int_t                       fMinNTrack;                  // minimum nr of tracks in event with pT>fTrackPtCut
   Bool_t                      fUseAliAnaUtils;             // used for LHC13* data: z-vtx, Ncontributors, z-vtx resolution cuts
   Bool_t                      fRejectPileup;               // Reject pilup using function AliAnalysisUtils::IsPileUpEvent()
+  Bool_t                      fTklVsClusSPDCut;            // Apply tracklet-vs-cluster SPD cut to reject background events in pp
   AliAnalysisUtils           *fAliAnalysisUtils;           //! vertex selection (optional)
   UInt_t                      fOffTrigger;                 // offline trigger for event selection
   TString                     fTrigClass;                  // trigger class name for event selection
index 7f35412..0dab4a4 100644 (file)
@@ -29,11 +29,14 @@ AliAnalysisTaskEmcalHighMultTrigger::AliAnalysisTaskEmcalHighMultTrigger() :
   fMedianEnergyExLP(0),
   fSumEnergy(0),
   fSumEnergyExLP(0),
-  fHistPatchEtaPhi(0),
+  fTruncatedMean(0),
+  fTruncateThreshold(6.),
+  fHistPatchEtaPhiE(0),
   fHistEnergyMedian(0),
   fHistEnergyMedianExLP(0),
   fHistEnergySum(0),
   fHistEnergySumExLP(0),
+  fHistTruncatedMean(0),
   fHistTracks(0),
   fHistTracklets(0),
   fHistV0MultSum(0),
@@ -51,6 +54,7 @@ AliAnalysisTaskEmcalHighMultTrigger::AliAnalysisTaskEmcalHighMultTrigger() :
     fHistEnergySumExLPEst[i] = 0;
     fHistEnergySumAvgEst[i] = 0;
     fHistEnergySumAvgExLPEst[i] = 0;
+    fHistTruncatedMeanEst[i] = 0;
   }
 
   SetMakeGeneralHistograms(kTRUE);
@@ -65,11 +69,14 @@ AliAnalysisTaskEmcalHighMultTrigger::AliAnalysisTaskEmcalHighMultTrigger(const c
   fMedianEnergyExLP(0),
   fSumEnergy(0),
   fSumEnergyExLP(0),
-  fHistPatchEtaPhi(0),
+  fTruncatedMean(0),
+  fTruncateThreshold(6.),
+  fHistPatchEtaPhiE(0),
   fHistEnergyMedian(0),
   fHistEnergyMedianExLP(0),
   fHistEnergySum(0),
   fHistEnergySumExLP(0),
+  fHistTruncatedMean(0),
   fHistTracks(0),
   fHistTracklets(0),
   fHistV0MultSum(0),
@@ -87,6 +94,7 @@ AliAnalysisTaskEmcalHighMultTrigger::AliAnalysisTaskEmcalHighMultTrigger(const c
     fHistEnergySumExLPEst[i] = 0;
     fHistEnergySumAvgEst[i] = 0;
     fHistEnergySumAvgExLPEst[i] = 0;
+    fHistTruncatedMeanEst[i] = 0;
   }
 
   SetMakeGeneralHistograms(kTRUE);
@@ -112,10 +120,10 @@ void AliAnalysisTaskEmcalHighMultTrigger::UserCreateOutputObjects()
   TString histName = "";
   TString histTitle = "";
 
-  histName = Form("fHistPatchEtaPhi");
-  histTitle = Form("%s;#eta;#phi",histName.Data());
-  fHistPatchEtaPhi = new TH2F(histName.Data(),histTitle.Data(),100,-1.,1.,18*8,0.,TMath::TwoPi());
-  fOutput->Add(fHistPatchEtaPhi);
+  histName = Form("fHistPatchEtaPhiE");
+  histTitle = Form("%s;#eta;#phi;E",histName.Data());
+  fHistPatchEtaPhiE = new TH3F(histName.Data(),histTitle.Data(),100,-1.,1.,18*8,0.,TMath::TwoPi(),100,0.,100.);
+  fOutput->Add(fHistPatchEtaPhiE);
 
   histName = Form("fHistEnergyMedian");
   histTitle = Form("%s;med[#it{E}]",histName.Data());
@@ -137,6 +145,11 @@ void AliAnalysisTaskEmcalHighMultTrigger::UserCreateOutputObjects()
   fHistEnergySumExLP = new TH1F(histName.Data(),histTitle.Data(),nE,minE,maxE);
   fOutput->Add(fHistEnergySumExLP);
 
+  histName = Form("fHistTruncatedMean");
+  histTitle = Form("%s;#sum[#it{E}]",histName.Data());
+  fHistTruncatedMean = new TH1F(histName.Data(),histTitle.Data(),nE,minE,maxE/4.);
+  fOutput->Add(fHistTruncatedMean);
+
   histName = Form("fHistTracks");
   histTitle = Form("%s;#it{N}_{tracks}",histName.Data());
   fHistTracks = new TH1F(histName.Data(),histTitle.Data(),300,0.,300.);
@@ -186,6 +199,11 @@ void AliAnalysisTaskEmcalHighMultTrigger::UserCreateOutputObjects()
     histTitle = Form("%s;#sum[#it{E}];%s",histName.Data(),strMultEst[i].Data());
     fHistEnergySumAvgExLPEst[i] = new TH2F(histName.Data(),histTitle.Data(),nE,minE,maxE/4.,nBinsMultEst[i],0.,multEstMax[i]);
     fOutput->Add(fHistEnergySumAvgExLPEst[i]);
+
+    histName = Form("fHistTruncatedMeanEst%s",strMultEst[i].Data());
+    histTitle = Form("%s;#sum[#it{E}];%s",histName.Data(),strMultEst[i].Data());
+    fHistTruncatedMeanEst[i] = new TH2F(histName.Data(),histTitle.Data(),nE,minE,maxE/4.,nBinsMultEst[i],0.,multEstMax[i]);
+    fOutput->Add(fHistTruncatedMeanEst[i]);
   }
 
   histName = Form("fHistTracksTracklets");
@@ -215,7 +233,7 @@ Bool_t AliAnalysisTaskEmcalHighMultTrigger::FillHistograms()
   fHistEnergyMedianExLP->Fill(fMedianEnergyExLP);
   fHistEnergySum->Fill(fSumEnergy);
   fHistEnergySumExLP->Fill(fSumEnergyExLP);
-
+  fHistTruncatedMean->Fill(fTruncatedMean);
 
   //Multiplicity estimators
   Int_t nTracks   = -1;
@@ -241,6 +259,7 @@ Bool_t AliAnalysisTaskEmcalHighMultTrigger::FillHistograms()
       fHistEnergySumAvgEst[i]->Fill(fSumEnergy/((Double_t)fNAccPatches),multEst[i]);
     if(fNAccPatches>1)
       fHistEnergySumAvgExLPEst[i]->Fill(fSumEnergyExLP/((Double_t)fNAccPatches-1.),multEst[i]);
+    fHistTruncatedMeanEst[i]->Fill(fTruncatedMean,multEst[i]);
   }
 
   fHistTracksTracklets->Fill(multEst[0],multEst[1]);
@@ -283,7 +302,7 @@ Bool_t AliAnalysisTaskEmcalHighMultTrigger::Run()
       ptarr[iacc] = patch->GetPatchE();
       iacc++;
     }
-    fHistPatchEtaPhi->Fill(patch->GetEtaMin(),patch->GetPhiMin());
+    fHistPatchEtaPhiE->Fill(patch->GetEtaMin(),patch->GetPhiMin(),patch->GetPatchE());
   }
   
   TMath::Sort(nPatch,ptarr,indexes);
@@ -314,6 +333,18 @@ Bool_t AliAnalysisTaskEmcalHighMultTrigger::Run()
   fMedianEnergyExLP = TMath::Median(iacc-fNExLP,ptarrSortExLP);
   fNAccPatches = iacc;
 
+  //calculate truncated mean
+  Double_t it = 0.;
+  Double_t sum = 0.;
+  for(Int_t i = 0; i<iacc; i++) {
+    if(ptarr[indexes[i]]<fTruncateThreshold) {
+      sum+= ptarr[indexes[i]];
+      it+=1.;
+    }
+  }
+  if(it>0)
+    fTruncatedMean = sum/it;
+
    return kTRUE;  // If return kFALSE FillHistogram() will NOT be executed.
 }
 
index 1fcad8a..85d30c8 100644 (file)
@@ -20,7 +20,8 @@ class AliAnalysisTaskEmcalHighMultTrigger : public AliAnalysisTaskEmcalJet {
   void                        Terminate(Option_t *option);
 
   //Setters
-  void                        SetNExcludeLeadingPatches(Int_t n)  {fNExLP = n; }
+  void                        SetNExcludeLeadingPatches(Int_t n)  { fNExLP             = n; }
+  void                        SetTruncateThreshold(Double_t t)    { fTruncateThreshold = t; }
 
  protected:
   void                        ExecOnce();
@@ -34,14 +35,16 @@ class AliAnalysisTaskEmcalHighMultTrigger : public AliAnalysisTaskEmcalJet {
   Double_t                    fMedianEnergyExLP;       //median event energy
   Double_t                    fSumEnergy;              //summed energy
   Double_t                    fSumEnergyExLP;          //summed energy
-
+  Double_t                    fTruncatedMean;          //truncated mean
+  Double_t                    fTruncateThreshold;      //threshold used for truncating
 
   //Histograms
-  TH2F                       *fHistPatchEtaPhi;               //! patch eta vs phi (center of patch)
+  TH3F                       *fHistPatchEtaPhiE;              //! patch eta vs phi (center of patch) vs energy
   TH1F                       *fHistEnergyMedian;              //! median energy in EMCal
   TH1F                       *fHistEnergyMedianExLP;          //! median energy in EMCal exclucing N leading patches
   TH1F                       *fHistEnergySum;                 //! total energy in EMCal
   TH1F                       *fHistEnergySumExLP;             //! total energy in EMCal exclucing N leading patches
+  TH1F                       *fHistTruncatedMean;             //! truncated mean in EMCal
 
   TH1F                       *fHistTracks;                    //! N hybrid tracks
   TH1F                       *fHistTracklets;                 //! Ntracklets
@@ -53,6 +56,7 @@ class AliAnalysisTaskEmcalHighMultTrigger : public AliAnalysisTaskEmcalJet {
   TH2F                       *fHistEnergySumExLPEst[3];       //! total energy in EMCal excluding N leading patches vs mult estimator
   TH2F                       *fHistEnergySumAvgEst[3];        //! avg energy in EMCal vs mult estimator
   TH2F                       *fHistEnergySumAvgExLPEst[3];    //! avg energy in EMCal excluding N leading patches vs mult estimator
+  TH2F                       *fHistTruncatedMeanEst[3];       //! truncated mean in EMCal vs mult estimator
 
   TH2F                       *fHistTracksTracklets;           //! Ntracks vs Ntracklets
   TH2F                       *fHistTracksV0MultSum;           //! Ntracks vs V0A+V0C
@@ -61,6 +65,6 @@ class AliAnalysisTaskEmcalHighMultTrigger : public AliAnalysisTaskEmcalJet {
   AliAnalysisTaskEmcalHighMultTrigger(const AliAnalysisTaskEmcalHighMultTrigger&);            // not implemented
   AliAnalysisTaskEmcalHighMultTrigger &operator=(const AliAnalysisTaskEmcalHighMultTrigger&); // not implemented
 
-  ClassDef(AliAnalysisTaskEmcalHighMultTrigger, 2) // high multiplicity pp trigger analysis task
+  ClassDef(AliAnalysisTaskEmcalHighMultTrigger, 3) // high multiplicity pp trigger analysis task
 };
 #endif