예제 #1
0
  void SurfaceBasis<EvalT, Traits>::computeJacobian(
      const PHX::MDField<MeshScalarT, Cell, QuadPoint, Dim, Dim> basis,
      const PHX::MDField<MeshScalarT, Cell, QuadPoint, Dim, Dim> dualBasis,
      PHX::MDField<MeshScalarT, Cell, QuadPoint> area)
  {
    const std::size_t worksetSize = basis.dimension(0);

    for (std::size_t cell(0); cell < worksetSize; ++cell) {
      for (std::size_t pt(0); pt < numQPs; ++pt) {
        Intrepid::Tensor<MeshScalarT> dPhiInv(3, &dualBasis(cell, pt, 0, 0));
        Intrepid::Tensor<MeshScalarT> dPhi(3, &basis(cell, pt, 0, 0));
        Intrepid::Vector<MeshScalarT> G_2(3, &basis(cell, pt, 2, 0));

        MeshScalarT j0 = Intrepid::det(dPhi);
        MeshScalarT jacobian = j0 *
          std::sqrt( Intrepid::dot(Intrepid::dot(G_2, Intrepid::transpose(dPhiInv) * dPhiInv), G_2));
        area(cell, pt) = jacobian * refWeights(pt);
      }
    }

  }
예제 #2
0
void plot_ZJetBalance( int index, int bin, TH1& responseHistGen, 
		       TH1& responseHistReco, TH1& genJetpt, 
		       TH1& caloJetpt, TH1& recoZpt ) {

  /////////////////////////////////////////////////////
  /////////////////////////////////////////////////////

  TChain* t = new TChain("ZJet");
  if( useLocalFile == true ) t->Add("analysis_zjet.root");
  else t->Add(basename + TString("*.root"));

  /////////////////////////////////////////////////////
  /////////////////////////////////////////////////////

  Float_t JetRecoPt[20][4];
  Float_t JetCorPt[20][4];
  Float_t JetGenPt[20][4];
  Float_t JetRecoEta[20][4];
  Float_t JetGenEta[20][4];
  Float_t JetRecoPhi[20][4];
  Float_t JetGenPhi[20][4];
  Float_t JetRecoType[20][4];
  Float_t Z_Pt;
  Float_t Z_Phi;
  Float_t Z_Eta;
  Float_t Z_PtGen;
  Float_t Z_PhiGen;
  Float_t ePlusPt;
  Float_t eMinusPt;
  Float_t ePlusPtGen;
  Float_t eMinusPtGen;
  Float_t ePlusEta;
  Float_t eMinusEta;
  Float_t ePlusPhi;
  Float_t eMinusPhi;
  Float_t mZeeGen;
  Float_t mZee;

  Float_t ePlus_ecaliso_20;
  Float_t ePlus_sc_e;
  Float_t eMinus_ecaliso_20;
  Float_t eMinus_sc_e;
  Float_t ePlus_ptisoatecal_15;	   
  Float_t eMinus_ptisoatecal_15;
  

  t->SetBranchAddress("JetGenPt",   JetGenPt);
  t->SetBranchAddress("JetGenEta",  JetGenEta);
  t->SetBranchAddress("JetGenPhi",  JetGenPhi);
  t->SetBranchAddress("JetCorPt",   JetCorPt);
  t->SetBranchAddress("JetRecoPt",  JetRecoPt);
  t->SetBranchAddress("JetRecoEta", JetRecoEta);
  t->SetBranchAddress("JetRecoPhi", JetRecoPhi);

  t->SetBranchAddress("Z_Pt",       &Z_Pt);
  t->SetBranchAddress("Z_Phi",      &Z_Phi);
  t->SetBranchAddress("Z_Eta",      &Z_Eta);
  t->SetBranchAddress("Z_PtGen",    &Z_PtGen);
  t->SetBranchAddress("Z_PhiGen",   &Z_PhiGen);
  t->SetBranchAddress("ePlusPt",    &ePlusPt);
  t->SetBranchAddress("eMinusPt",   &eMinusPt);
  t->SetBranchAddress("ePlusPtGen", &ePlusPtGen);
  t->SetBranchAddress("eMinusPtGen",&eMinusPtGen);
  t->SetBranchAddress("ePlusEta",   &ePlusEta);
  t->SetBranchAddress("eMinusEta",  &eMinusEta);
  t->SetBranchAddress("ePlusPhi",   &ePlusPhi);
  t->SetBranchAddress("eMinusPhi",  &eMinusPhi);
  t->SetBranchAddress("mZeeGen",     &mZeeGen);
  t->SetBranchAddress("mZee",        &mZee);
  t->SetBranchAddress("ePlus_ecaliso_20",      &ePlus_ecaliso_20);
  t->SetBranchAddress("ePlus_sc_e",            &ePlus_sc_e);
  t->SetBranchAddress("eMinus_ecaliso_20",     &eMinus_ecaliso_20);
  t->SetBranchAddress("eMinus_sc_e",           &eMinus_sc_e);
  t->SetBranchAddress("ePlus_ptisoatecal_15",  &ePlus_ptisoatecal_15);	   
  t->SetBranchAddress("eMinus_ptisoatecal_15", &eMinus_ptisoatecal_15);

  t->SetBranchStatus("*",    0);
  t->SetBranchStatus("JetGenPt",    1);
  t->SetBranchStatus("JetGenEta",   1);
  t->SetBranchStatus("JetGenPhi",   1);
  t->SetBranchStatus("JetRecoPt",   1);
  t->SetBranchStatus("JetRecoEta",  1);
  t->SetBranchStatus("JetRecoPhi",  1);
  t->SetBranchStatus("JetCorPt",    1);
  t->SetBranchStatus("JetCorEta",   1);
  t->SetBranchStatus("JetCorPhi",   1);
  t->SetBranchStatus("Z_Pt",        1);
  t->SetBranchStatus("Z_Phi",       1);
  t->SetBranchStatus("Z_Eta",       1);
  t->SetBranchStatus("Z_PtGen",     1);
  t->SetBranchStatus("Z_PhiGen",    1);
  t->SetBranchStatus("ePlusPt",     1);
  t->SetBranchStatus("eMinusPt",    1);
  t->SetBranchStatus("ePlusPtGen",  1);
  t->SetBranchStatus("eMinusPtGen", 1);
  t->SetBranchStatus("ePlusEta",    1);
  t->SetBranchStatus("eMinusEta",   1);
  t->SetBranchStatus("ePlusPhi",    1);
  t->SetBranchStatus("eMinusPhi",   1);
  t->SetBranchStatus("mZeeGen",     1);
  t->SetBranchStatus("mZee",        1);
  t->SetBranchStatus("ePlus_ecaliso_20",      1);
  t->SetBranchStatus("ePlus_sc_e",            1);
  t->SetBranchStatus("eMinus_ecaliso_20",     1);
  t->SetBranchStatus("eMinus_sc_e",           1);
  t->SetBranchStatus("ePlus_ptisoatecal_15",  1);	   
  t->SetBranchStatus("eMinus_ptisoatecal_15", 1);





  for (Long64_t entry =0; entry < t->GetEntries(); entry++) {
    t->GetEntry(entry);
    if(entry%20000==0) std::cout<<"************ Event # "<< entry <<std::endl;


    bool isPtCut  = (ePlusPt>20.0) && (eMinusPt>20.0) && 
      (Z_Pt > GenPt[bin]) && (Z_Pt < GenPt[bin+1]);


    bool isEtaCutP = (fabs(ePlusEta)<1.4442) || 
      (fabs(ePlusEta)>1.560 && fabs(ePlusEta)<2.5);
    bool isEtaCutM = (fabs(eMinusEta)<1.4442) || 
      (fabs(eMinusEta)>1.560 && fabs(eMinusEta)<2.5);
    bool isECALiso = (ePlus_ecaliso_20 > 0.0) && 
      (ePlus_ecaliso_20 < 0.2) && (eMinus_ecaliso_20 > 0.0) && 
      (eMinus_ecaliso_20 < 0.2);    
    bool isTrackiso = (ePlus_ptisoatecal_15 < 0.2) && 
      (eMinus_ptisoatecal_15 < 0.2);


    if( !(isPtCut && isEtaCutP && isEtaCutM && isECALiso && 
	  isTrackiso && fabs(mZee-91.2)<2.5) )  continue;

    float leadGenJetPt=JetGenPt[index][0]; 
    float secondGenJetPt=JetGenPt[index][0]; 


    int leadRecoIndex=-1, secondRecoIndex=-1;
    float leadRecoJetPt   = 0.0;
    float secondRecoJetPt = 0.0;

    leadRecoIndex = 0; 
    secondRecoIndex = 1;
    leadRecoJetPt   =  JetRecoPt[index][0];
    secondRecoJetPt =  JetRecoPt[index][1];


//   FindLeadIndex(JetRecoCorrectedPt[index], leadRecoIndex[index], secondRecoIndex[index]);
//   leadRecoJetPt   = JetRecoCorrectedPt[index][leadRecoIndex];
//   secondRecoJetPt = JetRecoCorrectedPt[index][secondRecoIndex];

//   if(leadRecoIndex==-1) continue;


    // ************ test: apply jet pT cut *****************
    if( JetRecoPt[index][0] < MINPTCUT || 
	JetRecoPt[index][1] < MINPTCUT ) continue;


    float leadRecoJetEta = JetRecoEta[index][leadRecoIndex];
    double dPhiReco = dPhi(JetRecoPhi[index][leadRecoIndex], Z_Phi);


    if( fabs(dPhiReco)<2.94 || fabs(leadRecoJetEta)>1.3 || 
	secondRecoJetPt/leadRecoJetPt>0.2 ) continue;


    double ptRatioGen  = leadGenJetPt/Z_PtGen;
    double ptRatioReco = 0.0;

    if(usingCorrectedCaloJetPt) ptRatioReco = JetCorPt[index][0]/Z_Pt;
    else ptRatioReco = JetRecoPt[index][0]/Z_Pt;


    responseHistGen.Fill( ptRatioGen );
    responseHistReco.Fill( ptRatioReco );

    genJetpt.Fill(leadGenJetPt); 
    caloJetpt.Fill(leadRecoJetPt);
    recoZpt.Fill( Z_Pt );

    
  } // end TTree loop


  if(makeplot_ZptBalance==true) {

    TString plotname = 
      Form("ptBalance-allCuts_%d_%d", (int) GenPt[bin], 
	   (int) GenPt[bin+1] );
    
    PlotOnCanvas( responseHistGen, responseHistReco, 
		  plotname);
  }

}
예제 #3
0
void plot_ZJetBalance( int index, std::string JetResponseFilename, 
		       Float_t genMean[], Float_t genSigma[], 
		       Float_t recoMean[], Float_t recoSigma[]) {


  ////////////// Defining the L3JetCorrector ///////////////////////
  double p[6];
  p[0] = 10.0;          
  p[1] = 800.0;         

  // // with MEAN response
//   p[2] = 0.953124;
//   p[3] = 4.87151;
//   p[4] = 2.83723;  
//   p[5] = 2.91468;


  // // with MPV response
//   p[2] = 0.978755;
//   p[3] = 2.1759;
//   p[4] = 2.25031;  
//   p[5] = 0.0;


  // // with TruncMEAN 2 sigma response
//   p[2] = 1.00299;
//   p[3] = 3.83695;
//   p[4] = 2.87351;  
//   p[5] = 1.6071;


  // // with TruncMEAN 1.5 sigma response
  p[2] = 1.00299;
  p[3] = 3.83695;
  p[4] = 2.87351;  
  p[5] = 1.6071;


  // // with TruncMEAN 1.5 sigma iterative 3 times
//   p[2] = 1.16793;
//   p[3] = 8.8575;
//   p[4] = 5.01816;  
//   p[5] = 5.03132;


  // // with TruncMEAN 1.5 sigma iterative n times
//   p[2] = 1.23392;
//   p[3] = 9.33578;
//   p[4] = 5.60468;  
//   p[5] = 5.52937;


  // // with TruncMEAN 1 sigma response
//   p[2] = 0.690152;
//   p[3] = 2.97111;
//   p[4] = 1.70586;  
//   p[5] = 0.72181;


  // // with MPV: when p[5] is allowed to go negative       
//   p[2] = 0.893141;
//   p[3] = 0.00355417;
//   p[4] = 0.0123656;  
//   p[5] = -1.00176;


  // // from dijet MC truth      
//   p[2] = 0.996998;
//   p[3] = 4.39412;
//   p[4] = 2.96134;  
//   p[5] = 1.69966;


   if(storeResponsHistogramsInRootFile == true) {
     TFile respHistFile(JetResponseFilename.c_str(),"RECREATE");
  }

  TH1F* responseHistGen[nZPtBins];
  TH1F* responseHistReco[nZPtBins];
  TH1F* genJetpt[nZPtBins];
  TH1F* recoZpt[nZPtBins];
  TH1F* caloJetpt[nZPtBins];
  TH1F* Zpt[nZPtBins];

  for(int i=0; i<nZPtBins; i++) {

    responseHistGen[i] = new TH1F(TString("responseHistGen_")+ptBin[i],
				  "",40, 0.0, 2.0);
    TAxis* responseHistGenx = responseHistGen[i]->GetXaxis();
    TAxis* responseHistGeny = responseHistGen[i]->GetYaxis();
    responseHistGenx->SetTitle("p_{T}^{jet} / p_{T}^{Z}   ");
    responseHistGeny->SetTitle("Events / 0.05");
    responseHistGeny->SetTitleOffset(1.4);   
    responseHistGenx->SetNdivisions(505);
    responseHistGeny->SetNdivisions(505);

    responseHistReco[i] = new TH1F(TString("responseHistReco_")+ptBin[i],
				   "",40,0.0,2.0);
    responseHistReco[i]->SetLineColor(2);
    responseHistReco[i]->SetMarkerColor(2);    
    genJetpt[i] = new TH1F(TString("genJetpt_")+ptBin[i],
			   "", 140, 0, 800);
    caloJetpt[i] = new TH1F(TString("caloJetpt_")+ptBin[i],
			    "", 140, 0, 800);
    recoZpt[i] = new TH1F(TString("recoZpt_")+ptBin[i],
			  "", 140, 0, 800);

    responseHistReco[i]->Sumw2();
    responseHistGen[i]->Sumw2();
    genJetpt[i]->Sumw2();
    caloJetpt[i]->Sumw2();
    recoZpt[i]->Sumw2();
  }


  for (Long64_t entry =0; entry < mychain->GetEntries(); entry++) {
    
    mychain->GetEntry(entry);
    if(entry%100000==0) std::cout<<"**** Event # "<< entry <<std::endl;


    // Fill generator level quantities
    int leadGenIndex=-1, secondGenIndex=-1;
    FindLeadIndex(JetGenPt[index], JetGenEta[index], JetGenPhi[index],
		  eMinusEtaGen, eMinusPhiGen, 
		  ePlusEtaGen, ePlusPhiGen, leadGenIndex, secondGenIndex);

    if(leadGenIndex !=-1 && secondGenIndex !=-1 && 
       (ePlusPtGen>20.0) && (eMinusPtGen>20.0) && 
       ((fabs(ePlusEtaGen)<1.4442) || 
	(fabs(ePlusEtaGen)>1.560 && fabs(ePlusEtaGen)<2.5)) && 
       ((fabs(eMinusEtaGen)<1.4442) || 
	(fabs(eMinusEtaGen)>1.560 && fabs(eMinusEtaGen)<2.5)) && 
       (fabs(JetGenEta[index][leadGenIndex])<1.3) ) {
	
      float leadGenJetPt   = JetGenPt[index][leadGenIndex];
      float secondGenJetPt = JetGenPt[index][secondGenIndex];

      double wt = GetWeight( mychain->GetFile()->GetName() );

      double ptRatioGen  = (double) leadGenJetPt/ (double) Z_PtGen;
      if((double) secondGenJetPt/(double) Z_PtGen < 0.1) {  

	for(int bin=0; bin<nZPtBins; bin++) { //begin Z pT bin loop
	  if(  (Z_PtGen > theZPt[bin]) && (Z_PtGen < theZPt[bin+1]) ) {
	    responseHistGen[bin]->Fill( ptRatioGen, wt );
	    genJetpt[bin]->Fill(leadGenJetPt, wt );  
	  } // end if loop
	} // end Z pT loop
      }
    }


    // Fill reco level quantities
    int leadRecoIndex=-1, secondRecoIndex=-1;
    FindLeadIndex(JetRecoPt[index], JetRecoEta[index], JetRecoPhi[index],
		  eMinusEta, eMinusPhi, 
		  ePlusEta, ePlusPhi, leadRecoIndex, secondRecoIndex);
    
    if(leadRecoIndex !=-1 && secondRecoIndex !=-1) {

      float leadRecoJetPt;
      float secondRecoJetPt;
      float leadRecoJetEta;
      double dPhiReco;

      double L3scale = 1.0;
      double apt = JetRecoPt[index][leadRecoIndex];
      if( apt< p[0] ) apt = p[0];
      if( apt> p[1] ) apt = p[1];
      double log10pt = log10(apt);
      double result = p[2]+p[3]/(pow(log10pt,p[4])+p[5]);

      if(usingCorrectedCaloJetPt) L3scale = result;

      leadRecoJetPt   = L3scale * JetRecoPt[index][leadRecoIndex];
      secondRecoJetPt = JetRecoPt[index][secondRecoIndex];
      leadRecoJetEta  = JetRecoEta[index][leadRecoIndex];
      dPhiReco = dPhi(JetRecoPhi[index][leadRecoIndex], Z_Phi);


      bool pass = BoolCutResult( Z_Pt, mZee, eMinusPt, eMinusEta, ePlusPt, 
				 ePlusEta, eMinus_trackiso, ePlus_trackiso, 
				 eMinus_ecaliso, ePlus_ecaliso, 
				 eMinus_hcaliso, ePlus_hcaliso, 
				 iseMinusLoose, isePlusLoose,
				 leadRecoJetPt, leadRecoJetEta, 
				 secondRecoJetPt, dPhiReco);

      if( ! pass )  continue;

      double wt = GetWeight( mychain->GetFile()->GetName() );
      double ptRatioReco = (double) leadRecoJetPt/ (double) Z_Pt;
 

      for(int bin=0; bin<nZPtBins; bin++) { //begin Z pT bin loop
	if(  (Z_Pt > theZPt[bin]) && (Z_Pt < theZPt[bin+1]) ) {
	  responseHistReco[bin]->Fill( ptRatioReco, wt  );
	  caloJetpt[bin]->Fill(leadRecoJetPt, wt );
	  recoZpt[bin]->Fill( Z_Pt, wt  );   
	} // end if loop
      } // end Z pT loop
    }
  } // end TTree loop


  // Fill the mean and error vectors

    for(int i=0; i<nZPtBins; i++) {
      if(ScaleToLuminosity) {
	for(int j=0; j<40; j++) {
	  double err = sqrt( responseHistReco[i]->GetBinContent(j));
	  responseHistReco[i]->SetBinError(j, err);
	  err = sqrt( responseHistGen[i]->GetBinContent(j));
	  responseHistGen[i]->SetBinError(j, err);
	}
      }

      genMean[i]   = (Float_t) responseHistGen[i]->GetMean(1);
      genSigma[i]  = (Float_t) responseHistGen[i]->GetMean(11);
      recoMean[i]  = (Float_t) responseHistReco[i]->GetMean(1); 
      recoSigma[i] = (Float_t) responseHistReco[i]->GetMean(11);
    }



  // plot the pT balance response histograms
  if(makeplot_ZptBalance==true) {

    for(int i=0; i<nZPtBins; i++) {
      TString plotname = Form("ptBalance-allCuts_%d_%d", (int) theZPt[i], 
			      (int) theZPt[i+1] );  
      PlotOnCanvas( *responseHistGen[i], *responseHistReco[i], plotname);
    }
  }   


  // Now write all the histograms in a ROOT file
  if(storeResponsHistogramsInRootFile == true) {
    respHistFile.cd();
    for(int i=0; i<nZPtBins; i++) {
      responseHistGen[i]->Write();
      responseHistReco[i]->Write();
      genJetpt[i]->Write();
      caloJetpt[i]->Write();
      recoZpt[i]->Write();
    }
    respHistFile.Close();
  }


  // clean up the memory
  delete [] responseHistGen;
  delete [] responseHistReco;
  delete [] genJetpt;
  delete [] caloJetpt;
  delete [] recoZpt;
}
예제 #4
0
int main(int ac, char** av){
	if(ac < 2){
		std::cout << "usage: ./signalAcceptance inputFile[s]" << std::endl;
		return -1;
	}
	
	TH1F* allCategory = new TH1F("allCategory","all Category",11,0.5,11.5);
	TH1F* preselCategory = new TH1F("preselCategory","presel Category",11,0.5,11.5);
	TH1F* photonCategory = new TH1F("photonCategory","reco photon Category",11,0.5,11.5);
	
	TH1F* VisAllCategory = new TH1F("VisAllCategory","all Category, Vis",11,0.5,11.5);
	TH1F* VisPreselCategory = new TH1F("VisPreselCategory","presel Category, Vis",11,0.5,11.5);
	TH1F* VisPhotonCategory = new TH1F("VisPhotonCategory","reco photon Category, Vis",11,0.5,11.5);
	
	
	TH1F* dROtherGen = new TH1F("dROtherGen", "dROtherGen", 800, 0.0, 4.0);
	TH1F* parentage = new TH1F("parentage","parentage",30, 0, 30);	
	TH1F* dptOverpt = new TH1F("dptOverpt","dptOverpt", 400, -2.0, 2.0);
	TH1F* dRrecoGen = new TH1F("dRrecoGen","dRrecoGen", 200, 0.0, 0.2);
	TH1F* dPhiRecoGen = new TH1F("dPhiRecoGen","dPhiRecoGen", 400, 0.0, 0.2);
	TH1F* dEtaRecoGen = new TH1F("dEtaRecoGen","dEtaRecoGen", 800, -0.2, 0.2);
	
	TH1F* dRGenNearJet = new TH1F("dRGenNearJet","dRGenNearJet", 200, 0.0, 1.0);
	TH1F* dPhiGenNearJet = new TH1F("dPhiGenNearJet","dPhiGenNearJet", 100, 0.0, 0.5);
	TH1F* dEtaGenNearJet = new TH1F("dEtaGenNearJet","dEtaGenNearJet", 200, -0.5, 0.5);

	//TH1F* dRGenNextNearJet = new TH1F("dRGenNextNearJet","dRGenNextNearJet", 600, 0.0, 6.0);
	//TH1F* dPhiGenNextNearJet = new TH1F("dPhiGenNextNearJet","dPhiGenNextNearJet", 300, 0.0, 3.0);
	//TH1F* dEtaGenNextNearJet = new TH1F("dEtaGenNextNearJet","dEtaGenNextNearJet", 600, -3.0, 3.0);

	// object selector
	Selector* selectorLoose = new Selector();
	// create event selectors here
	EventPick* evtPickLoose = new EventPick("LoosePhotonID");
	// do not do jet to photon dR cleaning
	evtPickLoose->veto_pho_jet_dR = 0.0;
	
	
	EventTree* tree = new EventTree(ac-1, av+1);
	double PUweight = 1.0;
	
	Long64_t nEntr = tree->GetEntries();
	for(Long64_t entry=0; entry<nEntr; entry++){
		if(entry%10000 == 0) std::cout << "processing entry " << entry << " out of " << nEntr << std::endl;
		tree->GetEntry(entry);
		
		doJER(tree);

		selectorLoose->process_objects(tree);
		evtPickLoose->process_event(tree, selectorLoose, PUweight);

		// fill the histograms
		fillCategory(tree, allCategory, PUweight);
		if(evtPickLoose->passPreSel) fillCategory(tree, preselCategory, PUweight);
		if(evtPickLoose->passAll) fillCategory(tree, photonCategory, PUweight);

		// fill histograms for gen photon passing the acceptance cuts defined in analysis
		bool inAcc = false;
		for(int mcInd=0; mcInd<tree->nMC_; ++mcInd){
			if(tree->mcPID->at(mcInd) == 22 && 
			(tree->mcParentage->at(mcInd)==2 || tree->mcParentage->at(mcInd)==10 || tree->mcParentage->at(mcInd)==26) && 
			tree->mcPt->at(mcInd) > 25 && 
			fabs(tree->mcEta->at(mcInd)) < 1.4442){
				inAcc = true;
			}
		}
		if(inAcc){
			fillCategory(tree, VisAllCategory, PUweight);
			if(evtPickLoose->passPreSel) fillCategory(tree, VisPreselCategory, PUweight);
			if(evtPickLoose->passAll) fillCategory(tree, VisPhotonCategory, PUweight);
		}
		
		// have at least one good photon
		if(!evtPickLoose->passAll) continue;

		// test
		//if(overlapMadGraph(tree)) continue;

		int phoInd = evtPickLoose->Photons.at(0);
		// experiment with delta R cuts for photons
		for(int mcInd=0; mcInd<tree->nMC_; ++mcInd){
			bool etetamatch = dR(tree->mcEta->at(mcInd),tree->mcPhi->at(mcInd),tree->phoEta_->at(phoInd),tree->phoPhi_->at(phoInd)) < 0.2 && 
			(fabs(tree->phoEt_->at(phoInd) - tree->mcPt->at(mcInd)) / tree->mcPt->at(mcInd)) < 1.0;
			if( etetamatch && tree->mcPID->at(mcInd) == 22){
				// test
				if(!(tree->mcParentage->at(mcInd)==2 || tree->mcParentage->at(mcInd)==10 || tree->mcParentage->at(mcInd)==26)) continue;
				
				// fill histograms for mathced photon candidate
				parentage->Fill( tree->mcParentage->at(mcInd) );
				dptOverpt->Fill( (tree->phoEt_->at(phoInd) - tree->mcPt->at(mcInd)) / tree->mcPt->at(mcInd));
				dRrecoGen->Fill( dR(tree->mcEta->at(mcInd),tree->mcPhi->at(mcInd),tree->phoEta_->at(phoInd),tree->phoPhi_->at(phoInd)) );
				dPhiRecoGen->Fill( dPhi( tree->phoPhi_->at(phoInd) - tree->mcPhi->at(mcInd) ) );
				dEtaRecoGen->Fill( tree->phoEta_->at(phoInd) - tree->mcEta->at(mcInd) );
				
				int closestGenInd = secondMinDrIndex( mcInd, tree );
				if(dR(tree->mcEta->at(mcInd), tree->mcPhi->at(mcInd), tree->mcEta->at(closestGenInd), tree->mcPhi->at(closestGenInd)) < 0.01){
					std::cout << "closest PID " << tree->mcPID->at(closestGenInd) << "  MomPID " << tree->mcMomPID->at(closestGenInd) << std::endl;
					std::cout << "photon mother PID " << tree->mcMomPID->at(mcInd) << std::endl;
				}
				dROtherGen->Fill( dR(tree->mcEta->at(mcInd), tree->mcPhi->at(mcInd), tree->mcEta->at(closestGenInd), tree->mcPhi->at(closestGenInd)) );
	
				int closestJetInd = minDrIndex( tree->mcEta->at(mcInd), tree->mcPhi->at(mcInd), tree->jetEta_, tree->jetPhi_ );
				dRGenNearJet->Fill( dR(tree->mcEta->at(mcInd), tree->mcPhi->at(mcInd), tree->jetEta_->at(closestJetInd), tree->jetPhi_->at(closestJetInd) ) );
				dPhiGenNearJet->Fill( dPhi( tree->jetPhi_->at(closestJetInd) - tree->mcPhi->at(mcInd) ) );
				dEtaGenNearJet->Fill( tree->jetEta_->at(closestJetInd) - tree->mcEta->at(mcInd) );
				
				//closestJetInd = secondMinDrIndex( tree->mcEta->at(mcInd), tree->mcPhi->at(mcInd), tree->jetEta_, tree->jetPhi_ );	
				//dRGenNextNearJet->Fill( dR(tree->mcEta->at(mcInd), tree->mcPhi->at(mcInd), tree->jetEta_->at(closestJetInd), tree->jetPhi_->at(closestJetInd) ) );
				//dPhiGenNextNearJet->Fill( dPhi( tree->jetPhi_->at(closestJetInd) - tree->mcPhi->at(mcInd) ) );
				//dEtaGenNextNearJet->Fill( tree->jetEta_->at(closestJetInd) - tree->mcEta->at(mcInd) );
			}
		}
	}

	evtPickLoose->print_cutflow();

	// write histograms
	TFile outFile("signalAcc.root","RECREATE");
	
	saveHist(allCategory, &outFile);
	saveHist(preselCategory, &outFile);
	saveHist(photonCategory, &outFile);
	
	saveHist(VisAllCategory, &outFile);
	saveHist(VisPreselCategory, &outFile);
	saveHist(VisPhotonCategory, &outFile);
	
	saveHist(dROtherGen, &outFile);
	saveHist(parentage, &outFile);
	saveHist(dptOverpt, &outFile);
	saveHist(dRrecoGen, &outFile);
	saveHist(dPhiRecoGen, &outFile);
	saveHist(dEtaRecoGen, &outFile);
	saveHist(dRGenNearJet, &outFile);
	saveHist(dPhiGenNearJet, &outFile);
	saveHist(dEtaGenNearJet, &outFile);
	
	//saveHist(dRGenNextNearJet, &outFile);
	//saveHist(dPhiGenNextNearJet, &outFile);
	//saveHist(dEtaGenNextNearJet, &outFile);

	outFile.Close();

	delete tree;
	return 0;
}
예제 #5
0
void
HHV4Vector::PrintErrors() const
{
  std::cout << Name() << "  ";
  Printf(" (Errors)    %8.2f  %8.4f  %8.4f  ", dE(), dEta(), dPhi());
}