ExampleTree.hh

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef RIVET_ExampleTree_HH
00003 #define RIVET_ExampleTree_HH
00004 
00005 #include "Rivet/Analysis.hh"
00006 #include "Rivet/Projections/ChargedLeptons.hh"
00007 #include "Rivet/Projections/TotalVisibleMomentum.hh"
00008 #include "Rivet/Projections/KtJets.hh"
00009 #include "Rivet/Projections/WZandh.hh"
00010 #include "Rivet/RivetAIDA.fhh"
00011 
00012 // Root stuff
00013 #ifdef HAVE_ROOT
00014 #include "TTree.h"
00015 #include "TFile.h"
00016 #include "TString.h"
00017 #endif
00018 
00019 
00020 namespace Rivet {
00021 
00022   /// This Analysis books and fills a ROOT tree with simulated data.
00023   /// Based initially on the ntuples used in Phys. Rev. D65; 096014 (2002)
00024   /// and JHEP05 (2007) 033.
00025   class ExampleTree : public Analysis {
00026 
00027   public:
00028 
00029     /// Default constructor
00030     inline ExampleTree()
00031       : _fsproj(-4.0, 4.0, 0.0), _chgleptonsproj(_fsproj), 
00032         _ktjetsproj(_fsproj), _wzandhproj(), _vfsproj(_fsproj),
00033         _totvismomproj(_fsproj)
00034     {
00035       /// Particle IDs for neutrinos and antineutrinos and LSP
00036       _vfsproj
00037         .addVetoDetail(12, 10.0, 50.0)
00038         .addVetoId(14)
00039         .addVetoId(16)
00040         .addVetoId(-12)
00041         .addVetoId(-14)
00042         .addVetoId(-16)
00043         .addVetoId(1000022);
00044       _totvismomproj = TotalVisibleMomentum(_vfsproj);
00045 
00046       addProjection(_fsproj);
00047       addProjection(_chgleptonsproj);
00048       addProjection(_ktjetsproj);
00049       addProjection(_wzandhproj);
00050       addProjection(_vfsproj);
00051       addProjection(_totvismomproj);
00052     }
00053 
00054     inline ~ExampleTree() {}
00055 
00056   public:
00057 
00058     /// Factory method
00059     static Analysis* create() { return new ExampleTree(); }
00060 
00061     /// Return the name of this analysis
00062     inline string getName() const {
00063       return "ExampleTree";
00064     }
00065 
00066   public:
00067 
00068     /// Initialise the analysis.
00069     void init();
00070     
00071     /// Perform the analysis for this event.
00072     void analyze(const Event& event);
00073     
00074     /// Finish off the analysis.
00075     void finalize();
00076 
00077 
00078   private:
00079 
00080     /// The FinalState projector used by this analysis.
00081     FinalState _fsproj;
00082 
00083     /// The Charged Lepton projector used by this analysis.
00084     ChargedLeptons _chgleptonsproj;
00085 
00086     /// The jet projector.
00087     KtJets _ktjetsproj;
00088 
00089     /// The vector boson projector.
00090     WZandh _wzandhproj;
00091 
00092     /// The VetoedFinalState projector used by this analysis.
00093     VetoedFinalState _vfsproj;
00094 
00095     /// The total visible momentum projector.
00096     TotalVisibleMomentum _totvismomproj;
00097 
00098 
00099 #ifdef HAVE_ROOT
00100   private:
00101 
00102     /// The tree
00103     TTree* _rivetTree;
00104 
00105     /// The file for the Tree
00106     TFile* _treeFile;
00107 
00108     /// The filename
00109     TString _treeFileName;
00110 #endif
00111 
00112 
00113   private:
00114 
00115     /// @name The ntuple variables.
00116     //@{
00117     /// Event number
00118     int _nevt;            
00119 
00120     /// Number of W bosons
00121     int _nvb;             
00122     /// 4 momentum of W bosons.
00123     float _vbvec[8][4];
00124     /// Type (i.e. decay mode) of W bosons.
00125     int _vbtype[8]; 
00126 
00127     /// Number of jets
00128     int _njet; 
00129     /// Four momentum of the jets
00130     float _vjet[50][4]; 
00131 
00132     /// Number of jets for which the subjet analysis was performed.
00133     int _nsub; 
00134     /// Four vector of jets for which we found subjets.
00135     float _sjet3[200][4];
00136     /// y 1->2, 2->3, 3->4, 4->5 for the above jets.
00137     float _ysubsj[200][4];
00138 
00139     /// Number of leptons
00140     int _nlep;
00141     /// Lepton types
00142     int _leptype[150][3];
00143     float _vlep[150][4];
00144 
00145     /// Number of partons
00146     int _npart; 
00147     float _ppart[4000][4];
00148     int _pid[4000];
00149     int _mo[4000];
00150 
00151     /// Total visible momentum
00152     float _esumr[4];
00153     //@}
00154 
00155 
00156   private:
00157 
00158     /// Hide the assignment operator
00159     ExampleTree& operator=(const ExampleTree&);
00160 
00161     /// Minimum pt of jets which will go into the tree.
00162     int _jet_pt_cut;
00163 
00164     /// Minimum pt of jets which will have y evaluated and stored.
00165     int _subj_pt_cut;
00166 
00167     /// Minimum pt of charged leptons which will go into the tree.
00168     int _lepton_pt_cut;
00169 
00170     /// Store the partons or not?
00171     bool _store_partons;
00172   };
00173 
00174 }
00175 
00176 #endif