1 #ifndef MEtoEDMFormat_h 2 #define MEtoEDMFormat_h 21 #include <TProfile2D.h> 22 #include <TObjString.h> 24 #include <THashList.h> 34 #define METOEDMFORMAT_DEBUG 0 64 THashList *l1 = (
const_cast<TAxis *
>(
a1))->GetLabels();
65 THashList *l2 = (
const_cast<TAxis *
>(
a2))->GetLabels();
73 if (l1->GetSize() != l2->GetSize()) {
76 for (
int i = 1;
i <=
a1->GetNbins(); ++
i) {
78 TString label2 =
a2->GetBinLabel(
i);
88 const size_t nObjects = newMEtoEDMObject.size();
94 if (nObjects != nOldObjects) {
95 std::cout <<
"WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" 96 << nObjects <<
", old=" << nOldObjects << std::endl;
99 for (
unsigned int i = 0;
i < nObjects; ++
i) {
111 if (
j >= nOldObjects) {
113 #if METOEDMFORMAT_DEBUG 114 std::cout <<
"WARNING MEtoEDM::mergeProducts(): adding new histogram '" <<
name <<
"'" << std::endl;
117 }
else if (
MEtoEdmObject[
j].
object.CanExtendAllAxes() && newMEtoEDMObject[
i].
object.CanExtendAllAxes()) {
119 list.Add((TObject *)&newMEtoEDMObject[
i].
object);
121 std::cout <<
"ERROR MEtoEDM::mergeProducts(): merge failed for '" <<
name <<
"'" << std::endl;
125 if (
MEtoEdmObject[
j].
object.GetNbinsX() == newMEtoEDMObject[
i].
object.GetNbinsX() &&
126 MEtoEdmObject[
j].
object.GetXaxis()->GetXmin() == newMEtoEDMObject[
i].
object.GetXaxis()->GetXmin() &&
127 MEtoEdmObject[
j].
object.GetXaxis()->GetXmax() == newMEtoEDMObject[
i].
object.GetXaxis()->GetXmax() &&
128 MEtoEdmObject[
j].
object.GetNbinsY() == newMEtoEDMObject[
i].
object.GetNbinsY() &&
129 MEtoEdmObject[
j].
object.GetYaxis()->GetXmin() == newMEtoEDMObject[
i].
object.GetYaxis()->GetXmin() &&
130 MEtoEdmObject[
j].
object.GetYaxis()->GetXmax() == newMEtoEDMObject[
i].
object.GetYaxis()->GetXmax() &&
131 MEtoEdmObject[
j].
object.GetNbinsZ() == newMEtoEDMObject[
i].
object.GetNbinsZ() &&
132 MEtoEdmObject[
j].
object.GetZaxis()->GetXmin() == newMEtoEDMObject[
i].
object.GetZaxis()->GetXmin() &&
133 MEtoEdmObject[
j].
object.GetZaxis()->GetXmax() == newMEtoEDMObject[
i].
object.GetZaxis()->GetXmax() &&
135 (TAxis *)newMEtoEDMObject[
i].
object.GetXaxis()) &&
137 (TAxis *)newMEtoEDMObject[
i].
object.GetYaxis()) &&
139 (TAxis *)newMEtoEDMObject[
i].
object.GetZaxis())) {
143 <<
"ERROR MEtoEDM::mergeProducts(): found histograms with different axis limits or different labels, '" 144 <<
name <<
"' not merged" << std::endl;
145 #if METOEDMFORMAT_DEBUG 150 << newMEtoEDMObject[
i].object.GetXaxis()->GetXmin() << std::endl;
152 << newMEtoEDMObject[
i].object.GetXaxis()->GetXmax() << std::endl;
156 << newMEtoEDMObject[
i].object.GetYaxis()->GetXmin() << std::endl;
158 << newMEtoEDMObject[
i].object.GetYaxis()->GetXmax() << std::endl;
162 << newMEtoEDMObject[
i].object.GetZaxis()->GetXmin() << std::endl;
164 << newMEtoEDMObject[
i].object.GetZaxis()->GetXmax() << std::endl;
182 const size_t nObjects = newMEtoEDMObject.size();
185 const size_t nOldObjects = MEtoEdmObject.size();
188 if (nObjects != nOldObjects) {
189 std::cout <<
"WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" 190 << nObjects <<
", old=" << nOldObjects << std::endl;
193 for (
unsigned int i = 0;
i < nObjects; ++
i) {
198 if (
i < nOldObjects && (MEtoEdmObject[
i].
name ==
name)) {
202 while (
j < nOldObjects && (MEtoEdmObject[
j].
name !=
name))
205 if (
j >= nOldObjects) {
207 #if METOEDMFORMAT_DEBUG 208 std::cout <<
"WARNING MEtoEDM::mergeProducts(): adding new histogram '" <<
name <<
"'" << std::endl;
210 MEtoEdmObject.push_back(newMEtoEDMObject[
i]);
219 const size_t nObjects = newMEtoEDMObject.size();
222 const size_t nOldObjects = MEtoEdmObject.size();
225 if (nObjects != nOldObjects) {
226 std::cout <<
"WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" 227 << nObjects <<
", old=" << nOldObjects << std::endl;
230 for (
unsigned int i = 0;
i < nObjects; ++
i) {
235 if (
i < nOldObjects && (MEtoEdmObject[
i].
name ==
name)) {
239 while (
j < nOldObjects && (MEtoEdmObject[
j].
name !=
name))
242 if (
j >= nOldObjects) {
244 #if METOEDMFORMAT_DEBUG 245 std::cout <<
"WARNING MEtoEDM::mergeProducts(): adding new histogram '" <<
name <<
"'" << std::endl;
247 MEtoEdmObject.push_back(newMEtoEDMObject[
i]);
250 if (MEtoEdmObject[
j].
name.find(
"EventInfo/processedEvents") != std::string::npos) {
251 MEtoEdmObject[
j].object += (newMEtoEDMObject[
i].object);
253 if (MEtoEdmObject[
j].
name.find(
"EventInfo/iEvent") != std::string::npos ||
254 MEtoEdmObject[
j].name.find(
"EventInfo/iLumiSection") != std::string::npos) {
255 if (MEtoEdmObject[
j].
object < newMEtoEDMObject[
i].
object) {
256 MEtoEdmObject[
j].object = (newMEtoEDMObject[
i].object);
267 const size_t nObjects = newMEtoEDMObject.size();
270 const size_t nOldObjects = MEtoEdmObject.size();
273 if (nObjects != nOldObjects) {
274 std::cout <<
"WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" 275 << nObjects <<
", old=" << nOldObjects << std::endl;
278 for (
unsigned int i = 0;
i < nObjects; ++
i) {
283 if (
i < nOldObjects && (MEtoEdmObject[
i].
name ==
name)) {
287 while (
j < nOldObjects && (MEtoEdmObject[
j].
name !=
name))
290 if (
j >= nOldObjects) {
292 #if METOEDMFORMAT_DEBUG 293 std::cout <<
"WARNING MEtoEDM::mergeProducts(): adding new histogram '" <<
name <<
"'" << std::endl;
295 MEtoEdmObject.push_back(newMEtoEDMObject[
i]);
298 if (MEtoEdmObject[
j].
name.find(
"EventInfo/processedEvents") != std::string::npos) {
299 MEtoEdmObject[
j].object += (newMEtoEDMObject[
i].object);
301 if (MEtoEdmObject[
j].
name.find(
"EventInfo/iEvent") != std::string::npos ||
302 MEtoEdmObject[
j].name.find(
"EventInfo/iLumiSection") != std::string::npos) {
303 if (MEtoEdmObject[
j].
object < newMEtoEDMObject[
i].
object) {
304 MEtoEdmObject[
j].object = (newMEtoEDMObject[
i].object);
315 const size_t nObjects = newMEtoEDMObject.size();
318 const size_t nOldObjects = MEtoEdmObject.size();
321 if (nObjects != nOldObjects) {
322 std::cout <<
"WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" 323 << nObjects <<
", old=" << nOldObjects << std::endl;
326 for (
unsigned int i = 0;
i < nObjects; ++
i) {
331 if (
i < nOldObjects && (MEtoEdmObject[
i].
name ==
name)) {
335 while (
j < nOldObjects && (MEtoEdmObject[
j].
name !=
name))
338 if (
j >= nOldObjects) {
340 #if METOEDMFORMAT_DEBUG 341 std::cout <<
"WARNING MEtoEDM::mergeProducts(): adding new histogram '" <<
name <<
"'" << std::endl;
343 MEtoEdmObject.push_back(newMEtoEDMObject[
i]);
void swap(MEtoEDM< T > &iOther)
MEtoEDM(size_t reservedSize)
const MEtoEdmObjectVector & getMEtoEdmObject() const
bool mergeProduct(const MEtoEDM< T > &newMEtoEDM)
void putMEtoEdmObject(const std::string &name, const T &object)
Container::value_type value_type
bool CheckBinLabels(const TAxis *a1, const TAxis *a2)
std::vector< MEtoEDMObject > MEtoEdmObjectVector
std::vector< uint32_t > TagList
MEtoEdmObjectVector MEtoEdmObject