Changeset 12170
- Timestamp:
- 10/11/11 19:26:14 (13 years ago)
- Location:
- fact/tools/rootmacros
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/FPedestalAllPx.c
r12166 r12170 1 1 #include <cstdio> 2 int FPedestalAllPx(fits &datafile, vector<int16_t> &data, vector<int16_t> &data_offset, vector<float> &drs_basemean, vector<float> &drs_gainmean, vector<float> &drs_triggeroffsetmean, UInt_t data_px, UInt_t data_roi, float pedestal_mean[], float pedestal_rms[]) 2 int FPedestalAllPx( 3 fits &datafile, 4 vector<int16_t> &data, 5 vector<int16_t> &data_offset, 6 vector<float> &drs_basemean, 7 vector<float> &drs_gainmean, 8 vector<float> &drs_triggeroffsetmean, 9 UInt_t data_px, 10 UInt_t data_roi, 11 float pedestal_mean[], 12 float pedestal_rms[] ) 3 13 { 4 14 // TCanvas *canv_base = new TCanvas( "canv_base", "Determine the baseline", 100, 520, 700, 500 ); … … 9 19 TH1F* baseline[data_px]; 10 20 for(int i=0; i<data_px; i++) { 11 std::sprintf(title_base,"Baseline of Px %i (data: %s, DRS: %s)",i); 21 22 std::sprintf(title_base,"Baseline of Px %i",i); 12 23 std::sprintf(name_base,"base%i",i); 24 13 25 baseline[i] = new TH1F(name_base,title_base,2000,-99.5,100.5); 14 26 baseline[i]->GetXaxis()->SetTitle("Sample value (mV)"); … … 16 28 } 17 29 18 // TH1F *baseline = new TH1F("baseline", title_base, 1000,-10,40);19 // baseline[i]->GetXaxis()->SetTitle("Sample value (mV)");20 // baseline[i]->GetYaxis()->SetTitle("Entries");21 22 30 //------------------------------------------- 23 31 //Find the baseline 24 32 //------------------------------------------- 25 for (size_t i=0; i<datafile.GetNumRows(); i++)33 for (size_t i=0; ( i<datafile.GetNumRows() ); i++) 26 34 { 27 35 datafile.GetRow(i); 28 cout << "Loop variable: " << i << endl;36 if( i%50 == 0 ) cout << "Loop variable: " << i << endl; 29 37 30 38 //Iterate over the pixels … … 52 60 pedestal_rms[j] = baseline[j]->GetRMS(); 53 61 } 54 std::cout << "Value of maximal probability: " << pedestal_mean[1348] << " +- " << pedestal_rms[1348] << std::endl;62 // std::cout << "Value of maximal probability Px 1348: " << pedestal_mean[1348] << " +- " << pedestal_rms[1348] << std::endl; 55 63 56 64 // canv_base->cd(); -
fact/tools/rootmacros/testFPedestalAllPx.C
r12166 r12170 11 11 #include "FPedestalAllPx.c" 12 12 13 int testFPedestalAllPx(const char *name, const char *drsname) 13 int testFPedestalAllPx( 14 const char *name = "../raw/20110916_025.fits", 15 const char *drsname = "../raw/20110916_024.drs.fits") 14 16 { 15 17 //****************************************************************************** … … 19 21 //Example call in ROOT: 20 22 //root [74] .x calscope.C++("20110804_024.fits","20110804_023.drs.fits",10,1348) 21 //T. Kr ähenbühl, August 2011, tpk@phys.ethz.ch23 //T. Kr�henb�hl, August 2011, tpk@phys.ethz.ch 22 24 //****************************************************************************** 23 25 … … 52 54 vector<float> drs_gainmean; 53 55 vector<float> drs_triggeroffsetmean; 56 54 57 FOpenCalibFile(drsname, drs_basemean, drs_gainmean, drs_triggeroffsetmean, drs_n); 55 58 59 56 60 //------------------------------------------- 57 61 //Check the sizes of the data columns … … 62 66 return 1; 63 67 } 68 else{ 69 cout << "Data and DRS file compatible" << endl; 70 // continue 71 } 64 72 65 73 … … 75 83 float pedestal_mean[data_px]; 76 84 float pedestal_rms[data_px]; 85 77 86 FPedestalAllPx(datafile, data, data_offset, drs_basemean, drs_gainmean, drs_triggeroffsetmean, data_px, data_roi, pedestal_mean, pedestal_rms); 87 78 88 // vector<float> calevent(data_px*data_roi); //Vector for the calibrated event 79 89 // FGetCalEvent(data, data_offset, drs_basemean, drs_gainmean, drs_triggeroffsetmean, calevent, data_px, data_roi); … … 82 92 //Draw the data 83 93 //------------------------------------------- 94 84 95 TCanvas *canv_mean= new TCanvas( "canv_mean", "mean in mV", 30, 300, 900, 500 ); 85 96 TH1F* histo_mean = new TH1F("histo_mean","Value of maximal probability",2000,-99.5,100.5);
Note:
See TracChangeset
for help on using the changeset viewer.