Beispiel #1
0
void replay(Int_t runnumber=0,Int_t all=0,sReplaySetUp ReplaySetUp=DefaultReplay)
{
    //general replay script
    //for detector or physics replay, please use replay_det or physics reply 

    Int_t ReplayMode=ReplaySetUp.ReplayMode;
    char* OutFileFormat=ReplaySetUp.OutFileFormat;
    Int_t DefReplayNum=ReplaySetUp.DefReplayNum;

    cout<<"replay: Init analyzer ..."<<endl;
    THaAnalyzer* analyzer = THaAnalyzer::GetInstance();
    if( analyzer ) {
        analyzer->Close();
    } else {
        analyzer = new THaAnalyzer;
    }


    // step 1: add detectors
    THaBigBite* pB=0;
    if (ReplayMode&(kReplayBigBiteTp+kReplayBigBiteMWDC+kReplayBigBiteOther))
    {
        cout<<"replay: Adding BigBite ..."<<endl;
        pB=new THaBigBite("BB","BigBite"); 
        gHaApps->Add(pB);
    }

    if ((ReplayMode&kReplayPhysics)&&(ReplayMode&kReplayBigBiteMWDC)){
        cout<<"replay: Adding BigBite Golden Track ..."<<endl;
        gHaPhysics->Add( new THaGoldenTrack(
            "BB.gold",
            "Golden (First) track for BigBite", 
            "BB"));
    }

    if (ReplayMode&(kReplayBigBiteTp))
        pB->AddDetector(new THaTriggerPlane("tp","Trigger Plane",pB));

    if (ReplayMode&(kReplayBigBiteMWDC))
        pB->AddDetector(new TreeSearch::MWDC("mwdc","MWDC",pB));

    if (ReplayMode&(kReplayBigBiteOther))
        pB->MountOptics(new THaOpticsAnalytical("optics","BigBite Optics Child Class",pB,"B"));

    /*if (ReplayMode&(kReplayBeam))
    {
    cout<<"replay: Adding Beam ..."<<endl;

    THaApparatus* B = new THaIdealBeam("B","Idea Beam, for Test Only");
    gHaApps->Add( B );

    }*/

    if (ReplayMode&(kReplayDecData))
    {
        cout<<"replay: Adding Decoder Data ..."<<endl;
        gHaApps->Add(new THaDecData("DL","Misc. Decoder Data"));
    }   

    if (ReplayMode&(kReplayHRSL))
    {
        THaApparatus* B = new THaIdealBeam("B","Idea Beam, for Test Only");
        gHaApps->Add( B );

        cout<<"replay: Adding L-arm Helicity"<< endl;
        B->AddDetector( new THaADCHelicity("adchel.L","Beam helicity L-arm") );
        B->AddDetector( new THaADCHelicity("adchel2.L","Beam helicity-2 L-arm") );
        //B->AddDetector( new THaG0Helicity("g0hel.L","Left arm G0 helicity") );	

        cout<<"replay: Adding UnRastered and Rastered Beam ..."<<endl;
        gHaApps->Add(new THaUnRasteredBeam("urb","Unrastered beam"));
        gHaApps->Add(new THaRasteredBeam("rb","Rastered Beam"));

        cout<<"replay: Adding Decoder Data ..."<<endl;
        gHaApps->Add(new THaDecData("DL","Misc. Decoder Data"));

        cout<<"replay: Adding HRS-L ..."<<endl;
        THaApparatus* HRSL = new THaHRS("L","Left HRS");
        gHaApps->Add( HRSL );

        // add detectors that are not in the default config
        HRSL->AddDetector( new THaCherenkov("cer", "Gas Cherenkov counter" ));
        HRSL->AddDetector( new THaShower("prl1", "Pre-shower pion rej." ));
        HRSL->AddDetector( new THaShower("prl2", "Show pion rej." ));

        cout<<"replay: adding Physics modules ..."<<endl;

        gHaPhysics->Add( new THaGoldenTrack("L.gold","Golden track for LHRS", "L") );

        THaPhysicsModule *Rpt_l = new THaReactionPoint(
            "ReactPt_L","Reaction vertex for Left","L","B");
        gHaPhysics->Add( Rpt_l );

        // Correct for using an Extended target
        // This needs information about the Point of interaction (hence a THaVertexModule)
        THaPhysicsModule* TgC_l = new THaExtTarCor("ExTgtCor_L",
            "Corrected for extended target, HRS-L",
            "L","ReactPt_L");
        gHaPhysics->Add( TgC_l );

        // add scalers
        THaScalerGroup* LeftScalers = new THaScalerGroup("Left");
        gHaScalers->Add(LeftScalers);
        // Enable scalers
        analyzer->EnableScalers();

    }

    if (ReplayMode&(kReplayHRSR))
    {
        THaApparatus* B = new THaIdealBeam("B","Idea Beam, for Test Only");
        gHaApps->Add( B );

        cout<<"replay: Adding R-arm Helicity"<< endl;
        B->AddDetector(new THaADCHelicity("adchel.R","Beam helicity R-arm"));
        //B->AddDetector( new THaG0Helicity("g0hel.R","Right arm G0 helicity") );

        cout<<"replay: Adding UnRastered and Rastered Beam ..."<<endl;
        gHaApps->Add(new THaUnRasteredBeam("Rurb","Unrastered beam"));
        gHaApps->Add(new THaRasteredBeam("Rrb","Rastered Beam"));

        cout<<"replay: Adding Decoder Data ..."<<endl;
        gHaApps->Add(new THaDecData("D","Misc. Decoder Data"));
        cout<<"replay: Adding HRS-R ..."<<endl;
        THaApparatus* HRSR = new THaHRS("R","Right HRS");
        gHaApps->Add( HRSR );

        // add detectors that are not in the default config
        HRSR->AddDetector( new THaCherenkov("cer", "Gas Cherenkov counter" ));
        HRSR->AddDetector( new THaShower("ps", "Pre-shower" ));
        HRSR->AddDetector( new THaShower("sh", "Shower" ));

        cout<<"replay: adding Physics modules ..."<<endl;

        gHaPhysics->Add( new THaGoldenTrack("R.gold","Golden track for RHRS", "R") );

        THaPhysicsModule *Rpt_r = new THaReactionPoint(
            "ReactPt_R","Reaction vertex for Left","R","B");
        gHaPhysics->Add( Rpt_r );

        // Correct for using an Extended target
        // This needs information about the Point of interaction 
        //(hence a THaVertexModule)
        THaPhysicsModule* TgC_r = new THaExtTarCor("ExTgtCor_R",
            "Corrected for extended target, HRS-R",
            "R","ReactPt_R");
        gHaPhysics->Add( TgC_r );

        // add scalers
        THaScalerGroup* RightScalers = new THaScalerGroup("Right");
        gHaScalers->Add(RightScalers);
        // Enable scalers
        analyzer->EnableScalers();
    }

    //Step 1.5: load Physics modules
    if (ReplayMode&(kReplayPhysics))
    {

        //The CORRECTED Electron kinematics
        THaPrimaryKine *PriKine=new THaPrimaryKine(
            "PriKine","kinematics of scattering of the primary (beam) particle",
            "ExTgtCor_L","B",.938272029);
        gHaPhysics->Add(PriKine);

        if (ReplayMode&(kReplayBigBiteTp+kReplayBigBiteMWDC+kReplayBigBiteOther)){
            THaSecondaryKine *SecKine=new THaSecondaryKine(
                "SecKine","kinematics of scattering of the primary (beam) particle",
                "BB","PriKine",.938272029);
            gHaPhysics->Add(SecKine);
        }

    }

    if (ReplayMode&(kReplayPhysicsHRSR))
    {
        //The CORRECTED Electron kinematics
        THaPrimaryKine *PriKine_r=new THaPrimaryKine(
            "PriKine_r","kinematics of scattering of the primary (beam) particle",
            "ExTgtCor_R","B",.938272029);
        gHaPhysics->Add(PriKine_r);

        //THaSecondaryKine *SecKine_r=new THaSecondaryKine(
        //    "SecKine_r","kinematics of scattering of the primary (beam) particle",
        //    "R","PriKine_r",.938272029);
        //gHaPhysics->Add(SecKine_r);

    }


    // step 2: setup run information

    int nrun, nev;
    int found = 0;
    const char** path = 0;
    char filename[300],buf[300];  
    FILE *fd;

    while( found==0 ) {
        if (runnumber<=0)
        {
            cout << "\nreplay: Please enter a Run Number (-1 to exit):";
            cin >> nrun;
            fgets(buf,300,stdin);//get the extra '\n' from stdin
            if( nrun<=0 ) break;
        }
        else 
Beispiel #2
0
void replay_asym(Int_t runnumber=0,Int_t all=0,Int_t fstEvt=0,Bool_t QuietRun = kTRUE)
{


  ////////////////////////////////////////
  //   Beams
  ////////////////////////////////////////

  cout<<"replay: Adding Idea Beam"<< endl;

  THaApparatus* B = new THaIdealBeam("B","Idea Beam, for Test Only");
  gHaApps->Add( B );
  
  cout<<"replay: Adding L-arm Helicity"<< endl;
  B->AddDetector( new THaADCHelicity("adchel.L","Beam helicity L-arm") );
  B->AddDetector( new THaADCHelicity("adchel2.L","Beam helicity-2 L-arm") );
  B->AddDetector( new THaG0Helicity("g0hel.L","Left arm G0 helicity") );	
    cout<<"replay: Adding UnRastered and Rastered Beam ..."<<endl;
  gHaApps->Add(new THaUnRasteredBeam("urb","Unrastered beam"));
//   gHaApps->Add(new THaRasteredBeam("rb","Rastered Beam"));
  
  

  ////////////////////////////////////////
  //   LHRS
  ////////////////////////////////////////

  cout<<"replay: Adding HRS-L ..."<<endl;
  THaApparatus* HRSL = new THaHRS("L","Left HRS");
  gHaApps->Add( HRSL );
  
  // add L detectors that are not in the default config
  HRSL->AddDetector( new THaCherenkov("cer", "Gas Cherenkov counter" ));
  HRSL->AddDetector( new THaCherenkov("a1", "A1 Cherenkov counter" ));
  HRSL->AddDetector( new THaShower("prl1", "Pre-shower pion rej." ));
  HRSL->AddDetector( new THaShower("prl2", "Show pion rej." ));

  //cout<<"replay: adding RICH detector ..."<<endl;
  //HRSL->AddDetector( new THaRICH("rich","The RICH")); 
  

  cout<<"replay: adding LHRS track modules ..."<<endl;

  THaPhysicsModule *Rpt_l = new THaReactionPoint("ReactPt_L","Reaction vertex for Left","L","B");
  gHaPhysics->Add( Rpt_l );

  // Correct for using an Extended target
  // This needs information about the Point of interaction (hence a THaVertexModule)
  THaPhysicsModule* TgC_l = new THaExtTarCor("ExTgtCor_L","Corrected for extended target, HRS-L","L","ReactPt_L");
  gHaPhysics->Add( TgC_l );

  ////////////////////////////////////////
  //   Bigbite
  ////////////////////////////////////////

  cout<<"replay: adding BigBite ..."<<endl;
  //Add BigBite 
  THaBigBite* pB=new THaBigBite("BB","BigBite"); 
  gHaApps->Add(pB);
  //THaBBTotalShower* ts=new THaBBTotalShower("ts","BigBite total shower");
  //pB->AddDetector(ts);
  pB->AddDetector(new TreeSearch::MWDC("mwdc","MWDC",pB));
  pB->AddDetector( new THaScintPlaneDet( "s", "BB Scintillator",pB ));
  pB->AddDetector( new THaScintPlaneDet( "sum", "BB Total sum",pB));
  pB->AddDetector( new THaScintPlaneDet( "psum", "BB Preshower sum",pB));
  pB->AddDetector( new THaBBTotalShower( "ts", "BB Total shower",pB));

  cout<<"replay: adding LHRS track modules ..."<<endl;
  pB->MountOptics(new THaOpticsE06010("optics","BigBite Optics Child Class",pB,"urb"));


  ////////////////////////////////////////
  //   Physics
  ////////////////////////////////////////

  cout<<"replay: adding Physics modules ..."<<endl;
  THaPrimaryKine *PriKine=new THaPrimaryKine("PriKine","kinematics of scattering of electron to BB","BB","urb",.939565);
  gHaPhysics->Add(PriKine);

  THaSecondaryKine *SecKinePion=new THaSecondaryKine(
                "SecKinePion","secondary kinematics of scattering pi into HRS",
                "ExTgtCor_L","PriKine", .13957018);
  gHaPhysics->Add(SecKinePion);

  
  ////////////////////////////////////////
  //   Other Modules
  ////////////////////////////////////////

  
  cout<<"replay: Adding Target ..."<<endl;
  THaHe3Target* pT=new THaHe3Target("he3","Hall A Polarized he3 target");
  gHaApps->Add(pT);
  THaSecondaryKine *SecKineHe3=new THaSecondaryKine(
		  "SecKineHe3","Calculate angles of polarized he3 VS electron scattering",
	"he3","PriKine", 0);
  gHaPhysics->Add(SecKineHe3);

  cout<<"replay: Adding Decoder Data ..."<<endl;
  gHaApps->Add(new THaDecData("DL","Misc. Decoder Data"));

  
  
  ////////////////////////////////////////
  //   Scalars
  ////////////////////////////////////////
  // add scalers
  
  gHaScalers->Add(new THaScalerGroup("Left"));
  gHaScalers->Add(new THaScalerGroup("bbite"));
  gHaScalers->Add(new THaScalerGroup("evLeft"));
  gHaScalers->Add(new THaScalerGroup("evbbite"));

  ////////////////////////////////////////
  //   BB Norm Ana
  ////////////////////////////////////////
  char buff[1000]="";
  sprintf(buff,"./summaryfiles/NormAna%d.log",runnumber);
  
  cout<<"replay: Adding BBNormAna & saving result to "<<buff<<endl;
  BBNormAna* norm = new BBNormAna("N","Normalization Analysis",buff,8); 
  gHaPhysics->Add(norm);
  
  ////////////////////////////////////////
  //   Do replay
  ////////////////////////////////////////
  THaAnalyzer* analyzer = THaAnalyzer::GetInstance();
  if( !analyzer ) {
  analyzer = new THaAnalyzer;
  }
  analyzer->EnableBenchmarks();
  analyzer->EnableHelicity();
  analyzer->EnableScalers();
  //analyzer->EnableSlowControl();
  analyzer->SetMarkInterval(20000);

  
  ReplayCore(
	    runnumber,            //run #
	    all,                  //-1=replay all;0=ask for a number
	    -1,                   //defaut replay event num
	    "%s/e06010_asym_%d.root", //output file format
	    "replay_asym.odef",    	//out define
	    "replay_asym.cdef",    	//empty cut define
	    kTRUE,                 	//replay scalar?
	    fstEvt,					//First Event To Replay
		QuietRun				//whether ask user for inputs
	    );
  analyzer->SetMarkInterval(1000);

}
Beispiel #3
0
void replay_phys(Int_t runnumber=0,Int_t all=0,Int_t fstEvt=0,Bool_t QuietRun = kTRUE)
{


  ////////////////////////////////////////
  //   Beams
  ////////////////////////////////////////

  cout<<"replay: Adding Idea Beam"<< endl;

  THaApparatus* B = new THaIdealBeam("B","Idea Beam, for Test Only");
  gHaApps->Add( B );
  
  cout<<"replay: Adding L-arm Helicity"<< endl;
  B->AddDetector( new THaADCHelicity("adchel.L","Beam helicity L-arm") );
  B->AddDetector( new THaADCHelicity("adchel2.L","Beam helicity-2 L-arm") );
  B->AddDetector( new THaG0Helicity("g0hel.L","Left arm G0 helicity") );	
    cout<<"replay: Adding UnRastered and Rastered Beam ..."<<endl;
  gHaApps->Add(new THaUnRasteredBeam("urb","Unrastered beam"));
  gHaApps->Add(new THaRasteredBeam("rb","Rastered Beam"));
  
  ////////////////////////////////////////
  //   LHRS
  ////////////////////////////////////////

  cout<<"replay: Adding HRS-L ..."<<endl;
  THaApparatus* HRSL = new THaHRS("L","Left HRS");
  gHaApps->Add( HRSL );
  
  // add L detectors that are not in the default config
  HRSL->AddDetector( new THaCherenkov("cer", "Gas Cherenkov counter" ));
//  HRSL->AddDetector( new THaCherenkov("a1", "A1 Cherenkov counter" ));
  HRSL->AddDetector( new THaShower("prl1", "Pre-shower pion rej." ));
  HRSL->AddDetector( new THaShower("prl2", "Show pion rej." ));

  //cout<<"replay: adding RICH detector ..."<<endl;
  //HRSL->AddDetector( new THaRICH("rich","The RICH")); 
  
  cout<<"replay: adding LHRS track modules ..."<<endl;
  gHaPhysics->Add( new THaGoldenTrack("L.gold","Golden track for LHRS", "L") );

  THaPhysicsModule *Rpt_l = new THaReactionPoint("ReactPt_L","Reaction vertex for Left","L","B");
  gHaPhysics->Add( Rpt_l );

  // Correct for using an Extended target
  // This needs information about the Point of interaction (hence a THaVertexModule)
  THaPhysicsModule* TgC_l = new THaExtTarCor("ExTgtCor_L","Corrected for extended target, HRS-L","L","ReactPt_L");
  gHaPhysics->Add( TgC_l );

  ////////////////////////////////////////
  //   Bigbite
  ////////////////////////////////////////

  cout<<"replay: adding BigBite ..."<<endl;
  //Add BigBite 
  THaBigBite* pB=new THaBigBite("BB","BigBite"); 
  gHaApps->Add(pB);
  //THaBBTotalShower* ts=new THaBBTotalShower("ts","BigBite total shower");
  //pB->AddDetector(ts);
  pB->AddDetector(new TreeSearch::MWDC("mwdc","MWDC",pB));
  pB->AddDetector( new THaScintPlaneDet( "s", "BB Scintillator",pB ));
  pB->AddDetector( new THaScintPlaneDet( "sum", "BB Total sum",pB));
  pB->AddDetector( new THaScintPlaneDet( "psum", "BB Preshower sum",pB));
  pB->AddDetector( new THaBBTotalShower( "ts", "BB Total shower",pB));

  cout<<"replay: adding LHRS track modules ..."<<endl;
  pB->MountOptics(new THaOpticsE06010("optics","BigBite Optics Child Class",pB,"urb"));
  gHaPhysics->Add( new THaGoldenTrack("BB.gold","Golden track for Bigbite", "BB") );

  ////////////////////////////////////////
  //   Other Modules
  ////////////////////////////////////////

  cout<<"replay: Adding Target ..."<<endl;
  THaHe3Target* pT=new THaHe3Target("he3","Hall A Polarized he3 target");
  gHaApps->Add(pT);

  cout<<"replay: Adding Decoder Data ..."<<endl;
  gHaApps->Add(new THaDecData("DL","Misc. Decoder Data"));

  cout<<"replay: Adding A Quick Hack Code to Extract t3[0] ..."<<endl;
  THaApparatus* DL1 = new THaIdealBeam("DL1","Base Apparatus for extract t3[0]");
  gHaApps->Add( DL1 );
  DL1->AddDetector(new THaADCHe3Spin("t3","copy of DL.t3[0], for .odef file",DL1));

  ////////////////////////////////////////
  //   Physics
  ////////////////////////////////////////

  cout<<"replay: adding Physics modules ..."<<endl;
  THaPrimaryKine *PriKine=new THaPrimaryKine("PriKine","kinematics of scattering of electron to BB","BB","urb",.939565);
  gHaPhysics->Add(PriKine);

  THaSecondaryKine *SecKinePion=new THaSecondaryKine(
                "SecKinePion","secondary kinematics of scattering pi into HRS",
                "ExTgtCor_L","PriKine", .13957018);
  gHaPhysics->Add(SecKinePion);

  //////////////////////////////////////////////
  //Do we need the physics of scattering Kaons?
  //////////////////////////////////////////////

  THaSecondaryKine *SecKineKaon=new THaSecondaryKine(
                "SecKineKaon","kinematics of scattering K into HRS",
                "ExTgtCor_L","PriKine", .493667);
  gHaPhysics->Add(SecKineKaon);
  
  
  ////////////////////////////////////////
  //   Scalars
  ////////////////////////////////////////
  // add scalers
  
  gHaScalers->Add(new THaScalerGroup("Left"));
  gHaScalers->Add(new THaScalerGroup("bbite"));
  gHaScalers->Add(new THaScalerGroup("evLeft"));
  gHaScalers->Add(new THaScalerGroup("evbbite"));

  ////////////////////////////////////////
  //   Do replay
  ////////////////////////////////////////

  
  ReplayCore(
	    runnumber,            //run #
	    all,                  //-1=replay all;0=ask for a number
	    100000,                   //defaut replay event num
	    "%s/e06014_phys_%d.root", //output file format
	    "replay_phys.odef",    	//out define
	    "replay_test.cdef",    	//empty cut define
	    kTRUE,                 	//replay scalar?
	    fstEvt,					//First Event To Replay
		QuietRun				//whether ask user for inputs
	    );

}
Beispiel #4
0
void compare_dc(Int_t RunNumber=52949, Int_t FirstToReplay=1, Int_t MaxEventToReplay=11000) {

    //
    //  Steering script to test hodoscope decoding
    //

    //Int_t RunNumber=52949;
    char* RunFileNamePattern="/cache/mss/hallc/daq04/raw/daq04_%d.log.0";
    gHcParms->Define("gen_run_number", "Run Number", RunNumber);
    gHcParms->AddString("g_ctp_database_filename", "jan05.database");

    gHcParms->Load(gHcParms->GetString("g_ctp_database_filename"), RunNumber);

    // g_ctp_parm_filename and g_decode_map_filename should now be defined

    gHcParms->Load(gHcParms->GetString("g_ctp_kinematics_filename"), RunNumber);
    gHcParms->Load(gHcParms->GetString("g_ctp_parm_filename"));
    gHcParms->Load("hcana.param");

    // Constants not in ENGINE PARAM files that we want to be
    // configurable
    //gHcParms->Load(Form("PARAM/%05d/general.param",RunNumber));

    // Generate db_cratemap to correspond to map file contents
    char command[100];
    sprintf(command,"./make_cratemap.pl < %s > db_cratemap.dat",gHcParms->GetString("g_decode_map_filename"));
    system(command);

    // Load the Hall C style detector map
    gHcDetectorMap=new THcDetectorMap();
    gHcDetectorMap->Load(gHcParms->GetString("g_decode_map_filename"));

    // Set up the equipment to be analyzed.

    THaApparatus* HMS = new THcHallCSpectrometer("H","HMS");
    gHaApps->Add( HMS );

    // Add hodoscope
    HMS->AddDetector( new THcHodoscope("hod", "Hodoscope" ));
    HMS->AddDetector( new THcShower("cal", "Shower" ));
    HMS->AddDetector( new THcDC("dc", "Drift Chambers" ));
    THcAerogel* aerogel = new THcAerogel("aero", "Aerogel Cerenkov" );
    HMS->AddDetector( aerogel );

    // setup physics
    gHaPhysics->Add( new THaGoldenTrack( "H.gold", "HMS Golden Track", "H" ));
    // Set up the analyzer - we use the standard one,
    // but this could be an experiment-specific one as well.
    // The Analyzer controls the reading of the data, executes
    // tests/cuts, loops over Acpparatus's and PhysicsModules,
    // and executes the output routines.


    // Set up the analyzer - we use the standard one,
    // but this could be an experiment-specific one as well.
    // The Analyzer controls the reading of the data, executes
    // tests/cuts, loops over Acpparatus's and PhysicsModules,
    // and executes the output routines.
    THaAnalyzer* analyzer = new THcAnalyzer;


    // A simple event class to be output to the resulting tree.
    // Creating your own descendant of THaEvent is one way of
    // defining and controlling the output.
    THaEvent* event = new THaEvent;

    // Define the run(s) that we want to analyze.
    // We just set up one, but this could be many.
    char RunFileName[100];
    sprintf(RunFileName,RunFileNamePattern,RunNumber);
    THaRun* run = new THaRun(RunFileName);

    // Eventually need to learn to skip over, or properly analyze
    // the pedestal events
    run->SetEventRange(FirstToReplay,MaxEventToReplay);//  Physics Event number, does not
    // include scaler or control events

    // Define the analysis parameters
    analyzer->SetCountMode( 2 ); // 0 = counter is # of physics triggers
    //1 = counter is # of all decode reads
    //2= counter is event number
    analyzer->SetEvent( event );
    analyzer->SetOutFile(Form("Rootfiles/compare_dc_%05d.root",RunNumber));
    analyzer->SetOdefFile("output_dc.def");
    analyzer->SetCutFile("cuts_dc.def");        // optional

    // File to record cuts accounting information
    //  analyzer->SetSummaryFile("summary_example.log"); // optional

    analyzer->Process(run);     // start the actual analysis
}
void replay_farm_L(Int_t runnumber=0,Int_t filesuffix=0,Int_t all=0,Int_t fstEvt=0,Bool_t QuietRun = kTRUE)
{

  THaApparatus* B = new THaIdealBeam("B","Idea Beam, for Test Only");
  gHaApps->Add( B );
  
  cout<<"replay: Adding L-arm Helicity"<< endl;
  B->AddDetector( new THaADCHelicity("adchel.L","Beam helicity L-arm") );
  B->AddDetector( new THaADCHelicity("adchel2.L","Beam helicity-2 L-arm") );
  B->AddDetector( new THaG0Helicity("g0hel.L","Left arm G0 helicity") );	
  
  cout<<"replay: Adding UnRastered and Rastered Beam ..."<<endl;
  gHaApps->Add(new THaUnRasteredBeam("urb","Unrastered beam"));
  gHaApps->Add(new THaRasteredBeam("rb","Rastered Beam"));
  
  cout<<"replay: Adding Decoder Data ..."<<endl;
  gHaApps->Add(new THaDecData("DL","Misc. Decoder Data"));
  
  cout<<"replay: Adding HRS-L ..."<<endl;
  THaApparatus* HRSL = new THaHRS("L","Left HRS");
  gHaApps->Add( HRSL );
  
  // add detectors that are not in the default config
  HRSL->AddDetector( new THaCherenkov("cer", "Gas Cherenkov counter" ));
//  HRSL->AddDetector( new THaCherenkov("a1", "A1 Cherenkov counter" ));
  HRSL->AddDetector( new THaShower("prl1", "Pre-shower pion rej." ));
  HRSL->AddDetector( new THaShower("prl2", "Show pion rej." ));

/*  cout<<"replay: adding RICH detector ..."<<endl;
  HRSL->AddDetector( new THaRICH("rich","The RICH")); 
*/  
  cout<<"replay: adding Physics modules ..."<<endl;
  
  gHaPhysics->Add( new THaGoldenTrack("L.gold","Golden track for LHRS", "L") );
  
  THaPhysicsModule *Rpt_l = new THaReactionPoint(
						 "ReactPt_L","Reaction vertex for Left","L","B");
  gHaPhysics->Add( Rpt_l );
  
  // Correct for using an Extended target
  // This needs information about the Point of interaction (hence a THaVertexModule)
  THaPhysicsModule* TgC_l = new THaExtTarCor("ExTgtCor_L",
					     "Corrected for extended target, HRS-L",
					     "L","ReactPt_L");
  gHaPhysics->Add( TgC_l );
  
  // add scalers
  THaScalerGroup* LeftScalers = new THaScalerGroup("Left");
  gHaScalers->Add(LeftScalers);
  
  FarmReplayCore(
	    runnumber,            //run #
		filesuffix,			  // suffix of data file (e.g. 0 for #.dat.0)
	    all,                  //-1=replay all;0=ask for a number
	    200000,                   //defaut replay event num
	    "%s/e06014_det_L_%d.root", //output file format
	    "replay_det_L.odef",	//out define
	    "replay_det_L.cdef", 	//empty cut define
	    kTRUE,                 	//replay scalar?
	    fstEvt,					//First Event To Replay
		QuietRun				//whether ask user for inputs
	    );
}