OPAL_2004_S6132243.cc

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