]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
Analyzer: Small bug fixes#
authorBenjamin Linnik <blinnik@jspc61.x-matter.uni-frankfurt.de>
Tue, 2 May 2017 10:53:21 +0000 (12:53 +0200)
committerBenjamin Linnik <blinnik@jspc61.x-matter.uni-frankfurt.de>
Tue, 2 May 2017 10:53:21 +0000 (12:53 +0200)
MABS_run_analyzer/ChargeSpektrum.c
MABS_run_analyzer/ChargeSpektrumFunctions.c
MABS_run_analyzer/HistogramType.c
MABS_run_analyzer/MAPS.c
MABS_run_analyzer/Run.c

index 068b0a7cd8bcc6f854693addcc48c3fe5b8315e8..e632ea15bdd0f897540d909fcb4b7b4964fa5a38 100644 (file)
@@ -61,6 +61,7 @@ void ChargeSpektrum(TString runnumber = "")
 //                     runs[runi]->setSubMatrixBorders(100,120,100,120);
                 //runs[runi]->setFixedThresholdValueElectrons(1440);
                 //runs[runi]->setNoisethresholdborderADU(30);
+             //runs[runi]->setNoisethresholdborderE(220);
 
 //                                 runs[runi]->analyzeFrame(6384);
 //                 runs[runi]->analyzeFrame(6605);
@@ -101,19 +102,20 @@ void ChargeSpektrum(TString runnumber = "")
                         gROOT->SetBatch(kFALSE);
                     
                     // Uncomment below to do classical analysis withour RTS
-//                     compareHistogramClassVector.push_back(runs[runi]->histogramwoRTS->normalized);
+//                    compareHistogramClassVector.push_back(runs[runi]->histogramwoRTS->normalized);
 //                     compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS);
-                    compareHistogramClassVector.push_back(runs[runi]->histogram->normalized);
+//                     compareHistogramClassVector.push_back(runs[runi]->histogram->normalized);
                     compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS->normalized);
-                    runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramwoRTS->pixeltimefired, "", 0);
+                    compareHistogramClassVector.push_back(runs[runi]->histogram->normalized);
+//                     runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramwoRTS->pixeltimefired, "", 0);
                      //compareHistogramClassVector.push_back(runs[runi]->histogramwoRTS);
 //                     compareHistogramClassVector2.push_back(runs[runi]->histogramthreshold);
                      //compareHistogramVector.push_back(runs[runi]->histogram->normalized->calibrated->Seed);
                      //compareHistogramVector2.push_back(runs[runi]->histogram->normalized->Seed);
                     
 //                  runs[runi]->plot1DHistogram(runs[runi]->histogram->normalized->calibrated, runs[runi]->processed->fNoiseInfo.fPedestals, "", 1);
-                    runs[runi]->plot1DHistogram(runs[runi]->histogram->normalized->calibrated, runs[runi]->histogram->normalized->calibrated->Seed, "landau", 1);
-             runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramwoRTS->pixeltimefiredsorted, "", 0);
+//                  runs[runi]->plot1DHistogram(runs[runi]->histogram->normalized, runs[runi]->histogramwoRTS->normalized->calibrated->Seed, "landau", 1, 1, 0, 200);
+//              runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramwoRTS->pixeltimefiredsorted, "", 0);
 //                     runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS->normalized->calibrated, runs[runi]->histogramwoRTS->normalized->calibrated->Seed, "landau", true);
 //                     runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS->normalized->calibrated, runs[runi]->histogramwoRTS->normalized->calibrated->Sum, "gaus", true);
                     
index 5a283b6ca11d4a6d26ecf0906fc2dca0211a9482..eff8451d282a840c412e8b79d4b08fb2bc622d96 100644 (file)
@@ -717,7 +717,10 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector)
             hs->Add(curhistogramclone);
             legendEntry = Form("%s", curhistogramclone->GetTitle());
             if (legendStringsVector.size() > 0)
+            {
                 legendEntry = Form("%s", legendStringsVector.at(histogrami).Data());
+                cout << colorcyan << legendEntry << endlr;
+            }
             leg2->AddEntry(curhistogramclone, legendEntry, "l");
             leg2->Draw("SAME");
             //             hs->Add(leg1);
@@ -899,7 +902,7 @@ Bool_t FindGoodTitle(vector<HistogramType*>* ptCompareHistogramClassVector) {
 //             same_System = kFALSE;             
     }
     
-    // construct header stringรถ
+    // construct header string
     TString title1 = "";
     if (same_Source)
         title1.Append(Form(", %s", firstlabbook.source.Data()));
@@ -916,7 +919,7 @@ Bool_t FindGoodTitle(vector<HistogramType*>* ptCompareHistogramClassVector) {
         title1.Append(Form(", %.1f*10^{13} n_{eq}/cm^{2}", firstlabbook.radDoseNonIon));
     if (same_Clock)
         title1.Append(Form(", %.2f Mhz", firstlabbook.clock));    
-    if (same_Depletion && firstlabbook.depletionV > 0)
+    if (same_Depletion && firstlabbook.depletionV >= 0)
         title1.Append(Form(", U_{dep}=%.1f V", firstlabbook.depletionV));
     
     headerStringsVector.push_back(title1);
@@ -946,7 +949,7 @@ Bool_t FindGoodTitle(vector<HistogramType*>* ptCompareHistogramClassVector) {
             legendstr.Append(Form("%.1f*10^{13} n_{eq}/cm^{2}", curlabbook.radDoseNonIon)); }
         if (!same_Clock) { if (legendstr.Length()) legendstr.Append(", ");
             legendstr.Append(Form("%.2f Mhz", curlabbook.clock)); }
-        if (!same_Depletion && curlabbook.depletionV > 0) { if (legendstr.Length()) legendstr.Append(", ");
+        if (!same_Depletion && curlabbook.depletionV >= 0) { if (legendstr.Length()) legendstr.Append(", ");
             legendstr.Append(Form("U_{dep}=%.1f V", curlabbook.depletionV)); }
         legendStringsVector.push_back(legendstr);
     }    
@@ -972,7 +975,7 @@ Bool_t FindGoodTitle(vector<HistogramType*>* ptCompareHistogramClassVector) {
     if (!same_Clock)
         for (UInt_t histogrami=0; histogrami < ptCompareHistogramClassVector->size(); histogrami++)
             folderadd.Append(Form(" %.2f Mhz", ptCompareHistogramClassVector->at(histogrami)->labbook->clock)); 
-    if (!same_Depletion && curlabbook.depletionV > 0)
+    if (!same_Depletion && curlabbook.depletionV >= 0)
         for (UInt_t histogrami=0; histogrami < ptCompareHistogramClassVector->size(); histogrami++)
             folderadd.Append(Form(" %.1fV", ptCompareHistogramClassVector->at(histogrami)->labbook->depletionV));
     
index db2eb9de6398467617ce9acb5c2c204904d4d8e3..238be69ae4cb1da0f185fafad7d4104155a6a8de 100644 (file)
@@ -234,7 +234,7 @@ Bool_t HistogramType::normalizeHistograms( Int_t got_frames_found ) {
     normalized->avgNoise = avgNoise;
     normalized->avgNoisePlus = avgNoisePlus;
     normalized->avgNoiseMinus = avgNoiseMinus;
-    normalized->sr90IntegralVal = sr90IntegralVal/frames_found*pow10(6);
+    normalized->sr90IntegralVal = sr90IntegralVal;
     normalized->StoN = StoN;
     normalized->CCE_in_Perc_1 = CCE_in_Perc_1;
     normalized->CCE_in_Perc_25 = CCE_in_Perc_25;
@@ -674,6 +674,7 @@ Bool_t HistogramType::calculteCCE(Bool_t verbose) {
 Bool_t HistogramType::FindNoisethresholdborder(TH1F* histogrampointer, Bool_t overwrite, Bool_t verbose) {
     if (overwrite || noisethresholdborder == -1)
     {
+//         cout << colorcyan << "Find border" << endl;
         Float_t posMaxValHist = histogrampointer->GetXaxis()->GetXmax();
         
         TH1F* smoothedcurce = (TH1F*)histogrampointer->Clone();
@@ -809,9 +810,12 @@ Bool_t HistogramType::integrateSr90Spectra(TH1F* histogrampointer, Int_t frames_
     if (thresholdborder < 0)
     {
         if (noisethresholdborder < 0) {
+//             cout << "noisethresholdborder is not set, searching" << endl;
             FindNoisethresholdborder(histogrampointer, true, verbose);
         }
         thresholdbincurcandidate = histogrampointer->GetXaxis()->FindBin(noisethresholdborder);
+//             cout << colorcyan << "noisethresholdborder: " << noisethresholdborder  << endl;
+//             cout << colorcyan << "thresholdbincurcandidate: " << thresholdbincurcandidate  << endl;
     }
     else
     {
@@ -838,9 +842,12 @@ Bool_t HistogramType::integrateSr90Spectra(TH1F* histogrampointer, Int_t frames_
             }
         }
     }
-    sr90IntegralVal = histogrampointer->IntegralAndError(thresholdbincurcandidate,histogrampointer->GetNbinsX(), sr90IntegralErr);
+//     sr90IntegralVal = histogrampointer->integral(thresholdbincurcandidate,histogrampointer->GetNbinsX(), sr90IntegralErr);
+    sr90IntegralVal = histogrampointer->Integral(thresholdbincurcandidate,histogrampointer->GetNbinsX());
+//     histogrampointer->Integral(min+fittries*min/20, histogrampointer->GetXaxis()->FindBin(posMaxValHist));
+//     for (
 //     cout << "Integrate from bin " << thresholdbincurcandidate << " to " <<  histogrampointer->GetNbinsX() << endl;
-    sr90IntegralErr /= sr90IntegralVal/100;
+//     sr90IntegralErr /= sr90IntegralVal/100;
 //     cout << "   Unscaled integral is " << Form("%e",sr90IntegralVal) << ", error " << sr90IntegralErr << "%" <<  endl;
     //     cout << "   ";
     if (verbose)
@@ -848,11 +855,14 @@ Bool_t HistogramType::integrateSr90Spectra(TH1F* histogrampointer, Int_t frames_
     if (frames_found>0)
     {
         sr90IntegralVal/=frames_found;
+        cout << "Integral is " << colorgreen << Form("%e",sr90IntegralVal) << colorreset << endl;
         if (verbose)
             cout << "Scaled ";
     }
-    if (verbose)
-        cout << "Integral is " << colorgreen << Form("%e",sr90IntegralVal) << colorreset << ", error " << sr90IntegralErr << "%" <<  endl;
+    if (verbose) {
+//         cout << "Integral is " << colorgreen << Form("%e",sr90IntegralVal) << colorreset << ", error " << sr90IntegralErr << "%" <<  endl;
+        cout << "Integral is " << colorgreen << Form("%e",sr90IntegralVal) << endlr;
+    }
     
     return 0;
 }
index 7cca3ae6bf550ce454172b3692d2840ed78220ef..6f96291d5482f91ecef539a7d248f82a154b4cd8 100644 (file)
@@ -1821,6 +1821,13 @@ void MAPS::plotFrame(Int_t FrameNumber) {
 //         canvasFrame->SetName(cm1->GetName());
         cm1->Update();
         cout<<"\rPIXELMATRIX plotted!                           "<<endl;
+        
+        TString canvastitle = Form("%s %s", "F0", "F0");
+        TString canvasname =  Form("%s %s", "F0", "F0");
+        TCanvas* canvas = new TCanvas(canvasname, canvastitle, 900, 700);
+        h4->Draw();
+        
+        
         cout<<"-------------------"<<endl;
     }
 }
@@ -2467,4 +2474,4 @@ void MAPS::reorderFSBB() {
 //####################################################################
 #endif
 
-            
\ No newline at end of file
+            
index e97d715d3be9d8d0817c5f3017aff69806e2e61e..e2926872cb5ab2a99ef7b13b95f8a27f4ce6260b 100644 (file)
@@ -254,7 +254,7 @@ void Run::setSystemSpecificParameters()
     systemparam systemparamPXI (800*16,800,75,150,150);
     systemparam systemparamFSBB (2800,2800/4,25,10,100);
     systemparam systemparamUSBMi19 (400/*maxbin*/,400/1/*nbins*/, 25/*vetothreshold*/, 10/*maxbinnoise*/, 100/*nbinsnoise*/);
-    systemparam systemparamPipper2 (500,500,15,10,100);
+    systemparam systemparamPipper2 (1000,250,15,10,100);
     if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("Mi34") )
         cursystemparam = systemparamUSB;
     else if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("FSBB") )
@@ -468,7 +468,8 @@ Bool_t Run::analyzeRun(Bool_t force)
                 (*curHistogramClass)->noisethresholdborder = noisethresholdborderADU;   
             if (noisethresholdborderE > -1) {
                 if (labbook.gainDB > 0) {
-                    (*curHistogramClass)->noisethresholdborder = noisethresholdborderE / labbook.gainDB;       
+                    (*curHistogramClass)->noisethresholdborder = noisethresholdborderE / labbook.gainDB;  
+                    cout << colorcyan << "Set noisethresholdborder to : " << (*curHistogramClass)->noisethresholdborder << " (" << noisethresholdborderE << " e)" << endlr;
                 } else {
                     cout << colorred << "Could not set noise threshold border in units of electrons to " << noisethresholdborderE << "e, no calibration done yet. Please rerun after first analysis." <<endlr;
                 }
@@ -662,7 +663,7 @@ Bool_t Run::setNoisethresholdborderADU(Float_t noisethresholdborder)
 
 Bool_t Run::setNoisethresholdborderE(Float_t noisethresholdborder)
 {
-    noisethresholdborderADU = noisethresholdborder;
+    noisethresholdborderE = noisethresholdborder;
     cout << " Noise threshold border: " << colorwhite << noisethresholdborder  << " e"<< colorreset << "  <-- only used if GAIN is allready saved in database, rerun after first analysis to make sure" << endl;
     return 0;
 }
@@ -995,7 +996,7 @@ void Run::updateDatabase() {
         }
     }
     if (histogramthreshold->normalized->calibrated != 0)
-//         if (histogramfixedthreshold != 0)
+        if (labbook.source.Contains("Sr") && histogramthreshold->normalized->calibrated->sr90IntegralVal > 0)
             constructUpdateString(&sqlupdatequery, "Sr90IntegralVal", histogramthreshold->normalized->calibrated->sr90IntegralVal,1000000000);
   
     if (sqlupdatequery.length()>0)