#include "base/ProcMgr.h"
#include "hadaq/HldProcessor.h"
#include "hadaq/TdcProcessor.h"
#include "hadaq/TrbProcessor.h"
void first()
{
trb3_1->
CreateTDC(0x1000, 0x1001, 0x1002, 0x1003);
int tdcmap[4] = { 0x1000, 0x1001, 0x1002, 0x1003 };
for (int cnt=0;cnt<4;cnt++) {
if (tdc==0) continue;
for (int ch=2;ch<=32;ch++)
}
}
void SetTriggeredAnalysis(bool on=true)
Enabled/disable triggered analysis is configured.
Definition: ProcMgr.h:192
virtual bool CreateStore(const char *storename)
create data store, for the moment - ROOT tree
Definition: ProcMgr.h:162
static ProcMgr * instance()
Return global instance of processor manager, provided by framework.
Definition: ProcMgr.cxx:46
void SetStoreEnabled(bool on=true)
Enable store - set store kind 1.
Definition: base/Processor.h:239
void SetHistFilling(int lvl=99)
Set histogram filling level.
Definition: base/Processor.h:225
HLD processor.
Definition: HldProcessor.h:93
TdcProcessor * FindTDC(unsigned tdcid) const
Find TDC by id.
Definition: HldProcessor.cxx:136
TDC processor.
Definition: TdcProcessor.h:32
void SetCh0Enabled(bool on=true)
Enable/disable store of channel 0 in output event.
Definition: TdcProcessor.h:708
void SetRefChannel(unsigned ch, unsigned refch, unsigned reftdc=0xffff, int npoints=5000, double left=-10., double right=10., bool twodim=false)
Set reference signal for the TDC channel ch.
Definition: TdcProcessor.cxx:516
TRB processor.
Definition: TrbProcessor.h:46
bool LoadCalibrations(const char *fileprefix)
Load calibrations for all existing TDCs as argument file prefix (without TDC id) should be specified.
Definition: TrbProcessor.cxx:300
static void SetDefaults(unsigned numch=65, unsigned edges=0x1, bool ignore_sync=true)
Set defaults for the next creation of TDC processors.
Definition: TrbProcessor.cxx:35
int CreateTDC(unsigned id1, unsigned id2=0, unsigned id3=0, unsigned id4=0)
Create up to 4 TDC with pre-configured default parameters.
Definition: TrbProcessor.cxx:222
void SetCrossProcess(bool on=true)
Enable Cross-processing - hits correlation between different TDCs.
Definition: TrbProcessor.cxx:522
static void SetFineLimits(unsigned min, unsigned max)
Method set static limits, which are used for simple interpolation of time for fine counter.
Definition: TdcMessage.h:294
#include <cstdio>
#include "TTree.h"
#include "base/EventProc.h"
#include "base/Event.h"
#include "hadaq/TdcSubEvent.h"
protected:
std::string fTdcId;
double fHits[8];
base::H1handle hNumHits;
public:
SecondProc(const char* procname, const char* _tdcid) :
base::EventProc(procname),
fTdcId(_tdcid),
hNumHits(0)
{
printf(
"Create %s for %s\n",
GetName(), fTdcId.c_str());
hNumHits =
MakeH1(
"NumHits",
"Number of hits", 32, 0, 32,
"number");
}
{
t->Branch(
GetName(), fHits,
"hits[8]/D");
}
{
for (unsigned n=0;n<8;n++) fHits[n] = 0.;
if (sub==0) return false;
double num(0), ch0tm(0);
for (
unsigned cnt=0;cnt<sub->
Size();cnt++) {
unsigned chid = ext.
msg().getHitChannel();
num+=1;
}
return true;
}
};
void second()
{
new SecondProc("Second1", "TDC_1000");
}
Abstract processor of build events.
Definition: EventProc.h:12
virtual bool Process(Event *)
Generic event processing If returns false, processing will be aborted and event will not be stored.
Definition: EventProc.h:26
Event - collection of several subevents.
Definition: Event.h:17
base::SubEvent * GetSubEvent(const std::string &name) const
Return subevent by name.
Definition: Event.h:69
Extended message - any message plus global time stamp.
Definition: base/SubEvent.h:36
const MsgClass & msg() const
message
Definition: base/SubEvent.h:81
double GetGlobalTime() const
global time stamp
Definition: base/SubEvent.h:84
H1handle MakeH1(const char *name, const char *title, int nbins, double left, double right, const char *xtitle=0)
Adds processor prefix to histogram name and calls base::ProcMgr::MakeH1 method.
Definition: base/Processor.cxx:132
virtual void CreateBranch(TTree *)
Create branch.
Definition: base/Processor.h:204
const char * GetName() const
Get processor name.
Definition: base/Processor.h:220
void FillH1(H1handle h1, double x, double weight=1.)
Fill 1-D histogram.
Definition: base/Processor.h:103
Subevent with vector of extended messages.
Definition: base/SubEvent.h:91
unsigned Size() const
Returns number of messages.
Definition: base/SubEvent.h:107
MsgClass & msg(unsigned indx)
Returns message with specified index.
Definition: base/SubEvent.h:116
#include "TTree.h"
#include "TFile.h"
void read()
{
TFile* f = TFile::Open("tree.root");
if (f==0) return;
TTree* t = (TTree*) f->Get("T");
if (t==0) return;
std::vector<hadaq::TdcMessageExt> *vect = new std::vector<hadaq::TdcMessageExt>;
t->SetBranchAddress("TDC_1000", &vect);
Long64_t entry(0), total(0);
while (t->GetEntry(entry)>0) {
entry++;
double ch0tm(0);
for (unsigned n=0;n<vect->size();n++) {
int chid = ext.
msg().getHitChannel();
total += 1;
}
}
printf("Read %ld entries %ld messages\n", entry, total);
}