CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Attributes
MEtoEDM< T > Class Template Reference

#include <MEtoEDMFormat.h>

Classes

struct  MEtoEDMObject
 

Public Types

typedef std::vector< MEtoEDMObjectMEtoEdmObjectVector
 
typedef std::vector< uint32_t > TagList
 

Public Member Functions

bool CheckBinLabels (const TAxis *a1, const TAxis *a2)
 
const MEtoEdmObjectVectorgetMEtoEdmObject () const
 
bool mergeProduct (const MEtoEDM< T > &newMEtoEDM)
 
 MEtoEDM ()
 
 MEtoEDM (size_t reservedSize)
 
void putMEtoEdmObject (const std::string &name, const TagList &tags, const T &object)
 
void swap (MEtoEDM< T > &iOther)
 
virtual ~MEtoEDM ()
 

Private Attributes

MEtoEdmObjectVector MEtoEdmObject
 

Detailed Description

template<class T>
class MEtoEDM< T >

DataFormat class to hold the information from a ME tranformed into ROOT objects as appropriate

Author
M. Strang SUNY-Buffalo

Definition at line 37 of file MEtoEDMFormat.h.

Member Typedef Documentation

template<class T>
typedef std::vector<MEtoEDMObject> MEtoEDM< T >::MEtoEdmObjectVector

Definition at line 55 of file MEtoEDMFormat.h.

template<class T>
typedef std::vector<uint32_t> MEtoEDM< T >::TagList

Definition at line 46 of file MEtoEDMFormat.h.

Constructor & Destructor Documentation

template<class T>
MEtoEDM< T >::MEtoEDM ( )
inline

Definition at line 40 of file MEtoEDMFormat.h.

40 {}
template<class T>
MEtoEDM< T >::MEtoEDM ( size_t  reservedSize)
inlineexplicit

Definition at line 41 of file MEtoEDMFormat.h.

41  {
42  MEtoEdmObject.reserve(reservedSize);
43  }
MEtoEdmObjectVector MEtoEdmObject
template<class T>
virtual MEtoEDM< T >::~MEtoEDM ( )
inlinevirtual

Definition at line 44 of file MEtoEDMFormat.h.

44 {}

Member Function Documentation

template<class T>
bool MEtoEDM< T >::CheckBinLabels ( const TAxis *  a1,
const TAxis *  a2 
)
inline

Definition at line 71 of file MEtoEDMFormat.h.

Referenced by MEtoEDM< TH1F >::mergeProduct().

72  {
73  // check that axis have same labels
74  THashList *l1 = (const_cast<TAxis*>(a1))->GetLabels();
75  THashList *l2 = (const_cast<TAxis*>(a2))->GetLabels();
76 
77  if (!l1 && !l2 )
78  return true;
79  if (!l1 || !l2 ) {
80  return false;
81  }
82  // check now labels sizes are the same
83  if (l1->GetSize() != l2->GetSize() ) {
84  return false;
85  }
86  for (int i = 1; i <= a1->GetNbins(); ++i) {
87  TString label1 = a1->GetBinLabel(i);
88  TString label2 = a2->GetBinLabel(i);
89  if (label1 != label2) {
90  return false;
91  }
92  }
93  return true;
94  }
template<class T>
const MEtoEdmObjectVector& MEtoEDM< T >::getMEtoEdmObject ( ) const
inline

Definition at line 68 of file MEtoEDMFormat.h.

Referenced by MEtoEDM< TH1F >::mergeProduct().

69  { return MEtoEdmObject; }
MEtoEdmObjectVector MEtoEdmObject
template<class T>
bool MEtoEDM< T >::mergeProduct ( const MEtoEDM< T > &  newMEtoEDM)
inline

Definition at line 96 of file MEtoEDMFormat.h.

96  {
97  const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject();
98  const size_t nObjects = newMEtoEDMObject.size();
99  // NOTE: we remember the present size since we will only add content
100  // from newMEtoEDMObject after this point
101  const size_t nOldObjects = MEtoEdmObject.size();
102 
103  // if the old and new are not the same size, we want to report a problem
104  if (nObjects != nOldObjects) {
105  std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl;
106  }
107 
108  for (unsigned int i = 0; i < nObjects; ++i) {
109  unsigned int j = 0;
110  // see if the name is already in the old container up to the point where
111  // we may have added new entries in the container
112  const std::string& name = newMEtoEDMObject[i].name;
113  if (i < nOldObjects && (MEtoEdmObject[i].name == name)) {
114  j = i;
115  } else {
116  j = 0;
117  while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j;
118  }
119  if (j >= nOldObjects) {
120  // this value is only in the new container, not the old one
121 #if METOEDMFORMAT_DEBUG
122  std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl;
123 #endif
124  MEtoEdmObject.push_back(newMEtoEDMObject[i]);
125  } else if (MEtoEdmObject[j].object.CanExtendAllAxes() && newMEtoEDMObject[i].object.CanExtendAllAxes()) {
126  TList list;
127  list.Add((TObject*)&newMEtoEDMObject[i].object);
128  if (MEtoEdmObject[j].object.Merge(&list) == -1) {
129  std::cout << "ERROR MEtoEDM::mergeProducts(): merge failed for '" << name << "'" << std::endl;
130  }
131  } else {
132  // this value is also in the new container: add the two
133  if (MEtoEdmObject[j].object.GetNbinsX() == newMEtoEDMObject[i].object.GetNbinsX() &&
134  MEtoEdmObject[j].object.GetXaxis()->GetXmin() == newMEtoEDMObject[i].object.GetXaxis()->GetXmin() &&
135  MEtoEdmObject[j].object.GetXaxis()->GetXmax() == newMEtoEDMObject[i].object.GetXaxis()->GetXmax() &&
136  MEtoEdmObject[j].object.GetNbinsY() == newMEtoEDMObject[i].object.GetNbinsY() &&
137  MEtoEdmObject[j].object.GetYaxis()->GetXmin() == newMEtoEDMObject[i].object.GetYaxis()->GetXmin() &&
138  MEtoEdmObject[j].object.GetYaxis()->GetXmax() == newMEtoEDMObject[i].object.GetYaxis()->GetXmax() &&
139  MEtoEdmObject[j].object.GetNbinsZ() == newMEtoEDMObject[i].object.GetNbinsZ() &&
140  MEtoEdmObject[j].object.GetZaxis()->GetXmin() == newMEtoEDMObject[i].object.GetZaxis()->GetXmin() &&
141  MEtoEdmObject[j].object.GetZaxis()->GetXmax() == newMEtoEDMObject[i].object.GetZaxis()->GetXmax() &&
142  CheckBinLabels((TAxis*)MEtoEdmObject[j].object.GetXaxis(),(TAxis*)newMEtoEDMObject[i].object.GetXaxis()) &&
143  CheckBinLabels((TAxis*)MEtoEdmObject[j].object.GetYaxis(),(TAxis*)newMEtoEDMObject[i].object.GetYaxis()) &&
144  CheckBinLabels((TAxis*)MEtoEdmObject[j].object.GetZaxis(),(TAxis*)newMEtoEDMObject[i].object.GetZaxis()) ) {
145  MEtoEdmObject[j].object.Add(&newMEtoEDMObject[i].object);
146  } else {
147  std::cout << "ERROR MEtoEDM::mergeProducts(): found histograms with different axis limits or different labels, '" << name << "' not merged" << std::endl;
148 #if METOEDMFORMAT_DEBUG
149  std::cout << MEtoEdmObject[j].name << " " << newMEtoEDMObject[i].name << std::endl;
150  std::cout << MEtoEdmObject[j].object.GetNbinsX() << " " << newMEtoEDMObject[i].object.GetNbinsX() << std::endl;
151  std::cout << MEtoEdmObject[j].object.GetXaxis()->GetXmin() << " " << newMEtoEDMObject[i].object.GetXaxis()->GetXmin() << std::endl;
152  std::cout << MEtoEdmObject[j].object.GetXaxis()->GetXmax() << " " << newMEtoEDMObject[i].object.GetXaxis()->GetXmax() << std::endl;
153  std::cout << MEtoEdmObject[j].object.GetNbinsY() << " " << newMEtoEDMObject[i].object.GetNbinsY() << std::endl;
154  std::cout << MEtoEdmObject[j].object.GetYaxis()->GetXmin() << " " << newMEtoEDMObject[i].object.GetYaxis()->GetXmin() << std::endl;
155  std::cout << MEtoEdmObject[j].object.GetYaxis()->GetXmax() << " " << newMEtoEDMObject[i].object.GetYaxis()->GetXmax() << std::endl;
156  std::cout << MEtoEdmObject[j].object.GetNbinsZ() << " " << newMEtoEDMObject[i].object.GetNbinsZ() << std::endl;
157  std::cout << MEtoEdmObject[j].object.GetZaxis()->GetXmin() << " " << newMEtoEDMObject[i].object.GetZaxis()->GetXmin() << std::endl;
158  std::cout << MEtoEdmObject[j].object.GetZaxis()->GetXmax() << " " << newMEtoEDMObject[i].object.GetZaxis()->GetXmax() << std::endl;
159 #endif
160  }
161  }
162  }
163  return true;
164  }
Definition: Merge.py:1
const MEtoEdmObjectVector & getMEtoEdmObject() const
Definition: MEtoEDMFormat.h:68
bool CheckBinLabels(const TAxis *a1, const TAxis *a2)
Definition: MEtoEDMFormat.h:71
std::vector< MEtoEDMObject > MEtoEdmObjectVector
Definition: MEtoEDMFormat.h:55
MEtoEdmObjectVector MEtoEdmObject
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
template<class T>
void MEtoEDM< T >::putMEtoEdmObject ( const std::string &  name,
const TagList tags,
const T object 
)
inline

Definition at line 57 of file MEtoEDMFormat.h.

60  {
62  MEtoEdmObject.push_back(temp);
63  MEtoEdmObject.back().name = name;
64  MEtoEdmObject.back().tags = tags;
65  MEtoEdmObject.back().object = object;
66  }
MEtoEdmObjectVector MEtoEdmObject
template<class T>
void MEtoEDM< T >::swap ( MEtoEDM< T > &  iOther)
inline

Definition at line 166 of file MEtoEDMFormat.h.

166  {
167  MEtoEdmObject.swap(iOther.MEtoEdmObject);
168  }
MEtoEdmObjectVector MEtoEdmObject

Member Data Documentation

template<class T>
MEtoEdmObjectVector MEtoEDM< T >::MEtoEdmObject
private