48 #include "TDirectory.h"
65 virtual void endJob()
override;
184 if ( wavelength !=0 ) {
return; }
192 LogError(
"EcalLaserAnalyzerYousi") <<
"Cannot get product: EBRecHitCollection from: "
204 LogError(
"EcalLaserAnalyzerYousi") <<
"Cannot get product: EBdigiCollection from: "
205 <<
"getbytype" <<
" - returning.\n\n";
213 for (
int j = 0;
j < 5; ++
j) {
215 for (
int z = 0;
z<2; ++
z) {
217 TF1 peakFit(
"peakFit",
"[0] +[1]*x +[2]*x^2", 30, 50);
218 TF1 pedFit(
"pedFit",
"[0]",0,5);
220 for(
int k = 0;
k < 50;
k++){
223 pedFit.SetParameter(0,750);
225 Float_t ped = pedFit.GetParameter(0);
227 Int_t maxbin =
FitHist->GetMaximumBin();
228 peakFit.SetRange(
FitHist->GetBinCenter(maxbin)-4*
FitHist->GetBinWidth(maxbin),
230 peakFit.SetParameters(750,4,-.05);
232 Float_t
max = peakFit.Eval(-peakFit.GetParameter(1)/(2*peakFit.GetParameter(2)));
234 PN_amp[
j] = PN_amp[
j] + max - ped;
236 PN_amp[
j] = PN_amp[
j] +
max;
240 PN_amp[
j] = PN_amp[
j]/2.0;
266 Int_t
CN = hits->size();
268 for(
int j = 0;
j <
CN;
j++){
269 ID = (*hits)[
j].id();
270 theAPD = (*hits)[
j].amplitude();
271 Jitter = (*hits)[
j].jitter();
272 Chi2 = (*hits)[
j].chi2();
273 thePN = PN_amp[ (
ID.ic() + 299)/400 ];
278 C_APD[
ID.ic()-1]->Fill(theAPD);
280 C_PN[
ID.ic()-1]->Fill(thePN);
281 C_J[
ID.ic()-1]->Fill(Jitter);
283 APDPN_J->Fill(Jitter, theAPD/thePN);
287 fTree[2] = theAPD/thePN;
290 fTree[5] = (*hits)[
j].pedestal();
291 fTree[6] = iEvent.
id().
event();
293 if(((
ID.ic()-1)%20 > 9)||((
ID.ic()-1)<100)){
296 APDPN_J_H[0]->Fill(Jitter, theAPD/thePN);
300 APDPN_J_H[1]->Fill(Jitter, theAPD/thePN);
302 if((
ID.ic()-1) < 100){
309 if(((
ID.ic()-1)%20) < 10){
310 index = ((
ID.ic()-101)/400)*2 + 1;
316 index = ((
ID.ic()-101)/400)*2 + 2;
348 edm::LogInfo(
"EcalLaserAnalyzerYousi") <<
"running laser analyzer \n\n";
354 APD =
new TH2F(
"APD",
"APD", 85, 0., 85., 20, 0., 20.);
355 APD_RMS =
new TH2F(
"APD_RMS",
"APD_RMS", 85, 0., 85., 20, 0., 20.);
356 APDPN =
new TH2F(
"APDPN",
"APDPN", 85, 0., 85., 20, 0., 20.);
357 APDPN_RMS =
new TH2F(
"APDPN_RMS",
"APDPN_RMS", 85, 0., 85., 20, 0., 20.);
358 PN =
new TH2F(
"PN",
"PN", 85, 0., 85., 20, 0., 20.);
359 APDPN_J =
new TH2F(
"JittervAPDPN",
"JittervAPDPN",250, 3., 7., 250, 1., 2.);
360 APDPN_C =
new TH2F(
"Chi2vAPDPN",
"Chi2vAPDPN", 250, 0., 50., 250, 0., 5.0);
361 FitHist =
new TH1F(
"FitHist",
"FitHist", 50, 0, 50);
362 Count =
new TH2F(
"Count",
"Count", 85, 0., 1., 20, 0., 1.);
365 for(
int i = 0;
i < 1700;
i++){
366 std::ostringstream name_1;
367 std::ostringstream name_2;
368 std::ostringstream name_3;
369 std::ostringstream name_4;
370 std::ostringstream name_5;
371 name_1 <<
"C_APD_" <<
i+1;
372 name_2 <<
"C_APDPN_" << i+1;
373 name_3 <<
"C_PN_" << i+1;
374 name_4 <<
"C_J_" << i+1;
375 name_5 <<
"C_APDPN_J_" << i+1;
376 C_APD[
i] =
new TH1F(name_1.str().c_str(), name_1.str().c_str(), 2500, 0., 5000.);
377 C_APDPN[
i] =
new TH1F(name_2.str().c_str(), name_2.str().c_str(), 20000, 0., 25.);
378 C_PN[
i] =
new TH1F(name_3.str().c_str(), name_3.str().c_str(), 1000, 0., 4000.);
379 C_J[
i] =
new TH1F(name_4.str().c_str(), name_4.str().c_str(), 250, 3.0, 7.);
380 C_APDPN_J[
i] =
new TH2F(name_5.str().c_str(), name_5.str().c_str(), 250, 3.0, 6., 250, 1., 2.2);
383 for(
int i = 0;
i < 2;
i++){
384 std::ostringstream aname_1;
385 std::ostringstream aname_2;
386 std::ostringstream aname_3;
387 aname_1 <<
"peakAPD_" <<
i;
388 aname_2 <<
"peakAPDPN_" <<
i;
389 aname_3 <<
"JittervAPDPN_Half_" <<
i;
390 peakAPD[
i] =
new TH1F(aname_1.str().c_str(), aname_1.str().c_str(), 1000, 0., 5000.);
391 peakAPDPN[
i] =
new TH1F(aname_2.str().c_str(), aname_2.str().c_str(), 1000, 0., 8.);
392 APDPN_J_H[
i] =
new TH2F(aname_3.str().c_str(), aname_3.str().c_str(), 250, 3., 7., 250, 1., 2.2);
395 for(
int i = 0;
i < 9;
i++){
396 std::ostringstream bname_1;
397 std::ostringstream bname_2;
398 std::ostringstream bname_3;
399 bname_1 <<
"APD_LM_" <<
i;
400 bname_2 <<
"APDPN_LM_" <<
i;
401 bname_3 <<
"APDPN_J_LM_" <<
i;
402 APD_LM[
i] =
new TH1F(bname_1.str().c_str(), bname_1.str().c_str(), 500, 0., 5000.);
403 APDPN_LM[
i] =
new TH1F(bname_2.str().c_str(), bname_2.str().c_str(), 500, 0., 8.);
404 APDPN_J_LM[
i] =
new TH2F(bname_3.str().c_str(), bname_3.str().c_str(), 250, 3., 7., 250, 1., 2.2);
413 std::ostringstream varlist;
414 varlist <<
"APD:PN:APDPN:Jitter:Chi2:ped:EVT";
415 for(
int i = 0;
i < 1700;
i++){
416 std::ostringstream
name;
417 name <<
"C_Tree_" <<
i+1;
418 C_Tree[
i] = (TNtuple*)
new TNtuple(name.str().c_str(), name.str().c_str(),
419 varlist.str().c_str());
434 DIR = fROOT->mkdir(
Run_.c_str());
437 for(
int j = 0;
j < 1700;
j++){
438 Float_t min_r, max_r;
439 Float_t
RMS, Sigma, K;
446 APD_RMS->SetBinContent(85-(
j/20), 20-(
j%20), RMS);
453 gs1 =
new TF1(
"gs1",
"gaus", min_r, max_r);
454 C_APD[
j]->Fit(
"gs1",
"RQI");
455 Sigma = gs1->GetParameter(2);
459 C_APD[
j]->Fit(
"gaus",
"QI");
460 gs1 =
C_APD[
j]->GetFunction(
"gaus");
466 APDPN_RMS->SetBinContent(85-(
j/20), 20-(
j%20), RMS);
473 gs2 =
new TF1(
"gs2",
"gaus", min_r, max_r);
475 Sigma = gs2->GetParameter(2);
480 gs2 =
C_APDPN[
j]->GetFunction(
"gaus");
488 C_PN[
j]->Fit(
"gaus",
"Q");
489 C_APD[
j]->Fit(
"gaus",
"QI");
491 C_APD[
j]->Write(
"", TObject::kOverwrite);
492 C_APDPN[
j]->Write(
"", TObject::kOverwrite);
493 C_PN[
j]->Write(
"", TObject::kOverwrite);
494 C_J[
j]->Write(
"", TObject::kOverwrite);
496 newgs1 =
C_APD[
j]->GetFunction(
"gaus");
497 newgs2 =
C_APDPN[
j]->GetFunction(
"gaus");
498 gs3 =
C_PN[
j]->GetFunction(
"gaus");
499 Float_t theAPD = newgs1->GetParameter(1);
500 APD->SetBinContent(85-(
j/20), 20-(
j%20), theAPD);
501 Float_t theAPDPN = newgs2->GetParameter(1);
502 APDPN->SetBinContent(85-(
j/20), 20-(
j%20), theAPDPN);
503 Float_t thePN = gs3->GetParameter(1);
505 PN->SetBinContent(85-(
j/20), 20-(
j%20), thePN);
506 C_Tree[
j]->Write(
"", TObject::kOverwrite);
509 for(
int i = 0;
i < 9;
i++){
510 APD_LM[
i]->Write(
"", TObject::kOverwrite);
511 APDPN_LM[
i]->Write(
"", TObject::kOverwrite);
517 APD->Write(
"", TObject::kOverwrite);
518 APD_RMS->Write(
"", TObject::kOverwrite);
519 APDPN_RMS->Write(
"", TObject::kOverwrite);
520 APDPN->Write(
"", TObject::kOverwrite);
521 APDPN_J->Write(
"", TObject::kOverwrite);
522 APDPN_C->Write(
"", TObject::kOverwrite);
523 PN->Write(
"", TObject::kOverwrite);
524 peakAPD[0]->Write(
"", TObject::kOverwrite);
525 peakAPD[1]->Write(
"", TObject::kOverwrite);
526 peakAPDPN[0]->Write(
"", TObject::kOverwrite);
527 peakAPDPN[1]->Write(
"", TObject::kOverwrite);
528 APDPN_J_H[0]->Write(
"", TObject::kOverwrite);
529 APDPN_J_H[1]->Write(
"", TObject::kOverwrite);
int adc(sample_type sample)
get the ADC sample (12 bits)
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
std::string digiProducer_
#define DEFINE_FWK_MODULE(type)
virtual void endJob() override
const T & max(const T &a, const T &b)
std::string hitCollection_
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
~EcalLaserAnalyzerYousi()
std::string PNdigiCollection_
EcalLaserAnalyzerYousi(const edm::ParameterSet &)
virtual void beginJob() override