Hi,
MakeClass does not like object (including vectors), you need to remove the SetMakeClass(1). With newer version of ROOT (5.28 and up), you should be able to also disable the MakeClass mode just for the branch containing the your vector (i.e. call SetMakeClass(0) on the branch.
Cheers,
Philippe.
On 4/6/11 2:04 PM, Arthur E. Snyder wrote:
> Hi All,
>
> I got the following to compile:
> if(agnTimeGap::agnName!="") {
> cout << "name:" << agnName << endl;
> // cout << "source:" << *Source_Name << endl;
> cout << "this source:" << *(const char*)Source_Name << endl;
> if(*agnTimeGap::agnName.Data()!=*(const char*)Source_Name) return kTRUE;
> cout << "got it" << endl;
> }
>
> However it doesn't work; the print out looks like this:
>
> set up for linux
>
> name:J0457.0-2325
> this source:È
>
> Perhaps |Source_Name| is not loaded properly by |MakeSelector|?
>
> std::vector<std::string> *Source_Name;
> Branch *b_Source_Name; //!
>
> Source_Name = 0; <--- this is different from the usual, like because |Source_Name| is pointer to |vector| of strings rather than
> the usual variables themselves ..
>
> fChain->SetBranchAddress("Source_Name", &Source_Name, &b_Source_Name);
>
> It's passing pointer-to-pointer |&Source_Name| to |SetBranchAddress| followed by pointer to pointer to point (|&b_Source_Name)|
>
> Is that ok?
>
> A.E. Snyder, Group ? \!c*p?/
> SLAC Mail Stop #95 ((. .))
> Box 4349 |
> Stanford, Ca, USA, 94309 '\|/`
> e-mail:snyder_at_slac.stanford.edu o
> phone:650-926-2701 _
> http://www.slac.stanford.edu/~snyder BaBar
> FAX:707-313-0250 Collaboration
> &
> Fermi/GLAST
>
>
>
> On Wed, 6 Apr 2011, Arthur E. Snyder wrote:
>
>>
>> In recent verions of fermi/glast n-tuples a string variable has been added
>> of the form:
>>
>> vector<string>* Source_Name
>>
>> I had some instructions for dealing with tup->Draw("var","cut"). These
>> work, and I can, e.g., compare |Source_Name| to a |TString| in the cut.
>>
>> However, when I try to the same thing in a selector (made with
>> |tup->MakeSelector| it fails to compile.
>>
>> Code fragment is:
>>
>> if(agnTimeGap::agnName!="") {
>> cout << "name:" << agnName << endl;
>> // cout << "source:" << *Source_Name << endl;
>> if(agnTimeGap::agnName!=Source_Name) return kTRUE;
>> cout << "got it" << endl;
>> }
>>
>> which is like the 'code' as it appears in |Draw|.
>>
>> The error message is
>>
>> /afs/slac.stanford.edu/u/ek/snyder/glast/root/./agnTimeGap.cc:95: error:
>> invalid conversion from `std::vector<std::string,
>> std::allocator<std::string> >*' to `char'
>> /afs/slac.stanford.edu/u/ek/snyder/glast/root/./agnTimeGap.cc:95: error:
>> initializing argument 1 of `TString::TString(char)'
>>
>> Putting a * in front of |Source_Name| produces a different error.
>>
>> So how am I supposed to compare at |TString| to a |vector<string>*|?
>>
>> --Thanks, Arthur S.
>>
>>
>>
>> A.E. Snyder, Group ? \!c*p?/
>> SLAC Mail Stop #95 ((. .))
>> Box 4349 |
>> Stanford, Ca, USA, 94309 '\|/`
>> e-mail:snyder_at_slac.stanford.edu o
>> phone:650-926-2701 _
>> http://www.slac.stanford.edu/~snyder BaBar
>> FAX:707-313-0250 Collaboration
>> &
>> Fermi/GLAST
>>
>>
>>
Received on Wed Apr 06 2011 - 21:32:36 CEST
This archive was generated by hypermail 2.2.0 : Thu Apr 07 2011 - 11:50:01 CEST