SC analysis using std::vector compiles

This commit is contained in:
2022-05-10 14:32:06 +02:00
parent 25fc057033
commit 5e8ba967c8

View File

@ -119,12 +119,12 @@ int main(int argc, char* argv[]) {
jungfrauFile *thisfile = new jungfrauFile();
vector<jungfrauPedestal*> pedestalObject_SC(16); //should call default constructor 16 times
vector<jungfrauPedestal*> pedestalObject_SC(NSC); //should call default constructor 16 times
vector<TH2F*> pedestalsG0;
pedestalsG0.reserve(16);
pedestalsG0.reserve(NSC);
vector<TH2F*> pedeRMSG0;
pedeRMSG0.reserve(16);
for (int sci = 0; sci < 16; ++sci) {
pedeRMSG0.reserve(NSC);
for (int sci = 0; sci < NSC; ++sci) {
//pedestalObject_SC[sci] = new jungfrauPedestal();
pedestalObject_SC[sci]->pedestalSetNFrames(100);
@ -134,8 +134,8 @@ int main(int argc, char* argv[]) {
snprintf( pedehistoname, 50, "pedeRMSG0_sc%d", sci );
pedeRMSG0.push_back( new TH2F( pedehistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
}
static vector< vector<uint16_t> > pedestals16_G0_start( 16, vector<uint16_t>(NCH) ); //I suppose, this is to track pedestal shifting over the course of data taking
static vector< vector<double> > pedeRMS16_G0( 16, vector<double>(NCH) );
static vector< vector<uint16_t> > pedestals16_G0_start( NSC, vector<uint16_t>(NCH) ); //I suppose, this is to track pedestal shifting over the course of data taking
static vector< vector<double> > pedeRMS16_G0( NSC, vector<double>(NCH) );
for (int pedefilei = 0; pedefilei < pedefilen; ++pedefilei) {
@ -162,7 +162,7 @@ int main(int argc, char* argv[]) {
} // end of loops over files
for (int sci = 0; sci < 16; ++sci) {
for (int sci = 0; sci < NSC; ++sci) {
for (int i = 0; i < NCH; ++i) {
if (pixel_mask[i] == true) {
pedestalsG0[sci]->Fill( i%NC, i/NC, pedestalObject_SC[sci]->pedestalOfChannel(i) );
@ -203,10 +203,7 @@ int main(int argc, char* argv[]) {
int adc2d_nbin= 1200;
if (isJF11) adc2d_nbin= 1600;
//HERE!!!
TH2I *adc2d[8][16];
vector< vector <TH2I*> > adc2d; //(8, vector <TH2I*>(16) ); //declare
/*
TH2I *adc2d_2[16]; = new TH2I("adc2d_2","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*1-0.5),(65536*2-0.5));
TH2I *adc2d_3[16]; = new TH2I("adc2d_3","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*2-0.5),(65536*3-0.5));
@ -216,25 +213,40 @@ int main(int argc, char* argv[]) {
TH2I *adc2d_7[16]; = new TH2I("adc2d_7","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*6-0.5),(65536*7-0.5));
TH2I *adc2d_8[16]; = new TH2I("adc2d_8","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*7-0.5),(65536*8-0.5));
*/
TH1D *adcpc_spec[16];
TH2F *pede_updates[16];
TH2F *pede_diff[16];
for ( int sci = 0; sci < 16; ++sci ) {
Char_t *_histoname = new Char_t[50];
//initilaize
for ( int adci = 0; adci < 8; ++adci ) {
vector<TH2I*> v;
v.reserve(NSC);
for ( int sci = 0; sci < NSC; ++sci ) {
Char_t *_histoname = new Char_t[50];
snprintf( _histoname, 50, "adc2d_%d_sc%d", (adci+1), sci );
adc2d[adci][sci] = new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*adci-0.5 ), ( 65536*( adci+1 )-0.5 ) );
v.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*adci-0.5 ), ( 65536*( adci+1 )-0.5 ) ) );
}
adc2d.push_back(v);
}
//declare
vector<TH1D*> adcpc_spec;
adcpc_spec.reserve(NSC);
vector<TH2F*> pede_updates;
pede_updates.reserve(NSC);
vector<TH2F*> pede_diff;
pede_diff.reserve(NSC);
//initialize
for ( int sci = 0; sci < NSC; ++sci ) {
Char_t *_histoname = new Char_t[50];
snprintf( _histoname, 50, "adcpc_spec_sc%d", sci );
adcpc_spec[sci] = new TH1D( _histoname,"",300,0,3000 ); //spectrum for every sc, every 10000 frames
adcpc_spec.push_back( new TH1D( _histoname,"",300,0,3000 ) ); //spectrum for every sc, every 10000 frames
snprintf( _histoname, 50, "pede_updates_sc%d", sci );
pede_updates[sci] = new TH2F( _histoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
pede_updates.push_back( new TH2F( _histoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
snprintf( _histoname, 50, "pede_diff_sc%d", sci );
pede_diff[sci] = new TH2F( _histoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
pede_diff.push_back( new TH2F( _histoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
}
//HERE!!!!
for (int filei = 0; filei < filen; filei++) {
// open data file
@ -294,8 +306,8 @@ int main(int argc, char* argv[]) {
pede_updates[sci]->Reset();
pede_diff[sci]->Reset();
for (int i = 0; i < NCH; i++) {
pede_updates[sci]->Fill(i%NC,i/NC,pedestalObject_SC[sci]->pedestalUpdates(i));
pede_diff[sci]->Fill(i%NC,i/NC,pedestalObject_SC[sci]->pedestalOfChannel(i) - pedestals16_G0_start[sci][i]);
pede_updates[sci]->Fill( i%NC, i/NC, pedestalObject_SC[sci]->pedestalUpdates(i) );
pede_diff[sci]->Fill( i%NC, i/NC, pedestalObject_SC[sci]->pedestalOfChannel(i) - pedestals16_G0_start[sci][i] );
pedestals16_G0_start[sci][i] = pedestalObject_SC[sci]->pedestalOfChannel(i);
}
@ -363,112 +375,144 @@ int main(int argc, char* argv[]) {
high_ADU_peak = 400;
}
TH1F* fit_par3[16];
TH1F* fit_par4[16];
TH1F* fit_par5[16];
TH1F* fit_par6[16];
TH1F* fit_par7[16];
//declare
vector<TH1F*> fit_par3;
fit_par3.reserve(NSC);
vector<TH1F*> fit_par4;
fit_par4.reserve(NSC);
vector<TH1F*> fit_par5;
fit_par5.reserve(NSC);
vector<TH1F*> fit_par6;
fit_par6.reserve(NSC);
vector<TH1F*> fit_par7;
fit_par7.reserve(NSC);
TH2F* fit_par3_2d[16];
TH2F* fit_par4_2d[16];
TH2F* fit_par5_2d[16];
TH2F* fit_par6_2d[16];
TH2F* fit_par7_2d[16];
vector<TH2F*> fit_par3_2d;
fit_par3_2d.reserve(NSC);
vector<TH2F*> fit_par4_2d;
fit_par4_2d.reserve(NSC);
vector<TH2F*> fit_par5_2d;
fit_par5_2d.reserve(NSC);
vector<TH2F*> fit_par6_2d;
fit_par6_2d.reserve(NSC);
vector<TH2F*> fit_par7_2d;
fit_par7_2d.reserve(NSC);
TH1F* peak_fit_pos[16];
TH1F* peak_fit_poserr[16];
TH2F* peak_fit_pos_2d[16];
TH2F* peak_fit_poserr_2d[16];
vector<TH1F*> peak_fit_pos;
peak_fit_pos.reserve(NSC);
vector<TH1F*> peak_fit_poserr;
peak_fit_poserr.reserve(NSC);
vector<TH2F*> peak_fit_pos_2d;
peak_fit_pos_2d.reserve(NSC);
vector<TH2F*> peak_fit_poserr_2d;
peak_fit_poserr_2d.reserve(NSC);
TH1F* noise_fit_pos[16];
TH1F* noise_fit_poserr[16];
TH2F* noise_fit_pos_2d[16];
TH2F* noise_fit_poserr_2d[16];
vector<TH1F*> noise_fit_pos;
noise_fit_pos.reserve(NSC);
vector<TH1F*> noise_fit_poserr;
noise_fit_poserr.reserve(NSC);
vector<TH2F*> noise_fit_pos_2d;
noise_fit_pos_2d.reserve(NSC);
vector<TH2F*> noise_fit_poserr_2d;
noise_fit_poserr_2d.reserve(NSC);
TH1F* gain_fit[16];
TH1F* gain_fiterr[16];
TH2F* gain_fit_2d[16];
TH2F* gain_fiterr_2d[16];
vector<TH1F*> gain_fit;
gain_fit.reserve(NSC);
vector<TH1F*> gain_fiterr;
gain_fiterr.reserve(NSC);
vector<TH2F*> gain_fit_2d;
gain_fit_2d.reserve(NSC);
vector<TH2F*> gain_fiterr_2d;
gain_fiterr_2d.reserve(NSC);
TH1F* gain_fit_isEdge[16];
TH1F* gain_fit_isInnerEdge[16];
TH1F* gain_fit_isDouble[16];
TH1F* gain_fit_isNextToDouble[16];
TH1F* gain_fit_isQuad[16];
TH1F* gain_fit_isBulk[16];
vector<TH1F*> gain_fit_isEdge;
gain_fit_isEdge.reserve(NSC);
vector<TH1F*> gain_fit_isInnerEdge;
gain_fit_isInnerEdge.reserve(NSC);
vector<TH1F*> gain_fit_isDouble;
gain_fit_isDouble.reserve(NSC);
vector<TH1F*> gain_fit_isNextToDouble;
gain_fit_isNextToDouble.reserve(NSC);
vector<TH1F*> gain_fit_isQuad;
gain_fit_isQuad.reserve(NSC);
vector<TH1F*> gain_fit_isBulk;
gain_fit_isBulk.reserve(NSC);
TH2F* gain_ADUper1keV_2d[16];
TH2F* gainerr_ADUper1keV_2d[16];
vector<TH2F*> gain_ADUper1keV_2d;
gain_ADUper1keV_2d.reserve(NSC);
vector<TH2F*> gainerr_ADUper1keV_2d;
gainerr_ADUper1keV_2d.reserve(NSC);
for ( int sci = 0; sci < 16; ++sci ) {
//initialize
for ( int sci = 0; sci < NSC; ++sci ) {
Char_t *fithistoname = new Char_t[50];
snprintf( fithistoname, 50, "fit_par3_sc%d", sci );
fit_par3[sci] = new TH1F( fithistoname, "", 100, 0, 50 );
fit_par3.push_back( new TH1F( fithistoname, "", 100, 0, 50 ) );
snprintf( fithistoname, 50, "fit_par4_sc%d", sci );
fit_par4[sci] = new TH1F( fithistoname, "", 100, 0, 500 );
fit_par4.push_back( new TH1F( fithistoname, "", 100, 0, 500 ) );
snprintf( fithistoname, 50, "fit_par5_sc%d", sci );
fit_par5[sci] = new TH1F( fithistoname, "", 100, 0, 0.5 );
fit_par5.push_back( new TH1F( fithistoname, "", 100, 0, 0.5 ) );
snprintf( fithistoname, 50, "fit_par6_sc%d", sci );
fit_par6[sci] = new TH1F( fithistoname, "", 100, 1.05, 1.25 );
fit_par6.push_back( new TH1F( fithistoname, "", 100, 1.05, 1.25 ) );
snprintf( fithistoname, 50, "fit_par7_sc%d", sci );
fit_par7[sci] = new TH1F( fithistoname, "", 100, 0, 0.4 );
fit_par7.push_back( new TH1F( fithistoname, "", 100, 0, 0.4 ) );
snprintf( fithistoname, 50, "fit_par3_2d_sc%d", sci );
fit_par3_2d[sci] = new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
fit_par3_2d.push_back( new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
snprintf( fithistoname, 50, "fit_par4_2d_sc%d", sci );
fit_par4_2d[sci] = new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
fit_par4_2d.push_back( new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
snprintf( fithistoname, 50, "fit_par5_2d_sc%d", sci );
fit_par5_2d[sci] = new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
fit_par5_2d.push_back( new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
snprintf( fithistoname, 50, "fit_par6_2d_sc%d", sci );
fit_par6_2d[sci] = new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
fit_par6_2d.push_back( new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
snprintf( fithistoname, 50, "fit_par7_2d_sc%d", sci );
fit_par7_2d[sci] = new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
fit_par7_2d.push_back( new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
snprintf( fithistoname, 50, "peak_fit_pos_sc%d", sci );
peak_fit_pos[sci] = new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak );
peak_fit_pos.push_back( new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak ) );
snprintf( fithistoname, 50, "peak_fit_poserr_sc%d", sci );
peak_fit_poserr[sci] = new TH1F( fithistoname, "", 100, 0, 2 );
peak_fit_poserr.push_back( new TH1F( fithistoname, "", 100, 0, 2 ) );
snprintf( fithistoname, 50, "peak_fit_pos_2d_sc%d", sci );
peak_fit_pos_2d[sci] = new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
peak_fit_pos_2d.push_back( new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
snprintf( fithistoname, 50, "peak_fit_poserr_2d_sc%d", sci );
peak_fit_poserr_2d[sci] = new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
peak_fit_poserr_2d.push_back( new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
snprintf( fithistoname, 50, "noise_fit_pos_sc%d", sci );
noise_fit_pos[sci] = new TH1F( fithistoname, "", 100, -10, 10 );
noise_fit_pos.push_back( new TH1F( fithistoname, "", 100, -10, 10 ) );
snprintf( fithistoname, 50, "noise_fit_poserr_sc%d", sci );
noise_fit_poserr[sci] = new TH1F( fithistoname, "", 100, 0, 0.1 );
noise_fit_poserr.push_back( new TH1F( fithistoname, "", 100, 0, 0.1 ) );
snprintf( fithistoname, 50, "noise_fit_pos_2d_sc%d", sci );
noise_fit_pos_2d[sci] = new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
noise_fit_pos_2d.push_back( new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
snprintf( fithistoname, 50, "noise_fit_poserr_2d_sc%d", sci );
noise_fit_poserr_2d[sci] = new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
noise_fit_poserr_2d.push_back( new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
snprintf( fithistoname, 50, "gain_fit_sc%d", sci );
gain_fit[sci] = new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak );
gain_fit.push_back( new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak ) );
snprintf( fithistoname, 50, "gain_fiterr_sc%d", sci );
gain_fiterr[sci] = new TH1F( fithistoname, "", 100, 0, 2 );
gain_fiterr.push_back( new TH1F( fithistoname, "", 100, 0, 2 ) );
snprintf( fithistoname, 50, "gain_fit_2d_sc%d", sci );
gain_fit_2d[sci] = new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
gain_fit_2d.push_back( new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
snprintf( fithistoname, 50, "gain_fiterr_2d_sc%d", sci );
gain_fiterr_2d[sci] = new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
gain_fiterr_2d.push_back( new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
snprintf( fithistoname, 50, "gain_fit_isEdge_sc%d", sci );
gain_fit_isEdge[sci] = new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak );
gain_fit_isEdge.push_back( new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak ) );
snprintf( fithistoname, 50, "gain_fit_isInnerEdge_sc%d", sci );
gain_fit_isInnerEdge[sci] = new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak );
gain_fit_isInnerEdge.push_back( new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak ) );
snprintf( fithistoname, 50, "gain_fit_isDouble_sc%d", sci );
gain_fit_isDouble[sci] = new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak );
gain_fit_isDouble.push_back( new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak ) );
snprintf( fithistoname, 50, "gain_fit_isNextToDouble_sc%d", sci );
gain_fit_isNextToDouble[sci] = new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak );
gain_fit_isNextToDouble.push_back( new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak ) );
snprintf( fithistoname, 50, "gain_fit_isQuad_sc%d", sci );
gain_fit_isQuad[sci] = new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak );
gain_fit_isQuad.push_back( new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak ) );
snprintf( fithistoname, 50, "gain_fit_isBulk_sc%d", sci );
gain_fit_isBulk[sci] = new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak );
gain_fit_isBulk.push_back( new TH1F( fithistoname, "", 100, low_ADU_peak, high_ADU_peak ) );
snprintf( fithistoname, 50, "gain_ADUper1keV_2d_sc%d", sci );
gain_ADUper1keV_2d[sci] = new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
gain_ADUper1keV_2d.push_back( new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
snprintf( fithistoname, 50, "gainerr_ADUper1keV_2d_sc%d", sci );
gainerr_ADUper1keV_2d[sci] = new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 );
gainerr_ADUper1keV_2d.push_back( new TH2F( fithistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
} //end histo creating for loop
@ -490,7 +534,7 @@ int main(int argc, char* argv[]) {
}
for ( int sci = 0; sci < 16; ++sci ) {
for ( int sci = 0; sci < NSC; ++sci ) {
for ( int j = 1; j < 9; ++j ) {
cout << "SC = " << sci << " slice " << j << endl;
@ -553,78 +597,78 @@ int main(int argc, char* argv[]) {
thiscalibration->setStartParametersKb(mypar);
thiscalibration->fixParameter(0,0.); // no background
thiscalibration->fixParameter(1,0.);
TF1* fittedfun = thiscalibration->fitSpectrumKb(proj_peak,mypar,emypar);
TF1* fittedfun = thiscalibration->fitSpectrumKb( proj_peak, mypar, emypar );
fit_par3[sci]->Fill(mypar[3]);
fit_par4[sci]->Fill(mypar[4]);
fit_par5[sci]->Fill(mypar[5]);
fit_par6[sci]->Fill(mypar[6]);
fit_par7[sci]->Fill(mypar[7]);
fit_par3[sci]->Fill( mypar[3] );
fit_par4[sci]->Fill( mypar[4] );
fit_par5[sci]->Fill( mypar[5] );
fit_par6[sci]->Fill( mypar[6] );
fit_par7[sci]->Fill( mypar[7] );
fit_par3_2d[sci]->Fill(i%NC,i/NC,mypar[3]);
fit_par4_2d[sci]->Fill(i%NC,i/NC,mypar[4]);
fit_par5_2d[sci]->Fill(i%NC,i/NC,mypar[5]);
fit_par6_2d[sci]->Fill(i%NC,i/NC,mypar[6]);
fit_par7_2d[sci]->Fill(i%NC,i/NC,mypar[7]);
fit_par3_2d[sci]->Fill( i%NC, i/NC, mypar[3] );
fit_par4_2d[sci]->Fill( i%NC, i/NC, mypar[4] );
fit_par5_2d[sci]->Fill( i%NC, i/NC, mypar[5] );
fit_par6_2d[sci]->Fill( i%NC, i/NC, mypar[6] );
fit_par7_2d[sci]->Fill( i%NC, i/NC, mypar[7] );
peak_fit_pos[sci]->Fill(mypar[2]);
peak_fit_poserr[sci]->Fill(emypar[2]);
peak_fit_pos_2d[sci]->Fill(i%NC,i/NC,mypar[2]);
peak_fit_poserr_2d[sci]->Fill(i%NC,i/NC,emypar[2]);
peak_fit_pos[sci]->Fill( mypar[2] );
peak_fit_poserr[sci]->Fill( emypar[2] );
peak_fit_pos_2d[sci]->Fill( i%NC, i/NC, mypar[2] );
peak_fit_poserr_2d[sci]->Fill( i%NC, i/NC, emypar[2] );
if ((i >= 58000 && i < 58000+10) || // bulk
(i >= 10 && i < 10+10) || // edge
(i >= 1024+10 && i < 1024+10+10) || // inner edge
(i >= (256*1024)+10 && i < (256*1024)+10+10) || // double
(i >= (257*1024)+10 && i < (257*1024)+10+10) || // next to double
(i == (255*1024)+255) // quad
if ( ( i >= 58000 && i < 58000+10 ) || // bulk
( i >= 10 && i < 10+10 ) || // edge
( i >= 1024+10 && i < 1024+10+10 ) || // inner edge
( i >= ( 256*1024 )+10 && i < ( 256*1024 )+10+10 ) || // double
( i >= ( 257*1024 )+10 && i < ( 257*1024 )+10+10 ) || // next to double
( i == ( 255*1024 )+255 ) // quad
) {
string pixel_type = "x";
if (i >= 58000 && i < 58000+10) {
if ( i >= 58000 && i < 58000+10 ) {
pixel_type = "b";
} else if (i >= 10 && i < 10+10) {
} else if ( i >= 10 && i < 10+10 ) {
pixel_type = "e";
} else if (i >= 1024+10 && i < 1024+10+10) {
} else if ( i >= 1024+10 && i < 1024+10+10 ) {
pixel_type = "ie";
} else if (i >= (256*1024)+10 && i < (256*1024)+10+10) {
} else if ( i >= ( 256*1024 )+10 && i < ( 256*1024 )+10+10 ) {
pixel_type = "d";
} else if (i >= (257*1024)+10 && i < (257*1024)+10+10) {
} else if ( i >= ( 257*1024 )+10 && i < ( 257*1024 )+10+10 ) {
pixel_type = "ntd";
} else if (i == (255*1024)+255) {
} else if ( i == ( 255*1024 )+255 ) {
pixel_type = "q";
}
proj_noise->Draw();
c1->Update();
proj_noise->GetXaxis()->SetTitle("Pedestal corrected ADC [ADU]");
proj_noise->GetXaxis()->SetRangeUser(-100,150);
fit->SetParNames("N_{#gamma}", "Peak pos", "Noise RMS");
TPaveStats *st0 = (TPaveStats*)proj_noise->FindObject("stats");
proj_noise->GetXaxis()->SetTitle( "Pedestal corrected ADC [ADU]" );
proj_noise->GetXaxis()->SetRangeUser( -100, 150 );
fit->SetParNames( "N_{#gamma}", "Peak pos", "Noise RMS" );
TPaveStats *st0 = (TPaveStats*)proj_noise->FindObject( "stats" );
st0->SetX1NDC(0.53);
st0->SetX2NDC(0.94);
st0->SetY1NDC(0.75);
st0->SetY2NDC(0.94);
st0->SetBorderSize(0);
st0->SetTextSize(0.04);
sprintf(savename,"plots/M%s/CuFluo/%s/noise_%s_sc%d_%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), pixel_type.c_str(), sci, i, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/noise_%s_sc%d_%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), pixel_type.c_str(), sci, i, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
TF1 *gaus_Ka = new TF1("gaus_Ka","gaus",proj->GetBinLowEdge(low_bin_peak),proj->GetBinLowEdge(high_bin_peak+1));
gaus_Ka->SetParameters(mypar[4],mypar[2],mypar[3]);
gaus_Ka->SetLineColor(kBlue);
TF1 *gaus_Ka = new TF1( "gaus_Ka", "gaus", proj->GetBinLowEdge(low_bin_peak), proj->GetBinLowEdge(high_bin_peak+1) );
gaus_Ka->SetParameters( mypar[4], mypar[2], mypar[3] );
gaus_Ka->SetLineColor( kBlue );
TF1 *erfc_Ka = new TF1("erfc_Ka","[0]/2.*(TMath::Erfc(([1]*(x-[2])/[3])/(TMath::Sqrt(2.))))",proj->GetBinLowEdge(low_bin_peak),proj->GetBinLowEdge(high_bin_peak+1));
erfc_Ka->SetParameters(mypar[4]*mypar[5], 1, mypar[2], mypar[3]);
erfc_Ka->SetLineColor(kOrange);
TF1 *erfc_Ka = new TF1( "erfc_Ka", "[0]/2.*(TMath::Erfc(([1]*(x-[2])/[3])/(TMath::Sqrt(2.))))", proj->GetBinLowEdge(low_bin_peak), proj->GetBinLowEdge(high_bin_peak+1) );
erfc_Ka->SetParameters( mypar[4]*mypar[5], 1, mypar[2], mypar[3] );
erfc_Ka->SetLineColor( kOrange );
TF1 *gaus_Kb = new TF1("gaus_Kb","gaus",proj->GetBinLowEdge(low_bin_peak),proj->GetBinLowEdge(high_bin_peak+1));
gaus_Kb->SetParameters(mypar[4]*mypar[7],mypar[6]*mypar[2],mypar[3]);
gaus_Kb->SetLineColor(kGreen+2);
TF1 *gaus_Kb = new TF1( "gaus_Kb", "gaus", proj->GetBinLowEdge(low_bin_peak), proj->GetBinLowEdge(high_bin_peak+1) );
gaus_Kb->SetParameters( mypar[4]*mypar[7], mypar[6]*mypar[2], mypar[3] );
gaus_Kb->SetLineColor( kGreen+2 );
TF1 *erfc_Kb = new TF1("erfc_Kb","[0]/2.*(TMath::Erfc(([1]*(x-[2])/[3])/(TMath::Sqrt(2.))))",proj->GetBinLowEdge(low_bin_peak),proj->GetBinLowEdge(high_bin_peak+1));
erfc_Kb->SetParameters(mypar[4]*mypar[7]*mypar[5], 1, mypar[6]*mypar[2], mypar[3]);
erfc_Kb->SetLineColor(kOrange+7);
TF1 *erfc_Kb = new TF1( "erfc_Kb", "[0]/2.*(TMath::Erfc(([1]*(x-[2])/[3])/(TMath::Sqrt(2.))))", proj->GetBinLowEdge(low_bin_peak), proj->GetBinLowEdge(high_bin_peak+1) );
erfc_Kb->SetParameters( mypar[4]*mypar[7]*mypar[5], 1, mypar[6]*mypar[2], mypar[3] );
erfc_Kb->SetLineColor( kOrange+7 );
proj_peak->Draw();
erfc_Kb->Draw("same");
@ -633,44 +677,44 @@ int main(int argc, char* argv[]) {
gaus_Ka->Draw("same");
fittedfun->Draw("same");
c1->Update();
proj_peak->GetXaxis()->SetTitle("Pedestal corrected ADC [ADU]");
fittedfun->SetParNames("Bkg height", "Bkg grad", "K_{#alpha} pos", "Noise RMS", "K_{#alpha} height", "CS", "K_{#beta}/K_{#alpha} pos", "K_{#beta} frac");
TPaveStats *st = (TPaveStats*)proj_peak->FindObject("stats");
proj_peak->GetXaxis()->SetTitle( "Pedestal corrected ADC [ADU]" );
fittedfun->SetParNames( "Bkg height", "Bkg grad", "K_{#alpha} pos", "Noise RMS", "K_{#alpha} height", "CS", "K_{#beta}/K_{#alpha} pos", "K_{#beta} frac" );
TPaveStats *st = (TPaveStats*)proj_peak->FindObject( "stats" );
st->SetX1NDC(0.22);
st->SetX2NDC(0.62);
st->SetY1NDC(0.7);
st->SetY2NDC(0.94);
st->SetBorderSize(0);
st->SetTextSize(0.04);
sprintf(savename,"plots/M%s/CuFluo/%s/peak_%s_sc%d_%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), pixel_type.c_str(), sci, i, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/peak_%s_sc%d_%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), pixel_type.c_str(), sci, i, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
}
// gain
gain_fit[sci]->Fill(mypar[2] - fit->GetParameter(1));
gain_fiterr[sci]->Fill(sqrt(pow(emypar[2],2) + pow(fit->GetParError(1),2)));
gain_fit_2d[sci]->Fill(i%NC,i/NC,mypar[2] - fit->GetParameter(1));
gain_fiterr_2d[sci]->Fill(i%NC,i/NC,sqrt(pow(emypar[2],2) + pow(fit->GetParError(1),2)));
gain_ADUper1keV_2d[sci]->Fill(i%NC,i/NC,(mypar[2] - fit->GetParameter(1)) / 8.0);
gainerr_ADUper1keV_2d[sci]->Fill(i%NC,i/NC,sqrt(pow(emypar[2],2) + pow(fit->GetParError(1),2)) / 8.0);
gain_fit[sci]->Fill( mypar[2] - fit->GetParameter(1) );
gain_fiterr[sci]->Fill( sqrt( pow(emypar[2],2) + pow(fit->GetParError(1),2) ) );
gain_fit_2d[sci]->Fill( i%NC, i/NC, mypar[2] - fit->GetParameter(1) );
gain_fiterr_2d[sci]->Fill( i%NC, i/NC, sqrt( pow(emypar[2],2) + pow(fit->GetParError(1),2) ) );
gain_ADUper1keV_2d[sci]->Fill( i%NC, i/NC, ( mypar[2] - fit->GetParameter(1) ) / 8.0 );
gainerr_ADUper1keV_2d[sci]->Fill( i%NC, i/NC, sqrt( pow( emypar[2],2 ) + pow( fit->GetParError(1),2) ) / 8.0 );
if (isEdge(i)) {
gain_fit_isEdge[sci]->Fill(mypar[2] - fit->GetParameter(1));
gain_fit_isEdge[sci]->Fill( mypar[2] - fit->GetParameter(1) );
}
if (isInnerEdge(i)) {
gain_fit_isInnerEdge[sci]->Fill(mypar[2] - fit->GetParameter(1));
gain_fit_isInnerEdge[sci]->Fill( mypar[2] - fit->GetParameter(1) );
}
if (isDouble(i)) {
gain_fit_isDouble[sci]->Fill(mypar[2] - fit->GetParameter(1));
gain_fit_isDouble[sci]->Fill( mypar[2] - fit->GetParameter(1) );
}
if (isNextToDouble(i)) {
gain_fit_isNextToDouble[sci]->Fill(mypar[2] - fit->GetParameter(1));
gain_fit_isNextToDouble[sci]->Fill( mypar[2] - fit->GetParameter(1) );
}
if (isQuad(i)) {
gain_fit_isQuad[sci]->Fill(mypar[2] - fit->GetParameter(1));
gain_fit_isQuad[sci]->Fill( mypar[2] - fit->GetParameter(1) );
}
if (isBulk(i)) {
gain_fit_isBulk[sci]->Fill(mypar[2] - fit->GetParameter(1));
gain_fit_isBulk[sci]->Fill( mypar[2] - fit->GetParameter(1) );
}
delete thiscalibration;
@ -686,10 +730,10 @@ int main(int argc, char* argv[]) {
} // end for loop sensor slices (j)
sprintf(savename,"plots/M%s/CuFluo/%s/pixelmask_afterfit_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
pixelMaskObject->plotPixelMask(pixel_mask,savename);
sprintf( savename, "plots/M%s/CuFluo/%s/pixelmask_afterfit_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
pixelMaskObject->plotPixelMask( pixel_mask, savename );
TPaveText *pave = new TPaveText(0.86,0.95,0.91,0.98,"blNDC");
TPaveText *pave = new TPaveText( 0.86, 0.95, 0.91, 0.98, "blNDC" );
pave->SetBorderSize(0);
pave->SetFillStyle(0);
pave->SetTextSize(0.06);
@ -702,64 +746,64 @@ int main(int argc, char* argv[]) {
fit_par3_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
fit_par3_2d[sci]->Draw("colz");
fit_par3_2d[sci]->GetZaxis()->SetRangeUser(0,50);
sprintf(savename,"plots/M%s/CuFluo/%s/fit_par3_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/fit_par3_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
mapcanvas->SaveAs( (const char *)(savename) );
fit_par4_2d[sci]->GetXaxis()->SetTitle("Column");
fit_par4_2d[sci]->GetYaxis()->SetTitle("Row");
fit_par4_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
fit_par4_2d[sci]->Draw("colz");
fit_par4_2d[sci]->GetZaxis()->SetRangeUser(0,500);
sprintf(savename,"plots/M%s/CuFluo/%s/fit_par4_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/fit_par4_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
mapcanvas->SaveAs( (const char *)(savename) );
fit_par5_2d[sci]->GetXaxis()->SetTitle("Column");
fit_par5_2d[sci]->GetYaxis()->SetTitle("Row");
fit_par5_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
fit_par5_2d[sci]->Draw("colz");
fit_par5_2d[sci]->GetZaxis()->SetRangeUser(0,0.5);
sprintf(savename,"plots/M%s/CuFluo/%s/fit_par5_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/fit_par5_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
mapcanvas->SaveAs( (const char *)(savename) );
fit_par6_2d[sci]->GetXaxis()->SetTitle("Column");
fit_par6_2d[sci]->GetYaxis()->SetTitle("Row");
fit_par6_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
fit_par6_2d[sci]->Draw("colz");
fit_par6_2d[sci]->GetZaxis()->SetRangeUser(1.0,1.25);
sprintf(savename,"plots/M%s/CuFluo/%s/fit_par6_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/fit_par6_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
mapcanvas->SaveAs( (const char *)(savename) );
fit_par7_2d[sci]->GetXaxis()->SetTitle("Column");
fit_par7_2d[sci]->GetYaxis()->SetTitle("Row");
fit_par7_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
fit_par7_2d[sci]->Draw("colz");
fit_par7_2d[sci]->GetZaxis()->SetRangeUser(0.,0.4);
sprintf(savename,"plots/M%s/CuFluo/%s/fit_par7_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/fit_par7_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
mapcanvas->SaveAs( (const char *)(savename) );
peak_fit_pos_2d[sci]->GetXaxis()->SetTitle("Column");
peak_fit_pos_2d[sci]->GetYaxis()->SetTitle("Row");
peak_fit_pos_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
peak_fit_pos_2d[sci]->Draw("colz");
peak_fit_pos_2d[sci]->GetZaxis()->SetRangeUser( low_ADU_peak, high_ADU_peak );
sprintf(savename,"plots/M%s/CuFluo/%s/peak_fit_pos_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/peak_fit_pos_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
mapcanvas->SaveAs( (const char *)(savename) );
peak_fit_poserr_2d[sci]->GetXaxis()->SetTitle("Column");
peak_fit_poserr_2d[sci]->GetYaxis()->SetTitle("Row");
peak_fit_poserr_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
peak_fit_poserr_2d[sci]->Draw("colz");
peak_fit_poserr_2d[sci]->GetZaxis()->SetRangeUser(0,2);
sprintf(savename,"plots/M%s/CuFluo/%s/peak_fit_poserr_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/peak_fit_poserr_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
mapcanvas->SaveAs( (const char *)(savename) );
noise_fit_pos_2d[sci]->GetXaxis()->SetTitle("Column");
noise_fit_pos_2d[sci]->GetYaxis()->SetTitle("Row");
noise_fit_pos_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
noise_fit_pos_2d[sci]->Draw("colz");
noise_fit_pos_2d[sci]->GetZaxis()->SetRangeUser(-5,5);
sprintf(savename,"plots/M%s/CuFluo/%s/noise_fit_pos_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/noise_fit_pos_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
mapcanvas->SaveAs( (const char *)(savename) );
noise_fit_poserr_2d[sci]->GetXaxis()->SetTitle("Column");
noise_fit_poserr_2d[sci]->GetYaxis()->SetTitle("Row");
@ -770,27 +814,27 @@ int main(int argc, char* argv[]) {
} else if (gain_str == "G0") {
noise_fit_poserr_2d[sci]->GetZaxis()->SetRangeUser(0,0.05);
}
sprintf(savename,"plots/M%s/CuFluo/%s/noise_fit_poserr_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/noise_fit_poserr_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
mapcanvas->SaveAs( (const char *)(savename) );
gain_fit_2d[sci]->GetXaxis()->SetTitle("Column");
gain_fit_2d[sci]->GetYaxis()->SetTitle("Row");
gain_fit_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
gain_fit_2d[sci]->Draw("colz");
sprintf(savename,"%s [ADU/8 keV]", gain_str.c_str());
pave->AddText((const char *)(savename));
sprintf( savename, "%s [ADU/8 keV]", gain_str.c_str() );
pave->AddText( (const char *)(savename) );
pave->Draw();
gain_fit_2d[sci]->GetZaxis()->SetRangeUser( low_ADU_peak, high_ADU_peak );
sprintf(savename,"plots/M%s/CuFluo/%s/gain_fit_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/gain_fit_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
mapcanvas->SaveAs( (const char *)(savename) );
gain_fiterr_2d[sci]->GetXaxis()->SetTitle("Column");
gain_fiterr_2d[sci]->GetYaxis()->SetTitle("Row");
gain_fiterr_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
gain_fiterr_2d[sci]->Draw("colz");
gain_fiterr_2d[sci]->GetZaxis()->SetRangeUser(0,2);
sprintf(savename,"plots/M%s/CuFluo/%s/gain_fiterr_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/gain_fiterr_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
mapcanvas->SaveAs( (const char *)(savename) );
gain_ADUper1keV_2d[sci]->GetXaxis()->SetTitle("Column");
gain_ADUper1keV_2d[sci]->GetYaxis()->SetTitle("Row");
@ -801,8 +845,8 @@ int main(int argc, char* argv[]) {
} else if (gain_str == "G0") {
gain_ADUper1keV_2d[sci]->GetZaxis()->SetRangeUser(35,50);
}
sprintf(savename,"plots/M%s/CuFluo/%s/gain_ADUper1keV_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/gain_ADUper1keV_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
mapcanvas->SaveAs( (const char *)(savename) );
gainerr_ADUper1keV_2d[sci]->GetXaxis()->SetTitle("Column");
gainerr_ADUper1keV_2d[sci]->GetYaxis()->SetTitle("Row");
@ -813,85 +857,85 @@ int main(int argc, char* argv[]) {
} else if (gain_str == "G0") {
gainerr_ADUper1keV_2d[sci]->GetZaxis()->SetRangeUser(0,0.25);
}
sprintf(savename,"plots/M%s/CuFluo/%s/gainerr_ADUper1keV_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
mapcanvas->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/gainerr_ADUper1keV_2d_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
mapcanvas->SaveAs( (const char *)(savename) );
c1->cd();
fit_par3[sci]->GetXaxis()->SetTitle("Fit par 3");
fit_par3[sci]->Draw();
sprintf(savename,"plots/M%s/CuFluo/%s/fit_par3_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/fit_par3_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
fit_par4[sci]->GetXaxis()->SetTitle("Fit par 4");
fit_par4[sci]->Draw();
sprintf(savename,"plots/M%s/CuFluo/%s/fit_par4_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/fit_par4_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
fit_par5[sci]->GetXaxis()->SetTitle("Fit par 5");
fit_par5[sci]->Draw();
sprintf(savename,"plots/M%s/CuFluo/%s/fit_par5_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/fit_par5_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
fit_par6[sci]->GetXaxis()->SetTitle("Fit par 6");
fit_par6[sci]->Draw();
sprintf(savename,"plots/M%s/CuFluo/%s/fit_par6_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/fit_par6_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
fit_par7[sci]->GetXaxis()->SetTitle("Fit par 7");
fit_par7[sci]->Draw();
sprintf(savename,"plots/M%s/CuFluo/%s/fit_par7_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/fit_par7_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
peak_fit_pos[sci]->GetXaxis()->SetTitle("Peak position [ADU]");
peak_fit_pos[sci]->Draw();
sprintf(savename,"plots/M%s/CuFluo/%s/peak_fit_pos_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/peak_fit_pos_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
peak_fit_poserr[sci]->GetXaxis()->SetTitle("Peak position uncert [ADU]");
peak_fit_poserr[sci]->Draw();
sprintf(savename,"plots/M%s/CuFluo/%s/peak_fit_poserr_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/peak_fit_poserr_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
noise_fit_pos[sci]->GetXaxis()->SetTitle("Noise position [ADU]");
noise_fit_pos[sci]->Draw();
sprintf(savename,"plots/M%s/CuFluo/%s/noise_fit_pos_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/noise_fit_pos_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
noise_fit_poserr[sci]->GetXaxis()->SetTitle("Noise position uncert [ADU]");
noise_fit_poserr[sci]->Draw();
sprintf(savename,"plots/M%s/CuFluo/%s/noise_fit_poserr_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/noise_fit_poserr_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
sprintf(savename,"Gain %s [ADU / 8 keV]", gain_str.c_str());
gain_fit[sci]->GetXaxis()->SetTitle((const char *)(savename));
sprintf( savename, "Gain %s [ADU / 8 keV]", gain_str.c_str() );
gain_fit[sci]->GetXaxis()->SetTitle( (const char *)(savename) );
gain_fit[sci]->Draw();
sprintf(savename,"plots/M%s/CuFluo/%s/gain_fit_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/gain_fit_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
gain_fit[sci]->GetXaxis()->SetRangeUser(low_ADU_peak+30, high_ADU_peak);
gain_fit[sci]->GetXaxis()->SetRangeUser( low_ADU_peak+30, high_ADU_peak );
gain_fit[sci]->Fit("gaus");
gain_fit[sci]->Draw();
c1->Update();
TPaveText *pave2 = new TPaveText(0.6,0.8,0.94,0.94,"blNDC");
TPaveText *pave2 = new TPaveText( 0.6, 0.8, 0.94, 0.94, "blNDC" );
pave2->SetBorderSize(0);
pave2->SetFillStyle(0);
pave2->SetTextSize(0.04);
pave2->SetTextAlign(32);
TF1* gain_fit_gaus = gain_fit[sci]->GetFunction("gaus");
sprintf(savename,"Mean %0.2f #pm %0.2f", gain_fit_gaus->GetParameter(1), gain_fit_gaus->GetParError(1));
pave2->AddText((const char *)(savename));
sprintf(savename,"Sigma %0.2f #pm %0.2f", gain_fit_gaus->GetParameter(2), gain_fit_gaus->GetParError(2));
pave2->AddText((const char *)(savename));
sprintf( savename, "Mean %0.2f #pm %0.2f", gain_fit_gaus->GetParameter(1), gain_fit_gaus->GetParError(1) );
pave2->AddText( (const char *)(savename) );
sprintf( savename, "Sigma %0.2f #pm %0.2f", gain_fit_gaus->GetParameter(2), gain_fit_gaus->GetParError(2) );
pave2->AddText( (const char *)(savename) );
pave2->Draw();
gain_fit[sci]->SetStats(kFALSE);
sprintf(savename,"plots/M%s/CuFluo/%s/gain_fit_fit_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/gain_fit_fit_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
gain_fiterr[sci]->GetXaxis()->SetTitle("Gain uncert [ADU / 8 keV]");
gain_fiterr[sci]->Draw();
sprintf(savename,"plots/M%s/CuFluo/%s/gain_fiterr_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/gain_fiterr_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
gain_fit_isEdge[sci]->SetLineColor(kBlue);
gain_fit_isInnerEdge[sci]->SetLineColor(kCyan);
@ -899,22 +943,22 @@ int main(int argc, char* argv[]) {
gain_fit_isNextToDouble[sci]->SetLineColor(kRed);
gain_fit_isQuad[sci]->SetLineColor(kOrange);
gain_fit_isEdge[sci]->Scale(1./gain_fit_isEdge[sci]->GetEntries());
gain_fit_isInnerEdge[sci]->Scale(1./gain_fit_isInnerEdge[sci]->GetEntries());
gain_fit_isDouble[sci]->Scale(1./gain_fit_isDouble[sci]->GetEntries());
gain_fit_isNextToDouble[sci]->Scale(1./gain_fit_isNextToDouble[sci]->GetEntries());
gain_fit_isQuad[sci]->Scale(1./gain_fit_isQuad[sci]->GetEntries());
gain_fit_isBulk[sci]->Scale(1./gain_fit_isBulk[sci]->GetEntries());
gain_fit_isEdge[sci]->Scale( 1./gain_fit_isEdge[sci]->GetEntries() );
gain_fit_isInnerEdge[sci]->Scale( 1./gain_fit_isInnerEdge[sci]->GetEntries() );
gain_fit_isDouble[sci]->Scale( 1./gain_fit_isDouble[sci]->GetEntries() );
gain_fit_isNextToDouble[sci]->Scale( 1./gain_fit_isNextToDouble[sci]->GetEntries() );
gain_fit_isQuad[sci]->Scale( 1./gain_fit_isQuad[sci]->GetEntries() );
gain_fit_isBulk[sci]->Scale( 1./gain_fit_isBulk[sci]->GetEntries() );
TLegend *leg = new TLegend(0.62,0.6,0.93,0.93);
leg->AddEntry(gain_fit_isBulk[sci], "Normal", "l");
leg->AddEntry(gain_fit_isDouble[sci], "Double", "l");
leg->AddEntry(gain_fit_isNextToDouble[sci], "Next to D", "l");
leg->AddEntry(gain_fit_isEdge[sci], "Edge", "l");
leg->AddEntry(gain_fit_isInnerEdge[sci], "Inner E", "l");
TLegend *leg = new TLegend( 0.62, 0.6, 0.93, 0.93 );
leg->AddEntry( gain_fit_isBulk[sci], "Normal", "l" );
leg->AddEntry( gain_fit_isDouble[sci], "Double", "l" );
leg->AddEntry( gain_fit_isNextToDouble[sci], "Next to D", "l" );
leg->AddEntry( gain_fit_isEdge[sci], "Edge", "l" );
leg->AddEntry( gain_fit_isInnerEdge[sci], "Inner E", "l" );
sprintf(savename,"Gain %s [ADU / 8 keV]", gain_str.c_str());
gain_fit_isDouble[sci]->GetXaxis()->SetTitle((const char *)(savename));
sprintf( savename, "Gain %s [ADU / 8 keV]", gain_str.c_str() );
gain_fit_isDouble[sci]->GetXaxis()->SetTitle( (const char *)(savename) );
gain_fit_isDouble[sci]->GetYaxis()->SetTitle("Normalised");
gain_fit_isDouble[sci]->GetYaxis()->SetTitleOffset(1.3);
gain_fit_isDouble[sci]->SetMinimum(0.0);
@ -925,11 +969,11 @@ int main(int argc, char* argv[]) {
gain_fit_isNextToDouble[sci]->Draw("same");
gain_fit_isBulk[sci]->Draw("same");
leg->Draw("same");
sprintf(savename,"plots/M%s/CuFluo/%s/gain_fit_perType_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
c1->SaveAs((const char *)(savename));
sprintf( savename, "plots/M%s/CuFluo/%s/gain_fit_perType_sc%d_%s_M%s.png", module_str.c_str(), gain_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
c1->SaveAs( (const char *)(savename) );
sprintf(savename,"data/M%s/CuFluo_gain_sc%d_%s_M%s.root", module_str.c_str(), sci, gain_str.c_str(), module_str.c_str());
TFile* saved_file = new TFile((const char *)(savename),"RECREATE");
sprintf( savename, "data/M%s/CuFluo_gain_sc%d_%s_M%s.root", module_str.c_str(), sci, gain_str.c_str(), module_str.c_str() );
TFile* saved_file = new TFile( (const char *)(savename), "RECREATE" );
gain_ADUper1keV_2d[sci]->Write();
gainerr_ADUper1keV_2d[sci]->Write();
saved_file->Close();