28 {
30
31 SG::WriteCondHandle<PixeldEdxData> writeHandle(
m_writeKey);
32 if (writeHandle.isValid()) {
33 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.fullKey() <<
" is already valid.. In theory this should not be called, but may happen if multiple concurrent events are being processed out of order.");
34 return StatusCode::SUCCESS;
35 }
36
37
38 std::unique_ptr<PixeldEdxData> writeCdo(std::make_unique<PixeldEdxData>());
39
40 const EventIDBase
start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0, 0, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
41 const EventIDBase
stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
42
44
46 std::string fun_type;
47 std::string bb_type;
48
50 SG::ReadCondHandle<AthenaAttributeList> readHandle(
m_readKey);
51 const AthenaAttributeList* readCdo = *readHandle;
52 if (readCdo==nullptr) {
54 return StatusCode::FAILURE;
55 }
56
57 ATH_MSG_DEBUG(
"Size of AthenaAttributeList " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
58
59
60 if (not readHandle.range(rangeW)) {
61 ATH_MSG_FATAL(
"Failed to retrieve validity range for " << readHandle.key());
62 return StatusCode::FAILURE;
63 }
64 ATH_MSG_DEBUG(
"Size of CondAttrListCollection " << readHandle.fullKey() <<
" readCdo->size()= " << readCdo->size());
66
67
68 std::string mystring=(*readCdo)["data"].data<std::string>();
69 std::istringstream mystringstream(mystring);
70
71 if (mystringstream.eof() || mystringstream.fail()) {
73 return StatusCode::FAILURE;
74 }
75
77 mystringstream >> fun_type;
78 mystringstream >> bb_type;
79
80 writeCdo -> setFunctionType(fun_type);
81 writeCdo -> setBetheBlochType(bb_type);
83
84 if (fit_type==0) {
85 for (
int i=0;
i<5;
i++) {
86 for (int j=0;j<9;j++) {
87 double param;
88 mystringstream >> param;
89 writeCdo -> setPar(i,param);
90 }
91 }
92 writeCdo -> setPosNeg(false);
93 }
94 else {
95 for (
int i=0;
i<2*5;
i++) {
96 for (int j=0;j<9;j++) {
97 double param;
98 mystringstream >> param;
99 writeCdo -> setPar(i,param);
100 }
101 }
102 writeCdo -> setPosNeg(true);
103 }
104 }
105 else {
109 return StatusCode::FAILURE;
110 }
114 return StatusCode::FAILURE;
115 }
119
120 writeCdo -> setFunctionType(fun_type);
121 writeCdo -> setBetheBlochType(bb_type);
123
124 if (fit_type==0) {
125 for (
int i=0;
i<5;
i++) {
126 for (int j=0;j<9;j++) {
127 double param;
129 writeCdo -> setPar(i,param);
130 }
131 }
132 writeCdo -> setPosNeg(false);
133 }
134 else {
135 for (
int i=0;
i<2*5;
i++) {
136 for (int j=0;j<9;j++) {
137 double param;
139 writeCdo -> setPar(i,param);
140 }
141 }
142 writeCdo -> setPosNeg(true);
143 }
145 }
146
147 if (writeHandle.record(rangeW, std::move(writeCdo)).isFailure()) {
148 ATH_MSG_FATAL(
"Could not record PixeldEdxData " << writeHandle.key() <<
" with EventRange " << rangeW <<
" into Conditions Store");
149 return StatusCode::FAILURE;
150 }
151 ATH_MSG_DEBUG(
"recorded new CDO " << writeHandle.key() <<
" with range " << rangeW <<
" into Conditions Store");
152
153 return StatusCode::SUCCESS;
154}
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
Gaudi::Property< bool > m_readfromcool
Gaudi::Property< std::string > m_filename
Gaudi::Property< double > m_mindedxformass
SG::ReadCondHandleKey< AthenaAttributeList > m_readKey
SG::WriteCondHandleKey< PixeldEdxData > m_writeKey