CMS 3D CMS Logo

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