CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
< MEtoEDMObject
MEtoEdmObjectVector
 
typedef std::vector< uint32_t > TagList
 

Public Member Functions

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 66 of file MEtoEDMFormat.h.

Member Typedef Documentation

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

Definition at line 84 of file MEtoEDMFormat.h.

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

Definition at line 75 of file MEtoEDMFormat.h.

Constructor & Destructor Documentation

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

Definition at line 69 of file MEtoEDMFormat.h.

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

Definition at line 70 of file MEtoEDMFormat.h.

70  {
71  MEtoEdmObject.reserve(reservedSize);
72  }
MEtoEdmObjectVector MEtoEdmObject
template<class T>
virtual MEtoEDM< T >::~MEtoEDM ( )
inlinevirtual

Definition at line 73 of file MEtoEDMFormat.h.

73 {}

Member Function Documentation

template<class T>
const MEtoEdmObjectVector& MEtoEDM< T >::getMEtoEdmObject ( ) const
inline

Definition at line 97 of file MEtoEDMFormat.h.

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

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

Definition at line 100 of file MEtoEDMFormat.h.

100  {
101  const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject();
102  const size_t nObjects = newMEtoEDMObject.size();
103  // NOTE: we remember the present size since we will only add content
104  // from newMEtoEDMObject after this point
105  const size_t nOldObjects = MEtoEdmObject.size();
106 
107  // if the old and new are not the same size, we want to report a problem
108  if (nObjects != nOldObjects) {
109  std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl;
110  }
111 
112  for (unsigned int i = 0; i < nObjects; ++i) {
113  unsigned int j = 0;
114  // see if the name is already in the old container up to the point where
115  // we may have added new entries in the container
116  const std::string& name = newMEtoEDMObject[i].name;
117  if (i < nOldObjects && (MEtoEdmObject[i].name == name)) {
118  j = i;
119  } else {
120  j = 0;
121  while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j;
122  }
123  if (j >= nOldObjects) {
124  // this value is only in the new container, not the old one
125 #if METOEDMFORMAT_DEBUG
126  std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl;
127 #endif
128  MEtoEdmObject.push_back(newMEtoEDMObject[i]);
129  } else if (MEtoEdmObject[j].object.CanExtendAllAxes() && newMEtoEDMObject[i].object.CanExtendAllAxes()) {
130  TList list;
131  list.Add((TObject*)&newMEtoEDMObject[i].object);
132  if (MEtoEdmObject[j].object.Merge(&list) == -1) {
133  std::cout << "ERROR MEtoEDM::mergeProducts(): merge failed for '" << name << "'" << std::endl;
134  }
135  } else {
136  // this value is also in the new container: add the two
137  if (MEtoEdmObject[j].object.GetNbinsX() == newMEtoEDMObject[i].object.GetNbinsX() &&
138  MEtoEdmObject[j].object.GetXaxis()->GetXmin() == newMEtoEDMObject[i].object.GetXaxis()->GetXmin() &&
139  MEtoEdmObject[j].object.GetXaxis()->GetXmax() == newMEtoEDMObject[i].object.GetXaxis()->GetXmax() &&
140  MEtoEdmObject[j].object.GetNbinsY() == newMEtoEDMObject[i].object.GetNbinsY() &&
141  MEtoEdmObject[j].object.GetYaxis()->GetXmin() == newMEtoEDMObject[i].object.GetYaxis()->GetXmin() &&
142  MEtoEdmObject[j].object.GetYaxis()->GetXmax() == newMEtoEDMObject[i].object.GetYaxis()->GetXmax() &&
143  MEtoEdmObject[j].object.GetNbinsZ() == newMEtoEDMObject[i].object.GetNbinsZ() &&
144  MEtoEdmObject[j].object.GetZaxis()->GetXmin() == newMEtoEDMObject[i].object.GetZaxis()->GetXmin() &&
145  MEtoEdmObject[j].object.GetZaxis()->GetXmax() == newMEtoEDMObject[i].object.GetZaxis()->GetXmax() &&
146  CheckBinLabels((TAxis*)MEtoEdmObject[j].object.GetXaxis(),(TAxis*)newMEtoEDMObject[i].object.GetXaxis()) &&
147  CheckBinLabels((TAxis*)MEtoEdmObject[j].object.GetYaxis(),(TAxis*)newMEtoEDMObject[i].object.GetYaxis()) &&
148  CheckBinLabels((TAxis*)MEtoEdmObject[j].object.GetZaxis(),(TAxis*)newMEtoEDMObject[i].object.GetZaxis()) ) {
149  MEtoEdmObject[j].object.Add(&newMEtoEDMObject[i].object);
150  } else {
151  std::cout << "ERROR MEtoEDM::mergeProducts(): found histograms with different axis limits or different labels, '" << name << "' not merged" << std::endl;
152 #if METOEDMFORMAT_DEBUG
153  std::cout << MEtoEdmObject[j].name << " " << newMEtoEDMObject[i].name << std::endl;
154  std::cout << MEtoEdmObject[j].object.GetNbinsX() << " " << newMEtoEDMObject[i].object.GetNbinsX() << std::endl;
155  std::cout << MEtoEdmObject[j].object.GetXaxis()->GetXmin() << " " << newMEtoEDMObject[i].object.GetXaxis()->GetXmin() << std::endl;
156  std::cout << MEtoEdmObject[j].object.GetXaxis()->GetXmax() << " " << newMEtoEDMObject[i].object.GetXaxis()->GetXmax() << std::endl;
157  std::cout << MEtoEdmObject[j].object.GetNbinsY() << " " << newMEtoEDMObject[i].object.GetNbinsY() << std::endl;
158  std::cout << MEtoEdmObject[j].object.GetYaxis()->GetXmin() << " " << newMEtoEDMObject[i].object.GetYaxis()->GetXmin() << std::endl;
159  std::cout << MEtoEdmObject[j].object.GetYaxis()->GetXmax() << " " << newMEtoEDMObject[i].object.GetYaxis()->GetXmax() << std::endl;
160  std::cout << MEtoEdmObject[j].object.GetNbinsZ() << " " << newMEtoEDMObject[i].object.GetNbinsZ() << std::endl;
161  std::cout << MEtoEdmObject[j].object.GetZaxis()->GetXmin() << " " << newMEtoEDMObject[i].object.GetZaxis()->GetXmin() << std::endl;
162  std::cout << MEtoEdmObject[j].object.GetZaxis()->GetXmax() << " " << newMEtoEDMObject[i].object.GetZaxis()->GetXmax() << std::endl;
163 #endif
164  }
165  }
166  }
167  return true;
168  }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
const MEtoEdmObjectVector & getMEtoEdmObject() const
Definition: MEtoEDMFormat.h:97
tuple cout
Definition: gather_cfg.py:145
std::vector< MEtoEDMObject > MEtoEdmObjectVector
Definition: MEtoEDMFormat.h:84
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 86 of file MEtoEDMFormat.h.

89  {
91  MEtoEdmObject.push_back(temp);
92  MEtoEdmObject.back().name = name;
93  MEtoEdmObject.back().tags = tags;
94  MEtoEdmObject.back().object = object;
95  }
tuple tags
Definition: o2o.py:248
MEtoEdmObjectVector MEtoEdmObject
template<class T>
void MEtoEDM< T >::swap ( MEtoEDM< T > &  iOther)
inline

Definition at line 170 of file MEtoEDMFormat.h.

170  {
171  MEtoEdmObject.swap(iOther.MEtoEdmObject);
172  }
MEtoEdmObjectVector MEtoEdmObject

Member Data Documentation

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