diff --git a/src/THcShowerPlane.cxx b/src/THcShowerPlane.cxx index 0eb653f36313b884fe221652f600ea4b117fd61a..866b981d4c8b721d7ffb22ddf7e13a6c7478c48e 100644 --- a/src/THcShowerPlane.cxx +++ b/src/THcShowerPlane.cxx @@ -83,18 +83,18 @@ THcShowerPlane::~THcShowerPlane() delete frPosAdcPulseIntRaw; frPosAdcPulseIntRaw = NULL; delete frPosAdcPulseAmpRaw; frPosAdcPulseAmpRaw = NULL; delete frPosAdcPulseTimeRaw; frPosAdcPulseTimeRaw = NULL; - + delete frPosAdcPed; frPosAdcPed = NULL; delete frPosAdcPulseInt; frPosAdcPulseInt = NULL; delete frPosAdcPulseAmp; frPosAdcPulseAmp = NULL; - + delete frNegAdcErrorFlag; frNegAdcErrorFlag = NULL; delete frNegAdcPedRaw; frNegAdcPedRaw = NULL; delete frNegAdcThreshold; frNegAdcThreshold = NULL; delete frNegAdcPulseIntRaw; frNegAdcPulseIntRaw = NULL; delete frNegAdcPulseAmpRaw; frNegAdcPulseAmpRaw = NULL; delete frNegAdcPulseTimeRaw; frNegAdcPulseTimeRaw = NULL; - + delete frNegAdcPed; frNegAdcPed = NULL; delete frNegAdcPulseInt; frNegAdcPulseInt = NULL; delete frNegAdcPulseAmp; frNegAdcPulseAmp = NULL; @@ -107,15 +107,15 @@ THcShowerPlane::~THcShowerPlane() delete [] fNegPedSum; delete [] fNegPedSum2; delete [] fNegPedLimit; - delete [] fNegPedCount; - + delete [] fNegPedCount; + delete [] fPosPed; delete [] fPosSig; delete [] fPosThresh; delete [] fNegPed; delete [] fNegSig; - delete [] fNegThresh; + delete [] fNegThresh; // delete [] fEpos; // delete [] fEneg; @@ -156,8 +156,8 @@ Int_t THcShowerPlane::ReadDatabase( const TDatime& date ) fPedSampHigh=9; fDataSampLow=23; fDataSampHigh=49; - fAdcNegThreshold=0.; - fAdcPosThreshold=0.; + fAdcNegThreshold=0.; + fAdcPosThreshold=0.; DBRequest list[]={ {"cal_AdcNegThreshold", &fAdcNegThreshold, kDouble, 0, 1}, {"cal_AdcPosThreshold", &fAdcPosThreshold, kDouble, 0, 1}, @@ -169,7 +169,7 @@ Int_t THcShowerPlane::ReadDatabase( const TDatime& date ) {0} }; - fDebugAdc = 0; // Set ADC debug parameter to false unless set in parameter file + fDebugAdc = 0; // Set ADC debug parameter to false unless set in parameter file gHcParms->LoadParmValues((DBRequest*)&list, prefix); @@ -238,7 +238,7 @@ Int_t THcShowerPlane::ReadDatabase( const TDatime& date ) fEpos = vector<Double_t> (fNelem, 0.0); fEneg = vector<Double_t> (fNelem, 0.0); - fEmean = vector<Double_t> (fNelem, 0.0); + fEmean = vector<Double_t> (fNelem, 0.0); // fEpos = new Double_t[fNelem]; // fEneg = new Double_t[fNelem]; // fEmean= new Double_t[fNelem]; @@ -290,7 +290,7 @@ Int_t THcShowerPlane::DefineVariables( EMode mode ) vars.push_back(RVarDef{"totNumPosAdcHits", "Total Number of Positive ADC Hits", "fTotNumPosAdcHits"}); // PreSh+ raw multiplicity vars.push_back(RVarDef{"totNumNegAdcHits", "Total Number of Negative ADC Hits", "fTotNumNegAdcHits"}); // PreSh+ raw multiplicity vars.push_back(RVarDef{"totnumAdcHits", "Total Number of ADC Hits Per PMT", "fTotNumAdcHits"}); // PreSh raw multiplicity - + vars.push_back(RVarDef{"numGoodPosAdcHits", "Number of Good Positive ADC Hits Per PMT", "fNumGoodPosAdcHits"}); // PreSh occupancy vars.push_back(RVarDef{"numGoodNegAdcHits", "Number of Good Negative ADC Hits Per PMT", "fNumGoodNegAdcHits"}); // PreSh occupancy vars.push_back(RVarDef{"totNumGoodPosAdcHits", "Total Number of Good Positive ADC Hits", "fTotNumGoodPosAdcHits"}); // PreSh multiplicity @@ -303,22 +303,22 @@ Int_t THcShowerPlane::DefineVariables( EMode mode ) vars.push_back(RVarDef{"goodPosAdcPed", "Good Positive ADC pedestals", "fGoodPosAdcPed"}); vars.push_back(RVarDef{"goodPosAdcPulseInt", "Good Positive ADC integrals", "fGoodPosAdcPulseInt"}); vars.push_back(RVarDef{"goodPosAdcPulseAmp", "Good Positive ADC amplitudes", "fGoodPosAdcPulseAmp"}); - vars.push_back(RVarDef{"goodPosAdcPulseTime", "Good Positive ADC times", "fGoodPosAdcPulseTime"}); - + vars.push_back(RVarDef{"goodPosAdcPulseTime", "Good Positive ADC times", "fGoodPosAdcPulseTime"}); + vars.push_back(RVarDef{"goodNegAdcPed", "Good Negative ADC pedestals", "fGoodNegAdcPed"}); vars.push_back(RVarDef{"goodNegAdcPulseInt", "Good Negative ADC integrals", "fGoodNegAdcPulseInt"}); vars.push_back(RVarDef{"goodNegAdcPulseAmp", "Good Negative ADC amplitudes", "fGoodNegAdcPulseAmp"}); - vars.push_back(RVarDef{"goodNegAdcPulseTime", "Good Negative ADC times", "fGoodNegAdcPulseTime"}); - + vars.push_back(RVarDef{"goodNegAdcPulseTime", "Good Negative ADC times", "fGoodNegAdcPulseTime"}); + vars.push_back(RVarDef{"epos", "Energy Depositions from Positive Side PMTs", "fEpos"}); vars.push_back(RVarDef{"eneg", "Energy Depositions from Negative Side PMTs", "fEneg"}); vars.push_back(RVarDef{"emean", "Mean Energy Depositions", "fEmean"}); vars.push_back(RVarDef{"eplane", "Energy Deposition per plane", "fEplane"}); vars.push_back(RVarDef{"eplane_pos", "Energy Deposition per plane from pos. PMTs","fEplane_pos"}); vars.push_back(RVarDef{"eplane_neg", "Energy Deposition per plane from neg. PMTs","fEplane_neg"}); - - if (fDebugAdc) { + + if (fDebugAdc) { vars.push_back(RVarDef{"posAdcPedRaw", "List of positive raw ADC pedestals", "frPosAdcPedRaw.THcSignalHit.GetData()"}); vars.push_back(RVarDef{"posAdcPulseIntRaw", "List of positive raw ADC pulse integrals.", "frPosAdcPulseIntRaw.THcSignalHit.GetData()"}); vars.push_back(RVarDef{"posAdcPulseAmpRaw", "List of positive raw ADC pulse amplitudes.", "frPosAdcPulseAmpRaw.THcSignalHit.GetData()"}); @@ -327,7 +327,7 @@ Int_t THcShowerPlane::DefineVariables( EMode mode ) vars.push_back(RVarDef{"posAdcPed", "List of positive ADC pedestals", "frPosAdcPed.THcSignalHit.GetData()"}); vars.push_back(RVarDef{"posAdcPulseInt", "List of positive ADC pulse integrals.", "frPosAdcPulseInt.THcSignalHit.GetData()"}); vars.push_back(RVarDef{"posAdcPulseAmp", "List of positive ADC pulse amplitudes.", "frPosAdcPulseAmp.THcSignalHit.GetData()"}); - + vars.push_back(RVarDef{"negAdcPedRaw", "List of negative raw ADC pedestals", "frNegAdcPedRaw.THcSignalHit.GetData()"}); vars.push_back(RVarDef{"negAdcPulseIntRaw", "List of negative raw ADC pulse integrals.", "frNegAdcPulseIntRaw.THcSignalHit.GetData()"}); vars.push_back(RVarDef{"negAdcPulseAmpRaw", "List of negative raw ADC pulse amplitudes.", "frNegAdcPulseAmpRaw.THcSignalHit.GetData()"}); @@ -336,7 +336,7 @@ Int_t THcShowerPlane::DefineVariables( EMode mode ) vars.push_back(RVarDef{"negAdcPed", "List of negative ADC pedestals", "frNegAdcPed.THcSignalHit.GetData()"}); vars.push_back(RVarDef{"negAdcPulseInt", "List of negative ADC pulse integrals.", "frNegAdcPulseInt.THcSignalHit.GetData()"}); vars.push_back(RVarDef{"negAdcPulseAmp", "List of negative ADC pulse amplitudes.", "frNegAdcPulseAmp.THcSignalHit.GetData()"}); - + } RVarDef end {0}; @@ -349,7 +349,7 @@ Int_t THcShowerPlane::DefineVariables( EMode mode ) void THcShowerPlane::Clear( Option_t* ) { // Clears the hit lists - + fPosADCHits->Clear(); fNegADCHits->Clear(); @@ -375,37 +375,37 @@ void THcShowerPlane::Clear( Option_t* ) frNegAdcPulseInt->Clear(); frNegAdcPulseAmp->Clear(); - for (UInt_t ielem = 0; ielem < fGoodPosAdcPed.size(); ielem++) { - fGoodPosAdcPed.at(ielem) = 0.0; - fGoodPosAdcPulseIntRaw.at(ielem) = 0.0; - fGoodPosAdcPulseInt.at(ielem) = 0.0; - fGoodPosAdcPulseAmp.at(ielem) = 0.0; - fGoodPosAdcPulseTime.at(ielem) = 0.0; - fEpos.at(ielem) = 0.0; - fNumGoodPosAdcHits.at(ielem) = 0.0; - } - - for (UInt_t ielem = 0; ielem < fGoodNegAdcPed.size(); ielem++) { - fGoodNegAdcPed.at(ielem) = 0.0; - fGoodNegAdcPulseIntRaw.at(ielem) = 0.0; - fGoodNegAdcPulseInt.at(ielem) = 0.0; - fGoodNegAdcPulseAmp.at(ielem) = 0.0; - fGoodNegAdcPulseTime.at(ielem) = 0.0; - fEneg.at(ielem) = 0.0; - fNumGoodNegAdcHits.at(ielem) = 0.0; - } - - for (UInt_t ielem = 0; ielem < fEmean.size(); ielem++) { - fEmean.at(ielem) = 0.0; - } - - fTotNumAdcHits = 0; - fTotNumPosAdcHits = 0; - fTotNumNegAdcHits = 0; - - fTotNumGoodAdcHits = 0; - fTotNumGoodPosAdcHits = 0; - fTotNumGoodNegAdcHits = 0; + for (UInt_t ielem = 0; ielem < fGoodPosAdcPed.size(); ielem++) { + fGoodPosAdcPed.at(ielem) = 0.0; + fGoodPosAdcPulseIntRaw.at(ielem) = 0.0; + fGoodPosAdcPulseInt.at(ielem) = 0.0; + fGoodPosAdcPulseAmp.at(ielem) = 0.0; + fGoodPosAdcPulseTime.at(ielem) = 0.0; + fEpos.at(ielem) = 0.0; + fNumGoodPosAdcHits.at(ielem) = 0.0; + } + + for (UInt_t ielem = 0; ielem < fGoodNegAdcPed.size(); ielem++) { + fGoodNegAdcPed.at(ielem) = 0.0; + fGoodNegAdcPulseIntRaw.at(ielem) = 0.0; + fGoodNegAdcPulseInt.at(ielem) = 0.0; + fGoodNegAdcPulseAmp.at(ielem) = 0.0; + fGoodNegAdcPulseTime.at(ielem) = 0.0; + fEneg.at(ielem) = 0.0; + fNumGoodNegAdcHits.at(ielem) = 0.0; + } + + for (UInt_t ielem = 0; ielem < fEmean.size(); ielem++) { + fEmean.at(ielem) = 0.0; + } + + fTotNumAdcHits = 0; + fTotNumPosAdcHits = 0; + fTotNumNegAdcHits = 0; + + fTotNumGoodAdcHits = 0; + fTotNumGoodPosAdcHits = 0; + fTotNumGoodNegAdcHits = 0; // Debug output. @@ -535,14 +535,14 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) ((THcSignalHit*) frPosAdcPulseTimeRaw->ConstructedAt(nrPosAdcHits))->Set(padnum, rawPosAdcHit.GetPulseTimeRaw(thit)); if (rawPosAdcHit.GetPulseAmp(thit)>0&&rawPosAdcHit.GetPulseIntRaw(thit)>0) { - ((THcSignalHit*) frPosAdcErrorFlag->ConstructedAt(nrPosAdcHits))->Set(padnum,0); + ((THcSignalHit*) frPosAdcErrorFlag->ConstructedAt(nrPosAdcHits))->Set(padnum,0); } else { - ((THcSignalHit*) frPosAdcErrorFlag->ConstructedAt(nrPosAdcHits))->Set(padnum,1); + ((THcSignalHit*) frPosAdcErrorFlag->ConstructedAt(nrPosAdcHits))->Set(padnum,1); } ++nrPosAdcHits; fTotNumAdcHits++; fTotNumPosAdcHits++; - + } THcRawAdcHit& rawNegAdcHit = hit->GetRawAdcHitNeg(); for (UInt_t thit=0; thit<rawNegAdcHit.GetNPulses(); ++thit) { @@ -565,8 +565,6 @@ Int_t THcShowerPlane::ProcessHits(TClonesArray* rawhits, Int_t nexthit) ++nrNegAdcHits; fTotNumAdcHits++; fTotNumNegAdcHits++; - - } ihit++; } @@ -584,7 +582,7 @@ Int_t THcShowerPlane::CoarseProcessHits() FillADC_SampleIntegral(); } else if (ADCMode == kADCSampIntDynPed) { FillADC_SampIntDynPed(); - } else { + } else { FillADC_Standard(); } // @@ -666,9 +664,9 @@ void THcShowerPlane::FillADC_Standard() fEpos.at(npad) =fGoodPosAdcPulseInt.at(npad)*fParent->GetGain(npad,fLayerNum-1,0); fEmean.at(npad) += fEpos.at(npad); fEplane_pos += fEpos.at(npad); - } + } } - fEplane= fEplane_neg+fEplane_pos; + fEplane= fEplane_neg+fEplane_pos; } //_____________________________________________________________________________ void THcShowerPlane::FillADC_DynamicPedestal() @@ -680,8 +678,8 @@ void THcShowerPlane::FillADC_DynamicPedestal() for (Int_t ielem=0;ielem<frNegAdcPulseInt->GetEntries();ielem++) { Int_t npad = ((THcSignalHit*) frNegAdcPulseInt->ConstructedAt(ielem))->GetPaddleNumber() - 1; Double_t pulseInt = ((THcSignalHit*) frNegAdcPulseInt->ConstructedAt(ielem))->GetData(); - Double_t pulsePed = ((THcSignalHit*) frNegAdcPed->ConstructedAt(ielem))->GetData(); - Double_t pulseAmp = ((THcSignalHit*) frNegAdcPulseAmp->ConstructedAt(ielem))->GetData(); + Double_t pulsePed = ((THcSignalHit*) frNegAdcPed->ConstructedAt(ielem))->GetData(); + Double_t pulseAmp = ((THcSignalHit*) frNegAdcPulseAmp->ConstructedAt(ielem))->GetData(); Double_t pulseIntRaw = ((THcSignalHit*) frNegAdcPulseIntRaw->ConstructedAt(ielem))->GetData(); Double_t pulseTime = ((THcSignalHit*) frNegAdcPulseTimeRaw->ConstructedAt(ielem))->GetData(); Double_t threshold = ((THcSignalHit*) frNegAdcThreshold->ConstructedAt(ielem))->GetData(); @@ -689,31 +687,31 @@ void THcShowerPlane::FillADC_DynamicPedestal() Bool_t pulseTimeCut = (pulseTime > AdcTimeWindowMin) && (pulseTime < AdcTimeWindowMax); if (!errorflag && pulseTimeCut) { fGoodNegAdcPulseIntRaw.at(npad) =pulseIntRaw; - + if(fGoodNegAdcPulseIntRaw.at(npad) > threshold && fGoodNegAdcPulseInt.at(npad)==0) { fGoodNegAdcPulseInt.at(npad) =pulseInt ; fEneg.at(npad) = fGoodNegAdcPulseInt.at(npad)*fParent->GetGain(npad,fLayerNum-1,1); fEmean.at(npad) += fEneg.at(npad); fEplane_neg += fEneg.at(npad); - fGoodNegAdcPed.at(npad) = pulsePed; - fGoodNegAdcPulseAmp.at(npad) = pulseAmp; - fGoodNegAdcPulseTime.at(npad) = pulseTime; + fGoodNegAdcPed.at(npad) = pulsePed; + fGoodNegAdcPulseAmp.at(npad) = pulseAmp; + fGoodNegAdcPulseTime.at(npad) = pulseTime; fTotNumGoodAdcHits++; fTotNumGoodNegAdcHits++; fNumGoodNegAdcHits.at(npad)++; } - - } + + } } // for (Int_t ielem=0;ielem<frPosAdcPulseInt->GetEntries();ielem++) { Int_t npad = ((THcSignalHit*) frPosAdcPulseInt->ConstructedAt(ielem))->GetPaddleNumber() - 1; - Double_t pulsePed = ((THcSignalHit*) frPosAdcPed->ConstructedAt(ielem))->GetData(); + Double_t pulsePed = ((THcSignalHit*) frPosAdcPed->ConstructedAt(ielem))->GetData(); Double_t threshold = ((THcSignalHit*) frPosAdcThreshold->ConstructedAt(ielem))->GetData(); - Double_t pulseAmp = ((THcSignalHit*) frPosAdcPulseAmp->ConstructedAt(ielem))->GetData(); + Double_t pulseAmp = ((THcSignalHit*) frPosAdcPulseAmp->ConstructedAt(ielem))->GetData(); Double_t pulseInt = ((THcSignalHit*) frPosAdcPulseInt->ConstructedAt(ielem))->GetData(); Double_t pulseIntRaw = ((THcSignalHit*) frPosAdcPulseIntRaw->ConstructedAt(ielem))->GetData(); Double_t pulseTime = ((THcSignalHit*) frPosAdcPulseTimeRaw->ConstructedAt(ielem))->GetData(); @@ -721,24 +719,24 @@ void THcShowerPlane::FillADC_DynamicPedestal() Bool_t pulseTimeCut = (pulseTime > AdcTimeWindowMin) && (pulseTime < AdcTimeWindowMax); if (!errorflag && pulseTimeCut) { fGoodPosAdcPulseIntRaw.at(npad) = pulseIntRaw; - + if(fGoodPosAdcPulseIntRaw.at(npad) > threshold && fGoodPosAdcPulseInt.at(npad)==0) { - + fGoodPosAdcPulseInt.at(npad) =pulseInt ; fEpos.at(npad) = fGoodPosAdcPulseInt.at(npad)*fParent->GetGain(npad,fLayerNum-1,0); fEmean.at(npad) += fEpos[npad]; fEplane_pos += fEpos.at(npad); - fGoodPosAdcPed.at(npad) = pulsePed; - fGoodPosAdcPulseAmp.at(npad) = pulseAmp; - fGoodPosAdcPulseTime.at(npad) = pulseTime; + fGoodPosAdcPed.at(npad) = pulsePed; + fGoodPosAdcPulseAmp.at(npad) = pulseAmp; + fGoodPosAdcPulseTime.at(npad) = pulseTime; - fTotNumGoodAdcHits++; - fTotNumGoodPosAdcHits++; - fNumGoodPosAdcHits.at(npad)++; + fTotNumGoodAdcHits++; + fTotNumGoodPosAdcHits++; + fNumGoodPosAdcHits.at(npad)++; + } } - } } // fEplane= fEplane_neg+fEplane_pos; diff --git a/src/THcShowerPlane.h b/src/THcShowerPlane.h index 967bd3e00faa452d903644849b321869aca9f360..6a029e13ee808848d1b85d63eb58db573929c8a1 100644 --- a/src/THcShowerPlane.h +++ b/src/THcShowerPlane.h @@ -116,24 +116,24 @@ protected: // 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 kADCStandard=0; static const Int_t kADCDynamicPedestal=1; static const Int_t kADCSampleIntegral=2; static const Int_t kADCSampIntDynPed=3; - + Int_t fDebugAdc; // fADC debug flag Int_t fPedSampLow; // Sample range for Int_t fPedSampHigh; // dynamic pedestal Int_t fDataSampLow; // Sample range for Int_t fDataSampHigh; // sample integration - Double_t fAdcNegThreshold; // - Double_t fAdcPosThreshold; // + Double_t fAdcNegThreshold; // + Double_t fAdcPosThreshold; // //counting variables Int_t fTotNumPosAdcHits; Int_t fTotNumNegAdcHits; Int_t fTotNumAdcHits; - + Int_t fTotNumGoodPosAdcHits; Int_t fTotNumGoodNegAdcHits; Int_t fTotNumGoodAdcHits; @@ -146,21 +146,21 @@ protected: vector<Double_t> fGoodPosAdcPulseInt; vector<Double_t> fGoodPosAdcPulseAmp; vector<Double_t> fGoodPosAdcPulseTime; - + vector<Double_t> fGoodNegAdcPed; vector<Double_t> fGoodNegAdcPulseInt; vector<Double_t> fGoodNegAdcPulseAmp; vector<Double_t> fGoodNegAdcPulseTime; - + vector<Double_t> fGoodPosAdcPulseIntRaw; - vector<Double_t> fGoodNegAdcPulseIntRaw; + vector<Double_t> fGoodNegAdcPulseIntRaw; vector<Double_t> fEpos; // [fNelem] energy depositions seen by positive PMTs vector<Double_t> fEneg; // [fNelem] energy depositions seen by negative PMTs vector<Double_t> fEmean; // [fNelem] mean energy depositions (pos + neg) - + Double_t fEplane_pos; // Energy deposition in the plane from positive PMTs Double_t fEplane_neg; // Energy deposition in the plane from negative PMTs Double_t fEplane;