FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
PndRadMapBoxMesh Class Reference

#include <PndRadMapBoxMesh.h>

Public Member Functions

 PndRadMapBoxMesh ()
 
 PndRadMapBoxMesh (PndRadMapBoxMesh &m)
 
 PndRadMapBoxMesh (const char *Name, int Xbins, Double_t Xlow, Double_t Xhigh, int Ybins, Double_t Ylow, Double_t Yhigh, int Zbins, Double_t Zlow, Double_t Zhigh)
 
 PndRadMapBoxMesh (const char *name, int xbins, Double_t xlow, Double_t xhigh, int ybins, Double_t ylow, Double_t yhigh, Double_t zlow, Double_t zhigh, orientation plane=ZX, quantity Quantity=Edep)
 
 ~PndRadMapBoxMesh ()
 
void SetFilter (const char *filter)
 
void SetQuantity (quantity Quantity=Edep)
 
void SetOrientation (orientation plane, Double_t rotate=99999, axis Ax=Xx)
 
void SetOrientation (Double_t rotate=99999, axis Ax=Xx)
 
void SetVerbosityLevel (int verbose=0)
 
void Fill (FairRadMapPoint *p)
 
void Transform (Double_t X, Double_t Y, Double_t Z)
 
void Transform (Double_t X, Double_t Y, Double_t Z, Double_t &X0, Double_t &Y0, Double_t &Z0)
 
void Transform (TVector3 InV, TVector3 &OutV)
 
void Scale (Double_t sca)
 
void Save (TFile *fout)
 
void Save ()
 
TH2D * GetHisto ()
 
PndRadMapPlaneGetPlane ()
 
Double_t CalcFluence (FairRadMapPoint *p)
 

Protected Member Functions

bool IsInside (Double_t X, Double_t Y, Double_t Z)
 
bool IsInside (FairRadMapPoint *p)
 
bool IsInside ()
 
void Fill (Int_t gBin, Double_t val)
 
void Fill (Double_t X, Double_t Y, Double_t Z, Double_t we=1)
 
void makeHisto (const char *Orient, Double_t rotate, int Hbins, Double_t Hlow, Double_t Hhigh, int Vbins, Double_t Vlow, Double_t Vhigh, Double_t dlow)
 

Protected Attributes

TH2D * _MeshHisto
 
TH2I * _StatHisto
 
TH2D * _EnergyHisto
 
TString _Name
 
orientation _orientation
 
Double_t _rotate
 
axis _axis
 
Double_t _volume
 
quantity _quantity
 
int _Xbins
 
Double_t _Xlow
 
Double_t _Xhigh
 
int _Ybins
 
Double_t _Ylow
 
Double_t _Yhigh
 
int _Zbins
 
Double_t _Zlow
 
Double_t _Zhigh
 
Double_t _X
 
Double_t _Y
 
Double_t _Z
 
Double_t _tX
 
Double_t _tY
 
Double_t _tZ
 
TFormula _filter
 
int _verbose
 
PndRadMapPlane_plane
 
TVector3 InterSection
 

Private Attributes

bool _isSurfaceQuantity
 
TDatabasePDG * pdg
 
TParticlePDG * pdgpart
 

Detailed Description

Definition at line 50 of file PndRadMapBoxMesh.h.

Constructor & Destructor Documentation

PndRadMapBoxMesh::PndRadMapBoxMesh ( )
PndRadMapBoxMesh::PndRadMapBoxMesh ( PndRadMapBoxMesh m)

Definition at line 87 of file PndRadMapBoxMesh.cxx.

References _isSurfaceQuantity, _MeshHisto, _Name, _orientation, _plane, _rotate, _StatHisto, _volume, and pdg.

87  {
88  _MeshHisto = (TH2D*)m._MeshHisto->Clone();
89  _StatHisto = (TH2I*)m._StatHisto->Clone();
91  _rotate = m._rotate;
92  _volume = m._volume;
93  _Name = m._Name;
94  _plane = NULL;
95  _isSurfaceQuantity = false;
96  pdg = TDatabasePDG::Instance();
97  pdg -> ReadPDGTable();
98 }
orientation _orientation
PndRadMapPlane * _plane
TDatabasePDG * pdg
PndRadMapBoxMesh::PndRadMapBoxMesh ( const char *  Name,
int  Xbins,
Double_t  Xlow,
Double_t  Xhigh,
int  Ybins,
Double_t  Ylow,
Double_t  Yhigh,
int  Zbins,
Double_t  Zlow,
Double_t  Zhigh 
)

Definition at line 101 of file PndRadMapBoxMesh.cxx.

References _filter, _isSurfaceQuantity, _Name, _verbose, _Xbins, _Xhigh, _Xlow, _Ybins, _Yhigh, _Ylow, _Zbins, _Zhigh, _Zlow, pdg, and TString.

104  {//in cm!!!!
105  _verbose = 0;
106  _Name = TString(name);
107  _Xbins = Xbins; _Xlow = Xlow; _Xhigh = Xhigh;
108  _Ybins = Ybins; _Ylow = Ylow; _Yhigh = Yhigh;
109  _Zbins = Zbins; _Zlow = Zlow; _Zhigh = Zhigh;
110  _filter = TFormula("formula", "1");
111 
112  if((_Xlow == _Xhigh) ||
113  (_Ylow == _Yhigh) ||
114  (_Zlow == _Zhigh))
115  _isSurfaceQuantity = true;
116  pdg = TDatabasePDG::Instance();
117  pdg -> ReadPDGTable();
118 
119  // if(_verbose)
120  std::cout << "PndRadMapBoxMesh::PndRadMapBoxMesh()\n"
121  << _Xlow << ' ' << _Xhigh << ' '
122  << _Ylow << ' ' << _Yhigh << ' '
123  << _Zlow << ' ' << _Zhigh << ' '
124  << _isSurfaceQuantity << std::endl;
125 
126 }
TString name
TDatabasePDG * pdg
PndRadMapBoxMesh::PndRadMapBoxMesh ( const char *  name,
int  xbins,
Double_t  xlow,
Double_t  xhigh,
int  ybins,
Double_t  ylow,
Double_t  yhigh,
Double_t  zlow,
Double_t  zhigh,
orientation  plane = ZX,
quantity  Quantity = Edep 
)

Definition at line 128 of file PndRadMapBoxMesh.cxx.

References _isSurfaceQuantity, _Name, _orientation, _verbose, _Xbins, _Xhigh, _Xlow, _Ybins, _Yhigh, _Ylow, _Zbins, _Zhigh, _Zlow, pdg, SetQuantity(), TString, XY, XZ, YX, YZ, ZX, and ZY.

133  {//in cm!!!!
134 
135  _verbose = 0;
136 
137  _Name = TString(name);
138 
139  _orientation = plane;
140  SetQuantity(Quantity);
141 
142  switch (_orientation){
143  case XY:
144  _Xbins = xbins;
145  _Xlow = xlow;
146  _Xhigh = xhigh;
147 
148  _Ybins = ybins;
149  _Ylow = ylow;
150  _Yhigh = yhigh;
151 
152  _Zlow = zlow;
153  _Zhigh = zhigh;
154  break;
155  case YX:
156  _Xbins = ybins;
157  _Xlow = ylow;
158  _Xhigh = yhigh;
159 
160  _Ybins = xbins;
161  _Ylow = xlow;
162  _Yhigh = xhigh;
163 
164  _Zlow = zlow;
165  _Zhigh = zhigh;
166  break;
167 
168  case XZ:
169  _Xbins = xbins;
170  _Xlow = xlow;
171  _Xhigh = xhigh;
172 
173  _Ylow = zlow;
174  _Yhigh = zhigh;
175 
176  _Zbins = ybins;
177  _Zlow = ylow;
178  _Zhigh = yhigh;
179  break;
180  case ZX:
181  _Xbins = ybins;
182  _Xlow = ylow;
183  _Xhigh = yhigh;
184 
185  _Zbins = xbins;
186  _Zlow = xlow;
187  _Zhigh = xhigh;
188 
189  _Ylow = zlow;
190  _Yhigh = zhigh;
191  break;
192 
193  case YZ:
194  _Xlow = zlow;
195  _Xhigh = zhigh;
196 
197  _Ybins = xbins;
198  _Ylow = xlow;
199  _Yhigh = xhigh;
200 
201  _Zbins = ybins;
202  _Zlow = ylow;
203  _Zhigh = yhigh;
204  break;
205  case ZY:
206  _Xlow = zlow;
207  _Xhigh = zhigh;
208 
209  _Ybins = ybins;
210  _Ylow = ylow;
211  _Yhigh = yhigh;
212 
213  _Zbins = xbins;
214  _Zlow = xlow;
215  _Zhigh = xhigh;
216  break;
217  };
218 
219  if((_Xlow == _Xhigh) ||
220  (_Ylow == _Yhigh) ||
221  (_Zlow == _Zhigh))
222  _isSurfaceQuantity = true;
223 
224  pdg = TDatabasePDG::Instance();
225  pdg -> ReadPDGTable();
226 }
orientation _orientation
void SetQuantity(quantity Quantity=Edep)
TString name
TDatabasePDG * pdg
PndRadMapBoxMesh::~PndRadMapBoxMesh ( )

Definition at line 228 of file PndRadMapBoxMesh.cxx.

References _MeshHisto, _StatHisto, and _verbose.

228  {
229  if(_verbose)
230  std::cout << "PndRadMapBoxMesh::~PndRadMapBoxMesh()\n";
231  delete _StatHisto;
232  delete _MeshHisto;
233 }

Member Function Documentation

Double_t PndRadMapBoxMesh::CalcFluence ( FairRadMapPoint *  p)

Definition at line 834 of file PndRadMapBoxMesh.cxx.

References _MeshHisto, _orientation, _StatHisto, _verbose, _Xhigh, _Xlow, _Yhigh, _Ylow, _Zhigh, _Zlow, counter, Double_t, dx, dy, dz, IsInside(), PndRadMapPlane::LineIntersection(), momentumfilter(), Transform(), verbose, X, XY, XZ, Y, YX, YZ, Z, ZX, and ZY.

834  {
835 
836  if(_verbose)
837  std::cout << "PndRadMapBoxMesh::CalcFluence(FairRadMapPoint *p)" << std::endl;
838 
839  Double_t xx, yy, zz, dx = 0, dy = 0, dz =0;
840  // float eff;
841  std::vector<Corner> CV;
842  std::vector<PndRadMapPlane> PV;
843  //The Z should be between zlow and zhigh!!
844  Transform(p->GetXOut(), p->GetYOut(), p->GetZOut(),
845  xx, yy, zz);
846  std::pair<int, double> minp;
847  bool OK= false, OK2= false;
848 
849  if(IsInside(p)){
850  if(IsInside(xx, yy, zz)) OK = true;
851  switch (_orientation){
852  case XY: case YX:
853  dz = _Zlow;
854  break;
855  case XZ: case ZX:
856  dy = _Ylow;
857  break;
858  case ZY: case YZ:
859  dx = _Xlow;
860  break;
861  }
862 
863  TVector3 poststepv = TVector3(p->GetXOut(), p->GetYOut(), p->GetZOut());
864  TVector3 prestepv = TVector3(p->GetX(), p->GetY(), p->GetZ());
865  unsigned int prebin = _MeshHisto->FindBin(prestepv.X(),
866  prestepv.Y());
867  unsigned int postbin = _MeshHisto->FindBin(poststepv.X(),
868  poststepv.Y());
869  PndRadMapPlane plane;
870  int prebinX = 0, prebinY = 0, prebinZ = 0;
871  int postbinX = 0, postbinY = 0, postbinZ = 0;
872  _MeshHisto->GetBinXYZ(postbin, postbinX, postbinY, postbinZ);
873  _MeshHisto->GetBinXYZ(prebin, prebinX, prebinY, prebinZ);
874  TVector3 tn(0, 0, 0);
875 
876  if(verbose) std::cout << "PndRadMapBoxMesh::CalcFluence - 1" << std::endl;
877 
878  // 1, only two planes: the narrowest bin lower and higher plane
879  // 2, if the resulting two points in the range of the other two axis-limits
880  // 3, start the stepping from one of those points
881 
882  // -------- 1 -------
883 
884  TVector3 isl, lbeg, lend;
885  double min_x, min_y, min_z, max_x, max_y, max_z;
886 
887  if(!OK){//if the 'out' is not in the given range
888  //the 'in' and the 'out' is outside of the given range, so it can be that it will cross it
889 
890  if(verbose) std::cout << "PndRadMapBoxMesh::CalcFluence - 2" << std::endl;
891  OK2 = false;
892  min_x = _Xlow;
893  min_y = _Ylow;
894  min_z = _Zlow;
895 
896  max_x = _Xhigh;
897  max_y = _Yhigh;
898  max_z = _Zhigh;
899  if(verbose) std::cout << "min_z: " << min_z << ' ' << max_z << ' ' << dz << std::endl;
900 
901  //the 'front' and 'back' XY planes
902  plane = PndRadMapPlane(TVector3(min_x+dx, min_y+dy, min_z+dz),
903  TVector3(max_x+dx, min_y+dy, min_z+dz),
904  TVector3(min_x+dx, max_y+dy, min_z+dz));//XY @ z=z_min
905  isl = plane.LineIntersection(prestepv, poststepv);
906  if(((min_x < isl.X()) && (isl.X() < max_x)) &&
907  ((min_y < isl.Y()) && (isl.Y() < max_y))){
908  OK2 = true;
909  }
910  if(verbose){
911  std::cout << "Xcross1: " << min_x << ' ' << isl.X() << ' ' << max_x << std::endl;
912  std::cout << "Ycross1: " << min_y << ' ' << isl.Y() << ' ' << max_y << std::endl;
913  std::cout << "=> " << OK2 << std::endl;
914  }
915  lbeg = isl;
916 
917  plane = PndRadMapPlane(TVector3(min_x+dx, min_y+dy, max_z+dz),
918  TVector3(max_x+dx, min_y+dy, max_z+dz),
919  TVector3(min_x+dx, max_y+dy, max_z+dz));//XY @ z-z_max
920  isl = plane.LineIntersection(prestepv, poststepv);
921  if(((min_x < isl.X()) && (isl.X() < max_x)) &&
922  ((min_y < isl.Y()) && (isl.Y() < max_y))){
923  OK2 = OK2 && true;
924  }
925  if(verbose){
926  std::cout << "Xcross2: " << min_x << ' ' << isl.X() << ' ' << max_x << std::endl;
927  std::cout << "Ycross2: " << min_y << ' ' << isl.Y() << ' ' << max_y << std::endl;
928  std::cout << "=> " << OK2 << std::endl;
929  }
930  lend = isl;
931 
932  if(OK2){//the intersections are on the XY planes withing boarders at both z_min and z_max
933  if(verbose) std::cout << "PndRadMapBoxMesh::CalcFluence - 3" << std::endl;
934  prestepv = lbeg;
935  poststepv = lend;
936  prebin = _MeshHisto->FindBin(prestepv.X(),
937  prestepv.Y());
938  postbin = _MeshHisto->FindBin(poststepv.X(),
939  poststepv.Y());
940  _MeshHisto->GetBinXYZ(prebin, prebinX, prebinY, prebinZ);
941  _MeshHisto->GetBinXYZ(postbin, postbinX, postbinY, postbinZ);
942  }else{
943  if(verbose) std::cout << "PndRadMapBoxMesh::CalcFluence - 4" << std::endl;
944  }
945  }else{
946  // if(prebin != postbin){
947  int counter = 0;
948  while((prebin != postbin) && !tn.Z()){
949  counter++;
950  PV.clear();
951 
952  // max
953  // /---/ y|
954  // /---/| | /z
955  // || || | /
956  // |/--|/ | /
957  // ----- |/
958  // min +----------
959  // x
960 
961 
962  // . corner1 corner2 corner3
963  //plane1 [(min, min, min), (min, min, max), (max, min, min)] ZX
964  //plane2 [(min, min, min), (max, min, min), (min, max, min)] XY
965  //plane3 [(min, min, min), (min, min, max), (min, max, min)] ZY
966 
967  //plane4 [(min, max, min), (min, max, max), (max, max, min)] ZX
968  //plane5 [(min, min, max), (max, min, max), (min, max, max)] XY
969  //plane6 [(max, min, min), (max, min, max), (max, max, min)] ZY
970 
971 
972  // //plane4 [(max, max, max), (max, max, min), (min, max, max)] XZ
973  // //plane5 [(max, max, max), (min, max, max), (max, min, max)]
974  // //plane6 [(max, max, max), (max, max, min), (max, min, max)]
975 
976 
977  min_x = (_MeshHisto->GetXaxis()->GetBinLowEdge(prebinX) < 0) ? 0 : _MeshHisto->GetXaxis()->GetBinLowEdge(prebinX);
978  min_y = (_MeshHisto->GetYaxis()->GetBinLowEdge(prebinY) < 0) ? 0 : _MeshHisto->GetYaxis()->GetBinLowEdge(prebinY);
979  min_z = (_MeshHisto->GetZaxis()->GetBinLowEdge(prebinZ) < 0) ? 0 : _MeshHisto->GetZaxis()->GetBinLowEdge(prebinZ);
980 
981  max_x = (_MeshHisto->GetXaxis()->GetBinUpEdge(prebinX) < 0) ? 0 : _MeshHisto->GetXaxis()->GetBinUpEdge(prebinX);
982  max_y = (_MeshHisto->GetYaxis()->GetBinUpEdge(prebinY) < 0) ? 0 : _MeshHisto->GetYaxis()->GetBinUpEdge(prebinY);
983  max_z = (_MeshHisto->GetZaxis()->GetBinUpEdge(prebinZ) < 0) ? 0 : _MeshHisto->GetZaxis()->GetBinUpEdge(prebinZ);
984  max_z += _MeshHisto->GetZaxis()->GetBinWidth(1);
985 
986  if(verbose){
987  std::cout << counter << " - Corners [[" << min_x << ", " << min_y << ", " << min_z << "] - ";
988  std::cout << "[" << max_x << ", " << max_y << ", " << max_z << "]]\n";
989  }
990 
991  //plane1
992  plane = PndRadMapPlane(TVector3(min_x+dx, min_y+dy, min_z+dz),
993  TVector3(min_x+dx, min_y+dy, max_z+dz),
994  TVector3(max_x+dx, min_y+dy, min_z+dz));
995  PV.push_back(plane);
996  //plane2
997  plane = PndRadMapPlane(TVector3(min_x+dx, min_y+dy, min_z+dz),
998  TVector3(max_x+dx, min_y+dy, min_z+dz),
999  TVector3(min_x+dx, max_y+dy, min_z+dz));
1000  PV.push_back(plane);
1001  //plane3
1002  plane = PndRadMapPlane(TVector3(min_x+dx, min_y+dy, min_z+dz),
1003  TVector3(min_x+dx, min_y+dy, max_z+dz),
1004  TVector3(min_x+dx, max_y+dy, min_z+dz));
1005  PV.push_back(plane);
1006  //plane4
1007  plane = PndRadMapPlane(TVector3(min_x+dx, max_y+dy, min_z+dz),
1008  TVector3(min_x+dx, max_y+dy, max_z+dz),
1009  TVector3(max_x+dx, max_y+dy, min_z+dz));
1010  PV.push_back(plane);
1011  //plane5
1012  plane = PndRadMapPlane(TVector3(min_x+dx, min_y+dy, max_z+dz),
1013  TVector3(max_x+dx, min_y+dy, max_z+dz),
1014  TVector3(min_x+dx, max_y+dy, max_z+dz));
1015  PV.push_back(plane);
1016  //plane6
1017  plane = PndRadMapPlane(TVector3(max_x+dx, min_y+dy, min_z+dz),
1018  TVector3(max_x+dx, min_y+dy, max_z+dz),
1019  TVector3(max_x+dx, max_y+dy, min_z+dz));
1020  PV.push_back(plane);
1021 
1022  if(verbose)
1023  std::cout << "Start\n["
1024  << prebin << " {" << prestepv.X() << ' ' << prestepv.Y() << ' ' << prestepv.Z() << "}("
1025  << prebinX << ' ' << prebinY << ' ' << prebinZ << ")\n"
1026  << ' ' << postbin << " {" << poststepv.X() << ' ' << poststepv.Y() << ' ' << poststepv.Z() << "}("
1027  << postbinX << ' ' << postbinY << ' ' << postbinZ << ")]\n\n";
1028 
1029  minp = std::make_pair(-1, 111111);//(which plane, what is the disrance)
1030 
1031  //calculate the intersection with every each planes
1032  isl = PV.at(0).LineIntersection(prestepv, poststepv);
1033  if(momentumfilter(TVector3(p->GetPx(), p->GetPy(), p->GetPz()), (isl-prestepv)))
1034  if(minp.second > (isl-prestepv).Mag())
1035  minp = std::make_pair(0, (isl-prestepv).Mag());
1036  if(verbose)
1037  std::cout << "XZ (" << (isl).X() << ", " << (isl).Y() << ", " << (isl).Z() << ") "
1038  << (poststepv-prestepv).Mag() << ", "
1039  << "(" << (isl-prestepv).X() << ", " << (isl-prestepv).Y() << ", " << (isl-prestepv).Z() << ") "
1040  << (isl-prestepv).Mag() << ' '
1041  << momentumfilter(TVector3(p->GetPx(), p->GetPy(), p->GetPz()), (isl-prestepv)) << ' '
1042  << (minp.second > (isl-prestepv).Mag()) << ' '
1043  << "[" << minp.first << ", " << minp.second << std::endl;
1044 
1045  if(!OK2){ //FIXME: OK2 was not set before!
1046 
1047  isl = PV.at(1).LineIntersection(prestepv, poststepv);
1048  if(momentumfilter(TVector3(p->GetPx(), p->GetPy(), p->GetPz()), (isl-prestepv)))
1049  if(minp.second > (isl-prestepv).Mag())
1050  minp = std::make_pair(1, (isl-prestepv).Mag());
1051  if(verbose)
1052  std::cout << "XY (" << (isl).X() << ", " << (isl).Y() << ", " << (isl).Z() << ") "
1053  << (poststepv-prestepv).Mag() << ", "
1054  << "(" << (isl-prestepv).X() << ", " << (isl-prestepv).Y() << ", " << (isl-prestepv).Z() << ") "
1055  << (isl-prestepv).Mag() << ' '
1056  << momentumfilter(TVector3(p->GetPx(), p->GetPy(), p->GetPz()), (isl-prestepv)) << ' '
1057  << (minp.second > (isl-prestepv).Mag()) << ' '
1058  << "[" << minp.first << ", " << minp.second << "]" << std::endl;
1059  }
1060 
1061  isl = PV.at(2).LineIntersection(prestepv, poststepv);
1062  if(momentumfilter(TVector3(p->GetPx(), p->GetPy(), p->GetPz()), (isl-prestepv)))
1063  if(minp.second > (isl-prestepv).Mag())
1064  minp = std::make_pair(2, (isl-prestepv).Mag());
1065  if(verbose)
1066  std::cout << "YZ (" << (isl).X() << ", " << (isl).Y() << ", " << (isl).Z() << ") "
1067  << (poststepv-prestepv).Mag() << ", "
1068  << "(" << (isl-prestepv).X() << ", " << (isl-prestepv).Y() << ", " << (isl-prestepv).Z() << ") "
1069  << (isl-prestepv).Mag() << ' '
1070  << momentumfilter(TVector3(p->GetPx(), p->GetPy(), p->GetPz()), (isl-prestepv)) << ' '
1071  << (minp.second > (isl-prestepv).Mag()) << ' '
1072  << "[" << minp.first << ", " << minp.second << "]" << std::endl;
1073 
1074  isl = PV.at(3).LineIntersection(prestepv, poststepv);
1075  if(momentumfilter(TVector3(p->GetPx(), p->GetPy(), p->GetPz()), (isl-prestepv)))
1076  if(minp.second > (isl-prestepv).Mag())
1077  minp = std::make_pair(3, (isl-prestepv).Mag());
1078  if(verbose)
1079  std::cout << "XZ (" << (isl).X() << ", " << (isl).Y() << ", " << (isl).Z() << ") "
1080  << (poststepv-prestepv).Mag() << ", "
1081  << "(" << (isl-prestepv).X() << ", " << (isl-prestepv).Y() << ", " << (isl-prestepv).Z() << ") "
1082  << (isl-prestepv).Mag() << ' '
1083  << momentumfilter(TVector3(p->GetPx(), p->GetPy(), p->GetPz()), (isl-prestepv)) << ' '
1084  << (minp.second > (isl-prestepv).Mag()) << ' '
1085  << "[" << minp.first << ", " << minp.second << "]" << std::endl;
1086 
1087  if(!OK2){ //FIXME: OK2 was not set before!
1088  isl = PV.at(4).LineIntersection(prestepv, poststepv);
1089  if(momentumfilter(TVector3(p->GetPx(), p->GetPy(), p->GetPz()), (isl-prestepv)))
1090  if(minp.second > (isl-prestepv).Mag())
1091  minp = std::make_pair(4, (isl-prestepv).Mag());
1092  if(verbose)
1093  std::cout << "XY (" << (isl).X() << ", " << (isl).Y() << ", " << (isl).Z() << ") "
1094  << (poststepv-prestepv).Mag() << ", "
1095  << "(" << (isl-prestepv).X() << ", " << (isl-prestepv).Y() << ", " << (isl-prestepv).Z() << ") "
1096  << (isl-prestepv).Mag() << ' '
1097  << momentumfilter(TVector3(p->GetPx(), p->GetPy(), p->GetPz()), (isl-prestepv)) << ' '
1098  << (minp.second > (isl-prestepv).Mag()) << ' '
1099  << "[" << minp.first << ", " << minp.second << "]" << std::endl;
1100  }
1101 
1102  isl = PV.at(5).LineIntersection(prestepv, poststepv);
1103  if(momentumfilter(TVector3(p->GetPx(), p->GetPy(), p->GetPz()), (isl-prestepv)))
1104  if(minp.second > (isl-prestepv).Mag())
1105  minp = std::make_pair(5, (isl-prestepv).Mag());
1106  if(verbose)
1107  std::cout << "YZ (" << (isl).X() << ", " << (isl).Y() << ", " << (isl).Z() << ") "
1108  << (poststepv-prestepv).Mag() << ", "
1109  << "(" << (isl-prestepv).X() << ", " << (isl-prestepv).Y() << ", " << (isl-prestepv).Z() << ") "
1110  << (isl-prestepv).Mag() << ' '
1111  << momentumfilter(TVector3(p->GetPx(), p->GetPy(), p->GetPz()), (isl-prestepv)) << ' '
1112  << (minp.second > (isl-prestepv).Mag()) << ' '
1113  << "[" << minp.first << ", " << minp.second << "]" << std::endl;
1114 
1115  if(verbose)
1116  std::cout << "\nmomentum: "
1117  << p->GetPx() << ' '
1118  << p->GetPy() << ' '
1119  << p->GetPz() << std::endl;
1120 
1121  //minp stores the smallest possible step
1122  if(0 <= minp.first){
1123  if(verbose){
1124  std::cout << "\nmomentum: "
1125  << p->GetPx() << ' '
1126  << p->GetPy() << ' '
1127  << p->GetPz() << std::endl;
1128  std::cout << "[(----)] " << minp.first << ' ' << minp.second << std::endl;
1129  std::cout << "normal: "
1130  << PV.at(minp.first).Normal().X() << ' '
1131  << PV.at(minp.first).Normal().Y() << ' '
1132  << PV.at(minp.first).Normal().Z() << std::endl;
1133  }
1134 
1135  isl = PV.at(minp.first).LineIntersection(prestepv, poststepv);
1136  Double_t step = (isl-prestepv).Mag();
1137  prestepv = isl;
1138 
1139  _MeshHisto->Fill(prestepv.X(), prestepv.Y(), step);
1140  _StatHisto->Fill(prestepv.X(), prestepv.Y());
1141 
1142  tn = PV.at(minp.first).Normal();
1143  float ds = 0;
1144  if(tn.X()){
1145  ds = _MeshHisto->GetXaxis()->GetBinWidth(1)/10.;
1146  if(verbose) std::cout << "Xprebin: " << prebin << " ---> ";
1147  if(p->GetPx() > 0){
1148  prebin = _MeshHisto->FindBin(isl.X() + ds,
1149  isl.Y());
1150  if(verbose) std::cout << "(" << isl.X() << " ---> " << isl.X() + ds << ' ' << p->GetPx() << " ) ";
1151  }else{
1152  prebin = _MeshHisto->FindBin(isl.X() - ds,
1153  isl.Y());
1154  if(verbose) std::cout << "(" << isl.X() << " ---> " << isl.X() - ds << ' ' << p->GetPx() << " ) ";
1155  }
1156  if(verbose) std::cout << prebin << std::endl;
1157  }
1158  if(tn.Y()){
1159  ds = _MeshHisto->GetYaxis()->GetBinWidth(1)/10.;
1160  if(verbose) std::cout << "Yprebin: " << prebin << " ---> ";
1161  if(p->GetPy() > 0){
1162  prebin = _MeshHisto->FindBin(isl.X(),
1163  isl.Y() + ds);
1164  if(verbose) std::cout << "1(" << isl.Y() << " ---> " << isl.Y() + ds << " ) ";
1165  }else{
1166  prebin = _MeshHisto->FindBin(isl.X(),
1167  isl.Y()-ds);
1168  if(verbose) std::cout << "1(" << isl.Y() << " ---> " << isl.Y() - ds << " ) ";
1169  }
1170  if(verbose) std::cout << prebin << std::endl;
1171  }
1172 
1173  _MeshHisto->GetBinXYZ(prebin, prebinX, prebinY, prebinZ);
1174  if(verbose) std::cout << "Stop\n["
1175  << prebin << " {" << prestepv.X() << ' ' << prestepv.Y() << ' ' << prestepv.Z() << "}("
1176  << prebinX << ' ' << prebinY << ' ' << prebinZ << ")\n"
1177  << ' ' << postbin << " {" << poststepv.X() << ' ' << poststepv.Y() << ' ' << poststepv.Z() << "}("
1178  << postbinX << ' ' << postbinY << ' ' << postbinZ << ")]\n\n";
1179 
1180  if(IsInside(p->GetX(), p->GetY(), p->GetZ())){
1181  if(verbose) std::cout << " Bingo\n";
1182  }
1183  }
1184  }
1185  }
1186  }
1187  return minp.second;
1188 }
Double_t p
Definition: anasim.C:58
orientation _orientation
double dy
TVector3 LineIntersection(TVector3 begline, TVector3 endline)
#define verbose
double Y
Definition: anaLmdDigi.C:68
bool momentumfilter(TVector3 mom, TVector3 diff)
int counter
Definition: ZeeAnalysis.C:59
Double_t
void Transform(Double_t X, Double_t Y, Double_t Z)
double dx
double X
Definition: anaLmdDigi.C:68
double Z
Definition: anaLmdDigi.C:68
void PndRadMapBoxMesh::Fill ( FairRadMapPoint *  p)

Definition at line 459 of file PndRadMapBoxMesh.cxx.

References _EnergyHisto, _filter, _orientation, _plane, _quantity, _verbose, _volume, Density, Dose, Double_t, Edep, EnergyFluence, Fluence, Flux, InterSection, Kerma, PndRadMapPlane::LineIntersection(), Mass, mom, pdg, pdgpart, pid(), SimpleFluence, CAMath::Sqrt(), theta, Twos, val, XY, XZ, YX, YZ, ZX, and ZY.

Referenced by Fill().

459  {
460  if(_verbose)
461  std::cout << "void PndRadMapBoxMesh::Fill(FairRadMapPoint *p)\n";
462 
463  Int_t pid = p->GetPdg();
464  Double_t mom = TMath::Sqrt((p->GetPx()*p->GetPx()) +
465  (p->GetPy()*p->GetPy()) +
466  (p->GetPz()*p->GetPz()));
467  pdgpart = pdg->GetParticle(pid);
468  Int_t cha = -1000;// to be implemented
469  Double_t pdgmass = -1;
470  Double_t val = 0;
471 
472  Double_t edep = 0;
473  Double_t dens = 0;
474  Double_t mass = p->GetMass();
475  TVector3 poststepv, prestepv;
476  Double_t lX = 0, lY = 0, lZ = 0;
477 
478  if(pdgpart){
479  pdgmass = pdgpart->Mass();
480  cha = pdgpart->Charge();
481  }
482 
483  if(_filter.Eval(pid, cha, mom)){
484 
485  val = 0;
486 
487  edep = p->GetEnergyLoss()*1.60217657*1e-10;//GeV->Joule
488  dens = p->GetDensity();
489  dens *= 0.001;//g/cm3 -> kg/cm3
490  mass = p->GetMass();
491  poststepv = TVector3(p->GetXOut(), p->GetYOut(), p->GetZOut());
492  prestepv = TVector3(p->GetX(), p->GetY(), p->GetZ());
493  lX = 0;
494  lY = 0;
495  lZ = 0;
496 
497  if(_verbose)
498  std::cout << "Density: " << dens
499  << ", mass: " << mass
500  << " (" << (dens*_volume)
501  << ", " << _volume << ") "
502  << dens*mass << ' '
503  << "charge: " << cha << "\n";
504 
505  lX = p->GetXOut();
506  lY = p->GetYOut();
507  lZ = p->GetZOut();
508 
509  bool OK = false;
510  switch (_quantity){
511 
512  case Edep:
513  val = edep;
514  if(!std::isnan(val) && val !=0)
515  // Fill(p->GetXOut(), p->GetYOut(), p->GetZOut(), val);
516  Fill(lX, lY, lZ, val);
517  break;
518 
519  case Dose:
520  val = edep/(dens*_volume);//mass=density*vol,dens[kg/cm^3],vol[cm^3]!
521  if(!std::isnan(val) && val !=0){
522  // Fill(p->GetXOut(), p->GetYOut(), p->GetZOut(), val);
523  Fill(lX, lY, lZ, val);
524  }
525  break;
526 
527  case Fluence:
528  InterSection = _plane->LineIntersection(poststepv, prestepv);
529  switch (_orientation){
530  case XY: case YX:
531  if(((prestepv.Z() <= InterSection.Z()) && (InterSection.Z() <= poststepv.Z())) ||
532  ((poststepv.Z() <= InterSection.Z()) && (InterSection.Z() <= prestepv.Z())))
533  OK = true;
534  break;
535 
536  case XZ: case ZX:
537  if(((prestepv.Y() <= InterSection.Y()) && (InterSection.Y() <= poststepv.Y())) ||
538  ((poststepv.Y() <= InterSection.Y()) && (InterSection.Y() <= prestepv.Y())))
539  OK = true;
540  break;
541 
542  case YZ: case ZY:
543  if(((prestepv.X() <= InterSection.X()) && (InterSection.X() <= poststepv.X())) ||
544  ((poststepv.X() <= InterSection.X()) && (InterSection.X() <= prestepv.X())))
545  OK = true;
546  break;
547  };
548  // std::cout << "test0\n"
549  // << "[" << prestepv.X() << "<=" << InterSection.X() << "<=" << poststepv.X() << "] - " << OK << "\n"
550  // << "[" << poststepv.X() << "<=" << InterSection.X() << "<=" << prestepv.X() << "] - " << OK << "\n"
551  // << "[" << prestepv.Y() << "<=" << InterSection.Y() << "<=" << poststepv.Y() << "] - " << OK << "\n"
552  // << "[" << poststepv.Y() << "<=" << InterSection.Y() << "<=" << prestepv.Y() << "] - " << OK << "\n"
553  // << "[" << prestepv.Z() << "<=" << InterSection.Z() << "<=" << poststepv.Z() << "] - " << OK << "\n"
554  // << "[" << poststepv.Z() << "<=" << InterSection.Z() << "<=" << prestepv.Z() << "] - " << OK << "\n\n";
555 
556  // // if(((prestepv.Z() <= InterSection.Z()) && (InterSection.Z() <= poststepv.Z())) ||
557  // // ((poststepv.Z() <= InterSection.Z()) && (InterSection.Z() <= prestepv.Z()))){
558  if(OK){
559  // std::cout << "testing 0...\n";
560  // std::cout << "testing 0... "
561  // << _Xlow << "<=" << InterSection.X() << "<=" << _Xhigh << " -> "
562  // << ((_Xlow <= InterSection.X()) && (InterSection.X() <= _Xhigh)) << ' ' << (InterSection.X() <= _Xhigh) << ' ' << (_Xlow <= InterSection.X()) << ' '
563  // << _Ylow << "<=" << InterSection.Y() << "<=" << _Yhigh << " -> "
564  // << ((_Ylow <= InterSection.Y()) && (InterSection.Y() <= _Yhigh)) << ' '
565  // << _Zlow << "<=" << InterSection.Z() << "<=" << _Zhigh << " -> "
566  // << ((_Zlow <= InterSection.Z()) && (InterSection.Z() <= _Zhigh)) << std::endl;
567 
568  Fill(InterSection.X(),
569  InterSection.Y(),
570  InterSection.Z()); //normalisation to the area ... now it is OK
571 
572 
573  Double_t theta = InterSection.Theta()*TMath::RadToDeg();
574  Double_t K = TMath::Sqrt(mom*mom + pdgmass*pdgmass) - pdgmass;
575 
576  _EnergyHisto->Fill(theta, K); //uncommented by MP, Sep 8
577  // val = CalcFluence(p);
578  // if(!isnan(val) && val !=0){
579  // Fill(p->GetXOut(), p->GetYOut(), p->GetZOut(), val);
580  }
581  break;
582 
583  case Density:
584  val = dens;
585  if(!std::isnan(val) && val !=0){
586  Fill(lX, lY, lZ, val);
587  // Fill(p->GetXOut(), p->GetYOut(), p->GetZOut(), val);
588  }
589  break;
590 
591  case Mass:
592  val = (dens*_volume);
593  if(!std::isnan(val) && val !=0){
594  Fill(lX, lY, lZ, val);
595  // Fill(p->GetXOut(), p->GetYOut(), p->GetZOut(), val);
596  }
597  break;
598 
599  case SimpleFluence:{
600  poststepv = TVector3(p->GetXOut(), p->GetYOut(), p->GetZOut());
601  prestepv = TVector3(p->GetX(), p->GetY(), p->GetZ());
602  val = (poststepv-prestepv).Mag()/1e2;// cm->m
603  val /= (_volume/1e6);//cm^3->m^3 -> 1/m^2
604  if(!std::isnan(val) && val!=0){
605  if(_verbose > 1){
606  std::cout << "Pre: " << prestepv.X() << ", " << prestepv.Y() << ", " << prestepv.Z() << "\n";
607  std::cout << "Pre: " << poststepv.X() << ", " << poststepv.Y() << ", " << poststepv.Z() << "\n";
608  std::cout << "diff: " << (poststepv-prestepv).Mag() << "; val: " << val << std::endl;
609  std::cout << "volume: " << _volume << "\n\n";
610  }
611  Fill(lX, lY, lZ, val);
612  // Fill(p->GetXOut(), p->GetYOut(), p->GetZOut(), val);
613  }
614  }break;
615 
616  case Twos:
617  val = 2;
618  if(!std::isnan(val) && val !=0){
619  Fill(lX, lY, lZ, val);
620  // Fill(p->GetXOut(), p->GetYOut(), p->GetZOut(), val);
621  }
622  break;
623  case EnergyFluence:
624  break;
625  case Flux:
626  break;
627  case Kerma:
628  break;
629  }
630  }
631 }
Double_t p
Definition: anasim.C:58
void Fill(FairRadMapPoint *p)
orientation _orientation
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
TVector3 LineIntersection(TVector3 begline, TVector3 endline)
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
int pid()
Double_t mom
Definition: plot_dirc.C:14
PndRadMapPlane * _plane
Double_t
TParticlePDG * pdgpart
TDatabasePDG * pdg
void PndRadMapBoxMesh::Fill ( Int_t  gBin,
Double_t  val 
)
protected

Definition at line 634 of file PndRadMapBoxMesh.cxx.

References _MeshHisto, _verbose, and Fill().

634  {
635  if(_verbose)
636  std::cout << "PndRadMapBoxMesh::Fill(" << gBin << ", " << val << ")\n";
637 
638  Int_t binX, binY, binZ;
639  _MeshHisto->GetBinXYZ(gBin, binX, binY, binZ);
640  Fill(binX, binY, binZ, val);
641 }
void Fill(FairRadMapPoint *p)
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
void PndRadMapBoxMesh::Fill ( Double_t  X,
Double_t  Y,
Double_t  Z,
Double_t  we = 1 
)
protected

Definition at line 643 of file PndRadMapBoxMesh.cxx.

References _MeshHisto, _orientation, _StatHisto, _verbose, _X, _Y, _Z, IsInside(), Transform(), XY, XZ, YX, YZ, ZX, and ZY.

643  {
644  if(_verbose)
645  std::cout << "PndRadMapBoxMesh::Fill(" << X << ", " << Y << ", " << Z << ", " << we << ")\n";
646 
647  Transform(X, Y, Z);
648 
649  // std::cout << "0 - PndRadMapBoxMesh::Fill(" << X << ", " << Y << ", " << Z << ", " << we << ")\n";
650  // std::cout << "1 - PndRadMapBoxMesh::Fill(" << _X << ", " << _Y << ", " << _Z << ", " << we << ")\n";
651 
652  // if(IsInside(_X, _Y, _Z)){
653  if(IsInside()){
654  // std::cout << "2 - PndRadMapBoxMesh::Fill(" << _X << ", " << _Y << ", " << _Z << ", " << we << ")\n";
655 
656  switch (_orientation){
657 
658  case XY:
659  _MeshHisto->Fill(_X, _Y, we);
660  _StatHisto->Fill(_X, _Y);
661  break;
662  case YX:
663  _MeshHisto->Fill(_Y, _X, we);
664  _StatHisto->Fill(_Y, _X);
665  break;
666 
667  case XZ:
668  _MeshHisto->Fill(_X, _Z, we);
669  _StatHisto->Fill(_X, _Z);
670  break;
671  case ZX:
672  _MeshHisto->Fill(_Z, _X, we);
673  _StatHisto->Fill(_Z, _X);
674  break;
675 
676  case YZ:
677  _MeshHisto->Fill(_Y, _Z, we);
678  _StatHisto->Fill(_Y, _Z);
679  break;
680  case ZY:
681  _MeshHisto->Fill(_Z, _Y, we);
682  _StatHisto->Fill(_Z, _Y);
683  break;
684  };
685  }
686 }
orientation _orientation
double Y
Definition: anaLmdDigi.C:68
void Transform(Double_t X, Double_t Y, Double_t Z)
double X
Definition: anaLmdDigi.C:68
double Z
Definition: anaLmdDigi.C:68
TH2D * PndRadMapBoxMesh::GetHisto ( )

Definition at line 694 of file PndRadMapBoxMesh.cxx.

References _MeshHisto, and _verbose.

694  {
695  if(_verbose)
696  std::cout << "PndRadMapBoxMesh::GetHisto()\n";
697  return _MeshHisto;
698 }
PndRadMapPlane * PndRadMapBoxMesh::GetPlane ( )

Definition at line 700 of file PndRadMapBoxMesh.cxx.

References _plane, and _verbose.

700  {
701  if(_verbose)
702  std::cout << "PndRadMapBoxMesh::GetPlane()\n";
703  return _plane;
704 }
PndRadMapPlane * _plane
bool PndRadMapBoxMesh::IsInside ( Double_t  X,
Double_t  Y,
Double_t  Z 
)
protected

Definition at line 736 of file PndRadMapBoxMesh.cxx.

References _verbose, _Xhigh, _Xlow, _Yhigh, _Ylow, _Zhigh, _Zlow, and ok.

736  {
737  if(_verbose)
738  std::cout << "PndRadMapBoxMesh::IsInside(" << X << ", " << Y << ", " << Z << ")\n";
739 
740  bool ok = false;
741 
742  if(((_Xlow <= X) && (X <= _Xhigh)) &&
743  ((_Ylow <= Y) && (Y <= _Yhigh)) &&
744  ((_Zlow <= Z) && (Z <= _Zhigh)))
745  ok = true;
746  return ok;
747 }
double Y
Definition: anaLmdDigi.C:68
float_m ok
double X
Definition: anaLmdDigi.C:68
double Z
Definition: anaLmdDigi.C:68
bool PndRadMapBoxMesh::IsInside ( FairRadMapPoint *  p)
protected

Definition at line 780 of file PndRadMapBoxMesh.cxx.

References _verbose, _Xhigh, _Xlow, _Yhigh, _Ylow, _Zhigh, _Zlow, ok, and Transform().

780  {
781  if(_verbose)
782  std::cout << "PndRadMapBoxMesh::IsInside(FairRadMapPoint *p)\n";
783 
784  bool ok = false;
785  double xin, yin, zin, xout, yout, zout;
786  Transform(p->GetX(), p->GetY(), p->GetZ(),
787  xin, yin, zin);
788  Transform(p->GetXOut(), p->GetYOut(), p->GetZOut(),
789  xout, yout, zout);
790 
791  if((((xin <= _Xlow) && (_Xhigh <= xout)) ||
792  ((xout <= _Xlow) && (_Xhigh <= xin )) ||
793  ((_Xlow <= xout) && (xout <= _Xhigh))) &&
794  (((yin <= _Ylow) && (_Yhigh <= yout)) ||
795  ((yout <= _Ylow) && (_Yhigh <= yin )) ||
796  ((_Ylow <= yout) && (yout <= _Yhigh))) &&
797  (((zin <= _Zlow) && (_Zhigh <= zout)) ||
798  ((zout <= _Zlow) && (_Zhigh <= zin )) ||
799  ((_Zlow <= zout) && (zout <= _Zhigh))))
800  ok = true;
801 
802  return ok;
803 }
Double_t p
Definition: anasim.C:58
void Transform(Double_t X, Double_t Y, Double_t Z)
float_m ok
bool PndRadMapBoxMesh::IsInside ( )
protected

Definition at line 749 of file PndRadMapBoxMesh.cxx.

References _orientation, _verbose, _X, _Xhigh, _Xlow, _Y, _Yhigh, _Ylow, _Z, _Zhigh, _Zlow, ok, XY, XZ, YX, YZ, ZX, and ZY.

Referenced by CalcFluence(), and Fill().

749  {
750  if(_verbose)
751  std::cout << "PndRadMapBoxMesh::IsInside()\n";
752 
753  bool ok = false;
754 
755  switch (_orientation){
756  case XY: case YX:
757  if(((_Xlow <= _X) && (_X <= _Xhigh)) &&
758  ((_Ylow <= _Y) && (_Y <= _Yhigh)))
759  ok = true;
760  break;
761  case XZ: case ZX:
762  if(((_Xlow <= _X) && (_X <= _Xhigh)) &&
763  ((_Zlow <= _Z) && (_Z <= _Zhigh)))
764  ok = true;
765  break;
766  case YZ: case ZY:
767  if(((_Ylow <= _Y) && (_Y <= _Yhigh)) &&
768  ((_Zlow <= _Z) && (_Z <= _Zhigh)))
769  ok = true;
770  break;
771  };
772 
773  // if(((_Xlow <= _X) && (_X <= _Xhigh)) &&
774  // ((_Ylow <= _Y) && (_Y <= _Yhigh)) &&
775  // ((_Zlow <= _Z) && (_Z <= _Zhigh)))
776  // ok = true;
777  return ok;
778 }
orientation _orientation
float_m ok
void PndRadMapBoxMesh::makeHisto ( const char *  Orient,
Double_t  rotate,
int  Hbins,
Double_t  Hlow,
Double_t  Hhigh,
int  Vbins,
Double_t  Vlow,
Double_t  Vhigh,
Double_t  dlow 
)
protected

Definition at line 805 of file PndRadMapBoxMesh.cxx.

References _axis, _EnergyHisto, _isSurfaceQuantity, _MeshHisto, _Name, _orientation, _plane, _rotate, _StatHisto, _verbose, and C().

Referenced by SetOrientation().

808  {
809  if(_verbose){
810  std::cout << "PndRadMapBoxMesh::makeHisto(" << Orient << ", " << rotate << ",\n";
811  std::cout << " " << Hbins << ", " << Hlow << ", " << Hhigh << ",\n";
812  std::cout << " " << Vbins << ", " << Vlow << ", " << Vhigh << ")\n";
813  }
814  char C[32];
815  sprintf(C, "%s_Histo_%s_%g", _Name.Data(), Orient, _rotate);
816  _MeshHisto = new TH2D(C, C,
817  Hbins, Hlow, Hhigh,
818  Vbins, Vlow, Vhigh);
819  sprintf(C, "%s_StatHisto_%s_%g", _Name.Data(), Orient, _rotate);
820  _StatHisto = new TH2I(C, C,
821  Hbins, Hlow, Hhigh,
822  Vbins, Vlow, Vhigh);
823 
824  if(_isSurfaceQuantity){
825  sprintf(C, "%s_EnergyHisto_%s_%g", _Name.Data(), Orient, _rotate);
826  _EnergyHisto = new TH2D(C, C,
827  180, 0, 180,
828  10000, 0, 10);
830 
831  }
832 }
orientation _orientation
PndRadMapPlane * _plane
int Pic_FED Eff_lEE C()
TVector3 rotate(TVector3 vec, TGeoRotation *rotma)
void PndRadMapBoxMesh::Save ( TFile *  fout)

Definition at line 706 of file PndRadMapBoxMesh.cxx.

References _EnergyHisto, _isSurfaceQuantity, _MeshHisto, _StatHisto, _verbose, and TString.

706  {
707  if(_verbose)
708  std::cout << "PndRadMapBoxMesh::Save(TFile* fout)\n";
709 
710  TObjArray* toa = TString(_MeshHisto->GetName()).Tokenize('_');
711  TString dirname = ((TObjString*)toa->At(0))->GetString();
712  dirname += '_';
713  dirname += ((TObjString*)toa->At(2))->GetString().Data();
714  dirname += '_';
715  dirname += ((TObjString*)toa->At(3))->GetString().Data();
716  std::cout << dirname.Data() << std::endl;
717 
718  // fout->mkdir(_MeshHisto->GetName());
719  // fout->cd (_MeshHisto->GetName());
720  fout->mkdir(dirname.Data());
721  fout->cd (dirname.Data());
722  _MeshHisto->Clone()->Write();
723  _StatHisto->Clone()->Write();
724  if(_isSurfaceQuantity) _EnergyHisto->Clone()->Write();
725  fout->cd();
726 }
void PndRadMapBoxMesh::Save ( )

Definition at line 728 of file PndRadMapBoxMesh.cxx.

References _EnergyHisto, _isSurfaceQuantity, _MeshHisto, _StatHisto, and _verbose.

728  {
729  if(_verbose)
730  std::cout << "PndRadMapBoxMesh::Save()\n";
731  _MeshHisto->Write();
732  _StatHisto->Write();
733  if(_isSurfaceQuantity) _EnergyHisto->Clone()->Write();
734 }
void PndRadMapBoxMesh::Scale ( Double_t  sca)

Definition at line 688 of file PndRadMapBoxMesh.cxx.

References _MeshHisto, and _verbose.

688  {
689  if(_verbose)
690  std::cout << "PndRadMapBoxMesh::Scale(" << sca << ")" << std::endl;
691  _MeshHisto->Scale(sca);
692 }
void PndRadMapBoxMesh::SetFilter ( const char *  filter)

Definition at line 235 of file PndRadMapBoxMesh.cxx.

References _filter, _verbose, and TString.

235  {
236  //Pid=x, Ch=y, Mom=z,
237  if(_verbose)
238  std::cout << "PndRadMapBoxMesh::SetFilter(" << filter << ")\n";
239  TString temps(filter);
240  temps.ReplaceAll("Pid", "x");
241  temps.ReplaceAll("Ch" , "y");
242  temps.ReplaceAll("Mom", "z");
243 
244  _filter = TFormula("formula", temps.Data());
245 }
void PndRadMapBoxMesh::SetOrientation ( orientation  plane,
Double_t  rotate = 99999,
axis  Ax = Xx 
)

Definition at line 253 of file PndRadMapBoxMesh.cxx.

References _orientation, and _verbose.

255  {
256  if(_verbose)
257  std::cout << "PndRadMapBoxMesh::SetOrientation(" << plane << ", " << rotate << ", " << Ax << ")\n";
258  _orientation = plane;
260 }
orientation _orientation
void SetOrientation(orientation plane, Double_t rotate=99999, axis Ax=Xx)
TVector3 rotate(TVector3 vec, TGeoRotation *rotma)
void PndRadMapBoxMesh::SetOrientation ( Double_t  rotate = 99999,
axis  Ax = Xx 
)

Definition at line 262 of file PndRadMapBoxMesh.cxx.

References _axis, _isSurfaceQuantity, _Name, _orientation, _rotate, _verbose, _volume, _Xbins, _Xhigh, _Xlow, _Ybins, _Yhigh, _Ylow, _Zbins, _Zhigh, _Zlow, makeHisto(), verbose, XY, XZ, YX, YZ, ZX, and ZY.

263  {
264 
265  if(_verbose)
266  std::cout << "PndRadMapBoxMesh::SetOrientation(" << rotate << ", " << Ax << ")\n";
267  _axis = Ax;
268  _rotate = (rotate == 99999) ? 0 : rotate;
269 
270  if(_verbose)
271  std::cout << "Volume[" << _Name.Data() << "][("
272  << _Xhigh << ", " << _Xlow << ", " << _Xbins << "),("
273  << _Yhigh << ", " << _Ylow << ", " << _Ybins << "),("
274  << _Zhigh << ", " << _Zlow << ", " << _Zbins << ")]:\n";
275 
276  // char C[32];
277  switch (_orientation){
278  case XY:
279  makeHisto("XY", _rotate,
280  _Xbins, _Xlow, _Xhigh,
281  _Ybins, _Ylow, _Yhigh,
282  _Zlow/*, _Zhigh --unused parameter*/);
283  break;
284  case YX:
285  makeHisto("YX", _rotate,
286  _Ybins, _Ylow, _Yhigh,
287  _Xbins, _Xlow, _Xhigh,
288  _Zlow/*, _Zhigh --unused parameter*/);
289  break;
290 
291  case XZ:
292  makeHisto("XZ", _rotate,
293  _Xbins, _Xlow, _Xhigh,
294  _Zbins, _Zlow, _Zhigh,
295  _Ylow/*, _Yhigh --unused parameter*/);
296  break;
297  case ZX:
298  makeHisto("ZX", _rotate,
299  _Zbins, _Zlow, _Zhigh,
300  _Xbins, _Xlow, _Xhigh,
301  _Ylow/*, _Yhigh --unused parameter*/);
302  break;
303 
304  case YZ:
305  makeHisto("YZ", _rotate,
306  _Ybins, _Ylow, _Yhigh,
307  _Zbins, _Zlow, _Zhigh,
308  _Xlow/*, _Xhigh --unused parameter*/);
309  break;
310  case ZY:
311  makeHisto("ZY", _rotate,
312  _Zbins, _Zlow, _Zhigh,
313  _Ybins, _Ylow, _Yhigh,
314  _Xlow/*, _Xhigh --unused parameter*/);
315  break;
316  };
317 
318  if(!_isSurfaceQuantity)
319  _volume = ((_Xhigh-_Xlow)/_Xbins) *
320  ((_Yhigh-_Ylow)/_Ybins)*
321  ((_Zhigh-_Zlow)/_Zbins);
322  else
323  _volume = 1;
324 
325  if(verbose)
326  std::cout << "Volume: "
327  << (_Xhigh-_Xlow)/_Xbins << ", "
328  << (_Yhigh-_Ylow)/_Ybins << ", "
329  << (_Zhigh-_Zlow)/_Zbins << " -> " << _volume << "\n";
330 }
void makeHisto(const char *Orient, Double_t rotate, int Hbins, Double_t Hlow, Double_t Hhigh, int Vbins, Double_t Vlow, Double_t Vhigh, Double_t dlow)
orientation _orientation
#define verbose
TVector3 rotate(TVector3 vec, TGeoRotation *rotma)
void PndRadMapBoxMesh::SetQuantity ( quantity  Quantity = Edep)

Definition at line 247 of file PndRadMapBoxMesh.cxx.

References _quantity, and _verbose.

Referenced by PndRadMapBoxMesh().

247  {
248  if(_verbose)
249  std::cout << "PndRadMapBoxMesh::SetQuantity(" << Quantity << ")\n";
250  _quantity = Quantity;
251 }
void PndRadMapBoxMesh::SetVerbosityLevel ( int  verbose = 0)

Definition at line 333 of file PndRadMapBoxMesh.cxx.

References _verbose.

333  {
334  _verbose = Verbose;
335 }
void PndRadMapBoxMesh::Transform ( Double_t  X,
Double_t  Y,
Double_t  Z 
)

Definition at line 339 of file PndRadMapBoxMesh.cxx.

References _verbose, _X, _Y, _Z, X, Y, and Z.

Referenced by CalcFluence(), Fill(), and IsInside().

339  {
340  if(_verbose)
341  std::cout << "PndRadMapBoxMesh::Transform(" << X << ", " << Y << ", " << Z << ")\n";
342 
343  _X = X; _Y = Y; _Z = Z;
344  Transform( X, Y, Z,
345  _X, _Y, _Z);
346 }
double Y
Definition: anaLmdDigi.C:68
void Transform(Double_t X, Double_t Y, Double_t Z)
double X
Definition: anaLmdDigi.C:68
double Z
Definition: anaLmdDigi.C:68
void PndRadMapBoxMesh::Transform ( Double_t  X,
Double_t  Y,
Double_t  Z,
Double_t X0,
Double_t Y0,
Double_t Z0 
)

Definition at line 348 of file PndRadMapBoxMesh.cxx.

References _axis, _orientation, _rotate, _verbose, CAMath::Cos(), Double_t, R, CAMath::Sin(), CAMath::Sqrt(), X, Xx, XY, XZ, Y, YX, Yy, YZ, Z, ZX, ZY, and Zz.

349  {
350 
351  if(_verbose){
352  std::cout << "PndRadMapBoxMesh::Transform(" << X << ", " << Y << ", " << Z << ")\n";
353  std::cout << " " << X0 << ", " << Y0 << ", " << Z0 << ")\n";
354  }
355  if(_rotate == 99999) _rotate = 0;
356  if((_rotate == 0)){
357  X0 = X; Y0 = Y; Z0 = Z;
358  }else{
359 
360  Double_t V1 = 0;
361  Double_t V2 = 0;
362 
363  X0 = X;
364  Y0 = Y;
365  Z0 = Z;
366  switch (_axis){
367  case Xx:
368  V1 = Y;
369  V2 = Z;
370  X0 = X;
371  break;
372  case Yy:
373  V1 = X;
374  V2 = Z;
375  Y0 = Y;
376  break;
377  case Zz:
378  V1 = X;
379  V2 = Y;
380  Z0 = Z;
381  break;
382  };
383 
384  Double_t _Vh, _Vv;
385  if(_rotate != 0){
386  Double_t R = TMath::Sqrt(V1*V1 + V2*V2);
387  Double_t rot0 = TMath::ATan(V1/V2)*TMath::RadToDeg();
388  if(V2 < 0) rot0 += 180;
389  Double_t drot = rot0-_rotate;
390  _Vh = R*TMath::Sin(1*drot*TMath::DegToRad());
391  _Vv = R*TMath::Cos(1*drot*TMath::DegToRad());
392  }else{
393  _Vh = V1;
394  _Vv = V2;
395  }
396 
397  switch (_axis){
398  case Xx:
399  switch (_orientation){
400  case XY: case YX: case XZ: case ZX:
401  Y0 = _Vv;
402  Z0 = _Vh;
403  break;
404 
405  case YZ:
406  Y0 = _Vh;
407  Z0 = _Vv;
408  break;
409  case ZY:
410  Y0 = _Vv;
411  Z0 = _Vh;
412  break;
413  };
414  break;
415 
416  case Yy:
417  switch (_orientation){
418  case XY: case YX: case YZ: case ZY:
419  X0 = _Vh;
420  Z0 = _Vv;
421  break;
422 
423  case XZ:
424  X0 = _Vh;
425  Z0 = _Vv;
426  break;
427  case ZX:
428  X0 = _Vv;
429  Z0 = _Vh;
430  break;
431  };
432  break;
433 
434  case Zz:
435  switch (_orientation){
436  case XZ: case ZX: case YZ: case ZY:
437  X0 = _Vh;
438  Y0 = _Vv;
439  break;
440 
441  case XY:
442  X0 = _Vh;
443  Y0 = _Vv;
444  break;
445  case YX:
446  X0 = _Vv;
447  Y0 = _Vh;
448  break;
449  };
450  break;
451  };
452  }
453  if(_verbose){
454  std::cout << " -> PndRadMapBoxMesh::Transform(" << X << ", " << Y << ", " << Z << ")\n";
455  std::cout << " " << X0 << ", " << Y0 << ", " << Z0 << ")\n";
456  }
457 }
orientation _orientation
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
static T Sin(const T &x)
Definition: PndCAMath.h:42
double Y
Definition: anaLmdDigi.C:68
static T Cos(const T &x)
Definition: PndCAMath.h:43
Double_t
double X
Definition: anaLmdDigi.C:68
double Z
Definition: anaLmdDigi.C:68
Double_t R
Definition: checkhelixhit.C:61
void PndRadMapBoxMesh::Transform ( TVector3  InV,
TVector3 &  OutV 
)

Member Data Documentation

axis PndRadMapBoxMesh::_axis
protected

Definition at line 107 of file PndRadMapBoxMesh.h.

Referenced by makeHisto(), SetOrientation(), and Transform().

TH2D* PndRadMapBoxMesh::_EnergyHisto
protected

Definition at line 102 of file PndRadMapBoxMesh.h.

Referenced by Fill(), makeHisto(), and Save().

TFormula PndRadMapBoxMesh::_filter
protected

Definition at line 121 of file PndRadMapBoxMesh.h.

Referenced by Fill(), PndRadMapBoxMesh(), and SetFilter().

bool PndRadMapBoxMesh::_isSurfaceQuantity
private

Definition at line 128 of file PndRadMapBoxMesh.h.

Referenced by makeHisto(), PndRadMapBoxMesh(), Save(), and SetOrientation().

TH2D* PndRadMapBoxMesh::_MeshHisto
protected
TString PndRadMapBoxMesh::_Name
protected

Definition at line 103 of file PndRadMapBoxMesh.h.

Referenced by makeHisto(), PndRadMapBoxMesh(), and SetOrientation().

orientation PndRadMapBoxMesh::_orientation
protected
PndRadMapPlane* PndRadMapBoxMesh::_plane
protected

Definition at line 124 of file PndRadMapBoxMesh.h.

Referenced by Fill(), GetPlane(), makeHisto(), and PndRadMapBoxMesh().

quantity PndRadMapBoxMesh::_quantity
protected

Definition at line 109 of file PndRadMapBoxMesh.h.

Referenced by Fill(), and SetQuantity().

Double_t PndRadMapBoxMesh::_rotate
protected

Definition at line 106 of file PndRadMapBoxMesh.h.

Referenced by makeHisto(), PndRadMapBoxMesh(), SetOrientation(), and Transform().

TH2I* PndRadMapBoxMesh::_StatHisto
protected
Double_t PndRadMapBoxMesh::_tX
protected

Definition at line 119 of file PndRadMapBoxMesh.h.

Double_t PndRadMapBoxMesh::_tY
protected

Definition at line 119 of file PndRadMapBoxMesh.h.

Double_t PndRadMapBoxMesh::_tZ
protected

Definition at line 119 of file PndRadMapBoxMesh.h.

int PndRadMapBoxMesh::_verbose
protected
Double_t PndRadMapBoxMesh::_volume
protected

Definition at line 108 of file PndRadMapBoxMesh.h.

Referenced by Fill(), PndRadMapBoxMesh(), and SetOrientation().

Double_t PndRadMapBoxMesh::_X
protected

Definition at line 118 of file PndRadMapBoxMesh.h.

Referenced by Fill(), IsInside(), and Transform().

int PndRadMapBoxMesh::_Xbins
protected

Definition at line 111 of file PndRadMapBoxMesh.h.

Referenced by PndRadMapBoxMesh(), and SetOrientation().

Double_t PndRadMapBoxMesh::_Xhigh
protected

Definition at line 112 of file PndRadMapBoxMesh.h.

Referenced by CalcFluence(), IsInside(), PndRadMapBoxMesh(), and SetOrientation().

Double_t PndRadMapBoxMesh::_Xlow
protected

Definition at line 112 of file PndRadMapBoxMesh.h.

Referenced by CalcFluence(), IsInside(), PndRadMapBoxMesh(), and SetOrientation().

Double_t PndRadMapBoxMesh::_Y
protected

Definition at line 118 of file PndRadMapBoxMesh.h.

Referenced by Fill(), IsInside(), and Transform().

int PndRadMapBoxMesh::_Ybins
protected

Definition at line 113 of file PndRadMapBoxMesh.h.

Referenced by PndRadMapBoxMesh(), and SetOrientation().

Double_t PndRadMapBoxMesh::_Yhigh
protected

Definition at line 114 of file PndRadMapBoxMesh.h.

Referenced by CalcFluence(), IsInside(), PndRadMapBoxMesh(), and SetOrientation().

Double_t PndRadMapBoxMesh::_Ylow
protected

Definition at line 114 of file PndRadMapBoxMesh.h.

Referenced by CalcFluence(), IsInside(), PndRadMapBoxMesh(), and SetOrientation().

Double_t PndRadMapBoxMesh::_Z
protected

Definition at line 118 of file PndRadMapBoxMesh.h.

Referenced by Fill(), IsInside(), and Transform().

int PndRadMapBoxMesh::_Zbins
protected

Definition at line 115 of file PndRadMapBoxMesh.h.

Referenced by PndRadMapBoxMesh(), and SetOrientation().

Double_t PndRadMapBoxMesh::_Zhigh
protected

Definition at line 116 of file PndRadMapBoxMesh.h.

Referenced by CalcFluence(), IsInside(), PndRadMapBoxMesh(), and SetOrientation().

Double_t PndRadMapBoxMesh::_Zlow
protected

Definition at line 116 of file PndRadMapBoxMesh.h.

Referenced by CalcFluence(), IsInside(), PndRadMapBoxMesh(), and SetOrientation().

TVector3 PndRadMapBoxMesh::InterSection
protected

Definition at line 125 of file PndRadMapBoxMesh.h.

Referenced by Fill().

TDatabasePDG* PndRadMapBoxMesh::pdg
private

Definition at line 129 of file PndRadMapBoxMesh.h.

Referenced by Fill(), and PndRadMapBoxMesh().

TParticlePDG* PndRadMapBoxMesh::pdgpart
private

Definition at line 130 of file PndRadMapBoxMesh.h.

Referenced by Fill().


The documentation for this class was generated from the following files: