ATLAS Offline Software
Classes | Functions
dqm_persistency Namespace Reference

Classes

class  PAlgorithm
 
class  PMetadata
 
class  PParameter
 
class  PRegion
 
class  PResult
 

Functions

void Print (const PParameter *param, TDirectory *topdir, Option_t *opt="")
 
void WriteTree (PRegion &top_level, TDirectory &topdir, PMetadata &topmap)
 
PParameterGetNode (TDirectory &topdir, const std::string &nodename)
 
PParameterGetNode (TDirectory &topdir, int key)
 
void WriteTreeRecurse (PRegion &region, TDirectory &paramdir, PMetadata &topmap, const std::string &path)
 

Function Documentation

◆ GetNode() [1/2]

PParameter * dqm_persistency::GetNode ( TDirectory &  topdir,
const std::string &  nodename 
)

Definition at line 229 of file dqm_persistency_impl.cxx.

229  {
230  PParameter* rv(0);
231  if (nodename == "top_level") {
232  rv = dynamic_cast<PParameter*>(topdir.Get("top_level"));
233  return rv;
234  }
235  PMetadata* pmd = dynamic_cast<PMetadata*>(topdir.Get("object_map"));
236  if (pmd) {
237  std::string key = pmd->data[nodename];
238  if (key == "") {
239  std::cerr << "ERROR: can't find node " << nodename << " in object_map"
240  << std::endl;
241  return 0;
242  } else {
243  rv = dynamic_cast<PParameter*>(topdir.Get(("Parameters/" + key).c_str()));
244  if (rv) { rv->SetUniqueID(rv->GetUniqueID() & 0xffffff); }
245  return rv;
246  }
247  } else {
248  std::cerr << "ERROR: can't retrieve object_map from file!" << std::endl;
249  return 0;
250  }
251  }

◆ GetNode() [2/2]

PParameter * dqm_persistency::GetNode ( TDirectory &  topdir,
int  key 
)

Definition at line 253 of file dqm_persistency_impl.cxx.

253  {
254  if (key == -1) {
255  return dynamic_cast<PParameter*>(topdir.Get("top_level"));
256  }
257  PParameter* rv = dynamic_cast<PParameter*>(topdir.Get(("Parameters/" + std::to_string(key)).c_str()));
258  if (rv) { rv->SetUniqueID(rv->GetUniqueID() & 0xffffff); }
259  return rv;
260  }

◆ Print()

void dqm_persistency::Print ( const PParameter param,
TDirectory *  topdir,
Option_t *  opt = "" 
)

Definition at line 161 of file dqm_persistency_impl.cxx.

162  {
163  param->Print();
164  const PRegion* region = dynamic_cast<const PRegion*>(param);
165  if (region) {
166  TString option = opt; option.ToLower();
167  if (option.Contains("r")) {
168  for (unsigned int i = 0; i < region->subparameters.size(); i++) {
169  std::cout << "Subparameter " << region->subparameters[i] << std::endl;
170  const PParameter* subparam = region->GetSubparameter(*topdir, i);
171  if (subparam) {
172  Print(subparam, topdir, opt);
173  } else {
174  std::cerr << "ERROR: can't find subparameter "
175  << region->subparameters[i]
176  << " from top-level directory "
177  << topdir->GetPath()
178  << std::endl;
179  }
180  }
181  }
182  }
183  }

◆ WriteTree()

void dqm_persistency::WriteTree ( PRegion top_level,
TDirectory &  topdir,
PMetadata topmap 
)

Definition at line 213 of file dqm_persistency_impl.cxx.

213  {
214  TDirectory* paramdir = topdir.GetDirectory("Parameters");
215  if (!paramdir) {
216  paramdir = topdir.mkdir("Parameters");
217  if (!paramdir) {
218  std::cerr << "ERROR: can't make Parameters subdirectory for storage"
219  << std::endl;
220  return;
221  }
222  }
223  WriteTreeRecurse(top_level, *paramdir, topmap, "");
224  topmap.data["top_level"] = std::to_string(top_level.GetUniqueID());
225  topdir.WriteTObject(&top_level, "top_level");
226  topdir.WriteTObject(&topmap, "object_map");
227  }

◆ WriteTreeRecurse()

void dqm_persistency::WriteTreeRecurse ( PRegion region,
TDirectory &  paramdir,
PMetadata topmap,
const std::string &  path 
)

Definition at line 185 of file dqm_persistency_impl.cxx.

186  {
187  TProcessID* pid = TProcessID::GetPID();
188  for (unsigned int i = 0; i < region.subparameters.size(); i++) {
189  int subparam = region.subparameters[i];
190  TObject* subobj = pid->GetObjectWithID(subparam);
191  PParameter* pparam = dynamic_cast<PParameter*>(subobj);
192  if (!pparam) {
193  std::cerr << "ERROR: can't retrieve parameter " << subparam
194  << std::endl;
195  continue;
196  }
197  std::string uid = std::to_string(subparam);
198  if (path == "") {
199  topmap.data[pparam->name] = uid;
200  } else {
201  topmap.data[path + "/" + pparam->name] = uid;
202  }
203  paramdir.WriteTObject(subobj, uid.c_str());
204  PRegion* preg = dynamic_cast<PRegion*>(subobj);
205  if (preg) {
206  std::string daughterpath = (path != "") ? (path+"/"+preg->name) : (preg->name) ;
207  WriteTreeRecurse(*preg, paramdir, topmap, daughterpath);
208  }
209  }
210  }
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
make_coralServer_rep.opt
opt
Definition: make_coralServer_rep.py:19
dqm_persistency::WriteTreeRecurse
void WriteTreeRecurse(PRegion &region, TDirectory &paramdir, PMetadata &topmap, const std::string &path)
Definition: dqm_persistency_impl.cxx:185
lumiFormat.i
int i
Definition: lumiFormat.py:85
ParticleGun_EoverP_Config.pid
pid
Definition: ParticleGun_EoverP_Config.py:62
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
dq_make_web_display.rv
def rv
Definition: dq_make_web_display.py:219
dqm_persistency::Print
void Print(const PParameter *param, TDirectory *topdir, Option_t *opt="")
Definition: dqm_persistency_impl.cxx:161
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37