ROOT Version: 6.24.02
Platform: Windows OS (Windows 10)
Compiler: MSVC 19.23.28107.0
I am trying to get my code to output some data to a spreadsheet (e.g. I want all of the “time” data points in one one column or row and all of the “reactivity” and “precursors” (etc.) data points in another row so the data can be parsed automatically).
To be honest I just need to get maximum values at their specified times, but as far as I have learned, C++ has no way of retrieving only a maximum or minimum, and I am stuck using the I/O system.
When I try and write the specified variables to a spreadsheet (in my macro) and run ROOT, it crashes. I’ve included a snippet of my code below.
Does anyone have any suggestions? Thank you very much, and I apologize if this is not very well articulated.
for(long j = 1; j < timeSteps / plotPoints; j++){
tempTime[j] = tempTime[j - 1] + deltaTime;
tempPower[j] = tempPower[j - 1] +
tempPower[j - 1] * ((tempReactivity[j - 1] - dnf1) / ngt) * deltaTime +
tempPrecursors1[j - 1] * pdc1 * deltaTime+tempPrecursors2[j-1]*pdc2*deltaTime;
tempPrecursors1[j] = tempPrecursors1[j - 1] + tempPower[j - 1] * (dnf1 / ngt) * deltaTime -
tempPrecursors1[j - 1] * pdc1 * deltaTime;
tempPrecursors2[j] = tempPrecursors2[j - 1] + tempPower[j - 1] * (dnf2 / ngt) * deltaTime -
tempPrecursors2[j - 1] * pdc2 * deltaTime;
tempReactivity[j] = initReactivity -
tcr * (tempTemperature[j - 1] - initTemperature);
tempTemperature[j] = tempTemperature[j - 1] +
rhc * (tempPower[j - 1]) * deltaTime -
htr * (tempTemperature[j - 1] - initTemperature) * deltaTime;
//cout << "Time: " << tempTime[j] << "\r\n";
//cout << "Power: " << tempPower[j] << "\r\n";
//cout << "Precursors1: " << tempPrecursors1[j] << "\r\n";
//cout << "Precursors2: " << tempPrecursors2[j] << "\r\n";
//cout << "Reactivity: " << tempReactivity[j] << "\r\n";
//cout << "Temperature: " << tempTemperature[j] << "\r\n";
//cout << "\r\n";
ofstream outfile;
outfile.open ("example.csv");
outfile << "time:" <<tempTime[j] << "\r\n";
outfile.close();
}