CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
fwlite::RecordWriter Class Reference

#include <RecordWriter.h>

Classes

struct  DataBuffer
 

Public Member Functions

void fill (const edm::ESRecordAuxiliary &)
 
 RecordWriter (const char *iName, TFile *iFile)
 
void update (const void *iData, const std::type_info &iType, const char *iLabel)
 
void write ()
 
virtual ~RecordWriter ()
 

Private Member Functions

const RecordWriteroperator= (const RecordWriter &)
 
 RecordWriter (const RecordWriter &)
 

Private Attributes

edm::ESRecordAuxiliary aux_
 
TBranch * auxBranch_
 
std::map< std::pair
< edm::TypeIDBase, std::string >
, DataBuffer
idToBuffer_
 
edm::ESRecordAuxiliarypAux_
 
TTree * tree_
 

Detailed Description

Definition at line 34 of file RecordWriter.h.

Constructor & Destructor Documentation

RecordWriter::RecordWriter ( const char *  iName,
TFile *  iFile 
)

Definition at line 39 of file RecordWriter.cc.

References auxBranch_, fwlite::format_type_to_mangled(), pAux_, and tree_.

39  :
40 pAux_(&aux_)
41 {
42  tree_ = new TTree(fwlite::format_type_to_mangled(iName).c_str(),"Holds data for an EventSetup Record");
43  tree_->SetDirectory(iFile);
44 
45  auxBranch_ = tree_->Branch("ESRecordAuxiliary","edm::ESRecordAuxiliary",&pAux_);
46 }
edm::ESRecordAuxiliary aux_
Definition: RecordWriter.h:65
std::string format_type_to_mangled(const std::string &)
given a C++ class name returned a mangled name
edm::ESRecordAuxiliary * pAux_
Definition: RecordWriter.h:66
RecordWriter::~RecordWriter ( )
virtual

Definition at line 53 of file RecordWriter.cc.

54 {
55 }
fwlite::RecordWriter::RecordWriter ( const RecordWriter )
private

Member Function Documentation

void RecordWriter::fill ( const edm::ESRecordAuxiliary iValue)

Definition at line 113 of file RecordWriter.cc.

References aux_, edm::hlt::Exception, idToBuffer_, python.multivaluedict::map(), and tree_.

114 {
115  for(std::map<std::pair<edm::TypeIDBase,std::string>, DataBuffer>::iterator it=idToBuffer_.begin(),itEnd=idToBuffer_.end();
116  it!=itEnd;++it) {
117  if(0==it->second.pBuffer_) {
118  throw cms::Exception("MissingESData")<<"The EventSetup data "<<it->first.first.name()<<" '"<<it->first.second<<"' was not supplied";
119  }
120  }
121 
122  aux_ = iValue;
123  tree_->Fill();
124  for(std::map<std::pair<edm::TypeIDBase,std::string>, DataBuffer>::iterator it=idToBuffer_.begin(),itEnd=idToBuffer_.end();
125  it!=itEnd;++it) {
126  it->second.pBuffer_=0;
127  }
128 }
edm::ESRecordAuxiliary aux_
Definition: RecordWriter.h:65
std::map< std::pair< edm::TypeIDBase, std::string >, DataBuffer > idToBuffer_
Definition: RecordWriter.h:68
const RecordWriter& fwlite::RecordWriter::operator= ( const RecordWriter )
private
void RecordWriter::update ( const void *  iData,
const std::type_info &  iType,
const char *  iLabel 
)

Definition at line 73 of file RecordWriter.cc.

References fwlite::RecordWriter::DataBuffer::branch_, className(), fwlite::format_type_to_mangled(), idToBuffer_, diffTwoXMLs::label, python.connectstrParser::o, fwlite::RecordWriter::DataBuffer::pBuffer_, lumiQTWidget::t, tree_, and fwlite::RecordWriter::DataBuffer::trueType_.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

74 {
75  const char* label = iLabel;
76  if(0==iLabel) {
77  label = "";
78  }
79  std::map<std::pair<edm::TypeIDBase,std::string>, DataBuffer>::iterator itFound = idToBuffer_.find(std::make_pair(edm::TypeIDBase(iType),
80  std::string(iLabel)));
81  if(itFound == idToBuffer_.end()) {
82  //first request
83  DataBuffer buffer;
84  buffer.pBuffer_=iData;
85  ROOT::Reflex::Type t = ROOT::Reflex::Type::ByTypeInfo(iType);
86  assert(t != ROOT::Reflex::Type());
87 
88  std::string className = t.Name(ROOT::Reflex::SCOPED|ROOT::Reflex::FINAL);
89 
90  //now find actual type
91  ROOT::Reflex::Object o(t,const_cast<void*>(iData));
92  ROOT::Reflex::Type trueType = o.DynamicType();
93  buffer.trueType_ = edm::TypeIDBase(trueType.TypeInfo());
94  std::string trueClassName = trueType.Name(ROOT::Reflex::SCOPED|ROOT::Reflex::FINAL);
95 
96  buffer.branch_ = tree_->Branch((fwlite::format_type_to_mangled(className)+"__"+label).c_str(),
97  trueClassName.c_str(),
98  &buffer.pBuffer_);
99  idToBuffer_.insert(std::make_pair(std::make_pair(edm::TypeIDBase(iType),std::string(iLabel)),buffer));
100  itFound = idToBuffer_.find(std::make_pair(edm::TypeIDBase(iType),
101  std::string(iLabel)));
102  }
103  ROOT::Reflex::Type t = ROOT::Reflex::Type::ByTypeInfo(iType);
104  ROOT::Reflex::Object o(t,const_cast<void*>(iData));
105  ROOT::Reflex::Type trueType = o.DynamicType();
106  assert(edm::TypeIDBase(trueType.TypeInfo())==itFound->second.trueType_);
107  itFound->second.branch_->SetAddress(&(itFound->second.pBuffer_));
108  itFound->second.pBuffer_ = iData;
109 }
std::string format_type_to_mangled(const std::string &)
given a C++ class name returned a mangled name
std::map< std::pair< edm::TypeIDBase, std::string >, DataBuffer > idToBuffer_
Definition: RecordWriter.h:68
std::string className(const T &t)
Definition: ClassName.h:30
void RecordWriter::write ( void  )

Definition at line 131 of file RecordWriter.cc.

References tree_.

132 {
133  tree_->Write();
134 }

Member Data Documentation

edm::ESRecordAuxiliary fwlite::RecordWriter::aux_
private

Definition at line 65 of file RecordWriter.h.

Referenced by fill().

TBranch* fwlite::RecordWriter::auxBranch_
private

Definition at line 67 of file RecordWriter.h.

Referenced by RecordWriter().

std::map<std::pair<edm::TypeIDBase,std::string>, DataBuffer> fwlite::RecordWriter::idToBuffer_
private

Definition at line 68 of file RecordWriter.h.

Referenced by fill(), and update().

edm::ESRecordAuxiliary* fwlite::RecordWriter::pAux_
private

Definition at line 66 of file RecordWriter.h.

Referenced by RecordWriter().

TTree* fwlite::RecordWriter::tree_
private

Definition at line 64 of file RecordWriter.h.

Referenced by fill(), RecordWriter(), update(), and write().