#include <MEtoEDMFormat.h>
Classes | |
struct | MEtoEDMObject |
Public Types | |
typedef std::vector < MEtoEDMObject > | MEtoEdmObjectVector |
typedef std::vector< uint32_t > | TagList |
Public Member Functions | |
const MEtoEdmObjectVector & | getMEtoEdmObject () const |
template<> | |
bool | mergeProduct (const MEtoEDM< TString > &newMEtoEDM) |
template<> | |
bool | mergeProduct (const MEtoEDM< double > &newMEtoEDM) |
template<> | |
bool | mergeProduct (const MEtoEDM< int > &newMEtoEDM) |
template<> | |
bool | mergeProduct (const MEtoEDM< long long > &newMEtoEDM) |
bool | mergeProduct (const MEtoEDM< T > &newMEtoEDM) |
MEtoEDM (size_t reservedSize) | |
MEtoEDM () | |
void | putMEtoEdmObject (const std::string &name, const TagList &tags, const T &object) |
void | swap (MEtoEDM< T > &iOther) |
virtual | ~MEtoEDM () |
Private Attributes | |
MEtoEdmObjectVector | MEtoEdmObject |
DataFormat class to hold the information from a ME tranformed into ROOT objects as appropriate
Definition at line 37 of file MEtoEDMFormat.h.
typedef std::vector<MEtoEDMObject> MEtoEDM< T >::MEtoEdmObjectVector |
Definition at line 55 of file MEtoEDMFormat.h.
Definition at line 46 of file MEtoEDMFormat.h.
Definition at line 40 of file MEtoEDMFormat.h.
{}
Definition at line 41 of file MEtoEDMFormat.h.
References MEtoEDM< T >::MEtoEdmObject.
{ MEtoEdmObject.reserve(reservedSize); }
Definition at line 44 of file MEtoEDMFormat.h.
{}
const MEtoEdmObjectVector& MEtoEDM< T >::getMEtoEdmObject | ( | ) | const [inline] |
Definition at line 68 of file MEtoEDMFormat.h.
References MEtoEDM< T >::MEtoEdmObject.
Referenced by MEtoEDM< T >::mergeProduct().
{ return MEtoEdmObject; }
Definition at line 149 of file MEtoEDMFormat.h.
References gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), i, j, and mergeVDriftHistosByStation::name.
{ const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject(); const size_t nObjects = newMEtoEDMObject.size(); // NOTE: we remember the present size since we will only add content // from newMEtoEDMObject after this point const size_t nOldObjects = MEtoEdmObject.size(); // if the old and new are not the same size, we want to report a problem if (nObjects != nOldObjects) { std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl; } for (unsigned int i = 0; i < nObjects; ++i) { unsigned int j = 0; // see if the name is already in the old container up to the point where // we may have added new entries in the container const std::string& name = newMEtoEDMObject[i].name; if (i < nOldObjects && (MEtoEdmObject[i].name == name)) { j = i; } else { j = 0; while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j; } if (j >= nOldObjects) { // this value is only in the new container, not the old one #if debug std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl; #endif MEtoEdmObject.push_back(newMEtoEDMObject[i]); } } return true; }
bool MEtoEDM< long long >::mergeProduct | ( | const MEtoEDM< long long > & | newMEtoEDM | ) | [inline] |
Definition at line 234 of file MEtoEDMFormat.h.
References gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), i, j, and mergeVDriftHistosByStation::name.
{ const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject(); const size_t nObjects = newMEtoEDMObject.size(); // NOTE: we remember the present size since we will only add content // from newMEtoEDMObject after this point const size_t nOldObjects = MEtoEdmObject.size(); // if the old and new are not the same size, we want to report a problem if (nObjects != nOldObjects) { std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl; } for (unsigned int i = 0; i < nObjects; ++i) { unsigned int j = 0; // see if the name is already in the old container up to the point where // we may have added new entries in the container const std::string& name = newMEtoEDMObject[i].name; if (i < nOldObjects && (MEtoEdmObject[i].name == name)) { j = i; } else { j = 0; while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j; } if (j >= nOldObjects) { // this value is only in the new container, not the old one #if debug std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl; #endif MEtoEdmObject.push_back(newMEtoEDMObject[i]); } else { // this value is also in the new container: add the two if ( MEtoEdmObject[j].name.find("EventInfo/processedEvents") != std::string::npos ) { MEtoEdmObject[j].object += (newMEtoEDMObject[i].object); } if ( MEtoEdmObject[j].name.find("EventInfo/iEvent") != std::string::npos || MEtoEdmObject[j].name.find("EventInfo/iLumiSection") != std::string::npos) { if (MEtoEdmObject[j].object < newMEtoEDMObject[i].object) { MEtoEdmObject[j].object = (newMEtoEDMObject[i].object); } } } } return true; }
Definition at line 186 of file MEtoEDMFormat.h.
References gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), i, j, and mergeVDriftHistosByStation::name.
{ const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject(); const size_t nObjects = newMEtoEDMObject.size(); // NOTE: we remember the present size since we will only add content // from newMEtoEDMObject after this point const size_t nOldObjects = MEtoEdmObject.size(); // if the old and new are not the same size, we want to report a problem if (nObjects != nOldObjects) { std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl; } for (unsigned int i = 0; i < nObjects; ++i) { unsigned int j = 0; // see if the name is already in the old container up to the point where // we may have added new entries in the container const std::string& name = newMEtoEDMObject[i].name; if (i < nOldObjects && (MEtoEdmObject[i].name == name)) { j = i; } else { j = 0; while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j; } if (j >= nOldObjects) { // this value is only in the new container, not the old one #if debug std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl; #endif MEtoEdmObject.push_back(newMEtoEDMObject[i]); } else { // this value is also in the new container: add the two if ( MEtoEdmObject[j].name.find("EventInfo/processedEvents") != std::string::npos ) { MEtoEdmObject[j].object += (newMEtoEDMObject[i].object); } if ( MEtoEdmObject[j].name.find("EventInfo/iEvent") != std::string::npos || MEtoEdmObject[j].name.find("EventInfo/iLumiSection") != std::string::npos) { if (MEtoEdmObject[j].object < newMEtoEDMObject[i].object) { MEtoEdmObject[j].object = (newMEtoEDMObject[i].object); } } } } return true; }
Definition at line 282 of file MEtoEDMFormat.h.
References gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), i, j, and mergeVDriftHistosByStation::name.
{ const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject(); const size_t nObjects = newMEtoEDMObject.size(); // NOTE: we remember the present size since we will only add content // from newMEtoEDMObject after this point const size_t nOldObjects = MEtoEdmObject.size(); // if the old and new are not the same size, we want to report a problem if (nObjects != nOldObjects) { std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl; } for (unsigned int i = 0; i < nObjects; ++i) { unsigned int j = 0; // see if the name is already in the old container up to the point where // we may have added new entries in the container const std::string& name = newMEtoEDMObject[i].name; if (i < nOldObjects && (MEtoEdmObject[i].name == name)) { j = i; } else { j = 0; while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j; } if (j >= nOldObjects) { // this value is only in the new container, not the old one #if debug std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl; #endif MEtoEdmObject.push_back(newMEtoEDMObject[i]); } } return true; }
Definition at line 71 of file MEtoEDMFormat.h.
References gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), i, j, list(), MEtoEDM< T >::MEtoEdmObject, and mergeVDriftHistosByStation::name.
{ const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject(); const size_t nObjects = newMEtoEDMObject.size(); // NOTE: we remember the present size since we will only add content // from newMEtoEDMObject after this point const size_t nOldObjects = MEtoEdmObject.size(); // if the old and new are not the same size, we want to report a problem if (nObjects != nOldObjects) { std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl; } for (unsigned int i = 0; i < nObjects; ++i) { unsigned int j = 0; // see if the name is already in the old container up to the point where // we may have added new entries in the container const std::string& name = newMEtoEDMObject[i].name; if (i < nOldObjects && (MEtoEdmObject[i].name == name)) { j = i; } else { j = 0; while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j; } if (j >= nOldObjects) { // this value is only in the new container, not the old one #if debug std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl; #endif MEtoEdmObject.push_back(newMEtoEDMObject[i]); } else if (MEtoEdmObject[j].object.TestBit(TH1::kCanRebin) == true && newMEtoEDMObject[i].object.TestBit(TH1::kCanRebin) == true) { TList list; list.Add((TObject*)&newMEtoEDMObject[i].object); if (MEtoEdmObject[j].object.Merge(&list) == -1) { std::cout << "ERROR MEtoEDM::mergeProducts(): merge failed for '" << name << "'" << std::endl; } } else { // this value is also in the new container: add the two if (MEtoEdmObject[j].object.GetNbinsX() == newMEtoEDMObject[i].object.GetNbinsX() && MEtoEdmObject[j].object.GetXaxis()->GetXmin() == newMEtoEDMObject[i].object.GetXaxis()->GetXmin() && MEtoEdmObject[j].object.GetXaxis()->GetXmax() == newMEtoEDMObject[i].object.GetXaxis()->GetXmax() && MEtoEdmObject[j].object.GetNbinsY() == newMEtoEDMObject[i].object.GetNbinsY() && MEtoEdmObject[j].object.GetYaxis()->GetXmin() == newMEtoEDMObject[i].object.GetYaxis()->GetXmin() && MEtoEdmObject[j].object.GetYaxis()->GetXmax() == newMEtoEDMObject[i].object.GetYaxis()->GetXmax() && MEtoEdmObject[j].object.GetNbinsZ() == newMEtoEDMObject[i].object.GetNbinsZ() && MEtoEdmObject[j].object.GetZaxis()->GetXmin() == newMEtoEDMObject[i].object.GetZaxis()->GetXmin() && MEtoEdmObject[j].object.GetZaxis()->GetXmax() == newMEtoEDMObject[i].object.GetZaxis()->GetXmax()) { MEtoEdmObject[j].object.Add(&newMEtoEDMObject[i].object); } else { std::cout << "ERROR MEtoEDM::mergeProducts(): found histograms with different axis limits, '" << name << "' not merged" << std::endl; #if debug std::cout << MEtoEdmObject[j].name << " " << newMEtoEDMObject[i].name << std::endl; std::cout << MEtoEdmObject[j].object.GetNbinsX() << " " << newMEtoEDMObject[i].object.GetNbinsX() << std::endl; std::cout << MEtoEdmObject[j].object.GetXaxis()->GetXmin() << " " << newMEtoEDMObject[i].object.GetXaxis()->GetXmin() << std::endl; std::cout << MEtoEdmObject[j].object.GetXaxis()->GetXmax() << " " << newMEtoEDMObject[i].object.GetXaxis()->GetXmax() << std::endl; std::cout << MEtoEdmObject[j].object.GetNbinsY() << " " << newMEtoEDMObject[i].object.GetNbinsY() << std::endl; std::cout << MEtoEdmObject[j].object.GetYaxis()->GetXmin() << " " << newMEtoEDMObject[i].object.GetYaxis()->GetXmin() << std::endl; std::cout << MEtoEdmObject[j].object.GetYaxis()->GetXmax() << " " << newMEtoEDMObject[i].object.GetYaxis()->GetXmax() << std::endl; std::cout << MEtoEdmObject[j].object.GetNbinsZ() << " " << newMEtoEDMObject[i].object.GetNbinsZ() << std::endl; std::cout << MEtoEdmObject[j].object.GetZaxis()->GetXmin() << " " << newMEtoEDMObject[i].object.GetZaxis()->GetXmin() << std::endl; std::cout << MEtoEdmObject[j].object.GetZaxis()->GetXmax() << " " << newMEtoEDMObject[i].object.GetZaxis()->GetXmax() << std::endl; #endif } } } return true; }
void MEtoEDM< T >::putMEtoEdmObject | ( | const std::string & | name, |
const TagList & | tags, | ||
const T & | object | ||
) | [inline] |
Definition at line 57 of file MEtoEDMFormat.h.
References MEtoEDM< T >::MEtoEdmObject, mergeVDriftHistosByStation::name, dbtoconf::object, o2o::tags, and cond::rpcobtemp::temp.
{ typename MEtoEdmObjectVector::value_type temp; MEtoEdmObject.push_back(temp); MEtoEdmObject.back().name = name; MEtoEdmObject.back().tags = tags; MEtoEdmObject.back().object = object; }
Definition at line 138 of file MEtoEDMFormat.h.
References MEtoEDM< T >::MEtoEdmObject.
{ MEtoEdmObject.swap(iOther.MEtoEdmObject); }
MEtoEdmObjectVector MEtoEDM< T >::MEtoEdmObject [private] |
Definition at line 143 of file MEtoEDMFormat.h.
Referenced by MEtoEDM< T >::getMEtoEdmObject(), MEtoEDM< T >::mergeProduct(), MEtoEDM< T >::MEtoEDM(), MEtoEDM< T >::putMEtoEdmObject(), and MEtoEDM< T >::swap().