diff --git a/src/THcShowerArray.cxx b/src/THcShowerArray.cxx index 6e294ac9741bffcb01264b5804fba0ea7fec0cda..da4257281a27931d590bfcb4e033bacb37a8d460 100644 --- a/src/THcShowerArray.cxx +++ b/src/THcShowerArray.cxx @@ -653,7 +653,6 @@ Int_t THcShowerArray::ProcessHits(TClonesArray* rawhits, Int_t nexthit) // Initialize variables. - Int_t nADCHits=0; fADCHits->Clear(); frAdcPedRaw->Clear(); @@ -709,35 +708,33 @@ Int_t THcShowerArray::ProcessHits(TClonesArray* rawhits, Int_t nexthit) ++nrAdcHits; } + fADCMode=kADCDynamicPedestal; + Double_t adc; + Double_t adc_pedsub; + if(fADCMode == kADCDynamicPedestal) { + adc_pedsub = hit->GetRawAdcHitPos().GetPulseInt(); + adc= hit->GetRawAdcHitPos().GetPulseIntRaw(); + } else if (fADCMode == kADCSampleIntegral) { + adc_pedsub = hit->GetRawAdcHitPos().GetSampleIntRaw() - fPed[hit->fCounter -1]; + adc = hit->GetRawAdcHitPos().GetSampleIntRaw(); + } else if (fADCMode == kADCSampIntDynPed) { + adc = hit->GetRawAdcHitPos().GetSampleInt(); + adc_pedsub = hit->GetRawAdcHitPos().GetSampleIntRaw(); + } else { + adc_pedsub = hit->GetRawAdcHitPos().GetPulseIntRaw()-fPed[hit->fCounter -1]; + adc = hit->GetRawAdcHitPos().GetPulseIntRaw(); + } - // Should check that counter # is in range - if (fUsingFADC) { - fA[hit->fCounter-1] = hit->GetRawAdcHitPos().GetData( - fPedSampLow, fPedSampHigh, fDataSampLow, fDataSampHigh - ); - fP[hit->fCounter-1] = hit->GetRawAdcHitPos().GetAverage( - fPedSampLow, fPedSampHigh - ); - } - else { - fA[hit->fCounter-1] = hit->GetData(0); - } - + fA[hit->fCounter-1] = adc; + threshold=hit->GetRawAdcHitPos().GetPedRaw()+100; if(fA[hit->fCounter-1] > threshold) { ngood++; } // Sparsify hits, fill the hit list, compute the energy depostion. - + fThresh[hit->fCounter -1] = hit->GetRawAdcHitPos().GetPedRaw()+100; if(fA[hit->fCounter-1] > fThresh[hit->fCounter -1]) { - - THcSignalHit *sighit = (THcSignalHit*)fADCHits->ConstructedAt(nADCHits++); - sighit->Set(hit->fCounter, fA[hit->fCounter-1]); - - fUsingFADC ? - fA_p[hit->fCounter-1] = fA[hit->fCounter-1] : - fA_p[hit->fCounter-1] = fA[hit->fCounter-1] - fPed[hit->fCounter -1]; - + fA_p[hit->fCounter-1] = adc_pedsub; fE[hit->fCounter-1] += fA_p[hit->fCounter-1] * fGain[hit->fCounter-1]; } diff --git a/src/THcShowerArray.h b/src/THcShowerArray.h index 18d2be0e2b7eba23f7415c7a72885aa2906f432b..ad0167030189296b445014c8880208e9f00f461a 100644 --- a/src/THcShowerArray.h +++ b/src/THcShowerArray.h @@ -98,7 +98,15 @@ protected: Double_t** fYPos; // block Y coordinates Int_t fUsingFADC; // != 0 if using FADC in sample mode - Int_t fPedSampLow; // Sample range for + Int_t fADCMode; // + // 1 == Use the pulse int - pulse ped + // 2 == Use the sample integral - known ped + // 3 == Use the sample integral - sample ped + static const Int_t kADCStandard=0; + static const Int_t kADCDynamicPedestal=1; + static const Int_t kADCSampleIntegral=2; + static const Int_t kADCSampIntDynPed=3; + Int_t fPedSampLow; // Sample range for Int_t fPedSampHigh; // dynamic pedestal Int_t fDataSampLow; // Sample range for Int_t fDataSampHigh; // sample integration diff --git a/src/THcShowerPlane.cxx b/src/THcShowerPlane.cxx index b078c31f447972626751c77e1f3ed2bf9bc73334..44eba1a16fea009b9fb5a524d01e0277ad622d4c 100644 --- a/src/THcShowerPlane.cxx +++ b/src/THcShowerPlane.cxx @@ -362,8 +362,6 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) // Initialize variables. - Int_t nPosADCHits=0; - Int_t nNegADCHits=0; fPosADCHits->Clear(); fNegADCHits->Clear(); @@ -451,32 +449,45 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) ++nrNegAdcHits; } - // Should probably check that counter # is in range - if (fUsingFADC) { - fA_Pos[hit->fCounter-1] = hit->GetRawAdcHitPos().GetData( - fPedSampLow, fPedSampHigh, fDataSampLow, fDataSampHigh - ); - fA_Neg[hit->fCounter-1] = hit->GetRawAdcHitNeg().GetData( - fPedSampLow, fPedSampHigh, fDataSampLow, fDataSampHigh - ); - } - else { - fA_Pos[hit->fCounter-1] = hit->GetData(0); - fA_Neg[hit->fCounter-1] = hit->GetData(1); - } - + fADCMode=kADCDynamicPedestal; + Double_t adc_pos; + Double_t adc_neg; + Double_t adc_pos_pedsub; + Double_t adc_neg_pedsub; + if(fADCMode == kADCDynamicPedestal) { + adc_pos_pedsub = hit->GetRawAdcHitPos().GetPulseInt(); + adc_neg_pedsub = hit->GetRawAdcHitNeg().GetPulseInt(); + adc_pos = hit->GetRawAdcHitPos().GetPulseIntRaw(); + adc_neg = hit->GetRawAdcHitNeg().GetPulseIntRaw(); + } else if (fADCMode == kADCSampleIntegral) { + adc_pos_pedsub = hit->GetRawAdcHitPos().GetSampleIntRaw() - fPosPed[hit->fCounter -1]; + adc_neg_pedsub = hit->GetRawAdcHitNeg().GetSampleIntRaw() - fNegPed[hit->fCounter -1]; + adc_pos = hit->GetRawAdcHitPos().GetSampleIntRaw(); + adc_neg = hit->GetRawAdcHitNeg().GetSampleIntRaw(); + } else if (fADCMode == kADCSampIntDynPed) { + adc_pos = hit->GetRawAdcHitPos().GetSampleInt(); + adc_neg = hit->GetRawAdcHitNeg().GetSampleInt(); + adc_pos_pedsub = hit->GetRawAdcHitPos().GetSampleIntRaw(); + adc_neg_pedsub = hit->GetRawAdcHitNeg().GetSampleIntRaw(); + } else { + adc_pos_pedsub = hit->GetRawAdcHitPos().GetPulseIntRaw()-fPosPed[hit->fCounter -1]; + adc_neg_pedsub = hit->GetRawAdcHitNeg().GetPulseIntRaw()-fNegPed[hit->fCounter -1]; + adc_pos = hit->GetRawAdcHitPos().GetPulseIntRaw(); + adc_neg = hit->GetRawAdcHitNeg().GetPulseIntRaw(); + } + // // Sparsify positive side hits, fill the hit list, compute the // energy depostion from positive side for the counter. + fA_Pos[hit->fCounter-1] =adc_pos; + fA_Neg[hit->fCounter-1] =adc_neg; Double_t thresh_pos = fPosThresh[hit->fCounter -1]; + thresh_pos =0; if(fA_Pos[hit->fCounter-1] > thresh_pos) { - THcSignalHit *sighit = - (THcSignalHit*) fPosADCHits->ConstructedAt(nPosADCHits++); - sighit->Set(hit->fCounter, fA_Pos[hit->fCounter-1]); - - fA_Pos_p[hit->fCounter-1] = fA_Pos[hit->fCounter-1] - fPosPed[hit->fCounter -1]; + fA_Pos_p[hit->fCounter-1] =adc_pos_pedsub ; + // cout << " pos " << hit->fCounter << " " << fA_Pos_p[hit->fCounter-1] << " " << fA_Pos[hit->fCounter-1] << " " << fPosPed[hit->fCounter -1] << "" << frNegAdcPulseAmp->ConstructedAt(nrNegAdcHits-1))->Get(padnum)<< endl; fEpos[hit->fCounter-1] += fA_Pos_p[hit->fCounter-1]* fParent->GetGain(hit->fCounter-1,fLayerNum-1,0); } @@ -485,13 +496,11 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) // energy depostion from negative side for the counter. Double_t thresh_neg = fNegThresh[hit->fCounter -1]; + thresh_neg=0; if(fA_Neg[hit->fCounter-1] > thresh_neg) { - THcSignalHit *sighit = - (THcSignalHit*) fNegADCHits->ConstructedAt(nNegADCHits++); - sighit->Set(hit->fCounter, fA_Neg[hit->fCounter-1]); - fA_Neg_p[hit->fCounter-1] = fA_Neg[hit->fCounter-1] - fNegPed[hit->fCounter -1]; + fA_Neg_p[hit->fCounter-1] =adc_neg_pedsub ; fEneg[hit->fCounter-1] += fA_Neg_p[hit->fCounter-1]* fParent->GetGain(hit->fCounter-1,fLayerNum-1,1); diff --git a/src/THcShowerPlane.h b/src/THcShowerPlane.h index de1ebce63f52f778d1ac594c9466ed1e9eff5d59..8cb4346aa21ab3dd609d91ed79556275d0fb4332 100644 --- a/src/THcShowerPlane.h +++ b/src/THcShowerPlane.h @@ -110,7 +110,15 @@ protected: // Flash ADC parameters Int_t fUsingFADC; // != 0 if using FADC in sample mode - Int_t fPedSampLow; // Sample range for + Int_t fADCMode; // + // 1 == Use the pulse int - pulse ped + // 2 == Use the sample integral - known ped + // 3 == Use the sample integral - sample ped + static const Int_t kADCStandard=0; + static const Int_t kADCDynamicPedestal=1; + static const Int_t kADCSampleIntegral=2; + static const Int_t kADCSampIntDynPed=3; + Int_t fPedSampLow; // Sample range for Int_t fPedSampHigh; // dynamic pedestal Int_t fDataSampLow; // Sample range for Int_t fDataSampHigh; // sample integration