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 136 of file FixLArElecCalib.h.

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

◆ 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 207 of file FixLArElecCalib.h.

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