Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions bin/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@
</bin>
-->

<bin name="JetTriggerEfficiency" file="JetTriggerAnalysis.cc">
<flags LDFLAGS="-lCore -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lz -pthread -lm -ldl -rdynamic"/>
</bin>

<bin name="MuonTriggerEfficiency" file="MuonTriggerAnalysis.cc">
<flags LDFLAGS="-lCore -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lz -pthread -lm -ldl -rdynamic"/>
</bin>

<!--
<bin name="MuonTriggerEfficiency_less-stats" file="MssmHbbMuonTriggerAnalysis_less-stats.cc">
<flags LDFLAGS="-lCore -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lz -pthread -lm -ldl -rdynamic"/>
</bin>
-->

<bin name="OnlineBtagExperience" file="OnlineBtagExperience.cc">
<flags LDFLAGS="-lCore -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lz -pthread -lm -ldl -rdynamic"/>
Expand Down
28 changes: 28 additions & 0 deletions bin/JetTriggerAnalysis.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "Analysis/Trigger/interface/JetTriggerAnalyser.h"

using namespace analysis;
using namespace analysis::tools;
using namespace analysis::trigger;

int main(int argc, char ** argv)
{
TH1::SetDefaultSumw2(); // proper treatment of errors when scaling histograms

JetTriggerAnalyser trigger(argc,argv);
trigger.jetHistograms("Probes");
trigger.jetHistograms("Probes with matching");

for ( int i = 0 ; i < trigger.nEvents() ; ++i )
{
if ( ! trigger.event(i) ) continue; // read event, run selection/json
if ( ! trigger.selectionTrigger() ) continue; // trigger
if ( ! trigger.preselection() ) continue; // preselection
if ( ! trigger.jetCorrections() ) continue; // jet corrections
if ( ! trigger.jetKTEfirstSelection() ) continue; // jet corrections
trigger.jetKTEtagandprobeSelection();
}
} // end main




28 changes: 28 additions & 0 deletions bin/MuonTriggerAnalysis.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "Analysis/Trigger/interface/MuonTriggerAnalyser.h"
#include "Analysis/Tools/interface/Analysis.h"
#include <fstream>
#include <iostream>

using namespace analysis;
using namespace analysis::tools;
using namespace analysis::muontrigger;

int main(int argc, char ** argv)
{
TH1::SetDefaultSumw2(); // proper treatment of errors when scaling histogram

MuonTriggerAnalyser muontrigger(argc,argv);

for ( int i = 0 ; i < muontrigger.nEvents() ; ++i )
{

if ( ! muontrigger.event(i) ) continue; // read event, run selection/json
if ( ! muontrigger.selectionTrigger() ) continue; // trigger
if ( ! muontrigger.muonsSelection() ) continue; // muon first selection
if ( ! muontrigger.muonTagsSelection() ) continue; // muon tag selection
muontrigger.reconstructJPsi();

}
} // end main


18 changes: 4 additions & 14 deletions interface/JetTriggerAnalyser.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
#ifndef Analysis_Trigger_JetTriggerAnalyser_h
#define Analysis_Trigger_JetTriggerAnalyser_h 1

// -*- C++ -*-
//
// Package: Analysis/MssmHbb
// Class: Analysis
//
/**\class Analysis MssmHbbAnalyser.cc Analysis/MssmHbb/src/MssmHbbAnalyser.cc

Description: [one line class summary]

Implementation:
[Notes on implementation]
*/
//
// Original Author: Roberval Walsh Bastos Rangel
// Created: Mon, 20 Oct 2014 14:24:08 GMT
// Author: Daina Leyva
// Created: Aug. 2021
// Reviwed: Feb. 2024
//
//


// system include files
#include <memory>
#include <vector>
Expand Down
32 changes: 14 additions & 18 deletions interface/MuonTriggerAnalyser.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
#ifndef Analysis_MuonTriggerAnalyser_h
#define Analysis_MuonTriggerAnalyser_h 1

// -*- C++ -*-
//
// Package: Analysis/MssmHbb
// Class: Analysis
//
/**\class Analysis MssmHbbAnalyser.cc Analysis/MssmHbb/src/MssmHbbAnalyser.cc

Description: [one line class summary]

Implementation:
[Notes on implementation]
*/
//
// Original Author: Roberval Walsh Bastos Rangel
// Created: Mon, 20 Oct 2014 14:24:08 GMT
// Author: Daina Leyva
// Created: Aug. 2021
// Reviwed: Feb. 2024
//
//


// system include files
#include <memory>
#include <vector>
Expand Down Expand Up @@ -47,16 +37,22 @@ namespace analysis {

virtual bool event(const int &i);
bool muonsSelection();
//bool muonsSelection_upsilon();
bool muonTagsSelection();
void muonPassandFail_MatchingProbesSelection();
void reconstructJPsi();
//void reconstruct_upsilon();

TH1D* TagsPt = new TH1D("Tags_Pt","TagsPt" , 300, 0, 30);
TH1D* PassedProbesPt = new TH1D("Matched_Probes_Pt","MatchedProbesPt" , 300, 0, 30);
TH1D* FailedProbesPt = new TH1D("Failed_Probes_Pt","FailedProbesPt" ,300, 0, 30);
TH1D* DiMuonMass_afterTagSelection = new TH1D("DiMuonMass","DiMuonMass" , 50, 2.85, 3.35);
//TH1D* DiMuonMass_afterTagSelection = new TH1D("DiMuonMass","DiMuonMass" , 50, 2.85, 3.35);
//TH1D* DiMuonMass_afterTagSelection = new TH1D("DiMuonMass","DiMuonMass" , 80, 2.70, 3.50);
TH1D* DiMuonMass_afterTagSelection = new TH1D("DiMuonMass","DiMuonMass" , 80, 2.80, 3.60);

TH2D* PassedDiMuonMass_vs_probespT = new TH2D("DiMuonMass of passing muons 2D","Passing Probes 2D" , 50, 2.85, 3.35, 300, 0, 30);
TH2D* FailedDiMuonMass_vs_probespT = new TH2D("DiMuonMass of failing muons 2D","Failing Probes 2D" , 50, 2.85, 3.35, 300, 0, 30);
//TH2D* PassedDiMuonMass_vs_probespT = new TH2D("DiMuonMass of passing muons 2D","Passing Probes 2D" , 50, 2.85, 3.35, 300, 0, 30);
//TH2D* FailedDiMuonMass_vs_probespT = new TH2D("DiMuonMass of failing muons 2D","Failing Probes 2D" , 50, 2.85, 3.35, 300, 0, 30);
TH2D* PassedDiMuonMass_vs_probespT = new TH2D("DiMuonMass of passing muons 2D","Passing Probes 2D" , 80, 2.80, 3.60, 300, 0, 30);
TH2D* FailedDiMuonMass_vs_probespT = new TH2D("DiMuonMass of failing muons 2D","Failing Probes 2D" , 80, 2.80, 3.60, 300, 0, 30);

// ----------member data ---------------------------
protected:
Expand Down
17 changes: 6 additions & 11 deletions src/JetTriggerAnalyser.cc
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
/**\class MssmHbb MssmHbbAnalyser.cc Analysis/Tools/src/MssmHbbAnalyser.cc

Description: [one line class summary]

Implementation:
[Notes on implementation]
*/
//
// Original Author: Roberval Walsh
// Created: Mon, 20 Oct 2014 14:24:08 GMT
// Author: Daina Leyva
// Created: Aug. 2021
// Reviwed: Feb. 2024
//
//


// system include files
#include <iostream>
//
Expand Down Expand Up @@ -75,8 +70,8 @@ bool JetTriggerAnalyser::jetKTEfirstSelection()
}

if ( selectedJets_[0]->deltaPhi(*selectedJets_[1]) < 2.4 ) return false;
if ( selectedJets_[0]->eta() > 2.3 ) return false;
if ( selectedJets_[1]->eta() > 2.3 ) return false;
if ( fabs(selectedJets_[0]->eta()) > 2.3 ) return false;
if ( fabs(selectedJets_[1]->eta()) > 2.3 ) return false;
if ( selectedJets_[2])
if ( selectedJets_[2]->pt() > (0.3*(selectedJets_[0]->pt()+selectedJets_[1]->pt())*0.5) ) return false;

Expand Down
24 changes: 10 additions & 14 deletions src/MuonTriggerAnalyser.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
/**\class MssmHbb MssmHbbAnalyser.cc Analysis/Tools/src/MssmHbbAnalyser.cc

Description: [one line class summary]

Implementation:
[Notes on implementation]
*/
//
// Original Author: Roberval Walsh
// Created: Mon, 20 Oct 2014 14:24:08 GMT
// Author: Daina Leyva
// Created: Aug. 2021
// Reviwed: Feb. 2024
//
//

Expand Down Expand Up @@ -76,8 +71,8 @@ bool MuonTriggerAnalyser::muonsSelection()
int q1, q2;

if ( ! this -> selectionMuonId() ) return false; // check if event has muons
if ( ! this -> selectionMuons() ) return false; // selection of the two leading muons according to nminMuons, ptmax, ptmin and etamax from config file
if (selectedMuons_[0] -> deltaR(*selectedMuons_[1]) < 0.1 ) return false; // check deltaR between leading muons
if ( ! this -> selectionMuons() ) return false; // selection of the 2 leading muons according to nminMuons, ptmax, ptmin and etamax from config file
if (selectedMuons_[0] -> deltaR(*selectedMuons_[1]) < 0.1 ) return false; // check deltaR between 2 leading muons

//Discriminate two muons with same charge and that their sum is outside J/Psi mass window
for ( int i = 0; i < config_ -> nMuonsMin(); i++ )
Expand Down Expand Up @@ -105,9 +100,10 @@ bool MuonTriggerAnalyser::muonsSelection()

bool MuonTriggerAnalyser::muonTagsSelection()
{
TLorentzVector m1_afterTagSelection, m2_afterTagSelection, m_afterTagSelection;
TLorentzVector m1_afterTagSelection, m2_afterTagSelection, m_afterTagSelection; //reconstructed mass after tag selection
double MassObtained;

//matching of tag muon to online object and kinematic selection
if ( ! onlineL1MuonMatching(1) ) return false; //check tags L1 online matching
if ( ! onlineL3MuonMatching(1) ) return false; //check tags L3 online matching
if ( selectedMuons_[0] -> pt() < 10 ) return false; //pt condition for tags
Expand All @@ -130,10 +126,10 @@ bool MuonTriggerAnalyser::muonTagsSelection()
return true;
}

void MuonTriggerAnalyser::muonPassandFail_MatchingProbesSelection()
void MuonTriggerAnalyser::reconstructJPsi()
{
TLorentzVector m1matched, m2matched, mmatched;
TLorentzVector m1failedmatched,m2failedmatched,mfailedmatched;
TLorentzVector m1matched, m2matched, mmatched; //reconstructed mass after probes selection, from passing probes
TLorentzVector m1failedmatched,m2failedmatched,mfailedmatched; //reconstructed mass after probes selection, from failing probes
double matchedDiMuonMassObtained;
double failedmatchedDiMuonMassObtained;

Expand Down
89 changes: 89 additions & 0 deletions test/ProcessingTools/JKTE_setp3_FitUncertaintyVariations.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
void JKTE_setp3_FitUncertaintyVariations()
{
TH1::SetDefaultSumw2(); // proper treatment of errors when scaling histograms
TCanvas * c1 = new TCanvas("c1","",820,820);

int etabin = -1, sigma = 0, sign_var = 0;
double etamin, etamax;

cout<<"\nIntroduce the absolute values of the pseudorapidity limits for which the efficiency will be calculated\n";
cout<<"\n|eta| lower limit:\n";
cin >> etamin;
cout<<"\n|eta| upper limit:\n";
cin >> etamax;

cout<<"\nIntroduce the module of the variation in amounts of sigma\n";
cin >> sigma;

cout<<"\nIntroduce the sign of the variation\n";
cin >> sign_var;

if (etamin == 0)
etabin = 1;
else if (etamin == 1)
etabin = 2;
else if (etamin == 1.4)
etabin = 3;



TFile * f = new TFile(Form("TGraph_up_nominal_down/TGraph_scale_factor_2017_SL_%dsigma.root",sigma));

auto sf_up = (TGraphAsymmErrors*) f -> Get(Form("jetOnlineTriggerScaleFactor_eta_%g_to_%g_up",etamin,etamax));
auto sf_down = (TGraphAsymmErrors*) f -> Get(Form("jetOnlineTriggerScaleFactor_eta_%g_to_%g_down",etamin,etamax));
TFitResultPtr r1;

//fitting function
TF1 *fa1 = new TF1("fa1","[0]*erf([1]*x-[2])",40, 300);
fa1 -> SetParameters(1,0.05,1);

//Fit and plot the SF, EX0 to ignore x axis uncert.
if (sign_var == 1)
{
r1 = sf_up->Fit(fa1,"RS EX0");
sf_up->Draw("ap");
}

if (sign_var == -1)
{
r1 = sf_down->Fit(fa1,"RS EX0");
sf_down->Draw("ap");
}


//---------------------------------------------
// print matrices
cout << endl;
cout << "chi2/ndf = " << r1->Chi2() << "/" << r1->Ndf() << " = " << r1->Chi2()/r1->Ndf() << ", prob = " << r1->Prob() << endl;
cout << endl;
cout << "*** Correlation Matrix ***" << endl;
r1 -> GetCorrelationMatrix().Print();
cout << endl;
cout << "*** Covariance Matrix ***" << endl;
r1 -> GetCovarianceMatrix().Print();
//---------------------------------------------

// Fit results

TFile fout(Form("results_fit_up_down/Funct_sf_%dsigma.root",sigma),"UPDATE");
if(sign_var == 1)
{
if(etabin == 1)
fa1->Write(Form("jetOnlineTriggerScaleFactor_etabin_0p0_to_1p0_%ds_up",sigma));
if(etabin == 2)
fa1->Write(Form("jetOnlineTriggerScaleFactor_etabin_1p0_to_1p4_%ds_up",sigma));
if(etabin == 3)
fa1->Write(Form("jetOnlineTriggerScaleFactor_etabin_1p4_to_2p2_%ds_up",sigma));
}

if(sign_var == -1)
{
if(etabin == 1)
fa1->Write(Form("jetOnlineTriggerScaleFactor_etabin_0p0_to_1p0_%ds_down",sigma));
if(etabin == 2)
fa1->Write(Form("jetOnlineTriggerScaleFactor_etabin_1p0_to_1p4_%ds_down",sigma));
if(etabin == 3)
fa1->Write(Form("jetOnlineTriggerScaleFactor_etabin_1p4_to_2p2_%ds_down",sigma));
}

}
Loading