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

NCType.cxx

Go to the documentation of this file.
00001 
00002 // $Id: NCType.cxx,v 1.39 2009/06/18 13:32:49 bckhouse Exp $
00003 //
00004 // NCType
00005 //
00006 // Author:  B. Rebel 10/2005
00007 //
00009 #include "NCUtils/NCType.h"
00010 
00011 #include "AnalysisNtuples/ANtpHeaderInfo.h"
00012 
00013 #include "NCUtils/NCUtility.h"
00014 
00015 #include <cassert>
00016 
00017 #include "MessageService/MsgService.h"
00018 CVSID("$Id: NCType.cxx,v 1.39 2009/06/18 13:32:49 bckhouse Exp $");
00019 
00020 
00021 //-----------------------------------------------------------------------
00022 NCType::EFileType NCType::FindFileType(ANtpHeaderInfo* header)
00023 {
00024   assert(header);
00025   //check if the event is from a tau file.  the mc run numbers have the convention
00026   //<ikey><itgt><iflv><S><RRRR>
00027   //<ikey> = 1 near, 2 far
00028   //<itgt> = 1 in detector only, 2 in rock only, 3 detector + rock, 4 in fiducial only
00029   //<iflv> = 0 beam, 1 nue, 3 nutau, 4 numu, nue inverted, 5 far oscillated mock data
00030   //<S> = split set
00031   //<RRRR> = run number
00032 
00033   if(header->run > 21300000 &&
00034      header->run < 21400000) return NCType::kTauFile;
00035 
00036   //dont know what these runs are just now
00037   if(header->run > 21400000 &&
00038      header->run < 21510000) return NCType::kElectronFile;
00039 
00040   if(header->run > 21910000 &&
00041      header->run < 21910004) return NCType::kMockFile;
00042 
00043   return NCType::kBeamFile;
00044 }
00045 
00046 TString NCType::FileTypeAsString(EFileType f)
00047 {
00048   switch(f){
00049   case kUnknownFile:  return "Unknown filetype";
00050   case kBeamFile:     return "Beam";
00051   case kTauFile:      return "Tau";
00052   case kElectronFile: return "Electron";
00053   case kMockFile:     return "Mock";
00054   default:
00055     assert(0 && "This really shouldn't happen");
00056   }
00057 }
00058 
00059 vector<BeamType::BeamType_t> NCType::BeamListFromString(const char* str)
00060 {
00061   const vector<TString> sl = NC::Utility::ParseStringList(str);
00062 
00063   using BeamType::BeamType_t;
00064 
00065   vector<BeamType_t> ret;
00066 
00067   for(unsigned int n = 0; n < sl.size(); ++n){
00068     // BeamType doesn't have a FromString function
00069     for(BeamType_t beam = BeamType_t(0);
00070         beam < BeamType::kEndOfList;
00071         beam = BeamType_t(int(beam)+1)){
00072       if(sl[n] == BeamType::AsString(beam)) ret.push_back(beam);
00073     } // end for beam
00074   } // end for n
00075 
00076   return ret;
00077 }

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