Fork me on GitHub

source: svn/trunk/src/JetsUtil.cc@ 274

Last change on this file since 274 was 260, checked in by severine ovyn, 16 years ago

add header

File size: 6.5 KB
Line 
1/***********************************************************************
2** **
3** /----------------------------------------------\ **
4** | Delphes, a framework for the fast simulation | **
5** | of a generic collider experiment | **
6** \----------------------------------------------/ **
7** **
8** **
9** This package uses: **
10** ------------------ **
11** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **
12** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **
13** FROG: [hep-ex/0901.2718v1] **
14** **
15** ------------------------------------------------------------------ **
16** **
17** Main authors: **
18** ------------- **
19** **
20** Severine Ovyn Xavier Rouby **
21** severine.ovyn@uclouvain.be xavier.rouby@cern **
22** **
23** Center for Particle Physics and Phenomenology (CP3) **
24** Universite catholique de Louvain (UCL) **
25** Louvain-la-Neuve, Belgium **
26** **
27** Copyright (C) 2008-2009, **
28** All rights reserved. **
29** **
30***********************************************************************/
31
32#include "JetsUtil.h"
33
34using namespace std;
35
36JetsUtil::JetsUtil() : plugins(NULL) {
37 DET = new RESOLution();
38 init();
39}
40
41
42JetsUtil::JetsUtil(const string & DetDatacard) : plugins(NULL) {
43 DET = new RESOLution();
44 DET->ReadDataCard(DetDatacard);
45 init();
46}
47
48
49JetsUtil::JetsUtil(const RESOLution * DetDatacard) : plugins(NULL) {
50 DET = new RESOLution(*DetDatacard);
51 init();
52}
53
54
55JetsUtil::JetsUtil(const JetsUtil& jet){
56 DET = new RESOLution(*(jet.DET));
57}
58
59JetsUtil& JetsUtil::operator=(const JetsUtil& jet) {
60 if(this==&jet) return *this;
61 DET = new RESOLution(*(jet.DET));
62 return *this;
63}
64
65void JetsUtil::init() {
66 if(plugins) delete plugins;
67
68 switch(DET->JET_jetalgo) {
69 default:
70 case 1: {
71 // set up a CDF midpoint jet definition
72#ifdef ENABLE_PLUGIN_CDFCONES
73 plugins = new fastjet::CDFJetCluPlugin(DET->JET_seed,DET->JET_coneradius,DET->JET_C_adjacencycut,DET->JET_C_maxiterations,DET->JET_C_iratch,DET->JET_overlap);
74 jet_def = fastjet::JetDefinition(plugins);
75#else
76 plugins = NULL;
77#endif
78 }
79 break;
80
81 case 2: {
82 // set up a CDF midpoint jet definition
83#ifdef ENABLE_PLUGIN_CDFCONES
84 plugins = new fastjet::CDFMidPointPlugin (DET->JET_seed,DET->JET_coneradius,DET->JET_M_coneareafraction,DET->JET_M_maxpairsize,DET->JET_M_maxiterations,DET->JET_overlap);
85 jet_def = fastjet::JetDefinition(plugins);
86#else
87 plugins = NULL;
88#endif
89 }
90 break;
91
92 case 3: {
93 // set up a siscone jet definition
94#ifdef ENABLE_PLUGIN_SISCONE
95 plugins = new fastjet::SISConePlugin (DET->JET_coneradius,DET->JET_overlap,DET->JET_S_npass, DET->JET_S_protojet_ptmin);
96 jet_def = fastjet::JetDefinition(plugins);
97#else
98 plugins = NULL;
99#endif
100 }
101 break;
102
103 case 4: {
104
105 jet_def = fastjet::JetDefinition(fastjet::kt_algorithm, DET->JET_coneradius);
106 }
107 break;
108
109 case 5: {
110 jet_def = fastjet::JetDefinition(fastjet::cambridge_algorithm,DET->JET_coneradius);
111 }
112 break;
113
114 case 6: {
115 jet_def = fastjet::JetDefinition(fastjet::antikt_algorithm,DET->JET_coneradius);
116 }
117 break;
118 }
119
120}
121
122vector<fastjet::PseudoJet> JetsUtil::RunJets(const vector<fastjet::PseudoJet>& input_particles)
123{
124 inclusive_jets.clear();
125 sorted_jets.clear();
126 // run the jet clustering with the above jet definition
127 if(input_particles.size()!=0)
128 {
129 fastjet::ClusterSequence clust_seq(input_particles, jet_def);
130 // extract the inclusive jets with pt > 5 GeV
131 double ptmin = 5.0;
132 inclusive_jets = clust_seq.inclusive_jets(ptmin);
133 // sort jets into increasing pt
134 sorted_jets = sorted_by_pt(inclusive_jets);
135 }
136
137 return sorted_jets;
138}
139
140void JetsUtil::RunJetBtagging(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchJet,const vector<fastjet::PseudoJet> & sorted_jets,const TSimpleArray<TRootGenParticle>& NFCentralQ)
141{
142 TRootJet *elementJet;
143 TLorentzVector JET;
144 for (unsigned int i = 0; i < sorted_jets.size(); i++) {
145 JET.SetPxPyPzE(sorted_jets[i].px(),sorted_jets[i].py(),sorted_jets[i].pz(),sorted_jets[i].E());
146 if(JET.Pt() > DET->PTCUT_jet)
147 {
148 elementJet = (TRootJet*) branchJet->NewEntry();
149 elementJet->Set(JET);
150 // b-jets
151 bool btag=false;
152 if((fabs(JET.Eta()) < DET->CEN_max_tracker && DET->Btaggedjet(JET, NFCentralQ)))btag=true;
153 elementJet->Btag = btag;
154 }
155 } // for itJet : loop on all jets
156
157}
158
159void JetsUtil::RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TLorentzVector> & TrackCentral)
160{
161 TRootTauJet *elementTauJet;
162 TLorentzVector JET;
163 for (unsigned int i = 0; i < sorted_jets.size(); i++) {
164 JET.SetPxPyPzE(sorted_jets[i].px(),sorted_jets[i].py(),sorted_jets[i].pz(),sorted_jets[i].E());
165 // Tau jet identification : 1! track and electromagnetic collimation
166 if(fabs(JET.Eta()) < (DET->CEN_max_tracker - DET->TAU_track_scone)) {
167 double Energie_tau_central = DET->EnergySmallCone(towers,JET.Eta(),JET.Phi());
168 if(
169 ( Energie_tau_central/JET.E() > DET->TAU_energy_frac ) &&
170 ( DET->NumTracks(TrackCentral,DET->TAU_track_pt,JET.Eta(),JET.Phi()) == 1 ) &&
171 ( JET.Pt() > DET->PTCUT_taujet)
172 ) {
173 elementTauJet = (TRootTauJet*) branchTauJet->NewEntry();
174 elementTauJet->Set(JET);
175 } // if tau jet
176 } // if JET.eta < tracker - tau_cone : Tau jet identification
177
178 } // for itJet : loop on all jets
179
180
181}
182
Note: See TracBrowser for help on using the repository browser.