Fork me on GitHub

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

Last change on this file since 480 was 443, checked in by Xavier Rouby, 15 years ago

new header in all files

File size: 9.2 KB
Line 
1/***********************************************************************
2** **
3** /----------------------------------------------\ **
4** | Delphes, a framework for the fast simulation | **
5** | of a generic collider experiment | **
6** \------------- arXiv:0903.2225v1 ------------/ **
7** **
8** **
9** This package uses: **
10** ------------------ **
11** ROOT: Nucl. Inst. & Meth. in Phys. Res. A389 (1997) 81-86 **
12** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **
13** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **
14** FROG: [hep-ex/0901.2718v1] **
15** HepMC: Comput. Phys. Commun.134 (2001) 41 **
16** **
17** ------------------------------------------------------------------ **
18** **
19** Main authors: **
20** ------------- **
21** **
22** Severine Ovyn Xavier Rouby **
23** severine.ovyn@uclouvain.be xavier.rouby@cern **
24** **
25** Center for Particle Physics and Phenomenology (CP3) **
26** Universite catholique de Louvain (UCL) **
27** Louvain-la-Neuve, Belgium **
28** **
29** Copyright (C) 2008-2009, **
30** All rights reserved. **
31** **
32***********************************************************************/
33
34#include "JetsUtil.h"
35
36using namespace std;
37
38JetsUtil::JetsUtil() : plugins(NULL) {
39 DET = new RESOLution();
40 init();
41}
42
43
44JetsUtil::JetsUtil(const string & DetDatacard) : plugins(NULL) {
45 DET = new RESOLution();
46 DET->ReadDataCard(DetDatacard);
47 init();
48}
49
50
51JetsUtil::JetsUtil(const RESOLution * DetDatacard) : plugins(NULL) {
52 DET = new RESOLution(*DetDatacard);
53 init();
54}
55
56
57JetsUtil::JetsUtil(const JetsUtil& jet){
58 DET = new RESOLution(*(jet.DET));
59}
60
61JetsUtil& JetsUtil::operator=(const JetsUtil& jet) {
62 if(this==&jet) return *this;
63 DET = new RESOLution(*(jet.DET));
64 return *this;
65}
66
67void JetsUtil::init() {
68 if(plugins) delete plugins;
69
70 switch(DET->JET_jetalgo) {
71 default:
72 case 1: {
73 // set up a CDF midpoint jet definition
74#ifdef ENABLE_PLUGIN_CDFCONES
75 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);
76 jet_def = fastjet::JetDefinition(plugins);
77#else
78 plugins = NULL;
79#endif
80 }
81 break;
82
83 case 2: {
84 // set up a CDF midpoint jet definition
85#ifdef ENABLE_PLUGIN_CDFCONES
86 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);
87 jet_def = fastjet::JetDefinition(plugins);
88#else
89 plugins = NULL;
90#endif
91 }
92 break;
93
94 case 3: {
95 // set up a siscone jet definition
96#ifdef ENABLE_PLUGIN_SISCONE
97 plugins = new fastjet::SISConePlugin (DET->JET_coneradius,DET->JET_overlap,DET->JET_S_npass, DET->JET_S_protojet_ptmin);
98 jet_def = fastjet::JetDefinition(plugins);
99#else
100 plugins = NULL;
101#endif
102 }
103 break;
104
105 case 4: {
106
107 jet_def = fastjet::JetDefinition(fastjet::kt_algorithm, DET->JET_coneradius);
108 }
109 break;
110
111 case 5: {
112 jet_def = fastjet::JetDefinition(fastjet::cambridge_algorithm,DET->JET_coneradius);
113 }
114 break;
115
116 case 6: {
117 jet_def = fastjet::JetDefinition(fastjet::antikt_algorithm,DET->JET_coneradius);
118 }
119 break;
120 }
121
122}
123
124vector<fastjet::PseudoJet> JetsUtil::RunJets(const vector<fastjet::PseudoJet>& input_particles, const vector<TRootTracks> & TrackCentral, vector<int> &NTrackJet, vector<float> &EHADEEM,D_CaloTowerList list_of_active_towers)
125{
126 inclusive_jets.clear();
127 sorted_jets.clear();
128 // run the jet clustering with the above jet definition
129 if(input_particles.size()!=0)
130 {
131 fastjet::ClusterSequence clust_seq(input_particles, jet_def);
132 // extract the inclusive jets with pt > 5 GeV
133 double ptmin = 5.0;
134 inclusive_jets = clust_seq.inclusive_jets(ptmin);
135
136 // sort jets into increasing pt
137 sorted_jets = sorted_by_pt(inclusive_jets);
138 //Bin tracks to make the link
139 float iEtaTrack[TrackCentral.size()];
140 float iPhiTrack[TrackCentral.size()];
141 for(unsigned int t = 0; t < TrackCentral.size(); t++)
142 {
143 if(!DET->JET_Eflow)
144 DET->BinEtaPhi(TrackCentral[t].PhiOuter,TrackCentral[t].EtaOuter,iPhiTrack[t],iEtaTrack[t]);
145 else {
146 iPhiTrack[t] = TrackCentral[t].PhiOuter; iEtaTrack[t] = TrackCentral[t].EtaOuter;
147 }
148 }
149 int numTrackJet;
150 for (unsigned int i = 0; i < sorted_jets.size(); i++)
151 {
152 //check number of tracks in jets
153 numTrackJet=0;
154 vector<fastjet::PseudoJet> constituents = clust_seq.constituents(sorted_jets[i]);
155 for(unsigned int it = 0; it < TrackCentral.size(); it++)
156 {
157 for (unsigned int j = 0; j < constituents.size(); j++)
158 {
159 if(DeltaR(iPhiTrack[it], iEtaTrack[it], constituents[j].phi(), constituents[j].eta())<0.001)numTrackJet++;
160 }
161 }
162 NTrackJet.push_back(numTrackJet);
163 //now, get EHad over EEm
164 float EmVal=0,HadVal=0;
165 for (unsigned int j = 0; j < constituents.size(); j++)
166 {
167 D_CaloTower calConsti(list_of_active_towers.getElement(constituents[j].eta(),constituents[j].phi()));
168 EmVal += calConsti.getEem();
169 HadVal += calConsti.getEhad();
170 }
171 EHADEEM.push_back(HadVal/EmVal);
172 }
173 }
174
175 return sorted_jets;
176}
177
178vector<fastjet::PseudoJet> JetsUtil::RunJetsResol(const vector<fastjet::PseudoJet>& input_particles)
179{
180 inclusive_jets.clear();
181 sorted_jets.clear();
182 // run the jet clustering with the above jet definition
183 if(input_particles.size()!=0)
184 {
185 fastjet::ClusterSequence clust_seq(input_particles, jet_def);
186 // extract the inclusive jets with pt > 5 GeV
187 double ptmin = 5.0;
188 inclusive_jets = clust_seq.inclusive_jets(ptmin);
189
190 // sort jets into increasing pt
191 sorted_jets = sorted_by_pt(inclusive_jets);
192 }
193 return sorted_jets;
194}
195
196
197void JetsUtil::RunJetBtagging(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchJet,const vector<fastjet::PseudoJet> & sorted_jets,const TSimpleArray<TRootC::GenParticle>& NFCentralQ, const vector<int> &NTrackJet, const vector<float> &EHADEEM)
198{
199 TRootJet *elementJet;
200 TLorentzVector JET;
201 for (unsigned int i = 0; i < sorted_jets.size(); i++) {
202 JET.SetPxPyPzE(sorted_jets[i].px(),sorted_jets[i].py(),sorted_jets[i].pz(),sorted_jets[i].E());
203 if(JET.Pt() > DET->PTCUT_jet)
204 {
205 elementJet = (TRootJet*) branchJet->NewEntry();
206 elementJet->Set(JET);
207 elementJet->NTracks = NTrackJet[i];
208 elementJet->EHoverEE = EHADEEM[i];
209
210 // b-jets
211 bool btag=false;
212 if((fabs(JET.Eta()) < DET->CEN_max_tracker && DET->Btaggedjet(JET, NFCentralQ)))btag=true;
213 elementJet->Btag = btag;
214 }
215 } // for itJet : loop on all jets
216}
217
218void JetsUtil::RunTauJets(ExRootTreeWriter *treeWriter, ExRootTreeBranch *branchTauJet,const vector<fastjet::PseudoJet> & sorted_jets,const vector<PhysicsTower> & towers, const vector<TRootTracks> & TrackCentral, const vector<int> &NTrackJet, const vector<float> &EHADEEM)
219{
220 TRootTauJet *elementTauJet;
221 TLorentzVector JET;
222 float charge=0;
223
224 for (unsigned int i = 0; i < sorted_jets.size(); i++) {
225 JET.SetPxPyPzE(sorted_jets[i].px(),sorted_jets[i].py(),sorted_jets[i].pz(),sorted_jets[i].E());
226 // Tau jet identification : 1! track and electromagnetic collimation
227 if(fabs(JET.Eta()) < (DET->CEN_max_tracker - DET->TAU_track_scone)) {
228 double Energie_tau_central = DET->EnergySmallCone(towers,JET.Eta(),JET.Phi());
229 if(
230 ( Energie_tau_central/JET.E() > DET->TAU_energy_frac ) &&
231 ( DET->NumTracks(charge,TrackCentral,DET->TAU_track_pt,JET.Eta(),JET.Phi()) == 1 ) &&
232 ( JET.Pt() > DET->PTCUT_taujet)
233 ) {
234 elementTauJet = (TRootTauJet*) branchTauJet->NewEntry();
235 elementTauJet->Set(JET);
236 elementTauJet->NTracks=NTrackJet[i];
237 elementTauJet->Charge = charge;
238 elementTauJet->EHoverEE = EHADEEM[i];
239 } // if tau jet
240 } // if JET.eta < tracker - tau_cone : Tau jet identification
241 } // for itJet : loop on all jets
242}
Note: See TracBrowser for help on using the repository browser.