--- PamelaDigitizer/Pamelagp2Digits.cxx 2007/09/13 11:00:53 1.1 +++ PamelaDigitizer/Pamelagp2Digits.cxx 2008/06/06 15:16:08 1.10 @@ -4,15 +4,17 @@ // The conversion is done using a slightly patched version of // Rene Brun's h2root. // -// Created : Jan Conrad (conrad@particle.kth.se) -// Modified: Silvio Orsi (silvio.orsi@roma2.infn.it) +// Created : 2006 Jan Conrad (conrad@particle.kth.se) +// Modified: 2007 Silvio Orsi (silvio.orsi@roma2.infn.it) // // // HOWTO (RECOMMENDED): // ./ Pamelagp2Digits filename.his // It generates filename.pam (PAMELA raw data) and filename.gp.root (sim info) // -// HOWTO (EXPERT, only for testing purposes) +// NB: more details are present in the file HOW-TO-DIGIT.TXT +// +// HOWTO (only for testing purposes) // Pamelagp2Digits hbook_filename root_filename raw_filename compress tolower // - If the 2nd and 3rd parameters are missing the names are generated from the hbook file name. // - The following flags are from h2root and default values are used: @@ -24,13 +26,40 @@ // convertex to lower case // // MODIFICATIONS: -// v. 1.0 (S.Orsi, September 2007) +// 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) +// + flag DEBUG added (default: DEBUG=false; if true, print on screem some messages to debug) +// - AC: + shift register filled; +// + minor bugs fixed +// + counters increment by 1 at each event (they were constant before) +// - 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. 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) +// +// v. 1.2 (S.Orsi, Roma2, 28 September 2007) +// - TOF TDC inserted (to be tuned) +// - improved tracker dEdx, tracker saturation inserted (S.Bottai) +// - S4 routine inserted in code (not in read-out) +// - bugs with packet length corrected +// - small bugs fixed +// - NB: Run DarthVader with the options: "DarthVader -zerofill -idRun 1 -ALL +RUN +CAL [ --no-crosstalk ] +TRK +TOF +AC +TRG +ND" or "DarthVader -zerofill -idRun 1 +CAL [ --no-crosstalk ] -S4", i.e. without S4 +// +// v. 1.1 (S.Orsi, Roma2, 13 September 2007) // - trigger (dummy), tof (preliminary, adc only), ND (preliminary) inserted // - various changes and bug fixes // - padding increased (fPADbuffer=64, fPadding = padbytes+64) // -// v. beta (J.Conrad) -// - compiles; includes pscu, calo, trk, ac +// v. beta (J.Conrad, KTH, 2006) +// - compiles; includes pscu, calo, trk, ac; not present on cvs // ///////////////////////////////////////////////////////////////////////// @@ -49,6 +78,8 @@ #include "TMath.h" #include "Digitizer.h" +using namespace std; + int Error; //to be removed soon // Define the names of the Fortran common blocks for the different OSs @@ -246,10 +277,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"); @@ -786,13 +820,63 @@ tree->Write(); - std::cout << "Invoking Digitizer" << endl << flush; + 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"); + 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 << flush; }