From a32d5c48a63a6bfa0f4c0c51a8bf6608e823e369 Mon Sep 17 00:00:00 2001 From: Ak1508 <ak1508@msstate.edu> Date: Wed, 31 May 2017 17:39:26 -0400 Subject: [PATCH] Good Hodo variables. Added to THcScintillatorPlane.h Initialize and clear in THcScintillatorPlane.cxx Add raw multiplicities for ADCs and TDCs --- src/THcScintillatorPlane.cxx | 145 ++++++++++++++++++++++++++++++----- src/THcScintillatorPlane.h | 50 ++++++++++++ 2 files changed, 174 insertions(+), 21 deletions(-) diff --git a/src/THcScintillatorPlane.cxx b/src/THcScintillatorPlane.cxx index 94682cd..ffdb479 100644 --- a/src/THcScintillatorPlane.cxx +++ b/src/THcScintillatorPlane.cxx @@ -74,7 +74,7 @@ THcScintillatorPlane::THcScintillatorPlane( const char* name, fPlaneNum = planenum; fTotPlanes = planenum; fNScinHits = 0; - // + fMaxHits=53; fpTimes = new Double_t [fMaxHits]; @@ -235,7 +235,7 @@ Int_t THcScintillatorPlane::ReadDatabase( const TDatime& date ) cout << " cosmic flag = " << fCosmicFlag << endl; // fetch the parameter from the temporary list - // Retrieve parameters we need from parent class + // Retrieve parameters we need from parent class // Common for all planes fAdcTimeWindowMin = ((THcHodoscope*) GetParent())->GetAdcTimeWindowMin(fPlaneNum-1); fAdcTimeWindowMax = ((THcHodoscope*) GetParent())->GetAdcTimeWindowMax(fPlaneNum-1); @@ -306,6 +306,29 @@ Int_t THcScintillatorPlane::ReadDatabase( const TDatime& date ) // Create arrays to hold results here InitializePedestals(); + + fNumGoodPosAdcHits = vector<Int_t> (fNelem, 0.0); + fNumGoodNegAdcHits = vector<Int_t> (fNelem, 0.0); + fNumGoodPosTdcHits = vector<Int_t> (fNelem, 0.0); + fNumGoodNegTdcHits = vector<Int_t> (fNelem, 0.0); + + fGoodPosAdcPed = vector<Double_t> (fNelem, 0.0); + fGoodNegAdcPed = vector<Double_t> (fNelem, 0.0); + fGoodPosAdcPulseAmp = vector<Double_t> (fNelem, 0.0); + fGoodNegAdcPulseAmp = vector<Double_t> (fNelem, 0.0); + fGoodPosAdcPulseInt = vector<Double_t> (fNelem, 0.0); + fGoodNegAdcPulseInt = vector<Double_t> (fNelem, 0.0); + fGoodPosAdcPulseTime = vector<Double_t> (fNelem, 0.0); + fGoodNegAdcPulseTime = vector<Double_t> (fNelem, 0.0); + + fGoodPosTdcChan = vector<Double_t> (fNelem, 0.0); + fGoodNegTdcChan = vector<Double_t> (fNelem, 0.0); + fGoodPosTdcTimeCorr = vector<Double_t> (fNelem, 0.0); + fGoodNegTdcTimeCorr = vector<Double_t> (fNelem, 0.0); + fGoodPosTdcTimeTOFCorr = vector<Double_t> (fNelem, 0.0); + fGoodNegTdcTimeTOFCorr = vector<Double_t> (fNelem, 0.0); + + return kOK; } @@ -324,10 +347,10 @@ Int_t THcScintillatorPlane::DefineVariables( EMode mode ) {"posAdcErrorFlag", "Error Flag for When FPGA Fails", "frPosAdcErrorFlag.THcSignalHit.GetData()"}, {"negAdcErrorFlag", "Error Flag for When FPGA Fails", "frNegAdcErrorFlag.THcSignalHit.GetData()"}, - {"posTdcCounter", "List of positive TDC counter numbers.", "frPosTdcTimeRaw.THcSignalHit.GetPaddleNumber()"}, - {"posAdcCounter", "List of positive ADC counter numbers.", "frPosAdcPulseIntRaw.THcSignalHit.GetPaddleNumber()"}, - {"negTdcCounter", "List of negative TDC counter numbers.", "frNegTdcTimeRaw.THcSignalHit.GetPaddleNumber()"}, - {"negAdcCounter", "List of negative ADC counter numbers.", "frNegAdcPulseIntRaw.THcSignalHit.GetPaddleNumber()"}, + {"posTdcCounter", "List of positive TDC counter numbers.", "frPosTdcTimeRaw.THcSignalHit.GetPaddleNumber()"}, //Hodo+ raw TDC occupancy + {"posAdcCounter", "List of positive ADC counter numbers.", "frPosAdcPulseIntRaw.THcSignalHit.GetPaddleNumber()"}, //Hodo+ raw ADC occupancy + {"negTdcCounter", "List of negative TDC counter numbers.", "frNegTdcTimeRaw.THcSignalHit.GetPaddleNumber()"}, //Hodo- raw TDC occupancy + {"negAdcCounter", "List of negative ADC counter numbers.", "frNegAdcPulseIntRaw.THcSignalHit.GetPaddleNumber()"}, //Hodo- raw ADC occupancy {"posTdcTimeRaw", "List of positive raw TDC values.", "frPosTdcTimeRaw.THcSignalHit.GetData()"}, {"posAdcPedRaw", "List of positive raw ADC pedestals", "frPosAdcPedRaw.THcSignalHit.GetData()"}, @@ -355,23 +378,38 @@ Int_t THcScintillatorPlane::DefineVariables( EMode mode ) // {"nhits", "Number of paddle hits (passed TDC && ADC Min and Max cuts for either end)", "GetNScinHits() "}, - {"totNumPosAdcHits", "Total Number of Positive ADC Hits", "fTotNumPosAdcHits"}, // Hodo+ raw ADC multiplicity - {"totNumNegAdcHits", "Total Number of Negative ADC Hits", "fTotNumNegAdcHits"}, // Hodo- raw ADC multiplicity - {"totnumAdcHits", "Total Number of ADC Hits Per PMT", "fTotNumAdcHits"}, // Hodo raw ADC multiplicity + {"totNumPosAdcHits", "Total Number of Positive ADC Hits", "fTotNumPosAdcHits"}, // Hodo+ raw ADC multiplicity Int_t + {"totNumNegAdcHits", "Total Number of Negative ADC Hits", "fTotNumNegAdcHits"}, // Hodo- raw ADC multiplicity "" + {"totNumAdcHits", "Total Number of PMTs Hit (as measured by ADCs)", "fTotNumAdcHits"}, // Hodo raw ADC multiplicity "" + + {"totNumPosTdcHits", "Total Number of Positive TDC Hits", "fTotNumPosTdcHits"}, // Hodo+ raw TDC multiplicity "" + {"totNumNegTdcHits", "Total Number of Negative TDC Hits", "fTotNumNegTdcHits"}, // Hodo- raw TDC multiplicity "" + {"totNumTdcHits", "Total Number of PMTs Hits (as measured by TDCs)", "fTotNumTdcHits"}, // Hodo raw TDC multiplicity "" + + + {"numGoodPosAdcHits", "Number of Good Positive ADC Hits Per PMT", "fNumGoodPosAdcHits"}, // Hodo+ good ADC occupancy - vector<Int_t> + {"numGoodNegAdcHits", "Number of Good Negative ADC Hits Per PMT", "fNumGoodNegAdcHits"}, // Hodo- good ADC occupancy - vector <Int_t> + + {"numGoodPosTdcHits", "Number of Good Positive TDC Hits Per PMT", "fNumGoodPosTdcHits"}, // Hodo+ good TDC occupancy - vector<Int_t> + {"numGoodNegTdcHits", "Number of Good Negative TDC Hits Per PMT", "fNumGoodNegTdcHits"}, // Hodo- good TDC occupancy - vector <Int_t> + + + {"totNumGoodPosAdcHits", "Total Number of Good Positive ADC Hits", "fTotNumGoodPosAdcHits"}, // Hodo+ good ADC multiplicity - Int_t + {"totNumGoodNegAdcHits", "Total Number of Good Negative ADC Hits", "fTotNumGoodNegAdcHits"}, // Hodo- good ADC multiplicity - Int_t + {"totNumGoodAdcHits", "TotalNumber of Good ADC Hits Per PMT", "fTotNumGoodAdcHits"}, // Hodo good ADC multiplicity - Int_t + + {"totNumGoodPosTdcHits", "Total Number of Good Positive TDC Hits", "fTotNumGoodPosTdcHits"}, // Hodo+ good TDC multiplicity - Int_t + {"totNumGoodNegTdcHits", "Total Number of Good Negative TDC Hits", "fTotNumGoodNegTdcHits"}, // Hodo- good TDC multiplicity - Int_t + {"totNumGoodTdcHits", "TotalNumber of Good TDC Hits Per PMT", "fTotNumGoodTdcHits"}, // Hodo good TDC multiplicity - Int_t - {"numGoodPosAdcHits", "Number of Good Positive ADC Hits Per PMT", "fNumGoodPosAdcHits"}, // Hodo+ good ADC occupancy - {"numGoodNegAdcHits", "Number of Good Negative ADC Hits Per PMT", "fNumGoodNegAdcHits"}, // Hodo- good ADC occupancy - {"totNumGoodPosAdcHits", "Total Number of Good Positive ADC Hits", "fTotNumGoodPosAdcHits"}, // Hodo+ good ADC multiplicity - {"totNumGoodNegAdcHits", "Total Number of Good Negative ADC Hits", "fTotNumGoodNegAdcHits"}, // Hodo- good ADC multiplicity - {"totNumGoodAdcHits", "TotalNumber of Good ADC Hits Per PMT", "fTotNumGoodAdcHits"}, // Hodo good ADC multiplicity // {"GoodPaddle", "List of Paddle Numbers (passed TDC && ADC Min and Max cuts for either end)", "fHodoHits.THcHodoHit.GetPaddleNumber()"}, - {"GoodPosAdcPed", "List of Positive ADC pedestals (passed TDC && ADC Min and Max cuts for either end)", "fGoodPosAdcPed"}, - {"GoodNegAdcPed", "List of Negative ADC pedestals (passed TDC && ADC Min and Max cuts for either end)", "fGoodNegAdcPed"}, + {"GoodPosAdcPed", "List of Positive ADC pedestals (passed TDC && ADC Min and Max cuts for either end)", "fGoodPosAdcPed"}, //vector<Double_t> + {"GoodNegAdcPed", "List of Negative ADC pedestals (passed TDC && ADC Min and Max cuts for either end)", "fGoodNegAdcPed"}, //vector<Double_t> - {"GoodNegTdcChan", "List of negative TDC values (passed TDC && ADC Min and Max cuts for either end)", "fGoodNegTdcChan"}, + {"GoodNegTdcChan", "List of negative TDC values (passed TDC && ADC Min and Max cuts for either end)", "fGoodNegTdcChan"}, //Units ns {"GoodNegTdcTimeCorr", "List of negative corrected TDC values (corrected for PMT offset and ADC)", "fGoodNegTdcTimeCorr"}, {"GoodNegTdcTimeTOFCorr", "List of negative corrected TDC values (corrected for TOF)", "fGoodNegTdcTimeTOFCorr"}, {"GoodNegAdcPulseInt", "List of negative ADC values (passed TDC && ADC Min and Max cuts for either end)", "fGoodNegAdcPulseInt"}, @@ -430,6 +468,63 @@ void THcScintillatorPlane::Clear( Option_t* ) frNegAdcPulseInt->Clear(); frNegAdcPulseAmp->Clear(); + + //Clear multiplicities + fTotNumPosAdcHits = 0; + fTotNumNegAdcHits = 0; + fTotNumAdcHits = 0; + + fTotNumPosTdcHits = 0; + fTotNumNegTdcHits = 0; + fTotNumTdcHits = 0; + + fTotNumGoodPosAdcHits = 0; + fTotNumGoodNegAdcHits = 0; + fTotNumGoodAdcHits = 0; + + fTotNumGoodPosTdcHits = 0; + fTotNumGoodNegTdcHits = 0; + fTotNumGoodTdcHits = 0; + + //Clear occupancies + for (UInt_t ielem = 0; ielem < fNumGoodPosAdcHits.size(); ielem++) + fNumGoodPosAdcHits.at(ielem) = 0; + for (UInt_t ielem = 0; ielem < fNumGoodNegAdcHits.size(); ielem++) + fNumGoodNegAdcHits.at(ielem) = 0; + + for (UInt_t ielem = 0; ielem < fNumGoodPosTdcHits.size(); ielem++) + fNumGoodPosTdcHits.at(ielem) = 0; + for (UInt_t ielem = 0; ielem < fNumGoodNegTdcHits.size(); ielem++) + fNumGoodNegTdcHits.at(ielem) = 0; + + //Clear Ped/Amps/Int/Time + for (UInt_t ielem = 0; ielem < fGoodPosAdcPed.size(); ielem++) { + fGoodPosAdcPed.at(ielem) = 0.0; + fGoodPosAdcPulseInt.at(ielem) = 0.0; + fGoodPosAdcPulseAmp.at(ielem) = 0.0; + fGoodPosAdcPulseTime.at(ielem) = 0.0; + } + for (UInt_t ielem = 0; ielem < fGoodNegAdcPed.size(); ielem++) { + fGoodNegAdcPed.at(ielem) = 0.0; + fGoodNegAdcPulseInt.at(ielem) = 0.0; + fGoodNegAdcPulseAmp.at(ielem) = 0.0; + fGoodNegAdcPulseTime.at(ielem) = 0.0; + } + + //Clear Good TDC Variables + for (UInt_t ielem = 0; ielem < fGoodPosTdcChan.size(); ielem++) { + fGoodPosTdcChan.at(ielem) = 0.0; + fGoodPosTdcTimeCorr.at(ielem) = 0.0; + fGoodPosTdcTimeTOFCorr.at(ielem) = 0.0; + } + + for (UInt_t ielem = 0; ielem < fGoodNegTdcChan.size(); ielem++) { + fGoodNegTdcChan.at(ielem) = 0.0; + fGoodNegTdcTimeCorr.at(ielem) = 0.0; + fGoodNegTdcTimeTOFCorr.at(ielem) = 0.0; + } + + fpTime = -1.e4; } @@ -554,12 +649,16 @@ Int_t THcScintillatorPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) ((THcSignalHit*) frPosTdcTimeRaw->ConstructedAt(nrPosTdcHits))->Set(padnum, rawPosTdcHit.GetTimeRaw(thit)); ((THcSignalHit*) frPosTdcTime->ConstructedAt(nrPosTdcHits))->Set(padnum, rawPosTdcHit.GetTime(thit)); ++nrPosTdcHits; + fTotNumTdcHits++; + fTotNumPosTdcHits++; } THcRawTdcHit& rawNegTdcHit = hit->GetRawTdcHitNeg(); for (UInt_t thit=0; thit<rawNegTdcHit.GetNHits(); ++thit) { ((THcSignalHit*) frNegTdcTimeRaw->ConstructedAt(nrNegTdcHits))->Set(padnum, rawNegTdcHit.GetTimeRaw(thit)); ((THcSignalHit*) frNegTdcTime->ConstructedAt(nrNegTdcHits))->Set(padnum, rawNegTdcHit.GetTime(thit)); ++nrNegTdcHits; + fTotNumTdcHits++; + fTotNumNegTdcHits++; } THcRawAdcHit& rawPosAdcHit = hit->GetRawAdcHitPos(); for (UInt_t thit=0; thit<rawPosAdcHit.GetNPulses(); ++thit) { @@ -578,6 +677,8 @@ Int_t THcScintillatorPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) if (rawPosAdcHit.GetPulseAmpRaw(thit) <= 0) ((THcSignalHit*) frPosAdcErrorFlag->ConstructedAt(nrPosAdcHits))->Set(padnum, 1); ++nrPosAdcHits; + fTotNumAdcHits++; + fTotNumPosAdcHits++; } THcRawAdcHit& rawNegAdcHit = hit->GetRawAdcHitNeg(); for (UInt_t thit=0; thit<rawNegAdcHit.GetNPulses(); ++thit) { @@ -596,7 +697,9 @@ Int_t THcScintillatorPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) if (rawNegAdcHit.GetPulseAmpRaw(thit) <= 0) ((THcSignalHit*) frNegAdcErrorFlag->ConstructedAt(nrNegAdcHits))->Set(padnum, 1); ++nrNegAdcHits; - } + fTotNumAdcHits++; + fTotNumNegAdcHits++; + } // Need to be finding first hit in TDC range, not the first hit overall if (hit->GetRawTdcHitPos().GetNHits() > 0) @@ -780,9 +883,9 @@ Int_t THcScintillatorPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) } } // cout << fNScinHits<< " " << timec_pos << " " << timec_neg << endl; - ((THcHodoHit*) fHodoHits->At(fNScinHits))->SetPaddleCenter(fPosCenter[index]); - ((THcHodoHit*) fHodoHits->At(fNScinHits))->SetCorrectedTimes(timec_pos,timec_neg, - postime, negtime, + ((THcHodoHit*) fHodoHits->At(fNScinHits))->SetPaddleCenter(fPosCenter[index]); + ((THcHodoHit*) fHodoHits->At(fNScinHits))->SetCorrectedTimes(timec_pos,timec_neg, //set values for f(Pos/Neg)CorrectedTime and f(Pos/Neg)TOFCorrectedTime + postime, negtime, //given that tdc_pos && tdc_neg is within the tdcTimeWindow scin_corrected_time); } else { Double_t timec_pos,timec_neg; diff --git a/src/THcScintillatorPlane.h b/src/THcScintillatorPlane.h index ddecf78..8924f2a 100644 --- a/src/THcScintillatorPlane.h +++ b/src/THcScintillatorPlane.h @@ -15,6 +15,8 @@ #include "THaSubDetector.h" #include "TClonesArray.h" +using namespace std; + class THaEvData; class THaSignalHit; @@ -99,6 +101,54 @@ class THcScintillatorPlane : public THaSubDetector { TClonesArray* frNegAdcPulseInt; TClonesArray* frNegAdcPulseAmp; + //Hodoscopes Multiplicities + Int_t fTotNumPosAdcHits; + Int_t fTotNumNegAdcHits; + Int_t fTotNumAdcHits; + + Int_t fTotNumPosTdcHits; + Int_t fTotNumNegTdcHits; + Int_t fTotNumTdcHits; + + Int_t fTotNumGoodPosAdcHits; + Int_t fTotNumGoodNegAdcHits; + Int_t fTotNumGoodAdcHits; + + Int_t fTotNumGoodPosTdcHits; + Int_t fTotNumGoodNegTdcHits; + Int_t fTotNumGoodTdcHits; + + //Hodoscope "GOOD" Occupancies + vector<Int_t> fNumGoodPosAdcHits; + vector<Int_t> fNumGoodNegAdcHits; + + vector<Int_t> fNumGoodPosTdcHits; + vector<Int_t> fNumGoodNegTdcHits; + + //Hodoscopoe "GOOD" ADC Ped/Amps/Ints/Time + vector<Double_t> fGoodPosAdcPed; + vector<Double_t> fGoodNegAdcPed; + + vector<Double_t> fGoodPosAdcPulseAmp; + vector<Double_t> fGoodNegAdcPulseAmp; + + vector<Double_t> fGoodPosAdcPulseInt; + vector<Double_t> fGoodNegAdcPulseInt; + + vector<Double_t> fGoodPosAdcPulseTime; + vector<Double_t> fGoodNegAdcPulseTime; + + //Hodoscopoe "GOOD" TDC Variables + vector<Double_t> fGoodPosTdcChan; + vector<Double_t> fGoodPosTdcTimeCorr; + vector<Double_t> fGoodPosTdcTimeTOFCorr; + + vector<Double_t> fGoodNegTdcChan; + vector<Double_t> fGoodNegTdcTimeCorr; + vector<Double_t> fGoodNegTdcTimeTOFCorr; + + + Int_t fCosmicFlag; // Int_t fPlaneNum; /* Which plane am I 1-4 */ UInt_t fTotPlanes; /* so we can read variables that are not indexed by plane id */ -- GitLab