Storing of Printed channels back into program

Hi Dear all !

How i can store the data (means the printed channels) back into the same macro in array . Could you please help me in this regard. For example some of them are here .

Thank you.

Hello,

Could you give a bit more details of your code (perhaps even a code snippet of what you are trying to do)?

Cheers,
Enric

Yes, You can find the code here.
And the result is already posted …

double avg_counts = linear_func->GetParameter(0);
double avg_counts_err = linear_func->GetParError(0);
double cut_counts_low = avg_counts - 3 * avg_counts_err;
double cut_counts_high = avg_counts + 3 * avg_counts_err;

cout << avg_counts << std ::endl;
cout << avg_counts_err << std ::endl;

// vector<int> bad_channelId;
// vector<int> hot_channelId;
// bad_channelId.clear();
// hot_channelId.clear();

for (int ibin = 1; ibin <= h_channelId->GetNbinsX(); ibin++)
{
    int counts = h_channelId->GetBinContent(ibin);

    // if(channelId > 36863) continue;

    // if(counts < 5) cout << "Found a bad channel, channelId is: " << h_channelId->GetBinLowEdge(ibin) << endl;
    // if(counts > 10000) cout << "Found a hot channel, channelId is: " << h_channelId->GetBinLowEdge(ibin) << endl;

    if (counts < cut_counts_low)
    {            
        cout << "Found a bad channel, channelId is: " << h_channelId->GetBinLowEdge(ibin) << endl;
        // bad_channelId.push_back(h_channelId->GetBinLowEdge(ibin));
    }
    if (counts > cut_counts_high)
    {
        cout << "Found a hot channel, channelId is: " << h_channelId->GetBinLowEdge(ibin) << endl;
        // hot_channelId.push_back(h_channelId->GetBinLowEdge(ibin));
    }
}

The logic around the “bad_channelId” and the “hot_channelId” vectors seems o.k. so, what’s the problem?

Thanks for the time, But i want to store these channels in Array. But how . . . … ?

You do not know in advance how many “bad” channels you have so, it will be much easier to work with “vectors” that (internally) use dynamically allocated arrays to store their elements.

Afterwards, you can access vector’s elements like an “array”, e.g.: “bad_channelId[i]” (where “0 <= i < bad_channelId.size()”, of course)

Okay,
Thank You.

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