]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
Run analyzer: added possibility to analyze submatrices of matrices or a specific...
authorBenjamin Linnik <blinnik@jspc28.x-matter.uni-frankfurt.de>
Tue, 1 Sep 2015 13:52:22 +0000 (15:52 +0200)
committerBenjamin Linnik <blinnik@jspc28.x-matter.uni-frankfurt.de>
Tue, 1 Sep 2015 13:52:22 +0000 (15:52 +0200)
MABS_run_analyzer/Run.c
MABS_run_analyzer/Run.h

index 050d5830e6f01b1f59971c04b1f22feba7c5fd20..05b30f6faa3958d751cb16b6b8257fbac50ebe2c 100644 (file)
@@ -140,6 +140,8 @@ Run::Run(Int_t runnumber, Int_t loopi)
             }
             cout << colorwhite << "setSystemSpecificParameters():" << endlr;
             setSystemSpecificParameters();
+            cout << colorwhite << "setMatrixSpecificParameters():" << endlr;
+            setMatrixSpecificParameters();
             cout << colorwhite << "generateReadableRunCode():" << endlr;
             generateReadableRunCode();
             cout << colorwhite << "initRootParameters():" << endlr;
@@ -569,6 +571,7 @@ void Run::setSensorInSystemParam()
     sensorinfostruct sensorinfoMi34PXI( 16, /* rows */  64 /* columns */   );
     sensorinfostruct sensorinfoPegasus( 8, 56 );
        sensorinfostruct sensorinfoFSBB( 8, 208 );
+    
     if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("Mi34") )
         sensorinfocur=sensorinfoMi34USB;
        else if (labbook.system.EqualTo("USB")  && labbook.chipGen.EqualTo("FSBB") )
@@ -579,6 +582,33 @@ void Run::setSensorInSystemParam()
         sensorinfocur=sensorinfoPegasus;
 }
 
+void Run::setMatrixSpecificParameters()
+{    
+    submatrix_x_start = 0;
+    submatrix_x_end = sensorinfocur.columns;
+    submatrix_y_start = 0;
+    submatrix_y_end = sensorinfocur.rows;
+}
+
+
+void Run::setSubMatrixBorders(u_int x_start, u_int x_end, u_int y_start, u_int y_end)
+{    
+    submatrix_x_start = x_start;
+    submatrix_x_end = x_end;
+    submatrix_y_start = y_start;
+    submatrix_y_end = y_end;
+}
+
+void Run::selectSubMatrixFSBB(TString matrixname)
+{    
+    if (matrixname.EqualTo("A0"))
+        setSubMatrixBorders(0, sensorinfocur.columns, 0, sensorinfocur.rows/2-2);
+    else if (matrixname.EqualTo("A1"))
+        setSubMatrixBorders(0, sensorinfocur.columns, sensorinfocur.rows/2+2, sensorinfocur.rows);   
+    else
+        cout << colorred << "Error in selectSubMatrixFSBB(), given submatrix with name: " << matrixname << " not known. " << endlr;
+}
+
 template <typename T>
 string Run::prepareSQLStatement( T statement )
 {
@@ -743,54 +773,64 @@ Bool_t Run::binSeedSumVeto()
         {
             for(Int_t hiti=0; (unsigned int)hiti<processed->fFrameInfo.hits;hiti++)
             {
-                histogram.numberofhits++;
-                
-                // histogram with the single pixel
-                histogram.Seed->Fill(processed->fFrameInfo.p[12][hiti]);
-                
-                // sum histogram
-                pixelSum = 0;
-                notSeedSum = 0;
-                               if(labbook.chipGen=="FSBB")
-                               {       
-                                       Float_t clusterArray[processed->clustersize*processed->clustersize];
-                                       Int_t index[processed->clustersize*processed->clustersize];
-                                       for (Int_t clusteri=0; clusteri<processed->clustersize*processed->clustersize; clusteri++)
-                                       {
-                                               clusterArray[clusteri] = processed->fFrameInfo.p[clusteri][hiti];
-                                               if (clusteri != 12)
-                                                       notSeedSum += processed->fFrameInfo.p[clusteri][hiti];
-                                       }
-                                       TMath::Sort(processed->clustersize*processed->clustersize,clusterArray,index,1);
-                                       for (Int_t clusteri=0; clusteri<4; clusteri++)
-                                       {
-                                               pixelSum += clusterArray[index[clusteri]];
-                                               
-                                       }
-                               }
-                               else
-                               {
-                                       for (Int_t clusteri=0; clusteri<processed->clustersize*processed->clustersize; clusteri++)
-                                       {
-                                               pixelSum += processed->fFrameInfo.p[clusteri][hiti];
-                                               if (clusteri != 12)
-                                                       notSeedSum += processed->fFrameInfo.p[clusteri][hiti];
-                                       }
-                               }
-                histogram.Sum->Fill(pixelSum);                
-                
-                // veto spectrum
-                if (TMath::Abs(notSeedSum) < systemparamcur.vetothreshold && (labbook.source.Contains("Fe")||labbook.source.Contains("Cd")))
-                    histogram.Veto->Fill(processed->fFrameInfo.p[12][hiti]);    // histogram with the single pixel
-                   
-                if (processed->fFrameInfo.pixelthreshold[hiti]>0)
+                uint pixel_column_x = processed->fFrameInfo.pixel[hiti]%sensorinfocur.columns;    //  column of seed
+                uint pixel_row_y = processed->fFrameInfo.pixel[hiti]/sensorinfocur.columns;       //  row of seed
+                if (false) {
+                    cout << "submatrix_x_start: " << submatrix_x_start << ", submatrix_x_end: " << submatrix_x_end << endl;
+                    cout << "submatrix_y_start: " << submatrix_y_start << ", submatrix_y_end: " << submatrix_y_end << endl;
+                    cout << "pixel_column_x: " << pixel_column_x << ", pixel_row_y: " << pixel_row_y << endl;
+                }
+                if (pixel_column_x >= submatrix_x_start && pixel_column_x < submatrix_x_end && pixel_row_y >= submatrix_y_start && pixel_row_y < submatrix_y_end) // Diode sitzt oben im SeedPixel, da nach PitchY angeordnet
                 {
-                    histogramthreshold.numberofhits++;
+                    histogram.numberofhits++;
+                    
+                    // histogram with the single pixel
+                    histogram.Seed->Fill(processed->fFrameInfo.p[12][hiti]);
+                    
+                    // sum histogram
+                    pixelSum = 0;
+                    notSeedSum = 0;
+                    if(labbook.chipGen=="FSBB")
+                    {  
+                        Float_t clusterArray[processed->clustersize*processed->clustersize];
+                        Int_t index[processed->clustersize*processed->clustersize];
+                        for (Int_t clusteri=0; clusteri<processed->clustersize*processed->clustersize; clusteri++)
+                        {
+                            clusterArray[clusteri] = processed->fFrameInfo.p[clusteri][hiti];
+                            if (clusteri != 12)
+                                notSeedSum += processed->fFrameInfo.p[clusteri][hiti];
+                        }
+                        TMath::Sort(processed->clustersize*processed->clustersize,clusterArray,index,1);
+                        for (Int_t clusteri=0; clusteri<4; clusteri++)
+                        {
+                            pixelSum += clusterArray[index[clusteri]];
+                            
+                        }
+                    }
+                    else
+                    {
+                        for (Int_t clusteri=0; clusteri<processed->clustersize*processed->clustersize; clusteri++)
+                        {
+                            pixelSum += processed->fFrameInfo.p[clusteri][hiti];
+                            if (clusteri != 12)
+                                notSeedSum += processed->fFrameInfo.p[clusteri][hiti];
+                        }
+                    }
+                    histogram.Sum->Fill(pixelSum);                
                     
-                    histogramthreshold.Seed->Fill(processed->fFrameInfo.p[12][hiti]);
-                    histogramthreshold.Sum->Fill(pixelSum);
+                    // veto spectrum
                     if (TMath::Abs(notSeedSum) < systemparamcur.vetothreshold && (labbook.source.Contains("Fe")||labbook.source.Contains("Cd")))
-                        histogramthreshold.Veto->Fill(processed->fFrameInfo.p[12][hiti]);    // histogram with the single pixel
+                        histogram.Veto->Fill(processed->fFrameInfo.p[12][hiti]);    // histogram with the single pixel
+                    
+                    if (processed->fFrameInfo.pixelthreshold[hiti]>0)
+                    {
+                        histogramthreshold.numberofhits++;
+                        
+                        histogramthreshold.Seed->Fill(processed->fFrameInfo.p[12][hiti]);
+                        histogramthreshold.Sum->Fill(pixelSum);
+                        if (TMath::Abs(notSeedSum) < systemparamcur.vetothreshold && (labbook.source.Contains("Fe")||labbook.source.Contains("Cd")))
+                            histogramthreshold.Veto->Fill(processed->fFrameInfo.p[12][hiti]);    // histogram with the single pixel
+                    }
                 }
             }
         }
@@ -833,63 +873,73 @@ Bool_t Run::binCluster()
         if (processed->fFrameInfo.hits<(unsigned int)10)
         {
             for(Int_t hiti=0; (unsigned int)hiti<processed->fFrameInfo.hits;hiti++)
-            {
-                if (processed->fFrameInfo.pixel[hiti]%2==0) // Diode sitzt oben im SeedPixel, da nach PitchY angeordnet
-                {
-                    for (Int_t clusteri=0; clusteri<processed->clustersize*processed->clustersize; clusteri++)
-                    {
-                        if ((clusteri%processed->clustersize)%2==0 || rotateangle == 0)
-                        {
-                            // betrachte für Pixel mit Diode links
-                            xcoord = (clusteri%processed->clustersize)*curpixelinfo.pitchY+11;
-                            ycoord = (int)(clusteri/processed->clustersize)*curpixelinfo.pitchX+11;
-                            xcoord_old = xcoord;
-                            xcoord = xcoord*TMath::Cos(rotateangle/180*TMath::Pi())-ycoord*TMath::Sin(rotateangle/180*TMath::Pi());
-                            ycoord = xcoord_old*TMath::Sin(rotateangle/180*TMath::Pi())+ycoord*TMath::Cos(rotateangle/180*TMath::Pi());
-                        }
-                        else
-                        {
-                            // betrachte für Pixel mit Diode links
-                            xcoord = (clusteri%processed->clustersize)*curpixelinfo.pitchY+11;
-                            ycoord = (int)(clusteri/processed->clustersize)*curpixelinfo.pitchX+curpixelinfo.pitchX/2+11;
-                            xcoord_old = xcoord;
-                            xcoord = xcoord*TMath::Cos(rotateangle/180*TMath::Pi())-ycoord*TMath::Sin(rotateangle/180*TMath::Pi());
-                            ycoord = xcoord_old*TMath::Sin(rotateangle/180*TMath::Pi())+ycoord*TMath::Cos(rotateangle/180*TMath::Pi());
-                        }
-//                         cout << colorwhite << "oben: xcoord: " << xcoord << ", ycoord: " << ycoord << endl;
-                        
-                        histogram.histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]);
-                        if (processed->fFrameInfo.pixelthreshold[hiti]>0)
-                            histogramthreshold.histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]);
-                    } 
+            {                
+                uint pixel_column_x = processed->fFrameInfo.pixel[hiti]%sensorinfocur.columns;    //  column of seed
+                uint pixel_row_y = processed->fFrameInfo.pixel[hiti]/sensorinfocur.columns;       //  row of seed
+                if (false) {
+                    cout << "submatrix_x_start: " << submatrix_x_start << ", submatrix_x_end: " << submatrix_x_end << endl;
+                    cout << "submatrix_y_start: " << submatrix_y_start << ", submatrix_y_end: " << submatrix_y_end << endl;
+                    cout << "pixel_column_x: " << pixel_column_x << ", pixel_row_y: " << pixel_row_y << endl;
                 }
-                else // Diode sitzt unten im SeedPixel, da nach PitchY angeordnet
+                if (pixel_column_x >= submatrix_x_start && pixel_column_x < submatrix_x_end && pixel_row_y >= submatrix_y_start && pixel_row_y < submatrix_y_end) // Diode sitzt oben im SeedPixel, da nach PitchY angeordnet
                 {
-                    for (Int_t clusteri=0; clusteri<processed->clustersize*processed->clustersize; clusteri++)
+                    if (processed->fFrameInfo.pixel[hiti]%2==0) // Diode sitzt oben im SeedPixel, da nach PitchY angeordnet
                     {
-                        if ((clusteri%processed->clustersize)%2==1 || rotateangle == 0)
+                        for (Int_t clusteri=0; clusteri<processed->clustersize*processed->clustersize; clusteri++)
                         {
-                            // betrachte für Pixel mit Diode links
-                            xcoord = (clusteri%processed->clustersize)*curpixelinfo.pitchY+11;
-                            ycoord = (int)(clusteri/processed->clustersize)*curpixelinfo.pitchX+11;
-                            xcoord_old = xcoord;
-                            xcoord = xcoord*TMath::Cos(rotateangle/180*TMath::Pi())-ycoord*TMath::Sin(rotateangle/180*TMath::Pi());
-                            ycoord = xcoord_old*TMath::Sin(rotateangle/180*TMath::Pi())+ycoord*TMath::Cos(rotateangle/180*TMath::Pi());
-                        }
-                        else
+                            if ((clusteri%processed->clustersize)%2==0 || rotateangle == 0)
+                            {
+                                // betrachte für Pixel mit Diode links
+                                xcoord = (clusteri%processed->clustersize)*curpixelinfo.pitchY+11;
+                                ycoord = (int)(clusteri/processed->clustersize)*curpixelinfo.pitchX+11;
+                                xcoord_old = xcoord;
+                                xcoord = xcoord*TMath::Cos(rotateangle/180*TMath::Pi())-ycoord*TMath::Sin(rotateangle/180*TMath::Pi());
+                                ycoord = xcoord_old*TMath::Sin(rotateangle/180*TMath::Pi())+ycoord*TMath::Cos(rotateangle/180*TMath::Pi());
+                            }
+                            else
+                            {
+                                // betrachte für Pixel mit Diode links
+                                xcoord = (clusteri%processed->clustersize)*curpixelinfo.pitchY+11;
+                                ycoord = (int)(clusteri/processed->clustersize)*curpixelinfo.pitchX+curpixelinfo.pitchX/2+11;
+                                xcoord_old = xcoord;
+                                xcoord = xcoord*TMath::Cos(rotateangle/180*TMath::Pi())-ycoord*TMath::Sin(rotateangle/180*TMath::Pi());
+                                ycoord = xcoord_old*TMath::Sin(rotateangle/180*TMath::Pi())+ycoord*TMath::Cos(rotateangle/180*TMath::Pi());
+                            }
+    //                         cout << colorwhite << "oben: xcoord: " << xcoord << ", ycoord: " << ycoord << endl;
+                            
+                            histogram.histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]);
+                            if (processed->fFrameInfo.pixelthreshold[hiti]>0)
+                                histogramthreshold.histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]);
+                        } 
+                    }
+                    else // Diode sitzt unten im SeedPixel, da nach PitchY angeordnet
+                    {
+                        for (Int_t clusteri=0; clusteri<processed->clustersize*processed->clustersize; clusteri++)
                         {
-                            // betrachte für Pixel mit Diode links
-                            xcoord = (clusteri%processed->clustersize)*curpixelinfo.pitchY+11;
-                            ycoord = (int)(clusteri/processed->clustersize)*curpixelinfo.pitchX+curpixelinfo.pitchX/2+11;
-                            xcoord_old = xcoord;
-                            xcoord = xcoord*TMath::Cos(rotateangle/180*TMath::Pi())-ycoord*TMath::Sin(rotateangle/180*TMath::Pi());
-                            ycoord = xcoord_old*TMath::Sin(rotateangle/180*TMath::Pi())+ycoord*TMath::Cos(rotateangle/180*TMath::Pi());
+                            if ((clusteri%processed->clustersize)%2==1 || rotateangle == 0)
+                            {
+                                // betrachte für Pixel mit Diode links
+                                xcoord = (clusteri%processed->clustersize)*curpixelinfo.pitchY+11;
+                                ycoord = (int)(clusteri/processed->clustersize)*curpixelinfo.pitchX+11;
+                                xcoord_old = xcoord;
+                                xcoord = xcoord*TMath::Cos(rotateangle/180*TMath::Pi())-ycoord*TMath::Sin(rotateangle/180*TMath::Pi());
+                                ycoord = xcoord_old*TMath::Sin(rotateangle/180*TMath::Pi())+ycoord*TMath::Cos(rotateangle/180*TMath::Pi());
+                            }
+                            else
+                            {
+                                // betrachte für Pixel mit Diode links
+                                xcoord = (clusteri%processed->clustersize)*curpixelinfo.pitchY+11;
+                                ycoord = (int)(clusteri/processed->clustersize)*curpixelinfo.pitchX+curpixelinfo.pitchX/2+11;
+                                xcoord_old = xcoord;
+                                xcoord = xcoord*TMath::Cos(rotateangle/180*TMath::Pi())-ycoord*TMath::Sin(rotateangle/180*TMath::Pi());
+                                ycoord = xcoord_old*TMath::Sin(rotateangle/180*TMath::Pi())+ycoord*TMath::Cos(rotateangle/180*TMath::Pi());
+                            }
+                            // cout << colorwhite << "unten: xcoord: " << xcoord << ", ycoord: " << ycoord << endl;
+                            
+                            histogram.histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]);
+                            if (processed->fFrameInfo.pixelthreshold[hiti]>0)
+                                histogramthreshold.histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]);
                         }
-                        // cout << colorwhite << "unten: xcoord: " << xcoord << ", ycoord: " << ycoord << endl;
-                        
-                        histogram.histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]);
-                        if (processed->fFrameInfo.pixelthreshold[hiti]>0)
-                            histogramthreshold.histAvgCluster->Fill(xcoord,ycoord,processed->fFrameInfo.p[clusteri][hiti]);
                     }
                 }
             }
index a7825a955d6a99201eeb51b5843eb79ec6932625..d6d92ba97103c6576a8631ecf533ec16c4da1084 100644 (file)
@@ -129,6 +129,15 @@ private:
     /// see #devided_lower_matr_min
     const Float_t devided_upper_matr_max = 16.0;
     
+    /// If you set this variable to a value, #Run::binSeedSumVeto() and #Run::binCluster() will only account for hits in given range
+    u_int submatrix_x_start;
+    /// If you set this variable to a value, #Run::binSeedSumVeto() and #Run::binCluster() will only account for hits in given range
+    u_int submatrix_x_end;
+    /// If you set this variable to a value, #Run::binSeedSumVeto() and #Run::binCluster() will only account for hits in given range
+    u_int submatrix_y_start;
+    /// If you set this variable to a value, #Run::binSeedSumVeto() and #Run::binCluster() will only account for hits in given range
+    u_int submatrix_y_end;
+    
     /// number of frames found in given folder
     ULong_t frames_found = 0;
     
@@ -463,9 +472,18 @@ public:
     /** @brief sets #sensorinfocurrent after run data got from db, USB or PXI */
     void setSensorInSystemParam();
     
+    /** @brief sets #Run::submatrix_x_start, #Run::submatrix_x_end, #Run::submatrix_y_start and #Run::submatrix_y_end to default values */
+    void setMatrixSpecificParameters();
+        
     /** @brief sets system dependant variables after run data got from db, USB or PXI */
     void setSystemSpecificParameters();
     
+    /** @brief sets boundaries for submatrix analysis, sets #Run::submatrix_x_start, #Run::submatrix_x_end, #Run::submatrix_y_start and #Run::submatrix_y_end to default values to given values */
+    void setSubMatrixBorders(u_int x_start, u_int x_end, u_int y_start, u_int y_end);
+    
+    /** @brief calls #Run::setSubMatrixBorders() with the correct boundaries for FSBB submatrix A0 or A1 */
+    void selectSubMatrixFSBB(TString matrixname);
+        
     /** @brief A structure to hold the histogram data for the run
      * 
      * seed, sum and veto histograms are stored here