]> jspc29.x-matter.uni-frankfurt.de Git - radhard.git/commitdiff
ChargeSpectrum: bugfix: changed tupel to tree structure in energyspectra calculation
authorBenjamin Linnik <blinnik@jspc28.x-matter.uni-frankfurt.de>
Tue, 3 Dec 2013 16:25:10 +0000 (17:25 +0100)
committerBenjamin Linnik <blinnik@jspc28.x-matter.uni-frankfurt.de>
Tue, 3 Dec 2013 16:25:10 +0000 (17:25 +0100)
newCOMBI/ChargeSpektrum.c
newCOMBI/MAPS.C
newCOMBI/run.C

index e214027f463abd721cc5ee0dbb1b9ec885686fc7..001eba4d97c25d2784d8ba92ebce472ea44efda4 100755 (executable)
@@ -40,7 +40,7 @@
 #define FIT_FUNC "gaus"
 #define DRAW_FITS true
 
-#define DATAPATH "/d/salt/data_recovered/maps/DennisDoering/root/Analysedata/"
+#define DATAPATH "/d/salt/data_recovered/maps/Benny/Mimosa34_Analyse/"
 struct laborbook
 {
     Int_t inputRun;
@@ -92,7 +92,7 @@ void ChargeSpektrum()
         noiseHisto[lauf]=Noise(runList[lauf]);
         arrayHisto[lauf]=GenerateHisto(runList[lauf]);
     }
-    
+   
     Double_t w = 600;
     Double_t h = 600;
     TCanvas * c1 = new TCanvas("c", "c", w, h);
@@ -156,7 +156,7 @@ struct histogram GenerateHisto(Int_t inputRun)
     // Read Laborbook, save it in the struct laborbookdata
     struct laborbook laborbookdata;
     laborbookdata=LaborBuchSQL(inputRun);
-    
+//     cout<<"TEST2 Run:"<<laborbookdata.inputRun<<endl;  
     Int_t maxBin;
     if(laborbookdata.system=="USB") 
     {
@@ -178,62 +178,103 @@ struct histogram GenerateHisto(Int_t inputRun)
         printf("Error: cannot open %s\n", path.Data());
         exit(0);
     }
-    
+   
     // get a pointer to the tree
-    TNtuple* hitNtuple = (TNtuple*) f->Get("hit");
+//     TNtuple* hitNtuple = (TNtuple*) f->Get("hit");
     //TNtuple* hitsNtuple = (TNtuple*) f->Get("hits");
     
     // one array element and one branch for each pixel
-    Float_t pixel[NUMPIXELS];
-    TBranch* pixelBranch[NUMPIXELS];
-    for (Int_t cnt=0; cnt<NUMPIXELS; cnt++) 
-    {
-        hitNtuple->SetBranchAddress(Form("p%i",cnt+1), &pixel[cnt], &pixelBranch[cnt]);
-    }
-    UInt_t frame;
-    TBranch* frameBranch;
-    hitNtuple->SetBranchAddress("frame", &frame, &frameBranch);
-    UInt_t seedPixel;
-    TBranch* seedPixelBranch;
-    hitNtuple->SetBranchAddress("pixel", &seedPixel, &seedPixelBranch);
+//     Float_t pixel[NUMPIXELS];
+    
+    
+    
+    
+//     TBranch* pixelBranch[NUMPIXELS];
+//     for (Int_t cnt=0; cnt<NUMPIXELS; cnt++) 
+//     {
+//         hitNtuple->SetBranchAddress(Form("p%i",cnt+1), &pixel[cnt], &pixelBranch[cnt]);
+//     }
+//     UInt_t frame;
+//     TBranch* frameBranch;
+//     hitNtuple->SetBranchAddress("frame", &frame, &frameBranch);
+//     UInt_t seedPixel;
+//     TBranch* seedPixelBranch;
+//     hitNtuple->SetBranchAddress("pixel", &seedPixel, &seedPixelBranch);
+
+      TTree* hitNtuple = (TTree*) f->Get("hit");
+      
+      UInt_t frame;
+      UInt_t hits;
+      UInt_t seedPixel[10000];
+      Float_t pixel[25][10000];
+      
+      
+      hitNtuple->SetBranchAddress ("frame"              , &frame);
+      hitNtuple->SetBranchAddress ("hits"              , &hits);
+      hitNtuple->SetBranchAddress ("pixel"              , seedPixel        );
+//       hitNtuple->SetBranchAddress ( "p13" , pixel );
+      
+    
+
+      for(int i=0;i<25;i++)   { hitNtuple->SetBranchAddress( Form("p%i",i+1) , &pixel[i][0] ); }
+    
+    //       fHitTree        = new TTree("hit", "hit");
+    
+    //       fHitTree->SetBranchAddress("frame"    , &fFrameInfo.frame );
+    //       fHitTree->SetBranchAddress("hits"     , &fFrameInfo.hits  );
+    //       fHitTree->SetBranchAddress("pixel"    , &fFrameInfo.pixel[0]  );
+    
     
     // loop over all hits to fill histogram
     Int_t nentries = hitNtuple->GetEntries();
-    
+//     cout<<"TEST4 Run:"<<laborbookdata.inputRun<<endl;  
+    int tempsamirvar = laborbookdata.inputRun;
+//     cout<<"nentries:"<<nentries<<endl;  
     for (Int_t cnt=0; cnt<nentries; cnt++) 
-    {
+    {   
         hitNtuple->GetEntry(cnt);
         
-        // take only frames with a maximum of one hit
-        // hitsNtuple->GetEntry((Int_t) frame);
-        // if (frameCounts > 1)
-        // continue;
+//         cout << cnt << " " << laborbookdata.inputRun << " " << tempsamirvar << " " ;
+//         cout<<frame<<" "<<hits<<" "<<endl;
         
-        
-        // histogram with the single pixel
-        histNtuple->Fill(pixel[12]);
-        
-        // histogram with the summed pixels
-        Double_t pixelSum = 0;
-        for (Int_t i=0; i<NUMPIXELS; i++)
+        if (hits<10)
         {
-            pixelSum += pixel[i];
-        }
-        histNtupleSum->Fill(pixelSum);
-        
-        // histogram with the single pixel and with "veto trigger"
-        // for the "histNtupleVeto" take only hits where only the seed pixel contains charge
-        Double_t notSeedSum = 0;
-        for (Int_t i=0; i<12; i++)
-            notSeedSum += pixel[i];
-        for (Int_t i=13; i<NUMPIXELS; i++)
-            notSeedSum += pixel[i];
-        if (TMath::Abs(notSeedSum) > VETO_THRESHOLD)
-            continue;
-        // meanNotSeedSum+=notSeedSum;
-        // nhits++;
-        histNtupleVeto->Fill(pixel[12]);    // histogram with the single pixel
-        
+          for(unsigned int i=0; i<hits;i++)
+          {
+//             cout<<" ---> "<<i<<" "<<seedPixel[i]<<" "<<pixel[12][i]<<endl;
+          
+
+          // take only frames with a maximum of one hit
+          // hitsNtuple->GetEntry((Int_t) frame);
+          // if (frameCounts > 1)
+          // continue;
+          
+          
+          // histogram with the single pixel
+          histNtuple->Fill(pixel[12][i]);
+          
+          // histogram with the summed pixels
+//           Double_t pixelSum = 0;
+//           for (Int_t i=0; i<NUMPIXELS; i++)
+//           {
+//               pixelSum += pixel[12][i];
+//           }
+//           histNtupleSum->Fill(pixelSum);
+          
+          // histogram with the single pixel and with "veto trigger"
+          // for the "histNtupleVeto" take only hits where only the seed pixel contains charge
+//           Double_t notSeedSum = 0;
+//           for (Int_t i=0; i<12; i++)
+//               notSeedSum += pixel[i];
+//           for (Int_t i=13; i<NUMPIXELS; i++)
+//               notSeedSum += pixel[i];
+//           if (TMath::Abs(notSeedSum) > VETO_THRESHOLD)
+//               continue;
+          // meanNotSeedSum+=notSeedSum;
+          // nhits++;
+//           histNtupleVeto->Fill(pixel[12]);    // histogram with the single pixel
+          }}
     }
     TCanvas* c1 = new TCanvas();
     c1->SetTitle(Form("Seed%i",inputRun));
@@ -276,7 +317,7 @@ struct histogram GenerateHisto(Int_t inputRun)
     histNtupleSumSame->SetLineColor(1);
     histNtupleVetoSame->SetLineColor(2);
     
-    
+   
     
     struct histogram arrayHisto;
     arrayHisto.Seed=(TH1F*)histNtuple->Clone(Form("hist%i",inputRun));
@@ -286,7 +327,10 @@ struct histogram GenerateHisto(Int_t inputRun)
     arrayHisto.posSeed=posSeed;
     arrayHisto.posSum=posSum;
     arrayHisto.posVeto=posVeto;
+//     cout<<"TEST1"<<endl;
+   
     arrayHisto.laborbookdata=laborbookdata;
+//     cout<<"TEST2"<<endl;
     return arrayHisto;
 }
 
@@ -429,12 +473,12 @@ struct noise Noise(Int_t inputRun)
 struct laborbook LaborBuch(Int_t inputRun)
 {
     std::string   system;
-    Float_t   temperature;    // desired temperature
-    Float_t   tempSens;   // actual temperature
-    std::string       chip;       // chip number (eg. 1-6)
-    std::string   source;
-    std::string   matrix;
-    std::string   radDose;
+    Float_t   temperature = 0;    // desired temperature
+    Float_t   tempSens = 0;   // actual temperature
+    std::string       chip = "";       // chip number (eg. 1-6)
+    std::string   source = "";
+    std::string   matrix = "";
+    std::string   radDose = "";
     
     std::ifstream  file("LaborbuchMi34.txt");
     CSVRow    row;
@@ -465,7 +509,7 @@ struct laborbook LaborBuch(Int_t inputRun)
         }
     }
     
-    cout<<"Run:"<<inputRun<<" System:"<<system<<" Chip:"<<chip<<" Temp:"<<temperature<<" TempSensor:"<<tempSens<<" Source:"<<source<<" RadDose:"<<radDose<<endl;  
+//     cout<<"Run:"<<inputRun<<" System:"<<system<<" Chip:"<<chip<<" Temp:"<<temperature<<" TempSensor:"<<tempSens<<" Source:"<<source<<" RadDose:"<<radDose<<endl;  
     
     struct laborbook laborbookdata;
     laborbookdata.inputRun= inputRun;
@@ -488,24 +532,24 @@ struct laborbook LaborBuchSQL(Int_t inputRun)
     std::string   source;
     std::string   matrix;
     std::string   radDose;
-    
+
     
     TSQLServer *db = TSQLServer::Connect("mysql://jspc29.x-matter.uni-frankfurt.de","radhard", "mimosa88");
     
-    //     printf("Server info: %s\n", db->ServerInfo());
+//         printf("Server info: %s\n", db->ServerInfo());
     
     TSQLRow *rowsql;
     TSQLResult *res;
     
     try 
     {
-        // query database and print results
-        char sqlquery[200];
+//         query database and print results
+        char sqlquery[400];
         sprintf(sqlquery, "select System,TempCooling,COALESCE(TempChipStart,-10000) as TempChipStart,COALESCE(TempChipEnd,-10000) as TempChipEnd,ChipNum,RadiationSource,Matrix,ChipRadiation from radhard.labbook WHERE runnumber=%d", inputRun);
         res = db->Query(sqlquery);
         
         int nrows = res->GetRowCount();
-        //             printf("\nGot %d rows in result\n", nrows);
+//      printf("\nGot %d rows in result\n", nrows);
         
         if (nrows > 0)
         {                
@@ -526,8 +570,8 @@ struct laborbook LaborBuchSQL(Int_t inputRun)
         cout << "Error while reading laboratory book (run number " << inputRun << ")!\n";
     }
     
-    //     cout<<"Run:"<<inputRun<<" System:"<<system<<" Chip:"<<chip<<" Temp:"<<temperature<<" TempSensor:"<<tempSens<<" Source:"<<source<<" RadDose:"<<radDose << "matrix: " << matrix <<endl;  
-    
+         cout<<"Run:"<<inputRun<<" System:"<<system<<" Chip:"<<chip<<" Temp:"<<temperature<<" TempSensor:"<<tempSens<<" Source:"<<source<<" RadDose:"<<radDose << "matrix: " << matrix <<endl;  
+
     struct laborbook laborbookdata;
     laborbookdata.inputRun= inputRun;
     laborbookdata.system= system;
@@ -537,6 +581,17 @@ struct laborbook LaborBuchSQL(Int_t inputRun)
     laborbookdata.source= source;
     laborbookdata.matrix= matrix;
     laborbookdata.radDose= radDose;
+    
+//     struct laborbook laborbookdata;
+//     laborbookdata.inputRun= 341500;
+//     laborbookdata.system= "PXI";
+//     laborbookdata.temp= -20;
+//     laborbookdata.tempSens= -13.4;
+//     laborbookdata.chip= "3";
+//     laborbookdata.source= "Fe55";
+//     laborbookdata.matrix= "P1";
+//     laborbookdata.radDose= "3";
+
     return laborbookdata;
 }
 
index bc53b6796abc7a9680bf588492753f7c85547d2a..e983e1eb025897ae06a36a8ff817a011ad732276 100755 (executable)
@@ -1031,7 +1031,7 @@ void MAPS::filterCommonMode() {
                }
        }
        
-       if(warning) { cout<<"\rFrame: "<<fFrameNumber<<" --> Common Mode suspiciously high!               "<<endl; }
+       if(!warning) { cout<<"\rFrame: "<<fFrameNumber<<" --> Common Mode suspiciously high!               "<<endl; }
 }
 
 //####################################################################
index c9249b286a61b4d32ba7bd65b625f8c92d761433..a8e0fc147881ea336fc0ce92818961e146e9b7bc 100755 (executable)
@@ -4,8 +4,9 @@ void run()
 {
 //-------------------------------------------------------
 //-------------------------------------------------------
-/*     TString path            = "/jspc53_U/PXI-System/";
-       Int_t   runnumber       = 34509;
+    TString    path            = "/jspc12_F/Mi32/";
+    TString outpath     = "/d/salt/data_recovered/maps/Benny/Mimosa34_Analyse/";
+    Int_t   runStart    = 341500;
        Int_t   rows            = 16;
        Int_t   columns         = 64;
        TString system          = "PXI";
@@ -14,21 +15,21 @@ void run()
        bool    save            = 1;
        
        bool    loadNoise               = false;
-       Int_t   runnumberNoise  = 29020; */
+       Int_t   runnumberNoise  = 29020; 
 //-------------------------------------------------------
 //-------------------------------------------------------
-       TString path            = "/jspc12_F/Mi32/";
-       TString outpath         = "/d/salt/data_recovered/maps/DennisDoering/root/Analysedata/";
-       Int_t   runStart        = 341355;
-       Int_t   rows            = 8;
-       Int_t   columns         = 64;
-       TString system          = "USB";
-       TString ordercode       = "";
-       Int_t   matrix          = 0;
-       bool    save            = 1;
-       
-       bool    loadNoise               = false;
-       Int_t   runnumberNoise  = 29020;
+//     TString path            = "/jspc12_F/Mi32/";
+//     TString outpath         = "/d/salt/data_recovered/maps/DennisDoering/root/Analysedata/";
+//     Int_t   runStart    = 341440;
+//     Int_t   rows            = 8;
+//     Int_t   columns         = 64;
+//     TString system          = "USB";
+//     TString ordercode       = "";
+//     Int_t   matrix          = 0;
+//     bool    save            = 1;
+//     
+//     bool    loadNoise               = false;
+//     Int_t   runnumberNoise  = 29020;
        
 //-------------------------------------------------------      
 //-------------------------------------------------------