Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

GetDetectorBins.cxx

Go to the documentation of this file.
00001 #include "GetDetectorBins.h"
00002 
00003 #include <UgliGeometry/UgliScintPlnHandle.h>
00004 #include <UgliGeometry/UgliSteelPlnHandle.h>
00005 #include <UgliGeometry/UgliStripHandle.h>
00006 
00007 #include <Conventions/PlaneCoverage.h>
00008 #include <Conventions/Detector.h>
00009 
00010 #include <vector>
00011 using namespace std;
00012 
00013 
00014 void DataUtil::GetDetectorBinsUV(UgliGeomHandle ugh, PlaneView::EPlaneView view,
00015                                  int &nbins, double &min, double &max)
00016 {
00017     vector<UgliScintPlnHandle> scints = ugh.GetScintPlnHandleVector();
00018 
00019     // u/v bins
00020     double binper=0;
00021     switch (ugh.GetVldRange().GetDetectorMask()) {
00022     case Detector::kNear:
00023         for (size_t ind = 0; ind < scints.size(); ++ind) {
00024             if (scints[ind].GetPlaneCoverage() == PlaneCoverage::kNearFull) {
00025                 if (scints[ind].GetPlaneView() == view) {
00026                     vector<UgliStripHandle> v = scints[ind].GetStripHandleVector();
00027                     min = v.front().GetTPos()-v.front().GetHalfWidth();
00028                     max = v.back().GetTPos()+v.back().GetHalfWidth();
00029                     binper = v.size()/(max-min);
00030                 }
00031                 if (binper) break;
00032             }
00033         }
00034         break;
00035     case Detector::kFar: case Detector::kCalib: {
00036         vector<UgliStripHandle> v = scints[0].GetStripHandleVector();
00037         min = v.front().GetTPos()-v.front().GetHalfWidth();
00038         max =  v.back().GetTPos() +v.back().GetHalfWidth();
00039         binper = v.size()/(max-min);
00040         break;}
00041     default:
00042         break;
00043     }
00044     nbins = (int)(((max-min)*binper)+0.5);
00045 }
00046 
00047 
00048 void DataUtil::GetDetectorBinsZ(UgliGeomHandle ugh,
00049                                 int &nbins, double &zmin, double &zmax)
00050 {
00051     vector<UgliSteelPlnHandle> steel = ugh.GetSteelPlnHandleVector();
00052 
00053     // Z bins
00054     double zbinper=0;
00055     switch (ugh.GetVldRange().GetDetectorMask()) {
00056     case Detector::kNear: case Detector::kCalib:
00057         ugh.GetZExtent(zmin,zmax);
00058         zbinper = steel.size()/(zmax-zmin);
00059         break;
00060     case Detector::kFar:{
00061         double max,min;
00062         ugh.GetZExtent(zmin,min,0);
00063         ugh.GetZExtent(max,zmax,1);
00064         zbinper = steel.size()/((zmax-zmin)-(max-min));
00065         break;}
00066     default:
00067         break;
00068     }
00069     nbins = (int)(((zmax-zmin)*zbinper)+0.5);
00070 }
00071 

Generated on Thu Nov 1 11:50:48 2007 for loon by  doxygen 1.3.9.1