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

FiducialCut.cxx

Go to the documentation of this file.
00001 // $Id: FiducialCut.cxx,v 1.15 2009/02/28 21:46:16 gmieg Exp $
00002 
00003 // C++
00004 #include <cstdlib>
00005 #include <cstring>
00006 #include <fstream>
00007 #include <iostream>
00008 
00009 // MINOS
00010 #include "Registry/Registry.h"
00011 
00012 // Local
00013 #include "PhysicsNtuple/Default.h"
00014 
00015 // Local
00016 #include "FiducialCut.h"
00017 
00018 //---------------------------------------------------------------------------------------
00019 Anp::FiducialCut::FiducialCut()
00020    :fPath(),
00021     fStrategy(kDisk),
00022     fCheck(false),
00023     fCount(true),
00024     fErase(true),
00025     fValid(false),
00026     fSelectStdHep(false),
00027     fUseTrackVtx(false),
00028     fFiducialKey(100),
00029     fNearMinZ(0.0),
00030     fNearMaxZ(0.0),     
00031     fNearRadius(0.0),
00032     fNearSpanU(0.0),
00033     fNearSpanV(0.0),
00034     fNearBeamX(0.0),
00035     fNearBeamY(0.0),
00036     fFarSM1MinZ(0.0),
00037     fFarSM1MaxZ(0.0),
00038     fFarSM2MinZ(0.0),
00039     fFarSM2MaxZ(0.0),
00040     fFarMaxRadius(0.0),
00041     fFarMinRadius(0.0),
00042     fTrackZOffset(0.0)
00043 {
00044 }
00045 
00046 //---------------------------------------------------------------------------------------
00047 Anp::FiducialCut::~FiducialCut()
00048 {
00049 }
00050 
00051 //---------------------------------------------------------------------------------------
00052 bool Anp::FiducialCut::Init(std::string path, const bool quiet)
00053 {
00054    Registry reg;
00055 
00056    fPath = path;
00057    fValid = false;
00058 
00059    if(!fPath.empty() && Anp::ReadRegistry(fPath, reg, quiet))
00060    {
00061       fValid = true;
00062    }
00063    else
00064    {
00065       const char *value_char = std::getenv("SRT_PRIVATE_CONTEXT");
00066       if(value_char)
00067       {
00068          fPath = std::string(value_char) + "/PhysicsNtuple/Config/FiducialCut.txt";
00069          if(Anp::ReadRegistry(fPath, reg, quiet))
00070          {
00071             fValid = true;
00072          }
00073       }
00074    }
00075 
00076    if(!fValid)
00077    {
00078       std::cerr << " FiducialCut - failed to find valid registry file" << std::endl;
00079       return false;
00080    }
00081 
00082    Anp::Read(reg, "Check", fCheck);
00083    Anp::Read(reg, "Count", fCount);
00084    Anp::Read(reg, "Erase", fErase);
00085 
00086    if(!Anp::Read(reg, "UseTrackVtx", fUseTrackVtx))
00087    {
00088       Anp::Read(reg, "UseTrackVertex", fUseTrackVtx);
00089    }
00090    
00091    if(!Anp::Read(reg, "SelectStdHep", fSelectStdHep))
00092    {
00093       Anp::Read(reg, "SelectFiducialStdHep", fSelectStdHep);
00094    }
00095 
00096    if(!reg.Get("FiducialKey", fFiducialKey)) reg.Get("FiducialCode", fFiducialKey);
00097 
00098    reg.Get("NearMinZ", fNearMinZ);
00099    reg.Get("NearMaxZ", fNearMaxZ);
00100    reg.Get("NearRadius", fNearRadius);
00101    reg.Get("NearSpanU", fNearSpanU);
00102    reg.Get("NearSpanV", fNearSpanV);
00103    reg.Get("NearBeamX", fNearBeamX);
00104    reg.Get("NearBeamY", fNearBeamY);
00105    reg.Get("FarSM1MinZ", fFarSM1MinZ);
00106    reg.Get("FarSM1MaxZ", fFarSM1MaxZ);
00107    reg.Get("FarSM2MinZ", fFarSM2MinZ);
00108    reg.Get("FarSM2MaxZ", fFarSM2MaxZ);
00109    reg.Get("FarMaxRadius", fFarMaxRadius);
00110    reg.Get("FarMinRadius", fFarMinRadius);
00111    reg.Get("TrackZOffset", fTrackZOffset);
00112    
00113    const char *value_char = 0;
00114    if(reg.Get("Strategy", value_char) && value_char)
00115    {
00116       if(std::strcmp("SquareUV", value_char) == 0)
00117       {
00118          fStrategy = kSquareUV;
00119       }
00120       else if(std::strcmp("SquareXY", value_char) == 0)
00121       {
00122          fStrategy = kSquareXY;
00123       }
00124       else if(std::strcmp("CC2008", value_char) == 0)
00125       {
00126          fStrategy = kCC2008;
00127       }
00128       else
00129       {
00130          fStrategy = kDisk;
00131       }
00132    }
00133 
00134    return true;
00135 }
00136 
00137 //----------------------------------------------------------------------
00138 void Anp::FiducialCut::Print(std::ostream &os) const
00139 {
00140    os << "   Path = " << fPath << std::endl
00141       << "   Check = " <<  fCheck << std::endl
00142       << "   Count = " <<  fCount << std::endl
00143       << "   Erase = " <<  fErase << std::endl
00144       << "   UseTrackVtx = " <<  fUseTrackVtx << std::endl
00145       << "   SelectStdHep = " <<  fSelectStdHep << std::endl            
00146       << "   FiducialKey = " << fFiducialKey << std::endl   
00147       << "   NearMinZ = " << fNearMinZ << std::endl
00148       << "   NearMaxZ = " << fNearMaxZ << std::endl     
00149       << "   NearRadius = " << fNearRadius << std::endl
00150       << "   NearSpanU = " << fNearSpanU << std::endl
00151       << "   NearSpanV = " << fNearSpanV << std::endl
00152       << "   NearBeamX = " << fNearBeamX << std::endl
00153       << "   NearBeamY = " << fNearBeamY << std::endl   
00154       << "   FarSM1MinZ = " << fFarSM1MinZ << std::endl
00155       << "   FarSM1MaxZ = " << fFarSM1MaxZ << std::endl
00156       << "   FarSM2MinZ = " << fFarSM2MinZ << std::endl
00157       << "   FarSM2MaxZ = " << fFarSM2MaxZ << std::endl
00158       << "   FarMaxRadius = " << fFarMaxRadius << std::endl
00159       << "   FarMinRadius = " << fFarMinRadius << std::endl
00160       << "   TrackZOffset = " << fTrackZOffset << std::endl;
00161 }

Generated on Mon Feb 15 11:06:41 2010 for loon by  doxygen 1.3.9.1