#include "muifuncs.h" #include "recoConsts.h" #include "RunToTimeObjy.hh" #include "PHTimeStamp.h" #include "dMuiDCMGhitRelWrapper.h" #include "dMutAnodesDCMWrapper.h" #include "dMuiRoadRawRelWrapper.h" #include "mumhitsWrapper.h" #include "mumgeoWrapper.h" #include "dMutCathodeChargeWrapper.h" #include "dMutCathodesFEMWrapper.h" #include "dMutCathodesFEMMCWrapper.h" #include "dMutAnodesFEMWrapper.h" #include "dMutAnodesFEMMCWrapper.h" #include "dMutCathodesDCMWrapper.h" #include "dMutCathodesDCMMCWrapper.h" #include "dMutAnodesDCMMCWrapper.h" #include "dMutCSCGeomWrapper.h" #include "precoSelect.h" #include "getMapFileFlag.h" #include "pisaReco.h" #include "mfm_setfscale.h" #include "mfm_getfscale.h" #define DEBUG void setup_mui() { mMuoReco = new mMuoRecoModule(); if(simulationFlag == 1) mMuoReco->setSimulationFlag(); if(evaluationFlag >0) mMuoReco->setEvaluationFlag(); mMuoReco->setMapFileFlag(getMapFileFlag()); if(simulationFlag<2) { mMuoReco->setRunNumber(runNumber); // for the sake of "real" MC 04/25/2002 mMuoReco->first_event(topNode); } PHNodeIterator* mainIter = new PHNodeIterator(topNode); PHBoolean IsFile; int msgnum = 0; size_t mr; // Read in par file used in response chain if we are doing reconstruction: PHIODataNode* dn; if(simulationFlag == 2 || simulationFlag == 3) { // // Insertions here for the initializations needed for // the slow simulator part of the detector resposne // if(simulationFlag == 3) { // // Insertions here for the initializations needed for // the FEM and DCM modules which are needed for PRDF output filling // // Set the simulation to use this runNumber // If the abs(runNumber) exists in the run Database, // we will initialize for abs(runNumber). Otherwise, // we will initialize for "simulation" mMuoReco->setRunNumber(runNumber); mMuoReco->response_first_event(topNode); // Set up the tables needed for mui // Find MUI node PHCompositeNode* muiNode = static_cast (mainIter->findFirst("PHCompositeNode","MUI")); // Find MUT node PHCompositeNode* mutNode = static_cast (mainIter->findFirst("PHCompositeNode","MUT")); mr=60000; munhitsWrapper* munhits = new munhitsWrapper("munhits",mr); PHIODataNode* munhitsNode = new PHIODataNode(munhits,"munhits"); geaNode->addNode(munhitsNode); mr=4000; dMuiRawGhitRelWrapper* dMuiRawGhitRel = new dMuiRawGhitRelWrapper("dMuiRawGhitRel",mr); PHIODataNode* dMuiRawGhitRelNode = new PHIODataNode(dMuiRawGhitRel,"dMuiRawGhitRel"); evaNode->addNode(dMuiRawGhitRelNode); // correct the node in deftext mr=4000; dMuiDCMGhitRelWrapper* dMuiDCMGhitRel = new dMuiDCMGhitRelWrapper("dMuiDCMGhitRel",mr); PHIODataNode* dMuiDCMGhitRelNode = new PHIODataNode(dMuiDCMGhitRel,"dMuiDCMGhitRel"); evaNode->addNode(dMuiDCMGhitRelNode); // correct the node in deftext mr=4; dMuiFEMWrapper* dMuiFEM = new dMuiFEMWrapper("dMuiFEM",mr); PHIODataNode* dMuiFEMNode = new PHIODataNode(dMuiFEM,"dMuiFEM"); muiNode->addNode(dMuiFEMNode); mr=4; dMuiDCMWrapper* dMuiDCM = new dMuiDCMWrapper("dMuiDCM",mr); PHIODataNode* dMuiDCMNode = new PHIODataNode(dMuiDCM,"dMuiDCM"); dcmNode->addNode(dMuiDCMNode); // Set up the tables needed for mut mr=60000; mumhitsWrapper* mumhits = new mumhitsWrapper("mumhits",mr); PHIODataNode* mumhitsNode = new PHIODataNode(mumhits,"mumhits"); geaNode->addNode(mumhitsNode); mr=1; mumgeoWrapper* mumgeo = new mumgeoWrapper("mumgeo",mr); PHIODataNode* mumgeoNode = new PHIODataNode(mumgeo,"mumgeo"); parNode->addNode(mumgeoNode); mr=5000; dMutCathodeChargeWrapper* dMutCathodeCharge = new dMutCathodeChargeWrapper("dMutCathodeCharge",mr); PHIODataNode* dMutCathodeChargeNode = new PHIODataNode(dMutCathodeCharge,"dMutCathodeCharge"); mutNode->addNode(dMutCathodeChargeNode); mr=510; dMutCathodesFEMWrapper* dMutCathodesFEM = new dMutCathodesFEMWrapper("dMutCathodesFEM",mr); PHIODataNode* dMutCathodesFEMNode = new PHIODataNode(dMutCathodesFEM,"dMutCathodesFEM"); mutNode->addNode(dMutCathodesFEMNode); mr=510; dMutCathodesFEMMCWrapper* dMutCathodesFEMMC = new dMutCathodesFEMMCWrapper("dMutCathodesFEMMC",mr); PHIODataNode* dMutCathodesFEMMCNode = new PHIODataNode(dMutCathodesFEMMC,"dMutCathodesFEMMC"); evaNode->addNode(dMutCathodesFEMMCNode); mr=20; dMutAnodesFEMWrapper* dMutAnodesFEM = new dMutAnodesFEMWrapper("dMutAnodesFEM ",mr); PHIODataNode* dMutAnodesFEMNode = new PHIODataNode(dMutAnodesFEM ,"dMutAnodesFEM "); mutNode->addNode(dMutAnodesFEMNode); mr=20; dMutAnodesFEMMCWrapper* dMutAnodesFEMMC = new dMutAnodesFEMMCWrapper("dMutAnodesFEMMC",mr); PHIODataNode* dMutAnodesFEMMCNode = new PHIODataNode(dMutAnodesFEMMC,"dMutAnodesFEMMC"); evaNode->addNode(dMutAnodesFEMMCNode); // ends of the definition of output tables for module mMutXYtoFE // begining of table def for mMutZeroSup mr=510; dMutCathodesDCMWrapper* dMutCathodesDCM = new dMutCathodesDCMWrapper("dMutCathodesDCM",mr); PHIODataNode* dMutCathodesDCMNode = new PHIODataNode(dMutCathodesDCM,"dMutCathodesDCM"); dcmNode->addNode(dMutCathodesDCMNode); mr=510; dMutCathodesDCMMCWrapper* dMutCathodesDCMMC = new dMutCathodesDCMMCWrapper("dMutCathodesDCMMC",mr); PHIODataNode* dMutCathodesDCMMCNode = new PHIODataNode(dMutCathodesDCMMC,"dMutCathodesDCMMC"); evaNode->addNode(dMutCathodesDCMMCNode); mr=20; dMutAnodesDCMWrapper* dMutAnodesDCM = new dMutAnodesDCMWrapper("dMutAnodesDCM",mr); PHIODataNode* dMutAnodesDCMNode = new PHIODataNode(dMutAnodesDCM,"dMutAnodesDCM"); dcmNode->addNode(dMutAnodesDCMNode); mr=20; dMutAnodesDCMMCWrapper* dMutAnodesDCMMC = new dMutAnodesDCMMCWrapper("dMutAnodesDCMMC",mr); PHIODataNode* dMutAnodesDCMMCNode = new PHIODataNode(dMutAnodesDCMMC,"dMutAnodesDCMMC"); evaNode->addNode(dMutAnodesDCMMCNode); mr=1; dMutCSCGeomWrapper* dMutCSCGeom = new dMutCSCGeomWrapper("dMutCSCGeom",mr); PHIODataNode* dMutCSCGeomNode = new PHIODataNode(dMutCSCGeom,"dMutCSCGeom"); geaNode->addNode(dMutCSCGeomNode); } // check on PISA-to-PRDF mode if(simulationFlag == 2) { // Insertions here for the initializations needed for // event reconstruction in PISA-to-DST mode when a PRDF is not written // cout << "ERROR: simulatationFlag=2 not yet implemented for Muons" << endl; return; } // check on PISA-to-DST mode } // check on PISA-to-DST or PISA-to-PRDF mode #ifdef DEBUG cout << "Finished Instantiating Tables\n"; #endif #ifdef DEBUG cout << "Finished setting MuID control parameters\n"; #endif // Leave module here that are required for response chain mMuiReadout = new mMuiReadoutModule; mMuiChannelGhitRel = new mMuiChannelGhitRelModule ; mMuiFEMToDCM = new mMuiFEMToDCMModule ; mMuiRawToFEM = new mMuiRawToFEMModule ; mMutXYtoFEEM = new mMutXYtoFEE; mMutZeroSup = new mMutZeroSupModule; #ifdef DEBUG cout << "Finished instantiating analysis modules\n"; #endif } void ana_mui() { if(simulationFlag == 2 || simulationFlag == 3) { // // insertions here for the event-by-event slow simulator code // which initially processes the PISA hits information // } // check on PISA-to-DST or PISA-to-PRDF mode if(simulationFlag == 3) { // // insertions here for the event-by-event FEM and DCM modules // mMuiReadout->event(topNode); mMuiRawToFEM->event(topNode); mMuiFEMToDCM->event(topNode); mMuiChannelGhitRel->event(topNode); MuiPutDCM(topNode); // put DCM table in PRDF node and On-Line buffers mMutXYtoFEEM->event(topNode); // mMutZeroSup->event(topNode); MutPutDCM(topNode); return; // simulationFlag = 3 means no event reconstruction } // check on PISA-to-PRDF mode if(simulationFlag == 2) { // // insertions here for any special PISA-to-DST event-by-event modules // needed for reconstruction not from a simulated PRDF // cout << "ERROR: simulationFlag=2 not yet implemented for Muons" << endl; } // check on PISA-to-DST mode if (evaluationFlag) { pisarun->GetOneEvent(pisaEventArray, &kPisaEvent, TTArray, nFiles); } mMuoReco->event_unpack(topNode); mMuoReco->event_cluster(topNode); mMuoReco->event_reco(topNode); if (evaluationFlag) { // Clean up PISA memory use at end of full event pisarun->HitsClear(); // releases memory assigned to XxxPISAHit globals } return; } void end_mui() { mMuoReco->end(topNode); }