File indexing completed on 2026-04-05 08:08:19
0001 #include <uspin/SpinDBInput.h>
0002 #include <uspin/SpinDBOutput.h>
0003 #include <uspin/SpinDBContent.h>
0004
0005 R__LOAD_LIBRARY(libuspin.so)
0006
0007 bool hasGoodSpinQA(int runnumber);
0008
0009 void macro_select_run_spinqa(const std::string& runListName = "RunList_hotmap.txt")
0010 {
0011 std::ifstream runListFile;
0012 runListFile.open(runListName);
0013
0014 std::ofstream runListFileOutput;
0015 runListFileOutput.open("RunList_spinqa.txt");
0016
0017 std::string line;
0018 int runnumber;
0019 while (std::getline(runListFile, line))
0020 {
0021 runnumber = std::stoi(line);
0022 if (hasGoodSpinQA(runnumber))
0023 {
0024 runListFileOutput << runnumber << std::endl;
0025 }
0026 }
0027 runListFileOutput.close();
0028 runListFile.close();
0029
0030 gSystem->Exit(0);
0031 }
0032
0033 bool hasGoodSpinQA(int runnumber)
0034 {
0035
0036 unsigned int qa_level = 0xffff;
0037 SpinDBOutput spin_out("phnxrc");
0038 SpinDBContent spin_cont;
0039 spin_out.StoreDBContent(runnumber, runnumber, qa_level);
0040 if (!spin_out.GetDBContentStore(spin_cont, runnumber))
0041 {
0042
0043 return false;
0044 }
0045
0046
0047
0048
0049
0050
0051 int badrunqa = spin_cont.GetBadRunFlag();
0052
0053 if (badrunqa == 1)
0054 {
0055 return false;
0056 }
0057
0058
0059 const int nbunches = 120;
0060 for (int i = 0; i < nbunches; i++)
0061 {
0062 if (spin_cont.GetScalerMbdVertexCut(i) > 0)
0063 {
0064 return true;
0065 }
0066 }
0067 return false;
0068 }