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/RivetYODA.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 #include "Rivet/Projections/Beam.hh"
00013 
00014 namespace Rivet {
00015 
00016 
00017   /// @brief ALEPH jet rates and event shapes at LEP 1 and 2
00018   class ALEPH_2004_S5765862 : public Analysis {
00019   public:
00020 
00021     ALEPH_2004_S5765862()
00022       : Analysis("ALEPH_2004_S5765862") , _initialisedJets(false),
00023         _initialisedSpectra(false), _weightedTotalChargedPartNum(0)
00024     {
00025     }
00026 
00027 
00028   public:
00029 
00030     void init() {
00031       _initialisedJets    = true;
00032       _initialisedSpectra = true;
00033       // TODO: According to the paper they seem to discard neutral particles
00034       //       between 1 and 2 GeV. That correction is included in the systematic
00035       //       uncertainties and overly complicated to program, so we ignore it.
00036       const FinalState fs;
00037       addProjection(fs, "FS");
00038       FastJets durhamjets(fs, FastJets::DURHAM, 0.7);
00039       durhamjets.useInvisibles(true);
00040       addProjection(durhamjets, "DurhamJets");
00041 
00042       const Thrust thrust(fs);
00043       addProjection(thrust, "Thrust");
00044       addProjection(Sphericity(fs), "Sphericity");
00045       addProjection(ParisiTensor(fs), "Parisi");
00046       addProjection(Hemispheres(thrust), "Hemispheres");
00047 
00048       const ChargedFinalState cfs;
00049       addProjection(Beam(), "Beams");
00050       addProjection(cfs, "CFS");
00051 
00052       // Histos
00053       // offset for the event shapes and jets
00054       int offset = 0;
00055       switch (int(sqrtS()/GeV + 0.5)) {
00056         case 91: offset = 0; break;
00057         case 133: offset = 1; break;
00058         case 161: offset = 2; break;
00059         case 172: offset = 3; break;
00060         case 183: offset = 4; break;
00061         case 189: offset = 5; break;
00062         case 200: offset = 6; break;
00063         case 206: offset = 7; break;
00064         default:
00065           _initialisedJets = false;
00066       }
00067       // event shapes
00068       if(_initialisedJets) {
00069         _h_thrust = bookHisto1D(offset+54, 1, 1);
00070         _h_heavyjetmass = bookHisto1D(offset+62, 1, 1);
00071         _h_totaljetbroadening = bookHisto1D(offset+70, 1, 1);
00072         _h_widejetbroadening = bookHisto1D(offset+78, 1, 1);
00073         _h_cparameter = bookHisto1D(offset+86, 1, 1);
00074         _h_thrustmajor = bookHisto1D(offset+94, 1, 1);
00075         _h_thrustminor = bookHisto1D(offset+102, 1, 1);
00076         _h_jetmassdifference = bookHisto1D(offset+110, 1, 1);
00077         _h_aplanarity = bookHisto1D(offset+118, 1, 1);
00078         _h_planarity  = offset==0 ? Histo1DPtr() : bookHisto1D(offset+125, 1, 1);
00079         _h_oblateness = bookHisto1D(offset+133, 1, 1);
00080         _h_sphericity = bookHisto1D(offset+141, 1, 1);
00081 
00082         // Durham n->m jet resolutions
00083         _h_y_Durham[0] = bookHisto1D(offset+149, 1, 1);   // y12 d149 ... d156
00084         _h_y_Durham[1] = bookHisto1D(offset+157, 1, 1);   // y23 d157 ... d164
00085         if (offset<6) { // there is no y34, y45 and y56 for 200 gev
00086           _h_y_Durham[2] = bookHisto1D(offset+165, 1, 1); // y34 d165 ... d172, but not 171
00087           _h_y_Durham[3] = bookHisto1D(offset+173, 1, 1); // y45 d173 ... d179
00088           _h_y_Durham[4] = bookHisto1D(offset+180, 1, 1); // y56 d180 ... d186
00089         }
00090         else if (offset==6) {
00091           _h_y_Durham[2].reset();
00092           _h_y_Durham[3].reset();
00093           _h_y_Durham[4].reset();
00094         }
00095         else if (offset==7) {
00096           _h_y_Durham[2] = bookHisto1D(172, 1, 1);
00097           _h_y_Durham[3] = bookHisto1D(179, 1, 1);
00098           _h_y_Durham[4] = bookHisto1D(186, 1, 1);
00099         }
00100 
00101         // Durham n-jet fractions
00102         _h_R_Durham[0] = bookHisto1D(offset+187, 1, 1); // R1 d187 ... d194
00103         _h_R_Durham[1] = bookHisto1D(offset+195, 1, 1); // R2 d195 ... d202
00104         _h_R_Durham[2] = bookHisto1D(offset+203, 1, 1); // R3 d203 ... d210
00105         _h_R_Durham[3] = bookHisto1D(offset+211, 1, 1); // R4 d211 ... d218
00106         _h_R_Durham[4] = bookHisto1D(offset+219, 1, 1); // R5 d219 ... d226
00107         _h_R_Durham[5] = bookHisto1D(offset+227, 1, 1); // R>=6 d227 ... d234
00108       }
00109       // offset for the charged particle distributions
00110       offset = 0;
00111       switch (int(sqrtS()/GeV + 0.5)) {
00112         case 133: offset = 0; break;
00113         case 161: offset = 1; break;
00114         case 172: offset = 2; break;
00115         case 183: offset = 3; break;
00116         case 189: offset = 4; break;
00117         case 196: offset = 5; break;
00118         case 200: offset = 6; break;
00119         case 206: offset = 7; break;
00120         default:
00121           _initialisedSpectra=false;
00122       }
00123       if (_initialisedSpectra) {
00124         _h_xp = bookHisto1D( 2+offset, 1, 1);
00125         _h_xi = bookHisto1D(11+offset, 1, 1);
00126         _h_xe = bookHisto1D(19+offset, 1, 1);
00127         _h_pTin  = bookHisto1D(27+offset, 1, 1);
00128         _h_pTout = offset!=7 ? Histo1DPtr() : bookHisto1D(35, 1, 1);
00129         _h_rapidityT = bookHisto1D(36+offset, 1, 1);
00130         _h_rapidityS = bookHisto1D(44+offset, 1, 1);
00131       }
00132 
00133       if (!_initialisedSpectra && !_initialisedJets) {
00134         MSG_WARNING("CoM energy of events sqrt(s) = " << sqrtS()/GeV
00135                     << " doesn't match any available analysis energy .");
00136       }
00137     }
00138 
00139 
00140     void analyze(const Event& e) {
00141       const double weight = e.weight();
00142 
00143       const Thrust& thrust = applyProjection<Thrust>(e, "Thrust");
00144       const Sphericity& sphericity = applyProjection<Sphericity>(e, "Sphericity");
00145 
00146       if(_initialisedJets) {
00147         bool LEP1 = fuzzyEquals(sqrtS(),91.2*GeV,0.01);
00148         // event shapes
00149         double thr = LEP1 ? thrust.thrust() : 1.0 - thrust.thrust();
00150         _h_thrust->fill(thr,weight);
00151         _h_thrustmajor->fill(thrust.thrustMajor(),weight);
00152         if(LEP1)
00153           _h_thrustminor->fill(log(thrust.thrustMinor()),weight);
00154         else
00155           _h_thrustminor->fill(thrust.thrustMinor(),weight);
00156         _h_oblateness->fill(thrust.oblateness(),weight);
00157 
00158         const Hemispheres& hemi = applyProjection<Hemispheres>(e, "Hemispheres");
00159         _h_heavyjetmass->fill(hemi.scaledM2high(),weight);
00160         _h_jetmassdifference->fill(hemi.scaledM2diff(),weight);
00161         _h_totaljetbroadening->fill(hemi.Bsum(),weight);
00162         _h_widejetbroadening->fill(hemi.Bmax(),weight);
00163 
00164         const ParisiTensor& parisi = applyProjection<ParisiTensor>(e, "Parisi");
00165         _h_cparameter->fill(parisi.C(),weight);
00166 
00167         _h_aplanarity->fill(sphericity.aplanarity(),weight);
00168         if(_h_planarity)
00169           _h_planarity->fill(sphericity.planarity(),weight);
00170         _h_sphericity->fill(sphericity.sphericity(),weight);
00171 
00172         // Jet rates
00173         const FastJets& durjet = applyProjection<FastJets>(e, "DurhamJets");
00174         double log10e = log10(exp(1.));
00175         if (durjet.clusterSeq()) {
00176           double logynm1=0.;
00177           double logyn;
00178           for (size_t i=0; i<5; ++i) {
00179             logyn = -log(durjet.clusterSeq()->exclusive_ymerge_max(i+1));
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       const double avgNumParts = _weightedTotalChargedPartNum / sumOfWeights();
00268       Scatter2DPtr  mult = bookScatter2D(1, 1, 1);
00269       for (size_t i = 0; i < mult->numPoints(); ++i) {
00270         if (fuzzyEquals(sqrtS(), mult->point(i).x(), 0.01)) {
00271           mult->point(i).setY(avgNumParts);
00272         }
00273       }
00274 
00275       if (_initialisedSpectra) {
00276         normalize(_h_xp, avgNumParts);
00277         normalize(_h_xi, avgNumParts);
00278         normalize(_h_xe, avgNumParts);
00279         normalize(_h_pTin , avgNumParts);
00280         if (_h_pTout) normalize(_h_pTout, avgNumParts);
00281         normalize(_h_rapidityT, avgNumParts);
00282         normalize(_h_rapidityS, avgNumParts);
00283       }
00284     }
00285 
00286   private:
00287 
00288     bool _initialisedJets;
00289     bool _initialisedSpectra;
00290 
00291     Histo1DPtr _h_xp;
00292     Histo1DPtr _h_xi;
00293     Histo1DPtr _h_xe;
00294     Histo1DPtr _h_pTin;
00295     Histo1DPtr _h_pTout;
00296     Histo1DPtr _h_rapidityT;
00297     Histo1DPtr _h_rapidityS;
00298     Histo1DPtr _h_thrust;
00299     Histo1DPtr _h_heavyjetmass;
00300     Histo1DPtr _h_totaljetbroadening;
00301     Histo1DPtr _h_widejetbroadening;
00302     Histo1DPtr _h_cparameter;
00303     Histo1DPtr _h_thrustmajor;
00304     Histo1DPtr _h_thrustminor;
00305     Histo1DPtr _h_jetmassdifference;
00306     Histo1DPtr _h_aplanarity;
00307     Histo1DPtr _h_planarity;
00308     Histo1DPtr _h_oblateness;
00309     Histo1DPtr _h_sphericity;
00310 
00311     Histo1DPtr _h_R_Durham[6];
00312     Histo1DPtr _h_y_Durham[5];
00313 
00314     double _weightedTotalChargedPartNum;
00315 
00316   };
00317 
00318 
00319 
00320   // The hook for the plugin system
00321   DECLARE_RIVET_PLUGIN(ALEPH_2004_S5765862);
00322 
00323 }