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