/[PAMELA software]/DarthVader/S4Level2/src/S4Core.cpp
ViewVC logotype

Diff of /DarthVader/S4Level2/src/S4Core.cpp

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

revision 1.4 by mocchiut, Tue Sep 5 13:21:12 2006 UTC revision 1.10 by mocchiut, Tue Jan 23 15:36:47 2007 UTC
# Line 29  Line 29 
29  #include <stdlib.h>  #include <stdlib.h>
30  #include <math.h>  #include <math.h>
31  //  //
32    // RunInfo header
33    //
34    #include <RunInfo.h>
35    #include <GLTables.h>
36    //
37  // YODA headers  // YODA headers
38  //  //
39  #include <PamelaRun.h>  #include <PamelaRun.h>
# Line 38  Line 43 
43  #include <CalibS4Event.h>  #include <CalibS4Event.h>
44  #include <physics/S4/S4Event.h>  #include <physics/S4/S4Event.h>
45  //#include <yodaUtility.h>  //#include <yodaUtility.h>
46  //  
 // RunInfo header  
 //  
 #include <RunInfo.h>  
 #include <GLTables.h>  
47  //  //
48  // This program headers  // This program headers
49  //  //
# Line 72  TArrayD *S4_paramfit(UInt_t atime, TSQLS Line 73  TArrayD *S4_paramfit(UInt_t atime, TSQLS
73    //    //
74    GL_S4_CALIB *glS4calib = new GL_S4_CALIB();    GL_S4_CALIB *glS4calib = new GL_S4_CALIB();
75    //    //
76      if ( !dbc->IsConnected() ) throw -504;
77    glS4calib->Query_GL_S4_CALIB(atime, dbc);    glS4calib->Query_GL_S4_CALIB(atime, dbc);
78    //    //
79    GL_ROOT *glroot = new GL_ROOT();    GL_ROOT *glroot = new GL_ROOT();
80      if ( !dbc->IsConnected() ) throw -504;
81    glroot->Query_GL_ROOT(glS4calib->ID_ROOT_L0,dbc);    glroot->Query_GL_ROOT(glS4calib->ID_ROOT_L0,dbc);
82    //    //
83    stringstream ftmpname;    stringstream ftmpname;
# Line 196  int S4Core(UInt_t run, TFile *file, TSQL Line 199  int S4Core(UInt_t run, TFile *file, TSQL
199    //    //
200    // variables needed to reprocess data    // variables needed to reprocess data
201    //    //
202      Long64_t maxsize = 10000000000LL;  
203      TTree::SetMaxTreeSize(maxsize);
204      //
205    TString S4version;    TString S4version;
206    ItoRunInfo *runinfo = 0;    ItoRunInfo *runinfo = 0;
207    TArrayI *runlist = 0;    TArrayI *runlist = 0;
# Line 341  int S4Core(UInt_t run, TFile *file, TSQL Line 347  int S4Core(UInt_t run, TFile *file, TSQL
347      //      //
348      // tree exists, we are reprocessing data. Are we reprocessing a single run or all the file?      // tree exists, we are reprocessing data. Are we reprocessing a single run or all the file?
349      //      //
350        S4trclone->SetAutoSave(900000000000000LL);
351      reproc = true;      reproc = true;
352      //      //
353      // update versioning information      // update versioning information
# Line 385  int S4Core(UInt_t run, TFile *file, TSQL Line 392  int S4Core(UInt_t run, TFile *file, TSQL
392    //    //
393    file->cd();    file->cd();
394    S4tr = new TTree("S4-new","PAMELA Level2 S4 data");    S4tr = new TTree("S4-new","PAMELA Level2 S4 data");
395      S4tr->SetAutoSave(900000000000000LL);
396    S4tr->Branch("S4Level2","S4Level2",&s4);    S4tr->Branch("S4Level2","S4Level2",&s4);
397    //    //
398    if ( reproc && !reprocall ){    if ( reproc && !reprocall ){
# Line 393  int S4Core(UInt_t run, TFile *file, TSQL Line 401  int S4Core(UInt_t run, TFile *file, TSQL
401      //      //
402      tempfile = new TFile(tempname.str().c_str(),"READ");      tempfile = new TFile(tempname.str().c_str(),"READ");
403      S4trclone = (TTree*)tempfile->Get("S4-old");      S4trclone = (TTree*)tempfile->Get("S4-old");
404        S4trclone->SetAutoSave(900000000000000LL);
405      S4trclone->SetBranchAddress("S4Level2",&s4clone);      S4trclone->SetBranchAddress("S4Level2",&s4clone);
406      //            //      
407      if ( nobefrun > 0 ){      if ( nobefrun > 0 ){
# Line 451  int S4Core(UInt_t run, TFile *file, TSQL Line 460  int S4Core(UInt_t run, TFile *file, TSQL
460        sgnl = 0;        sgnl = 0;
461      };      };
462      //      //
463      // now you can access that variables using the RunInfo class this way runinfo->ID_REG_RUN      // now you can access that variables using the RunInfo class this way runinfo->ID_ROOT_L0
464      //      //
465      if ( runinfo->ID_ROOT_L0 == 0 ){      if ( runinfo->ID_ROOT_L0 == 0 ){
466        if ( debug ) printf("\n S4 - ERROR: no run with ID_RUN = %u \n\n Exiting... \n\n",idRun);        if ( debug ) printf("\n S4 - ERROR: no run with ID_RUN = %u \n\n Exiting... \n\n",idRun);
# Line 461  int S4Core(UInt_t run, TFile *file, TSQL Line 470  int S4Core(UInt_t run, TFile *file, TSQL
470      //      //
471      // prepare the timesync for the db      // prepare the timesync for the db
472      //      //
473        if ( !dbc->IsConnected() ) throw -504;
474      dbtime = new GL_TIMESYNC(runinfo->ID_ROOT_L0,"ID",dbc);      dbtime = new GL_TIMESYNC(runinfo->ID_ROOT_L0,"ID",dbc);
475      //      //
476      // Search in the DB the path and name of the LEVEL0 file to be processed.      // Search in the DB the path and name of the LEVEL0 file to be processed.
477      //      //
478        if ( !dbc->IsConnected() ) throw -504;
479      glroot->Query_GL_ROOT(runinfo->ID_ROOT_L0,dbc);      glroot->Query_GL_ROOT(runinfo->ID_ROOT_L0,dbc);
480      //      //
481      ftmpname.str("");      ftmpname.str("");
# Line 525  int S4Core(UInt_t run, TFile *file, TSQL Line 536  int S4Core(UInt_t run, TFile *file, TSQL
536        goto closeandexit;        goto closeandexit;
537      };      };
538      //      //
539      if ( runinfo->NEVENTS > nevents-1 ) {      if ( runinfo->EV_TO > nevents-1 ) {
540        if ( debug ) printf(" S4 - ERROR: too few entries in the S4 tree\n");        if ( debug ) printf(" S4 - ERROR: too few entries in the S4 tree\n");
541        l0File->Close();        l0File->Close();
542        code = -12;        code = -12;
# Line 573  int S4Core(UInt_t run, TFile *file, TSQL Line 584  int S4Core(UInt_t run, TFile *file, TSQL
584        //        //
585        s4->Clear();        s4->Clear();
586        l0S4->GetEntry(re);        l0S4->GetEntry(re);
587        if (l0s4e->unpackError == 1)  continue;              if (l0s4e->unpackError == 0){
588        s4->S4adc = l0s4e->S4_DATA;          s4->S4adc = l0s4e->S4_DATA;
589            //
590            if ((l0s4e->S4_DATA) > 31 ){
591              s4->S4calibrated = ParamFit0*((l0s4e->S4_DATA)-32)+ParamFit1;
592            }else{
593              s4->S4calibrated = 0;
594            }
595          };
596        //        //
597        if ((l0s4e->S4_DATA) > 31 ){        s4->unpackError = l0s4e->unpackError;
         s4->S4calibrated = ParamFit0*((l0s4e->S4_DATA)-32)+ParamFit1;  
       }else{  
         s4->S4calibrated = 0;  
       }  
598        //        //
599        S4tr->Fill();        S4tr->Fill();
600        //            //    

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

  ViewVC Help
Powered by ViewVC 1.1.23