00001 00002 // $Id: FardetBeamSelect.cxx,v 1.7 2006/05/27 09:03:39 rhatcher Exp $ 00003 // 00004 // A module to select beam events based on timing and trigger source 00005 // 00006 // n.tagg1@physics.ox.ac.uk 00008 #include "FardetBeamSelect.h" 00009 #include "MessageService/MsgService.h" 00010 #include "MinosObjectMap/MomNavigator.h" 00011 #include "JobControl/JobCModuleRegistry.h" // For JOBMODULE macro 00012 #include "TTree.h" 00013 #include "TFile.h" 00014 #include "RawData/RawDigitDataBlock.h" 00015 #include "RawData/RawRecord.h" 00016 #include "RawData/RawDaqSnarlHeader.h" 00017 #include "DataUtil/GetRawHeader.h" 00018 #include "SpillTiming/SpillTimeFinder.h" 00019 #include "RawData/RawDigit.h" 00020 #include "OnlineUtil/mdTriggerCodes.h" 00021 #include "OnlineUtil/mdSpillData.h" 00022 #include <cmath> 00023 00024 JOBMODULE(FardetBeamSelect, "FardetBeamSelect", 00025 "FardetBeamSelect"); 00026 00027 CVSID("$Id: FardetBeamSelect.cxx,v 1.7 2006/05/27 09:03:39 rhatcher Exp $"); 00028 00029 00030 //...................................................................... 00031 00032 FardetBeamSelect::FardetBeamSelect() 00033 { 00034 } 00035 00036 //...................................................................... 00037 00038 FardetBeamSelect::~FardetBeamSelect() 00039 { 00040 } 00041 00042 //...................................................................... 00043 00044 JobCResult FardetBeamSelect::Ana(const MomNavigator* mom) 00045 { 00052 00053 const RawDaqSnarlHeader* header = 00054 DataUtil::GetRawHeader<RawDaqSnarlHeader>(mom); 00055 00056 if(!header) return JobCResult::kFailed; 00057 00058 // Look at trigger. 00059 Int_t trigger = header->GetTrigSrc(); 00060 00061 if((trigger & TRIGGER_BIT_SPILL_IP)>0) { 00062 00063 if((header->GetRemoteSpillType()==kSpillType_Fake) || 00064 (header->GetRemoteSpillType()==kSpillType_Local) ) { 00065 if(fAllowFakeSpillTriggers==0) return JobCResult::kPassed; 00066 else return JobCResult::kFailed; 00067 } 00068 00069 return JobCResult::kPassed; 00070 } 00071 00072 // see if it's within the window. 00073 VldContext cx = header->GetVldContext(); 00074 double dspill = SpillTimeFinder::Instance(). 00075 GetTimeToNearestSpill(cx); 00076 if(fabs(dspill) < fWindowSize) return JobCResult::kPassed; 00077 00078 00079 return JobCResult::kFailed; 00080 } 00081 00082 //...................................................................... 00083 00084 const Registry& FardetBeamSelect::DefaultConfig() const 00085 { 00086 //====================================================================== 00087 // Supply the default configuration for the module 00088 //====================================================================== 00089 static Registry r; // Default configuration for module 00090 00091 // Set name of config 00092 std::string name = this->GetName(); 00093 name += ".config.default"; 00094 r.SetName(name.c_str()); 00095 00096 // Set values in configuration 00097 r.UnLockValues(); 00098 r.Set("WindowSize", 50e-6); 00099 r.Set("AllowFakeSpillTriggers", 1); 00100 r.LockValues(); 00101 00102 return r; 00103 } 00104 00105 //...................................................................... 00106 00107 void FardetBeamSelect::Config(const Registry& r) 00108 { 00109 //====================================================================== 00110 // Configure the module given the Registry r 00111 //====================================================================== 00112 00113 fWindowSize = r.GetDouble("WindowSize"); 00114 fAllowFakeSpillTriggers = r.GetInt("AllowFakeSpillTriggers"); 00115 } 00116 00118 00119
1.3.9.1