/[PAMELA software]/DarthVader/OrbitalInfo/src/OrbitalInfoCore.cpp
ViewVC logotype

Diff of /DarthVader/OrbitalInfo/src/OrbitalInfoCore.cpp

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

revision 1.22 by mocchiut, Tue May 22 08:15:07 2007 UTC revision 1.27 by mocchiut, Mon Sep 1 16:58:45 2008 UTC
# Line 50  using namespace std; Line 50  using namespace std;
50  // CORE ROUTINE  // CORE ROUTINE
51  //  //
52  //  //
53  int OrbitalInfoCore(UInt_t run, TFile *file, TSQLServer *dbc, Int_t OrbitalInfoargc, char *OrbitalInfoargv[]){  int OrbitalInfoCore(UInt_t run, TFile *file, GL_TABLES *glt, Int_t OrbitalInfoargc, char *OrbitalInfoargv[]){
54    //    //
55    Int_t i = 0;    Int_t i = 0;
56      TString host = glt->CGetHost();
57      TString user = glt->CGetUser();
58      TString psw = glt->CGetPsw();
59      TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
60      //
61      stringstream myquery;
62      myquery.str("");
63      myquery << "SET time_zone='+0:00'";
64      dbc->Query(myquery.str().c_str());
65    //    //
66    TString processFolder = Form("OrbitalInfoFolder_%u",run);    TString processFolder = Form("OrbitalInfoFolder_%u",run);
67    //    //
# Line 184  int OrbitalInfoCore(UInt_t run, TFile *f Line 193  int OrbitalInfoCore(UInt_t run, TFile *f
193    TTree *tempOrbitalInfo = 0;    TTree *tempOrbitalInfo = 0;
194    stringstream tempname;    stringstream tempname;
195    stringstream OrbitalInfofolder;    stringstream OrbitalInfofolder;
196      Bool_t myfold = false;
197    tempname.str("");    tempname.str("");
198    tempname << outDir;    tempname << outDir;
199    tempname << "/" << processFolder.Data();    tempname << "/" << processFolder.Data();
200    OrbitalInfofolder.str("");    OrbitalInfofolder.str("");
201    OrbitalInfofolder << tempname.str().c_str();    OrbitalInfofolder << tempname.str().c_str();
   gSystem->MakeDirectory(OrbitalInfofolder.str().c_str());  
202    tempname << "/OrbitalInfotree_run";    tempname << "/OrbitalInfotree_run";
203    tempname << run << ".root";      tempname << run << ".root";  
204    //    //
# Line 337  int OrbitalInfoCore(UInt_t run, TFile *f Line 346  int OrbitalInfoCore(UInt_t run, TFile *f
346        //        //
347        // copying old tree to a new file        // copying old tree to a new file
348        //        //
349          gSystem->MakeDirectory(OrbitalInfofolder.str().c_str());
350          myfold = true;
351        tempfile = new TFile(tempname.str().c_str(),"RECREATE");        tempfile = new TFile(tempname.str().c_str(),"RECREATE");
352        tempOrbitalInfo = OrbitalInfotrclone->CloneTree(-1,"fast");        tempOrbitalInfo = OrbitalInfotrclone->CloneTree(-1,"fast");
353        tempOrbitalInfo->SetName("OrbitalInfo-old");        tempOrbitalInfo->SetName("OrbitalInfo-old");
# Line 399  int OrbitalInfoCore(UInt_t run, TFile *f Line 410  int OrbitalInfoCore(UInt_t run, TFile *f
410    //    //
411    // Loop over the run to be processed    // Loop over the run to be processed
412    //    //
     
413    for (UInt_t irun=0; irun < numbofrun; irun++){    for (UInt_t irun=0; irun < numbofrun; irun++){
414      //      //
415      // retrieve the first run ID to be processed using the RunInfo list      // retrieve the first run ID to be processed using the RunInfo list
# Line 459  int OrbitalInfoCore(UInt_t run, TFile *f Line 469  int OrbitalInfoCore(UInt_t run, TFile *f
469        printf(" RUN TRAILER absolute time is: %u \n",runinfo->RUNTRAILER_TIME);        printf(" RUN TRAILER absolute time is: %u \n",runinfo->RUNTRAILER_TIME);
470        printf(" %i events to be processed for run %u: from %i to %i \n\n",totevent,idRun,runinfo->EV_FROM+1,runinfo->EV_FROM+totevent);        printf(" %i events to be processed for run %u: from %i to %i \n\n",totevent,idRun,runinfo->EV_FROM+1,runinfo->EV_FROM+totevent);
471      }//      }//
472        //
473        if ( !totevent ) goto closeandexit;
474      // Open Level0 file      // Open Level0 file
475      l0File = new TFile(fname.Data());      l0File = new TFile(fname.Data());
476      if ( !l0File ) {      if ( !l0File ) {
# Line 551  int OrbitalInfoCore(UInt_t run, TFile *f Line 563  int OrbitalInfoCore(UInt_t run, TFile *f
563      //      //
564      if (verbose) printf("\n Ready to start! \n\n Processed events: \n\n");      if (verbose) printf("\n Ready to start! \n\n Processed events: \n\n");
565      //      //
566         //
567      for ( re = runinfo->EV_FROM; re < (runinfo->EV_FROM+runinfo->NEVENTS); re++){      for ( re = runinfo->EV_FROM; re < (runinfo->EV_FROM+runinfo->NEVENTS); re++){
568            
569        //        //
# Line 935  int OrbitalInfoCore(UInt_t run, TFile *f Line 948  int OrbitalInfoCore(UInt_t run, TFile *f
948    //    //
949    if ( l0File ) l0File->Close();    if ( l0File ) l0File->Close();
950    if ( tempfile ) tempfile->Close();                if ( tempfile ) tempfile->Close();            
951    gSystem->Unlink(tempname.str().c_str());    if ( myfold ) gSystem->Unlink(tempname.str().c_str());
952    //    //
953    if ( runinfo ) runinfo->Close();        if ( runinfo ) runinfo->Close();    
954    if ( OrbitalInfotr ) OrbitalInfotr->SetName("OrbitalInfo");        if ( OrbitalInfotr ) OrbitalInfotr->SetName("OrbitalInfo");    
# Line 944  int OrbitalInfoCore(UInt_t run, TFile *f Line 957  int OrbitalInfoCore(UInt_t run, TFile *f
957      file->Write();      file->Write();
958    };    };
959    //    //
960    gSystem->Unlink(OrbitalInfofolder.str().c_str());    if ( myfold ) gSystem->Unlink(OrbitalInfofolder.str().c_str());
961    //    //
962    // the end    // the end
963    //    //
964      if ( dbc ){
965        dbc->Close();
966        delete dbc;
967      };
968    if (verbose) printf("\n Exiting...\n");    if (verbose) printf("\n Exiting...\n");
969    if(OrbitalInfotr)OrbitalInfotr->Delete();    if(OrbitalInfotr)OrbitalInfotr->Delete();
970    //    //

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.23