Project
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
scan-hvlv-ccdb.cxx File Reference
#include <algorithm>
#include <ctime>
#include <fstream>
#include <iterator>
#include <limits>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
#include <boost/program_options.hpp>
#include <fmt/format.h>
#include "TFile.h"
#include "TCanvas.h"
#include "TGraph.h"
#include "TH1F.h"
#include "TLine.h"
#include "TMultiGraph.h"
#include "TStyle.h"
#include "CCDB/BasicCCDBManager.h"
#include "CCDB/CcdbApi.h"
#include "CommonUtils/ConfigurableParam.h"
#include "DetectorsDCS/DataPointIdentifier.h"
#include "DetectorsDCS/DataPointValue.h"
#include "MCHConditions/DCSAliases.h"
#include "MCHStatus/HVStatusCreator.h"
#include "MCHStatus/StatusMapCreatorParam.h"

Go to the source code of this file.

Typedefs

using DPID = dcs::DataPointIdentifier
 
using DPVAL = dcs::DataPointValue
 
using DPMAP = std::unordered_map< DPID, std::vector< DPVAL > >
 
using DPMAP2 = std::map< std::string, std::map< uint64_t, double > >
 
using RBMAP = std::map< int, std::pair< uint64_t, uint64_t > >
 
using DPBMAP = std::map< uint64_t, uint64_t >
 
using ISSUE = std::tuple< uint64_t, uint64_t, double, double, std::string >
 
using ISSUELIST = std::vector< ISSUE >
 
using ISSUEMAP = std::map< std::string, ISSUELIST >
 
using ULL = unsigned long long
 

Functions

bool containsAKey (std::string data, const std::set< std::string > &Keys)
 
bool isValid (std::string alias)
 
void scanWhat (std::string what, std::string &path, bool &scanHV, bool &scanAll, std::set< std::string > &aliases)
 
uint64_t ms2s (uint64_t ts)
 
std::string getTime (uint64_t ts)
 
std::string getDuration (uint64_t tStart, uint64_t tStop)
 
std::set< intgetRuns (std::string runList)
 
RBMAP getRunBoundaries (ccdb::CcdbApi const &api, std::string runList)
 
void checkRunBoundaries (const RBMAP &runBoundaries)
 
void printRunBoundaries (const RBMAP &runBoundaries)
 
void drawRunBoudaries (const RBMAP &runBoundaries, TCanvas *c)
 
DPBMAP getDPBoundaries (ccdb::CcdbApi const &api, std::string what, uint64_t tStart, uint64_t tStop, uint64_t timeInterval)
 
void checkDPBoundaries (const DPBMAP &dpBoundaries, bool scanHV, uint64_t tStart, uint64_t tStop)
 
void printDPBoundaries (const DPBMAP &dpBoundaries, bool scanHV, uint64_t timeInterval)
 
double getLVLimit (std::string alias)
 
void drawLimit (double limit, TCanvas *c)
 
double getValue (DPVAL dp)
 
std::string getDE (std::string alias)
 
void fillDataPoints (const std::vector< DPVAL > &dps, std::map< uint64_t, double > &dps2, uint64_t tMin, uint64_t tMax, int warningLevel)
 
void selectDataPoints (DPMAP2 dpsMapsPerCh[10], uint64_t tStart, uint64_t tStop)
 
void printDataPoints (const DPMAP2 dpsMapsPerCh[10], std::string hvlvFormat, bool all)
 
TGraph * mapToGraph (std::string alias, const std::map< uint64_t, double > &dps)
 
TCanvas * drawDataPoints (TMultiGraph *mg, double min, double max)
 
void findIssues (const std::map< uint64_t, double > &dps, double limit, ISSUELIST &issues)
 
void fillO2Issues (const std::vector< mch::HVStatusCreator::TimeRange > &o2issues, ISSUELIST &issues, uint64_t tMin, uint64_t tMax)
 
std::string findAffectedRuns (const RBMAP &runBoundaries, uint64_t tStart, uint64_t tStop)
 
void selectIssues (ISSUEMAP issuesPerCh[10], const RBMAP &runBoundaries, uint64_t minDuration)
 
void selectO2Issues (ISSUEMAP issuesPerCh[10], const RBMAP &runBoundaries)
 
bool eraseIssue (const ISSUE &issue, ISSUELIST &issues)
 
void printIssues (const ISSUEMAP issuesPerCh[10], const ISSUEMAP o2IssuesPerCh[10], bool scanHV, std::string hvlvFormat)
 
int main (int argc, char **argv)
 

Typedef Documentation

◆ DPBMAP

using DPBMAP = std::map<uint64_t, uint64_t>

Definition at line 55 of file scan-hvlv-ccdb.cxx.

◆ DPID

Definition at line 50 of file scan-hvlv-ccdb.cxx.

◆ DPMAP

using DPMAP = std::unordered_map<DPID, std::vector<DPVAL> >

Definition at line 52 of file scan-hvlv-ccdb.cxx.

◆ DPMAP2

using DPMAP2 = std::map<std::string, std::map<uint64_t, double> >

Definition at line 53 of file scan-hvlv-ccdb.cxx.

◆ DPVAL

Definition at line 51 of file scan-hvlv-ccdb.cxx.

◆ ISSUE

using ISSUE = std::tuple<uint64_t, uint64_t, double, double, std::string>

Definition at line 56 of file scan-hvlv-ccdb.cxx.

◆ ISSUELIST

using ISSUELIST = std::vector<ISSUE>

Definition at line 57 of file scan-hvlv-ccdb.cxx.

◆ ISSUEMAP

using ISSUEMAP = std::map<std::string, ISSUELIST>

Definition at line 58 of file scan-hvlv-ccdb.cxx.

◆ RBMAP

using RBMAP = std::map<int, std::pair<uint64_t, uint64_t> >

Definition at line 54 of file scan-hvlv-ccdb.cxx.

◆ ULL

using ULL = unsigned long long

Definition at line 59 of file scan-hvlv-ccdb.cxx.

Function Documentation

◆ checkDPBoundaries()

void checkDPBoundaries ( const DPBMAP dpBoundaries,
bool  scanHV,
uint64_t  tStart,
uint64_t  tStop 
)

check the consistency of HV/LV file time boundaries

Definition at line 336 of file scan-hvlv-ccdb.cxx.

◆ checkRunBoundaries()

void checkRunBoundaries ( const RBMAP runBoundaries)

check the consistency of the run time boundaries

Definition at line 226 of file scan-hvlv-ccdb.cxx.

◆ containsAKey()

bool containsAKey ( std::string  data,
const std::set< std::string > &  Keys 
)

check if the data contains one of the keys

Definition at line 62 of file scan-hvlv-ccdb.cxx.

◆ drawDataPoints()

TCanvas * drawDataPoints ( TMultiGraph *  mg,
double  min,
double  max 
)

display the data points of the given chamber

Definition at line 636 of file scan-hvlv-ccdb.cxx.

◆ drawLimit()

void drawLimit ( double  limit,
TCanvas *  c 
)

draw the HV/LV limit for the displayed chamber

Definition at line 413 of file scan-hvlv-ccdb.cxx.

◆ drawRunBoudaries()

void drawRunBoudaries ( const RBMAP runBoundaries,
TCanvas *  c 
)

draw the run time boundaries

Definition at line 278 of file scan-hvlv-ccdb.cxx.

◆ eraseIssue()

bool eraseIssue ( const ISSUE issue,
ISSUELIST issues 
)

find an issue with the same time range and associated run list and erase it return true in case of success

Definition at line 843 of file scan-hvlv-ccdb.cxx.

◆ fillDataPoints()

void fillDataPoints ( const std::vector< DPVAL > &  dps,
std::map< uint64_t, double > &  dps2,
uint64_t  tMin,
uint64_t  tMax,
int  warningLevel 
)

fill the map of data points

Definition at line 459 of file scan-hvlv-ccdb.cxx.

◆ fillO2Issues()

void fillO2Issues ( const std::vector< mch::HVStatusCreator::TimeRange > &  o2issues,
ISSUELIST issues,
uint64_t  tMin,
uint64_t  tMax 
)

fill the list of issues from O2 (extend the previous one and/or create new ones)

Definition at line 707 of file scan-hvlv-ccdb.cxx.

◆ findAffectedRuns()

std::string findAffectedRuns ( const RBMAP runBoundaries,
uint64_t  tStart,
uint64_t  tStop 
)

return the list of affected runs in this time range

Definition at line 752 of file scan-hvlv-ccdb.cxx.

◆ findIssues()

void findIssues ( const std::map< uint64_t, double > &  dps,
double  limit,
ISSUELIST issues 
)

return the list of HV/LV issues (time range, min value, mean value) for each DCS channel

Definition at line 657 of file scan-hvlv-ccdb.cxx.

◆ getDE()

std::string getDE ( std::string  alias)

for DCS HV alias: return the corresponding DE (and sector) for DCS LV alias: return an empty string

Definition at line 442 of file scan-hvlv-ccdb.cxx.

◆ getDPBoundaries()

DPBMAP getDPBoundaries ( ccdb::CcdbApi const &  api,
std::string  what,
uint64_t  tStart,
uint64_t  tStop,
uint64_t  timeInterval 
)

get the time boundaries of every HV/LV files found in the time range

Definition at line 301 of file scan-hvlv-ccdb.cxx.

◆ getDuration()

std::string getDuration ( uint64_t  tStart,
uint64_t  tStop 
)

get the duration (dd hh:mm:ss) between the two time stamps (ms)

Definition at line 158 of file scan-hvlv-ccdb.cxx.

◆ getLVLimit()

double getLVLimit ( std::string  alias)

return the LV limit for that channel

Definition at line 398 of file scan-hvlv-ccdb.cxx.

◆ getRunBoundaries()

RBMAP getRunBoundaries ( ccdb::CcdbApi const &  api,
std::string  runList 
)

return the SOR / EOR time stamps for every runs in the list

Definition at line 209 of file scan-hvlv-ccdb.cxx.

◆ getRuns()

std::set< int > getRuns ( std::string  runList)

read the runList from an ASCII file, or a comma separated run list, or a single run

Definition at line 172 of file scan-hvlv-ccdb.cxx.

◆ getTime()

std::string getTime ( uint64_t  ts)

convert the time stamp (ms) to local time

Definition at line 145 of file scan-hvlv-ccdb.cxx.

◆ getValue()

double getValue ( DPVAL  dp)

return the value of this data point

Definition at line 427 of file scan-hvlv-ccdb.cxx.

◆ isValid()

bool isValid ( std::string  alias)

check if the alias is a valid (part of a) DCS alias

Definition at line 74 of file scan-hvlv-ccdb.cxx.

◆ main()

int main ( int  argc,
char **  argv 
)

scan HV or LV CCDB objects looking for issues

Definition at line 947 of file scan-hvlv-ccdb.cxx.

◆ mapToGraph()

TGraph * mapToGraph ( std::string  alias,
const std::map< uint64_t, double > &  dps 
)

create a graph for the DCS channel and add the data points

Definition at line 609 of file scan-hvlv-ccdb.cxx.

◆ ms2s()

uint64_t ms2s ( uint64_t  ts)

convert the time stamp from ms to s

Definition at line 137 of file scan-hvlv-ccdb.cxx.

◆ printDataPoints()

void printDataPoints ( const DPMAP2  dpsMapsPerCh[10],
std::string  hvlvFormat,
bool  all 
)

print all the registered data points

Definition at line 570 of file scan-hvlv-ccdb.cxx.

◆ printDPBoundaries()

void printDPBoundaries ( const DPBMAP dpBoundaries,
bool  scanHV,
uint64_t  timeInterval 
)

print the time boundaries of every HV/LV files found in the full time range

Definition at line 377 of file scan-hvlv-ccdb.cxx.

◆ printIssues()

void printIssues ( const ISSUEMAP  issuesPerCh[10],
const ISSUEMAP  o2IssuesPerCh[10],
bool  scanHV,
std::string  hvlvFormat 
)

print all HV/LV issues

Definition at line 863 of file scan-hvlv-ccdb.cxx.

◆ printRunBoundaries()

void printRunBoundaries ( const RBMAP runBoundaries)

print the list of runs with their time boundaries

Definition at line 262 of file scan-hvlv-ccdb.cxx.

◆ scanWhat()

void scanWhat ( std::string  what,
std::string path,
bool &  scanHV,
bool &  scanAll,
std::set< std::string > &  aliases 
)

get what to scan and where

Definition at line 92 of file scan-hvlv-ccdb.cxx.

◆ selectDataPoints()

void selectDataPoints ( DPMAP2  dpsMapsPerCh[10],
uint64_t  tStart,
uint64_t  tStop 
)

remove the data points outside of the given time range and, if needed, add a data point at the boundaries with value equal to the preceding one

Definition at line 530 of file scan-hvlv-ccdb.cxx.

◆ selectIssues()

void selectIssues ( ISSUEMAP  issuesPerCh[10],
const RBMAP runBoundaries,
uint64_t  minDuration 
)

select HV/LV issues of a minimum duration (ms) occurring during runs

Definition at line 777 of file scan-hvlv-ccdb.cxx.

◆ selectO2Issues()

void selectO2Issues ( ISSUEMAP  issuesPerCh[10],
const RBMAP runBoundaries 
)

select HV issues from O2 algorithm occurring during runs and restrict the range of issues to the run range

Definition at line 812 of file scan-hvlv-ccdb.cxx.