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)
 
template<>
bool mergeProduct (const MEtoEDM< double > &newMEtoEDM)
 
template<>
bool mergeProduct (const MEtoEDM< int > &newMEtoEDM)
 
template<>
bool mergeProduct (const MEtoEDM< long long > &newMEtoEDM)
 
template<>
bool mergeProduct (const MEtoEDM< TString > &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.

References MEtoEDM< T >::MEtoEdmObject.

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.

References mps_fire::i.

Referenced by MEtoEDM< T >::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.

References MEtoEDM< T >::MEtoEdmObject.

Referenced by MEtoEDM< T >::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.

References MEtoEDM< T >::CheckBinLabels(), gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), mps_fire::i, list(), MEtoEDM< T >::MEtoEdmObject, MEtoEDM< T >::MEtoEDMObject::name, and AlCaHLTBitMon_QueryRunRegistry::string.

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<>
bool MEtoEDM< double >::mergeProduct ( const MEtoEDM< double > &  newMEtoEDM)
inline

Definition at line 177 of file MEtoEDMFormat.h.

References gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), mps_fire::i, MEtoEDM< T >::MEtoEdmObject, MEtoEDM< T >::MEtoEDMObject::name, and AlCaHLTBitMon_QueryRunRegistry::string.

178 {
179  const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject();
180  const size_t nObjects = newMEtoEDMObject.size();
181  // NOTE: we remember the present size since we will only add content
182  // from newMEtoEDMObject after this point
183  const size_t nOldObjects = MEtoEdmObject.size();
184 
185  // if the old and new are not the same size, we want to report a problem
186  if (nObjects != nOldObjects) {
187  std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl;
188  }
189 
190  for (unsigned int i = 0; i < nObjects; ++i) {
191  unsigned int j = 0;
192  // see if the name is already in the old container up to the point where
193  // we may have added new entries in the container
194  const std::string& name = newMEtoEDMObject[i].name;
195  if (i < nOldObjects && (MEtoEdmObject[i].name == name)) {
196  j = i;
197  } else {
198  j = 0;
199  while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j;
200  }
201  if (j >= nOldObjects) {
202  // this value is only in the new container, not the old one
203 #if METOEDMFORMAT_DEBUG
204  std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl;
205 #endif
206  MEtoEdmObject.push_back(newMEtoEDMObject[i]);
207  }
208  }
209  return true;
210 }
const MEtoEdmObjectVector & getMEtoEdmObject() const
Definition: MEtoEDMFormat.h:68
std::vector< MEtoEDMObject > MEtoEdmObjectVector
Definition: MEtoEDMFormat.h:55
MEtoEdmObjectVector MEtoEdmObject
template<>
bool MEtoEDM< int >::mergeProduct ( const MEtoEDM< int > &  newMEtoEDM)
inline

Definition at line 214 of file MEtoEDMFormat.h.

References gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), mps_fire::i, MEtoEDM< T >::MEtoEdmObject, MEtoEDM< T >::MEtoEDMObject::name, and AlCaHLTBitMon_QueryRunRegistry::string.

215 {
216  const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject();
217  const size_t nObjects = newMEtoEDMObject.size();
218  // NOTE: we remember the present size since we will only add content
219  // from newMEtoEDMObject after this point
220  const size_t nOldObjects = MEtoEdmObject.size();
221 
222  // if the old and new are not the same size, we want to report a problem
223  if (nObjects != nOldObjects) {
224  std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl;
225  }
226 
227  for (unsigned int i = 0; i < nObjects; ++i) {
228  unsigned int j = 0;
229  // see if the name is already in the old container up to the point where
230  // we may have added new entries in the container
231  const std::string& name = newMEtoEDMObject[i].name;
232  if (i < nOldObjects && (MEtoEdmObject[i].name == name)) {
233  j = i;
234  } else {
235  j = 0;
236  while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j;
237  }
238  if (j >= nOldObjects) {
239  // this value is only in the new container, not the old one
240 #if METOEDMFORMAT_DEBUG
241  std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl;
242 #endif
243  MEtoEdmObject.push_back(newMEtoEDMObject[i]);
244  } else {
245  // this value is also in the new container: add the two
246  if ( MEtoEdmObject[j].name.find("EventInfo/processedEvents") != std::string::npos ) {
247  MEtoEdmObject[j].object += (newMEtoEDMObject[i].object);
248  }
249  if ( MEtoEdmObject[j].name.find("EventInfo/iEvent") != std::string::npos ||
250  MEtoEdmObject[j].name.find("EventInfo/iLumiSection") != std::string::npos) {
251  if (MEtoEdmObject[j].object < newMEtoEDMObject[i].object) {
252  MEtoEdmObject[j].object = (newMEtoEDMObject[i].object);
253  }
254  }
255  }
256  }
257  return true;
258 }
const MEtoEdmObjectVector & getMEtoEdmObject() const
Definition: MEtoEDMFormat.h:68
std::vector< MEtoEDMObject > MEtoEdmObjectVector
Definition: MEtoEDMFormat.h:55
MEtoEdmObjectVector MEtoEdmObject
template<>
bool MEtoEDM< long long >::mergeProduct ( const MEtoEDM< long long > &  newMEtoEDM)
inline

Definition at line 262 of file MEtoEDMFormat.h.

References gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), mps_fire::i, MEtoEDM< T >::MEtoEdmObject, MEtoEDM< T >::MEtoEDMObject::name, and AlCaHLTBitMon_QueryRunRegistry::string.

263 {
264  const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject();
265  const size_t nObjects = newMEtoEDMObject.size();
266  // NOTE: we remember the present size since we will only add content
267  // from newMEtoEDMObject after this point
268  const size_t nOldObjects = MEtoEdmObject.size();
269 
270  // if the old and new are not the same size, we want to report a problem
271  if (nObjects != nOldObjects) {
272  std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl;
273  }
274 
275  for (unsigned int i = 0; i < nObjects; ++i) {
276  unsigned int j = 0;
277  // see if the name is already in the old container up to the point where
278  // we may have added new entries in the container
279  const std::string& name = newMEtoEDMObject[i].name;
280  if (i < nOldObjects && (MEtoEdmObject[i].name == name)) {
281  j = i;
282  } else {
283  j = 0;
284  while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j;
285  }
286  if (j >= nOldObjects) {
287  // this value is only in the new container, not the old one
288 #if METOEDMFORMAT_DEBUG
289  std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl;
290 #endif
291  MEtoEdmObject.push_back(newMEtoEDMObject[i]);
292  } else {
293  // this value is also in the new container: add the two
294  if ( MEtoEdmObject[j].name.find("EventInfo/processedEvents") != std::string::npos ) {
295  MEtoEdmObject[j].object += (newMEtoEDMObject[i].object);
296  }
297  if ( MEtoEdmObject[j].name.find("EventInfo/iEvent") != std::string::npos ||
298  MEtoEdmObject[j].name.find("EventInfo/iLumiSection") != std::string::npos) {
299  if (MEtoEdmObject[j].object < newMEtoEDMObject[i].object) {
300  MEtoEdmObject[j].object = (newMEtoEDMObject[i].object);
301  }
302  }
303  }
304  }
305  return true;
306 }
const MEtoEdmObjectVector & getMEtoEdmObject() const
Definition: MEtoEDMFormat.h:68
std::vector< MEtoEDMObject > MEtoEdmObjectVector
Definition: MEtoEDMFormat.h:55
MEtoEdmObjectVector MEtoEdmObject
template<>
bool MEtoEDM< TString >::mergeProduct ( const MEtoEDM< TString > &  newMEtoEDM)
inline

Definition at line 310 of file MEtoEDMFormat.h.

References gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), mps_fire::i, MEtoEDM< T >::MEtoEdmObject, MEtoEDM< T >::MEtoEDMObject::name, and AlCaHLTBitMon_QueryRunRegistry::string.

311 {
312  const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject();
313  const size_t nObjects = newMEtoEDMObject.size();
314  // NOTE: we remember the present size since we will only add content
315  // from newMEtoEDMObject after this point
316  const size_t nOldObjects = MEtoEdmObject.size();
317 
318  // if the old and new are not the same size, we want to report a problem
319  if (nObjects != nOldObjects) {
320  std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl;
321  }
322 
323  for (unsigned int i = 0; i < nObjects; ++i) {
324  unsigned int j = 0;
325  // see if the name is already in the old container up to the point where
326  // we may have added new entries in the container
327  const std::string& name = newMEtoEDMObject[i].name;
328  if (i < nOldObjects && (MEtoEdmObject[i].name == name)) {
329  j = i;
330  } else {
331  j = 0;
332  while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j;
333  }
334  if (j >= nOldObjects) {
335  // this value is only in the new container, not the old one
336 #if METOEDMFORMAT_DEBUG
337  std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl;
338 #endif
339  MEtoEdmObject.push_back(newMEtoEDMObject[i]);
340  }
341  }
342  return true;
343 }
const MEtoEdmObjectVector & getMEtoEdmObject() const
Definition: MEtoEDMFormat.h:68
std::vector< MEtoEDMObject > MEtoEdmObjectVector
Definition: MEtoEDMFormat.h:55
MEtoEdmObjectVector MEtoEdmObject
template<class T>
void MEtoEDM< T >::putMEtoEdmObject ( const std::string &  name,
const TagList tags,
const T object 
)
inline
template<class T>
void MEtoEDM< T >::swap ( MEtoEDM< T > &  iOther)
inline

Definition at line 166 of file MEtoEDMFormat.h.

References MEtoEDM< T >::MEtoEdmObject.

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

Member Data Documentation

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