JADE_OPAL_2000_S4300807.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetAIDA.hh"
00004 #include "Rivet/Projections/FastJets.hh"
00005 #include "Rivet/Projections/FinalState.hh"
00006 
00007 namespace Rivet {
00008 
00009 
00010   /// @brief Jet rates in \f$ e^+ e^- \f$ at OPAL and JADE
00011   /// @author Frank Siegert
00012   class JADE_OPAL_2000_S4300807 : public Analysis {
00013   public:
00014 
00015     /// @name Constructors etc.
00016     //@{
00017 
00018     /// Constructor
00019     JADE_OPAL_2000_S4300807() : Analysis("JADE_OPAL_2000_S4300807") {
00020     }
00021 
00022     //@}
00023 
00024 
00025     /// @name Analysis methods
00026     //@{
00027 
00028     void init() {
00029       // Projections
00030       const FinalState fs;
00031       addProjection(fs, "FS");
00032       addProjection(FastJets(fs, FastJets::JADE, 0.7), "JadeJets");
00033       addProjection(FastJets(fs, FastJets::DURHAM, 0.7), "DurhamJets");
00034 
00035       // Histos
00036       int offset = 0;
00037       switch (int(sqrtS()/GeV + 0.5)) {
00038       case 35: offset = 7; break;
00039       case 44: offset = 8; break;
00040       case 91: offset = 9; break;
00041       case 133: offset = 10; break;
00042       case 161: offset = 11; break;
00043       case 172: offset = 12; break;
00044       case 183: offset = 13; break;
00045       case 189: offset = 14; break;
00046       default: break;
00047       }
00048       for (size_t i = 0; i < 5; ++i) {
00049         _h_R_Jade[i] = bookDataPointSet(offset, 1, i+1);
00050         _h_R_Durham[i] = bookDataPointSet(offset+9, 1, i+1);
00051         if (i < 4) _h_y_Durham[i] = bookHistogram1D(offset+17, 1, i+1);
00052       }
00053     }
00054 
00055 
00056 
00057     void analyze(const Event& e) {
00058       const double weight = e.weight();
00059       MSG_DEBUG("Num particles = " << applyProjection<FinalState>(e, "FS").particles().size());
00060 
00061       const FastJets& jadejet = applyProjection<FastJets>(e, "JadeJets");
00062       if (jadejet.clusterSeq()) {
00063         /// @todo Put this in an index loop?
00064         double y_23 = jadejet.clusterSeq()->exclusive_ymerge_max(2);
00065         double y_34 = jadejet.clusterSeq()->exclusive_ymerge_max(3);
00066         double y_45 = jadejet.clusterSeq()->exclusive_ymerge_max(4);
00067         double y_56 = jadejet.clusterSeq()->exclusive_ymerge_max(5);
00068 
00069         for (int i = 0; i < _h_R_Jade[0]->size(); ++i) {
00070           IDataPoint* dp = _h_R_Jade[0]->point(i);
00071           if (y_23 < dp->coordinate(0)->value()) {
00072             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00073           }
00074         }
00075         for (int i = 0; i < _h_R_Jade[1]->size(); ++i) {
00076           IDataPoint* dp = _h_R_Jade[1]->point(i);
00077           double ycut = dp->coordinate(0)->value();
00078           if (y_34 < ycut && y_23 > ycut) {
00079             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00080           }
00081         }
00082         for (int i = 0; i < _h_R_Jade[2]->size(); ++i) {
00083           IDataPoint* dp = _h_R_Jade[2]->point(i);
00084           double ycut = dp->coordinate(0)->value();
00085           if (y_45 < ycut && y_34 > ycut) {
00086             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00087           }
00088         }
00089         for (int i = 0; i < _h_R_Jade[3]->size(); ++i) {
00090           IDataPoint* dp = _h_R_Jade[3]->point(i);
00091           double ycut = dp->coordinate(0)->value();
00092           if (y_56 < ycut && y_45 > ycut) {
00093             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00094           }
00095         }
00096         for (int i = 0; i < _h_R_Jade[4]->size(); ++i) {
00097           IDataPoint* dp = _h_R_Jade[4]->point(i);
00098           double ycut = dp->coordinate(0)->value();
00099           if (y_56 > ycut) {
00100             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00101           }
00102         }
00103       }
00104 
00105       const FastJets& durjet = applyProjection<FastJets>(e, "DurhamJets");
00106       if (durjet.clusterSeq()) {
00107         /// @todo Put this in an index loop?
00108         double y_23 = durjet.clusterSeq()->exclusive_ymerge_max(2);
00109         double y_34 = durjet.clusterSeq()->exclusive_ymerge_max(3);
00110         double y_45 = durjet.clusterSeq()->exclusive_ymerge_max(4);
00111         double y_56 = durjet.clusterSeq()->exclusive_ymerge_max(5);
00112 
00113         _h_y_Durham[0]->fill(y_23, weight);
00114         _h_y_Durham[1]->fill(y_34, weight);
00115         _h_y_Durham[2]->fill(y_45, weight);
00116         _h_y_Durham[3]->fill(y_56, weight);
00117 
00118         for (int i = 0; i < _h_R_Durham[0]->size(); ++i) {
00119           IDataPoint* dp = _h_R_Durham[0]->point(i);
00120           if (y_23 < dp->coordinate(0)->value()) {
00121             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00122           }
00123         }
00124         for (int i = 0; i < _h_R_Durham[1]->size(); ++i) {
00125           IDataPoint* dp = _h_R_Durham[1]->point(i);
00126           double ycut = dp->coordinate(0)->value();
00127           if (y_34 < ycut && y_23 > ycut) {
00128             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00129           }
00130         }
00131         for (int i = 0; i < _h_R_Durham[2]->size(); ++i) {
00132           IDataPoint* dp = _h_R_Durham[2]->point(i);
00133           double ycut = dp->coordinate(0)->value();
00134           if (y_45 < ycut && y_34 > ycut) {
00135             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00136           }
00137         }
00138         for (int i = 0; i < _h_R_Durham[3]->size(); ++i) {
00139           IDataPoint* dp = _h_R_Durham[3]->point(i);
00140           double ycut = dp->coordinate(0)->value();
00141           if (y_56 < ycut && y_45 > ycut) {
00142             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00143           }
00144         }
00145         for (int i = 0; i < _h_R_Durham[4]->size(); ++i) {
00146           IDataPoint* dp = _h_R_Durham[4]->point(i);
00147           double ycut = dp->coordinate(0)->value();
00148           if (y_56 > ycut) {
00149             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00150           }
00151         }
00152       }
00153     }
00154 
00155 
00156 
00157     /// Finalize
00158     void finalize() {
00159       for (size_t n = 0; n < 4; ++n) {
00160         scale(_h_y_Durham[n], 1.0/sumOfWeights());
00161       }
00162 
00163       for (size_t n = 0; n < 5; ++n) {
00164         // Scale integrated jet rates to 100%
00165         for (int i = 0; i < _h_R_Jade[n]->size(); ++i) {
00166           IDataPoint* dp = _h_R_Jade[n]->point(i);
00167           dp->coordinate(1)->setValue(dp->coordinate(1)->value()*100.0/sumOfWeights());
00168         }
00169         for (int i = 0; i < _h_R_Durham[n]->size(); ++i) {
00170           IDataPoint* dp = _h_R_Durham[n]->point(i);
00171           dp->coordinate(1)->setValue(dp->coordinate(1)->value()*100.0/sumOfWeights());
00172         }
00173       }
00174     }
00175 
00176     //@}
00177 
00178 
00179   private:
00180 
00181     /// @name Histograms
00182     //@{
00183     AIDA::IDataPointSet *_h_R_Jade[5];
00184     AIDA::IDataPointSet *_h_R_Durham[5];
00185     AIDA::IHistogram1D *_h_y_Durham[4];
00186     //@}
00187 
00188   };
00189 
00190 
00191 
00192   // The hook for the plugin system
00193   DECLARE_RIVET_PLUGIN(JADE_OPAL_2000_S4300807);
00194 
00195 }