File indexing completed on 2025-08-05 08:13:25
0001 void get_scalers(int runnumber, long long unsigned int live[64], long long unsigned int scaled[64])
0002 {
0003
0004
0005 TSQLServer *db = TSQLServer::Connect("pgsql://sphnxdaqdbreplica:5432/daq","","");
0006 if(!db)
0007 {
0008 cout << "FAILED TO CONNECT TO DB!" << endl;
0009 exit(1);
0010 }
0011 TSQLRow *row;
0012 TSQLResult *res;
0013 char sql[1000];
0014
0015
0016 for(int i=0; i<64; ++i)
0017 {
0018 sprintf(sql, "select live, scaled from gl1_scalers where runnumber = %d and index = %d;", runnumber, i);
0019 res = db->Query(sql);
0020 if(!res) continue;
0021 row = res->Next();
0022 if(!row) continue;
0023
0024 live[i] = stoll(row->GetField(0));
0025 scaled[i] = stoll(row->GetField(1));
0026 }
0027 }
0028
0029 int checks(int runnumber)
0030 {
0031 stringstream filestringstream;
0032 filestringstream << "output/added/triggeroutput_" << runnumber << ".root";
0033 string filename = filestringstream.str();
0034 cout << endl << endl << endl << "BEGIN!" << endl;
0035 TFile* file = TFile::Open(filename.c_str());
0036 TTree* tree = (TTree*)file->Get("outt");
0037
0038 long long unsigned int dblive[64] = {0};
0039 long long unsigned int dbscaled[64] = {0};
0040
0041 get_scalers(runnumber, dblive, dbscaled);
0042
0043 long long unsigned int totlive[64];
0044 long long unsigned int totscaled[64];
0045 long long unsigned int sumgoodscaled[64];
0046 long long unsigned int sumgoodlive[64];
0047 double avgPS[64];
0048 long long unsigned int tottrigcounts[3][64];
0049 double totembdlive[3];
0050 long long unsigned int nevt;
0051
0052 tree->SetBranchAddress("totlive",totlive);
0053 tree->SetBranchAddress("totscaled",totscaled);
0054 tree->SetBranchAddress("sumgoodscaled",sumgoodscaled);
0055 tree->SetBranchAddress("sumgoodlive",sumgoodlive);
0056 tree->SetBranchAddress("avgPS",avgPS);
0057 tree->SetBranchAddress("tottrigcounts",tottrigcounts);
0058 tree->SetBranchAddress("totembdlive",totembdlive);
0059 tree->SetBranchAddress("nevt",&nevt);
0060
0061 tree->GetEntry(0);
0062
0063 cout << "Begin infodump for file: " << filename << endl;
0064 cout << "total produced events in run: " << nevt << endl;
0065 cout << "upscaled mbd evt. w/ |zvtx| < 30/60/200: " << totembdlive[0] << " " << totembdlive[1] << " " << totembdlive[2] << endl;
0066 for(int i=0; i<64; ++i)
0067 {
0068 cout << endl << "trigger " << i << endl << endl;
0069 cout << "DB live counts: " << dblive[i] << endl;
0070 cout << "live counts (last - first): " << totlive[i] << endl;
0071 cout << "live counts (good segs): " << sumgoodlive[i] << endl;
0072 cout << "DB scaled counts: " << dbscaled[i] << endl;
0073 cout << "scaled counts (last - first): " << totscaled[i] << endl;
0074 cout << "scaled counts (good segs): " << sumgoodscaled[i] << endl;
0075 cout << "average prescale (good segs): " << avgPS[i] << endl;
0076 cout << "tot. prod. evt. w/ bit " << i << " up: " << endl;
0077 cout << "|zvtx| < 30/60/200 cm: " << tottrigcounts[0][i] << " " << tottrigcounts[1][i] << " " << tottrigcounts[2][i] << endl;
0078
0079 }
0080 cout << "DONE!" << endl << endl << endl;
0081 return 0;
0082 }