31 const char* description,
32 const char* spec1,
const char* spec2,
34 const char* ch_name1,
const char* ch_name2 )
36 fpmass1(m1), fpmass2(m2), fSpect1(nullptr), fSpect2(nullptr),
38 fTdcRes{0,0}, fTdcOff{0,0}, fTdcData{0, 0}
47 if (ch_name1 && strlen(ch_name1)>0) {
52 if (ch_name2 && strlen(ch_name2)>0) {
83 {
"d_trig",
"Measured TDC start+delay of spec 2 (1), by spec 1 (2)",
"fdTdc" },
84 {
"ntr1",
"Number of tracks in first spec.",
"GetNTr1()" },
85 {
"ntr2",
"Number of tracks in first spec.",
"GetNTr2()" },
86 {
"vx_t1",
"Time of track from spec1 at target vertex",
"fVxTime1" },
87 {
"vx_t2",
"Time of track from spec2 at target vertex",
"fVxTime2" },
88 {
"ncomb",
"Number of track combinations considered",
"GetNTimes()" },
89 {
"ct_2by1",
"Coinc. times of tracks, d_trig from spec 1",
"fTimeCombos.fDiffT2by1" },
90 {
"ct_1by2",
"Coinc. times of tracks, d_trig from spec 2",
"fTimeCombos.fDiffT1by2" },
91 {
"trind1",
"Track indices for spec1 match entries in ct_*",
"fTimeCombos.fTrInd1" },
92 {
"trind2",
"Track indices for spec2 match entries in ct_*",
"fTimeCombos.fTrInd2" },
128 const char*
const here =
"ReadDatabase";
133 file = Podd::OpenDBFile(
"CT", date);
145 for(
int i=0; i<2 && !err; i++) {
146 vector<Int_t> detmap;
148 DBRequest request[] = {
149 {
"detmap", &detmap, kIntV },
158 if( detmap.size() != 6 ) {
159 Error(
Here(
here),
"Invalid number of detector map values = %d for "
160 "database key %sdetmap. Must be exactly 6. Fix database.",
161 static_cast<Int_t>(detmap.size()), pref.
Data() );
164 if( detmap[2] != detmap[3] ) {
166 "channel. Setting last = first. Fix database.",
168 detmap[3] = detmap[2];
174 Error(
Here(
here),
"Error %d filling detector map element %d",
185 if(
fDetMap->GetSize() != 2 ) {
186 Error(
Here(
here),
"Unexpected number of detector map modules = %d. "
187 "Must be exactly 2. Fix database.",
fDetMap->GetSize() );
200 const char*
const here =
"Process";
202 if( !
IsOK() )
return -1;
206 for(
double tdcres :
fTdcRes ) {
225 vector<Double_t>& Vxtime;
229 const vector<Spec_short> SpList = {
234 for(
const auto& sp : SpList ) {
235 assert(sp.Vxtime.empty());
236 Int_t ntr = sp.Sp->GetNTracks();
238 for(
Int_t i = 0; i < ntr; i++ ) {
243 sp.Sp->GetName(), i);
247 if( tr->GetBeta() != 0. &&
p > 0. ) {
250 sp.Vxtime.push_back(tr->GetTime() - tr->GetPathLen() / (
beta *
c));
253 sp.Vxtime.push_back((i + 1) *
kBig);
263 for(
size_t i = 0; i <
fVxTime1.size(); i++ ) {
264 for(
size_t j = 0; j <
fVxTime2.size(); j++ ) {
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char mode
static const char *const here
char * Form(const char *fmt,...)
static Int_t LoadDB(FILE *file, const TDatime &date, const DBRequest *request, const char *prefix, Int_t search=0, const char *here="THaAnalysisObject::LoadDB")
static Int_t DefineVarsFromList(const void *list, EType type, EMode mode, const char *def_prefix, const TObject *obj, const char *prefix, const char *here, const char *comment_subst="")
virtual const char * Here(const char *) const
THaAnalysisObject * FindModule(const char *name, const char *classname, bool do_error=true)
virtual FILE * OpenFile(const TDatime &date)
virtual Int_t ReadDatabase(const TDatime &date)
THaSpectrometer * fSpect2
virtual void Clear(Option_t *opt="")
std::vector< Double_t > fVxTime2
std::vector< TimeCombo > fTimeCombos
std::unique_ptr< THaDetMap > fDetMap
THaCoincTime(const char *name, const char *description, const char *spec1="L", const char *spec2="R", Double_t mass1=.938272, Double_t mass2=0.000511, const char *ch_name1=nullptr, const char *ch_name2=nullptr)
THaSpectrometer * fSpect1
virtual Int_t DefineVariables(EMode mode=kDefine)
virtual Int_t Process(const THaEvData &)
std::vector< Double_t > fVxTime1
UInt_t GetNumHits(UInt_t crate, UInt_t slot, UInt_t chan) const
UInt_t GetData(UInt_t crate, UInt_t slot, UInt_t chan, UInt_t hit) const
virtual void Clear(Option_t *opt="")
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Error(const char *method, const char *msgfmt,...) const
const char * Data() const
TString & Append(char c, Ssiz_t rep=1)
double beta(double x, double y)
Double_t Sqrt(Double_t x)