WCSim
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WCSimRootGeom.cc
Go to the documentation of this file.
1 // Based on Root test Event.cxx
3 
4 //#include "G4ios.hh"
5 #include "TObject.h"
6 #include "TDirectory.h"
7 #include "TProcessID.h"
8 #include "TClonesArray.h"
9 
10 #include "WCSimRootGeom.hh"
11 #include "WCSimRootTools.hh"
12 
13 #include <iostream>
14 
15 #ifndef REFLEX_DICTIONARY
16 ClassImp(WCSimRootGeom)
17 ClassImp(WCSimRootPMT)
18 #endif
19 
20 //______________________________________________________________________________
22 {
23  // Create a WCSimRootGeom object.
24  fWCNumPMT = 0;
25  fPMTArray = 0;
26  fPMTArray = new TClonesArray("WCSimRootPMT", 500);
27 
28 }
29 //______________________________________________________________________________
31  : TObject()
32 {
35  fgeo_type = in.GetGeo_Type();
37  fWCNumPMT = in.GetWCNumPMT();
40  for(int i = 0; i < 3; i++)
41  fWCOffset[i] = in.GetWCOffset(i);
43  //fill the TClonesArray
44  fPMTArray = new TClonesArray("WCSimRootPMT", fWCNumPMT);
45  for(int i = 0; i < fWCNumPMT; i++)
46  new((*fPMTArray)[i]) WCSimRootPMT(*(in.GetPMTPtr(i)));
47 }
48 //______________________________________________________________________________
50 {
51  fPMTArray->Delete();
52  delete fPMTArray;
53 }
54 //______________________________________________________________________________
56 {
57  bool failed = false;
58  failed = (!ComparisonPassed(fWCCylRadius, c->GetWCCylRadius(), typeid(*this).name(), __func__, "WCCylRadius")) || failed;
59  failed = (!ComparisonPassed(fWCCylLength, c->GetWCCylLength(), typeid(*this).name(), __func__, "WCCylLength")) || failed;
60  failed = (!ComparisonPassed(fgeo_type, c->GetGeo_Type(), typeid(*this).name(), __func__, "Geo_Type")) || failed;
61  failed = (!ComparisonPassed(fWCPMTRadius, c->GetWCPMTRadius(), typeid(*this).name(), __func__, "WCPMTRadius")) || failed;
62  failed = (!ComparisonPassed(fWCNumPMT, c->GetWCNumPMT(), typeid(*this).name(), __func__, "WCNumPMT")) || failed;
63  for(int i = 0; i < 3; i++) {
64  failed = (!ComparisonPassed(fWCOffset[i], c->GetWCOffset(i), typeid(*this).name(), __func__, TString::Format("WCOffset[%d]", i))) || failed;
65  }//i
66  failed = (!ComparisonPassed(fOrientation, c->GetOrientation(), typeid(*this).name(), __func__, "Orientation")) || failed;
67  for(int i = 0; i < TMath::Min(fWCNumPMT, c->GetWCNumPMT()); i++) {
68  failed = !(this->GetPMTPtr(i)->CompareAllVariables(c->GetPMTPtr(i))) || failed;
69  }
70 
71  return !failed;
72 }
73 //______________________________________________________________________________
75 {
76  // Create a WCSimRootPMT object.
77 }
78 //______________________________________________________________________________
80 {
81  fTubeNo = in.GetTubeNo();
82  fCylLoc = in.GetCylLoc();
83  for(int i = 0; i < 3; i++) {
84  fOrientation[i] = in.GetOrientation(i);
85  fPosition [i] = in.GetPosition(i);
86  }//i
87 }
88 //______________________________________________________________________________
89 WCSimRootPMT::WCSimRootPMT(Int_t tubeNo, Int_t cylLoc, Double_t orientation[3], Double_t position[3])
90 {
91  fTubeNo = tubeNo;
92  fCylLoc = cylLoc;
93  int j = 0;
94  for(j = 0; j < 3; j++) {
95  fOrientation[j] = orientation[j];
96  fPosition[j] = position[j];
97  }
98  // fOrientation = *(orientation);
99  // fPositoin = *(position);
100  // Create a WCSimRootPMT object.
101 }
102 
103 //______________________________________________________________________________
104 void WCSimRootGeom::SetPMT(Int_t i, Int_t tubeno, Int_t cyl_loc,
105  Double_t rot[3], Double_t pos[3], bool expand)
106 {
107  if(expand) (*(fPMTArray)).ExpandCreate(i+2);
108 
109  // Set PMT values
110 TClonesArray &pmtArray = *fPMTArray;
111  WCSimRootPMT *jPMT = new(pmtArray[i]) WCSimRootPMT(tubeno, cyl_loc, rot, pos);
112  //WCSimRootPMT jPMT = *(WCSimRootPMT*)(*fPMTArray)[i];
113  // jPMT.SetTubeNo(tubeno);
114  // jPMT.SetCylLoc(cyl_loc);
115  // int j;
116  // for (j=0;j<3;j++){
117  // jPMT.SetOrientation(j,rot[j]);
118  // jPMT.SetPosition(j,pos[j]);
119  // }
120 
121 }
122 
123 //______________________________________________________________________________
125 {
126 }
127 
128 //______________________________________________________________________________
130 {
131  bool failed = false;
132  failed = (!ComparisonPassed(fTubeNo, c->GetTubeNo(), typeid(*this).name(), __func__, "TubeNo")) || failed;
133  failed = (!ComparisonPassed(fCylLoc, c->GetCylLoc(), typeid(*this).name(), __func__, "CylLoc")) || failed;
134  for(int i = 0; i < 3; i++) {
135  failed = (!ComparisonPassed(fOrientation[i], c->GetOrientation(i), typeid(*this).name(), __func__, TString::Format("Orientation[%d]", i))) || failed;
136  failed = (!ComparisonPassed(fPosition[i], c->GetPosition(i), typeid(*this).name(), __func__, TString::Format("Position[%d]", i))) || failed;
137  }//i
138  return !failed;
139 }
Float_t GetPosition(Int_t i=0) const
Float_t GetWCOffset(Int_t i) const
Int_t GetWCNumPMT() const
Int_t GetTubeNo() const
Float_t fWCPMTRadius
Int_t GetGeo_Type() const
Float_t GetOrientation(Int_t i=0) const
bool ComparisonPassed(int val1, int val2, const char *callerclass, const char *callerfunc, const char *tag)
const WCSimRootPMT * GetPMTPtr(Int_t i) const
Float_t GetWCPMTRadius() const
Int_t GetCylLoc() const
virtual ~WCSimRootGeom()
Float_t GetODWCPMTRadius() const
Float_t fWCCylRadius
bool CompareAllVariables(const WCSimRootGeom *c) const
Float_t fPosition[3]
bool CompareAllVariables(const WCSimRootPMT *c) const
Float_t GetWCCylRadius() const
Int_t GetODWCNumPMT() const
Int_t GetOrientation() const
Float_t GetWCCylLength() const
void SetPMT(Int_t i, Int_t tubeno, Int_t cyl_loc, Double_t rot[3], Double_t pos[3], bool expand=true)
Float_t fWCOffset[3]
Float_t fWCCylLength
virtual ~WCSimRootPMT()
Float_t fODWCPMTRadius
Float_t fOrientation[3]
TClonesArray * fPMTArray