46 #include "TDirectory.h" 123 : hitCollection_(iConfig.getUntrackedParameter<
std::
string>(
"hitCollection")),
124 hitProducer_(iConfig.getUntrackedParameter<
std::
string>(
"hitProducer")),
125 outFileName_(iConfig.getUntrackedParameter<
std::
string>(
"outFileName")),
126 SM_(iConfig.getUntrackedParameter<
std::
string>(
"SM")),
127 Run_(iConfig.getUntrackedParameter<
std::
string>(
"Run")),
128 digiProducer_(iConfig.getUntrackedParameter<
std::
string>(
"digiProducer")),
129 PNdigiCollection_(iConfig.getUntrackedParameter<
std::
string>(
"PNdigiCollection")),
159 if (wavelength != 0) {
165 if (!
hits.isValid()) {
167 <<
"Cannot get product: EBRecHitCollection from: " <<
hitCollection_ <<
" - returning.\n\n";
173 edm::LogError(
"EcalLaserAnalyzerYousi") <<
"Cannot get product: EBdigiCollection from: getHandle - returning.\n\n";
180 for (
int j = 0;
j < 5; ++
j) {
182 for (
int z = 0;
z < 2; ++
z) {
184 TF1 peakFit(
"peakFit",
"[0] +[1]*x +[2]*x^2", 30, 50);
185 TF1 pedFit(
"pedFit",
"[0]", 0, 5);
187 for (
int k = 0;
k < 50;
k++) {
190 pedFit.SetParameter(0, 750);
192 Float_t ped = pedFit.GetParameter(0);
194 Int_t maxbin =
FitHist->GetMaximumBin();
195 peakFit.SetRange(
FitHist->GetBinCenter(maxbin) - 4 *
FitHist->GetBinWidth(maxbin),
196 FitHist->GetBinCenter(maxbin) + 4 *
FitHist->GetBinWidth(maxbin));
197 peakFit.SetParameters(750, 4, -.05);
199 Float_t
max = peakFit.Eval(-peakFit.GetParameter(1) / (2 * peakFit.GetParameter(2)));
201 PN_amp[
j] = PN_amp[
j] +
max - ped;
203 PN_amp[
j] = PN_amp[
j] +
max;
207 PN_amp[
j] = PN_amp[
j] / 2.0;
228 for (
int j = 0;
j <
CN;
j++) {
229 ID = (*hits)[
j].id();
230 theAPD = (*hits)[
j].amplitude();
231 Jitter = (*hits)[
j].jitter();
232 Chi2 = (*hits)[
j].chi2();
233 thePN = PN_amp[(
ID.ic() + 299) / 400];
238 C_APD[
ID.ic() - 1]->Fill(theAPD);
239 C_APDPN[
ID.ic() - 1]->Fill(theAPD / thePN);
240 C_PN[
ID.ic() - 1]->Fill(thePN);
241 C_J[
ID.ic() - 1]->Fill(Jitter);
242 C_APDPN_J[
ID.ic() - 1]->Fill(Jitter, theAPD / thePN);
243 APDPN_J->Fill(Jitter, theAPD / thePN);
247 fTree[2] = theAPD / thePN;
250 fTree[5] = (*hits)[
j].pedestal();
251 fTree[6] =
iEvent.id().event();
253 if (((
ID.ic() - 1) % 20 > 9) || ((
ID.ic() - 1) < 100)) {
256 APDPN_J_H[0]->Fill(Jitter, theAPD / thePN);
260 APDPN_J_H[1]->Fill(Jitter, theAPD / thePN);
262 if ((
ID.ic() - 1) < 100) {
268 if (((
ID.ic() - 1) % 20) < 10) {
269 index = ((
ID.ic() - 101) / 400) * 2 + 1;
274 index = ((
ID.ic() - 101) / 400) * 2 + 2;
295 edm::LogInfo(
"EcalLaserAnalyzerYousi") <<
"running laser analyzer \n\n";
301 APD =
new TH2F(
"APD",
"APD", 85, 0., 85., 20, 0., 20.);
302 APD_RMS =
new TH2F(
"APD_RMS",
"APD_RMS", 85, 0., 85., 20, 0., 20.);
303 APDPN =
new TH2F(
"APDPN",
"APDPN", 85, 0., 85., 20, 0., 20.);
304 APDPN_RMS =
new TH2F(
"APDPN_RMS",
"APDPN_RMS", 85, 0., 85., 20, 0., 20.);
305 PN =
new TH2F(
"PN",
"PN", 85, 0., 85., 20, 0., 20.);
306 APDPN_J =
new TH2F(
"JittervAPDPN",
"JittervAPDPN", 250, 3., 7., 250, 1., 2.);
307 APDPN_C =
new TH2F(
"Chi2vAPDPN",
"Chi2vAPDPN", 250, 0., 50., 250, 0., 5.0);
308 FitHist =
new TH1F(
"FitHist",
"FitHist", 50, 0, 50);
309 Count =
new TH2F(
"Count",
"Count", 85, 0., 1., 20, 0., 1.);
311 for (
int i = 0;
i < 1700;
i++) {
312 std::ostringstream name_1;
313 std::ostringstream name_2;
314 std::ostringstream name_3;
315 std::ostringstream name_4;
316 std::ostringstream name_5;
317 name_1 <<
"C_APD_" <<
i + 1;
318 name_2 <<
"C_APDPN_" <<
i + 1;
319 name_3 <<
"C_PN_" <<
i + 1;
320 name_4 <<
"C_J_" <<
i + 1;
321 name_5 <<
"C_APDPN_J_" <<
i + 1;
322 C_APD[
i] =
new TH1F(name_1.str().c_str(), name_1.str().c_str(), 2500, 0., 5000.);
323 C_APDPN[
i] =
new TH1F(name_2.str().c_str(), name_2.str().c_str(), 20000, 0., 25.);
324 C_PN[
i] =
new TH1F(name_3.str().c_str(), name_3.str().c_str(), 1000, 0., 4000.);
325 C_J[
i] =
new TH1F(name_4.str().c_str(), name_4.str().c_str(), 250, 3.0, 7.);
326 C_APDPN_J[
i] =
new TH2F(name_5.str().c_str(), name_5.str().c_str(), 250, 3.0, 6., 250, 1., 2.2);
329 for (
int i = 0;
i < 2;
i++) {
330 std::ostringstream aname_1;
331 std::ostringstream aname_2;
332 std::ostringstream aname_3;
333 aname_1 <<
"peakAPD_" <<
i;
334 aname_2 <<
"peakAPDPN_" <<
i;
335 aname_3 <<
"JittervAPDPN_Half_" <<
i;
336 peakAPD[
i] =
new TH1F(aname_1.str().c_str(), aname_1.str().c_str(), 1000, 0., 5000.);
337 peakAPDPN[
i] =
new TH1F(aname_2.str().c_str(), aname_2.str().c_str(), 1000, 0., 8.);
338 APDPN_J_H[
i] =
new TH2F(aname_3.str().c_str(), aname_3.str().c_str(), 250, 3., 7., 250, 1., 2.2);
341 for (
int i = 0;
i < 9;
i++) {
342 std::ostringstream bname_1;
343 std::ostringstream bname_2;
344 std::ostringstream bname_3;
345 bname_1 <<
"APD_LM_" <<
i;
346 bname_2 <<
"APDPN_LM_" <<
i;
347 bname_3 <<
"APDPN_J_LM_" <<
i;
348 APD_LM[
i] =
new TH1F(bname_1.str().c_str(), bname_1.str().c_str(), 500, 0., 5000.);
349 APDPN_LM[
i] =
new TH1F(bname_2.str().c_str(), bname_2.str().c_str(), 500, 0., 8.);
350 APDPN_J_LM[
i] =
new TH2F(bname_3.str().c_str(), bname_3.str().c_str(), 250, 3., 7., 250, 1., 2.2);
358 std::ostringstream varlist;
359 varlist <<
"APD:PN:APDPN:Jitter:Chi2:ped:EVT";
360 for (
int i = 0;
i < 1700;
i++) {
361 std::ostringstream
name;
362 name <<
"C_Tree_" <<
i + 1;
363 C_Tree[
i] = (TNtuple *)
new TNtuple(
name.str().c_str(),
name.str().c_str(), varlist.str().c_str());
378 for (
int j = 0;
j < 1700;
j++) {
379 Float_t min_r, max_r;
380 Float_t
RMS, Sigma, K;
385 APD_RMS->SetBinContent(85 - (
j / 20), 20 - (
j % 20),
RMS);
389 while (Sigma >
RMS) {
392 TF1 gs1(
"gs1",
"gaus", min_r, max_r);
393 C_APD[
j]->Fit(&gs1,
"RQI");
394 Sigma = gs1.GetParameter(2);
398 C_APD[
j]->Fit(
"gaus",
"QI");
408 while (Sigma >
RMS) {
411 TF1 gs2(
"gs2",
"gaus", min_r, max_r);
413 Sigma = gs2.GetParameter(2);
425 C_PN[
j]->Fit(
"gaus",
"Q");
426 C_APD[
j]->Fit(
"gaus",
"QI");
428 C_APD[
j]->Write(
"", TObject::kOverwrite);
429 C_APDPN[
j]->Write(
"", TObject::kOverwrite);
430 C_PN[
j]->Write(
"", TObject::kOverwrite);
431 C_J[
j]->Write(
"", TObject::kOverwrite);
433 newgs1 =
C_APD[
j]->GetFunction(
"gaus");
434 newgs2 =
C_APDPN[
j]->GetFunction(
"gaus");
435 gs3 =
C_PN[
j]->GetFunction(
"gaus");
436 Float_t theAPD = newgs1->GetParameter(1);
437 APD->SetBinContent(85 - (
j / 20), 20 - (
j % 20), theAPD);
438 Float_t theAPDPN = newgs2->GetParameter(1);
439 APDPN->SetBinContent(85 - (
j / 20), 20 - (
j % 20), theAPDPN);
440 Float_t thePN = gs3->GetParameter(1);
442 PN->SetBinContent(85 - (
j / 20), 20 - (
j % 20), thePN);
443 C_Tree[
j]->Write(
"", TObject::kOverwrite);
446 for (
int i = 0;
i < 9;
i++) {
447 APD_LM[
i]->Write(
"", TObject::kOverwrite);
448 APDPN_LM[
i]->Write(
"", TObject::kOverwrite);
453 APD->Write(
"", TObject::kOverwrite);
454 APD_RMS->Write(
"", TObject::kOverwrite);
455 APDPN_RMS->Write(
"", TObject::kOverwrite);
456 APDPN->Write(
"", TObject::kOverwrite);
457 APDPN_J->Write(
"", TObject::kOverwrite);
458 APDPN_C->Write(
"", TObject::kOverwrite);
459 PN->Write(
"", TObject::kOverwrite);
460 peakAPD[0]->Write(
"", TObject::kOverwrite);
461 peakAPD[1]->Write(
"", TObject::kOverwrite);
462 peakAPDPN[0]->Write(
"", TObject::kOverwrite);
463 peakAPDPN[1]->Write(
"", TObject::kOverwrite);
464 APDPN_J_H[0]->Write(
"", TObject::kOverwrite);
465 APDPN_J_H[1]->Write(
"", TObject::kOverwrite);
const edm::EDGetTokenT< EcalRawDataCollection > rawDataToken_
const edm::EDGetTokenT< EcalPnDiodeDigiCollection > pnDigiToken_
~EcalLaserAnalyzerYousi() override=default
Log< level::Error, false > LogError
const std::string PNdigiCollection_
void analyze(const edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
const_iterator begin() const
const std::string digiProducer_
Log< level::Info, false > LogInfo
const std::string hitCollection_
const edm::EDGetTokenT< EBUncalibratedRecHitCollection > hitToken_
const std::string hitProducer_
EcalLaserAnalyzerYousi(const edm::ParameterSet &)
uint16_t *__restrict__ uint16_t const *__restrict__ adc
const std::string outFileName_