Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:18

0001 #include "L1Trigger/L1TCommon/src/Parameter.cc"
0002 #include "L1Trigger/L1TCommon/src/Mask.cc"
0003 #include "L1Trigger/L1TCommon/src/XmlConfigParser.cc"
0004 //#include "L1Trigger/L1TGlobal/interface/PrescalesVetosHelper.h"
0005 #include "L1Trigger/L1TCommon/interface/TriggerSystem.h"
0006 #include <iostream>
0007 #include <fstream>
0008 #include <algorithm>
0009 #include <strings.h> // strcasecmp
0010 // To compile run these lines in your CMSSW_X_Y_Z/src/ :
0011 /*
0012 cmsenv
0013 eval "setenv `scram tool info xerces-c | sed -n -e 's/INCLUDE=/XERC_INC /gp'`"
0014 eval "setenv `scram tool info xerces-c | sed -n -e 's/LIBDIR=/XERC_LIB /gp'`"
0015 eval "setenv `scram tool info boost    | sed -n -e 's/INCLUDE=/BOOST_INC /gp'`"
0016 eval "setenv `scram tool info boost    | sed -n -e 's/LIBDIR=/BOOST_LIB /gp'`"
0017 g++ -g -std=c++11 -o test readgt.cpp -I./ -I$CMSSW_BASE/src -I$CMSSW_RELEASE_BASE/src -I$XERC_INC -L$XERC_LIB -lxerces-c -I$BOOST_INC -L$BOOST_LIB -lboost_thread -lboost_signals -lboost_date_time -L$CMSSW_BASE/lib/$SCRAM_ARCH/ -L$CMSSW_RELEASE_BASE/lib/$SCRAM_ARCH/ -lFWCoreMessageLogger -lCondFormatsL1TObjects -lL1TriggerL1TCommon
0018 */
0019 
0020 using namespace std;
0021 
0022 int main(int argc, char *argv[]){
0023     // read the input xml file into a string
0024     list<string> sequence;
0025     map<string,string> xmlPayload;
0026     for(int p=1; p<argc; p++){
0027 
0028         ifstream input( argv[p] );
0029         if( !input ){ cout << "Cannot open " << argv[p] << " file" << endl; return 0; }
0030         sequence.push_back( argv[p] );
0031 
0032         size_t nLinesRead=0;
0033 
0034         while( !input.eof() ){
0035             string tmp;
0036             getline( input, tmp, '\n' );
0037             xmlPayload[ argv[p] ].append( tmp );
0038             nLinesRead++;
0039         }
0040 
0041         cout << argv[p] << ": read " << nLinesRead << " lines" << endl;
0042         input.close();
0043     }
0044 
0045   std::map<std::string,int> algoName2bit;
0046   algoName2bit["L1_ZeroBias"] = 0;
0047   algoName2bit["L1_BptxMinus_NotBptxPlus2"] = 1;
0048   algoName2bit["L1_DoubleMu10_Mass60to150_BptxAND"] = 2;
0049   algoName2bit["L1_SingleMu10"] = 3;
0050   algoName2bit["L1_BptxPlus_NotBptxMinus"] = 4;
0051   algoName2bit["L1_BptxMinus_NotBptxPlus"] = 5;
0052   algoName2bit["L1_MinimumBiasHF0_OR_BptxAND"] = 6;
0053   algoName2bit["L1_MinimumBiasHF0_AND_BptxAND"] = 7;
0054   algoName2bit["L1_MinimumBiasHF0_OR"] = 8;
0055 
0056   list<string>::const_iterator fname = sequence.begin();
0057   std::cout << "Prescales: " << *fname << std::endl;
0058   std::string xmlPayload_prescale    = xmlPayload[*fname++];
0059   std::cout << "Finor: " << *fname << std::endl;
0060   std::string xmlPayload_mask_finor  = xmlPayload[*fname++];
0061   std::cout << "Veto: " << *fname << std::endl;
0062   std::string xmlPayload_mask_veto   = xmlPayload[*fname++];
0063   std::cout << "AlgoBX: " << *fname << std::endl;
0064   std::string xmlPayload_mask_algobx = xmlPayload[*fname++];
0065 
0066   unsigned int m_numberPhysTriggers = 512;
0067 
0068 
0069   std::vector<std::vector<int> > prescales;
0070   std::vector<unsigned int> triggerMasks;
0071   std::vector<int> triggerVetoMasks;
0072   std::map<int, std::vector<int> > triggerAlgoBxMaskAlgoTrig;
0073 
0074   // Prescales
0075     l1t::XmlConfigParser xmlReader_prescale;
0076     l1t::TriggerSystem ts_prescale;
0077     ts_prescale.addProcessor("uGtProcessor", "uGtProcessor","-1","-1");
0078 
0079     // run the parser 
0080     xmlReader_prescale.readDOMFromString( xmlPayload_prescale ); // initialize it
0081     xmlReader_prescale.readRootElement( ts_prescale, "uGT" ); // extract all of the relevant context
0082     ts_prescale.setConfigured();
0083 
0084     const std::map<std::string, l1t::Parameter> &settings_prescale = ts_prescale.getParameters("uGtProcessor");
0085     std::map<std::string,unsigned int> prescaleColumns = settings_prescale.at("prescales").getColumnIndices();
0086 
0087     unsigned int numColumns_prescale = prescaleColumns.size();
0088     int nPrescaleSets = numColumns_prescale - 1;
0089     std::vector<std::string> algoNames = settings_prescale.at("prescales").getTableColumn<std::string>("algo/prescale-index");
0090 
0091     if( nPrescaleSets > 0 ){
0092         // Fill default prescale set
0093         for( int iSet=0; iSet<nPrescaleSets; iSet++ ){
0094             prescales.push_back(std::vector<int>());
0095             for( int iBit = 0; iBit < m_numberPhysTriggers; ++iBit ){
0096                 int inputDefaultPrescale = 0; // only prescales that are set in the block below are used
0097                 prescales[iSet].push_back(inputDefaultPrescale);
0098             }
0099         }
0100 
0101         for(auto &col : prescaleColumns){
0102             if( col.second<1 ) continue; // we don't care for the algorithms' indicies in 0th column
0103             int iSet = col.second - 1;
0104             std::vector<unsigned int> prescalesForSet = settings_prescale.at("prescales").getTableColumn<unsigned int>(col.first.c_str());
0105             for(unsigned int row=0; row<prescalesForSet.size(); row++){
0106                 unsigned int prescale = prescalesForSet[row];
0107                 std::string  algoName = algoNames[row];
0108                 unsigned int algoBit  = algoName2bit[algoName];
0109                 prescales[iSet][algoBit] = prescale;
0110   
0111 std::cout << "prescales[" << iSet << "][" << algoBit << "(" << algoName << ")] " << prescale << std::endl;
0112           }
0113         }
0114     }
0115 
0116 
0117     ///////////////////////////////////////////////////////////////////////////////////////////////////////////
0118 
0119     // finor mask
0120     l1t::XmlConfigParser xmlReader_mask_finor;
0121     l1t::TriggerSystem ts_mask_finor;
0122     ts_mask_finor.addProcessor("uGtProcessor", "uGtProcessor","-1","-1");
0123 
0124     // run the parser 
0125     xmlReader_mask_finor.readDOMFromString( xmlPayload_mask_finor ); // initialize it
0126     xmlReader_mask_finor.readRootElement( ts_mask_finor, "uGT" ); // extract all of the relevant context
0127     ts_mask_finor.setConfigured();
0128 
0129     const std::map<std::string, l1t::Parameter>& settings_mask_finor = ts_mask_finor.getParameters("uGtProcessor");
0130 
0131     std::vector<std::string>  algo_mask_finor = settings_mask_finor.at("finorMask").getTableColumn<std::string>("algo");
0132     std::vector<unsigned int> mask_mask_finor = settings_mask_finor.at("finorMask").getTableColumn<unsigned int>("mask");
0133 
0134     // mask (default=1 - unmask)
0135     unsigned int default_finor_mask = 1;
0136     auto default_finor_row =
0137         std::find_if( algo_mask_finor.cbegin(),
0138                       algo_mask_finor.cend(),
0139                       [] (const std::string &s){
0140                           // simpler than overweight std::tolower(s[], std::locale()) POSIX solution (thx to BA):
0141                           return strcasecmp("all", s.c_str()) == 0;
0142                       }
0143         );
0144     if( default_finor_row == algo_mask_finor.cend() ){
0145         edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" )
0146               << "\nWarning: No default found in FinOR mask xml, use 1 (unmasked) as default"
0147               << std::endl;
0148     } else {
0149         default_finor_mask = mask_mask_finor[ std::distance( algo_mask_finor.cbegin(), default_finor_row ) ];
0150     }
0151 
0152     for( unsigned int iAlg=0; iAlg < m_numberPhysTriggers; iAlg++ )
0153         triggerMasks.push_back(default_finor_mask);
0154 
0155     for(unsigned int row=0; row<algo_mask_finor.size(); row++){
0156         std::string  algoName = algo_mask_finor[row];
0157         if( strcasecmp("all", algoName.c_str()) == 0 ) continue;
0158         unsigned int algoBit  = algoName2bit[algoName];
0159         unsigned int mask     = mask_mask_finor[row];
0160         if( algoBit < m_numberPhysTriggers ) triggerMasks[algoBit] = mask;
0161 
0162 std::cout << "triggerMasks[" << algoBit << "(" << algoName << ")] " << mask << std::endl;
0163     }
0164 
0165     ///////////////////////////////////////////////////////////////////////////////////////////////////////////
0166 
0167     // veto mask
0168     l1t::XmlConfigParser xmlReader_mask_veto;
0169     l1t::TriggerSystem ts_mask_veto;
0170     ts_mask_veto.addProcessor("uGtProcessor", "uGtProcessor","-1","-1");
0171 
0172     // run the parser 
0173     xmlReader_mask_veto.readDOMFromString( xmlPayload_mask_veto ); // initialize it
0174     xmlReader_mask_veto.readRootElement( ts_mask_veto, "uGT" ); // extract all of the relevant context
0175     ts_mask_veto.setConfigured();
0176 
0177     const std::map<std::string, l1t::Parameter>& settings_mask_veto = ts_mask_veto.getParameters("uGtProcessor");
0178     std::vector<std::string>  algo_mask_veto = settings_mask_veto.at("vetoMask").getTableColumn<std::string>("algo");
0179     std::vector<unsigned int> veto_mask_veto = settings_mask_veto.at("vetoMask").getTableColumn<unsigned int>("veto");
0180 
0181     // veto mask (default=0 - no veto)
0182     unsigned int default_veto_mask = 1;
0183     auto default_veto_row =
0184         std::find_if( algo_mask_veto.cbegin(),
0185                       algo_mask_veto.cend(),
0186                       [] (const std::string &s){
0187                           // simpler than overweight std::tolower(s[], std::locale()) POSIX solution (thx to BA):
0188                           return strcasecmp("all", s.c_str()) == 0;
0189                       }
0190         );
0191     if( default_veto_row == algo_mask_veto.cend() ){
0192         edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" )
0193               << "\nWarning: No default found in Veto mask xml, use 0 (unvetoed) as default"
0194               << std::endl;
0195     } else {
0196         default_veto_mask = veto_mask_veto[ std::distance( algo_mask_veto.cbegin(), default_veto_row ) ];
0197     }
0198 
0199     for( unsigned int iAlg=0; iAlg < m_numberPhysTriggers; iAlg++ )
0200         triggerVetoMasks.push_back(default_veto_mask);
0201 
0202     for(unsigned int row=0; row<algo_mask_veto.size(); row++){
0203         std::string  algoName = algo_mask_veto[row];
0204         if( strcasecmp("all", algoName.c_str()) == 0 ) continue;
0205         unsigned int algoBit  = algoName2bit[algoName];
0206         unsigned int veto    = veto_mask_veto[row];
0207         if( algoBit < m_numberPhysTriggers ) triggerVetoMasks[algoBit] = int(veto);
0208 
0209 std::cout << "triggerVetoMasks[" << algoBit << "(" << algoName << ")] " << int(veto) << std::endl;
0210     }
0211 
0212     ///////////////////////////////////////////////////////////////////////////////////////////////////////////
0213 
0214     // Algo bx mask
0215     l1t::XmlConfigParser xmlReader_mask_algobx;
0216     l1t::TriggerSystem ts_mask_algobx;
0217     ts_mask_algobx.addProcessor("uGtProcessor", "uGtProcessor","-1","-1");
0218 
0219     // run the parser 
0220     xmlReader_mask_algobx.readDOMFromString( xmlPayload_mask_algobx ); // initialize it
0221     xmlReader_mask_algobx.readRootElement( ts_mask_algobx, "uGT" ); // extract all of the relevant context
0222     ts_mask_algobx.setConfigured();
0223 
0224     const std::map<std::string, l1t::Parameter>& settings_mask_algobx = ts_mask_algobx.getParameters("uGtProcessor");
0225     std::vector<std::string>  bx_algo_name = settings_mask_algobx.at("algorithmBxMask").getTableColumn<std::string>("algo");
0226     std::vector<std::string>  bx_range     = settings_mask_algobx.at("algorithmBxMask").getTableColumn<std::string>("range");
0227     std::vector<unsigned int> bx_mask      = settings_mask_algobx.at("algorithmBxMask").getTableColumn<unsigned int>("mask");
0228 
0229     int default_bxmask_row = -1;
0230     unsigned int m_bx_mask_default = 1;
0231     typedef std::pair<unsigned long,unsigned long> Range_t;
0232     // auto comp = [] (Range_t a, Range_t b){ return a.first < b.first; };
0233     struct RangeComp_t { bool operator()(const Range_t& a, const Range_t& b) const { return a.first < b.first; } };
0234     std::map<std::string, std::set<Range_t,RangeComp_t>> non_default_bx_ranges;
0235 
0236     for(unsigned int row = 0; row < bx_algo_name.size(); row++){
0237         const std::string &s1 = bx_algo_name[row];
0238         const std::string &s2 = bx_range[row];
0239         // find "all" broadcast keywords
0240         bool broadcastAlgo  = false;
0241         bool broadcastRange = false;
0242         if( strcasecmp("all", s1.c_str()) == 0 ) broadcastAlgo  = true;
0243         if( strcasecmp("all", s2.c_str()) == 0 ) broadcastRange = true;
0244         // ALL-ALL-default:
0245         if( broadcastAlgo && broadcastRange ){
0246             if( row != 0 ){
0247                 edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" )
0248                     << "\nWarning: ALL-ALL row is not the first one, ignore it assuming 1 (unmasked) as the default"
0249                     << std::endl;
0250                 continue;
0251             }
0252             if( default_bxmask_row >= 0 ){
0253                 edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" )
0254                     << "\nWarning: multiple ALL-ALL rows found, using the first"
0255                     << std::endl;
0256                 continue;
0257             }
0258             default_bxmask_row = row;
0259             m_bx_mask_default = bx_mask[row];
0260             continue;
0261         }
0262         // interpret the range
0263         unsigned long first = 0, last = 0;
0264         if( broadcastRange ){
0265             first = 0;
0266             last = 3563;
0267         } else {
0268             char *dash = 0;
0269             first = strtoul(s2.data(), &dash, 0);
0270             while( *dash != '\0' && *dash != '-' ) ++dash;
0271             last  = (*dash != '\0' ? strtoul(++dash, &dash, 0) : first);
0272             if( first == 3564 ) first = 0;
0273             if( last  == 3564 ) last  = 0;
0274             // what could possibly go wrong?
0275             if( *dash != '\0' ){
0276                 edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" )
0277                         << "\nWarning: parsing " << s2 << " as [" << first << "," << last << "] range"
0278                         << std::endl;
0279             }
0280             if( first > 3563 ){
0281                 edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" )
0282                         << "\nWarning: start of interval is out of range: " << s2 << ", skipping the row"
0283                         << std::endl;
0284                 continue;
0285             }
0286             if( last > 3563 ){
0287                 last = 3563;
0288                 edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" )
0289                         << "\nWarning: end of interval is out of range: " << s2 << ", force [" << first << "," << last << "] range"
0290                         << std::endl;
0291             }
0292             if( first > last ){
0293                 edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" )
0294                        << "\nWarning: inverse/spillover range "<< s2 << ", accounting for circular orbit as [0," << last << "] & [" << first << ",3563]"
0295                        << std::endl;
0296             }
0297         }
0298         // {algo,ALL}-{range,ALL}-{0,1}:
0299         std::vector<std::string> algos;
0300         std::vector<std::pair<unsigned long,unsigned long>> orderedRanges;
0301         if( first <= last ){
0302             if( !broadcastAlgo ){
0303                 algos.push_back( bx_algo_name[row] );
0304                 orderedRanges.push_back( std::make_pair(first,last) );
0305             } else {
0306                 for(const auto &i: non_default_bx_ranges){
0307                     algos.push_back(i.first);
0308                     orderedRanges.push_back( std::make_pair(first,last) );
0309                 }
0310             }
0311         } else {
0312             if( !broadcastAlgo ){
0313                 algos.push_back( bx_algo_name[row] );
0314                 algos.push_back( bx_algo_name[row] );
0315                 orderedRanges.push_back( std::make_pair(0,last) );
0316                 orderedRanges.push_back( std::make_pair(first,3563) );
0317             } else {
0318                 for(const auto &i: non_default_bx_ranges){
0319                    algos.push_back(i.first);
0320                    algos.push_back(i.first);
0321                    orderedRanges.push_back( std::make_pair(0,last) );
0322                    orderedRanges.push_back( std::make_pair(first,3563) );
0323                 }
0324             }
0325         }
0326 
0327         for(unsigned int item=0; item < algos.size(); item++){
0328            const std::string &algoName = algos[item];
0329            unsigned int first = orderedRanges[item].first;
0330            unsigned int last  = orderedRanges[item].second;
0331 
0332            std::set<Range_t,RangeComp_t> &ranges = non_default_bx_ranges[algoName];
0333 ///           std::set<Range_t,decltype(comp)> &ranges = non_default_bx_ranges.insert
0334 ///           (
0335 ///               std::pair< std::string, std::set<Range_t,decltype(comp)> >
0336 ///               (
0337 ///                   algoName,  std::set<Range_t,decltype(comp)>(comp)
0338 ///               )
0339 ///           ).first->second; // I don't care if insert was successfull or if I've got a hold on existing range
0340 
0341            // current range may or may not overlap with the already present ranges
0342            // if end of the predecessor starts before begin of the current range and begin
0343            //  of the successor starts after end of the current range there is no overlap
0344            //  and I save this range only if it has mask different from the default
0345            //  otherwise modify predecessor/successor ranges accordingly
0346            std::set<Range_t>::iterator curr = ranges.end(); // inserted range
0347            std::set<Range_t>::iterator succ = ranges.lower_bound(std::make_pair(first,last)); // successor starts at current or later
0348            std::set<Range_t>::iterator pred = succ;
0349            if( pred != ranges.begin() ) pred--; else pred = ranges.end();
0350 
0351            if( (pred == ranges.end() || pred->second < first) &&
0352                (succ == ranges.end() || succ->first > last) ){
0353                // no overlap
0354                if( m_bx_mask_default != bx_mask[row] )
0355                    curr = ranges.insert(std::make_pair(first,last)).first;
0356                // do nothing if this is a default-mask interval
0357            } else {
0358                // pred/succ iterators are read-only, create intermediate adjusted copies
0359                Range_t newPred, newSucc;
0360                bool modifiedPred = false, holeInPred = false, modifiedSucc = false, dropSucc = false;
0361                // overlap found with predecessor range
0362                if( pred != ranges.end() && pred->second >= first && pred->second <= last ){
0363                    if( m_bx_mask_default != bx_mask[row] ){
0364                        if( last == pred->second ){
0365                            // both ranges end in the same place - nothing to do
0366                            modifiedPred = false;
0367                        } else {
0368                            // extend predecessor range
0369                            newPred.first  = pred->first;
0370                            newPred.second = last;
0371                            modifiedPred = true;
0372                        }
0373                    } else {
0374                        // shrink predecessor range
0375                        newPred.first  = pred->first;
0376                        newPred.second = first-1; // non-negative for the predecessor by design
0377                        // by design pred->first < first, so the interval above is always valid
0378                        modifiedPred = true;
0379                    }
0380                }
0381                // current range is fully contained in predecessor
0382                if( pred != ranges.end() && pred->second > first && pred->second > last ){
0383                    if( m_bx_mask_default != bx_mask[row] ){
0384                        // no change to the predecessor range
0385                        modifiedPred = false;
0386                    } else {
0387                        // make a "hole" in predecessor range
0388                        newPred.first  = first;
0389                        newPred.second = last;
0390                        holeInPred = true;
0391                        modifiedPred = true;
0392                    }
0393                }
0394                // overlap found with successor range
0395                if( succ != ranges.end() && succ->first <= last ){
0396                    if( m_bx_mask_default != bx_mask[row] ){
0397                        // extend successor range
0398                        newSucc.first  = first;
0399                        newSucc.second = succ->second;
0400                    } else {
0401                        // shrink successor range
0402                        newSucc.first  = last+1;
0403                        newSucc.second = succ->second;
0404                        if( newSucc.first > 3563 || newSucc.first > newSucc.second )
0405                            dropSucc = true;
0406                    }
0407                    modifiedSucc = true;
0408                }
0409                // overlap found with both, predecessor and successor, such that I need to merge them
0410                if( modifiedPred && modifiedSucc && newPred.second >= newSucc.first ){
0411                    // make newPred and newSucc identical just in case
0412                    newPred.second = newSucc.second;
0413                    newSucc.first  = newPred.first;
0414                    ranges.erase(pred,++succ);
0415                    curr = ranges.insert(newPred).first;
0416                } else {
0417                    // merging is not the case, but I still need to propagate the new ranges back to the source
0418                    if( modifiedPred ){
0419                        if( !holeInPred ){
0420                            ranges.erase(pred);
0421                            curr = ranges.insert(newPred).first;
0422                        } else {
0423                            // make a hole by splitting predecessor into two ranges
0424                            Range_t r1(pred->first, newPred.first-1); // non-negative for the predecessor by design
0425                            Range_t r2(newPred.second+1, pred->second);
0426                            ranges.erase(pred);
0427                            ranges.insert(r1).first;
0428                            ranges.insert(r2).first;
0429                            curr = ranges.end(); // hole cannot cover any additional ranges
0430                        }
0431                    }
0432                    if( modifiedSucc ){
0433                        ranges.erase(succ);
0434                        if( !dropSucc )
0435                            curr = ranges.insert(newSucc).first;
0436                    }
0437                }
0438            }
0439            // if current range spans over few more ranges after the successor
0440            //  remove those from the consideration up until the last covered range
0441            //  that may or may not extend beyond the current range end 
0442            if( curr != ranges.end() ){ // insertion took place
0443                std::set<Range_t,RangeComp_t>::iterator last_covered = ranges.upper_bound(std::make_pair(curr->second,0));
0444                if( last_covered != ranges.begin() ) last_covered--; else last_covered = ranges.end();
0445 
0446                if( last_covered != ranges.end() && last_covered->first != curr->first ){
0447                    // ranges is not empty and last_covered is not current itself (i.e. it is different)
0448                    if( curr->second < last_covered->second ){
0449                        // the range needs to be extended
0450                        Range_t newRange(curr->first, last_covered->second);
0451                        ranges.erase(curr);
0452                        curr = ranges.insert(newRange).first;
0453                    }
0454                    ranges.erase(++curr,last_covered);
0455                }
0456            }
0457         }
0458     }
0459 
0460     if( default_bxmask_row < 0 ){
0461         edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" )
0462               << "\nWarning: No default found in BX mask xml, used 1 (unmasked) as default"
0463               << std::endl;
0464     }
0465 
0466     for(const std::pair<std::string, std::set<Range_t,RangeComp_t>> &algo : non_default_bx_ranges){
0467         const std::string &algoName = algo.first;
0468         unsigned int algoBit  = algoName2bit[algoName];
0469         for(auto range : algo.second)
0470            for(int bx = range.first; bx <= range.second; bx++){
0471                triggerAlgoBxMaskAlgoTrig[bx].push_back(algoBit);
0472 
0473 std::cout << "triggerAlgoBxMaskAlgoTrig[" << bx << "] " << algoBit << std::endl;
0474            }
0475     }
0476 
0477 
0478     // Set prescales to zero if masked
0479     for( unsigned int iSet=0; iSet < prescales.size(); iSet++ ){
0480         for( unsigned int iBit=0; iBit < prescales[iSet].size(); iBit++ ){
0481         // Add protection in case prescale table larger than trigger mask size
0482         if( iBit >= triggerMasks.size() ){
0483             edm::LogError( "L1-O2O: L1TGlobalPrescalesVetosOnlineProd" )
0484           << "\nWarning: algoBit in prescale table >= triggerMasks.size() "
0485           << "\nWarning: no information on masking bit or not, setting as unmasked "
0486           << std::endl;
0487         } else {
0488             prescales[iSet][iBit] *= triggerMasks[iBit];
0489         }
0490       }
0491     }
0492 
0493     return 0;
0494 }
0495