Problems with merging multiple histos using THStack

yep,

     } else if(Folder == "Data") {
      DataHist->Fill(ZZMass,weight);

should be filled but for some reason it’s not,that’s my question

I can’t tell… If you don’t know how to debug your code, you can still add some printf (like in the good old time) :wink:
Or give me access to the data, so I can run the code

If there’s a way that i can give u access to data,i’ll gladly do it,but you’ll have to tell me how,since im a newbie here xD
I’ll try to igure it out,might take some time

Well, I would advise to try to solve the problem yourself (we can still help), so you would have a chance to understand and learn more than if someone is just writing the right code for you… You can use gdb and put breakpoints in the code to follow what the code is actually doing…

Well sure,I usually tried to understand from beginning,however usually get stuck at times like those.And working with pputty is hell for me,since i dont have mac,so trying to solve something really gets hard at some times,together with all the other tasks i have.But okay,tnx for help-if u find a soultion please do post

in run.cpp:

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

should be:

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

Fixed,still no print on hist,I’m working on it.If you guys find anything else weird pls text,
Thank you

Okay,did it!
There were some mistakes in InitializeHistos and also Draw(“SAME”) must be called after a Draw() function.
Thanks alot tho!

You’re welcome! Can we see the result?

Of course,this is what it looks like

The only thing left is making this more “presentable” and better-looking.If you have any tips,I would appriciate them

Cool, thanks! And maybe @couet can give you some tips

Sure :slight_smile: .Okays,Couet I’m all ears!

Yes I can help … but thats also a matter of taste … some people will find what you have already very “presentable” :slight_smile:
If you want your plot looks like the original plot you posted you will need to change the histogram colors, marker style of errors bars … etc … The simplest would be that you send me your running macro and I will try to modify it in that way.

Yeah It would be nice to change it to the looks of original plot,if you could just edit the code where I’m editing colors and other options,I would be greatful.
I’m sending you all 3 codes,but I think you’ll only need Analyzer.C part for editing,InitializeHistos function and so on.
run.cpp (989 Bytes)
Analyzer.C (8.7 KB)
Analyzer.h (121.0 KB)

I’d gladly send u the stuff I fill histograms with too,but files are too large unfortunately

Your macro has several lines like h13->SetFillColor(kRed);
They all set saturated colors
Try to use less aggressive colors as those provided in the color wheel

The marker style can be also change with h->SetMrakerStyle(...)
Choose pyour preferred marker in the list of markers

I do not know what else you want to do …

Perfect,many thanks!I think this will be more than enough for editing I need :slight_smile:

Guys,one last question ( this time its really the last one,I’m done with histos and they are approved,just doing some fixing ) : How do you see a number of Events in hist? I could really use that info since I need Event/bin ratio for y-Axis(just making sure)
Until now I’ve assumed Events are equal to (X_max-X_min)

root [0] hpx->GetEntries()
(double) 25000.000000

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