12 #ifndef ZDCNLCalibration_h
13 #define ZDCNLCalibration_h
29 #include <TDecompLU.h>
36 std::array<std::vector<float>, 4>
weights;
42 std::vector<float> unity(1, 1);
43 weights = {unity, unity, unity, unity};
107 typedef std::multimap<unsigned int, std::pair<unsigned int, unsigned int> >
LBEvtMap;
126 std::pair<float, float>
FindSNRange(
size_t LBLow,
size_t LBHigh,
size_t side);
128 std::pair<std::pair<float, float>,std::pair<float, float> >
FindSNTwoNRanges(
size_t LBLow,
size_t LBHigh,
size_t side);
134 void Calibrate(
size_t side,
const std::string & calibInput,
const std::string & calibOutput,
135 size_t LBLow,
size_t LBHigh, std::array<int, 4> maxPowerModule,
136 const std::vector<std::pair<double, double> >& nNeutERange,
137 bool excludeHE,
float heSumThresh,
float HEDeweight);
151 std::array<int, 4> maxPowerModule,
float HEDeweight,
152 const std::vector<std::vector<double> >& sums1DVec,
const std::vector<double>& sumsHE,
153 const std::vector<std::vector<double> >& sums2DVec,
const std::vector<double>& sumsHE2D);
161 void AddToSums(std::vector<double>& sums1D, std::vector<double>& sums2D,
float* amps)
166 for (
size_t module1 : {0, 1, 2, 3}) {
167 double amp1 = amps[module1];
168 double amp1Pow = amp1;
170 for (
size_t power1 = 0; power1 <
m_maxNLPower; power1++) {
171 for (
size_t module2 : {0, 1, 2, 3}) {
172 double amp2 = amps[module2];
173 double amp2Pow = amp2;
175 for (
size_t power2 = 0; power2 <
m_maxNLPower; power2++) {
176 sums2D.at(index2D++) += amp1Pow*amp2Pow;
181 sums1D.at(index1D++) += amp1Pow;
191 for (
size_t module : {0, 1, 2, 3}) {
192 float amp = moduleAmps[
module];
195 for (
size_t power = 0; power <
calib.weights[
module].size(); power++) {
208 #ifdef ZDCNLCalibration_cxx
210 m_TFile(0), m_tree(0), m_maxNLPower(maxNLPower),
212 m_SNEnergy(2510), m_HEFraction({0.31, 0.27, 0.21, 0.21}),
215 std::cout <<
"Initializing ZDCNLCalibration with debug level " <<
m_debugLevel << std::endl;
217 TFile* temp_p =
new TFile(
file.c_str());
218 if (!temp_p->IsOpen()) {
219 std::cout <<
"Error opening input file " <<
file << std::endl;
224 m_tree =
static_cast<TTree*
>(
m_TFile->GetObjectChecked(
"zdcTree",
"TTree"));
226 std::cout <<
"Error reading tree from input file " <<
file << std::endl;
236 if (
m_tree->FindBranch(
"zdc_ZdcModuleMask")) {
241 else if (
m_tree->FindBranch(
"zdc_ModuleMask")) {
246 else throw std::runtime_error(
"ZDCNLCalibration::ZDCNLCalibration valid branch not found");
254 std::cout <<
"Filling LumiBlock-event map" << std::endl;
265 #endif // #ifdef ZDCNLCalibration_cxx