ATLAS Offline Software
Loading...
Searching...
No Matches
FixLArElecCalib.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  FixLArElecCalib
 fix electronic calibration constants for MC. More...

Functions

template<class T>
StatusCode FixLArElecCalib::update_EM_HEC ATLAS_NOT_THREAD_SAFE (const std::string &em_filename, const std::string &hec_filename, const LArOnOffIdMapping *cabling, bool withGain, int nvar)
template<class T>
StatusCode FixLArElecCalib::update_All ATLAS_NOT_THREAD_SAFE (const std::string &filename, const LArOnOffIdMapping *cabling, bool withGain, int nvar)

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE() [1/2]

template<class T>
StatusCode FixLArElecCalib::update_EM_HEC ATLAS_NOT_THREAD_SAFE ( const std::string & em_filename,
const std::string & hec_filename,
const LArOnOffIdMapping * cabling,
bool withGain,
int nvar )

Definition at line 144 of file FixLArElecCalib.h.

145{
146 // read in the file
147
148 const T * container_c = nullptr;
149 ATH_CHECK( detStore()->retrieve(container_c) );
150
151 T* container = const_cast<T*>(container_c);
152
153 typedef typename T::LArCondObj CONDOBJ ;
154
155 for (int i=0; i<2;++i)
156 { // EM and HEC
157 if( i==0 )
158 {
159 if ( em_filename == "") continue ;
160 bool EM=true;
161 ATH_CHECK( ReadFile(em_filename,cabling,EM,withGain,nvar) );
162 }
163 if( i==1 )
164 {
165 if ( hec_filename == "") continue ;
166 bool EM=false ;
167 ATH_CHECK( ReadFile(hec_filename,cabling,EM,withGain,nvar) );
168 }
169
170
171 int ngain=1;
172 if (withGain) ngain=3;
173 for (int igain = 0;igain<ngain;++igain){
174 VROW_t::iterator it = m_cache[igain].begin();
175 VROW_t::iterator it_e = m_cache[igain].end();
176
177 int n=0;
178 for( ;it!=it_e;++it)
179 {
180 HWIdentifier hid = (*it).first;
181
182 const CONDOBJ& u = container->get(hid,igain);
183
184 if( u.isEmpty() )
185 {
186 ATH_MSG_WARNING(" No existing conditions data, adding new one " );
187 CONDOBJ t ;
188 set_object(t,(*it).second) ;
189 container->setPdata(hid,t,igain);
190 }
191 else
192 {
193 print_object(" Old object = ",u);
194
195 CONDOBJ& u2 = const_cast<CONDOBJ&>(u);
196 set_object(u2,(*it).second) ;
197 }
198
199 const CONDOBJ& u3 = container->get(hid,igain);
200 print_object(" New object = ",u3);
201
202 ++n;
203 }
204 ATH_MSG_INFO( " done for gain ="<<igain<<" with "<<n<<" objects");
205
206 }// gain
207 }// EM HEC
208
209 ATH_MSG_INFO(" done with EM "<<em_filename<<" and HEC" <<hec_filename );
210 return StatusCode::SUCCESS;
211}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ ATLAS_NOT_THREAD_SAFE() [2/2]

template<class T>
StatusCode FixLArElecCalib::update_All ATLAS_NOT_THREAD_SAFE ( const std::string & filename,
const LArOnOffIdMapping * cabling,
bool withGain,
int nvar )

Definition at line 215 of file FixLArElecCalib.h.

216{
217 // read in the file
218
219 const T * container_c = nullptr;
220 ATH_CHECK( detStore()->retrieve(container_c) );
221
222 T* container = const_cast<T*>(container_c);
223
224 typedef typename T::LArCondObj CONDOBJ ;
225
226 if ( filename == "") { ATH_MSG_ERROR("No input filename "); return StatusCode::FAILURE; }
227 ATH_CHECK( ReadFileAll(filename, cabling, withGain,nvar) );
228
229 int ngain=1;
230 if (withGain) ngain=3;
231 for (int igain = 0;igain<ngain;++igain){
232 VROW_t::iterator it = m_cache[igain].begin();
233 VROW_t::iterator it_e = m_cache[igain].end();
234
235 int n=0;
236 for( ;it!=it_e;++it) {
237 HWIdentifier hid = (*it).first;
238
239 if(!hid.is_valid()) {
240 ATH_MSG_WARNING(" Not valid hid: 0x" <<hid.getString() );
241 continue;
242 }
243
244 const CONDOBJ& u = container->get(hid,igain);
245
246 if( u.isEmpty() ) {
247 ATH_MSG_WARNING(" Not existing conditions data, adding new one " );
248 CONDOBJ t ;
249 set_object(t,(*it).second) ;
250 container->setPdata(hid,t,igain);
251 } else {
252 print_object(" Old object = ",u);
253
254 CONDOBJ& u2 = const_cast<CONDOBJ&>(u);
255 set_object(u2,(*it).second) ;
256 }
257
258 const CONDOBJ& u3 = container->get(hid,igain);
259 print_object(" New object = ",u3);
260
261 ++n;
262 }
263 ATH_MSG_INFO( " done for gain ="<<igain<<" with "<<n<<" objects");
264
265 }// gain
266
267 ATH_MSG_INFO(" done with "<<filename );
268 return StatusCode::SUCCESS;
269}
#define ATH_MSG_ERROR(x)
std::string getString() const
Provide a string form of the identifier - hexadecimal.
bool is_valid() const
Check if id is in a valid state.