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

Member Typedef Documentation

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

Definition at line 54 of file MEtoEDMFormat.h.

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

Definition at line 45 of file MEtoEDMFormat.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file MEtoEDMFormat.h.

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

Definition at line 40 of file MEtoEDMFormat.h.

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

Definition at line 43 of file MEtoEDMFormat.h.

43 {}

Member Function Documentation

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

Definition at line 67 of file MEtoEDMFormat.h.

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

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

Definition at line 70 of file MEtoEDMFormat.h.

70  {
71  const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject();
72  const size_t nObjects = newMEtoEDMObject.size();
73  // NOTE: we remember the present size since we will only add content
74  // from newMEtoEDMObject after this point
75  const size_t nOldObjects = MEtoEdmObject.size();
76 
77  // if the old and new are not the same size, we want to report a problem
78  if (nObjects != nOldObjects) {
79  std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl;
80  }
81 
82  for (unsigned int i = 0; i < nObjects; ++i) {
83  unsigned int j = 0;
84  // see if the name is already in the old container up to the point where
85  // we may have added new entries in the container
86  const std::string& name = newMEtoEDMObject[i].name;
87  if (i < nOldObjects && (MEtoEdmObject[i].name == name)) {
88  j = i;
89  } else {
90  j = 0;
91  while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j;
92  }
93  if (j >= nOldObjects) {
94  // this value is only in the new container, not the old one
95 #if METOEDMFORMAT_DEBUG
96  std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl;
97 #endif
98  MEtoEdmObject.push_back(newMEtoEDMObject[i]);
99  } else if (MEtoEdmObject[j].object.TestBit(TH1::kCanRebin) == true && newMEtoEDMObject[i].object.TestBit(TH1::kCanRebin) == true) {
100  TList list;
101  list.Add((TObject*)&newMEtoEDMObject[i].object);
102  if (MEtoEdmObject[j].object.Merge(&list) == -1) {
103  std::cout << "ERROR MEtoEDM::mergeProducts(): merge failed for '" << name << "'" << std::endl;
104  }
105  } else {
106  // this value is also in the new container: add the two
107  if (MEtoEdmObject[j].object.GetNbinsX() == newMEtoEDMObject[i].object.GetNbinsX() &&
108  MEtoEdmObject[j].object.GetXaxis()->GetXmin() == newMEtoEDMObject[i].object.GetXaxis()->GetXmin() &&
109  MEtoEdmObject[j].object.GetXaxis()->GetXmax() == newMEtoEDMObject[i].object.GetXaxis()->GetXmax() &&
110  MEtoEdmObject[j].object.GetNbinsY() == newMEtoEDMObject[i].object.GetNbinsY() &&
111  MEtoEdmObject[j].object.GetYaxis()->GetXmin() == newMEtoEDMObject[i].object.GetYaxis()->GetXmin() &&
112  MEtoEdmObject[j].object.GetYaxis()->GetXmax() == newMEtoEDMObject[i].object.GetYaxis()->GetXmax() &&
113  MEtoEdmObject[j].object.GetNbinsZ() == newMEtoEDMObject[i].object.GetNbinsZ() &&
114  MEtoEdmObject[j].object.GetZaxis()->GetXmin() == newMEtoEDMObject[i].object.GetZaxis()->GetXmin() &&
115  MEtoEdmObject[j].object.GetZaxis()->GetXmax() == newMEtoEDMObject[i].object.GetZaxis()->GetXmax()) {
116  MEtoEdmObject[j].object.Add(&newMEtoEDMObject[i].object);
117  } else {
118  std::cout << "ERROR MEtoEDM::mergeProducts(): found histograms with different axis limits, '" << name << "' not merged" << std::endl;
119 #if METOEDMFORMAT_DEBUG
120  std::cout << MEtoEdmObject[j].name << " " << newMEtoEDMObject[i].name << std::endl;
121  std::cout << MEtoEdmObject[j].object.GetNbinsX() << " " << newMEtoEDMObject[i].object.GetNbinsX() << std::endl;
122  std::cout << MEtoEdmObject[j].object.GetXaxis()->GetXmin() << " " << newMEtoEDMObject[i].object.GetXaxis()->GetXmin() << std::endl;
123  std::cout << MEtoEdmObject[j].object.GetXaxis()->GetXmax() << " " << newMEtoEDMObject[i].object.GetXaxis()->GetXmax() << std::endl;
124  std::cout << MEtoEdmObject[j].object.GetNbinsY() << " " << newMEtoEDMObject[i].object.GetNbinsY() << std::endl;
125  std::cout << MEtoEdmObject[j].object.GetYaxis()->GetXmin() << " " << newMEtoEDMObject[i].object.GetYaxis()->GetXmin() << std::endl;
126  std::cout << MEtoEdmObject[j].object.GetYaxis()->GetXmax() << " " << newMEtoEDMObject[i].object.GetYaxis()->GetXmax() << std::endl;
127  std::cout << MEtoEdmObject[j].object.GetNbinsZ() << " " << newMEtoEDMObject[i].object.GetNbinsZ() << std::endl;
128  std::cout << MEtoEdmObject[j].object.GetZaxis()->GetXmin() << " " << newMEtoEDMObject[i].object.GetZaxis()->GetXmin() << std::endl;
129  std::cout << MEtoEdmObject[j].object.GetZaxis()->GetXmax() << " " << newMEtoEDMObject[i].object.GetZaxis()->GetXmax() << std::endl;
130 #endif
131  }
132  }
133  }
134  return true;
135  }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
const MEtoEdmObjectVector & getMEtoEdmObject() const
Definition: MEtoEDMFormat.h:67
tuple cout
Definition: gather_cfg.py:121
std::vector< MEtoEDMObject > MEtoEdmObjectVector
Definition: MEtoEDMFormat.h:54
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 56 of file MEtoEDMFormat.h.

59  {
61  MEtoEdmObject.push_back(temp);
62  MEtoEdmObject.back().name = name;
63  MEtoEdmObject.back().tags = tags;
64  MEtoEdmObject.back().object = object;
65  }
Container::value_type value_type
tuple tags
Definition: o2o.py:248
list object
Definition: dbtoconf.py:77
MEtoEdmObjectVector MEtoEdmObject
template<class T>
void MEtoEDM< T >::swap ( MEtoEDM< T > &  iOther)
inline

Definition at line 137 of file MEtoEDMFormat.h.

137  {
138  MEtoEdmObject.swap(iOther.MEtoEdmObject);
139  }
MEtoEdmObjectVector MEtoEdmObject

Member Data Documentation

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