Fork me on GitHub

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

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

new header in all files

File size: 9.2 KB
RevLine 
[260]1/***********************************************************************
2** **
3** /----------------------------------------------\ **
4** | Delphes, a framework for the fast simulation | **
5** | of a generic collider experiment | **
[443]6** \------------- arXiv:0903.2225v1 ------------/ **
[260]7** **
8** **
9** This package uses: **
10** ------------------ **
[443]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] **
[260]14** FROG: [hep-ex/0901.2718v1] **
[443]15** HepMC: Comput. Phys. Commun.134 (2001) 41 **
[260]16** **
17** ------------------------------------------------------------------ **
18** **
19** Main authors: **
20** ------------- **
21** **
[443]22** Severine Ovyn Xavier Rouby **
23** severine.ovyn@uclouvain.be xavier.rouby@cern **
[260]24** **
[443]25** Center for Particle Physics and Phenomenology (CP3) **
26** Universite catholique de Louvain (UCL) **
27** Louvain-la-Neuve, Belgium **
28** **
[260]29** Copyright (C) 2008-2009, **
[443]30** All rights reserved. **
[260]31** **
32***********************************************************************/
[215]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
[310]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)
[215]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);
[307]135
[215]136 // sort jets into increasing pt
137 sorted_jets = sorted_by_pt(inclusive_jets);
[310]138 //Bin tracks to make the link
[307]139 float iEtaTrack[TrackCentral.size()];
140 float iPhiTrack[TrackCentral.size()];
141 for(unsigned int t = 0; t < TrackCentral.size(); t++)
[384]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 }
[307]149 int numTrackJet;
150 for (unsigned int i = 0; i < sorted_jets.size(); i++)
151 {
[310]152 //check number of tracks in jets
[307]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);
[310]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);
[307]172 }
[215]173 }
174
175 return sorted_jets;
176}
177
[310]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);
[307]189
[310]190 // sort jets into increasing pt
191 sorted_jets = sorted_by_pt(inclusive_jets);
192 }
193 return sorted_jets;
194}
[307]195
[310]196
[350]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)
[215]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);
[307]207 elementJet->NTracks = NTrackJet[i];
[310]208 elementJet->EHoverEE = EHADEEM[i];
[307]209
[215]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
[310]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)
[215]219{
220 TRootTauJet *elementTauJet;
221 TLorentzVector JET;
[286]222 float charge=0;
[315]223
[215]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 ) &&
[286]231 ( DET->NumTracks(charge,TrackCentral,DET->TAU_track_pt,JET.Eta(),JET.Phi()) == 1 ) &&
[215]232 ( JET.Pt() > DET->PTCUT_taujet)
233 ) {
234 elementTauJet = (TRootTauJet*) branchTauJet->NewEntry();
235 elementTauJet->Set(JET);
[307]236 elementTauJet->NTracks=NTrackJet[i];
[286]237 elementTauJet->Charge = charge;
[310]238 elementTauJet->EHoverEE = EHADEEM[i];
[215]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.