diff --git a/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.cxx b/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.cxx index fa0afd4f6fcbfe629fd59a0b679f0239e86e3b4f..65d631d9ef73aa3efecf5ecada50a9788ab534d5 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.cxx @@ -74,9 +74,22 @@ StatusCode ComboHypo::finalize() { } -StatusCode ComboHypo::copyDecisions( const DecisionIDContainer& passing, const EventContext& context ) const { - +StatusCode ComboHypo::copyDecisions( std::map<TrigCompositeUtils::DecisionID, std::vector< std::pair<uint32_t,uint16_t> >> & passingCombinations, const EventContext& context ) const { + DecisionIDContainer passing; + for (auto const& element : passingCombinations) { + passing.insert(element.first); + } ATH_MSG_DEBUG( "Copying "<<passing.size()<<" positive decisions to outputs"); + + +// } + + +// StatusCode ComboHypo::copyDecisions( const DecisionIDContainer& passing, const EventContext& context ) const { + + + +// ATH_MSG_DEBUG( "Copying "<<passing.size()<<" positive decisions to outputs"); for ( size_t input_counter = 0; input_counter < m_inputs.size(); ++input_counter ) { // new output decisions @@ -85,9 +98,9 @@ StatusCode ComboHypo::copyDecisions( const DecisionIDContainer& passing, const E auto inputHandle = SG::makeHandle( m_inputs.at(input_counter), context ); if ( inputHandle.isValid() ) { - + int index=0; for (const Decision* inputDecision : *inputHandle) { - + std::pair<uint32_t,uint16_t> thiscomb(input_counter, index); DecisionIDContainer inputDecisionIDs; decisionIDs( inputDecision, inputDecisionIDs ); @@ -100,6 +113,10 @@ StatusCode ComboHypo::copyDecisions( const DecisionIDContainer& passing, const E DecisionIDContainer finalIds; for (const DecisionID c : common){ const HLT::Identifier cID = HLT::Identifier(c); + // add teh decID only if this candidate passed the combination selection + auto Comb=passingCombinations[c]; + if(std::find(Comb.begin(), Comb.end(), thiscomb) == Comb.end()) continue; + finalIds.insert( cID.numeric() ); // all Ids used by the Filter, including legs if (TrigCompositeUtils::isLegId ( cID )){ const HLT::Identifier mainChain = TrigCompositeUtils::getIDFromLeg( cID ); @@ -113,7 +130,9 @@ StatusCode ComboHypo::copyDecisions( const DecisionIDContainer& passing, const E << (TrigCompositeUtils::findLink<TrigRoiDescriptorCollection>(newDec, initialRoIString())).isValid() << " valid initialRoI and "<< TrigCompositeUtils::getLinkToPrevious(newDec).size() <<" previous decisions; valid Ids="<<finalIds.size()) ; + insertDecisionIDs( finalIds, newDec ); + index++; } } @@ -139,27 +158,24 @@ StatusCode ComboHypo::execute(const EventContext& context ) const { DecisionIDContainer passing; // this map is filled with the count of positive decisions from each input + // it maps decidionID to the combinations (list of dec object) that passed that ID CombinationMap dmap; - std::map<TrigCompositeUtils::DecisionID,std::map<int, int>> dmapFeatures; + uint nRequiredUnique; ATH_CHECK( fillDecisionsMap( dmap, context ) ); + //this is added for hypocombo tools: + CombinationMap GoodMultCombMap; - //this is added for hypocombo tools: - // all possible combinations - typedef std::vector<std::pair<int,int>> Combinations; // vector of vector of decision that satisfy the mult. requirement (for each leg) - // each legs contains the elements that satisfy it - std::map <TrigCompositeUtils::DecisionID, std::vector<Combinations>> IDCombMap; + // first check multiplicity: - int nmaps=0; - for ( const auto& m : m_multiplicitiesReqMap ) { + for ( const auto& m : m_multiplicitiesReqMap ) { // loop over all chains uint32_t nRequiredUnique = 0; const HLT::Identifier chain = HLT::Identifier(m.first); const std::vector<int>& multiplicityPerLeg = m.second; const DecisionID requiredDecisionID = chain.numeric(); - DecisionIDContainer allDecisionIds; allDecisionIds.insert(requiredDecisionID); @@ -189,7 +205,6 @@ StatusCode ComboHypo::execute(const EventContext& context ) const { } //check this leg of the chain passes with required multiplicity - const size_t observedMultiplicity = it->second.getCombinations().size(); ATH_MSG_DEBUG( "Required multiplicity " << requiredMultiplicity << " for leg " << legId << ": observed multiplicity " << observedMultiplicity << " in leg " << legIndex ); @@ -198,22 +213,8 @@ StatusCode ComboHypo::execute(const EventContext& context ) const { overallDecision = false; break; } - - - auto decisionsPerLeg = dmap[ requiredDecisionIDLeg ]; - IDCombMap[requiredDecisionID].push_back(decisionsPerLeg); - - const size_t uniqueDecisionsInLeg = dmapFeatures[requiredDecisionIDLeg].size(); - - //check that the multiplicity of unique features is high enough - ATH_MSG_DEBUG("Number of unique decisions per Leg: "<<uniqueDecisionsInLeg<<", number of required decisions: "<<requiredMultiplicity); - if(uniqueDecisionsInLeg<requiredMultiplicity) overallDecision=false; - else - allDecisionIds.insert(requiredDecisionIDLeg); - for (auto feat: dmapFeatures[requiredDecisionIDLeg]){ - uniqueDecisions.insert( feat.first ); + //keep track of the number of unique features - for (const auto& entry : it->second.getFeatures()){ if (entry.first == 0) { ATH_MSG_WARNING("Disregarding feature hash of zero"); @@ -223,6 +224,8 @@ StatusCode ComboHypo::execute(const EventContext& context ) const { // TODO - do something with entry.second (the ROI) } + // save combinations for the tools + //GoodMultCombMap.insert (*it); allDecisionIds.insert(requiredDecisionIDLeg); } @@ -237,27 +240,44 @@ StatusCode ComboHypo::execute(const EventContext& context ) const { if ( overallDecision == true ) { for (auto decID: allDecisionIds) { passing.insert( passing.end(), decID ); + GoodMultCombMap.insert ( *dmap.find(decID)); ATH_MSG_DEBUG(" Passing " << HLT::Identifier(decID)); } } } + // need to extend CombinationMap, for now just do the simple exercise: + // launching the tools: + // get all the decisions + std::vector<TrigCompositeUtils::DecisionContainer> decisions; + // can we use EL: const ElementLinkVector<DecisionContainer> ? + for ( size_t i = 0; i < m_inputs.size(); ++i ) { + auto inputHandle = SG::makeHandle( m_inputs.at(i), context ); + decisions.push_back(*inputHandle); + } + - DecisionIDContainer passingIds; + std::map<TrigCompositeUtils::DecisionID, std::vector< std::pair<uint32_t,uint16_t> >> passingCombinations; for ( auto& tool: m_hypoTools ) { - ATH_CHECK( tool->decide( IDCombMap, passingIds ) ); + ATH_MSG_DEBUG( "Calling tool "<<tool->name()); + ATH_CHECK( tool->decide( decisions, GoodMultCombMap, passingCombinations ) ); } + DecisionIDContainer passingTools; + for (auto const& element : passingCombinations) { + passingTools.insert(element.first); + } if (msgLvl(MSG::DEBUG)){ - for (auto p: passing) + for (auto p: passingTools) ATH_MSG_DEBUG("Passing "<<HLT::Identifier(p)); } - ATH_CHECK( copyDecisions( passing, context ) ); + // need to pass single combinations, since not all element pass the decID + ATH_CHECK( copyDecisions( passingCombinations, context ) ); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.h b/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.h index cdc132776c5c385356dc3c0b31f6a6e37b970629..4bd3f290a27cda47ae8ab02e14e01fae12643b52 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.h +++ b/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.h @@ -50,7 +50,9 @@ private: * @brief iterates over the inputs and for every object (no filtering) crates output object linked to input moving * the decisions that are mentioned in the passing set **/ - StatusCode copyDecisions( const TrigCompositeUtils::DecisionIDContainer& passing, const EventContext& context ) const; + + StatusCode copyDecisions( std::map<TrigCompositeUtils::DecisionID, std::vector< std::pair<uint32_t,uint16_t> >> & passingComb, const EventContext& context ) const; + //StatusCode copyDecisions( const TrigCompositeUtils::DecisionIDContainer& passing, const EventContext& context ) const; /** * @brief For a given Decision node from a HypoAlg, extracts type-less identification data on the node's Feature and seeding ROI. @@ -69,7 +71,7 @@ private: /** * @brief iterates over all inputs filling the multiplicity map for each input collection **/ - typedef std::map<TrigCompositeUtils::DecisionID, ComboHypoCombination> CombinationMap; + StatusCode fillDecisionsMap( CombinationMap& dmap, const EventContext& context) const; // ComboHypoTools diff --git a/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx b/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx index 2d0154830680a28c36f48e5f061768ed94697259..54062479f869dff5ddfd9bd1537e6227b1fae75e 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/components/DecisionHandling_entries.cxx @@ -3,13 +3,13 @@ #include "../TriggerSummaryAlg.h" #include "../ComboHypo.h" #include "../InputMakerForRoI.h" -#include "../MultiplicityComboHypoTool.h" +#include "../dRMuMuComboHypoTool.h" DECLARE_COMPONENT( DumpDecisions ) DECLARE_COMPONENT( RoRSeqFilter ) DECLARE_COMPONENT( TriggerSummaryAlg ) DECLARE_COMPONENT( ComboHypo ) DECLARE_COMPONENT( InputMakerForRoI ) -DECLARE_COMPONENT( MultiplicityComboHypoTool ) +DECLARE_COMPONENT( dRMuMuComboHypoTool ) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py index 7f19802b2a72e04dcf3e5653c3743f1922d8762c..d96e4abaaae2b9aec1017b6854c67d7576c491e3 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/EmuStepProcessingConfig.py @@ -51,12 +51,12 @@ def generateL1DecoderAndChains(): #data['l1muroi'][1] = '0,0,0,MU0;' data['msmu'][1] = 'eta:-1.2,phi:0.7,pt:1500,pt2:1500; eta:-1.1,phi:0.6,pt:1500,pt2:1500;' - # event 2: 2e+ 2mu : HLT_e5_e8_2mu6_L1EM3_EM5_L12MU6, HLT_mu6_e8_L1MU6_EM5 + # event 2: 2e+ 3mu : HLT_e5_e8_2mu6_L1EM3_EM5_L12MU6, HLT_mu6_e8_L1MU6_EM5 data['ctp'] [2] = 'HLT_mu6_L1MU6 HLT_mu8_L1MU10 HLT_mu10_L1MU10 HLT_mu8_1step_L1MU6 HLT_e20_L1EM10 HLT_e8_L1EM7 HLT_mu6_e8_L1MU6_EM5 HLT_mu6Comb_e8_L1MU6_EM5 HLT_e3_e5_L1EM3_EM5 HLT_2mu6_L12MU6 HLT_2mu6Comb_L12MU6 HLT_2mu4_bDimu_L12MU4 HLT_e5_e8_L1EM3_EM5 HLT_e5_e8_2mu6_L1EM3_EM5_L12MU6 HLT_mu6_mu6noL1_L1MU6' data['l1emroi'][2] = '1,0.2,0,EM3,EM5, EM7,EM15,EM20,EM50,EM100; 1,-1.1,0,EM3,EM5,EM7,EM15,EM20,EM50;' data['emclusters'][2]= 'eta:0.5,phi:0,et:120000; eta:1,phi:-1.2,et:65000;' - data['l1muroi'][2] = '2,0.5,0,MU6,MU8; 3,0.5,0,MU6,MU8,MU10;' - data['msmu'][2] = 'eta:-1.2,phi:0.7,pt:6500,pt2:8500; eta:-1.1,phi:0.6,pt:8500,pt2:8500;' + data['l1muroi'][2] = '2,0.5,0,MU6,MU8; 3,0.5,0,MU6,MU8,MU10;2.2,0.6,0,MU6;' + data['msmu'][2] = 'eta:-1.2,phi:0.7,pt:6500,pt2:8500; eta:-1.1,phi:0.6,pt:8500,pt2:8500;eta:-1.1,phi:0.6,pt:8500,pt2:8500;' #event 3: 1e + 1mu - HLT_mu6_e8_L1MU6_EM5 data['ctp'] [3] = 'HLT_mu20_L1MU10 HLT_mu10_L1MU10 HLT_mu8_L1MU10 HLT_mu8_1step_L1MU6 HLT_2mu8 HLT_e8_L1EM7 HLT_mu6_e8_L1MU6_EM5 HLT_mu6Comb_e8_L1MU6_EM5' @@ -188,7 +188,7 @@ def generateL1DecoderAndChains(): - + from TrigUpgradeTest.HLTSignatureHypoTools import dimuDrComboHypoTool @@ -200,29 +200,29 @@ def generateL1DecoderAndChains(): CombChains =[ - makeChain(name='HLT_mu6_e8_L1MU6_EM5', L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em", [mu11, el11], multiplicity=[1,1]), - ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ), +# makeChain(name='HLT_mu6_e8_L1MU6_EM5', L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu_em", [mu11, el11], multiplicity=[1,1]), +# ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ), - makeChain(name='HLT_mu6Comb_e8_L1MU6_EM5', L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu2_em", [mu12, el11], multiplicity=[1,1]), - ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ), +# makeChain(name='HLT_mu6Comb_e8_L1MU6_EM5', L1Thresholds=["MU6","EM5"], ChainSteps=[ ChainStep("Step1_mu2_em", [mu12, el11], multiplicity=[1,1]), +# ChainStep("Step2_mu_em", [mu21, el21], multiplicity=[1,1])] ), - makeChain(name='HLT_e5_e8_L1EM3_EM5', L1Thresholds=["EM3","EM5"], ChainSteps=[ ChainStep("Step1_2emAs", [el11, el11], multiplicity=[1,1]), - ChainStep("Step2_2emAs", [el21, el21], multiplicity=[1,1]) ]), - makeChain(name='HLT_e5_e8_2mu6_L1EM3_EM5_L12MU6', L1Thresholds=["EM3","EM5","MU6"], - ChainSteps=[ChainStep("Step1_2em_2mu", [el11,el11,mu11], multiplicity=[1,1,2]), - ChainStep("Step2_2em_2mu", [el21,el21,mu21], multiplicity=[1,1,2]) ]), - makeChain(name='HLT_2mu6_L12MU6', L1Thresholds=["MU6"], ChainSteps=[ ChainStep("Step1_2mu", [mu11], multiplicity=[2]), - ChainStep("Step2_2mu", [mu21], multiplicity=[2]) ]), +# makeChain(name='HLT_e5_e8_L12EM3', L1Thresholds=["EM3","EM3"], ChainSteps=[ ChainStep("Step1_2emAs", [el11, el11], multiplicity=[1,1]), +# ChainStep("Step2_2emAs", [el21, el21], multiplicity=[1,1]) ]), +# makeChain(name='HLT_e5_e8_2mu6_L1EM3_EM5_L12MU6', L1Thresholds=["EM3","EM5","MU6"], +# ChainSteps=[ChainStep("Step1_2em_2mu", [el11,el11,mu11], multiplicity=[1,1,2]), +# ChainStep("Step2_2em_2mu", [el21,el21,mu21], multiplicity=[1,1,2]) ]), + ## makeChain(name='HLT_2mu6_L12MU6', L1Thresholds=["MU6"], ChainSteps=[ ChainStep("Step1_2mu", [mu11], multiplicity=[2]), + ## ChainStep("Step2_2mu", [mu21], multiplicity=[2]) ]), - makeChain(name='HLT_2mu6Comb_L12MU6', L1Thresholds=["MU6"], ChainSteps=[ ChainStep("Step1_2mu_empty", multiplicity=[2]), - ChainStep("Step2_2mu", [mu21], multiplicity=[2]) ]), + ## makeChain(name='HLT_2mu6Comb_L12MU6', L1Thresholds=["MU6"], ChainSteps=[ ChainStep("Step1_2mu_empty", multiplicity=[2]), + ## ChainStep("Step2_2mu", [mu21], multiplicity=[2]) ]), - makeChain(name='HLT_2mu4_bDimu_L12MU4', L1Thresholds=["MU6"], ChainSteps=[ ChainStep("Step1_2mu", [mu11], multiplicity=[2]), - ChainStep("Step2_2mu22",[mu22], multiplicity=[2]), - ChainStep("Step3_2mu", [mu31], multiplicity=[2])] ), + makeChain(name='HLT_2mu4_bDimu_L12MU4', L1Thresholds=["MU6"], ChainSteps=[ ChainStep("Step1_2muDr", [mu11], multiplicity=[2], comboToolConfs=[dimuDrComboHypoTool])])#, + ## ChainStep("Step2_2mu22",[mu22], multiplicity=[2]), + ## ChainStep("Step3_2mu", [mu31], multiplicity=[2])] ), - makeChain(name='HLT_mu6_mu6noL1_L1MU6', L1Thresholds=["MU6", "FSNOSEED"], ChainSteps=[ ChainStep("Step1_2muAs", [mu11, mu11], multiplicity=[1,1]), - ChainStep("Step2_2muAs", [mu21, mu21], multiplicity=[1,1]) ]) + ## makeChain(name='HLT_mu6_mu6noL1_L1MU6', L1Thresholds=["MU6", "FSNOSEED"], ChainSteps=[ ChainStep("Step1_2muAs", [mu11, mu11], multiplicity=[1,1]), + ## ChainStep("Step2_2muAs", [mu21, mu21], multiplicity=[1,1]) ]) ] diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureConfig.py b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureConfig.py index 5845fed428eb13b94a0a9fbaacfc593d38b7c71b..0922cc1392923e757bcaf846f9116ef407aa467b 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureConfig.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureConfig.py @@ -63,7 +63,6 @@ def makeMuSequence(ConfigFlags, name,step): return makeSequence(ConfigFlags, name,step, signature="mu") - ## ##### electron signatures ## ########################## diff --git a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureHypoTools.py b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureHypoTools.py index b318d82a30f67b778ed712f41954b60a16024173..63c775c2d5f81f50ad7d2c3d260e6256b89dc4fd 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureHypoTools.py +++ b/Trigger/TrigValidation/TrigUpgradeTest/python/HLTSignatureHypoTools.py @@ -40,3 +40,12 @@ def getThreshold(chainDict, signature): from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import getChainThresholdFromName return getChainThresholdFromName( name.split("_"), signature) + +def dimuDrComboHypoTool(chainDict): + from DecisionHandling.DecisionHandlingConf import dRMuMuComboHypoTool + name = chainDict['chainName'] + print "ComboHypoTool drMuMu init: ", name + tool= dRMuMuComboHypoTool(name) + tool.DRcut=0.3 + return tool + diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDictTools.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDictTools.py index 51f0ad39fdf717d7cd971407592de8f913ec3423..d404a001734a7c8c1a5c37a7ddc24bc17e1e37b2 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDictTools.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/ChainDictTools.py @@ -86,7 +86,7 @@ def splitInterSignatureChainDict(chainDict): return listOfSplitChainDicts - +# maybe obsolete? def splitChainDict(chainDict): listOfChainDicts = [] for chainPart in chainDict['chainParts']: diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py index a7b7ce91b0766708266419d74589cb29ab6c29dc..4280c66ccbc3b58bae171579c9f82d3e7449ab52 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py @@ -304,7 +304,7 @@ def decisionTreeFromChains(HLTNode, chains, allDicts, newJO): # decode and attach HypoTools: for chain in chains: - chain.decodeHypoToolConfs() + chain.createHypoTools() log.debug("finalDecisions: %s", finalDecisions) if create_dot(): @@ -452,7 +452,7 @@ def generateDecisionTreeOld(HLTNode, chains, allChainDicts): ## Fill chain steps matrix for chain in chains: - chain.decodeHypoToolConfs()#allChainDicts) + chain.createHypoTools()#allChainDicts) for stepNumber, chainStep in enumerate(chain.steps): chainName = chainStep.name.split('_')[0] chainStepsMatrix[stepNumber][chainName].append(chain) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py index a2cc557f633ebdad2947577562b188e5a1b15cb5..92fb5b0763bc6cf28fe2da244ae1f39ff90d72bb 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuComponents.py @@ -224,12 +224,13 @@ class InputMakerNode(AlgNode): from DecisionHandling.DecisionHandlingConf import ComboHypo class ComboMaker(AlgNode): def __init__(self, name, multiplicity): - #Alg = RecoFragmentsPool.retrieve( self.create, name ) + Alg = RecoFragmentsPool.retrieve( self.create, name ) log.debug("ComboMaker init: Alg %s", name) - Alg = ComboHypo(name) + #Alg = ComboHypo(name) AlgNode.__init__(self, Alg, 'HypoInputDecisions', 'HypoOutputDecisions') self.prop="MultiplicitiesMap" self.mult=list(multiplicity) + self._hypoToolConf = [] def create (self, name): log.debug("ComboMaker.create %s",name) @@ -258,8 +259,20 @@ class ComboMaker(AlgNode): cval = self.Alg.getProperties()[self.prop] return cval - def addComboHypoTools(self, tools): - self.Alg.ComboHypoTools = tools + def addComboHypoToolConfs(self, comboToolConfs): + self._hypoToolConf = [ HypoToolConf( tool ) for tool in comboToolConfs ] + for conf in self._hypoToolConf: + print "CACCA addComboHypoToolConfs %s %s "%(self.Alg.name(), conf.name) + + def createComboHypoTools(self, chainDict): + # now configure hypotools + print "CACCA createComboHypoTools is called %s %d "%(self.Alg.name(), len(self._hypoToolConf)) + for conf in self._hypoToolConf: + print "CACCA createComboHypoTools ", conf.name + conf.setConf( chainDict ) + + self.Alg.ComboHypoTools = [conf.create() for conf in self._hypoToolConf] + print "Added comboTools in ", self.Alg @@ -477,7 +490,7 @@ class Chain(object): return legs - def decodeHypoToolConfs(self): + def createHypoTools(self): """ This is extrapolating the hypotool configuration from the chain name""" log.debug("decodeHypoToolConfs for chain %s", self.name) from TriggerMenuMT.HLTMenuConfig.Menu.ChainDictTools import splitChainInDict @@ -501,6 +514,8 @@ class Chain(object): for seq, onePartChainDict in zip(step.sequences, listOfChainDictsLegs): seq.createHypoTools( onePartChainDict ) + step.createComboHypoTools(listOfChainDictsLegs) + def __repr__(self): return "--- Chain %s --- \n + Seeds: %s \n + Steps: \n %s \n"%(\ @@ -589,7 +604,7 @@ class CFSequence(object): -class StepComp(object): +class StepComponent(object): """ Class to build hte ChainStep, for including empty sequences""" def __init__(self, sequence, multiplicity,empty): self.sequence=sequence @@ -598,7 +613,7 @@ class StepComp(object): class ChainStep(object): """Class to describe one step of a chain; if multiplicity is greater than 1, the step is combo/combined. Set one multiplicity value per sequence""" - def __init__(self, name, Sequences=[], multiplicity=[1], comboTools=[]): + def __init__(self, name, Sequences=[], multiplicity=[1], comboToolConfs=[]): self.name = name self.sequences=Sequences @@ -606,15 +621,22 @@ class ChainStep(object): self.isCombo=sum(multiplicity)>1 self.combo=None if self.isCombo: - self.makeCombo(Sequences, comboTools ) + self.makeCombo(Sequences, comboToolConfs ) self.decisions = [] - def makeCombo(self, Sequences, comboTools=[]): + def makeCombo(self, Sequences, comboToolConfs=[]): if len(Sequences)==0: return hashableMult = tuple(self.multiplicity) self.combo = RecoFragmentsPool.retrieve(createComboAlg, None, name=CFNaming.comboHypoName(self.name), multiplicity=hashableMult) - self.combo.addComboHypoTools(comboTools) + self.combo.addComboHypoToolConfs(comboToolConfs) + + def createComboHypoTools(self, listOfChainDictsLegs): + if self.isCombo: + print "CACCA I'm in the step creator" + chainDict = listOfChainDictsLegs[0] + self.combo.createComboHypoTools(chainDict) +