Skip to content

Commit

Permalink
All kinds of stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannu Siikonen committed Jun 14, 2017
1 parent c3fadec commit a819ad4
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 21 deletions.
1 change: 0 additions & 1 deletion IOV.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ namespace jec {

vector<JetCorrectorParameters> vpar;

cout << "Fuuga!" << endl;
// L1FastJet for AK*PF, L1Offset for others
s = Form("%s%sL1FastJet_%s.txt",p,t,a);
if (access(s, F_OK)==-1) {
Expand Down
10 changes: 10 additions & 0 deletions etaHistos.C
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,28 @@ etaHistos::etaHistos(TDirectory *dir, string trigname) {
hdjasymmtp.push_back(new TH3D((string("hdjasymmtp_a")+number).c_str(),
";p_{T,tag};#eta;Asymmetry",
npts,&ptrange[0],netas,&etarange[0],na,&va[0]) );
hdjasymmpt.push_back(new TH3D((string("hdjasymmpt_a")+number).c_str(),
";p_{T,probe};#eta;Asymmetry",
npts,&ptrange[0],netas,&etarange[0],na,&va[0]) );
hdjmpf.push_back( new TH3D((string("hdjmpf_a")+number).c_str(),
";p_{T,ave};#eta;MPF",
npts,&ptrange[0],netas,&etarange[0],na,&va[0]) );
hdjmpftp.push_back( new TH3D((string("hdjmpftp_a")+number).c_str(),
";p_{T,tag};#eta;MPF",
npts,&ptrange[0],netas,&etarange[0],na,&va[0]) );
hdjmpfpt.push_back( new TH3D((string("hdjmpfpt_a")+number).c_str(),
";p_{T,probe};#eta;MPF",
npts,&ptrange[0],netas,&etarange[0],na,&va[0]) );
}

// Weights:
for (unsigned i = 0; i < alpharange.size(); ++i) {
hdjasymm[i]->Sumw2();
hdjasymmtp[i]->Sumw2();
hdjasymmpt[i]->Sumw2();
hdjmpf[i]->Sumw2();
hdjmpftp[i]->Sumw2();
hdjmpfpt[i]->Sumw2();
}

curdir->cd();
Expand All @@ -82,8 +90,10 @@ etaHistos::~etaHistos() {
for (unsigned i = 0; i < alpharange.size(); ++i) {
delete hdjasymm[i];
delete hdjasymmtp[i];
delete hdjasymmpt[i];
delete hdjmpf[i];
delete hdjmpftp[i];
delete hdjmpfpt[i];
}
delete dir;
};
3 changes: 3 additions & 0 deletions etaHistos.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ class etaHistos {
string trigname;

// Control plots of resolutions in the pt-eta plane
// tp: tag-probe (tag), pt: probe-tag (probe)
vector<TH3D *> hdjasymm;
vector<TH3D *> hdjasymmtp;
vector<TH3D *> hdjasymmpt;
vector<TH3D *> hdjmpf;
vector<TH3D *> hdjmpftp;
vector<TH3D *> hdjmpfpt;

const vector<float> alpharange = {0.05,0.10,0.15,0.20,0.25,0.30};

Expand Down
65 changes: 46 additions & 19 deletions fillHistos.C
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,12 @@ void fillHistos::Loop()

if (_jp_doEtaHistos) {
initEtas("FullEta_Reco");
if (_jp_ismc && _jp_doEtaHistosMcResponse) {
if (_jp_ismc) {
initEtas("FullEta_Gen");
initMcHistos("FullEta_RecoPerGen_vReco");
initMcHistos("FullEta_RecoPerGen_vGen");
if (_jp_doEtaHistosMcResponse) {
initMcHistos("FullEta_RecoPerGen_vReco");
initMcHistos("FullEta_RecoPerGen_vGen");
}
}
}

Expand All @@ -306,6 +308,13 @@ void fillHistos::Loop()
initRunHistos("RunsEndcap",2.,3.);
}

if (_jp_etaphiexcl) {
fetaphiexcl = new TFile("hotjets.root","READ");
assert(fetaphiexcl && !fetaphiexcl->IsZombie() && "file hotjets.root missing");
h2etaphiexcl = (TH2D*)fetaphiexcl->Get(_jp_etaphitype.c_str());
assert(h2etaphiexcl && "erroneous eta-phi exclusion type");
}

// Report memory usage to avoid malloc problems when writing file
*ferr << "Beginning Loop() proper:" << endl << flush;
cout << "Beginning Loop() proper:" << endl << flush;
Expand Down Expand Up @@ -1569,7 +1578,15 @@ void fillHistos::fillBasic(basicHistos *h)
h->hyeta->Fill(TMath::Sign(y-eta,y), _w);
h->hyeta2->Fill(y-eta, _w);
h->hbetabetastar->Fill(jtbeta[i], jtbetastar[i], _w);
h->hetaphi->Fill(eta, phi, _w);
if (_jp_etaphiexcl) {
// Val 10 = excluded, -10 = ok
if (h2etaphiexcl->GetBinContent(h2etaphiexcl->FindBin(eta,phi)) < 0)
h->hetaphi->Fill(eta, phi, _w);
else if (_debug)
cout << "Excluded " << eta << " " << phi << endl;
} else {
h->hetaphi->Fill(eta, phi, _w);
}
} // within trigger pT range

int iprobe = i;
Expand Down Expand Up @@ -1901,32 +1918,42 @@ void fillHistos::fillEta(etaHistos *h, Float_t* _pt, Float_t* _eta, Float_t* _ph
// Calculate and fill dijet balance histograms
if (njt>=2 && _evtid && delta_phi(_phi[0],_phi[1])>2.8
&& _jetids[0] && _jetids[1] && _pt[0]>_jp_recopt && _pt[1]>_jp_recopt) {
if (_jp_etaphiexcl) {
// Abort if one of the leading jets is in a difficult zone
bool good0 = h2etaphiexcl->GetBinContent(h2etaphiexcl->FindBin(_eta[0],_phi[0])) < 0;
bool good1 = h2etaphiexcl->GetBinContent(h2etaphiexcl->FindBin(_eta[1],_phi[1])) < 0;
if (!good0 or !good1)
return;
}
// Two leading jets
for (int iref = 0; iref<2; ++iref) {
int iprobe = (iref==0 ? 1 : 0);
double etaref = _eta[iref];
for (int itag = 0; itag<2; ++itag) {
int iprobe = (itag==0 ? 1 : 0);
double etatag = _eta[itag];
double etaprobe = _eta[iprobe];

if (fabs(etaref) < 1.3) {
double ptref = _pt[iref];
if (fabs(etatag) < 1.3) {
double pttag = _pt[itag];
double ptprobe = _pt[iprobe];
double pt3 = (njt>2 ? _pt[2] : 0.);
double ptave = 0.5 * (ptref + ptprobe); assert(ptave);
double ptave = 0.5 * (pttag + ptprobe); assert(ptave);
double alpha = pt3/ptave;
double alphatp = pt3/ptref;
double asymm = (ptprobe - ptref)/(2*ptave);
double asymmtp = (ptprobe - ptref)/(2*ptref);
double mpf = met2*cos(delta_phi(metphi2,_phi[iref]))/ptave;
double mpftp = met2*cos(delta_phi(metphi2,_phi[iref]))/ptref;
//double alphatp = pt3/pttag;
double asymm = (ptprobe - pttag)/(2*ptave);
//double asymmtp = (ptprobe - pttag)/(2*pttag);
double mpf = met2*cos(delta_phi(metphi2,_phi[itag]))/ptave;
//double mpftp = met2*cos(delta_phi(metphi2,_phi[itag]))/pttag;
for (unsigned i = 0; i < h->alpharange.size(); ++i) {
float alphasel = h->alpharange[i];
if (alphatp<alphasel) {
h->hdjasymmtp[i]->Fill(ptref, etaprobe, asymmtp, _w);
h->hdjmpftp[i] ->Fill(ptref, etaprobe, mpftp , _w);
}
//if (alphatp<alphasel) {
//}
if (alpha<alphasel) {
// Val 10 = excluded, -10 = ok
h->hdjasymm[i]->Fill(ptave, etaprobe, asymm, _w);
h->hdjmpf[i] ->Fill(ptave, etaprobe, mpf , _w);
h->hdjasymmtp[i]->Fill(pttag, etaprobe, asymm, _w);
h->hdjmpftp[i] ->Fill(pttag, etaprobe, mpf , _w);
h->hdjasymmpt[i]->Fill(ptprobe, etaprobe, asymm, _w);
h->hdjmpfpt[i] ->Fill(ptprobe, etaprobe, mpf , _w);
}
}
} // etatag < 1.3
Expand Down
2 changes: 2 additions & 0 deletions fillHistos.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ public :
map<string, vector<mcHistos*> > _mchistos;
map<string, runHistos*> _runhistos;
TH1D *hmcweight;
TH2D *h2etaphiexcl;
TFile *fetaphiexcl;

vector<string> _availTrigs;

Expand Down
6 changes: 5 additions & 1 deletion settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const bool _debug = false;
// Algorithm to use ("AK4PF" or "AK8PF")
string _jp_algo = "AK4PFchs";
// Data type ("DATA", "MC", or "HW")
string _jp_type = "DATA"
string _jp_type = "DATA";
// In case of DATA, choose run ("RunB/C/D/E/Fearly/Flate/G/H")
string _jp_run = "RunG";
// Kostas stored UNCORRECTED four-vector, current status: CORRECTED
Expand All @@ -41,6 +41,10 @@ Long64_t _jp_nentries =
// Number of events to skip from the beginning (for debugging)
Long64_t _jp_nskip = 0;

// Eta phi exclusion due to ecal problems
bool _jp_etaphiexcl = true;
string _jp_etaphitype = "h2hotr"; // h2hotr (Robert) or h2hotm (Mikko)

// Decide whether or not to simulate triggers from MC (this is slow)
bool _jp_domctrigsim = true;
// Use "mc" trigger for whole pT range instead of stiching triggers together (requires trigsim)
Expand Down

0 comments on commit a819ad4

Please sign in to comment.