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)
 
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

Date:
2010/09/14 09:12:54
Revision:
1.28
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>
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 71 of file MEtoEDMFormat.h.

References gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), i, j, list(), MEtoEDM< T >::MEtoEdmObject, and mergeVDriftHistosByStation::name.

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

References gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), i, j, and mergeVDriftHistosByStation::name.

150 {
151  const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject();
152  const size_t nObjects = newMEtoEDMObject.size();
153  // NOTE: we remember the present size since we will only add content
154  // from newMEtoEDMObject after this point
155  const size_t nOldObjects = MEtoEdmObject.size();
156 
157  // if the old and new are not the same size, we want to report a problem
158  if (nObjects != nOldObjects) {
159  std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl;
160  }
161 
162  for (unsigned int i = 0; i < nObjects; ++i) {
163  unsigned int j = 0;
164  // see if the name is already in the old container up to the point where
165  // we may have added new entries in the container
166  const std::string& name = newMEtoEDMObject[i].name;
167  if (i < nOldObjects && (MEtoEdmObject[i].name == name)) {
168  j = i;
169  } else {
170  j = 0;
171  while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j;
172  }
173  if (j >= nOldObjects) {
174  // this value is only in the new container, not the old one
175 #if debug
176  std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl;
177 #endif
178  MEtoEdmObject.push_back(newMEtoEDMObject[i]);
179  }
180  }
181  return true;
182 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
const MEtoEdmObjectVector & getMEtoEdmObject() const
Definition: MEtoEDMFormat.h:68
tuple cout
Definition: gather_cfg.py:121
std::vector< MEtoEDMObject > MEtoEdmObjectVector
Definition: MEtoEDMFormat.h:55
MEtoEdmObjectVector MEtoEdmObject
template<>
bool MEtoEDM< int >::mergeProduct ( const MEtoEDM< int > &  newMEtoEDM)
inline

Definition at line 186 of file MEtoEDMFormat.h.

References gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), i, j, and mergeVDriftHistosByStation::name.

187 {
188  const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject();
189  const size_t nObjects = newMEtoEDMObject.size();
190  // NOTE: we remember the present size since we will only add content
191  // from newMEtoEDMObject after this point
192  const size_t nOldObjects = MEtoEdmObject.size();
193 
194  // if the old and new are not the same size, we want to report a problem
195  if (nObjects != nOldObjects) {
196  std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl;
197  }
198 
199  for (unsigned int i = 0; i < nObjects; ++i) {
200  unsigned int j = 0;
201  // see if the name is already in the old container up to the point where
202  // we may have added new entries in the container
203  const std::string& name = newMEtoEDMObject[i].name;
204  if (i < nOldObjects && (MEtoEdmObject[i].name == name)) {
205  j = i;
206  } else {
207  j = 0;
208  while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j;
209  }
210  if (j >= nOldObjects) {
211  // this value is only in the new container, not the old one
212 #if debug
213  std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl;
214 #endif
215  MEtoEdmObject.push_back(newMEtoEDMObject[i]);
216  } else {
217  // this value is also in the new container: add the two
218  if ( MEtoEdmObject[j].name.find("EventInfo/processedEvents") != std::string::npos ) {
219  MEtoEdmObject[j].object += (newMEtoEDMObject[i].object);
220  }
221  if ( MEtoEdmObject[j].name.find("EventInfo/iEvent") != std::string::npos ||
222  MEtoEdmObject[j].name.find("EventInfo/iLumiSection") != std::string::npos) {
223  if (MEtoEdmObject[j].object < newMEtoEDMObject[i].object) {
224  MEtoEdmObject[j].object = (newMEtoEDMObject[i].object);
225  }
226  }
227  }
228  }
229  return true;
230 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
const MEtoEdmObjectVector & getMEtoEdmObject() const
Definition: MEtoEDMFormat.h:68
tuple cout
Definition: gather_cfg.py:121
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 234 of file MEtoEDMFormat.h.

References gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), i, j, and mergeVDriftHistosByStation::name.

235 {
236  const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject();
237  const size_t nObjects = newMEtoEDMObject.size();
238  // NOTE: we remember the present size since we will only add content
239  // from newMEtoEDMObject after this point
240  const size_t nOldObjects = MEtoEdmObject.size();
241 
242  // if the old and new are not the same size, we want to report a problem
243  if (nObjects != nOldObjects) {
244  std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl;
245  }
246 
247  for (unsigned int i = 0; i < nObjects; ++i) {
248  unsigned int j = 0;
249  // see if the name is already in the old container up to the point where
250  // we may have added new entries in the container
251  const std::string& name = newMEtoEDMObject[i].name;
252  if (i < nOldObjects && (MEtoEdmObject[i].name == name)) {
253  j = i;
254  } else {
255  j = 0;
256  while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j;
257  }
258  if (j >= nOldObjects) {
259  // this value is only in the new container, not the old one
260 #if debug
261  std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl;
262 #endif
263  MEtoEdmObject.push_back(newMEtoEDMObject[i]);
264  } else {
265  // this value is also in the new container: add the two
266  if ( MEtoEdmObject[j].name.find("EventInfo/processedEvents") != std::string::npos ) {
267  MEtoEdmObject[j].object += (newMEtoEDMObject[i].object);
268  }
269  if ( MEtoEdmObject[j].name.find("EventInfo/iEvent") != std::string::npos ||
270  MEtoEdmObject[j].name.find("EventInfo/iLumiSection") != std::string::npos) {
271  if (MEtoEdmObject[j].object < newMEtoEDMObject[i].object) {
272  MEtoEdmObject[j].object = (newMEtoEDMObject[i].object);
273  }
274  }
275  }
276  }
277  return true;
278 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
const MEtoEdmObjectVector & getMEtoEdmObject() const
Definition: MEtoEDMFormat.h:68
tuple cout
Definition: gather_cfg.py:121
std::vector< MEtoEDMObject > MEtoEdmObjectVector
Definition: MEtoEDMFormat.h:55
MEtoEdmObjectVector MEtoEdmObject
template<>
bool MEtoEDM< TString >::mergeProduct ( const MEtoEDM< TString > &  newMEtoEDM)
inline

Definition at line 282 of file MEtoEDMFormat.h.

References gather_cfg::cout, MEtoEDM< T >::getMEtoEdmObject(), i, j, and mergeVDriftHistosByStation::name.

283 {
284  const MEtoEdmObjectVector &newMEtoEDMObject = newMEtoEDM.getMEtoEdmObject();
285  const size_t nObjects = newMEtoEDMObject.size();
286  // NOTE: we remember the present size since we will only add content
287  // from newMEtoEDMObject after this point
288  const size_t nOldObjects = MEtoEdmObject.size();
289 
290  // if the old and new are not the same size, we want to report a problem
291  if (nObjects != nOldObjects) {
292  std::cout << "WARNING MEtoEDM::mergeProducts(): the lists of histograms to be merged have different sizes: new=" << nObjects << ", old=" << nOldObjects << std::endl;
293  }
294 
295  for (unsigned int i = 0; i < nObjects; ++i) {
296  unsigned int j = 0;
297  // see if the name is already in the old container up to the point where
298  // we may have added new entries in the container
299  const std::string& name = newMEtoEDMObject[i].name;
300  if (i < nOldObjects && (MEtoEdmObject[i].name == name)) {
301  j = i;
302  } else {
303  j = 0;
304  while (j < nOldObjects && (MEtoEdmObject[j].name != name) ) ++j;
305  }
306  if (j >= nOldObjects) {
307  // this value is only in the new container, not the old one
308 #if debug
309  std::cout << "WARNING MEtoEDM::mergeProducts(): adding new histogram '" << name << "'" << std::endl;
310 #endif
311  MEtoEdmObject.push_back(newMEtoEDMObject[i]);
312  }
313  }
314  return true;
315 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
const MEtoEdmObjectVector & getMEtoEdmObject() const
Definition: MEtoEDMFormat.h:68
tuple cout
Definition: gather_cfg.py:121
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

Definition at line 57 of file MEtoEDMFormat.h.

References MEtoEDM< T >::MEtoEdmObject, mergeVDriftHistosByStation::name, dbtoconf::object, o2o::tags, and groupFilesInBlocks::temp.

60  {
62  MEtoEdmObject.push_back(temp);
63  MEtoEdmObject.back().name = name;
64  MEtoEdmObject.back().tags = tags;
65  MEtoEdmObject.back().object = object;
66  }
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 138 of file MEtoEDMFormat.h.

References MEtoEDM< T >::MEtoEdmObject.

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

Member Data Documentation

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