From Salvatore
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 10 May 2013 18:32:13 +0000 (18:32 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 10 May 2013 18:32:13 +0000 (18:32 +0000)
- AliJetModelBaseTask: track charge handling
- AliJetEmbeddingFromAODTask: new QA histogram, new event selection (vertex distance from the embedded event)
- AliEmcalClusTrackMatcherTask: no centrality bin histograms for pp analysis

PWG/EMCAL/AliEmcalClusTrackMatcherTask.cxx
PWGJE/EMCALJetTasks/AliJetEmbeddingFromAODTask.cxx
PWGJE/EMCALJetTasks/AliJetEmbeddingFromAODTask.h
PWGJE/EMCALJetTasks/AliJetEmbeddingFromPYTHIATask.cxx
PWGJE/EMCALJetTasks/AliJetModelBaseTask.cxx
PWGJE/EMCALJetTasks/AliJetModelBaseTask.h

index 8f5544c..d03af62 100644 (file)
@@ -66,7 +66,9 @@ void AliEmcalClusTrackMatcherTask::UserCreateOutputObjects()
 
   AliAnalysisTaskEmcal::UserCreateOutputObjects();
 
-  for(Int_t icent=0; icent<8; ++icent) {
+  const Int_t nCentChBins = fNcentBins * 2;
+
+  for(Int_t icent=0; icent<nCentChBins; ++icent) {
     for(Int_t ipt=0; ipt<9; ++ipt) {
       for(Int_t ieta=0; ieta<2; ++ieta) {
        TString nameEta(Form("fHistMatchEta_%i_%i_%i",icent,ipt,ieta));
@@ -149,7 +151,7 @@ Bool_t AliEmcalClusTrackMatcherTask::Run()
        Int_t mombin = GetMomBin(track->P());
        Int_t centbinch = fCentBin;
        if (track->Charge()<0) 
-         centbinch += 4;
+         centbinch += fNcentBins;
        Int_t etabin = 0;
        if(track->Eta() > 0) 
          etabin = 1;
index 6c727e8..7cf68be 100644 (file)
@@ -54,10 +54,11 @@ AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask() :
   fAODClusName(),
   fAODCellsName(),
   fAODMCParticlesName(),
-  fMinCentrality(0),
-  fMaxCentrality(10),
+  fMinCentrality(-1),
+  fMaxCentrality(-1),
   fTriggerMask(AliVEvent::kAny),
   fZVertexCut(10),
+  fMaxVertexDist(999),
   fJetMinPt(0),
   fJetMinEta(-0.5),
   fJetMaxEta(0.5),
@@ -91,7 +92,8 @@ AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask() :
   fHistFileMatching(0),
   fHistAODFileError(0),
   fHistNotEmbedded(0),
-  fHistEmbeddingQA(0)
+  fHistEmbeddingQA(0),
+  fHistRejectedEvents(0)
 {
   // Default constructor.
   SetSuffix("AODEmbedding");
@@ -117,10 +119,11 @@ AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask(const char *name, Bool_t
   fAODClusName(""),
   fAODCellsName("emcalCells"),
   fAODMCParticlesName(AliAODMCParticle::StdBranchName()),
-  fMinCentrality(0),
-  fMaxCentrality(10),
+  fMinCentrality(-1),
+  fMaxCentrality(-1),
   fTriggerMask(AliVEvent::kAny),
   fZVertexCut(10),
+  fMaxVertexDist(999),
   fJetMinPt(0),
   fJetMinEta(-0.5),
   fJetMaxEta(0.5),
@@ -154,7 +157,8 @@ AliJetEmbeddingFromAODTask::AliJetEmbeddingFromAODTask(const char *name, Bool_t
   fHistFileMatching(0),
   fHistAODFileError(0),
   fHistNotEmbedded(0),
-  fHistEmbeddingQA(0)
+  fHistEmbeddingQA(0),
+  fHistRejectedEvents(0)
 {
   // Standard constructor.
   SetSuffix("AODEmbedding");
@@ -210,6 +214,11 @@ void AliJetEmbeddingFromAODTask::UserCreateOutputObjects()
   fHistEmbeddingQA->GetXaxis()->SetBinLabel(2, "Not embedded");
   fOutput->Add(fHistEmbeddingQA);
 
+  fHistRejectedEvents = new TH1F("fHistRejectedEvents", "fHistRejectedEvents", 500, -0.5, 499.5);
+  fHistRejectedEvents->GetXaxis()->SetTitle("# of rejected events");
+  fHistRejectedEvents->GetYaxis()->SetTitle("counts");
+  fOutput->Add(fHistRejectedEvents);
+
   PostData(1, fOutput);
 }
 
@@ -305,9 +314,9 @@ Bool_t AliJetEmbeddingFromAODTask::OpenNextFile()
   if (fRandomAccess)
     fCurrentAODEntry = TMath::Nint(gRandom->Rndm()*fCurrentAODTree->GetEntries());
   else
-    fCurrentAODEntry = 0;
+    fCurrentAODEntry = -1;
 
-  AliDebug(3,Form("Will start embedding from entry %d", fCurrentAODEntry));
+  AliDebug(3,Form("Will start embedding from entry %d", fCurrentAODEntry+1));
   
   if (fHistFileMatching)
     fHistFileMatching->Fill(fCurrentFileID, fCurrentAODFileID-1);
@@ -361,33 +370,43 @@ TFile* AliJetEmbeddingFromAODTask::GetNextFile()
 //________________________________________________________________________
 Bool_t AliJetEmbeddingFromAODTask::GetNextEntry() 
 {
-  Int_t attempts = 0;
+  Int_t attempts = -1;
 
   do {
-    if (!fCurrentAODFile || !fCurrentAODTree || fCurrentAODEntry >= fCurrentAODTree->GetEntries()) {
+    if (!fCurrentAODFile || !fCurrentAODTree || fCurrentAODEntry+1 >= fCurrentAODTree->GetEntries()) {
       if (!OpenNextFile()) {
        AliError("Could not open the next file!");
        return kFALSE;
       }
     }
+
+    if (!fCurrentAODTree) {
+      AliError("Could not get the tree!");
+      return kFALSE;
+    }
     
-    fCurrentAODTree->GetEntry(fCurrentAODEntry);
     fCurrentAODEntry++;
-    attempts++;
+    fCurrentAODTree->GetEntry(fCurrentAODEntry);
 
+    attempts++;
     if (attempts == 1000) 
       AliWarning("After 1000 attempts no event has been accepted by the event selection (trigger, centrality...)!");
 
-  } while (!IsAODEventSelected() && fCurrentAODTree);
+  } while (!IsAODEventSelected());
+
+  fHistRejectedEvents->Fill(attempts);
 
-  return (fCurrentAODTree!=0);
+  if (!fCurrentAODTree)
+    return kFALSE;
+
+  return kTRUE;
 }
 
 //________________________________________________________________________
 Bool_t AliJetEmbeddingFromAODTask::IsAODEventSelected()
 {
   // AOD event selection.
-  
+
   if (!fEsdTreeMode && fAODHeader) {
     AliAODHeader *aodHeader = static_cast<AliAODHeader*>(fAODHeader);
 
@@ -423,6 +442,14 @@ Bool_t AliJetEmbeddingFromAODTask::IsAODEventSelected()
                      vert[2], fZVertexCut));
       return kFALSE;
     }
+    Double_t dist = TMath::Sqrt((vert[0]-fVertex[0])*(vert[0]-fVertex[0])+(vert[1]-fVertex[1])*(vert[1]-fVertex[1])+(vert[2]-fVertex[2])*(vert[2]-fVertex[2]));
+    if (dist > fMaxVertexDist) {
+      AliDebug(2,Form("Event rejected because the distance between the current and embedded verteces is > %f. "
+                     "Current event vertex (%f, %f, %f), embedded event vertex (%f, %f, %f). Distance = %f", 
+                     fMaxVertexDist, fVertex[0], fVertex[1], fVertex[2], vert[0], vert[1], vert[2], dist));
+      return kFALSE;
+    }
+      
   }
 
   // Jet selection
@@ -588,7 +615,7 @@ void AliJetEmbeddingFromAODTask::Run()
            AliDebug(1,Form("%s: Track %d with label==0", GetName(), i));
        }
 
-       AddTrack(track->Pt(), track->Eta(), track->Phi(), type, track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal(), isEmc, label);
+       AddTrack(track->Pt(), track->Eta(), track->Phi(), type, track->GetTrackEtaOnEMCal(), track->GetTrackPhiOnEMCal(), isEmc, label, track->Charge());
        AliDebug(3, "Track embedded!");
       }
     }
index c9b5ddc..977b2e5 100644 (file)
@@ -49,6 +49,7 @@ class AliJetEmbeddingFromAODTask : public AliJetModelBaseTask {
   void           SetJetType(Byte_t t)                              { fJetType            = t     ; }
   void           SetJetAlgo(Byte_t t)                              { fJetAlgo            = t     ; }
   void           SetZVertexCut(Double_t z)                         { fZVertexCut         = z     ; }
+  void           SetMaxVertexDist(Double_t d)                      { fMaxVertexDist      = d     ; }
 
  protected:
   Bool_t          ExecOnce()            ;// intialize task
@@ -72,6 +73,7 @@ class AliJetEmbeddingFromAODTask : public AliJetModelBaseTask {
   Double_t       fMaxCentrality       ;//  Maximum centrality
   UInt_t         fTriggerMask         ;//  Trigger selection mask
   Double_t       fZVertexCut          ;//  Z vertex cut
+  Double_t       fMaxVertexDist       ;//  Maximum distance allowed between the vertices of the current and the embedded events
   Double_t       fJetMinPt            ;//  Select events with a minimum jet pt
   Double_t       fJetMinEta           ;//  Min eta for jets
   Double_t       fJetMaxEta           ;//  Max eta for jets
@@ -107,11 +109,12 @@ class AliJetEmbeddingFromAODTask : public AliJetModelBaseTask {
   TH1           *fHistAODFileError    ;//! AOD file ID (to be embedded) error
   TH1           *fHistNotEmbedded     ;//! File ID not embedded
   TH1           *fHistEmbeddingQA     ;//! Embedding QA
+  TH1           *fHistRejectedEvents  ;//! Rejected events
 
  private:
   AliJetEmbeddingFromAODTask(const AliJetEmbeddingFromAODTask&);            // not implemented
   AliJetEmbeddingFromAODTask &operator=(const AliJetEmbeddingFromAODTask&); // not implemented
 
-  ClassDef(AliJetEmbeddingFromAODTask, 9) // Jet embedding from AOD task
+  ClassDef(AliJetEmbeddingFromAODTask, 10) // Jet embedding from AOD task
 };
 #endif
index 19748c6..ea08446 100644 (file)
@@ -93,6 +93,11 @@ void AliJetEmbeddingFromPYTHIATask::UserCreateOutputObjects()
   fHistEmbeddingQA->GetXaxis()->SetBinLabel(2, "Not embedded");
   fOutput->Add(fHistEmbeddingQA);
 
+  fHistRejectedEvents = new TH1F("fHistRejectedEvents", "fHistRejectedEvents", 500, -0.5, 499.5);
+  fHistRejectedEvents->GetXaxis()->SetTitle("# of rejected events");
+  fHistRejectedEvents->GetYaxis()->SetTitle("counts");
+  fOutput->Add(fHistRejectedEvents);
+
   PostData(1, fOutput);
 }
 
index 319923a..dbc5766 100644 (file)
@@ -158,6 +158,14 @@ void AliJetModelBaseTask::UserExec(Option_t *)
   if (!fIsInit)
     return;
 
+  fVertex[0] = 0;
+  fVertex[1] = 0;
+  fVertex[2] = 0;
+
+  const AliVVertex *vert = InputEvent()->GetPrimaryVertex();
+  if (vert)
+    vert->GetXYZ(fVertex);
+
   if (fCopyArray) {
     if (fOutTracks)
       fOutTracks->Delete();
@@ -635,7 +643,7 @@ AliVCluster* AliJetModelBaseTask::AddCluster(Double_t e, Int_t absId, Int_t labe
 }
 
 //________________________________________________________________________
-AliPicoTrack* AliJetModelBaseTask::AddTrack(Double_t pt, Double_t eta, Double_t phi, Byte_t type, Double_t etaemc, Double_t phiemc, Bool_t ise, Int_t label)
+AliPicoTrack* AliJetModelBaseTask::AddTrack(Double_t pt, Double_t eta, Double_t phi, Byte_t type, Double_t etaemc, Double_t phiemc, Bool_t ise, Int_t label, Short_t charge)
 {
   // Add a track to the event.
 
@@ -656,7 +664,7 @@ AliPicoTrack* AliJetModelBaseTask::AddTrack(Double_t pt, Double_t eta, Double_t
   AliPicoTrack *track = new ((*fOutTracks)[nTracks]) AliPicoTrack(pt, 
                                                                  eta, 
                                                                  phi, 
-                                                                 1,
+                                                                 charge,
                                                                  label,
                                                                  type, 
                                                                  etaemc, 
index 34d1fe1..66e626a 100644 (file)
@@ -56,8 +56,9 @@ class AliJetModelBaseTask : public AliAnalysisTaskSE {
   AliVCluster           *AddCluster(Double_t e = -1, Double_t eta = -999, Double_t phi = -1, Int_t label=0); // add a cluster; if values are -1 generate random parameters
   AliVCluster           *AddCluster(Double_t e, Int_t absId, Int_t label=0);                   // add a cluster with given energy and position
   AliVCluster           *AddCluster(AliVCluster *oc);                                          // add a cluster (copy)
-  AliPicoTrack          *AddTrack(Double_t pt = -1, Double_t eta = -999, Double_t phi = -1, 
-                                 Byte_t type=0, Double_t etaemc=0, Double_t phiemc=0, Bool_t ise=kFALSE, Int_t label=0); // add a track; if values are -1 generate random parameters
+  AliPicoTrack          *AddTrack(Double_t pt = -1, Double_t eta = -999, Double_t phi = -1, Byte_t type=0, 
+                                 Double_t etaemc=0, Double_t phiemc=0, Bool_t ise=kFALSE, 
+                                 Int_t label=0, Short_t charge=1); // add a track; if values are -1 generate random parameters
   AliAODMCParticle      *AddMCParticle(AliAODMCParticle *part, Int_t origIndex);                // add a MC particle
   void                   CopyCells();
   void                   CopyClusters();
@@ -96,6 +97,7 @@ class AliJetModelBaseTask : public AliAnalysisTaskSE {
   Bool_t                 fQAhistos;               // draw QA histograms
   Bool_t                 fIsInit;                 //!=true if initialized
   AliEMCALGeometry      *fGeom;                   //!pointer to EMCal geometry
+  Double_t               fVertex[3];              //!event vertex
   TClonesArray          *fClusters;               //!cluster collection
   TClonesArray          *fOutClusters;            //!output cluster collection
   TClonesArray          *fTracks;                 //!track collection