2 using namespace RPCEventBuilderLX;
7 #include <fwk/RunController.h>
10 #include <cevt/CEvent.h>
11 #include <cevt/Station.h>
13 #include <cevt/PadRecData.h>
14 #include <cevt/PadSimData.h>
15 #include <cevt/StationSimData.h>
16 #include <cevt/StationRecData.h>
19 #include <utl/config.h>
20 #include <utl/TimeStamp.h>
21 #include <utl/ErrorLogger.h>
22 #include <utl/MultiTimeDistribution.h>
23 #include <utl/TimeDistributionAlgorithm.h>
39 INFO(
"RPCEventBuilder::Init()");
46 INFO(
"RPCEventBuilder::Finish()");
53 INFO(
"RPCEventBuilder::Run()");
56 ERROR(
"No CEvent found.");
60 CEvent &rpcEvent =
event.GetCEvent();
68 const int sId = station.
GetId();
72 info <<
"station " << sId <<
" does not have RPC sim data";
86 Accumulator::Safe<Accumulator::Min<double> > minTime;
87 for(Station::ConstPadIterator pIt = station.
PadsBegin();
88 pIt != station.
PadsEnd(); ++pIt) {
99 const double stationT0 = minTime.GetMin();
102 for(Station::PadIterator pIt = station.
PadsBegin();
103 pIt != station.
PadsEnd(); ++pIt) {
122 if (!station.
HasHits(component))
130 const double timeBin = simDigitTimeDist.
GetBinning();
133 it != simDigitTimeDist.
SparseEnd(); ++it) {
135 padHits.
AddTime(it->get<0>()*timeBin-stationT0,it->get<1>());
136 stationHits.
AddTime(it->get<0>()*timeBin-stationT0,it->get<1>());
fwk::VModule::ResultFlag Init(void)
Initialize: invoked at beginning of run (NOT beginning of event)
int GetStart() const
First slot with data.
bool HasHits(const StationConstants::SignalComponent source=StationConstants::eTotal) const
Check if a digitized signal exists. Source may be specified.
HitsTimeDistributionsIterator HitsTimeDistributionsEnd()
End iterator over available digitized PAD signal sources.
bool HasSimData() const
Check whether station simulated data exists.
evt::Header & GetHeader()
StationIterator StationsEnd()
End of all stations.
void MakeHits(const SignalComponent source=eTotal)
Make a time distribution. Source may be specified.
virtual ~RPCEventBuilder()
utl::TimeDistributionI & GetHitsTimeDistribution(const StationConstants::SignalComponent source=StationConstants::eTotal)
Histogram class for time distributions with suppressed empty bins.
#define INFO(message)
Macro for logging informational messages.
bool HasHitsTimeDistribution(const StationConstants::SignalComponent source=StationConstants::eTotal) const
Check if the digitized PAD signal (optionally for a given source)
Class to hold simulated data at Pad level.
A TimeStamp holds GPS second and nanosecond for some event.
class to hold data at Pad level
fwk::VModule::ResultFlag Run(evt::Event &theEvent)
Run: invoked once per event.
double GetBinning() const
Size of one slot.
utl::TimeDistributionI & GetHits(const StationConstants::SignalComponent source=StationConstants::eTotal)
Get time distribution of hits, optionally specifying the source.
void SetHitsStartTime(const utl::TimeStamp &Time)
Set absolute start time of the hits time distribution.
int GetId() const
Get the station Id.
HitsTimeDistributionsIterator HitsTimeDistributionsBegin()
Begin iterator over available digitized PAD signal sources.
utl::MultiTimeDistributionI::ConstIterator ConstHitsTimeDistributionsIterator
Const iterator over available digitized PAD signal sources.
bool HasHits(const SignalComponent source=eTotal) const
Check if a digitized signal exists. Source may be specified.
utl::TimeDistributionI & GetHits(const SignalComponent source=eTotal)
Time distribution of hits.
fwk::VModule::ResultFlag Finish(void)
Finish: invoked at end of the run (NOT end of the event)
SparseIterator SparseEnd() const
void MakeHits(const StationConstants::SignalComponent source=StationConstants::eTotal)
Make a time distribution. Source may be specified.
class to hold data at Station level
PadIterator PadsEnd()
end Pad iterator for read/write
A TimeInterval is used to represent time elapsed between two events.
ResultFlag
Flag returned by module methods to the RunController.
StationIterator StationsBegin()
Beginning of all stations.
PadSimData & GetSimData()
Get object containing Pad simulated data.
SparseIterator SparseBegin() const
Iterator over time slots with data in them (skips empty slots).
boost::indirect_iterator< InternalStationIterator, Station & > StationIterator
Iterator over all stations.
PadIterator PadsBegin()
begin Pad iterator for read/write
#define ERROR(message)
Macro for logging error messages.
void AddTime(const double time, const T weight=T(1))
Add an entry (optionally weighted) for the given time. Slot will be computed.
boost::transform_iterator< InternalMapFunctor, InternalConstIterator, Tuple > SparseIterator
Interface class to access to the SD part of an event.