Commit 094d2893 authored by Carlos Vazquez Sierra's avatar Carlos Vazquez Sierra 👁‍🗨
Browse files

Preparing v6

r1 release
parent d05a4b2c
################################################################################
# Package: V0hhFitter
################################################################################
gaudi_subdir(V0hhFitter v1r0)
find_package(Boost COMPONENTS program_options REQUIRED)
find_package(ROOT COMPONENTS Core Tree RIO Hist TreePlayer Graf Graf3d
Gpad Matrix MathCore MathMore RooFitCore RooFit
RooStats TMVA)
find_package(GSL)
include_directories(${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${GSL_INCLUDE_DIRS})
# override the genreflex call to wrap it in the right environment
set(ROOT_genreflex_CMD ${env_cmd} --xml ${env_xml} ${ROOT_genreflex_CMD})
reflex_generate_dictionary(V0hhFitterDict
dict/V0hhFitterDict.h dict/V0hhFitterDict.xml
SPLIT_CLASSDEF)
gaudi_add_library(V0hhFitterLib
src/*.cpp
V0hhFitterDictDict_classdef.cpp
PUBLIC_HEADERS RooPhysFitter
INCLUDE_DIRS Boost ROOT
LINK_LIBRARIES Boost ROOT)
add_dependencies(V0hhFitterLib V0hhFitterDictGen)
sameMissID true
Bd2KSKpi false
SingleCB false
mixed false
twoWidths false
shiftMeans false
lambdaB false
#Scan likelihood
likelihoodScan false
#MC models
sigModel Standard
crossModel SameMissID
partModel Standard
#Combinatorial model
sameSlopesYears false
sameSlopesModes false
facSlopesYears true
facSlopesModes false
sameRatiosYears true
sameRatiosModes false
allKKConstraint false
#Signal model
deltaM true
deltaMYears true
facBs true
kSig(LL) 1. 0.
kSig(LL)(2012X/2011) 1. 0.
kSig(Bs) 1. 0.01
kSig(Bs)(2012X/2011) 1. 0.
kSig(Kpi)(2011) 0.9 0.01
kSig(KK)(2011) 0.9 0.01
kSig(Mode)(2012X/2011) 1. 0.
#Crossfeed model
crossFeedCriterion true
crossFeedSameForPiK true
crossFeedSameForYears false
crossFeedSameForDDLL false
crossFeedFacForYears true
crossFeedSameFacForYears false
crossFeedFacForDDLL true
crossFeedFacForCF false
crossFeedConstant false
crossFeedFactor 5.
#Partially-reconstructed model
branchingRatios true
partRecoSameModes false
partRecoSameDDLL false
partRecoSameYears false
partRecoFacDDLL true
partRecoFacYears true
partRecoSameFacYears false
partRecoSamePiK true
partRecoConstant false
partRecoFactor 10.
#Partially-reconstructed included
#pipi
Charmless-Bd pipi true
Charmless-Bs pipi true
Charmed-Bd pipi true
Charmed-Bs pipi true
Charmonia-Bd pipi false
Charmonia-Bs pipi false
MissGamNR-Bd pipi true
MissGamNR-Bs pipi false
MissGamRes-Bd pipi true
MissGamRes-Bs pipi false
Arbitrary-Bd-pi pipi false
Arbitrary-Bs-pi pipi false
Arbitrary-Bd-gam pipi false
Arbitrary-Bs-gam pipi false
#Kpi
Charmless-Bd Kpi false
Charmless-Bs Kpi true
Charmed-Bd Kpi true
Charmed-Bs Kpi true
Charmonia-Bd Kpi false
Charmonia-Bs Kpi false
MissGamNR-Bd Kpi false
MissGamNR-Bs Kpi false
MissGamRes-Bd Kpi false
MissGamRes-Bs Kpi false
Arbitrary-Bd-pi Kpi false
Arbitrary-Bs-pi Kpi false
Arbitrary-Bd-gam Kpi false
Arbitrary-Bs-gam Kpi false
#KK
Charmless-Bd KK true
Charmless-Bs KK false
Charmed-Bd KK true
Charmed-Bs KK false
Charmonia-Bd KK false
Charmonia-Bs KK false
MissGamNR-Bd KK false
MissGamNR-Bs KK false
MissGamRes-Bd KK false
MissGamRes-Bs KK false
Arbitrary-Bd-pi KK false
Arbitrary-Bs-pi KK false
Arbitrary-Bd-gam KK false
Arbitrary-Bs-gam KK false
#CrossFeeds included
Bd2KSpipi Kpi true
Bs2KSpipi Kpi false
Bd2KSpipi KK false
Bs2KSpipi KK false
Bd2KSKpi pipi true
Bs2KSKpi pipi true
Bd2KSKpi KK true
Bs2KSKpi KK true
Bd2KSKK pipi false
Bs2KSKK pipi false
Bd2KSKK Kpi true
Bs2KSKK Kpi false
Lb2KS0ppi pipi true
Lb2KS0ppi piK true
Lb2KS0ppi Kpi true
Lb2KS0ppi KK false
Lb2KS0pK pipi false
Lb2KS0pK piK true
Lb2KS0pK Kpi true
Lb2KS0pK KK true
#MC models
sigModel Standard
crossModel SameMissID
partModel Standard
#Combinatorial model
sameSlopesYears false
sameSlopesModes false
sameRatiosYears true
sameRatiosModes false
#Signal model
deltaM true
deltaMYears true
facBs false
kSig(LL) 1. 0.
kSig(LL)(2012X/2011) 1. 0.
kSig(Bs) 1. 0.2
kSig(Bs)(2012X/2011) 1. 0.
kSig(Kpi)(2011) 0.9 0.01
kSig(KK)(2011) 0.9 0.01
kSig(Mode)(2012X/2011) 1. 0.
#Crossfeed model
crossFeedSameForPiK true
crossFeedSameForYears false
crossFeedSameForDDLL true
crossFeedFacForYears false
crossFeedSameFacForYears false
crossFeedFacForDDLL false
crossFeedFacForCF false
crossFeedConstant false
#Partially-reconstructed model
partRecoSameDDLL false
partRecoSameYears false
partRecoFacDDLL false
partRecoFacYears false
partRecoSameFacYears false
partRecoSamePiK false
partRecoConstant false
partRecoFactor 2.
#Partially-reconstructed included
#pipi
Charmless-Bd pipi false
Charmless-Bs pipi false
Charmed-Bd pipi false
Charmed-Bs pipi false
Charmonia-Bd pipi false
Charmonia-Bs pipi false
MissGamNR-Bd pipi false
MissGamNR-Bs pipi false
MissGamRes-Bd pipi false
MissGamRes-Bs pipi false
#Kpi
Charmless-Bd Kpi false
Charmless-Bs Kpi false
Charmed-Bd Kpi false
Charmed-Bs Kpi false
Charmonia-Bd Kpi false
Charmonia-Bs Kpi false
MissGamNR-Bd Kpi false
MissGamNR-Bs Kpi false
MissGamRes-Bd Kpi false
MissGamRes-Bs Kpi false
#KK
Charmless-Bd KK false
Charmless-Bs KK false
Charmed-Bd KK false
Charmed-Bs KK false
Charmonia-Bd KK false
Charmonia-Bs KK false
MissGamNR-Bd KK false
MissGamNR-Bs KK false
MissGamRes-Bd KK false
MissGamRes-Bs KK false
#CrossFeeds included
Bd2KSpipi Kpi false
Bs2KSpipi Kpi false
Bd2KSpipi KK false
Bs2KSpipi KK false
Bd2KSKpi pipi false
Bs2KSKpi pipi false
Bd2KSKpi KK false
Bs2KSKpi KK false
Bd2KSKK pipi false
Bs2KSKK pipi false
Bd2KSKK Kpi false
Bs2KSKK Kpi false
facBs true
kSig(LL) 0.01
kSig(Bs) 0.01
kSig(Mode) 0.01
#Sigma factorization model
facBs true
kSig(LL) 0.01
kSig(Bs) 0.01
kSig(Mode) 0.01
This diff is collapsed.
#include "TFile.h"
#include "TMath.h"
#include "RooRealVar.h"
#include "RooWorkspace.h"
#include <iostream>
#include <map>
#include <vector>
int AnalyzeResults()
{
TFile *f = TFile::Open("/afs/cern.ch/user/l/lohenry/Fitter/KShh/WS/Data-WS-Loose-sWeights.root","READ");
RooWorkspace* newDesktop = (RooWorkspace*) f->Get("newDesktop");
std::map<std::string,std::pair<double,double> > yields;
std::vector<std::string> invMass;
invMass.push_back("pipi");
invMass.push_back("piK");
invMass.push_back("Kpi");
invMass.push_back("KK");
std::vector<std::string> years;
years.push_back("2011");
years.push_back("2012a");
years.push_back("2012b");
std::vector<std::string> KScat;
KScat.push_back("DD");
KScat.push_back("LL");
if (newDesktop == NULL)
{
std::cout << "No desktop!" << std::endl;
return 1;
}
for (std::vector<std::string>::iterator itMass = invMass.begin() ; itMass != invMass.end() ; ++itMass)
for (std::vector<std::string>::iterator itYears = years.begin() ; itYears != years.end() ; ++itYears)
for (std::vector<std::string>::iterator itKS = KScat.begin() ; itKS != KScat.end() ; ++itKS)
{
std::string name = "2KS"+(*itMass)+(*itKS)+"_"+(*itYears)+"_pdf_KS"+(*itMass)+(*itKS)+"_"+(*itYears)+"_Yield";
if (newDesktop->var(("Bd"+name).c_str()) == NULL)
{
std::cout << "No var named " << "Bd"+name << std::endl;
return 1;
}
yields["Bd2KS"+(*itMass)+(*itKS)+"_"+(*itYears)] = std::make_pair(newDesktop->var(("Bd"+name).c_str())->getVal(),newDesktop->var(("Bd"+name).c_str())->getError());
yields["Bs2KS"+(*itMass)+(*itKS)+"_"+(*itYears)] = std::make_pair(newDesktop->var(("Bs"+name).c_str())->getVal(),newDesktop->var(("Bs"+name).c_str())->getError());
if (itMass->find("KK") == std::string::npos)
{
double ratio = yields["Bs2KS"+(*itMass)+(*itKS)+"_"+(*itYears)].first/yields["Bd2KS"+(*itMass)+(*itKS)+"_"+(*itYears)].first;
double error = ratio*TMath::Sqrt((1./(yields["Bs2KS"+(*itMass)+(*itKS)+"_"+(*itYears)].second*yields["Bs2KS"+(*itMass)+(*itKS)+"_"+(*itYears)].second))+
(1./(yields["Bd2KS"+(*itMass)+(*itKS)+"_"+(*itYears)].second*yields["Bd2KS"+(*itMass)+(*itKS)+"_"+(*itYears)].second)));
std::cout << "Ratio of Bs/Bd in "+(*itMass)+" spectrum for " << (*itYears) << "," << (*itKS) << " is " << ratio << " +/- " << error << "." << std::endl;
}
}
return 0;
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include <iostream>
#include <sstream>
#include <string>
#include <ctime>
#include <cstdlib>
//ROOT
#include "TChain.h"
#include "TCanvas.h"
#include "TPad.h"
#include "TAxis.h"
#include "TKey.h"
#include "TROOT.h"
#include "TH2D.h"
#include "TFile.h"
// RooFit
#include "RooPlot.h"
#include "RooRealVar.h"
#include "RooSimultaneous.h"
// Fitter
#include "V0hhFitter/SimultaneousFitter.h"
#include "V0hhFitter/FitterPulls.h"
#include "V0hhFitter/ToyStudy.h"
#include "V0hhFitter/string_tools.h"
#include <boost/program_options.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string.hpp>
// SQLite
#include <sqlite3.h>
//Constraints
#include "KShh/Constraints/useConstraints.cpp"
int main(int argc, char* argv[])
{
RooMsgService::instance().setGlobalKillBelow(RooFit::ERROR);
boost::program_options::options_description decisions("Option Arguments");
std::string name("Fitter"), signalWS("Standard");
std::string selectionType("Loose"), combModel("Exponential"),option("Standard");
unsigned int nToys(0), nCPU(4);
decisions.add_options()
("help,h" , "produce help message")
("name,n" , boost::program_options::value<std::string>(&name), "")
("selectionBDT,s" , boost::program_options::value<std::string>(&selectionType), "")
("toying,t" , boost::program_options::value<unsigned int>(&nToys), "")
("nCPU" , boost::program_options::value<unsigned int>(&nCPU),"")
("signalModel", boost::program_options::value<std::string>(&signalWS), "")
("combModel", boost::program_options::value<std::string>(&combModel), "")
("option" , boost::program_options::value<std::string>(&option),"")
;
boost::program_options::variables_map vm;
boost::program_options::store( boost::program_options::parse_command_line( argc, argv, decisions ), vm );
boost::program_options::notify( vm );
std::vector<std::string> files;
unsigned int i = 1;
TFile *temp = NULL;
while (i < 200) //Cap
{
std::stringstream ss;
ss << i;
temp = TFile::Open(("/afs/cern.ch/user/l/lohenry/cmtuser/Urania_v2r4/PhysFit/V0hhFitter/KShh/temp/SystI-CrossFeed-"+option+"-"+combModel+"-"+selectionType+"-Standard-"+ss.str()+".root").c_str());
if (!temp)
break;
temp->Close();
files.push_back(temp->GetName());
std::cout << "INFO: Adding " << temp->GetName() << " file in the FitterPulls." << std::endl;
++i;
}
V0hhFit::FitterPulls fPulls(files, "SystI","dataFit", "CrossFeed-"+signalWS+"-"+selectionType+"-"+combModel+"-"+option+".txt");
// fPulls.plotPulls(("KShh/temp/"+selectionType+"-pulls").c_str());
// fPulls.plotResiduals(("KShh/temp/"+selectionType+"-residuals").c_str());
// fPulls.plotPulls((selectionType+"-pulls").c_str());
fPulls.plotSystI(("KShh/temp/plots/CrossFeed-"+signalWS+"/"+selectionType+"/"+combModel+"/").c_str(),("CrossFeed-"+option).c_str(),2);
// fPulls.plotConstant(("KShh/temp/plots/CrossFeed-"+signalWS+"/"+selectionType+"/").c_str(),("Constants-"+option).c_str(),2);
// fPulls.plotErrorVsResiduals((selectionType+"-ErrVsResiduals").c_str());
// fPulls.writeVectors("temp.txt");
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment