CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/L1Trigger/GlobalTrigger/src/L1GlobalTriggerGTL.cc

Go to the documentation of this file.
00001 
00018 // this class header
00019 #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerGTL.h"
00020 
00021 // system include files
00022 #include <ext/hash_map>
00023 
00024 // user include files
00025 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerObjectMap.h"
00026 
00027 #include "CondFormats/L1TObjects/interface/L1GtFwd.h"
00028 
00029 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
00030 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
00031 
00032 #include "CondFormats/L1TObjects/interface/L1GtCondition.h"
00033 #include "CondFormats/L1TObjects/interface/L1GtAlgorithm.h"
00034 
00035 #include "CondFormats/L1TObjects/interface/L1GtMuonTemplate.h"
00036 #include "CondFormats/L1TObjects/interface/L1GtCaloTemplate.h"
00037 #include "CondFormats/L1TObjects/interface/L1GtEnergySumTemplate.h"
00038 #include "CondFormats/L1TObjects/interface/L1GtJetCountsTemplate.h"
00039 #include "CondFormats/L1TObjects/interface/L1GtHfBitCountsTemplate.h"
00040 #include "CondFormats/L1TObjects/interface/L1GtHfRingEtSumsTemplate.h"
00041 #include "CondFormats/L1TObjects/interface/L1GtCastorTemplate.h"
00042 #include "CondFormats/L1TObjects/interface/L1GtBptxTemplate.h"
00043 #include "CondFormats/L1TObjects/interface/L1GtExternalTemplate.h"
00044 #include "CondFormats/L1TObjects/interface/L1GtCorrelationTemplate.h"
00045 
00046 #include "CondFormats/L1TObjects/interface/L1MuTriggerScales.h"
00047 #include "CondFormats/DataRecord/interface/L1MuTriggerScalesRcd.h"
00048 #include "CondFormats/L1TObjects/interface/L1CaloGeometry.h"
00049 #include "CondFormats/DataRecord/interface/L1CaloGeometryRecord.h"
00050 
00051 #include "L1Trigger/GlobalTrigger/interface/L1GtConditionEvaluation.h"
00052 #include "L1Trigger/GlobalTrigger/interface/L1GtAlgorithmEvaluation.h"
00053 
00054 #include "L1Trigger/GlobalTrigger/interface/L1GlobalTriggerPSB.h"
00055 
00056 #include "L1Trigger/GlobalTrigger/interface/L1GtMuonCondition.h"
00057 #include "L1Trigger/GlobalTrigger/interface/L1GtCaloCondition.h"
00058 #include "L1Trigger/GlobalTrigger/interface/L1GtEnergySumCondition.h"
00059 #include "L1Trigger/GlobalTrigger/interface/L1GtJetCountsCondition.h"
00060 #include "L1Trigger/GlobalTrigger/interface/L1GtHfBitCountsCondition.h"
00061 #include "L1Trigger/GlobalTrigger/interface/L1GtHfRingEtSumsCondition.h"
00062 #include "L1Trigger/GlobalTrigger/interface/L1GtCastorCondition.h"
00063 #include "L1Trigger/GlobalTrigger/interface/L1GtBptxCondition.h"
00064 #include "L1Trigger/GlobalTrigger/interface/L1GtExternalCondition.h"
00065 #include "L1Trigger/GlobalTrigger/interface/L1GtCorrelationCondition.h"
00066 
00067 #include "L1Trigger/GlobalTrigger/interface/L1GtEtaPhiConversions.h"
00068 
00069 #include "FWCore/Utilities/interface/Exception.h"
00070 
00071 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00072 #include "FWCore/MessageLogger/interface/MessageDrop.h"
00073 
00074 #include "FWCore/Framework/interface/ESHandle.h"
00075 
00076 // forward declarations
00077 
00078 // constructor
00079 L1GlobalTriggerGTL::L1GlobalTriggerGTL() :
00080     m_candL1Mu( new std::vector<const L1MuGMTCand*>),
00081     m_isDebugEnabled(edm::isDebugEnabled())
00082 {
00083 
00084     m_gtlAlgorithmOR.reset();
00085     m_gtlDecisionWord.reset();
00086 
00087     // initialize cached IDs
00088     m_l1GtMenuCacheID = 0ULL;
00089     m_l1CaloGeometryCacheID = 0ULL;
00090     m_l1MuTriggerScalesCacheID = 0ULL;
00091 
00092     // pointer to conversion - actually done in the event loop (cached)
00093     m_gtEtaPhiConversions = new L1GtEtaPhiConversions();
00094 
00095 }
00096 
00097 // destructor
00098 L1GlobalTriggerGTL::~L1GlobalTriggerGTL() {
00099 
00100     reset();
00101     delete m_candL1Mu;
00102     delete m_gtEtaPhiConversions;
00103 
00104 }
00105 
00106 // operations
00107 void L1GlobalTriggerGTL::init(const int nrL1Mu, const int numberPhysTriggers) {
00108 
00109     m_candL1Mu->reserve(nrL1Mu);
00110 
00111     // FIXME move from bitset to std::vector<bool> to be able to use
00112     // numberPhysTriggers from EventSetup
00113 
00114     //m_gtlAlgorithmOR.reserve(numberPhysTriggers);
00115     //m_gtlAlgorithmOR.assign(numberPhysTriggers, false);
00116 
00117     //m_gtlDecisionWord.reserve(numberPhysTriggers);
00118     //m_gtlDecisionWord.assign(numberPhysTriggers, false);
00119 
00120 }
00121 
00122 // receive data from Global Muon Trigger
00123 void L1GlobalTriggerGTL::receiveGmtObjectData(edm::Event& iEvent,
00124     const edm::InputTag& muGmtInputTag, const int iBxInEvent, const bool receiveMu,
00125     const int nrL1Mu) {
00126 
00127     if (m_verbosity) {
00128         LogDebug("L1GlobalTriggerGTL")
00129                 << "\n**** L1GlobalTriggerGTL receiving muon data for BxInEvent = "
00130                 << iBxInEvent << "\n     from input tag " << muGmtInputTag << "\n"
00131                 << std::endl;
00132 
00133     }
00134 
00135     reset();
00136 
00137     // get data from Global Muon Trigger
00138     if (receiveMu) {
00139 
00140         edm::Handle<std::vector<L1MuGMTCand> > muonData;
00141         iEvent.getByLabel(muGmtInputTag, muonData);
00142 
00143         if (!muonData.isValid()) {
00144             if (m_verbosity) {
00145                 edm::LogWarning("L1GlobalTriggerGTL")
00146                         << "\nWarning: std::vector<L1MuGMTCand> with input tag "
00147                         << muGmtInputTag
00148                         << "\nrequested in configuration, but not found in the event.\n"
00149                         << std::endl;
00150             }
00151         } else {
00152 
00153             std::vector<L1MuGMTCand>::const_iterator itMuon;
00154             for (itMuon = muonData->begin(); itMuon != muonData->end(); itMuon++) {
00155                 if ((*itMuon).bx() == iBxInEvent) {
00156 
00157                     (*m_candL1Mu).push_back(&(*itMuon));
00158                     //LogTrace("L1GlobalTriggerGTL") << (*itMuon)
00159                     //        << std::endl;
00160 
00161                 }
00162 
00163             }
00164 
00165         }
00166     }
00167 
00168     if (m_verbosity && m_isDebugEnabled) {
00169         printGmtData(iBxInEvent);
00170     }
00171 
00172 }
00173 
00174 // run GTL
00175 void L1GlobalTriggerGTL::run(
00176         edm::Event& iEvent, const edm::EventSetup& evSetup,
00177         const L1GlobalTriggerPSB* ptrGtPSB,
00178         const bool produceL1GtObjectMapRecord,
00179         const int iBxInEvent,
00180         std::auto_ptr<L1GlobalTriggerObjectMapRecord>& gtObjectMapRecord,
00181         const unsigned int numberPhysTriggers,
00182         const int nrL1Mu,
00183         const int nrL1NoIsoEG, const int nrL1IsoEG,
00184         const int nrL1CenJet, const int nrL1ForJet, const int nrL1TauJet,
00185         const int nrL1JetCounts,
00186         const int ifMuEtaNumberBits, const int ifCaloEtaNumberBits) {
00187 
00188 
00189         // get / update the trigger menu from the EventSetup
00190     // local cache & check on cacheIdentifier
00191 
00192     unsigned long long l1GtMenuCacheID = evSetup.get<L1GtTriggerMenuRcd>().cacheIdentifier();
00193 
00194     if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
00195 
00196         edm::ESHandle< L1GtTriggerMenu> l1GtMenu;
00197         evSetup.get< L1GtTriggerMenuRcd>().get(l1GtMenu) ;
00198         m_l1GtMenu =  l1GtMenu.product();
00199         (const_cast<L1GtTriggerMenu*>(m_l1GtMenu))->buildGtConditionMap();
00200 
00201         m_l1GtMenuCacheID = l1GtMenuCacheID;
00202 
00203     }
00204 
00205     const std::vector<ConditionMap>& conditionMap = m_l1GtMenu->gtConditionMap();
00206     const AlgorithmMap& algorithmMap = m_l1GtMenu->gtAlgorithmMap();
00207 
00208     const std::vector<std::vector<L1GtMuonTemplate> >& corrMuon =
00209             m_l1GtMenu->corMuonTemplate();
00210 
00211     const std::vector<std::vector<L1GtCaloTemplate> >& corrCalo =
00212             m_l1GtMenu->corCaloTemplate();
00213 
00214     const std::vector<std::vector<L1GtEnergySumTemplate> >& corrEnergySum =
00215             m_l1GtMenu->corEnergySumTemplate();
00216 
00217     // conversion needed for correlation conditions
00218     // waste time - done also when no correlation template is in the menu
00219     // TODO timing against "search the conditionMap for correlation conditions,
00220     //      execute it conditionally?"
00221     bool convertScale = false;
00222 
00223     // get / update the calorimeter geometry from the EventSetup
00224     // local cache & check on cacheIdentifier
00225     unsigned long long l1CaloGeometryCacheID =
00226             evSetup.get<L1CaloGeometryRecord>().cacheIdentifier();
00227 
00228     if (m_l1CaloGeometryCacheID != l1CaloGeometryCacheID) {
00229 
00230         edm::ESHandle<L1CaloGeometry> l1CaloGeometry;
00231         evSetup.get<L1CaloGeometryRecord>().get(l1CaloGeometry) ;
00232         m_l1CaloGeometry =  l1CaloGeometry.product();
00233 
00234         m_l1CaloGeometryCacheID = l1CaloGeometryCacheID;
00235         convertScale = true;
00236 
00237     }
00238 
00239     // get / update the eta and phi muon trigger scales from the EventSetup
00240     // local cache & check on cacheIdentifier
00241     unsigned long long l1MuTriggerScalesCacheID =
00242             evSetup.get<L1MuTriggerScalesRcd>().cacheIdentifier();
00243 
00244     if (m_l1MuTriggerScalesCacheID != l1MuTriggerScalesCacheID) {
00245 
00246         edm::ESHandle< L1MuTriggerScales> l1MuTriggerScales;
00247         evSetup.get< L1MuTriggerScalesRcd>().get(l1MuTriggerScales);
00248         m_l1MuTriggerScales = l1MuTriggerScales.product();
00249 
00250         m_l1MuTriggerScalesCacheID = l1MuTriggerScalesCacheID;
00251         convertScale = true;
00252     }
00253 
00254     if (convertScale) {
00255         m_gtEtaPhiConversions->convert(m_l1CaloGeometry, m_l1MuTriggerScales,
00256                 ifCaloEtaNumberBits, ifMuEtaNumberBits);
00257     }
00258 
00259 
00260     // loop over condition maps (one map per condition chip)
00261     // then loop over conditions in the map
00262     // save the results in temporary maps
00263 
00264 
00265     std::vector<L1GtAlgorithmEvaluation::ConditionEvaluationMap> conditionResultMaps;
00266     conditionResultMaps.reserve(conditionMap.size());
00267 
00268     int iChip = -1;
00269 
00270     for (std::vector<ConditionMap>::const_iterator
00271                 itCondOnChip = conditionMap.begin(); itCondOnChip != conditionMap.end(); itCondOnChip++) {
00272 
00273         iChip++;
00274 
00275         //L1GtAlgorithmEvaluation::ConditionEvaluationMap cMapResults;
00276         L1GtAlgorithmEvaluation::ConditionEvaluationMap cMapResults((*itCondOnChip).size()); // hash map
00277 
00278         for (CItCond itCond = itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
00279 
00280             // evaluate condition
00281             switch ((itCond->second)->condCategory()) {
00282                 case CondMuon: {
00283 
00284                     L1GtMuonCondition* muCondition = new L1GtMuonCondition(itCond->second, this,
00285                             nrL1Mu, ifMuEtaNumberBits);
00286 
00287                     muCondition->setVerbosity(m_verbosity);
00288                     muCondition->evaluateConditionStoreResult();
00289 
00290                     cMapResults[itCond->first] = muCondition;
00291 
00292                     if (m_verbosity && m_isDebugEnabled) {
00293                         std::ostringstream myCout;
00294                         muCondition->print(myCout);
00295 
00296                         LogTrace("L1GlobalTriggerGTL") << myCout.str() << std::endl;
00297                     }
00298 
00299                     //delete muCondition;
00300 
00301                 }
00302                     break;
00303                 case CondCalo: {
00304 
00305                     L1GtCaloCondition* caloCondition = new L1GtCaloCondition(
00306                             itCond->second, ptrGtPSB,
00307                             nrL1NoIsoEG,
00308                             nrL1IsoEG,
00309                             nrL1CenJet,
00310                             nrL1ForJet,
00311                             nrL1TauJet,
00312                             ifCaloEtaNumberBits);
00313 
00314                     caloCondition->setVerbosity(m_verbosity);
00315                     caloCondition->evaluateConditionStoreResult();
00316 
00317                     cMapResults[itCond->first] = caloCondition;
00318 
00319                     if (m_verbosity && m_isDebugEnabled) {
00320                         std::ostringstream myCout;
00321                         caloCondition->print(myCout);
00322 
00323                         LogTrace("L1GlobalTriggerGTL") << myCout.str() << std::endl;
00324                     }
00325                     //                    delete caloCondition;
00326 
00327                 }
00328                     break;
00329                 case CondEnergySum: {
00330                     L1GtEnergySumCondition* eSumCondition = new L1GtEnergySumCondition(
00331                             itCond->second, ptrGtPSB);
00332 
00333                     eSumCondition->setVerbosity(m_verbosity);
00334                     eSumCondition->evaluateConditionStoreResult();
00335 
00336                     cMapResults[itCond->first] = eSumCondition;
00337 
00338                     if (m_verbosity && m_isDebugEnabled) {
00339                         std::ostringstream myCout;
00340                         eSumCondition->print(myCout);
00341 
00342                         LogTrace("L1GlobalTriggerGTL") << myCout.str() << std::endl;
00343                     }
00344                     //                    delete eSumCondition;
00345 
00346                 }
00347                     break;
00348                 case CondJetCounts: {
00349                     L1GtJetCountsCondition* jcCondition = new L1GtJetCountsCondition(
00350                             itCond->second, ptrGtPSB, nrL1JetCounts);
00351 
00352                     jcCondition->setVerbosity(m_verbosity);
00353                     jcCondition->evaluateConditionStoreResult();
00354 
00355                     cMapResults[itCond->first] = jcCondition;
00356 
00357                     if (m_verbosity && m_isDebugEnabled) {
00358                         std::ostringstream myCout;
00359                         jcCondition->print(myCout);
00360 
00361                         LogTrace("L1GlobalTriggerGTL") << myCout.str() << std::endl;
00362                     }
00363 
00364                     //                  delete jcCondition;
00365 
00366                 }
00367                     break;
00368                 case CondHfBitCounts: {
00369                     L1GtHfBitCountsCondition* bcCondition = new L1GtHfBitCountsCondition(
00370                             itCond->second, ptrGtPSB);
00371 
00372                     bcCondition->setVerbosity(m_verbosity);
00373                     bcCondition->evaluateConditionStoreResult();
00374 
00375                     cMapResults[itCond->first] = bcCondition;
00376 
00377                     if (m_isDebugEnabled ) {
00378                         std::ostringstream myCout;
00379                         bcCondition->print(myCout);
00380 
00381                         LogTrace("L1GlobalTriggerGTL") << myCout.str() << std::endl;
00382                     }
00383 
00384                     //                  delete bcCondition;
00385 
00386                 }
00387                     break;
00388                 case CondHfRingEtSums: {
00389                     L1GtHfRingEtSumsCondition* etCondition = new L1GtHfRingEtSumsCondition(
00390                             itCond->second, ptrGtPSB);
00391 
00392                     etCondition->setVerbosity(m_verbosity);
00393                     etCondition->evaluateConditionStoreResult();
00394 
00395                     cMapResults[itCond->first] = etCondition;
00396 
00397                     if (m_verbosity && m_isDebugEnabled) {
00398                         std::ostringstream myCout;
00399                         etCondition->print(myCout);
00400 
00401                         LogTrace("L1GlobalTriggerGTL") << myCout.str() << std::endl;
00402                     }
00403 
00404                     //                  delete etCondition;
00405 
00406                 }
00407                     break;
00408                 case CondCastor: {
00409                     bool castorCondResult = false;
00410 
00411                     // FIXME need a solution to read CASTOR
00412                     //if (castorConditionFlag) {
00413                     //    castorCondResult = castorData->conditionResult(itCond->first);
00414                     //}
00415 
00416                     L1GtCastorCondition* castorCondition = new L1GtCastorCondition(
00417                             itCond->second, castorCondResult);
00418 
00419                     castorCondition->setVerbosity(m_verbosity);
00420                     castorCondition->evaluateConditionStoreResult();
00421 
00422                     cMapResults[itCond->first] = castorCondition;
00423 
00424                     if (m_verbosity && m_isDebugEnabled) {
00425                         std::ostringstream myCout;
00426                         castorCondition->print(myCout);
00427 
00428                         LogTrace("L1GlobalTriggerGTL") << myCout.str() << std::endl;
00429                     }
00430 
00431                     //                  delete castorCondition;
00432 
00433                 }
00434                     break;
00435                 case CondBptx: {
00436                     bool bptxCondResult = true;
00437 
00438                     // FIXME need a solution to read BPTX with real value
00439 
00440                     L1GtBptxCondition* bptxCondition = new L1GtBptxCondition(
00441                             itCond->second, bptxCondResult);
00442 
00443                     bptxCondition->setVerbosity(m_verbosity);
00444                     bptxCondition->evaluateConditionStoreResult();
00445 
00446                     cMapResults[itCond->first] = bptxCondition;
00447 
00448                     if (m_verbosity && m_isDebugEnabled) {
00449                         std::ostringstream myCout;
00450                         bptxCondition->print(myCout);
00451 
00452                         LogTrace("L1GlobalTriggerGTL") << myCout.str() << std::endl;
00453                     }
00454 
00455                     //                  delete bptxCondition;
00456 
00457                 }
00458                     break;
00459                 case CondExternal: {
00460                     bool externalCondResult = true;
00461 
00462                     // FIXME need a solution to read External with real value
00463 
00464                     L1GtExternalCondition* externalCondition = new L1GtExternalCondition(
00465                             itCond->second, externalCondResult);
00466 
00467                     externalCondition->setVerbosity(m_verbosity);
00468                     externalCondition->evaluateConditionStoreResult();
00469 
00470                     cMapResults[itCond->first] = externalCondition;
00471 
00472                     if (m_verbosity && m_isDebugEnabled) {
00473                         std::ostringstream myCout;
00474                         externalCondition->print(myCout);
00475 
00476                         LogTrace("L1GlobalTriggerGTL") << myCout.str() << std::endl;
00477                     }
00478 
00479                     //                  delete externalCondition;
00480 
00481                 }
00482                     break;
00483                 case CondCorrelation: {
00484 
00485                     // get first the sub-conditions
00486                     const L1GtCorrelationTemplate* corrTemplate =
00487                         static_cast<const L1GtCorrelationTemplate*>(itCond->second);
00488                     const L1GtConditionCategory cond0Categ = corrTemplate->cond0Category();
00489                     const L1GtConditionCategory cond1Categ = corrTemplate->cond1Category();
00490                     const int cond0Ind = corrTemplate->cond0Index();
00491                     const int cond1Ind = corrTemplate->cond1Index();
00492 
00493                     const L1GtCondition* cond0Condition = 0;
00494                     const L1GtCondition* cond1Condition = 0;
00495 
00496                     // maximum number of objects received for evaluation of Type1s condition
00497                     int cond0NrL1Objects = 0;
00498                     int cond1NrL1Objects = 0;
00499 
00500                     int cond0EtaBits = 0;
00501                     int cond1EtaBits = 0;
00502 
00503                     switch (cond0Categ) {
00504                         case CondMuon: {
00505                             cond0Condition = &((corrMuon[iChip])[cond0Ind]);
00506                             cond0NrL1Objects = nrL1Mu;
00507                             cond0EtaBits = ifMuEtaNumberBits;
00508                         }
00509                             break;
00510                         case CondCalo: {
00511                             cond0Condition = &((corrCalo[iChip])[cond0Ind]);
00512 
00513                             switch ((cond0Condition->objectType())[0]) {
00514                                 case NoIsoEG:
00515                                     cond0NrL1Objects= nrL1NoIsoEG;
00516                                     break;
00517                                 case IsoEG:
00518                                     cond0NrL1Objects = nrL1IsoEG;
00519                                     break;
00520                                 case CenJet:
00521                                     cond0NrL1Objects = nrL1CenJet;
00522                                     break;
00523                                 case ForJet:
00524                                     cond0NrL1Objects = nrL1ForJet;
00525                                     break;
00526                                 case TauJet:
00527                                     cond0NrL1Objects = nrL1TauJet;
00528                                     break;
00529                                 default:
00530                                     cond0NrL1Objects = 0;
00531                                     break;
00532                             }
00533 
00534                             cond0EtaBits = ifCaloEtaNumberBits;
00535                         }
00536                             break;
00537                         case CondEnergySum: {
00538                             cond0Condition = &((corrEnergySum[iChip])[cond0Ind]);
00539                             cond0NrL1Objects = 1;
00540                         }
00541                             break;
00542                         default: {
00543                             // do nothing, should not arrive here
00544                         }
00545                             break;
00546                     }
00547 
00548                     switch (cond1Categ) {
00549                         case CondMuon: {
00550                             cond1Condition = &((corrMuon[iChip])[cond1Ind]);
00551                             cond1NrL1Objects = nrL1Mu;
00552                             cond1EtaBits = ifMuEtaNumberBits;
00553                         }
00554                             break;
00555                         case CondCalo: {
00556                             cond1Condition = &((corrCalo[iChip])[cond1Ind]);
00557 
00558                             switch ((cond1Condition->objectType())[0]) {
00559                                 case NoIsoEG:
00560                                     cond1NrL1Objects= nrL1NoIsoEG;
00561                                     break;
00562                                 case IsoEG:
00563                                     cond1NrL1Objects = nrL1IsoEG;
00564                                     break;
00565                                 case CenJet:
00566                                     cond1NrL1Objects = nrL1CenJet;
00567                                     break;
00568                                 case ForJet:
00569                                     cond1NrL1Objects = nrL1ForJet;
00570                                     break;
00571                                 case TauJet:
00572                                     cond1NrL1Objects = nrL1TauJet;
00573                                     break;
00574                                 default:
00575                                     cond1NrL1Objects = 0;
00576                                     break;
00577                             }
00578 
00579                              cond1EtaBits = ifCaloEtaNumberBits;
00580                         }
00581                             break;
00582                         case CondEnergySum: {
00583                             cond1Condition = &((corrEnergySum[iChip])[cond1Ind]);
00584                             cond1NrL1Objects = 1;
00585                         }
00586                             break;
00587                         default: {
00588                             // do nothing, should not arrive here
00589                         }
00590                             break;
00591                     }
00592 
00593                     L1GtCorrelationCondition* correlationCond =
00594                         new L1GtCorrelationCondition(itCond->second,
00595                             cond0Condition, cond1Condition,
00596                             cond0NrL1Objects, cond1NrL1Objects,
00597                             cond0EtaBits, cond1EtaBits,
00598                             this, ptrGtPSB, m_gtEtaPhiConversions);
00599 
00600                     correlationCond->evaluateConditionStoreResult();
00601                     correlationCond->setVerbosity(m_verbosity);
00602 
00603                     cMapResults[itCond->first] = correlationCond;
00604 
00605                     if (m_verbosity && m_isDebugEnabled) {
00606                         std::ostringstream myCout;
00607                         correlationCond->print(myCout);
00608 
00609                         LogTrace("L1GlobalTriggerGTL") << myCout.str() << std::endl;
00610                     }
00611 
00612                     //                  delete correlationCond;
00613 
00614                 }
00615                     break;
00616                 case CondNull: {
00617 
00618                     // do nothing
00619 
00620                 }
00621                     break;
00622                 default: {
00623 
00624                     // do nothing
00625 
00626                 }
00627                     break;
00628             }
00629 
00630         }
00631 
00632         conditionResultMaps.push_back(cMapResults);
00633 
00634     }
00635 
00636     // loop over algorithm map
00637 
00638     // empty vector for object maps - filled during loop
00639     std::vector<L1GlobalTriggerObjectMap> objMapVec;
00640     objMapVec.reserve(numberPhysTriggers);
00641 
00642     for (CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
00643 
00644         L1GtAlgorithmEvaluation gtAlg(itAlgo->second);
00645         gtAlg.evaluateAlgorithm((itAlgo->second).algoChipNumber(), conditionResultMaps);
00646 
00647         int algBitNumber = (itAlgo->second).algoBitNumber();
00648         bool algResult = gtAlg.gtAlgoResult();
00649 
00650         if (algResult) {
00651             m_gtlAlgorithmOR.set(algBitNumber);
00652         }
00653 
00654         // object maps only for BxInEvent = 0
00655         if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
00656 
00657             // set object map
00658             L1GlobalTriggerObjectMap objMap;
00659 
00660             objMap.setAlgoName(itAlgo->first);
00661             objMap.setAlgoBitNumber(algBitNumber);
00662             objMap.setAlgoGtlResult(algResult);
00663             objMap.setOperandTokenVector(gtAlg.operandTokenVector());
00664             objMap.setCombinationVector(*(gtAlg.gtAlgoCombinationVector()));
00665 
00666             if (m_verbosity && m_isDebugEnabled) {
00667                 std::ostringstream myCout1;
00668                 objMap.print(myCout1);
00669 
00670                 LogTrace("L1GlobalTriggerGTL") << myCout1.str() << std::endl;
00671             }
00672 
00673             objMapVec.push_back(objMap);
00674 
00675         }
00676 
00677         if (m_verbosity && m_isDebugEnabled) {
00678             std::ostringstream myCout;
00679             ( itAlgo->second ).print(myCout);
00680             gtAlg.print(myCout);
00681 
00682             LogTrace("L1GlobalTriggerGTL") << myCout.str() << std::endl;
00683         }
00684 
00685     }
00686 
00687     // object maps only for BxInEvent = 0
00688     if (produceL1GtObjectMapRecord && (iBxInEvent == 0)) {
00689         gtObjectMapRecord->setGtObjectMap(objMapVec);
00690     }
00691 
00692     // loop over condition maps (one map per condition chip)
00693     // then loop over conditions in the map
00694     // delete the conditions created with new, clear all
00695     for (std::vector<L1GtAlgorithmEvaluation::ConditionEvaluationMap>::iterator
00696         itCondOnChip = conditionResultMaps.begin(); itCondOnChip != conditionResultMaps.end();
00697         itCondOnChip++) {
00698 
00699         for (L1GtAlgorithmEvaluation::ItEvalMap itCond =
00700             itCondOnChip->begin(); itCond != itCondOnChip->end(); itCond++) {
00701 
00702             if (itCond->second != 0) {
00703                 delete itCond->second;
00704             }
00705             itCond->second = 0;
00706 
00707         }
00708 
00709         itCondOnChip->clear();
00710     }
00711 
00712     conditionResultMaps.clear();
00713 
00714 }
00715 
00716 // clear GTL
00717 void L1GlobalTriggerGTL::reset() {
00718 
00719     m_candL1Mu->clear();
00720 
00721     m_gtlDecisionWord.reset();
00722     m_gtlAlgorithmOR.reset();
00723 
00724 }
00725 
00726 // print Global Muon Trigger data received by GTL
00727 void L1GlobalTriggerGTL::printGmtData(const int iBxInEvent) const {
00728 
00729     LogTrace("L1GlobalTriggerGTL")
00730             << "\nL1GlobalTrigger: GMT data received for BxInEvent = "
00731             << iBxInEvent << std::endl;
00732 
00733     int nrL1Mu = m_candL1Mu->size();
00734     LogTrace("L1GlobalTriggerGTL")
00735             << "Number of GMT muons = " << nrL1Mu << "\n"
00736             << std::endl;
00737 
00738     for (std::vector<const L1MuGMTCand*>::const_iterator iter =
00739             m_candL1Mu->begin(); iter != m_candL1Mu->end(); iter++) {
00740 
00741         LogTrace("L1GlobalTriggerGTL") << *(*iter) << std::endl;
00742 
00743     }
00744 
00745     LogTrace("L1GlobalTriggerGTL") << std::endl;
00746 
00747 }