Angular analysis of B+->K*+(K+pi0)mumu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1652 lines
83 KiB

  1. #include "../GlobalFunctions.hh"
  2. //////////////////////////////////////////////////////////////////////
  3. /// DTFcomparison()
  4. /// #todo
  5. ///
  6. string figureFormat = "eps";
  7. std::array<string, 3> ParticlesPiZero {"B",
  8. //"muplus",
  9. //"muminus",
  10. "Kstar",
  11. "pi0",
  12. //"gamma1",
  13. //"gamma2"
  14. };
  15. std::array<string, 3> ParticlesKShort {"B",
  16. //"muplus",
  17. //"muminus",
  18. "Kstar",
  19. "Kshort"
  20. };
  21. std::array<string, 3> Variables{ "M",
  22. "PT",
  23. "ETA"
  24. };
  25. std::array<string,1> ExtraVariables{// "ThetaK",
  26. // "ThetaL",
  27. // "Phi",
  28. "OpenAngle",
  29. };
  30. std::array<string, 2> DTFoptions{//"DTF_PDG",
  31. //"PDG",
  32. "DTF",
  33. ""
  34. };
  35. string particleLatex(string particle){ //one doesn't have to think much when making labels and titles
  36. if (particle == "B") return ("B^{+}");
  37. if (particle == "Bplus") return ("B^{+}");
  38. if (particle == "B_plus") return ("B^{+}");
  39. if (particle == "Kstar") return ("K^{*+}");
  40. if (particle == "K_star") return ("K^{*+}");
  41. if (particle == "Kplus") return ("K^{+}");
  42. if (particle == "K_plus") return ("K^{+}");
  43. if (particle == "Kshort") return ("K_{s}");
  44. if (particle == "K_short") return ("K_{s}");
  45. if (particle == "piplus") return ("#pi^{+}");
  46. if (particle == "pi_plus") return ("#pi^{+}");
  47. if (particle == "pizero") return ("#pi^{0}");
  48. if (particle == "pi_zero") return ("#pi^{0}");
  49. if (particle == "pi0") return ("#pi^{0}");
  50. if (particle == "mu") return ("#mu");
  51. if (particle == "mu_plus") return ("#mu^{+}");
  52. if (particle == "muplus") return ("#mu^{+}");
  53. if (particle == "mu_minus") return ("#mu^{-}");
  54. if (particle == "muminus") return ("#mu^{-}");
  55. if (particle == "gamma") return ("#gamma");
  56. cout << "Particle "<< particle <<" not in the list!" << endl;
  57. return "";
  58. }
  59. string variableLatex(string var){
  60. if (var=="PT") return ("p_{T}");
  61. if (var=="PX") return ("p_{X}");
  62. if (var=="PY") return ("p_{Y}");
  63. if (var=="PZ") return ("p_{Z}");
  64. if (var=="ETA") return ("#eta");
  65. if (var=="M") return ("m");
  66. if (var=="OpenAngle") return ("Open angle (#gamma#gamma angle)");
  67. cout << "Variable "<< var <<" is not in the list!" << endl;
  68. return "";
  69. }
  70. string optionLatex(string opt){
  71. if (opt=="DTF_PDG") return ("#splitline{info from DTF}{with masses fixed to PDG}");
  72. if (opt=="DTF") return ("info from DTF");
  73. if (opt=="PDG") return ("#splitline{info from TupleTool}{with masses fixed to PDG}");
  74. if (opt=="") return ("info from TupleTool");
  75. cout << "Option " << opt << " not in the list!" << endl;
  76. return "";
  77. }
  78. string histName(string particle, string var, string opt){
  79. return (variableLatex(var)+"("+ particleLatex(particle)+ "):" + optionLatex(opt));
  80. }
  81. void designCanvas(TCanvas* canvas){
  82. canvas->SetRightMargin(0.04);
  83. canvas->SetTopMargin(0.04);
  84. canvas->SetLeftMargin(0.12);
  85. canvas->SetBottomMargin(0.12);
  86. }
  87. void designPlots(TH1D *hist, int color){
  88. hist->SetLineWidth(2);
  89. hist->SetLineColor(color);
  90. hist->GetYaxis()->SetTitleOffset(1.7);
  91. hist->GetXaxis()->SetTitleOffset(1.0);
  92. hist->SetTitle("");
  93. }
  94. void designLegend(TLegend *leg, string legTitle, TH1D *hist, string opt){
  95. leg->SetTextSize(0.03);
  96. leg->SetHeader(legTitle.c_str());
  97. leg->AddEntry(hist,optionLatex(opt).c_str(),"l");
  98. }
  99. int DTFcomparison(std::string year = "2011", std::string magnet = "down", bool MC = false, bool ReferenceChannel = false, bool PHSP = false, bool preselected = true, bool truthMatched = false) {
  100. //no point in keepeng the MC option, but it doesn't hurt neither
  101. TFile* output = 0;
  102. TChain *tree;
  103. if (!(MC || ReferenceChannel || PHSP)) truthMatched = false;
  104. if (!preselected){
  105. //Kst2Kpluspi0Resolved case
  106. if(Kst2Kpluspi0Resolved){
  107. if(!MC){
  108. tree=new TChain("b2KstKpi0mumuResolvedTuple/DecayTree");
  109. if(smallSample) tree->Add(Form("%s/data/%s%s/*B2Kstmumu*13.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  110. else{
  111. tree->Add(Form("%s/data/%s%s/*.root",path_to_data.c_str(),year.c_str(),magnet.c_str()));
  112. std::cout << "Adding " << Form("%s/data/%s%s/*B2Kstmumu*.root",path_to_data.c_str(),year.c_str(),magnet.c_str()) << endl;
  113. }
  114. }
  115. else{
  116. tree=new TChain("b2KstKpi0mumuResolvedTuple/DecayTree");
  117. if(ReferenceChannel){
  118. if(smallSample) tree->Add(Form("%s/data/MC/RefKplusPi0/%s%s/*B2KstJpsi*1.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  119. else tree->Add(Form("%s/data/MC/RefKplusPi0/%s%s/*B2KstJpsi*.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  120. }
  121. else if(PHSP){
  122. if(smallSample) tree->Add(Form("%s/data/PHSP/KplusPi0/%s%s/*B2Kstmumu*1.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  123. else tree->Add(Form("%s/data/PHSP/KplusPi0/%s%s/*B2Kstmumu*.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  124. }
  125. else{
  126. if(smallSample) tree->Add(Form("%s/data/MC/KplusPi0/%s%s/*B2Kstmumu*1.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  127. else tree->Add(Form("%s/data/MC/KplusPi0/%s%s/*B2Kstmumu*.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  128. }
  129. }
  130. }
  131. //Kst2Kpluspi0Merged case
  132. if(Kst2Kpluspi0Merged){
  133. tree=new TChain("b2KstKpi0mumuMergedTuple/DecayTree");
  134. if(!MC){
  135. if(smallSample) tree->Add(Form("%s/data/%s%s/*B2Kstmumu*13.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  136. else tree->Add(Form("%s/data/%s%s/*B2Kstmumu*.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  137. }
  138. else{
  139. if(smallSample) tree->Add(Form("%s/data/MC/KplusPi0/%s%s/*B2Kstmumu*1.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  140. else tree->Add(Form("%s/data/MC/KplusPi0/%s%s/*B2Kstmumu*.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  141. }
  142. }
  143. //Kst2Kspiplus case
  144. if(Kst2Kspiplus){
  145. if(!MC){
  146. tree=new TChain("b2KstKs0pimumu_Tuple/DecayTree");
  147. if(smallSample) tree->Add(Form("%s/data/%s%s/*B2Kstmumu*23.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  148. else tree->Add(Form("%s/data/%s%s/*B2Kstmumu*.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  149. }
  150. else{
  151. tree=new TChain("b2KstKs0pimumu_Tuple/DecayTree");
  152. if(ReferenceChannel){
  153. if(smallSample) tree->Add(Form("%s/data/MC/RefKshortPiplus/%s%s/*B2KstJpsi*13.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  154. else tree->Add(Form("%s/data/MC/RefKshortPiplus/%s%s/*B2KstJpsi*.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  155. }
  156. else if(PHSP){
  157. if(smallSample) tree->Add(Form("%s/data/PHSP/KshortPiplus/%s%s/*B2Kstmumu*1.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  158. else tree->Add(Form("%s/data/PHSP/KshortPiplus/%s%s/*B2Kstmumu*.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  159. }
  160. else{
  161. if(smallSample) tree->Add(Form("%s/data/MC/KshortPiplus/%s%s/*B2Kstmumu*1.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  162. else tree->Add(Form("%s/data/MC/KshortPiplus/%s%s/*B2Kstmumu*.root",path_to_data.c_str(), year.c_str(),magnet.c_str()));
  163. }
  164. }
  165. }
  166. }
  167. else{ //preselected
  168. string name = (truthMatched ? "DecayTreeTruthMatched" : "DecayTree");
  169. tree=new TChain(name.c_str());
  170. // Kst2Kpluspi0Resolved case
  171. if(Kst2Kpluspi0Resolved){
  172. if(!MC){
  173. tree->Add(Form("%s/data/%s%s/%s%s_pi0Resolved.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str()));
  174. cout << Form("%s/data/%s%s/%s%s_pi0Resolved.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str()) << endl;
  175. }
  176. else{
  177. if(ReferenceChannel){
  178. tree->Add(Form("%s/data/MC/RefKplusPi0/%s%s/%s%s_pi0Resolved.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str()));
  179. }
  180. else if(PHSP){
  181. tree->Add(Form("%s/data/PHSP/KplusPi0/%s%s/%s%s_pi0Resolved.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str()));
  182. }
  183. else{
  184. tree->Add(Form("%s/data/MC/KplusPi0/%s%s/%s%s_pi0Resolved.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str()));
  185. }
  186. }
  187. }
  188. // Kst2Kpluspi0Merged case
  189. if(Kst2Kpluspi0Merged){
  190. if(!MC){
  191. tree->Add(Form("%s/data/%s%s/%s%s_pi0Merged.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str()));
  192. }
  193. else{
  194. if(ReferenceChannel){
  195. tree->Add(Form("%s/data/MC/RefKplusPi0/%s%s/%s%s_pi0Merged.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str()));
  196. }
  197. else if(PHSP){
  198. tree->Add(Form("%s/data/PHSP/KplusPi0/%s%s/%s%s_pi0Merged.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str()));
  199. }
  200. else{
  201. tree->Add(Form("%s/data/MC/KplusPi0/%s%s/%s%s_pi0Mergedroot",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str()));
  202. }
  203. }
  204. }
  205. // Kst2Kspiplus case
  206. if(Kst2Kspiplus){
  207. if(!MC){
  208. tree->Add(Form("%s/data/%s%s/%s%s_piplus.root",path_to_output_KshortPiplus.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str()));
  209. }
  210. else{
  211. if(ReferenceChannel){
  212. tree->Add(Form("%s/data/MC/RefKshortPiplus/%s%s/%s%s_piplus.root",path_to_output_KshortPiplus.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str()));
  213. }
  214. else if(PHSP){
  215. tree->Add(Form("%s/data/PHSP/KshortPiplus/%s%s/%s%s_piplus.root",path_to_output_KshortPiplus.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str()));
  216. }
  217. else{
  218. tree->Add(Form("%s/data/MC/KshortPiplus/%s%s/%s%s_piplus.root",path_to_output_KshortPiplus.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str()));
  219. }
  220. }
  221. }
  222. }
  223. int N = tree->GetEntries();
  224. if(N == 0){
  225. std::cout << "[ERROR]\t\tNo events found!" << std::endl;
  226. return 0;
  227. }
  228. // MASSES HISTOGRAMS
  229. string tmpName = "";
  230. //pi0
  231. tmpName = "m_{"+ particleLatex("pi0") +"}[MeV]";
  232. TH1 * h_pi0_M_DTF_PDG= new TH1D("h_pi0_M_DTF_PDG", histName("pi0","M", "DTF_PDG").c_str(), 70, 100, 170);
  233. h_pi0_M_DTF_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  234. h_pi0_M_DTF_PDG->GetYaxis()->SetTitle("Counts / 1MeV");
  235. TH1 * h_pi0_M_DTF= new TH1D("h_pi0_M_DTF" , histName("pi0","M", "DTF").c_str(), 70, 100, 170);
  236. h_pi0_M_DTF->GetXaxis()->SetTitle(tmpName.c_str());
  237. h_pi0_M_DTF->GetYaxis()->SetTitle("Counts / 1MeV");
  238. tmpName = "m_{"+ particleLatex("pizero") +"}[MeV]";
  239. TH1 * h_pi0_M_PDG= new TH1D("h_pi0_M_PDG" , histName("pi0","M", "PDG").c_str(), 70, 100, 170);
  240. h_pi0_M_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  241. h_pi0_M_PDG->GetYaxis()->SetTitle("Counts / 1MeV");
  242. TH1 * h_pi0_M= new TH1D("h_pi0_M" , histName("pi0","M", "").c_str(), 70, 100, 170);
  243. h_pi0_M->GetXaxis()->SetTitle(tmpName.c_str());
  244. h_pi0_M->GetYaxis()->SetTitle("Counts / 1MeV");
  245. //Ks
  246. tmpName = "m_{" + particleLatex("Kshort") + "}[MeV]";
  247. TH1 * h_Kshort_M_DTF_PDG= new TH1D("h_Kshort_M_DTF_PDG" , histName("Kshort","M", "DTF_PDG").c_str(), 100, 400, 600);
  248. h_Kshort_M_DTF_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  249. h_Kshort_M_DTF_PDG->GetYaxis()->SetTitle("Counts / 2MeV");
  250. TH1 * h_Kshort_M_DTF= new TH1D("h_Kshort_M_DTF" , histName("Kshort","M", "DTF").c_str(), 100, 400, 600);
  251. h_Kshort_M_DTF->GetXaxis()->SetTitle(tmpName.c_str());
  252. h_Kshort_M_DTF->GetYaxis()->SetTitle("Counts / 2MeV");
  253. TH1 * h_Kshort_M_PDG= new TH1D("h_Kshort_M_PDG" ,histName("Kshort","M", "PDG").c_str(), 100, 400, 600);
  254. h_Kshort_M_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  255. h_Kshort_M_PDG->GetYaxis()->SetTitle("Counts / 2MeV");
  256. TH1 * h_Kshort_M= new TH1D("h_Kshort_M" , histName("Kshort","M", "").c_str(), 100, 400, 600);
  257. h_Kshort_M->GetXaxis()->SetTitle(tmpName.c_str());
  258. h_Kshort_M->GetYaxis()->SetTitle("Counts / 2MeV");
  259. //K*
  260. if (Kst2Kpluspi0Resolved) tmpName = "m_{" + particleLatex("Kplus") + particleLatex("pi0") + "}[MeV]";
  261. else if (Kst2Kspiplus) tmpName = "m_{" + particleLatex("Kshort") + particleLatex("piplus") + "}[MeV]";
  262. TH1 * h_Kstar_M_DTF_PDG= new TH1D("h_Kstar_M_DTF_PDG" ,histName("Kstar","M", "DTF_PDG").c_str(), 100, 700, 1100);
  263. h_Kstar_M_DTF_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  264. h_Kstar_M_DTF_PDG->GetYaxis()->SetTitle("Counts / 4MeV");
  265. TH1 * h_Kstar_M_DTF= new TH1D("h_Kstar_M_DTF" , histName("Kstar","M", "DTF").c_str(), 100, 700, 1100);
  266. h_Kstar_M_DTF->GetXaxis()->SetTitle(tmpName.c_str());
  267. h_Kstar_M_DTF->GetYaxis()->SetTitle("Counts / 4MeV");
  268. if (Kst2Kpluspi0Resolved) tmpName = "m_{" + particleLatex("Kplus") + particleLatex("pizero") + "}[MeV]";
  269. TH1 * h_Kstar_M_PDG= new TH1D("h_Kstar_M_PDG" , histName("Kstar","M", "PDG").c_str(), 100, 700, 1100);
  270. h_Kstar_M_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  271. h_Kstar_M_PDG->GetYaxis()->SetTitle("Counts / 4MeV");
  272. TH1 * h_Kstar_M= new TH1D("h_Kstar_M" , histName("Kstar","M", "").c_str(), 100, 700, 1100);
  273. h_Kstar_M->GetXaxis()->SetTitle(tmpName.c_str());
  274. h_Kstar_M->GetYaxis()->SetTitle("Counts / 4MeV");
  275. //B+
  276. if (Kst2Kpluspi0Resolved) tmpName = "m_{" + particleLatex("Kplus") + particleLatex("pi0") + particleLatex("mu") + particleLatex("mu") + "}[MeV]";
  277. else if (Kst2Kspiplus) tmpName = "m_{" + particleLatex("Kshort") + particleLatex("piplus") + particleLatex("mu") + particleLatex("mu") + "}[MeV]";
  278. TH1 * h_B_M_DTF_PDG= new TH1D("h_B_M_DTF_PDG" , histName("Bplus","M", "DTF_PDG").c_str(), (7000-cut_B_plus_M_low)/20, cut_B_plus_M_low, 7000);
  279. h_B_M_DTF_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  280. h_B_M_DTF_PDG->GetYaxis()->SetTitle("Counts / 20MeV");
  281. TH1 * h_B_M_DTF= new TH1D("h_B_M_DTF" , histName("Bplus","M", "DTF").c_str(), (7000-cut_B_plus_M_low)/20, cut_B_plus_M_low, 7000);
  282. h_B_M_DTF->GetXaxis()->SetTitle(tmpName.c_str());
  283. h_B_M_DTF->GetYaxis()->SetTitle("Counts / 20MeV");
  284. if (Kst2Kpluspi0Resolved) tmpName = "m_{" + particleLatex("Kplus") + particleLatex("pizero") + particleLatex("mu") + particleLatex("mu") + "}[MeV]";
  285. TH1 * h_B_M_PDG= new TH1D("h_B_M_PDG", histName("Bplus","M", "PDG").c_str(), (7000-cut_B_plus_M_low)/20, cut_B_plus_M_low, 7000);
  286. h_B_M_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  287. h_B_M_PDG->GetYaxis()->SetTitle("Counts / 20MeV");
  288. TH1 * h_B_M= new TH1D("h_B_M" , histName("Bplus","M", "").c_str(), (7000-cut_B_plus_M_low)/20, cut_B_plus_M_low, 7000);
  289. h_B_M->GetXaxis()->SetTitle(tmpName.c_str());
  290. h_B_M->GetYaxis()->SetTitle("Counts / 20MeV");
  291. //pT HISTOGRAMS
  292. //pi0
  293. tmpName = variableLatex("PT") + "{"+ particleLatex("pi0") +"}[MeV]";
  294. TH1 * h_pi0_PT_DTF_PDG= new TH1D("h_pi0_PT_DTF_PDG" , histName("pi0","PT", "DTF_PDG").c_str(), 100, 0, 5000);
  295. h_pi0_PT_DTF_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  296. h_pi0_PT_DTF_PDG->GetYaxis()->SetTitle("Counts / 50MeV");
  297. TH1 * h_pi0_PT_DTF= new TH1D("h_pi0_PT_DTF" , histName("pizero","PT", "DTF").c_str(),100, 0, 5000);
  298. h_pi0_PT_DTF->GetXaxis()->SetTitle(tmpName.c_str());
  299. h_pi0_PT_DTF->GetYaxis()->SetTitle("Counts / 50MeV");
  300. TH1 * h_pi0_PT_PDG= new TH1D("h_pi0_PT_PDG" , histName("pi0","PT", "PDG").c_str(), 100, 0, 5000);;
  301. h_pi0_PT_PDG->GetXaxis()->SetTitle("p_{T}{#pi^{0}[MeV]");
  302. h_pi0_PT_PDG->GetYaxis()->SetTitle("Counts / 50MeV");
  303. TH1 * h_pi0_PT= new TH1D("h_pi0_PT" , histName("pi0","PT", "").c_str(),100, 0, 5000);
  304. h_pi0_PT->GetXaxis()->SetTitle("p_{T}{#pi^{0}[MeV]");
  305. h_pi0_PT->GetYaxis()->SetTitle("Counts / 50MeV");
  306. //Ks
  307. tmpName = variableLatex("PT") + "{" + particleLatex("Kshort") + "}[MeV]";
  308. TH1 * h_Kshort_PT_DTF_PDG= new TH1D("h_Kshort_PT_DTF_PDG" , histName("Kshort","PT", "DTF_PDG").c_str(), 100, 0, 15000);
  309. h_Kshort_PT_DTF_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  310. h_Kshort_PT_DTF_PDG->GetYaxis()->SetTitle("Counts / 150MeV");
  311. TH1 * h_Kshort_PT_DTF= new TH1D("h_Kshort_PT_DTF" , histName("Kshort","PT", "DTF").c_str(), 100, 0, 15000);
  312. h_Kshort_PT_DTF->GetXaxis()->SetTitle(tmpName.c_str());
  313. h_Kshort_PT_DTF->GetYaxis()->SetTitle("Counts / 150MeV");
  314. TH1 * h_Kshort_PT_PDG= new TH1D("h_Kshort_PT_PDG" , histName("Kshort","PT", "PDG").c_str(), 100, 0, 15000);
  315. h_Kshort_PT_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  316. h_Kshort_PT_PDG->GetYaxis()->SetTitle("Counts / 150MeV");
  317. TH1 * h_Kshort_PT= new TH1D("h_Kshort_PT" , histName("Kshort","PT", "").c_str(), 100, 0, 15000);
  318. h_Kshort_PT->GetXaxis()->SetTitle(tmpName.c_str());
  319. h_Kshort_PT->GetYaxis()->SetTitle("Counts / 150MeV");
  320. //K*
  321. if (Kst2Kpluspi0Resolved) tmpName = variableLatex("PT") + "{" + particleLatex("Kplus") + particleLatex("pi0") + "}[MeV]";
  322. else if (Kst2Kspiplus) tmpName = variableLatex("PT") + "{" + particleLatex("Kshort") + particleLatex("piplus") + "}[MeV]";
  323. TH1 * h_Kstar_PT_DTF_PDG= new TH1D("h_Kstar_PT_DTF_PDG" , histName("Kstar","PT", "DTF_PDG").c_str(), 100, 0, 15000);
  324. h_Kstar_PT_DTF_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  325. h_Kstar_PT_DTF_PDG->GetYaxis()->SetTitle("Counts / 150MeV");
  326. TH1 * h_Kstar_PT_DTF= new TH1D("h_Kstar_PT_DTF" , histName("Kstar","PT", "DTF").c_str(), 100, 0, 15000);
  327. h_Kstar_PT_DTF->GetXaxis()->SetTitle(tmpName.c_str());
  328. h_Kstar_PT_DTF->GetYaxis()->SetTitle("Counts / 150MeV");
  329. TH1 * h_Kstar_PT_PDG= new TH1D("h_Kstar_PT_PDG" , histName("Kstar","PT", "PDG").c_str(),100, 0, 15000);
  330. h_Kstar_PT_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  331. h_Kstar_PT_PDG->GetYaxis()->SetTitle("Counts / 150MeV");
  332. TH1 * h_Kstar_PT= new TH1D("h_Kstar_PT" , histName("Kstar","PT", "").c_str(), 100, 0, 15000);
  333. h_Kstar_PT->GetXaxis()->SetTitle(tmpName.c_str());
  334. h_Kstar_PT->GetYaxis()->SetTitle("Counts / 150MeV");
  335. //B+
  336. if (Kst2Kpluspi0Resolved) tmpName = variableLatex("PT") + "{" + particleLatex("Kplus") + particleLatex("pi0") + particleLatex("mu") + particleLatex("mu") + "}[MeV]";
  337. else if (Kst2Kspiplus) tmpName = variableLatex("PT") + "{" + particleLatex("Kshort") + particleLatex("piplus") + particleLatex("mu") + particleLatex("mu") + "}[MeV]";
  338. TH1 * h_B_PT_DTF_PDG= new TH1D("h_B_PT_DTF_PDG" , histName("Bplus","PT", "DTF_PDG").c_str(), 100, 0, 40000);
  339. h_B_PT_DTF_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  340. h_B_PT_DTF_PDG->GetYaxis()->SetTitle("Counts / 400MeV");
  341. TH1 * h_B_PT_DTF= new TH1D("h_B_PT_DTF" , histName("Bplus","PT", "DTF").c_str(), 100, 0, 40000);
  342. h_B_PT_DTF->GetXaxis()->SetTitle(tmpName.c_str());
  343. h_B_PT_DTF->GetYaxis()->SetTitle("Counts / 20MeV");
  344. TH1 * h_B_PT_PDG= new TH1D("h_B_PT_PDG" , histName("Bplus","PT", "PDG").c_str(), 100, 0, 40000);
  345. h_B_PT_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  346. h_B_PT_PDG->GetYaxis()->SetTitle("Counts / 20MeV");
  347. TH1 * h_B_PT= new TH1D("h_B_PT" , histName("Bplus","PT", "").c_str(), 100, 0, 40000);
  348. h_B_PT->GetXaxis()->SetTitle(tmpName.c_str());
  349. h_B_PT->GetYaxis()->SetTitle("Counts / 20MeV");
  350. //eta HISTOGRAMS #TODO: hist titles
  351. //pi0
  352. tmpName = variableLatex("ETA") + "{"+ particleLatex("pi0") +"}[MeV]";
  353. TH1 * h_pi0_ETA_DTF_PDG= new TH1D("h_pi0_ETA_DTF_PDG" , histName("pi0","ETA", "DTF_PDG").c_str(), 35, 1.5, 5);
  354. h_pi0_ETA_DTF_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  355. h_pi0_ETA_DTF_PDG->GetYaxis()->SetTitle("Counts / 0.1");
  356. TH1 * h_pi0_ETA_DTF= new TH1D("h_pi0_ETA_DTF" , histName("pi0","ETA", "DTF").c_str(), 35, 1.5, 5);
  357. h_pi0_ETA_DTF->GetXaxis()->SetTitle(tmpName.c_str());
  358. h_pi0_ETA_DTF->GetYaxis()->SetTitle("Counts / 0.1");
  359. TH1 * h_pi0_ETA_PDG= new TH1D("h_pi0_ETA_PDG" , histName("pi0","ETA", "PDG").c_str(), 35, 1.5, 5);
  360. h_pi0_ETA_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  361. h_pi0_ETA_PDG->GetYaxis()->SetTitle("Counts / 0.1");
  362. TH1 * h_pi0_ETA= new TH1D("h_pi0_ETA" , histName("pi0","ETA", "").c_str(), 35, 1.5, 5);
  363. h_pi0_ETA->GetXaxis()->SetTitle(tmpName.c_str());
  364. h_pi0_ETA->GetYaxis()->SetTitle("Counts / 0.1");
  365. //Ks
  366. tmpName = variableLatex("ETA") + "{" + particleLatex("Kshort") + "}[MeV]";
  367. TH1 * h_Kshort_ETA_DTF_PDG= new TH1D("h_Kshort_ETA_DTF_PDG" , histName("Kshort","ETA", "DTF_PDG").c_str(), 35, 1.5, 5);
  368. h_Kshort_ETA_DTF_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  369. h_Kshort_ETA_DTF_PDG->GetYaxis()->SetTitle("Counts / 0.1");
  370. TH1 * h_Kshort_ETA_DTF= new TH1D("h_Kshort_ETA_DTF" , histName("Kshort","ETA", "DTF").c_str(), 35, 1.5, 5);
  371. h_Kshort_ETA_DTF->GetXaxis()->SetTitle(tmpName.c_str());
  372. h_Kshort_ETA_DTF->GetYaxis()->SetTitle("Counts / 0.1");
  373. TH1 * h_Kshort_ETA_PDG= new TH1D("h_Kshort_ETA_PDG" , histName("Kshort","ETA", "PDG").c_str(), 35, 1.5, 5);
  374. h_Kshort_ETA_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  375. h_Kshort_ETA_PDG->GetYaxis()->SetTitle("Counts / 0.1");
  376. TH1 * h_Kshort_ETA= new TH1D("h_Kshort_ETA" , histName("Kshort","ETA", "").c_str(), 35, 1.5, 5);
  377. h_Kshort_ETA->GetXaxis()->SetTitle(tmpName.c_str());
  378. h_Kshort_ETA->GetYaxis()->SetTitle("Counts / 0.1");
  379. //K*
  380. if (Kst2Kpluspi0Resolved) tmpName = variableLatex("ETA") + "{" + particleLatex("Kplus") + particleLatex("pi0") + "}[MeV]";
  381. else if (Kst2Kspiplus) tmpName = variableLatex("ETA") + "{" + particleLatex("Kshort") + particleLatex("piplus") + "}[MeV]";
  382. TH1 * h_Kstar_ETA_DTF_PDG= new TH1D("h_Kstar_ETA_DTF_PDG" , histName("Kstar","ETA", "DTF_PDG").c_str(), 35, 1.5, 5);
  383. h_Kstar_ETA_DTF_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  384. h_Kstar_ETA_DTF_PDG->GetYaxis()->SetTitle("Counts / 0.1");
  385. TH1 * h_Kstar_ETA_DTF= new TH1D("h_Kstar_ETA_DTF" , histName("Kstar","ETA", "DTF").c_str(), 35, 1.5, 5);
  386. h_Kstar_ETA_DTF->GetXaxis()->SetTitle(tmpName.c_str());
  387. h_Kstar_ETA_DTF->GetYaxis()->SetTitle("Counts / 0.1");
  388. TH1 * h_Kstar_ETA_PDG= new TH1D("h_Kstar_ETA_PDG" , histName("Kstar","ETA", "PDG").c_str(), 35, 1.5, 5);
  389. h_Kstar_ETA_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  390. h_Kstar_ETA_PDG->GetYaxis()->SetTitle("Counts / 0.1");
  391. TH1 * h_Kstar_ETA= new TH1D("h_Kstar_ETA" , histName("Kstar","ETA", "").c_str(), 35, 1.5, 5);
  392. h_Kstar_ETA->GetXaxis()->SetTitle(tmpName.c_str());
  393. h_Kstar_ETA->GetYaxis()->SetTitle("Counts / 0.1");
  394. //B+
  395. if (Kst2Kpluspi0Resolved) tmpName = variableLatex("ETA") + "{" + particleLatex("Kplus") + particleLatex("pi0") + particleLatex("mu") + particleLatex("mu") + "}[MeV]";
  396. else if (Kst2Kspiplus) tmpName = variableLatex("ETA") + "{" + particleLatex("Kshort") + particleLatex("piplus") + particleLatex("mu") + particleLatex("mu") + "}[MeV]";
  397. TH1 * h_B_ETA_DTF_PDG= new TH1D("h_B_ETA_DTF_PDG" , histName("Bplus","ETA", "DTF_PDG").c_str(), 45, 1.5, 6);
  398. h_B_ETA_DTF_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  399. h_B_ETA_DTF_PDG->GetYaxis()->SetTitle("Counts / 0.1");
  400. TH1 * h_B_ETA_DTF= new TH1D("h_B_ETA_DTF" , histName("Bplus","ETA", "DTF").c_str(), 45, 1.5, 6);
  401. h_B_ETA_DTF->GetXaxis()->SetTitle(tmpName.c_str());
  402. h_B_ETA_DTF->GetYaxis()->SetTitle("Counts / 0.1");
  403. TH1 * h_B_ETA_PDG= new TH1D("h_B_ETA_PDG" , histName("Bplus","ETA", "PDG").c_str(), 45, 1.5, 6);
  404. h_B_ETA_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  405. h_B_ETA_PDG->GetYaxis()->SetTitle("Counts / 0.1");
  406. TH1 * h_B_ETA = new TH1D("h_B_ETA" , histName("Bplus","ETA", "").c_str(), 45, 1.5, 6);
  407. h_B_ETA->GetXaxis()->SetTitle(tmpName.c_str());
  408. h_B_ETA->GetYaxis()->SetTitle("Counts / 0.1");
  409. //Angular description
  410. TH1 * h_ctk = new TH1D("h_ctk" ,"#theta_{k}", 73, -3.15, 3.15);
  411. h_ctk->GetXaxis()->SetTitle("#theta_{k}");
  412. h_ctk->GetYaxis()->SetTitle("Counts / 0.1");
  413. TH1 * h_ctl = new TH1D("h_ctl" , "#theta_{l}", 73, -3.15, 3.15);
  414. h_ctl->GetXaxis()->SetTitle("#theta_{l}");
  415. h_ctl->GetYaxis()->SetTitle("Counts / 0.1");
  416. TH1 * h_sp = new TH1D("h_sp" ,"#phi", 73, -3.15, 3.15);
  417. h_sp->GetXaxis()->SetTitle("#phi");
  418. h_sp->GetYaxis()->SetTitle("Counts / 0.1");
  419. //Open Angle
  420. tmpName ="Open Angle";
  421. TH1 * h_OpenAngle_DTF_PDG= new TH1D("h_OpenAngle_DTF_PDG" , ("Open Angle" + optionLatex("DTF_PDG")).c_str(), 40, 0, 0.2);
  422. h_OpenAngle_DTF_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  423. h_OpenAngle_DTF_PDG->GetYaxis()->SetTitle("Counts / 0.005");
  424. TH1 * h_OpenAngle_DTF= new TH1D("h_OpenAngle_DTF" , ("Open Angle" + optionLatex("DTF")).c_str(), 40, 0, 0.2);
  425. h_OpenAngle_DTF->GetXaxis()->SetTitle(tmpName.c_str());
  426. h_OpenAngle_DTF->GetYaxis()->SetTitle("Counts / 0.005");
  427. TH1 * h_OpenAngle_PDG= new TH1D("h_OpenAngle_PDG" , ("Open Angle" + optionLatex("PDG")).c_str(), 40, 0, 0.2);
  428. h_OpenAngle_PDG->GetXaxis()->SetTitle(tmpName.c_str());
  429. h_OpenAngle_PDG->GetYaxis()->SetTitle("Counts / 0.005");
  430. TH1 * h_OpenAngle = new TH1D("h_OpenAngle" , ("Open Angle" + optionLatex("")).c_str(), 40, 0, 0.2);
  431. h_OpenAngle->GetXaxis()->SetTitle(tmpName.c_str());
  432. h_OpenAngle->GetYaxis()->SetTitle("Counts / 0.05");
  433. /////////////////////
  434. // Detector values //
  435. /////////////////////
  436. TLorentzVector LorVec_B_plus;
  437. TLorentzVector LorVec_K_star_plus;
  438. TLorentzVector LorVec_K_plus;
  439. TLorentzVector LorVec_pi_zero_merged;
  440. TLorentzVector LorVec_pi_zero_resolved;
  441. TLorentzVector LorVec_K_short;
  442. TLorentzVector LorVec_pi_plus;
  443. TLorentzVector LorVec_KS_pi_plus;
  444. TLorentzVector LorVec_KS_pi_minus;
  445. TLorentzVector LorVec_mu_minus;
  446. TLorentzVector LorVec_mu_plus;
  447. TLorentzVector LorVec_gamma1;
  448. TLorentzVector LorVec_gamma2;
  449. TLorentzVector LorVec_DiGamma;
  450. //potentially misIDed particles:
  451. TLorentzVector LorVec_pi_plus_MisIDed;
  452. TLorentzVector LorVec_mu_plus_MisIDed;
  453. TLorentzVector LorVec_B_plus_From_DoubleMisIDed;
  454. TLorentzVector LorVec_Jpsi_From_DoubleMisIDed;
  455. TLorentzVector LorVec_K_star_plus_From_DoubleMisIDed;
  456. //recombined particles:
  457. TLorentzVector LorVec_DiMuon;
  458. TLorentzVector LorVec_KaonPion;
  459. TLorentzVector LorVec_ReconB;
  460. TLorentzVector LorVec_ReconBPiZero;
  461. TLorentzVector LorVec_KshortMuMu;
  462. TLorentzVector LorVec_KplusMuMu;
  463. //Other variables:
  464. Double_t OpenAngle;
  465. /////////////////////
  466. // DTF values //
  467. /////////////////////
  468. TLorentzVector LorVec_DTF_B_plus;
  469. TLorentzVector LorVec_DTF_K_star_plus;
  470. TLorentzVector LorVec_DTF_K_plus;
  471. TLorentzVector LorVec_DTF_pi_zero_merged;
  472. TLorentzVector LorVec_DTF_pi_zero_resolved;
  473. TLorentzVector LorVec_DTF_K_short;
  474. TLorentzVector LorVec_DTF_pi_plus;
  475. TLorentzVector LorVec_DTF_KS_pi_plus;
  476. TLorentzVector LorVec_DTF_KS_pi_minus;
  477. TLorentzVector LorVec_DTF_mu_minus;
  478. TLorentzVector LorVec_DTF_mu_plus;
  479. TLorentzVector LorVec_DTF_gamma1;
  480. TLorentzVector LorVec_DTF_gamma2;
  481. TLorentzVector LorVec_DTF_DiGamma;
  482. //potentially misIDed particles:
  483. TLorentzVector LorVec_DTF_pi_plus_MisIDed;
  484. TLorentzVector LorVec_DTF_mu_plus_MisIDed;
  485. TLorentzVector LorVec_DTF_B_plus_From_DoubleMisIDed;
  486. TLorentzVector LorVec_DTF_Jpsi_From_DoubleMisIDed;
  487. TLorentzVector LorVec_DTF_K_star_plus_From_DoubleMisIDed;
  488. //recombined particles:
  489. TLorentzVector LorVec_DTF_DiMuon;
  490. TLorentzVector LorVec_DTF_KaonPion;
  491. TLorentzVector LorVec_DTF_ReconB;
  492. TLorentzVector LorVec_DTF_ReconBPiZero;
  493. TLorentzVector LorVec_DTF_KshortMuMu;
  494. TLorentzVector LorVec_DTF_KplusMuMu;
  495. //Other variables:
  496. Double_t OpenAngle_DTF;
  497. /////////////////////
  498. // PDG+DTF values //
  499. /////////////////////
  500. TLorentzVector LorVec_DTF_PDG_B_plus;
  501. TLorentzVector LorVec_DTF_PDG_K_star_plus;
  502. TLorentzVector LorVec_DTF_PDG_K_plus;
  503. TLorentzVector LorVec_DTF_PDG_pi_zero_merged;
  504. TLorentzVector LorVec_DTF_PDG_pi_zero_resolved;
  505. TLorentzVector LorVec_DTF_PDG_K_short;
  506. TLorentzVector LorVec_DTF_PDG_pi_plus;
  507. TLorentzVector LorVec_DTF_PDG_KS_pi_plus;
  508. TLorentzVector LorVec_DTF_PDG_KS_pi_minus;
  509. TLorentzVector LorVec_DTF_PDG_mu_minus;
  510. TLorentzVector LorVec_DTF_PDG_mu_plus;
  511. TLorentzVector LorVec_DTF_PDG_gamma1;
  512. TLorentzVector LorVec_DTF_PDG_gamma2;
  513. TLorentzVector LorVec_DTF_PDG_DiGamma;
  514. //potentially misIDed particles:
  515. TLorentzVector LorVec_DTF_PDG_pi_plus_MisIDed;
  516. TLorentzVector LorVec_DTF_PDG_mu_plus_MisIDed;
  517. TLorentzVector LorVec_DTF_PDG_B_plus_From_DoubleMisIDed;
  518. TLorentzVector LorVec_DTF_PDG_Jpsi_From_DoubleMisIDed;
  519. TLorentzVector LorVec_DTF_PDG_K_star_plus_From_DoubleMisIDed;
  520. //recombined particles:
  521. TLorentzVector LorVec_DTF_PDG_DiMuon;
  522. TLorentzVector LorVec_DTF_PDG_KaonPion;
  523. TLorentzVector LorVec_DTF_PDG_ReconB;
  524. TLorentzVector LorVec_DTF_PDG_ReconBPiZero;
  525. TLorentzVector LorVec_DTF_PDG_KshortMuMu;
  526. TLorentzVector LorVec_DTF_PDG_KplusMuMu;
  527. //Other variables:
  528. Double_t OpenAngle_DTF_PDG;
  529. /////////////////////
  530. // PDG values //
  531. /////////////////////
  532. TLorentzVector LorVec_PDG_B_plus;
  533. TLorentzVector LorVec_PDG_K_star_plus;
  534. TLorentzVector LorVec_PDG_K_plus;
  535. TLorentzVector LorVec_PDG_pi_zero_merged;
  536. TLorentzVector LorVec_PDG_pi_zero_resolved;
  537. TLorentzVector LorVec_PDG_K_short;
  538. TLorentzVector LorVec_PDG_pi_plus;
  539. TLorentzVector LorVec_PDG_KS_pi_plus;
  540. TLorentzVector LorVec_PDG_KS_pi_minus;
  541. TLorentzVector LorVec_PDG_mu_minus;
  542. TLorentzVector LorVec_PDG_mu_plus;
  543. TLorentzVector LorVec_PDG_gamma1;
  544. TLorentzVector LorVec_PDG_gamma2;
  545. TLorentzVector LorVec_PDG_DiGamma;
  546. //potentially misIDed particles:
  547. TLorentzVector LorVec_PDG_pi_plus_MisIDed;
  548. TLorentzVector LorVec_PDG_mu_plus_MisIDed;
  549. TLorentzVector LorVec_PDG_B_plus_From_DoubleMisIDed;
  550. TLorentzVector LorVec_PDG_Jpsi_From_DoubleMisIDed;
  551. TLorentzVector LorVec_PDG_K_star_plus_From_DoubleMisIDed;
  552. //recombined particles:
  553. TLorentzVector LorVec_PDG_DiMuon;
  554. TLorentzVector LorVec_PDG_KaonPion;
  555. TLorentzVector LorVec_PDG_ReconB;
  556. TLorentzVector LorVec_PDG_ReconBPiZero;
  557. TLorentzVector LorVec_PDG_KshortMuMu;
  558. TLorentzVector LorVec_PDG_KplusMuMu;
  559. //Other variables:
  560. Double_t OpenAngle_PDG;
  561. /////////////////////
  562. // Branches //
  563. /////////////////////
  564. tree->SetBranchStatus("*",0);
  565. tree->SetBranchStatus( "*P", 1 );
  566. tree->SetBranchStatus( "*PX", 1 );
  567. tree->SetBranchStatus( "*PY", 1);
  568. tree->SetBranchStatus( "*PZ", 1);
  569. tree->SetBranchStatus( "*PE", 1);
  570. tree->SetBranchStatus( "*PT", 1 );
  571. tree->SetBranchStatus( "*TAU", 1 );
  572. tree->SetBranchStatus( "*Phi",1 );
  573. tree->SetBranchStatus( "*ThetaL",1 );
  574. tree->SetBranchStatus( "*ThetaK",1 );
  575. ///B+
  576. Double_t B_plus_PX = 0.;
  577. Double_t B_plus_PY = 0.;
  578. Double_t B_plus_PZ = 0.;
  579. Double_t B_plus_PE = 0.;
  580. ///K*+
  581. Double_t K_star_plus_PX = 0.;
  582. Double_t K_star_plus_PY = 0.;
  583. Double_t K_star_plus_PZ = 0.;
  584. Double_t K_star_plus_PE = 0.;
  585. ///K+
  586. Double_t K_plus_PX = 0.;
  587. Double_t K_plus_PY = 0.;
  588. Double_t K_plus_PZ = 0.;
  589. Double_t K_plus_PE = 0.;
  590. Float_t K_plus_PX_DTF[100];
  591. Float_t K_plus_PY_DTF[100];
  592. Float_t K_plus_PZ_DTF[100];
  593. Float_t K_plus_PE_DTF[100];
  594. ///pi0 (merged)
  595. Double_t pi_zero_merged_PX = 0.;
  596. Double_t pi_zero_merged_PY = 0.;
  597. Double_t pi_zero_merged_PZ = 0.;
  598. Double_t pi_zero_merged_PE = 0.;
  599. ///pi0 (resolved)
  600. Double_t pi_zero_resolved_PX = 0.;
  601. Double_t pi_zero_resolved_PY = 0.;
  602. Double_t pi_zero_resolved_PZ = 0.;
  603. Double_t pi_zero_resolved_PE = 0.;
  604. ///Kshort
  605. Double_t K_short_PX = 0.;
  606. Double_t K_short_PY = 0.;
  607. Double_t K_short_PZ = 0.;
  608. Double_t K_short_PE = 0.;
  609. ///pi+ (KS)
  610. Double_t Ks_pi_plus_PX = 0.;
  611. Double_t Ks_pi_plus_PY = 0.;
  612. Double_t Ks_pi_plus_PZ = 0.;
  613. Double_t Ks_pi_plus_PE = 0.;
  614. Float_t Ks_pi_plus_PX_DTF[100];
  615. Float_t Ks_pi_plus_PY_DTF[100];
  616. Float_t Ks_pi_plus_PZ_DTF[100];
  617. Float_t Ks_pi_plus_PE_DTF[100];
  618. ///pi- (KS)
  619. Double_t Ks_pi_minus_PX = 0.;
  620. Double_t Ks_pi_minus_PY = 0.;
  621. Double_t Ks_pi_minus_PZ = 0.;
  622. Double_t Ks_pi_minus_PE = 0.;
  623. Float_t Ks_pi_minus_PX_DTF[100];
  624. Float_t Ks_pi_minus_PY_DTF[100];
  625. Float_t Ks_pi_minus_PZ_DTF[100];
  626. Float_t Ks_pi_minus_PE_DTF[100];
  627. ///pi+
  628. Double_t pi_plus_PX = 0.;
  629. Double_t pi_plus_PY = 0.;
  630. Double_t pi_plus_PZ = 0.;
  631. Double_t pi_plus_PE = 0.;
  632. Float_t pi_plus_PX_DTF[100];
  633. Float_t pi_plus_PY_DTF[100];
  634. Float_t pi_plus_PZ_DTF[100];
  635. Float_t pi_plus_PE_DTF[100];
  636. ///mu+
  637. Double_t mu_minus_PX = 0.;
  638. Double_t mu_minus_PY = 0.;
  639. Double_t mu_minus_PZ = 0.;
  640. Double_t mu_minus_PE = 0.;
  641. Float_t mu_minus_PX_DTF[100];
  642. Float_t mu_minus_PY_DTF[100];
  643. Float_t mu_minus_PZ_DTF[100];
  644. Float_t mu_minus_PE_DTF[100];
  645. ///mu+
  646. Double_t mu_plus_PX = 0.;
  647. Double_t mu_plus_PY = 0.;
  648. Double_t mu_plus_PZ = 0.;
  649. Double_t mu_plus_PE = 0.;
  650. Float_t mu_plus_PX_DTF[100];
  651. Float_t mu_plus_PY_DTF[100];
  652. Float_t mu_plus_PZ_DTF[100];
  653. Float_t mu_plus_PE_DTF[100];
  654. ///gamma1
  655. Double_t gamma1_PX = 0.;
  656. Double_t gamma1_PY = 0.;
  657. Double_t gamma1_PZ = 0.;
  658. Double_t gamma1_PE = 0.;
  659. Float_t gamma1_PX_DTF[100];
  660. Float_t gamma1_PY_DTF[100];
  661. Float_t gamma1_PZ_DTF[100];
  662. Float_t gamma1_PE_DTF[100];
  663. ///gamma2
  664. Double_t gamma2_PX = 0.;
  665. Double_t gamma2_PY = 0.;
  666. Double_t gamma2_PZ = 0.;
  667. Double_t gamma2_PE = 0.;
  668. Float_t gamma2_PX_DTF[100];
  669. Float_t gamma2_PY_DTF[100];
  670. Float_t gamma2_PZ_DTF[100];
  671. Float_t gamma2_PE_DTF[100];
  672. //angles
  673. Double_t ThetaL = 0.;
  674. Double_t ThetaK = 0.;
  675. Double_t Phi = 0.;
  676. //particle masses and momenta
  677. tree -> SetBranchAddress( "B_plus_PX" , &B_plus_PX );
  678. tree -> SetBranchAddress( "B_plus_PY" , &B_plus_PY );
  679. tree -> SetBranchAddress( "B_plus_PZ" , &B_plus_PZ );
  680. tree -> SetBranchAddress( "B_plus_PE" , &B_plus_PE );
  681. tree -> SetBranchAddress( "K_star_plus_PX" , &K_star_plus_PX );
  682. tree -> SetBranchAddress( "K_star_plus_PY" , &K_star_plus_PY );
  683. tree -> SetBranchAddress( "K_star_plus_PZ" , &K_star_plus_PZ );
  684. tree -> SetBranchAddress( "K_star_plus_PE" , &K_star_plus_PE );
  685. if(Kst2Kpluspi0Merged){ //TODO: in case one really wants to do that, add DTF info
  686. tree -> SetBranchAddress( "pi_zero_merged_PX" , &pi_zero_merged_PX );
  687. tree -> SetBranchAddress( "pi_zero_merged_PY" , &pi_zero_merged_PY );
  688. tree -> SetBranchAddress( "pi_zero_merged_PZ" , &pi_zero_merged_PZ );
  689. tree -> SetBranchAddress( "pi_zero_merged_PE" , &pi_zero_merged_PE );
  690. }
  691. if(Kst2Kpluspi0Resolved){
  692. tree -> SetBranchAddress( "pi_zero_resolved_PX" , &pi_zero_resolved_PX );
  693. tree -> SetBranchAddress( "pi_zero_resolved_PY" , &pi_zero_resolved_PY );
  694. tree -> SetBranchAddress( "pi_zero_resolved_PZ" , &pi_zero_resolved_PZ );
  695. tree -> SetBranchAddress( "pi_zero_resolved_PE" , &pi_zero_resolved_PE );
  696. tree -> SetBranchAddress( "gamma1_PX" , &gamma1_PX );
  697. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_pi0_gamma_0_PX" , &gamma1_PX_DTF );
  698. tree -> SetBranchAddress( "gamma1_PY" , &gamma1_PY );
  699. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_pi0_gamma_0_PY" , &gamma1_PY_DTF );
  700. tree -> SetBranchAddress( "gamma1_PZ" , &gamma1_PZ );
  701. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_pi0_gamma_0_PZ" , &gamma1_PZ_DTF );
  702. tree -> SetBranchAddress( "gamma1_PE" , &gamma1_PE );
  703. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_pi0_gamma_0_PE" , &gamma1_PE_DTF );
  704. tree -> SetBranchAddress( "gamma2_PX" , &gamma2_PX );
  705. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_pi0_gamma_PX" , &gamma2_PX_DTF );
  706. tree -> SetBranchAddress( "gamma2_PY" , &gamma2_PY );
  707. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_pi0_gamma_PY" , &gamma2_PY_DTF );
  708. tree -> SetBranchAddress( "gamma2_PZ" , &gamma2_PZ );
  709. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_pi0_gamma_PZ" , &gamma2_PZ_DTF );
  710. tree -> SetBranchAddress( "gamma2_PE" , &gamma2_PE );
  711. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_pi0_gamma_PE" , &gamma2_PE_DTF );
  712. }
  713. if(Kst2Kpluspi0Merged || Kst2Kpluspi0Resolved){
  714. tree -> SetBranchAddress( "K_plus_PX" , &K_plus_PX );
  715. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_Kplus_PX" , &K_plus_PX_DTF );
  716. tree -> SetBranchAddress( "K_plus_PY" , &K_plus_PY );
  717. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_Kplus_PY" , &K_plus_PY_DTF );
  718. tree -> SetBranchAddress( "K_plus_PZ" , &K_plus_PZ );
  719. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_Kplus_PZ" , &K_plus_PZ_DTF );
  720. tree -> SetBranchAddress( "K_plus_PE" , &K_plus_PE );
  721. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_Kplus_PE" , &K_plus_PE_DTF );
  722. }
  723. if(Kst2Kspiplus){
  724. tree -> SetBranchAddress( "K_short_PX" , &K_short_PX );
  725. tree -> SetBranchAddress( "K_short_PY" , &K_short_PY );
  726. tree -> SetBranchAddress( "K_short_PZ" , &K_short_PZ );
  727. tree -> SetBranchAddress( "K_short_PE" , &K_short_PE );
  728. tree -> SetBranchAddress( "pi_plus_PX" , &pi_plus_PX );
  729. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_piplus_PX" , &pi_plus_PX_DTF );
  730. tree -> SetBranchAddress( "pi_plus_PY" , &pi_plus_PY );
  731. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_piplus_PY" , &pi_plus_PY_DTF );
  732. tree -> SetBranchAddress( "pi_plus_PZ" , &pi_plus_PZ );
  733. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_piplus_PZ" , &pi_plus_PZ_DTF );
  734. tree -> SetBranchAddress( "pi_plus_PE" , &pi_plus_PE );
  735. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_piplus_PE" , &pi_plus_PE_DTF );
  736. tree -> SetBranchAddress( "Ks_pi_minus_PX" , &Ks_pi_minus_PX );
  737. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_KS0_piplus_PX" , &Ks_pi_minus_PX_DTF );
  738. tree -> SetBranchAddress( "Ks_pi_minus_PY" , &Ks_pi_minus_PY );
  739. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_KS0_piplus_PY" , &Ks_pi_minus_PY_DTF );
  740. tree -> SetBranchAddress( "Ks_pi_minus_PZ" , &Ks_pi_minus_PZ );
  741. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_KS0_piplus_PZ" , &Ks_pi_minus_PZ_DTF );
  742. tree -> SetBranchAddress( "Ks_pi_minus_PE" , &Ks_pi_minus_PE );
  743. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_KS0_piplus_PE" , &Ks_pi_minus_PE_DTF );
  744. tree -> SetBranchAddress( "Ks_pi_plus_PX" , &Ks_pi_plus_PX );
  745. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_KS0_piplus_0_PX" , &Ks_pi_plus_PX_DTF );
  746. tree -> SetBranchAddress( "Ks_pi_plus_PY" , &Ks_pi_plus_PY );
  747. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_KS0_piplus_0_PY" , &Ks_pi_plus_PY_DTF );
  748. tree -> SetBranchAddress( "Ks_pi_plus_PZ" , &Ks_pi_plus_PZ );
  749. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_KS0_piplus_0_PZ" , &Ks_pi_plus_PZ_DTF );
  750. tree -> SetBranchAddress( "Ks_pi_plus_PE" , &Ks_pi_plus_PE );
  751. tree -> SetBranchAddress( "B_plus_DTF_Kst_892_plus_KS0_piplus_0_PE" , &Ks_pi_plus_PE_DTF );
  752. }
  753. tree -> SetBranchAddress( "mu_minus_PX" , &mu_minus_PX );
  754. tree -> SetBranchAddress( "B_plus_DTF_J_psi_1S_muminus_0_PX" , &mu_minus_PX_DTF );
  755. tree -> SetBranchAddress( "mu_minus_PY" , &mu_minus_PY );
  756. tree -> SetBranchAddress( "B_plus_DTF_J_psi_1S_muminus_0_PY" , &mu_minus_PY_DTF );
  757. tree -> SetBranchAddress( "mu_minus_PZ" , &mu_minus_PZ );
  758. tree -> SetBranchAddress( "B_plus_DTF_J_psi_1S_muminus_0_PZ" , &mu_minus_PZ_DTF );
  759. tree -> SetBranchAddress( "mu_minus_PE" , &mu_minus_PE );
  760. tree -> SetBranchAddress( "B_plus_DTF_J_psi_1S_muminus_0_PE" , &mu_minus_PE_DTF );
  761. tree -> SetBranchAddress( "mu_plus_PX" , &mu_plus_PX );
  762. tree -> SetBranchAddress( "B_plus_DTF_J_psi_1S_muminus_PX" , &mu_plus_PX_DTF );
  763. tree -> SetBranchAddress( "mu_plus_PY" , &mu_plus_PY );
  764. tree -> SetBranchAddress( "B_plus_DTF_J_psi_1S_muminus_PY" , &mu_plus_PY_DTF );
  765. tree -> SetBranchAddress( "mu_plus_PZ" , &mu_plus_PZ );
  766. tree -> SetBranchAddress( "B_plus_DTF_J_psi_1S_muminus_PZ" , &mu_plus_PZ_DTF );
  767. tree -> SetBranchAddress( "mu_plus_PE" , &mu_plus_PE );
  768. tree -> SetBranchAddress( "B_plus_DTF_J_psi_1S_muminus_PE" , &mu_plus_PE_DTF );
  769. tree -> SetBranchAddress( "B_plus_ThetaL" , &ThetaL);
  770. tree -> SetBranchAddress( "B_plus_ThetaK" , &ThetaK);
  771. tree -> SetBranchAddress( "B_plus_Phi" , &Phi );
  772. //////////////////////////////////
  773. ///// //////
  774. //// Loop over events /////
  775. ///// //////
  776. //////////////////////////////////
  777. for (int i=0; i<N; i++){
  778. //output the different counters!
  779. if ((0ul == (i % 10000ul) || i + 1 == N) && i != 0) {
  780. cout << "Read event " << i + 1 << "/" << N
  781. << endl;
  782. }
  783. tree->GetEntry(i);
  784. /////////////////////
  785. // PDG+DTF values //
  786. /////////////////////
  787. LorVec_DTF_PDG_mu_minus.SetXYZM (mu_minus_PX_DTF[0], mu_minus_PY_DTF[0], mu_minus_PZ_DTF[0], PDGMASS.MU);
  788. LorVec_DTF_PDG_mu_plus.SetXYZM (mu_plus_PX_DTF[0], mu_plus_PY_DTF[0], mu_plus_PZ_DTF[0], PDGMASS.MU);
  789. if(Kst2Kspiplus){
  790. /// Ks, pi+
  791. LorVec_DTF_PDG_pi_plus.SetXYZM (pi_plus_PX_DTF[0], pi_plus_PY_DTF[0], pi_plus_PZ_DTF[0], PDGMASS.PI_PLUS);
  792. LorVec_DTF_PDG_KS_pi_plus.SetXYZM (Ks_pi_plus_PX_DTF[0], Ks_pi_plus_PY_DTF[0], Ks_pi_plus_PZ_DTF[0], PDGMASS.PI_PLUS);
  793. LorVec_DTF_PDG_KS_pi_minus.SetXYZM (Ks_pi_minus_PX_DTF[0], Ks_pi_minus_PY_DTF[0], Ks_pi_minus_PZ_DTF[0], PDGMASS.PI_PLUS);
  794. LorVec_DTF_PDG_pi_plus_MisIDed.SetXYZM (pi_plus_PX_DTF[0], pi_plus_PY_DTF[0], pi_plus_PZ_DTF[0], PDGMASS.MU);
  795. LorVec_DTF_PDG_mu_plus_MisIDed.SetXYZM (mu_plus_PX_DTF[0], mu_plus_PY_DTF[0], mu_plus_PZ_DTF[0], PDGMASS.PI_PLUS);
  796. }
  797. else{
  798. /// K+, pi0
  799. LorVec_DTF_PDG_K_plus.SetXYZM (K_plus_PX_DTF[0], K_plus_PY_DTF[0], K_plus_PZ_DTF[0], PDGMASS.K_PLUS);
  800. LorVec_DTF_PDG_gamma1.SetXYZM (gamma1_PX_DTF[0], gamma1_PY_DTF[0], gamma1_PZ_DTF[0], PDGMASS.GAMMA);
  801. LorVec_DTF_PDG_gamma2.SetXYZM (gamma2_PX_DTF[0], gamma2_PY_DTF[0], gamma2_PZ_DTF[0], PDGMASS.GAMMA);
  802. }
  803. //directly recombine the non-stable particles for later use (K*+ not really needed/used for Kst2Kspiplus)
  804. if(Kst2Kspiplus){
  805. LorVec_DTF_PDG_K_short = LorVec_DTF_PDG_KS_pi_plus + LorVec_DTF_PDG_KS_pi_minus;
  806. LorVec_DTF_PDG_KaonPion = LorVec_DTF_PDG_K_short + LorVec_DTF_PDG_pi_plus;
  807. }
  808. if(Kst2Kpluspi0Resolved){
  809. LorVec_DTF_PDG_DiGamma = LorVec_DTF_PDG_gamma1 + LorVec_DTF_PDG_gamma2;
  810. LorVec_DTF_PDG_pi_zero_resolved = LorVec_DTF_PDG_DiGamma;
  811. LorVec_DTF_PDG_KaonPion = LorVec_DTF_PDG_K_plus + LorVec_DTF_PDG_pi_zero_resolved;
  812. }
  813. LorVec_DTF_PDG_K_star_plus = LorVec_DTF_PDG_KaonPion;
  814. LorVec_DTF_PDG_DiMuon = LorVec_DTF_PDG_mu_minus + LorVec_DTF_PDG_mu_plus;
  815. LorVec_DTF_PDG_B_plus = LorVec_DTF_PDG_K_star_plus + LorVec_DTF_PDG_DiMuon;
  816. /////////////////////
  817. // DTF-values //
  818. /////////////////////
  819. LorVec_DTF_mu_minus = TLorentzVector (mu_minus_PX_DTF[0], mu_minus_PY_DTF[0], mu_minus_PZ_DTF[0], mu_minus_PE_DTF[0]);
  820. LorVec_DTF_mu_plus = TLorentzVector (mu_plus_PX_DTF[0], mu_plus_PY_DTF[0], mu_plus_PZ_DTF[0], mu_plus_PE_DTF[0]);
  821. if(Kst2Kspiplus){
  822. /// Ks, pi+
  823. LorVec_DTF_pi_plus = TLorentzVector (pi_plus_PX_DTF[0], pi_plus_PY_DTF[0], pi_plus_PZ_DTF[0], pi_plus_PE_DTF[0]);
  824. LorVec_DTF_KS_pi_plus = TLorentzVector (Ks_pi_plus_PX_DTF[0], Ks_pi_plus_PY_DTF[0], Ks_pi_plus_PZ_DTF[0], Ks_pi_plus_PE_DTF[0]);
  825. LorVec_DTF_KS_pi_minus = TLorentzVector (Ks_pi_minus_PX_DTF[0], Ks_pi_minus_PY_DTF[0], Ks_pi_minus_PZ_DTF[0], Ks_pi_minus_PE_DTF[0]);
  826. LorVec_DTF_pi_plus_MisIDed.SetXYZM (pi_plus_PX_DTF[0], pi_plus_PY_DTF[0], pi_plus_PZ_DTF[0], PDGMASS.MU);
  827. LorVec_DTF_mu_plus_MisIDed.SetXYZM (mu_plus_PX_DTF[0], mu_plus_PY_DTF[0], mu_plus_PZ_DTF[0], PDGMASS.PI_PLUS);
  828. }
  829. else{
  830. /// K+, pi0
  831. LorVec_DTF_K_plus = TLorentzVector (K_plus_PX_DTF[0], K_plus_PY_DTF[0], K_plus_PZ_DTF[0], K_plus_PE_DTF[0]);
  832. LorVec_DTF_gamma1 = TLorentzVector (gamma1_PX_DTF[0], gamma1_PY_DTF[0], gamma1_PZ_DTF[0], gamma1_PE_DTF[0]);
  833. LorVec_DTF_gamma2 = TLorentzVector (gamma2_PX_DTF[0], gamma2_PY_DTF[0], gamma2_PZ_DTF[0], gamma2_PE_DTF[0]);
  834. }
  835. //directly recombine the non-stable particles for later use (K*+ not really needed/used for Kst2Kspiplus)
  836. if(Kst2Kspiplus){
  837. LorVec_DTF_K_short = LorVec_DTF_KS_pi_plus + LorVec_DTF_KS_pi_minus;
  838. LorVec_DTF_KaonPion = LorVec_DTF_K_short + LorVec_DTF_pi_plus;
  839. }
  840. if(Kst2Kpluspi0Resolved){
  841. LorVec_DTF_DiGamma = LorVec_DTF_gamma1 + LorVec_DTF_gamma2;
  842. LorVec_DTF_pi_zero_resolved = LorVec_DTF_DiGamma;
  843. LorVec_DTF_KaonPion = LorVec_DTF_K_plus + LorVec_DTF_pi_zero_resolved;
  844. }
  845. LorVec_DTF_K_star_plus = LorVec_DTF_KaonPion;
  846. LorVec_DTF_DiMuon = LorVec_DTF_mu_minus + LorVec_DTF_mu_plus;
  847. LorVec_DTF_B_plus = LorVec_DTF_K_star_plus + LorVec_DTF_DiMuon;
  848. /////////////////////
  849. // PDG values //
  850. /////////////////////
  851. LorVec_PDG_B_plus.SetXYZM (B_plus_PX, B_plus_PY, B_plus_PZ, PDGMASS.B_PLUS);
  852. LorVec_PDG_K_star_plus.SetXYZM (K_star_plus_PX, K_star_plus_PY, K_star_plus_PZ, PDGMASS.K_STAR_PLUS);
  853. LorVec_PDG_mu_minus.SetXYZM (mu_minus_PX, mu_minus_PY, mu_minus_PZ, PDGMASS.MU);
  854. LorVec_PDG_mu_plus.SetXYZM (mu_plus_PX, mu_plus_PY, mu_plus_PZ, PDGMASS.MU);
  855. if(Kst2Kspiplus){
  856. /// Ks, pi+
  857. LorVec_PDG_K_short.SetXYZM (K_short_PX, K_short_PY, K_short_PZ, PDGMASS.K_SHORT);
  858. LorVec_PDG_pi_plus.SetXYZM (pi_plus_PX, pi_plus_PY, pi_plus_PZ, PDGMASS.PI_PLUS);
  859. LorVec_PDG_KS_pi_plus.SetXYZM (Ks_pi_plus_PX, Ks_pi_plus_PY, Ks_pi_plus_PZ, PDGMASS.PI_PLUS);
  860. LorVec_PDG_KS_pi_minus.SetXYZM (Ks_pi_minus_PX, Ks_pi_minus_PY, Ks_pi_minus_PZ, PDGMASS.PI_PLUS);
  861. LorVec_PDG_pi_plus_MisIDed.SetXYZM (pi_plus_PX, pi_plus_PY, pi_plus_PZ, PDGMASS.MU);
  862. LorVec_PDG_mu_plus_MisIDed.SetXYZM (mu_plus_PX, mu_plus_PY, mu_plus_PZ, PDGMASS.PI_PLUS);
  863. }
  864. else{
  865. /// K+, pi0
  866. LorVec_PDG_K_plus.SetXYZM (K_plus_PX, K_plus_PY, K_plus_PZ, PDGMASS.K_PLUS);
  867. LorVec_PDG_pi_zero_merged.SetXYZM (pi_zero_merged_PX, pi_zero_merged_PY, pi_zero_merged_PZ, PDGMASS.PI_ZERO);
  868. LorVec_PDG_pi_zero_resolved.SetXYZM (pi_zero_resolved_PX, pi_zero_resolved_PY, pi_zero_resolved_PZ, PDGMASS.PI_ZERO);
  869. LorVec_PDG_gamma1.SetXYZM (gamma1_PX, gamma1_PY, gamma1_PZ, PDGMASS.GAMMA);
  870. LorVec_PDG_gamma2.SetXYZM (gamma2_PX, gamma2_PY, gamma2_PZ, PDGMASS.GAMMA);
  871. }
  872. //Recombination of 'Parent'-Particles
  873. LorVec_PDG_DiMuon = LorVec_PDG_mu_minus + LorVec_PDG_mu_plus;
  874. if(Kst2Kspiplus){
  875. LorVec_PDG_KaonPion = LorVec_PDG_K_short + LorVec_PDG_pi_plus;
  876. }
  877. if(Kst2Kpluspi0Merged){
  878. LorVec_PDG_KaonPion = LorVec_PDG_K_plus + LorVec_PDG_pi_zero_merged;
  879. }
  880. if(Kst2Kpluspi0Resolved){ //todo: save both dtf and fixed masses
  881. LorVec_PDG_DiGamma = LorVec_PDG_gamma1 + LorVec_PDG_gamma2;
  882. LorVec_PDG_KaonPion = LorVec_PDG_K_plus + LorVec_PDG_DiGamma;
  883. }
  884. //////////////////////
  885. // detector values //
  886. //////////////////////
  887. LorVec_B_plus = TLorentzVector (B_plus_PX, B_plus_PY, B_plus_PZ, B_plus_PE);
  888. LorVec_K_star_plus = TLorentzVector (K_star_plus_PX, K_star_plus_PY, K_star_plus_PZ, K_star_plus_PE);
  889. LorVec_mu_minus = TLorentzVector (mu_minus_PX, mu_minus_PY, mu_minus_PZ, mu_minus_PE);
  890. LorVec_mu_plus = TLorentzVector (mu_plus_PX, mu_plus_PY, mu_plus_PZ, mu_plus_PE);
  891. if(Kst2Kspiplus){
  892. /// Ks, pi+
  893. LorVec_K_short = TLorentzVector (K_short_PX, K_short_PY, K_short_PZ, K_short_PE);
  894. LorVec_pi_plus = TLorentzVector (pi_plus_PX, pi_plus_PY, pi_plus_PZ, pi_plus_PE);
  895. LorVec_KS_pi_plus = TLorentzVector (Ks_pi_plus_PX, Ks_pi_plus_PY, Ks_pi_plus_PZ, Ks_pi_plus_PE);
  896. LorVec_KS_pi_minus = TLorentzVector (Ks_pi_minus_PX, Ks_pi_minus_PY, Ks_pi_minus_PZ, Ks_pi_minus_PE);
  897. LorVec_pi_plus_MisIDed.SetXYZM (pi_plus_PX, pi_plus_PY, pi_plus_PZ, PDGMASS.MU);
  898. LorVec_mu_plus_MisIDed.SetXYZM (mu_plus_PX, mu_plus_PY, mu_plus_PZ, PDGMASS.PI_PLUS);
  899. }
  900. else{
  901. /// K+, pi0
  902. LorVec_K_plus = TLorentzVector (K_plus_PX, K_plus_PY, K_plus_PZ, K_plus_PE);
  903. LorVec_pi_zero_merged = TLorentzVector (pi_zero_merged_PX, pi_zero_merged_PY, pi_zero_merged_PZ, pi_zero_merged_PE);
  904. LorVec_pi_zero_resolved = TLorentzVector (pi_zero_resolved_PX, pi_zero_resolved_PY, pi_zero_resolved_PZ, pi_zero_resolved_PE);
  905. LorVec_gamma1 = TLorentzVector (gamma1_PX, gamma1_PY, gamma1_PZ, gamma1_PE);
  906. LorVec_gamma2 = TLorentzVector (gamma2_PX, gamma2_PY, gamma2_PZ, gamma2_PE);
  907. }
  908. //Recombination of 'Parent'-Particles
  909. LorVec_DiMuon = LorVec_mu_minus + LorVec_mu_plus;
  910. if(Kst2Kspiplus){
  911. LorVec_KaonPion = LorVec_K_short + LorVec_pi_plus;
  912. }
  913. if(Kst2Kpluspi0Merged){
  914. LorVec_KaonPion = LorVec_K_plus + LorVec_pi_zero_merged;
  915. }
  916. if(Kst2Kpluspi0Resolved){
  917. LorVec_DiGamma = LorVec_gamma1 + LorVec_gamma2;
  918. LorVec_KaonPion = LorVec_K_plus + LorVec_DiGamma;
  919. }
  920. //Recombination of Particles
  921. if(Kst2Kspiplus){
  922. LorVec_DTF_PDG_KshortMuMu = LorVec_DTF_PDG_K_short+ LorVec_DTF_PDG_DiMuon;
  923. LorVec_DTF_KshortMuMu = LorVec_DTF_K_short + LorVec_DTF_DiMuon;
  924. LorVec_PDG_KshortMuMu = LorVec_PDG_K_short + LorVec_PDG_DiMuon;
  925. LorVec_KshortMuMu = LorVec_K_short + LorVec_DiMuon;
  926. }
  927. if(Kst2Kpluspi0Merged){
  928. LorVec_DTF_PDG_KplusMuMu = LorVec_DTF_PDG_K_plus + LorVec_DTF_PDG_DiMuon;
  929. LorVec_DTF_KplusMuMu = LorVec_DTF_K_plus + LorVec_DTF_DiMuon;
  930. LorVec_PDG_KplusMuMu = LorVec_PDG_K_plus + LorVec_PDG_DiMuon;
  931. LorVec_KplusMuMu = LorVec_K_plus + LorVec_DiMuon;
  932. }
  933. if(Kst2Kpluspi0Resolved){
  934. LorVec_DTF_PDG_KplusMuMu = LorVec_DTF_PDG_K_plus + LorVec_DTF_PDG_DiMuon;
  935. LorVec_DTF_KplusMuMu = LorVec_DTF_K_plus + LorVec_DTF_DiMuon;
  936. LorVec_PDG_KplusMuMu = LorVec_PDG_K_plus + LorVec_PDG_DiMuon;
  937. LorVec_KplusMuMu = LorVec_K_plus + LorVec_DiMuon;
  938. LorVec_DTF_PDG_ReconBPiZero = LorVec_DTF_PDG_DiMuon + LorVec_DTF_PDG_K_plus + LorVec_DTF_PDG_pi_zero_resolved;
  939. LorVec_DTF_ReconBPiZero = LorVec_DTF_DiMuon + LorVec_DTF_K_plus + LorVec_DTF_pi_zero_resolved;
  940. LorVec_PDG_ReconBPiZero = LorVec_PDG_DiMuon + LorVec_PDG_K_plus + LorVec_PDG_pi_zero_resolved;
  941. LorVec_ReconBPiZero = LorVec_DiMuon + LorVec_K_plus + LorVec_pi_zero_resolved;
  942. LorVec_DTF_PDG_pi_zero_resolved = LorVec_DTF_PDG_DiGamma;
  943. LorVec_DTF_pi_zero_resolved = LorVec_DTF_DiGamma;
  944. LorVec_PDG_pi_zero_resolved = LorVec_PDG_DiGamma;
  945. LorVec_pi_zero_resolved = LorVec_DiGamma;
  946. }
  947. LorVec_DTF_PDG_K_star_plus = LorVec_DTF_PDG_KaonPion;
  948. LorVec_DTF_K_star_plus = LorVec_DTF_KaonPion;
  949. LorVec_PDG_K_star_plus = LorVec_PDG_KaonPion;
  950. LorVec_K_star_plus = LorVec_KaonPion;
  951. LorVec_DTF_PDG_ReconB = LorVec_DTF_PDG_DiMuon + LorVec_DTF_PDG_K_star_plus;
  952. LorVec_DTF_ReconB = LorVec_DTF_DiMuon + LorVec_DTF_K_star_plus;
  953. LorVec_PDG_ReconB = LorVec_PDG_DiMuon + LorVec_PDG_K_star_plus;
  954. LorVec_ReconB = LorVec_DiMuon + LorVec_K_star_plus;
  955. //fill MASS HISTOGRAMS
  956. h_B_M_DTF_PDG ->Fill(LorVec_DTF_PDG_ReconB.M());
  957. h_B_M_DTF ->Fill(LorVec_DTF_ReconB.M());
  958. h_B_M_PDG ->Fill(LorVec_PDG_ReconB.M());
  959. h_B_M ->Fill(LorVec_ReconB.M());
  960. h_Kstar_M_DTF_PDG ->Fill(LorVec_DTF_PDG_K_star_plus.M());
  961. h_Kstar_M_DTF ->Fill(LorVec_DTF_K_star_plus.M());
  962. h_Kstar_M_PDG ->Fill(LorVec_PDG_K_star_plus.M());
  963. h_Kstar_M ->Fill(LorVec_K_star_plus.M());
  964. if(Kst2Kspiplus){
  965. h_Kshort_M_DTF_PDG ->Fill(LorVec_DTF_PDG_K_short.M());
  966. h_Kshort_M_DTF ->Fill(LorVec_DTF_K_short.M());
  967. h_Kshort_M_PDG ->Fill(LorVec_PDG_K_short.M());
  968. h_Kshort_M ->Fill(LorVec_K_short.M());
  969. }
  970. if (Kst2Kpluspi0Resolved){
  971. h_pi0_M_DTF_PDG ->Fill(LorVec_DTF_PDG_pi_zero_resolved.M());
  972. h_pi0_M_DTF ->Fill(LorVec_DTF_pi_zero_resolved.M());
  973. h_pi0_M_PDG ->Fill(LorVec_PDG_pi_zero_resolved.M());
  974. h_pi0_M ->Fill(LorVec_pi_zero_resolved.M());
  975. }
  976. //fill PT HISTOGRAMS
  977. h_B_PT_DTF_PDG ->Fill(LorVec_DTF_PDG_ReconB.Pt());
  978. h_B_PT_DTF ->Fill(LorVec_DTF_ReconB.Pt());
  979. h_B_PT_PDG ->Fill(LorVec_PDG_ReconB.Pt());
  980. h_B_PT ->Fill(LorVec_ReconB.Pt());
  981. h_Kstar_PT_DTF_PDG ->Fill(LorVec_DTF_PDG_K_star_plus.Pt());
  982. h_Kstar_PT_DTF ->Fill(LorVec_DTF_K_star_plus.Pt());
  983. h_Kstar_PT_PDG ->Fill(LorVec_PDG_K_star_plus.Pt());
  984. h_Kstar_PT ->Fill(LorVec_K_star_plus.Pt());
  985. if(Kst2Kspiplus){
  986. h_Kshort_PT_DTF_PDG ->Fill(LorVec_DTF_PDG_K_short.Pt());
  987. h_Kshort_PT_DTF ->Fill(LorVec_DTF_K_short.Pt());
  988. h_Kshort_PT_PDG ->Fill(LorVec_PDG_K_short.Pt());
  989. h_Kshort_PT ->Fill(LorVec_K_short.Pt());
  990. }
  991. if (Kst2Kpluspi0Resolved){
  992. h_pi0_PT_DTF_PDG ->Fill(LorVec_DTF_PDG_pi_zero_resolved.Pt());
  993. h_pi0_PT_DTF ->Fill(LorVec_DTF_pi_zero_resolved.Pt());
  994. h_pi0_PT_PDG ->Fill(LorVec_PDG_pi_zero_resolved.Pt());
  995. h_pi0_PT ->Fill(LorVec_pi_zero_resolved.Pt());
  996. }
  997. //fill ETA HISTOGRAMS
  998. h_B_ETA_DTF_PDG ->Fill(LorVec_DTF_PDG_ReconB.Eta() );
  999. h_B_ETA_DTF ->Fill(LorVec_DTF_ReconB.Eta());
  1000. h_B_ETA_PDG ->Fill(LorVec_PDG_ReconB.Eta());
  1001. h_B_ETA ->Fill(LorVec_ReconB.Eta());
  1002. h_Kstar_ETA_DTF_PDG ->Fill(LorVec_DTF_PDG_K_star_plus.Eta());
  1003. h_Kstar_ETA_DTF ->Fill(LorVec_DTF_K_star_plus.Eta());
  1004. h_Kstar_ETA_PDG ->Fill(LorVec_PDG_K_star_plus.Eta());
  1005. h_Kstar_ETA ->Fill(LorVec_K_star_plus.Eta());
  1006. if(Kst2Kspiplus){
  1007. h_Kshort_ETA_DTF_PDG ->Fill(LorVec_DTF_PDG_K_short.Eta());
  1008. h_Kshort_ETA_DTF ->Fill(LorVec_DTF_K_short.Eta());
  1009. h_Kshort_ETA_PDG ->Fill(LorVec_PDG_K_short.Eta());
  1010. h_Kshort_ETA ->Fill(LorVec_K_short.Eta());
  1011. }
  1012. if (Kst2Kpluspi0Resolved){
  1013. h_pi0_ETA_DTF_PDG ->Fill(LorVec_DTF_PDG_pi_zero_resolved.Eta());
  1014. h_pi0_ETA_DTF ->Fill(LorVec_DTF_pi_zero_resolved.Eta());
  1015. h_pi0_ETA_PDG ->Fill(LorVec_PDG_pi_zero_resolved.Eta());
  1016. h_pi0_ETA ->Fill(LorVec_pi_zero_resolved.Eta());
  1017. }
  1018. //fill angles
  1019. h_ctk->Fill(ThetaK);
  1020. h_ctl->Fill(ThetaL);
  1021. h_sp->Fill(Phi);
  1022. //fill other variables
  1023. if (Kst2Kpluspi0Resolved){
  1024. OpenAngle_DTF_PDG = LorVec_DTF_PDG_gamma1.Angle(LorVec_DTF_PDG_gamma2.Vect());
  1025. OpenAngle_DTF = LorVec_DTF_gamma1.Angle(LorVec_DTF_gamma2.Vect());
  1026. OpenAngle_PDG = LorVec_PDG_gamma1.Angle(LorVec_PDG_gamma2.Vect());
  1027. OpenAngle = LorVec_gamma1.Angle(LorVec_gamma2.Vect());
  1028. h_OpenAngle_DTF_PDG ->Fill(OpenAngle_DTF_PDG);
  1029. h_OpenAngle_DTF ->Fill(OpenAngle_DTF);
  1030. h_OpenAngle_PDG ->Fill(OpenAngle_PDG);
  1031. h_OpenAngle ->Fill(OpenAngle);
  1032. }
  1033. } //end of event loop
  1034. // Kst2Kpluspi0Resolved case
  1035. string newName = "";
  1036. preselected ? newName = "_DTFcheck_preselected" : newName ="_DTFcheck";
  1037. if (truthMatched) newName = newName + "_TM";
  1038. if(Kst2Kpluspi0Resolved){
  1039. if(!MC){
  1040. output = new TFile(Form("%s/data/%s%s/%s%s_pi0Resolved%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()),"RECREATE");
  1041. }
  1042. else{
  1043. if(ReferenceChannel){
  1044. output = new TFile(Form("%s/data/MC/RefKplusPi0/%s%s/%s%s_pi0Resolved%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()),"RECREATE");
  1045. }
  1046. else if(PHSP){
  1047. output = new TFile(Form("%s/data/PHSP/KplusPi0/%s%s/%s%s_pi0Resolved%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()),"RECREATE");
  1048. }
  1049. else{
  1050. output = new TFile(Form("%s/data/MC/KplusPi0/%s%s/%s%s_pi0Resolved%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()),"RECREATE");
  1051. }
  1052. }
  1053. }
  1054. // Kst2Kpluspi0Merged case
  1055. if(Kst2Kpluspi0Merged){
  1056. if(!MC){
  1057. output = new TFile(Form("%s/data/%s%s/%s%s_pi0Merged%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()),"RECREATE");
  1058. }
  1059. else{
  1060. if(ReferenceChannel){
  1061. output = new TFile(Form("%s/data/MC/RefKplusPi0/%s%s/%s%s_pi0Merged%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()),"RECREATE");
  1062. }
  1063. else if(PHSP){
  1064. output = new TFile(Form("%s/data/PHSP/KplusPi0/%s%s/%s%s_pi0Merged%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()),"RECREATE");
  1065. }
  1066. else{
  1067. output = new TFile(Form("%s/data/MC/KplusPi0/%s%s/%s%s_pi0Merged%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()),"RECREATE");
  1068. }
  1069. }
  1070. }
  1071. // Kst2Kspiplus case
  1072. if(Kst2Kspiplus){
  1073. if(!MC){
  1074. output = new TFile(Form("%s/data/%s%s/%s%s_piplus%s.root",path_to_output_KshortPiplus.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()),"RECREATE");
  1075. }
  1076. else{
  1077. if(ReferenceChannel){
  1078. output = new TFile(Form("%s/data/MC/RefKshortPiplus/%s%s/%s%s_piplus%s.root",path_to_output_KshortPiplus.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()),"RECREATE");
  1079. }
  1080. else if(PHSP){
  1081. output = new TFile(Form("%s/data/PHSP/KshortPiplus/%s%s/%s%s_piplus%s.root",path_to_output_KshortPiplus.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()),"RECREATE");
  1082. }
  1083. else{
  1084. output = new TFile(Form("%s/data/MC/KshortPiplus/%s%s/%s%s_piplus%s.root",path_to_output_KshortPiplus.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()),"RECREATE");
  1085. }
  1086. }
  1087. }
  1088. output->cd();
  1089. //save MASS HISTOGRAMS
  1090. h_B_M_DTF_PDG ->Write();
  1091. h_B_M_DTF ->Write();
  1092. h_B_M_PDG ->Write();
  1093. h_B_M ->Write();
  1094. h_Kstar_M_DTF_PDG ->Write();
  1095. h_Kstar_M_DTF ->Write();
  1096. h_Kstar_M_PDG ->Write();
  1097. h_Kstar_M ->Write();
  1098. if(Kst2Kspiplus){
  1099. h_Kshort_M_DTF_PDG ->Write();
  1100. h_Kshort_M_DTF ->Write();
  1101. h_Kshort_M_PDG ->Write();
  1102. h_Kshort_M ->Write();
  1103. }
  1104. if (Kst2Kpluspi0Resolved){
  1105. h_pi0_M_DTF_PDG ->Write();
  1106. h_pi0_M_DTF ->Write();
  1107. h_pi0_M_PDG ->Write();
  1108. h_pi0_M ->Write();
  1109. }
  1110. //save PT HISTOGRAMS
  1111. h_B_PT_DTF_PDG ->Write();
  1112. h_B_PT_DTF ->Write();
  1113. h_B_PT_PDG ->Write();
  1114. h_B_PT ->Write();
  1115. h_Kstar_PT_DTF_PDG ->Write();
  1116. h_Kstar_PT_DTF ->Write();
  1117. h_Kstar_PT_PDG ->Write();
  1118. h_Kstar_PT ->Write();
  1119. if(Kst2Kspiplus){
  1120. h_Kshort_PT_DTF_PDG ->Write();
  1121. h_Kshort_PT_DTF ->Write();
  1122. h_Kshort_PT_PDG ->Write();
  1123. h_Kshort_PT ->Write();
  1124. }
  1125. if (Kst2Kpluspi0Resolved){
  1126. h_pi0_PT_DTF_PDG ->Write();
  1127. h_pi0_PT_DTF ->Write();
  1128. h_pi0_PT_PDG ->Write();
  1129. h_pi0_PT ->Write();
  1130. }
  1131. //save ETA HISTOGRAMS
  1132. h_B_ETA_DTF_PDG ->Write();
  1133. h_B_ETA_DTF ->Write();
  1134. h_B_ETA_PDG ->Write();
  1135. h_B_ETA ->Write();
  1136. h_Kstar_ETA_DTF_PDG ->Write();
  1137. h_Kstar_ETA_DTF ->Write();
  1138. h_Kstar_ETA_PDG ->Write();
  1139. h_Kstar_ETA ->Write();
  1140. if(Kst2Kspiplus){
  1141. h_Kshort_ETA_DTF_PDG ->Write();
  1142. h_Kshort_ETA_DTF ->Write();
  1143. h_Kshort_ETA_PDG ->Write();
  1144. h_Kshort_ETA ->Write();
  1145. }
  1146. if (Kst2Kpluspi0Resolved){
  1147. h_pi0_ETA_DTF_PDG ->Write();
  1148. h_pi0_ETA_DTF ->Write();
  1149. h_pi0_ETA_PDG ->Write();
  1150. h_pi0_ETA ->Write();
  1151. //save other histograms
  1152. h_OpenAngle_DTF_PDG ->Write();
  1153. h_OpenAngle_DTF ->Write();
  1154. h_OpenAngle_PDG ->Write();
  1155. h_OpenAngle ->Write();
  1156. }
  1157. //save Angle histograms
  1158. // h_ctk ->Write();
  1159. // h_ctl ->Write();
  1160. // h_sp ->Write();
  1161. output->Close();
  1162. cout << "[INFO]\t\t Histograms created." << endl;
  1163. return 1;
  1164. }
  1165. int DTFcomparisonAllData(Int_t Run = 1, bool preselected = true) {
  1166. if(Run != 1 && Run != 2){
  1167. std::cout << "[ERROR]\t\tInvalid Run number given: " << Run << ". Exit program!" << std::endl;
  1168. return 0;
  1169. }
  1170. if ( DTFcomparison((Run == 1 ? "2011" : "2015"),"down", false, false, false, preselected, 0) == 0) return 0;
  1171. if ( DTFcomparison((Run == 1 ? "2011" : "2015"),"up" , false, false, false, preselected, 0) == 0) return 0;
  1172. if ( DTFcomparison((Run == 1 ? "2012" : "2016"),"down", false, false, false, preselected, 0) == 0) return 0;
  1173. if ( DTFcomparison((Run == 1 ? "2012" : "2016"),"up" , false, false, false, preselected, 0) == 0) return 0;
  1174. return 1;
  1175. }
  1176. int DTFcomparisonAllMC(Int_t Run = 1, bool preselected = true, bool truthMatched = false) {
  1177. if(Run != 1 && Run != 2){
  1178. std::cout << "[ERROR]\t\tInvalid Run number given: " << Run << ". Exit program!" << std::endl;
  1179. return 0;
  1180. }
  1181. if ( DTFcomparison((Run == 1 ? "2011" : "2015"),"down", true, false, false, preselected, truthMatched) == 0) return 0;
  1182. if ( DTFcomparison((Run == 1 ? "2011" : "2015"),"up" , true, false, false, preselected, truthMatched) == 0) return 0;
  1183. if ( DTFcomparison((Run == 1 ? "2012" : "2016"),"down", true, false, false, preselected, truthMatched) == 0) return 0;
  1184. if ( DTFcomparison((Run == 1 ? "2012" : "2016"),"up" , true, false, false, preselected, truthMatched) == 0) return 0;
  1185. return 1;
  1186. }
  1187. int DTFcomparisonAllRefChannel(Int_t Run = 1, bool preselected = true, bool truthMatched = false) {
  1188. if(Run != 1 && Run != 2){
  1189. std::cout << "[ERROR]\t\tInvalid Run number given: " << Run << ". Exit program!" << std::endl;
  1190. return 0;
  1191. }
  1192. if ( DTFcomparison((Run == 1 ? "2011" : "2015"),"down", true, true, false, preselected, truthMatched) == 0) return 0;
  1193. if ( DTFcomparison((Run == 1 ? "2011" : "2015"),"up" , true, true, false, preselected, truthMatched) == 0) return 0;
  1194. if ( DTFcomparison((Run == 1 ? "2012" : "2016"),"down", true, true, false, preselected, truthMatched) == 0) return 0;
  1195. if ( DTFcomparison((Run == 1 ? "2012" : "2016"),"up" , true, true, false, preselected, truthMatched) == 0) return 0;
  1196. return 1;
  1197. }
  1198. int DTFcomparisonAllPHSP(Int_t Run = 1, bool preselected = true, bool truthMatched = false) {
  1199. if(Run != 1 && Run != 2){
  1200. std::cout << "[ERROR]\t\tInvalid Run number given: " << Run << ". Exit program!" << std::endl;
  1201. return 0;
  1202. }
  1203. if ( DTFcomparison((Run == 1 ? "2011" : "2015"),"down", true, false, true, preselected, truthMatched) == 0) return 0;
  1204. if ( DTFcomparison((Run == 1 ? "2011" : "2015"),"up" , true, false, true, preselected, truthMatched) == 0) return 0;
  1205. if ( DTFcomparison((Run == 1 ? "2012" : "2016"),"down", true, false, true, preselected, truthMatched) == 0) return 0;
  1206. if ( DTFcomparison((Run == 1 ? "2012" : "2016"),"up" , true, false, true, preselected, truthMatched) == 0) return 0;
  1207. return 1;
  1208. }
  1209. int DTFcomparisonAll( Int_t Run = 1, bool preselected = true, bool truthMatched = false) {
  1210. if (DTFcomparisonAllData (Run, preselected)==0) return 0;
  1211. if (DTFcomparisonAllMC (Run, preselected, truthMatched)==0) return 0;
  1212. if (Run == 2) cout << "[INFO]\tNo reference channel for run 2, Skipping.";
  1213. else{
  1214. if (DTFcomparisonAllRefChannel (Run, preselected, truthMatched)==0) return 0;
  1215. }
  1216. if (DTFcomparisonAllPHSP (Run, preselected, truthMatched)==0) return 0;
  1217. return 1;
  1218. }
  1219. int DTFcomparisonComplete( Int_t Run = 1){
  1220. if (DTFcomparisonAllData (Run, 1)==0) return 0;
  1221. if (DTFcomparisonAllData (Run, 0)==0) return 0;
  1222. if (DTFcomparisonAllMC (Run, 0, 0)==0) return 0;
  1223. if (DTFcomparisonAllMC (Run, 1, 0)==0) return 0;
  1224. if (DTFcomparisonAllMC (Run, 1, 1)==0) return 0;
  1225. if (DTFcomparisonAllRefChannel (Run, 0, 0)==0) return 0;
  1226. if (DTFcomparisonAllRefChannel (Run, 1, 0)==0) return 0;
  1227. if (DTFcomparisonAllRefChannel (Run, 1, 1)==0) return 0;
  1228. if (DTFcomparisonAllPHSP (Run, 0, 0)==0) return 0;
  1229. if (DTFcomparisonAllPHSP (Run, 1, 0)==0) return 0;
  1230. if (DTFcomparisonAllPHSP (Run, 1, 1)==0) return 0;
  1231. return 1;
  1232. }
  1233. int plotDTFcomparison(std::string year = "2011", std::string magnet = "down", bool MC = false, bool ReferenceChannel = false, bool PHSP = false, bool preselected = true, bool truthMatched = false){
  1234. // Kst2Kpluspi0Resolved case
  1235. TFile *input = 0;
  1236. string newName = "";
  1237. string legTitle = "";
  1238. string TM = "";
  1239. preselected ? newName = "_DTFcheck_preselected" : newName ="_DTFcheck";
  1240. truthMatched ? TM = "_TM" : "";
  1241. newName = newName + TM;
  1242. Kst2Kspiplus? legTitle= particleLatex("Kstar") +" #rightarrow " +particleLatex("Kshort") + particleLatex("piplus") :legTitle= particleLatex("Kstar") +" #rightarrow " +particleLatex("Kplus") + particleLatex("pizero");
  1243. preselected ? legTitle= legTitle + ": preselected" : legTitle = legTitle+": stripped";
  1244. truthMatched ? legTitle= "#splitline{" + legTitle+":}{TruthMatched}" : legTitle = legTitle;
  1245. if (MC){
  1246. if(ReferenceChannel) legTitle = legTitle + " {MCRef}";
  1247. else if (PHSP) legTitle = legTitle + " {PHSP MC}";
  1248. else legTitle = legTitle + " {MC}";
  1249. }
  1250. if(Kst2Kpluspi0Resolved){
  1251. if(!MC){
  1252. input = TFile::Open(Form("%s/data/%s%s/%s%s_pi0Resolved%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()));
  1253. cout << Form("%s/data/%s%s/%s%s_pi0Resolved%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()) << endl;
  1254. }
  1255. else{
  1256. if(ReferenceChannel){
  1257. input = TFile::Open(Form("%s/data/MC/RefKplusPi0/%s%s/%s%s_pi0Resolved%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()));
  1258. }
  1259. else if(PHSP){
  1260. input = TFile::Open(Form("%s/data/PHSP/KplusPi0/%s%s/%s%s_pi0Resolved%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()));
  1261. }
  1262. else{
  1263. input = TFile::Open(Form("%s/data/MC/KplusPi0/%s%s/%s%s_pi0Resolved%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()));
  1264. }
  1265. }
  1266. }
  1267. // Kst2Kpluspi0Merged case
  1268. if(Kst2Kpluspi0Merged){
  1269. if(!MC){
  1270. input = TFile::Open(Form("%s/data/%s%s/%s%s_pi0Merged%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()));
  1271. }
  1272. else{
  1273. if(ReferenceChannel){
  1274. input = TFile::Open(Form("%s/data/MC/RefKplusPi0/%s%s/%s%s_pi0Merged%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()));
  1275. }
  1276. else if(PHSP){
  1277. input = TFile::Open(Form("%s/data/PHSP/KplusPi0/%s%s/%s%s_pi0Merged%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()));
  1278. }
  1279. else{
  1280. input = TFile::Open(Form("%s/data/MC/KplusPi0/%s%s/%s%s_pi0Merged%s.root",path_to_output_KplusPizero.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()));
  1281. }
  1282. }
  1283. }
  1284. // Kst2Kspiplus case
  1285. if(Kst2Kspiplus){
  1286. if(!MC){
  1287. input = TFile::Open(Form("%s/data/%s%s/%s%s_piplus%s.root",path_to_output_KshortPiplus.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()));
  1288. }
  1289. else{
  1290. if(ReferenceChannel){
  1291. input = TFile::Open(Form("%s/data/MC/RefKshortPiplus/%s%s/%s%s_piplus%s.root",path_to_output_KshortPiplus.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()));
  1292. }
  1293. else if(PHSP){
  1294. input = TFile::Open(Form("%s/data/PHSP/KshortPiplus/%s%s/%s%s_piplus%s.root",path_to_output_KshortPiplus.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()));
  1295. }
  1296. else{
  1297. input = TFile::Open(Form("%s/data/MC/KshortPiplus/%s%s/%s%s_piplus%s.root",path_to_output_KshortPiplus.c_str(), year.c_str(),magnet.c_str(),year.c_str(),magnet.c_str(),newName.c_str()));
  1298. }
  1299. }
  1300. }
  1301. string tmpName = "";
  1302. string tmpNameCanvas = "";
  1303. int col = 1;
  1304. if(Kst2Kpluspi0Resolved){
  1305. for (auto& var: Variables){
  1306. for (auto& particle: ParticlesPiZero){
  1307. tmpNameCanvas = "c_" + particle + "_" + var;
  1308. TCanvas *canvas = new TCanvas(tmpNameCanvas.c_str(), "", 10,10,600,600);
  1309. designCanvas(canvas);
  1310. canvas->cd();
  1311. gStyle->SetOptStat(0);
  1312. TLegend *leg = new TLegend(0.57,0.78,0.96,0.96);
  1313. col = 1;
  1314. for (auto& opt: DTFoptions){
  1315. tmpName = "h_" + particle + "_" + var + "_" + opt;
  1316. if (strcmp(&tmpName[tmpName.length()-1],"_")==0) tmpName.pop_back(); //if ending with _, remove it
  1317. TH1D* tmp = (TH1D*)input->Get(tmpName.c_str()); //check memory leaks
  1318. designPlots(tmp,col);
  1319. designLegend(leg, legTitle, tmp, opt);
  1320. //tmp->SetTitle((variableLatex(var)+"(" + particleLatex(particle)+")").c_str());
  1321. tmp->Draw("SAME");
  1322. col++;
  1323. }
  1324. leg->Draw();
  1325. tmpName = path_to_output_KplusPizero;
  1326. if (MC){
  1327. if(ReferenceChannel) tmpName = tmpName + "/data/MC/RefKplusPi0/" + year + magnet;
  1328. else if (PHSP) tmpName = tmpName + "/data/PHSP/KplusPi0/" + year + magnet;
  1329. else tmpName = tmpName + "/data/MC/KplusPi0/" + year + magnet;
  1330. }
  1331. else tmpName = tmpName + "/data/" + year + magnet;
  1332. tmpNameCanvas = tmpName + "/" + tmpNameCanvas + TM + (preselected ? "_preselected" :"") + "." +figureFormat;
  1333. canvas->Print(tmpNameCanvas.c_str(),figureFormat.c_str()); //#TODO: cancel piplus, replace by path_to accordingly
  1334. leg->Clear();
  1335. canvas->Clear();
  1336. delete(leg);
  1337. delete(canvas);
  1338. }
  1339. }
  1340. for (auto& evar: ExtraVariables){
  1341. tmpNameCanvas = "c_" + evar;
  1342. TCanvas *canvas = new TCanvas(tmpNameCanvas.c_str(), "", 10,10,600,600);
  1343. designCanvas(canvas);
  1344. canvas->cd();
  1345. gStyle->SetOptStat(0);
  1346. TLegend *leg = new TLegend(0.62,0.8,0.96,0.96);
  1347. col = 1;
  1348. for (auto& opt: DTFoptions){
  1349. tmpName = "h_" + evar + "_" + opt;
  1350. if (strcmp(&tmpName[tmpName.length()-1],"_")==0) tmpName.pop_back(); //if ending with _, remove it
  1351. TH1D* tmp = (TH1D*)input->Get(tmpName.c_str()); //check memory leaks
  1352. designPlots(tmp,col);
  1353. designLegend(leg, legTitle, tmp, opt);
  1354. // tmp->SetTitle((variableLatex(evar)).c_str());
  1355. tmp->Draw("SAME");
  1356. col++;
  1357. }
  1358. leg->Draw();
  1359. tmpName = path_to_output_KplusPizero;
  1360. if (MC){
  1361. if(ReferenceChannel) tmpName = tmpName + "/data/MC/RefKplusPi0/" + year + magnet;
  1362. else if (PHSP) tmpName = tmpName + "/data/PHSP/KplusPi0/" + year + magnet;
  1363. else tmpName = tmpName + "/data/MC/KplusPi0/" + year + magnet;
  1364. }
  1365. else tmpName = tmpName + "/data/" + year + magnet;
  1366. tmpNameCanvas = tmpName + "/" + tmpNameCanvas + TM + (preselected ? "_preselected" :"") + "." +figureFormat;
  1367. canvas->Print(tmpNameCanvas.c_str(),figureFormat.c_str()); //#TODO: cancel piplus, replace by path_to accordingly
  1368. leg->Clear();
  1369. canvas->Clear();
  1370. delete(leg);
  1371. delete(canvas);
  1372. }
  1373. }
  1374. if(Kst2Kspiplus){
  1375. for (auto& var: Variables){
  1376. for (auto& particle: ParticlesKShort){
  1377. tmpNameCanvas = "c_" + particle + "_" + var;
  1378. TCanvas *canvas = new TCanvas(tmpNameCanvas.c_str(), "", 10,10,600,600);
  1379. designCanvas(canvas);
  1380. canvas->cd();
  1381. gStyle->SetOptStat(0);
  1382. TLegend *leg = new TLegend(0.62,0.8,0.96,0.96);
  1383. col = 1;
  1384. for (auto& opt: DTFoptions){
  1385. tmpName = "h_" + particle + "_" + var + "_" + opt;
  1386. if (strcmp(&tmpName[tmpName.length()-1],"_")==0) tmpName.pop_back(); //if ending with _, remove it
  1387. TH1D* tmp = (TH1D*)input->Get(tmpName.c_str()); //check memory leaks
  1388. designPlots(tmp,col);
  1389. designLegend(leg, legTitle, tmp, opt);
  1390. // tmp->SetTitle((variableLatex(var)+"(" + particleLatex(particle)+")").c_str());
  1391. tmp->Draw("SAME");
  1392. col++;
  1393. }
  1394. leg->Draw();
  1395. tmpName = path_to_output_KshortPiplus;
  1396. if (MC){
  1397. if(ReferenceChannel) tmpName = tmpName + "/data/MC/RefKplusPi0/" + year + magnet;
  1398. else if (PHSP) tmpName = tmpName + "/data/PHSP/KplusPi0/" + year + magnet;
  1399. else tmpName = tmpName + "/data/MC/KplusPi0/" + year + magnet;
  1400. }
  1401. else tmpName = tmpName + "/data/" + year + magnet;
  1402. tmpNameCanvas = tmpName + "/piplus_" + tmpNameCanvas +TM + (preselected ? "_preselected" :"") + "." +figureFormat;
  1403. canvas->Print(tmpNameCanvas.c_str(),figureFormat.c_str()); //#TODO: cancel piplus, replace by path_to accordingly
  1404. leg->Clear();
  1405. canvas->Clear();
  1406. delete(leg);
  1407. delete(canvas);
  1408. }
  1409. }
  1410. }
  1411. return 1;
  1412. }
  1413. int plotDTFcomparisonAllData(Int_t Run = 1, bool preselected = true) {
  1414. if(Run != 1 && Run != 2){
  1415. std::cout << "[ERROR]\t\tInvalid Run number given: " << Run << ". Exit program!" << std::endl;
  1416. return 0;
  1417. }
  1418. if ( plotDTFcomparison((Run == 1 ? "2011" : "2015"),"down", false, false, false, preselected, 0) == 0) return 0;
  1419. if ( plotDTFcomparison((Run == 1 ? "2011" : "2015"),"up" , false, false, false, preselected, 0) == 0) return 0;
  1420. if ( plotDTFcomparison((Run == 1 ? "2012" : "2016"),"down", false, false, false, preselected, 0) == 0) return 0;
  1421. if ( plotDTFcomparison((Run == 1 ? "2012" : "2016"),"up" , false, false, false, preselected, 0) == 0) return 0;
  1422. return 1;
  1423. }
  1424. int plotDTFcomparisonAllMC(Int_t Run = 1, bool preselected = true, bool truthMatched = false) {
  1425. if(Run != 1 && Run != 2){
  1426. std::cout << "[ERROR]\t\tInvalid Run number given: " << Run << ". Exit program!" << std::endl;
  1427. return 0;
  1428. }
  1429. if ( plotDTFcomparison((Run == 1 ? "2011" : "2015"),"down", true, false, false, preselected, truthMatched) == 0) return 0;
  1430. if ( plotDTFcomparison((Run == 1 ? "2011" : "2015"),"up" , true, false, false, preselected, truthMatched) == 0) return 0;
  1431. if ( plotDTFcomparison((Run == 1 ? "2012" : "2016"),"down", true, false, false, preselected, truthMatched) == 0) return 0;
  1432. if ( plotDTFcomparison((Run == 1 ? "2012" : "2016"),"up" , true, false, false, preselected, truthMatched) == 0) return 0;
  1433. return 1;
  1434. }
  1435. int plotDTFcomparisonAllRefChannel(Int_t Run = 1, bool preselected = true, bool truthMatched = false) {
  1436. if(Run != 1 && Run != 2){
  1437. std::cout << "[ERROR]\t\tInvalid Run number given: " << Run << ". Exit program!" << std::endl;
  1438. return 0;
  1439. }
  1440. if ( plotDTFcomparison((Run == 1 ? "2011" : "2015"),"down", true, true, false, preselected, truthMatched) == 0) return 0;
  1441. if ( plotDTFcomparison((Run == 1 ? "2011" : "2015"),"up" , true, true, false, preselected, truthMatched) == 0) return 0;
  1442. if ( plotDTFcomparison((Run == 1 ? "2012" : "2016"),"down", true, true, false, preselected, truthMatched) == 0) return 0;
  1443. if ( plotDTFcomparison((Run == 1 ? "2012" : "2016"),"up" , true, true, false, preselected, truthMatched) == 0) return 0;
  1444. return 1;
  1445. }
  1446. int plotDTFcomparisonAllPHSP(Int_t Run = 1, bool preselected = true, bool truthMatched = false) {
  1447. if(Run != 1 && Run != 2){
  1448. std::cout << "[ERROR]\t\tInvalid Run number given: " << Run << ". Exit program!" << std::endl;
  1449. return 0;
  1450. }
  1451. if ( plotDTFcomparison((Run == 1 ? "2011" : "2015"),"down", true, false, true, preselected, truthMatched) == 0) return 0;
  1452. if ( plotDTFcomparison((Run == 1 ? "2011" : "2015"),"up" , true, false, true, preselected, truthMatched) == 0) return 0;
  1453. if ( plotDTFcomparison((Run == 1 ? "2012" : "2016"),"down", true, false, true, preselected, truthMatched) == 0) return 0;
  1454. if ( plotDTFcomparison((Run == 1 ? "2012" : "2016"),"up" , true, false, true, preselected, truthMatched) == 0) return 0;
  1455. return 1;
  1456. }
  1457. int plotDTFcomparisonAll( Int_t Run = 1, bool preselected = true, bool truthMatched = false) {
  1458. if (plotDTFcomparisonAllData (Run, preselected)==0) return 0;
  1459. if (plotDTFcomparisonAllMC (Run, preselected, truthMatched)==0) return 0;
  1460. if (plotDTFcomparisonAllRefChannel (Run, preselected, truthMatched)==0) return 0;
  1461. if (plotDTFcomparisonAllPHSP (Run, preselected, truthMatched)==0) return 0;
  1462. return 1;
  1463. }
  1464. int plotDTFcomparisonComplete( Int_t Run = 1){
  1465. if (plotDTFcomparisonAllData (Run, 1)==0) return 0;
  1466. if (plotDTFcomparisonAllData (Run, 0)==0) return 0;
  1467. if (plotDTFcomparisonAllMC (Run, 0, 0)==0) return 0;
  1468. if (plotDTFcomparisonAllMC (Run, 1, 0)==0) return 0;
  1469. if (plotDTFcomparisonAllMC (Run, 1, 1)==0) return 0;
  1470. if (plotDTFcomparisonAllRefChannel (Run, 0, 0)==0) return 0;
  1471. if (plotDTFcomparisonAllRefChannel (Run, 1, 0)==0) return 0;
  1472. if (plotDTFcomparisonAllRefChannel (Run, 1, 1)==0) return 0;
  1473. if (plotDTFcomparisonAllPHSP (Run, 0, 0)==0) return 0;
  1474. if (plotDTFcomparisonAllPHSP (Run, 1, 0)==0) return 0;
  1475. if (plotDTFcomparisonAllPHSP (Run, 1, 1)==0) return 0;
  1476. return 1;
  1477. }