7 #include "GaudiKernel/ToolHandle.h"
11 #include "CLHEP/Units/SystemOfUnits.h"
51 ATH_MSG_DEBUG (
"======== LArCalibDigitMaker Initialize ========" );
56 ATH_MSG_DEBUG (
"======== LArCalibDigitMaker isSC is True ========" );
64 std::vector<std::vector<unsigned>> theseBoardIDs;
65 std::vector<std::vector<unsigned>> thesePatterns;
66 std::vector<std::vector<unsigned>> theseDACs;
69 theseDACs.reserve(
m_vDAC.size());
71 theseBoardIDs.emplace_back(elem.begin(), elem.end());
74 thesePatterns.emplace_back(elem.begin(), elem.end());
76 for (
const auto& elem :
m_vDAC) {
77 theseDACs.emplace_back(elem.begin(), elem.end());
79 std::vector<unsigned> cutPattern;
81 auto calibParams = std::make_unique<LArCalibParams>();
83 for(
long unsigned int i=0;
i < theseBoardIDs.size();
i++ ){
85 cutPattern = thesePatterns[
i];
91 if (thesePatterns[
i].
size()%4) {
92 ATH_MSG_ERROR (
"Problem with jobOptions! One Pattern must conists of 4 32bit values! Pattern "<<
i );
93 return StatusCode::FAILURE;
95 for (
unsigned id : theseBoardIDs[
i]) {
111 ATH_MSG_DEBUG (
"======== LArCalibDigitMaker initialize successfully ========" );
112 return StatusCode::SUCCESS;
118 if (
m_dontRun)
return StatusCode::SUCCESS;
120 const EventContext& ctx = Gaudi::Hive::currentContext();
125 ATH_MSG_DEBUG (
"======== LArCalibDigitMaker: using SC calib line map" );
136 return StatusCode::FAILURE;
139 const unsigned eventNb=(ctx.eventID().event_number())&0xffffff ;
141 ATH_MSG_DEBUG (
"======== executing event "<< eventNb <<
" ========" );
150 if (
sc.isFailure()) {
151 ATH_MSG_DEBUG (
"Cannot read LArDigitContainer from StoreGate! key=" <<
key );
154 if (larDigitCont->
empty()) {
155 ATH_MSG_DEBUG (
"LArDigitContainer with key '" <<
key <<
"' is empty. Ignored." );
160 auto calibDigitContainer=std::make_unique<LArCalibDigitContainer>();
171 const std::vector<short>& samples=
digit->samples();
173 const std::vector<HWIdentifier>& calibChannelIDs=clcabling->
calibSlotLine(chid);
174 if (calibChannelIDs.empty()) {
178 std::vector<HWIdentifier>::const_iterator csl_it=calibChannelIDs.begin();
181 unsigned ddac=calibParams->
DAC(eventNb,*csl_it);
190 for(; csl_it != calibChannelIDs.end(); ++csl_it) {
191 if(calibParams->
isPulsed(eventNb,*csl_it)){
198 ATH_MSG_VERBOSE(
"HERE!! "<<chid<<
" "<<
gain<<
" "<<
dac<<
" "<<
delay<<
" "<<ispulsed<<
" event no "<<eventNb<<
" "<<calibChannelIDs.size()<<
" calib lines, first is "<<*csl_it);
202 calibDigitContainer->push_back(calibDigit);
206 ATH_MSG_DEBUG (
"LArCalibDigitContainer recorded to StoreGate. key=" <<
key );
208 return StatusCode::SUCCESS;