Skip to content

Instantly share code, notes, and snippets.

@gordonwatts
Last active January 3, 2016 05:29
Show Gist options
  • Save gordonwatts/8415590 to your computer and use it in GitHub Desktop.
Save gordonwatts/8415590 to your computer and use it in GitHub Desktop.
These two queries should produce identical code. They do not, one produces blank guys, the other produces a good plot. Note the difference is only in the Tuple.Create guy being used.
if ((((*this).MET_RefFinal)/1000.0)<50.0)
{
map<double, vector<int> > aDictionary_2_945Map;
int aInt32_950=0;
bool aBoolean_951=false;
int aInt32_973=0;
bool aBoolean_974=false;
int aInt32_944 = (*(*this).AntiKt4TopoEMJets_Calibscale).size();
for (int aInt32_943=0; aInt32_943 < aInt32_944; aInt32_943++)
{
TLorentzVector* aNTLorentzVector_946;
TLorentzVector tlz138;
tlz138.SetPxPyPzE((((*(*this).AntiKt4TopoEMJets_Calibpx).at(aInt32_943))/1000.0), (((*(*this).AntiKt4TopoEMJets_Calibpy).at(aInt32_943))/1000.0), (((*(*this).AntiKt4TopoEMJets_Calibpz).at(aInt32_943))/1000.0), (((*(*this).AntiKt4TopoEMJets_CalibE).at(aInt32_943))/1000.0));
aNTLorentzVector_946 = &tlz138;
double aDouble_947=(*aNTLorentzVector_946).Pt();
aDictionary_2_945Map[aDouble_947].push_back(aInt32_943);
}
vector<double> aDouble___948;
for(map<double, vector<int> >::const_iterator i_itr = aDictionary_2_945Map.begin(); i_itr != aDictionary_2_945Map.end(); i_itr++) {
aDouble___948.push_back(i_itr->first);
}
sort(aDouble___948.begin(), aDouble___948.end());
for (int i_index = aDouble___948.size()-1; i_index >= 0; i_index--) {
const vector<int> &sublist0(aDictionary_2_945Map[aDouble___948.at(i_index)]);
for (int i_sindex = 0; i_sindex < sublist0.size(); i_sindex++) {
const int aInt32_949 = sublist0.at(i_sindex);
{
aInt32_950++;
if (aInt32_950 > 1)
{
if (!aBoolean_951) {
aBoolean_951 = true;
}
}
}
}
}
// BUG: this should be 951. And lower down it is 951. So this is a code combination
// bug??
if (aBoolean_974)
{
map<double, vector<int> > aDictionary_2_979Map;
var goodEvents = events
.Where(EDMCuts.DefaultDataEventCuts);
var jetPairs = from e in goodEvents
let alljets = e.Jets.Select(j => DataBuilder.jetMaker.Invoke(j))
let sorted = alljets.OrderByDescending(j => j.c.Pt())
where sorted.Skip(1).Any()
select Tuple.Create(sorted.First(), sorted.Skip(1).First());
SetIgnoreQuery(true);
jetPairs
.Select(p => p.Item1)
.FuturePlot(EDMPlotSpec.SpPtPlot, "AllFirstJets")
.Save(output);
SetIgnoreQuery(false);
var jetPairs2 = from e in goodEvents
let alljets = e.Jets.Select(j => DataBuilder.jetMaker.Invoke(j))
let sorted = alljets.OrderByDescending(j => j.c.Pt())
where sorted.Skip(1).Any()
select sorted.First();
SetIgnoreQuery(true);
jetPairs2
.FuturePlot(EDMPlotSpec.SpPtPlot, "AllPairFirstJets")
.Save(output);
SetIgnoreQuery(false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment