Subversion Repositories f9daq

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
326 f9daq 1
void printgain(char * foutput=NULL){
2
 
3
   char fname[0xff];
4
   char run[0xff];
5
   sprintf(fname,"%s",gSystem->BaseName(_file0->GetName()));
6
   fname[11]=0;
7
   strncpy(run,fname,4);
8
   run[4]=0;
9
   TIter nxt(gDirectory->GetListOfKeys());
10
   TKey *key;
11
 
12
   FILE *fo=stdout;
13
   if (foutput!=NULL && strlen(foutput)>1) {
14
     fo = fopen(foutput,"a");
15
     printf("FILE=%s",foutput);
16
   }
17
   while ((key = (TKey*)nxt())) {
18
 
19
      TClass *cl = gROOT->GetClass(key->GetClassName());
20
 
21
      if (!cl->InheritsFrom("TCanvas")) continue;
22
      TCanvas *c1 = (TCanvas*)key->ReadObj();
23
      TPad *pad = (TPad *)c1->GetListOfPrimitives()->At(1);
24
 
25
      TH2F *h2 = (TH2F*)pad->GetListOfPrimitives()->At(0);
26
      TCanvas c2;
27
      if (h2) {
28
        h2->Print();
29
        fprintf(fo,"<gain run='%s' sn='%s'>\n", run,&fname[5]);
30
        for (int i=0;i < h2->GetNbinsX();i++){
31
          for (int j=0;j < h2->GetNbinsY();j++){
32
            fprintf(fo,"<v i='%d'>%g</v>\n",i* h2->GetNbinsY()+j, h2->GetBinContent(i+1,j+1));
33
          }
34
        }
35
        fprintf(fo,"</gain>\n");
36
      }    
37
      else printf("not found\n");
38
 
39
   }
40
//   TCanvas *c1 = gDirectory->Get("0063_ZJ6743_Gain")
41
//   hFra40 = (TH1F*)c1->GetPrimitive("hFracEtcorr2Part");
42
 
43
}