Integration in limited range

Can you please show me how to code the integration for the Counts from channel (4000 to 5000) from the attached file ?
first column is the channel number and the second is the count

Run.txt (109.5 KB)

Fits you read the file as we showed you many times already. You can create two vectors holding all the values and sum the counts for the channel 4000 to 5000. You can also create and fill a 1D histogram (you have many examples from past posts) and integrate from bin 4000 to 5000. There are several ways to it it.

This is Ok, ??

ifstream inputfile;"Run.txt");

double Ch, Ct,  Area=0, Left, Right;
                                            // Left Edge of the integration Part
                                            // Left Edge of the integration Part
while (inputfile >> Ch >> Ct){
       if ((Ch>=5000.) && (Ch<=5500.)){

cout << "Total Area=" << Area << endl;


I do not know… does it give you a meaning full result ?

yes, it give me the expected results.

But i post my question to know how to use the integration function in root.

In the ROOT reference guide type “Integral” in the search box and you will get all the references.
Very likely you are looking for this one.

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