Browse Source

Added qaParticleLight class, vn now calculates using std::vector<qaParticleLight> of selected particles

ParfenovPeter 10 months ago
parent
commit
5f3d1a302d
7 changed files with 365 additions and 71 deletions
  1. 4 0
      CMakeLists.txt
  2. 53 29
      bin/main.cpp
  3. 29 0
      format/qaParticleLight.cxx
  4. 41 0
      format/qaParticleLight.h
  5. 1 0
      qaTools.LinkDef.h
  6. 228 38
      utility/Utility.cxx
  7. 9 4
      utility/Utility.h

+ 4 - 0
CMakeLists.txt

@@ -52,6 +52,7 @@ if(NOT MCINI)
 
   set(QATOOLS_LIBRARY_h_files
     ${CMAKE_CURRENT_SOURCE_DIR}/format/qaParticle.h
+    ${CMAKE_CURRENT_SOURCE_DIR}/format/qaParticleLight.h
     ${CMAKE_CURRENT_SOURCE_DIR}/format/qaEvent.h
     ${CMAKE_CURRENT_SOURCE_DIR}/readers/qaReader_smash_root.h
     ${CMAKE_CURRENT_SOURCE_DIR}/readers/qaReader_mcpico.h
@@ -61,6 +62,7 @@ if(NOT MCINI)
 
   set(QATOOLS_LIBRARY_cxx_files
     ${CMAKE_CURRENT_SOURCE_DIR}/format/qaParticle.cxx
+    ${CMAKE_CURRENT_SOURCE_DIR}/format/qaParticleLight.cxx
     ${CMAKE_CURRENT_SOURCE_DIR}/format/qaEvent.cxx
     ${CMAKE_CURRENT_SOURCE_DIR}/readers/qaReader_smash_root.cxx
     ${CMAKE_CURRENT_SOURCE_DIR}/readers/qaReader_mcpico.cxx
@@ -87,6 +89,7 @@ if(MCINI)
 
   set(QATOOLS_LIBRARY_h_files
     ${CMAKE_CURRENT_SOURCE_DIR}/format/qaParticle.h
+    ${CMAKE_CURRENT_SOURCE_DIR}/format/qaParticleLight.h
     ${CMAKE_CURRENT_SOURCE_DIR}/format/qaEvent.h
     ${CMAKE_CURRENT_SOURCE_DIR}/readers/qaReader_smash_root.h
     ${CMAKE_CURRENT_SOURCE_DIR}/readers/qaReader_mcpico.h
@@ -97,6 +100,7 @@ if(MCINI)
 
   set(QATOOLS_LIBRARY_cxx_files
     ${CMAKE_CURRENT_SOURCE_DIR}/format/qaParticle.cxx
+    ${CMAKE_CURRENT_SOURCE_DIR}/format/qaParticleLight.cxx
     ${CMAKE_CURRENT_SOURCE_DIR}/format/qaEvent.cxx
     ${CMAKE_CURRENT_SOURCE_DIR}/readers/qaReader_smash_root.cxx
     ${CMAKE_CURRENT_SOURCE_DIR}/readers/qaReader_mcpico.cxx

+ 53 - 29
bin/main.cpp

@@ -10,6 +10,7 @@
 #include <TStopwatch.h>
 
 #include <qaParticle.h>
+#include <qaParticleLight.h>
 #include <qaEvent.h>
 #include <qaReader_manager.h>
 #include <qaReader_smash_root.h>
@@ -354,6 +355,11 @@ int main(int argc, char **argv)
   Int_t ipid;
   Double_t v1, v2, y;
   Int_t eta_w, centBin;
+
+  std::vector<qaParticleLight> v_particles_v1;
+  std::vector<qaParticleLight> v_particles_v2;
+  qaParticleLight light_particle;
+
   while (Minbias_counter < Nentries)
   {
     if (Minbias_counter % 1000 == 0)
@@ -370,6 +376,10 @@ int main(int argc, char **argv)
 
     Ncounter_minbias = 0;
     Ncounter_refmult = 0;
+
+    v_particles_v1.clear();
+    v_particles_v2.clear();
+
     Nparticles = event->GetNparticles();
     for (int iparticle = 0; iparticle < Nparticles; iparticle++)
     {
@@ -498,25 +508,12 @@ int main(int argc, char **argv)
           qaUtility::GetInstance()->Cut_Particle_v1_acceptance(particle) &&
           qaUtility::GetInstance()->Is_v1 == 1)
       {
-        v1 = TMath::Cos(1. * (particle->GetPhi() - event->GetPhiRP()));
-        eta_w = 1; //(particle->GetEta() >= 0.) ? 1 : -1;
-        y = 0.5 * TMath::Log((particle->GetEnergy() + particle->GetPz()) / (particle->GetEnergy() - particle->GetPz()));
-        centBin = qaUtility::GetInstance()->GetCentralityBin(event->GetB(), qaUtility::GetInstance()->Cut_v1_Event_bCent);
-
         h2_v1_Particle_pteta->Fill(particle->GetEta(), particle->GetPt());
-
         ipid = qaUtility::GetInstance()->GetPdgId(particle->GetPdg());
-
         if (ipid != -1)
         {
-          if (qaUtility::GetInstance()->Cut_Particle_v1_PID_pt(particle, ipid) && centBin != -1)
-          {
-            p_v1_PID_pt[centBin][ipid]->Fill(particle->GetPt(), v1 * eta_w);
-          }
-          if (qaUtility::GetInstance()->Cut_Particle_v1_PID_y(particle, ipid) && centBin != -1)
-          {
-            p_v1_PID_y[centBin][ipid]->Fill(y, v1);
-          }
+          light_particle.SetParticle(particle);
+          v_particles_v1.push_back(light_particle);
         }
       }
 
@@ -524,30 +521,57 @@ int main(int argc, char **argv)
           qaUtility::GetInstance()->Cut_Particle_v2_acceptance(particle) &&
           qaUtility::GetInstance()->Is_v2 == 1)
       {
-        v2 = TMath::Cos(2. * (particle->GetPhi() - event->GetPhiRP()));
-        y = 0.5 * TMath::Log((particle->GetEnergy() + particle->GetPz()) / (particle->GetEnergy() - particle->GetPz()));
-        centBin = qaUtility::GetInstance()->GetCentralityBin(event->GetB(), qaUtility::GetInstance()->Cut_v2_Event_bCent);
-
         h2_v2_Particle_pteta->Fill(particle->GetEta(), particle->GetPt());
-
         ipid = qaUtility::GetInstance()->GetPdgId(particle->GetPdg());
-
         if (ipid != -1)
         {
-          if (qaUtility::GetInstance()->Cut_Particle_v2_PID_pt(particle, ipid) && centBin != -1)
-          {
-            p_v2_PID_pt[centBin][ipid]->Fill(particle->GetPt(), v2);
-          }
-          if (qaUtility::GetInstance()->Cut_Particle_v2_PID_y(particle, ipid) && centBin != -1)
-          {
-            p_v2_PID_y[centBin][ipid]->Fill(y, v2);
-          }
+          light_particle.SetParticle(particle);
+          v_particles_v2.push_back(light_particle);
         }
       }
 
       delete particle;
     }
 
+    // Loop over v1-related particles
+    centBin = qaUtility::GetInstance()->GetCentralityBin(event->GetB(), qaUtility::GetInstance()->Cut_v1_Event_bCent);
+    if (qaUtility::GetInstance()->Is_v1 == 1)
+    {
+      for (const auto& lparticle: v_particles_v1)
+      {
+        v1 = TMath::Cos(1. * (lparticle.GetPhi() - event->GetPhiRP()));
+        eta_w = 1; //(particle->GetEta() >= 0.) ? 1 : -1;
+        ipid = qaUtility::GetInstance()->GetPdgId(lparticle.GetPdg());
+        if (qaUtility::GetInstance()->Cut_Particle_v1_PID_pt(lparticle, ipid) && centBin != -1)
+        {
+          p_v1_PID_pt[centBin][ipid]->Fill(lparticle.GetPt(), v1 * eta_w);
+        }
+        if (qaUtility::GetInstance()->Cut_Particle_v1_PID_y(lparticle, ipid) && centBin != -1)
+        {
+          p_v1_PID_y[centBin][ipid]->Fill(lparticle.GetRapidity(), v1);
+        }
+      }
+    }
+
+    // Loop over v2-related particles
+    centBin = qaUtility::GetInstance()->GetCentralityBin(event->GetB(), qaUtility::GetInstance()->Cut_v2_Event_bCent);
+    if (qaUtility::GetInstance()->Is_v2 == 1)
+    {
+      for (const auto& lparticle: v_particles_v2)
+      {
+        v2 = TMath::Cos(2. * (lparticle.GetPhi() - event->GetPhiRP()));
+        ipid = qaUtility::GetInstance()->GetPdgId(lparticle.GetPdg());
+        if (qaUtility::GetInstance()->Cut_Particle_v2_PID_pt(lparticle, ipid) && centBin != -1)
+        {
+          p_v2_PID_pt[centBin][ipid]->Fill(lparticle.GetPt(), v2);
+        }
+        if (qaUtility::GetInstance()->Cut_Particle_v2_PID_y(lparticle, ipid) && centBin != -1)
+        {
+          p_v2_PID_y[centBin][ipid]->Fill(lparticle.GetRapidity(), v2);
+        }
+      }
+    }
+
     if (qaUtility::GetInstance()->Cut_Event_minbias(event) && qaUtility::GetInstance()->Is_minbias == 1)
     {
       Minbias_counter++;

+ 29 - 0
format/qaParticleLight.cxx

@@ -0,0 +1,29 @@
+#include <qaParticleLight.h>
+
+ClassImp(qaParticleLight);
+
+qaParticleLight::qaParticleLight(/* args */) : fPx(0), fPy(0), fPz(0), fE(0), fPdg(0)
+{
+}
+
+qaParticleLight::~qaParticleLight()
+{
+}
+
+void qaParticleLight::SetParticle(Float_t _px, Float_t _py, Float_t _pz, Float_t _e, Int_t _pdg)
+{
+    fPx = _px;
+    fPy = _py;
+    fPz = _pz;
+    fE = _e;
+    fPdg = _pdg;
+}
+
+void qaParticleLight::SetParticle(qaParticle *const &_particle)
+{
+    fPx = _particle->GetPx();
+    fPy = _particle->GetPy();
+    fPz = _particle->GetPz();
+    fE = _particle->GetEnergy();
+    fPdg = _particle->GetPdg();
+}

+ 41 - 0
format/qaParticleLight.h

@@ -0,0 +1,41 @@
+#ifndef QATOOLS_FORMAT_PARTICLE_LIGHT_H
+#define QATOOLS_FORMAT_PARTICLE_LIGHT_H
+
+#include <iostream>
+#include <Rtypes.h>
+#include <TMath.h>
+
+#include <qaParticle.h>
+
+class qaParticleLight
+{
+private:
+    Float_t fPx;
+    Float_t fPy;
+    Float_t fPz;
+    Float_t fE;
+    Int_t fPdg;
+
+public:
+    qaParticleLight(/* args */);
+    virtual ~qaParticleLight();
+
+    virtual void SetParticle(Float_t _px, Float_t _py, Float_t _pz, Float_t _e, Int_t _pdg);
+    virtual void SetParticle(qaParticle *const &_particle);
+
+    virtual Float_t GetPx() const { return fPx; }
+    virtual Float_t GetPy() const { return fPy; }
+    virtual Float_t GetPz() const { return fPz; }
+    virtual Float_t GetEnergy() const { return fE; }
+    virtual Int_t GetPdg() const { return fPdg; }
+
+    virtual Float_t GetPt() const { return TMath::Sqrt(TMath::Power(fPx, 2) + TMath::Power(fPy, 2)); }
+    virtual Float_t GetP() const { return TMath::Sqrt(TMath::Power(fPx, 2) + TMath::Power(fPy, 2) + TMath::Power(fPz, 2)); }
+    virtual Float_t GetEta() const { return 0.5 * TMath::Log((TMath::Sqrt(TMath::Power(fPx, 2) + TMath::Power(fPy, 2) + TMath::Power(fPz, 2)) + fPz) / (TMath::Sqrt(TMath::Power(fPx, 2) + TMath::Power(fPy, 2) + TMath::Power(fPz, 2)) - fPz)); }
+    virtual Float_t GetRapidity() const { return 0.5 * TMath::Log((fE + fPz) / (fE - fPz)); }
+    virtual Float_t GetPhi() const { return TMath::ATan2(fPy, fPx); }
+
+    ClassDef(qaParticleLight, 0);
+};
+
+#endif

+ 1 - 0
qaTools.LinkDef.h

@@ -9,6 +9,7 @@
 #pragma link C++ nestedtypedef;
 
 #pragma link C++ class qaParticle+;
+#pragma link C++ class qaParticleLight+;
 #pragma link C++ class qaEvent+;
 #pragma link C++ class qaReader_smash_root+;
 #pragma link C++ class qaReader_mcpico+;

+ 228 - 38
utility/Utility.cxx

@@ -307,13 +307,106 @@ Bool_t qaUtility::Cut_Particle_v1_acceptance(qaParticle *const &particle)
   return true;
 }
 
-Bool_t qaUtility::Cut_Particle_v1_PID_pt(qaParticle *const &particle, Int_t _pid)
+// Bool_t qaUtility::Cut_Particle_v1_PID_pt(qaParticle *const &particle, Int_t _pid)
+// {
+//   if (particle->GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
+//     return false;
+  
+//   // PID related kinematics cut
+//   Double_t y = 0.5 * TMath::Log( (particle->GetEnergy() + particle->GetPz())/(particle->GetEnergy() - particle->GetPz()) );
+//   if (_pid == 1 && y < Cut_v1_Particle_ymin_pi)
+//     return false;
+//   if (_pid == 1 && y > Cut_v1_Particle_ymax_pi)
+//     return false;
+//   if (_pid == 2 && y < Cut_v1_Particle_ymin_ka)
+//     return false;
+//   if (_pid == 2 && y > Cut_v1_Particle_ymax_ka)
+//     return false;
+//   if (_pid == 3 && y < Cut_v1_Particle_ymin_pr)
+//     return false;
+//   if (_pid == 3 && y > Cut_v1_Particle_ymax_pr)
+//     return false;
+//   if (_pid == 5 && y < Cut_v1_Particle_ymin_pi)
+//     return false;
+//   if (_pid == 5 && y > Cut_v1_Particle_ymax_pi)
+//     return false;
+//   if (_pid == 6 && y < Cut_v1_Particle_ymin_ka)
+//     return false;
+//   if (_pid == 6 && y > Cut_v1_Particle_ymax_ka)
+//     return false;
+//   if (_pid == 7 && y < Cut_v1_Particle_ymin_pr)
+//     return false;
+//   if (_pid == 7 && y > Cut_v1_Particle_ymax_pr)
+//     return false;
+
+//   Double_t charge = GetCharge(particle->GetPdg());
+//   if (charge == error_code)
+//     return false;
+//   if (charge == 0)
+//     return false;
+
+//   if (_pid == 0 && charge < 0)
+//     return false;
+//   if (_pid == 4 && charge > 0)
+//     return false;
+
+//   return true;
+// }
+
+// Bool_t qaUtility::Cut_Particle_v1_PID_y(qaParticle *const &particle, Int_t _pid)
+// {
+//   if (particle->GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
+//     return false;
+  
+//   // PID related kinematics cut
+//   if (_pid == 1 && particle->GetPt() < Cut_v1_Particle_ptmin_pi)
+//     return false;
+//   if (_pid == 1 && particle->GetPt() > Cut_v1_Particle_ptmax_pi)
+//     return false;
+//   if (_pid == 2 && particle->GetPt() < Cut_v1_Particle_ptmin_ka)
+//     return false;
+//   if (_pid == 2 && particle->GetPt() > Cut_v1_Particle_ptmax_ka)
+//     return false;
+//   if (_pid == 3 && particle->GetPt() < Cut_v1_Particle_ptmin_pr)
+//     return false;
+//   if (_pid == 3 && particle->GetPt() > Cut_v1_Particle_ptmax_pr)
+//     return false;
+//   if (_pid == 5 && particle->GetPt() < Cut_v1_Particle_ptmin_pi)
+//     return false;
+//   if (_pid == 5 && particle->GetPt() > Cut_v1_Particle_ptmax_pi)
+//     return false;
+//   if (_pid == 6 && particle->GetPt() < Cut_v1_Particle_ptmin_ka)
+//     return false;
+//   if (_pid == 6 && particle->GetPt() > Cut_v1_Particle_ptmax_ka)
+//     return false;
+//   if (_pid == 7 && particle->GetPt() < Cut_v1_Particle_ptmin_pr)
+//     return false;
+//   if (_pid == 7 && particle->GetPt() > Cut_v1_Particle_ptmax_pr)
+//     return false;
+
+//   Double_t charge = GetCharge(particle->GetPdg());
+//   if (charge == error_code)
+//     return false;
+//   if (charge == 0)
+//     return false;
+
+//   if (_pid == 0 && charge < 0)
+//     return false;
+//   if (_pid == 4 && charge > 0)
+//     return false;
+
+//   return true;
+// }
+
+Bool_t qaUtility::Cut_Particle_v1_PID_pt(qaParticleLight const &particle, Int_t _pid)
 {
-  if (particle->GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
+  if (_pid == -1) 
+    return false;
+  if (particle.GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
     return false;
   
   // PID related kinematics cut
-  Double_t y = 0.5 * TMath::Log( (particle->GetEnergy() + particle->GetPz())/(particle->GetEnergy() - particle->GetPz()) );
+  Double_t y = 0.5 * TMath::Log( (particle.GetEnergy() + particle.GetPz())/(particle.GetEnergy() - particle.GetPz()) );
   if (_pid == 1 && y < Cut_v1_Particle_ymin_pi)
     return false;
   if (_pid == 1 && y > Cut_v1_Particle_ymax_pi)
@@ -339,7 +432,7 @@ Bool_t qaUtility::Cut_Particle_v1_PID_pt(qaParticle *const &particle, Int_t _pid
   if (_pid == 7 && y > Cut_v1_Particle_ymax_pr)
     return false;
 
-  Double_t charge = GetCharge(particle->GetPdg());
+  Double_t charge = GetCharge(particle.GetPdg());
   if (charge == error_code)
     return false;
   if (charge == 0)
@@ -353,38 +446,40 @@ Bool_t qaUtility::Cut_Particle_v1_PID_pt(qaParticle *const &particle, Int_t _pid
   return true;
 }
 
-Bool_t qaUtility::Cut_Particle_v1_PID_y(qaParticle *const &particle, Int_t _pid)
+Bool_t qaUtility::Cut_Particle_v1_PID_y(qaParticleLight const &particle, Int_t _pid)
 {
-  if (particle->GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
+  if (_pid == -1) 
+    return false;
+  if (particle.GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
     return false;
   
   // PID related kinematics cut
-  if (_pid == 1 && particle->GetPt() < Cut_v1_Particle_ptmin_pi)
+  if (_pid == 1 && particle.GetPt() < Cut_v1_Particle_ptmin_pi)
     return false;
-  if (_pid == 1 && particle->GetPt() > Cut_v1_Particle_ptmax_pi)
+  if (_pid == 1 && particle.GetPt() > Cut_v1_Particle_ptmax_pi)
     return false;
-  if (_pid == 2 && particle->GetPt() < Cut_v1_Particle_ptmin_ka)
+  if (_pid == 2 && particle.GetPt() < Cut_v1_Particle_ptmin_ka)
     return false;
-  if (_pid == 2 && particle->GetPt() > Cut_v1_Particle_ptmax_ka)
+  if (_pid == 2 && particle.GetPt() > Cut_v1_Particle_ptmax_ka)
     return false;
-  if (_pid == 3 && particle->GetPt() < Cut_v1_Particle_ptmin_pr)
+  if (_pid == 3 && particle.GetPt() < Cut_v1_Particle_ptmin_pr)
     return false;
-  if (_pid == 3 && particle->GetPt() > Cut_v1_Particle_ptmax_pr)
+  if (_pid == 3 && particle.GetPt() > Cut_v1_Particle_ptmax_pr)
     return false;
-  if (_pid == 5 && particle->GetPt() < Cut_v1_Particle_ptmin_pi)
+  if (_pid == 5 && particle.GetPt() < Cut_v1_Particle_ptmin_pi)
     return false;
-  if (_pid == 5 && particle->GetPt() > Cut_v1_Particle_ptmax_pi)
+  if (_pid == 5 && particle.GetPt() > Cut_v1_Particle_ptmax_pi)
     return false;
-  if (_pid == 6 && particle->GetPt() < Cut_v1_Particle_ptmin_ka)
+  if (_pid == 6 && particle.GetPt() < Cut_v1_Particle_ptmin_ka)
     return false;
-  if (_pid == 6 && particle->GetPt() > Cut_v1_Particle_ptmax_ka)
+  if (_pid == 6 && particle.GetPt() > Cut_v1_Particle_ptmax_ka)
     return false;
-  if (_pid == 7 && particle->GetPt() < Cut_v1_Particle_ptmin_pr)
+  if (_pid == 7 && particle.GetPt() < Cut_v1_Particle_ptmin_pr)
     return false;
-  if (_pid == 7 && particle->GetPt() > Cut_v1_Particle_ptmax_pr)
+  if (_pid == 7 && particle.GetPt() > Cut_v1_Particle_ptmax_pr)
     return false;
 
-  Double_t charge = GetCharge(particle->GetPdg());
+  Double_t charge = GetCharge(particle.GetPdg());
   if (charge == error_code)
     return false;
   if (charge == 0)
@@ -418,13 +513,106 @@ Bool_t qaUtility::Cut_Particle_v2_acceptance(qaParticle *const &particle)
   return true;
 }
 
-Bool_t qaUtility::Cut_Particle_v2_PID_pt(qaParticle *const &particle, Int_t _pid)
+// Bool_t qaUtility::Cut_Particle_v2_PID_pt(qaParticle *const &particle, Int_t _pid)
+// {
+//   if (particle->GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
+//     return false;
+  
+//   // PID related kinematics cut
+//   Double_t y = 0.5 * TMath::Log( (particle->GetEnergy() + particle->GetPz())/(particle->GetEnergy() - particle->GetPz()) );
+//   if (_pid == 1 && y < Cut_v2_Particle_ymin_pi)
+//     return false;
+//   if (_pid == 1 && y > Cut_v2_Particle_ymax_pi)
+//     return false;
+//   if (_pid == 2 && y < Cut_v2_Particle_ymin_ka)
+//     return false;
+//   if (_pid == 2 && y > Cut_v2_Particle_ymax_ka)
+//     return false;
+//   if (_pid == 3 && y < Cut_v2_Particle_ymin_pr)
+//     return false;
+//   if (_pid == 3 && y > Cut_v2_Particle_ymax_pr)
+//     return false;
+//   if (_pid == 5 && y < Cut_v2_Particle_ymin_pi)
+//     return false;
+//   if (_pid == 5 && y > Cut_v2_Particle_ymax_pi)
+//     return false;
+//   if (_pid == 6 && y < Cut_v2_Particle_ymin_ka)
+//     return false;
+//   if (_pid == 6 && y > Cut_v2_Particle_ymax_ka)
+//     return false;
+//   if (_pid == 7 && y < Cut_v2_Particle_ymin_pr)
+//     return false;
+//   if (_pid == 7 && y > Cut_v2_Particle_ymax_pr)
+//     return false;
+
+//   Double_t charge = GetCharge(particle->GetPdg());
+//   if (charge == error_code)
+//     return false;
+//   if (charge == 0)
+//     return false;
+
+//   if (_pid == 0 && charge < 0)
+//     return false;
+//   if (_pid == 4 && charge > 0)
+//     return false;
+
+//   return true;
+// }
+
+// Bool_t qaUtility::Cut_Particle_v2_PID_y(qaParticle *const &particle, Int_t _pid)
+// {
+//   if (particle->GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
+//     return false;
+  
+//   // PID related kinematics cut
+//   if (_pid == 1 && particle->GetPt() < Cut_v2_Particle_ptmin_pi)
+//     return false;
+//   if (_pid == 1 && particle->GetPt() > Cut_v2_Particle_ptmax_pi)
+//     return false;
+//   if (_pid == 2 && particle->GetPt() < Cut_v2_Particle_ptmin_ka)
+//     return false;
+//   if (_pid == 2 && particle->GetPt() > Cut_v2_Particle_ptmax_ka)
+//     return false;
+//   if (_pid == 3 && particle->GetPt() < Cut_v2_Particle_ptmin_pr)
+//     return false;
+//   if (_pid == 3 && particle->GetPt() > Cut_v2_Particle_ptmax_pr)
+//     return false;
+//   if (_pid == 5 && particle->GetPt() < Cut_v2_Particle_ptmin_pi)
+//     return false;
+//   if (_pid == 5 && particle->GetPt() > Cut_v2_Particle_ptmax_pi)
+//     return false;
+//   if (_pid == 6 && particle->GetPt() < Cut_v2_Particle_ptmin_ka)
+//     return false;
+//   if (_pid == 6 && particle->GetPt() > Cut_v2_Particle_ptmax_ka)
+//     return false;
+//   if (_pid == 7 && particle->GetPt() < Cut_v2_Particle_ptmin_pr)
+//     return false;
+//   if (_pid == 7 && particle->GetPt() > Cut_v2_Particle_ptmax_pr)
+//     return false;
+
+//   Double_t charge = GetCharge(particle->GetPdg());
+//   if (charge == error_code)
+//     return false;
+//   if (charge == 0)
+//     return false;
+
+//   if (_pid == 0 && charge < 0)
+//     return false;
+//   if (_pid == 4 && charge > 0)
+//     return false;
+
+//   return true;
+// }
+
+Bool_t qaUtility::Cut_Particle_v2_PID_pt(qaParticleLight const &particle, Int_t _pid)
 {
-  if (particle->GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
+  if (_pid == -1) 
+    return false;
+  if (particle.GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
     return false;
   
   // PID related kinematics cut
-  Double_t y = 0.5 * TMath::Log( (particle->GetEnergy() + particle->GetPz())/(particle->GetEnergy() - particle->GetPz()) );
+  Double_t y = 0.5 * TMath::Log( (particle.GetEnergy() + particle.GetPz())/(particle.GetEnergy() - particle.GetPz()) );
   if (_pid == 1 && y < Cut_v2_Particle_ymin_pi)
     return false;
   if (_pid == 1 && y > Cut_v2_Particle_ymax_pi)
@@ -450,7 +638,7 @@ Bool_t qaUtility::Cut_Particle_v2_PID_pt(qaParticle *const &particle, Int_t _pid
   if (_pid == 7 && y > Cut_v2_Particle_ymax_pr)
     return false;
 
-  Double_t charge = GetCharge(particle->GetPdg());
+  Double_t charge = GetCharge(particle.GetPdg());
   if (charge == error_code)
     return false;
   if (charge == 0)
@@ -464,38 +652,40 @@ Bool_t qaUtility::Cut_Particle_v2_PID_pt(qaParticle *const &particle, Int_t _pid
   return true;
 }
 
-Bool_t qaUtility::Cut_Particle_v2_PID_y(qaParticle *const &particle, Int_t _pid)
+Bool_t qaUtility::Cut_Particle_v2_PID_y(qaParticleLight const &particle, Int_t _pid)
 {
-  if (particle->GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
+  if (_pid == -1) 
+    return false;
+  if (particle.GetPdg() != vpdg.at(_pid) && _pid != 0 && _pid != 4)
     return false;
   
   // PID related kinematics cut
-  if (_pid == 1 && particle->GetPt() < Cut_v2_Particle_ptmin_pi)
+  if (_pid == 1 && particle.GetPt() < Cut_v2_Particle_ptmin_pi)
     return false;
-  if (_pid == 1 && particle->GetPt() > Cut_v2_Particle_ptmax_pi)
+  if (_pid == 1 && particle.GetPt() > Cut_v2_Particle_ptmax_pi)
     return false;
-  if (_pid == 2 && particle->GetPt() < Cut_v2_Particle_ptmin_ka)
+  if (_pid == 2 && particle.GetPt() < Cut_v2_Particle_ptmin_ka)
     return false;
-  if (_pid == 2 && particle->GetPt() > Cut_v2_Particle_ptmax_ka)
+  if (_pid == 2 && particle.GetPt() > Cut_v2_Particle_ptmax_ka)
     return false;
-  if (_pid == 3 && particle->GetPt() < Cut_v2_Particle_ptmin_pr)
+  if (_pid == 3 && particle.GetPt() < Cut_v2_Particle_ptmin_pr)
     return false;
-  if (_pid == 3 && particle->GetPt() > Cut_v2_Particle_ptmax_pr)
+  if (_pid == 3 && particle.GetPt() > Cut_v2_Particle_ptmax_pr)
     return false;
-  if (_pid == 5 && particle->GetPt() < Cut_v2_Particle_ptmin_pi)
+  if (_pid == 5 && particle.GetPt() < Cut_v2_Particle_ptmin_pi)
     return false;
-  if (_pid == 5 && particle->GetPt() > Cut_v2_Particle_ptmax_pi)
+  if (_pid == 5 && particle.GetPt() > Cut_v2_Particle_ptmax_pi)
     return false;
-  if (_pid == 6 && particle->GetPt() < Cut_v2_Particle_ptmin_ka)
+  if (_pid == 6 && particle.GetPt() < Cut_v2_Particle_ptmin_ka)
     return false;
-  if (_pid == 6 && particle->GetPt() > Cut_v2_Particle_ptmax_ka)
+  if (_pid == 6 && particle.GetPt() > Cut_v2_Particle_ptmax_ka)
     return false;
-  if (_pid == 7 && particle->GetPt() < Cut_v2_Particle_ptmin_pr)
+  if (_pid == 7 && particle.GetPt() < Cut_v2_Particle_ptmin_pr)
     return false;
-  if (_pid == 7 && particle->GetPt() > Cut_v2_Particle_ptmax_pr)
+  if (_pid == 7 && particle.GetPt() > Cut_v2_Particle_ptmax_pr)
     return false;
 
-  Double_t charge = GetCharge(particle->GetPdg());
+  Double_t charge = GetCharge(particle.GetPdg());
   if (charge == error_code)
     return false;
   if (charge == 0)

+ 9 - 4
utility/Utility.h

@@ -17,6 +17,7 @@
 
 #include <qaEvent.h>
 #include <qaParticle.h>
+#include <qaParticleLight.h>
 
 class qaUtility
 {
@@ -122,10 +123,14 @@ public:
   Bool_t Cut_Particle_refmult(qaParticle *const &particle);
   Bool_t Cut_Particle_v1_acceptance(qaParticle *const &particle);
   Bool_t Cut_Particle_v2_acceptance(qaParticle *const &particle);
-  Bool_t Cut_Particle_v1_PID_pt(qaParticle *const &particle, Int_t _pid);
-  Bool_t Cut_Particle_v1_PID_y(qaParticle *const &particle, Int_t _pid);
-  Bool_t Cut_Particle_v2_PID_pt(qaParticle *const &particle, Int_t _pid);
-  Bool_t Cut_Particle_v2_PID_y(qaParticle *const &particle, Int_t _pid);
+  // Bool_t Cut_Particle_v1_PID_pt(qaParticle *const &particle, Int_t _pid);
+  // Bool_t Cut_Particle_v1_PID_y(qaParticle *const &particle, Int_t _pid);
+  // Bool_t Cut_Particle_v2_PID_pt(qaParticle *const &particle, Int_t _pid);
+  // Bool_t Cut_Particle_v2_PID_y(qaParticle *const &particle, Int_t _pid);
+  Bool_t Cut_Particle_v1_PID_pt(qaParticleLight const &particle, Int_t _pid);
+  Bool_t Cut_Particle_v1_PID_y(qaParticleLight const &particle, Int_t _pid);
+  Bool_t Cut_Particle_v2_PID_pt(qaParticleLight const &particle, Int_t _pid);
+  Bool_t Cut_Particle_v2_PID_y(qaParticleLight const &particle, Int_t _pid);
 
   Double_t GetCharge(Int_t pdg);
   Int_t GetPdgId(Int_t pdg);