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
@ -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;