添付ファイル 'pl_adcdata.C'

ダウンロード

   1 /*
   2   pl_adcdata.C
   3 */
   4 #include <iostream>
   5 #include <fstream>
   6 #include <string>
   7 #include "TFile.h"
   8 #include "TH1.h"
   9 
  10 void pl_adcdata(const std::string& fname_in, const std::string& fname_out="adc.root") {
  11   std::ifstream fin(fname_in.c_str());
  12 
  13   TFile* fout = TFile::Open(fname_out.c_str(), "RECREATE");
  14   TH1* h_adc = new TH1F("h_adc", "", 100, 0, 4096);
  15 
  16   int value;
  17   int adc_value;
  18   char line[1000];
  19   int n;
  20 
  21   while (!fin.eof() && fin.good()) {
  22     fin.getline(line, 1000);
  23     if (strlen(line)>0) {
  24       sscanf(line, "%08x", &value);
  25       adc_value = value >> 4;
  26       h_adc->Fill(adc_value);
  27       std::cout << "ADC value: " << adc_value << std::endl;
  28       n ++;
  29     }
  30   }
  31   fin.close();
  32 
  33   h_adc->Draw();
  34 
  35   fout->Write();
  36 }

添付ファイル

添付ファイルを参照するには、(下のファイル一覧にあるように)attachment:filenameと記述します。 [get]リンクのURLは変更される可能性が高いので、利用しないでください。
 All files | Selected Files: delete move to page copy to page

ファイルを添付する権限がありません。