rivet is hosted by Hepforge, IPPP Durham
ALICE_2011_S8945144.cc
Go to the documentation of this file.
00001 #include "Rivet/Rivet.hh"
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/ChargedFinalState.hh"
00004 
00005 namespace Rivet {
00006 
00007 
00008   class ALICE_2011_S8945144 : public Analysis {
00009   public:
00010 
00011     ALICE_2011_S8945144()
00012       : Analysis("ALICE_2011_S8945144")
00013     {}
00014 
00015 
00016   public:
00017 
00018     void init() {
00019       const ChargedFinalState cfs(-15, 15);
00020       addProjection(cfs, "CFS");
00021 
00022       _histPtPions        = bookHisto1D("d01-x01-y01");
00023       _histPtAntiPions    = bookHisto1D("d01-x01-y02");
00024       _histPtKaons        = bookHisto1D("d02-x01-y01");
00025       _histPtAntiKaons    = bookHisto1D("d02-x01-y02");
00026       _histPtProtons      = bookHisto1D("d03-x01-y01");
00027       _histPtAntiProtons  = bookHisto1D("d03-x01-y02");
00028       _histAveragePt      = bookProfile1D("d04-x01-y01");
00029     }
00030 
00031 
00032     void analyze(const Event& event) {
00033       const double weight = event.weight();
00034       const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(event, "CFS");
00035       foreach (const Particle& p, cfs.particles()) {
00036         if(fabs(p.rapidity())<0.5) {
00037           switch (p.pdgId()) {
00038             case 211:
00039               _histPtPions->fill(p.pT()/GeV, weight);
00040               _histAveragePt->fill(p.mass()/GeV, p.pT()/GeV, weight);
00041               break;
00042             case -211:
00043               _histPtAntiPions->fill(p.pT()/GeV, weight);
00044               _histAveragePt->fill(p.mass()/GeV, p.pT()/GeV, weight);
00045               break;
00046             case 2212:
00047               if ( !(p.hasAncestor(3322) ||                             // Xi0
00048                      p.hasAncestor(3122) || p.hasAncestor(-3122) ||     // Lambda
00049                      p.hasAncestor(3222) || p.hasAncestor(-3222) ||     // Sigma+/-
00050                      p.hasAncestor(3312) || p.hasAncestor(-3312) ) ) {  // Xi-/+
00051                 _histPtProtons->fill(p.pT()/GeV, weight);
00052                 _histAveragePt->fill(p.mass()/GeV, p.pT()/GeV, weight);
00053               }
00054               break;
00055             case -2212:
00056               if ( !(p.hasAncestor(3322) ||                             // Xi0
00057                      p.hasAncestor(3122) || p.hasAncestor(-3122) ||     // Lambda
00058                      p.hasAncestor(3222) || p.hasAncestor(-3222) ||     // Sigma+/-
00059                      p.hasAncestor(3312) || p.hasAncestor(-3312) ) ) {  // Xi-/+
00060                 _histPtAntiProtons->fill(p.pT()/GeV, weight);
00061                 _histAveragePt->fill(p.mass()/GeV, p.pT()/GeV, weight);
00062               }
00063               break;
00064             case 321:
00065               _histPtKaons->fill(p.pT()/GeV, weight);
00066               _histAveragePt->fill(p.mass()/GeV, p.pT()/GeV, weight);
00067               break;
00068             case -321:
00069               _histPtAntiKaons->fill(p.pT()/GeV, weight);
00070               _histAveragePt->fill(p.mass()/GeV, p.pT()/GeV, weight);
00071               break;
00072           }
00073         }
00074       }
00075     }
00076 
00077 
00078     void finalize() {
00079       scale(_histPtPions,       1./sumOfWeights());
00080       scale(_histPtProtons,     1./sumOfWeights());
00081       scale(_histPtKaons,       1./sumOfWeights());
00082       scale(_histPtAntiPions,   1./sumOfWeights());
00083       scale(_histPtAntiProtons, 1./sumOfWeights());
00084       scale(_histPtAntiKaons,   1./sumOfWeights());
00085     }
00086 
00087 
00088   private:
00089 
00090     Histo1DPtr _histPtPions;
00091     Histo1DPtr _histPtProtons;
00092     Histo1DPtr _histPtKaons;
00093     Histo1DPtr _histPtAntiPions;
00094     Histo1DPtr _histPtAntiProtons;
00095     Histo1DPtr _histPtAntiKaons;
00096     Profile1DPtr _histAveragePt;
00097 
00098   };
00099 
00100 
00101 
00102   // The hook for the plugin system
00103   DECLARE_RIVET_PLUGIN(ALICE_2011_S8945144);
00104 
00105 }