SC analysis working (needs 40G RAM)
This commit is contained in:
@ -21,6 +21,7 @@
|
||||
#include "TPaveStats.h"
|
||||
#include "TLegend.h"
|
||||
#include "TPaveText.h"
|
||||
#include "TObjArray.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <vector>
|
||||
@ -74,8 +75,8 @@ int main(int argc, char* argv[]) {
|
||||
//char savename[128];
|
||||
char histoname[256]; // VH 210902
|
||||
char savename[256]; // VH 210902
|
||||
int filen = 16;
|
||||
int pedefilen = 1;
|
||||
int filen = 352;
|
||||
int pedefilen = 5;
|
||||
|
||||
// create necessary directories with permissions drwxrwxr-x
|
||||
// data/Mxxx
|
||||
@ -110,10 +111,10 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
TCanvas* c1 = new TCanvas("c1","");
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* NOTE: Since arrays, as they were used before, tend to cause memory leaks if they grow too large on the heap, */
|
||||
/* it might be smarter to realize all array objects with std::vector instead. */
|
||||
/****************************************************************************************************************/
|
||||
/*****************************************************************************************************************/
|
||||
/* NOTE: Since arrays, as they were used before, tend to cause memory leaks if they grow too large on the stack, */
|
||||
/* it might be smarter to realize all array objects with std::vector instead. */
|
||||
/*****************************************************************************************************************/
|
||||
|
||||
if (createHistoFile) {
|
||||
|
||||
@ -121,138 +122,150 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
vector<jungfrauPedestal*> pedestalObject_SC; //( NSC, new jungfrauPedestal() ); //should call default constructor 16 times
|
||||
pedestalObject_SC.reserve(NSC);
|
||||
vector<TH2F*> pedestalsG0;
|
||||
pedestalsG0.reserve(NSC);
|
||||
vector<TH2F*> pedeRMSG0;
|
||||
pedeRMSG0.reserve(NSC);
|
||||
for (int sci = 0; sci < NSC; ++sci) {
|
||||
pedestalObject_SC.push_back( new jungfrauPedestal() );
|
||||
pedestalObject_SC.at(sci)->pedestalSetNFrames(100);
|
||||
|
||||
Char_t *pedehistoname = new Char_t[50];
|
||||
snprintf( pedehistoname, 50, "pedestalsG0_sc%d", sci );
|
||||
pedestalsG0.push_back( new TH2F( pedehistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
|
||||
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 ) );
|
||||
}
|
||||
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
|
||||
vector< vector<double> > pedeRMS16_G0( NSC, vector<double>(NCH) );
|
||||
|
||||
for (int pedefilei = 0; pedefilei < pedefilen; ++pedefilei) {
|
||||
|
||||
// open pede file
|
||||
sprintf( savename, "%s/%s_%%6.6d.dat", data_loc.c_str(), pede_file.c_str() ); //VH: note, this adds a double slash in the filepath
|
||||
thisfile->open( (char*)savename, pedefilei );
|
||||
|
||||
//count events in file
|
||||
int nevents = 0;
|
||||
while ( thisfile->readNextFrame() ) {
|
||||
nevents++;
|
||||
}
|
||||
thisfile->rewind();
|
||||
cout << "read " << nevents << " events" << endl;
|
||||
{ //scope to limit the following 2 vectors
|
||||
vector<TH2F*> pedestalsG0;
|
||||
pedestalsG0.reserve(NSC);
|
||||
vector<TH2F*> pedeRMSG0;
|
||||
pedeRMSG0.reserve(NSC);
|
||||
for (int sci = 0; sci < NSC; ++sci) {
|
||||
pedestalObject_SC.push_back( new jungfrauPedestal() );
|
||||
pedestalObject_SC.at(sci)->pedestalSetNFrames(100);
|
||||
|
||||
while ( thisfile->readNextFrame() ) {
|
||||
// calculate pixel mask
|
||||
pixelMaskObject->maskIfGainNot( 0, thisfile->getFrameDataHandle(), pixel_mask );
|
||||
// caluclate pedestals
|
||||
pedestalObject_SC.at( thisfile->currentSCnumber() )->addFrameToPedestalCalculation( thisfile->getFrameDataHandle() );
|
||||
Char_t *pedehistoname = new Char_t[50];
|
||||
snprintf( pedehistoname, 50, "pedestalsG0_sc%d", sci );
|
||||
pedestalsG0.push_back( new TH2F( pedehistoname, "", NC, -0.5, NC-0.5, NR, -0.5, NR-0.5 ) );
|
||||
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 ) );
|
||||
}
|
||||
|
||||
thisfile->close();
|
||||
|
||||
} // end of loops over files
|
||||
|
||||
for (int sci = 0; sci < NSC; ++sci) {
|
||||
for (int i = 0; i < NCH; ++i) {
|
||||
if (pixel_mask[i] == true) {
|
||||
pedestalsG0.at(sci)->Fill( i%NC, i/NC, pedestalObject_SC[sci]->pedestalOfChannel(i) );
|
||||
pedeRMSG0.at(sci)->Fill( i%NC, i/NC, pedestalObject_SC[sci]->rmsOfChannel(i) );
|
||||
for (int pedefilei = 0; pedefilei < pedefilen; ++pedefilei) {
|
||||
|
||||
// open pede file
|
||||
sprintf( savename, "%s/%s_%%6.6d.dat", data_loc.c_str(), pede_file.c_str() ); //VH: note, this adds a double slash in the filepath
|
||||
thisfile->open( (char*)savename, pedefilei );
|
||||
|
||||
//count events in file
|
||||
int nevents = 0;
|
||||
while ( thisfile->readNextFrame() ) {
|
||||
nevents++;
|
||||
}
|
||||
thisfile->rewind();
|
||||
cout << "read " << nevents << " events" << endl;
|
||||
|
||||
while ( thisfile->readNextFrame() ) {
|
||||
// calculate pixel mask
|
||||
pixelMaskObject->maskIfGainNot( 0, thisfile->getFrameDataHandle(), pixel_mask );
|
||||
// caluclate pedestals
|
||||
pedestalObject_SC.at( thisfile->currentSCnumber() )->addFrameToPedestalCalculation( thisfile->getFrameDataHandle() );
|
||||
}
|
||||
|
||||
thisfile->close();
|
||||
|
||||
} // end of loops over files
|
||||
|
||||
for (int sci = 0; sci < NSC; ++sci) {
|
||||
for (int i = 0; i < NCH; ++i) {
|
||||
if (pixel_mask[i] == true) {
|
||||
pedestalsG0.at(sci)->Fill( i%NC, i/NC, pedestalObject_SC[sci]->pedestalOfChannel(i) );
|
||||
pedeRMSG0.at(sci)->Fill( i%NC, i/NC, pedestalObject_SC[sci]->rmsOfChannel(i) );
|
||||
}
|
||||
}
|
||||
pedestalObject_SC.at(sci)->pedestalData((uint16_t*)(pedestals16_G0_start.at(sci).data())); //this loads the pedestal data into the array pedestals16_G0_start
|
||||
pedestalObject_SC.at(sci)->pedestalRMSData(pedeRMS16_G0[sci].data()); //same here
|
||||
pedestalObject_SC.at(sci)->pedestalResetUpdates();
|
||||
//pedestalObject[sci]->pedestalClear(); //I don't need to clear if I only calculate pedestal once.
|
||||
}
|
||||
pedestalObject_SC.at(sci)->pedestalData((uint16_t*)(pedestals16_G0_start.at(sci).data())); //this loads the pedestal data into the array pedestals16_G0_start
|
||||
pedestalObject_SC.at(sci)->pedestalRMSData(pedeRMS16_G0[sci].data()); //same here
|
||||
pedestalObject_SC.at(sci)->pedestalResetUpdates();
|
||||
//pedestalObject[sci]->pedestalClear(); //I don't need to clear if I only calculate pedestal once.
|
||||
}
|
||||
|
||||
sprintf( savename, "plots/M%s/CuFluo/%s/pixelmask_%s_M%s.png", module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str() );
|
||||
pixelMaskObject->plotPixelMask( pixel_mask, savename );
|
||||
cout << "after chip mask, n masked pixels is " << pixelMaskObject->getNMasked(pixel_mask) << endl;
|
||||
|
||||
mapcanvas->cd();
|
||||
|
||||
for (int sci = 0; sci < 16; ++sci) {
|
||||
sprintf( savename, "plots/M%s/CuFluo/%s/pixelmask_%s_M%s.png", module_str.c_str(), gain_str.c_str(), gain_str.c_str(), module_str.c_str() );
|
||||
pixelMaskObject->plotPixelMask( pixel_mask, savename );
|
||||
cout << "after chip mask, n masked pixels is " << pixelMaskObject->getNMasked(pixel_mask) << endl;
|
||||
|
||||
pedestalsG0[sci]->GetXaxis()->SetTitle("Column");
|
||||
pedestalsG0[sci]->GetYaxis()->SetTitle("Row");
|
||||
pedestalsG0[sci]->GetYaxis()->SetTitleOffset(0.7);
|
||||
pedestalsG0[sci]->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CuFluo/%s/pedeG0_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));
|
||||
mapcanvas->cd();
|
||||
|
||||
pedeRMSG0[sci]->GetXaxis()->SetTitle("Column");
|
||||
pedeRMSG0[sci]->GetYaxis()->SetTitle("Row");
|
||||
pedeRMSG0[sci]->GetYaxis()->SetTitleOffset(0.7);
|
||||
pedeRMSG0[sci]->GetZaxis()->SetRangeUser(0,30);
|
||||
pedeRMSG0[sci]->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CuFluo/%s/pedeRMSG0_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));
|
||||
for (int sci = 0; sci < 16; ++sci) {
|
||||
|
||||
pedestalsG0[sci]->GetXaxis()->SetTitle("Column");
|
||||
pedestalsG0[sci]->GetYaxis()->SetTitle("Row");
|
||||
pedestalsG0[sci]->GetYaxis()->SetTitleOffset(0.7);
|
||||
pedestalsG0[sci]->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CuFluo/%s/pedeG0_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));
|
||||
|
||||
}
|
||||
pedestalsG0[sci]->Delete(); //not needed hereafter (try to save memory)
|
||||
|
||||
pedeRMSG0[sci]->GetXaxis()->SetTitle("Column");
|
||||
pedeRMSG0[sci]->GetYaxis()->SetTitle("Row");
|
||||
pedeRMSG0[sci]->GetYaxis()->SetTitleOffset(0.7);
|
||||
pedeRMSG0[sci]->GetZaxis()->SetRangeUser(0,30);
|
||||
pedeRMSG0[sci]->Draw("colz");
|
||||
sprintf(savename,"plots/M%s/CuFluo/%s/pedeRMSG0_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));
|
||||
|
||||
pedeRMSG0[sci]->Delete(); //not needed hereafter (try to save memory)
|
||||
|
||||
}
|
||||
|
||||
//Make sure histograms are deleted
|
||||
|
||||
} // end of scope to limit pedestalsG0 and pedeRMSG0
|
||||
|
||||
int adc2d_nbin= 1200;
|
||||
if (isJF11) adc2d_nbin= 1600;
|
||||
|
||||
vector <TH2I*> adc2d_1; //(8, vector <TH2I*>(16) ); //declare
|
||||
vector <TH2I*> adc2d_2;
|
||||
vector <TH2I*> adc2d_3;
|
||||
vector <TH2I*> adc2d_4;
|
||||
vector <TH2I*> adc2d_5;
|
||||
vector <TH2I*> adc2d_6;
|
||||
vector <TH2I*> adc2d_7;
|
||||
vector <TH2I*> adc2d_8;
|
||||
|
||||
vector<TH2I*> adc2d_1; //(8, vector <TH2I*>(16) ); //declare
|
||||
vector<TH2I*> adc2d_2;
|
||||
vector<TH2I*> adc2d_3;
|
||||
vector<TH2I*> adc2d_4;
|
||||
vector<TH2I*> adc2d_5;
|
||||
vector<TH2I*> adc2d_6;
|
||||
vector<TH2I*> adc2d_7;
|
||||
vector<TH2I*> adc2d_8;
|
||||
//TObjArray *adc2d_8 = new TObjArray(NSC);
|
||||
//adc2d.reserve(8);
|
||||
/*
|
||||
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));
|
||||
TH2I *adc2d_4[16]; = new TH2I("adc2d_4","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*3-0.5),(65536*4-0.5));
|
||||
TH2I *adc2d_5[14]; = new TH2I("adc2d_5","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*4-0.5),(65536*5-0.5));
|
||||
TH2I *adc2d_6[16]; = new TH2I("adc2d_6","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*5-0.5),(65536*6-0.5));
|
||||
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));
|
||||
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));
|
||||
TH2I *adc2d_4[16]; = new TH2I("adc2d_4","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*3-0.5),(65536*4-0.5));
|
||||
TH2I *adc2d_5[14]; = new TH2I("adc2d_5","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*4-0.5),(65536*5-0.5));
|
||||
TH2I *adc2d_6[16]; = new TH2I("adc2d_6","",adc2d_nbin,-200-0.5,adc2d_nbin-200-0.5,65536,(65536*5-0.5),(65536*6-0.5));
|
||||
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));
|
||||
*/
|
||||
|
||||
cout << "Initialize vector of vectors..." << endl;
|
||||
|
||||
|
||||
cout << "Initialize adc2d vectors..." << endl;
|
||||
|
||||
//initialize
|
||||
//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_1_sc%d", sci );
|
||||
adc2d_1.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*0-0.5 ), ( 65536*( 0+1 )-0.5 ) ) );
|
||||
snprintf( _histoname, 50, "adc2d_2_sc%d", sci );
|
||||
adc2d_2.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*1-0.5 ), ( 65536*( 1+1 )-0.5 ) ) );
|
||||
snprintf( _histoname, 50, "adc2d_3_sc%d", sci );
|
||||
adc2d_3.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*2-0.5 ), ( 65536*( 2+1 )-0.5 ) ) );
|
||||
snprintf( _histoname, 50, "adc2d_4_sc%d", sci );
|
||||
adc2d_4.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*3-0.5 ), ( 65536*( 3+1 )-0.5 ) ) );
|
||||
snprintf( _histoname, 50, "adc2d_5_sc%d", sci );
|
||||
adc2d_5.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*4-0.5 ), ( 65536*( 4+1 )-0.5 ) ) );
|
||||
snprintf( _histoname, 50, "adc2d_6_sc%d", sci );
|
||||
adc2d_6.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*5-0.5 ), ( 65536*( 5+1 )-0.5 ) ) );
|
||||
snprintf( _histoname, 50, "adc2d_7_sc%d", sci );
|
||||
adc2d_7.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*6-0.5 ), ( 65536*( 6+1 )-0.5 ) ) );
|
||||
snprintf( _histoname, 50, "adc2d_8_sc%d", sci );
|
||||
adc2d_8.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*7-0.5 ), ( 65536*( 7+1 )-0.5 ) ) );
|
||||
}
|
||||
//vector<TH2I*> v;
|
||||
//v.reserve(NSC);
|
||||
for ( int sci = 0; sci < NSC; ++sci ) {
|
||||
Char_t *_histoname = new Char_t[50];
|
||||
snprintf( _histoname, 50, "adc2d_1_sc%d", sci );
|
||||
adc2d_1.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*0-0.5 ), ( 65536*( 0+1 )-0.5 ) ) );
|
||||
snprintf( _histoname, 50, "adc2d_2_sc%d", sci );
|
||||
adc2d_2.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*1-0.5 ), ( 65536*( 1+1 )-0.5 ) ) );
|
||||
snprintf( _histoname, 50, "adc2d_3_sc%d", sci );
|
||||
adc2d_3.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*2-0.5 ), ( 65536*( 2+1 )-0.5 ) ) );
|
||||
snprintf( _histoname, 50, "adc2d_4_sc%d", sci );
|
||||
adc2d_4.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*3-0.5 ), ( 65536*( 3+1 )-0.5 ) ) );
|
||||
snprintf( _histoname, 50, "adc2d_5_sc%d", sci );
|
||||
adc2d_5.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*4-0.5 ), ( 65536*( 4+1 )-0.5 ) ) );
|
||||
snprintf( _histoname, 50, "adc2d_6_sc%d", sci );
|
||||
adc2d_6.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*5-0.5 ), ( 65536*( 5+1 )-0.5 ) ) );
|
||||
snprintf( _histoname, 50, "adc2d_7_sc%d", sci );
|
||||
adc2d_7.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*6-0.5 ), ( 65536*( 6+1 )-0.5 ) ) );
|
||||
snprintf( _histoname, 50, "adc2d_8_sc%d", sci );
|
||||
adc2d_8.push_back( new TH2I( _histoname, "", adc2d_nbin, -200-0.5, adc2d_nbin-200-0.5, 65536, ( 65536*7-0.5 ), ( 65536*( 7+1 )-0.5 ) ) );
|
||||
}
|
||||
//adc2d.push_back(v);
|
||||
//}
|
||||
|
||||
|
||||
cout << "Done." << endl;
|
||||
|
||||
|
||||
//declare
|
||||
vector<TH1D*> adcpc_spec;
|
||||
adcpc_spec.reserve(NSC);
|
||||
@ -313,7 +326,8 @@ int main(int argc, char* argv[]) {
|
||||
} else if (i < (65536*7)) {
|
||||
adc2d_7[scnumber]->Fill(adcpc,i);
|
||||
} else if (i < (65536*8)) {
|
||||
adc2d_8[scnumber]->Fill(adcpc,i);
|
||||
//TH2I *adc2d_now = dynamic_cast<TH2I*>(adc2d_8->At(scnumber));
|
||||
adc2d_8[scnumber]->Fill(adcpc,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -377,6 +391,21 @@ int main(int argc, char* argv[]) {
|
||||
adc2d_6[sci]->Write();
|
||||
adc2d_7[sci]->Write();
|
||||
adc2d_8[sci]->Write();
|
||||
//TH2I *adc2d_now = dynamic_cast<TH2I*>(adc2d_8->At(sci));
|
||||
|
||||
//All pede updates have been written, so they can be destroyed.
|
||||
pede_updates[sci]->Delete();
|
||||
pede_diff[sci]->Delete();
|
||||
|
||||
//In theory, I believe, adc2d can now also be destroyed since it has already been written to file
|
||||
adc2d_1[sci]->Delete();
|
||||
adc2d_2[sci]->Delete();
|
||||
adc2d_3[sci]->Delete();
|
||||
adc2d_4[sci]->Delete();
|
||||
adc2d_5[sci]->Delete();
|
||||
adc2d_6[sci]->Delete();
|
||||
adc2d_7[sci]->Delete();
|
||||
adc2d_8[sci]->Delete();
|
||||
}
|
||||
//}
|
||||
saved_file->Close();
|
||||
@ -407,7 +436,7 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
} else if (gain_str == "G0") {
|
||||
low_ADU_peak = 250;
|
||||
low_ADU_peak = 200; // was 250
|
||||
high_ADU_peak = 400;
|
||||
}
|
||||
|
||||
@ -490,7 +519,7 @@ int main(int argc, char* argv[]) {
|
||||
snprintf( fithistoname, 50, "fit_par5_sc%d", sci );
|
||||
fit_par5.push_back( new TH1F( fithistoname, "", 100, 0, 0.5 ) );
|
||||
snprintf( fithistoname, 50, "fit_par6_sc%d", sci );
|
||||
fit_par6.push_back( new TH1F( fithistoname, "", 100, 1.05, 1.25 ) );
|
||||
fit_par6.push_back( new TH1F( fithistoname, "", 100, 1.05, 1.3 ) ); // was 1.05, 1.25
|
||||
snprintf( fithistoname, 50, "fit_par7_sc%d", sci );
|
||||
fit_par7.push_back( new TH1F( fithistoname, "", 100, 0, 0.4 ) );
|
||||
|
||||
@ -517,7 +546,7 @@ int main(int argc, char* argv[]) {
|
||||
snprintf( fithistoname, 50, "noise_fit_pos_sc%d", sci );
|
||||
noise_fit_pos.push_back( new TH1F( fithistoname, "", 100, -10, 10 ) );
|
||||
snprintf( fithistoname, 50, "noise_fit_poserr_sc%d", sci );
|
||||
noise_fit_poserr.push_back( new TH1F( fithistoname, "", 100, 0, 0.1 ) );
|
||||
noise_fit_poserr.push_back( new TH1F( fithistoname, "", 100, 0, 0.15 ) ); // was 0, 0.1
|
||||
snprintf( fithistoname, 50, "noise_fit_pos_2d_sc%d", sci );
|
||||
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 );
|
||||
@ -785,6 +814,8 @@ int main(int argc, char* argv[]) {
|
||||
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_par3_2d[sci]->Delete();
|
||||
|
||||
fit_par4_2d[sci]->GetXaxis()->SetTitle("Column");
|
||||
fit_par4_2d[sci]->GetYaxis()->SetTitle("Row");
|
||||
fit_par4_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
|
||||
@ -793,6 +824,8 @@ int main(int argc, char* argv[]) {
|
||||
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_par4_2d[sci]->Delete();
|
||||
|
||||
fit_par5_2d[sci]->GetXaxis()->SetTitle("Column");
|
||||
fit_par5_2d[sci]->GetYaxis()->SetTitle("Row");
|
||||
fit_par5_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
|
||||
@ -801,14 +834,18 @@ int main(int argc, char* argv[]) {
|
||||
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_par5_2d[sci]->Delete();
|
||||
|
||||
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);
|
||||
fit_par6_2d[sci]->GetZaxis()->SetRangeUser(1.0,1.3); //was (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) );
|
||||
|
||||
fit_par6_2d[sci]->Delete();
|
||||
|
||||
fit_par7_2d[sci]->GetXaxis()->SetTitle("Column");
|
||||
fit_par7_2d[sci]->GetYaxis()->SetTitle("Row");
|
||||
fit_par7_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
|
||||
@ -825,6 +862,8 @@ int main(int argc, char* argv[]) {
|
||||
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_pos_2d[sci]->Delete();
|
||||
|
||||
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);
|
||||
@ -833,6 +872,8 @@ int main(int argc, char* argv[]) {
|
||||
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) );
|
||||
|
||||
peak_fit_poserr_2d[sci]->Delete();
|
||||
|
||||
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);
|
||||
@ -841,6 +882,8 @@ int main(int argc, char* argv[]) {
|
||||
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_pos_2d[sci]->Delete();
|
||||
|
||||
noise_fit_poserr_2d[sci]->GetXaxis()->SetTitle("Column");
|
||||
noise_fit_poserr_2d[sci]->GetYaxis()->SetTitle("Row");
|
||||
noise_fit_poserr_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
|
||||
@ -848,11 +891,13 @@ int main(int argc, char* argv[]) {
|
||||
if (gain_str == "HG0") {
|
||||
noise_fit_poserr_2d[sci]->GetZaxis()->SetRangeUser(0,0.1);
|
||||
} else if (gain_str == "G0") {
|
||||
noise_fit_poserr_2d[sci]->GetZaxis()->SetRangeUser(0,0.05);
|
||||
noise_fit_poserr_2d[sci]->GetZaxis()->SetRangeUser(0,0.1); // was 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) );
|
||||
|
||||
noise_fit_poserr_2d[sci]->Delete();
|
||||
|
||||
gain_fit_2d[sci]->GetXaxis()->SetTitle("Column");
|
||||
gain_fit_2d[sci]->GetYaxis()->SetTitle("Row");
|
||||
gain_fit_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
|
||||
@ -864,6 +909,8 @@ int main(int argc, char* argv[]) {
|
||||
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_fit_2d[sci]->Delete();
|
||||
|
||||
gain_fiterr_2d[sci]->GetXaxis()->SetTitle("Column");
|
||||
gain_fiterr_2d[sci]->GetYaxis()->SetTitle("Row");
|
||||
gain_fiterr_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
|
||||
@ -872,6 +919,8 @@ int main(int argc, char* argv[]) {
|
||||
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_fiterr_2d[sci]->Delete();
|
||||
|
||||
gain_ADUper1keV_2d[sci]->GetXaxis()->SetTitle("Column");
|
||||
gain_ADUper1keV_2d[sci]->GetYaxis()->SetTitle("Row");
|
||||
gain_ADUper1keV_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
|
||||
@ -879,11 +928,13 @@ int main(int argc, char* argv[]) {
|
||||
if (gain_str == "HG0") {
|
||||
gain_ADUper1keV_2d[sci]->GetZaxis()->SetRangeUser(80,120);
|
||||
} else if (gain_str == "G0") {
|
||||
gain_ADUper1keV_2d[sci]->GetZaxis()->SetRangeUser(35,50);
|
||||
gain_ADUper1keV_2d[sci]->GetZaxis()->SetRangeUser(25,45); //was 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) );
|
||||
|
||||
//gain_ADUper1keV_2d[sci]->Delete();
|
||||
|
||||
gainerr_ADUper1keV_2d[sci]->GetXaxis()->SetTitle("Column");
|
||||
gainerr_ADUper1keV_2d[sci]->GetYaxis()->SetTitle("Row");
|
||||
gainerr_ADUper1keV_2d[sci]->GetYaxis()->SetTitleOffset(0.7);
|
||||
@ -895,6 +946,8 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
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) );
|
||||
|
||||
//gainerr_ADUper1keV_2d[sci]->Delete();
|
||||
|
||||
c1->cd();
|
||||
|
||||
@ -902,22 +955,30 @@ int main(int argc, char* argv[]) {
|
||||
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) );
|
||||
|
||||
fit_par3[sci]->Delete();
|
||||
|
||||
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) );
|
||||
|
||||
fit_par4[sci]->Delete();
|
||||
|
||||
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) );
|
||||
|
||||
fit_par5[sci]->Delete();
|
||||
|
||||
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) );
|
||||
|
||||
fit_par6[sci]->Delete();
|
||||
|
||||
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() );
|
||||
@ -928,27 +989,37 @@ int main(int argc, char* argv[]) {
|
||||
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_pos[sci]->Delete();
|
||||
|
||||
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) );
|
||||
|
||||
peak_fit_poserr[sci]->Delete();
|
||||
|
||||
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) );
|
||||
|
||||
noise_fit_pos[sci]->Delete();
|
||||
|
||||
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) );
|
||||
|
||||
noise_fit_poserr[sci]->Delete();
|
||||
|
||||
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) );
|
||||
|
||||
//gain_fit[sci]->Delete();
|
||||
|
||||
gain_fit[sci]->GetXaxis()->SetRangeUser( low_ADU_peak+30, high_ADU_peak );
|
||||
gain_fit[sci]->Fit("gaus");
|
||||
gain_fit[sci]->Draw();
|
||||
@ -968,11 +1039,15 @@ int main(int argc, char* argv[]) {
|
||||
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_fit[sci]->Delete();
|
||||
|
||||
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) );
|
||||
|
||||
gain_fiterr[sci]->Delete();
|
||||
|
||||
gain_fit_isEdge[sci]->SetLineColor(kBlue);
|
||||
gain_fit_isInnerEdge[sci]->SetLineColor(kCyan);
|
||||
gain_fit_isDouble[sci]->SetLineColor(kGreen+2);
|
||||
@ -1008,11 +1083,20 @@ int main(int argc, char* argv[]) {
|
||||
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) );
|
||||
|
||||
gain_fit_isDouble[sci]->Delete();
|
||||
gain_fit_isEdge[sci]->Delete();
|
||||
gain_fit_isInnerEdge[sci]->Delete();
|
||||
gain_fit_isNextToDouble[sci]->Delete();
|
||||
gain_fit_isBulk[sci]->Delete();
|
||||
|
||||
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();
|
||||
|
||||
gain_ADUper1keV_2d[sci]->Delete();
|
||||
gainerr_ADUper1keV_2d[sci]->Delete();
|
||||
|
||||
} // end of sc loop
|
||||
|
||||
|
Reference in New Issue
Block a user