16 extern struct UPPRIV {
22 extern struct MEMAIN {
81 <<
"Run not initialized in JetMatchingMadgraph"
84 for (
int i = 0;
i < 3;
i++)
97 for (
int i=0;
i < hepeup.
NUP;
i++ )
99 if ( hepeup.
ISTUP[
i] < 0 )
continue;
100 if ( hepeup.
MOTHUP[
i].first != 1 && hepeup.
MOTHUP[
i].second !=2 )
continue;
118 int NPartons =
typeIdx[0].size();
129 const std::vector<fastjet::PseudoJet>* jetInput )
134 int NPartons =
typeIdx[0].size();
139 int ClusSeqNJets = 0;
141 fastjet::ClusterSequence ClusSequence( *jetInput, *
fJetFinder );
155 if ( ClusSeqNJets < NPartons )
return LESS_JETS;
157 double localQcutSq =
qCutSq;
161 if( ClusSeqNJets > NPartons )
return MORE_JETS;
167 fClusJets = ClusSequence.exclusive_jets( NPartons );
168 ClusSeqNJets = NPartons;
173 std::vector<fastjet::PseudoJet> MatchingInput;
175 std::vector<bool> jetAssigned;
182 while ( counter < NPartons )
185 MatchingInput.clear();
187 for (
int i=0;
i<ClusSeqNJets;
i++ )
189 if ( jetAssigned[
i] )
continue;
190 if ( i == NPartons )
break;
196 MatchingInput.push_back( fastjet::PseudoJet( exjet.px(), exjet.py(), exjet.pz(), exjet.e() ) );
197 MatchingInput.back().set_user_index(i);
201 MatchingInput.push_back( fastjet::PseudoJet( hepeup.
PUP[idx][0],
204 hepeup.
PUP[idx][3]) );
209 int NBefore = MatchingInput.size();
218 fastjet::ClusterSequence ClusSeq( MatchingInput, *
fJetFinder );
220 const std::vector<fastjet::PseudoJet>&
output = ClusSeq.jets();
221 int NClusJets = output.size() - NBefore;
236 if ( NClusJets >= NBefore )
248 bool matched =
false;
249 const std::vector<fastjet::ClusterSequence::history_element>& history = ClusSeq.history();
252 for (
unsigned int i=NBefore;
i<output.size();
i++ )
255 int hidx = output[
i].cluster_sequence_history_index();
256 double dNext = history[hidx].dij;
257 if ( dNext < localQcutSq )
263 int parent1 = history[hidx].parent1;
264 int parent2 = history[hidx].parent2;
265 if ( parent1 < 0 || parent2 < 0 )
break;
269 int pidx = MatchingInput[parent1].user_index();
270 jetAssigned[pidx] =
true;
290 std::vector<double> MergingScale;
291 MergingScale.clear();
292 for (
int nj=0; nj<4; nj++ )
294 double dmscale2 = ClusSequence.exclusive_dmerge( nj );
295 double dmscale =
sqrt( dmscale2 );
296 MergingScale.push_back( dmscale );
298 fDJROutput.open(
"events.tree", std::ios_base::app );
299 double dNJets = (double)NPartons;
300 fDJROutput <<
" " << dNJets <<
" " << MergingScale[0] <<
" "
301 << MergingScale[1] <<
" "
302 << MergingScale[2] <<
" "
303 << MergingScale[3] << std::endl;
struct gen::MEMAIN memain_
fastjet::JetDefinition * fJetFinder
const HEPEUP * getHEPEUP() const
std::vector< std::pair< int, int > > MOTHUP
const T & max(const T &a, const T &b)
std::vector< FiveVector > PUP
std::vector< fastjet::PseudoJet > fClusJets
std::vector< fastjet::PseudoJet > fPtSortedJets
std::vector< int > typeIdx[3]
void beforeHadronisation(const lhef::LHEEvent *)
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
Power< A, B >::type pow(const A &a, const B &b)
struct gen::UPPRIV uppriv_
int match(const lhef::LHEEvent *partonLevel, const std::vector< fastjet::PseudoJet > *jetInput)