139 {
"tr.betachisq",
"Chi2 of beta",
"fTracks.THaTrack.GetBetaChi2()"},
140 {
"tr.GoodPlane4",
"Flag for track hitting hodo plane 4",
"fTracks.THaTrack.GetGoodPlane4()"},
141 {
"tr.GoodPlane3",
"Flag for track hitting hodo plane 3",
"fTracks.THaTrack.GetGoodPlane3()"},
142 {
"tr.fptime",
"Track hodo focal plane time",
"fTracks.THaTrack.GetFPTime()"},
143 {
"tr.npmt",
"Track number of hodo PMTs hit",
"fTracks.THaTrack.GetNPMT()"},
144 {
"tr.PruneSelect",
"Prune Select ID",
"fPruneSelect"},
145 {
"present",
"Trigger Type includes this spectrometer",
"fPresent"},
200 static const char*
const here =
"THcHallCSpectrometer::ReadDatabase";
203 cout <<
"In THcHallCSpectrometer::ReadDatabase()" << endl;
206 const char* detector_name =
"hod";
214 Error(
"THcHallCSpectrometer",
"Cannot find hodoscope detector %s",
221 if(
dynamic_cast<THcDC*
>(detdc) ) {
224 Error(
"THcHallCSpectrometer",
"Cannot find detector DC");
237 cout <<
" GetName() " <<
GetName() << endl;
240 prefix[0]=tolower(
GetName()[0]);
243 string reconCoeffFilename;
245 {
"_recon_coeff_filename", &reconCoeffFilename, kString },
312 if (prefix[0]==
'h') {
320 if (prefix[0]==
'p') {
324 cout << prefix[0] <<
" From Formula Mispointing_y = " <<
fMispointing_y << endl;
330 cout << prefix[0] <<
" From Parameter Set Mispointing_y = " <<
fMispointing_y << endl;
336 if (prefix[0]==
'h') {
343 cout << prefix[0] <<
" From Formula Mispointing_x = " <<
fMispointing_x << endl;
347 if (prefix[0]==
'p') {
352 cout << prefix[0] <<
" From Formula Mispointing_x = " <<
fMispointing_x << endl;
359 cout << prefix[0] <<
" From Parameter Set Mispointing_x = " <<
fMispointing_x << endl;
367 cout <<
"\n\n\nhodo planes = " <<
fNPlanes << endl;
369 cout <<
"fPruneXp = " <<
fPruneXp << endl;
370 cout <<
"fPruneYp = " <<
fPruneYp << endl;
371 cout <<
"fPruneYtar = " <<
fPruneYtar << endl;
373 cout <<
"fPruneBeta = " <<
fPruneBeta << endl;
374 cout <<
"fPruneDf = " <<
fPruneDf << endl;
377 cout <<
"fPruneNPMT = " <<
fPruneNPMT << endl;
380 cout <<
"fPartMass = " <<
fPartMass << endl;
398 ifile.open(reconCoeffFilename.c_str());
399 if(!ifile.is_open()) {
400 Error(here,
"error opening reconstruction coefficient file %s",reconCoeffFilename.c_str());
407 while(good &&
line[0]==
'!') {
408 good = getline(ifile,
line).good();
413 while(good &&
line.compare(0,4,
" ---")!=0) {
421 good = getline(ifile,
line).good();
425 good = getline(ifile,
line).good();
431 while(good &&
line.compare(0,4,
" ---")!=0) {
433 sscanf(
line.c_str(),
" %le %le %le %le %1d%1d%1d%1d%1d"
442 good = getline(ifile,
line).good();
444 cout <<
"Read " <<
fNReconTerms <<
" matrix element terms" << endl;
446 Error(here,
"Error processing reconstruction coefficient file %s",reconCoeffFilename.c_str());
511 }
else if (
fHodo!=0){
550 for(
Int_t k=0;k<4;k++) {
555 for(
Int_t j=0;j<5;j++) {
560 for(
Int_t k=0;k<4;k++) {
570 delta = delta + p0corr*xptar/100.;
578 Int_t hit_gold_track=0;
579 Int_t hit_dc_track=1;
583 hit_gold_track=itrack;
632 chi2Min = 10000000000.0;
649 x2Hits[goodRawPad] =
kTRUE;
652 y2Hits[goodRawPad] =
kTRUE;
660 if (!aTrack) {
delete[] x2Hits;
delete[] y2Hits;
return -1;}
687 if (diff < mindiff) mindiff = diff;
701 if (diff < mindiff) mindiff = diff;
714 if ( y2D <= y2Dmin ) {
715 if ( y2D < y2Dmin ) {
717 chi2Min = 10000000000.;
720 if ( x2D <= x2Dmin ){
722 chi2Min = 10000000000.0;
724 if ( chi2PerDeg < chi2Min ){
729 chi2Min = chi2PerDeg;
744 chi2Min = 10000000000.0;
748 if (!aTrack)
return -1;
753 if ( chi2PerDeg < chi2Min ){
756 chi2Min = chi2PerDeg;
790 chi2Min = 10000000000.0;
799 keep[ptrack] =
kTRUE;
802 if (!testTracks[ptrack])
return -1;
809 if ( (
TMath::Abs( testTracks[ptrack]->GetTTheta() ) <
fPruneXp ) && ( keep[ptrack] ) ){
826 if ( (
TMath::Abs( testTracks[ptrack]->GetTPhi() ) <
fPruneYp ) && ( keep[ptrack] ) ){
853 reject[ptrack] += 10;
871 reject[ptrack] += 20;
897 reject[ptrack] += 30;
909 if ( (
TMath::Abs( testTracks[ptrack]->GetBeta() - betaP ) <
fPruneBeta ) && ( keep[ptrack] ) ){
919 reject[ptrack] += 100;
929 if ( ( testTracks[ptrack]->GetNDoF() >=
fPruneDf ) && ( keep[ptrack] ) ){
935 if ( testTracks[ptrack]->GetNDoF() <
fPruneDf ){
937 reject[ptrack] += 200;
947 if ( ( testTracks[ptrack]->GetNPMT() >=
fPruneNPMT ) && ( keep[ptrack] ) ){
953 if ( testTracks[ptrack]->GetNPMT() <
fPruneNPMT ){
955 reject[ptrack] += 100000;
965 if ( ( testTracks[ptrack]->GetBetaChi2() <
fPruneChiBeta ) &&
966 ( testTracks[ptrack]->GetBetaChi2() > 0.01 ) && ( keep[ptrack] ) ){
972 if ( ( testTracks[ptrack]->GetBetaChi2() >=
fPruneChiBeta ) ||
973 ( testTracks[ptrack]->GetBetaChi2() <= 0.01 ) ){
975 reject[ptrack] += 1000;
994 reject[ptrack] += 2000;
1004 if ( ( testTracks[ptrack]->GetGoodPlane4() == 1 ) && keep[ptrack] ) {
1010 if ( testTracks[ptrack]->GetGoodPlane4() != 1 ) {
1012 reject[ptrack] += 10000;
1022 if ( ( testTracks[ptrack]->GetGoodPlane3() == 1 ) && keep[ptrack] ) {
1028 if ( testTracks[ptrack]->GetGoodPlane3() != 1 ) {
1030 reject[ptrack] += 20000;
1041 chi2PerDeg = testTracks[ptrack]->
GetChi2() / testTracks[ptrack]->
GetNDoF();
1043 if ( ( chi2PerDeg < chi2Min ) && ( keep[ptrack] ) ){
1045 chi2Min = chi2PerDeg;
1122 Double_t xdip = x_fp + xp_fp*DipoleExitWindowZpos;
1123 Double_t ydip = y_fp + yp_fp*DipoleExitWindowZpos;
1138 if ( ((xdip-voffset)*(xdip-voffset)+(ydip-hwid)*(ydip-hwid)) > crad*crad) insideSHMS=
kFALSE;
1140 if ( ydip <=-hwid) {
1141 if ( ((xdip-voffset)*(xdip-voffset)+(ydip+hwid)*(ydip+hwid)) > crad*crad) insideSHMS=
kFALSE;
1152 if ( ((xdip-xpipe_offset)*(xdip-xpipe_offset)+(ydip-ypipe_offset)*(ydip-ypipe_offset)) > pipe_rad*pipe_rad) insideHMS=
kFALSE;
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char mode
ClassImp(VDC::AnalyticTTDConv) using namespace std
R__EXTERN class THcParmList * gHcParms
void Sort(Int_t upto=kMaxInt) override
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 THaDetector * GetDetector(const char *name)
virtual Int_t Decode(const THaEvData &)
void SetCentralAngles(Double_t th, Double_t ph, Bool_t bend_down)
virtual Int_t DefineVariables(EMode mode=kDefine)
Double_t GetEnergy() const
Double_t GetTheta() const
THaVar * Define(const char *name, const Byte_t &var, const Int_t *count=nullptr)
Analyze a package of horizontal drift chambers.
void SetFocalPlaneBestTrack(Int_t golden_track_index)
A standard Hall C spectrometer apparatus.
virtual Bool_t IsMyEvent(Int_t evtype) const
virtual Int_t TrackTimes(TClonesArray *tracks)
Double_t fThetaCentralOffset
void InitializeReconstruction()
Bool_t GetTrSorting() const
Bool_t SHMSDipoleExitWindow(Double_t x_dip, Double_t y_dip)
virtual void CalculateTargetQuantities(THaTrack *track, Double_t &gbeam_y, Double_t &xptar, Double_t &ytar, Double_t &yptar, Double_t &delta)
Transport focal plane track to target.
virtual void EnforcePruneLimits()
Enforce minimum values for the prune cuts.
Double_t fOopCentralOffset
virtual Int_t Decode(const THaEvData &)
virtual Int_t TrackCalc()
Bool_t HMSDipoleExitWindow(Double_t x_dip, Double_t y_dip)
virtual Int_t BestTrackUsingScin()
Choose best track using closeness to scintillator hits.
virtual Int_t ReadDatabase(const TDatime &date)
Loads parameters to characterize a Hall C spectrometer.
THcHallCSpectrometer(const char *name, const char *description)
Bool_t fUseSHMSDipoleExitWindow
static const UInt_t kSortTracks
virtual void SetEvtType(int evtype)
virtual void AddEvtType(int evtype)
virtual Int_t BestTrackUsingPrune()
Choose best track after pruning.
std::vector< Int_t > eventtypes
Double_t fPruneDipoleExit
Bool_t InsideDipoleExitWindow(Double_t x_fp, Double_t xp_fp, Double_t y_fp, Double_t yp_fp)
std::vector< reconTerm > fReconTerms
virtual Int_t BestTrackSimple()
Choose best track based on Chisq.
virtual Int_t FindVertices(TClonesArray &tracks)
Reconstruct target coordinates.
virtual Int_t DefineVariables(EMode mode=kDefine)
Bool_t SetTrSorting(Bool_t set=kFALSE)
Bool_t fUseHMSDipoleExitWindow
virtual ~THcHallCSpectrometer()
virtual Int_t ReadRunDatabase(const TDatime &date)
Generic hodoscope consisting of multiple planes with multiple paddles with phototubes on both ends.
Int_t GetGoodRawPad(Int_t iii)
Double_t GetPlaneCenter(Int_t ip)
UInt_t GetNPaddles(Int_t ip)
Double_t GetStartTimeCenter() const
Int_t GetGoodRawPlane(Int_t iii)
Double_t GetPlaneSpacing(Int_t ip)
Int_t LoadParmValues(const DBRequest *list, const char *prefix="")
Retrieve parameter values from the parameter cache.
const char * GetName() const override
TObject * At(Int_t idx) const override
virtual void Error(const char *method, const char *msgfmt,...) const
void SetXYZ(Double_t x, Double_t y, Double_t z)
RVec< PromoteTypes< T0, T1 > > pow(const RVec< T0 > &v, const T1 &y)
Double_t Min(Double_t a, Double_t b)
Double_t Sqrt(Double_t x)
Double_t Max(Double_t a, Double_t b)
constexpr Double_t RadToDeg()