rivet is hosted by Hepforge, IPPP Durham
OPAL_2004_S6132243.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/Beam.hh"
00004 #include "Rivet/Projections/FinalState.hh"
00005 #include "Rivet/Projections/ChargedFinalState.hh"
00006 #include "Rivet/Projections/Sphericity.hh"
00007 #include "Rivet/Projections/Thrust.hh"
00008 #include "Rivet/Projections/FastJets.hh"
00009 #include "Rivet/Projections/ParisiTensor.hh"
00010 #include "Rivet/Projections/Hemispheres.hh"
00011 #include <cmath>
00012 
00013 namespace Rivet {
00014 
00015 
00016   /// @brief OPAL event shapes and moments at 91, 133, 177, and 197 GeV
00017   /// @author Andy Buckley
00018   class OPAL_2004_S6132243 : public Analysis {
00019   public:
00020 
00021     /// Constructor
00022     OPAL_2004_S6132243()
00023       : Analysis("OPAL_2004_S6132243"),
00024         _isqrts(-1), _sumWTrack2(0.0), _sumWJet3(0.0)
00025     {
00026       //
00027     }
00028 
00029 
00030     /// @name Analysis methods
00031     //@{
00032 
00033     /// Energies: 91, 133, 177 (161-183), 197 (189-209) => index 0..4
00034     int getHistIndex(double sqrts) {
00035       int ih = -1;
00036       if (inRange(sqrts/GeV, 89.9, 91.5)) {
00037         ih = 0;
00038       } else if (fuzzyEquals(sqrts/GeV, 133)) {
00039         ih = 1;
00040       } else if (fuzzyEquals(sqrts/GeV, 177)) { // (161-183)
00041         ih = 2;
00042       } else if (fuzzyEquals(sqrts/GeV, 197)) { // (189-209)
00043         ih = 3;
00044       } else {
00045         stringstream ss;
00046         ss << "Invalid energy for OPAL_2004 analysis: "
00047            << sqrts/GeV << " GeV != 91, 133, 177, or 197 GeV";
00048         throw Error(ss.str());
00049       }
00050       assert(ih >= 0);
00051       return ih;
00052     }
00053 
00054 
00055     void init() {
00056       // Projections
00057       addProjection(Beam(), "Beams");
00058       const FinalState fs;
00059       addProjection(fs, "FS");
00060       const ChargedFinalState cfs;
00061       addProjection(cfs, "CFS");
00062       addProjection(FastJets(fs, FastJets::DURHAM, 0.7), "DurhamJets");
00063       addProjection(Sphericity(fs), "Sphericity");
00064       addProjection(ParisiTensor(fs), "Parisi");
00065       const Thrust thrust(fs);
00066       addProjection(thrust, "Thrust");
00067       addProjection(Hemispheres(thrust), "Hemispheres");
00068 
00069       // Get beam energy index
00070       _isqrts = getHistIndex(sqrtS());
00071 
00072       // Book histograms
00073       _hist1MinusT[_isqrts]    = bookHisto1D(1, 1, _isqrts+1);
00074       _histHemiMassH[_isqrts]  = bookHisto1D(2, 1, _isqrts+1);
00075       _histCParam[_isqrts]     = bookHisto1D(3, 1, _isqrts+1);
00076       _histHemiBroadT[_isqrts] = bookHisto1D(4, 1, _isqrts+1);
00077       _histHemiBroadW[_isqrts] = bookHisto1D(5, 1, _isqrts+1);
00078       _histY23Durham[_isqrts]  = bookHisto1D(6, 1, _isqrts+1);
00079       _histTMajor[_isqrts]     = bookHisto1D(7, 1, _isqrts+1);
00080       _histTMinor[_isqrts]     = bookHisto1D(8, 1, _isqrts+1);
00081       _histAplanarity[_isqrts] = bookHisto1D(9, 1, _isqrts+1);
00082       _histSphericity[_isqrts] = bookHisto1D(10, 1, _isqrts+1);
00083       _histOblateness[_isqrts] = bookHisto1D(11, 1, _isqrts+1);
00084       _histHemiMassL[_isqrts]  = bookHisto1D(12, 1, _isqrts+1);
00085       _histHemiBroadN[_isqrts] = bookHisto1D(13, 1, _isqrts+1);
00086       _histDParam[_isqrts]     = bookHisto1D(14, 1, _isqrts+1);
00087       //
00088       _hist1MinusTMom[_isqrts]    = bookHisto1D(15, 1, _isqrts+1);
00089       _histHemiMassHMom[_isqrts]  = bookHisto1D(16, 1, _isqrts+1);
00090       _histCParamMom[_isqrts]     = bookHisto1D(17, 1, _isqrts+1);
00091       _histHemiBroadTMom[_isqrts] = bookHisto1D(18, 1, _isqrts+1);
00092       _histHemiBroadWMom[_isqrts] = bookHisto1D(19, 1, _isqrts+1);
00093       _histY23DurhamMom[_isqrts]  = bookHisto1D(20, 1, _isqrts+1);
00094       _histTMajorMom[_isqrts]     = bookHisto1D(21, 1, _isqrts+1);
00095       _histTMinorMom[_isqrts]     = bookHisto1D(22, 1, _isqrts+1);
00096       _histSphericityMom[_isqrts] = bookHisto1D(23, 1, _isqrts+1);
00097       _histOblatenessMom[_isqrts] = bookHisto1D(24, 1, _isqrts+1);
00098       _histHemiMassLMom[_isqrts]  = bookHisto1D(25, 1, _isqrts+1);
00099       _histHemiBroadNMom[_isqrts] = bookHisto1D(26, 1, _isqrts+1);
00100     }
00101 
00102 
00103     void analyze(const Event& event) {
00104       // Even if we only generate hadronic events, we still need a cut on numCharged >= 2.
00105       const FinalState& cfs = applyProjection<FinalState>(event, "CFS");
00106       if (cfs.size() < 2) vetoEvent;
00107 
00108       // Increment passed-cuts weight sum
00109       const double weight = event.weight();
00110       _sumWTrack2 += weight;
00111 
00112       // Thrusts
00113       const Thrust& thrust = applyProjection<Thrust>(event, "Thrust");
00114       _hist1MinusT[_isqrts]->fill(1-thrust.thrust(), weight);
00115       _histTMajor[_isqrts]->fill(thrust.thrustMajor(), weight);
00116       _histTMinor[_isqrts]->fill(thrust.thrustMinor(), weight);
00117       _histOblateness[_isqrts]->fill(thrust.oblateness(), weight);
00118       for (int n = 1; n <= 5; ++n) {
00119         _hist1MinusTMom[_isqrts]->fill(n, pow(1-thrust.thrust(), n)*weight);
00120         _histTMajorMom[_isqrts]->fill(n, pow(thrust.thrustMajor(), n)*weight);
00121         _histTMinorMom[_isqrts]->fill(n, pow(thrust.thrustMinor(), n)*weight);
00122         _histOblatenessMom[_isqrts]->fill(n, pow(thrust.oblateness(), n)*weight);
00123       }
00124 
00125       // Jets
00126       const FastJets& durjet = applyProjection<FastJets>(event, "DurhamJets");
00127       if (durjet.clusterSeq()) {
00128         _sumWJet3 += weight;
00129         const double y23 = durjet.clusterSeq()->exclusive_ymerge_max(2);
00130         _histY23Durham[_isqrts]->fill(y23, weight);
00131         for (int n = 1; n <= 5; ++n) {
00132           _histY23DurhamMom[_isqrts]->fill(n, pow(y23, n)*weight);
00133         }
00134       }
00135 
00136       // Sphericities
00137       const Sphericity& sphericity = applyProjection<Sphericity>(event, "Sphericity");
00138       const double sph = sphericity.sphericity();
00139       const double apl = sphericity.aplanarity();
00140       _histSphericity[_isqrts]->fill(sph, weight);
00141       _histAplanarity[_isqrts]->fill(apl, weight);
00142       for (int n = 1; n <= 5; ++n) {
00143         _histSphericityMom[_isqrts]->fill(n, pow(sph, n)*weight);
00144       }
00145 
00146       // C & D params
00147       const ParisiTensor& parisi = applyProjection<ParisiTensor>(event, "Parisi");
00148       const double cparam = parisi.C();
00149       const double dparam = parisi.D();
00150       _histCParam[_isqrts]->fill(cparam, weight);
00151       _histDParam[_isqrts]->fill(dparam, weight);
00152       for (int n = 1; n <= 5; ++n) {
00153         _histCParamMom[_isqrts]->fill(n, pow(cparam, n)*weight);
00154       }
00155 
00156       // Hemispheres
00157       const Hemispheres& hemi = applyProjection<Hemispheres>(event, "Hemispheres");
00158       // The paper says that M_H/L are scaled by sqrt(s), but scaling by E_vis is the way that fits the data...
00159       const double hemi_mh = hemi.scaledMhigh();
00160       const double hemi_ml = hemi.scaledMlow();
00161       /// @todo This shouldn't be necessary... what's going on? Memory corruption suspected :(
00162       // if (std::isnan(hemi_ml)) {
00163       //   MSG_ERROR("NaN in HemiL! Event = " << numEvents());
00164       //   MSG_ERROR(hemi.M2low() << ", " << hemi.E2vis());
00165       // }
00166       if (!std::isnan(hemi_mh) && !std::isnan(hemi_ml)) {
00167         const double hemi_bmax = hemi.Bmax();
00168         const double hemi_bmin = hemi.Bmin();
00169         const double hemi_bsum = hemi.Bsum();
00170         _histHemiMassH[_isqrts]->fill(hemi_mh, weight);
00171         _histHemiMassL[_isqrts]->fill(hemi_ml, weight);
00172         _histHemiBroadW[_isqrts]->fill(hemi_bmax, weight);
00173         _histHemiBroadN[_isqrts]->fill(hemi_bmin, weight);
00174         _histHemiBroadT[_isqrts]->fill(hemi_bsum, weight);
00175         for (int n = 1; n <= 5; ++n) {
00176           // if (std::isnan(pow(hemi_ml, n))) MSG_ERROR("NaN in HemiL moment! Event = " << numEvents());
00177           _histHemiMassHMom[_isqrts]->fill(n, pow(hemi_mh, n)*weight);
00178           _histHemiMassLMom[_isqrts]->fill(n, pow(hemi_ml, n)*weight);
00179           _histHemiBroadWMom[_isqrts]->fill(n, pow(hemi_bmax, n)*weight);
00180           _histHemiBroadNMom[_isqrts]->fill(n, pow(hemi_bmin, n)*weight);
00181           _histHemiBroadTMom[_isqrts]->fill(n, pow(hemi_bsum, n)*weight);
00182         }
00183       }
00184     }
00185 
00186 
00187     void finalize() {
00188       scale(_hist1MinusT[_isqrts], 1.0/_sumWTrack2);
00189       scale(_histTMajor[_isqrts], 1.0/_sumWTrack2);
00190       scale(_histTMinor[_isqrts], 1.0/_sumWTrack2);
00191       scale(_histOblateness[_isqrts], 1.0/_sumWTrack2);
00192       scale(_histSphericity[_isqrts], 1.0/_sumWTrack2);
00193       scale(_histAplanarity[_isqrts], 1.0/_sumWTrack2);
00194       scale(_histHemiMassH[_isqrts], 1.0/_sumWTrack2);
00195       scale(_histHemiMassL[_isqrts], 1.0/_sumWTrack2);
00196       scale(_histHemiBroadW[_isqrts], 1.0/_sumWTrack2);
00197       scale(_histHemiBroadN[_isqrts], 1.0/_sumWTrack2);
00198       scale(_histHemiBroadT[_isqrts], 1.0/_sumWTrack2);
00199       scale(_histCParam[_isqrts], 1.0/_sumWTrack2);
00200       scale(_histDParam[_isqrts], 1.0/_sumWTrack2);
00201       scale(_histY23Durham[_isqrts], 1.0/_sumWJet3);
00202       //
00203       scale(_hist1MinusTMom[_isqrts], 1.0/_sumWTrack2);
00204       scale(_histTMajorMom[_isqrts], 1.0/_sumWTrack2);
00205       scale(_histTMinorMom[_isqrts], 1.0/_sumWTrack2);
00206       scale(_histOblatenessMom[_isqrts], 1.0/_sumWTrack2);
00207       scale(_histSphericityMom[_isqrts], 1.0/_sumWTrack2);
00208       scale(_histHemiMassHMom[_isqrts], 1.0/_sumWTrack2);
00209       scale(_histHemiMassLMom[_isqrts], 1.0/_sumWTrack2);
00210       scale(_histHemiBroadWMom[_isqrts], 1.0/_sumWTrack2);
00211       scale(_histHemiBroadNMom[_isqrts], 1.0/_sumWTrack2);
00212       scale(_histHemiBroadTMom[_isqrts], 1.0/_sumWTrack2);
00213       scale(_histCParamMom[_isqrts], 1.0/_sumWTrack2);
00214       scale(_histY23DurhamMom[_isqrts], 1.0/_sumWJet3);
00215     }
00216 
00217     //@}
00218 
00219 
00220   private:
00221 
00222     /// Beam energy index for histograms
00223     int _isqrts;
00224 
00225     /// @name Counters of event weights passing the cuts
00226     //@{
00227     double _sumWTrack2, _sumWJet3;
00228     //@}
00229 
00230     /// @name Event shape histos at 4 energies
00231     //@{
00232     Histo1DPtr _hist1MinusT[4];
00233     Histo1DPtr _histHemiMassH[4];
00234     Histo1DPtr _histCParam[4];
00235     Histo1DPtr _histHemiBroadT[4];
00236     Histo1DPtr _histHemiBroadW[4];
00237     Histo1DPtr _histY23Durham[4];
00238     Histo1DPtr _histTMajor[4];
00239     Histo1DPtr _histTMinor[4];
00240     Histo1DPtr _histAplanarity[4];
00241     Histo1DPtr _histSphericity[4];
00242     Histo1DPtr _histOblateness[4];
00243     Histo1DPtr _histHemiMassL[4];
00244     Histo1DPtr _histHemiBroadN[4];
00245     Histo1DPtr _histDParam[4];
00246     //@}
00247 
00248     /// @name Event shape moment histos at 4 energies
00249     //@{
00250     Histo1DPtr _hist1MinusTMom[4];
00251     Histo1DPtr _histHemiMassHMom[4];
00252     Histo1DPtr _histCParamMom[4];
00253     Histo1DPtr _histHemiBroadTMom[4];
00254     Histo1DPtr _histHemiBroadWMom[4];
00255     Histo1DPtr _histY23DurhamMom[4];
00256     Histo1DPtr _histTMajorMom[4];
00257     Histo1DPtr _histTMinorMom[4];
00258     Histo1DPtr _histSphericityMom[4];
00259     Histo1DPtr _histOblatenessMom[4];
00260     Histo1DPtr _histHemiMassLMom[4];
00261     Histo1DPtr _histHemiBroadNMom[4];
00262     //@}
00263 
00264   };
00265 
00266 
00267 
00268   // The hook for the plugin system
00269   DECLARE_RIVET_PLUGIN(OPAL_2004_S6132243);
00270 
00271 }