示例#1
0
void plotdjr(TString filename, const char* outputbase) {
 
  TH1::SetDefaultSumw2();
  
  TChain *tree = new TChain("Events");
  tree->Add(filename);
  
  tree->SetAlias("LHEEvent","LHEEventProduct_source__GEN.obj");
  tree->SetAlias("GenEvent","GenEventInfoProduct_generator__GEN.obj");
  tree->SetAlias("GenParticles","recoGenParticles_genParticles__GEN.obj");
  tree->SetAlias("genJets","recoGenJets_ak4GenJets__GEN.obj");  
  
  tree->SetAlias("dr0","sqrt( (genJetsCleaned[0].eta()-promptPhotons[0].eta())^2 + atan2(sin(genJetsCleaned[0].phi()-promptPhotons[0].phi()),cos(genJetsCleaned[0].phi()-promptPhotons[0].phi()))^2 )");
  tree->SetAlias("dr1","sqrt( (genJetsCleaned[1].eta()-promptPhotons[0].eta())^2 + atan2(sin(genJetsCleaned[1].phi()-promptPhotons[0].phi()),cos(genJetsCleaned[1].phi()-promptPhotons[0].phi()))^2 )");
  tree->SetAlias("dr2","sqrt( (genJetsCleaned[2].eta()-promptPhotons[0].eta())^2 + atan2(sin(genJetsCleaned[2].phi()-promptPhotons[0].phi()),cos(genJetsCleaned[2].phi()-promptPhotons[0].phi()))^2 )");
  tree->SetAlias("dr3","sqrt( (genJetsCleaned[3].eta()-promptPhotons[0].eta())^2 + atan2(sin(genJetsCleaned[3].phi()-promptPhotons[0].phi()),cos(genJetsCleaned[3].phi()-promptPhotons[0].phi()))^2 )");
  
  TCut weight = "GenEvent.weight()";
  int nbins = 50.;
  double djrmin = -0.5;
  double djrmax = 4.;
  
  
  makeplot(TString::Format("%s_%s",outputbase,"djr0"),tree,weight,"log10(GenEvent.DJRValues_[0])","DJR 0->1",nbins,djrmin,djrmax);
  makeplot(TString::Format("%s_%s",outputbase,"djr1"),tree,weight,"log10(GenEvent.DJRValues_[1])","DJR 1->2",nbins,djrmin,djrmax);
  makeplot(TString::Format("%s_%s",outputbase,"djr2"),tree,weight,"log10(GenEvent.DJRValues_[2])","DJR 2->3",nbins,djrmin,djrmax);
  makeplot(TString::Format("%s_%s",outputbase,"djr3"),tree,weight,"log10(GenEvent.DJRValues_[3])","DJR 3->4",nbins,djrmin,djrmax);
  return;  
}
示例#2
0
void plotdjr(const TString & infile, const TString & outfile) {
 
  gSystem->Load("libFWCoreFWLite.so");  
  AutoLibraryLoader::enable();  
  TH1::SetDefaultSumw2();
  
  TChain *tree = new TChain("Events");
  tree->Add(infile);
  
  tree->SetAlias("GenEvent","GenEventInfoProduct_generator__GEN.obj");
  tree->SetAlias("LHEEvent","LHEEventProduct_externalLHEProducer__LHE.obj");
 
  TCut weight = "GenEvent.weight()";
  int nbins = 50.;
  double djrmin = -0.5;
  double djrmax = 3.;
  //typeMC sets the kind of sample we are looking at: 
  //0 is for NLO with FXFX merging; 
  //1 is for LO with MLM; 
  //2 is for LO with MLM (plotting partons after excluding non-matched partons in wbb/vbf type processes)
  int typeMC = 2;
  
  TCanvas *c1 = new TCanvas("c1", "c1", 800, 600);
  TPad *pad[5];
  setcanvas(c1,pad);

  pad[0]->cd();
  makeplot("djr0",tree,weight,"log10(GenEvent.DJRValues_[0])","DJR 0->1",nbins,djrmin,djrmax,typeMC);
  pad[1]->cd();
  makeplot("djr1",tree,weight,"log10(GenEvent.DJRValues_[1])","DJR 1->2",nbins,djrmin,djrmax,typeMC);
  pad[2]->cd();
  makeplot("djr2",tree,weight,"log10(GenEvent.DJRValues_[2])","DJR 2->3",nbins,djrmin,djrmax,typeMC);
  pad[3]->cd();
  makeplot("djr3",tree,weight,"log10(GenEvent.DJRValues_[3])","DJR 3->4",nbins,djrmin,djrmax,typeMC);
  pad[4]->cd();
  makeplot("djr4",tree,weight,"log10(GenEvent.DJRValues_[4])","DJR 4->5",nbins,djrmin,djrmax,typeMC);


  c1->Print(outfile);
  return;  
}
示例#3
0
/*
 * Makes n plots and times them.
 * Plot number k is called sink.
 * It is a plot of sin(kx) vs. x
 */
void timeplot(int n){
	double x[n*10];
	double y[n*10];
	StatVector stats(n);
	TimeStamp clk;
	for(int i=1; i <= n; i++){
		printf("\r%d", i);
		fflush(stdout);
		char name[30];
		sprintf(name, "sin%d", i);
		for(int j=0; j < n*10; j++){
			x[j] = 2*PI*i*j/(n*10.0);
			y[j] = sin(x[j]*i);
		}
		clk.tic();
		makeplot(x, y, 10*n, name);
		double cycles = clk.toc();
		stats.insert(cycles);
	}
	char banner[200];
	sprintf(banner, "cycle stats for %d plots", n);
	stats.print(banner);
	system("rm FIGS/sin*.pdf");
}