Changeset 12556
- Timestamp:
- 11/18/11 18:22:42 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/tpeak.C
r12545 r12556 74 74 vector<float> Vcfd(FAD_MAX_SAMPLES); // CDF result 75 75 vector<float> Vcfd2(FAD_MAX_SAMPLES); // CDF result + 2nd sliding average 76 76 77 typedef struct{ 77 78 float maxAmpl; … … 96 97 TH1F *hMaxPeakOverlay; 97 98 //TH2F *hPixelPeakOverlay; 98 TH2F *hEventPeakOverlay;99 //TH2F *hEventPeakOverlay; 99 100 int hPeakOverlayXaxisLeft,hPeakOverlayXaxisRight; 100 101 … … 140 141 TCanvas *cFiltered = NULL; 141 142 if (spikeDebug){ 142 cFiltered = new TCanvas("cFiltered","filtered DRS Waveforms", 1,10,400,300);143 cFiltered = new TCanvas("cFiltered","filtered DRS Waveforms", 1,310,400,300); 143 144 cFiltered->Divide(1, 3); 144 145 } 145 146 // Canvases to show the peak template 146 147 TCanvas *cPeakOverlay = NULL; 147 cPeakOverlay = new TCanvas("cPeakOverlay", "Overlay of detected Peaks", 1, 1, 400, 600);148 cPeakOverlay->Divide( 1,2);149 // All peaks of one Pixel150 TCanvas *cPixelPeakOverlay = NULL;151 cPixelPeakOverlay = new TCanvas("cPixelPeakOverlay", "Overlay of detected Peaks of all Events of one Pixel", 401, 1, 400, 400);152 // All Peaks of one Event153 TCanvas *cYProjection = NULL;154 cYProjection = new TCanvas("cYProjection", "Y Projection of peak overlay for each bin ", 802, 1, 400, 400);148 cPeakOverlay = new TCanvas("cPeakOverlay", "Overlay of detected Peaks", 1, 1, 1200, 600); 149 cPeakOverlay->Divide(2,1); 150 // // All peaks of one Pixel 151 // TCanvas *cPixelPeakOverlay = NULL; 152 // cPixelPeakOverlay = new TCanvas("cPixelPeakOverlay", "Overlay of detected Peaks of all Events of one Pixel", 401, 1, 400, 400); 153 // // All Peaks of one Event 154 // TCanvas *cYProjection = NULL; 155 // cYProjection = new TCanvas("cYProjection", "Y Projection of peak overlay for each bin ", 802, 1, 400, 400); 155 156 156 157 … … 205 206 if (verbosityLevel > 0) 206 207 cout <<"of, which "<< npixel << "will be processed"<< endl; 207 208 208 //Get the DRS calibration 209 209 FOpenCalibFile( drsfilename, … … 212 212 drs_triggeroffsetmean, 213 213 drs_n); 214 214 cout << "test4" << endl; 215 215 // Book the histograms 216 216 BookHistos( ); … … 276 276 hPeakOverlay->Fill( pos - (it->maxPos), Vslide[pos]) ; 277 277 // hPixelPeakOverlay->Fill( pos - (it->maxPos), Vcorr[pos]) ; 278 hEventPeakOverlay->Fill( pos - (it->maxPos), 2*Vcorr[pos]) ;278 // hEventPeakOverlay->Fill( pos - (it->maxPos), 2*Vcorr[pos]) ; 279 279 } 280 280 } … … 364 364 if (ProduceGraphic){ 365 365 if (ev % 50 == 0){ 366 //OVERLAY PEAKS 367 cPeakOverlay->cd(1); 368 hPeakOverlay->Draw("COLZ"); 369 cPeakOverlay->cd(2); 370 hMaxPeakOverlay->Draw("COLZ"); 371 cPeakOverlay->Modified(); 372 cPeakOverlay->Update(); 373 374 // cPixelPeakOverlay->cd(); 375 // hPixelPeakOverlay->Draw("COLZ"); 376 // cPixelPeakOverlay->Modified(); 377 // cPixelPeakOverlay->Update(); 366 367 //OVERLAY PEAKS 368 cPeakOverlay->cd(1); 369 hPeakOverlay->Draw("COLZ"); 370 cPeakOverlay->cd(2); 371 // hMaxPeakOverlay->Draw(""); 372 cPeakOverlay->Modified(); 373 cPeakOverlay->Update(); 378 374 } 379 375 } … … 385 381 // end of loop over Events 386 382 //------------------------------------- 387 //TH1D* hProjPeak = TH2::ProjectionY(const char* name = "proj_py", Int_t firstxbin = 0, Int_t lastxbin = -1, Option_t* option = ""); 388 SingleMaximum.resize(hPeakOverlay->GetNbinsX()); 389 for (int TimeSlice = 0; TimeSlice <= hPeakOverlay->GetNbinsX(); TimeSlice++ ){ 390 TH1D* hProjPeak = hPeakOverlay->ProjectionY("proj_py", TimeSlice, TimeSlice, ""); 391 SingleMaximum[ TimeSlice ].maxAmpl = (hProjPeak->GetMaximumBin() * 0.5) - 55.5; 392 SingleMaximum[ TimeSlice ].countOfMax = hProjPeak->GetBinContent( hProjPeak->GetMaximumBin() ); 393 // cout << "Timeslice:" << "\t" << "MaxAmplitude" << "\t" << "Counts" << "\t" << "max. Value on X Axis: " << endl; 394 // cout << TimeSlice << "\t \t" << SingleMaximum[ TimeSlice ].maxAmpl << "\t \t" << SingleMaximum[ TimeSlice ].countOfMax<< "\t \t" << ((hProjPeak->GetNbinsX() * 0.5) -55.5)<< endl; 395 hMaxPeakOverlay->SetBinContent(TimeSlice, SingleMaximum[ TimeSlice ].maxAmpl ); 396 397 } 398 383 384 //------------------------------------- 385 // Histogramm of Maximas in Overlay Spectra 386 //------------------------------------- 387 // resize vector SingleMaximum to number of timeslices in Overlay Spectra 388 SingleMaximum.resize(hPeakOverlay->GetNbinsX()); 389 390 //put maximumvalue of every Y-projection of every timeslice into vector 391 for (int TimeSlice = 0; TimeSlice <= hPeakOverlay->GetNbinsX(); TimeSlice++ ){ 392 TH1D* hProjPeak = hPeakOverlay->ProjectionY("proj_py", TimeSlice, TimeSlice, ""); 393 SingleMaximum[ TimeSlice ].maxAmpl = (hProjPeak->GetMaximumBin() * 0.5) - 54; 394 SingleMaximum[ TimeSlice ].countOfMax = hProjPeak->GetBinContent( hProjPeak->GetMaximumBin() ); 395 hMaxPeakOverlay->SetBinContent(TimeSlice, SingleMaximum[ TimeSlice ].maxAmpl ); 396 } 397 hMaxPeakOverlay->Fit("landau", "", "", -50, 250); 398 399 //------------------------------------- 400 // Draw Histograms 401 //------------------------------------- 399 402 if (ProduceGraphic){ 400 403 //OVERLAY PEAKS 401 404 cPeakOverlay->cd(1); 402 405 hPeakOverlay->Draw("COLZ"); 403 // cPeakOverlay->Modified();404 // cPeakOverlay->Update();405 406 cPeakOverlay->cd(2); 406 407 hMaxPeakOverlay->Draw(""); … … 414 415 415 416 } 416 417 418 // cPixelPeakOverlay->cd();419 // hPixelPeakOverlay->Draw();420 // cPixelPeakOverlay->Modified();421 // cPixelPeakOverlay->Update();422 423 417 SaveHistograms( OutRootFileName ); 424 418 … … 482 476 hMaxPeakOverlay->GetXaxis()->SetTitle( "Timeslices" ); 483 477 hMaxPeakOverlay->GetYaxis()->SetTitle( "Amplitude [a.u.]" ); 484 //hMaxPeakOverlay->SetBit(TH2F::kCanRebin);485 478 hList.Add( hMaxPeakOverlay ); 486 479 … … 492 485 // hList.Add( hPixelPeakOverlay ); 493 486 494 hEventPeakOverlay = new TH2F("hEventPeakOverlay", "Overlay of detected Peaks of all Pixel of one Event",495 hPeakOverlayXaxisLeft + hPeakOverlayXaxisRight , (-1*hPeakOverlayXaxisLeft)-0.5, hPeakOverlayXaxisRight-0.5 ,496 4096, -48.5, 200.5 );497 hEventPeakOverlay->GetXaxis()->SetTitle( "Timeslices" );498 hEventPeakOverlay->GetYaxis()->SetTitle( "Amplitude [a.u.]" );499 hList.Add( hEventPeakOverlay );487 // hEventPeakOverlay = new TH2F("hEventPeakOverlay", "Overlay of detected Peaks of all Pixel of one Event", 488 // hPeakOverlayXaxisLeft + hPeakOverlayXaxisRight , (-1*hPeakOverlayXaxisLeft)-0.5, hPeakOverlayXaxisRight-0.5 , 489 // 4096, -48.5, 200.5 ); 490 // hEventPeakOverlay->GetXaxis()->SetTitle( "Timeslices" ); 491 // hEventPeakOverlay->GetYaxis()->SetTitle( "Amplitude [a.u.]" ); 492 // hList.Add( hEventPeakOverlay ); 500 493 501 494 }
Note:
See TracChangeset
for help on using the changeset viewer.