150{
151 MsgStream log(
msgSvc(), name());
152 log<<MSG::INFO<<"DedxCalibWireGain::WriteHists()"<<endreq;
153
154
156 for(
int i=0; i<
wireNo; i++)
157 {
158 entryNo[i] = m_wiregain[i]->Integral();
159 mean[i] = m_wiregain[i]->GetMean();
160 sigma[i] = m_wiregain[i]->GetRMS();
161 proper[i] = m_wiregain[i]->GetBinCenter(m_wiregain[i]->GetMaximumBin());
162 if(entryNo[i]<10) continue;
163
165 {
166 fitmean[i] = m_wiregain[i]->GetFunction("mylan")->GetParameter(1);
167 fitmeanerr[i] = m_wiregain[i]->GetFunction("mylan")->GetParError(1);
168 fitsigma[i] = m_wiregain[i]->GetFunction("mylan")->GetParameter(2);
169 chisq[i] = (m_wiregain[i]->GetFunction("mylan")-> GetChisquare())/(m_wiregain[i]->GetFunction("mylan")-> GetNDF());
170 }
172 {
173 fitmean[i] = m_wiregain[i]->GetFunction("landaun")->GetParameter(1);
174 fitmeanerr[i] = m_wiregain[i]->GetFunction("landaun")->GetParError(1);
175 fitsigma[i] = m_wiregain[i]->GetFunction("landaun")->GetParameter(2);
176 chisq[i] = (m_wiregain[i]->GetFunction("landaun")-> GetChisquare())/(m_wiregain[i]->GetFunction("landaun")-> GetNDF());
177 }
179 {
180 fitmean[i] = m_wiregain[i]->GetFunction("Landau")->GetParameter(1);
181 fitmeanerr[i] = m_wiregain[i]->GetFunction("Landau")->GetParError(1);
182 fitsigma[i] = m_wiregain[i]->GetFunction("Landau")->GetParameter(2);
183 chisq[i] = (m_wiregain[i]->GetFunction("Landau")-> GetChisquare())/(m_wiregain[i]->GetFunction("Landau")-> GetNDF());
184 }
186 {
187 fitmean[i] = m_wiregain[i]->GetFunction("Vavilov")->GetParameter(1);
188 fitmeanerr[i] = m_wiregain[i]->GetFunction("Vavilov")->GetParError(1);
189 fitsigma[i] = m_wiregain[i]->GetFunction("Vavilov")->GetParameter(2);
190 chisq[i] = (m_wiregain[i]->GetFunction("Vavilov")-> GetChisquare())/(m_wiregain[i]->GetFunction("Vavilov")-> GetNDF());
191 }
193 {
194 fitmean[i] = m_wiregain[i]->GetFunction("AsymGauss")->GetParameter(1);
195 fitmeanerr[i] = m_wiregain[i]->GetFunction("AsymGauss")->GetParError(1);
196 fitsigma[i] = m_wiregain[i]->GetFunction("AsymGauss")->GetParameter(2);
197 chisq[i] = (m_wiregain[i]->GetFunction("AsymGauss")-> GetChisquare())/(m_wiregain[i]->GetFunction("AsymGauss")-> GetNDF());
198 }
199
200 }
201
202 double Norm=0,
count=0;
203 for(
int i=188; i<
wireNo; i++)
204 {
205 if(fitmean[i]>0 && fitmeanerr[i]>0 && fitmeanerr[i]<10 && fitsigma[i]>0 && fitsigma[i]<200 && entryNo[i]>1500)
206 {
207 Norm += fitmean[i];
209 }
210 }
212 cout<<
"count= "<<
count<<
" average value of good wire: "<<Norm<<endl;
213
214
216 {
217 wireg[i] = fitmean[i]/Norm;
218 wire[i] = i;
219 }
220
221
222 log<<MSG::INFO<<"begin generating root file!!! "<<endreq;
223 TFile*
f =
new TFile(
m_rootfile.c_str(),
"recreate");
225
226 TTree* wiregcalib = new TTree("wiregcalib", "wiregcalib");
227 wiregcalib->Branch("wireg", wireg, "wireg[6796]/D");
228 wiregcalib->Branch("wire", wire, "wire[6796]/D");
229 wiregcalib->Branch("entryNo", entryNo, "entryNo[6796]/D");
230 wiregcalib->Branch("proper", proper, "proper[6796]/D");
231 wiregcalib->Branch("mean", mean, "mean[6796]/D");
232 wiregcalib->Branch(
"sigma",
sigma,
"sigma[6796]/D");
233 wiregcalib->Branch("fitmean", fitmean, "fitmean[6796]/D");
234 wiregcalib->Branch("fitmeanerr", fitmeanerr, "fitmeanerr[6796]/D");
235 wiregcalib->Branch("fitsigma", fitsigma, "fitsigma[6796]/D");
236 wiregcalib->Branch("chisq", chisq, "chisq[6796]/D");
237 wiregcalib->Fill();
238 wiregcalib->Write();
239
241
242 TCanvas c1("c1", "canvas", 500, 400);
245 {
246 m_wiregain[i]->Draw();
248 }
250
251 for(
int i=0;i<
wireNo;i++)
delete m_wiregain[i];
252
253}
DOUBLE_PRECISION count[3]