46 #include "TDirectory.h" 159 if (wavelength != 0) {
170 <<
" - returning.\n\n";
181 LogError(
"EcalLaserAnalyzerYousi") <<
"Cannot get product: EBdigiCollection from: " 183 <<
" - returning.\n\n";
190 for (
int j = 0;
j < 5; ++
j) {
192 for (
int z = 0;
z < 2; ++
z) {
194 TF1 peakFit(
"peakFit",
"[0] +[1]*x +[2]*x^2", 30, 50);
195 TF1 pedFit(
"pedFit",
"[0]", 0, 5);
197 for (
int k = 0;
k < 50;
k++) {
200 pedFit.SetParameter(0, 750);
202 Float_t ped = pedFit.GetParameter(0);
204 Int_t maxbin =
FitHist->GetMaximumBin();
205 peakFit.SetRange(
FitHist->GetBinCenter(maxbin) - 4 *
FitHist->GetBinWidth(maxbin),
206 FitHist->GetBinCenter(maxbin) + 4 *
FitHist->GetBinWidth(maxbin));
207 peakFit.SetParameters(750, 4, -.05);
209 Float_t
max = peakFit.Eval(-peakFit.GetParameter(1) / (2 * peakFit.GetParameter(2)));
211 PN_amp[
j] = PN_amp[
j] +
max - ped;
213 PN_amp[
j] = PN_amp[
j] +
max;
217 PN_amp[
j] = PN_amp[
j] / 2.0;
238 for (
int j = 0;
j <
CN;
j++) {
239 ID = (*hits)[
j].id();
240 theAPD = (*hits)[
j].amplitude();
241 Jitter = (*hits)[
j].jitter();
242 Chi2 = (*hits)[
j].chi2();
243 thePN = PN_amp[(
ID.ic() + 299) / 400];
248 C_APD[
ID.ic() - 1]->Fill(theAPD);
249 C_APDPN[
ID.ic() - 1]->Fill(theAPD / thePN);
250 C_PN[
ID.ic() - 1]->Fill(thePN);
251 C_J[
ID.ic() - 1]->Fill(Jitter);
252 C_APDPN_J[
ID.ic() - 1]->Fill(Jitter, theAPD / thePN);
253 APDPN_J->Fill(Jitter, theAPD / thePN);
257 fTree[2] = theAPD / thePN;
260 fTree[5] = (*hits)[
j].pedestal();
261 fTree[6] =
iEvent.id().event();
263 if (((
ID.ic() - 1) % 20 > 9) || ((
ID.ic() - 1) < 100)) {
266 APDPN_J_H[0]->Fill(Jitter, theAPD / thePN);
270 APDPN_J_H[1]->Fill(Jitter, theAPD / thePN);
272 if ((
ID.ic() - 1) < 100) {
278 if (((
ID.ic() - 1) % 20) < 10) {
279 index = ((
ID.ic() - 101) / 400) * 2 + 1;
284 index = ((
ID.ic() - 101) / 400) * 2 + 2;
305 edm::LogInfo(
"EcalLaserAnalyzerYousi") <<
"running laser analyzer \n\n";
311 APD =
new TH2F(
"APD",
"APD", 85, 0., 85., 20, 0., 20.);
312 APD_RMS =
new TH2F(
"APD_RMS",
"APD_RMS", 85, 0., 85., 20, 0., 20.);
313 APDPN =
new TH2F(
"APDPN",
"APDPN", 85, 0., 85., 20, 0., 20.);
314 APDPN_RMS =
new TH2F(
"APDPN_RMS",
"APDPN_RMS", 85, 0., 85., 20, 0., 20.);
315 PN =
new TH2F(
"PN",
"PN", 85, 0., 85., 20, 0., 20.);
316 APDPN_J =
new TH2F(
"JittervAPDPN",
"JittervAPDPN", 250, 3., 7., 250, 1., 2.);
317 APDPN_C =
new TH2F(
"Chi2vAPDPN",
"Chi2vAPDPN", 250, 0., 50., 250, 0., 5.0);
318 FitHist =
new TH1F(
"FitHist",
"FitHist", 50, 0, 50);
319 Count =
new TH2F(
"Count",
"Count", 85, 0., 1., 20, 0., 1.);
321 for (
int i = 0;
i < 1700;
i++) {
322 std::ostringstream name_1;
323 std::ostringstream name_2;
324 std::ostringstream name_3;
325 std::ostringstream name_4;
326 std::ostringstream name_5;
327 name_1 <<
"C_APD_" <<
i + 1;
328 name_2 <<
"C_APDPN_" <<
i + 1;
329 name_3 <<
"C_PN_" <<
i + 1;
330 name_4 <<
"C_J_" <<
i + 1;
331 name_5 <<
"C_APDPN_J_" <<
i + 1;
332 C_APD[
i] =
new TH1F(name_1.str().c_str(), name_1.str().c_str(), 2500, 0., 5000.);
333 C_APDPN[
i] =
new TH1F(name_2.str().c_str(), name_2.str().c_str(), 20000, 0., 25.);
334 C_PN[
i] =
new TH1F(name_3.str().c_str(), name_3.str().c_str(), 1000, 0., 4000.);
335 C_J[
i] =
new TH1F(name_4.str().c_str(), name_4.str().c_str(), 250, 3.0, 7.);
336 C_APDPN_J[
i] =
new TH2F(name_5.str().c_str(), name_5.str().c_str(), 250, 3.0, 6., 250, 1., 2.2);
339 for (
int i = 0;
i < 2;
i++) {
340 std::ostringstream aname_1;
341 std::ostringstream aname_2;
342 std::ostringstream aname_3;
343 aname_1 <<
"peakAPD_" <<
i;
344 aname_2 <<
"peakAPDPN_" <<
i;
345 aname_3 <<
"JittervAPDPN_Half_" <<
i;
346 peakAPD[
i] =
new TH1F(aname_1.str().c_str(), aname_1.str().c_str(), 1000, 0., 5000.);
347 peakAPDPN[
i] =
new TH1F(aname_2.str().c_str(), aname_2.str().c_str(), 1000, 0., 8.);
348 APDPN_J_H[
i] =
new TH2F(aname_3.str().c_str(), aname_3.str().c_str(), 250, 3., 7., 250, 1., 2.2);
351 for (
int i = 0;
i < 9;
i++) {
352 std::ostringstream bname_1;
353 std::ostringstream bname_2;
354 std::ostringstream bname_3;
355 bname_1 <<
"APD_LM_" <<
i;
356 bname_2 <<
"APDPN_LM_" <<
i;
357 bname_3 <<
"APDPN_J_LM_" <<
i;
358 APD_LM[
i] =
new TH1F(bname_1.str().c_str(), bname_1.str().c_str(), 500, 0., 5000.);
359 APDPN_LM[
i] =
new TH1F(bname_2.str().c_str(), bname_2.str().c_str(), 500, 0., 8.);
360 APDPN_J_LM[
i] =
new TH2F(bname_3.str().c_str(), bname_3.str().c_str(), 250, 3., 7., 250, 1., 2.2);
368 std::ostringstream varlist;
369 varlist <<
"APD:PN:APDPN:Jitter:Chi2:ped:EVT";
370 for (
int i = 0;
i < 1700;
i++) {
371 std::ostringstream
name;
372 name <<
"C_Tree_" <<
i + 1;
373 C_Tree[
i] = (TNtuple *)
new TNtuple(
name.str().c_str(),
name.str().c_str(), varlist.str().c_str());
388 for (
int j = 0;
j < 1700;
j++) {
389 Float_t min_r, max_r;
390 Float_t
RMS, Sigma, K;
395 APD_RMS->SetBinContent(85 - (
j / 20), 20 - (
j % 20),
RMS);
399 while (Sigma >
RMS) {
402 TF1 gs1(
"gs1",
"gaus", min_r, max_r);
403 C_APD[
j]->Fit(&gs1,
"RQI");
404 Sigma = gs1.GetParameter(2);
408 C_APD[
j]->Fit(
"gaus",
"QI");
418 while (Sigma >
RMS) {
421 TF1 gs2(
"gs2",
"gaus", min_r, max_r);
423 Sigma = gs2.GetParameter(2);
435 C_PN[
j]->Fit(
"gaus",
"Q");
436 C_APD[
j]->Fit(
"gaus",
"QI");
438 C_APD[
j]->Write(
"", TObject::kOverwrite);
439 C_APDPN[
j]->Write(
"", TObject::kOverwrite);
440 C_PN[
j]->Write(
"", TObject::kOverwrite);
441 C_J[
j]->Write(
"", TObject::kOverwrite);
443 newgs1 =
C_APD[
j]->GetFunction(
"gaus");
444 newgs2 =
C_APDPN[
j]->GetFunction(
"gaus");
445 gs3 =
C_PN[
j]->GetFunction(
"gaus");
446 Float_t theAPD = newgs1->GetParameter(1);
447 APD->SetBinContent(85 - (
j / 20), 20 - (
j % 20), theAPD);
448 Float_t theAPDPN = newgs2->GetParameter(1);
449 APDPN->SetBinContent(85 - (
j / 20), 20 - (
j % 20), theAPDPN);
450 Float_t thePN = gs3->GetParameter(1);
452 PN->SetBinContent(85 - (
j / 20), 20 - (
j % 20), thePN);
453 C_Tree[
j]->Write(
"", TObject::kOverwrite);
456 for (
int i = 0;
i < 9;
i++) {
457 APD_LM[
i]->Write(
"", TObject::kOverwrite);
458 APDPN_LM[
i]->Write(
"", TObject::kOverwrite);
463 APD->Write(
"", TObject::kOverwrite);
464 APD_RMS->Write(
"", TObject::kOverwrite);
465 APDPN_RMS->Write(
"", TObject::kOverwrite);
466 APDPN->Write(
"", TObject::kOverwrite);
467 APDPN_J->Write(
"", TObject::kOverwrite);
468 APDPN_C->Write(
"", TObject::kOverwrite);
469 PN->Write(
"", TObject::kOverwrite);
470 peakAPD[0]->Write(
"", TObject::kOverwrite);
471 peakAPD[1]->Write(
"", TObject::kOverwrite);
472 peakAPDPN[0]->Write(
"", TObject::kOverwrite);
473 peakAPDPN[1]->Write(
"", TObject::kOverwrite);
474 APDPN_J_H[0]->Write(
"", TObject::kOverwrite);
475 APDPN_J_H[1]->Write(
"", TObject::kOverwrite);
std::string digiProducer_
~EcalLaserAnalyzerYousi() override
Log< level::Error, false > LogError
T getUntrackedParameter(std::string const &, T const &) const
std::string hitCollection_
void analyze(const edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
const_iterator begin() const
Log< level::Info, false > LogInfo
std::string PNdigiCollection_
EcalLaserAnalyzerYousi(const edm::ParameterSet &)
uint16_t *__restrict__ uint16_t const *__restrict__ adc