]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
clusterCut fertig
authorDennis Doering <doering@physik.uni-frankfurt.de>
Thu, 7 May 2015 10:07:49 +0000 (12:07 +0200)
committerDennis Doering <doering@physik.uni-frankfurt.de>
Thu, 7 May 2015 10:07:49 +0000 (12:07 +0200)
MABS_run_analyzer/Run.c

index acf8e06a2c05b8b5ccf09700e958a9e787b099de..51dab681c39a2d4eb173517ebfb7c1efe7bfa912 100644 (file)
@@ -597,8 +597,8 @@ Bool_t Run::binSeedSumVeto()
     Float_t pixelSum = 0;
     Float_t notSeedSum = 0;
         
-    //for (Int_t framei=0; framei<processed->fHitTree->GetEntries(); framei++) // loop over all frames
-       for (Int_t framei=0; framei<100; framei++) // loop over all frames
+    for (Int_t framei=0; framei<processed->fHitTree->GetEntries(); framei++) // loop over all frames
+//     for (Int_t framei=0; framei<10000; framei++) // loop over all frames
     {
         processed->fHitTree->GetEntry(framei);
         // account only frames with less then 10 hits
@@ -608,81 +608,55 @@ Bool_t Run::binSeedSumVeto()
             {
 //------------------------------------------------------------------------------------
                        
-                       cout<<"hit"<<endl;
-                       cout<< processed->fFrameInfo.p[6][hiti]<<","<< processed->fFrameInfo.p[7][hiti]<<","<< processed->fFrameInfo.p[8][hiti]<<","<< processed->fFrameInfo.p[8][hiti]<<","<< processed->fFrameInfo.p[10][hiti]<<endl;
-                       cout<< processed->fFrameInfo.p[10][hiti]<<","<< processed->fFrameInfo.p[11][hiti]<<","<< processed->fFrameInfo.p[12][hiti]<<","<< processed->fFrameInfo.p[13][hiti]<<","<< processed->fFrameInfo.p[14][hiti]<<endl;
-                       cout<< processed->fFrameInfo.p[15][hiti]<<","<< processed->fFrameInfo.p[16][hiti]<<","<< processed->fFrameInfo.p[17][hiti]<<","<< processed->fFrameInfo.p[18][hiti]<<","<< processed->fFrameInfo.p[19][hiti]<<endl;
+                       
 Double_t array[processed->clustersize*processed->clustersize];
 Int_t arraySort[processed->clustersize*processed->clustersize];
                for (Int_t clusteri=0; clusteri<processed->clustersize*processed->clustersize; clusteri++)
                {
                array[clusteri]=processed->fFrameInfo.p[clusteri][hiti];
                }
-                       for (Int_t clusteri=0; clusteri<processed->clustersize*processed->clustersize; clusteri++)
-               {
-               cout<<array[clusteri]<<",";
-               }
-               cout <<endl;
+
                TMath::Sort(25,array,arraySort);//Sort cluster from Greater and save their sorting index in arraySort
-                               for (Int_t clusteri=0; clusteri<processed->clustersize*processed->clustersize; clusteri++)
-               {
-               cout<<arraySort[clusteri]<<",";
-               }
-               cout <<endl;
-               for (Int_t clusteri=0; clusteri<processed->clustersize*processed->clustersize; clusteri++)
-               {
-               cout<<array[arraySort[clusteri]]<<",";
-               }
-               cout <<endl;
+       
+       
                Int_t clusterSizeForCut=4;
                Double_t clusterValueCut=0;
                for (Int_t clusteri=0; clusteri<clusterSizeForCut; clusteri++)
                {
                clusterValueCut+=array[arraySort[clusteri]];//Sum up the greatest entries up to clusterSizeForCut
                }
-               cout<<"ClusterValue: "<<clusterValueCut<<endl;
+               
                
                Float_t noise;
     TBranch* noiseBranch;
     processed->fNoiseTree->SetBranchAddress("noise", &noise, &noiseBranch);
                
-               cout<<"Pixelnr"<<processed->fFrameInfo.pixel[hiti]<<endl;
+        Double_t sigmaValue=5;
                processed->fNoiseTree->GetEntry(processed->fFrameInfo.pixel[hiti]);//Set &noise to the index of the seed pixel
-               Double_t cutValue=3*noise*TMath::Sqrt(clusterSizeForCut);//Calculate cutvalue, 3=3*sigma, Sqrt(clusterSizeForCut) counts for the noise of the summed pixel, in ideal case: Sqrt(noise_Pixel1^2+noise_Pixel2^2+noise_Pixel3^2+noise_Pixel4^2), so far simplified to the noise of seed pixel and assume the others have the same noise, therefore Sqrt(4)
-               cout<<"Cutwert"<<TMath::Sqrt(clusterSizeForCut)<<","<<cutValue<<endl;
-               if(clusterValueCut>cutValue)
-               cout<<"Yes"<<clusterValueCut<<","<<cutValue<<endl;
-               else
-               cout<<"No"<<clusterValueCut<<","<<cutValue<<endl;
-               cout<<"Noise:"<<noise<<endl;
+               Double_t cutValue=sigmaValue*noise*TMath::Sqrt(clusterSizeForCut);//Calculate cutvalue, 3=3*sigma, Sqrt(clusterSizeForCut) counts for the noise of the summed pixel, in ideal case: Sqrt(noise_Pixel1^2+noise_Pixel2^2+noise_Pixel3^2+noise_Pixel4^2), so far simplified to the noise of seed pixel and assume the others have the same noise, therefore Sqrt(4)
+                       if(clusterValueCut>cutValue)//Fill in only hits which fulfill the clustercutcondition
+                       {
                
+
                
-               for (Int_t clusteri=244; clusteri<245; clusteri++)
-               {
-               processed->fNoiseTree->GetEntry(clusteri);
-               cout<<noise<<",";
-               }
-               cout <<endl;
-               
-               cout<<"test"<<endl;
-               //---------------------------------------------
-                // histogram with the single pixel
-                histogram.Seed->Fill(processed->fFrameInfo.p[12][hiti]);
-             
-                // sum histogram
-                pixelSum = 0;
-                notSeedSum = 0;
-                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"))
-                    histogram.Veto->Fill(processed->fFrameInfo.p[12][hiti]);    // histogram with the single pixel
+                                       // histogram with the single pixel
+                                       histogram.Seed->Fill(processed->fFrameInfo.p[12][hiti]);
+                                
+                                       // sum histogram
+                                       pixelSum = 0;
+                                       notSeedSum = 0;
+                                       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"))
+                                               histogram.Veto->Fill(processed->fFrameInfo.p[12][hiti]);    // histogram with the single pixel
+                               }               
             }
         }
     }