rivet is hosted by Hepforge, IPPP Durham
OPAL_2001_S4553896.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetYODA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Projections/FastJets.hh"
00006 #include "Rivet/Projections/FinalState.hh"
00007 
00008 namespace Rivet {
00009 
00010 
00011   namespace {
00012 
00013     /// @name Jet angle calculator functions
00014     //@{
00015     /// @todo Move to utils? (taken from DELPHI_2003)
00016 
00017     /// @todo Use Jet or FourMomentum interface rather than PseudoJet
00018     /// @todo Move to utils?
00019     double calc_BZ(const vector<fastjet::PseudoJet>& jets) {
00020       assert(jets.size() == 4);
00021       Vector3 p12 = cross( momentum3(jets[0]), momentum3(jets[1]));
00022       Vector3 p34 = cross( momentum3(jets[2]), momentum3(jets[3]));
00023       return dot(p12,p34) / (p12.mod()*p34.mod());
00024     }
00025 
00026 
00027     /// @todo Use Jet or FourMomentum interface rather than PseudoJet
00028     /// @todo Move to utils?
00029     double calc_KSW(const vector<fastjet::PseudoJet>& jets) {
00030       assert(jets.size() == 4);
00031       Vector3 p13 = cross( momentum3(jets[0]), momentum3(jets[2]));
00032       Vector3 p24 = cross( momentum3(jets[1]), momentum3(jets[3]));
00033       Vector3 p14 = cross( momentum3(jets[0]), momentum3(jets[3]));
00034       Vector3 p23 = cross( momentum3(jets[1]), momentum3(jets[2]));
00035       return cos (0.5*( acos (dot(p14,p23) / (p14.mod()*p23.mod())) +
00036                         acos (dot(p13,p24) / (p13.mod()*p24.mod())) ));
00037     }
00038 
00039 
00040     /// @todo Use Jet or FourMomentum interface rather than PseudoJet
00041     /// @todo Move to utils?
00042     double calc_NR(const vector<fastjet::PseudoJet>& jets) {
00043       assert(jets.size() == 4);
00044       Vector3 p12 = momentum3(jets[0]) - momentum3(jets[1]);
00045       Vector3 p34 = momentum3(jets[2]) - momentum3(jets[3]);
00046       return dot(p12,p34) / (p12.mod()*p34.mod());
00047     }
00048 
00049     /// @todo Use Jet or FourMomentum interface rather than PseudoJet
00050     /// @todo Move to utils?
00051     double calc_ALPHA34(const vector<fastjet::PseudoJet>& jets) {
00052       assert(jets.size() == 4);
00053       Vector3 p3 = momentum3(jets[2]);
00054       Vector3 p4 = momentum3(jets[3]);
00055       return dot(p3,p4) / (p3.mod()*p4.mod());
00056     }
00057 
00058     //@}
00059 
00060   }
00061 
00062 
00063   class OPAL_2001_S4553896 : public Analysis {
00064   public:
00065 
00066     /// @name Constructors etc.
00067     //@{
00068 
00069     /// Constructor
00070     OPAL_2001_S4553896()
00071       : Analysis("OPAL_2001_S4553896")
00072     {    }
00073 
00074     //@}
00075 
00076 
00077   public:
00078 
00079     /// @name Analysis methods
00080     //@{
00081 
00082     /// Book histograms and initialise projections before the run
00083     void init() {
00084 
00085       /// Initialise and register projections here
00086       const FinalState fs;
00087       addProjection(fs, "FS");
00088       addProjection(FastJets(fs, FastJets::DURHAM, 0.7), "Jets");
00089 
00090 
00091       /// @todo Book histograms here, e.g.:
00092       _h_BZ      = bookHisto1D(3, 1, 1);
00093       _h_KSW     = bookHisto1D(4, 1, 1);
00094       _h_NR      = bookHisto1D(5, 1, 1);
00095       _h_ALPHA34 = bookHisto1D(6, 1, 1);
00096     }
00097 
00098 
00099     /// Perform the per-event analysis
00100     void analyze(const Event& event) {
00101       const double weight = event.weight();
00102 
00103       // Even if we only generate hadronic events, we still need a cut on numCharged >= 2.
00104       if (applyProjection<FinalState>(event, "FS").particles().size() < 2) {
00105         vetoEvent;
00106       }
00107 
00108       const FastJets& fastjets = applyProjection<FastJets>(event, "Jets");
00109       if (fastjets.clusterSeq()) {
00110         vector<fastjet::PseudoJet> jets;
00111         foreach (const fastjet::PseudoJet& jet,
00112                  fastjet::sorted_by_E(fastjets.clusterSeq()->exclusive_jets_ycut(0.008))) {
00113           if (jet.E()>3.0*GeV) jets.push_back(jet);
00114         }
00115         if (jets.size() == 4) {
00116           _h_BZ->fill(fabs(calc_BZ(jets)), weight);
00117           _h_KSW->fill(calc_KSW(jets), weight);
00118           _h_NR->fill(fabs(calc_NR(jets)), weight);
00119           _h_ALPHA34->fill(calc_ALPHA34(jets), weight);
00120         }
00121       }
00122 
00123 
00124     }
00125 
00126 
00127     /// Normalise histograms etc., after the run
00128     void finalize() {
00129 
00130       /// Normalise, scale and otherwise manipulate histograms here
00131       normalize(_h_BZ);
00132       normalize(_h_KSW);
00133       normalize(_h_NR);
00134       normalize(_h_ALPHA34);
00135 
00136     }
00137 
00138     //@}
00139 
00140 
00141   private:
00142 
00143     /// @name Histograms
00144     //@{
00145 
00146     Histo1DPtr _h_BZ;
00147     Histo1DPtr _h_KSW;
00148     Histo1DPtr _h_NR;
00149     Histo1DPtr _h_ALPHA34;
00150     //@}
00151 
00152   };
00153 
00154 
00155 
00156   // The hook for the plugin system
00157   DECLARE_RIVET_PLUGIN(OPAL_2001_S4553896);
00158 
00159 }