void calc_SBRatio_D0Kpi_lepMissID() { #include #include gROOT->Reset(); // Root macro to calculate uncertainty of signal //####################################################### // Change these values to meet your condition //####################################################### // Info of input data/MC root files //TString baseDir("/home1x/OtherMounts/hep03/khamano/test"); TString baseDir("/home1x/OtherMounts/hep03/khamano/R16b/thrustCut"); TString nameBase_BpBm("SP-1235-BToDlnu-Run3-R16b"); int nStart_BpBm = 1; int nStop_BpBm = 218; //218 //87 TString nameBase_B0B0bar("SP-1237-BToDlnu-Run3-R16b"); int nStart_B0B0bar = 1; int nStop_B0B0bar = 220; //220 //88 TString nameBase_ccbar("SP-1005-BToDlnu-Run3-R16b"); int nStart_ccbar = 1; int nStop_ccbar = 208; //208 //83 TString nameBase_uds("SP-998-BToDlnu-Run3-R16b"); int nStart_uds = 1; int nStop_uds = 143; //143 //58 TString nameBase_tautau("SP-3429-BToDlnu-Run3-R16b"); int nStart_tautau = 1; int nStop_tautau = 11; //11 //5 // Name of the root tree in the input root files TString ntpName("ntp2"); // Info of output files TString outFileName("SBRatio_D0Kpi_lepMissID.txt"); // D mass peak region float DMassMin = 1.840; //1.855; //1.845; //for D0 float DMassMax = 1.888; //1.875; //1.885; // D mass off peak (side band)region float DSideMin1 = 1.816; //for Dch float DSideMax1 = 1.840; float DSideMin2 = 1.888; //for Dch float DSideMax2 = 1.912; // Select D decay mode int setDDecMod = 1; // D0Kpi //int setDDecMod = 2; // D0K3pi //int setDDecMod = 3; // D0Kpipi0 //int setDDecMod = 4; // D0Kspipi // Vertex cut float DprobMin = 0.01; //0.001 float BprobMin = 0.01; //0.001 // Thrust cut float cosThrMax = 0.80; // Select a bin float DMomMin = 0.2; float DMomMax = 2.8; float LMomMin = 0.8; float LMomMax = 2.8; float cosBYMin = -10; float cosBYMax = 5; // uncertainty on background float rho = 0; //####################################################################### // Chain input root files and define trees. cout << "start chain\n"; TChain * chain_MC = new TChain(ntpName); for (Int_t i=nStart_BpBm; i<=nStop_BpBm; i++) { chain_MC->Add(baseDir+"/"+nameBase_BpBm+"-"+i+".root"); } for (Int_t i=nStart_B0B0bar; i<=nStop_B0B0bar; i++) { chain_MC->Add(baseDir+"/"+nameBase_B0B0bar+"-"+i+".root"); } for (Int_t i=nStart_ccbar; i<=nStop_ccbar; i++) { chain_MC->Add(baseDir+"/"+nameBase_ccbar+"-"+i+".root"); } for (Int_t i=nStart_uds; i<=nStop_uds; i++) { chain_MC->Add(baseDir+"/"+nameBase_uds+"-"+i+".root"); } for (Int_t i=nStart_tautau; i<=nStop_tautau; i++) { chain_MC->Add(baseDir+"/"+nameBase_tautau+"-"+i+".root"); } TTree * tree_MC = chain_MC; int numDl(0); int DDecMod[200], DType[200]; double fitDprob[200], fitBprob[200]; float cosThr[200]; int isABEvent[200], isDirectFromB[200], isFromSameB[200]; int BDecMod[200], mcDDecMod[200]; int noExtKPi[200], KMissID[200], PiMissID[200], KPiSameD[200]; float Dmass[200]; int lepType[200]; float pD[200], pLep[200], cosBY[200]; tree_MC->SetBranchAddress("nDl", &numDl); tree_MC->SetBranchAddress("DDecayMode", &DDecMod); tree_MC->SetBranchAddress("DhadType", &DType); tree_MC->SetBranchAddress("FitDprob", &fitDprob); tree_MC->SetBranchAddress("FitBprob", &fitBprob); tree_MC->SetBranchAddress("cosDlnonDl", &cosThr); tree_MC->SetBranchAddress("trueLepFromB", &isABEvent); tree_MC->SetBranchAddress("mcDirectLepFromB", &isDirectFromB); tree_MC->SetBranchAddress("trueLepFromSameB", &isFromSameB); tree_MC->SetBranchAddress("trueBDecMod", &BDecMod); tree_MC->SetBranchAddress("trueDDecMod", &mcDDecMod); tree_MC->SetBranchAddress("noExtraKorPi", &noExtKPi); tree_MC->SetBranchAddress("mcKaonMissID", &KMissID); tree_MC->SetBranchAddress("mcPiMissID", &PiMissID); tree_MC->SetBranchAddress("mcKPifromSameD", &KPiSameD); tree_MC->SetBranchAddress("DMass", &Dmass); tree_MC->SetBranchAddress("DMom", &pD); tree_MC->SetBranchAddress("DlLeptMom", &pLep); tree_MC->SetBranchAddress("DLcosBY", &cosBY); tree_MC->SetBranchAddress("DlLepType", &lepType); int nSig_Elec(0), nBkg_Elec(0); int nLepMissID_NonB_Elec(0), nLepMissID_DmissReco_Elec(0); int nLepMissID_BmissReco_Elec(0); int nNonB_Elec(0); int nNotDirectB_Elec(0), nNotFrmSameB_Elec(0); int nKMissID_Elec(0), nPiMissID_Elec(0), nKPiNotSameD_Elec(0); int nExtraKPi_Elec(0); int nSig_Mu(0), nBkg_Mu(0); int nLepMissID_NonB_Mu(0), nLepMissID_DmissReco_Mu(0); int nLepMissID_BmissReco_Mu(0); int nNonB_Mu(0); int nNotDirectB_Mu(0), nNotFrmSameB_Mu(0); int nKMissID_Mu(0), nPiMissID_Mu(0), nKPiNotSameD_Mu(0); int nExtraKPi_Mu(0); Int_t nEvent =(Int_t)tree_MC->GetEntries(); // get number of events cout << "nEvent = " << nEvent << endl; int nSelEvent(0); for (Int_t i=0;iGetEntry(i); //read complete event in memory int nDl_total(0), nDl_sig(0), nDl_bkg(0); int nDl_side(0); for (Int_t j=0;j