/[PAMELA software]/calo/flight/FUTILITIES/macros/FCaloFUNCTIONS.cxx
ViewVC logotype

Diff of /calo/flight/FUTILITIES/macros/FCaloFUNCTIONS.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by mocchiut, Wed Mar 22 15:07:47 2006 UTC revision 1.4 by mocchiut, Thu Jan 23 11:23:58 2014 UTC
# Line 33  Line 33 
33  #include <TKey.h>  #include <TKey.h>
34  #include <TClassTable.h>  #include <TClassTable.h>
35  #include <TThread.h>  #include <TThread.h>
36    #include <TMath.h>
37  //  //
38  #include <PamelaRun.h>  #include <PamelaRun.h>
39  #include <physics/calorimeter/CalorimeterEvent.h>  #include <physics/calorimeter/CalorimeterEvent.h>
40  #include <CalibCalPedEvent.h>  #include <CalibCalPedEvent.h>
41  //  //
42  #include <fcalostructs.h>  #include <fcalostructs.h>
43  #include <FCaloFUNCTIONSfun.h>  //#include <FCaloFUNCTIONSfun.h>
44  #include <caloclassesfun.h>  #include <caloclassesfun.h>
45  //  //
46  using namespace std;  using namespace std;
# Line 304  int CaloPede(TString filename, Int_t s, Line 305  int CaloPede(TString filename, Int_t s,
305  }  }
306    
307  TString getFilename(const TString filename){  TString getFilename(const TString filename){
308      const string fil = (const char*)filename;    //
309      Int_t posiz = fil.find("dw_");    const string fil = gSystem->BaseName(filename.Data());
310      if ( posiz == -1 ) posiz = fil.find("DW_");    Int_t posiz = fil.find(".root");
311      if ( posiz == -1 ) return 0;    //
312      Int_t posiz2 = posiz+13;    TString file2;
313      TString file2;    if ( posiz == -1 ){
314      stringcopy(file2,filename,posiz,posiz2);      file2 = gSystem->BaseName(filename.Data());
315      TString pdat(".dat");    } else {
316      stringappend(file2,pdat);      Int_t posiz2 = 0;
317      return file2;      stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz);
318        TString pdat(".pam");
319        stringappend(file2,pdat);  
320      };
321      return file2;
322  }  }
323    // TString getFilename(const TString filename){
324    //     const string fil = (const char*)filename;
325    //     Int_t posiz = fil.find("dw_");
326    //     if ( posiz == -1 ) posiz = fil.find("DW_");
327    //     if ( posiz == -1 ) return 0;
328    //     Int_t posiz2 = posiz+13;
329    //     TString file2;
330    //     stringcopy(file2,filename,posiz,posiz2);
331    //     TString pdat(".dat");
332    //     stringappend(file2,pdat);
333    //     return file2;
334    // }
335    
336  Int_t fetchpreviousfile(TString ffile, Int_t s){  Int_t fetchpreviousfile(TString ffile, Int_t s){
337      const char *file = ffile;      const char *file = ffile;
# Line 755  char *getLEVname(TString filename, TStri Line 772  char *getLEVname(TString filename, TStri
772      string fil = (const char *)filename;      string fil = (const char *)filename;
773      Int_t posiz = fil.find("dw_");      Int_t posiz = fil.find("dw_");
774      if ( posiz == -1 ) posiz = fil.find("DW_");      if ( posiz == -1 ) posiz = fil.find("DW_");
775      if ( posiz == -1 ) return(0);      if ( posiz == -1 ) return("unkwnown.root");
776      Int_t spos = posiz;      Int_t spos = posiz;
777      Int_t epos = posiz+15;      Int_t epos = posiz+15;
778      TString tmptempf;      TString tmptempf;
# Line 778  char *getfileLEVname(TString filename, T Line 795  char *getfileLEVname(TString filename, T
795      string fil = (const char *)filename;      string fil = (const char *)filename;
796      Int_t posiz = fil.find("dw_");      Int_t posiz = fil.find("dw_");
797      if ( posiz == -1 ) posiz = fil.find("DW_");      if ( posiz == -1 ) posiz = fil.find("DW_");
798      if ( posiz == -1 ) return(0);      if ( posiz == -1 ) return("unknown.root");
799      Int_t spos = posiz;      Int_t spos = posiz;
800      Int_t epos = posiz+13;      Int_t epos = posiz+13;
801      TString tmptempf;      TString tmptempf;
# Line 1323  Int_t WhatToDo(int& i, int& doflag, int& Line 1340  Int_t WhatToDo(int& i, int& doflag, int&
1340  }  }
1341    
1342  void PrintFigure(TString filename, TString outDir, TString figty, TString saveas, TCanvas& figure) {  void PrintFigure(TString filename, TString outDir, TString figty, TString saveas, TCanvas& figure) {
1343      const string fil = (const char*)filename;    //
1344      Int_t posiz = fil.find("dw_");    const string fil = gSystem->BaseName(filename.Data());
1345      if ( posiz == -1 ) posiz = fil.find("DW_");    Int_t posiz = fil.find(".root");
1346      Int_t posiz2 = posiz+13;    //
1347      TString file2;    TString file2;
1348      stringcopy(file2,filename,posiz,posiz2);    if ( posiz == -1 ){
1349      //      file2 = gSystem->BaseName(filename.Data());
1350      const char *figrec = file2;    } else {
1351      stringstream figsave;      Int_t posiz2 = 0;
1352      figsave.str("");      stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz);
1353      figsave << outDir.Data() << "/";    };
1354      figsave << figrec << "_";  //     const string fil = (const char*)filename;
1355      figsave << figty.Data() << ".";  //     Int_t posiz = fil.find("dw_");
1356      figsave << saveas.Data();  //     if ( posiz == -1 ) posiz = fil.find("DW_");
1357      figure.SaveAs(figsave.str().c_str());  //     Int_t posiz2 = posiz+13;
1358      return;  //     TString file2;
1359    //     stringcopy(file2,filename,posiz,posiz2);
1360      //
1361      const char *figrec = file2;
1362      stringstream figsave;
1363      figsave.str("");
1364      figsave << outDir.Data() << "/";
1365      figsave << figrec << "_";
1366      figsave << figty.Data() << ".";
1367      figsave << saveas.Data();
1368      figure.SaveAs(figsave.str().c_str());
1369      return;
1370  }  }
1371    
1372  Double_t langaufun(Double_t *x, Double_t *par) {  Double_t langaufun(Double_t *x, Double_t *par) {

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.23