int main( int argc, const char *argv[] )
{

	////////////////////////
	// 					  //
	// -- Initializing -- //
	// 				      //
	////////////////////////
	

	int nEvents = 3;

	// Event parameters
	int nParticles = 2;

	// Auxiliary vector(s)
	TLorentzVector k0 (1.0, 0.0, 0.0, 1.0);

	// Fortran COMMON blocks
	masses_.rmtau             = m_tau;
	couplings_.wcl            = 1.0;
	couplings_.gh_tautau      = 1.0;
	amplitudes_.rh_6f_tautau  = 0.0;
	amplitudes_.rh_6f_taum    = 0.0;
	amplitudes_.rh_6f_taup    = 0.0;
	amplitudes_.rh_6f_res     = 0.0;
	amplitudes_.rh_6f_res_nwa = 0.0;

	// Ampltiudes
	//cval cdec_taum[2][2];
	CMatrix_2_2 cdec_taum;
	CMatrix_2_2 cdec_taup;
	CMatrix_2_2 ch_tautau;

	TauMatrix h_tautau;
	TauMatrix taum;
	TauMatrix taup;
	TauMatrix c7_568;
	h_tautau.SetName("H->tau- tau+");
	taum.SetName("taum");
	taup.SetName("taup");
	c7_568.SetName("c7_568");

	////////////////////////////////////////////////////
	// -- Generate HiggsDecays with TGenPhaseSpace -- //
	////////////////////////////////////////////////////
	
	TGenPhaseSpace HiggsDecay;
	TLorentzVector Higgs(0.0, 0.0, 0.0, m_higgs);
	
	double TauMasses[2] = {m_tau, m_tau};
	TGenPhaseSpace p568Decay;
	TGenPhaseSpace p734Decay;

	double LeptonMasses1[3] = {m_nu_tau, m_ele, m_nu_ele};
	double LeptonMasses2[3] = {m_nu_tau, m_muo, m_nu_muo};

	HiggsDecay.SetDecay(Higgs, 2, TauMasses);
	
	TH2F *h2 = new TH2F("h2","h2", 50,1.1,1.8, 50,1.1,1.8);

	double p1_[4];
	double p2_[4];
	double p3_[4];
	double p4_[4];
	double p5_[4];
	double p6_[4];
	double p7_[4];
	double p8_[4];

	std::cout << "\n\n#########################" << std::endl;
	std::cout << "### Consistency check ###" << std::endl;
	std::cout << "#########################\n" << std::endl;

	std::cout << "Process:" << std::endl;
	std::cout << "H -->  (tau+) (tau-) --> (3 leptons) (3 leptons)\n" << std::endl;

	std::cout << Form("m_higgs (used in phase space gen): %8.4f [GeV]", m_higgs) << std::endl;
	std::cout << Form("masses_.rmtau (used in rh_6f):     %8.4f [GeV]", masses_.rmtau) << std::endl;
	std::cout << Form("m_tau (used in phase space gen):   %8.4f [GeV]", m_tau) << std::endl;
	std::cout << Form("m_ele (used in phase space gen):   %8.4f [GeV]", m_ele) << std::endl;
	std::cout << Form("m_muo (used in phase space gen):   %8.4f [GeV]", m_muo) << std::endl;
	std::cout << Form("and all neutrinos are massless") << std::endl;
	
	for (int iEv = 0; iEv < nEvents; iEv++)
	{

		std::cout << Form("\n################\n### iEv: %3d ###\n################", iEv) << std::endl;

		// Higgs Decay
	   Double_t weight = HiggsDecay.Generate();

		std::cout << "weight: " << weight << std::endl;

		// Get tau+ and tau-
	   TLorentzVector *p734 = HiggsDecay.GetDecay(1);
	   TLorentzVector *p568 = HiggsDecay.GetDecay(0);

		TVector3 p734_BoostVector = p734->BoostVector();
		TVector3 p568_BoostVector = p568->BoostVector();

		// Make taus decay
		p734Decay.SetDecay( (*p734), 3, LeptonMasses1 );
		p568Decay.SetDecay( (*p568), 3, LeptonMasses2 );

	   Double_t weight1 = p568Decay.Generate();
	   Double_t weight2 = p734Decay.Generate();

		std::cout << "weight1: " << weight1 << std::endl;
		std::cout << "weight2: " << weight2 << std::endl;

	   TLorentzVector *p7 = p734Decay.GetDecay(0); // v_tau
	   TLorentzVector *p3 = p734Decay.GetDecay(1); // ele-
	   TLorentzVector *p4 = p734Decay.GetDecay(2); // v_ele_bar
	   TLorentzVector *p8 = p568Decay.GetDecay(0); // v_tau_bar
	   TLorentzVector *p6 = p568Decay.GetDecay(1); // mu+
	   TLorentzVector *p5 = p568Decay.GetDecay(2); // v_muo
 
 		double p568k0 = k0 * (*p568);
 		double p734k0 = k0 * (*p734);
 		double p3k0 = k0 * (*p3);
 		double p4k0 = k0 * (*p4); 
 		double p5k0 = k0 * (*p5);
 		double p6k0 = k0 * (*p6);
		double p7k0 = k0 * (*p7);
		double p8k0 = k0 * (*p8);

	   TLorentzVector *sum = new TLorentzVector;
		(*sum) = (*p8) + (*p6) + (*p5) + (*p7) + (*p3) + (*p4);

		std::cout << "\n# --- Generated momenta --- #\n";
		std::cout << "- sum: "; displayTLorentzVector(sum);
		std::cout << "- p734 "; displayTLorentzVector(p734);
		std::cout << "- p568 "; displayTLorentzVector(p568);
		std::cout << "- p7   (v_tau )"; displayTLorentzVector(p7);
		std::cout << "- p3       (e-)"; displayTLorentzVector(p3);
		std::cout << "- p4   (v_ebar)"; displayTLorentzVector(p4);
		std::cout << "- p8 (v_taubar)"; displayTLorentzVector(p8);
		std::cout << "- p6    (muon+)"; displayTLorentzVector(p6);
		std::cout << "- p5     (v_mu)"; displayTLorentzVector(p5);


		// -- Unpolarized term -- //
		double taum_amp = p734->Dot((*p4)) * p3->Dot((*p7));
		double taup_amp = p568->Dot((*p5)) * p6->Dot((*p8));

		// -- Polarized term -- //

		// polarization vectors
		TLorentzVector polvec_taum;
		TLorentzVector polvec_taup;

		//  standard polarization vector with p and k0
		for(int nu = 0; nu<4; nu++)
		{
			polvec_taum[nu] = ( (*p734)[nu]/m_tau) - (m_tau/p734k0)*k0[nu];
			polvec_taup[nu] = ( (*p568)[nu]/m_tau) - (m_tau/p568k0)*k0[nu];
		}

		double taum_pol_amp = m_tau*( polvec_taum * (*p4) ) * ( (*p3) * (*p7) ); // (ek')(qk)
		double taup_pol_amp = m_tau*( polvec_taup * (*p5) ) * ( (*p6) * (*p8) ); // (ek')(qk)


		std::cout << Form("\n# --- Standard calculation --- #") << std::endl;
		std::cout << Form("Unpolarized case:") << std::endl;
		std::cout << Form("- tau- (pk')(qk) (unpolarized): %.4f", taum_amp ) << std::endl;
		std::cout << Form("- tau+ (pk')(qk) (unpolarized): %.4f", taup_amp ) << std::endl;
		std::cout << Form("- tau-/tau+ (unpolarized): %.4f", taum_amp/taup_amp ) << std::endl;
		std::cout << Form("Polarized case:") << std::endl;

		std::cout << Form("- tau- m_tau*(ek')(qk) (polarized term): %.4f", taum_pol_amp ) << std::endl;
		std::cout << Form("- tau+ m_tau*(ek')(qk) (polarized term): %.4f", taup_pol_amp ) << std::endl;

		double taum_standard_pol_1 = taum_amp - taum_pol_amp;
		double taum_standard_pol_2 = taum_amp + taum_pol_amp;
		double taup_standard_pol_1 = taup_amp - taup_pol_amp;
		double taup_standard_pol_2 = taup_amp + taup_pol_amp;

		std::cout << Form("- taum_standard_pol_1 ((pk')(qk)-m_tau*(ek')(qk)): %.4f", taum_standard_pol_1) << std::endl;
		std::cout << Form("- taum_standard_pol_2 ((pk')(qk)+m_tau*(ek')(qk)): %.4f", taum_standard_pol_2) << std::endl;
		std::cout << Form("- taup_standard_pol_1 ((pk')(qk)-m_tau*(ek')(qk)): %.4f", taup_standard_pol_1) << std::endl;
		std::cout << Form("- taup_standard_pol_2 ((pk')(qk)+m_tau*(ek')(qk)): %.4f", taup_standard_pol_2) << std::endl;

		for (int i = 0; i < 4; i++)
		{
			p1_[e2m[i]] = (*p568)[i];
			p2_[e2m[i]] = (*p734)[i];
			p3_[e2m[i]] = (*p3)[i];
			p4_[e2m[i]] = (*p4)[i];
			p5_[e2m[i]] = (*p5)[i];
			p6_[e2m[i]] = (*p6)[i];
			p7_[e2m[i]] = (*p7)[i];
			p8_[e2m[i]] = (*p8)[i];
		}

//		double rh_tautau_val = rh_tautau_(p1_,p2_);
//		std::cout << Form("rh_tautau: %.2f\n", rh_tautau_val) << std::endl;

		std::cout << Form("\n# --- Helicity amplitude calculation --- #") << std::endl;
		double rh_6f_val = rh_6f_(p3_,p4_,p5_,p6_,p7_,p8_);

		h_tautau.ReadInCMatrix_2_2( taumatrices_.ch_tautau );
		taum.ReadInCMatrix_2_2(     taumatrices_.cdec_taum );
		taup.ReadInCMatrix_2_2(     taumatrices_.cdec_taup );
		c7_568.ReadInCMatrix_2_2(   taumatrices_.c7_568    );

		h_tautau.Show();
		taum.Show();
		taup.Show();

		double taum_rh_6f_pol_1 = std::abs(taum.m[1][0])*std::abs(taum.m[1][0]);
		double taum_rh_6f_pol_2 = std::abs(taum.m[1][1])*std::abs(taum.m[1][1]);

		double taup_rh_6f_pol_1 = std::abs(taup.m[0][1])*std::abs(taup.m[0][1]);
		double taup_rh_6f_pol_2 = std::abs(taup.m[1][1])*std::abs(taup.m[1][1]);

		taum_rh_6f_pol_1 = taum_rh_6f_pol_1/p3k0/p4k0/p7k0/p734k0;
		taum_rh_6f_pol_2 = taum_rh_6f_pol_2/p3k0/p4k0/p7k0/p734k0;

		taup_rh_6f_pol_1 = taup_rh_6f_pol_1/p5k0/p6k0/p8k0/p568k0;
		taup_rh_6f_pol_2 = taup_rh_6f_pol_2/p5k0/p6k0/p8k0/p568k0;

		taum.ShowSumOfSquares();
		taup.ShowSumOfSquares();
//		for (int i=0; i<2; i++)
//		for (int j=0; j<2; j++)
//		{
//		  std::cout << Form("rh_6f_tau-[%d][%d].r: %.4f \n",i,j,cdec_taum[i][j].r);
//		  std::cout << Form("rh_6f_tau-[%d][%d].i: %.4f \n",i,j,cdec_taum[i][j].i);
//		}
//
//		for (int i=0; i<2; i++)
//		for (int j=0; j<2; j++)
//		{
//		  std::cout << Form("rh_6f_tau+[%d][%d].r: %.4f \n",i,j,cdec_taup[i][j].r);
//		  std::cout << Form("rh_6f_tau+[%d][%d].i: %.4f \n",i,j,cdec_taup[i][j].i);
//		}
		double taum_unpol = taum.CalcSumOfSquares();
		double taup_unpol = taup.CalcSumOfSquares();

		taum_unpol = taum_unpol/p3k0/p4k0/p7k0/p734k0;
		taup_unpol = taup_unpol/p5k0/p6k0/p8k0/p568k0;

		std::cout << Form("- taum_unpolarized (calc via sum of square of tau elements): %.4f", taum_unpol) << std::endl;
		std::cout << Form("- taup_unpolarized (calc via sum of square of tau elements): %.4f", taup_unpol) << std::endl;

		std::cout << Form("- taum_rh_6f_pol_1 (calc via square): %.4f", taum_rh_6f_pol_1) << std::endl;
		std::cout << Form("- taum_rh_6f_pol_2 (calc via square): %.4f", taum_rh_6f_pol_2) << std::endl;
		std::cout << Form("- taup_rh_6f_pol_1 (calc via square): %.4f", taup_rh_6f_pol_1) << std::endl;
		std::cout << Form("- taup_rh_6f_pol_2 (calc via square): %.4f", taup_rh_6f_pol_2) << std::endl;

		std::cout << Form("- (taum_rh_6f_pol_1-taum_rh_6f_pol_2) (calc via square): %.4f", taum_rh_6f_pol_1-taum_rh_6f_pol_2) << std::endl;
		std::cout << Form("- (taup_rh_6f_pol_1-taup_rh_6f_pol_2) (calc via square): %.4f", taup_rh_6f_pol_1-taup_rh_6f_pol_2) << std::endl;


		std::cout << Form("- rh_6f_taum (passed through FORTRAN common): %.4f", amplitudes_.rh_6f_taum) << std::endl;
		std::cout << Form("- rh_6f_taup (passed through FORTRAN common): %.4f", amplitudes_.rh_6f_taup ) << std::endl;
		std::cout << Form("- rh_6f tau-/tau+ (passed through FORTRAN common): %.4f", amplitudes_.rh_6f_taum/amplitudes_.rh_6f_taup	) << std::endl;
		std::cout << Form("- rh_6f_res (passed through FORTRAN common): %.4f", amplitudes_.rh_6f_res ) << std::endl;
		std::cout << Form("- rh_6f_res_nwa (passed through FORTRAN common): %.4f", amplitudes_.rh_6f_res_nwa ) << std::endl;

		std::cout << Form("\n# --- Comparison --- #") << std::endl;
		std::cout << Form("- rh_6f_taum/taum ratio (unpolarized): %.4f", amplitudes_.rh_6f_taum/taum_amp ) << std::endl;
		std::cout << Form("- rh_6f_taup/taup ratio (unpolarized): %.4f", amplitudes_.rh_6f_taup/taup_amp ) << std::endl;

		std::cout << Form("- taum_pol_1 (rh_6f/standard ratio) (polarized): %.4f", taum_rh_6f_pol_1/taum_standard_pol_1 ) << std::endl;
		std::cout << Form("- taum_pol_2 (rh_6f/standard ratio) (polarized): %.4f", taum_rh_6f_pol_2/taum_standard_pol_2 ) << std::endl;
		std::cout << Form("- taup_pol_1 (rh_6f/standard ratio) (polarized): %.4f", taup_rh_6f_pol_1/taup_standard_pol_1 ) << std::endl;
		std::cout << Form("- taup_pol_2 (rh_6f/standard ratio) (polarized): %.4f", taup_rh_6f_pol_2/taup_standard_pol_2 ) << std::endl;


		//std::cout << Form("rh_6f: %.2f", rh_6f_val) << std::endl;
		//	double LeptonMasses1[3] = {m_nu_tau, m_ele, m_nu_ele};
		//	double LeptonMasses2[3] = {m_nu_tau, m_muo, m_nu_muo};
		// H(p) -> e-(p3) vebar(p4) vmu(p5) mu+(p6) vtau(p7) vtaubar(p8)                 
	}

}
Exemple #2
0
void plot3(TString infile = "fp-d", TString pltmd = "cos") {

// CHECK FOR RIGHT INPUT ////////////////////////////////////////////////

   string strpltmd = pltmd, filename = infile, strfile = infile;

   if( (strpltmd.compare("cos") != 0 ) &&
       (strpltmd.compare("sin") != 0 ) &&
       (strpltmd.compare("tan") != 0 ) &&
       (strpltmd.compare("mmp") != 0 ) ) {error(4);};

// GLOBAL VARIABLES  ////////////////////////////////////////////////////

   Int_t file, point, color, style;

   Float_t fits2b, fittph, tphold, fitsph, fitcph, fitx, fitxmin, fitxmax = -1.0;

   Float_t xVal, yVal;

   Float_t xMin = 100000, xMax = -1.0, yMin = 100000, yMax = -1.0;

   Float_t MZ, MW, Mmin = 100000;

   Float_t Cz1, Cz2, Cz3, Cw1, Cw2, Cw3, Cw4, C1, C2;

   Float_t phiMin, phiMax, cphmin, cphmax, sphmin, sphmax;

// CUSTOMIZE PLOT ///////////////////////////////////////////////////////

   gROOT->Reset();
   gROOT->SetStyle("Plain");
   gStyle->SetTitleBorderSize(0);
   gStyle->SetPalette(1);

   TCanvas *MyC = new TCanvas("MyC","Plot of the GAPP fit results",200,10,700,500);

   Float_t mmlegxmin, mmlegxmax, mmlegymin, mmlegymax;

   Float_t s2blegxmin, s2blegymin, s2blegxmax, s2blegymax;

   Float_t lblxmin, lblxmax, lblymin, lblymax;

   string plottitle = "Model: " + infile + "  |  Plot: ";

   string xtitle, ytitle, NPleg, SMleg, display;

   NPleg = "#font[52]{M_{H}^{(NP)}, #bar{m}_{t}^{(NP)}}";
   SMleg = "#font[52]{M_{H}^{(SM)}, #bar{m}_{t}^{(SM)}}";

   if (strpltmd.compare("tan") == 0) { 

      plottitle += "#font[42]{tan^{2}(#tilde{#phi}) over }#font[52]{#tilde{x}}#font[42]{.}";
      xtitle = "#font[52]{#tilde{x}}";
      ytitle = "#font[42]{tan^{2}(#tilde{#phi})}";
      display = "C";

      mmlegxmin = 0.15;
      mmlegxmax = 0.30;
      mmlegymin = 0.75;
      mmlegymax = 0.85;

      s2blegxmin = 0.15;
      s2blegxmax = 0.40;
      s2blegymin = 0.30;
      s2blegymax = 0.50;

      lblxmin = 0.88;
      lblxmax = 0.88;
      lblymin = 0.60;
      lblymax = 0.65;

   } else if (strpltmd.compare("cos") == 0) { 

      plottitle += "#font[42]{cos(#tilde{#phi}) over }#font[52]{#tilde{x}}#font[42]{.}";
      xtitle = "#font[52]{#tilde{x}}";
      ytitle = "#font[42]{cos(#tilde{#phi})}";
      display = "C";

      mmlegxmin = 0.70;
      mmlegxmax = 0.85;
      mmlegymin = 0.75;
      mmlegymax = 0.85;

      s2blegxmin = 0.15;
      s2blegxmax = 0.40;
      s2blegymin = 0.30;
      s2blegymax = 0.50;

      lblxmin = 0.65;
      lblxmax = 0.80;
      lblymin = 0.60;
      lblymax = 0.65;

   } else if (strpltmd.compare("sin") == 0) {

      plottitle += "#font[42]{sin(#tilde{#phi}) over }#font[52]{#tilde{x}}#font[42]{.}";
      xtitle = "#font[52]{#tilde{x}}";
      ytitle = "#font[42]{sin(#tilde{#phi})}";
      display = "C";

      mmlegxmin = 0.15;
      mmlegxmax = 0.30;
      mmlegymin = 0.75;
      mmlegymax = 0.85;

      s2blegxmin = 0.60;
      s2blegxmax = 0.85;
      s2blegymin = 0.30;
      s2blegymax = 0.50;

      lblxmin = 0.65;
      lblxmax = 0.80;
      lblymin = 0.60;
      lblymax = 0.65;

   } else if (strpltmd.compare("mmp") == 0) {

      plottitle += "#font[42]{Masses of the new heavy gauge bosons.}";
      xtitle = "#font[52]{M_{Z'}}#font[42]{ (TeV)}";
      ytitle = "#font[52]{M_{W'}}#font[42]{ (TeV)}";
      display = "C";

      mmlegxmin = 0.15;
      mmlegxmax = 0.30;
      mmlegymin = 0.75;
      mmlegymax = 0.85;

      s2blegxmin = 0.60;
      s2blegxmax = 0.85;
      s2blegymin = 0.45;
      s2blegymax = 0.65;

      lblxmin = 0.35;
      lblxmax = 0.50;
      lblymin = 0.45;
      lblymax = 0.50;

   };
   
// PREPARE BOSON MASSES AND PHI BOUNDS //////////////////////////////////

   string mdl(filename,0,2);

   if ( (mdl.compare("lr") == 0) ||
        (mdl.compare("lp") == 0) ||
        (mdl.compare("hp") == 0) ||
        (mdl.compare("fp") == 0) ) {

      phiMin = 5.600; phiMax = 84.400;

      string Higgs(filename,3,1);

      if (Higgs.compare("d") == 0) {

         Cz1 = 11.95349795785275;
         Cz2 = 30.63269990028513;
         Cz3 = 42.58619785813789;
         Cw1 = 21.29309892906894;
         Cw2 = 9.339600971216193;
         Cw3 = 30.63269990028513;
         Cw4 = 42.58619785813789;

      }

      else if (Higgs.compare("t") == 0) {

         Cz1 = 5.976748978926375;
         Cz2 = 30.63269990028513;
         Cz3 = 85.17239571627579;
         Cw1 = 15.05649464522066;
         Cw2 = 3.302047590161717;
         Cw3 = 21.66058982554409;
         Cw4 = 60.22597858088265;

      }
   } 

   else if ( (mdl.compare("uu") == 0) ||
             (mdl.compare("nu") == 0) ) {

      phiMin = 10.179, phiMax = 79.821;

      C1 = 94.0397928463607;
      C2 = 77.1253849720165;

   } else {error(6);}

      cphmin = cos(TMath::Pi()*phiMin/180.0)*cos(TMath::Pi()*phiMin/180.0);
      cphmax = cos(TMath::Pi()*phiMax/180.0)*cos(TMath::Pi()*phiMax/180.0);
      sphmin = sin(TMath::Pi()*phiMin/180.0)*sin(TMath::Pi()*phiMin/180.0);
      sphmax = sin(TMath::Pi()*phiMax/180.0)*sin(TMath::Pi()*phiMax/180.0);

// LOOP OVER ROOT FILES  ////////////////////////////////////////////////
   
   for(file=0; file<=1; file++) {
   
      if(file==0) string epsfile  =  filename + "_" + strpltmd + ".eps";
      if(file==1) string filename =  filename + "_sm";
      string rootname = filename + ".root";
   
      TFile *rootfile = TFile::Open(rootname.c_str());      
      if(rootfile == NULL) error(1);
      
      TTree *tree = (TTree*)rootfile->Get(filename.c_str());
      if(tree == NULL) error(2);
   
      TBranch *fits2bbranch = (TBranch*)tree->GetBranch("fits2b");
      TBranch *fittphbranch = (TBranch*)tree->GetBranch("fittph");
      TBranch *fitxbranch   = (TBranch*)tree->GetBranch("fitx");

      if( (fits2bbranch == NULL) || 
          (fittphbranch == NULL) || 
          (fitxbranch   == NULL) ) error(3);

      tree->SetBranchAddress("fits2b",&fits2b);
      tree->SetBranchAddress("fittph",&fittph);
      tree->SetBranchAddress("fitx",  &fitx);
   
// GET ARRAYS ///////////////////////////////////////////////////////////

      Int_t Npoints = (Int_t)tree->GetEntries();

      Int_t tphStep = 0;

      Float_t tphMax = -1.0;

      for(point=0; point<Npoints; point++) {
      
         tree->GetEntry(point);
      
         if( fittph > tphMax ) {tphStep++; tphMax = fittph;}
      
      };

      const int tphSteps = tphStep;

      Float_t xArray[tphSteps], yArray[tphSteps], zArray[tphSteps];

      tphStep = -1, tphold = -1.0, fitxmin = 100000;

      for(point=0; point<Npoints; point++) {
      
         tree->GetEntry(point);

         if(fittph > tphold) {tphStep++; fitxmin = 100000;}

         fitsph = fittph / (1.0 + fittph);
         fitcph = 1.0 - fitsph; 
      
         if (strpltmd.compare("tan") == 0) {

            xVal = fitx;
            yVal = fittph;

         } else if (strpltmd.compare("cos") == 0) {

            xVal = fitx;
            yVal = sqrt(fitcph); 

         } else if (strpltmd.compare("sin") == 0) { 

            xVal = fitx; 
            yVal = sqrt(fitsph); 

         } else if (strpltmd.compare("mmp") == 0) { 

            if (fitsph != 0.0) {

               if ( (mdl.compare("lr") == 0) ||
                    (mdl.compare("lp") == 0) ||
                    (mdl.compare("hp") == 0) ||
                    (mdl.compare("fp") == 0) ) {

                  MMI(Cz1,Cz2,Cz3,Cw1,Cw2,Cw3,Cw4,fitx,fitsph,fitcph,fits2b,xVal,yVal);

               } else if ( (mdl.compare("uu") == 0) ||
                           (mdl.compare("nu") == 0) ) {

                  MMII(C1,C2,fitx,fitsph,fitcph,xVal,yVal);

               }
            }   
         }

         if( (strpltmd.compare("mmp") == 0) && (tphStep==1) ) { 
          
            xArray[0] = xArray[1]; 
            yArray[0] = yArray[1];
            zArray[0] = zArray[1]; 
 
         }

         if(fitx>fitxmax) fitxmax = fitx;

         if(fitx<fitxmin) {
 
            xArray[tphStep] = xVal;
            yArray[tphStep] = yVal;
            zArray[tphStep] = fits2b;
            fitxmin = fitx;

         }
  
         tphold = fittph;
 
      }

      if(file==0) TGraph *NPplot = new TGraph(tphSteps,xArray,yArray);
      if(file==1) TGraph *SMplot = new TGraph(tphSteps,xArray,yArray);

      TMarker *NPmrk[tphSteps], *SMmrk[tphSteps];

      for(tphStep=0; tphStep<tphSteps; tphStep++){

         marker(zArray[tphStep],color,style);

         if(file==0) { NPmrk[tphStep] = new TMarker(xArray[tphStep],yArray[tphStep],style);
                       NPmrk[tphStep]->SetMarkerSize(0.8);    
                       NPmrk[tphStep]->SetMarkerColor(color);}
         if(file==1) { SMmrk[tphStep] = new TMarker(xArray[tphStep],yArray[tphStep],style);
                       SMmrk[tphStep]->SetMarkerSize(0.8);    
                       SMmrk[tphStep]->SetMarkerColor(color);}

         if( (strpltmd.compare("mmp") != 0) || (tphStep !=0 )) {

            if (xArray[tphStep] < xMin) xMin = xArray[tphStep]; 
            if (xArray[tphStep] > xMax) xMax = xArray[tphStep]; 
            if (yArray[tphStep] < yMin) yMin = yArray[tphStep]; 
            if (yArray[tphStep] > yMax) yMax = yArray[tphStep]; 

         }

         if( ((strfile.compare("uu-d") == 0) || (strfile.compare("nu-d") == 0)) && (strpltmd.compare("sin") == 0) ) {

            fitx = xArray[tphStep];
            fitsph = yArray[tphStep]*yArray[tphStep];
            fitcph = 1.0 - fitsph;

            if( (sphmin < fitsph) && (fitsph<sphmax) ) {

               MMII(C1,C2,fitx,fitsph,fitcph,MZ,MW);

               if(MZ < Mmin) { Mmin = MZ; cout << MZ << "\t" << sqrt(fitsph) << endl;}
            }
         }
      }
   }
 
// CREATE PLOTS /////////////////////////////////////////////////////////

   NPplot->SetLineStyle(2);
   NPplot->SetMarkerStyle(20);
   NPplot->SetMarkerSize(0.4);
   SMplot->SetMarkerStyle(20);
   SMplot->SetMarkerSize(0.4);
   
   if(strpltmd.compare("cos") == 0) {yMin = 0.0; yMax = 1.0;}
   if(strpltmd.compare("sin") == 0) {yMin = 0.0; yMax = 1.0;}
   if(strpltmd.compare("mmp") == 0) {xMin = 0.0; xMax = 5.0; yMin = 0.0; yMax = 5;}

   TH1F* frame = MyC->DrawFrame(0.9*xMin,0.9*yMin,1.1*xMax,1.0*yMax);
   frame->SetTitle(plottitle.c_str());

   TAxis *xaxis = frame->GetXaxis();
   TAxis *yaxis = frame->GetYaxis();   
   xaxis->SetTitle(xtitle.c_str());
   xaxis->CenterTitle();
   xaxis->SetTitleOffset(1.);
   xaxis->SetDecimals();
   xaxis->SetLabelSize(0.03);
   xaxis->SetLabelOffset(0.01);
   yaxis->SetTitle(ytitle.c_str());
   yaxis->CenterTitle();
   yaxis->SetTitleOffset(1.2);
   yaxis->SetDecimals();
   yaxis->SetLabelSize(0.03);
   yaxis->SetLabelOffset(0.01);

   TLegend *mmleg = new TLegend(mmlegxmin,mmlegymin,mmlegxmax,mmlegymax);
   mmleg->AddEntry(NPplot,NPleg.c_str(),"l");
   mmleg->AddEntry(SMplot,SMleg.c_str(),"l"); 
   mmleg->SetTextSize(0.025);
   mmleg->SetFillStyle(0);

   if( (strfile.compare("uu-d") != 0) && (strfile.compare("nu-d") != 0) ) {

      for(tphStep=0; tphStep<tphSteps; tphStep++){NPmrk[tphStep]->Draw(); SMmrk[tphStep]->Draw();}

   }

   Float_t xdummy[1] = {0.0}, ydummy[1] = {0.0};

   TGraph *circle = new TGraph(1,xdummy,ydummy);
   circle->SetMarkerStyle(24);
   circle->SetMarkerColor(kGreen+1);
   circle->SetMarkerSize(0.8); 
   
   TGraph *square = new TGraph(1,xdummy,ydummy);
   square->SetMarkerStyle(25);
   square->SetMarkerColor(kCyan+1);
   square->SetMarkerSize(0.8); 

   TGraph *triangle = new TGraph(1,xdummy,ydummy);
   triangle->SetMarkerStyle(26);
   triangle->SetMarkerColor(kBlue+1);
   triangle->SetMarkerSize(0.8); 

   TGraph *diamond = new TGraph(1,xdummy,ydummy);
   diamond->SetMarkerStyle(27);
   diamond->SetMarkerColor(kMagenta+1);
   diamond->SetMarkerSize(0.8); 

   TLegend *s2bleg = new TLegend(s2blegxmin,s2blegymin,s2blegxmax,s2blegymax); 

   s2bleg->AddEntry(circle,"#font[42]{0.00 < sin^{2}(2#tilde{#beta}) #leq 0.25}","p");
   s2bleg->AddEntry(square,"#font[42]{0.25 < sin^{2}(2#tilde{#beta}) #leq 0.50}","p");
   s2bleg->AddEntry(triangle,"#font[42]{0.50 < sin^{2}(2#tilde{#beta}) #leq 0.75}","p");
   s2bleg->AddEntry(diamond,"#font[42]{0.75 < sin^{2}(2#tilde{#beta}) #leq 1.00}","p");
   s2bleg->SetTextSize(0.025);
   s2bleg->SetFillStyle(0); 

   NPplot->Draw(display.c_str());
   SMplot->Draw(display.c_str());
   mmleg->Draw();
   if( (strfile.compare("uu-d") != 0) && (strfile.compare("nu-d") != 0) ) s2bleg->Draw();

// BOUNDS ON PHI //////////////////////////////////////////////////////

   Int_t i;

   const int iSteps = 100;    

   fitxmin = 1.0, fitxmax *= 1.5;

   Float_t deltax = (fitxmax-fitxmin)/iSteps;

   Float_t phixmin0[iSteps], phixmax0[iSteps], phixmin1[iSteps], phixmax1[iSteps];

   Float_t phiymin0[iSteps], phiymax0[iSteps], phiymin1[iSteps], phiymax1[iSteps];

   if ( (strpltmd.compare("tan") == 0) || 
        (strpltmd.compare("cos") == 0) ||
        (strpltmd.compare("sin") == 0) ) {

      for(i=0; i<100; i++) {

         fitx = fitxmin + i*deltax;

         phixmin0[i] = fitx;
         if (strpltmd.compare("tan") == 0) { phiymin0[i] = sphmin / cphmin; phiymax0[i] = sphmax / cphmax; }
         if (strpltmd.compare("cos") == 0) { phiymin0[i] = sqrt(cphmin);    phiymax0[i] = sqrt(cphmax); }
         if (strpltmd.compare("sin") == 0) { phiymin0[i] = sqrt(sphmin);    phiymax0[i] = sqrt(sphmax); }

      }

      TGraph *phiMin0 = new TGraph(iSteps,phixmin0,phiymin0);
      TGraph *phiMax0 = new TGraph(iSteps,phixmin0,phiymax0);

   } else if (strpltmd.compare("mmp") == 0) { 

      if ( (mdl.compare("lr") == 0) ||
           (mdl.compare("lp") == 0) ||
           (mdl.compare("hp") == 0) ||
           (mdl.compare("fp") == 0) ) {

         for(i=0; i<100; i++) {

            fitx = fitxmin + i*deltax;

            MMI(Cz1,Cz2,Cz3,Cw1,Cw2,Cw3,Cw4,fitx,sphmin,cphmin,0.0,phixmin0[i],phiymin0[i]);
            MMI(Cz1,Cz2,Cz3,Cw1,Cw2,Cw3,Cw4,fitx,sphmin,cphmin,1.0,phixmin1[i],phiymin1[i]);
            MMI(Cz1,Cz2,Cz3,Cw1,Cw2,Cw3,Cw4,fitx,sphmax,cphmax,0.0,phixmax0[i],phiymax0[i]);
            MMI(Cz1,Cz2,Cz3,Cw1,Cw2,Cw3,Cw4,fitx,sphmax,cphmax,1.0,phixmax1[i],phiymax1[i]);

         }

         TGraph *phiMin0 = new TGraph(iSteps,phixmin0,phiymin0);
         TGraph *phiMin1 = new TGraph(iSteps,phixmin1,phiymin1);
         TGraph *phiMax0 = new TGraph(iSteps,phixmax0,phiymax0);
         TGraph *phiMax1 = new TGraph(iSteps,phixmax1,phiymax1);

         phiMin1->SetLineStyle(7);
         phiMin1->SetMarkerStyle(22);
         phiMin1->SetMarkerSize(1.0);
         phiMax1->SetLineStyle(7);
         phiMax1->SetMarkerStyle(22);
         phiMax1->SetMarkerSize(1.0);

         phiMin1->Draw("C");
         phiMax1->Draw("C");

      } else if ( (mdl.compare("uu") == 0) ||
                  (mdl.compare("nu") == 0) ) {

         for(i=0; i<100; i++) {

            fitx = fitxmin + i*deltax;

            MMII(C1,C2,fitx,sphmin,cphmin,phixmin0[i],phiymin0[i]);
            MMII(C1,C2,fitx,sphmax,cphmax,phixmax0[i],phiymax0[i]);

         }

         TGraph *phiMin0 = new TGraph(iSteps,phixmin0,phiymin0);
         TGraph *phiMax0 = new TGraph(iSteps,phixmax0,phiymax0);

      }
   } 
      
   phiMin0->SetLineStyle(3);
   phiMin0->SetMarkerStyle(20);
   phiMin0->SetMarkerSize(0.4);
   phiMax0->SetLineStyle(3);
   phiMax0->SetMarkerStyle(20);
   phiMax0->SetMarkerSize(0.4);

   phiMin0->Draw("C");
   phiMax0->Draw("C");

// LABEL ALLOWED REGION ///////////////////////////////////////////////

   TPaveText *allowed = new TPaveText(lblxmin,lblymin,lblxmax,lblymax,"NDC");
   TText *text = allowed->AddText("#font[42]{allowed (95% CL)}");
   allowed->SetTextSize(0.04);
   if (strpltmd.compare("tan") == 0) text->SetTextAngle(270);
   allowed->SetFillStyle(0);
   allowed->SetLineColor(0);
   allowed->SetBorderSize(1);
   allowed->Draw();

// SAVE GRAPHIC ///////////////////////////////////////////////////////

   MyC->Print(epsfile.c_str());
  
}
Exemple #3
0
void plotFit(TString filename = "fp-d", TString pltmd = "tph") {

// CHECK FOR RIGHT INPUT ////////////////////////////////////////////////

   string strpltmd = pltmd;

   if( strpltmd.compare("tph")  != 0 &&
       strpltmd.compare("s2b")  != 0 &&
       strpltmd.compare("mmp") != 0 ) {error(4);};
   
// OPEN THE ROOT FILE  //////////////////////////////////////////////////

   gROOT->Reset();
   gROOT->SetStyle("Plain");
   gStyle->SetTitleBorderSize(0);
   gStyle->SetPalette(1);

   TCanvas *MyC = new TCanvas("MyC","Plot of the GAPP fit",200,10,700,500);

// Still to do: Automate the frame boundaries. 
   
   string strfile = filename, rootname = strfile + ".root";

   TFile *rootfile = TFile::Open(rootname.c_str());
      
   if(rootfile == NULL) error(1);
      
   TTree *tree = (TTree*)rootfile->Get(strfile.c_str());
   
   if(tree == NULL) error(2);
   
   TBranch *fits2bbranch = (TBranch*)tree->GetBranch("fits2b");
   
   TBranch *fittphbranch = (TBranch*)tree->GetBranch("fittph");
   
   TBranch *fitxbranch   = (TBranch*)tree->GetBranch("fitx");
   
   if( (fits2bbranch == NULL) || (fittphbranch == NULL) || (fitxbranch == NULL) ) error(3);
   
   Float_t fits2b, fittph, fitx;
      
   tree->SetBranchAddress("fits2b",&fits2b);

   tree->SetBranchAddress("fittph",&fittph);
   
   tree->SetBranchAddress("fitx",  &fitx);
   
   
// GET GRID /////////////////////////////////////////////////////////////

   Int_t Npoints = (Int_t)tree->GetEntries();

   Int_t point, zSteps = 0, ySteps = 0;

   Float_t fitxMin = 100000, fitxMax = -1.0, s2bMin = 100000, tphMin = 100000;

   Float_t s2bMax = -1.0, tphMax = -1.0;

   for(point=0; point<Npoints; point++) {
      
      tree->GetEntry(point);
      
      if( fits2b > s2bMax ) {zSteps++; s2bMax = fits2b;}

      if( fittph > tphMax ) {ySteps++; tphMax = fittph;}
      
   };

   const int s2bSteps = zSteps, tphSteps = ySteps, mmpSteps = Npoints;

   Float_t s2bValues[s2bSteps], tphValues[tphSteps];

   s2bMax = -1.0, tphMax = -1.0;

   int s2bStep = 0, tphStep = 0;

   for(point=0; point<Npoints; point++) {
      
      tree->GetEntry(point);
      
      if( fits2b > s2bMax ) {s2bValues[s2bStep] = fits2b; s2bStep++; s2bMax = fits2b;}

      if( fittph > tphMax ) {tphValues[tphStep] = fittph; tphStep++; tphMax = fittph;}
      
   };

// PREPARE PLOT /////////////////////////////////////////////////////////

   string plottitle = "Model: " + strfile + "  |  Plot: ";

   if( strpltmd.compare("tph") == 0 ) {

      plottitle += "tan^{2}(#phi) over x for fixed sin^{2}(2#beta)";

   }

   if( strpltmd.compare("s2b") == 0 ) {

      plottitle += "sin^{2}(2#beta) over x for fixed tan^{2}(#phi)";

   }

   if( strpltmd.compare("mmp") == 0 ) {

      plottitle += "Masses of the new heavy gauge bosons";

   }

//  PLOT DATA ///////////////////////////////////////////////////////////

   if (strpltmd.compare("tph") == 0) {

      tphMax = -1.0;

//    TGraph *tphplots[s2bSteps];
      TGraph *tphplots[s2bSteps-30];

//    for(s2bStep=0; s2bStep<s2bSteps; s2bStep++) {
      for(s2bStep=0; s2bStep<s2bSteps-30; s2bStep++) {

         Float_t tphArray[tphSteps], fitxArray[tphSteps];

         tphStep = 0;

         for(point=0; point<Npoints; point++) {
      
            tree->GetEntry(point);
      
            if(fits2b == s2bValues[s2bStep]) {

//             tphArray[tphStep]  = fittph;
               tphArray[tphStep]  = sqrt(1.0/(1.0+fittph));

               if (fittph < tphMin) tphMin = fittph;

               if (fittph > tphMax) tphMax = fittph;

               fitxArray[tphStep] = fitx;

               if (fitx < fitxMin) fitxMin = fitx;

               if (fitx > fitxMax) fitxMax = fitx;

               tphStep++;


              TMarker *m = new TMarker(fitxArray[tphStep],tphArray[tphStep],20);
              m->SetMarkerSize(2);
              m->SetMarkerColor(31+tphStep);
              m->Draw();



            }
         }

         if (s2bStep == 0) {

            TH1F* frame = MyC->DrawFrame(0.0,0.0,1.1*fitxMax,1.1);
//          TH1F* frame = MyC->DrawFrame(0.7*fitxMin,0.7*tphMin,1.1*fitxMax,1.1*tphMax);

            TAxis *xaxis = frame->GetXaxis();
            TAxis *yaxis = frame->GetYaxis();
   
            xaxis->SetTitle("x = u^{2}/v^{2}");
            xaxis->CenterTitle();
            xaxis->SetTitleOffset(1.);
            xaxis->SetDecimals();
            xaxis->SetLabelSize(0.03);
            xaxis->SetLabelOffset(0.01);
        
            yaxis->SetTitle("tan^{2}(#phi)");
            yaxis->CenterTitle();
            yaxis->SetTitleOffset(1.);
            yaxis->SetDecimals();
            yaxis->SetLabelSize(0.03);
            yaxis->SetLabelOffset(0.01);

            frame->SetTitle(plottitle.c_str());

         }

         tphplots[s2bStep] = new TGraph(tphSteps,fitxArray,tphArray);

         tphplots[s2bStep]->SetMarkerStyle(20);

         tphplots[s2bStep]->SetMarkerSize(0.4);
   
         tphplots[s2bStep]->Draw("CP");

      }
   }

   else if (strpltmd.compare("s2b") == 0) {

      s2bMax = -1.0;

      TGraph *s2bplots[tphSteps-100];

      for(tphStep=0; tphStep<tphSteps-100; tphStep++) {

         Float_t s2bArray[s2bSteps], fitxArray[s2bSteps];

         s2bStep = 0;

         for(point=0; point<Npoints; point++) {
      
            tree->GetEntry(point);
      
            if(fittph == tphValues[tphStep+20]) {

               s2bArray[s2bStep]  = fits2b;

               if (fits2b < s2bMin) s2bMin = fits2b;

               if (fits2b > s2bMax) s2bMax = fits2b;

               fitxArray[s2bStep] = fitx;

               if (fitx < fitxMin) fitxMin = fitx;

               if (fitx > fitxMax) fitxMax = fitx;

               s2bStep++;              

            }
         }

         if (tphStep == 0) {

            TH1F* frame = MyC->DrawFrame(0.8*fitxMin,0.95*s2bMin,1.2*fitxMax,1.05*s2bMax);

            TAxis *xaxis = frame->GetXaxis();
            TAxis *yaxis = frame->GetYaxis();
   
            xaxis->SetTitle("x = u^{2}/v^{2}");
            xaxis->CenterTitle();
            xaxis->SetTitleOffset(1.);
            xaxis->SetDecimals();
            xaxis->SetLabelSize(0.03);
            xaxis->SetLabelOffset(0.01);

            yaxis->SetTitle("sin^{2}(2#beta)");
            yaxis->CenterTitle();
            yaxis->SetTitleOffset(1.25);
            yaxis->SetDecimals();
            yaxis->SetLabelSize(0.03);
            yaxis->SetLabelOffset(0.01);

            frame->SetTitle(plottitle.c_str());

         }

         s2bplots[tphStep] = new TGraph(s2bSteps,fitxArray,s2bArray);

         s2bplots[tphStep]->SetMarkerStyle(20);

         s2bplots[tphStep]->SetMarkerSize(0.4);

         s2bplots[tphStep]->Draw("C");

      }
   }

   else if (strpltmd.compare("mmp") == 0) {

      Float_t mzpArray[mmpSteps], mwpArray[mmpSteps];

      Float_t mzpMin = 100000, mzpMax = -1.0, mwpMin = 100000, mwpMax = -1.0;

      Float_t fitsph, fitcph; 

      Float_t Cz1, Cz2, Cz3, Cw1, Cw2, Cw3, Cw4, C1, C2;

      string mdl(strfile,0,2);

      if ( (mdl.compare("lr") == 0) ||
           (mdl.compare("lp") == 0) ||
           (mdl.compare("hp") == 0) ||
           (mdl.compare("fp") == 0) ) {

         string Higgs(strfile,3,1);

         if (Higgs.compare("d") == 0) {

            Cz1 = 11.95349795785275;
            Cz2 = 30.63269990028513;
            Cz3 = 42.58619785813789;
            Cw1 = 21.29309892906894;
            Cw2 = 9.339600971216193;
            Cw3 = 30.63269990028513;
            Cw4 = 42.58619785813789;

         }

         else if (Higgs.compare("t") == 0) {

            Cz1 = 5.976748978926375;
            Cz2 = 30.63269990028513;
            Cz3 = 85.17239571627579;
            Cw1 = 15.05649464522066;
            Cw2 = 3.302047590161717;
            Cw3 = 21.66058982554409;
            Cw4 = 60.22597858088265;

         } else {error(6);}

         for(point=0; point<Npoints; point++) {
      
            tree->GetEntry(point);

            fitsph = fittph / (1.0 + fittph);

            fitcph = 1.0 - fitsph;

            if (fitsph != 0.0) {

               mzpArray[point] = (0.001/sqrt(fitsph*fitcph*fitx)) * (Cz1*fitcph*fitcph + Cz2*fits2b + Cz3*fitx);

               if (mzpArray[point] < mzpMin) mzpMin = mzpArray[point];

               if (mzpArray[point] > mzpMax) mzpMax = mzpArray[point];

               mwpArray[point] = (0.001/sqrt(fitsph*fitx))  * (Cw1 - Cw2*fitcph*fitcph + Cw3*fits2b + Cw4*fitx);

               if (mwpArray[point] < mwpMin) mwpMin = mwpArray[point];

               if (mwpArray[point] > mwpMax) mwpMax = mwpArray[point];

            } else {

               mzpArray[point] = 0.0;

               mwpArray[point] = 0.0;

            }
         }
      } 

      else if ( (mdl.compare("uu") == 0) ||
                (mdl.compare("nu") == 0) ) {

         C1 = 94.0397928463607
         C2 = 77.1253849720165

         for(point=0; point<Npoints; point++) {
      
            tree->GetEntry(point);

            fitsph = fittph / (1.0+fittph);

            fitcph = 1.0 - fitsph;

            if (fitsph != 0.0) {

               mzpArray[point] = (0.001/sqrt(fitsph*fitcph*fitx)) * (C1*fitsph*fitsph + C2*fitx);

               if (mzpArray[point] < mzpMin) mzpMin = mzpArray[point];

               if (mzpArray[point] > mzpMax) mzpMax = mzpArray[point];

               mwpArray[point] = (0.001/sqrt(fitsph*fitcph*fitx)) * (C1*fitsph*fitsph + C2*fitx);

               if (mwpArray[point] < mwpMin) mwpMin = mwpArray[point];

               if (mwpArray[point] > mwpMax) mwpMax = mwpArray[point];

            } else {

               mzpArray[point] = 0.0;

               mwpArray[point] = 0.0;

            }
         }
      }