- adding histograms for energy deposited by identified charged particles
authorodjuvsla <odjuvsla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 18 Sep 2010 16:36:19 +0000 (16:36 +0000)
committerodjuvsla <odjuvsla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 18 Sep 2010 16:36:19 +0000 (16:36 +0000)
PWG4/totEt/AliAnalysisEt.cxx
PWG4/totEt/AliAnalysisEt.h
PWG4/totEt/AliAnalysisEtReconstructed.cxx
PWG4/totEt/AliAnalysisEtReconstructed.h

index d706043..260d9fb 100644 (file)
@@ -60,6 +60,21 @@ AliAnalysisEt::AliAnalysisEt() :
         ,fMultiplicity(0)
         ,fChargedMultiplicity(0)
         ,fNeutralMultiplicity(0)
+        ,fBaryonEt(0)
+        ,fAntiBaryonEt(0)
+        ,fMesonEt(0)
+        ,fBaryonEtAcc(0)
+        ,fAntiBaryonEtAcc(0)
+        ,fMesonEtAcc(0)
+        ,fProtonEt(0)
+        ,fChargedKaonEt(0)
+        ,fMuonEt(0)
+        ,fElectronEt(0)
+        ,fProtonEtAcc(0)
+        ,fChargedKaonEtAcc(0)
+        ,fMuonEtAcc(0)
+        ,fElectronEtAcc(0)
+        ,fEtaCut(0)
        ,fEtaCutAcc(0)
        ,fPhiCutAccMin(0)
        ,fPhiCutAccMax(0)
@@ -83,6 +98,15 @@ AliAnalysisEt::AliAnalysisEt() :
         ,fHistBaryonEtAcc(0)
         ,fHistAntiBaryonEtAcc(0)
         ,fHistMesonEtAcc(0)
+        ,fHistProtonEt(0)
+        ,fHistChargedKaonEt(0)
+        ,fHistMuonEt(0)
+        ,fHistElectronEt(0)
+        ,fHistProtonEtAcc(0)
+        ,fHistChargedKaonEtAcc(0)
+        ,fHistMuonEtAcc(0)
+        ,fHistElectronEtAcc(0)
+        ,fHistEtRecvsEtMC(0)
         ,fHistTMDeltaR(0)
 {
 }
@@ -117,6 +141,13 @@ void AliAnalysisEt::FillOutputList(TList *list)
     list->Add(fHistAntiBaryonEtAcc);
     list->Add(fHistMesonEtAcc);
 
+    list->Add(fHistProtonEtAcc);
+    list->Add(fHistChargedKaonEtAcc);
+    list->Add(fHistMuonEtAcc);
+    list->Add(fHistElectronEtAcc);
+
+    list->Add(fHistEtRecvsEtMC);
+
     list->Add(fHistTMDeltaR);
 }
 
@@ -207,6 +238,33 @@ void AliAnalysisEt::CreateHistograms()
     histname = "fHistMesonEtAcc" + fHistogramNameSuffix;
     fHistMesonEtAcc = new TH1F(histname.Data(), "E_{T} for mesons in calorimeter acceptance",  nbinsEt, minEt, maxEt);
 
+    histname = "fHistProtonEt" + fHistogramNameSuffix;
+    fHistProtonEt = new TH1F(histname.Data(), "E_{T} for (anti-)protons", nbinsEt, minEt, maxEt);
+
+    histname = "fHistKaonEt" + fHistogramNameSuffix;
+    fHistChargedKaonEt = new TH1F(histname.Data(), "E_{T} for charged kaons", nbinsEt, minEt, maxEt);
+
+    histname = "fHistMuonEt" + fHistogramNameSuffix;
+    fHistMuonEt = new TH1F(histname.Data(), "E_{T} for muons", nbinsEt, minEt, maxEt);
+
+    histname = "fHistElectronEt" + fHistogramNameSuffix;
+    fHistElectronEt = new TH1F(histname.Data(), "E_{T} for electrons/positrons", nbinsEt, minEt, maxEt);
+
+    histname = "fHistProtonEtAcc" + fHistogramNameSuffix;
+    fHistProtonEtAcc = new TH1F(histname.Data(), "E_{T} for (anti-)protons in calorimeter acceptance", nbinsEt, minEt, maxEt);
+
+    histname = "fHistKaonEtAcc" + fHistogramNameSuffix;
+    fHistChargedKaonEtAcc = new TH1F(histname.Data(), "E_{T} for charged kaons in calorimeter acceptance", nbinsEt, minEt, maxEt);
+
+    histname = "fHistMuonEtAcc" + fHistogramNameSuffix;
+    fHistMuonEtAcc = new TH1F(histname.Data(), "E_{T} for muons in calorimeter acceptance", nbinsEt, minEt, maxEt);
+
+    histname = "fHistElectronEtAcc" + fHistogramNameSuffix;
+    fHistElectronEtAcc = new TH1F(histname.Data(), "E_{T} for electrons/positrons in calorimeter acceptance", nbinsEt, minEt, maxEt);
+
+    histname = "fHistEtRecvsEtMC" + fHistogramNameSuffix;
+    fHistEtRecvsEtMC = new TH2F(histname.Data(), "Reconstructed E_{t} vs MC E_{t}", nbinsEt, minEt, maxEt, nbinsEt, minEt, maxEt);
+
     //
     histname = "fHistTMDeltaR" + fHistogramNameSuffix;
     fHistTMDeltaR = new TH1F(histname.Data(), "#Delta R for calorimeter clusters", 200, 0, 50);
@@ -241,6 +299,15 @@ void AliAnalysisEt::FillHistograms()
 
     fHistTMDeltaR;
     */
+    fHistProtonEt->Fill(fProtonEt);
+    fHistChargedKaonEt->Fill(fChargedKaonEt);
+    fHistMuonEt->Fill(fMuonEt);
+    fHistElectronEt->Fill(fElectronEt);
+    
+    fHistProtonEtAcc->Fill(fProtonEtAcc);
+    fHistChargedKaonEtAcc->Fill(fChargedKaonEtAcc);
+    fHistMuonEtAcc->Fill(fMuonEtAcc);
+    fHistElectronEtAcc->Fill(fElectronEtAcc);
 }
 
 Int_t AliAnalysisEt::AnalyseEvent(AliVEvent *event)
@@ -261,7 +328,20 @@ void AliAnalysisEt::ResetEventValues()
   fMultiplicity = 0;
   fChargedMultiplicity = 0;
   fNeutralMultiplicity = 0;
-  
+  fBaryonEt = 0;
+  fAntiBaryonEt = 0;
+  fMesonEt = 0;
+  fBaryonEtAcc = 0;
+  fAntiBaryonEtAcc = 0;
+  fMesonEtAcc = 0;
+  fProtonEt = 0;
+  fChargedKaonEt = 0;
+  fMuonEt = 0;
+  fElectronEt = 0;
+  fProtonEtAcc = 0;
+  fChargedKaonEtAcc = 0;
+  fMuonEtAcc = 0;
+    
   if (!fCuts || !fPdgDB || fPiPlusCode==0) { // some Init's needed
     cout << __FILE__ << ":" << __LINE__ << " : Init " << endl;
     if (!fCuts) {
index e59998e..84a9b39 100644 (file)
@@ -127,6 +127,51 @@ protected:
     Int_t fMultiplicity;/** Multiplicity of particles in the event */    
     Int_t fChargedMultiplicity;/** Multiplicity of charged particles in the event */    
     Int_t fNeutralMultiplicity; /** Multiplicity of neutral particles in the event */
+    
+    /** Et of identified baryons */
+    Double_t fBaryonEt;
+    
+    /** Et of identified anti-baryons */
+    Double_t fAntiBaryonEt;
+    
+    /** Et of identified mesons */
+    Double_t fMesonEt;
+
+    /** Et of identified baryons in calorimeter acceptance */
+    Double_t fBaryonEtAcc;
+
+    /** Et of identified anti-baryons in calorimeter acceptance */
+    Double_t fAntiBaryonEtAcc;
+    
+    /** Et of identified mesons in calorimeter acceptance */
+    Double_t fMesonEtAcc;
+
+    /** Et of identified protons */
+    Double_t fProtonEt;
+    
+    /** Et of identified charged kaons */
+    Double_t fChargedKaonEt;
+    
+    /** Et of identified muons */
+    Double_t fMuonEt;
+    
+    /** Et of identified electrons */
+    Double_t fElectronEt;
+    
+    /** Et of identified protons in calorimeter acceptance */
+    Double_t fProtonEtAcc;
+
+    /** Et of identified charged kaons in calorimeter acceptance */
+    Double_t fChargedKaonEtAcc;
+
+    /** Et of identified muons in calorimeter acceptance */
+    Double_t fMuonEtAcc;
+
+    /** Et of identified electrons in calorimeter acceptance */
+    Double_t fElectronEtAcc;
+    
+    /** Cut in eta (standard |eta| < 0.5 )*/
+    Double_t fEtaCut;
 
     Double_t fEtaCutAcc;/** Eta cut for our acceptance */
     Double_t fPhiCutAccMin; /** Min phi cut for our acceptance in radians */    
@@ -169,17 +214,31 @@ protected:
     TH2F *fHistPhivsPtPos; //phi vs pT plot for positive tracks
     TH2F *fHistPhivsPtNeg; //phi vs pT plot for negative tracks
 
-    /* PID plots, Et */
-    TH1F *fHistBaryonEt; // baryon
-    TH1F *fHistAntiBaryonEt; // anti-baryon
-    TH1F *fHistMesonEt; // meson
+    /* PID plots */
+    TH1F *fHistBaryonEt;
+    TH1F *fHistAntiBaryonEt;
+    TH1F *fHistMesonEt;
 
-    TH1F *fHistBaryonEtAcc; // baryon, acc
-    TH1F *fHistAntiBaryonEtAcc; // anti-baryon, acc
-    TH1F *fHistMesonEtAcc; // meson, acc
+    TH1F *fHistBaryonEtAcc;
+    TH1F *fHistAntiBaryonEtAcc;
+    TH1F *fHistMesonEtAcc;
 
-    TH1F *fHistTMDeltaR;  /* Track matching plots */
+    TH1F *fHistProtonEt;
+    TH1F *fHistChargedKaonEt;
+    TH1F *fHistMuonEt;
+    TH1F *fHistElectronEt;
+    
+    TH1F *fHistProtonEtAcc;
+    TH1F *fHistChargedKaonEtAcc;
+    TH1F *fHistMuonEtAcc;
+    TH1F *fHistElectronEtAcc;
+    
+    /* Correction plots */
+    TH2F *fHistEtRecvsEtMC; //Reconstructed Et versus MC Et
 
+    /* Track matching plots */
+    TH1F *fHistTMDeltaR;
+    
 private:
     //Declare private to avoid compilation warning
     AliAnalysisEt & operator = (const AliAnalysisEt & g) ;//cpy assignment
index 407aa5a..7584916 100644 (file)
 #include "AliVEvent.h"
 #include "AliESDEvent.h"
 #include "AliVParticle.h"
+#include "TDatabasePDG.h"
+#include "TList.h"
 #include <iostream>
 #include "TH2F.h"
 
 AliAnalysisEtReconstructed::AliAnalysisEtReconstructed() :
         AliAnalysisEt()
+        ,fNTpcClustersCut(0)
+        ,fNItsClustersCut(0)
         ,fTrackDistanceCut(0)
+        ,fPidCut(0)
         ,fClusterType(0)
+        ,fHistChargedPionEnergyDeposit(0)
+        ,fHistProtonEnergyDeposit(0)
+        ,fHistAntiProtonEnergyDeposit(0)
+        ,fHistChargedKaonEnergyDeposit(0)
+        ,fHistMuonEnergyDeposit(0)
 {
 
 }
@@ -35,6 +45,8 @@ Int_t AliAnalysisEtReconstructed::AnalyseEvent(AliVEvent* ev)
     ResetEventValues();
     AliESDEvent *event = dynamic_cast<AliESDEvent*>(ev);
 
+    Double_t protonMass = fPdgDB->GetParticle("proton")->Mass();
+
     for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++)
     {
         AliVParticle *track = event->GetTrack(iTrack);
@@ -52,10 +64,11 @@ Int_t AliAnalysisEtReconstructed::AnalyseEvent(AliVEvent* ev)
         Float_t massPart = 0;
 
         const Double_t *pidWeights = track->PID();
+       Int_t maxpid = -1;
+        Double_t maxpidweight = 0;
+            
         if (pidWeights)
         {
-            Int_t maxpid = -1;
-            Float_t maxpidweight = 0;
             for (Int_t p =0; p < AliPID::kSPECIES; p++)
             {
                 if (pidWeights[p] > maxpidweight)
@@ -66,7 +79,8 @@ Int_t AliAnalysisEtReconstructed::AnalyseEvent(AliVEvent* ev)
             }
             if (maxpid == AliPID::kProton)
             {
-                //     massPart = -0.938*track->Charge();
+             //by definition of ET
+               massPart = -protonMass*track->Charge();
             }
 
         }
@@ -78,10 +92,49 @@ Int_t AliAnalysisEtReconstructed::AnalyseEvent(AliVEvent* ev)
         {
            fTotChargedEt +=  et;
             fChargedMultiplicity++;
+           if (maxpid != -1)
+            {
+                if (maxpid == AliPID::kPion)
+                {
+                    fProtonEt += et;
+                }
+                if (maxpid == AliPID::kKaon)
+                {
+                    fChargedKaonEt += et;
+                }
+                if (maxpid == AliPID::kMuon)
+                {
+                    fMuonEt += et;
+                }
+                if (maxpid == AliPID::kElectron)
+                {
+                    fElectronEt += et;
+                }
+            }
 
             if (TMath::Abs(track->Eta()) < fEtaCutAcc && track->Phi() < fPhiCutAccMax && track->Phi() > fPhiCutAccMin)
             {
                 fTotChargedEtAcc += track->E()*TMath::Sin(track->Theta()) + massPart;
+               if (maxpid != -1)
+                {
+                    if (maxpid == AliPID::kPion)
+                    {
+                        fProtonEtAcc += et;
+                    }
+                    if (maxpid == AliPID::kKaon)
+                    {
+                        fChargedKaonEtAcc += et;
+                    }
+                    if (maxpid == AliPID::kMuon)
+                    {
+                        fMuonEtAcc += et;
+                    }
+                    if (maxpid == AliPID::kElectron)
+                    {
+                        fElectronEtAcc += et;
+                    }
+                }
+           
             }
         }
 
@@ -104,25 +157,67 @@ Int_t AliAnalysisEtReconstructed::AnalyseEvent(AliVEvent* ev)
             continue;
         }
 
-       // printf("Rec Cluster: iCluster %03d E %4.3f type %d NCells %d\n", iCluster, cluster->E(), (int)(cluster->GetType()), cluster->GetNCells()); // tmp/debug printout
-        if (cluster->GetType() != fClusterType) continue;
-
+       if (cluster->GetType() != fClusterType) continue;
+       if(cluster->GetTracksMatched() > 0)
+       //printf("Rec Cluster: iCluster %03d E %4.3f type %d NCells %d, nmatched: %d, distance to closest: %f\n", iCluster, cluster->E(), (int)(cluster->GetType()), cluster->GetNCells(), cluster->GetNTracksMatched(), cluster->GetEmcCpvDistance()); // tmp/debug printout
+              
+        
         if (cluster->E() < fClusterEnergyCut) continue;
         Float_t pos[3];
         TVector3 cp(pos);
         cluster->GetPosition(pos);
-        //if (pos[0] < -(32.0*2.2)) continue; //Ensure that modules 0 and 1 are not used
-        // if(cp.Phi() < 260.*TMath::Pi()/180.) continue;
-        fHistTMDeltaR->Fill(cluster->GetEmcCpvDistance());
+
+       fHistTMDeltaR->Fill(cluster->GetEmcCpvDistance());
         if (cluster->GetEmcCpvDistance() < fTrackDistanceCut)
         {
+            if (cluster->GetNTracksMatched() == 1)
+            {
+                AliVTrack *track = event->GetTrack(cluster->GetTrackMatchedIndex());
+                const Double_t *pidWeights = track->PID();
+                
+               Double_t maxpidweight = 0;
+               Int_t maxpid = 0;
+                
+               if (pidWeights)
+                {
+                    for (Int_t p =0; p < AliPID::kSPECIES; p++)
+                    {
+                        if (pidWeights[p] > maxpidweight)
+                        {
+                            maxpidweight = pidWeights[p];
+                            maxpid = p;
+                        }
+                    }
+                    if(maxpidweight > fPidCut)
+                   {
+                      if(maxpid == AliPID::kProton)
+                      {
+                         if(track->Charge() == 1)
+                         {
+                            fHistProtonEnergyDeposit->Fill(cluster->E(), track->E());
+                         }
+                         else if(track->Charge() == -1)
+                         {
+                            fHistAntiProtonEnergyDeposit->Fill(cluster->E(), track->E());
+                         }
+                      }
+                      else if(maxpid == AliPID::kPion)
+                      {
+                         fHistChargedPionEnergyDeposit->Fill(cluster->E(), track->E());
+                      }
+                      else if(maxpid == AliPID::kKaon)
+                      {
+                         fHistChargedKaonEnergyDeposit->Fill(cluster->E(), track->E());
+                      }   
+                      else if(maxpid == AliPID::kMuon)
+                      {
+                         fHistMuonEnergyDeposit->Fill(cluster->E(), track->E());
+                      }
+                   }
+                }
+            }
+
             continue;
-            //AliVParticle *matchedTrack = event->GetTrack(cluster->GetTrackMatched());
-//         if(CheckGoodVertex(matchedTrack))
-//         {
-//            totChargedEnergy +=  matchedTrack->E();;
-//            totChargedEt += matchedTrack->E()*TMath::Sin(matchedTrack);
-//         }
         }
 
         if (cluster->E() >  fSingleCellEnergyCut && cluster->GetNCells() == fCuts->GetCommonSingleCell()) continue;
@@ -142,11 +237,9 @@ Int_t AliAnalysisEtReconstructed::AnalyseEvent(AliVEvent* ev)
     }
 
     fTotNeutralEtAcc = fTotNeutralEt;
-
     fTotEt = fTotChargedEt + fTotNeutralEt;
     fTotEtAcc = fTotChargedEtAcc + fTotNeutralEtAcc;
 
-    std::cout << fTotChargedEtAcc << std::endl;
     // Fill the histograms...
     FillHistograms();
 
@@ -172,6 +265,9 @@ bool AliAnalysisEtReconstructed::CheckGoodVertex(AliVParticle* track)
 void AliAnalysisEtReconstructed::Init()
 { // Init
     AliAnalysisEt::Init();
+    fNItsClustersCut = fCuts->GetReconstructedNItsClustersCut();
+    fNTpcClustersCut = fCuts->GetReconstructedNTpcClustersCut();
+    fPidCut = fCuts->GetCommonPidCut();
 }
 
 bool AliAnalysisEtReconstructed::TrackHitsCalorimeter(AliVParticle* track, Double_t magField)
@@ -189,3 +285,46 @@ bool AliAnalysisEtReconstructed::TrackHitsCalorimeter(AliVParticle* track, Doubl
                   esdTrack->Phi() < fPhiCutAccMax*TMath::Pi()/180.;
 }
 
+void AliAnalysisEtReconstructed::FillOutputList(TList* list)
+{
+    AliAnalysisEt::FillOutputList(list);
+
+    list->Add(fHistChargedPionEnergyDeposit);
+    list->Add(fHistProtonEnergyDeposit);
+    list->Add(fHistAntiProtonEnergyDeposit);
+    list->Add(fHistChargedKaonEnergyDeposit);
+    list->Add(fHistMuonEnergyDeposit);
+}
+
+void AliAnalysisEtReconstructed::CreateHistograms()
+{
+    AliAnalysisEt::CreateHistograms();
+
+    TString histname;
+    histname = "fHistChargedPionEnergyDeposit" + fHistogramNameSuffix;
+    fHistChargedPionEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by #pi^{+/-}", 1000, 0, 10, 1000, 0, 10);
+    fHistChargedPionEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
+    fHistChargedPionEnergyDeposit->SetYTitle("Energy of track");
+    
+    histname = "fHistProtonEnergyDeposit" + fHistogramNameSuffix;
+    fHistProtonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by protons", 1000, 0, 10, 1000, 0, 10);
+    fHistProtonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
+    fHistProtonEnergyDeposit->SetYTitle("Energy of track");
+    
+    histname = "fHistAntiProtonEnergyDeposit" + fHistogramNameSuffix;
+    fHistAntiProtonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by anti-protons", 1000, 0, 10, 1000, 0, 10);
+    fHistAntiProtonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
+    fHistAntiProtonEnergyDeposit->SetYTitle("Energy of track");
+    
+    histname = "fHistChargedKaonEnergyDeposit" + fHistogramNameSuffix;
+    fHistChargedKaonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by K^{+/-}", 1000, 0, 10, 1000, 0, 10);
+    fHistChargedKaonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
+    fHistChargedKaonEnergyDeposit->SetYTitle("Energy of track");
+    
+    histname = "fHistMuonEnergyDeposit" + fHistogramNameSuffix;
+    fHistMuonEnergyDeposit = new TH2F(histname.Data(), "Energy deposited by #mu^{+/-}", 1000, 0, 10, 1000, 0, 10);
+    fHistMuonEnergyDeposit->SetXTitle("Energy deposited in calorimeter");
+    fHistMuonEnergyDeposit->SetYTitle("Energy of track");
+    
+
+}
index 062933b..8552f31 100644 (file)
@@ -23,15 +23,48 @@ public:
     virtual Int_t AnalyseEvent(AliVEvent* event);
 
     virtual void Init();
+
+    /** Fill the objects you want to output, classes which add new histograms should overload this. */
+    virtual void FillOutputList(TList *list);
+
+    /** Create the histograms, must be overloaded if you want to add your own */
+    virtual void CreateHistograms();
     
 protected:
 
     bool CheckGoodVertex(AliVParticle *track);
     virtual bool TrackHitsCalorimeter(AliVParticle *track, Double_t magField);
 
+    Int_t fNTpcClustersCut;
+    Int_t fNItsClustersCut;
+
     Double_t fTrackDistanceCut; // cut on track distance    
+    
+    Double_t fPidCut; // cut on the pid probability
+    
     Char_t fClusterType; // selection on cluster type
     
+    /** Energy deposited in calorimeter by charged pions */
+    TH2F *fHistChargedPionEnergyDeposit;
+    
+    /** Energy deposited in calorimeter by protons */
+    TH2F *fHistProtonEnergyDeposit;
+    
+    /** Energy deposited in calorimeter by anti-protons */
+    TH2F *fHistAntiProtonEnergyDeposit;
+
+    /** Energy deposited in calorimeter by charged kaons */
+    TH2F *fHistChargedKaonEnergyDeposit;
+    
+    /** Energy deposited in calorimeter by muons */
+    TH2F *fHistMuonEnergyDeposit;
+    
+  private:
+    
+    AliAnalysisEtReconstructed(const AliAnalysisEtReconstructed& g);
+    AliAnalysisEtReconstructed & operator=(const AliAnalysisEtReconstructed&);
+    
+   
 };
 
 #endif // ALIANALYSISETRECONSTRUCTED_H