Changeset 19951 for trunk/Mars/hawc/extract_singles.C
- Timestamp:
- 04/29/20 21:48:05 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/hawc/extract_singles.C
r19857 r19951 57 57 { 58 58 Int_t fIntegrationWindow; 59 60 59 vector<vector<Single>> fData; 61 60 62 61 public: 63 MSingles(const char *name=NULL, const char *title=NULL) : fIntegrationWindow( 30)62 MSingles(const char *name=NULL, const char *title=NULL) : fIntegrationWindow(40) 64 63 { 65 64 fName = name ? name : "MSingles"; … … 88 87 ClassDef(MSingles, 1) 89 88 }; 90 91 89 // Histogram class to extract the baseline 92 90 class MHBaseline : public MH … … 102 100 103 101 public: 104 MHBaseline() : fPedestal(0), fSkipStart( 20), fSkipEnd(10)102 MHBaseline() : fPedestal(0), fSkipStart(10), fSkipEnd(10) 105 103 { 106 104 fName = "MHBaseline"; … … 108 106 // Setup the histogram 109 107 fBaseline.SetName("Baseline"); 110 fBaseline.SetTitle(" Median spectrum");108 fBaseline.SetTitle("Baseline Spectrum"); 111 109 fBaseline.SetXTitle("Pixel [idx]"); 112 fBaseline.SetYTitle(" Median baseline [mV]");110 fBaseline.SetYTitle("Amplitude [mV]"); 113 111 fBaseline.SetDirectory(NULL); 114 112 } … … 282 280 TH2F fTime; 283 281 TProfile2D fPulse; 282 TH2F fPulse2D; //plot the extracted singles in a 2D plot vs samples(time) 284 283 285 284 UInt_t fNumEntries; … … 296 295 // Setup histograms 297 296 fSignal.SetName("Signal"); 298 fSignal.SetTitle(" pulse integral spectrum");297 fSignal.SetTitle("Pulse Integral Spectrum"); 299 298 fSignal.SetXTitle("pixel [SoftID]"); 300 299 fSignal.SetYTitle("time [a.u.]"); … … 302 301 303 302 fTime.SetName("Time"); 304 fTime.SetTitle(" arival time spectrum");303 fTime.SetTitle("Arrival Time Spectrum"); 305 304 fTime.SetXTitle("pixel [SoftID]"); 306 305 fTime.SetYTitle("time [a.u.]"); … … 308 307 309 308 fPulse.SetName("Pulse"); 310 fPulse.SetTitle(" average pulse shape spectrum");309 fPulse.SetTitle("Average Pulse Shape Spectrum"); 311 310 fPulse.SetXTitle("pixel [SoftID]"); 312 311 fPulse.SetYTitle("time [a.u.]"); 313 312 fPulse.SetDirectory(NULL); 313 314 fPulse2D.SetName("Pulse2D"); 315 fPulse2D.SetTitle("Extracted Pulses"); 316 fPulse2D.SetXTitle("time [a.u.]"); 317 fPulse2D.SetYTitle("amplitude [a.u.]"); 318 fPulse2D.SetDirectory(NULL); 314 319 } 315 320 … … 363 368 364 369 // Correct for DRS timing!! 370 371 //Setup binning for the average time spectrum 365 372 MBinning binst(roi, -0.5, roi-0.5); 366 373 MH::SetBinning(fTime, binsx, binst); 367 374 375 //Setup binning for the average pulse spectrum 368 376 MBinning binspy(2*roi, -roi-0.5, roi-0.5); 377 //MBinning binspy(1024, -522-0.5, 522-0.5); 369 378 MH::SetBinning(fPulse, binsx, binspy); 379 380 //Setup binning for the 2D plot amplitude vs time 381 MBinning bins_time(2*roi, -roi-0.5, roi-0.5); 382 //MBinning bins_time(1024, -522-0.5, 522-0.5); 383 MBinning bins_ampl(160, -30, 50); //N_bin is chosen such that 1 DAC = 0.5mV 384 MH::SetBinning(fPulse2D, bins_time, bins_ampl); 370 385 371 386 return kTRUE; … … 402 417 for (int s=0; s<roi; s++) 403 418 fPulse.Fill(i, s-tm, ptr[s]); 419 420 for (int s=0; s<roi; s++) 421 fPulse2D.Fill(s-tm, ptr[s]); 404 422 } 405 423 … … 416 434 const TH2 *GetTime() const { return &fTime; } 417 435 const TH2 *GetPulse() const { return &fPulse; } 436 const TH2F *GetPulse2D() const {return &fPulse2D;} 418 437 419 438 UInt_t GetNumEntries() const { return fNumEntries; } … … 441 460 gPad->SetFrameBorderMode(0); 442 461 fPulse.Draw("colz"); 462 463 pad->cd(4); 464 gPad->SetBorderMode(0); 465 gPad->SetFrameBorderMode(0); 466 fPulse2D.Draw("colz"); 443 467 } 444 468 … … 465 489 gPad->SetFrameBorderMode(0); 466 490 fPulse.DrawCopy("colz"); 491 492 pad->cd(4); 493 gPad->SetBorderMode(0); 494 gPad->SetFrameBorderMode(0); 495 fPulse2D.Draw("colz"); 467 496 } 468 497 … … 497 526 MExtractSingles() : fSingles(0), fPedestal(0), fEvent(0), 498 527 fExtractionRange(64), 499 fNumAverage(10), fStartSkip( 20), fEndSkip(10),500 fIntegrationSize( 3*10), fMaxSearchWindow(30)528 fNumAverage(10), fStartSkip(10), fEndSkip(10), 529 fIntegrationSize(4*10), fMaxSearchWindow(20) 501 530 { 502 531 } … … 538 567 539 568 const size_t navg = fNumAverage; 540 const float threshold = fThreshold; 569 const float threshold = fThreshold; 541 570 const UInt_t start_skip = fStartSkip; 542 571 const UInt_t end_skip = fEndSkip; … … 595 624 if (k_max == i+5 || k_max == i + max_search_window-1) 596 625 continue; 626 627 //Make sure the pulse is isolated (area after the maximum is empty) 628 UInt_t k_falling = k_max+200; 629 for (UInt_t k_after = k_falling; k_after < k_max +250; k_after++) 630 { 631 if (val[k_after] > val[k_falling] && 632 val[k_after + fNumAverage/2] > val[k_falling]) 633 continue; 634 } 597 635 598 636 //search for half maximum before maximum … … 623 661 single.fTime = k_half_max; 624 662 625 // Crossing of the threshold is at 5663 // Crossing of the threshold is at 7 626 664 for (UInt_t j=k_half_max; j<k_half_max+integration_size; j++) 627 665 single.fSignal += ptr[j]; … … 631 669 // Add single to list 632 670 result.push_back(single); 671 break; //accept only one pulse per event 633 672 634 673 // skip falling edge … … 644 683 645 684 int extract_singles( 646 Int_t max_dist = 14,647 Double_t threshold =5,648 const char *runfile = "raw/2019/10/27/20191027_",649 int firstRunID = 6,650 int lastRunID = 6,651 const char *drsfile = "raw/2019/10/27/20191027_003.drs.fits",652 const char *outpath = "."685 Int_t max_dist = 14, 686 Double_t threshold = 5, 687 const char *runfile = "/home/giangdo/Documents/Master/MA/pulse/data_single_pe/20191027_", 688 int firstRunID = 6, 689 int lastRunID = 6, 690 const char *drsfile = "/home/giangdo/Documents/Master/MA/pulse/data_single_pe/20191027_004.drs.fits", 691 const char *outpath = "/home/giangdo/Documents/Master/MA/pulse/data_single_pe/extracted" 653 692 ) 654 693 { … … 688 727 689 728 // map file to use (get that from La Palma!) 690 const char *map = usemap ? " ../hawc/FAMOUSmap171218.txt" : NULL;729 const char *map = usemap ? "/home/giangdo/Documents/Master/MA/Software/Mars/hawc/HAWCsEyemap181214.txt" : NULL; 691 730 692 731 // ------------------------------------------------------ … … 856 895 const TH2 *htime = h->GetTime(); 857 896 const TH2 *hpulse = h->GetPulse(); 897 const TH2F *ppulse2d = h->GetPulse2D(); 858 898 859 899 d->AddTab("Time"); … … 869 909 hp->Draw(); 870 910 911 d->AddTab("2DPulse"); 912 ppulse2d->DrawCopy("colz"); 913 871 914 d->SaveAs(outfile); 872 915
Note:
See TracChangeset
for help on using the changeset viewer.