00001
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Tools/Logging.hh"
00004 #include "Rivet/RivetAIDA.hh"
00005 #include "Rivet/Projections/FinalState.hh"
00006 #include "Rivet/Projections/ChargedFinalState.hh"
00007 #include "Rivet/Projections/FastJets.hh"
00008 #include "Rivet/Projections/Multiplicity.hh"
00009 #include "Rivet/Projections/Thrust.hh"
00010 #include "Rivet/Projections/Sphericity.hh"
00011
00012 namespace Rivet {
00013
00014
00015
00016 class ExampleAnalysis : public Analysis {
00017 public:
00018
00019
00020 ExampleAnalysis()
00021 : Analysis("EXAMPLE")
00022 {
00023
00024 }
00025
00026
00027
00028
00029
00030
00031 void init() {
00032
00033 const FinalState cnfs(-4, 4, 2*GeV);
00034 const ChargedFinalState cfs(-4, 4, 2*GeV);
00035 addProjection(cnfs, "FS");
00036 addProjection(cfs, "CFS");
00037 addProjection(FastJets(cnfs, FastJets::KT, 0.7), "Jets");
00038 addProjection(Multiplicity(cfs), "CMult");
00039 addProjection(Multiplicity(cnfs), "CNMult");
00040 addProjection(Thrust(cfs), "Thrust");
00041 addProjection(Sphericity(cfs), "Sphericity");
00042
00043
00044 _histTot = bookHistogram1D("TotalMult", 100, -0.5, 99.5);
00045 _histChTot = bookHistogram1D("TotalChMult", 50, -1.0, 99.0);
00046 _histHadrTot = bookHistogram1D("HadrTotalMult", 100, -0.5, 99.5);
00047 _histHadrChTot = bookHistogram1D("HadrTotalChMult", 50, -1.0, 99.0);
00048 _histMajor = bookHistogram1D("Major", 10, 0.0, 0.6);
00049 _histSphericity = bookHistogram1D("Sphericity", 10, 0.0, 0.8);
00050 _histAplanarity = bookHistogram1D("Aplanarity", 10, 0.0, 0.3);
00051
00052
00053 double edges[11] = { 0.5, 0.6, 0.7, 0.80, 0.85, 0.9, 0.92, 0.94, 0.96, 0.98, 1.0 };
00054 vector<double> vedges(edges, edges+11);
00055 _histThrust = bookHistogram1D("Thrust", vedges);
00056 }
00057
00058
00059
00060 void analyze(const Event& event) {
00061
00062 const Multiplicity& cm = applyProjection<Multiplicity>(event, "CMult");
00063 const Multiplicity& cnm = applyProjection<Multiplicity>(event, "CNMult");
00064 getLog() << Log::DEBUG << "Total multiplicity = " << cnm.totalMultiplicity() << endl;
00065 getLog() << Log::DEBUG << "Total charged multiplicity = " << cm.totalMultiplicity() << endl;
00066 getLog() << Log::DEBUG << "Hadron multiplicity = " << cnm.hadronMultiplicity() << endl;
00067 getLog() << Log::DEBUG << "Hadron charged multiplicity = " << cm.hadronMultiplicity() << endl;
00068
00069 const Thrust& t = applyProjection<Thrust>(event, "Thrust");
00070 getLog() << Log::DEBUG << "Thrust = " << t.thrust() << endl;
00071
00072 const Sphericity& s = applyProjection<Sphericity>(event, "Sphericity");
00073 getLog() << Log::DEBUG << "Sphericity = " << s.sphericity() << endl;
00074 getLog() << Log::DEBUG << "Aplanarity = " << s.aplanarity() << endl;
00075
00076 size_t num_b_jets = 0;
00077 const Jets jets = applyProjection<FastJets>(event, "Jets").jets();
00078 foreach (const Jet& j, jets) {
00079 if (j.containsBottom()) ++num_b_jets;
00080 }
00081 getLog() << Log::DEBUG << "#B-jets = " << num_b_jets << endl;
00082
00083
00084 const double weight = event.weight();
00085 _histTot->fill(cnm.totalMultiplicity(), weight);
00086 _histChTot->fill(cm.totalMultiplicity(), weight);
00087 _histHadrTot->fill(cnm.hadronMultiplicity(), weight);
00088 _histHadrChTot->fill(cm.hadronMultiplicity(), weight);
00089 _histThrust->fill(t.thrust(), weight);
00090 _histMajor->fill(t.thrustMajor(), weight);
00091 _histSphericity->fill(s.sphericity(), weight);
00092 _histAplanarity->fill(s.aplanarity(), weight);
00093 }
00094
00095
00096
00097 void finalize() {
00098 normalize(_histTot);
00099 normalize(_histChTot);
00100 normalize(_histHadrTot);
00101 normalize(_histHadrChTot);
00102 normalize(_histThrust);
00103 normalize(_histMajor);
00104 normalize(_histSphericity);
00105 normalize(_histAplanarity);
00106 }
00107
00108
00109
00110
00111 private:
00112
00113
00114
00115 AIDA::IHistogram1D* _histTot;
00116 AIDA::IHistogram1D* _histChTot;
00117 AIDA::IHistogram1D* _histHadrTot;
00118 AIDA::IHistogram1D* _histHadrChTot;
00119 AIDA::IHistogram1D* _histThrust;
00120 AIDA::IHistogram1D* _histMajor;
00121 AIDA::IHistogram1D* _histSphericity;
00122 AIDA::IHistogram1D* _histAplanarity;
00123
00124
00125 };
00126
00127
00128
00129
00130 AnalysisBuilder<ExampleAnalysis> plugin_ExampleAnalysis;
00131
00132 }