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