30 #define COMPILER (!defined(__CINT__) && !defined(__CLING__)) 
   31 #if defined(__MAKECINT__) || defined(__ROOTCLING__) || COMPILER 
   39 void example_H_to_hh_to_4Wlnu(
const std::string& output_name = 
"output_example_04.root"){
 
   52   g_Log << LogInfo << 
"Initializing generator frames and tree..." << LogEnd;
 
   73   LAB_G.SetChildFrame(H_G);
 
   74   H_G.AddChildFrame(ha_G);
 
   75   H_G.AddChildFrame(hb_G);
 
   76   ha_G.AddChildFrame(Waa_G);
 
   77   ha_G.AddChildFrame(Wab_G);
 
   78   hb_G.AddChildFrame(Wba_G);
 
   79   hb_G.AddChildFrame(Wbb_G);
 
   80   Waa_G.AddChildFrame(Laa_G);
 
   81   Waa_G.AddChildFrame(Naa_G);
 
   82   Wab_G.AddChildFrame(Lab_G);
 
   83   Wab_G.AddChildFrame(Nab_G);
 
   84   Wba_G.AddChildFrame(Lba_G);
 
   85   Wba_G.AddChildFrame(Nba_G);
 
   86   Wbb_G.AddChildFrame(Lbb_G);
 
   87   Wbb_G.AddChildFrame(Nbb_G);
 
   89   if(LAB_G.InitializeTree())
 
   90     g_Log << LogInfo << 
"...Successfully initialized generator tree" << LogEnd;
 
   92     g_Log << LogError << 
"...Failed initializing generator tree" << LogEnd;                                 
 
  117   Laa_G.SetEtaCut(2.5);
 
  118   Lab_G.SetEtaCut(2.5);
 
  119   Lba_G.SetEtaCut(2.5);
 
  120   Lbb_G.SetEtaCut(2.5);
 
  122   if(LAB_G.InitializeAnalysis())
 
  123     g_Log << LogInfo << 
"...Successfully initialized generator analysis" << LogEnd;
 
  125     g_Log << LogError << 
"...Failed initializing generator analysis" << LogEnd;
 
  130   g_Log << LogInfo << 
"Initializing reconstruction frames and trees..." << LogEnd;
 
  152   LAB_R.SetChildFrame(H_R);
 
  153   H_R.AddChildFrame(ha_R);
 
  154   H_R.AddChildFrame(hb_R);
 
  155   ha_R.AddChildFrame(Waa_R);
 
  156   ha_R.AddChildFrame(Wab_R);
 
  157   hb_R.AddChildFrame(Wba_R);
 
  158   hb_R.AddChildFrame(Wbb_R);
 
  159   Waa_R.AddChildFrame(Laa_R);
 
  160   Waa_R.AddChildFrame(Naa_R);
 
  161   Wab_R.AddChildFrame(Lab_R);
 
  162   Wab_R.AddChildFrame(Nab_R);
 
  163   Wba_R.AddChildFrame(Lba_R);
 
  164   Wba_R.AddChildFrame(Nba_R);
 
  165   Wbb_R.AddChildFrame(Lbb_R);
 
  166   Wbb_R.AddChildFrame(Nbb_R);
 
  168   if(LAB_R.InitializeTree())
 
  169     g_Log << LogInfo << 
"...Successfully initialized reconstruction tree" << LogEnd;
 
  171     g_Log << LogError << 
"...Failed initializing reconstruction tree" << LogEnd;
 
  177   INV_R.AddFrame(Naa_R);
 
  178   INV_R.AddFrame(Nab_R);
 
  179   INV_R.AddFrame(Nba_R);
 
  180   INV_R.AddFrame(Nbb_R);
 
  184   INV_R.AddJigsaw(NuNuM_R);
 
  187   INV_R.AddJigsaw(NuNuR_R);
 
  188   NuNuR_R.AddVisibleFrames(LAB_R.GetListVisibleFrames());
 
  191   INV_R.AddJigsaw(MinMh_R);
 
  192   MinMh_R.AddInvisibleFrames(ha_R.GetListInvisibleFrames(), 0);
 
  193   MinMh_R.AddInvisibleFrames(hb_R.GetListInvisibleFrames(), 1);
 
  194   MinMh_R.AddVisibleFrames(ha_R.GetListVisibleFrames(), 0);
 
  195   MinMh_R.AddVisibleFrames(hb_R.GetListVisibleFrames(), 1);
 
  201   INV_R.AddJigsaw(MinMWa_R);
 
  202   MinMWa_R.AddInvisibleFrames(Waa_R.GetListInvisibleFrames(), 0);
 
  203   MinMWa_R.AddInvisibleFrames(Wab_R.GetListInvisibleFrames(), 1);
 
  204   MinMWa_R.AddVisibleFrames(Waa_R.GetListVisibleFrames(), 0);
 
  205   MinMWa_R.AddVisibleFrames(Wab_R.GetListVisibleFrames(), 1);
 
  206   MinMWa_R.AddMassFrame(Lba_R, 0);
 
  207   MinMWa_R.AddMassFrame(Lbb_R, 1);
 
  213   INV_R.AddJigsaw(MinMWb_R);
 
  214   MinMWb_R.AddInvisibleFrames(Wba_R.GetListInvisibleFrames(), 0);
 
  215   MinMWb_R.AddInvisibleFrames(Wbb_R.GetListInvisibleFrames(), 1);
 
  216   MinMWb_R.AddVisibleFrames(Wba_R.GetListVisibleFrames(), 0);
 
  217   MinMWb_R.AddVisibleFrames(Wbb_R.GetListVisibleFrames(), 1);
 
  218   MinMWb_R.AddMassFrame(Laa_R, 0);
 
  219   MinMWb_R.AddMassFrame(Lab_R, 1);
 
  223   VIS_R.AddFrame(Lab_R);
 
  224   VIS_R.AddFrame(Lbb_R);
 
  226   VIS_R.SetNElementsForFrame(Lab_R, 1);
 
  227   VIS_R.SetNElementsForFrame(Lbb_R, 1);
 
  230   VIS_R.AddJigsaw(MinMll_R);
 
  231   MinMll_R.AddCombFrame(Lab_R, 0);
 
  232   MinMll_R.AddCombFrame(Lbb_R, 1);
 
  233   MinMll_R.AddObjectFrames(Laa_R+Lab_R, 0);
 
  234   MinMll_R.AddObjectFrames(Lba_R+Lbb_R, 1);
 
  236   if(LAB_R.InitializeAnalysis())
 
  237     g_Log << LogInfo << 
"...Successfully initialized analysis" << LogEnd;
 
  239     g_Log << LogError << 
"...Failed initializing analysis" << LogEnd;   
 
  246   treePlot->SetTree(LAB_G);
 
  247   treePlot->Draw(
"GenTree", 
"Generator Tree", 
true);
 
  249   treePlot->SetTree(LAB_R);
 
  250   treePlot->Draw(
"RecoTree", 
"Reconstruction Tree");
 
  252   treePlot->SetTree(INV_R);
 
  253   treePlot->Draw(
"InvTree", 
"Invisible Jigsaws", 
true);
 
  257   std::string plot_title = 
"H #rightarrow hh #rightarrow W(#it{l} #nu) W(#it{l} #nu)";
 
  260   const HistPlotCategory& cat_Gen   = histPlot->GetNewCategory(
"Gen",  
"Generator");
 
  261   const HistPlotCategory& cat_Reco  = histPlot->GetNewCategory(
"Reco", 
"Reconstruction");
 
  263   const HistPlotVar& MH    = histPlot->GetNewVar(
"MH", 
"M_{H} / m_{H}^{ true}", 0., 2.);
 
  264   const HistPlotVar& Mha   = histPlot->GetNewVar(
"Mha", 
"M_{h}^{ a} / m_{h}^{ true}", 0., 2.);
 
  265   const HistPlotVar& Mhb   = histPlot->GetNewVar(
"Mhb", 
"M_{h}^{ b} / m_{h}^{ true}", 0., 2.);
 
  266   const HistPlotVar& MWaa  = histPlot->GetNewVar(
"MWaa", 
"M_{W a,a}", 0., mW*2., 
"[GeV]");
 
  267   const HistPlotVar& MWab  = histPlot->GetNewVar(
"MWab", 
"M_{W a,b}", 0., mW*2., 
"[GeV]");
 
  268   const HistPlotVar& MWba  = histPlot->GetNewVar(
"MWba", 
"M_{W b,a}", 0., mW*2., 
"[GeV]");
 
  269   const HistPlotVar& MWbb  = histPlot->GetNewVar(
"MWbb", 
"M_{W b,b}", 0., mW*2., 
"[GeV]");
 
  270   const HistPlotVar& cosH  = histPlot->GetNewVar(
"cosH",
"cos #theta_{H}", -1., 1.);
 
  271   const HistPlotVar& cosha = histPlot->GetNewVar(
"cosha",
"cos #theta_{h a}", -1., 1.);
 
  272   const HistPlotVar& coshb = histPlot->GetNewVar(
"coshb",
"cos #theta_{h b}", -1., 1.);
 
  273   const HistPlotVar& cosWaa = histPlot->GetNewVar(
"cosWaa",
"cos #theta_{Waa}", -1., 1.);
 
  274   const HistPlotVar& cosWab = histPlot->GetNewVar(
"cosWab",
"cos #theta_{Wab}", -1., 1.);
 
  275   const HistPlotVar& DcosH = histPlot->GetNewVar(
"DcosH",
"#theta_{H} - #theta_{H}^{ true}", 
 
  276                          -acos(-1.)/2., acos(-1.)/2.);
 
  277   const HistPlotVar& Dcosha = histPlot->GetNewVar(
"Dcosha",
"#theta_{h a} - #theta_{h a}^{ true}", 
 
  278                           -acos(-1.)/2., acos(-1.)/2.);
 
  279   const HistPlotVar& Dcoshb = histPlot->GetNewVar(
"Dcoshb",
"#theta_{h b} - #theta_{h b}^{ true}", 
 
  280                           -acos(-1.)/2., acos(-1.)/2.);
 
  281   const HistPlotVar& DcosWaa = histPlot->GetNewVar(
"DcosWaa",
"#theta_{W a,a} - #theta_{W a,a}^{ true}", 
 
  282                           -acos(-1.)/2., acos(-1.)/2.);
 
  283   const HistPlotVar& DcosWab = histPlot->GetNewVar(
"DcosWab",
"#theta_{W a,b} - #theta_{W a,b}^{ true}", 
 
  284                           -acos(-1.)/2., acos(-1.)/2.);
 
  286   histPlot->AddPlot(MWaa, MWab, cat_Gen+cat_Reco);
 
  287   histPlot->AddPlot(MWaa, MWbb, cat_Gen+cat_Reco);
 
  288   histPlot->AddPlot(MH, cat_Reco);
 
  289   histPlot->AddPlot(Mha, cat_Reco);
 
  290   histPlot->AddPlot(Mha, Mhb, cat_Reco);
 
  291   histPlot->AddPlot(MH, Mha, cat_Reco);
 
  292   histPlot->AddPlot(Mha, MWaa, cat_Reco);
 
  293   histPlot->AddPlot(DcosH, cat_Reco);
 
  294   histPlot->AddPlot(Dcosha, cat_Reco);
 
  295   histPlot->AddPlot(MH, DcosH, cat_Reco);
 
  296   histPlot->AddPlot(Mha, Dcosha, cat_Reco);
 
  297   histPlot->AddPlot(DcosH, Dcosha, cat_Reco);
 
  298   histPlot->AddPlot(Dcosha, Dcoshb, cat_Reco);
 
  300   histPlot->AddPlot(DcosWaa, cat_Reco);
 
  301   histPlot->AddPlot(DcosWaa, DcosWab, cat_Reco);
 
  306   for(
int igen = 0; igen < Ngen; igen++){
 
  307     if(igen%((std::max(Ngen,10))/10) == 0)
 
  308       g_Log << LogInfo << 
"Generating event " << igen << 
" of " << Ngen << LogEnd;
 
  312     double PTH = mH*gRandom->Rndm()*0.1;
 
  313     LAB_G.SetTransverseMomentum(PTH);               
 
  314     LAB_G.AnalyzeEvent();                          
 
  319     TVector3 MET = LAB_G.GetInvisibleMomentum();      
 
  321     INV_R.SetLabFrameThreeVector(MET);                
 
  329     Laa_R.SetLabFrameFourVector(Laa_G.GetFourVector(),-1);
 
  330     Lba_R.SetLabFrameFourVector(Lba_G.GetFourVector(),-1);
 
  331     std::vector<RFKey> L_ID; 
 
  332     L_ID.push_back(VIS_R.AddLabFrameFourVector(Lab_G.GetFourVector(), 1));
 
  333     L_ID.push_back(VIS_R.AddLabFrameFourVector(Lbb_G.GetFourVector(), 1));
 
  340     LAB_R.AnalyzeEvent();                             
 
  343     double MHgen    = H_G.GetMass();
 
  344     double Mhagen   = ha_G.GetMass();
 
  345     double Mhbgen   = hb_G.GetMass();
 
  346     double cosHgen  = H_G.GetCosDecayAngle();
 
  347     double coshagen = ha_G.GetCosDecayAngle();
 
  348     double coshbgen = hb_G.GetCosDecayAngle();
 
  352     double cosWaagen = Waa_G.GetCosDecayAngle();
 
  353     double cosWabgen = Wab_G.GetCosDecayAngle();
 
  354     MWaa = Waa_G.GetMass();
 
  355     MWab = Wab_G.GetMass();
 
  356     MWba = Wba_G.GetMass();
 
  357     MWbb = Wbb_G.GetMass();
 
  359     histPlot->Fill(cat_Gen);
 
  362     MH = H_R.GetMass()/MHgen;
 
  366     Mha = 2.*ha_R.GetListVisibleFrames().GetEnergy(ha_R)/Mhagen;
 
  367     Mhb = 2.*hb_R.GetListVisibleFrames().GetEnergy(hb_R)/Mhbgen;
 
  368     cosH = H_R.GetCosDecayAngle();
 
  369     cosha = ha_R.GetCosDecayAngle();
 
  370     coshb = hb_R.GetCosDecayAngle();
 
  371     cosWaa = Waa_R.GetCosDecayAngle();
 
  372     cosWab = Wab_R.GetCosDecayAngle();
 
  373     MWaa = Waa_R.GetMass();
 
  374     MWab = Wab_R.GetMass();
 
  375     MWba = Wba_R.GetMass();
 
  376     MWbb = Wbb_R.GetMass();
 
  377     DcosH = asin(sqrt(1.-cosH*cosH)*cosHgen-sqrt(1.-cosHgen*cosHgen)*cosH);
 
  378     Dcosha = asin(sqrt(1.-cosha*cosha)*coshagen-sqrt(1.-coshagen*coshagen)*cosha);
 
  379     Dcoshb = asin(sqrt(1.-coshb*coshb)*coshbgen-sqrt(1.-coshbgen*coshbgen)*coshb);
 
  380     DcosWaa = asin(sqrt(1.-cosWaa*cosWaa)*cosWaagen-sqrt(1.-cosWaagen*cosWaagen)*cosWaa);
 
  381     DcosWab = asin(sqrt(1.-cosWab*cosWab)*cosWabgen-sqrt(1.-cosWabgen*cosWabgen)*cosWab);
 
  384     histPlot->Fill(cat_Reco);
 
  399   LAB_G.PrintGeneratorEfficiency();
 
  401   g_Log << LogInfo << 
"Finished" << LogEnd;
 
  404 # ifndef __CINT__ // main function for stand-alone compilation 
  406   example_H_to_hh_to_4Wlnu();