Compare eta Dalitz using weights with parse_eta.C


{
    //First, one has to run parse_eta.C and use_eta_generator.C
    //If one uses the output of hello_world.C one can
    //see very nicely the effect of a detector acceptance

    gStyle->SetOptLogy(1);

    TFile *f = new TFile("eta_dalitz.root");
    TTree *Reaction = (TTree*)gDirectory->Get("data");
    TClonesArray *evt = new TClonesArray("PParticle", 7);
    Reaction->SetBranchAddress("Particles", &evt);
    PParticle *par[7];

    Int_t nentries = Reaction->GetEntries();
    TH1F *mass = new TH1F("mass", "Dilepton mass", 100, 0, 1.);
    mass->Sumw2();

    PParticle *dil=NULL, *d=NULL;

    for (Int_t i=0; i<nentries; i++) {
    
	Reaction->GetEntry(i);
    
	for (int j=0; j<7; j++) {
	    par[j] = (PParticle*)evt->At(j);
	    if (par[j] && par[j]->is("dilepton")) dil = (PParticle*)evt->At(j);
	    if (par[j] && par[j]->is("D+"))       d   = (PParticle*)evt->At(j);
	}

	mass->Fill(dil->M(), (Stat_t) dil->W()*mass->GetNbinsX());
    }

    mass->SetMinimum(0.000000001);
    mass->Draw("e1");
    mass->SetMarkerColor(2);
    mass->SetLineColor(2);

    TFile *f2 = new TFile("eta_generator.root");
    Reaction = (TTree*)gDirectory->Get("data");

    Reaction->SetBranchAddress("Particles", &evt);

    nentries = Reaction->GetEntries();
    TH1F *mass2 = new TH1F("mass2", "Dilepton mass", 100, 0, 1.);
    mass2->Sumw2();

    for (Int_t i=0; i<nentries; i++) {
    
	Reaction->GetEntry(i);
    
	for (int j=0; j<7; j++) {
	    par[j] = (PParticle*)evt->At(j);
	    if (par[j] && par[j]->is("dilepton")) dil = (PParticle*)evt->At(j);
	    if (par[j] && par[j]->is("D+"))       d   = (PParticle*)evt->At(j);
	}

	mass2->Fill(dil->M(), (Stat_t) dil->W()*mass2->GetNbinsX());
    }

    mass2->SetXTitle("M [GeV/c^{2}]");
    mass2->SetYTitle("counts * BR");
    mass2->Draw("");
    
    mass->SetMarkerStyle(4); //open circles
    mass->Draw("samee1");
    mass2->SetMarkerColor(4);
    mass2->SetLineColor(4);
}
 ana_eta_generator.C:1
 ana_eta_generator.C:2
 ana_eta_generator.C:3
 ana_eta_generator.C:4
 ana_eta_generator.C:5
 ana_eta_generator.C:6
 ana_eta_generator.C:7
 ana_eta_generator.C:8
 ana_eta_generator.C:9
 ana_eta_generator.C:10
 ana_eta_generator.C:11
 ana_eta_generator.C:12
 ana_eta_generator.C:13
 ana_eta_generator.C:14
 ana_eta_generator.C:15
 ana_eta_generator.C:16
 ana_eta_generator.C:17
 ana_eta_generator.C:18
 ana_eta_generator.C:19
 ana_eta_generator.C:20
 ana_eta_generator.C:21
 ana_eta_generator.C:22
 ana_eta_generator.C:23
 ana_eta_generator.C:24
 ana_eta_generator.C:25
 ana_eta_generator.C:26
 ana_eta_generator.C:27
 ana_eta_generator.C:28
 ana_eta_generator.C:29
 ana_eta_generator.C:30
 ana_eta_generator.C:31
 ana_eta_generator.C:32
 ana_eta_generator.C:33
 ana_eta_generator.C:34
 ana_eta_generator.C:35
 ana_eta_generator.C:36
 ana_eta_generator.C:37
 ana_eta_generator.C:38
 ana_eta_generator.C:39
 ana_eta_generator.C:40
 ana_eta_generator.C:41
 ana_eta_generator.C:42
 ana_eta_generator.C:43
 ana_eta_generator.C:44
 ana_eta_generator.C:45
 ana_eta_generator.C:46
 ana_eta_generator.C:47
 ana_eta_generator.C:48
 ana_eta_generator.C:49
 ana_eta_generator.C:50
 ana_eta_generator.C:51
 ana_eta_generator.C:52
 ana_eta_generator.C:53
 ana_eta_generator.C:54
 ana_eta_generator.C:55
 ana_eta_generator.C:56
 ana_eta_generator.C:57
 ana_eta_generator.C:58
 ana_eta_generator.C:59
 ana_eta_generator.C:60
 ana_eta_generator.C:61
 ana_eta_generator.C:62
 ana_eta_generator.C:63
 ana_eta_generator.C:64
 ana_eta_generator.C:65
 ana_eta_generator.C:66
 ana_eta_generator.C:67
 ana_eta_generator.C:68
 ana_eta_generator.C:69
 ana_eta_generator.C:70