Concerning histogram range


_ROOT Version: 6.14.04
_Platform: Linux (Ubuntu)
Compiler: Not Provided


Hi All,

In the macro I am using, I have generated 30 million events (pp-collisions) and out of all those events, put a histogram of the transverse momentum of all pions in a canvas, together with a histogram of the transverse momentum of pions which specifically originate from sigma-c baryons. Unfortunately I have encountered a problem. When I run a fairly low amount of events (say 100.000), the code works just fine, but with the 30m events, it seems that a constraint is put on the maximum of the histogram for all pions. I have added an image below to illustrate what I mean:
AllPion_vs_SigmaPion_30M.pdf (18.2 KB).
The blue bins are the ones for all pions and the red bins are the ones for pions specifically originating form sigma-c baryons.

I know there is nothing wrong with the way pythia simulates the events, because I have copied that part of the code directly from root’s own pythia/root tutorial. There must be something wrong in the way I have defined my histograms or selection criteria. I have included the part of the code where the error must be below:

TH1F* ptPionH = new TH1F("ptpionH", "pion pt", 100, 0., 3);
TH1F* ptPionSigmaH = new TH1F("ptPionSigmaH","pion from Sigmac pt", 100, 0., 3);

// Array of all particles
   TClonesArray* particles = new TClonesArray("TParticle", 1000);
// Create pythia8 object
   TPythia8* pythia8 = new TPythia8();
// Configure
   pythia8->ReadString("HardQCD:all = on");
// Initialize
   pythia8->Initialize(2212 /* p */, 2212 /* p */, 10000. /* GeV */);

//--------------------------------event-loop-----------------------------
 for (Int_t iev = 0; iev < nev; iev++) {
      pythia8->GenerateEvent();
      if (iev < ndeb) pythia8->EventListing();
      pythia8->ImportParticles(particles,"All");
      Int_t np = particles->GetEntriesFast();

 for (Int_t ip = 0; ip < np; ip++) {
         TParticle* part = (TParticle*) particles->At(ip);
         Int_t pdg = part->GetPdgCode();
         Float_t pt  = part->Pt();

//Pion
	 if (((pdg == 211) || (pdg == -211)) && (pt >= 0)) ptPionH->Fill(pt);

 if ((!part) || part->IsPrimary()) continue;
	 Int_t motherindex = part->GetFirstMother();
	 TParticle* mpart = (TParticle*) particles->At(motherindex);
	 Int_t mpdg = mpart->GetPdgCode();
	 Float_t mpt = mpart->Pt();

 //Pion with Sigma_c as mother-particle
	 if (((pdg == 211) || (pdg == -211)) && (mpdg == 4112) && (pt >= 0)) ptPionSigmaH->Fill(pt)

//--------------------------Histogram-Settings-------------------------------
double_t norm1 = ptPionH->GetEntries();
double_t norm3 = ptPionSigmaH->GetEntries();

ptPionH->Scale(1/norm1);
   ptPionH->SetXTitle("p_{t} [GeV/c]");
   ptPionH->SetYTitle("Entries");

ptPionSigmaH->Scale(1/norm3);
   ptPionSigmaH->SetXTitle("p_{t} [GeV/c]");
   ptPionSigmaH->SetYTitle("Entries");

 TCanvas* c11 = new TCanvas("c11", "Pythia8 pion  pt", 700, 700);
   ptPionSigmaH->SetLineColor(kRed);
   ptPionSigmaH->Draw();
   ptPionH->Draw("SAME");

Does anyone have any idea what could be wrong?
Best regards,

Loek Meijers

Try to use TH1D instead of TH1F.

Thanks, I appreciate you helping me out again!

Loek

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.