Hello @jalopezg
I replaced
Double_t BeamX; tree_input->SetBranchAddress( "BeamX", &BeamX );
Double_t BeamY; tree_input->SetBranchAddress( "BeamY", &BeamY );
Double_t BeamZ; tree_input->SetBranchAddress( "BeamZ", &BeamZ );
Double_t BeamCX; tree_input->SetBranchAddress( "BeamCX", &BeamCX );
Double_t BeamCY; tree_input->SetBranchAddress( "BeamCY", &BeamCY );
Double_t BeamCZ; tree_input->SetBranchAddress( "BeamCZ", &BeamCZ );
Double_t BeamEne; tree_input->SetBranchAddress( "BeamEne", &BeamEne );
Double_t BeamPart; tree_input->SetBranchAddress( "BeamPart", &BeamPart );
Double_t nhits; tree_input->SetBranchAddress( "nhits", &nhits );
by
vector<double> *BeamX; tree_input->SetBranchAddress( "BeamX", &BeamX );
vector<double> *BeamY; tree_input->SetBranchAddress( "BeamY", &BeamY );
vector<double> *BeamZ; tree_input->SetBranchAddress( "BeamZ", &BeamZ );
vector<double> *BeamCX; tree_input->SetBranchAddress( "BeamCX", &BeamCX );
vector<double> *BeamCY; tree_input->SetBranchAddress( "BeamCY", &BeamCY );
vector<double> *BeamCZ; tree_input->SetBranchAddress( "BeamCZ", &BeamCZ );
vector<double> *BeamEne; tree_input->SetBranchAddress( "BeamEne", &BeamEne );
vector<double> *BeamPart; tree_input->SetBranchAddress( "BeamPart", &BeamPart );
vector<double> *nhits; tree_input->SetBranchAddress( "nhits", &nhits );
and because of in the root file I read there are xhit, yhit and zhit
I replaced
vector<double> *xh=0; tree_input->SetBranchAddress( "xh", &xh );
vector<double> *yh=0; tree_input->SetBranchAddress( "yh", &yh );
vector<double> *zh=0; tree_input->SetBranchAddress( "zh", &zh );
by
vector<double> *xhit=0; tree_input->SetBranchAddress( "xh", &xhit );
vector<double> *yhit=0; tree_input->SetBranchAddress( "yh", &yhit );
vector<double> *zhit=0; tree_input->SetBranchAddress( "zh", &zhit );
but I got this error
root [0] .x Vector_To_Array.C("C:/LemmaMC.root", "C:/testbeam/LemmaMC_array.root")
In file included from input_line_8:1:
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:160:24: error: assigning to 'Double_t' (aka 'double') from incompatible type 'vector<double> *'
BeamX_new = BeamX;
^~~~~
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:161:24: error: assigning to 'Double_t' (aka 'double') from incompatible type 'vector<double> *'
BeamY_new = BeamY;
^~~~~
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:162:24: error: assigning to 'Double_t' (aka 'double') from incompatible type 'vector<double> *'
BeamZ_new = BeamZ;
^~~~~
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:163:24: error: assigning to 'Double_t' (aka 'double') from incompatible type 'vector<double> *'
BeamCX_new = BeamCX;
^~~~~~
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:164:24: error: assigning to 'Double_t' (aka 'double') from incompatible type 'vector<double> *'
BeamCY_new = BeamCY;
^~~~~~
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:165:24: error: assigning to 'Double_t' (aka 'double') from incompatible type 'vector<double> *'
BeamCZ_new = BeamCZ;
^~~~~~
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:166:24: error: assigning to 'Double_t' (aka 'double') from incompatible type 'vector<double> *'
BeamEne_new = BeamEne;
^~~~~~~
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:167:24: error: assigning to 'Double_t' (aka 'double') from incompatible type 'vector<double> *'
BeamPart_new = BeamPart;
^~~~~~~~
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:168:24: error: assigning to 'Double_t' (aka 'double') from incompatible type 'vector<double> *'
nhits_new = nhits;
^~~~~
then I replaced
Double_t BeamX_new; tree_output->Branch( "BeamX", &BeamX_new, "BeamX/D" );
Double_t BeamY_new; tree_output->Branch( "BeamY", &BeamY_new, "BeamY/D" );
Double_t BeamZ_new; tree_output->Branch( "BeamZ", &BeamZ_new, "BeamZ/D" );
Double_t BeamCX_new; tree_output->Branch( "BeamCX", &BeamCX_new, "BeamCX/D" );
Double_t BeamCY_new; tree_output->Branch( "BeamCY", &BeamCY_new, "BeamCY/D" );
Double_t BeamCZ_new; tree_output->Branch( "BeamCZ", &BeamCZ_new, "BeamCZ/D" );
Double_t BeamEne_new; tree_output->Branch( "BeamEne", &BeamEne_new, "BeamEne/D" );
Double_t BeamPart_new; tree_output->Branch( "BeamPart", &BeamPart_new, "BeamPart/D" );
Double_t nhits_new; tree_output->Branch( "nhits", &nhits_new, "nhits/D" );
by
vector<double> BeamX_new; tree_output->Branch( "BeamX", &BeamX_new, "BeamX/D" );
vector<double> BeamY_new; tree_output->Branch( "BeamY", &BeamY_new, "BeamY/D" );
vector<double> BeamZ_new; tree_output->Branch( "BeamZ", &BeamZ_new, "BeamZ/D" );
vector<double> BeamCX_new; tree_output->Branch( "BeamCX", &BeamCX_new, "BeamCX/D" );
vector<double> BeamCY_new; tree_output->Branch( "BeamCY", &BeamCY_new, "BeamCY/D" );
vector<double> BeamCZ_new; tree_output->Branch( "BeamCZ", &BeamCZ_new, "BeamCZ/D" );
vector<double> BeamEne_new; tree_output->Branch( "BeamEne", &BeamEne_new, "BeamEne/D" );
vector<double> BeamPart_new; tree_output->Branch( "BeamPart", &BeamPart_new, "BeamPart/D" );
vector<double> nhits_new; tree_output->Branch( "nhits", &nhits_new, "nhits/D" );
buy I get this big error
root [0] .x Vector_To_Array.C("C:/LemmaMC.root", "C:/testbeam/LemmaMC_array.root")
In file included from input_line_8:1:
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:160:22: error: no viable overloaded '='
BeamX_new = BeamX;
~~~~~~~~~ ^ ~~~~~
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:671:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(vector&& _Right) noexcept(noexcept(_Move_assign(_Right, _Choose_pocma<_Alty>{}))) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1174:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'const std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(const vector& _Right) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1182:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'initializer_list<double>' for 1st
argument
vector& operator=(initializer_list<_Ty> _Ilist) {
^
In file included from input_line_8:1:
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:161:22: error: no viable overloaded '='
BeamY_new = BeamY;
~~~~~~~~~ ^ ~~~~~
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:671:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(vector&& _Right) noexcept(noexcept(_Move_assign(_Right, _Choose_pocma<_Alty>{}))) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1174:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'const std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(const vector& _Right) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1182:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'initializer_list<double>' for 1st
argument
vector& operator=(initializer_list<_Ty> _Ilist) {
^
In file included from input_line_8:1:
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:162:22: error: no viable overloaded '='
BeamZ_new = BeamZ;
~~~~~~~~~ ^ ~~~~~
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:671:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(vector&& _Right) noexcept(noexcept(_Move_assign(_Right, _Choose_pocma<_Alty>{}))) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1174:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'const std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(const vector& _Right) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1182:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'initializer_list<double>' for 1st
argument
vector& operator=(initializer_list<_Ty> _Ilist) {
^
In file included from input_line_8:1:
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:163:22: error: no viable overloaded '='
BeamCX_new = BeamCX;
~~~~~~~~~~ ^ ~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:671:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(vector&& _Right) noexcept(noexcept(_Move_assign(_Right, _Choose_pocma<_Alty>{}))) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1174:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'const std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(const vector& _Right) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1182:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'initializer_list<double>' for 1st
argument
vector& operator=(initializer_list<_Ty> _Ilist) {
^
In file included from input_line_8:1:
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:164:22: error: no viable overloaded '='
BeamCY_new = BeamCY;
~~~~~~~~~~ ^ ~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:671:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(vector&& _Right) noexcept(noexcept(_Move_assign(_Right, _Choose_pocma<_Alty>{}))) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1174:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'const std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(const vector& _Right) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1182:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'initializer_list<double>' for 1st
argument
vector& operator=(initializer_list<_Ty> _Ilist) {
^
In file included from input_line_8:1:
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:165:22: error: no viable overloaded '='
BeamCZ_new = BeamCZ;
~~~~~~~~~~ ^ ~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:671:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(vector&& _Right) noexcept(noexcept(_Move_assign(_Right, _Choose_pocma<_Alty>{}))) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1174:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'const std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(const vector& _Right) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1182:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'initializer_list<double>' for 1st
argument
vector& operator=(initializer_list<_Ty> _Ilist) {
^
In file included from input_line_8:1:
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:166:22: error: no viable overloaded '='
BeamEne_new = BeamEne;
~~~~~~~~~~~ ^ ~~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:671:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(vector&& _Right) noexcept(noexcept(_Move_assign(_Right, _Choose_pocma<_Alty>{}))) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1174:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'const std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(const vector& _Right) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1182:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'initializer_list<double>' for 1st
argument
vector& operator=(initializer_list<_Ty> _Ilist) {
^
In file included from input_line_8:1:
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:167:22: error: no viable overloaded '='
BeamPart_new = BeamPart;
~~~~~~~~~~~~ ^ ~~~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:671:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(vector&& _Right) noexcept(noexcept(_Move_assign(_Right, _Choose_pocma<_Alty>{}))) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1174:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'const std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(const vector& _Right) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1182:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'initializer_list<double>' for 1st
argument
vector& operator=(initializer_list<_Ty> _Ilist) {
^
In file included from input_line_8:1:
C:\root_v6.25.01_master-build\macros\Vector_To_Array.C:168:22: error: no viable overloaded '='
nhits_new = nhits;
~~~~~~~~~ ^ ~~~~~
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:671:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(vector&& _Right) noexcept(noexcept(_Move_assign(_Right, _Choose_pocma<_Alty>{}))) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1174:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'const std::vector<double,
std::allocator<double> >' for 1st argument; dereference the argument with *
vector& operator=(const vector& _Right) {
^
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\vector:1182:13: note: candidate function not viable: no known conversion from 'vector<double> *' to 'initializer_list<double>' for 1st
argument
vector& operator=(initializer_list<_Ty> _Ilist) {
^
root [1]