ROOTANA
TDataContainer.cxx
Go to the documentation of this file.
1 #include "TDataContainer.hxx"
2 
3 #include <exception>
4 
5 
7 
8  fMidasEventPointer = new TMidasEvent(dataContainer.GetMidasData());
10 
11 }
12 
14 
16  delete fMidasEventPointer;
17 
18  for(unsigned int i = 0; i < fEventDataList.size(); i++){
19  delete fEventDataList[i];
20  }
21 
22 }
23 
24 
25 // Define exception for reset the pointer to MidasEvent when we still own the pointer for
26 // the previous one.
27 class TDataContainerBadPointerReset : public std::exception
28 {
29  virtual const char* what() const throw(){
30  return "TDataContainer Exception: trying to reset MidasEventPointer without deleting old memory";
31  }
32 };
33 
34 // Define exception for trying to access MidasEvent when it doesn't exist.
35 class TDataContainerNoValidMidasEvent : public std::exception
36 {
37  virtual const char* what() const throw(){
38  return "TDataContainer Exception: physics event does not have a valid midas event pointer";
39  }
40 };
41 
42 
44 
45  for(unsigned int i = 0; i < fEventDataList.size(); i++){
46  delete fEventDataList[i];
47  }
48  fEventDataList.clear();
49 }
50 
51 
53 
54  // If the MidasPointer is still valid and we own the memory associated with it,
55  // then we shouldn't be reseting the fMidasEventPointer.
58  }
59 
60  fMidasEventPointer = &event; // ugly!
61  fOwnMidasEventMemory = false;
62 
63 }
64 
65 
67 
68  // Make sure that point is valid.
69  if(fMidasEventPointer==0){
71  }
72 
73  return *fMidasEventPointer;
74 
75 }
76 
virtual const char * what() const
TMidasEvent * fMidasEventPointer
void SetMidasEventPointer(TMidasEvent &event)
std::vector< TGenericData * > fEventDataList
bool fOwnMidasEventMemory
Do we own the memory pointed to by TMidasEvent pointer?
TMidasEvent & GetMidasData() const
Get the MIDAS data for this event, in TMidasEvent format.
virtual const char * what() const
MIDAS event.
Definition: TMidasEvent.h:22