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

infid_finder.h File Reference

#include "Rtypes.h"
#include "Validity/VldContext.h"
#include "Conventions/Munits.h"

Go to the source code of this file.

Namespaces

namespace  FidVol

Enumerations

enum  EAirRegion { kBetweenScintAndSteel = 0, kDownstreamOfSteel = +1 }
enum  EPosition { kUpstream = -1, kMiddle = 0, kDownstream = +1 }

Functions

const char * AirRegionAsString (EAirRegion region)
const char * PositionAsString (EPosition pos)
double infid_z_finder (VldContext vldc, int planenum, EAirRegion region=kBetweenScintAndSteel, EPosition pos=kMiddle, double eps=Munits::micrometer)
void find_z_cuts (int pup_near=17, int pdn_near=84, int pup1_far=8, int pdn1_far=240, int pup2_far=255, int pdn2_far=452, EAirRegion region=kBetweenScintAndSteel, EPosition pos=kMiddle, double eps=Munits::micrometer)


Enumeration Type Documentation

enum EAirRegion
 

Enumeration values:
kBetweenScintAndSteel 
kDownstreamOfSteel 

Definition at line 29 of file infid_finder.h.

00029                   {
00030     kBetweenScintAndSteel =  0,
00031     kDownstreamOfSteel    = +1
00032   };

enum EPosition
 

Enumeration values:
kUpstream 
kMiddle 
kDownstream 

Definition at line 35 of file infid_finder.h.

00035                  {
00036     kUpstream   = -1,
00037     kMiddle     =  0,
00038     kDownstream = +1
00039   };


Function Documentation

const char * FidVol::AirRegionAsString EAirRegion  region  ) 
 

Definition at line 77 of file infid_finder.cxx.

References FidVol::kBetweenScintAndSteel, and FidVol::kDownstreamOfSteel.

Referenced by FidVol::find_z_cuts().

00078 {
00079   switch (region) {
00080   case kBetweenScintAndSteel:  return "BetweenScintAndSteel";
00081   case kDownstreamOfSteel:     return "DownstreamOfSteel";
00082   default:                     return "UnknownAirRegion";
00083   }
00084 }

void FidVol::find_z_cuts int  pup_near = 17,
int  pdn_near = 84,
int  pup1_far = 8,
int  pdn1_far = 240,
int  pup2_far = 255,
int  pdn2_far = 452,
EAirRegion  region = kBetweenScintAndSteel,
EPosition  pos = kMiddle,
double  eps = Munits::micrometer
 

Definition at line 157 of file infid_finder.cxx.

References FidVol::AirRegionAsString(), Form(), FidVol::infid_z_finder(), FidVol::kMiddle, and FidVol::PositionAsString().

Referenced by NuCuts::FindZCuts().

00161 {
00162   VldTimeStamp now;
00163   VldContext vldc_near_data(Detector::kNear,SimFlag::kData,now);
00164   VldContext vldc_near_mc(Detector::kNear,SimFlag::kMC,now);
00165   VldContext vldc_far_data(Detector::kFar,SimFlag::kData,now);
00166   VldContext vldc_far_mc(Detector::kFar,SimFlag::kMC,now);
00167   std::cout << "FidVol::find_z_cuts() called" << std::endl;
00168   double nearZData[2], nearZMC[2];
00169   double farZData[4],  farZMC[4];
00170 
00171   nearZData[0] = FidVol::infid_z_finder(vldc_near_data,pup_near,region,pos,eps);
00172   nearZData[1] = FidVol::infid_z_finder(vldc_near_data,pdn_near,region,pos,eps);
00173 
00174   nearZMC[0]   = FidVol::infid_z_finder(vldc_near_mc,pup_near,region,pos,eps);
00175   nearZMC[1]   = FidVol::infid_z_finder(vldc_near_mc,pdn_near,region,pos,eps);
00176 
00177   farZData[0]  = FidVol::infid_z_finder(vldc_far_data,pup1_far,region,pos,eps);
00178   farZData[1]  = FidVol::infid_z_finder(vldc_far_data,pdn1_far,region,pos,eps);
00179   farZData[2]  = FidVol::infid_z_finder(vldc_far_data,pup2_far,region,pos,eps);
00180   farZData[3]  = FidVol::infid_z_finder(vldc_far_data,pdn2_far,region,pos,eps);
00181 
00182   farZMC[0]    = FidVol::infid_z_finder(vldc_far_mc,pup1_far,region,pos,eps);
00183   farZMC[1]    = FidVol::infid_z_finder(vldc_far_mc,pdn1_far,region,pos,eps);
00184   farZMC[2]    = FidVol::infid_z_finder(vldc_far_mc,pup2_far,region,pos,eps);
00185   farZMC[3]    = FidVol::infid_z_finder(vldc_far_mc,pdn2_far,region,pos,eps);
00186 
00187   // now format it for cut-and-paste purposes
00188   std::cout << "   // Chosen z is " << FidVol::PositionAsString(pos)
00189             << " of air gap " << FidVol::AirRegionAsString(region);
00190   if ( pos != kMiddle && eps != 0)
00191     std::cout << " eps = " << eps;
00192   std::cout << std::endl;
00193   
00194   std::cout << "   // Near:  relative to steel planes "
00195             << " [" << pup_near << "," << pdn_near << "]" 
00196             << std::endl;
00197   std::cout << "   setNearZData(0," << Form("%8.5f",nearZData[0]) << ");"
00198             << "   setNearZData(1," << Form("%8.5f",nearZData[1]) << ");"
00199             << std::endl;
00200   std::cout << "   setNearZMC(  0," << Form("%8.5f",nearZMC[0]) << ");"
00201             << "   setNearZMC(  1," << Form("%8.5f",nearZMC[1]) << ");"
00202             << std::endl;
00203 
00204 
00205   std::cout << "   // Far:  relative to steel planes "
00206             << " [" << pup1_far << "," << pdn1_far << "]" 
00207             << " [" << pup2_far << "," << pdn2_far << "]" 
00208             << std::endl;
00209   std::cout << "   setFarZData(0," << Form("%8.5f",farZData[0]) << "); "
00210             << "   setFarZData(1," << Form("%8.5f",farZData[1]) << ");"
00211             << std::endl
00212             << "   setFarZData(2," << Form("%8.5f",farZData[2]) << "); "
00213             << "   setFarZData(3," << Form("%8.5f",farZData[3]) << ");"
00214             << std::endl;
00215   std::cout << "   setFarZMC(  0," << Form("%8.5f",farZMC[0]) << "); "
00216             << "   setFarZMC(  1," << Form("%8.5f",farZMC[1]) << ");"
00217             << std::endl
00218             << "   setFarZMC(  2," << Form("%8.5f",farZMC[2]) << "); "
00219             << "   setFarZMC(  3," << Form("%8.5f",farZMC[3]) << ");"
00220             << std::endl;
00221 }

double FidVol::infid_z_finder VldContext  vldc,
int  planenum,
EAirRegion  region = kBetweenScintAndSteel,
EPosition  pos = kMiddle,
double  eps = Munits::micrometer
 

Definition at line 96 of file infid_finder.cxx.

References fidvol_find_ugliplnhandle(), fidvol_toggle_msglvl(), VldContext::GetDetector(), UgliPlnHandle::GetHalfThickness(), UgliGeomHandle::GetPlnHandleVector(), UgliPlnHandle::GetZ0(), UgliPlnHandle::IsValid(), PlexPlaneId::IsValid(), FidVol::kDownstream, FidVol::kDownstreamOfSteel, FidVol::kMiddle, and FidVol::kUpstream.

Referenced by FidVol::find_z_cuts().

00098 {
00099 
00100   fidvol_toggle_msglvl(); // quiet things down
00101   //std::cout << "FidVol::infid_z_finder for " << vldc.AsString() << std::endl;
00102 
00103   UgliGeomHandle ugh(vldc);
00104   PlexPlaneId plnid_steel(vldc.GetDetector(),planenum,true);
00105   // kBetweenScintAndSteel means scint/steel are same pair and scint is upstream
00106   // kDownstreamOfSteel means scint
00107   int dir = -1;
00108   if ( kDownstreamOfSteel == region ) dir = +1;
00109   PlexPlaneId plnid_adjoin = plnid_steel.GetAdjoin(dir);
00110   if ( ! plnid_steel.IsValid() || ! plnid_adjoin.IsValid() ) {
00111     std::cout << "HEY! invalid plane " << planenum
00112               << " steel " << plnid_steel << " adjoin " << plnid_adjoin
00113               << std::endl;
00114     fidvol_toggle_msglvl(); // restore message levels
00115     return -9999;
00116   }
00117   
00118   std::vector<UgliPlnHandle> uphv = ugh.GetPlnHandleVector();
00119   UgliPlnHandle uph_steel  = fidvol_find_ugliplnhandle(plnid_steel,uphv);
00120   UgliPlnHandle uph_adjoin = fidvol_find_ugliplnhandle(plnid_adjoin,uphv);
00121   if ( ! uph_steel.IsValid()  || ! uph_adjoin.IsValid() ) {
00122     std::cout << "HEY! invalid UgliPlnHandle: steel "
00123               << (uph_steel.IsValid()?"okay":"invalid")
00124               << " adjoin "
00125               << (uph_adjoin.IsValid()?"okay":"invalid")
00126               << std::endl;
00127     fidvol_toggle_msglvl(); // restore message levels
00128     return -9999;
00129   }
00130 
00131   double zup, zdn;
00132   if ( kDownstreamOfSteel == region ) {
00133     zup = uph_steel.GetZ0()  + uph_steel.GetHalfThickness();
00134     zdn = uph_adjoin.GetZ0() - uph_adjoin.GetHalfThickness();
00135   } else {
00136     zup = uph_adjoin.GetZ0() + uph_adjoin.GetHalfThickness();
00137     zdn = uph_steel.GetZ0()  - uph_steel.GetHalfThickness();
00138   }
00139 
00140   double z;
00141   switch ( pos ) {
00142   case kUpstream:    z = zup + eps;     break;
00143   case kMiddle:      z = 0.5*(zup+zdn); break;
00144   case kDownstream:  z = zup - eps;     break;
00145   default:
00146     std::cout << "HEY: pos arg isn't legal " << (int)pos << std::endl;
00147     z = -9999;
00148   }
00149 
00150   //std::cout << " planeum " << planenum << " blah, blah  chooose z = " << z << std::endl;
00151 
00152   fidvol_toggle_msglvl(); // restore message levels
00153   return z;
00154 
00155 }

const char * FidVol::PositionAsString EPosition  pos  ) 
 

Definition at line 86 of file infid_finder.cxx.

References FidVol::kDownstream, FidVol::kMiddle, and FidVol::kUpstream.

Referenced by FidVol::find_z_cuts().

00087 {
00088   switch (pos) {
00089   case kUpstream:   return "upstream";
00090   case kMiddle:     return "middle";
00091   case kDownstream: return "downstream";
00092   default:          return "UnknownPosition";
00093   }
00094 }


Generated on Mon Feb 15 11:08:00 2010 for loon by  doxygen 1.3.9.1