CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
JetMatchingMadgraph Class Reference

#include <JetMatchingPy8Internal.h>

Inheritance diagram for JetMatchingMadgraph:
JetMatching JetMatchingMadgraphInputAlpgen

Public Member Functions

bool canVetoStep ()
 
bool doVetoStep (int, int, int, const Pythia8::Event &)
 
vector< double > GetDJR ()
 
bool initAfterBeams ()
 
 JetMatchingMadgraph ()
 
vector< int > nMEPartons ()
 
int numberVetoStep ()
 
 ~JetMatchingMadgraph ()
 
- Public Member Functions inherited from JetMatching
bool canVetoPartonLevelEarly ()
 
bool canVetoProcessLevel ()
 
bool canVetoStep ()
 
bool doVetoPartonLevelEarly (const Pythia8::Event &event)
 
bool doVetoProcessLevel (Pythia8::Event &process)
 
bool doVetoStep (int, int, int, const Pythia8::Event &)
 
 JetMatching ()
 
int numberVetoStep ()
 
 ~JetMatching ()
 

Public Attributes

Pythia8::SlowJet * slowJetDJR
 

Protected Member Functions

void ClearDJR ()
 
void ClearnME ()
 
bool doShowerKtVeto (double pTfirst)
 
void jetAlgorithmInput (const Pythia8::Event &, int)
 
bool matchPartonsToJets (int)
 
int matchPartonsToJetsHeavy ()
 
int matchPartonsToJetsLight ()
 
void runJetAlgorithm ()
 
void SetDJR (const Pythia8::Event &event)
 
void SetnME ()
 
void sortIncomingProcess (const Pythia8::Event &)
 

Protected Attributes

double clFact
 
vector< double > DJR
 
bool doFxFx
 
vector< int > nME
 
int nPartonsNow
 
int nQmatch
 
vector< int > origTypeIdx [3]
 
double qCut
 
double qCutME
 
double qCutMESq
 
double qCutSq
 
- Protected Attributes inherited from JetMatching
Pythia8::CellJet * cellJet
 
double coneMatchHeavy
 
double coneMatchLight
 
double coneRadius
 
double coneRadiusHeavy
 
bool doMerge
 
bool doShowerKt
 
double etaJetMax
 
double etaJetMaxAlgo
 
double eTjetMin
 
double eTpTlightMin
 
double eTseed
 
double eTthreshold
 
Pythia8::Event eventProcess
 
Pythia8::Event eventProcessOrig
 
bool exclusive
 
int exclusiveMode
 
int jetAlgorithm
 
int jetAllow
 
int jetMatch
 
vector< Pythia8::Vec4jetMomenta
 
int nEta
 
int nJet
 
int nJetMax
 
int nPhi
 
Pythia8::SlowJet * slowJet
 
Pythia8::SlowJet * slowJetHard
 
int slowJetPower
 
vector< int > typeIdx [3]
 
set< int > typeSet [3]
 
Pythia8::Event workEventJet
 

Additional Inherited Members

- Protected Types inherited from JetMatching
enum  partonTypes {
  ID_CHARM =4, ID_BOT =5, ID_TOP =6, ID_LEPMIN =11,
  ID_LEPMAX =16, ID_GLUON =21, ID_PHOTON =22
}
 
enum  vetoStatus {
  NONE, LESS_JETS, MORE_JETS, HARD_JET,
  UNMATCHED_PARTON
}
 
- Static Protected Attributes inherited from JetMatching
static const bool MATCHINGCHECK = false
 
static const bool MATCHINGDEBUG = false
 

Detailed Description

Definition at line 165 of file JetMatchingPy8Internal.h.

Constructor & Destructor Documentation

JetMatchingMadgraph::JetMatchingMadgraph ( )
inline

Definition at line 170 of file JetMatchingPy8Internal.h.

170 { }
JetMatchingMadgraph::~JetMatchingMadgraph ( )
inline

Definition at line 171 of file JetMatchingPy8Internal.h.

171 { }

Member Function Documentation

bool JetMatchingMadgraph::canVetoStep ( )
inline

Definition at line 178 of file JetMatchingPy8Internal.h.

References JetMatching::doShowerKt.

178 { return doShowerKt; }
void JetMatchingMadgraph::ClearDJR ( )
inlineprotected

Definition at line 199 of file JetMatchingPy8Internal.h.

References DJR.

Referenced by SetDJR().

199 { DJR.resize(0);}
void JetMatchingMadgraph::ClearnME ( )
inlineprotected

Definition at line 200 of file JetMatchingPy8Internal.h.

References nME.

Referenced by SetnME().

200 { nME.resize(0);}
bool JetMatchingMadgraph::doShowerKtVeto ( double  pTfirst)
protected

Definition at line 855 of file JetMatchingPy8Internal.cc.

References i, bookConverter::min, and funct::pow().

855  {
856 
857  // Only check veto in the shower-kT scheme.
858  if ( !doShowerKt ) return false;
859 
860  // Reset veto code
861  bool doVeto = false;
862 
863  // Find the (kinematical) pT of the softest (light) parton in the hard
864  // process.
865  int nParton = typeIdx[0].size();
866  double pTminME=1e10;
867  for ( int i = 0; i < nParton; ++i)
868  pTminME = min(pTminME,eventProcess[typeIdx[0][i]].pT());
869 
870  // Veto if the softest hard process parton is below Qcut.
871  if ( nParton > 0 && pow(pTminME,2) < qCutSq ) doVeto = true;
872 
873  // For non-highest multiplicity, veto if the hardest emission is harder
874  // than Qcut.
875  if ( exclusive && pow(pTfirst,2) > qCutSq ) {
876  doVeto = true;
877  // For highest multiplicity sample, veto if the hardest emission is harder
878  // than the hard process parton.
879  } else if ( !exclusive && nParton > 0 && pTfirst > pTminME ) {
880  doVeto = true;
881  }
882 
883  // Return veto
884  return doVeto;
885 
886 }
int i
Definition: DBlmapReader.cc:9
Pythia8::Event eventProcess
vector< int > typeIdx[3]
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
bool JetMatchingMadgraph::doVetoStep ( int  ,
int  ,
int  ,
const Pythia8::Event &   
)

Definition at line 799 of file JetMatchingPy8Internal.cc.

References i, and findQualityFiles::size.

800  {
801 
802  // Do not perform any veto if not in the Shower-kT scheme.
803  if ( !doShowerKt ) return false;
804 
805  // Default to no veto in case the hard input matrix element already has too
806  // many partons (same as in Pythia6).
807  if ( int(typeIdx[0].size()) > nJetMax ) return false;
808 
809  // Do nothing for emissions after the first one.
810  if ( nISR + nFSR > 1 ) return false;
811 
812  // Do nothing in resonance decay showers.
813  if (iPos == 5) return false;
814 
815  // Clear the event of MPI systems and resonace decay products. Store trimmed
816  // event in workEvent.
818 
819  // Get (kinematical) pT of first emission
820  double pTfirst = 0.;
821  for (int i = 0; i < workEvent.size(); i++){
822  // Since this event only contains one emission, this test is enough
823  // to isolate this emission.
824  if ( workEvent[i].isFinal()
825  && (workEvent[i].statusAbs()==43 || workEvent[i].statusAbs()==51)) {
826  // Only check partons originating from QCD splittings.
827  int iPos = 1;
828  bool QCDemission = true;
829  while ( workEvent[iPos].statusAbs() > 23 ) {
830  if ( workEvent[iPos].id() == 22 || workEvent[iPos].id() == 23
831  || workEvent[iPos].idAbs() == 24){
832  QCDemission = false;
833  break;
834  }
835  iPos = workEvent[iPos].mother1();
836  }
837  // Get kinematical pT.
838  if (QCDemission) {
839  pTfirst = workEvent[i].pT();
840  break;
841  }
842  }
843  }
844 
845  // Check veto.
846  if ( doShowerKtVeto(pTfirst) ) return true;
847 
848  // No veto if come this far.
849  return false;
850 
851 }
int i
Definition: DBlmapReader.cc:9
bool doShowerKtVeto(double pTfirst)
void sortIncomingProcess(const Pythia8::Event &)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
vector< int > typeIdx[3]
tuple size
Write out results.
vector<double> JetMatchingMadgraph::GetDJR ( )
inline

Definition at line 185 of file JetMatchingPy8Internal.h.

References DJR.

185 { return DJR;}
bool JetMatchingMadgraph::initAfterBeams ( )
virtual

Implements JetMatching.

Definition at line 662 of file JetMatchingPy8Internal.cc.

References gather_cfg::cout, MadgraphPar::getParam(), MadgraphPar::getParamAsInt(), MadgraphPar::haveParam(), NULL, MadgraphPar::parse(), funct::pow(), and MadgraphPar::printParams().

Referenced by JetMatchingMadgraphInputAlpgen::initAfterBeams().

662  {
663 
664  // Read in Madgraph specific configuration variables
665  bool setMad = settingsPtr->flag("JetMatching:setMad");
666 
667  // If Madgraph parameters are present, then parse in MadgraphPar object
668  MadgraphPar par(infoPtr);
669  string parStr = infoPtr->header("MGRunCard");
670  if (!parStr.empty()) {
671  par.parse(parStr);
672  par.printParams();
673  }
674 
675  // Set Madgraph merging parameters from the file if requested
676  if (setMad) {
677  if ( par.haveParam("xqcut") && par.haveParam("maxjetflavor")
678  && par.haveParam("alpsfact") && par.haveParam("ickkw") ) {
679  settingsPtr->flag("JetMatching:merge", par.getParam("ickkw"));
680  settingsPtr->parm("JetMatching:qCut", par.getParam("xqcut"));
681  settingsPtr->mode("JetMatching:nQmatch",
682  par.getParamAsInt("maxjetflavor"));
683  settingsPtr->parm("JetMatching:clFact",
684  clFact = par.getParam("alpsfact"));
685  if (par.getParamAsInt("ickkw") == 0)
686  infoPtr->errorMsg("Error in JetMatchingMadgraph:init: "
687  "Madgraph file parameters are not set for merging");
688 
689  // Warn if setMad requested, but one or more parameters not present
690  } else {
691  infoPtr->errorMsg("Warning in JetMatchingMadgraph:init: "
692  "Madgraph merging parameters not found");
693  if (!par.haveParam("xqcut")) infoPtr->errorMsg("Warning in "
694  "JetMatchingMadgraph:init: No xqcut");
695  if (!par.haveParam("ickkw")) infoPtr->errorMsg("Warning in "
696  "JetMatchingMadgraph:init: No ickkw");
697  if (!par.haveParam("maxjetflavor")) infoPtr->errorMsg("Warning in "
698  "JetMatchingMadgraph:init: No maxjetflavor");
699  if (!par.haveParam("alpsfact")) infoPtr->errorMsg("Warning in "
700  "JetMatchingMadgraph:init: No alpsfact");
701  }
702  }
703 
704  // Read in FxFx matching parameters
705  doFxFx = settingsPtr->flag("JetMatching:doFxFx");
706  nPartonsNow = settingsPtr->mode("JetMatching:nPartonsNow");
707  qCutME = settingsPtr->parm("JetMatching:qCutME");
708  qCutMESq = pow(qCutME,2);
709 
710  // Read in Madgraph merging parameters
711  doMerge = settingsPtr->flag("JetMatching:merge");
712  doShowerKt = settingsPtr->flag("JetMatching:doShowerKt");
713  qCut = settingsPtr->parm("JetMatching:qCut");
714  nQmatch = settingsPtr->mode("JetMatching:nQmatch");
715  clFact = settingsPtr->parm("JetMatching:clFact");
716 
717  // Read in jet algorithm parameters
718  jetAlgorithm = settingsPtr->mode("JetMatching:jetAlgorithm");
719  nJetMax = settingsPtr->mode("JetMatching:nJetMax");
720  eTjetMin = settingsPtr->parm("JetMatching:eTjetMin");
721  coneRadius = settingsPtr->parm("JetMatching:coneRadius");
722  etaJetMax = settingsPtr->parm("JetMatching:etaJetMax");
723  slowJetPower = settingsPtr->mode("JetMatching:slowJetPower");
724 
725  // Matching procedure
726  jetAllow = settingsPtr->mode("JetMatching:jetAllow");
727  exclusiveMode = settingsPtr->mode("JetMatching:exclusive");
728  qCutSq = pow(qCut,2);
730 
731  // If not merging, then done
732  if (!doMerge) return true;
733 
734  // Exclusive mode; if set to 2, then set based on nJet/nJetMax
735  if (exclusiveMode == 2) {
736 
737  // No nJet or nJetMax, so default to exclusive mode
738  if (nJetMax < 0) {
739  infoPtr->errorMsg("Warning in JetMatchingMadgraph:init: "
740  "missing jet multiplicity information; running in exclusive mode");
741  exclusiveMode = 1;
742  }
743  }
744 
745  // Initialise chosen jet algorithm.
746  // Currently, this only supports the kT-algorithm in SlowJet.
747  // Use the QCD distance measure by default.
748  jetAlgorithm = 2;
749  slowJetPower = 1;
750  slowJet = new SlowJet(slowJetPower, coneRadius, eTjetMin,
751  etaJetMaxAlgo, 2, 2, NULL, false);
752 
753  // For FxFx, also initialise jet algorithm to define matrix element jets.
754  // Currently, this only supports the kT-algorithm in SlowJet.
755  // Use the QCD distance measure by default.
756  slowJetHard = new SlowJet(slowJetPower, coneRadius, qCutME,
757  etaJetMaxAlgo, 2, 2, NULL, false);
758 
759  // To access the DJR's
760  slowJetDJR = new SlowJet(slowJetPower, coneRadius, 0.0/*qCutME*/,
761  etaJetMaxAlgo, 2, 2, NULL, false);
762 
763  // Setup local event records
764  eventProcessOrig.init("(eventProcessOrig)", particleDataPtr);
765  eventProcess.init("(eventProcess)", particleDataPtr);
766  workEventJet.init("(workEventJet)", particleDataPtr);
767 
768  // Print information
769  string jetStr = (jetAlgorithm == 1) ? "CellJet" :
770  (slowJetPower == -1) ? "anti-kT" :
771  (slowJetPower == 0) ? "C/A" :
772  (slowJetPower == 1) ? "kT" : "unknown";
773  string modeStr = (exclusiveMode) ? "exclusive" : "inclusive";
774  cout << endl
775  << " *----- Madgraph matching parameters -----*" << endl
776  << " | qCut | " << setw(14)
777  << qCut << " |" << endl
778  << " | nQmatch | " << setw(14)
779  << nQmatch << " |" << endl
780  << " | clFact | " << setw(14)
781  << clFact << " |" << endl
782  << " | Jet algorithm | " << setw(14)
783  << jetStr << " |" << endl
784  << " | eTjetMin | " << setw(14)
785  << eTjetMin << " |" << endl
786  << " | etaJetMax | " << setw(14)
787  << etaJetMax << " |" << endl
788  << " | jetAllow | " << setw(14)
789  << jetAllow << " |" << endl
790  << " | Mode | " << setw(14)
791  << modeStr << " |" << endl
792  << " *-----------------------------------------*" << endl;
793 
794  return true;
795 }
Pythia8::Event eventProcess
Pythia8::SlowJet * slowJetHard
Pythia8::Event workEventJet
Pythia8::SlowJet * slowJet
#define NULL
Definition: scimark2.h:8
Pythia8::Event eventProcessOrig
Pythia8::SlowJet * slowJetDJR
tuple cout
Definition: gather_cfg.py:121
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void JetMatchingMadgraph::jetAlgorithmInput ( const Pythia8::Event &  ,
int   
)
protectedvirtual

Implements JetMatching.

Definition at line 1038 of file JetMatchingPy8Internal.cc.

References end, spr::find(), i, and customizeTrackingMonitorSeedNumber::idx.

1038  {
1039 
1040  // Take input from 'workEvent' and put output in 'workEventJet'
1041  workEventJet = workEvent;
1042 
1043  // Loop over particles and decide what to pass to the jet algorithm
1044  for (int i = 0; i < workEventJet.size(); ++i) {
1045  if (!workEventJet[i].isFinal()) continue;
1046 
1047  // jetAllow option to disallow certain particle types
1048  if (jetAllow == 1) {
1049 
1050  // Original AG+Py6 algorithm explicitly excludes tops,
1051  // leptons and photons.
1052  int id = workEventJet[i].idAbs();
1053  if ((id >= ID_LEPMIN && id <= ID_LEPMAX) || id == ID_TOP
1054  || id == ID_PHOTON || (id > nQmatch && id!=21)) {
1055  workEventJet[i].statusNeg();
1056  continue;
1057  }
1058  }
1059 
1060  // Get the index of this particle in original event
1061  int idx = workEventJet[i].daughter1();
1062 
1063  // Start with particle idx, and afterwards track mothers
1064  while (true) {
1065 
1066  // Light jets
1067  if (iType == 0) {
1068 
1069  // Do not include if originates from heavy jet or 'other'
1070  if (typeSet[1].find(idx) != typeSet[1].end() ||
1071  typeSet[2].find(idx) != typeSet[2].end()) {
1072  workEventJet[i].statusNeg();
1073  break;
1074  }
1075 
1076  // Made it to start of event record so done
1077  if (idx == 0) break;
1078  // Otherwise next mother and continue
1079  idx = event[idx].mother1();
1080 
1081  // Heavy jets
1082  } else if (iType == 1) {
1083 
1084  // Only include if originates from heavy jet
1085  if (typeSet[1].find(idx) != typeSet[1].end()) break;
1086 
1087  // Made it to start of event record with no heavy jet mother,
1088  // so DO NOT include particle
1089  if (idx == 0) {
1090  workEventJet[i].statusNeg();
1091  break;
1092  }
1093 
1094  // Otherwise next mother and continue
1095  idx = event[idx].mother1();
1096 
1097  } // if (iType)
1098  } // while (true)
1099  } // for (i)
1100 }
int i
Definition: DBlmapReader.cc:9
Pythia8::Event workEventJet
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
#define end
Definition: vmac.h:37
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
set< int > typeSet[3]
bool JetMatchingMadgraph::matchPartonsToJets ( int  iType)
protectedvirtual

Implements JetMatching.

Definition at line 1114 of file JetMatchingPy8Internal.cc.

1114  {
1115 
1116  // Use two different routines for light/heavy jets as
1117  // different veto conditions and for clarity
1118  if (iType == 0) {
1120  SetnME();
1121  return (matchPartonsToJetsLight() > 0);
1122  }
1123  else return (matchPartonsToJetsHeavy() > 0);
1124 }
Pythia8::Event workEventJet
void SetDJR(const Pythia8::Event &event)
int JetMatchingMadgraph::matchPartonsToJetsHeavy ( )
protectedvirtual

Implements JetMatching.

Definition at line 1376 of file JetMatchingPy8Internal.cc.

References NONE.

1376  {
1377 
1378  // Currently, heavy jets are unmatched
1379  // If there are no extra jets, then accept
1380  if (jetMomenta.empty()) return NONE;
1381 
1382  // No extra jets were present so no veto
1383  return NONE;
1384 }
vector< Pythia8::Vec4 > jetMomenta
int JetMatchingMadgraph::matchPartonsToJetsLight ( )
protectedvirtual

Implements JetMatching.

Definition at line 1139 of file JetMatchingPy8Internal.cc.

References alignCSCRings::e, i, max(), NONE, findQualityFiles::size, and python.multivaluedict::sort().

1139  {
1140 
1141  // Count the number of hard partons
1142  int nParton = typeIdx[0].size();
1143  if((int)origTypeIdx[0].size()>nJetMax)return 1;
1144 
1145  // Initialize SlowJet with current working event
1146  if (!slowJet->setup(workEventJet) ) {
1147  infoPtr->errorMsg("Warning in JetMatchingMadgraph:matchPartonsToJets"
1148  "Light: the SlowJet algorithm failed on setup");
1149  return NONE;
1150  }
1151  double localQcutSq = qCutSq;
1152  double dOld = 0.0;
1153  // Cluster in steps to find all hadronic jets at the scale qCut
1154  while ( slowJet->sizeAll() - slowJet->sizeJet() > 0 ) {
1155  if( slowJet->dNext() > localQcutSq ) break;
1156  dOld = slowJet->dNext();
1157  slowJet->doStep();
1158  }
1159  int nJets = slowJet->sizeJet();
1160  int nClus = slowJet->sizeAll();
1161 
1162  // Debug printout.
1163  if (MATCHINGDEBUG) slowJet->list(true);
1164 
1165  // Count of the number of hadronic jets in SlowJet accounting
1166  int nCLjets = nClus - nJets;
1167  // Get number of partons. Different for MLM and FxFx schemes.
1168  int nRequested = (doFxFx) ? nPartonsNow : nParton;
1169 
1170  // Veto event if too few hadronic jets
1171  if ( nCLjets < nRequested ) return LESS_JETS;
1172 
1173  // In exclusive mode, do not allow more hadronic jets than partons
1174  if ( exclusive && !doFxFx ) {
1175  if ( nCLjets > nRequested ) return MORE_JETS;
1176  } else {
1177 
1178  // For FxFx, in the non-highest multipicity, all jets need to matched to
1179  // partons. For nCLjets > nRequested, this is not possible. Hence, we can
1180  // veto here already.
1181  if ( doFxFx && nRequested < nJetMax && nCLjets > nRequested )
1182  return MORE_JETS;
1183 
1184  // Now continue in inclusive mode.
1185  // In inclusive mode, there can be more hadronic jets than partons,
1186  // provided that all partons are properly matched to hadronic jets.
1187  // Start by setting up the jet algorithm.
1188  if (!slowJet->setup(workEventJet) ) {
1189  infoPtr->errorMsg("Warning in JetMatchingMadgraph:matchPartonsToJets"
1190  "Light: the SlowJet algorithm failed on setup");
1191  return NONE;
1192  }
1193 
1194  // For FxFx, continue clustering as long as the jet separation is above
1195  // qCut.
1196  if (doFxFx) {
1197  while ( slowJet->sizeAll() - slowJet->sizeJet() > 0 ) {
1198  if( slowJet->dNext() > localQcutSq ) break;
1199  slowJet->doStep();
1200  }
1201  // For MLM, cluster into hadronic jets until there are the same number as
1202  // partons.
1203  } else {
1204  while ( slowJet->sizeAll() - slowJet->sizeJet() > nParton )
1205  slowJet->doStep();
1206  }
1207 
1208  // Sort partons in pT. Update local qCut value.
1209  // Hadronic jets are already sorted in pT.
1210  localQcutSq = dOld;
1211  if ( clFact >= 0. && nParton > 0 ) {
1212  vector<double> partonPt;
1213  for (int i = 0; i < nParton; ++i)
1214  partonPt.push_back( eventProcess[typeIdx[0][i]].pT2() );
1215  sort( partonPt.begin(), partonPt.end());
1216  localQcutSq = max( qCutSq, partonPt[0]);
1217  }
1218  nJets = slowJet->sizeJet();
1219  nClus = slowJet->sizeAll();
1220  }
1221  // Update scale if clustering factor is non-zero
1222  if ( clFact != 0. ) localQcutSq *= pow2(clFact);
1223 
1224  Event tempEvent;
1225  tempEvent.init( "(tempEvent)", particleDataPtr);
1226  int nPass = 0;
1227  double pTminEstimate = -1.;
1228  // Construct a master copy of the event containing only the
1229  // hardest nParton hadronic clusters. While constructing the event,
1230  // the parton type (ID_GLUON) and status (98,99) are arbitrary.
1231  for (int i = nJets; i < nClus; ++i) {
1232  tempEvent.append( ID_GLUON, 98, 0, 0, 0, 0, 0, 0, slowJet->p(i).px(),
1233  slowJet->p(i).py(), slowJet->p(i).pz(), slowJet->p(i).e() );
1234  ++nPass;
1235  pTminEstimate = max( pTminEstimate, slowJet->pT(i));
1236  if(nPass == nRequested) break;
1237  }
1238 
1239  int tempSize = tempEvent.size();
1240  // This keeps track of which hadronic jets are matched to parton
1241  vector<bool> jetAssigned;
1242  jetAssigned.assign( tempSize, false);
1243 
1244  // This keeps track of which partons are matched to which hadronic
1245  // jets.
1246  vector< vector<bool> > partonMatchesJet;
1247  for (int i=0; i < nParton; ++i )
1248  partonMatchesJet.push_back( vector<bool>(tempEvent.size(),false) );
1249 
1250  // Begin matching.
1251  // Do jet matching for FxFx.
1252  // Make sure that the nPartonsNow hardest hadronic jets are matched to any
1253  // of the nPartonsNow (+1) partons. This matching is done by attaching a jet
1254  // from the list of unmatched hadronic jets, and appending a jet from the
1255  // list of partonic jets, one at a time. The partonic jet will be clustered
1256  // with the hadronic jet or the beam if the distance measure is below the
1257  // cut. The hadronic jet is matched once this happens. Otherwise, another
1258  // partonic jet is tried. When a hadronic jet is matched to a partonic jet,
1259  // it is removed from the list of unmatched hadronic jets. This process
1260  // continues until the nPartonsNow hardest hadronic jets are matched to
1261  // partonic jets, or it is not possible to make a match for a hadronic jet.
1262  int iNow = 0;
1263  while ( doFxFx && iNow < tempSize ) {
1264 
1265  // Check if this shower jet matches any partonic jet.
1266  Event tempEventJet;
1267  tempEventJet.init("(tempEventJet)", particleDataPtr);
1268  for (int i=0; i < nParton; ++i ) {
1269 
1271  //for (int j=0; j < tempSize; ++j )
1272  // if ( partonMatchesJet[i][j]) continue;
1273 
1274  // Attach a single hadronic jet.
1275  tempEventJet.clear();
1276  tempEventJet.append( ID_GLUON, 98, 0, 0, 0, 0, 0, 0,
1277  tempEvent[iNow].px(), tempEvent[iNow].py(),
1278  tempEvent[iNow].pz(), tempEvent[iNow].e() );
1279  // Attach the current parton.
1280  Vec4 pIn = eventProcess[typeIdx[0][i]].p();
1281  tempEventJet.append( ID_GLUON, 99, 0, 0, 0, 0, 0, 0,
1282  pIn.px(), pIn.py(), pIn.pz(), pIn.e() );
1283 
1284  // Setup jet algorithm.
1285  if ( !slowJet->setup(tempEventJet) ) {
1286  infoPtr->errorMsg("Warning in JetMatchingMadgraph:matchPartonsToJets"
1287  "Light: the SlowJet algorithm failed on setup");
1288  return NONE;
1289  }
1290 
1291  // These are the conditions for the hadronic jet to match the parton
1292  // at the local qCut scale
1293  if ( slowJet->iNext() == tempEventJet.size() - 1
1294  && slowJet->jNext() > -1 && slowJet->dNext() < localQcutSq ) {
1295  jetAssigned[iNow] = true;
1296  partonMatchesJet[i][iNow] = true;
1297  }
1298 
1299  } // End loop over hard partons.
1300 
1301  // Veto if the jet could not be assigned to any parton.
1302  if ( !jetAssigned[iNow] ) return UNMATCHED_PARTON;
1303 
1304  // Continue;
1305  ++iNow;
1306  }
1307 
1308  // Do jet matching for MLM.
1309  // Take the list of unmatched hadronic jets and append a parton, one at
1310  // a time. The parton will be clustered with the "closest" hadronic jet
1311  // or the beam if the distance measure is below the cut. When a hadronic
1312  // jet is matched to a parton, it is removed from the list of unmatched
1313  // hadronic jets. This process continues until all hadronic jets are
1314  // matched to partons or it is not possible to make a match.
1315  iNow = 0;
1316  while (!doFxFx && iNow < nParton ) {
1317  Event tempEventJet;
1318  tempEventJet.init("(tempEventJet)", particleDataPtr);
1319  for (int i = 0; i < tempSize; ++i) {
1320  if (jetAssigned[i]) continue;
1321  Vec4 pIn = tempEvent[i].p();
1322  // Append unmatched hadronic jets
1323  tempEventJet.append( ID_GLUON, 98, 0, 0, 0, 0, 0, 0,
1324  pIn.px(), pIn.py(), pIn.pz(), pIn.e() );
1325  }
1326 
1327  Vec4 pIn = eventProcess[typeIdx[0][iNow]].p();
1328  // Append the current parton
1329  tempEventJet.append( ID_GLUON, 99, 0, 0, 0, 0, 0, 0,
1330  pIn.px(), pIn.py(), pIn.pz(), pIn.e() );
1331  if ( !slowJet->setup(tempEventJet) ) {
1332  infoPtr->errorMsg("Warning in JetMatchingMadgraph:matchPartonsToJets"
1333  "Light: the SlowJet algorithm failed on setup");
1334  return NONE;
1335  }
1336  // These are the conditions for the hadronic jet to match the parton
1337  // at the local qCut scale
1338  if ( slowJet->iNext() == tempEventJet.size() - 1
1339  && slowJet->jNext() > -1 && slowJet->dNext() < localQcutSq ) {
1340  int iKnt = -1;
1341  for (int i = 0; i != tempSize; ++i) {
1342  if (jetAssigned[i]) continue;
1343  ++iKnt;
1344  // Identify the hadronic jet that matches the parton
1345  if (iKnt == slowJet->jNext() ) jetAssigned[i] = true;
1346  }
1347  } else {
1348  return UNMATCHED_PARTON;
1349  }
1350  ++iNow;
1351  }
1352 
1353  // Minimal eT/pT (CellJet/SlowJet) of matched light jets.
1354  // Needed later for heavy jet vetos in inclusive mode.
1355  // This information is not used currently.
1356  if (nParton > 0 && pTminEstimate > 0) eTpTlightMin = pTminEstimate;
1357  else eTpTlightMin = -1.;
1358 
1359  //SetDJR(workEventJet);
1360  //SetnME();
1361  // No veto
1362  //std::cout<<"No VETO"<<std::endl;
1363  return NONE;
1364 }
int i
Definition: DBlmapReader.cc:9
Pythia8::Event eventProcess
Pythia8::Event workEventJet
ExtVec< T, 4 > Vec4
Definition: ExtVec.h:23
Pythia8::SlowJet * slowJet
const T & max(const T &a, const T &b)
vector< int > origTypeIdx[3]
vector< int > typeIdx[3]
static const bool MATCHINGDEBUG
tuple size
Write out results.
vector<int> JetMatchingMadgraph::nMEPartons ( )
inline

Definition at line 186 of file JetMatchingPy8Internal.h.

References nME.

186 {return nME;}
int JetMatchingMadgraph::numberVetoStep ( )
inline

Definition at line 177 of file JetMatchingPy8Internal.h.

177 {return 1;}
void JetMatchingMadgraph::runJetAlgorithm ( )
protectedvirtual

Implements JetMatching.

Definition at line 1108 of file JetMatchingPy8Internal.cc.

1108 {; }
void JetMatchingMadgraph::SetDJR ( const Pythia8::Event &  event)
inlineprotected

Definition at line 202 of file JetMatchingPy8Internal.h.

References ClearDJR(), DJR, i, query::result, slowJetDJR, and mathSSE::sqrt().

202  {
203 
204  // Clear members.
205  ClearDJR();
206 
207  vector<double> result;
208 
209  // Initialize SlowJetDJR jet algorithm with event
210  if (!slowJetDJR->setup(event) ) {
211  infoPtr->errorMsg("Warning in JetMatchingMadgraph:iGetDJR"
212  ": the SlowJet algorithm failed on setup");
213  return;
214  }
215 
216  // Cluster in steps to find all hadronic jets
217  while ( slowJetDJR->sizeAll() - slowJetDJR->sizeJet() > 0 ) {
218  // Save the next clustering scale.
219  result.push_back(slowJetDJR->dNext());
220  // Perform step.
221  slowJetDJR->doStep();
222  }
223 
224  // Save clustering scales in reserve order.
225  for (int i=int(result.size())-1; i > 0; --i){
226 // std::cout<<"Saving DJR "<<i<<" "<<log10(sqrt(result[i]))<<std::endl;
227  DJR.push_back(log10(sqrt(result[i])));
228  }
229  }
int i
Definition: DBlmapReader.cc:9
Pythia8::SlowJet * slowJetDJR
T sqrt(T t)
Definition: SSEVec.h:48
tuple result
Definition: query.py:137
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void JetMatchingMadgraph::SetnME ( )
inlineprotected

Definition at line 230 of file JetMatchingPy8Internal.h.

References ClearnME(), nME, origTypeIdx, query::result, findQualityFiles::size, and JetMatching::typeIdx.

230  {
231  ClearnME();
232  vector<int> result;
233  nME.push_back(origTypeIdx[0].size());
234  nME.push_back(typeIdx[0].size());
235  //std::cout<<"Number of partons "<<origTypeIdx[0].size()<<" "<<typeIdx[0].size()<<std::endl;
236  }
tuple result
Definition: query.py:137
vector< int > origTypeIdx[3]
vector< int > typeIdx[3]
tuple size
Write out results.
void JetMatchingMadgraph::sortIncomingProcess ( const Pythia8::Event &  )
protectedvirtual

Implements JetMatching.

Definition at line 892 of file JetMatchingPy8Internal.cc.

References reco::flavour(), i, customizeTrackingMonitorSeedNumber::idx, j, contentValuesFiles::parts, pileupReCalc_HLTpaths::scale, and mathSSE::sqrt().

892  {
893 
894  // Remove resonance decays from original process and keep only final
895  // state. Resonances will have positive status code after this step.
896  omitResonanceDecays(eventProcessOrig, true);
897 
898  ClearDJR();
899  ClearnME();
900 
901  // For FxFx, pre-cluster partons in the event into jets.
902  if (doFxFx) {
903 
904  // Get final state partons
905  eventProcess.clear();
906  workEventJet.clear();
907  for( int i=0; i < workEvent.size(); ++i) {
908  // Original AG+Py6 algorithm explicitly excludes tops,
909  // leptons and photons.
910  int id = workEvent[i].idAbs();
911  if ((id >= ID_LEPMIN && id <= ID_LEPMAX) || id == ID_TOP
912  || id == ID_PHOTON || id == 23 || id == 24 || id == 25) {
913  eventProcess.append(workEvent[i]);
914  } else {
915  workEventJet.append(workEvent[i]);
916  }
917  }
918 
919  // Initialize SlowJetHard jet algorithm with current working event
920  if (!slowJetHard->setup(workEventJet) ) {
921  infoPtr->errorMsg("Warning in JetMatchingMadgraph:sortIncomingProcess"
922  ": the SlowJet algorithm failed on setup");
923  return;
924  }
925 
926  // Get matrix element cut scale.
927  double localQcutSq = qCutMESq;
928  // Cluster in steps to find all hadronic jets at the scale qCutME
929  while ( slowJetHard->sizeAll() - slowJetHard->sizeJet() > 0 ) {
930  // Done if next step is above qCut
931  if( slowJetHard->dNext() > localQcutSq ) break;
932  // Done if we're at or below the number of partons in the Born state.
933  if( slowJetHard->sizeAll()-slowJetHard->sizeJet() <= nPartonsNow) break;
934  slowJetHard->doStep();
935  }
936 
937  // Construct a master copy of the event containing only the
938  // hardest nPartonsNow hadronic clusters. While constructing the event,
939  // the parton type (ID_GLUON) and status (98,99) are arbitrary.
940  int nJets = slowJetHard->sizeJet();
941  int nClus = slowJetHard->sizeAll();
942  int nNow = 0;
943  for (int i = nJets; i < nClus; ++i) {
944  vector<int> parts;
945  if (i < nClus-nJets) parts = slowJetHard->clusConstituents(i);
946  else parts = slowJetHard->constituents(nClus-nJets-i);
947  int flavour = ID_GLUON;
948  for(int j=0; j < int(parts.size()); ++j)
949  if (workEventJet[parts[j]].id() == ID_BOT)
950  flavour = ID_BOT;
951  eventProcess.append( flavour, 98,
952  workEventJet[parts.back()].mother1(),
953  workEventJet[parts.back()].mother2(),
954  workEventJet[parts.back()].daughter1(),
955  workEventJet[parts.back()].daughter2(),
956  0, 0, slowJetHard->p(i).px(), slowJetHard->p(i).py(),
957  slowJetHard->p(i).pz(), slowJetHard->p(i).e() );
958  nNow++;
959  }
960 
961  // Done. Clean-up
962  workEventJet.clear();
963 
964  // For MLM matching, simply take hard process state from workEvent,
965  // without any preclustering.
966  } else {
967  eventProcess = workEvent;
968  }
969 
970  // Sort original process final state into light/heavy jets and 'other'.
971  // Criteria:
972  // 1 <= ID <= nQmatch, or ID == 21 --> light jet (typeIdx[0])
973  // nQMatch < ID --> heavy jet (typeIdx[1])
974  // All else --> other (typeIdx[2])
975  // Note that 'typeIdx' stores indices into 'eventProcess' (after resonance
976  // decays are omitted), while 'typeSet' stores indices into the original
977  // process record, 'eventProcessOrig', but these indices are also valid
978  // in 'event'.
979  for (int i = 0; i < 3; i++) {
980  typeIdx[i].clear();
981  typeSet[i].clear();
982  origTypeIdx[i].clear();
983  }
984  for (int i = 0; i < eventProcess.size(); i++) {
985  // Ignore non-final state and default to 'other'
986  if (!eventProcess[i].isFinal()) continue;
987  int idx = 2;
988  int orig_idx = 2;
989 
990  // Light jets: all gluons and quarks with id less than or equal to nQmatch
991  if (eventProcess[i].id() == ID_GLUON
992  || (eventProcess[i].idAbs() <= nQmatch) ) {
993  orig_idx = 0;
994  // Crucial point: MG puts the scale of a non-QCD particle to eCM. For
995  // such particles, we should keep the default "2"
996  if ( eventProcess[i].scale() < 1.999*sqrt(infoPtr->eA()*infoPtr->eB()) )
997  idx = 0;
998  }
999 
1000  // Heavy jets: all quarks with id greater than nQmatch
1001  else if (eventProcess[i].idAbs() > nQmatch
1002  && eventProcess[i].idAbs() <= ID_TOP) {
1003  idx = 1;
1004  orig_idx = 1;
1005 
1006  } else {
1007  idx = 2;
1008  orig_idx = 2;
1009  }
1010 
1011  // Store
1012  typeIdx[idx].push_back(i);
1013  typeSet[idx].insert(eventProcess[i].daughter1());
1014  origTypeIdx[orig_idx].push_back(i);
1015  }
1016 
1017  // Exclusive mode; if set to 2, then set based on nJet/nJetMax
1018  if (exclusiveMode == 2) {
1019 
1020  // Inclusive if nJet == nJetMax, exclusive otherwise
1021  int nParton = origTypeIdx[0].size();
1022  exclusive = (nParton == nJetMax) ? false : true;
1023 
1024  // Otherwise, just set as given
1025  } else {
1026  exclusive = (exclusiveMode == 0) ? false : true;
1027  }
1028 
1029  // Extract partons from hardest subsystem + ISR + FSR only into
1030  // workEvent. Note no resonance showers or MPIs.
1031  subEvent(event);
1032 }
int i
Definition: DBlmapReader.cc:9
Pythia8::Event eventProcess
Pythia8::SlowJet * slowJetHard
Pythia8::Event workEventJet
Pythia8::Event eventProcessOrig
T sqrt(T t)
Definition: SSEVec.h:48
int j
Definition: DBlmapReader.cc:9
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
vector< int > origTypeIdx[3]
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
set< int > typeSet[3]
vector< int > typeIdx[3]
int flavour(const Candidate &part)
Definition: pdgIdUtils.h:31

Member Data Documentation

double JetMatchingMadgraph::clFact
protected

Definition at line 241 of file JetMatchingPy8Internal.h.

vector<double> JetMatchingMadgraph::DJR
protected

Definition at line 247 of file JetMatchingPy8Internal.h.

Referenced by ClearDJR(), GetDJR(), and SetDJR().

bool JetMatchingMadgraph::doFxFx
protected

Definition at line 242 of file JetMatchingPy8Internal.h.

vector<int> JetMatchingMadgraph::nME
protected

Definition at line 248 of file JetMatchingPy8Internal.h.

Referenced by ClearnME(), nMEPartons(), and SetnME().

int JetMatchingMadgraph::nPartonsNow
protected

Definition at line 243 of file JetMatchingPy8Internal.h.

int JetMatchingMadgraph::nQmatch
protected

Definition at line 240 of file JetMatchingPy8Internal.h.

vector<int> JetMatchingMadgraph::origTypeIdx[3]
protected

Definition at line 239 of file JetMatchingPy8Internal.h.

Referenced by SetnME().

double JetMatchingMadgraph::qCut
protected

Definition at line 241 of file JetMatchingPy8Internal.h.

double JetMatchingMadgraph::qCutME
protected

Definition at line 244 of file JetMatchingPy8Internal.h.

double JetMatchingMadgraph::qCutMESq
protected

Definition at line 244 of file JetMatchingPy8Internal.h.

double JetMatchingMadgraph::qCutSq
protected

Definition at line 241 of file JetMatchingPy8Internal.h.

Pythia8::SlowJet* JetMatchingMadgraph::slowJetDJR

Definition at line 183 of file JetMatchingPy8Internal.h.

Referenced by SetDJR().