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

PTSim.cxx

Go to the documentation of this file.
00001 
00002 //
00003 // PTSim
00004 //
00005 // Package: PTSim.
00006 //
00007 // S. Kasahara 05/04
00008 //
00009 // Purpose: Define data types and provide general purpose utility routines 
00010 //          to the persistency package.
00011 //
00013 
00014 #include <TString.h>
00015 
00016 #include "ParticleTransportSim/PTSim.h"
00017 #include "MessageService/MsgService.h"
00018 
00019 CVSID("$Id: PTSim.cxx,v 1.7 2007/04/07 04:05:23 schubert Exp $");
00020 
00021 //_____________________________________________________________________________
00022 const char* PTSim::AsString(EStdHepSelectMode mode) {
00023   //  Purpose:  Convert enumerated stdhep select mode to a string.
00024   //
00025   //  Return:  mode string. If unknown, returns "Unknown".
00026   //
00027 
00028   switch ( mode ) {
00029 
00030     case kUnknown:
00031       return "Unknown";
00032     case kMomentum:
00033       return "Momentum";
00034     case kHit:
00035       return "Hit";
00036     default:
00037       MSG("PTSim",Msg::kWarning) 
00038       << "PTSim::AsString called with unknown EStdHepSelectMode" 
00039       << (int)mode << endl;
00040       return "Unknown";
00041 
00042   }//end of switch
00043 
00044 }
00045 
00046 //_____________________________________________________________________________
00047 int PTSim::GetStdHepSelectMode(const char* mode) {
00048   // Purpose: Convert text string cut to an enumerated mode.
00049   //
00050   // Return: returns -1 if no match, else EStdHepSelectMode
00051   //
00052 
00053   TString tmpstr(mode);
00054   tmpstr.ToLower();
00055   if ( strcmp(tmpstr.Data(),"momentum") == 0 ) return PTSim::kMomentum;
00056   else if ( strcmp(tmpstr.Data(),"hit") == 0 ) return PTSim::kHit;
00057 
00058   return -1;
00059 
00060 }
00061 
00062 //_____________________________________________________________________________
00063 const char* PTSim::AsString(ECut cut) {
00064   //  Purpose:  Convert enumerated mc cut to a cut string.
00065   //
00066   //  Argument: cut: enumerated ECut described in PTSim.h.
00067   //
00068   //  Return:  cut string. If unknown, returns "Unknown".
00069   //
00070   //  Contact:   S. Kasahara
00071   //
00072 
00073   switch ( cut ) {
00074     case kCUTGAM:
00075       return "CUTGAM";
00076     case kCUTELE:
00077       return "CUTELE";
00078     case kCUTNEU:
00079       return "CUTNEU";
00080     case kCUTHAD:
00081       return "CUTHAD";
00082     case kCUTMUO:
00083       return "CUTMUO";
00084     case kBCUTE:
00085       return "BCUTE";
00086     case kBCUTM:
00087       return "BCUTM";
00088     case kDCUTE:
00089       return "DCUTE";
00090     case kDCUTM:
00091       return "DCUTM";
00092     case kPPCUTM:
00093       return "PPCUTM";
00094     case kTOFMAX:
00095       return "TOFMAX";
00096 
00097     default:
00098       MSG("PTSim",Msg::kWarning) 
00099       << "PTSim::AsString called with unknown cut" 
00100       << (int)cut << endl;
00101       return "Unknown";
00102   }//end of switch
00103 
00104 }
00105 
00106 //_____________________________________________________________________________
00107 int PTSim::GetCut(const char* cut) {
00108   // Purpose: Convert text string cut to an enumerated code.
00109   // 
00110   // Argument: cut string
00111   //
00112   // Return: returns -1 if no match
00113   //
00114   // Contact: S. Kasahara
00115   //
00116 
00117   TString tmpstr(cut);
00118   tmpstr.ToLower();
00119   if ( strcmp(tmpstr.Data(),"cutgam") == 0 ) return PTSim::kCUTGAM;
00120   else if ( strcmp(tmpstr.Data(),"cutele") == 0 ) return PTSim::kCUTELE;
00121   else if ( strcmp(tmpstr.Data(),"cutneu") == 0 ) return PTSim::kCUTNEU;
00122   else if ( strcmp(tmpstr.Data(),"cuthad") == 0 ) return PTSim::kCUTHAD;
00123   else if ( strcmp(tmpstr.Data(),"cutmuo") == 0 ) return PTSim::kCUTMUO;
00124   else if ( strcmp(tmpstr.Data(),"bcute") == 0 ) return PTSim::kBCUTE;
00125   else if ( strcmp(tmpstr.Data(),"bcutm") == 0 ) return PTSim::kBCUTM;
00126   else if ( strcmp(tmpstr.Data(),"dcute") == 0 ) return PTSim::kDCUTE;
00127   else if ( strcmp(tmpstr.Data(),"dcutm") == 0 ) return PTSim::kDCUTM;
00128   else if ( strcmp(tmpstr.Data(),"ppcutm") == 0 ) return PTSim::kPPCUTM;
00129   else if ( strcmp(tmpstr.Data(),"tofmax") == 0 ) return PTSim::kTOFMAX;
00130 
00131   return -1;
00132 
00133 }
00134 
00135 //_____________________________________________________________________________
00136 const char* PTSim::AsString(EProcess process) {
00137   //  Purpose:  Convert enumerated mc process to a process string.
00138   //
00139   //  Argument: process: enumerated EProcess described in PTSim.h.
00140   //
00141   //  Return:  process string. If unknown, returns "Unknown".
00142   //
00143   //  Contact:   S. Kasahara
00144   //
00145 
00146   switch ( process ) {
00147     case kANNI:
00148       return "ANNI";
00149     case kBREM:
00150       return "BREM";
00151     case kCOMP:
00152       return "COMP";
00153     case kDCAY:
00154       return "DCAY";
00155     case kDRAY:
00156       return "DRAY";
00157     case kHADR:
00158       return "HADR";
00159     case kLOSS:
00160       return "LOSS";
00161     case kMULS:
00162       return "MULS";
00163     case kMUNU:
00164       return "MUNU";
00165     case kPAIR:
00166       return "PAIR";
00167     case kPFIS:
00168       return "PFIS";
00169     case kPHOT:
00170       return "PHOT";
00171 
00172     default:
00173       MSG("PTSim",Msg::kWarning) 
00174       << "PTSim::AsString called with unknown process" << (int)process << endl;
00175       return "Unknown";
00176   }//end of switch
00177 
00178 }
00179 
00180 //_____________________________________________________________________________
00181 int PTSim::GetProcess(const char* process) {
00182   // Purpose: Convert text string process to an enumerated code.
00183   // 
00184   // Argument: process string
00185   //
00186   // Return: returns -1 if no match
00187   //
00188   // Contact: S. Kasahara
00189   //
00190 
00191   TString tmpstr(process);
00192   tmpstr.ToLower();
00193   if ( strcmp(tmpstr.Data(),"anni") == 0 ) return PTSim::kANNI;
00194   else if ( strcmp(tmpstr.Data(),"brem") == 0 ) return PTSim::kBREM;
00195   else if ( strcmp(tmpstr.Data(),"comp") == 0 ) return PTSim::kCOMP;
00196   else if ( strcmp(tmpstr.Data(),"dcay") == 0 ) return PTSim::kDCAY;
00197   else if ( strcmp(tmpstr.Data(),"dray") == 0 ) return PTSim::kDRAY;
00198   else if ( strcmp(tmpstr.Data(),"hadr") == 0 ) return PTSim::kHADR;
00199   else if ( strcmp(tmpstr.Data(),"loss") == 0 ) return PTSim::kLOSS;
00200   else if ( strcmp(tmpstr.Data(),"muls") == 0 ) return PTSim::kMULS;
00201   else if ( strcmp(tmpstr.Data(),"munu") == 0 ) return PTSim::kMUNU;
00202   else if ( strcmp(tmpstr.Data(),"pair") == 0 ) return PTSim::kPAIR;
00203   else if ( strcmp(tmpstr.Data(),"pfis") == 0 ) return PTSim::kPFIS;
00204   else if ( strcmp(tmpstr.Data(),"phot") == 0 ) return PTSim::kPHOT;
00205 
00206   return -1;
00207 
00208 }

Generated on Mon Feb 15 11:07:26 2010 for loon by  doxygen 1.3.9.1