Read variable in tree

Dear experts,

I’m working in the directory (1). When I run the file ./do.exe, in the Loop function in analysis.C, you can see that the “cout” for the variable (2) does not print anything. But when I look at the tree that the file read (3),
you can see that this variable is fill. Do you see something wrong? It has the same type than “el_ambiguityType” which works file.

Regards

(1)
http://calpas.web.cern.ch/calpas/test/

(2)
cout<<"(*el_expectInnermostPixelLayerHit)[0]: "<<(*el_expectInnermostPixelLayerHit)[0] <<endl;

(3)
http://calpas.web.cern.ch/calpas/test/output.root

Try:

std::cout << "(*el_expectInnermostPixelLayerHit)[0]: " << ((int)((*el_expectInnermostPixelLayerHit)[0])) << std::endl;

Dear Coyote,

thank you, it worked.

Regards

Dear experts,
I still have the same trouble but with different variables. In my working directory (1) when I run “analysis.C”, I have a break segment at these line (2) or even (3). This seems to be random. I checked for the vector size with “jet_e->size()”, but as it is a pointor I’m not sure? Do you see what is wrong? I want to be sure I’m reading good value and not any value taken by the reference out of the vector “real range”…
Regards

(1)
http://calpas.web.cern.ch/calpas/plot/

(2)
//if(jet_e->size()>=1) hist_e[12]->Fill((*jet_e)[0]);
//if(jet_e->size()>=2) hist_e[13]->Fill((*jet_e)[1]);
//if(jet_e->size()>=3) hist_e[14]->Fill((*jet_e)[2]);
(3)
//if(jet_e->size()>=2) hist_e[12]->Fill((*jet_e)[1]);
//if(jet_e->size()>=3) hist_e[13]->Fill((*jet_e)[2]);
//if(jet_e->size()>=1) hist_e[14]->Fill((*jet_eta)[0]);

Try with (I assume that all “hist_e[12]”, …, “hist_e[14]” have been created in advance):

if((jet_e) && (jet_e->size() > 0)) hist_e[12]->Fill((*jet_e)[0]);
// ...
if((jet_eta) && (jet_eta->size() > 0)) hist_e[14]->Fill((*jet_eta)[0]);

Dear Coyote,

it does not work.

Regards

You need to “protect” all places (in the same way as in my previous post here) where you access various vectors (maybe the problem is in another line and you just get the “break” message with incorrect line number).

Dear Coyote,

thank you. All is ok now.

Regards

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