00001
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
00011
00012
00013
00014 class JADE_OPAL_2000_S4300807 : public Analysis {
00015 public:
00016
00017
00018
00019
00020
00021 JADE_OPAL_2000_S4300807() : Analysis("JADE_OPAL_2000_S4300807") {
00022 setBeams(ELECTRON, POSITRON);
00023 }
00024
00025
00026
00027
00028
00029
00030
00031 void init() {
00032
00033 const FinalState fs;
00034 addProjection(fs, "FS");
00035 addProjection(FastJets(fs, FastJets::JADE, 0.7), "JadeJets");
00036 addProjection(FastJets(fs, FastJets::DURHAM, 0.7), "DurhamJets");
00037
00038
00039 int offset = 0;
00040 switch (int(sqrtS()/GeV + 0.5)) {
00041 case 35: offset = 7; break;
00042 case 44: offset = 8; break;
00043 case 91: offset = 9; break;
00044 case 133: offset = 10; break;
00045 case 161: offset = 11; break;
00046 case 172: offset = 12; break;
00047 case 183: offset = 13; break;
00048 case 189: offset = 14; break;
00049 default:
00050 getLog() << Log::ERROR
00051 << "CMS energy of events sqrt(s) = " << sqrtS()/GeV
00052 <<" doesn't match any available analysis energy." << endl;
00053
00054 exit(1);
00055 }
00056 for (size_t i = 0; i < 5; ++i) {
00057 _h_R_Jade[i] = bookDataPointSet(offset, 1, i+1);
00058 _h_R_Durham[i] = bookDataPointSet(offset+9, 1, i+1);
00059 if (i < 4) _h_y_Durham[i] = bookHistogram1D(offset+17, 1, i+1);
00060 }
00061 }
00062
00063
00064
00065 void analyze(const Event& e) {
00066
00067 getLog() << Log::DEBUG << "Using FastJet JADE patch to make diff jet rate plots:" << endl;
00068 const double weight = e.weight();
00069
00070 const FastJets& jadejet = applyProjection<FastJets>(e, "JadeJets");
00071 if (jadejet.clusterSeq()) {
00072
00073 double y_23 = jadejet.clusterSeq()->exclusive_ymerge(2);
00074 double y_34 = jadejet.clusterSeq()->exclusive_ymerge(3);
00075 double y_45 = jadejet.clusterSeq()->exclusive_ymerge(4);
00076 double y_56 = jadejet.clusterSeq()->exclusive_ymerge(5);
00077
00078 for (int i = 0; i < _h_R_Jade[0]->size(); ++i) {
00079 IDataPoint* dp = _h_R_Jade[0]->point(i);
00080 if (y_23 < dp->coordinate(0)->value()) {
00081 dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00082 }
00083 }
00084 for (int i = 0; i < _h_R_Jade[1]->size(); ++i) {
00085 IDataPoint* dp = _h_R_Jade[1]->point(i);
00086 double ycut = dp->coordinate(0)->value();
00087 if (y_34 < ycut && y_23 > ycut) {
00088 dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00089 }
00090 }
00091 for (int i = 0; i < _h_R_Jade[2]->size(); ++i) {
00092 IDataPoint* dp = _h_R_Jade[2]->point(i);
00093 double ycut = dp->coordinate(0)->value();
00094 if (y_45 < ycut && y_34 > ycut) {
00095 dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00096 }
00097 }
00098 for (int i = 0; i < _h_R_Jade[3]->size(); ++i) {
00099 IDataPoint* dp = _h_R_Jade[3]->point(i);
00100 double ycut = dp->coordinate(0)->value();
00101 if (y_56 < ycut && y_45 > ycut) {
00102 dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00103 }
00104 }
00105 for (int i = 0; i < _h_R_Jade[4]->size(); ++i) {
00106 IDataPoint* dp = _h_R_Jade[4]->point(i);
00107 double ycut = dp->coordinate(0)->value();
00108 if (y_56 > ycut) {
00109 dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00110 }
00111 }
00112 }
00113
00114 const FastJets& durjet = applyProjection<FastJets>(e, "DurhamJets");
00115 if (durjet.clusterSeq()) {
00116
00117 double y_23 = durjet.clusterSeq()->exclusive_ymerge(2);
00118 double y_34 = durjet.clusterSeq()->exclusive_ymerge(3);
00119 double y_45 = durjet.clusterSeq()->exclusive_ymerge(4);
00120 double y_56 = durjet.clusterSeq()->exclusive_ymerge(5);
00121
00122 _h_y_Durham[0]->fill(y_23, weight);
00123 _h_y_Durham[1]->fill(y_34, weight);
00124 _h_y_Durham[2]->fill(y_45, weight);
00125 _h_y_Durham[3]->fill(y_56, weight);
00126
00127 for (int i = 0; i < _h_R_Durham[0]->size(); ++i) {
00128 IDataPoint* dp = _h_R_Durham[0]->point(i);
00129 if (y_23 < dp->coordinate(0)->value()) {
00130 dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00131 }
00132 }
00133 for (int i = 0; i < _h_R_Durham[1]->size(); ++i) {
00134 IDataPoint* dp = _h_R_Durham[1]->point(i);
00135 double ycut = dp->coordinate(0)->value();
00136 if (y_34 < ycut && y_23 > ycut) {
00137 dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00138 }
00139 }
00140 for (int i = 0; i < _h_R_Durham[2]->size(); ++i) {
00141 IDataPoint* dp = _h_R_Durham[2]->point(i);
00142 double ycut = dp->coordinate(0)->value();
00143 if (y_45 < ycut && y_34 > ycut) {
00144 dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00145 }
00146 }
00147 for (int i = 0; i < _h_R_Durham[3]->size(); ++i) {
00148 IDataPoint* dp = _h_R_Durham[3]->point(i);
00149 double ycut = dp->coordinate(0)->value();
00150 if (y_56 < ycut && y_45 > ycut) {
00151 dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00152 }
00153 }
00154 for (int i = 0; i < _h_R_Durham[4]->size(); ++i) {
00155 IDataPoint* dp = _h_R_Durham[4]->point(i);
00156 double ycut = dp->coordinate(0)->value();
00157 if (y_56 > ycut) {
00158 dp->coordinate(1)->setValue(dp->coordinate(1)->value() + weight);
00159 }
00160 }
00161 }
00162 }
00163
00164
00165
00166
00167 void finalize() {
00168 for (size_t n = 0; n < 4; ++n) {
00169 scale(_h_y_Durham[n], 1.0/sumOfWeights());
00170 }
00171
00172 for (size_t n = 0; n < 5; ++n) {
00173
00174 for (int i = 0; i < _h_R_Jade[n]->size(); ++i) {
00175 IDataPoint* dp = _h_R_Jade[n]->point(i);
00176 dp->coordinate(1)->setValue(dp->coordinate(1)->value()*100.0/sumOfWeights());
00177 }
00178 for (int i = 0; i < _h_R_Durham[n]->size(); ++i) {
00179 IDataPoint* dp = _h_R_Durham[n]->point(i);
00180 dp->coordinate(1)->setValue(dp->coordinate(1)->value()*100.0/sumOfWeights());
00181 }
00182 }
00183 }
00184
00185
00186
00187
00188 private:
00189
00190
00191
00192 AIDA::IDataPointSet *_h_R_Jade[5];
00193 AIDA::IDataPointSet *_h_R_Durham[5];
00194 AIDA::IHistogram1D *_h_y_Durham[4];
00195
00196
00197 };
00198
00199
00200
00201
00202
00203
00204
00205
00206 AnalysisBuilder<JADE_OPAL_2000_S4300807> plugin_JADE_OPAL_2000_S4300807;
00207
00208
00209 }