Skip to content
Snippets Groups Projects
Commit e437a0c5 authored by Eric Torrence's avatar Eric Torrence
Browse files

Merge branch 'waveform' into 'master'

Waveform

See merge request torrence/calypso!3
parents 671dc725 188bb23b
No related branches found
No related tags found
23 merge requests!197Reco Script update for Segment Finder,!194Reco script update,!176Waveform Reco updates,!175Waveform reco update,!173Update production to latest master,!167Catch raw data format errors,!166Waveform raw integral bug,!165Reco scripts,!162Production Reco Scripts,!161Add waveform identifiers, configure digitizer channels,!159Move Waveform code to its own major area,!157Catch error on truncated events,!155Cluster Limit,!138Made NoisyStripFinder package,!134Added raw data reconstruction tests to pipeline,!123Waveform reconstruction bugfix,!118Wavereco bugfix,!114Rename xAOD TLB Aux Data class,!107Xrootd support,!105Wavereco bugfix,!104Wavereco,!103Waveform reconstruction,!87Scintillator Waveform POOL
Showing
with 402 additions and 4 deletions
......@@ -32,6 +32,7 @@ ScintWaveformAccess::initialize()
ATH_CHECK( m_TriggerWaveformContainer.initialize() );
ATH_CHECK( m_PreshowerWaveformContainer.initialize() );
ATH_CHECK( m_TestWaveformContainer.initialize() );
ATH_CHECK( m_ClockWaveformContainer.initialize() );
return StatusCode::SUCCESS;
}
......@@ -70,5 +71,9 @@ ScintWaveformAccess::execute(const EventContext& ctx) const
ATH_MSG_INFO("Found ReadHandle for TestWaveforms");
ATH_MSG_INFO(*testHandle);
SG::ReadHandle<ScintWaveformContainer> clockHandle(m_ClockWaveformContainer, ctx);
ATH_MSG_INFO("Found ReadHandle for ClockWaveforms");
ATH_MSG_INFO(*clockHandle);
return StatusCode::SUCCESS;
}
......@@ -40,6 +40,8 @@ class ScintWaveformAccess: public AthReentrantAlgorithm
{ this, "PreshowerWaveformContainerKey", "PreshowerWaveforms", "ReadHandleKey for PreshowerWaveforms Container"};
SG::ReadHandleKey<ScintWaveformContainer> m_TestWaveformContainer
{ this, "TestWaveformContainerKey", "TestWaveforms", "ReadHandleKey for TestWaveforms Container"};
SG::ReadHandleKey<ScintWaveformContainer> m_ClockWaveformContainer
{ this, "ClockWaveformContainerKey", "ClockWaveforms", "ReadHandleKey for ClockWaveforms Container"};
};
#endif /* WAVEFORMDATAACCESSEXAMPLE_SCINTWAVEFORMACCESS_H */
......@@ -17,6 +17,7 @@ def FaserByteStreamCnvSvcBaseCfg(flags, **kwargs):
"ScintWaveformContainer/VetoWaveforms",
"ScintWaveformContainer/TriggerWaveforms",
"ScintWaveformContainer/PreshowerWaveforms",
"ScintWaveformContainer/ClockWaveforms",
"ScintWaveformContainer/TestWaveforms"
]
......
......@@ -22,18 +22,31 @@ ScintWaveformDecoderTool::ScintWaveformDecoderTool(const std::string& type,
declareProperty("CaloChannels", m_caloChannels);
m_caloChannels.push_back(0);
m_caloChannels.push_back(1);
m_caloChannels.push_back(2);
m_caloChannels.push_back(3);
declareProperty("VetoChannels", m_vetoChannels);
m_vetoChannels.push_back(1);
m_vetoChannels.push_back(4);
m_vetoChannels.push_back(5);
m_vetoChannels.push_back(6);
m_vetoChannels.push_back(7);
declareProperty("TriggerChannels", m_triggerChannels);
m_triggerChannels.push_back(2);
m_triggerChannels.push_back(8);
m_triggerChannels.push_back(9);
m_triggerChannels.push_back(10);
m_triggerChannels.push_back(11);
declareProperty("PreshowerChannels", m_preshowerChannels);
m_preshowerChannels.push_back(3);
m_preshowerChannels.push_back(12);
m_preshowerChannels.push_back(13);
declareProperty("TestChannels", m_testChannels);
m_testChannels.push_back(4);
m_testChannels.push_back(14);
declareProperty("ClockChannels", m_clockChannels);
m_clockChannels.push_back(15);
}
......@@ -104,6 +117,8 @@ ScintWaveformDecoderTool::convert(const DAQFormats::EventFull* re,
channelList = &m_preshowerChannels;
} else if (key == std::string("TestWaveforms")) {
channelList = &m_testChannels;
} else if (key == std::string("ClockWaveforms")) {
channelList = &m_clockChannels;
} else {
ATH_MSG_ERROR("Unknown key " << key);
return StatusCode::FAILURE;
......
......@@ -37,6 +37,7 @@ private:
std::vector<unsigned int> m_triggerChannels;
std::vector<unsigned int> m_preshowerChannels;
std::vector<unsigned int> m_testChannels;
std::vector<unsigned int> m_clockChannels;
};
......
# $Id: CMakeLists.txt 749562 2016-05-25 04:45:43Z krasznaa $
################################################################################
# Package: ScintEventAthenaPool
################################################################################
# Declare the package name:
atlas_subdir( ScintEventAthenaPool )
# Component(s) in the package:
atlas_add_poolcnv_library( ScintEventAthenaPoolPoolCnv
ScintEventAthenaPool/*.h src/*.h src/*.cxx
FILES ScintRawEvent/ScintWaveform.h
ScintRawEvent/ScintWaveformContainer.h
LINK_LIBRARIES Identifier GeneratorObjectsTPCnv AthAllocators AthContainers
AthenaBaseComps AthenaKernel SGTools StoreGateLib AthenaPoolCnvSvcLib
AthenaPoolUtilities AtlasSealCLHEP GaudiKernel ScintRawEvent
)
atlas_add_dictionary( ScintEventAthenaPoolCnvDict
ScintEventAthenaPool/ScintEventAthenaPoolCnvDict.h
ScintEventAthenaPool/selection.xml
LINK_LIBRARIES Identifier GeneratorObjectsTPCnv )
# Install files from the package:
atlas_install_headers( ScintEventAthenaPool )
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef SCINTEVENTATHENAPOOLCNVDICT_H
#define SCINTEVENTATHENAPOOLCNVDICT_H
#include "ScintEventAthenaPool/ScintWaveform_p0.h"
#include "ScintEventAthenaPool/ScintWaveformContainer_p0.h"
#endif
/*
Copyright (C) 2020 CERN for the benefit of the FASER collaboration
*/
#ifndef SCINTWAVEFORMCONTAINER_P0_H
#define SCINTWAVEFORMCONTAINER_P0_H
// Persistent represenation of a ScintWaveformContainer.
#include <vector>
#include "ScintEventAthenaPool/ScintWaveform_p0.h"
class ScintWaveformContainer_p0 {
public:
ScintWaveformContainer_p0();
friend class ScintWaveformContainerCnv_p0;
private:
bool m_board_fail_flag;
unsigned int m_board_id;
unsigned int m_pattern_trig_options;
unsigned int m_channel_mask;
unsigned int m_event_counter;
unsigned int m_trigger_time_tag;
unsigned int m_samples;
std::vector<ScintWaveform_p0> m_waveforms;
};
inline
ScintWaveformContainer_p0::ScintWaveformContainer_p0() : m_board_fail_flag(0),
m_board_id(0),
m_pattern_trig_options(0),
m_channel_mask(0),
m_event_counter(0),
m_trigger_time_tag(0),
m_samples(0) {
m_waveforms.clear();
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef SCINTWAVEFORM_P0_H
#define SCINTWAVEFORM_P0_H
#include <vector>
#include <iostream>
#include <iomanip>
class ScintWaveform_p0 {
public:
ScintWaveform_p0();
// List of Cnv classes that convert this into Rdo objects
friend class ScintWaveformCnv_p0;
private:
unsigned int m_ID;
unsigned int m_channel;
std::vector<unsigned int> m_adc_counts;
public:
void print() const {
std::cout << "Persistent Waveform data:" << std::endl
<< std::setw(30) << " channel: "<<std::setfill(' ')<<std::setw(32)<<std::dec<<m_channel<<std::setfill(' ')<<std::endl
<< std::setw(30) << " length: "<<std::setfill(' ')<<std::setw(32)<<std::dec<<m_adc_counts.size()<<std::setfill(' ')<<std::endl;
}
};
inline
ScintWaveform_p0::ScintWaveform_p0() : m_channel(0) {
m_adc_counts.clear();
}
// Stream operator for debugging
//std::ostream
//&operator<<(std::ostream &out, const ScintWaveform_p0 &wfm) {
// return wfm.print(out);
//}
#endif
<lcgdict>
<class name="ScintWaveform_p0" />
<class name="ScintWaveformContainer_p0" id="344d904d-6338-41f1-94ee-ea609ea4ae44" />
</lcgdict>
/*
Copyright (C) 2020 CERN for the benefit of the FASER collaboration
*/
#include "ScintWaveformCnv_p0.h"
void
ScintWaveformCnv_p0::persToTrans(const ScintWaveform_p0* persObj, ScintWaveform* transObj, MsgStream& log) {
// Just fill available data here
// Rest of it patched up in ScintWaveformContainerCnv_p0
transObj->setIdentifier(persObj->m_ID);
transObj->setChannel(persObj->m_channel);
transObj->setCounts(persObj->m_adc_counts);
}
void
ScintWaveformCnv_p0::transToPers(const ScintWaveform* transObj, ScintWaveform_p0* persObj, MsgStream& log) {
// log << MSG::DEBUG << "ScintWaveformCnv_p0::transToPers called" << endmsg;
// log << MSG::DEBUG << "Transient waveform:" << endmsg;
// log << MSG::DEBUG << (*transObj) << endmsg;
// log << MSG::DEBUG << "Persistent waveform (before):" << endmsg;
// persObj->print();
persObj->m_ID = transObj->identify();
persObj->m_channel = transObj->channel();
// Use copy here
persObj->m_adc_counts = transObj->adc_counts();
// log << MSG::DEBUG << "Persistent waveform (after):" << endmsg;
// persObj->print();
// log << MSG::DEBUG << "ScintWaveformCnv_p0::transToPers done" << endmsg;
}
/*
Copyright (C) 2020 CERN for the benefit of the FASER collaboration
*/
#ifndef SCINTWAVEFORMCNV_P0_H
#define SCINTWAVEFORMCNV_P0_H
#include "ScintRawEvent/ScintWaveform.h"
#include "ScintEventAthenaPool/ScintWaveform_p0.h"
#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h"
class ScintWaveformCnv_p0 : public T_AthenaPoolTPCnvBase<ScintWaveform, ScintWaveform_p0> {
public:
ScintWaveformCnv_p0() {};
virtual void persToTrans(const ScintWaveform_p0* persObj,
ScintWaveform* transObj,
MsgStream& log);
virtual void transToPers(const ScintWaveform* transObj,
ScintWaveform_p0* persObj,
MsgStream& log);
private:
};
#endif
/*
Copyright (C) 2020 CERN for the benefit of the FASER collaboration
*/
#include "ScintWaveformContainerCnv.h"
ScintWaveformContainer_PERS*
ScintWaveformContainerCnv::createPersistent (ScintWaveformContainer* transCont) {
ATH_MSG_DEBUG("ScintWaveformContainerCnv::createPersistent()");
ScintWaveformContainerCnv_PERS converter;
ScintWaveformContainer_PERS* persObj(nullptr);
persObj = converter.createPersistent( transCont, msg() );
return persObj;
}
ScintWaveformContainer*
ScintWaveformContainerCnv::createTransient() {
ATH_MSG_DEBUG("ScintWaveformContainerCnv::createTransient()");
static const pool::Guid p0_guid("344d904d-6338-41f1-94ee-ea609ea4ae44");
ScintWaveformContainer* trans(0);
// Check for GUID of each persistent type
if ( compareClassGuid(p0_guid) ) {
std::unique_ptr< ScintWaveformContainer_p0 > col_vect( poolReadObject< ScintWaveformContainer_p0 >() );
ScintWaveformContainerCnv_p0 converter_p0;
trans = converter_p0.createTransient( col_vect.get(), msg() );
} else {
// Didn't find a known type
throw std::runtime_error("Unsupported persistent version of ScintWaveformContainer");
}
return trans;
}
/*
Copyright 2020 CERN for the benefit of the FASER collaboration
*/
#ifndef SCINTWAVEFORMCONTAINERCNV_H
#define SCINTWAVEFORMCONTAINERCNV_H
#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
#include "ScintWaveformContainerCnv_p0.h"
#include "ScintRawEvent/ScintWaveformContainer.h"
#include "ScintEventAthenaPool/ScintWaveformContainer_p0.h"
// The latest persistent representation
typedef ScintWaveformContainer_p0 ScintWaveformContainer_PERS;
typedef ScintWaveformContainerCnv_p0 ScintWaveformContainerCnv_PERS;
typedef T_AthenaPoolCustomCnv< ScintWaveformContainer, ScintWaveformContainer_PERS > ScintWaveformContainerCnvBase;
class ScintWaveformContainerCnv : public ScintWaveformContainerCnvBase {
friend class CnvFactory<ScintWaveformContainerCnv>;
public:
ScintWaveformContainerCnv (ISvcLocator* svcloc) : ScintWaveformContainerCnvBase(svcloc) {}
protected:
virtual ScintWaveformContainer_PERS* createPersistent (ScintWaveformContainer* transCont);
virtual ScintWaveformContainer* createTransient ();
};
#endif
/*
Copyright (C) 2020 CERN for the benefit of the FASER collaboration
*/
#include "ScintWaveformContainerCnv_p0.h"
#include "ScintWaveformCnv_p0.h"
void
ScintWaveformContainerCnv_p0::persToTrans(const ScintWaveformContainer_p0* persCont, ScintWaveformContainer* transCont, MsgStream& log) {
log << MSG::DEBUG << "ScintWaveformContainerCnv_p0::persToTrans called" << endmsg;
ScintWaveformCnv_p0 waveformCnv;
// Clear this, transient container is DataVector, which stores pointers
// Create them below and push back to fill
transCont->clear();
for (unsigned int index = 0; index < persCont->m_waveforms.size(); ++index) {
std::unique_ptr<ScintWaveform> data = std::make_unique<ScintWaveform>();
const ScintWaveform_p0* pdata = &persCont->m_waveforms.at(index);
waveformCnv.persToTrans(pdata, data.get(), log);
// Fill other values held by container in persistent class
data->setBoardFailFlag(persCont->m_board_fail_flag);
data->setBoardId(persCont->m_board_id);
data->setPatternTrigOptions(persCont->m_pattern_trig_options);
data->setChannelMask(persCont->m_channel_mask);
data->setEventCounter(persCont->m_event_counter);
data->setTriggerTime(persCont->m_trigger_time_tag);
data->setSamples(persCont->m_samples);
transCont->push_back(data.release());
}
}
void
ScintWaveformContainerCnv_p0::transToPers(const ScintWaveformContainer* transCont,ScintWaveformContainer_p0* persCont, MsgStream& log) {
log << MSG::DEBUG << "ScintWaveformContainerCnv_p0::transToPers preparing " << transCont->size() << " waveforms" << endmsg;
ScintWaveformCnv_p0 waveformCnv;
typedef ScintWaveformContainer TRANS;
TRANS::const_iterator it_Cont = transCont->begin();
TRANS::const_iterator it_ContEnd = transCont->end();
// Fill common information
const ScintWaveform* transObj = (*it_Cont);
persCont->m_board_fail_flag = transObj->board_fail_flag();
persCont->m_board_id = transObj->board_id();
persCont->m_pattern_trig_options = transObj->pattern_trig_options();
persCont->m_channel_mask = transObj->channel_mask();
persCont->m_event_counter = transObj->event_counter();
persCont->m_trigger_time_tag = transObj->trigger_time_tag();
persCont->m_samples = transObj->n_samples();
// Loop over each waveform and convert those as well
persCont->m_waveforms.resize(transCont->size());
for (int index=0; it_Cont != it_ContEnd; it_Cont++, index++) {
// Add new collection
log << MSG::DEBUG << "Converting waveform " << index << endmsg;
const ScintWaveform* data = (*it_Cont);
ScintWaveform_p0* pdata = &(persCont->m_waveforms.at(index));
waveformCnv.transToPers(data, pdata, log);
}
log << MSG::DEBUG << "ScintWaveformContainerCnv_p0::transToPers finished" << endmsg;
}
/*
Copyright 2020 CERN for the benefit of the FASER collaboration
*/
#ifndef SCINTWAVEFORMCONTAINERCNV_P0_H
#define SCINTWAVEFORMCONTAINERCNV_P0_H
#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h"
#include "ScintRawEvent/ScintWaveformContainer.h"
#include "ScintEventAthenaPool/ScintWaveformContainer_p0.h"
class ScintWaveformContainerCnv_p0 : public T_AthenaPoolTPCnvBase<ScintWaveformContainer, ScintWaveformContainer_p0> {
public:
ScintWaveformContainerCnv_p0() {};
virtual void persToTrans(const ScintWaveformContainer_p0* persCont,
ScintWaveformContainer* transCont,
MsgStream& log);
virtual void transToPers(const ScintWaveformContainer* transCont,
ScintWaveformContainer_p0* persCont,
MsgStream& log);
};
#endif
// Dummy source file so that cmake can find this
......@@ -73,6 +73,17 @@ public:
void setHeader (const DigitizerDataFragment* frag);
void setWaveform (unsigned int channel, const std::vector<uint16_t> waveform);
// Set functions for P->T conversion
void setBoardId(unsigned int id) {m_board_id = id;}
void setBoardFailFlag(bool flag) {m_board_fail_flag = flag;}
void setPatternTrigOptions(unsigned int pattern) {m_pattern_trig_options = pattern;}
void setChannelMask(unsigned int mask) {m_channel_mask = mask;}
void setEventCounter(unsigned int counter) {m_event_counter = counter;}
void setTriggerTime(unsigned int tag) {m_trigger_time_tag = tag;}
void setChannel(unsigned int chan) {m_channel = chan;}
void setSamples(unsigned int samp) {m_samples = samp;}
void setCounts(const std::vector<unsigned int>& counts) {m_adc_counts = counts;}
///////////////////////////////////////////////////////////////////
// Private data:
///////////////////////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment