Home | News | Documentation | Download

What will get in the "cut=cut_s.data()"?

Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided
what will get in the “cut=cut_s.data()”?

class detector
detector(string name,double min,double max);  
TCut cut;
double upper;
double lower;
detector::detector(string name,double min,double max):lower(min),upper(max)     
string cut_s=name+Form(">%f",lower)+"&&"+name+Form("<%f",upper);          //Form?
cut=cut_s.data();             //?

Hi @meixue,
sorry for the late reply. data() just returns the contents of a string as an array of characters, i.e. as const char *. It’s not ROOT related, see e.g. https://en.cppreference.com/w/cpp/string/basic_string/data


you can just print cut to screen to see what’s inside the string

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.