ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/grimes/L1Menu/src/tools.cpp
(Generate patch)

Comparing UserCode/grimes/L1Menu/src/tools.cpp (file contents):
Revision 1.1 by grimes, Tue May 28 23:14:04 2013 UTC vs.
Revision 1.3 by grimes, Tue Jun 4 08:17:37 2013 UTC

# Line 4 | Line 4
4   #include <exception>
5   #include <map>
6   #include <stdexcept>
7 + #include <algorithm>
8   #include "l1menu/ITrigger.h"
9   #include "l1menu/IEvent.h"
10   #include "l1menu/TriggerTable.h"
# Line 32 | Line 33 | std::vector<std::string> l1menu::getThre
33                                  if( legNumber!=0 ) stringConverter << "leg" << legNumber; // For triggers with only one leg I don't want to prefix anything.
34  
35                                  stringConverter << "threshold" << thresholdNumber;
36 +
37                                  trigger.parameter(stringConverter.str());
38                                  // If the threshold doesn't exist the statement above will throw an exception, so
39                                  // I've reached this far then the threshold name must exist.
# Line 45 | Line 47 | std::vector<std::string> l1menu::getThre
47                          // exist, so I know I've finished. If it isn't from the first threshold then there could be
48                          // other prefixes (e.g. "leg2") that have thresholds that can be modified, in which case I
49                          // need to continue.
50 <                        if( thresholdNumber==1 ) break;
50 >                        if( thresholdNumber==1 && legNumber!=0 ) break;
51                  }
52          }
53  
54          return returnValue;
55 + }
56 +
57 + std::vector<std::string> l1menu::getNonThresholdParameterNames( const l1menu::ITrigger& trigger )
58 + {
59 +        std::vector<std::string> returnValue;
60 +
61 +        // It'll be easier to get the threshold names and then copy
62 +        // everything that's not in there to the return value.
63 +        std::vector<std::string> allParameterNames=trigger.parameterNames();
64 +        std::vector<std::string> thresholdNames=getThresholdNames(trigger);
65 +
66 +        for( const auto& parameterName : allParameterNames )
67 +        {
68 +                const auto& iFindResult=std::find( thresholdNames.begin(), thresholdNames.end(), parameterName );
69 +                // If the current parameter name isn't one of the thresholds add
70 +                // it the vector which I'm going to return.
71 +                if( iFindResult==thresholdNames.end() ) returnValue.push_back(parameterName);
72 +        }
73 +
74 +        return returnValue;
75   }
76  
77   void l1menu::setTriggerThresholdsAsTightAsPossible( const l1menu::IEvent& event, l1menu::ITrigger& trigger, float tolerance )

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines