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
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); }