#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace RAT { DataCleaning::DataCleaning() : Processor("DataCleaning"), fKey(0) { RAT::GlobalFactory::Register("ftscut", new RAT::Alloc); RAT::GlobalFactory::Register("flashergeocut", new RAT::Alloc); RAT::GlobalFactory::Register("itctimespreadcut", new RAT::Alloc); RAT::GlobalFactory::Register("junkcut", new RAT::Alloc); RAT::GlobalFactory::Register("muontag", new RAT::Alloc); RAT::GlobalFactory::Register("neckcut", new RAT::Alloc); RAT::GlobalFactory::Register("owlcut", new RAT::Alloc); RAT::GlobalFactory::Register("qcluster", new RAT::Alloc); RAT::GlobalFactory::Register("qvnhit", new RAT::Alloc); RAT::GlobalFactory::Register("qvt", new RAT::Alloc); RAT::GlobalFactory::Register("ringoffire", new RAT::Alloc); RAT::GlobalFactory::Register("crateisotropy", new RAT::Alloc); RAT::GlobalFactory::Register("zerozerocut", new RAT::Alloc); RAT::GlobalFactory::Register("prescalecut", new RAT::Alloc); RAT::GlobalFactory::Register("tpmuonfollowercut", new RAT::Alloc); RAT::GlobalFactory::Register("caencut", new RAT::Alloc); RAT::GlobalFactory::Register("nothingcut", new RAT::Alloc); RAT::GlobalFactory::Register("nhitcut", new RAT::Alloc); RAT::GlobalFactory::Register("pollingcut", new RAT::Alloc); RAT::GlobalFactory::Register("thresholdflashercut", new RAT::Alloc); RAT::GlobalFactory::Register("tpburstcut", new RAT::Alloc); RAT::GlobalFactory::Register("livetimecuts", new RAT::Alloc); RAT::GlobalFactory::Register("missedmuonfollower", new RAT::Alloc); RAT::GlobalFactory::Register("missingcaendata", new RAT::Alloc); RAT::GlobalFactory::Register("pedcut", new RAT::Alloc); RAT::GlobalFactory::Register("atmospheric", new RAT::Alloc); RAT::GlobalFactory::Register("emptycrate", new RAT::Alloc); RAT::GlobalFactory::Register("missedcountburstcut", new RAT::Alloc); RAT::GlobalFactory::Register("waterBlind", new RAT::Alloc); } std::vector DataCleaning::GetNamedMask(std::string name) { try{ return fLBitMask->GetSArray(name); } catch( RAT::DBNotFoundError &e ){ warn << "DataCleaning::GetNamedMask: Cannot find named mask " << name << newline; Log::Die("DataCleaning::GetNamedMask, use a real mask defined in DATACLEANING.ratdb or don't call /rat/proc datacleaning"); return std::vector(); } } void DataCleaning::SetS(const std::string& param, const std::string& value) { if (param == "add"){ if (std::find(fAddedCuts.begin(),fAddedCuts.end(),value) == fAddedCuts.end()){ fAddedCuts.push_back(value); } }else if (param == "mask"){ if (std::find(fAddedMasks.begin(),fAddedMasks.end(),value) == fAddedMasks.end()){ fAddedMasks.push_back(value); } }else{ throw ParamUnknown(param); } } void DataCleaning::SetI(const std::string& param, const int value) { if (param == "verbose"){ if (value >= 0) DataCleaningProc::SetVerbose(value); }else if (param == "pass") { DataCleaningProc::SetProcessPass(value); }else{ throw ParamUnknown(param); } } void DataCleaning::BeginOfRun(DS::Run& run) { fLBitMask = DB::Get()->GetLink("DATACLEANING","bitmask"); for (size_t i=0;i::New(fAddedCuts[i])); fAppliedCuts.push_back(fAddedCuts[i]); } // Always apply the blindness anytime data cleaning is applied fCutProcs.push_back(RAT::GlobalFactory::New("waterBlind")); fAppliedCuts.push_back("waterBlind"); for (size_t i=0;i namedmask = GetNamedMask(fAddedMasks[i]); for (size_t j=0;j::New(cutname)); fAppliedCuts.push_back(cutname); } } } for (int i=0;i<(int)fCutProcs.size();i++) fCutProcs[i]->BeginOfRun(run); } void DataCleaning::EndOfRun(DS::Run& run) { for (size_t i=0;iEndOfRun(run); for (int i=0;i<(int)fCutProcs.size();i++) delete fCutProcs[i]; fCutProcs.clear(); fAppliedCuts.clear(); } Processor::Result DataCleaning::DSEvent(DS::Run& run, DS::Entry& ds) { Processor::Result flag = OKTRUE; for (int i=0;i<(int)fCutProcs.size();i++) if (fCutProcs[i]->DSEvent(run, ds) != OKTRUE){flag = OKFALSE;}; return flag; } }