#678 closed How to (fixed)
Can't using Track declare a vector or a function.
Reported by: | Li Huang | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Delphes code | Version: | Delphes 3 |
Keywords: | Cc: |
Description
I find that, for example, I can write Track trackArray[] to use Track to declare a array.
But I can not use vector<Track> vec or Track function() or function(Track parameter) . I can not using Track to declare a vector or function or parameters, why and how can I using function or vector with these classes?
Change History (4)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 9 years ago
Thank you! But I want to compile my script with root, like,after root -l,then .L test.C+ .(using compilation like yours may lead other problems since I want to use the Delphes and root header files.) Can you help me?
comment:4 by , 9 years ago
(using compilation like yours may lead other problems since I want to use the Delphes and root header files.)
It's not true. It's just a C++ program. You can include any combination of Delphes, ROOT and any other header files.
I don't understand your problem. The code from my previous comment can be used with .L test.C+
.
Here is a slightly modified version that can be saved as test.C
:
#include <iostream> #include <vector> #include <classes/DelphesClasses.h> using namespace std; void test() { vector< Track > test; cout << "vector size: " << test.size() << endl; }
It works without any problem:
$ root -l root [0] .L test.C+ Info in <TUnixSystem::ACLiC>: creating shared library test_C.so root [1] test(); vector size: 0
Here is an example of a program using
vector<Track>
: