/[PAMELA software]/PamelaDigitizer/Pamelagp2Digits.cxx
ViewVC logotype

Diff of /PamelaDigitizer/Pamelagp2Digits.cxx

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

revision 1.10 by pamelats, Fri Jun 6 15:16:08 2008 UTC revision 1.13 by mocchiut, Tue Aug 11 14:56:31 2009 UTC
# Line 63  Line 63 
63  //  //
64  /////////////////////////////////////////////////////////////////////////  /////////////////////////////////////////////////////////////////////////
65    
 #include <stdlib.h>  
 #include <string.h>  
 #include <ctype.h>  
 #include "Riostream.h"  
 #include "TFile.h"  
 #include "TDirectory.h"  
 #include "TTree.h"  
 #include "TLeafI.h"  
 #include "TH1.h"  
 #include "TH2.h"  
 #include "TProfile.h"  
 #include "TGraph.h"  
 #include "TMath.h"  
66  #include "Digitizer.h"  #include "Digitizer.h"
67    
68  using namespace std;  using namespace std;
69    
70  int Error;   //to be removed soon  //int Error;   //to be removed soon
71    
72  //  Define the names of the Fortran common blocks for the different OSs  //  Define the names of the Fortran common blocks for the different OSs
73    
# Line 282  char *DigitizerInfo(bool print); Line 269  char *DigitizerInfo(bool print);
269  int main(int argc, char **argv)  int main(int argc, char **argv)
270    
271  {  {
272    char* cha=DigitizerInfo(1);    //  char* cha=DigitizerInfo(1);
273    
274    if (argc < 2) {    if (argc < 2) {
275       printf("Error: Pamelagp2Digits \n");       printf("Error: Pamelagp2Digits \n");
# Line 301  int main(int argc, char **argv) Line 288  int main(int argc, char **argv)
288    void *qq = iq;    void *qq = iq;
289     q = (float*)qq;     q = (float*)qq;
290    char *file_in=argv[1];    char *file_in=argv[1];
291    char *file_out = " ";    char *file_out = new char[512];
292      strcpy(file_out," ");
293    char *file_raw;    char *file_raw;
294    
295    Int_t compress = 1;    Int_t compress = 1;
# Line 532  void convert_directory(const char *dir, Line 520  void convert_directory(const char *dir,
520    }    }
521    h1->SetEntries(nentries);    h1->SetEntries(nentries);
522    h1->Write();    h1->Write();
523    delete h1;    //  delete h1;
524      h1->Delete();
525  }  }
526  //____________________________________________________________________________  //____________________________________________________________________________
527    void convert_cwn(Int_t id,char* file_raw)    void convert_cwn(Int_t id,char* file_raw)
# Line 821  void convert_directory(const char *dir, Line 810  void convert_directory(const char *dir,
810    tree->Write();    tree->Write();
811    
812    cout << "Invoking Digitizer" << endl << flush;    cout << "Invoking Digitizer" << endl << flush;
813    char *ndl[8],*q,*q1;    const char *ndl[8];
814      char *q,*q1;
815    q=(char*)malloc(5 *sizeof(char));    q=(char*)malloc(5 *sizeof(char));
816    q1=(char*)malloc(5 *sizeof(char));    q1=(char*)malloc(5 *sizeof(char));
817    ndl[0]="nspe";    ndl[0]="nspe";
# Line 845  void convert_directory(const char *dir, Line 835  void convert_directory(const char *dir,
835    
836    ifstream np("vectpar.dat",ios::in);    ifstream np("vectpar.dat",ios::in);
837    if(!np)printf("ATTENTION: Using default vector legths!\n");    if(!np)printf("ATTENTION: Using default vector legths!\n");
838    while(!np.eof()){    else{
839      np>>q>>tmp;      while(!np.eof()){
840      if(np.eof())break;        np>>q>>tmp;
841      if(tmp<=0){        if(np.eof())break;
842        cout<<"ATTENTION: Length of one vector is negative or equal 0!"<<endl<<q<<"="<<tmp<<endl;        if(tmp<=0){
843        break;          cout<<"ATTENTION: Length of one vector is negative or equal 0!"<<endl<<q<<"="<<tmp<<endl;
844      }          break;
845      t=0;        }
846      while(tmp){        t=0;
847        q1=ndl[t];        while(tmp){
848        if(q[0]==q1[0] && q[1]==q1[1] && q[2]==q1[2] && q[3]==q1[3]){          strcpy(q1,ndl[t]);
849          par[t]=tmp;          if(q[0]==q1[0] && q[1]==q1[1] && q[2]==q1[2] && q[3]==q1[3]){
850          tmp=0;            par[t]=tmp;
851          cout<<q<<" "<<par[t]<<"["<<t<<"]"<<endl;            tmp=0;
852              cout<<q<<" "<<par[t]<<"["<<t<<"]"<<endl;
853            }
854            t++;
855        }        }
       t++;  
856      }      }
857        nspe=par[0];
858        ntof=par[1];
859        ncat=par[2];
860        ncas=par[3];
861        ncar=par[4];
862        ncal=par[5];
863        nnd=par[6];
864        nstr=par[7];
865    }    }
   nspe=par[0];  
   ntof=par[1];  
   ncat=par[2];  
   ncas=par[3];  
   ncar=par[4];  
   ncal=par[5];  
   nnd=par[6];  
   nstr=par[7];  
   
866    Digitizer* dig = new Digitizer(tree,file_raw,nspe,ntof,ncat,ncas,ncar,ncal,nnd,nstr);    Digitizer* dig = new Digitizer(tree,file_raw,nspe,ntof,ncat,ncas,ncar,ncal,nnd,nstr);
867    dig->Loop();    dig->Loop();
868    dig->Close();    dig->Close();
869    
870    cout << "Finished" << endl << flush;    cout << "Finished" << endl;
871    
872  }  }
873    

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.13

  ViewVC Help
Powered by ViewVC 1.1.23