001
002
003
004
005
006
007
008
009 #include "AtlfastAlgs/ClusterFastJetStrategy.h"
010 #include "AtlfastEvent/Cell.h"
011 #include "AtlfastEvent/KtCluster.h"
012 #include "AtlfastEvent/ICluster.h"
013
014 #include "fastjet/SISConePlugin.hh"
015 #include "JetRec/YSplitter.h"
016
017
018 #include "GaudiKernel/MsgStream.h"
019
020
021 #include "CLHEP/Vector/LorentzVector.h"
022
023 namespace Atlfast {
024
025
026
027
028
029
030
031
032
033
034
035
036 ClusterFastJetStrategy::ClusterFastJetStrategy(std::string strategy,
037 double coneRadius,
038 double overlapThreshold,
039 double minet,
040 double rp,
041 std::string angle,
042 std::string recom,
043 int subjet) :
044 m_minClusterET(minet), m_rParameter(rp), m_subjet(subjet), m_plugin(0), m_jetDef(0) {
045
046
047 if(strategy == "Kt" || strategy == "Cam" || strategy == "AntiKt"){
048
049
050 if(angle == "angular") {m_angle = 1;}
051 else if (angle == "deltaR") {m_angle = 2;}
052 else if (angle == "QCD") {m_angle = 3;}
053 else{
054 std::cerr << "Warning, unknown Kt angle scheme. Scheme set to \"deltaR\"" << std::endl;
055 m_angle = 2;
056 }
057
058 fastjet::RecombinationScheme recombScheme;
059
060
061 if(recom == "E") {m_recom = 1; recombScheme = fastjet::E_scheme;}
062 else if (recom == "pt") {m_recom = 2; recombScheme = fastjet::pt_scheme;}
063 else if (recom == "pt2") {m_recom = 3; recombScheme = fastjet::pt2_scheme;}
064 else if (recom == "et") {m_recom = 4; recombScheme = fastjet::Et_scheme;}
065 else if (recom == "et2") {m_recom = 5; recombScheme = fastjet::Et2_scheme;}
066 else{
067 std::cerr << "Warning, unknown Kt recombination scheme. Scheme set to \"E\"" << std::endl;
068 m_recom = 1;
069 recombScheme = fastjet::E_scheme;
070 }
071
072
073 fastjet::Strategy ktstrategy = fastjet::Best;
074 fastjet::JetAlgorithm jetalgorithm = fastjet::kt_algorithm;
075 if ( strategy == "Cam" ) jetalgorithm = fastjet::cambridge_algorithm;
076 if ( strategy == "AntiKt" ) jetalgorithm = fastjet::antikt_algorithm;
077
078 m_jetDef = new fastjet::JetDefinition(jetalgorithm, m_rParameter, recombScheme, ktstrategy);
079
080 }
081 else if (strategy == "Cone"){
082
083 m_plugin = new fastjet::SISConePlugin(coneRadius, overlapThreshold);
084 m_jetDef = new fastjet::JetDefinition(m_plugin);
085
086 }
087 }
088
089 std::string ClusterFastJetStrategy::Details(const char type[], const fastjet::PseudoJet &pj)const{
090 char outputDetails[256];
091 std::string outString;
092 sprintf(outputDetails,"%10g %10g %10g %10g %s\0",pj.px(),pj.py(),pj.pz(),pj.E(),type);
093 outString.append(outputDetails);
094 return outString;
095 }
096 std::string ClusterFastJetStrategy::Details(const char type[])const{
097 char outputDetails[256];
098 std::string outString;
099 sprintf(outputDetails,"%10s %10s %10s %10s %s\0","px","py","pz","E",type);
100 outString.append(outputDetails);
101 return outString;
102 }
103
104
105
106 ClusterFastJetStrategy::~ClusterFastJetStrategy()
107 {
108 delete m_plugin;
109 delete m_jetDef;
110 }
111
112 void ClusterFastJetStrategy::makeClusters(MsgStream& log,
113 const std::vector<IKinematic*>& storedCells,
114 IKinematicVector& unusedCells,
115 IClusterCollection* clusters) const {
116
117 log << MSG::DEBUG << storedCells.size() << " cells to start with"<<endreq;
118
119
120
121
122
123 std::vector<IKinematic*>::const_iterator itr = storedCells.begin();
124 std::vector<fastjet::PseudoJet> input_particles;
125 std::map<fastjet::PseudoJet,IKinematic*,JetComp> CellMap;
126
127
128 log << MSG::VERBOSE <<"Event Summary..."<<endreq;
129 log << MSG::VERBOSE <<Details("Input_Particles")<<endreq;
130
131 fastjet::PseudoJet tempVec;
132 input_particles.reserve(storedCells.size());
133 for(; itr != storedCells.end() ; ++itr){
134 tempVec = fastjet::PseudoJet((*itr)->momentum());
135 log << MSG::VERBOSE <<Details("Input_Particles",tempVec)<<endreq;
136 input_particles.push_back(tempVec);
137 CellMap[tempVec] = (*itr);
138 }
139 log << MSG::DEBUG << "Made vector of input particles"<<endreq;
140 log << MSG::VERBOSE << "Number of input Cells "<<CellMap.size()<<". Number of input particles "<<input_particles.size()<<endreq;
141 int iRemoved=0;
142
143
144
145
146 if(!m_jetDef){
147 printf("ClusterFastJetStrategy ERROR Error no jet definition exists, maybe you didn't type the clustering strategy correctly.\n");
148 printf("ClusterFastJetStrategy ERROR Returning having made no clusters.\n");
149 return;
150 }
151 fastjet::ClusterSequence clust_seq(input_particles, *m_jetDef);
152 log << MSG::DEBUG << "Made ClusterSequence"<<endreq;
153
154
155
156
157 std::vector<fastjet::PseudoJet> inclusive_jets = clust_seq.inclusive_jets();
158
159
160
161
162
163
164 log << MSG::DEBUG << "Got events jets "<< inclusive_jets.size() << endreq;
165
166 std::vector<fastjet::PseudoJet>::const_iterator ijet = inclusive_jets.begin();
167 double et=0;
168 double modP=0;
169
170 log << MSG::VERBOSE <<Details("Output_Jets")<<endreq;
171 log << MSG::VERBOSE <<Details("Output_Constituents")<<endreq;
172 for (; ijet != inclusive_jets.end() ; ++ijet){
173 log << MSG::VERBOSE <<Details("Output_Jets",(*ijet))<<endreq;
174 modP=sqrt( (*ijet).px()*(*ijet).px() + (*ijet).py()*(*ijet).py() + (*ijet).pz()*(*ijet).pz() );
175 et=(*ijet).E() * (*ijet).perp()/modP;
176
177 if(et > m_minClusterET) {
178 std::vector<fastjet::PseudoJet> jet_constituents;
179 jet_constituents = clust_seq.constituents(*ijet);
180
181 std::vector<IKinematic*> tempCellVec;
182 std::vector<fastjet::PseudoJet>::const_iterator iconstituent = jet_constituents.begin();
183 std::vector<HepLorentzVector> ysplit_constituents;
184 log << MSG::VERBOSE <<"Number of constituents in jet: "<<jet_constituents.size()<<endreq;
185 for (; iconstituent != jet_constituents.end() ; ++iconstituent){
186 log << MSG::VERBOSE <<Details("Output_Constituents",(*iconstituent))<<endreq;
187 ysplit_constituents.push_back(HepLorentzVector((*iconstituent).px(),(*iconstituent).py(),(*iconstituent).pz(),(*iconstituent).E()));
188 if(CellMap.find(*iconstituent) == CellMap.end()){
189 log << MSG::WARNING << "Cannot find this constituent in map of cells" << endreq;
190 }
191 else {
192 tempCellVec.push_back(CellMap[(*iconstituent)]);
193 log << MSG::VERBOSE <<"Removing cell as matched with constituent"<<endreq;
194 CellMap.erase(*iconstituent);
195 ++iRemoved;
196
197 }
198 }
199
200 double yCut = 0.;
201
202 if(m_subjet){
203 YSplitter ys(ysplit_constituents,4, m_angle, m_recom, m_rParameter);
204 yCut = ys.getYMergeVals(1).at(0);
205 }
206
207
208 HepLorentzVector tmp((*ijet).px(), (*ijet).py(), (*ijet).pz(), (*ijet).E());
209 ICluster* clu = new KtCluster(tmp,tempCellVec.begin(),tempCellVec.end(),yCut);
210 log << MSG::DEBUG << "Made a KtCluster" << endreq;
211
212 clusters->push_back(clu);
213 }
214 else{ log << MSG::VERBOSE <<"Jet has not enough et to cluster: JetEt = "<<et<<", min cluster Et = "<<m_minClusterET<<endreq; }
215 }
216
217 log << MSG::DEBUG << "Number of clusters Made by Kt algo " << clusters->size() << endreq;
218
219 std::map<fastjet::PseudoJet,IKinematic*,JetComp>::iterator celit = CellMap.begin();
220
221 for (; celit != CellMap.end() ; ++celit){
222
223 unusedCells.push_back( ( (*celit).second ) );
224 }
225
226 log << MSG::VERBOSE << "Number of output clusters "<<inclusive_jets.size()<<".Number of Removed cells "<<iRemoved<<". Number of saved KtClusters "<<clusters->size()<< endreq;
227 log << MSG::DEBUG << "Size of unusedCells vector " << unusedCells.size() << endreq;
228 return;
229 }
230
231 }
232
233
234
235
| Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
|
This page was automatically generated by the
LXR engine.
|
|