25 if (writeFluenceMapHandle.isValid()) {
26 ATH_MSG_DEBUG(
"CondHandle " << writeFluenceMapHandle.fullKey() <<
" is already valid.. In theory this should not be called, but may happen if multiple concurrent events are being processed out of order.");
27 return StatusCode::SUCCESS;
31 std::unique_ptr<PixelRadiationDamageFluenceMapData> writeFluenceCdo(std::make_unique<PixelRadiationDamageFluenceMapData>());
33 const EventIDBase
start{EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, 0,
34 0, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
35 const EventIDBase
stop {EventIDBase::UNDEFNUM, EventIDBase::UNDEFEVT, EventIDBase::UNDEFNUM-1,
36 EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFNUM, EventIDBase::UNDEFNUM};
48 std::vector<PixelHistoConverter> ramoPotentialMap;
49 std::vector<PixelHistoConverter> lorentzMap_e;
50 std::vector<PixelHistoConverter> lorentzMap_h;
51 std::vector<PixelHistoConverter> distanceMap_e;
52 std::vector<PixelHistoConverter> distanceMap_h;
59 return StatusCode::FAILURE;
63 std::unique_ptr<TH3F> ramoPotentialMap_hold(mapsFile->Get<TH3F>(
"hramomap1"));
64 if (!ramoPotentialMap_hold) {
65 ramoPotentialMap_hold.reset(mapsFile->Get<TH3F>(
"ramo3d"));
67 if (!ramoPotentialMap_hold) {
68 ATH_MSG_FATAL(
"Did not find a Ramo potential map and an approximate form is available yet. Exit...");
69 return StatusCode::FAILURE;
72 ramoPotentialMap_hold->SetDirectory(
nullptr);
73 std::unique_ptr<TH2F> lorentzMap_e_hold(mapsFile->Get<
TH2F>(
"lorentz_map_e"));
74 std::unique_ptr<TH2F> lorentzMap_h_hold(mapsFile->Get<
TH2F>(
"lorentz_map_h"));
75 std::unique_ptr<TH2F> distanceMap_e_hold(mapsFile->Get<
TH2F>(
"edistance"));
76 std::unique_ptr<TH2F> distanceMap_h_hold(mapsFile->Get<
TH2F>(
"hdistance"));
78 if (!lorentzMap_e_hold || !lorentzMap_h_hold || !distanceMap_e_hold || !distanceMap_h_hold) {
80 return StatusCode::FAILURE;
83 lorentzMap_e_hold->SetDirectory(
nullptr);
84 lorentzMap_h_hold->SetDirectory(
nullptr);
85 distanceMap_e_hold->SetDirectory(
nullptr);
86 distanceMap_h_hold->SetDirectory(
nullptr);
88 ramoPotentialMap.emplace_back();
89 ATH_CHECK(ramoPotentialMap.back().setHisto3D(ramoPotentialMap_hold.get()));
90 lorentzMap_e.emplace_back();
91 lorentzMap_h.emplace_back();
92 distanceMap_e.emplace_back();
93 distanceMap_h.emplace_back();
94 ATH_CHECK(lorentzMap_e.back().setHisto2D(lorentzMap_e_hold.get()));
95 ATH_CHECK(lorentzMap_h.back().setHisto2D(lorentzMap_h_hold.get()));
96 ATH_CHECK(distanceMap_e.back().setHisto2D(distanceMap_e_hold.get()));
97 ATH_CHECK(distanceMap_h.back().setHisto2D(distanceMap_h_hold.get()));
101 writeFluenceCdo -> setLorentzMap_e(std::move(lorentzMap_e));
102 writeFluenceCdo -> setLorentzMap_h(std::move(lorentzMap_h));
103 writeFluenceCdo -> setDistanceMap_e(std::move(distanceMap_e));
104 writeFluenceCdo -> setDistanceMap_h(std::move(distanceMap_h));
105 writeFluenceCdo -> setRamoPotentialMap(std::move(ramoPotentialMap));
108 std::vector<PixelHistoConverter> ramoPotentialMap3D;
109 std::vector<PixelHistoConverter> eFieldMap3D;
110 std::vector<PixelHistoConverter> xPositionMap3D_e;
111 std::vector<PixelHistoConverter> xPositionMap3D_h;
112 std::vector<PixelHistoConverter> yPositionMap3D_e;
113 std::vector<PixelHistoConverter> yPositionMap3D_h;
114 std::vector<PixelHistoConverter> timeMap3D_e;
115 std::vector<PixelHistoConverter> timeMap3D_h;
125 return StatusCode::FAILURE;
129 std::unique_ptr<TH2F> ramoPotentialMap3D_hold(mapsFile3D->Get<
TH2F>(
"ramo"));
130 std::unique_ptr<TH2F> eFieldMap3D_hold(mapsFile3D->Get<
TH2F>(
"efield"));
131 if (!ramoPotentialMap3D_hold || !eFieldMap3D_hold) {
132 ATH_MSG_FATAL(
"Did not find a Ramo potential or e-field map for 3D and an approximate form is available yet. Exit...");
133 return StatusCode::FAILURE;
135 ramoPotentialMap3D_hold->SetDirectory(
nullptr);
136 eFieldMap3D_hold->SetDirectory(
nullptr);
137 ramoPotentialMap3D.emplace_back();
138 eFieldMap3D.emplace_back();
139 ATH_CHECK(ramoPotentialMap3D.back().setHisto2D(ramoPotentialMap3D_hold.get()));
140 ATH_CHECK(eFieldMap3D.back().setHisto2D(eFieldMap3D_hold.get()));
143 std::unique_ptr<TH3F> xPositionMap3D_e_hold(mapsFile3D->Get<TH3F>(
"xPosition_e"));
144 std::unique_ptr<TH3F> xPositionMap3D_h_hold(mapsFile3D->Get<TH3F>(
"xPosition_h"));
145 std::unique_ptr<TH3F> yPositionMap3D_e_hold(mapsFile3D->Get<TH3F>(
"yPosition_e"));
146 std::unique_ptr<TH3F> yPositionMap3D_h_hold(mapsFile3D->Get<TH3F>(
"yPosition_h"));
147 std::unique_ptr<TH2F> timeMap3D_e_hold(mapsFile3D->Get<
TH2F>(
"etimes"));
148 std::unique_ptr<TH2F> timeMap3D_h_hold(mapsFile3D->Get<
TH2F>(
"htimes"));
150 if (!xPositionMap3D_e_hold || !xPositionMap3D_h_hold || !yPositionMap3D_e_hold || !yPositionMap3D_h_hold || !timeMap3D_e_hold || !timeMap3D_h_hold) {
152 return StatusCode::FAILURE;
155 xPositionMap3D_e_hold->SetDirectory(
nullptr);
156 xPositionMap3D_h_hold->SetDirectory(
nullptr);
157 yPositionMap3D_e_hold->SetDirectory(
nullptr);
158 yPositionMap3D_h_hold->SetDirectory(
nullptr);
159 timeMap3D_e_hold->SetDirectory(
nullptr);
160 timeMap3D_h_hold->SetDirectory(
nullptr);
163 xPositionMap3D_e.emplace_back();
164 xPositionMap3D_h.emplace_back();
165 yPositionMap3D_e.emplace_back();
166 yPositionMap3D_h.emplace_back();
167 timeMap3D_e.emplace_back();
168 timeMap3D_h.emplace_back();
169 ATH_CHECK(xPositionMap3D_e.back().setHisto3D(xPositionMap3D_e_hold.get()));
170 ATH_CHECK(xPositionMap3D_h.back().setHisto3D(xPositionMap3D_h_hold.get()));
171 ATH_CHECK(yPositionMap3D_e.back().setHisto3D(yPositionMap3D_e_hold.get()));
172 ATH_CHECK(yPositionMap3D_h.back().setHisto3D(yPositionMap3D_h_hold.get()));
173 ATH_CHECK(timeMap3D_e.back().setHisto2D(timeMap3D_e_hold.get()));
174 ATH_CHECK(timeMap3D_h.back().setHisto2D(timeMap3D_h_hold.get()));
176 std::unique_ptr<TH2F> avgCharge3D_e_hold(mapsFile3D->Get<
TH2F>(
"avgCharge_e"));
177 std::unique_ptr<TH2F> avgCharge3D_h_hold(mapsFile3D->Get<
TH2F>(
"avgCharge_h"));
179 if (!avgCharge3D_e_hold || !avgCharge3D_h_hold) {
181 return StatusCode::FAILURE;
184 avgCharge3D_e_hold->SetDirectory(
nullptr);
185 avgCharge3D_h_hold->SetDirectory(
nullptr);
193 writeFluenceCdo -> setRamoPotentialMap3D(std::move(ramoPotentialMap3D));
194 writeFluenceCdo -> setEFieldMap3D(std::move(eFieldMap3D));
195 writeFluenceCdo -> setXPositionMap3D_e(std::move(xPositionMap3D_e));
196 writeFluenceCdo -> setXPositionMap3D_h(std::move(xPositionMap3D_h));
197 writeFluenceCdo -> setYPositionMap3D_e(std::move(yPositionMap3D_e));
198 writeFluenceCdo -> setYPositionMap3D_h(std::move(yPositionMap3D_h));
199 writeFluenceCdo -> setTimeMap3D_e(std::move(timeMap3D_e));
200 writeFluenceCdo -> setTimeMap3D_h(std::move(timeMap3D_h));
201 writeFluenceCdo -> setAvgChargeMap3D_e(avgChargeMap3D_e);
202 writeFluenceCdo -> setAvgChargeMap3D_h(avgChargeMap3D_h);
204 if (rangeW.stop().isValid() && rangeW.start()>rangeW.stop()) {
206 return StatusCode::FAILURE;
208 if (writeFluenceMapHandle.record(rangeW, std::move(writeFluenceCdo)).isFailure()) {
209 ATH_MSG_FATAL(
"Could not record PixelRadiationDamageFluenceMapData " << writeFluenceMapHandle.key() <<
" with EventRange " << rangeW <<
" into Conditions Store");
210 return StatusCode::FAILURE;
212 ATH_MSG_INFO(
"recorded new CDO " << writeFluenceMapHandle.key() <<
" with range " << rangeW <<
" into Conditions Store");
214 return StatusCode::SUCCESS;