ATLAS Offline Software
Loading...
Searching...
No Matches
LArCaliWaves2Ntuple.cxx File Reference
Include dependency graph for LArCaliWaves2Ntuple.cxx:

Go to the source code of this file.

Functions

StatusCode LArCaliWaves2Ntuple::stop ATLAS_NOT_THREAD_SAFE ()
 Install fatal handler with default options.

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

StatusCode LArCaliWaves2Ntuple::stop ATLAS_NOT_THREAD_SAFE ( void )
inline

Install fatal handler with default options.

This is meant to be easy to call from python via ctypes.

Install fatal handler with default options.

getLorentzAngle() Read LorentzAngle from HIST and write out into local DB

getBSErrors() Read BSErrors from Monitoring HIST and write out into local DB

getEfficiency() Read Efficiency from Monitoring HIST and write out into local DB

getRawOccupancy() Read RawOccupancy from Monitoring HIST and write out into local DB

getNoiseOccupancy() Read NoiseOccupancy from HIST and write out into local DB

getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats

beginning of the loop of channels

bad bit newly found

known bad bit

for low noisy cells

for high noisy cells

0.01 is used to scale "PER" to the same order of magnitude to "SIG"

smaller deviation: distorted

checking TmaxAmp, Not mixed with MaxAmp and Width

channel information output

Only dead or distorted, or short known BCs are considered below.

index of bc

Definition at line 48 of file LArCaliWaves2Ntuple.cxx.

49{
50
51 // Check DACSatur jobOption consistency, in case setup default values
52 if ( m_dacSaturSkip && m_dacSaturLayer0.size()<3 ) {
53 ATH_MSG_WARNING( "DACSaturPS jobOption has wrong size. Will use default." ) ;
54 m_dacSaturLayer0.resize(3);
55 m_dacSaturLayer0[0] = 15000 ;
56 m_dacSaturLayer0[1] = 50000 ;
57 m_dacSaturLayer0[2] = 65000 ;
58 }
59 if ( m_dacSaturSkip && m_dacSaturLayer1.size()<3 ) {
60 ATH_MSG_WARNING( "DACSaturStrips jobOption has wrong size. Will use default." ) ;
61 m_dacSaturLayer1.resize(3);
62 m_dacSaturLayer1[0] = 800 ;
63 m_dacSaturLayer1[1] = 8000 ;
64 m_dacSaturLayer1[2] = 65000 ;
65 }
66 if ( m_dacSaturSkip && m_dacSaturLayer2.size()<3 ) {
67 ATH_MSG_WARNING( "DACSaturMiddle jobOption has wrong size. Will use default." ) ;
68 m_dacSaturLayer2.resize(3);
69 m_dacSaturLayer2[0] = 1000 ;
70 m_dacSaturLayer2[1] = 10000 ;
71 m_dacSaturLayer2[2] = 65000 ;
72 }
73 if ( m_dacSaturSkip && m_dacSaturLayer3.size()<3 ) {
74 ATH_MSG_WARNING( "DACSaturBack jobOption has wrong size. Will use default." ) ;
75 m_dacSaturLayer3.resize(3);
76 m_dacSaturLayer3[0] = 800 ;
77 m_dacSaturLayer3[1] = 8000 ;
78 m_dacSaturLayer3[2] = 65000 ;
79 }
80
81 StatusCode sc;
82 sc=m_nt->addItem("DAC",m_dac,0,600000);
83 if (sc!=StatusCode::SUCCESS) {
84 ATH_MSG_ERROR( "addItem 'DAC' failed" );
85 return StatusCode::FAILURE;
86 }
87
88 sc=m_nt->addItem("gain",m_gain,0,3);
89 if (sc!=StatusCode::SUCCESS) {
90 ATH_MSG_ERROR( "addItem 'gain' failed" );
91 return StatusCode::FAILURE;
92 }
93
94 if (m_addCalib) {
95 sc=m_nt->addItem("nPulsedCalibLines",m_nPulsedCalibLines,0,4);
96 if (sc!=StatusCode::SUCCESS) {
97 ATH_MSG_ERROR( "addItem 'nPulsedCalibLines' failed" );
98 return StatusCode::FAILURE;
99 }
100
101 sc=m_nt->addItem("pulsedCalibLines",4,m_pulsedCalibLines);
102 if (sc!=StatusCode::SUCCESS) {
103 ATH_MSG_ERROR( "addItem 'pulsedCalibLines' failed" );
104 return StatusCode::FAILURE;
105 }
106 }
107
108 if (m_saveJitter) {
109 sc=m_nt->addItem("Jitter",m_jitter,0.,1.);
110 if (sc!=StatusCode::SUCCESS) {
111 ATH_MSG_ERROR( "addItem 'Jitter' failed" );
112 return StatusCode::FAILURE;
113 }
114 }
115
116 if (m_addCorrUndo) {
117 sc=m_nt->addItem("corrUndo",m_corrUndo,0,1);
118 if (sc!=StatusCode::SUCCESS) {
119 ATH_MSG_ERROR( "addItem 'corrUndo' failed" );
120 return StatusCode::FAILURE;
121 }
122 }
123
124
125 const LArCalibLineMapping *clCont=nullptr;
126 if(m_isSC) {
127 ATH_MSG_DEBUG( "LArCaliWaves2Ntuple: using SC calib map" );
128 SG::ReadCondHandle<LArCalibLineMapping> clHdl{m_calibMapSCKey};
129 clCont=*clHdl;
130 } else {
131 SG::ReadCondHandle<LArCalibLineMapping> clHdl{m_calibMapKey};
132 clCont=*clHdl;
133 }
134
135 if(!clCont) {
136 ATH_MSG_WARNING( "Do not have calib line mapping !!!" );
137 return StatusCode::FAILURE;
138 }
139
140 for ( unsigned k=0 ; k<m_keylist.size() ; k++ ) {
141 const std::string& key = m_keylist[k] ;
142
143
144 ATH_MSG_INFO( "Processing WaveContainer from StoreGate! key=" << m_keylist[k] );
145 const LArCaliWaveContainer* caliWaveContainer = nullptr;
146 StatusCode sc = m_detStore->retrieve(caliWaveContainer,key);
147 if (sc.isFailure()) {
148 ATH_MSG_ERROR( "Cannot read LArCaliWaveContainer from StoreGate! key=" << key );
149 return StatusCode::FAILURE;
150 } else
151 ATH_MSG_INFO( "Read LArCaliWaveContainer from StoreGate! key= " << key );
152 LArCaliWaveContainer* caliWaveContainer_nc=nullptr;
153 if (m_applyCorr) {
154 if (!caliWaveContainer->correctionsApplied()) {
155 caliWaveContainer_nc=const_cast<LArCaliWaveContainer*>(caliWaveContainer);
156 sc=caliWaveContainer_nc->applyCorrections();
157 if (sc.isFailure()) {
158 ATH_MSG_ERROR( "Failed to apply corrections to LArCaliWaveContainer!" );
159 }
160 else
161 ATH_MSG_INFO( "Applied corrections to LArCaliWaveContainer" );
162 }
163 else {
164 ATH_MSG_WARNING( "Corrections already applied. Can't apply twice!" );
165 }
166 }// end if applyCorr
167
168
169 for (unsigned igain=CaloGain::LARHIGHGAIN;igain<CaloGain::LARNGAIN ;++igain){
170 for (const HWIdentifier chid: m_onlineId->channel_range()) {
171 m_gain=(long)igain;
172 const LArCaliWaveVec& cwv = caliWaveContainer->get(chid,igain);
173 if (cwv.empty()) continue;
174
175 LArCaliWaveVec::const_iterator cwv_it=cwv.begin();
176 LArCaliWaveVec::const_iterator cwv_it_e=cwv.end();
177 for (;cwv_it!=cwv_it_e;++cwv_it) {
178 const LArCaliWave& wave=*cwv_it;
179 if (wave.isEmpty()) continue;
180 if (m_addCorrUndo) m_corrUndo=0;
181 bool skip=writeEntry(chid,igain,wave,clCont);
182 if (skip) continue;
183 sc=ntupleSvc()->writeRecord(m_nt);
184 if (sc!=StatusCode::SUCCESS) {
185 ATH_MSG_ERROR( "writeRecord failed" );
186 return sc;
187 }
188 }//End loop over DAC
189 }//end loop over identifiers
190 }//end loop over gains
191
192
193 if (m_addCorrUndo) {
194 for (unsigned igain=CaloGain::LARHIGHGAIN;igain<CaloGain::LARNGAIN ;++igain) {
195 LArCaliWaveContainer::ConstCorrectionIt itUndo=caliWaveContainer->undoCorrBegin(igain);
196 LArCaliWaveContainer::ConstCorrectionIt itUndo_e=caliWaveContainer->undoCorrEnd(igain);
197 for(;itUndo!=itUndo_e;itUndo++) {
198 const HWIdentifier chid(itUndo->first);
199 const LArCaliWaveVec& cwv = itUndo->second;
200 LArCaliWaveVec::const_iterator cwv_it=cwv.begin();
201 LArCaliWaveVec::const_iterator cwv_it_e=cwv.end();
202 for (;cwv_it!=cwv_it_e;++cwv_it) {
203 const LArCaliWave& wave=*cwv_it;
204 m_gain = (long)igain;
205 m_corrUndo = 1;
206 bool skip=writeEntry(chid,igain,wave,clCont);
207 if (skip) continue;
208 sc=ntupleSvc()->writeRecord(m_nt);
209 if (sc!=StatusCode::SUCCESS) {
210 ATH_MSG_ERROR( "writeRecord failed" );
211 return sc;
212 }
213 }//end loop over DAC
214 }//end loop over corrections
215 }//end loop over gain
216 }//end if addUndoCorr
217 if (caliWaveContainer_nc) {
218 ATH_CHECK(caliWaveContainer_nc->undoCorrections());
219 ATH_MSG_INFO("Reverted corrections of CaliWave container");
220 }
221 }
222 ATH_MSG_INFO( "LArWave2Ntuple has finished." );
223 return StatusCode::SUCCESS;
224} // end finalize-method.
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
INTupleSvc * ntupleSvc()
Liquid Argon Cumulative Wave Container.
bool correctionsApplied() const
Have corrections been applied?
StatusCode applyCorrections()
apply correction set
StatusCode undoCorrections()
undo corrections that have been already applied
ConstCorrectionIt undoCorrBegin(unsigned int gain) const
get iterator over the Undo-Vector for a certain gain
ConstCorrectionIt undoCorrEnd(unsigned int gain) const
ConstReference get(const HWIdentifier id, unsigned int gain=0) const
get data with online identifier
bool isEmpty() const
is LArWave uninitialized?
Definition LArWave.h:183
@ LARNGAIN
Definition CaloGain.h:19
@ LARHIGHGAIN
Definition CaloGain.h:18