]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
Analyzer: Seed integral added
authorBenjamin Linnik <blinnik@jspc61.x-matter.uni-frankfurt.de>
Tue, 1 Nov 2016 17:20:18 +0000 (18:20 +0100)
committerBenjamin Linnik <blinnik@jspc61.x-matter.uni-frankfurt.de>
Tue, 1 Nov 2016 17:20:18 +0000 (18:20 +0100)
MABS_run_analyzer/ChargeSpektrum.c
MABS_run_analyzer/ChargeSpektrumFunctions.c
MABS_run_analyzer/HistogramType.c
MABS_run_analyzer/HistogramType.h
MABS_run_analyzer/Run.c

index 0bfaf848abc2d000fb993f57539dc17ce7b07013..d88067887c4a77b52ba63882367cf864600ef673 100644 (file)
@@ -104,7 +104,7 @@ void ChargeSpektrum(TString runnumber = "")
                     compareHistogramClassVector2.push_back(runs[runi]->histogram->normalized->calibrated);
                      compareHistogramClassVector.push_back(runs[runi]->histogram->normalized);
 //                     compareHistogramClassVector2.push_back(runs[runi]->histogramthreshold);
-                     /*compareHistogramVector*/.push_back(runs[runi]->histogram->normalized->calibrated->Seed);
+                     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]->histogram->normalized->calibrated->Seed, "landau", 1);
 //                     runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS->normalized->calibrated, runs[runi]->histogramwoRTS->normalized->calibrated->Seed, "landau", true);
index 561d2d31a4a9e7bb962496b384ecbb6aa80d509b..37ef0654c0f05ea33d2e22325eab72d40b889537 100644 (file)
@@ -810,7 +810,10 @@ Bool_t printSummaryTable(vector<HistogramType*>* ptCompareHistogramClassVector)
         //cout << left << setw(width) << setfill(' ') << "Veto Peak"; filecontent += Form("Veto Peak\t");
         //         cout << left << setw(width+2) << setfill(' ') << "Veto Integral"; filecontent += Form("Veto Integral\t");
         //         cout << left << setw(width+2) << setfill(' ') << "Sum Integral"; filecontent += Form("Veto Integral\t");
-        cout << left << setw(width-2) << setfill(' ') << "RTS pixel"; filecontent += Form("RTS pixel\t");
+        Float_t printRTSpixel = 0;
+        if (printRTSpixel > 0) { cout << left << setw(width-2) << setfill(' ') << "RTS pixel"; filecontent += Form("RTS pixel\t"); }
+        Float_t printSeedIntegral = 1;
+        if (printSeedIntegral > 0) { cout << left << setw(width) << setfill(' ') << "Seed int"; filecontent += Form("Seed integral\t"); }
         cout << left << setw(width+2) << setfill(' ') << "Leakage"; filecontent += Form("Leakage cur.\t");
         cout << left << setw(width-2) << setfill(' ') << "Noise"; filecontent += Form("Noise\t");
         cout << left << setw(width) << setfill(' ') << "Noise threshold"; filecontent += Form("Noise threshold\t");
@@ -836,7 +839,8 @@ Bool_t printSummaryTable(vector<HistogramType*>* ptCompareHistogramClassVector)
             //cout << left << setw(width) << setfill(' ') << printTableElement(curhistogramclassp->posVeto,ptCompareHistogramClassVector->at(0)->posVeto); filecontent += Form("%s\t", printTableElement(curhistogramclassp->posVeto,ptCompareHistogramClassVector->at(0)->posVeto).c_str());
             //             cout << left << setw(width+2) << setfill(' ') << printTableElement(curhistogramclassp->integralVeto,ptCompareHistogramClassVector->at(0)->integralVeto,2); filecontent += Form("%s\t", printTableElement(curhistogramclassp->integralVeto,ptCompareHistogramClassVector->at(0)->integralVeto,4).c_str());
             //             cout << left << setw(width+2) << setfill(' ') << printTableElement(curhistogramclassp->integralSum,ptCompareHistogramClassVector->at(0)->integralSum,2); filecontent += Form("%s\t", printTableElement(curhistogramclassp->integralSum,ptCompareHistogramClassVector->at(0)->integralSum,4).c_str());
-            cout << left << setw(width-2) << setfill(' ') << printTableElement((float)curhistogramclassp->RTSpixel.size(),(float)ptCompareHistogramClassVector->at(0)->RTSpixel.size(),0); filecontent += Form("%s\t", printTableElement((float)curhistogramclassp->RTSpixel.size(),(float)ptCompareHistogramClassVector->at(0)->RTSpixel.size(),0).c_str());
+            if (printRTSpixel > 0) { cout << left << setw(width-2) << setfill(' ') << printTableElement((float)curhistogramclassp->RTSpixel.size(),(float)ptCompareHistogramClassVector->at(0)->RTSpixel.size(),0); filecontent += Form("%s\t", printTableElement((float)curhistogramclassp->RTSpixel.size(),(float)ptCompareHistogramClassVector->at(0)->RTSpixel.size(),0).c_str()); }
+            if (printSeedIntegral > 0) {  cout << left << setw(width) << setfill(' ') << printTableElement(curhistogramclassp->integralSeed,ptCompareHistogramClassVector->at(0)->integralSeed); filecontent += Form("%s\t", printTableElement(curhistogramclassp->integralSeed,ptCompareHistogramClassVector->at(0)->integralSeed).c_str()); }
             cout << left << setw(width+2) << setfill(' ') << printTableElement((float)curhistogramclassp->medianLeakageCurrent,(float)ptCompareHistogramClassVector->at(0)->medianLeakageCurrent,1); filecontent += Form("%s\t", printTableElement((float)curhistogramclassp->medianLeakageCurrent,(float)ptCompareHistogramClassVector->at(0)->medianLeakageCurrent,1).c_str());
             cout << left << setw(width-2) << setfill(' ') << printTableElement(curhistogramclassp->avgNoise,ptCompareHistogramClassVector->at(0)->avgNoise); filecontent += Form("%s\t", printTableElement(curhistogramclassp->avgNoise,ptCompareHistogramClassVector->at(0)->avgNoise).c_str());
             cout << left << setw(width) << setfill(' ') << printTableElement(curhistogramclassp->noisethresholdborder,ptCompareHistogramClassVector->at(0)->noisethresholdborder); filecontent += Form("%s\t", printTableElement(curhistogramclassp->noisethresholdborder,ptCompareHistogramClassVector->at(0)->noisethresholdborder).c_str());
index c97eab1e0c3bb900197005465fed4c86424c977f..198a3cf135f40124ee77c75b84cf4326b1b8ea51 100644 (file)
@@ -123,14 +123,15 @@ Bool_t HistogramType::calibrateHistograms( Float_t gotgain ) {
     calibrated->posSeed = posSeed * gain;
     calibrated->posSum = posSum * gain;
     calibrated->posVeto = posVeto * gain;
-    calibrated->integralVeto = integralVeto * gain;
-    calibrated->integralSum = integralVeto * gain;
+    calibrated->integralSeed = integralSeed;
+    calibrated->integralVeto = integralVeto;
+    calibrated->integralSum = integralVeto;
     calibrated->posSeedPerc = posSeedPerc;
     calibrated->sigmaSeedPerc = sigmaSeedPerc;
     calibrated->avgNoise = avgNoise * gain;
     calibrated->avgNoisePlus = avgNoisePlus * gain;
     calibrated->avgNoiseMinus = avgNoiseMinus * gain;
-    calibrated->sr90IntegralVal = sr90IntegralVal * gain;
+    calibrated->sr90IntegralVal = sr90IntegralVal;
     calibrated->StoN = StoN;
     calibrated->CCE_in_Perc_1 = CCE_in_Perc_1;
     calibrated->CCE_in_Perc_25 = CCE_in_Perc_25;
@@ -221,6 +222,8 @@ Bool_t HistogramType::normalizeHistograms( Int_t got_frames_found ) {
     normalized->posSeed = posSeed;
     normalized->posSum = posSum;
     normalized->posVeto = posVeto;
+    normalized->integralSeed = integralSeed/frames_found*pow10(6);
+    normalized->integralVeto= integralVeto/frames_found*pow10(6);
     normalized->integralVeto= integralVeto/frames_found*pow10(6);
     normalized->integralSum = integralSum/frames_found*pow10(6);
     normalized->posSeedPerc = posSeedPerc;
@@ -229,7 +232,7 @@ Bool_t HistogramType::normalizeHistograms( Int_t got_frames_found ) {
     normalized->avgNoise = avgNoise;
     normalized->avgNoisePlus = avgNoisePlus;
     normalized->avgNoiseMinus = avgNoiseMinus;
-    normalized->sr90IntegralVal = sr90IntegralVal;
+    normalized->sr90IntegralVal = sr90IntegralVal/frames_found*pow10(6);
     normalized->StoN = StoN;
     normalized->CCE_in_Perc_1 = CCE_in_Perc_1;
     normalized->CCE_in_Perc_25 = CCE_in_Perc_25;
@@ -517,8 +520,11 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType,
     {
         histogrampointer->GetXaxis()->UnZoom();
          posMaxValHist = (histogrampointer->GetBinCenter(histogrampointer->FindLastBinAbove(1,1)));
-//          cout << colorcyan << "maxvalhist: " << posMaxValHist << endlr;
-//          cout << colorcyan << "noiseborder: " << noiseborder << endlr;
+         
+         if (verbose) {
+            cout << colorcyan << "maxvalhist: " << posMaxValHist << endlr;
+            cout << colorcyan << "noiseborder: " << noiseborder << endlr;
+         }
 //         histogrampointer->GetXaxis()->SetRange(noiseborder,histogrampointer->FindLastBinAbove(0));   // look only for maxima with x greater than noiseborder, cut away noise
          histogrampointer->GetXaxis()->SetRange(histogrampointer->FindBin(noiseborder),histogrampointer->FindBin(posMaxValHist));   // look only for maxima with x greater than noiseborder, cut away noise
         
@@ -529,7 +535,7 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType,
         const Double_t def_peakcenter=histogrampointer->GetBinCenter(histogrampointer->GetMaximumBin());
 //                  cout << colorcyan << "def_peakcenter: " << def_peakcenter << endlr;
 //                  cout << colorcyan << "histogrampointer->GetMaximumBin(): " << histogrampointer->GetMaximumBin() << endlr;
-        const Double_t def_gausssig=-8.68052;
+        const Double_t def_gausssig=8.68052;
         const Double_t def_distgauss=20.4;
         const Double_t def_bgslope=0;
         const Double_t def_bgoffs=histogrampointer->GetBinContent(histogrampointer->FindBin((noiseborder+def_peakcenter)/2));
@@ -545,6 +551,7 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType,
         fitFunc->SetParLimits(1,def_peakcenter*0.8,def_peakcenter*1.2);
         fitFunc->SetParName(2,"Gaussian sigma");
         fitFunc->SetParameter(2,def_gausssig);
+        fitFunc->SetParLimits(2,0,10000);
         fitFunc->SetParName(3,"Distance from Gauss");
         fitFunc->SetParameter(3,def_distgauss);
         fitFunc->SetParLimits(3,0,def_distgauss*2);
@@ -626,10 +633,12 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType,
         double integralbg = bgfct->Integral(parameters[1] - 2*parameters[2] ,parameters[1] + 2*parameters[2]); // integral value of histogram (NOT fit)
         parameters[6] -= integralbg;       
         
-        cout << colorcyan << "Integral from bin : " << histogrampointer->FindBin(parameters[7])  << " to " << histogrampointer->GetXaxis()->FindBin(parameters[1] + 2*parameters[2]) << endlr;  
-         cout << colorcyan << "Integral from val : " << parameters[7] << " to " << parameters[1] + 2*parameters[2] << endlr;  
-         cout << colorcyan << "Integral value: " << parameters[6] << endlr;            
-         cout << colorcyan << "Integral bg: " << integralbg << endlr;            
+        if (verbose) {
+            cout << colorcyan << "Integral from bin : " << histogrampointer->FindBin(parameters[7])  << " to " << histogrampointer->GetXaxis()->FindBin(parameters[1] + 2*parameters[2]) << endlr;  
+            cout << colorcyan << "Integral from val : " << parameters[7] << " to " << parameters[1] + 2*parameters[2] << endlr;  
+            cout << colorcyan << "Integral value: " << parameters[6] << endlr;            
+            cout << colorcyan << "Integral bg: " << integralbg << endlr;            
+        }
 
 //             DEBUG
 //         TCanvas* canvas = new TCanvas(histogrampointer->GetName(), histogrampointer->GetName(), 900, 700);
index 4c85ccdc52c4edd4c2c8265d640587c75ee5001d..8b7e9eeca08d3be4f6a080572ac6b0481599741d 100644 (file)
@@ -148,6 +148,8 @@ public:
     
     /// fitted position of the most probable value of the seed spectrum
     Float_t posSeed=0;
+    /// fintegral over the Seed peak, 4 sigma area
+    Double_t integralSeed=0;
     /// fitted position of the most probable value in the over cluster summed spectrum
     Float_t posSum=0;
     /// fintegral over the sum peak, normalized to number of events
index 332388c8b4c1316d470f9a26ac5a2ac68a91918a..b36b2f6582f61dbe51bb0cb87c106007052b1b9b 100644 (file)
@@ -251,7 +251,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 (1000,1000,15,10,100);
+    systemparam systemparamPipper2 (1000,500,15,10,100);
     if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("Mi34") )
         cursystemparam = systemparamUSB;
     else if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("FSBB") )
@@ -953,6 +953,7 @@ void Run::updateDatabase() {
     constructUpdateString(&sqlupdatequery, "SeedPeak",   histogramthreshold->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);
@@ -1381,9 +1382,10 @@ Bool_t Run::binSeedSumVeto()
             (*curHistogramClass)->integralVeto = parameters[6];
         }
         if (labbook.chipGen.EqualTo("Pipper2")) 
-            parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->Seed, "gaus");
+            parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->Seed, "GaussTail");
         else
             parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->Seed, "landau");
+        (*curHistogramClass)->integralSeed = parameters[6];
         (*curHistogramClass)->posSeed = parameters[1];
         parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->Sum, "gaus");
         (*curHistogramClass)->posSum = parameters[1];
@@ -2147,7 +2149,7 @@ TCanvas* Run::plot1DHistogram(HistogramType* HistogramTypepointer, TH1F* onehist
                 cout << "background slope : " <<  parameters[4] << endl;
                 cout << "background offset: " <<  parameters[5] << endl;
                 //TF1 *f1 = new TF1("f1","[0] +[1]*x +gaus(2)",0,5);
-                TF1 *f1 = new TF1("f1","[0] +[1]*x",100,250);
+                TF1 *f1 = new TF1("f1","[0] +[1]*x",0,1000);
                 f1->SetParameters(parameters[5],parameters[4]);
                 f1->Draw("SAME");          
             }