--- PamelaDigitizer/Pamelagp2Digits.cxx 2007/10/11 17:23:10 1.4 +++ PamelaDigitizer/Pamelagp2Digits.cxx 2008/12/18 17:11:47 1.12 @@ -26,6 +26,11 @@ // convertex to lower case // // MODIFICATIONS: +// v. 1.5 (S.Orsi, Roma2, 11 October 2007) +// - file HOW-TO-DIGIT.TXT written (mainly by S.Bottai): contains information on how to run the chain from the DB creation to DarthVader through Digitizer, yoda and YodaProfiler +// +// v. 1.4 (S.Orsi, Roma2, 11 October 2007) +// - similar to v. 1.3 // // v. 1.3 (S.Orsi, Roma2, 11 October 2007) // - TOF: + changes and major corrections in ADC and TDC (W.Menn, D.Campana, S.Orsi) @@ -36,7 +41,7 @@ // - S4: + minor bugs fixed (S.Borisov) // + the routine DigitizeS4() is now inserted in the code. For DV versions earlier than October 2007, the option "-S4" is still needed because S4 calibration is not present // - corrected severe bug that caused yoda to process only part of large data files (file.pam). S4 data were written to file even if the DigitizeS4() routine was not called. Previous versions of the digitizer should have crashed always, but unexpectedly worked on small files. -// - file HOW-TO-DIGIT.TXT written (mainly by S.Bottai): contains information on how to run the chain from the DB creation to DarthVader through Digitizer, yoda and YodaProfiler +// - file HOW-TO-DIGIT.TXT written (mainly by S.Bottai): contains information on how to run the chain from the DB creation to DarthVader through Digitizer, yoda and YodaProfiler. The file is included only from release 1.5 // - digitizer version numbers modified according to CVS repository (v1.00->v1.1, v1.01->v1.2) // - some flags (LDFLAGS) in the Makefile have been changed; they are needed on some machines (e.g. pamelatov.roma2.infn.it), but give errors on others (e.g. pamelaws02.na.infn.it). See Makefile for details if the compilation fails due to library errors) // @@ -58,22 +63,11 @@ // ///////////////////////////////////////////////////////////////////////// -#include -#include -#include -#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" #include "Digitizer.h" -int Error; //to be removed soon +using namespace std; + +//int Error; //to be removed soon // Define the names of the Fortran common blocks for the different OSs @@ -270,10 +264,13 @@ Int_t bufsize = 64000; Int_t optcwn = 1; +char *DigitizerInfo(bool print); int main(int argc, char **argv) { + // char* cha=DigitizerInfo(1); + if (argc < 2) { printf("Error: Pamelagp2Digits \n"); printf("Pamelagp2Digits file.hbook file.root file.pam [compress] [tolower] [lrecl] [bufsize] [optcwn] \n"); @@ -522,7 +519,8 @@ } h1->SetEntries(nentries); h1->Write(); - delete h1; + // delete h1; + h1->Delete(); } //____________________________________________________________________________ void convert_cwn(Int_t id,char* file_raw) @@ -810,13 +808,64 @@ tree->Write(); - std::cout << "Invoking Digitizer" << endl << flush; - - Digitizer* dig = new Digitizer(tree,file_raw); + cout << "Invoking Digitizer" << endl << flush; + char *ndl[8],*q,*q1; + q=(char*)malloc(5 *sizeof(char)); + q1=(char*)malloc(5 *sizeof(char)); + ndl[0]="nspe"; + ndl[1]="ntof"; + ndl[2]="ncat"; + ndl[3]="ncas"; + ndl[4]="ncar"; + ndl[5]="ncal"; + ndl[6]="nndd"; + ndl[7]="nstr"; + + int nspe=200,ntof=200,ncat=50,ncas=50,ncar=100,ncal=1000,nnd=200,nstr=1000,par[8],tmp=0,t; + par[0]=nspe; + par[1]=ntof; + par[2]=ncat; + par[3]=ncas; + par[4]=ncar; + par[5]=ncal; + par[6]=nnd; + par[7]=nstr; + + ifstream np("vectpar.dat",ios::in); + if(!np)printf("ATTENTION: Using default vector legths!\n"); + else{ + while(!np.eof()){ + np>>q>>tmp; + if(np.eof())break; + if(tmp<=0){ + cout<<"ATTENTION: Length of one vector is negative or equal 0!"<Loop(); dig->Close(); - std::cout << "Finished" << endl << flush; + cout << "Finished" << endl; }