]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
FSBB-Versuch FSBBVersuch
authorDennis Doering <doering@physik.uni-frankfurt.de>
Wed, 22 Jul 2015 15:30:51 +0000 (17:30 +0200)
committerDennis Doering <doering@physik.uni-frankfurt.de>
Wed, 22 Jul 2015 15:30:51 +0000 (17:30 +0200)
MABS_run_analyzer/ChargeSpektrum.c
MABS_run_analyzer/MAPS.c
MABS_run_analyzer/MAPS.h
MABS_run_analyzer/Run.c

index bf8ded8ccdc117a9350ff4d04dbe8051902a7d9f..8c44ad415c07feb52052666657fc79900eccee27 100644 (file)
@@ -142,10 +142,10 @@ void ChargeSpektrum(TString runnumber = "")
                                 
 //                 runs[runi]->analyzeFrame(15684);
 //                 runs[runi]->analyzeFrame(803316);
-//                 runs[runi]->analyzeFrame(8319);
+       //          runs[runi]->analyzeFrame(8319);
                 
                 // creates or opens .root file, can analyze the RAW data
-                runs[runi]->error=runs[runi]->analyzeRun(false); // creates or opens .root file, can analyze the RAW data
+                runs[runi]->error=runs[runi]->analyzeRun(true); // creates or opens .root file, can analyze the RAW data
                 if (!runs[runi]->error)
                 {
             //         gROOT->SetBatch(kTRUE);
@@ -159,18 +159,21 @@ void ChargeSpektrum(TString runnumber = "")
                     //         runs[runi]->plotNoise();
                     if (!isBatch)
                         gROOT->SetBatch(kFALSE);
-                            runs[runi]->plotAllHistograms();
-//                    runs[runi]->plotAllHistogramsThresholdCluster();
-                    runs[runi]->plotAllHistogramsThresholdClusterCalibrated();
-                     runs[runi]->plotAllHistogramsCalibrated(); 
+//                            runs[runi]->plotAllHistograms();
+                    runs[runi]->plotAllHistogramsThresholdCluster();
+                //    runs[runi]->plotAllHistogramsThresholdClusterCalibrated();
+               //      runs[runi]->plotAllHistogramsCalibrated(); 
                     runs[runi]->writeAllHistogramsToFile(); 
                 }
             }
+                       
         }
     }
 //     plotAllRuns("");
     plotAllRuns("seed calibrated");
 //     writeObservableToFile("seed threshold calibrated");
-//    writeObservableToFile("seed threshold");
+    writeObservableToFile("seed threshold");
+       writeObservableToFile("veto threshold");
        writeObservableToFile("seed threshold calibrated");
+       
 }
index 64659623021b7b1bedb7e76236bbc9e409af0a8f..c49a017084cd7886c6c351f68baf6d66bbc3db31 100644 (file)
@@ -198,6 +198,7 @@ Bool_t MAPS::initMapsRun( ) {
     fColumns = run->sensorinfocur.columns;
     fPixels            = fRows*fColumns;
        fMatrix =  run->labbook.matrix;
+       fOrderCode = run->labbook.chipGen;
        fSystem = run->labbook.system;
     fConfigFile = fInDir+Form("/RUN_%i_i.rz",fRunNumber);
     fRootFile   = fOutDir+Form("/RUN_%i_i.root",fRunNumber);
@@ -647,12 +648,12 @@ bool MAPS::getFrame(UInt_t FrameNumber) {
 // - fF1matrix
 // Use 'fOrderCode' to choose the respective order!
 // -----------------
-        if                     (fOrderCode == "")              { }
-//             else if         (fOrderCode == "Mi26")  { reorderMi26();        }
-        else if                (fOrderCode == "Mi29a") {
-            reorderMi29a();
-        }
-//             else if         (fOrderCode == "Mi29b") { reorderMi29b();       }
+        if                     (fOrderCode == "")               { }
+               else if         (fOrderCode == "Mi34")   {      }
+               else if         (fOrderCode == "Pegasus"){      }
+               else if         (fOrderCode == "FSBB")   {  reorderFSBB();      }
+        else if                (fOrderCode == "Mi29a")  {  reorderMi29a(); }
+//             else if         (fOrderCode == "Mi29b")  { reorderMi29b();      }
 //==========================================================================
         delete[] HDRDATA;
         delete[] RAWDATA;
@@ -996,10 +997,16 @@ void MAPS::debugStream(const arraytype* (a), Int_t n, Int_t columns, Int_t preci
         std::cout << std::left << std::setprecision(precision);          
         std::cout << a[i] << colorreset;
         if ((i+1)%columns==0)
-            cout << endl << endl;
+            cout << endl;
+               //      cout << endl << endl;
     }
     cout << colorwhite << "----------------------------------" << colorreset << endl;
     cout << endl;
+          for (int i=0; i<n;i++)
+    {
+     //   if (abs(a[i]) > highlightabove)
+    //    cout<<"Pixelpos"<<i<<"CDS-Value"<<  a[i] << endl;
+               }
 }
 
 
@@ -1340,6 +1347,457 @@ void MAPS::hitana() {
                 }
             }
             
+            //Begin: loop evaluate true seeds:
+            if(CHANCE==100)
+            {
+                if (seedcolumn < 2 || seedcolumn > fColumns-3 || seedrow < 2 || seedrow > fRows-3)
+                    bordercluster = true;
+                else
+                    bordercluster = false;
+                for(Int_t row=0; row<5; row++)
+                {
+                    for(Int_t column=0; column<5; column++)
+                    {
+                        if          ( (row==0) && (seedrow<2) )                   { }
+                        else if     ( (row==1) && (seedrow<1) )                   { }
+                        else if     ( (row==3) && (seedrow>= (fRows-1)) )         { }
+                        else if     ( (row==4) && (seedrow>= (fRows-2)) )         { }
+                        else
+                        {
+                            if      ( (column==0) && (seedcolumn<2) )                { }
+                            else if ( (column==1) && (seedcolumn==0) )               { }
+                            else if ( (column==3) && (seedcolumn==fColumns-1))       { }
+                            else if ( (column==4) && (seedcolumn>fColumns-3))        { }
+                            else                                            {
+                                fHittedPixel[rechargePixellist[rechargingpixeli]+(row-2)*fColumns+(column-2)] = -3;
+                            }
+                        }
+                    }
+                }
+                                 cout<<"Hitted pixel discriminator matrix:"<<endl;
+                                 debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
+                fHittedPixel[rechargePixellist[rechargingpixeli]] = -4;
+                
+            }
+            
+        }
+        
+        //Begin: loop over all potential seed pixels:
+        //Determine 'hit-vicinity':
+        fHits = 0;
+        /// Array which holds the hit pixels indices, in other words: it holds the pixel number of the fired pixels
+        for(Int_t hit=0; hit<HITNR; hit++)
+        {
+            A = (Hitlist[hit])/fColumns;            // A: row of seed
+            B = (Hitlist[hit])%fColumns;            // B: column of seed
+            noisesumincluster=0;
+            chargesumincluster=0;
+            
+            // Consider boundaries => Remove hits where the seed pixel is within 2 pixels beside the edge
+            //  Hitlist[hit]%fColumn = x-coordinate of the seed pixel, Hitlist[hit]/fColumns = y-coordinate of the seed pixel
+//             if (Hitlist[hit]%fColumns < 2 || Hitlist[hit]%fColumns > fColumns-3 || Hitlist[hit]/fColumns < 2 || Hitlist[hit]/fColumns > fRows-3)
+//                 continue;
+                
+                        
+            //Provide 5x5 clusters with CDS - content:
+            for(Int_t row=0; row<5; row++)
+            {
+                for(Int_t column=0; column<5; column++)
+                {
+                    // wenn erste Reihe des Clusters gefüllt werden soll
+                    // und das Seed Pixel am Rand - in erster oder zweiten Reihe des Matrix liegt
+                    if          ( (row==0) && (A<2) )                   {
+//                         cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                        pixelchargeincluster[(row*5)+column]=DUMMY;
+                        noiseincluster[(row*5)+column]=DUMMY;
+                    }
+                    // wenn zweite Reihe des Clusters gefüllt werden soll
+                    // und das Seed Pixel am Rand - in erster Reihe des Matrix liegt
+                    else if     ( (row==1) && (A<1) )                   {
+//                         cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                        pixelchargeincluster[(row*5)+column]=DUMMY;
+                        noiseincluster[(row*5)+column]=DUMMY;
+                    }
+                    // wenn vierte Reihe des Clusters gefüllt werden soll
+                    // und das Seed Pixel am Rand - in letzter Reihe des Matrix liegt
+                    else if     ( (row==3) && (A>= (fRows-1)) )         {
+//                         cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                        pixelchargeincluster[(row*5)+column]=DUMMY;
+                        noiseincluster[(row*5)+column]=DUMMY;
+                    }
+                    // wenn vierte Reihe des Clusters gefüllt werden soll
+                    // und das Seed Pixel am Rand - in vorletzter Reihe des Matrix liegt
+                    else if     ( (row==4) && (A>= (fRows-2)) )         {
+//                         cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                        pixelchargeincluster[(row*5)+column]=DUMMY;
+                        noiseincluster[(row*5)+column]=DUMMY;
+                    }
+                    else
+                    {
+                        // wenn erste Spalte des Clusters gefüllt werden soll
+                        // und das Seed Pixel am Rand - in erster oder zweiten Spalte des Matrix liegt
+                        if      ( (column==0) && (B<2) )                {
+//                             cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                            pixelchargeincluster[(row*5)+column]=DUMMY;
+                            noiseincluster[(row*5)+column]=DUMMY;
+                        }                        
+                        // wenn zweite Spalte des Clusters gefüllt werden soll
+                        // und das Seed Pixel am Rand - in erster Spalte der Matrix liegt
+                        else if ( (column==1) && (B==0) )               {
+//                             cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                            pixelchargeincluster[(row*5)+column]=DUMMY;
+                            noiseincluster[(row*5)+column]=DUMMY;
+                        }
+                        // wenn dritte Spalte des Clusters gefüllt werden soll
+                        // und das Seed Pixel am Rand - in letzter Spalte der Matrix liegt
+                        else if ( (column==3) && (B==fColumns-1))       {
+//                             cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                            pixelchargeincluster[(row*5)+column]=DUMMY;
+                            noiseincluster[(row*5)+column]=DUMMY;
+                        }
+                        // wenn letzte Spalte des Clusters gefüllt werden soll
+                        // und das Seed Pixel am Rand - in vorletzter Spalte der Matrix liegt
+                        else if ( (column==4) && (B>fColumns-3))        {
+//                             cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                            pixelchargeincluster[(row*5)+column]=DUMMY;
+                            noiseincluster[(row*5)+column]=DUMMY;
+                        }
+                        else                                            {
+                            noiseincluster[(row*5)+column] = fNoise[Hitlist[hit]+(row-2)*fColumns+(column-2)];
+                            pixelchargeincluster[(row*5)+column] = 1.*fCdsmatrix [Hitlist[hit]+(row-2)*fColumns+(column-2)] - fPedestals [Hitlist[hit]+(row-2)*fColumns+(column-2)];
+                            noisesumincluster+=TMath::Power(noiseincluster[(row*5)+column],2);
+                                                 //noisesumincluster+=noiseincluster[(row*5)+column]; //Mathematicabug reconstructed
+                            chargesumincluster+=pixelchargeincluster[(row*5)+column];
+                        }
+                    }
+                }
+            }
+            noisesumincluster=TMath::Sqrt(noisesumincluster);
+//             cout << coloryellow << "Noise     für Cluster: " << noisesumincluster << endlr;
+//             cout << coloryellow << "ChargeSum für Cluster: " << chargesumincluster << endlr;
+//             debug
+//             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;
+            
+            //Check seeds (whether highest entry in cluster):
+            for(Int_t i=6; i<19; i++) // why not over full cluster? (I=0 i<25 TODO
+            {
+                if          ( (i!=12) && (pixelchargeincluster[i] > pixelchargeincluster[12]) )               {
+                    CHANCE=0;                    
+//                     cout << "kill cluster: " << Hitlist[hit] << " with ADC: " << pixelchargeincluster[12] << endl;
+                    break;
+                }
+                // maybe this is unnecessary, if upper if clause is a >= comparison
+                else if     ( (i!=12) && (pixelchargeincluster[i] == pixelchargeincluster[12]) && i>12 )      {
+                    cout << "WARNING: next pixel value identical to precessor" << endl;
+                    CHANCE=0;    //NOTE: potential error source
+                    break;
+                }
+                else {
+                    CHANCE=100;
+                    if(i%5==3) {
+                        i+=2;
+                    };
+                }
+            }
+            
+            
+            
+            
+            
+            //Begin: loop evaluate true seeds:
+            if(CHANCE==100)
+            {
+                if (B < 2 || B > fColumns-3 || A < 2 || A > fRows-3)
+                    bordercluster = true;
+                else
+                    bordercluster = false;
+                for(Int_t row=0; row<5; row++)
+                {
+                    for(Int_t column=0; column<5; column++)
+                    {
+                        if          ( (row==0) && (A<2) )                   { }
+                        else if     ( (row==1) && (A<1) )                   { }
+                        else if     ( (row==3) && (A>= (fRows-1)) )         { }
+                        else if     ( (row==4) && (A>= (fRows-2)) )         { }
+                        else
+                        {
+                            if      ( (column==0) && (B<2) )                { }
+                            else if ( (column==1) && (B==0) )               { }
+                            else if ( (column==3) && (B==fColumns-1))       { }
+                            else if ( (column==4) && (B>fColumns-3))        { }
+                            else                                            {
+                                fHittedPixel[Hitlist[hit]+(row-2)*fColumns+(column-2)] = bordercluster?-1:1;
+                            }
+                        }
+                    }
+                }
+//                 cout<<"Hitted pixel discriminator matrix:"<<endl;
+//                 debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
+                if (bordercluster)
+                    fHittedPixel[Hitlist[hit]] = -2;
+                else
+                {
+                    fHittedPixel[Hitlist[hit]] = 2;
+                
+                    //Fill hit TTree:
+                    fFrameInfo.pixel[fHits] = Hitlist[hit];
+                    for(int clupos=0; clupos<25; clupos++)
+                    {
+                        fFrameInfo.p [clupos][fHits] = pixelchargeincluster[clupos];
+                    }
+                    
+                    // if cluster charge > clusternoise * const
+                    if (1.0*chargesumincluster > noisesumincluster*2.0)
+                        fFrameInfo.pixelthreshold[fHits] = Hitlist[hit];
+                    else
+                        fFrameInfo.pixelthreshold[fHits] = 0;
+                        
+                    if(fSave) {
+                        hint1->Fill( Hitlist[hit]%fColumns, (int)(Hitlist[hit]/fColumns) );
+                    }
+                    fHits++;
+                    
+                }
+                
+            }
+        }
+        //End: loop evaluate true seeds:
+        //End: loop over all potential seed pixels:
+        
+        if(fSave)
+        {
+            for(Int_t i=0; i<fPixels; i++)
+            {
+                if (fHittedPixel[i]!=0)
+                {
+                    fdiscriminatedhitmatrix->SetBinContent(i%fColumns, (int)(i/fColumns), fHittedPixel[i]);
+                    fADCHitmatrix->SetBinContent(i%fColumns, (int)(i/fColumns), fCdsmatrix[i]);
+                }
+            }
+            
+            fFrameInfo.hits     = fHits;
+            if(fHits<100)
+            {
+                fHitTree->Fill();
+            }
+            else
+            {
+                cout<<"\rFrame: "<<fFrameNumber<<" not saved! Too many hits: "<<fHits<<endl;
+            }
+        }
+        
+        delete[] Hitlist;
+    }
+}
+
+
+//####################################################################
+//####################################################################
+
+void MAPS::hitanaFSBB() {
+    
+    if(!fFrameOk)       {
+        cout<<"\rNo frame loaded!      ";
+    }
+    /*else if(!fNoiseOk)  {
+        cout<<"Noise/Pedestals not set!"<<endl;
+        exit(-1);
+    }*/
+    else {
+        /// Array which holds the hit pixels indices, in other words: it holds the pixel number of the fired pixels
+        TArrayI HITS;
+        /// counts total number of hits
+        Int_t HITNR = 0;
+        /// Array which holds the hit pixels indices, in other words: it holds the pixel number of the fired pixels
+        Int_t *Hitlist;
+        /// Array which holds the recharging pixel indices, in other words: it holds the pixel number of the pixels with highly negative CDS
+        std::vector<int> rechargePixellist;
+        Int_t A;
+        Int_t B;
+        Int_t seedrow;
+        Int_t seedcolumn;
+        Int_t DUMMY=0;
+        /// F0 - F1 of specific pixel in cluster
+        Float_t pixelchargeincluster[25]={ 0 };
+        ///noise of specific pixel in cluster
+        Float_t noiseincluster[25]={ 0 };
+        Int_t CHANCE;
+               Float_t CLUSTER[25];
+        Bool_t bordercluster=false;
+        Float_t noisesumincluster=0;
+        Float_t chargesumincluster=0;
+                
+        for(Int_t i=0; i<fPixels; i++)
+        {
+            fHittedPixel[i] = 0;
+            
+            if( (float)(1.*fCdsmatrix[i]) > (100) )
+            {
+                HITNR++;
+                HITS.Set(HITNR);
+                HITS.AddAt(i,(HITNR-1));                
+                if(fSave)   {
+                    hint2->Fill(i%fColumns+0.1, (int)(i/fColumns)+0.1); // counts up in 2dimensional pixel matrix
+                }
+                               cout <<endl <<endl << colorwhite << "---------------- FRAME " << fFrameNumber << " -------Position:"<<HITS.At(i)<<"Value:"<<fCdsmatrix[i]<<"---------" << colorreset << endl << endl;
+        cout<<"CDS matrix:"<<endl;
+        debugStream<>(fCdsmatrix, fPixels, fColumns, 0, 39);
+            }
+            
+            if( (float)(1.*fCdsmatrix[i]-fPedestals[i]) < (-5.*fNoise[i]) )  // loop to find pixel with highly negative CDS
+            {
+                rechargePixellist.push_back(i);
+            }
+        }
+        
+        //Rewrite HITS to fHitlist array (why?)
+        Hitlist= new Int_t[HITNR];
+        
+        for(Int_t i=0; i<HITNR; i++)
+        {
+            Hitlist[i]=HITS.At(i);
+                       cout<<"HIT FOUND"<<Hitlist[i]<<endl;
+        }
+               int hit=0;
+               A = (Hitlist[hit])/fColumns;                    // A: row of seed
+               B = (Hitlist[hit])%fColumns;                    // B: column of seed
+       cout<<"A:"<<A<<"    B:"<<B<<endl;
+//Provide 5x5 clusters with CDS - content:
+               for(Int_t row=0;row<5;row++)
+               {
+                       for(Int_t column=0;column<5;column++)
+                       {
+                               if                      ( (row==0) && (A<2) )                           {CLUSTER[(row*5)+column]=DUMMY; }
+                               else if         ( (row==1) && (A<1) )                           {CLUSTER[(row*5)+column]=DUMMY; }
+                               else if         ( (row==3) && (A>= (fRows-1)) )         {CLUSTER[(row*5)+column]=DUMMY; }
+                               else if         ( (row==4) && (A>= (fRows-2)) )         {CLUSTER[(row*5)+column]=DUMMY; }
+                               else
+                               {
+                                       if              ( (column==0) && (B<2) )                        {CLUSTER[(row*5)+column]=DUMMY; }
+                                       else if ( (column==1) && (B==0) )                       {CLUSTER[(row*5)+column]=DUMMY; }
+                                       else if ( (column==3) && (B==fColumns-1))       {CLUSTER[(row*5)+column]=DUMMY; }
+                                       else if ( (column==4) && (B>fColumns-3))        {CLUSTER[(row*5)+column]=DUMMY; }
+//                                     else                                                                            {CLUSTER[(row*5)+column] = fCdsmatrix[Hitlist[hit]+(row-2)*fColumns+(column-2)];}
+                                       else                                                                            {CLUSTER[(row*5)+column] = 1.*fCdsmatrix[Hitlist[hit]+(row-2)*fColumns+(column-2)] ;}
+                               }
+                       }
+               }
+debugStream<>(CLUSTER, 25, 5, 0, 100);
+for(Int_t row=0;row<3;row++)
+               {
+                       for(Int_t column=0;column<3;column++)
+                       {
+                               {CLUSTER[(row*3)+column] = 1.*fCdsmatrix[Hitlist[hit]+(row-1)*fColumns+(column-1)] ;}
+                               
+                       }
+               }
+debugStream<>(CLUSTER, 9, 3, 0, 100);
+
+
+        cout<<"HIER BIN ICH"<<endl;
+      //  cout<<"Hitted pixel discriminator matrix:"<<endl;
+     //   debugStream<>(fHittedPixel, fPixels, fColumns, 1, 1);
+        /*
+//         Begin loop over all negative CDS pixel
+//         Determine clusters around them
+        for(UInt_t rechargingpixeli=0; rechargingpixeli<rechargePixellist.size(); rechargingpixeli++)
+        {
+            seedrow = (rechargePixellist[rechargingpixeli])/fColumns;            // row of seed
+            seedcolumn = (rechargePixellist[rechargingpixeli])%fColumns;            // column of seed
+            
+            //Provide 5x5 clusters with CDS - content:
+            for(Int_t row=0; row<5; row++)
+            {
+                for(Int_t column=0; column<5; column++)
+                {
+                    // wenn erste Reihe des Clusters gefüllt werden soll
+                    // und das Seed Pixel am Rand - in erster oder zweiten Reihe des Matrix liegt
+                    if          ( (row==0) && (seedrow<2) )                   {
+                        //                         cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                        pixelchargeincluster[(row*5)+column]=DUMMY;
+                    }
+                    // wenn zweite Reihe des Clusters gefüllt werden soll
+                    // und das Seed Pixel am Rand - in erster Reihe des Matrix liegt
+                    else if     ( (row==1) && (seedrow<1) )                   {
+                        //                         cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                        pixelchargeincluster[(row*5)+column]=DUMMY;
+                    }
+                    // wenn vierte Reihe des Clusters gefüllt werden soll
+                    // und das Seed Pixel am Rand - in letzter Reihe des Matrix liegt
+                    else if     ( (row==3) && (seedrow>= (fRows-1)) )         {
+                        //                         cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                        pixelchargeincluster[(row*5)+column]=DUMMY;
+                    }
+                    // wenn vierte Reihe des Clusters gefüllt werden soll
+                    // und das Seed Pixel am Rand - in vorletzter Reihe des Matrix liegt
+                    else if     ( (row==4) && (seedrow>= (fRows-2)) )         {
+                        //                         cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                        pixelchargeincluster[(row*5)+column]=DUMMY;
+                    }
+                    else
+                    {
+                        // wenn erste Spalte des Clusters gefüllt werden soll
+                        // und das Seed Pixel am Rand - in erster oder zweiten Spalte des Matrix liegt
+                        if      ( (column==0) && (seedcolumn<2) )                {
+                            //                             cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                            pixelchargeincluster[(row*5)+column]=DUMMY;
+                        }                        
+                        // wenn zweite Spalte des Clusters gefüllt werden soll
+                        // und das Seed Pixel am Rand - in erster Spalte der Matrix liegt
+                        else if ( (column==1) && (seedcolumn==0) )               {
+                            //                             cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                            pixelchargeincluster[(row*5)+column]=DUMMY;
+                        }
+                        // wenn dritte Spalte des Clusters gefüllt werden soll
+                        // und das Seed Pixel am Rand - in letzter Spalte der Matrix liegt
+                        else if ( (column==3) && (seedcolumn==fColumns-1))       {
+                            //                             cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                            pixelchargeincluster[(row*5)+column]=DUMMY;
+                        }
+                        // wenn letzte Spalte des Clusters gefüllt werden soll
+                        // und das Seed Pixel am Rand - in vorletzter Spalte der Matrix liegt
+                        else if ( (column==4) && (seedcolumn>fColumns-3))        {
+                            //                             cout << "WARNING: Clusters are filled with dummy values, please check MAPS.c hitana() cluster fill procedure." << endl;
+                            pixelchargeincluster[(row*5)+column]=DUMMY;
+                        }
+                        else                                            {
+                            pixelchargeincluster[(row*5)+column] = 1.*fCdsmatrix [rechargePixellist[rechargingpixeli]+(row-2)*fColumns+(column-2)] - fPedestals [rechargePixellist[rechargingpixeli]+(row-2)*fColumns+(column-2)];
+                        }
+                    }
+                }
+            }
+        
+            //Check seeds (whether lowest entry in cluster):
+            for(Int_t i=6; i<19; i++)
+            {
+                if          ( (i!=12) && (pixelchargeincluster[i] < pixelchargeincluster[12]) )               {
+                    CHANCE=0;                    
+                    break;
+                }
+                // maybe this is unnecessary, if upper if clause is a >= comparison
+                else if     ( (i!=12) && (pixelchargeincluster[i] == pixelchargeincluster[12]) && i>12 )      {
+                    cout << "WARNING: next pixel value identical to precessor" << endl;
+                    CHANCE=0;    //NOTE: potential error source
+                    break;
+                }
+                else {
+                    CHANCE=100;
+                    if(i%5==3) {
+                        i+=2;
+                    };
+                }
+            }
+            
             //Begin: loop evaluate true seeds:
             if(CHANCE==100)
             {
@@ -1588,7 +2046,7 @@ void MAPS::hitana() {
                 cout<<"\rFrame: "<<fFrameNumber<<" not saved! Too many hits: "<<fHits<<endl;
             }
         }
-        
+        */
         delete[] Hitlist;
     }
 }
@@ -2297,6 +2755,45 @@ void MAPS::reorderMi29a() {
     }
 }
 
+//####################################################################
+//####################################################################
+
+void MAPS::reorderFSBB() {
+    
+
+        Float_t CDSMATRIX      [fPixels];
+        Int_t F0MATRIX [fPixels];
+        Int_t F1MATRIX [fPixels];
+         for(Int_t i=0; i<fPixels; i++)
+        {
+            CDSMATRIX  [i] = fCdsmatrix[i];
+            F0MATRIX   [i] = fF0matrix [i];
+            F1MATRIX   [i] = fF1matrix [i];
+        }
+               Int_t pixel=4*416;
+               Int_t array[pixel];
+               for(int i=0;i<pixel;i++)
+               array[i]=CDSMATRIX      [i];
+               
+               //Divide array in two submatrices
+               Int_t submatrix=0;
+               Int_t nMatrix=2;
+               Int_t pixelInSubMatrix=pixel/nMatrix;
+               Int_t arrayDiv[pixelInSubMatrix];
+               for(int i=0;i<pixelInSubMatrix;i++)
+               arrayDiv[i]=array[i+submatrix*pixelInSubMatrix];
+               debugStream(arrayDiv, pixelInSubMatrix, 208, 0, 39);
+               for(Int_t i=0; i<pixelInSubMatrix; i++)
+        {
+            fCdsmatrix[i]= arrayDiv[i];
+               }
+               for(Int_t i=pixelInSubMatrix; i<fPixels; i++)
+        {
+            fCdsmatrix[i]= 0;
+               }       
+  //  exit(1);
+}
+
 //####################################################################
 #endif
 
index 97182ba2f40d10068270ea2c999b90e8693e2880..d07b33ee2e6e6612aa10b157a954b91fcb3ddc2b 100644 (file)
@@ -274,7 +274,12 @@ private:
      * Pixels are counted different here - account for this
      */
     void reorderMi29a();
-    
+    /**
+     * @brief Reorder pixels for FSBB chip
+     *
+     * Pixels are counted different here - account for this Two lines are merged together CURRENTLY A TODO
+     */
+    void reorderFSBB();    
     /**
      * @brief Sums over a given array
      *
@@ -463,6 +468,7 @@ public:
      * 
      */
     void hitana         ();
+       void hitanaFSBB         ();
     
     /**
      * @brief Old routine, shoould be deletable without side effects */
index b805a681de6753de8ef91d5269448c0a906e8442..8f214fcad22b3b2d52b1a1c863902467729c4f3c 100644 (file)
@@ -245,12 +245,12 @@ Bool_t Run::analyzeRun(Bool_t force)
             int start   = 0;
             int nframes = processed->GetNumberFrames();
             // for(int i=15580; i<15685;i++) // TODO remove 100000 run 342272
-            for(int i=0; i<nframes;i++) // TODO remove 100000 run 342272
+            for(int i=0; i<4073;i++) // TODO remove 100000 run 342272
             {
 //                 cout << "getframe " << i << endl;
                 processed->getFrame(i);
                 //                 processed->filterCommonMode();
-//                     cout << "hitana " << i << endl;
+              //       cout << "hitana " << i << endl;
                 processed->hitana();
 //                 cout << "regetDynNoise " << endl;
                 if (dynamicalNoise)