]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
Run analyzer: Benny is cleaning the code, adding comments
authorAli Yazgili <ayazgili@jspc32.x-matter.uni-frankfurt.de>
Tue, 28 Nov 2017 10:26:26 +0000 (11:26 +0100)
committerAli Yazgili <ayazgili@jspc32.x-matter.uni-frankfurt.de>
Tue, 28 Nov 2017 10:26:26 +0000 (11:26 +0100)
MABS_run_analyzer/ChargeSpektrumFunctions.c
MABS_run_analyzer/Run.c

index 734b607cc2b8d42e716aebb061e0861170a3197d..f7ed149fdeaff7414b50536255c2c2ed0a7a0a92 100644 (file)
@@ -1384,7 +1384,7 @@ Bool_t printSummaryTable(vector<HistogramType*>* ptCompareHistogramClassVector)
             //             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());
             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()); }
-            if (printLeakage > 0.0) { 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()); }
+            if (printLeakage > 0.0) { cout << left << setw(width+2) << setfill(' ') << printTableElement((float)curhistogramclassp->medianLeakageCurrent,(float)ptCompareHistogramClassVector->at(0)->medianLeakageCurrent,2); 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());
             if (printnsethr > 0) { 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");
index 93faba2f4ef019f25b42ae3cc4b9312092c1f04d..f43a7e732f624c5761f89fe796f68d489db06c37 100644 (file)
@@ -1620,11 +1620,12 @@ Bool_t Run::binSeedSumVeto()
                                 if (histogramdynamicalthreshold->fixedThresholdValue <= 0) {
                                     Float_t highestval = histogram->Seed->GetMaximum();
                                     float_t cutval = (*histogram->Sum)->GetBinCenter((*histogram->Sum)->FindLastBinAbove(highestval/4,1));
+                                    cout << " Setting 'maybe better' noise border for 'histogramdynamicalthreshold' cut class" << endlr;
                                     setFixedThresholdValueADU(histogramdynamicalthreshold, cutval*0.6); // change back to *0.8
                                 }
                                 if (pixelSum > histogramdynamicalthreshold->fixedThresholdValue) // charge is more then histogramdynamicalthreshold->fixedThresholdValue in whole cluster
                                 {
-                                    histogramdynamicalthreshold->numberofhits++;                            
+                                    histogramdynamicalthreshold->numberofhits++;        
                                     fillAHistogramsinclass(histogramdynamicalthreshold, hiti, completeclustersize, pixelSum, notSeedSum, &a_pixelSum[0], &a_notSeedSum[0], pixelSum25, notSeedSum25, &a_pixelSum25[0], &a_notSeedSum25[0], pixelSum9, notSeedSum9, &a_pixelSum9[0], &a_notSeedSum9[0]);
                                 }
                             }
@@ -1633,7 +1634,8 @@ Bool_t Run::binSeedSumVeto()
                             // bin the fixed threshold for charge histogram class
                             if (histogramfixedthreshold != 0 && histogram != 0) {
                                 if (histogramfixedthreshold->fixedThresholdValue <= 0) {
-                                    setFixedThresholdValueADU(histogramfixedthreshold, 30); // change back to *0.8
+                                    cout << " Setting fixed noise border for 'histogramfixedthreshold' cut class" << endlr;
+                                    setFixedThresholdValueADU(histogramfixedthreshold, 30);
                                 }
                                 if (pixelSum > histogramfixedthreshold->fixedThresholdValue) // charge is more then histogramfixedthreshold->fixedThresholdValue in whole cluster
                                 {
@@ -1642,8 +1644,8 @@ Bool_t Run::binSeedSumVeto()
                                 }
                             }
                             
-                            if (histogramGoodVeto != 0 && histogram != 0) {
-                                if (framei == 0) { // only one time job, do while in first frame only
+                            if (histogramGoodVeto != 0 && histogram != 0) { // histogramGoodVeto not used any more
+                                if (framei == 0) { // only one time job, do one time only, main job was done in first fill round, see 'filli == 1' above
                                     histogram->FindNoisethresholdborder(histogram->Seed, false, false);
                                     if (labbook.source.Contains("Fe")||labbook.source.Contains("Cd")) {
                                         parameters = histogram->FitPerform(histogram->Veto, "GaussTail");
@@ -1661,7 +1663,7 @@ Bool_t Run::binSeedSumVeto()
                                 
                         } else if (filli == 2) { // third fill round, some histograms are allready filled
                             
-                            if (histogramGoodVeto != 0 && histogram != 0) {
+                            if (histogramGoodVeto != 0 && histogram != 0) {// histogramGoodVeto not used any more
                                 
                                 if (framei == 0) { // only one time job, do while in first frame only
                                     uint numberofgoodvetopixels = 0;
@@ -1695,10 +1697,15 @@ Bool_t Run::binSeedSumVeto()
     //     gROOT->SetBatch(kTRUE);
     for (vector<HistogramType*>::iterator curHistogramClass = HistogramClassVector.begin(); curHistogramClass != HistogramClassVector.end(); curHistogramClass++)  {
         Double_t* parameters = (Double_t *)calloc(11, sizeof(Double_t)); // allocate 11 parameters for safety, maximum 10 used at the moment     
+        
+                                cout << colorcyan << "Start fitting" << endlr;
+                                cout << colorcyan << (*curHistogramClass)->histogramdescription << endlr;
         (*curHistogramClass)->FindNoisethresholdborder((*curHistogramClass)->Seed, false, false);
         if (labbook.runnumber == 343056)
             (*curHistogramClass)->noisethresholdborder = 34;
         if (labbook.source.Contains("Fe")||labbook.source.Contains("Cd")) {
+            
+            cout << colorcyan << "Veto" << endlr;
             parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->Veto, "GaussTail");
             (*curHistogramClass)->posVeto = parameters[1];
             if (labbook.runnumber == 343056)
@@ -1714,6 +1721,7 @@ Bool_t Run::binSeedSumVeto()
             //             cout << (*curHistogramClass)->histogramdescription << ": " << colorcyan <<  parameters[1] << endlr;
             (*curHistogramClass)->integralVeto = parameters[6];
         }
+        cout << colorcyan << "Seed" << endlr;
         if (labbook.chipGen.EqualTo("Pipper2") || labbook.chipGen.EqualTo("Pegasus")) 
             parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->Seed, "gaus", 0, false, (*curHistogramClass)->fixedThresholdValue);
         else
@@ -1721,6 +1729,8 @@ Bool_t Run::binSeedSumVeto()
         (*curHistogramClass)->integralSeed = parameters[6];
         (*curHistogramClass)->posSeed = parameters[1];
         (*curHistogramClass)->integralSeedErr = parameters[9];
+        
+        cout << colorcyan << "Sum" << endlr;
         parameters = (*curHistogramClass)->FitPerform((*(*curHistogramClass)->Sum), "gaus", 0, false, (*curHistogramClass)->fixedThresholdValue); //TODO change back to gauss
         (*curHistogramClass)->posSum = parameters[1];
         (*curHistogramClass)->integralSum = parameters[6];
@@ -1729,6 +1739,7 @@ Bool_t Run::binSeedSumVeto()
         for (Int_t bini = 1; bini <= (*curHistogramClass)->clustermultiplicity->GetNbinsX(); bini++) {
             (*curHistogramClass)->clustermultiplicity->SetBinContent(bini, (*curHistogramClass)->clustermultiplicity->GetBinContent(bini)/(*curHistogramClass)->numberofhits); }
         
+        cout << colorcyan << "Sum9" << endlr;
         for (u_int sumi = 0; sumi < (*curHistogramClass)->a_Sum9.size(); sumi++) {
             //             Float_t integratestart = (*curHistogramClass)->FindNoisethresholdborder((*curHistogramClass)->a_Sum[sumi], false, false);
             //             parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->a_Sum[sumi], "gaus", 0, false, integratestart); //TODO change back to gauss
@@ -1737,6 +1748,7 @@ Bool_t Run::binSeedSumVeto()
             (*curHistogramClass)->a_integralSum9.push_back(parameters[6]);
             (*curHistogramClass)->a_integralSumErr9.push_back(parameters[9]);
         }
+        cout << colorcyan << "Sum25" << endlr;
         for (u_int sumi = 0; sumi < (*curHistogramClass)->a_Sum25.size(); sumi++) {
             //             Float_t integratestart = (*curHistogramClass)->FindNoisethresholdborder((*curHistogramClass)->a_Sum[sumi], false, false);
 //             parameters = (*curHistogramClass)->FitPerform((*curHistogramClass)->a_Sum[sumi], "gaus", 0, false, integratestart); //TODO change back to gauss
@@ -1746,6 +1758,7 @@ Bool_t Run::binSeedSumVeto()
             (*curHistogramClass)->a_integralSumErr25.push_back(parameters[9]);
         }
         
+        cout << colorcyan << "SeedPerc" << endlr;
         parameters =(*curHistogramClass)->FitPerform((*curHistogramClass)->SeedPerc, "landau");
         (*curHistogramClass)->posSeedPerc = parameters[1];
         (*curHistogramClass)->sigmaSeedPerc = parameters[2];