25 class TFileNoSync :
public TFile {
27 TFileNoSync(
char const *
file,
char const *
opt) : TFile{
file, opt} {}
28 Int_t SysSync(Int_t)
override {
return 0; }
31 std::cout <<
"DQMFileSaver::globalEndRun()" << std::endl;
34 sprintf(suffix,
"R%09d", run);
35 TFileNoSync *
file =
new TFileNoSync(filename.c_str(), fileupdate.c_str());
38 std::vector<MonitorElement *> mes;
53 uint64_t firstSlashPos = dirName.find(
'/');
54 if (firstSlashPos == std::string::npos) {
55 firstSlashPos = dirName.length();
61 dirName = dirName.substr(0, firstSlashPos) +
"/Run summary" + dirName.substr(firstSlashPos, dirName.size());
62 dirName =
"DQMData/Run " + std::to_string(run) +
"/" +
dirName;
75 std::string content =
"<" + objectName +
">i=" + std::to_string(value) +
"</" + objectName +
">";
76 TObjString
str(content.c_str());
79 double value =
me->getFloatValue();
82 std::snprintf(buf,
sizeof(buf),
"%.*g", DBL_DIG + 2, value);
84 TObjString
str(content.c_str());
89 TObjString
str(content.c_str());
96 if (
me->getEfficiencyFlag()) {
98 TObjString
str(content.c_str());
106 std::snprintf(buf,
sizeof(buf),
"qr=st:%d:%.*g:", qr->getStatus(), DBL_DIG + 2, qr->getQTresult());
107 result =
'<' + objectName +
'.' + qr->getQRName() +
'>';
109 result += qr->getAlgorithm() +
':' + qr->getMessage();
110 result +=
"</" + objectName +
'.' + qr->getQRName() +
'>';
111 TObjString
str(result.c_str());
131 size_t end = path.find(
'/', start);
132 if (end == std::string::npos)
139 TObject *
o = gDirectory->Get(part.c_str());
140 if (o && !dynamic_cast<TDirectory *>(o))
141 throw cms::Exception(
"DQMFileSaver") <<
"Attempt to create directory '" << path
143 " fails because the part '"
145 <<
"' already exists and is not"
148 gDirectory->mkdir(part.c_str());
150 if (!gDirectory->cd(part.c_str()))
151 throw cms::Exception(
"DQMFileSaver") <<
"Attempt to create directory '" << path
153 " fails because could not cd into subdirectory '"
157 if (end + 1 >= path.size())
162 end = path.find(
'/', start);
163 if (end == std::string::npos)
171 TDirectory *dirsav = gDirectory;
172 LogDebug(
"LegacyIOHelper") <<
"Inside:" << gDirectory->GetPath() << std::endl;
173 TIter
next(dir->GetListOfKeys());
175 while ((key = (TKey *)
next())) {
176 if (key->IsFolder()) {
177 LogDebug(
"LegacyIOHelper") << key->GetName() << std::endl;
178 dir->cd(key->GetName());
179 TDirectory *subdir = gDirectory;
184 TClass *
cl = gROOT->GetClass(key->GetClassName());
186 if (cl->InheritsFrom(
"TProfile")) {
187 TProfile *
h =
dynamic_cast<TProfile *
>(key->ReadObject<TProfile>()->Clone());
188 h->SetDirectory(
nullptr);
190 getMEName<TProfile>(
h, toppath, meName);
193 }
else if (cl->InheritsFrom(
"TProfile2D")) {
194 TProfile2D *
h =
dynamic_cast<TProfile2D *
>(key->ReadObject<TProfile2D>()->Clone());
195 h->SetDirectory(
nullptr);
197 getMEName<TProfile2D>(
h, toppath, meName);
200 }
else if (cl->InheritsFrom(
"TH1F")) {
201 TH1F *
h =
dynamic_cast<TH1F *
>(key->ReadObject<TH1F>()->Clone());
202 h->SetDirectory(
nullptr);
204 getMEName<TH1F>(
h, toppath, meName);
207 }
else if (cl->InheritsFrom(
"TH1S")) {
208 TH1S *
h =
dynamic_cast<TH1S *
>(key->ReadObject<TH1S>()->Clone());
209 h->SetDirectory(
nullptr);
211 getMEName<TH1S>(
h, toppath, meName);
214 }
else if (cl->InheritsFrom(
"TH1D")) {
215 TH1D *
h =
dynamic_cast<TH1D *
>(key->ReadObject<TH1D>()->Clone());
216 h->SetDirectory(
nullptr);
218 getMEName<TH1D>(
h, toppath, meName);
221 }
else if (cl->InheritsFrom(
"TH2F")) {
222 TH2F *
h =
dynamic_cast<TH2F *
>(key->ReadObject<TH2F>()->Clone());
223 h->SetDirectory(
nullptr);
225 getMEName<TH2F>(
h, toppath, meName);
228 }
else if (cl->InheritsFrom(
"TH2S")) {
229 TH2S *
h =
dynamic_cast<TH2S *
>(key->ReadObject<TH2S>()->Clone());
230 h->SetDirectory(
nullptr);
232 getMEName<TH2S>(
h, toppath, meName);
235 }
else if (cl->InheritsFrom(
"TH2D")) {
236 TH2D *
h =
dynamic_cast<TH2D *
>(key->ReadObject<TH2D>()->Clone());
237 h->SetDirectory(
nullptr);
239 getMEName<TH2D>(
h, toppath, meName);
242 }
else if (cl->InheritsFrom(
"TH3F")) {
243 TH3F *
h =
dynamic_cast<TH3F *
>(key->ReadObject<TH3F>()->Clone());
244 h->SetDirectory(
nullptr);
246 getMEName<TH3F>(
h, toppath, meName);
258 TFile *
f1 = TFile::Open(filename.c_str());
261 std::ostringstream toppath;
262 toppath << filename <<
":/DQMData/Run " << run <<
"/";
265 bool flag =
readdir(f1, dirpath);
bool createDirectoryIfNeededAndCd(const std::string &path)
MonitorElement * bookProfile2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, double lowZ, double highZ, char const *option="s", FUNC onbooking=NOOP())
void save(std::string const &filename, std::string const &path="", uint32_t const run=0, bool saveall=true, std::string const &fileupdate="RECREATE")
MonitorElement * book2S(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
virtual std::vector< dqm::harvesting::MonitorElement * > getAllContents(std::string const &path) const
bool open(std::string const &filename, std::string const &path="", uint32_t const run=0)
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
bool readdir(TDirectory *dir, const std::string &toppath)
tuple key
prepare the HTCondor submission files and eventually submit them
MonitorElement * book1S(TString const &name, TString const &title, int nchX, double lowX, double highX, FUNC onbooking=NOOP())
Log< level::Warning, true > LogPrint
unsigned long long uint64_t
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * book2DD(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
MonitorElement * book3D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, FUNC onbooking=NOOP())