rivet is hosted by Hepforge, IPPP Durham
ALEPH_2004_S5765862.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/FinalState.hh"
00004 #include "Rivet/Projections/FastJets.hh"
00005 #include "Rivet/Projections/ChargedFinalState.hh"
00006 #include "Rivet/Projections/Thrust.hh"
00007 #include "Rivet/Projections/Sphericity.hh"
00008 #include "Rivet/Projections/ParisiTensor.hh"
00009 #include "Rivet/Projections/Hemispheres.hh"
00010 #include "Rivet/Projections/Beam.hh"
00011 
00012 namespace Rivet {
00013 
00014 
00015   /// @brief ALEPH jet rates and event shapes at LEP 1 and 2
00016   class ALEPH_2004_S5765862 : public Analysis {
00017   public:
00018 
00019     ALEPH_2004_S5765862()
00020       : Analysis("ALEPH_2004_S5765862") , _initialisedJets(false),
00021         _initialisedSpectra(false), _weightedTotalChargedPartNum(0)
00022     {
00023     }
00024 
00025 
00026   public:
00027 
00028     void init() {
00029       _initialisedJets    = true;
00030       _initialisedSpectra = true;
00031       // TODO: According to the paper they seem to discard neutral particles
00032       //       between 1 and 2 GeV. That correction is included in the systematic
00033       //       uncertainties and overly complicated to program, so we ignore it.
00034       const FinalState fs;
00035       addProjection(fs, "FS");
00036       FastJets durhamjets(fs, FastJets::DURHAM, 0.7);
00037       durhamjets.useInvisibles(true);
00038       addProjection(durhamjets, "DurhamJets");
00039 
00040       const Thrust thrust(fs);
00041       addProjection(thrust, "Thrust");
00042       addProjection(Sphericity(fs), "Sphericity");
00043       addProjection(ParisiTensor(fs), "Parisi");
00044       addProjection(Hemispheres(thrust), "Hemispheres");
00045 
00046       const ChargedFinalState cfs;
00047       addProjection(Beam(), "Beams");
00048       addProjection(cfs, "CFS");
00049 
00050       // Histos
00051       // offset for the event shapes and jets
00052       int offset = 0;
00053       switch (int(sqrtS()/GeV + 0.5)) {
00054         case 91: offset = 0; break;
00055         case 133: offset = 1; break;
00056         case 161: offset = 2; break;
00057         case 172: offset = 3; break;
00058         case 183: offset = 4; break;
00059         case 189: offset = 5; break;
00060         case 200: offset = 6; break;
00061         case 206: offset = 7; break;
00062         default:
00063           _initialisedJets = false;
00064       }
00065       // event shapes
00066       if(_initialisedJets) {
00067         _h_thrust = bookHisto1D(offset+54, 1, 1);
00068         _h_heavyjetmass = bookHisto1D(offset+62, 1, 1);
00069         _h_totaljetbroadening = bookHisto1D(offset+70, 1, 1);
00070         _h_widejetbroadening = bookHisto1D(offset+78, 1, 1);
00071         _h_cparameter = bookHisto1D(offset+86, 1, 1);
00072         _h_thrustmajor = bookHisto1D(offset+94, 1, 1);
00073         _h_thrustminor = bookHisto1D(offset+102, 1, 1);
00074         _h_jetmassdifference = bookHisto1D(offset+110, 1, 1);
00075         _h_aplanarity = bookHisto1D(offset+118, 1, 1);
00076         _h_planarity  = offset==0 ? Histo1DPtr() : bookHisto1D(offset+125, 1, 1);
00077         _h_oblateness = bookHisto1D(offset+133, 1, 1);
00078         _h_sphericity = bookHisto1D(offset+141, 1, 1);
00079 
00080         // Durham n->m jet resolutions
00081         _h_y_Durham[0] = bookHisto1D(offset+149, 1, 1);   // y12 d149 ... d156
00082         _h_y_Durham[1] = bookHisto1D(offset+157, 1, 1);   // y23 d157 ... d164
00083         if (offset<6) { // there is no y34, y45 and y56 for 200 gev
00084           _h_y_Durham[2] = bookHisto1D(offset+165, 1, 1); // y34 d165 ... d172, but not 171
00085           _h_y_Durham[3] = bookHisto1D(offset+173, 1, 1); // y45 d173 ... d179
00086           _h_y_Durham[4] = bookHisto1D(offset+180, 1, 1); // y56 d180 ... d186
00087         }
00088         else if (offset==6) {
00089           _h_y_Durham[2].reset();
00090           _h_y_Durham[3].reset();
00091           _h_y_Durham[4].reset();
00092         }
00093         else if (offset==7) {
00094           _h_y_Durham[2] = bookHisto1D(172, 1, 1);
00095           _h_y_Durham[3] = bookHisto1D(179, 1, 1);
00096           _h_y_Durham[4] = bookHisto1D(186, 1, 1);
00097         }
00098 
00099         // Durham n-jet fractions
00100         _h_R_Durham[0] = bookHisto1D(offset+187, 1, 1); // R1 d187 ... d194
00101         _h_R_Durham[1] = bookHisto1D(offset+195, 1, 1); // R2 d195 ... d202
00102         _h_R_Durham[2] = bookHisto1D(offset+203, 1, 1); // R3 d203 ... d210
00103         _h_R_Durham[3] = bookHisto1D(offset+211, 1, 1); // R4 d211 ... d218
00104         _h_R_Durham[4] = bookHisto1D(offset+219, 1, 1); // R5 d219 ... d226
00105         _h_R_Durham[5] = bookHisto1D(offset+227, 1, 1); // R>=6 d227 ... d234
00106       }
00107       // offset for the charged particle distributions
00108       offset = 0;
00109       switch (int(sqrtS()/GeV + 0.5)) {
00110         case 133: offset = 0; break;
00111         case 161: offset = 1; break;
00112         case 172: offset = 2; break;
00113         case 183: offset = 3; break;
00114         case 189: offset = 4; break;
00115         case 196: offset = 5; break;
00116         case 200: offset = 6; break;
00117         case 206: offset = 7; break;
00118         default:
00119           _initialisedSpectra=false;
00120       }
00121       if (_initialisedSpectra) {
00122         _h_xp = bookHisto1D( 2+offset, 1, 1);
00123         _h_xi = bookHisto1D(11+offset, 1, 1);
00124         _h_xe = bookHisto1D(19+offset, 1, 1);
00125         _h_pTin  = bookHisto1D(27+offset, 1, 1);
00126         _h_pTout = offset!=7 ? Histo1DPtr() : bookHisto1D(35, 1, 1);
00127         _h_rapidityT = bookHisto1D(36+offset, 1, 1);
00128         _h_rapidityS = bookHisto1D(44+offset, 1, 1);
00129       }
00130 
00131       if (!_initialisedSpectra && !_initialisedJets) {
00132         MSG_WARNING("CoM energy of events sqrt(s) = " << sqrtS()/GeV
00133                     << " doesn't match any available analysis energy .");
00134       }
00135     }
00136 
00137 
00138     void analyze(const Event& e) {
00139       const double weight = e.weight();
00140 
00141       const Thrust& thrust = applyProjection<Thrust>(e, "Thrust");
00142       const Sphericity& sphericity = applyProjection<Sphericity>(e, "Sphericity");
00143 
00144       if(_initialisedJets) {
00145         bool LEP1 = fuzzyEquals(sqrtS(),91.2*GeV,0.01);
00146         // event shapes
00147         double thr = LEP1 ? thrust.thrust() : 1.0 - thrust.thrust();
00148         _h_thrust->fill(thr,weight);
00149         _h_thrustmajor->fill(thrust.thrustMajor(),weight);
00150         if(LEP1)
00151           _h_thrustminor->fill(log(thrust.thrustMinor()),weight);
00152         else
00153           _h_thrustminor->fill(thrust.thrustMinor(),weight);
00154         _h_oblateness->fill(thrust.oblateness(),weight);
00155 
00156         const Hemispheres& hemi = applyProjection<Hemispheres>(e, "Hemispheres");
00157         _h_heavyjetmass->fill(hemi.scaledM2high(),weight);
00158         _h_jetmassdifference->fill(hemi.scaledM2diff(),weight);
00159         _h_totaljetbroadening->fill(hemi.Bsum(),weight);
00160         _h_widejetbroadening->fill(hemi.Bmax(),weight);
00161 
00162         const ParisiTensor& parisi = applyProjection<ParisiTensor>(e, "Parisi");
00163         _h_cparameter->fill(parisi.C(),weight);
00164 
00165         _h_aplanarity->fill(sphericity.aplanarity(),weight);
00166         if(_h_planarity)
00167           _h_planarity->fill(sphericity.planarity(),weight);
00168         _h_sphericity->fill(sphericity.sphericity(),weight);
00169 
00170         // Jet rates
00171         const FastJets& durjet = applyProjection<FastJets>(e, "DurhamJets");
00172         double log10e = log10(exp(1.));
00173         if (durjet.clusterSeq()) {
00174           double logynm1=0.;
00175           double logyn;
00176           for (size_t i=0; i<5; ++i) {
00177             double yn = durjet.clusterSeq()->exclusive_ymerge_max(i+1);
00178             if (yn<=0.0) continue;
00179             logyn = -log(yn);
00180             if (_h_y_Durham[i]) {
00181               _h_y_Durham[i]->fill(logyn, weight);
00182             }
00183             if(!LEP1) logyn *= log10e;
00184             for (size_t j = 0; j < _h_R_Durham[i]->numBins(); ++j) {
00185               double val   = _h_R_Durham[i]->bin(j).xMin();
00186               double width = _h_R_Durham[i]->bin(j).width();
00187               if(-val<=logynm1) break;
00188               if(-val<logyn) {
00189                 _h_R_Durham[i]->fill(val+0.5*width, weight*width);
00190               }
00191             }
00192             logynm1 = logyn;
00193           }
00194           for (size_t j = 0; j < _h_R_Durham[5]->numBins(); ++j) {
00195             double val   = _h_R_Durham[5]->bin(j).xMin();
00196             double width = _h_R_Durham[5]->bin(j).width();
00197             if(-val<=logynm1) break;
00198             _h_R_Durham[5]->fill(val+0.5*width, weight*width);
00199           }
00200         }
00201         if( !_initialisedSpectra) {
00202           const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(e, "CFS");
00203           const size_t numParticles = cfs.particles().size();
00204           _weightedTotalChargedPartNum += numParticles * weight;
00205         }
00206       }
00207 
00208       // charged particle distributions
00209       if(_initialisedSpectra) {
00210         const ChargedFinalState& cfs = applyProjection<ChargedFinalState>(e, "CFS");
00211         const size_t numParticles = cfs.particles().size();
00212         _weightedTotalChargedPartNum += numParticles * weight;
00213         const ParticlePair& beams = applyProjection<Beam>(e, "Beams").beams();
00214         const double meanBeamMom = ( beams.first.momentum().vector3().mod() +
00215                                      beams.second.momentum().vector3().mod() ) / 2.0;
00216         foreach (const Particle& p, cfs.particles()) {
00217           const double xp = p.momentum().vector3().mod()/meanBeamMom;
00218           _h_xp->fill(xp   , weight);
00219           const double logxp = -std::log(xp);
00220           _h_xi->fill(logxp, weight);
00221           const double xe = p.momentum().E()/meanBeamMom;
00222           _h_xe->fill(xe   , weight);
00223           const double pTinT  = dot(p.momentum().vector3(), thrust.thrustMajorAxis());
00224           const double pToutT = dot(p.momentum().vector3(), thrust.thrustMinorAxis());
00225           _h_pTin->fill(fabs(pTinT/GeV), weight);
00226           if(_h_pTout) _h_pTout->fill(fabs(pToutT/GeV), weight);
00227           const double momT = dot(thrust.thrustAxis()        ,p.momentum().vector3());
00228           const double rapidityT = 0.5 * std::log((p.momentum().E() + momT) /
00229                                                   (p.momentum().E() - momT));
00230           _h_rapidityT->fill(fabs(rapidityT), weight);
00231           const double momS = dot(sphericity.sphericityAxis(),p.momentum().vector3());
00232           const double rapidityS = 0.5 * std::log((p.momentum().E() + momS) /
00233                                                   (p.momentum().E() - momS));
00234           _h_rapidityS->fill(fabs(rapidityS), weight);
00235         }
00236       }
00237     }
00238 
00239     void finalize() {
00240       if(!_initialisedJets && !_initialisedSpectra) return;
00241 
00242       if (_initialisedJets) {
00243         normalize(_h_thrust);
00244         normalize(_h_heavyjetmass);
00245         normalize(_h_totaljetbroadening);
00246         normalize(_h_widejetbroadening);
00247         normalize(_h_cparameter);
00248         normalize(_h_thrustmajor);
00249         normalize(_h_thrustminor);
00250         normalize(_h_jetmassdifference);
00251         normalize(_h_aplanarity);
00252         if(_h_planarity) normalize(_h_planarity);
00253         normalize(_h_oblateness);
00254         normalize(_h_sphericity);
00255 
00256         for (size_t n=0; n<6; ++n) {
00257           scale(_h_R_Durham[n], 1./sumOfWeights());
00258         }
00259 
00260         for (size_t n = 0; n < 5; ++n) {
00261           if (_h_y_Durham[n]) {
00262             scale(_h_y_Durham[n], 1.0/sumOfWeights());
00263           }
00264         }
00265       }
00266 
00267       Histo1D temphisto(refData(1, 1, 1));
00268       const double avgNumParts = _weightedTotalChargedPartNum / sumOfWeights();
00269       Scatter2DPtr  mult = bookScatter2D(1, 1, 1);
00270       for (size_t b = 0; b < temphisto.numBins(); b++) {
00271         const double x  = temphisto.bin(b).midpoint();
00272         const double ex = temphisto.bin(b).width()/2.;
00273         if (inRange(sqrtS()/GeV, x-ex, x+ex)) {
00274           mult->addPoint(x, avgNumParts, ex, 0.);
00275         }
00276       }
00277 
00278       if (_initialisedSpectra) {
00279         normalize(_h_xp, avgNumParts);
00280         normalize(_h_xi, avgNumParts);
00281         normalize(_h_xe, avgNumParts);
00282         normalize(_h_pTin , avgNumParts);
00283         if (_h_pTout) normalize(_h_pTout, avgNumParts);
00284         normalize(_h_rapidityT, avgNumParts);
00285         normalize(_h_rapidityS, avgNumParts);
00286       }
00287     }
00288 
00289   private:
00290 
00291     bool _initialisedJets;
00292     bool _initialisedSpectra;
00293 
00294     Histo1DPtr _h_xp;
00295     Histo1DPtr _h_xi;
00296     Histo1DPtr _h_xe;
00297     Histo1DPtr _h_pTin;
00298     Histo1DPtr _h_pTout;
00299     Histo1DPtr _h_rapidityT;
00300     Histo1DPtr _h_rapidityS;
00301     Histo1DPtr _h_thrust;
00302     Histo1DPtr _h_heavyjetmass;
00303     Histo1DPtr _h_totaljetbroadening;
00304     Histo1DPtr _h_widejetbroadening;
00305     Histo1DPtr _h_cparameter;
00306     Histo1DPtr _h_thrustmajor;
00307     Histo1DPtr _h_thrustminor;
00308     Histo1DPtr _h_jetmassdifference;
00309     Histo1DPtr _h_aplanarity;
00310     Histo1DPtr _h_planarity;
00311     Histo1DPtr _h_oblateness;
00312     Histo1DPtr _h_sphericity;
00313 
00314     Histo1DPtr _h_R_Durham[6];
00315     Histo1DPtr _h_y_Durham[5];
00316 
00317     double _weightedTotalChargedPartNum;
00318 
00319   };
00320 
00321 
00322 
00323   // The hook for the plugin system
00324   DECLARE_RIVET_PLUGIN(ALEPH_2004_S5765862);
00325 
00326 }