]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
Analyzer: Share before Tobis checkout
authorBenjamin Linnik <blinnik@jspc61.x-matter.uni-frankfurt.de>
Fri, 7 Oct 2016 13:45:10 +0000 (15:45 +0200)
committerBenjamin Linnik <blinnik@jspc61.x-matter.uni-frankfurt.de>
Fri, 7 Oct 2016 13:45:10 +0000 (15:45 +0200)
MABS_run_analyzer/ChargeSpektrum.c
MABS_run_analyzer/ChargeSpektrumFunctions.c
MABS_run_analyzer/HistogramType.c
MABS_run_analyzer/HistogramType.h
MABS_run_analyzer/MAPS.c
MABS_run_analyzer/Run.c
MABS_run_analyzer/Run.h
MABS_run_analyzer/help.h

index 3133e5035c0048a3a173878db9b7ab3e17e6f75c..003964ca9651fed726b368c51c73f68753fb5896 100644 (file)
@@ -62,7 +62,14 @@ void ChargeSpektrum(TString runnumber = "")
                 //runs[runi]->setFixedThresholdValueElectrons(1440);
                 //runs[runi]->setNoisethresholdborderADU(30);
 
-//                    runs[runi]->analyzeFrame(1000);
+//                                 runs[runi]->analyzeFrame(6384);
+//                 runs[runi]->analyzeFrame(6604);
+//                 runs[runi]->analyzeFrame(675);
+//                 runs[runi]->analyzeFrame(680);
+//                 runs[runi]->analyzeFrame(685);
+//                 runs[runi]->analyzeFrame(690);
+//                 continue;
+                    
 
                 // creates or opens .root file, can analyze the RAW data
                 if (runListForceAnalysis.size() >= (unsigned)runi+1)
@@ -79,7 +86,7 @@ void ChargeSpektrum(TString runnumber = "")
                     runs[runi]->error=runs[runi]->analyzeRun(true);
                 }                
                 if (!runs[runi]->error)
-                {                    
+                {
                     if (runListCustomTitle.size() >= (unsigned)runi+1)
                     {
                         if (runListCustomTitle[runi].Length()>0)
@@ -92,9 +99,13 @@ void ChargeSpektrum(TString runnumber = "")
                     if (!isBatch)
                         gROOT->SetBatch(kFALSE);
                     
-//                     // Uncomment below to do classical analysis
-//                     compareHistogramClassVector.push_back(runs[runi]->histogramthreshold);
-//                     compareHistogramVector.push_back(runs[runi]->histogramthreshold->Seed);
+                    // Uncomment below to do classical analysis withour RTS
+//                     compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTS->normalized->calibrated);
+                    compareHistogramClassVector.push_back(runs[runi]->histogram);
+                    compareHistogramClassVector2.push_back(runs[runi]->histogramthreshold);
+//                     compareHistogramVector2.push_back(runs[runi]->histogramwoRTS->normalized->calibrated->Seed);
+//                     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);
                     
 // //                     Uncomment below to do analysis without RTS pixel
 //                     compareHistogramClassVector2.push_back(runs[runi]->histogramwoRTSthreshold);
@@ -116,12 +127,12 @@ void ChargeSpektrum(TString runnumber = "")
 //                     compareHistogramVector6.push_back(runs[runi]->histogramwoRTSthreshold->calibrated->pixeltimefiredsorted);
                     
                     // Leakage current
-                    runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramthreshold->calibrated->LeakageCurrentInPixel, "", 0);
+//                     runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogram->calibrated->LeakageCurrentInPixel, "", 0);
 //                     runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogramthreshold->LeakageCurrentInPixelSorted, "", 0);
-                    compareHistogramVector5.push_back(runs[runi]->histogramthreshold->calibrated->LeakageCurrentInPixelSorted);
-                    compareHistogramClassVector4.push_back(runs[runi]->histogramwoRTSthreshold->calibrated);
-                    compareHistogramClassVector5.push_back(runs[runi]->histogramwoRTSthreshold);
-//                     compareHistogramVector7.push_back(runs[runi]->histogramthreshold->calibrated->LeakageCurrentInPixelSorted);
+//                     compareHistogramVector5.push_back(runs[runi]->histogram->calibrated->LeakageCurrentInPixelSorted);
+//                     compareHistogramClassVector4.push_back(runs[runi]->histogramwoRTS->calibrated);
+//                     compareHistogramClassVector5.push_back(runs[runi]->histogramwoRTS);
+//                     compareHistogramVector7.push_back(runs[runi]->histogram->calibrated->LeakageCurrentInPixelSorted);
                     
                     
                     
@@ -159,7 +170,7 @@ void ChargeSpektrum(TString runnumber = "")
 //                         compareHistogramVector3.push_back(runs[runi]->histogramwoRTS->pixeltimefiredsorted);
 //                         compareHistogramVector.push_back(runs[runi]->histogramwoRTS->normalized->Seed);
 //                         runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS, runs[runi]->histogramwoRTS->pixeltimefired, "", 0);
-//                         runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogram->pixeltimefired, "", 0);
+                    runs[runi]->plot1DHistogram(runs[runi]->histogram, runs[runi]->histogram->Seed, "landau", 1);
 //                         runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS, runs[runi]->histogramwoRTS->pixeltimefiredsorted, "", 0, true, true);
 //                         runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS, runs[runi]->histogramwoRTS->pixeltimefired, "", 0, true, true);
 //                         runs[runi]->plot1DHistogram(runs[runi]->histogramwoRTS, runs[runi]->histogramwoRTS->LeakageCurrentInPixel, "", 0);
@@ -189,17 +200,15 @@ void ChargeSpektrum(TString runnumber = "")
     
     
     
-//     if (numberRuns>0)
-//         runs[0]->setLabel("Not irradiated");
-// //         runs[0]->setLabel("33x33 #mum, S(D)=8 #mum^2, F(D)=15 #mum^2");
-//     if (numberRuns>1)
-//         runs[1]->setLabel("10^{13} n_{eq}/cm^{2}");
-//     if (numberRuns>2)
-//         runs[2]->setLabel("10^{14} n_{eq}/cm^{2}");
-//            runs[1]->setLabel("66x33 #mum, S(D)=8 #mum^2, F(D)=15 #mum^2");
-//     if (numberRuns>2)
-//         runs[2]->setLabel("33x33 #mum, S(D)=11 #mum^2, F(D)=11 #mum^2");
-//     runs[3]->setLabel("HR18, P13, 5.0 V");
+// if (numberRuns>0)
+//     runs[0]->setLabel("Not irradiated, -20 {}^{0}C");
+// if (numberRuns>1)
+//     runs[1]->setLabel("     +20 {}^{0}C");
+// if (numberRuns>2)
+//     runs[2]->setLabel("Irradiated with Lead, Dose 4, -20 {}^{0}C");
+// if (numberRuns>3) 
+//     runs[3]->setLabel("    +20 {}^{0}C");
+
 printSummaryTable(&compareHistogramClassVector);
 printSummaryTable(&compareHistogramClassVector2);
 printSummaryTable(&compareHistogramClassVector4);
@@ -218,7 +227,8 @@ plotAllRuns(&compareHistogramClassVector4);
 plotAllRuns(&compareHistogramClassVector5);
 CompareLeageCurrent(&compareHistogramClassVector4);
 CompareLeageCurrent(&compareHistogramClassVector5);
-    writeObservableToFile();
+writeObservableToFile();
+writeOneHistogramTypeToFile(&compareHistogramClassVector);
 //     plotAllRuns("seed threshold calibrated");
 //     setCustomPath("Excel/");
 //     writeObservableToFile("seed threshold calibrated");
index a3c107836e98e796bb8995a1bf0273c918515adb..0861768b60220f681b57563447da6e2bad055ace 100644 (file)
@@ -41,6 +41,8 @@ template<typename varType> string printTableElement(varType t1, varType t2, cons
  */
 Bool_t CompareHistograms(vector<TH1F*>* ptCompareHistogramVector, TString titlestr = "", TString YAxisTitle = "");
 
+Bool_t writeOneHistogramTypeToFile(vector<HistogramType*>*);
+
 Bool_t writeObservableToFile();
 /** @brief A vector able to hold pointer of type #Run::histogramstruct
  * 
@@ -208,6 +210,56 @@ Int_t ReadRunList(std::vector<int>* runlist)
     return numberRuns;
 }
 
+Bool_t writeOneHistogramTypeToFile(vector<HistogramType*>* ptCompareHistogramClassVector)
+{
+    if (ptCompareHistogramClassVector->size() > 0)
+    { 
+        system("mkdir "+ runs[0]->savepathresults + " -p");
+        
+        TString filename = Form("%s/Spectrum_%s", runs[0]->savepathresults.Data(), ptCompareHistogramClassVector->at(0)->histogramdescription.Data());
+        
+        TString header = "";
+        for(UInt_t runi=0;runi<ptCompareHistogramClassVector->size();runi++) // loop over runs read from file
+        {
+            if (ptCompareHistogramClassVector->at(runi) != nullptr)
+            {
+               // header  += Form("#%s, %s\n", ptCompareHistogramClassVector->at(runi)->humanreadablestr.Data(), ptCompareHistogramClassVector->at(runi)->histogramdescription.Data());
+            }
+        }
+        filename+=".dat";
+        fstream* fout = new fstream(filename,ios::out);
+        for(UInt_t runi=0;runi<ptCompareHistogramClassVector->size();runi++) // loop over runs read from file
+        {
+            header += Form("Energy\tSeed\tSum\tVeto\t");
+        }
+        header += Form("\n");  
+        for(UInt_t runi=0;runi<ptCompareHistogramClassVector->size();runi++) // loop over runs read from file
+        {
+            header += Form("%s\t\t\t\t", ptCompareHistogramClassVector->at(runi)->iscalibrated?"e":"ADU");
+        }
+        header += Form("\n");  
+        for(UInt_t runi=0;runi<ptCompareHistogramClassVector->size();runi++) // loop over runs read from file
+        {
+            header += Form("%s\t%s\t%s\t%s\t", ptCompareHistogramClassVector->at(runi)->humanreadablestr.Data(), ptCompareHistogramClassVector->at(runi)->humanreadablestr.Data(), ptCompareHistogramClassVector->at(runi)->humanreadablestr.Data(), ptCompareHistogramClassVector->at(runi)->humanreadablestr.Data());
+        }    
+        *fout << header << endl;
+        TString outline;
+        for(Int_t bin=1;bin<=ptCompareHistogramClassVector->at(0)->Seed->GetNbinsX();bin++)
+        {
+            outline ="";
+            for(UInt_t runi=0;runi<ptCompareHistogramClassVector->size();runi++) // loop over runs read from file
+            {
+                outline+=Form("%.1f\t%.1f\t%.1f\t%.1f\t", ptCompareHistogramClassVector->at(runi)->Seed->GetBinCenter(bin), ptCompareHistogramClassVector->at(runi)->Seed->GetBinContent(bin), ptCompareHistogramClassVector->at(runi)->Sum->GetBinContent(bin), ptCompareHistogramClassVector->at(runi)->Veto->GetBinContent(bin));
+            }
+            *fout<<outline<<endl;
+        }
+        fout->close();
+        return 0;
+        
+    }    
+    return 0;
+}
+
 
 Bool_t writeObservableToFile()
 {
@@ -515,7 +567,7 @@ Bool_t plotAllRuns(vector<HistogramType*>* ptCompareHistogramClassVector)
         
         // legend entries
         Float_t height = ptCompareHistogramClassVector->size() * 0.055;
-        TLegend* leg1 = new TLegend(0.50,0.89-height,0.95,0.89);//(0.6,0.7,0.89,0.89);
+        TLegend* leg1 = new TLegend(0.4,0.89-height,0.95,0.89);//(0.6,0.7,0.89,0.89);
         leg1->SetTextSize(0.035);
         leg1->SetFillStyle(0);
         leg1->SetTextFont(132);
@@ -696,11 +748,18 @@ Bool_t printSummaryTable(vector<HistogramType*>* ptCompareHistogramClassVector)
         fstream* fout = new fstream(filename,ios::out);        
         
         const int width = 15;
-        cout << endlr << colorwhite << right << setw(width*9) << setfill('=') << " " << endl;
+        cout << endlr << colorwhite << right << setw(width*11) << setfill('=') << " " << endl;
         cout << left << setw(width*1) << setfill(' ')  << "Cut type: "<< left << setw(width*8) << setfill(' ')  << ptCompareHistogramClassVector->at(0)->histogramdescription << endl; filecontent += Form("Cut type: %s\n", ptCompareHistogramClassVector->at(0)->histogramdescription.Data());
         cout << left << setw(width-5) << setfill(' ') << "Runnumber"; filecontent += Form("Runnumber\t");
         cout << left << setw(width-5) << setfill(' ') << "Frames"; filecontent += Form("Frames\t");
         cout << left << setw(width-10) << setfill(' ') << "Chp#"; filecontent += Form("Chp#\t");
+        Bool_t printtemp = 1; // always print temperature
+        for (vector<HistogramType*>::iterator curHistogramClass = ptCompareHistogramClassVector->begin(); curHistogramClass != ptCompareHistogramClassVector->end(); curHistogramClass++) {
+            if ((*curHistogramClass)->labbook->temp != ptCompareHistogramClassVector->at(0)->labbook->temp)
+                printtemp = 1;
+        }
+        if (printtemp)
+            cout << left << setw(width-8) << setfill(' ') << "Temp"; filecontent += Form("Temp\t");
         cout << left << setw(width-10) << setfill(' ') << "Mtrx"; filecontent += Form("Mtrx\t");
         Float_t printradion = 0;
         for (vector<HistogramType*>::iterator curHistogramClass = ptCompareHistogramClassVector->begin(); curHistogramClass != ptCompareHistogramClassVector->end(); curHistogramClass++)
@@ -729,7 +788,7 @@ Bool_t printSummaryTable(vector<HistogramType*>* ptCompareHistogramClassVector)
 //         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");
-        cout << left << setw(width-2) << setfill(' ') << "Leakage"; filecontent += Form("Leakage cur.\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");
         cout << endl; filecontent += Form("\n");
@@ -741,6 +800,7 @@ Bool_t printSummaryTable(vector<HistogramType*>* ptCompareHistogramClassVector)
             cout << left << setw(width-5) << setfill(' ') << to_str_w_prec(curhistogramclassp->frames_found); filecontent += Form("%s\t", to_str_w_prec(curhistogramclassp->frames_found).c_str());
 //             cout << "2" << endl;
             cout << left << setw(width-10) << setfill(' ') << curhistogramclassp->labbook->chip; filecontent += Form("%s\t", curhistogramclassp->labbook->chip.Data());
+            if (printtemp) { cout << left << setw(width-8) << setfill(' ') << curhistogramclassp->labbook->temp; filecontent += Form("%.1f\t", curhistogramclassp->labbook->temp); }
 //             cout << "!" << endl;
             cout << left << setw(width-10) << setfill(' ') << curhistogramclassp->labbook->matrix; filecontent += Form("%s\t", curhistogramclassp->labbook->matrix.Data());
             if (printradion > 0) { cout << left << setw(width-5) << setfill(' ') << curhistogramclassp->labbook->radDoseIon; filecontent += Form("%.1f\t", curhistogramclassp->labbook->radDoseIon); }
@@ -754,12 +814,12 @@ Bool_t printSummaryTable(vector<HistogramType*>* ptCompareHistogramClassVector)
 //             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());
-            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((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());
             cout << "" << endl; filecontent += Form("\n");
         }
-        cout << right << setw(width*9) << setfill('=') << " " << endl;
+        cout << right << setw(width*11) << setfill('=') << " " << endl;
         *fout << filecontent << endl;
         fout->close();
     }
index e9b4f04e36b20402849fd255e80aa67db32a9558..d93731dbc7d89bb89001a27262b2d22c2b19c7a4 100644 (file)
@@ -66,7 +66,7 @@ void HistogramType::initHistogram(TH1F* &histogrampointer, TString prefix, Int_t
     histogrampointer->SetLineColor(color);
     histogrampointer->SetStats(kTRUE);        
     histogrampointer->SetStats(111111111);
-    histogrampointer->SetLineWidth(3); // TODO: set to 3 again
+    histogrampointer->SetLineWidth(2); // TODO: set to 3 again
     histogrampointer->GetXaxis()->SetTitle("Q_coll [ADU]");
     histogrampointer->GetYaxis()->SetTitle(Form("Entries [1/%.1f ADU]",histogrampointer->GetBinWidth(1)));
     histogrampointer->GetXaxis()->CenterTitle();
@@ -254,7 +254,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);
+        histogrampointernew->SetBinContent(x,histogrampointerold->GetBinContent(x)/frames_found*1000000.0);
     }
     histogrampointernew->GetYaxis()->SetTitle(Form("%s\b/(%d/1000000)]",histogrampointernew->GetYaxis()->GetTitle(), frames_found));
 }
@@ -355,6 +355,7 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType,
             histogrampointer->GetXaxis()->SetRange(histogrampointer->GetXaxis()->FindBin(noiseborder),histogrampointer->GetXaxis()->FindBin(posMaxValHist));   // look only for maxima with x greater than noiseborder, cut away noise
 //             TCanvas* canvas = new TCanvas("2121", "212121212", 900, 700);
             //             histogrampointer->Draw();if (verbose)
+            fitFunc->SetLineStyle(1); // normal for the following fits
             if (verbose)
               fitFunc->DrawCopy("same");
         } else {
@@ -362,6 +363,7 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType,
             noiseborder = FindBorderToPeak(histogrampointer, noiseborder,fitFunc->GetParameter(1), verbose); // starting point of histogram integration
             integralPeak = histogrampointer->Integral(histogrampointer->GetXaxis()->FindBin(noiseborder), histogrampointer->GetXaxis()->FindBin(posMaxValHist));
             posMax = fitFunc->GetMaximumX(); // Methode 2
+            fitFunc->SetLineStyle(1); // normal for the following fits
             if (verbose)
                 fitFunc->Draw("SAME");
         }
@@ -438,7 +440,7 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType,
         for (Int_t pari=0; pari<3; pari++)
             parameters[pari]=fitFunc->GetParameter(pari);
 //         posMax = fitFunc->GetParameter(1); // new method, just use MPV of fit, as noise border is well known. Compare with old method anyway and warn if something suspecious.
-        parameters[1]=fitFunc->GetMaximumX();
+//         parameters[1]=fitFunc->GetMaximumX();
         posMax = fitFunc->GetMaximumX(); // new method, just use MPV of fit, as noise border is well known. Compare with old method anyway and warn if something suspecious.
 //         cout << "fitFunc->GetParameter(0): " << fitFunc->GetParameter(0) << endl;
 //         cout << "fitFunc->GetParameter(1): " << fitFunc->GetParameter(1) << endl;
@@ -456,8 +458,9 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType,
         //             histogrampointer->Fit(fitFunc, "N,Q,W", "", fitMax1, histogrampointer->GetBinCenter(bini));
         fitMax3 = fitFunc->GetMaximumX();
         fitFunc->SetLineColor(kGreen);
-//                       fitFunc->DrawCopy("same");
         fitFunc->SetLineStyle(1); // normal for the following fits
+        if (verbose)
+            fitFunc->DrawCopy("same");
         
         //Sort the three fits and save error estimation
         minFitMax = TMath::Min(TMath::Min(fitMax1,fitMax2),fitMax3);
@@ -493,6 +496,9 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType,
         //             fitFcn->FixParameter(0,21655.90045);
         //             fitFcn->FixParameter(1,34.31885101);
         fitFcn->FixParameter(2,histogrampointer->GetXaxis()->GetBinCenter((int)(histogrampointer->GetXaxis()->GetNbins()/2.0+0.5)));
+        fitFcn->SetLineStyle(1); // normal for the following fits
+        if (verbose)
+            fitFcn->DrawCopy("same");
         //             fitFcn->FixParameter(3,-22.43016284);
         
         //histogrampointer->Fit("fitFcn","V+","ep");
@@ -583,7 +589,7 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType,
 //         histogrampointer->Fit(fitFunc, "N,M,W,Q", "", noiseborder, posMaxValHist);           
 //         for (Int_t pari=0; pari<6; pari++)
 //             parameters[pari]=fitFunc->GetParameter(pari);     
-        parameters[1] = parameters[1] + histogrampointer->GetBinWidth(0);
+        parameters[1] = parameters[1] - histogrampointer->GetBinWidth(0)*2;
 
         
         parameters[7] = FindBorderToPeak(histogrampointer, noiseborder,def_peakcenter, verbose); // starting point of histogram integration
@@ -596,7 +602,8 @@ Double_t* HistogramType::FitPerform(TH1F* histogrampointer, TString fitFuncType,
 //         TCanvas* canvas = new TCanvas(histogrampointer->GetName(), histogrampointer->GetName(), 900, 700);
 //         histogrampointer->Draw();
 //         fitFunc->Draw("SAME");
-        
+
+        fitFunc->SetLineStyle(1); // normal for the following fits
         if (verbose)
             fitFunc->Draw("SAME");
         
index ff71db10508277af0e5318e29a79a660a6bf7739..4c85ccdc52c4edd4c2c8265d640587c75ee5001d 100644 (file)
@@ -193,7 +193,7 @@ public:
     * It is set as a multiply of the standard deviation
     *      
     */
-    Float_t RTSthreshold = 5;
+    Float_t RTSthreshold = 4;
     
     //*****************
     // GETTER AND SETTER
index 0ff60f36038e5112e4030a32673bbae6941f40a4..77b13c8056d52c745632cf77d181ccec2034bcc2 100644 (file)
@@ -69,7 +69,7 @@ Bool_t MAPS::initNewRootFile() {
         fNoiseTree->Branch("pixelnumber", &fNoiseInfo.pixelnumber    , "pixelnumber/i"     , 32000);
         fNoiseTree->Branch("noise"      , &fNoiseInfo.fNoise[0]    , "noise[pixelnumber]/F"     , 32000);
         fNoiseTree->Branch("pedestal"   , &fNoiseInfo.fPedestals[0] , "pedestal[pixelnumber]/F"  , 32000);
-        fNoiseTree->Branch("F0"         , &fNoiseInfo.fF0[0] ,       "F0[pixelnumber]/i"  , 32000);
+        fNoiseTree->Branch("AvgF0"   , &fNoiseInfo.AvgF0 , "AvgF0/D"  , 32000);
                 
         initHistograms();
         cout<<"-----------------------"<<endl;
@@ -119,7 +119,7 @@ Bool_t MAPS::initOldRootFile() {
     fNoiseTree->SetBranchAddress("frame"      , &fFrameInfo.frame);
     fNoiseTree->SetBranchAddress("noise"      , &fNoiseInfo.fNoise[0]);
     fNoiseTree->SetBranchAddress("pedestal"   , &fNoiseInfo.fPedestals[0]);
-    fNoiseTree->SetBranchAddress("F0"          , &fNoiseInfo.fF0[0]);
+    fNoiseTree->SetBranchAddress("AvgF0"      , &fNoiseInfo.AvgF0);
     
     initHistograms();  
     cout<<"-----------------------"<<endl;
@@ -399,8 +399,7 @@ bool MAPS::checkConf( Int_t &PixelData ) {
         fCdsmatrix  = new Float_t       [fPixelsData]();
         fHittedPixel= new Int_t     [fPixelsData]();
         fNoiseInfo.fNoise      = new Float_t   [fPixelsData]();
-        fNoiseInfo.fPedestals  = new Float_t   [fPixelsData]();   
-        fNoiseInfo.fF0  = new Int_t   [fPixelsData]();          
+        fNoiseInfo.fPedestals  = new Float_t   [fPixelsData]();           
         //-----------------------------------------------
         return true;
     }
@@ -436,7 +435,6 @@ bool MAPS::defaultConf(  ) {
     fHittedPixel= new Int_t     [fPixelsData]();
     fNoiseInfo.fNoise      = new Float_t   [fPixelsData]();
     fNoiseInfo.fPedestals  = new Float_t   [fPixelsData](); 
-    fNoiseInfo.fF0        = new Int_t   [fPixelsData]();  
     //-----------------------------------------------
     return true;
 }
@@ -668,8 +666,8 @@ bool MAPS::getFrame(UInt_t FrameNumber) {
                 fF1matrix   [i] = value2    [(UChar_t)RAWDATA[4*i]] [(UChar_t)RAWDATA[4*i+1]];
             }
             fCdsmatrix  [i] = fF0matrix[i] - fF1matrix[i];
-            fNoiseInfo.fF0[i] = fF0matrix[i];   
         }
+//         cout << fCdsmatrix  [50] << "  " << " Frame: "<< FrameNumber << "  ";
         //==========================================================================
         // -----------------
         // If pixel array is different from 'standard',
@@ -821,6 +819,8 @@ bool MAPS::InitialDynNoise(Int_t startframe, Int_t frames) {
             startframe = 0;
         if (startframe+frames>=GetNumberFrames())
             startframe=GetNumberFrames()-frames;
+                
+        fNoiseInfo.AvgF0=0;
         
         // first estimate
         // sum up over all frames every CDS value, pixelwise
@@ -832,14 +832,18 @@ bool MAPS::InitialDynNoise(Int_t startframe, Int_t frames) {
             
             for(Int_t pixeli=0; pixeli<fPixels; pixeli++)
             {
+                // Average F0 value
+                fNoiseInfo.AvgF0+=fF0matrix[pixeli];          
+                
                 fNoiseInfo.fPedestals[pixeli] += fCdsmatrix[pixeli];
             }
         }
         // calculate average pedestal of each pixel
         for(Int_t pixeli=0; pixeli<fPixels; pixeli++)
         {
-            fNoiseInfo.fPedestals[pixeli] /= frames;
+            fNoiseInfo.fPedestals[pixeli] /= frames;   
         }
+        fNoiseInfo.AvgF0/=frames*fPixels;  
         
         // sum up over all frames every variance from the pedestial, pixelwise
         for(Int_t framei=startframe; framei<frames+startframe; framei++)
@@ -1016,11 +1020,13 @@ void MAPS::debugStream(const arraytype* (a), Int_t n, Int_t columns, Int_t preci
 bool MAPS::regetDynNoise(Int_t Frames) {
     Bool_t pedestalhighinthisframe = false;
     Bool_t noisehighinthisframe = false;
+    fNoiseInfo.AvgF0=0;
     for(Int_t pixeli=0; pixeli<fPixels; pixeli++)
     {
         //         if (fHittedPixel[fColumns]==0)
         if (fHittedPixel[pixeli]==0)
         {
+            fNoiseInfo.AvgF0+=fF0matrix[pixeli];
             if (useexponentialdecayingnoisewindow)
             {
                 fNoiseInfo.fNoise[pixeli]     = TMath::Sqrt(( (Frames-2)*TMath::Power(fNoiseInfo.fNoise[pixeli],2) + TMath::Power(1.*fCdsmatrix[pixeli]-fNoiseInfo.fPedestals[pixeli],2) )/(Frames-1));
@@ -1034,7 +1040,7 @@ bool MAPS::regetDynNoise(Int_t Frames) {
                 fNoiseInfo.fPedestals[pixeli] -= (CDSlastframes[pixeli].front()-fCdsmatrix[pixeli])/CDSlastframes[pixeli].size();
                 CDSlastframes[pixeli].pop();
                 CDSlastframes[pixeli].push(fCdsmatrix[pixeli]);
-            }
+            }            
             if (abs(fNoiseInfo.fPedestals[pixeli])>20)
             {
                 fPedestalhighPixel++;
@@ -1076,6 +1082,8 @@ bool MAPS::regetDynNoise(Int_t Frames) {
             //             cout << "Skipped pixel " << pixeli << " for noise calc in frame " << fFrameNumber << ", because fHittedPixel: " << fHittedPixel[pixeli]  << endl;
         }        
     }
+//     cout << "fNoiseInfo.AvgF0 : " << fNoiseInfo.AvgF0 << endl;
+    fNoiseInfo.AvgF0/=fPixels;  
     //     if (pedestalhighinthisframe)
     //         cout<<"\rFrame: "<<fFrameNumber<< " --> Pedestal suspiciously high!"<<endl;
     //     if (noisehighinthisframe)
@@ -1541,8 +1549,11 @@ void MAPS::hitana() {
                         }
                     }
                 }
+//                 cout<<"Frame : " << fFrameNumber << ", hit: " << hit << ", bordercluster: " << (bordercluster?"Yes":"No") << endl;
+//                 
 //                       cout<<"Hitted pixel discriminator matrix:"<<endl;
 //                       debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
+                      
                 if (bordercluster)
                     fHittedPixel[Hitlist[hit]] = -2;
                 else
@@ -1555,19 +1566,22 @@ void MAPS::hitana() {
                     {
                         fFrameInfo.p [clupos][fHits] = pixelchargeincluster[clupos];
                     }
-                    // for(Int_t row=0; row<5; row++)
-                    // {
-                    // for(Int_t column=0; column<5; column++)
-                    // {
-                    // std::cout.width(10);
-                    // std::cout << std::fixed;
-                    // std::cout << std::left << std::setprecision(2) << pixelchargeincluster[row*5+column];
-                    // }
-                    // cout << endl;
-                    // }
-                    // cout << endl;
+                    
+                    // comment me out
+//                     for(Int_t row=0; row<5; row++)
+//                     {
+//                         for(Int_t column=0; column<5; column++)
+//                         {
+//                             std::cout.width(10);
+//                             std::cout << std::fixed;
+//                             std::cout << std::left << std::setprecision(2) << pixelchargeincluster[row*5+column];
+//                         }
+//                         cout << endl;
+//                     }
+//                     cout << endl;
+
                     // if cluster charge > clusternoise * const
-                    if(fOrderCode=="FSBB")
+                    if(fOrderCode=="FSBB" || fOrderCode=="Mi19")
                     {
                         if (1.0*chargesumincluster4 > noisesumincluster4*6.0)
                             fFrameInfo.pixelthreshold[fHits] = Hitlist[hit];
@@ -1655,6 +1669,7 @@ void MAPS::hitana() {
 void MAPS::filterCommonMode() {
 
     Float_t CommonModeInRow = 0;
+    Float_t AverageF0InRow = 0;
     bool warning;
 
     Float_t* Arr = new Float_t[fColumns]();
@@ -1663,11 +1678,16 @@ void MAPS::filterCommonMode() {
     {
         warning  = false;
         CommonModeInRow = 0;
+        AverageF0InRow = 0;
         
         for(int column=0; column<fColumns; column++ )
         {
             Arr[column] = fCdsmatrix[ row*fColumns+column ] - fNoiseInfo.fPedestals[ row*fColumns+column ];    // Bugfix: Considered pedestals in common mode calculation
+            AverageF0InRow += fF0matrix[row*fColumns+column];
+//             cout << Arr[column] << "  ";
         }
+//         cout << endl;
+        AverageF0InRow /= fColumns;
         
         CommonModeInRow = TMath::Median(fColumns, Arr); // Don't use mean, consider hitted pixel !
         if (CommonModeInRow < 0)
@@ -1675,10 +1695,12 @@ void MAPS::filterCommonMode() {
         else
             minus++;
         
-        if(TMath::Abs(CommonModeInRow)>1000) // TODO better warning criteria
+        if(TMath::Abs(CommonModeInRow)>AverageF0InRow/10.0) // more than 10 % correction
         {
             warning = true;
         }
+//         cout << "CommonModeInRow: " << CommonModeInRow << endl;
+//         cout << "AverageF0InRow: " << AverageF0InRow << endl;
         if(warning) { cout<<"\rFrame: "<<fFrameNumber<< " row: " << row << " Median of row: " << CommonModeInRow <<  " --> Common Mode suspiciously high!               "<<endl; 
             debugStream<>(fCdsmatrix, fPixels, fColumns, 1, 20);
             debugStream<>(Arr, fColumns, fColumns, 1, 20);
@@ -1701,22 +1723,22 @@ void MAPS::plotFrame(Int_t FrameNumber) {
     else {
         cout <<endl <<endl << colorwhite << "---------------- FRAME " << fFrameNumber << " ----------------" << colorreset << endl << endl;
         cout<<"F0 matrix:"<<endl;
-        debugStream<>(fF0matrix, fPixels/fColumns, fColumns, 0, 39);
+        debugStream<>(fF0matrix, fPixels, fColumns, 0, 39);
         cout<<"F1 matrix:"<<endl;
-        debugStream<>(fF1matrix, fPixels/fColumns, fColumns, 0, 39);
+        debugStream<>(fF1matrix, fPixels, fColumns, 0, 39);
         
         cout<<"CDS matrix:"<<endl;
-        debugStream<>(fCdsmatrix, fPixels/fColumns, fColumns, 0, 39);
+        debugStream<>(fCdsmatrix, fPixels, fColumns, 0, 39);
         Float_t cdsmatrixCorrPed[fPixels];
         for(Int_t i=0; i<fPixels; i++)
         {
             cdsmatrixCorrPed[i]=(float)(1.*fCdsmatrix[i]-fNoiseInfo.fPedestals[i]);
         }
         cout<<"CDS matrix minus pedestals:"<<endl;
-        debugStream<>(cdsmatrixCorrPed, fPixels/fColumns, fColumns, 0, 10);
+        debugStream<>(cdsmatrixCorrPed, fPixels, fColumns, 0, 10);
 //         cout<<fCdsmatrix[0]<<","<<fCdsmatrix[1]<<","<<fCdsmatrix[2]<<","<<fCdsmatrix[3]<<","<<fCdsmatrix[4]<<","<<fCdsmatrix[5]<<","<<fCdsmatrix[6]<<endl;
         cout<<"Hitted pixel discriminator matrix:"<<endl;
-        debugStream<>(fHittedPixel, fPixels/fColumns, fColumns, 1, 1);
+        debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
         
         TCanvas* cm1 = new TCanvas(Form("Frame %d",FrameNumber),Form("Frame %d",FrameNumber),50,100,1200,800);
         cm1->Divide(2,3);
index e469c018b73d972aeb15a4c8a1af3ca85a7f0e16..c337c71be84cf36d7c7bb7a0a4d2ff001abdff50 100644 (file)
@@ -246,11 +246,12 @@ Bool_t Run::debugDBreadout()
 void Run::setSystemSpecificParameters()
 {    
 //     systemparam systemparamUSB (2800/*maxbin*/,2800/4/*nbins*/, 25/*vetothreshold*/, 10/*maxbinnoise*/, 100/*nbinsnoise*/); // TODO: uncomment and add again old binning
-    systemparam systemparamUSB (2800/*maxbin*/,2800/4/*nbins*/, 25/*vetothreshold*/, 10/*maxbinnoise*/, 100/*nbinsnoise*/);
+    systemparam systemparamUSB (2800/*maxbin*/,2800/6/*nbins*/, 25/*vetothreshold*/, 10/*maxbinnoise*/, 100/*nbinsnoise*/);
     systemparam systemparamPegasus (2800,2800/2,20,10,100);
     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 (2800,2800/4,15,10,100);
     if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("Mi34") )
         cursystemparam = systemparamUSB;
     else if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("FSBB") )
@@ -261,6 +262,8 @@ void Run::setSystemSpecificParameters()
         cursystemparam = systemparamPegasus;
     if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("Mi19") )
         cursystemparam = systemparamUSBMi19;
+    if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("Pipper2") )
+        cursystemparam = systemparamPipper2;
     else if (labbook.system.EqualTo("USB")) // && labbook.chipGen.EqualTo("34") )
         cursystemparam = systemparamUSB;
     
@@ -274,6 +277,7 @@ void Run::setSensorInSystemParam()
     sensorinfostruct sensorinfoPegasus( 8, 56 );
     sensorinfostruct sensorinfoFSBB( 4, 416 );
     sensorinfostruct sensorinfoMi19USB( 192, /* rows */  192 /* columns */   );
+    sensorinfostruct sensorinfoPipper2( 8, 128 );
     
     if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("Mi34") )
         cursensorinfo=sensorinfoMi34USB;
@@ -285,6 +289,8 @@ void Run::setSensorInSystemParam()
         cursensorinfo=sensorinfoPegasus;
     else if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("Mi19") )
         cursensorinfo=sensorinfoMi19USB;
+    else if (labbook.chipGen.EqualTo("Pipper2") )
+        cursensorinfo=sensorinfoPipper2;
 }
 
 void Run::setMatrixSpecificParameters()
@@ -396,7 +402,7 @@ Bool_t Run::analyzeRun(Bool_t force)
             processed->InitialDynNoise();
             int start   = 0;
             int nframes = processed->GetNumberFrames();
-//             for(int i=0; i<200;i++) // TODO remove 100000 run 342272
+//             for(int i=0; i<1000;i++) // TODO remove 100000 run 342272
             for(int i=0; i<nframes;i++) // TODO remove 100000 run 342272
             {
 //                 cout << "getframe " << i << endl;
@@ -428,6 +434,7 @@ Bool_t Run::analyzeRun(Bool_t force)
             cout << colorwhite << "initOldRootFile():" << endlr;
         }
         if (processed->initOldRootFile()) return 1;
+        cout << colorcyan << "9TEST" << endlr;
         frames_found = processed->GetNumberFrames();
 //         cout << colorwhite << "plotPixSignal():"<< flush << endlr;
 //         processed->plotPixSignal(0,10000000,351);
@@ -438,10 +445,12 @@ Bool_t Run::analyzeRun(Bool_t force)
             cout << "Processing histograms in class: <" << colorwhite << (*curHistogramClass)->histogramdescription << colorreset << " >" << endlr;
             if ((*curHistogramClass)->maskRTSpixel) {
                 cout << colorwhite << " FindRTSPixelToMask():" << endlr;
-                FindRTSPixelToMask(*curHistogramClass);
+//                 FindRTSPixelToMask(*curHistogramClass);
             }
         }
         cout << "--------------------------------------------" << endl;
+        cout << colorwhite << "binF0():" << endlr;  
+        binF0();         
         cout << colorwhite << "binSeedSumVeto():" << endlr;  
         binSeedSumVeto(); 
 //         cout << colorwhite << "binCluster():" << endlr;
@@ -709,13 +718,15 @@ Bool_t Run::analyzeFrame(Int_t frame)
         int entries = processed->GetNumberFrames();
         if (frame < entries)
         {
-            processed->InitialDynNoise(100);
+            processed->InitialDynNoise();
             processed->getFrame(frame);
             if (commonModeFilter)
                 processed->filterCommonMode();
             processed->hitana();
+            if (dynamicalNoise)
+                processed->regetDynNoise();
             processed->plotFrame(frame);
-            delete processed;
+//             delete processed;
             return 0;
         }
         else
@@ -723,7 +734,7 @@ Bool_t Run::analyzeFrame(Int_t frame)
             cout << "\033[1;33mFrame number too big, max frame: " << entries << "\033[0m" << endl;
         }
     }
-    delete processed;
+//     delete processed;
     return 1;
 }
 
@@ -941,6 +952,8 @@ void Run::updateDatabase() {
     constructUpdateString(&sqlupdatequery, "Gain",       histogramthreshold->normalized->gain);
     constructUpdateString(&sqlupdatequery, "SumPeak",    histogramthreshold->normalized->posSum, 4);
     constructUpdateString(&sqlupdatequery, "SeedPeak",   histogramthreshold->normalized->posSeed, 4);
+    constructUpdateString(&sqlupdatequery, "AvgF0",   labbook.averageF0, 6);
+    constructUpdateString(&sqlupdatequery, "SigmaF0",   labbook.sigmaF0, 6);
     constructUpdateString(&sqlupdatequery, "VetoPeak",   histogramthreshold->normalized->posVeto, 4);
     constructUpdateString(&sqlupdatequery, "VetoIntegral",   histogramthreshold->normalized->integralVeto, 10);
     constructUpdateString(&sqlupdatequery, "SumIntegral",   histogramthreshold->normalized->integralSum, 10);
@@ -1092,15 +1105,15 @@ Bool_t Run::binLeakageCurrent(HistogramType* oneHistogramClass)
     
 //     cout << colorcyan << "oneHistogramClass->avgLeakageCurrentInChip: " << oneHistogramClass->avgLeakageCurrentInChip << endlr;
 //     cout << colorcyan << "oneHistogramClass->medianLeakageCurrent: " << oneHistogramClass->medianLeakageCurrent << endlr;
-    TCanvas *c1 = new TCanvas("c1","c1",600,400);
-    TH2F *hcandle = new TH2F("hcandle","Option CANDLE6 example ",40,-4,4,40,-20,20);
-    Float_t px, py;
-    for (Int_t pixeli=0; pixeli < oneHistogramClass->LeakageCurrentInPixel->GetNbinsX(); pixeli++) {
-        hcandle->Fill(1,oneHistogramClass->LeakageCurrentInPixel->GetBinContent(pixeli));
-    }
-    hcandle->SetMarkerSize(0.5);
-    hcandle->SetBarWidth(1.0);
-    hcandle->Draw("CANDLEX5");
+//     TCanvas *c1 = new TCanvas("c1","c1",600,400);
+//     TH2F *hcandle = new TH2F("hcandle","Option CANDLE6 example ",40,-4,4,40,-20,20);
+//     Float_t px, py;
+//     for (Int_t pixeli=0; pixeli < oneHistogramClass->LeakageCurrentInPixel->GetNbinsX(); pixeli++) {
+//         hcandle->Fill(1,oneHistogramClass->LeakageCurrentInPixel->GetBinContent(pixeli));
+//     }
+//     hcandle->SetMarkerSize(0.5);
+//     hcandle->SetBarWidth(1.0);
+//     hcandle->Draw("CANDLEX5");
 //     gPad->BuildLegend(0.6,0.7,0.7,0.8);
     
     return 0;
@@ -1141,6 +1154,40 @@ Bool_t Run::binNoise(HistogramType* oneHistogramClass)
     return 0;
 }
 
+Bool_t Run::binF0()
+{
+    averageF0Hist =new TH1F(Form("%d AvgF0",labbook.runnumber), Form("%d AvgF0",labbook.runnumber), processed->fHitTree->GetEntries(), 0, processed->fHitTree->GetEntries());  
+    averageF0Hist->SetLineStyle(rootlinestyle[plotStyle]); 
+    averageF0Hist->SetLineColor(rootcolors[plotStyle]);
+    averageF0Hist->SetStats(kTRUE);        
+    averageF0Hist->SetStats(111111111);
+    averageF0Hist->SetLineWidth(3); // TODO: set to 3 again
+    averageF0Hist->GetXaxis()->SetTitle("time [frame]");
+    averageF0Hist->GetYaxis()->SetTitle("AverageF0");
+    averageF0Hist->GetXaxis()->CenterTitle();
+    averageF0Hist->GetYaxis()->CenterTitle();
+    labbook.averageF0 = 0;
+    labbook.sigmaF0 = 0;
+    for (Int_t framei=0; framei<processed->fHitTree->GetEntries(); framei++) // loop over all frames
+    {
+        processed->fHitTree->GetEntry(framei);
+        Float_t avgF0InCurFrame = processed->fNoiseInfo.AvgF0;
+        averageF0Hist->SetBinContent(framei, avgF0InCurFrame);
+        labbook.averageF0+=avgF0InCurFrame;
+//         labbook.averageF0 + = avgF0InCurFrame;
+    }
+    labbook.averageF0 /= processed->fHitTree->GetEntries();   
+    for (Int_t framei=0; framei<processed->fHitTree->GetEntries(); framei++) // loop over all frames
+    {
+        Float_t avgF0InCurFrame = processed->fNoiseInfo.AvgF0;
+        labbook.sigmaF0 += pow(avgF0InCurFrame-labbook.averageF0,2);
+        //         labbook.averageF0 + = avgF0InCurFrame;
+    }
+    labbook.sigmaF0 /= processed->fHitTree->GetEntries();
+    labbook.sigmaF0 = sqrt(labbook.sigmaF0);
+    return 0;
+}
+
 Bool_t Run::binSeedSumVeto()
 {        
     /// collected charge in cluster
@@ -1175,7 +1222,7 @@ Bool_t Run::binSeedSumVeto()
                     // sum histogram
                     pixelSum = 0;
                     notSeedSum = 0;
-                    if(labbook.chipGen=="FSBB")
+                    if(labbook.chipGen=="FSBB" || labbook.chipGen=="Mi19")
                     {  
                         Float_t clusterArray[processed->clustersize*processed->clustersize];// temp variable clusterArray necessary, because Sort only accepts 1-dim arrays
                         Int_t index[processed->clustersize*processed->clustersize];
@@ -1323,6 +1370,14 @@ Bool_t Run::binSeedSumVeto()
             (*curHistogramClass)->posVeto = parameters[1];
             if (labbook.runnumber == 343056)
                 (*curHistogramClass)->posVeto = 234;
+            if (labbook.runnumber == 345045)
+                (*curHistogramClass)->posVeto = 425;
+            if (labbook.runnumber == 342824)
+                (*curHistogramClass)->posVeto = 425;
+            if (labbook.runnumber == 342265)
+                (*curHistogramClass)->posVeto = 417;
+            if (labbook.runnumber == 345054)
+                (*curHistogramClass)->posVeto = 417;
             //             cout << (*curHistogramClass)->histogramdescription << ": " << colorcyan <<  parameters[1] << endlr;
             (*curHistogramClass)->integralVeto = parameters[6];
         }
@@ -2163,6 +2218,7 @@ Bool_t Run::writeAllHistogramsToFile()
     TString header = Form("#%s %lu frames\n", runcode.Data(), frames_found);
     header += Form("#posVeto, run: %.1f, DB: %.1f, Fe55 DB (%d, %.1f): %.1f\n", histogram->posVeto, labbook.posVetoDB, Fe55run.posVetorunnumber, Fe55run.temperature, Fe55run.posVeto);
     header += Form("#\t\t");
+    
     for (vector<HistogramType*>::iterator curHistogramClass = HistogramClassVector.begin(); curHistogramClass != HistogramClassVector.end(); curHistogramClass++)  {
         header += Form("%s\t\t\tnorm.\t\t\t", (*curHistogramClass)->histogramdescription.Data());
     }      
index f656de396df575d05de482df8649b32548007c2a..d4345eec875fbddf88b0d31495a611050d5835b8 100644 (file)
@@ -158,6 +158,10 @@ private:
     /**
      * @brief fills Seedm, Sum and Veto #Run::histogramstruct  */
     Bool_t binSeedSumVeto();
+    
+    /**
+     * @brief fills averageF0Hist with average F0 values  */
+    Bool_t binF0();
     /**
      * @brief fills the average cluster distribution into a 2 dimension histogram #Run::histogramstruct */
     Bool_t binCluster();
@@ -224,7 +228,7 @@ private:
     
     /** @brief finds and and masks RTS pixel if maskRTSpixel isset to true */
     Bool_t FindRTSPixelToMask(HistogramType* histogramtypepointer);
-    
+            
 public:
     /** @brief empty constructor */
     Run    (void);
@@ -402,6 +406,9 @@ public:
     // holds all used HistogramType classes
     vector<HistogramType*> HistogramClassVector;
     
+    /** @brief The average F0 value of the run over the complete chip in dependance of the time */
+    TH1F* averageF0Hist = 0;
+    
             
     /** @brief Plots all histograms from #Run::HistogramType into one canvas 
      *
index bf71c366c7b69fd0c44482f8ef7c5f6d955d670c..cebec7f9fd487714df8b4894865f4aa392f56cd3 100644 (file)
@@ -151,7 +151,7 @@ struct noiseInfo{
     /// Array with pedestial information of given pixel
     Float_t*    fPedestals; //[MAXPIXELS];
     // Array with F0 information of given pixel
-    Int_t* fF0;
+    Double_t AvgF0;
 };
 
 
@@ -265,6 +265,9 @@ struct labbooksctruct
     Float_t percentageofRTSpixel = -1;
     /// percentage of pixel showing RTS signature
     Float_t HitsInRTSpixel = -1;
+    /// average F0 in current run
+    Float_t averageF0 = -1;
+    Float_t sigmaF0 = -1;
 };
 
 void preparecanvas() {