Parent Directory
|
Revision Log
|
Revision Graph
see CL
// Interface with HLT framework // Date of first implementation : 25/2/2003 // Authors: Michela Biglietti <biglietti@na.infn.it> // Gabriella Cataldi <gabriella.cataldi@le.infn.it> #include <iostream> #include "TrigMoore/MooHLTAlgo.h" #include "TrigMoore/MooMakePhiSegmentSeeded.h" #include "TrigMoore/MooMakeCrudeRZSegmentsSeeded.h" #include "TrigMoore/MooRoI.h" #include "TrigMoore/ITrigMooreHisto.h" #include "TrigMoore/TrigMooreHisto.h" #include "TrigMoore/TrigMooreAANTuple.h" #include "TrigMoore/ITrigMooreNtuple.h" #include "TrigMoore/TrigMooreNtuple.h" #include "TrigT1Interfaces/TrigT1Interfaces_ClassDEF.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" #include "TrigT1Interfaces/RecMuonRoI.h" #include "RegionSelector/IRegSelSvc.h" #include "MooAlgs/MooMakePhiSegments.h" #include "MooAlgs/MooMakeCrudeRZSegments.h" #include "MooAlgs/MooMakeRoads.h" #include "MooAlgs/MooMakeTracks.h" #include "MooStatistics/MooSummary.h" #include "MooEvent/MooTrackContainer.h" #include "MooEvent/MdtSegmentContainer.h" #include "MuidStandAlone/MuidStandAlone.h" #include "MuidCombined/MuidCombined.h" #include "MuidEvent/MuidTrackContainer.h" #include "MuidEvent/Muid_ClassDEF.h" #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/IDataProviderSvc.h" #include "GaudiKernel/AlgFactory.h" #include "GaudiKernel/PropertyMgr.h" #include "GaudiKernel/IIncidentSvc.h" #include "GaudiKernel/INTupleSvc.h" #include "GaudiKernel/SmartDataPtr.h" #include "MuonDigitContainer/MdtDigitContainer.h" #include "MuonDigitContainer/MdtDigitCollection.h" #include "MuonDigitContainer/RpcDigitContainer.h" #include "MuonDigitContainer/RpcDigitCollection.h" #include "MuonDigitContainer/TgcDigitContainer.h" #include "MuonDigitContainer/TgcDigitCollection.h" #include "TrigMuonEvent/MuonFeature.h" #include "TrigMuonEvent/TrigMuonEFContainer.h" #include "TrigMuonEvent/TrigMuonEF.h" #include <sstream> // ---------------------------------------- MooHLTAlgo::MooHLTAlgo(const std::string& name, ISvcLocator* pSvcLocator) : FexAlgo(name, pSvcLocator), m_print_level(0), m_chronotest(false), m_seed(true), m_pRegionSelector(0), m_roi_num(0), m_track_num(0), m_muidtrack_num(0), m_muidcbtrack_num(0), m_roi("noSeed"), m_moore(0),// To run reco spectrometer m_muid(0), // To add vertex constraint m_muidcomb(0), // To match with inner detector m_ntupleID("222"), m_max_roi(10), m_prefix("tm_"), m_TrigMooreAANTuple(new TrigMooreAANTuple), m_pTrigMooreNtuple(0), m_nev(0), m_testbeam(false), m_doAANtuples(false), m_doNtuples(false), m_doHistos(false), m_doTimers(false), m_makeESD(false), m_makeAOD(false), m_AodForFexOff(true), m_seedFromLvl1(false), m_seedFromLvl2(false), m_deta(0), m_dphi(0), m_allMooreTracks(0), m_allMuidExtrTracks(0), m_allMuidCombTracks(0) { declareProperty("print_level", m_print_level); declareProperty("chrono_test", m_chronotest); declareProperty("seed", m_seed); declareProperty("MooreReconstruction", m_moore); declareProperty("MuonIdentification", m_muid); declareProperty("MuidComb", m_muidcomb); declareProperty("NtupleID", m_ntupleID); declareProperty("maxNumerofRoi", m_max_roi); declareProperty("testbeam", m_testbeam); declareProperty("NTupleVariablePrefix", m_prefix); declareProperty("doAANtuples", m_doAANtuples ); declareProperty("doNtuples", m_doNtuples ); declareProperty("doHistos", m_doHistos ); declareProperty("doTimers", m_doTimers ); declareProperty("makeESD", m_makeESD ); declareProperty("makeAOD", m_makeAOD ); declareProperty("makeAODforRoI", m_AodForFexOff); declareProperty("seedFromLvl1", m_seedFromLvl1 ); declareProperty("seedFromLvl2", m_seedFromLvl2 ); declareProperty("deltaEtaRoI", m_deta); declareProperty("deltaPhiRoI", m_dphi); } // ---------------------------------------- MooHLTAlgo::~MooHLTAlgo() { } // ---------------------------------------- HLT::ErrorCode MooHLTAlgo::hltInitialize() { StatusCode status; MsgStream ini_log(messageService(), name()); msg() << MSG::DEBUG << "Initializing MooHLTAlgo with Steps " << "Moore : " << m_moore << endreq; msg() << MSG::DEBUG << "Muid SA " << m_muid << endreq; msg() << MSG::DEBUG << "Muid CB " << m_muidcomb << endreq; if(msgLvl() <= MSG::DEBUG){ msg() << MSG::DEBUG <<"package version = "<<PACKAGE_VERSION<<endreq; msg() << MSG::DEBUG <<"Properties are set as follows: "<<endreq; msg() << MSG::DEBUG <<"print_level "<<m_print_level<<endreq; msg() << MSG::DEBUG <<"chrono_test "<<m_chronotest<<endreq; msg() << MSG::DEBUG <<"seed "<<m_seed<<endreq; msg() << MSG::DEBUG <<"MooreReconstruction "<<m_moore<<endreq; msg() << MSG::DEBUG <<"MuonIdentification "<<m_muid<<endreq; msg() << MSG::DEBUG <<"MuidComb "<<m_muidcomb<<endreq; msg() << MSG::DEBUG <<"NtupleID "<<m_ntupleID<<endreq; msg() << MSG::DEBUG <<"maxNumerofRoi "<<m_max_roi<<endreq; msg() << MSG::DEBUG <<"testbeam "<<m_testbeam<<endreq; msg() << MSG::DEBUG <<"NTupleVariablePrefix "<<m_prefix<<endreq; msg() << MSG::DEBUG <<"doAANtuples "<<m_doAANtuples <<endreq; msg() << MSG::DEBUG <<"doNtuples "<<m_doNtuples <<endreq; msg() << MSG::DEBUG <<"doHistos "<<m_doHistos <<endreq; msg() << MSG::DEBUG <<"doTimers "<<m_doTimers <<endreq; msg() << MSG::DEBUG <<"makeESD "<<m_makeESD <<endreq; msg() << MSG::DEBUG <<"makeAOD "<<m_makeAOD <<endreq; msg() << MSG::DEBUG <<"makeAODForROI "<<m_AodForFexOff <<endreq; msg() << MSG::DEBUG <<"seedFromLvl1 "<<m_seedFromLvl1 <<endreq; msg() << MSG::DEBUG <<"seedFromLvl2 "<<m_seedFromLvl2 <<endreq; msg() << MSG::DEBUG <<"deltaEtaRoI "<<m_deta<<endreq; msg() << MSG::DEBUG <<"deltaPhiRoI "<<m_dphi<<endreq; } // initializes chrono svc if (m_chronotest) chronosvc = chronoSvc(); // Locate the StoreGateSvc and initialize our local ptr status = service("StoreGateSvc", p_SGevent); if (!status.isSuccess() || 0 == p_SGevent){ msg() << MSG::ERROR << "MooHLTALGO::initialize() : Could not find StoreGateSvc" << endreq; return HLT::BAD_JOB_SETUP; } if(m_moore){ // Get the region selector tool: status = service("RegSelSvc", m_pRegionSelector); if(status.isFailure()) { msg() << MSG::FATAL << "Unable to retrieve RegionSelector Svc" << endreq; return HLT::BAD_JOB_SETUP; } // initialize the sub-algorithms if(m_seed) { msg() << MSG::DEBUG << "Initializing MooMakePhiSegmentsSeeded " << endreq; status = initializeAlgs("MooMakePhiSegmentSeeded", &m_MooMakePhiSegmentSeededAlgs); if (status.isFailure()) msg() << MSG::ERROR << "Cannot create sub-Alg of type MooMakePhiSegmentSeeded" << endreq; status = initializeAlgs("MooMakeCrudeRZSegmentsSeeded", &m_MooMakeCrudeRZSegmentsSeededAlgs); if (status.isFailure()) msg() << MSG::ERROR << "Cannot create sub-Alg of type MooMakeCrudeRZSegmentsSeeded" << endreq; }else{ msg() << MSG::DEBUG << "Initializing MooMakePhiSegments " << endreq; status = initializeAlgs("MooMakePhiSegments", &m_MooMakePhiSegmentsAlgs); if (status.isFailure()) msg() << MSG::ERROR << "Cannot create sub-Alg of type MooMakePhiSegments" << endreq; status = initializeAlgs("MooMakeCrudeRZSegments", &m_MooMakeCrudeRZSegmentsAlgs); if (status.isFailure()) msg() << MSG::ERROR << "Cannot create sub-Alg of type MooMakeCrudeRZSegments" << endreq; } /* if (m_testbeam) { msg() << MSG::INFO << "Initializing MuonTBSegmentmaker " << endreq; status = initializeAlgs("MuonTBSegmentMaker", &m_MuonTBSegmentMakerAlgs); if (status.isFailure()) msg() << MSG::ERROR << "Cannot create sub-Alg of type MuonTBSegmentMaker" << endreq; } */ msg() << MSG::DEBUG << "Initializing MooMakeRoads " << endreq; status = initializeAlgs("MooMakeRoads", &m_MooMakeRoadsAlgs); if (status.isFailure()) msg() << MSG::ERROR << "Cannot create sub-Alg of type MooMakeRoads" << endreq; msg() << MSG::DEBUG << "Initializing MooMakeTracks " << endreq; status = initializeAlgs("MooMakeTracks", &m_MooMakeTracksAlgs); if (status.isFailure()) msg() << MSG::ERROR << "Cannot create sub-Alg of type MooMakeTracks" << endreq; status = initializeAlgs("MooSummary", &m_MooSummaryAlgs); if (status.isFailure()) msg() << MSG::ERROR << "Cannot create sub-Alg of type MooSummary" << endreq; // TrigMooHisto initialization only if required. if (m_doHistos) { IToolSvc* toolSvc; status = service("ToolSvc",toolSvc); if(StatusCode::SUCCESS != status) { msg() << MSG::ERROR << "Histo monitor: can't get ToolSvc" << endreq; return HLT::BAD_JOB_SETUP; } else { msg() << MSG::DEBUG << "Histo monitor: I got ToolSvc" << endreq; } std::string toolName("TrigMooreHisto"); IAlgTool* bTool; if(toolSvc->retrieveTool(toolName, bTool, this).isFailure() ) { msg() << MSG::FATAL << "Histo monitor: Unable to create " << toolName << "AlgTool" << endreq; return HLT::BAD_JOB_SETUP; } else { m_monitoring = dynamic_cast<TrigMooreHisto*> (bTool); msg() << MSG::DEBUG << "Histo monitor: able to create m_monitoring" << toolName << "AlgTool" << endreq; } } } if(m_muid){ msg() << MSG::DEBUG << "Initializing MuidStandAlone " << endreq; status = initializeAlgs("MuidStandAlone", &m_MuidStandAloneAlgs); if (status.isFailure()) msg() << MSG::ERROR << "Cannot create sub-Alg of type MuidStandAlone" << endreq; } if (m_muidcomb){ msg() << MSG::DEBUG << "Initializing MuidComb " << endreq; status = initializeAlgs("MuidCombined", &m_MuidCombAlgs); if (status.isFailure()) msg() << MSG::ERROR << "Cannot create sub-Alg of type MuidComb" << endreq; } ////////////////////////////////////////////////////////////////////////// IIncidentSvc* pIncsvc; status = serviceLocator()->service("IncidentSvc", pIncsvc); int priority= 100; if ( status.isSuccess() ) { pIncsvc->addListener( this, "EndEvent", priority); } else { msg() << MSG::ERROR << "Could not register incident service " << endreq; } /////////////////////////////////////////// // ntuples init ////////////////////////////////////////// // Book the ntuple if(m_doNtuples){ status = toolSvc()->retrieveTool("TrigMooreNtuple", m_pTrigMooreNtuple); if(status.isFailure()) { msg() << MSG::FATAL << "Unable to retrieve TrigMooreNtuple tool" << endreq; return HLT::BAD_JOB_SETUP; } SmartDataPtr<NTuple::Directory> ntid(ntupleSvc(), "/NTUPLES/FILE1/CBNT"); if ( !ntid ){ msg() << MSG::DEBUG << "creating directory ... " << endreq; ntid = ntupleSvc()->createDirectory("/NTUPLES/FILE1/CBNT"); }else{ msg() << MSG::DEBUG << "Ntuple ID retrieved from the store " << endreq; } if ( ! ntid ) { msg() << MSG::WARNING << " unable to create ntuple directory" << endreq; return HLT::BAD_JOB_SETUP; } msg() << MSG::DEBUG << "ntuple ID " << m_ntupleID << endreq; if(m_moore){ msg() << MSG::DEBUG << "booking moore ntuples... " << endreq; m_ntuple = ntupleSvc()->book(ntid.ptr(), m_ntupleID, CLID_ColumnWiseTuple,"moore"); msg() << MSG::DEBUG << "declaring variables... " << endreq; status = m_pTrigMooreNtuple->bookNtuple(m_ntuple); if(!status.isSuccess() ) { msg() << MSG::ERROR << " failed to book Moore ntuple" << endreq; } else msg() << MSG::DEBUG << " Moore ntuple booked successfully" << endreq; } msg() << MSG::DEBUG << " bookNtuple done!" << endreq; if (m_ntuple){ if(!status.isSuccess() ) msg() << MSG::ERROR << " failed to book MooHLT ntuple" << endreq; }else { msg() << MSG::ERROR << " failed to book ntuple" << endreq; } } if (m_doAANtuples){ if (m_seedFromLvl1 || m_seedFromLvl2 || m_moore || m_muid || m_muidcomb) { m_TrigMooreAANTuple->SetNtuplePrefix(m_prefix); msg() << MSG::DEBUG << "ntuple variables prefix set to: " << m_prefix << endreq; // if(m_TrigMooreAANTuple->cleanBlocks(m_seedFromLvl1,m_seedFromLvl2,m_moore,m_muid,m_muidcomb).isFailure()) // log << MSG::WARNING << "cleanBlocks beginRun failed" << endreq; } } if(m_doTimers){ // add some timers: m_tTotal = addTimer("tTotal","nTracks"); m_tPhi = addTimer("tMakePhiSeg"); m_tRZ = addTimer("tMakeRZSeg"); m_tPhiSeeded = addTimer("tMakePhiSegSd"); m_tRZSeeded = addTimer("tMakeRZSegSd"); m_tMakeRoad = addTimer("tMakeRoad","nMdt"); m_tMakeTracks = addTimer("tMakeTracks","nRpc"); m_tMooSummary = addTimer("tMakeSummary"); m_tMuidSA = addTimer("tMuidSA","nTgc"); m_tMuidComb = addTimer("tMuidComb"); } msg() << MSG::DEBUG << "End of init MooHLTAlgo" << endreq; return HLT::OK; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * HLT::ErrorCode MooHLTAlgo::hltExecute(const HLT::TriggerElement* inputTE, HLT::TriggerElement* TEout){ msg() << MSG::DEBUG << ": Executing MooHLTAlgo::execHLTAlgorithm()" << endreq; if (m_chronotest) chronosvc->chronoStart("All Algos"); if(m_doTimers) m_tTotal->start(); HLT::ErrorCode hltStatus; StatusCode status; ////////////////////////////////////////////////////////////////// // Need to number the RoIs for object in the TDS ++m_roi_num; std::ostringstream s; s<<m_roi_num; std::string roi = "RoI"; m_roi = roi+s.str(); msg() << MSG::DEBUG << "RoI number : " << m_roi_num << " " << m_roi << endreq ; if(!m_seed&&m_roi_num>1) return HLT::OK; const LVL1::RecMuonRoI * muonRoIl1 = 0; const TrigRoiDescriptor * fakeRoI = 0; const MuonFeature * muonRoIL2 = 0; if(m_moore){ if (m_seed){ double etaRoI=0., phiRoI=0., thRoI=0.; std::string RoIType; const TrigRoiDescriptor* muonRoI = 0; hltStatus = getFeature(inputTE, muonRoI, "forMS"); if(muonRoI==0) { msg() << MSG::DEBUG << "Could not find RoIDescriptor <<forMS>>, " << "trying to recover the initial one." << endreq; hltStatus = getFeature(inputTE, muonRoI, ""); if(muonRoI==0) { msg() << MSG::DEBUG << "Initial one not accessible, problem here!" << endreq; return HLT::NAV_ERROR; } } //it must be a non zero pointer to the RoIDescriptor here!! //if (muonRoI){ // so ... use it msg() << MSG::DEBUG << "Got a RoiDescriptor from inputTE " << " phi " << muonRoI->phi0() << " eta " << muonRoI->eta0() << endreq; msg() << MSG::DEBUG << "ROI ID " << muonRoI->roiId() << endreq; msg() << MSG::DEBUG << "LVL1 ID " << muonRoI->l1Id() << endreq; if (m_doHistos) { msg() << MSG::DEBUG << "Histo monitor: Filling MuonRoI Histograms .... " << endreq; status=m_monitoring->fillTrigMooreHists(muonRoI); if(status.isFailure()){ msg() << MSG::DEBUG << "Unable to fill Histos" << endreq;} } //} if(m_seedFromLvl1){ /////////////////////////////////////////////// // Seeeded reconstruction from LVL1 muon RoIs // Get vector of of pointers to all MuonRecoRoIs with label "uses": msg() << MSG::DEBUG <<" seeding comes from Lvl1 simulation " << endreq; std::vector<const LVL1::RecMuonRoI*> vectorOfRecMuonRoI; msg() << MSG::VERBOSE <<"getting vector of RecMuonRoI from inputTE... " << endreq; hltStatus = getFeatures(inputTE,vectorOfRecMuonRoI, ""); if(hltStatus!=HLT::OK) return HLT::NAV_ERROR; msg() << MSG::VERBOSE <<"L1 MuonRecoRoI retrieved with status " << hltStatus << endreq; if(vectorOfRecMuonRoI.size() != 1){ msg() << MSG::ERROR << "Size of vector of Muon RoIs is not 1 but " << vectorOfRecMuonRoI.size() << endreq; // return StatusCode::FAILURE; } else { msg() << MSG::VERBOSE <<"getting a MuonRoI from vector of objects... " << endreq; muonRoIl1 = vectorOfRecMuonRoI.front(); if(!muonRoIl1) { msg() << MSG::ERROR << "Retrieval of RoI from vector failed" << endreq; status= false; } msg() << MSG::VERBOSE <<"DONE with status : " << status << endreq; if(muonRoIl1){ etaRoI = muonRoIl1->eta(); phiRoI = muonRoIl1->phi(); thRoI = muonRoIl1->getThresholdValue(); RoIType = "LVL1"; // msg() << MSG::DEBUG << "The position of the MuonRecoRoI is phi = " << phiRoI << " / eta = " << etaRoI << " / threshold = " << thRoI << endreq; } } } else if (m_seedFromLvl2) { msg() << MSG::DEBUG <<" seeding comes from Lvl2 " << endreq; std::vector<const MuonFeature*> vectorOfMuonFex; msg() << MSG::VERBOSE <<"getting vector of Muon Features from inputTE... " << endreq; hltStatus = getFeatures(inputTE,vectorOfMuonFex, ""); msg() << MSG::VERBOSE <<"DONE with status : " << hltStatus << endreq; if(vectorOfMuonFex.size() != 1) { msg() << MSG::DEBUG << "Size of vector of Muon Feature is not 1 but " << vectorOfMuonFex.size() << endreq; msg() << MSG::DEBUG << "... using RoiDescriptor with " << " phi " << muonRoI->phi0() << " eta " << muonRoI->eta0() << endreq; etaRoI = muonRoI->eta0(); phiRoI = muonRoI->phi0(); thRoI = 0; // return StatusCode::FAILURE; } else { msg() << MSG::VERBOSE <<"getting a Lvl2 Muon from vector of objects... " << endreq; muonRoIL2 = vectorOfMuonFex.front(); if(!muonRoIL2) { msg() << MSG::ERROR << "Retrieval of L2 RoI from vector failed" << endreq; status= false; } msg() << MSG::VERBOSE <<"MuonFeature retrieved with status : " << status << endreq; if(muonRoIL2){ phiRoI = muonRoIL2->phi(); etaRoI = muonRoIL2->eta(); thRoI = muonRoIL2->pt(); msg() << MSG::DEBUG <<"LVL2 phi/eta = "<<phiRoI<<"/"<<etaRoI<<" muonFeature.address " <<muonRoIL2->saddress()<<endreq; if ( muonRoIL2->saddress()==-1) { msg() << MSG::DEBUG << " The MuonFeature does not provide eta and phi in the EC" << endreq; //21/11/2006 temporary// The MuonFeature does not provide eta and phi in the EC phiRoI = muonRoI->phi0(); etaRoI = muonRoI->eta0(); msg() << MSG::DEBUG <<"Resetting LVL2 phi/eta with LVL1 RoiDescriptor = "<<phiRoI<<"/"<<etaRoI<<endreq; } RoIType = "LVL2"; msg() << MSG::DEBUG << "The position of the Muon Feature is phi = " << phiRoI << " / eta = " << etaRoI << " / pt = " << thRoI << endreq; } } } else { /////////////////////////////////////////////// // Seeded reconstruction from fake RoIs msg() << MSG::DEBUG <<" seeding comes from KINE fake RoIs " << endreq; msg() << MSG::VERBOSE <<"getting vector of fake RoI from inputTE... " << endreq; // Get RoiDescriptor hltStatus = getFeature(inputTE, fakeRoI, ""); if(!fakeRoI) { msg() << MSG::ERROR << "Retrieval of fake RoI from vector failed" << endreq; status= false; } msg() << MSG::DEBUG <<"DONE with status : " << status << endreq; if(fakeRoI){ etaRoI = fakeRoI->eta0(); phiRoI = fakeRoI->phi0(); thRoI = 1000; RoIType = "FAKE"; //should be DEBUG msg() << MSG::DEBUG << "The position of the fake RoI is phi = " << phiRoI << " / eta = " << etaRoI << " / roiId = " << fakeRoI->roiId() << " / l1Id = " << fakeRoI->l1Id() << endreq; } } double phiToRS = phiRoI; // phi must go from 0 to 2*pi if (phiToRS < 0) phiToRS += 2.*M_PI; double phiMin = phiToRS - m_dphi; double phiMax = phiToRS + m_dphi; if (phiMin < 0.) phiMin =+ 2.*M_PI; if (phiMax < 0.) phiMax =+ 2.*M_PI; if (phiMin > 2*M_PI) phiMin -= 2*M_PI; if (phiMax > 2*M_PI) phiMax -= 2*M_PI; msg()<<MSG::DEBUG<<"Phicentral = "<<phiToRS<<" Phi min, max = "<<phiMin<<" "<<phiMax<<endreq; msg()<<MSG::DEBUG<<"Etacentral = "<<etaRoI<<" Eta min, max = " <<etaRoI-m_deta<<" "<<etaRoI+m_deta<<endreq; std::vector<IdentifierHash> rpc_hash_ids; m_pRegionSelector->DetHashIDList(RPC, etaRoI-m_deta, etaRoI+m_deta, phiMin, phiMax, &rpc_hash_ids); std::vector<IdentifierHash> tgc_hash_ids; m_pRegionSelector->DetHashIDList(TGC, etaRoI-m_deta, etaRoI+m_deta, phiMin, phiMax,&tgc_hash_ids); std::vector<IdentifierHash> mdt_hash_ids; m_pRegionSelector->DetHashIDList(MDT, etaRoI-m_deta, etaRoI+m_deta, phiMin, phiMax, &mdt_hash_ids); std::vector<IdentifierHash> csc_hash_ids; m_pRegionSelector->DetHashIDList(CSC, etaRoI-m_deta, etaRoI+m_deta, phiMin, phiMax, &csc_hash_ids); msg() << MSG::DEBUG << "The size of RPC is " << rpc_hash_ids.size() << endreq; msg() << MSG::DEBUG << "The size of TGC is " << tgc_hash_ids.size() << endreq; msg() << MSG::DEBUG << "The size of MDT is " << mdt_hash_ids.size() << endreq; msg() << MSG::DEBUG << "The size of CSC is " << csc_hash_ids.size() << endreq; if(muonRoI==0 && fakeRoI==0 && muonRoIL2==0) { msg() << MSG::ERROR << "No RoI available... execution is over " << endreq; return HLT::ERROR; }else{ m_mooRoI = new MooRoI(etaRoI, phiRoI, thRoI, RoIType); m_mooRoI->setHashIds( new std::vector<IdentifierHash>(rpc_hash_ids), new std::vector<IdentifierHash>(tgc_hash_ids), new std::vector<IdentifierHash>(mdt_hash_ids), new std::vector<IdentifierHash>(csc_hash_ids) ); } if(removeCloseRoIs(m_mooRoI)){ msg() << MSG::DEBUG << "This RoI is close to an another one, will give the same result " << endreq; TEout->setActiveState(true); MooTrackContainer * mooreTracks = new MooTrackContainer(); status = p_SGevent->record(mooreTracks, m_roi); return HLT::OK; } else { msg() << MSG::VERBOSE << "This RoI is far from other RoIs... let's go on! " << endreq; } }//if m_seed if(m_seed) { msg() << MSG::DEBUG << "Executing MooMakePhiSegments Seeded " << endreq; if(m_doTimers) m_tPhiSeeded->start(); executeAlgsSeeded(&m_MooMakePhiSegmentSeededAlgs); if(m_doTimers) m_tPhiSeeded->stop(); msg() << MSG::DEBUG << "Executing MooMakeCrudeRZSegments Seeded " << endreq; if(m_doTimers) m_tRZSeeded->start(); executeAlgsSeeded(&m_MooMakeCrudeRZSegmentsSeededAlgs); if(m_doTimers) m_tRZSeeded->stop(); } else { msg() << MSG::DEBUG << "Executing MooMakePhiSegments " << endreq; if(m_doTimers) m_tPhi->start(); executeAlgs(&m_MooMakePhiSegmentsAlgs); if(m_doTimers) m_tPhi->stop(); msg() << MSG::DEBUG << "Executing MooMakeCrudeRZSegments" << endreq; if(m_doTimers) m_tRZ->start(); executeAlgs(&m_MooMakeCrudeRZSegmentsAlgs); if(m_doTimers) m_tRZ->stop(); } msg() << MSG::DEBUG << "Executing MooMakeRoads " << endreq; if(m_doTimers) m_tMakeRoad->start(); executeAlgs(&m_MooMakeRoadsAlgs); if(m_doTimers) m_tMakeRoad->stop(); msg() << MSG::DEBUG << "Executing MooMakeTracks " << endreq; if(m_doTimers) m_tMakeTracks->start(); executeAlgs(&m_MooMakeTracksAlgs); if(m_doTimers) m_tMakeTracks->stop(); if(m_doTimers) m_tMooSummary->start(); if(!m_testbeam){ msg() << MSG::DEBUG << "Executing MooSummary " << endreq; executeAlgs(&m_MooSummaryAlgs); } if(m_doTimers) m_tMooSummary->stop(); } //MuonIdentification if(m_muid){ msg() << MSG::DEBUG << "Executing MuidStandAlone " << endreq; if(m_doTimers) m_tMuidSA->start(); executeAlgs(&m_MuidStandAloneAlgs); if(m_doTimers) m_tMuidSA->stop(); } if(m_muidcomb){ msg() << MSG::DEBUG << "Executing MuidComb " << endreq; if(m_doTimers) m_tMuidComb->start(); executeAlgs(&m_MuidCombAlgs); if(m_doTimers) m_tMuidComb->stop(); } const MooTrackContainer * track_container = 0; const MuidTrackContainer * muid_track_container = 0; const MuidTrackContainer * cbTrackContainer = 0; std::string m_myautokey = ""; if(m_moore){ if (StatusCode::SUCCESS != p_SGevent->retrieve(track_container,m_roi) ) { msg() << MSG::ERROR << "Could not find Moore Track container" << endreq; if (!status) return HLT::SG_ERROR; } else { msg() << MSG::DEBUG << "Moore Track container retrieved with size : " << track_container->size() << endreq; if(m_AodForFexOff){ const double myMass = 105.7; TrigMuonEFContainer * myMuonEFCont = new TrigMuonEFContainer(); for(MooTrackContainer::const_iterator it = track_container->begin(); it!=track_container->end(); ++it){ const PerigeeParameters& perigee = (**it).perigee_parameters(); double myPhi = perigee.phi(); double myTheta = perigee.cot_theta(); double myIpt = std::fabs(perigee.inverse_pt()); double myCharge = perigee.charge(); std::string myRoi= m_roi; // int myCode = (**it).muon_code(); int myCode = 0; TrigMuonEF * mytrimuon = new TrigMuonEF(myIpt,myTheta,myPhi,myMass); mytrimuon->set_muonCode(myCode); mytrimuon->set_RoINum(myRoi); mytrimuon->set_Charge(myCharge); myMuonEFCont->push_back(mytrimuon); } msg() << MSG::DEBUG << "Attaching Moore Feature ... " << endreq; // getStoreGateKey(myMuonEFCont,m_myautokey ); //msg() << MSG::DEBUG << "Moore autoKey = " << m_myautokey << endreq; //recordAndAttachFeature(TEout, myMuonEFCont, m_myautokey, "MuonEF"); // now cellCollKey contains the unique key used by Navigation to store myFeature in SG // status = p_SGevent->record(myMuonEFCont, m_myautokey, false, false ); hltStatus = attachFeature(TEout, myMuonEFCont, "MuonEF"); if(hltStatus!=HLT::OK) msg() << MSG::DEBUG << "No MuonFeature per RoI" << endreq; }else{ msg() << MSG::DEBUG << "Attaching Moore Full Tracks ... " << endreq; hltStatus = attachFeature(TEout, track_container , "MuonEF"); if(hltStatus!=HLT::OK) msg() << MSG::DEBUG << "Only Track container record" << endreq; } if (m_doHistos) { MooTrackContainer * ptrigTrackContainer= const_cast<MooTrackContainer *>(track_container); msg() << MSG::DEBUG << "Histo Monitor: Filling Track_Container Histograms .... " << endreq; status=m_monitoring->fillTrigMooreHists(ptrigTrackContainer); if(status.isFailure()) msg() << MSG::DEBUG << "Unable to fill Histos" << endreq; } } } if(m_muid){ if (StatusCode::SUCCESS != p_SGevent->retrieve(muid_track_container,"MuidStandAlone"+m_roi) ) { msg() << MSG::DEBUG << "Could not find MuonIdentification Track container" << endreq; //return( StatusCode::FAILURE); } else { msg() << MSG::DEBUG << "Muid Extr Track container retrieved with size : " << muid_track_container->size() << endreq; if(m_AodForFexOff){ const double myMass = 105.7; TrigMuonEFContainer * myMuonEFCont = new TrigMuonEFContainer(); for(MuidTrackContainer::const_iterator it = muid_track_container->begin(); it!=muid_track_container->end(); ++it){ const PerigeeParameters& perigee = (**it).perigee_parameters(); double myPhi = perigee.phi(); double myTheta = perigee.cot_theta(); double myIpt = std::fabs(perigee.inverse_pt()); double myCharge = perigee.charge(); std::string myRoi= m_roi; int myCode = (**it).muon_code(); // int myCode = 1; TrigMuonEF * mytrimuon = new TrigMuonEF(myIpt,myTheta,myPhi,myMass); mytrimuon->set_muonCode(myCode); mytrimuon->set_RoINum(myRoi); mytrimuon->set_Charge(myCharge); myMuonEFCont->push_back(mytrimuon); } msg() << MSG::DEBUG << "Attaching Muid SA Feature ... " << endreq; // getStoreGateKey(myMuonEFCont,m_myautokey ); // msg() << MSG::DEBUG << "MuidSA autoKey = " << m_myautokey << endreq; //recordAndAttachFeature(TEout, myMuonEFCont, m_myautokey, "MuonExtrEF"); //status = p_SGevent->record(myMuonEFCont, m_myautokey, false, false ); hltStatus = attachFeature(TEout, myMuonEFCont, "MuonEF"); if(hltStatus!=HLT::OK) msg() << MSG::DEBUG << "No MuonFeature per RoI" << endreq; }else{ msg() << MSG::DEBUG << "Attaching Muid SA Full Tracks ... " << endreq; hltStatus = attachFeature(TEout, muid_track_container, "MuonExtrEF"); if(hltStatus!=HLT::OK) msg() << MSG::DEBUG << "Only Track container record" << endreq; } } } if(m_muidcomb){ if (StatusCode::SUCCESS == p_SGevent->retrieve(cbTrackContainer,"MuidCombinedHyb"+m_roi) ) { msg() << MSG::DEBUG << "Hyb Muid Comb Track container retrieved with size : " << cbTrackContainer->size() << endreq; if(m_AodForFexOff){ const double myMass = 105.7; TrigMuonEFContainer * myMuonEFCont = new TrigMuonEFContainer(); for(MuidTrackContainer::const_iterator it = cbTrackContainer->begin(); it!=cbTrackContainer->end(); ++it){ const PerigeeParameters& perigee = (**it).perigee_parameters(); double myPhi = perigee.phi(); double myTheta = perigee.cot_theta(); double myIpt = std::fabs(perigee.inverse_pt()); double myCharge = perigee.charge(); std::string myRoi= m_roi; int myCode = (**it).muon_code(); // int myCode = 1; TrigMuonEF * mytrimuon = new TrigMuonEF(myIpt,myTheta,myPhi,myMass); mytrimuon->set_muonCode(myCode); mytrimuon->set_RoINum(myRoi); mytrimuon->set_Charge(myCharge); myMuonEFCont->push_back(mytrimuon); } msg() << MSG::DEBUG << "Attaching Muid Comb Feature ... " << endreq; // getStoreGateKey( myMuonEFCont,m_myautokey ); // msg() << MSG::DEBUG << "MUID COMB Auto Key = " << m_myautokey << endreq; //recordAndAttachFeature(TEout, myMuonEFCont, m_myautokey, "MuonCombEF"); //status = p_SGevent->record(myMuonEFCont, m_myautokey, false, false ); //if(status.isFailure())msg() << MSG::DEBUG // << "No TrigElement per RoI" << endreq; hltStatus = attachFeature(TEout, myMuonEFCont, "MuonEF"); if(hltStatus!=HLT::OK) msg() << MSG::DEBUG << "No MuonFeature per RoI" << endreq; }else{ msg() << MSG::DEBUG << "Attaching Muid Comb Full Tracks ... " << endreq; hltStatus = attachFeature(TEout, cbTrackContainer, "MuonCombEF"); if(hltStatus!=HLT::OK) msg() << MSG::DEBUG << "Only Track container record" << endreq; } } else if (StatusCode::SUCCESS == p_SGevent->retrieve(cbTrackContainer,"MuidCombined"+m_roi) ) { msg() << MSG::DEBUG << "Muid Comb Track container retrieved with size : " << cbTrackContainer->size() << endreq; if(m_AodForFexOff){ const double myMass = 105.7; TrigMuonEFContainer * myMuonEFCont = new TrigMuonEFContainer(); for(MuidTrackContainer::const_iterator it = cbTrackContainer->begin(); it!=cbTrackContainer->end(); ++it){ const PerigeeParameters& perigee = (**it).perigee_parameters(); double myPhi = perigee.phi(); double myTheta = perigee.cot_theta(); double myIpt = std::fabs(perigee.inverse_pt()); double myCharge = perigee.charge(); std::string myRoi= m_roi; int myCode = (**it).muon_code(); // int myCode = 1; TrigMuonEF * mytrimuon = new TrigMuonEF(myIpt,myTheta,myPhi,myMass); mytrimuon->set_muonCode(myCode); mytrimuon->set_RoINum(myRoi); mytrimuon->set_Charge(myCharge); myMuonEFCont->push_back(mytrimuon); } msg() << MSG::DEBUG << "Attaching Muid Comb Feature ... " << endreq; // getStoreGateKey( myMuonEFCont,m_myautokey ); //msg() << MSG::DEBUG << "MuidCOmb autoKey = " << m_myautokey << endreq; //recordAndAttachFeature(TEout, myMuonEFCont, m_myautokey, "MuonCombEF"); //status = p_SGevent->record(myMuonEFCont, m_myautokey, false, false ); //if(status.isFailure())msg() << MSG::DEBUG // << "No TrigElement per RoI" << endreq; hltStatus = attachFeature(TEout, myMuonEFCont, "MuonEF"); if(hltStatus!=HLT::OK) msg() << MSG::DEBUG << "No MuonFeature per RoI" << endreq; }else{ msg() << MSG::DEBUG << "Attaching Muid Comb Full Tracks ... " << endreq; hltStatus = attachFeature(TEout,cbTrackContainer , "MuonCombEF"); if(hltStatus!=HLT::OK) msg() << MSG::DEBUG << "Only Track container record" << endreq; } } else { msg() << MSG::DEBUG << "NO idtrack Offline switch-on could not find MuonIdentification Comb Track container" << endreq; } } if(m_makeESD||m_makeAOD){ std::string mooKey = "TrigMooreTracks"; std::string muidExtrKey = "TrigMuidExtrTracksnoSeed"; std::string muidCombKey = "TrigMuidCombTracksnoSeed"; if(m_roi_num==1) { if(m_moore){ m_allMooreTracks = new MooTrackContainer(); status = p_SGevent->record(m_allMooreTracks, mooKey); if (status.isFailure()){ msg() << MSG::ERROR << "Record of Moore track into StoreGate failed" << endreq; return HLT::SG_ERROR; } else msg() << MSG::DEBUG << "Moore track saved in "<< mooKey << endreq; } if(m_muid){ m_allMuidExtrTracks = new MuidTrackContainer(); status = p_SGevent->record(m_allMuidExtrTracks, muidExtrKey); if (status.isFailure()){ msg() << MSG::ERROR << "Record of Muid extrapolated track into StoreGate failed" << endreq; return HLT::SG_ERROR; } else msg() << MSG::DEBUG << "Muid extrapolated track saved in " << muidExtrKey << endreq; } if(m_muidcomb){ m_allMuidCombTracks = new MuidTrackContainer(); status = p_SGevent->record(m_allMuidCombTracks, muidCombKey); if (status.isFailure()){ msg() << MSG::ERROR << "Record of Muid combined track into StoreGate failed" << endreq; return HLT::SG_ERROR; } else msg() << MSG::DEBUG << "Muid combined track saved in " << muidCombKey << endreq; } if(!m_seed){ msg() << MSG::DEBUG << "building ESD/AOD for the Wrapper " << endreq; if(track_container!=0){ for(MooTrackContainer::const_iterator it = track_container->begin(); it!=track_container->end(); ++it) m_allMooreTracks->push_back(new MooiPatTrack(**it)); } if(muid_track_container!=0){ for(MuidTrackContainer::const_iterator it1 = muid_track_container->begin(); it1!=muid_track_container->end(); ++it1){ MuidTrack * tmpTracksa = new MuidTrack(**it1); m_allMuidExtrTracks->push_back(tmpTracksa); } } if(cbTrackContainer!=0){ for(MuidTrackContainer::const_iterator it2 = cbTrackContainer->begin(); it2!=cbTrackContainer->end(); ++it2){ MuidTrack * tmpTrackcb = new MuidTrack(**it2); m_allMuidCombTracks->push_back(tmpTrackcb); } } } } if(m_seed){ msg() << MSG::DEBUG << "building ESD/AOD for the seeded " << endreq; if(m_moore){ if(track_container!=0){ msg() << MSG::DEBUG << "Preparing Moore Container for ESD " << endreq; for(MooTrackContainer::const_iterator mooit = track_container->begin(); mooit!=track_container->end(); ++mooit) { m_allMooreTracks->push_back(new MooiPatTrack(*(*mooit))); } } } if(m_muid){ if(muid_track_container!=0){ msg() << MSG::DEBUG << "Preparing Muid SA Container for ESD " << endreq; for(MuidTrackContainer::const_iterator muit = muid_track_container->begin(); muit!=muid_track_container->end(); ++muit){ m_allMuidExtrTracks->push_back(new MuidTrack(*(*muit))); } } } if(m_muidcomb){ if(cbTrackContainer!=0){ msg() << MSG::DEBUG << "Preparing Muid CB Container for ESD " << endreq; for(MuidTrackContainer::const_iterator cbit = cbTrackContainer->begin(); cbit!=cbTrackContainer->end(); ++cbit){ m_allMuidCombTracks->push_back(new MuidTrack(*(*cbit))); } } } } if (m_print_level>0){ if(m_moore){ const MooTrackContainer * testMooreTracks; if (StatusCode::SUCCESS != p_SGevent->retrieve(testMooreTracks,mooKey) ) { msg() << MSG::ERROR << "Could not find Moore Track container" << endreq; //return( StatusCode::FAILURE); } else msg() << MSG::DEBUG << "Moore tracks found with size " << testMooreTracks->size() << endreq; } if(m_muid){ const MuidTrackContainer * testMuidsaTracks; if (StatusCode::SUCCESS != p_SGevent->retrieve(testMuidsaTracks,muidExtrKey) ) { msg() << MSG::ERROR << "Could not find MuonIdentification Extr Track container" << endreq; //return( StatusCode::FAILURE); } else msg() << MSG::DEBUG << "Muid Extr tracks found with size " << testMuidsaTracks->size() << endreq; } if(m_muidcomb){ const MuidTrackContainer * testMuidTracks; if (StatusCode::SUCCESS != p_SGevent->retrieve(testMuidTracks,muidCombKey) ) { msg() << MSG::ERROR << "Could not find MuonIdentification Track container" << endreq; //return( StatusCode::FAILURE); } else msg() << MSG::DEBUG << "Muid tracks found with size " << testMuidTracks->size() << endreq; } } } if(m_moore){ if (track_container){ m_track_num += track_container->size(); if(m_doTimers) m_tTotal->propVal(track_container->size() ); } } //Let's suppose Moore always validates the sequence... TEout->setActiveState(true); if(m_doTimers) m_tTotal->stop(); if (m_chronotest) chronosvc->chronoStop("All Algos"); if (m_doAANtuples || m_doNtuples) { /////////////////////Fill Ntuples /////////////////////////// //FILL RECOMUONROI NTUPLE msg() << MSG::DEBUG << " Filling ntuples .... " << endreq; if (m_seedFromLvl1 || m_seedFromLvl2 || m_moore || m_muid || m_muidcomb) { if(m_TrigMooreAANTuple->cleanBlocks(m_seedFromLvl1,m_seedFromLvl2,m_moore,m_muid,m_muidcomb).isFailure()) msg() << MSG::WARNING << "cleanBlocks beginRun failed" << endreq; } if(m_moore){ if(m_seed&&m_seedFromLvl1){ msg() << MSG::DEBUG << " LVL1 ntuples .... " << endreq; if (m_doAANtuples) status = m_TrigMooreAANTuple->execLVL1Block(muonRoIl1,m_roi_num); if (status.isFailure()) { msg() << MSG::WARNING << " problems with lvl1 variables in the AAAntuple" << endreq; //return status; } if (m_doNtuples) status = m_pTrigMooreNtuple->fillLVL1Block(muonRoIl1,m_roi_num); if (status.isFailure()) { msg() << MSG::WARNING << " problems with lvl1 variables in the ntuple" << endreq; //return status; } }else if (m_seed&&m_seedFromLvl2){ msg() << MSG::DEBUG << " LVL2 ntuples .... " << endreq; if (m_doAANtuples) status = m_TrigMooreAANTuple->execLVL2Block(muonRoIL2,m_roi_num); if (status.isFailure()) { msg() << MSG::WARNING << " problems with AA lvl2 variables in the ntuple" << endreq; //return status; } if (m_doNtuples) status = m_pTrigMooreNtuple->fillLVL2Block(muonRoIL2,m_roi_num); if (status.isFailure()) { msg() << MSG::WARNING << " problems with lvl2 variables in the ntuple" << endreq; //return status; } } std::string key = "MDT_DIGITS"; const MdtDigitContainer * mdt_container; status = p_SGevent->retrieve(mdt_container,key); if (status.isFailure()) { msg() << MSG::ERROR << " Cannot retrieve MDT Digit Container " << endreq; return HLT::SG_ERROR; } int mdt_count = 0; // Loop on mdt collections for (MdtDigitContainer::const_iterator c = mdt_container->begin(); c != mdt_container->end(); ++c) { mdt_count += (*c)->size(); } if (m_doTimers) m_tMakeRoad->propVal(mdt_count); key = "RPC_DIGITS"; const RpcDigitContainer* rpc_container; status = p_SGevent->retrieve(rpc_container,key); if (status.isFailure()) { msg() << MSG::ERROR << " Cannot retrieve RPC Digit Container " << endreq; return HLT::SG_ERROR; } int rpc_count = 0; // Loop on collections for (RpcDigitContainer::const_iterator c = rpc_container->begin(); c != rpc_container->end(); ++c) rpc_count += (*c)->size(); if (m_doTimers) m_tMakeTracks->propVal(rpc_count ); key = "TGC_DIGITS"; const TgcDigitContainer* tgc_container; status = p_SGevent->retrieve(tgc_container,key); if (status.isFailure()) { msg() << MSG::ERROR << " Cannot retrieve TGC Digit Container " << endreq; return HLT::SG_ERROR; } int tgc_count = 0; // Loop on collections for (TgcDigitContainer::const_iterator c = tgc_container->begin(); c != tgc_container->end(); ++c) tgc_count += (*c)->size(); if (m_doTimers) m_tMuidSA->propVal(tgc_count ); //msg() << MSG::VERBOSE << " MOORE ntuples .... " << endreq; msg() << MSG::DEBUG << " MOORE ntuples .... " << endreq; if (m_doAANtuples) status = m_TrigMooreAANTuple->execMOOREBlock(track_container,m_track_num,m_roi_num); if (status.isFailure()) { msg() << MSG::WARNING << " problems with AA-Moore variables in the ntuple" << endreq; //return status; } if (m_doNtuples) status = m_pTrigMooreNtuple->fillMOOREBlock(track_container,m_track_num,m_roi_num); if (status.isFailure()) { msg() << MSG::WARNING << " problems with MOORE variables in the ntuple" << endreq; //return status; } } // m_moore if(m_muid){ if (muid_track_container) if (muid_track_container->size() > 0 ) { m_muidtrack_num += muid_track_container->size(); } msg() << MSG::DEBUG << " MUID STANDALONE ntuples .... " <<muid_track_container << endreq; if (m_doAANtuples) status = m_TrigMooreAANTuple->execMUIDBlock(muid_track_container,m_muidtrack_num, m_roi_num); if (status.isFailure()) { msg() << MSG::WARNING << " problems with AA MUID variables in the ntuple" << endreq; //return status; } if (m_doNtuples) status = m_pTrigMooreNtuple->fillMUIDBlock(muid_track_container,m_muidtrack_num, m_roi_num); if (status.isFailure()) { msg() << MSG::WARNING << " problems with MUID variables in the ntuple" << endreq; //return status; } } // m_muid if (m_muidcomb){ if(cbTrackContainer) if (cbTrackContainer->size() > 0 ) { m_muidcbtrack_num += cbTrackContainer ->size(); } msg() << MSG::DEBUG << " MUID COMB ntuples .... " << endreq; if (m_doAANtuples) status = m_TrigMooreAANTuple->execMUIDCBBlock(cbTrackContainer,m_muidcbtrack_num, m_roi_num); if (status.isFailure()) { msg() << MSG::WARNING << " problems with MUIDCB AA variables in the ntuple" << endreq; //return status; } if (m_doNtuples) status = m_pTrigMooreNtuple->fillMUIDCBBlock(cbTrackContainer,m_muidcbtrack_num, m_roi_num); if (status.isFailure()) { msg() << MSG::WARNING << " problems with MUIDCB variables in the ntuple" << endreq; //return status; } } // m_muidcomb if (m_doNtuples) { status = ntupleSvc()->writeRecord("/NTUPLES/FILE1/CBNT"+m_ntupleID); if (status.isFailure()) { msg() << MSG::WARNING << " problems with write record in the ntuple" << endreq; //return status; } } } return HLT::OK; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * HLT::ErrorCode MooHLTAlgo:: hltFinalize(){ if(msgLvl() <= MSG::DEBUG) msg() << MSG::DEBUG << "Finalizing MooHLTAlgo" << endreq; return HLT::OK; } //------------------------------------------------------ template<class T> StatusCode MooHLTAlgo::initializeAlgs(std::string mooalg_name, std::vector<T*>* mooAlgs){ MsgStream ini_log(messageService(), name()); StatusCode status = StatusCode::SUCCESS; // std::string mooAlgsName[1]={mooalg_name+"EF"}; std::string mooAlgsName = mooalg_name+"EF"; Algorithm* subalg; // const int nsub_algs = 1; //for (int i=0; i<nsub_algs; ++i){ status = createSubAlgorithm(mooalg_name, mooAlgsName, subalg); if (status.isFailure()){ ini_log << MSG::ERROR << "Cannot create " << mooAlgsName << endreq; } else { mooAlgs->push_back(dynamic_cast<T*>(subalg)); } // } return status; } //------------------------------------------------------ template<class T> void MooHLTAlgo::executeAlgs(std::vector<T*>* mooAlgs){ MsgStream log(messageService(), name()); StatusCode status = StatusCode::SUCCESS; const int NALGS = mooAlgs->size(); for (int ialg =0; ialg<NALGS; ++ialg ){ status=(*mooAlgs)[ialg]->setProperty(StringProperty("RoInumber",m_roi)); if (status.isFailure()){ log << MSG::DEBUG << "Unable to execute Algo" << endreq; } if ((*mooAlgs)[ialg]->name()=="MooMakeRoadsEF"){ status=(*mooAlgs)[ialg]->setProperty(StringProperty("CrudeMDTSegmentLocation",m_roi)); if (status.isFailure()){ log << MSG::DEBUG << "Property set failed" << endreq; } status=(*mooAlgs)[ialg]->setProperty(StringProperty("CrudeCSCSegmentLocation",m_roi)); if (status.isFailure()){ log << MSG::DEBUG << "Property set failed" << endreq; } status=(*mooAlgs)[ialg]->setProperty(StringProperty("PhiSegmentLocation",m_roi)); if (status.isFailure()){ log << MSG::DEBUG << "Property set failed" << endreq; } }else if ((*mooAlgs)[ialg]->name()=="MooMakeTracksEF"){ status=(*mooAlgs)[ialg]->setProperty(StringProperty("CrudeMDTSegmentLocation",m_roi)); if (status.isFailure()){ log << MSG::DEBUG << "Property set failed" << endreq; } status=(*mooAlgs)[ialg]->setProperty(StringProperty("CrudeCSCSegmentLocation",m_roi)); if (status.isFailure()){ log << MSG::DEBUG << "Property set failed" << endreq; } status=(*mooAlgs)[ialg]->setProperty(StringProperty("TrackLocation",m_roi)); if (status.isFailure()){ log << MSG::DEBUG << "Property set failed" << endreq; } } if (m_chronotest) chronosvc->chronoStart((*mooAlgs)[ialg]->name() ); status=(*mooAlgs)[ialg]->execute(); if (status.isFailure()){ log << MSG::DEBUG << "Unable to execute Algo" << endreq; } if (m_chronotest) chronosvc->chronoStop( (*mooAlgs)[ialg]->name() ); } } template<class T> void MooHLTAlgo::executeAlgsSeeded(std::vector<T*>* mooAlgs){ MsgStream log(messageService(), name()); StatusCode status = StatusCode::SUCCESS; const int NALGS = mooAlgs->size(); for (int ialg =0; ialg<NALGS; ++ialg ){ status=(*mooAlgs)[ialg]->setProperty(StringProperty("RoInumber",m_roi)); if (status.isFailure()){ log << MSG::DEBUG << "Unable to set property" << endreq; } if (m_chronotest) chronosvc->chronoStart((*mooAlgs)[ialg]->name() ); (*mooAlgs)[ialg]->setMuonRoI(m_mooRoI); status=(*mooAlgs)[ialg]->execute(); if (status.isFailure()){ log << MSG::DEBUG << "Unable to execute Algo" << endreq; } if (m_chronotest) chronosvc->chronoStop( (*mooAlgs)[ialg]->name() ); } } bool MooHLTAlgo::removeCloseRoIs(MooRoI * roi){ std::vector<IdentifierHash> mdtHashs = *roi->getMdtHashIds(); std::vector<IdentifierHash> rpcHashs = *roi->getRpcHashIds(); std::vector<IdentifierHash> tgcHashs = *roi->getTgcHashIds(); sort( mdtHashs.begin(), mdtHashs.end() ); sort( rpcHashs.begin(), rpcHashs.end() ); sort( tgcHashs.begin(), tgcHashs.end() ); if(m_RoIs.size()==0) { m_RoIs.push_back(roi); return false; } for(std::vector<MooRoI *>::const_iterator roiIt = m_RoIs.begin(); roiIt != m_RoIs.end(); ++roiIt){ std::vector<IdentifierHash> rpcHashsIt = *( (*roiIt)->getRpcHashIds() ) ; std::vector<IdentifierHash> tgcHashsIt = *( (*roiIt)->getTgcHashIds() ) ; std::vector<IdentifierHash> mdtHashsIt = *( (*roiIt)->getMdtHashIds() ) ; sort( mdtHashsIt.begin(), mdtHashsIt.end() ); sort( rpcHashsIt.begin(), rpcHashsIt.end() ); sort( tgcHashsIt.begin(), tgcHashsIt.end() ); // for(std::vector<int>::const_iterator it=mdtHashsIt.begin() ;it !=mdtHashsIt.end(); ++it ){ //std::cout << *it << std::endl; //} if ( includes(rpcHashsIt.begin(), rpcHashsIt.end(), rpcHashs.begin(), rpcHashs.end()) && includes(mdtHashsIt.begin(), mdtHashsIt.end(), mdtHashs.begin(), mdtHashs.end()) && includes(tgcHashsIt.begin(), tgcHashsIt.end(), tgcHashs.begin(), tgcHashs.end()) ){ //the processed RoiI is already included in one of those in the RoI list return true; } if (includes(rpcHashs.begin(), rpcHashs.end(), rpcHashsIt.begin(), rpcHashsIt.end()) && includes(mdtHashs.begin(), mdtHashs.end(), mdtHashsIt.begin(), mdtHashsIt.end()) && includes(tgcHashs.begin(), tgcHashs.end(), tgcHashsIt.begin(), tgcHashsIt.end()) ){ //the processed RoiI includes one in the RoI list // m_RoIs.erase(*roiIt); m_RoIs.push_back(roi); return true; } } m_RoIs.push_back(roi); return false; } void MooHLTAlgo::handle(const Incident &inc) { if ( inc.type() == "EndEvent"){ MsgStream log( messageService(), name() ); int outputLevel = msgSvc()->outputLevel( name() ); if(outputLevel <= MSG::DEBUG) log << MSG::DEBUG << "=====> End of Event" << endreq; m_roi_num = 0; m_track_num = 0; m_muidtrack_num = 0; m_muidcbtrack_num = 0; m_RoIs.clear(); if (!m_doAANtuples) return; if (m_seedFromLvl1 || m_seedFromLvl2 || m_moore || m_muid || m_muidcomb) { if(outputLevel <= MSG::DEBUG) log << MSG::DEBUG << "calling cleanBlocks" << endreq; if(m_TrigMooreAANTuple->cleanBlocks(m_seedFromLvl1,m_seedFromLvl2,m_moore,m_muid,m_muidcomb).isFailure()) log << MSG::WARNING << "end of event not correctly handled" << endreq; } } }
CERN Central CVS service | ViewVC Help |
Powered by ViewVC 1.0.4 |