ALEPH_2004_S5765862.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/FinalState.hh"
00006 #include "Rivet/Projections/FastJets.hh"
00007 #include "Rivet/Projections/ChargedFinalState.hh"
00008 #include "Rivet/Projections/Thrust.hh"
00009 #include "Rivet/Projections/Sphericity.hh"
00010 #include "Rivet/Projections/ParisiTensor.hh"
00011 #include "Rivet/Projections/Hemispheres.hh"
00012 
00013 namespace Rivet {
00014 
00015 
00016   class ALEPH_2004_S5765862 : public Analysis {
00017   public:
00018 
00019     ALEPH_2004_S5765862()
00020       : Analysis("ALEPH_2004_S5765862") , _initialised(false)
00021     {
00022       setBeams(ELECTRON, POSITRON);
00023     }
00024 
00025 
00026   public:
00027 
00028     void init() {
00029       _initialised=true;
00030 
00031       const FinalState fs;
00032       addProjection(fs, "FS");
00033       addProjection(FastJets(fs, FastJets::DURHAM, 0.7), "DurhamJets");
00034 
00035       const Thrust thrust(fs);
00036       addProjection(thrust, "Thrust");
00037       addProjection(Sphericity(fs), "Sphericity");
00038       addProjection(ParisiTensor(fs), "Parisi");
00039       addProjection(Hemispheres(thrust), "Hemispheres");
00040       
00041       // Histos
00042       int offset = 0;
00043       switch (int(sqrtS()/GeV + 0.5)) {
00044       case 91: offset = 0; break;
00045       case 133: offset = 1; break;
00046       case 161: offset = 2; break;
00047       case 172: offset = 3; break;
00048       case 183: offset = 4; break;
00049       case 189: offset = 5; break;
00050       case 200: offset = 6; break;
00051       case 206: offset = 7; break;
00052       default:
00053         getLog() << Log::WARNING
00054                  << "CMS energy of events sqrt(s) = " << sqrtS()/GeV
00055                  <<" doesn't match any available analysis energy." << endl;
00056         _initialised=false;
00057         return;
00058       }
00059       
00060       // event shapes
00061       _h_thrust = bookHistogram1D(offset+54, 1, 1);
00062       _h_heavyjetmass = bookHistogram1D(offset+62, 1, 1);
00063       _h_totaljetbroadening = bookHistogram1D(offset+70, 1, 1);
00064       _h_widejetbroadening = bookHistogram1D(offset+78, 1, 1);
00065       _h_cparameter = bookHistogram1D(offset+86, 1, 1);
00066       _h_thrustmajor = bookHistogram1D(offset+94, 1, 1);
00067       _h_thrustminor = bookHistogram1D(offset+102, 1, 1);
00068       _h_jetmassdifference = bookHistogram1D(offset+110, 1, 1);
00069       _h_aplanarity = bookHistogram1D(offset+118, 1, 1);
00070       // planarity is missing the 91 gev data, so left out
00071       _h_oblateness = bookHistogram1D(offset+133, 1, 1);
00072       _h_sphericity = bookHistogram1D(offset+141, 1, 1);
00073       
00074       
00075       // Durham n->m jet resolutions
00076       _h_y_Durham[0] = bookHistogram1D(offset+149, 1, 1);   // y12 d149 ... d156
00077       _h_y_Durham[1] = bookHistogram1D(offset+157, 1, 1);   // y23 d157 ... d164
00078       _h_y_Durham[2] = bookHistogram1D(offset+165, 1, 1);   // y34 d165 ... d172
00079       if (offset<6) { // there is no y45 and y56 for 200 gev
00080         _h_y_Durham[3] = bookHistogram1D(offset+173, 1, 1); // y45 d173 ... d179
00081         _h_y_Durham[4] = bookHistogram1D(offset+180, 1, 1); // y56 d180 ... d186
00082       }
00083       else if (offset==6) {
00084         _h_y_Durham[3] = NULL;
00085         _h_y_Durham[4] = NULL;
00086       }
00087       else if (offset==7) {
00088         _h_y_Durham[3] = bookHistogram1D(179, 1, 1);
00089         _h_y_Durham[4] = bookHistogram1D(186, 1, 1);
00090       }
00091       
00092       // Durham n-jet fractions      
00093       _h_R_Durham[0] = bookDataPointSet(offset+187, 1, 1); // R1 d187 ... d194
00094       _h_R_Durham[1] = bookDataPointSet(offset+195, 1, 1); // R2 d195 ... d202
00095       _h_R_Durham[2] = bookDataPointSet(offset+203, 1, 1); // R3 d203 ... d210
00096       _h_R_Durham[3] = bookDataPointSet(offset+211, 1, 1); // R4 d211 ... d218
00097       _h_R_Durham[4] = bookDataPointSet(offset+219, 1, 1); // R5 d219 ... d226
00098       _h_R_Durham[5] = bookDataPointSet(offset+227, 1, 1); // R>=6 d227 ... d234
00099     }
00100 
00101 
00102     void analyze(const Event& e) {
00103       if (!_initialised) return;
00104       const double weight = e.weight();
00105 
00106       // event shapes
00107       const Thrust& thrust = applyProjection<Thrust>(e, "Thrust");
00108       double thr = (fuzzyEquals(sqrtS(),91.2*GeV,0.5)?thrust.thrust():1.0-thrust.thrust());
00109       _h_thrust->fill(thr,weight);
00110       _h_thrustmajor->fill(thrust.thrustMajor(),weight);
00111       _h_thrustminor->fill(log(thrust.thrustMinor()),weight);
00112       _h_oblateness->fill(thrust.oblateness(),weight);
00113       
00114       const Hemispheres& hemi = applyProjection<Hemispheres>(e, "Hemispheres");
00115       _h_heavyjetmass->fill(hemi.scaledM2high(),weight);
00116       _h_jetmassdifference->fill(hemi.scaledM2diff(),weight);
00117       _h_totaljetbroadening->fill(hemi.Bsum(),weight);
00118       _h_widejetbroadening->fill(hemi.Bmax(),weight);
00119       
00120       const ParisiTensor& parisi = applyProjection<ParisiTensor>(e, "Parisi");
00121       _h_cparameter->fill(parisi.C(),weight);
00122 
00123       const Sphericity& sphericity = applyProjection<Sphericity>(e, "Sphericity");
00124       _h_aplanarity->fill(sphericity.aplanarity(),weight);
00125       _h_sphericity->fill(sphericity.sphericity(),weight);
00126 
00127       // jet rates
00128       const FastJets& durjet = applyProjection<FastJets>(e, "DurhamJets");
00129       if (durjet.clusterSeq()) {
00130         for (int i=0; i<5; ++i) {
00131           _h_y_Durham[i]->fill(-log(durjet.clusterSeq()->exclusive_ymerge(i+1)), weight);
00132         }
00133       }
00134     }
00135 
00136 
00137     void finalize() {
00138       if (!_initialised) return;
00139       
00140       normalize(_h_thrust);
00141       normalize(_h_heavyjetmass);
00142       normalize(_h_totaljetbroadening);
00143       normalize(_h_widejetbroadening);
00144       normalize(_h_cparameter);
00145       normalize(_h_thrustmajor);
00146       normalize(_h_thrustminor);
00147       normalize(_h_jetmassdifference);
00148       normalize(_h_aplanarity);
00149       normalize(_h_oblateness);
00150       normalize(_h_sphericity);
00151       
00152       for (int N=1; N<7; ++N) {
00153         // calculate the N jet fraction from the jet resolution histograms
00154         
00155         for (int i = 0; i < _h_R_Durham[N-1]->size(); ++i) {
00156           IDataPoint* dp = _h_R_Durham[N-1]->point(i);
00157           // get ycut at which the njet-fraction is to be calculated
00158           /// @todo HepData has binwidths here, which doesn't make sense at all
00159           /// I assume the low edge to be the ycut
00160           double ycut = dp->coordinate(0)->value()-dp->coordinate(0)->errorMinus();
00161           
00162           // sum all >=N jet events
00163           double sigmaNinclusive = 0.0; 
00164           if (N>1) {
00165             AIDA::IHistogram1D* y_Nminus1_N = _h_y_Durham[N-2];
00166             // watch out, y_NM is negatively binned
00167             int cutbin=y_Nminus1_N->coordToIndex(-ycut);
00168             if (cutbin==AIDA::IAxis::UNDERFLOW_BIN) cutbin=0;
00169             if (cutbin==AIDA::IAxis::OVERFLOW_BIN) cutbin=y_Nminus1_N->axis().bins()-1;
00170             for (int ibin=0; ibin<cutbin; ++ibin) {
00171               sigmaNinclusive += y_Nminus1_N->binHeight(ibin);
00172             }
00173           }
00174           else sigmaNinclusive = sumOfWeights();
00175           
00176           // sum all >=N+1 jet events
00177           double sigmaNplus1inclusive = 0.0;
00178           if (N<6) {
00179             AIDA::IHistogram1D* y_N_Nplus1 = _h_y_Durham[N-1];
00180             // watch out, y_NM is negatively binned
00181             int cutbin=y_N_Nplus1->coordToIndex(-ycut);
00182             if (cutbin==AIDA::IAxis::UNDERFLOW_BIN) cutbin=0;
00183             if (cutbin==AIDA::IAxis::OVERFLOW_BIN) cutbin=y_N_Nplus1->axis().bins();
00184             for (int ibin=0; ibin<cutbin; ++ibin) {
00185               sigmaNplus1inclusive += y_N_Nplus1->binHeight(ibin);
00186             }
00187           }
00188 
00189           // njetfraction = (sigma(>=N jet) - sigma(>=N+1 jet)) / sigma(tot)
00190           double njetfraction = (sigmaNinclusive-sigmaNplus1inclusive)/sumOfWeights();
00191           dp->coordinate(1)->setValue(njetfraction);
00192         }
00193       }
00194       
00195 
00196       for (size_t n = 0; n < 5; ++n) {
00197         scale(_h_y_Durham[n], 1.0/sumOfWeights());
00198       }
00199       
00200     }
00201 
00202 
00203   private:
00204     
00205     bool _initialised;
00206 
00207     AIDA::IHistogram1D *_h_thrust;
00208     AIDA::IHistogram1D *_h_heavyjetmass;
00209     AIDA::IHistogram1D *_h_totaljetbroadening;
00210     AIDA::IHistogram1D *_h_widejetbroadening;
00211     AIDA::IHistogram1D *_h_cparameter;
00212     AIDA::IHistogram1D *_h_thrustmajor;
00213     AIDA::IHistogram1D *_h_thrustminor;
00214     AIDA::IHistogram1D *_h_jetmassdifference;
00215     AIDA::IHistogram1D *_h_aplanarity;
00216     AIDA::IHistogram1D *_h_oblateness;
00217     AIDA::IHistogram1D *_h_sphericity;
00218     
00219     AIDA::IDataPointSet *_h_R_Durham[6];
00220     AIDA::IHistogram1D *_h_y_Durham[5];
00221 
00222   };
00223 
00224 
00225 
00226   // This global object acts as a hook for the plugin system
00227   AnalysisBuilder<ALEPH_2004_S5765862> plugin_ALEPH_2004_S5765862;
00228 
00229 
00230 }