]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
analyzer: updated updateDatabase() function to add noise + and - values in ADU
authorTobias Bus <tbus@jspc48.x-matter.uni-frankfurt.de>
Tue, 6 Jun 2017 12:47:24 +0000 (14:47 +0200)
committerTobias Bus <tbus@jspc48.x-matter.uni-frankfurt.de>
Tue, 6 Jun 2017 12:47:24 +0000 (14:47 +0200)
MABS_run_analyzer/ChargeSpektrum.c
MABS_run_analyzer/HistogramType.c
MABS_run_analyzer/Run.c

index 6d48a5a5788c90a73f1407bdfe489e352a1f71fe..25d58f6969d112f36898367715bccfb703757639 100644 (file)
@@ -118,7 +118,11 @@ void ChargeSpektrum(TString runnumber = "")
 //              runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramwoRTS->pixeltimefiredsorted, "", 0);
 
 // Integralberechnung vom Veto Peak
-                    runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS->normalized, runs[runi]->histogramwoRTS->normalized->Seed, "GaussTail", true);
+                    runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogram->Seed, "GaussTail", true);
+                    runs[runi]->plot1DHistogram(runs[runi]->histogram->normalized, runs[runi]->histogram->normalized->Seed, "GaussTail", true);
+                                       
+                                       compareHistogramVector.push_back(runs[runi]->histogram->normalized->Seed);
+                                       compareHistogramVector.push_back(runs[runi]->histogram->Seed);
 
 //                     runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS->normalized->calibrated, runs[runi]->histogramwoRTS->normalized->calibrated->Sum, "gaus", true);
                     
index 4ef06b18099b40289505251fcfb539d46b26425c..662affad657c0ab4eae397bd77f49af254cf2471 100644 (file)
@@ -259,7 +259,7 @@ void HistogramType::normalizeHistogram(TH1F* &histogrampointernew, TH1F* &histog
     histogrampointernew->SetTitle(Form("%s, norm.", histogrampointerold->GetTitle())); 
     int nbins = histogrampointernew->GetXaxis()->GetNbins();    
     for(int x=0; x <= nbins; x++){
-        histogrampointernew->SetBinContent(x,histogrampointerold->GetBinContent(x)/frames_found*1000000.0);
+        histogrampointernew->SetBinContent(x,  (histogrampointerold->GetBinContent(x)*1000000.0)/frames_found);
     }
     //histogrampointernew->GetYaxis()->SetTitle(Form("%s\b/(%d/1000000)]",histogrampointernew->GetYaxis()->GetTitle(), frames_found));
 }
@@ -271,7 +271,7 @@ void HistogramType::normalizeHistogramXAxis(TH1F* &histogrampointernew, TH1F* &h
     int nbins = histogrampointernew->GetXaxis()->GetNbins();    
     double new_bins[nbins+1];
     for(int i=0; i <= nbins; i++){
-        new_bins[i] = histogrampointernew->GetBinLowEdge(i)/frames_found*1000000;
+        new_bins[i] = histogrampointernew->GetBinLowEdge(i)*1000000/frames_found;
     }  
     histogrampointernew->SetBins(nbins, new_bins);    
 //    histogrampointernew->GetYaxis()->SetTitle(Form("%s\b/(%d/1000000)]",histogrampointernew->GetYaxis()->GetTitle(), frames_found));
index f03c83926dc3b1420c816ac5f7953da8db19c979..a29e9764fe224eaee395043391bbf8e978efda70 100644 (file)
@@ -955,49 +955,60 @@ void Run::constructUpdateString(string *sqlupdatequery, const string databaseval
 }
 
 void Run::updateDatabase() {
-    
-    
-    string sqlupdatequery = "";
-    constructUpdateString(&sqlupdatequery, "Gain",       histogramthreshold->normalized->gain);
-    constructUpdateString(&sqlupdatequery, "SumPeak",    histogramthreshold->normalized->posSum, 4);
-    constructUpdateString(&sqlupdatequery, "SeedPeak",   histogramthreshold->normalized->posSeed, 4);
+       HistogramType* histogramclassToUseForDB = 0;
+       // Add code to set the pointer histogramclassToUseForDB to class to use for database values
+       // histogramclassToUseForDB = histogramthreshold;
+       if (labbook.chipGen.EqualTo("Pipper2")) {
+               histogramclassToUseForDB = histogramwoRTS;
+       } else {
+               histogramclassToUseForDB = histogramwoRTSthreshold;
+       }
+               
+       
+       
+    string sqlupdatequery = "";        
+    constructUpdateString(&sqlupdatequery, "Gain",       histogramclassToUseForDB->normalized->gain);
+    constructUpdateString(&sqlupdatequery, "SumPeak",    histogramclassToUseForDB->normalized->posSum, 4);
+    constructUpdateString(&sqlupdatequery, "SeedPeak",   histogramclassToUseForDB->normalized->posSeed, 4);
     constructUpdateString(&sqlupdatequery, "AvgF0",   labbook.averageF0, 6);
     constructUpdateString(&sqlupdatequery, "SigmaF0",   labbook.sigmaF0, 6);
-    constructUpdateString(&sqlupdatequery, "SeedIntegralMinusBG2Sigma",   histogramthreshold->normalized->integralSeed, 10);
-    constructUpdateString(&sqlupdatequery, "VetoPeak",   histogramthreshold->normalized->posVeto, 4);
-    constructUpdateString(&sqlupdatequery, "VetoIntegral",   histogramthreshold->normalized->integralVeto, 10);
-    constructUpdateString(&sqlupdatequery, "SumIntegral",   histogramthreshold->normalized->integralSum, 10);
-    if (histogramthreshold->normalized->calibrated != 0)
+    constructUpdateString(&sqlupdatequery, "SeedIntegralMinusBG2Sigma",   histogramclassToUseForDB->normalized->integralSeed, 10);
+    constructUpdateString(&sqlupdatequery, "VetoPeak",   histogramclassToUseForDB->normalized->posVeto, 4);
+    constructUpdateString(&sqlupdatequery, "VetoIntegral",   histogramclassToUseForDB->normalized->integralVeto, 10);
+    constructUpdateString(&sqlupdatequery, "SumIntegral",   histogramclassToUseForDB->normalized->integralSum, 10);
+    if (histogramclassToUseForDB->normalized->calibrated != 0)
 //         if (histogramthreshold->normalized->calibrated->avgNoise < 100)
-            constructUpdateString(&sqlupdatequery, "Avg.Noise",  histogramthreshold->normalized->calibrated->avgNoise);
-    if (histogramthreshold->normalized->calibrated != 0)
+            constructUpdateString(&sqlupdatequery, "Avg.Noise",  histogramclassToUseForDB->normalized->calibrated->avgNoise);
+    if (histogramclassToUseForDB->normalized->calibrated != 0)
 //         if (histogramthreshold->normalized->calibrated->avgNoisePlus < 100)
-            constructUpdateString(&sqlupdatequery, "Avg.Noise+", histogram->normalized->calibrated->avgNoisePlus, 2);
-    if (histogramthreshold->normalized->calibrated != 0)
+            constructUpdateString(&sqlupdatequery, "Avg.Noise+", histogramclassToUseForDB->normalized->calibrated->avgNoisePlus, 2);
+    if (histogramclassToUseForDB->normalized->calibrated != 0)
 //         if (histogramthreshold->normalized->calibrated->avgNoiseMinus < 100)
-            constructUpdateString(&sqlupdatequery, "Avg.Noise-", histogramthreshold->normalized->calibrated->avgNoiseMinus, 2);
-    constructUpdateString(&sqlupdatequery, "CCE_1",      histogramthreshold->normalized->CCE_in_Perc_1);
-    constructUpdateString(&sqlupdatequery, "CCE_25",     histogramthreshold->normalized->CCE_in_Perc_25);
-    constructUpdateString(&sqlupdatequery, "StoN",     histogramthreshold->normalized->StoN, 3);
-//     if (histogramthreshold->normalized->avgNoise < 100)
-        constructUpdateString(&sqlupdatequery, "Avg.NoiseADC",  histogramthreshold->normalized->avgNoise);
+            constructUpdateString(&sqlupdatequery, "Avg.Noise-", histogramclassToUseForDB->normalized->calibrated->avgNoiseMinus, 2);
+    constructUpdateString(&sqlupdatequery, "CCE_1",      histogramclassToUseForDB->normalized->CCE_in_Perc_1);
+    constructUpdateString(&sqlupdatequery, "CCE_25",     histogramclassToUseForDB->normalized->CCE_in_Perc_25);
+    constructUpdateString(&sqlupdatequery, "StoN",     histogramclassToUseForDB->normalized->StoN, 3);
+//     if (histogramclassToUseForDB->normalized->avgNoise < 100)
+       constructUpdateString(&sqlupdatequery, "Avg.NoiseADC",  histogramclassToUseForDB->normalized->avgNoise);
+       constructUpdateString(&sqlupdatequery, "Avg.NoiseADC+",  histogramclassToUseForDB->normalized->avgNoisePlus);
+       constructUpdateString(&sqlupdatequery, "Avg.NoiseADC-",  histogramclassToUseForDB->normalized->avgNoiseMinus);
     constructUpdateString(&sqlupdatequery, "Frames_found", frames_found,100000000);
-    if (histogramwoRTSthreshold != 0) {
-        constructUpdateString(&sqlupdatequery, "RTSpixel",       histogramwoRTSthreshold->normalized->RTSpixel.size());
-        constructUpdateString(&sqlupdatequery, "RTSpixel_percentage",       histogramwoRTSthreshold->normalized->percentageofRTSpixel);
-        constructUpdateString(&sqlupdatequery, "LeakageCurMedADC",  histogramwoRTSthreshold->medianLeakageCurrent);
-        constructUpdateString(&sqlupdatequery, "LeakageCurAvgADC",  histogramwoRTSthreshold->avgLeakageCurrentInChip);
-        if (histogramwoRTSthreshold->calibrated != 0) {
-            constructUpdateString(&sqlupdatequery, "LeakageCurAvgE",  histogramwoRTSthreshold->calibrated->avgLeakageCurrentInChip);     
-            constructUpdateString(&sqlupdatequery, "LeakageCurfA",  histogramwoRTSthreshold->calibrated->medianLeakageCurrent);      
-            constructUpdateString(&sqlupdatequery, "LeakageCurfA+",  histogramwoRTSthreshold->calibrated->medianLeakageCurrentPlus);      
-            constructUpdateString(&sqlupdatequery, "LeakageCurfA-",  histogramwoRTSthreshold->calibrated->medianLeakageCurrentMinus);      
+    if (histogramwoRTS != 0) {
+        constructUpdateString(&sqlupdatequery, "RTSpixel",       histogramwoRTS->normalized->RTSpixel.size());
+        constructUpdateString(&sqlupdatequery, "RTSpixel_percentage",       histogramwoRTS->normalized->percentageofRTSpixel);
+        constructUpdateString(&sqlupdatequery, "LeakageCurMedADC",  histogramwoRTS->medianLeakageCurrent);
+        constructUpdateString(&sqlupdatequery, "LeakageCurAvgADC",  histogramwoRTS->avgLeakageCurrentInChip);
+        if (histogramwoRTS->calibrated != 0) {
+            constructUpdateString(&sqlupdatequery, "LeakageCurAvgE",  histogramwoRTS->calibrated->avgLeakageCurrentInChip);     
+            constructUpdateString(&sqlupdatequery, "LeakageCurfA",  histogramwoRTS->calibrated->medianLeakageCurrent);      
+            constructUpdateString(&sqlupdatequery, "LeakageCurfA+",  histogramwoRTS->calibrated->medianLeakageCurrentPlus);      
+            constructUpdateString(&sqlupdatequery, "LeakageCurfA-",  histogramwoRTS->calibrated->medianLeakageCurrentMinus);      
             constructUpdateString(&sqlupdatequery, "CalibrationPeak",  Fe55run.posVeto);             
         }
     }
-    if (histogramthreshold->normalized->calibrated != 0)
-        if (labbook.source.Contains("Sr") && histogramthreshold->normalized->calibrated->sr90IntegralVal > 0)
-            constructUpdateString(&sqlupdatequery, "Sr90IntegralVal", histogramthreshold->normalized->calibrated->sr90IntegralVal,1000000000);
+    if (histogramclassToUseForDB->normalized->calibrated != 0)
+        if (labbook.source.Contains("Sr") && histogramclassToUseForDB->normalized->calibrated->sr90IntegralVal > 0)
+            constructUpdateString(&sqlupdatequery, "Sr90IntegralVal", histogramclassToUseForDB->normalized->calibrated->sr90IntegralVal,1000000000);
   
     if (sqlupdatequery.length()>0)
     {