// $Id: Fun4Muons_Pisa.C,v 1.34 2006/06/06 11:42:38 hpereira Exp $ /*! runs mutoo slow simulator on a PisaFile, create a Simulated DST */ void Fun4Muons_Pisa(int nEvents=1000, char *filein = "PISAEvent.root", char *dstout = "sim_dst.root", char *prdfout = "data_out.prdf", int run_number = 109656) { // dst/prdf output bool write_dst = true; bool write_prdf = false; // RPC software bool use_RPC = false; // use FVTX software bool use_FVTX = true; bool use_svx = true; /* if true, muon response (MCHits to Hits) is done after pisa unpacking, the mutr/muid hits are saved to the DST together with the MC hits */ bool do_evaluation = true; bool do_muon_response = true; // load libraries gSystem->Load("libfun4all.so"); gSystem->Load("libfun4allfuncs.so"); gSystem->Load("libmutoo_subsysreco.so"); gSystem->Load("libfvtx_subsysreco.so"); gSystem->Load("libsimreco.so"); gSystem->Load("libgea.so"); /* Int_t iTest; cout << "\n debug pause " << endl; cin >> iTest; cout << "\n iTest = " << iTest << endl; */ // Fun4All macro to process PISA hits files into simulated DSTs, uDSTs, and nDSTs // Modeled after Fun4All.C macro used in Run3 PRDF processing // Input parameters // The centroid values are modified by the Width values which are Gaussian sigma values /////////////////////////////////////////// // recoConsts setup ////////////////////////////////////////// recoConsts *rc = recoConsts::instance(); // vertex configuration // simVertexFlag = 0 (default) means that the BBC Z0 value will be used // simVertexFlag = 1 means that the same simZ0Vertex centroid value is used for all events // simVertexFlag = 2 means that the Z0 centroid is taken from the PISA event header for each event rc->set_IntFlag("SIMVERTEXFLAG",0); rc->set_FloatFlag("SIMZ0VERTEX",0.0); rc->set_FloatFlag("SIMT0VERTEX",0.0); rc->set_FloatFlag("SIMZ0VERTEXWIDTH",0.0); rc->set_FloatFlag("SIMT0VERTEXWIDTH",0.0); rc->set_IntFlag("SIMULATIONFLAG",3); rc->set_IntFlag("EMBEDFLAG",0); rc->set_IntFlag("RUNNUMBER", run_number); /* magnetic field configuration note that the mag field is actually unused since the particle are already tracked through it at PISA level and not at pisa_to_dst level */ mMfmMT::setMapFileFlag(4); mMfmMT::setMapFileScale(1.0); MuonUtil::set_check_mapfile_scale( false ); /////////////////////////////////////////// // Make the Server /////////////////////////////////////////// Fun4AllServer *se = Fun4AllServer::instance(); /////////////////////////////////////////// // Subsystems ////////////////////////////////////////// se->registerSubsystem( new HeadSimreco() ); se->registerSubsystem( new TrigSimreco() ); // BBC/ZDC reconstruction //se->registerSubsystem( new BbcSimreco("BBC") ); //se->registerSubsystem( new VtxReco("VTX") ); // muon reconstruction MuonUnpackPisa *Muon_pisa = new MuonUnpackPisa(); se->registerSubsystem(Muon_pisa); Muon_pisa->Verbosity( 1 ); // Rpc reconstruction if( use_RPC ) { RpcUnpackPisa *Rpc_pisa = new RpcUnpackPisa(); se->registerSubsystem(Rpc_pisa); } if( use_FVTX ) { gSystem->Load("libfvtx_subsysreco.so"); FVTXGEOM::set_root_initialized(); se->registerSubsystem( new FvtxUnpackPisa() ); if( do_evaluation ) se->registerSubsystem( new FvtxMCEval() ); } if( use_svx ) { gSystem->Load("libsvx.so"); SubsysReco* svx = new SvxSimreco(); (dynamic_castsvx)->set_ReadParFromFile(0); se->registerSubsystem( svx ); } // /* // possibly adds a filter here to only select "good" MC events // possible filters are MC_SHALLOW_SHALLOW|MC_DEEP_SHALLOW|MC_DEEP_DEE // */ // MuonTrigFilter *muon_mc_filter = new MuonTrigFilter( "muon_mc_filter", MuonTrigFilter::MC_SHALLOW_SHALLOW ); // muon_mc_filter->set_action(MuonTrigFilter::ABORT_EVENT); // se->registerSubsystem( muon_mc_filter ); // tell module to run the response and write it to the DST if( do_muon_response || (prdfout && write_prdf) ) Muon_pisa->set_do_response( true ); // tell module to write PRDF output if required if( prdfout && write_prdf ) se->registerSubsystem( new MuonPackPRDF() ); /////////////////////////////////////////// // Input manager /////////////////////////////////////////// Fun4AllPisaInputManager *inMan = new Fun4AllPisaInputManager("PisaIn"); se->registerInputManager(inMan); se->fileopen(inMan->Name(),filein); /////////////////////////////////////////// // Output manager /////////////////////////////////////////// // DST output if( dstout && write_dst ) { Fun4AllDstOutputManager *dst_io = new Fun4AllDstOutputManager("DSTOUT",dstout); dst_io->AddEventSelector(Muon_pisa->Name()); se->registerOutputManager(dst_io); // Header and vertex nodes dst_io->AddNode("RunHeader"); dst_io->AddNode("EventHeader"); dst_io->AddNode("TrigLvl1"); dst_io->AddNode("PHGlobal"); dst_io->AddNode("VtxOut"); dst_io->AddNode("BbcOut"); dst_io->AddNode("BbcRaw"); dst_io->AddNode("ZdcOut"); dst_io->AddNode("ZdcRaw"); dst_io->AddNode("L2Decision"); // RPC geometry if( use_RPC ) { dst_io->AddNode("RpcStationType1"); dst_io->AddNode("RpcStationType2"); } // mutoo/muioo nodes dst_io->AddNode("TMCPrimary"); dst_io->AddNode("TMuiMCHitO"); dst_io->AddNode("TMutMCHit"); dst_io->AddNode("TMutMCTrk"); // add hits if do_muon_response is true if( do_muon_response ) { dst_io->AddNode("TMuiHitO"); dst_io->AddNode("TMutHit"); } // RPC node if( use_RPC ) dst_io->AddNode("TRpcMCHit"); // Fvtx nodes if( use_FVTX ) { dst_io->AddNode( "TFvtxMCHit" ); dst_io->AddNode( "TFvtxPisaHit" ); } // Fvtx nodes if( use_svx ) { dst_io->AddNode( "SvxPisaHit" ); } // From EVA node dst_io->AddNode("header"); dst_io->AddNode("fkin"); dst_io->AddNode("primary"); dst_io->AddNode("pythia"); } /* prdf output up to now only the muon tracker/muid will be written to the prdf, since the other detectors (simreco modules) cannot write both on DST and PRDF at the same time (this is controlled by the SIMULATION flag) */ if( prdfout && write_prdf ) { Fun4AllPrdfOutputManager *prdf_io = new Fun4AllPrdfOutputManager("PRDFOUT",prdfout); prdf_io->AddEventSelector(Muon_pisa->Name()); prdf_io->InitPrdfNode( se->topNode() ); se->registerOutputManager(prdf_io); } /////////////////////////////////////////// // Analyze the Data. ////////////////////////////////////////// int kEvents = nEvents; TFile f(filein); int jEvents = T->GetEntries(); if(kEvents==0) kEvents = jEvents; se->run(kEvents); se->End(); cout << "Completed reconstruction." << endl; }