Error accessing the content of a vector (using commands GetName, getVal, etc.)

Dear experts,

I faced a problem while writing a code in C++. There was an error every time I tried to access the content of a vector. There is something wrong with my ROOT probably because the script runs on other computers. Is there anything I could try to fix the problem??

More specifically the error is found in line 136 when I try to get the name or the value of the content of the vector:

for (unsigned int i=0; i<nuisPar_name.size(); i++) {
cout << vars[i]->GetName() << " " << vars[i]->getVal() << " " << vars[i]->getMin() << " " << vars[i]->getMax() << endl;;
}

The code is given below

Thank you in advance
myPL.C (4.31 KB)

Try to add a protection:
if (vars[i]) cout << vars[i]->GetName() << …

I got the same segmentation error as before…Please, excuse me for asking but have you tried that in the script attached? Just to know for sure if it is only me who gets this error or not.

I get (ROOT 5.34/36 and 6.06/06): [code]root [0] .x myPL.C

RooFit v3.60 – Developed by Wouter Verkerke and David Kirkby
Copyright © 2000-2013 NIKHEF, University of California & Stanford University
All rights reserved, please read http://roofit.sourceforge.net/license.txt

[#1] INFO:ObjectHandling – RooWorkspace::import(wspace) importing dataset data
WARNING! lower bound for parameter b is negative (-0.386607)

Created nuisance parameters:

b 1.1 -0.386607 2.58661
Czz 0.83 0.8 0.86
Lumi 20.3 19.7316 20.8684
root [1] [/code]
I’ve got an idea … before you start ROOT, in the subdirectory in which you work, make sure that you first: rm -rf AutoDict_* *_ACLiC_*

It didn’t work either…So it’s only me who gets the error…Are you suggesting I should reinstall ROOT as a last resort? Because probably there is something wrong there or something missing.

If it helps by the way if I try to load the script first and then execute it I get this error:

root [0] .L myPL.C

RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby 
                Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
                All rights reserved, please read http://roofit.sourceforge.net/license.txt

root [1] .x myPL.C
Warning: template pair duplicate definition /home/stergios/root/cint/cint/stl/_pair.h:31:
Warning: template reverse_iterator duplicate definition /home/stergios/root/cint/cint/stl/_iterator.h:269:
Warning: template vector duplicate definition /home/stergios/root/cint/cint/stl/_vector.h:44:
Error: Too many template arguments /home/stergios/root/cint/cint/stl/_vector.h:192:
Error: Too many template arguments /home/stergios/root/cint/cint/stl/_vector.h:192:
Error: Too many template arguments /home/stergios/root/cint/cint/stl/_vector.h:192:
*** Interpreter error recovered ***
root [2] 

Either: root [0] .x myPL.C or: root [0] .L myPL.C root [1] myPL(); Try: root [0] .?

Oh ok…Then it is the same error in both cases

RooFit v3.60 -- Developed by Wouter Verkerke and David Kirkby 
                Copyright (C) 2000-2013 NIKHEF, University of California & Stanford University
                All rights reserved, please read http://roofit.sourceforge.net/license.txt

[#1] INFO:ObjectHandling -- RooWorkspace::import(wspace) importing dataset data
WARNING! lower bound for parameter b is negative (-0.386607)
============================ 
Created nuisance parameters: 
============================ 

 *** Break *** segmentation violation
Root > Function myPL() busy flag cleared

[url=https://root-forum.cern.ch/t/missing-canvas/17664/17 it be that you have several ROOT versions installed and you get a “mix” of their libraries?[/url]

It is possible…So I will follow the steps described and I will let you know…Thanks for your help!

The problem was fixed finally after I re-installed Root…Thank you for your help once again!

Best regards,
Stergios