CDF_1996_S3349578.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 
00008 namespace Rivet {
00009 
00010 
00011   class CDF_1996_S3349578 : public Analysis {
00012   public:
00013 
00014     /// @name Constructors etc.
00015     //@{
00016 
00017     /// Constructor
00018     CDF_1996_S3349578()
00019       : Analysis("CDF_1996_S3349578")
00020     {
00021       setBeams(PROTON, ANTIPROTON);
00022     }
00023 
00024     //@}
00025 
00026 
00027   public:
00028 
00029     /// @name Analysis methods
00030     //@{
00031 
00032     /// Book histograms and initialise projections before the run
00033     void init() {
00034 
00035       /// Initialise and register projections here
00036       const FinalState fs(-4.2, 4.2);
00037       addProjection(FastJets(fs, FastJets::CDFJETCLU, 0.7), "Jets");
00038 
00039       /// Book histograms here, e.g.:
00040       _h_3_mNJ = bookHistogram1D(1, 1, 1);
00041       _h_3_X3 = bookHistogram1D(2, 1, 1);
00042       _h_3_X4 = bookHistogram1D(3, 1, 1);
00043       _h_3_costheta3 = bookHistogram1D(8, 1, 1);
00044       _h_3_psi3 = bookHistogram1D(9, 1, 1);
00045       _h_3_f3 = bookHistogram1D(14, 1, 1);
00046       _h_3_f4 = bookHistogram1D(14, 1, 2);
00047       _h_3_f5 = bookHistogram1D(14, 1, 3);
00048    
00049       _h_4_mNJ = bookHistogram1D(1, 1, 2);
00050       _h_4_X3 = bookHistogram1D(4, 1, 1);
00051       _h_4_X4 = bookHistogram1D(5, 1, 1);
00052       _h_4_costheta3 = bookHistogram1D(10, 1, 1);
00053       _h_4_psi3 = bookHistogram1D(11, 1, 1);
00054       _h_4_f3 = bookHistogram1D(15, 1, 1);
00055       _h_4_f4 = bookHistogram1D(15, 1, 2);
00056       _h_4_f5 = bookHistogram1D(15, 1, 3);
00057       _h_4_XA = bookHistogram1D(17, 1, 1);
00058       _h_4_psiAB = bookHistogram1D(19, 1, 1);
00059       _h_4_fA = bookHistogram1D(21, 1, 1);
00060       _h_4_fB = bookHistogram1D(21, 1, 2);
00061    
00062       _h_5_mNJ = bookHistogram1D(1, 1, 3);
00063       _h_5_X3 = bookHistogram1D(6, 1, 1);
00064       _h_5_X4 = bookHistogram1D(7, 1, 1);
00065       _h_5_costheta3 = bookHistogram1D(12, 1, 1);
00066       _h_5_psi3 = bookHistogram1D(13, 1, 1);
00067       _h_5_f3 = bookHistogram1D(16, 1, 1);
00068       _h_5_f4 = bookHistogram1D(16, 1, 2);
00069       _h_5_f5 = bookHistogram1D(16, 1, 3);
00070       _h_5_XA = bookHistogram1D(18, 1, 1);
00071       _h_5_XC = bookHistogram1D(18, 1, 2);
00072       _h_5_psiAB = bookHistogram1D(20, 1, 1);
00073       _h_5_psiCD = bookHistogram1D(20, 1, 2);
00074       _h_5_fA = bookHistogram1D(22, 1, 1);
00075       _h_5_fB = bookHistogram1D(23, 1, 1);
00076       _h_5_fC = bookHistogram1D(24, 1, 1);
00077       _h_5_fD = bookHistogram1D(25, 1, 1);
00078    
00079     }
00080 
00081 
00082     void analyze(const Event& event) {
00083       const double weight = event.weight();
00084 
00085       Jets jets;
00086       FourMomentum jetsystem(0.0, 0.0, 0.0, 0.0);
00087       foreach (const Jet& jet, applyProjection<FastJets>(event, "Jets").jetsByEt()) {
00088         double Et = jet.momentum().Et();
00089         if (Et > 20.0*GeV) {
00090           bool separated=true;
00091           foreach (const Jet& ref, jets) {
00092             if (deltaR(jet.momentum(), ref.momentum())<0.9) {
00093               separated=false;
00094               break;
00095             }
00096           }
00097           if (!separated) continue;
00098           jets.push_back(jet);
00099           jetsystem += jet.momentum();
00100         }
00101         if (jets.size()>=5) break;
00102       }
00103       /// @todo include gaussian jet energy resolution smearing?
00104    
00105       if (jets.size() > 4) {
00106         _fiveJetAnalysis(jets, weight);
00107         jets.resize(4);
00108       }
00109       if (jets.size() > 3) {
00110         _fourJetAnalysis(jets, weight);
00111         jets.resize(3);
00112       }
00113       if (jets.size() > 2) _threeJetAnalysis(jets, weight);
00114     }
00115  
00116     
00117     
00118     
00119     void _threeJetAnalysis(const Jets& jets, const double& weight) {
00120       getLog() << Log::DEBUG << "3 jet analysis" << std::endl;
00121 
00122       double sumEt=0.0;
00123       FourMomentum jetsystem(0.0, 0.0, 0.0, 0.0);
00124       foreach (const Jet& jet, jets) {
00125         sumEt+=jet.momentum().Et();
00126         jetsystem+=jet.momentum();
00127       }
00128       if (sumEt < 420.0*GeV) return;
00129       
00130       const double m3J = _safeMass(jetsystem);
00131       if (m3J<600*GeV) {
00132         return;
00133       }
00134  
00135       LorentzTransform cms_boost(-jetsystem.boostVector());
00136       vector<FourMomentum> jets3;
00137       foreach (Jet jet, jets) {
00138         jets3.push_back(cms_boost.transform(jet.momentum()));
00139       }
00140       std::sort(jets3.begin(), jets3.end(), FourMomentum::byEDescending());
00141       FourMomentum p3(jets3[0]);
00142       FourMomentum p4(jets3[1]);
00143       FourMomentum p5(jets3[2]);
00144    
00145       FourMomentum pAV = cms_boost.transform(_avg_beam_in_lab(m3J, jetsystem.rapidity()));
00146       double costheta3=pAV.vector3().unit().dot(p3.vector3().unit());
00147       if (fabs(costheta3)>0.6) {
00148         return;
00149       }
00150    
00151       double X3 = 2.0*p3.E()/m3J;
00152       if (X3>0.9) {
00153         return;
00154       }
00155       
00156       const double X4 = 2.0*p4.E()/m3J;
00157       const double psi3 = _psi(p3, pAV, p4, p5);
00158       const double f3 = _safeMass(p3)/m3J;
00159       const double f4 = _safeMass(p4)/m3J;
00160       const double f5 = _safeMass(p5)/m3J;
00161    
00162       _h_3_mNJ->fill(m3J, weight);
00163       _h_3_X3->fill(X3, weight);
00164       _h_3_X4->fill(X4, weight);
00165       _h_3_costheta3->fill(costheta3, weight);
00166       _h_3_psi3->fill(psi3, weight);
00167       _h_3_f3->fill(f3, weight);
00168       _h_3_f4->fill(f4, weight);
00169       _h_3_f5->fill(f5, weight);
00170    
00171     }
00172 
00173     
00174     
00175     
00176     void _fourJetAnalysis(const Jets& jets, const double& weight) {
00177       getLog() << Log::DEBUG << "4 jet analysis" << std::endl;
00178       
00179       double sumEt=0.0;
00180       FourMomentum jetsystem(0.0, 0.0, 0.0, 0.0);
00181       foreach (const Jet& jet, jets) {
00182         sumEt+=jet.momentum().Et();
00183         jetsystem+=jet.momentum();
00184       }
00185       if (sumEt < 420.0*GeV) return;
00186       
00187       const double m4J = _safeMass(jetsystem);
00188       if (m4J < 650*GeV) return;
00189    
00190       LorentzTransform cms_boost(-jetsystem.boostVector());
00191       vector<FourMomentum> jets4;
00192       foreach (Jet jet, jets) {
00193         jets4.push_back(cms_boost.transform(jet.momentum()));
00194       }
00195       std::sort(jets4.begin(), jets4.end(), FourMomentum::byEDescending());
00196       
00197       FourMomentum pA, pB;
00198       vector<FourMomentum> jets3(_reduce(jets4, pA, pB));
00199       std::sort(jets3.begin(), jets3.end(), FourMomentum::byEDescending());
00200       FourMomentum p3(jets3[0]);
00201       FourMomentum p4(jets3[1]);
00202       FourMomentum p5(jets3[2]);
00203    
00204       FourMomentum pAV = cms_boost.transform(_avg_beam_in_lab(m4J, jetsystem.rapidity()));
00205       double costheta3=pAV.vector3().unit().dot(p3.vector3().unit());
00206       if (fabs(costheta3)>0.8) {
00207         return;
00208       }
00209    
00210       const double X3 = 2.0*p3.E()/m4J;
00211       if (X3>0.9) {
00212         return;
00213       }
00214    
00215       // fill histograms
00216       const double X4 = 2.0*p4.E()/m4J;
00217       const double psi3 = _psi(p3, pAV, p4, p5);
00218       const double f3 = _safeMass(p3)/m4J;
00219       const double f4 = _safeMass(p4)/m4J;
00220       const double f5 = _safeMass(p5)/m4J;
00221       const double fA = _safeMass(pA)/m4J;
00222       const double fB = _safeMass(pB)/m4J;
00223       const double XA = pA.E()/(pA.E()+pB.E());
00224       const double psiAB = _psi(pA, pB, pA+pB, pAV);
00225    
00226       _h_4_mNJ->fill(m4J, weight);
00227       _h_4_X3->fill(X3, weight);
00228       _h_4_X4->fill(X4, weight);
00229       _h_4_costheta3->fill(costheta3, weight);
00230       _h_4_psi3->fill(psi3, weight);
00231       _h_4_f3->fill(f3, weight);
00232       _h_4_f4->fill(f4, weight);
00233       _h_4_f5->fill(f5, weight);
00234       _h_4_XA->fill(XA, weight);
00235       _h_4_psiAB->fill(psiAB, weight);
00236       _h_4_fA->fill(fA, weight);
00237       _h_4_fB->fill(fB, weight);
00238     }
00239    
00240     
00241     
00242    
00243     void _fiveJetAnalysis(const Jets& jets, const double& weight) {
00244       getLog() << Log::DEBUG << "5 jet analysis" << std::endl;
00245       
00246       double sumEt=0.0;
00247       FourMomentum jetsystem(0.0, 0.0, 0.0, 0.0);
00248       foreach (const Jet& jet, jets) {
00249         sumEt+=jet.momentum().Et();
00250         jetsystem+=jet.momentum();
00251       }
00252       if (sumEt < 420.0*GeV) return;
00253       
00254       const double m5J = _safeMass(jetsystem);
00255       if (m5J < 750*GeV) return;
00256 
00257       LorentzTransform cms_boost(-jetsystem.boostVector());
00258       vector<FourMomentum> jets5;
00259       foreach (Jet jet, jets) {
00260         jets5.push_back(cms_boost.transform(jet.momentum()));
00261       }
00262       std::sort(jets5.begin(), jets5.end(), FourMomentum::byEDescending());
00263       
00264       FourMomentum pC, pD;
00265       vector<FourMomentum> jets4(_reduce(jets5, pC, pD));
00266       std::sort(jets4.begin(), jets4.end(), FourMomentum::byEDescending());
00267       
00268       FourMomentum pA, pB;
00269       vector<FourMomentum> jets3(_reduce(jets4, pA, pB));
00270       std::sort(jets3.begin(), jets3.end(), FourMomentum::byEDescending());
00271       FourMomentum p3(jets3[0]);
00272       FourMomentum p4(jets3[1]);
00273       FourMomentum p5(jets3[2]);
00274    
00275       // fill histograms
00276       FourMomentum pAV = cms_boost.transform(_avg_beam_in_lab(m5J, jetsystem.rapidity()));
00277       const double costheta3 = pAV.vector3().unit().dot(p3.vector3().unit());
00278       const double X3 = 2.0*p3.E()/m5J;
00279       const double X4 = 2.0*p4.E()/m5J;
00280       const double psi3 = _psi(p3, pAV, p4, p5);
00281       const double f3 = _safeMass(p3)/m5J;
00282       const double f4 = _safeMass(p4)/m5J;
00283       const double f5 = _safeMass(p5)/m5J;
00284       const double fA = _safeMass(pA)/m5J;
00285       const double fB = _safeMass(pB)/m5J;
00286       const double XA = pA.E()/(pA.E()+pB.E());
00287       const double psiAB = _psi(pA, pB, pA+pB, pAV);
00288       const double fC = _safeMass(pC)/m5J;
00289       const double fD = _safeMass(pD)/m5J;
00290       const double XC = pC.E()/(pC.E()+pD.E());
00291       const double psiCD = _psi(pC, pD, pC+pD, pAV);
00292    
00293       _h_5_mNJ->fill(m5J, weight);
00294       _h_5_X3->fill(X3, weight);
00295       _h_5_X4->fill(X4, weight);
00296       _h_5_costheta3->fill(costheta3, weight);
00297       _h_5_psi3->fill(psi3, weight);
00298       _h_5_f3->fill(f3, weight);
00299       _h_5_f4->fill(f4, weight);
00300       _h_5_f5->fill(f5, weight);
00301       _h_5_XA->fill(XA, weight);
00302       _h_5_psiAB->fill(psiAB, weight);
00303       _h_5_fA->fill(fA, weight);
00304       _h_5_fB->fill(fB, weight);
00305       _h_5_XC->fill(XC, weight);
00306       _h_5_psiCD->fill(psiCD, weight);
00307       _h_5_fC->fill(fC, weight);
00308       _h_5_fD->fill(fD, weight);
00309     }
00310    
00311    
00312     /// Normalise histograms etc., after the run
00313     void finalize() {
00314    
00315       /// Normalise, scale and otherwise manipulate histograms here
00316       normalize(_h_3_mNJ, 1.0);
00317       normalize(_h_3_X3, 1.0);
00318       normalize(_h_3_X4, 1.0);
00319       normalize(_h_3_costheta3, 1.0);
00320       normalize(_h_3_psi3, 1.0);
00321       normalize(_h_3_f3, 1.0);
00322       normalize(_h_3_f4, 1.0);
00323       normalize(_h_3_f5, 1.0);
00324    
00325       normalize(_h_4_mNJ, 1.0);
00326       normalize(_h_4_X3, 1.0);
00327       normalize(_h_4_X4, 1.0);
00328       normalize(_h_4_costheta3, 1.0);
00329       normalize(_h_4_psi3, 1.0);
00330       normalize(_h_4_f3, 1.0);
00331       normalize(_h_4_f4, 1.0);
00332       normalize(_h_4_f5, 1.0);
00333       normalize(_h_4_XA, 1.0);
00334       normalize(_h_4_psiAB, 1.0);
00335       normalize(_h_4_fA, 1.0);
00336       normalize(_h_4_fB, 1.0);
00337    
00338       normalize(_h_5_mNJ, 1.0);
00339       normalize(_h_5_X3, 1.0);
00340       normalize(_h_5_X4, 1.0);
00341       normalize(_h_5_costheta3, 1.0);
00342       normalize(_h_5_psi3, 1.0);
00343       normalize(_h_5_f3, 1.0);
00344       normalize(_h_5_f4, 1.0);
00345       normalize(_h_5_f5, 1.0);
00346       normalize(_h_5_XA, 1.0);
00347       normalize(_h_5_XC, 1.0);
00348       normalize(_h_5_psiAB, 1.0);
00349       normalize(_h_5_psiCD, 1.0);
00350       normalize(_h_5_fA, 1.0);
00351       normalize(_h_5_fB, 1.0);
00352       normalize(_h_5_fC, 1.0);
00353       normalize(_h_5_fD, 1.0);
00354    
00355     }
00356 
00357     //@}
00358 
00359 
00360   private:
00361     vector<FourMomentum> _reduce(const vector<FourMomentum>& jets,
00362                                  FourMomentum& combined1,
00363                                  FourMomentum& combined2) {
00364       double minMass2 = 1e9;
00365       size_t idx1(jets.size()), idx2(jets.size());
00366       for (size_t i=0; i<jets.size(); ++i) {
00367         for (size_t j=i+1; j<jets.size(); ++j) {
00368           double mass2 = FourMomentum(jets[i]+jets[j]).mass2();
00369           if (mass2<minMass2) {
00370             idx1=i;
00371             idx2=j;
00372           }
00373         }
00374       }
00375       vector<FourMomentum> newjets;
00376       for (size_t i=0; i<jets.size(); ++i) {
00377         if (i!=idx1 && i!=idx2) newjets.push_back(jets[i]);
00378       }
00379       newjets.push_back(jets[idx1]+jets[idx2]);
00380       combined1 = jets[idx1];
00381       combined2 = jets[idx2];
00382       return newjets;
00383     }
00384     
00385     FourMomentum _avg_beam_in_lab(const double& m, const double& y) {
00386       const double mt = m/2.0;
00387       FourMomentum beam1(mt, 0, 0, mt);
00388       FourMomentum beam2(mt, 0, 0, -mt);
00389       if (fabs(y)>1e-3) {
00390         FourMomentum boostvec(cosh(y), 0.0, 0.0, sinh(y));
00391         LorentzTransform cms_boost(-boostvec.boostVector());
00392         cms_boost = cms_boost.inverse();
00393         beam1=cms_boost.transform(beam1);
00394         beam2=cms_boost.transform(beam2);
00395       }
00396       if (beam1.E()>beam2.E()) {
00397         return beam1-beam2;
00398       }
00399       else {
00400         return beam2-beam1;
00401       }
00402     }
00403     
00404     double _psi(const FourMomentum& p1, const FourMomentum& p2,
00405                 const FourMomentum& p3, const FourMomentum& p4) {
00406       Vector3 p1xp2 = p1.vector3().cross(p2.vector3());
00407       Vector3 p3xp4 = p3.vector3().cross(p4.vector3());
00408       return mapAngle0ToPi(acos(p1xp2.unit().dot(p3xp4.unit())));
00409     }
00410 
00411     double _safeMass(const FourMomentum& p) {
00412       double mass2=p.mass2();
00413       if (mass2>0.0) return sqrt(mass2);
00414       else if (mass2<-1.0e-5) {
00415         getLog() << Log::WARNING << "m2 = " << m2 << ". Assuming m2=0." << endl;
00416         return 0.0;
00417       }
00418       else return 0.0;
00419     }
00420  
00421 
00422   private:
00423 
00424     /// @name Histograms
00425     //@{
00426     AIDA::IHistogram1D *_h_3_mNJ;
00427     AIDA::IHistogram1D *_h_3_X3;
00428     AIDA::IHistogram1D *_h_3_X4;
00429     AIDA::IHistogram1D *_h_3_costheta3;
00430     AIDA::IHistogram1D *_h_3_psi3;
00431     AIDA::IHistogram1D *_h_3_f3;
00432     AIDA::IHistogram1D *_h_3_f4;
00433     AIDA::IHistogram1D *_h_3_f5;
00434  
00435     AIDA::IHistogram1D *_h_4_mNJ;
00436     AIDA::IHistogram1D *_h_4_X3;
00437     AIDA::IHistogram1D *_h_4_X4;
00438     AIDA::IHistogram1D *_h_4_costheta3;
00439     AIDA::IHistogram1D *_h_4_psi3;
00440     AIDA::IHistogram1D *_h_4_f3;
00441     AIDA::IHistogram1D *_h_4_f4;
00442     AIDA::IHistogram1D *_h_4_f5;
00443     AIDA::IHistogram1D *_h_4_XA;
00444     AIDA::IHistogram1D *_h_4_psiAB;
00445     AIDA::IHistogram1D *_h_4_fA;
00446     AIDA::IHistogram1D *_h_4_fB;
00447  
00448     AIDA::IHistogram1D *_h_5_mNJ;
00449     AIDA::IHistogram1D *_h_5_X3;
00450     AIDA::IHistogram1D *_h_5_X4;
00451     AIDA::IHistogram1D *_h_5_costheta3;
00452     AIDA::IHistogram1D *_h_5_psi3;
00453     AIDA::IHistogram1D *_h_5_f3;
00454     AIDA::IHistogram1D *_h_5_f4;
00455     AIDA::IHistogram1D *_h_5_f5;
00456     AIDA::IHistogram1D *_h_5_XA;
00457     AIDA::IHistogram1D *_h_5_XC;
00458     AIDA::IHistogram1D *_h_5_psiAB;
00459     AIDA::IHistogram1D *_h_5_psiCD;
00460     AIDA::IHistogram1D *_h_5_fA;
00461     AIDA::IHistogram1D *_h_5_fB;
00462     AIDA::IHistogram1D *_h_5_fC;
00463     AIDA::IHistogram1D *_h_5_fD;
00464     //@}
00465 
00466   };
00467 
00468 
00469 
00470   // This global object acts as a hook for the plugin system
00471   AnalysisBuilder<CDF_1996_S3349578> plugin_CDF_1996_S3349578;
00472 
00473 
00474 }