CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
JsonOutputProducer::JsonEvent Struct Reference

Public Member Functions

 JsonEvent (int _run, int _lumi, int _event)
 
JsonTriggerEventStatepushTrigger (int _tr)
 
std::string serialise (size_t _indent=0) const
 

Public Attributes

int event
 
int lumi
 
int run
 
std::vector< JsonTriggerEventStatetriggerStates
 

Detailed Description

Definition at line 658 of file hltDiff.cc.

Constructor & Destructor Documentation

◆ JsonEvent()

JsonOutputProducer::JsonEvent::JsonEvent ( int  _run,
int  _lumi,
int  _event 
)
inline

Definition at line 680 of file hltDiff.cc.

680 : run(_run), lumi(_lumi), event(_event), triggerStates(0) {}
std::vector< JsonTriggerEventState > triggerStates
Definition: hltDiff.cc:662

Member Function Documentation

◆ pushTrigger()

JsonTriggerEventState& JsonOutputProducer::JsonEvent::pushTrigger ( int  _tr)
inline

Definition at line 682 of file hltDiff.cc.

References JsonOutputProducer::JsonTriggerEventState::tr.

682  {
683  // check whether the last trigger is the one
684  if (!triggerStates.empty()) {
685  JsonTriggerEventState& lastTrigger = triggerStates.back();
686  if (lastTrigger.tr == _tr)
687  return lastTrigger;
688  }
689  triggerStates.push_back(JsonTriggerEventState(_tr));
690  return triggerStates.back();
691  }
std::vector< JsonTriggerEventState > triggerStates
Definition: hltDiff.cc:662

◆ serialise()

std::string JsonOutputProducer::JsonEvent::serialise ( size_t  _indent = 0) const
inline

Definition at line 664 of file hltDiff.cc.

References util.rrClient::indent, and writedatasetfile::run.

664  {
665  std::ostringstream json;
666  json << indent(_indent) << '{' << "\"r\"" << ':' << run << ",\"l\":" << lumi << ",\"e\":" << event
667  << ",\"t\":["; // line open
668  for (auto it = triggerStates.begin(); it != triggerStates.end(); ++it) {
669  json << '{'; // line open
670  json << (*it).serialise(_indent + 2); // block
671  json << indent(_indent + 1) << '}'; // line close
672  if (it != --triggerStates.end())
673  json << ',';
674  }
675  json << indent(_indent) << ']' << '}'; // line close
676 
677  return json.str();
678  }
static std::string indent(size_t _nTabs)
Definition: hltDiff.cc:425
nlohmann::json json
std::vector< JsonTriggerEventState > triggerStates
Definition: hltDiff.cc:662

Member Data Documentation

◆ event

int JsonOutputProducer::JsonEvent::event

◆ lumi

int JsonOutputProducer::JsonEvent::lumi

Definition at line 660 of file hltDiff.cc.

Referenced by SummaryOutputProducer::GenericSummary::addEntry().

◆ run

int JsonOutputProducer::JsonEvent::run

◆ triggerStates

std::vector<JsonTriggerEventState> JsonOutputProducer::JsonEvent::triggerStates

Definition at line 662 of file hltDiff.cc.

Referenced by SummaryOutputProducer::GenericSummary::addEntry().