17 #include "art_root_io/TFileService.h" 27 #include "artdaq-core/Data/ContainerFragment.hh" 90 void FragmentToTriggers(
const artdaq::Fragment& artFrag, std::unique_ptr<std::vector<CRT::Trigger>>& triggers);
101 "Time [s];Raw Timestamp [ticks]");
121 produces<std::vector<CRT::Trigger>>();
122 consumes<std::vector<artdaq::Fragment>>(
fFragTag);
133 MF_LOG_DEBUG(
"CRTGoodEvent") <<
"Is this Fragment good? " << ((frag.
good_event())?
"true":
"false") <<
"\n";
137 std::vector<CRT::Hit> hits;
140 for(
size_t hitNum = 0; hitNum < frag.
num_hits(); ++hitNum)
142 const auto hit = *(frag.
hit(hitNum));
144 <<
"ADC: " <<
hit.adc <<
"\n";
146 size_t offline_channel =
hit.channel;
164 offline_channel = (31-
hit.channel)*2;
167 offline_channel = (63-
hit.channel)*2+1;
172 offline_channel =
hit.channel*2;
175 offline_channel = (
hit.channel-32)*2+1;
179 if (offline_channel%2==0) ++offline_channel;
180 else --offline_channel;
181 hits.emplace_back(offline_channel,
hit.adc);
188 <<
"Number of hits: " << frag.
num_hits() <<
"\n" 195 catch(
const std::out_of_range&
e)
197 mf::LogWarning(
"Bad CRT Channel") <<
"Got CRT channel number " << frag.
module_num() <<
" that is greater than the number of boards" 198 <<
" in the channel map: " <<
fChannelMap.size() <<
". Throwing out this Trigger.\n";
204 if(deltaT > 0 && deltaT < 1e6)
207 plots.fLowerTimeVersusTime->SetPoint(plots.fLowerTimeVersusTime->GetN(), deltaT, frag.
raw_backend_time());
211 mf::LogWarning(
"SyncPlots") <<
"Got time difference " << deltaT <<
" that was not included in sync plots.\n" 229 auto triggers = std::make_unique<std::vector<CRT::Trigger>>();
242 for(
const auto& frag: *fragHandle)
244 artdaq::ContainerFragment container(frag);
249 for(
const auto& artFrag: *fragHandle)
251 artdaq::ContainerFragment container(artFrag);
270 <<
"not doing anything.\n";
283 const auto nModules = geom->
NAuxDets();
326 for(
size_t module = 0; module < nModules; ++module)
fChannelMap.push_back(module);
335 for(
size_t module = 0; module < nModules; ++module)
fSyncPlots.emplace_back(*tfs, module);
PerModule(art::TFileDirectory &parent, const size_t module)
uint64_t fifty_mhz_time() const
const art::InputTag fFragTag
def mkdir(path, mode=0o777)
void produce(art::Event &e) override
const bool fLookForContainer
uint64_t raw_backend_time() const
EDProducer(fhicl::ParameterSet const &pset)
const bool fMatchOfflineMapping
CRTRawDecoder(fhicl::ParameterSet const &p)
std::vector< PerModule > fSyncPlots
art framework interface to geometry description
void SetEarliestTime(const artdaq::Fragment &frag)
#define DEFINE_ART_MODULE(klass)
std::vector< size_t > fChannelMap
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
CRTRawDecoder & operator=(CRTRawDecoder const &)=delete
void FragmentToTriggers(const artdaq::Fragment &artFrag, std::unique_ptr< std::vector< CRT::Trigger >> &triggers)
static int max(int a, int b)
Detector simulation of raw signals on wires.
art::TFileDirectory fModuleDir
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
uint16_t module_num() const
Access the description of detector geometry.
TGraph * fLowerTimeVersusTime
std::string to_string(ModuleType const mt)
def parent(G, child, parent_type)
cet::coded_exception< error, detail::translate > exception
unsigned int NAuxDets() const
Returns the number of auxiliary detectors.
const hit_t * hit(const int i) const