57 {
58
60
61 const LArShapeComplete* inputShape=nullptr;
66 }
67
68
69 const LArShapeComplete* inputShapeResidual=nullptr;
74 }
75
76 std::unique_ptr<LArShapeComplete> larShapeCompleteCorr=std::make_unique<LArShapeComplete>();
78 sc = larShapeCompleteCorr->initialize();
79 if (
sc.isFailure() ) {
80 ATH_MSG_ERROR(
"Could not initialize LArShapeComplete data object - exit!" ) ;
82 }
83
90
92 const HWIdentifier
id =
it.channelId() ;
94 if (nPhases==0) {
95
96 continue;
97 }
99
103
104 bool doShapeCorr=true;
105 if ( vShape.size() == 0 || vShapeDer.size() == 0 ) {
106 ATH_MSG_WARNING(
"Shape not found for gain "<< gain <<
" channel 0x" << std::hex <<
id.get_compact() << std::dec );
107 continue;
108 }
109 if ( vShape.size() != vShapeDer.size() ) {
110 ATH_MSG_WARNING(
"Shape (" << vShape.size() <<
") derivative (" << vShapeDer.size() <<
") don't have the same size for channel 0x"
111 << std::hex << id.get_compact() << std::dec );
112 continue;
113 }
114
115 std::vector<float> theShape;
116 std::vector<float> theShapeDer;
117
120 if ( vShapeResidual.size() == 0 || vShapeResidualDer.size() == 0 ) {
122 << " channel 0x" << std::hex << id.get_compact() << std::dec
123 << ". Will not be applied!" );
124 doShapeCorr=false;
125 }
126 if ( vShapeResidual.size() != vShapeResidualDer.size() ) {
127 ATH_MSG_ERROR(
"Shape residual (" << vShapeResidual.size() <<
") and its derivative (" << vShapeResidualDer.size()
128 << ") don't have the same size for channel 0x"
129 << std::hex << id.get_compact() << std::dec
130 << ". Will be not applied!" );
131 doShapeCorr=false;
132 }
133
134
135 if ( vShape.size() > vShapeResidual.size() ) {
136 ATH_MSG_WARNING(
"Shape residual size does not match the shape size for channel 0x"
137 << std::hex << id.get_compact() << std::dec
138 << ". Will be not corrected!" );
139 doShapeCorr=false;
140 }
141
142 if (doShapeCorr) {
143 for (
unsigned k=0;
k<vShape.size();
k++) {
144 theShape.push_back( vShape[k] + vShapeResidual[k] );
145 theShapeDer.push_back( vShapeDer[k] + vShapeResidualDer[k] );
146 ATH_MSG_VERBOSE(
"Shape channel= " <<
id.get_compact() <<
": " << k <<
"\t" << vShape[k] <<
"\t" << vShapeDer[k]);
147 ATH_MSG_VERBOSE(
"Shape residual channel= " <<
id.get_compact() <<
": " << k <<
"\t" << vShapeResidual[k] <<
"\t" << vShapeResidualDer[k]);
148 }
149 }
150 else {
151 for (
unsigned k=0;
k<vShape.size();
k++) {
152 theShape.push_back( vShape[k] );
153 theShapeDer.push_back( vShapeDer[k] );
154 }
155 }
156
157 std::vector<std::vector<float> > shapeAmpl { std::move(theShape) };
158 std::vector<std::vector<float> > shapeDer { std::move(theShapeDer) };
159 larShapeCompleteCorr->set(id,(int)gain,shapeAmpl,shapeDer,timeOffset,25.);
160
161 }
162 }
163
164 ATH_MSG_DEBUG(
" Selected shapes for " <<
count <<
" cells. NChannels=" << larShapeCompleteCorr->chan_size());
165
167 if (
sc.isFailure()) {
170 }
172
174 if (
sc.isFailure()) {
175 ATH_MSG_ERROR(
"Failed to sym-link LArShapeComplete object" );
177 }
178
179
180
181 return StatusCode::SUCCESS;
182
183}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
const ServiceHandle< StoreGateSvc > & detStore() const
LArVectorProxy ShapeRef_t
This class defines the interface for accessing Shape (Nsample variable, Dt = 25 ns fixed) @stereotype...
ILArShape::ShapeRef_t shapeDer(size_t tbin) const
ILArShape::ShapeRef_t shape(size_t tbin) const
float timeOffset() const
Return the time offset for this channel.
GroupingType
Grouping type.
ConditionsMap::const_iterator ConstConditionsMapIterator
Subset::ConstReference ConstReference
ConstConditionsMapIterator begin(unsigned int gain) const
get iterator for all channels for a gain
ConstConditionsMapIterator end(unsigned int gain) const
end of all channels for this gain
virtual ShapeRef_t ShapeDer(const HWIdentifier &CellID, int gain, int tbin=0, int mode=0) const override
virtual ShapeRef_t Shape(const HWIdentifier &CellID, int gain, int tbin=0, int mode=0) const override
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
::StatusCode StatusCode
StatusCode definition for legacy code.