[Rivet] segfault while declaring arrays of histograms

Raghav Kunnawalkam Elayavalli raghav.k.e at cern.ch
Thu Aug 4 14:08:34 BST 2016


Hi Rivet and Yoda experts,

Im having an issue with declaring arrays of histograms (without a yoda file to point to d01-x01-y01, and d01-x02-y01 etc..., that works) inside my initialize method.
I want to do something like this (but that doenst work in rivet/yoda)
for(int i = 0; i<N; ++i){
     hist[i] = bookHisto1D(Form("name_%d",i), 100, 0, 100);
}

So I have two sets of histograms like this:

    Histo2DPtr _h_JES[3];
    Histo1DPtr _h_JER[3][3];

    Scatter2DPtr _h_JES_pTClosure[3];
    Scatter2DPtr _h_JES_etaClosure[3];

and this is how i declare them

      for(int i = 0; i<_NJES_eta; ++i){
stringstream etabin;
etabin << "JES_etabin" << i;
const string JESname = etabin.str();
_h_JES[i] = bookHisto2D(JESname, 500, 0, 500, 100, 0, 2);
for(int j = 0; j<_NJES_pt; ++i){
 stringstream ptbin;
 ptbin << "JER_etabin" << i << "_ptbin" << j;
 const string JERname = ptbin.str();
 _h_JER[i][j] = bookHisto1D(JERname, 100, 0, 2);
}
      }

      for(int i = 0; i<_NJES_eta; ++i){
stringstream etabin;
etabin << "JES_pTClosure_etabin" << i;
const string JESname = etabin.str();
_h_JES_pTClosure[i] = bookScatter2D(JESname);
      }

      for(int i = 0; i<_NJES_pt; ++i){
stringstream ptbin;
ptbin << "JES_etaClosure_ptbin" << i;
const string JESname = ptbin.str();
_h_JES_etaClosure[i] = bookScatter2D(JESname);
      }


when i do this, I just get a segfault without it telling me anything. Is this the proper way to do it?

Cheers
Raghav Kunnawalkam Elayavalli
PhD Candiate
Rutgers University
http://physics.rutgers.edu/~raghav/<http://www.google.com/url?q=http%3A%2F%2Fphysics.rutgers.edu%2F~raghav%2F&sa=D&sntz=1&usg=AFQjCNENvwedEL22DMATPxyb0WMvVEm9Bw>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20160804/274078f7/attachment.html>


More information about the Rivet mailing list