changes from saiola
authormcosenti <mcosenti@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Jul 2012 13:36:32 +0000 (13:36 +0000)
committermcosenti <mcosenti@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 9 Jul 2012 13:36:32 +0000 (13:36 +0000)
PWGGA/EMCALJetTasks/UserTasks/AliAnalysisTaskSAQA.cxx
PWGGA/EMCALJetTasks/UserTasks/AliAnalysisTaskSAQA.h

index 7f7d9f7..204cb46 100644 (file)
@@ -19,6 +19,9 @@
 #include "AliVTrack.h"
 #include "AliEmcalJet.h"
 #include "AliVEventHandler.h"
+#include "AliAODEvent.h"
+#include "AliExternalTrackParam.h"
+#include "AliTrackerBase.h"
 #include "AliLog.h"
 
 #include "AliAnalysisTaskSAQA.h"
@@ -45,8 +48,11 @@ AliAnalysisTaskSAQA::AliAnalysisTaskSAQA() :
   fHistTracksPt(0),
   fHistTrPhiEta(0),
   fHistTrEmcPhiEta(0),
+  fHistTrPhiEtaNonProp(0),
   fHistDeltaEtaPt(0),
   fHistDeltaPhiPt(0),
+  fHistDeltaEtaNewProp(0),
+  fHistDeltaPhiNewProp(0),
   fHistClusPhiEtaEnergy(0),
   fHistNCellsEnergy(0),
   fHistClusTimeEnergy(0),
@@ -93,8 +99,11 @@ AliAnalysisTaskSAQA::AliAnalysisTaskSAQA(const char *name) :
   fHistTracksPt(0),
   fHistTrPhiEta(0),
   fHistTrEmcPhiEta(0),
+  fHistTrPhiEtaNonProp(0),
   fHistDeltaEtaPt(0),
   fHistDeltaPhiPt(0),
+  fHistDeltaEtaNewProp(0),
+  fHistDeltaPhiNewProp(0),
   fHistClusPhiEtaEnergy(0),
   fHistNCellsEnergy(0),
   fHistClusTimeEnergy(0),
@@ -211,16 +220,31 @@ void AliAnalysisTaskSAQA::UserCreateOutputObjects()
   fHistTrEmcPhiEta->GetYaxis()->SetTitle("#phi");
   fOutput->Add(fHistTrEmcPhiEta);
 
+  fHistTrPhiEtaNonProp = new TH2F("fHistTrPhiEtaNonProp","fHistTrPhiEtaNonProp", 80, -2, 2, 128, 0, 6.4);
+  fHistTrPhiEtaNonProp->GetXaxis()->SetTitle("#eta");
+  fHistTrPhiEtaNonProp->GetYaxis()->SetTitle("#phi");
+  fOutput->Add(fHistTrPhiEtaNonProp);
+
   fHistDeltaEtaPt = new TH2F("fHistDeltaEtaPt","fHistDeltaEtaPt", fNbins, fMinBinPt, fMaxBinPt, 80, -0.5, 0.5);
   fHistDeltaEtaPt->GetXaxis()->SetTitle("p_{T} [GeV/c]");
-  fHistDeltaEtaPt->GetYaxis()->SetTitle("#eta");
+  fHistDeltaEtaPt->GetYaxis()->SetTitle("#delta#eta");
   fOutput->Add(fHistDeltaEtaPt);
 
   fHistDeltaPhiPt = new TH2F("fHistDeltaPhiPt","fHistDeltaPhiPt", fNbins, fMinBinPt, fMaxBinPt, 256, -1.6, 4.8);
   fHistDeltaPhiPt->GetXaxis()->SetTitle("p_{T} [GeV/c]");
-  fHistDeltaPhiPt->GetYaxis()->SetTitle("#phi");
+  fHistDeltaPhiPt->GetYaxis()->SetTitle("#delta#phi");
   fOutput->Add(fHistDeltaPhiPt);
 
+  fHistDeltaEtaNewProp = new TH1F("fHistDeltaEtaNewProp","fHistDeltaEtaNewProp", 80, -0.5, 0.5);
+  fHistDeltaEtaNewProp->GetXaxis()->SetTitle("#delta#eta");
+  fHistDeltaEtaNewProp->GetYaxis()->SetTitle("counts");
+  fOutput->Add(fHistDeltaEtaNewProp);
+
+  fHistDeltaPhiNewProp = new TH1F("fHistDeltaPhiNewProp","fHistDeltaPhiNewProp", 256, -1.6, 4.8);
+  fHistDeltaPhiNewProp->GetXaxis()->SetTitle("#delta#phi");
+  fHistDeltaPhiNewProp->GetYaxis()->SetTitle("counts");
+  fOutput->Add(fHistDeltaPhiNewProp);
+
   if (fAnaType == kEMCAL || fAnaType == kEMCALOnly) {
     fHistClusPhiEtaEnergy = new TH3F("fHistClusPhiEtaEnergy","Phi-Eta-Energy distribution of clusters", fNbins, fMinBinPt, fMaxBinPt, 80, -2, 2, 128, 0, 6.4);
     fHistClusPhiEtaEnergy->GetXaxis()->SetTitle("E [GeV]");
@@ -540,14 +564,61 @@ Float_t AliAnalysisTaskSAQA::DoTrackLoop()
     if (!vtrack)
       continue;
 
+    if (vtrack->GetTrackEtaOnEMCal() == -999 || vtrack->GetTrackPhiOnEMCal() == -999)
+      fHistTrPhiEtaNonProp->Fill(vtrack->Eta(), vtrack->Phi());
+
     fHistTrEmcPhiEta->Fill(vtrack->GetTrackEtaOnEMCal(), vtrack->GetTrackPhiOnEMCal());
     fHistDeltaEtaPt->Fill(vtrack->Pt(), vtrack->Eta() - vtrack->GetTrackEtaOnEMCal());
     fHistDeltaPhiPt->Fill(vtrack->Pt(), vtrack->Phi() - vtrack->GetTrackPhiOnEMCal());
+    
+    Float_t propeta = -999, propphi = -999;
+    PropagateTrack(vtrack, propeta, propphi);
+    fHistDeltaEtaNewProp->Fill(propeta - vtrack->GetTrackEtaOnEMCal());
+    fHistDeltaPhiNewProp->Fill(propphi - vtrack->GetTrackPhiOnEMCal());
   }
   
   return sum;
 }
 
+//____________________________________________________________________________
+void AliAnalysisTaskSAQA::PropagateTrack(AliVTrack *track, Float_t &eta, Float_t &phi)
+{
+  eta = -999;
+  phi = -999;
+
+  if (!track)
+    return;
+
+  // init the magnetic field if not already on
+  if(!TGeoGlobalMagField::Instance()->GetField()) {
+    AliInfo("Init the magnetic field\n");
+    AliAODEvent* aodevent = dynamic_cast<AliAODEvent*>(InputEvent());
+    if (aodevent) {
+      Double_t curSol = 30000*aodevent->GetMagneticField()/5.00668;
+      Double_t curDip = 6000 *aodevent->GetMuonMagFieldScale();
+      AliMagF *field  = AliMagF::CreateFieldMap(curSol,curDip);
+      TGeoGlobalMagField::Instance()->SetField(field);
+    }
+  }
+    
+  Double_t cv[21];
+  for (Int_t i = 0; i < 21; i++) cv[i] = 0;
+
+  Double_t pos[3], mom[3];
+  track->GetXYZ(pos);
+  track->GetPxPyPz(mom);
+  AliExternalTrackParam *trackParam = new AliExternalTrackParam(pos, mom, cv, track->Charge());
+  if(!AliTrackerBase::PropagateTrackToBxByBz(trackParam, 430., 0, 20, kTRUE, 0.8, -1)) return;
+  Double_t trkPos[3] = {0., 0., 0.};
+  if(!trackParam->GetXYZ(trkPos)) return;
+  TVector3 trkPosVec(trkPos[0], trkPos[1], trkPos[2]);
+  eta = trkPosVec.Eta();
+  phi = trkPosVec.Phi();
+  if(phi < 0)
+    phi += 2 * TMath::Pi();
+}
+
 //________________________________________________________________________
 void AliAnalysisTaskSAQA::DoJetLoop()
 {
index 744baf5..888aa58 100644 (file)
@@ -26,14 +26,15 @@ class AliAnalysisTaskSAQA : public AliAnalysisTaskEmcalJet {
 
  protected:
 
-  Bool_t                      FillHistograms()                                          ;
-  Bool_t                      RetrieveEventObjects()                                    ;
-  Int_t                       DoCellLoop(Float_t &sum, Float_t &sum_cut)                ;
-  void                        DoTriggerPrimitives(Int_t &maxL1amp, Int_t &maxL1thr)     ;
-  Float_t                     DoTriggerClusLoop()                                       ;
-  Float_t                     DoTrackLoop()                                             ;
-  Float_t                     DoClusterLoop()                                           ;
-  void                        DoJetLoop()                                               ;
+  Bool_t                      FillHistograms()                                              ;
+  Bool_t                      RetrieveEventObjects()                                        ;
+  Int_t                       DoCellLoop(Float_t &sum, Float_t &sum_cut)                    ;
+  void                        DoTriggerPrimitives(Int_t &maxL1amp, Int_t &maxL1thr)         ;
+  Float_t                     DoTriggerClusLoop()                                           ;
+  Float_t                     DoTrackLoop()                                                 ;
+  Float_t                     DoClusterLoop()                                               ;
+  void                        DoJetLoop()                                                   ;
+  void                        PropagateTrack(AliVTrack *track, Float_t &eta, Float_t &phi)  ;
 
   Float_t                     fCellEnergyCut;            // Energy cell cut
   Bool_t                      fDoTrigger;                // Make trigger qa plots
@@ -56,8 +57,11 @@ class AliAnalysisTaskSAQA : public AliAnalysisTaskEmcalJet {
   TH1F                       *fHistTracksPt;             //!Pt spectrum of tracks
   TH2F                       *fHistTrPhiEta;             //!Phi-Eta distribution of tracks
   TH2F                       *fHistTrEmcPhiEta;          //!Phi-Eta emcal propagated distribution of tracks
+  TH2F                       *fHistTrPhiEtaNonProp;      //!Phi-Eta distribution of non emcal propagated tracks
   TH2F                       *fHistDeltaEtaPt;           //!Eta-EtaProp vs. Pt
   TH2F                       *fHistDeltaPhiPt;           //!Phi-PhiProp vs. Pt
+  TH1F                       *fHistDeltaEtaNewProp;      //!NewEtaProp-EtaProp
+  TH1F                       *fHistDeltaPhiNewProp;      //!NewPhiProp-PhiProp
   // Clusters
   TH3F                       *fHistClusPhiEtaEnergy;     //!Phi-Eta-Energy distribution of clusters
   TH2F                       *fHistNCellsEnergy;         //!Number of cells vs. energy of cluster