Skip to content
Snippets Groups Projects

Clean out Supercell functionality from regular LArRawChannelBuilderAlg

Merged Walter Lampl requested to merge wlampl/athena:LArRawChannelBuilder_NoSC into master
1 file
+ 20
26
Compare changes
  • Side-by-side
  • Inline
@@ -113,22 +113,16 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const {
const auto& ofca=ofcs->OFC_a(id,gain);
const auto& adc2mev=adc2MeVs->ADC2MEV(id,gain);
const size_t nOFC=ofca.size();
//Sanity check on input conditions data:
// ensure that the size of the samples vector is compatible with ofc_a size when preceeding samples are saved
const size_t nSamples=samples.size()-firstSample;
if (nSamples<ofca.size()) {
if (nSamples<nOFC) {
ATH_MSG_ERROR("effective sample size: "<< nSamples << ", must be >= OFC_a size: " << ofca.size());
return StatusCode::FAILURE;
}
//Sanity check on input conditions data:
// FIXME: fix to get splash test running, should implement the iterations later
size_t len=nSamples;
if(ATH_UNLIKELY(ofca.size()<nSamples)) {
if (!connected) continue; //No conditions for disconnected channel, who cares?
ATH_MSG_DEBUG("Number of OFC a's doesn't match number of samples for conencted channel " << m_onlineId->channel_name(id)
<< " gain " << gain << ". OFC size=" << ofca.size() << ", nbr ADC samples=" << nSamples);
len=ofca.size();
}
if (ATH_UNLIKELY(p==ILArPedestal::ERRORCODE)) {
if (!connected) continue; //No conditions for disconencted channel, who cares?
@@ -152,12 +146,12 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const {
bool saturated=false;
// Check saturation AND discount pedestal
std::vector<float> samp_no_ped(nSamples,0.0);
for (size_t i=0;i<nSamples;++i) {
if (samples[i+firstSample]==4096 || samples[i+firstSample]==0) saturated=true; //choose the correct first sample
std::vector<float> samp_no_ped(nOFC,0.0);
for (size_t i=0;i<nOFC;++i) {
if (samples[i+firstSample]==4096 || samples[i+firstSample]==0) saturated=true;
samp_no_ped[i]=samples[i+firstSample]-p;
}
for (size_t i=0;i<len;++i) {
for (size_t i=0;i<nOFC;++i) {
A+=static_cast<double>(samp_no_ped[i])*ofca[i];
}
@@ -195,7 +189,7 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const {
//Get time by applying OFC-b coefficients:
const auto& ofcb=ofcs->OFC_b(id,gain);
double At=0;
for (size_t i=0;i<len;++i) {
for (size_t i=0;i<nOFC;++i) {
At+=static_cast<double>(samp_no_ped[i])*ofcb[i];
}
//Divide A*t/A to get time
@@ -203,20 +197,20 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const {
const auto& fullShape=shapes->Shape(id,gain);
//Get Q-factor
// fixing HEC to move +1 in case of 4 samples and firstSample 0 (copied from old LArRawChannelBuilder)
//fixing HEC to move +1 in case of 4 samples and firstSample 0 (copied from old LArRawChannelBuilder)
const size_t nSamples=samples.size();
if (fullShape.size()>nSamples && nSamples==4 && m_firstSample==0) {
if (m_onlineId->isHECchannel(id)) {
firstSample=1;
}
}
if (ATH_UNLIKELY(fullShape.size()<nSamples+firstSample)) {
if (ATH_UNLIKELY(fullShape.size()<nOFC+firstSample)) {
if (!connected) continue; //No conditions for disconnected channel, who cares?
ATH_MSG_DEBUG("No valid shape for channel " << m_onlineId->channel_name(id)
ATH_MSG_ERROR("No valid shape for channel " << m_onlineId->channel_name(id)
<< " gain " << gain);
ATH_MSG_DEBUG("Got size " << fullShape.size() << ", expected at least " << nSamples+firstSample);
//return StatusCode::FAILURE;
len=fullShape.size()-firstSample;
ATH_MSG_ERROR("Got size " << fullShape.size() << ", expected at least " << nSamples+firstSample);
return StatusCode::FAILURE;
}
const float* shape=&*fullShape.begin()+firstSample;
@@ -225,20 +219,20 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const {
if (m_useShapeDer) {
const auto& fullshapeDer=shapes->ShapeDer(id,gain);
if (ATH_UNLIKELY(fullshapeDer.size()<nSamples+firstSample)) {
ATH_MSG_DEBUG("No valid shape derivative for channel " << m_onlineId->channel_name(id)
ATH_MSG_ERROR("No valid shape derivative for channel " << m_onlineId->channel_name(id)
<< " gain " << gain);
ATH_MSG_DEBUG("Got size " << fullshapeDer.size() << ", expected at least " << nSamples+firstSample);
//return StatusCode::FAILURE;
ATH_MSG_ERROR("Got size " << fullshapeDer.size() << ", expected at least " << nSamples+firstSample);
return StatusCode::FAILURE;
}
const float* shapeDer=&*fullshapeDer.begin()+firstSample;
for (size_t i=0;i<len;++i) {
for (size_t i=0;i<nOFC;++i) {
q += std::pow((A*(shape[i]-tau*shapeDer[i])-(samp_no_ped[i])),2);
}
}//end if useShapeDer
else {
//Q-factor w/o shape derivative
for (size_t i=0;i<len;++i) {
for (size_t i=0;i<nOFC;++i) {
q += std::pow((A*shape[i]-(samp_no_ped[i])),2);
}
}
Loading