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:
00048         getLog() << Log::ERROR
00049                  << "CMS energy of events sqrt(s) = " << sqrtS()/GeV
00050                  <<" doesn't match any available analysis energy." << endl;
00051         /// @todo Really call exit()? I don't like the break of "command chain" that this implies
00052         exit(1);
00053       }
00054       for (size_t i = 0; i < 5; ++i) {
00055         _h_R_Jade[i] = bookDataPointSet(offset, 1, i+1);
00056         _h_R_Durham[i] = bookDataPointSet(offset+9, 1, i+1);
00057         if (i < 4) _h_y_Durham[i] = bookHistogram1D(offset+17, 1, i+1);
00058       }
00059     }
00060 
00061 
00062 
00063     void analyze(const Event& e) {
00064       const double weight = e.weight();
00065       MSG_DEBUG("Num particles = " << applyProjection<FinalState>(e, "FS").particles().size());
00066 
00067       const FastJets& jadejet = applyProjection<FastJets>(e, "JadeJets");
00068       if (jadejet.clusterSeq()) {
00069         /// @todo Put this in an index loop?
00070         double y_23 = jadejet.clusterSeq()->exclusive_ymerge_max(2);
00071         double y_34 = jadejet.clusterSeq()->exclusive_ymerge_max(3);
00072         double y_45 = jadejet.clusterSeq()->exclusive_ymerge_max(4);
00073         double y_56 = jadejet.clusterSeq()->exclusive_ymerge_max(5);
00074 
00075         for (int i = 0; i < _h_R_Jade[0]->size(); ++i) {
00076           IDataPoint* dp = _h_R_Jade[0]->point(i);
00077           if (y_23 < dp->coordinate(0)->value()) {
00078             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00079           }
00080         }
00081         for (int i = 0; i < _h_R_Jade[1]->size(); ++i) {
00082           IDataPoint* dp = _h_R_Jade[1]->point(i);
00083           double ycut = dp->coordinate(0)->value();
00084           if (y_34 < ycut && y_23 > ycut) {
00085             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00086           }
00087         }
00088         for (int i = 0; i < _h_R_Jade[2]->size(); ++i) {
00089           IDataPoint* dp = _h_R_Jade[2]->point(i);
00090           double ycut = dp->coordinate(0)->value();
00091           if (y_45 < ycut && y_34 > ycut) {
00092             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00093           }
00094         }
00095         for (int i = 0; i < _h_R_Jade[3]->size(); ++i) {
00096           IDataPoint* dp = _h_R_Jade[3]->point(i);
00097           double ycut = dp->coordinate(0)->value();
00098           if (y_56 < ycut && y_45 > ycut) {
00099             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00100           }
00101         }
00102         for (int i = 0; i < _h_R_Jade[4]->size(); ++i) {
00103           IDataPoint* dp = _h_R_Jade[4]->point(i);
00104           double ycut = dp->coordinate(0)->value();
00105           if (y_56 > ycut) {
00106             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00107           }
00108         }
00109       }
00110 
00111       const FastJets& durjet = applyProjection<FastJets>(e, "DurhamJets");
00112       if (durjet.clusterSeq()) {
00113         /// @todo Put this in an index loop?
00114         double y_23 = durjet.clusterSeq()->exclusive_ymerge_max(2);
00115         double y_34 = durjet.clusterSeq()->exclusive_ymerge_max(3);
00116         double y_45 = durjet.clusterSeq()->exclusive_ymerge_max(4);
00117         double y_56 = durjet.clusterSeq()->exclusive_ymerge_max(5);
00118 
00119         _h_y_Durham[0]->fill(y_23, weight);
00120         _h_y_Durham[1]->fill(y_34, weight);
00121         _h_y_Durham[2]->fill(y_45, weight);
00122         _h_y_Durham[3]->fill(y_56, weight);
00123 
00124         for (int i = 0; i < _h_R_Durham[0]->size(); ++i) {
00125           IDataPoint* dp = _h_R_Durham[0]->point(i);
00126           if (y_23 < dp->coordinate(0)->value()) {
00127             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00128           }
00129         }
00130         for (int i = 0; i < _h_R_Durham[1]->size(); ++i) {
00131           IDataPoint* dp = _h_R_Durham[1]->point(i);
00132           double ycut = dp->coordinate(0)->value();
00133           if (y_34 < ycut && y_23 > ycut) {
00134             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00135           }
00136         }
00137         for (int i = 0; i < _h_R_Durham[2]->size(); ++i) {
00138           IDataPoint* dp = _h_R_Durham[2]->point(i);
00139           double ycut = dp->coordinate(0)->value();
00140           if (y_45 < ycut && y_34 > ycut) {
00141             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00142           }
00143         }
00144         for (int i = 0; i < _h_R_Durham[3]->size(); ++i) {
00145           IDataPoint* dp = _h_R_Durham[3]->point(i);
00146           double ycut = dp->coordinate(0)->value();
00147           if (y_56 < ycut && y_45 > ycut) {
00148             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00149           }
00150         }
00151         for (int i = 0; i < _h_R_Durham[4]->size(); ++i) {
00152           IDataPoint* dp = _h_R_Durham[4]->point(i);
00153           double ycut = dp->coordinate(0)->value();
00154           if (y_56 > ycut) {
00155             dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00156           }
00157         }
00158       }
00159     }
00160 
00161 
00162 
00163     /// Finalize
00164     void finalize() {
00165       for (size_t n = 0; n < 4; ++n) {
00166         scale(_h_y_Durham[n], 1.0/sumOfWeights());
00167       }
00168 
00169       for (size_t n = 0; n < 5; ++n) {
00170         // Scale integrated jet rates to 100%
00171         for (int i = 0; i < _h_R_Jade[n]->size(); ++i) {
00172           IDataPoint* dp = _h_R_Jade[n]->point(i);
00173           dp->coordinate(1)->setValue(dp->coordinate(1)->value()*100.0/sumOfWeights());
00174         }
00175         for (int i = 0; i < _h_R_Durham[n]->size(); ++i) {
00176           IDataPoint* dp = _h_R_Durham[n]->point(i);
00177           dp->coordinate(1)->setValue(dp->coordinate(1)->value()*100.0/sumOfWeights());
00178         }
00179       }
00180     }
00181 
00182     //@}
00183 
00184 
00185   private:
00186 
00187     /// @name Histograms
00188     //@{
00189     AIDA::IDataPointSet *_h_R_Jade[5];
00190     AIDA::IDataPointSet *_h_R_Durham[5];
00191     AIDA::IHistogram1D *_h_y_Durham[4];
00192     //@}
00193 
00194   };
00195 
00196 
00197 
00198   //////////////////////////////////////////////////////////////
00199 
00200 
00201 
00202   // This global object acts as a hook for the plugin system
00203   AnalysisBuilder<JADE_OPAL_2000_S4300807> plugin_JADE_OPAL_2000_S4300807;
00204 
00205 
00206 }