00001
00002
00003
00004
00005
00006
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
00026
00027
00028
00029
00030
00031
00032
00033 if(header->run > 21300000 &&
00034 header->run < 21400000) return NCType::kTauFile;
00035
00036
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
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 }
00074 }
00075
00076 return ret;
00077 }