From 97678b527f6d5e4163f6e8bc85bc4c4b4ce3136a Mon Sep 17 00:00:00 2001 From: "Stephen A. Wood" <saw@jlab.org> Date: Fri, 7 Sep 2018 08:58:14 -0400 Subject: [PATCH] Save readout side information in THcDCWire objects Determine readout side in THcDriftChamberPlane at initialization time. --- src/THcDCHit.h | 85 +----------------------------------- src/THcDCWire.h | 8 +++- src/THcDriftChamberPlane.cxx | 83 ++++++++++++++++++++++++++++++++++- src/THcDriftChamberPlane.h | 3 +- 4 files changed, 91 insertions(+), 88 deletions(-) diff --git a/src/THcDCHit.h b/src/THcDCHit.h index 6636e9e..d6bb14b 100644 --- a/src/THcDCHit.h +++ b/src/THcDCHit.h @@ -58,90 +58,7 @@ public: Int_t GetChamberNum() const { return fWirePlane->GetChamberNum(); } void SetCorrectedStatus(Int_t c) { fCorrected = c; } - Int_t GetReadoutSide() { - Int_t pln = fWirePlane->GetPlaneNum(); - Int_t tb = fWirePlane->GetReadoutTB(); - Int_t wn = fWire->GetNum(); - Int_t version = fWirePlane->GetVersion(); - - //if new HMS - if (version == 1) { - if ((pln>=3 && pln<=4) || (pln>=9 && pln<=10)) { - if (tb>0) { - if (wn < 60) { - fReadoutSide = 2; - } else { - fReadoutSide = 4; - } - } else { - if (wn < 44) { - fReadoutSide = 4; - } else { - fReadoutSide = 2; - } - } - } else { - if (tb>0) { - if (wn < 51) { - fReadoutSide = 2; - } else if (wn >= 51 && wn <= 64) { - fReadoutSide = 1; - } else { - fReadoutSide =4; - } - } else { - if (wn < 33) { - fReadoutSide = 4; - } else if (wn >=33 && wn<=46) { - fReadoutSide = 1; - } else { - fReadoutSide = 2; - } - } - } - } else{//appplies SHMS DC configuration - //check if x board - if ((pln>=3 && pln<=4) || (pln>=9 && pln<=10)) { - if (tb>0) { - if (wn < 49) { - fReadoutSide = 4; - } else { - fReadoutSide = 2; - } - } else { - if (wn < 33) { - fReadoutSide = 2; - } else { - fReadoutSide = 4; - } - } - } else { //else is u board - if (tb>0) { - if (wn < 41) { - fReadoutSide = 4; - } else if (wn >= 41 && wn <= 63) { - fReadoutSide = 3; - } else if (wn >=64 && wn <=69) { - fReadoutSide = 1; - } else { - fReadoutSide = 2; - } - } else { - if (wn < 39) { - fReadoutSide = 2; - } else if (wn >=39 && wn<=44) { - fReadoutSide = 1; - } else if (wn>=45 && wn<=67) { - fReadoutSide = 3; - } else { - fReadoutSide = 4; - } - } - } - } - return fReadoutSide; - } - + Int_t GetReadoutSide() { return(fWire->GetReadoutSide()); } protected: static const Double_t kBig; //! diff --git a/src/THcDCWire.h b/src/THcDCWire.h index efbcc74..535ded9 100644 --- a/src/THcDCWire.h +++ b/src/THcDCWire.h @@ -15,8 +15,10 @@ class THcDCWire : public TObject { public: THcDCWire( Int_t num=0, Double_t pos=0.0, Double_t offset=0.0, Double_t sigma=0.0, - THcDCTimeToDistConv* ttd=NULL ) : - fNum(num), fFlag(0), fPos(pos), fTOffset(offset), fSigmaWire(sigma), fTTDConv(ttd) {} + Int_t readoutside=0, + THcDCTimeToDistConv* ttd=NULL ) : + fNum(num), fFlag(0), fPos(pos), fTOffset(offset), fSigmaWire(sigma), + fReadoutSide(readoutside), fTTDConv(ttd) {} virtual ~THcDCWire() {} // Get and Set Functions @@ -25,6 +27,7 @@ public: Double_t GetPos() const { return fPos; } Double_t GetTOffset() const { return fTOffset; } Double_t GetSigma() const { return fSigmaWire; } + Int_t GetReadoutSide() { return fReadoutSide; } THcDCTimeToDistConv * GetTTDConv() { return fTTDConv; } void SetNum (Int_t num) {fNum = num;} @@ -40,6 +43,7 @@ protected: Double_t fPos; //Position within the plane Double_t fTOffset; //Timing Offset Double_t fSigmaWire; //Added SIgma per Wire --Carlos + Int_t fReadoutSide; // Side where wire is read out. 1-4 is T/R/B/L from beam view for new chambers. THcDCTimeToDistConv* fTTDConv; //!Time to Distance Converter private: diff --git a/src/THcDriftChamberPlane.cxx b/src/THcDriftChamberPlane.cxx index 4acfbac..f72748b 100644 --- a/src/THcDriftChamberPlane.cxx +++ b/src/THcDriftChamberPlane.cxx @@ -256,7 +256,8 @@ Int_t THcDriftChamberPlane::ReadDatabase( const TDatime& date ) for (int i=0; i<nWires; i++) { Double_t pos = fPitch*( (fWireOrder==0?(i+1):fNWires-i) - fCentralWire) - fCenter; - new((*fWires)[i]) THcDCWire( i+1, pos , fTzeroWire[i], fSigmaWire[i], fTTDConv); //added fTzeroWire/fSigmaWire to be read in as fTOffset --Carlos + Int_t readoutside = GetReadoutSide(i+1); + new((*fWires)[i]) THcDCWire( i+1, pos , fTzeroWire[i], fSigmaWire[i], readoutside, fTTDConv); //added fTzeroWire/fSigmaWire to be read in as fTOffset --Carlos } THaApparatus* app = GetApparatus(); @@ -388,3 +389,83 @@ Int_t THcDriftChamberPlane::SubtractStartTime() } return 0; } +Int_t THcDriftChamberPlane::GetReadoutSide(Int_t wirenum) +{ + Int_t readoutside; + //if new HMS + if (fVersion == 1) { + if ((fPlaneNum>=3 && fPlaneNum<=4) || (fPlaneNum>=9 && fPlaneNum<=10)) { + if (fReadoutTB>0) { + if (wirenum < 60) { + readoutside = 2; + } else { + readoutside = 4; + } + } else { + if (wirenum < 44) { + readoutside = 4; + } else { + readoutside = 2; + } + } + } else { + if (fReadoutTB>0) { + if (wirenum < 51) { + readoutside = 2; + } else if (wirenum >= 51 && wirenum <= 64) { + readoutside = 1; + } else { + readoutside =4; + } + } else { + if (wirenum < 33) { + readoutside = 4; + } else if (wirenum >=33 && wirenum<=46) { + readoutside = 1; + } else { + readoutside = 2; + } + } + } + } else {//appplies SHMS DC configuration + //check if x board + if ((fPlaneNum>=3 && fPlaneNum<=4) || (fPlaneNum>=9 && fPlaneNum<=10)) { + if (fReadoutTB>0) { + if (wirenum < 49) { + readoutside = 4; + } else { + readoutside = 2; + } + } else { + if (wirenum < 33) { + readoutside = 2; + } else { + readoutside = 4; + } + } + } else { //else is u board + if (fReadoutTB>0) { + if (wirenum < 41) { + readoutside = 4; + } else if (wirenum >= 41 && wirenum <= 63) { + readoutside = 3; + } else if (wirenum >=64 && wirenum <=69) { + readoutside = 1; + } else { + readoutside = 2; + } + } else { + if (wirenum < 39) { + readoutside = 2; + } else if (wirenum >=39 && wirenum<=44) { + readoutside = 1; + } else if (wirenum>=45 && wirenum<=67) { + readoutside = 3; + } else { + readoutside = 4; + } + } + } + } + return(readoutside); +} diff --git a/src/THcDriftChamberPlane.h b/src/THcDriftChamberPlane.h index b074cb4..e008afc 100644 --- a/src/THcDriftChamberPlane.h +++ b/src/THcDriftChamberPlane.h @@ -44,7 +44,8 @@ public: virtual Int_t SubtractStartTime(); - + virtual Int_t GetReadoutSide(Int_t wirenum); + // Get and Set functions Int_t GetNWires() const { return fWires->GetLast()+1; } THcDCWire* GetWire(Int_t i) const -- GitLab