CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DQMOffline/Trigger/src/EgHLTTrigTools.cc

Go to the documentation of this file.
00001 #include "DQMOffline/Trigger/interface/EgHLTTrigTools.h"
00002 
00003 #include "FWCore/ParameterSet/interface/Registry.h"
00004 
00005 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
00006 
00007 #include <boost/algorithm/string.hpp>
00008 using namespace egHLT;
00009 
00010 TrigCodes::TrigBitSet trigTools::getFiltersPassed(const std::vector<std::pair<std::string,int> >& filters,const trigger::TriggerEvent* trigEvt,const std::string& hltTag)
00011 {
00012   TrigCodes::TrigBitSet evtTrigs;
00013   for(size_t filterNrInVec=0;filterNrInVec<filters.size();filterNrInVec++){
00014     size_t filterNrInEvt = trigEvt->filterIndex(edm::InputTag(filters[filterNrInVec].first,"",hltTag).encode());
00015     const TrigCodes::TrigBitSet filterCode = TrigCodes::getCode(filters[filterNrInVec].first.c_str());
00016     if(filterNrInEvt<trigEvt->sizeFilters()){ //filter found in event, however this only means that something passed the previous filter
00017       const trigger::Keys& trigKeys = trigEvt->filterKeys(filterNrInEvt);
00018       if(static_cast<int>(trigKeys.size())>=filters[filterNrInVec].second){
00019         evtTrigs |=filterCode; //filter was passed
00020       }
00021     }//end check if filter is present
00022   }//end loop over all filters
00023 
00024 
00025   return evtTrigs;
00026 
00027 }
00028 
00029 
00030 
00031 
00032 //this function runs over all parameter sets for every module that has ever run on an event in this job
00033 //it looks for the specified filter module
00034 //and returns the minimum number of objects required to pass the filter, -1 if its not found
00035 //which is either the ncandcut or MinN parameter in the filter config
00036 //assumption: nobody will ever change MinN or ncandcut without changing the filter name
00037 //as this just picks the first module name and if 2 different versions of HLT were run with the filter having
00038 //a different min obj required in the two versions, this may give the wrong answer
00039 int trigTools::getMinNrObjsRequiredByFilter(const std::string& filterName)
00040 {
00041  
00042   //will return out of for loop once its found it to save time
00043   const edm::pset::Registry* psetRegistry = edm::pset::Registry::instance();
00044   if(psetRegistry==NULL) return -1;
00045   for(edm::pset::Registry::const_iterator psetIt=psetRegistry->begin();psetIt!=psetRegistry->end();++psetIt){ //loop over every pset for every module ever run
00046     const std::map<std::string,edm::Entry>& mapOfPara  = psetIt->second.tbl(); //contains the parameter name and value for all the parameters of the pset
00047     const std::map<std::string,edm::Entry>::const_iterator itToModLabel = mapOfPara.find("@module_label"); 
00048     if(itToModLabel!=mapOfPara.end()){
00049       if(itToModLabel->second.getString()==filterName){ //moduleName is the filter name, we have found filter, we will now return something
00050         std::map<std::string,edm::Entry>::const_iterator itToCandCut = mapOfPara.find("ncandcut");
00051         if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()=='I') return itToCandCut->second.getInt32();
00052         else{ //checks if nZcandcut exists and is int32, if not return -1
00053           itToCandCut = mapOfPara.find("nZcandcut");
00054           if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()=='I') return itToCandCut->second.getInt32();
00055           else{ //checks if MinN exists and is int32, if not return -1
00056             itToCandCut = mapOfPara.find("MinN");
00057             if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()=='I') return itToCandCut->second.getInt32();
00058             else{ //checks if minN exists and is int32, if not return -1
00059             itToCandCut = mapOfPara.find("minN");
00060             if(itToCandCut!=mapOfPara.end() && itToCandCut->second.typeCode()=='I') return itToCandCut->second.getInt32();
00061             else return -1;
00062             }
00063           }
00064         }
00065       }
00066     }
00067   }
00068   return -1;
00069 }
00070  
00071 
00072 //this looks into the HLT config and fills a sorted vector with the last filter of all HLT triggers
00073 //it assumes this filter is either the last (in the case of ES filters) or second to last in the sequence
00074 /*void trigTools::getActiveFilters(const HLTConfigProvider& hltConfig,std::vector<std::string>& activeFilters)
00075   {
00076   activeFilters.clear();
00077   
00078   for(size_t pathNr=0;pathNr<hltConfig.size();pathNr++){
00079   const std::string& pathName = hltConfig.triggerName(pathNr);
00080   if(pathName.find("HLT_")==0){ //hlt path as they all start with HLT_XXXX
00081   
00082   std::string lastFilter;
00083   const std::vector<std::string>& filters = hltConfig.moduleLabels(pathNr);
00084   if(!filters.empty()){
00085   if(filters.back()=="hltBoolEnd" && filters.size()>=2){
00086   activeFilters.push_back(filters[filters.size()-2]); //2nd to last element is the last filter, useally the case as last is hltBool except for ES bits
00087   }else activeFilters.push_back(filters.back());
00088   //std::cout<<filters[filters.size()-2]<<std::endl;
00089   }
00090   }//end hlt path check
00091   }//end path loop over
00092 
00093   std::sort(activeFilters.begin(),activeFilters.end());
00094   
00095   }*/
00096 //----Morse--------------
00097 //want to grab all modules with saveTags==true for e/g paths
00098 //veto x-triggers, which will be handled by PAGs
00099 //first step towards automation; for now it is just used to check against filtersToMon
00100 //should have some overhead but they will be filtered out by filterInactiveTriggers anyway
00101 void trigTools::getActiveFilters(const HLTConfigProvider& hltConfig,std::vector<std::string>& activeFilters,std::vector<std::string>& activeEleFilters,std::vector<std::string>& activeEle2LegFilters,std::vector<std::string>& activePhoFilters,std::vector<std::string>& activePho2LegFilters)
00102 {
00103   
00104   activeFilters.clear();
00105   activeEleFilters.clear();
00106   activeEle2LegFilters.clear();
00107   activePhoFilters.clear();
00108   activePho2LegFilters.clear();
00109   
00110   for(size_t pathNr=0;pathNr<hltConfig.size();pathNr++){
00111     const std::string& pathName = hltConfig.triggerName(pathNr);
00112     if(pathName.find("HLT_")==0){ //hlt path as they all start with HLT_XXXX
00113       if((pathName.find("Photon")==4 || pathName.find("Ele")==4 || pathName.find("EG")==4)// e/g paths, pho or ele always come first
00114          && (pathName.find("Jet")==pathName.npos && pathName.find("Muon")==pathName.npos 
00115              && pathName.find("Tau")==pathName.npos && pathName.find("HT")==pathName.npos 
00116              && pathName.find("MR")==pathName.npos && pathName.find("LEITI")==pathName.npos 
00117              && pathName.find("Jpsi")==pathName.npos && pathName.find("Ups")==pathName.npos ) ){//veto x-triggers
00118         //std::string lastFilter;
00119         const std::vector<std::string>& filters = hltConfig.saveTagsModules(pathNr);
00120 
00121         //std::cout<<"Number of prescale sets: "<<hltConfig.prescaleSize()<<std::endl;
00122         //std::cout<<std::endl<<"Path Name: "<<pathName<<"   Prescale: "<<hltConfig.prescaleValue(1,pathName)<<std::endl;
00123 
00124         if(!filters.empty()){//std::cout<<"Path Name: "<<pathName<<std::endl;
00125           //if(filters.back()=="hltBoolEnd" && filters.size()>=2){
00126           for(size_t filter=0;filter<filters.size();filter++){
00127             if(filters[filter].find("Filter")!=filters[filter].npos){//keep only modules that contain the word "Filter"
00128               //std::cout<<"  Module Name: "<<filters[filter]<<" filter#: "<<int(filter)<<"/"<<filters.size()<<" ncandcut: "<<trigTools::getMinNrObjsRequiredByFilter(filters[filter])<<std::endl;
00129               if(//keep only the last filter and the last one with ncandcut==1 (for di-object triggers)
00130                  (filter<filters.size()-1  && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==2)  
00131                  || (filter<filters.size()-1  && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("Mass")!=filters[filter+1].npos)
00132                  || (filter<filters.size()-1  && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("FEM")!=filters[filter+1].npos)  
00133                  || (filter<filters.size()-1  && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("PFMT")!=filters[filter+1].npos)  
00134                  || filter==filters.size()-1 ){
00135                 activeFilters.push_back(filters[filter]); //saves all modules with saveTags=true
00136                 //std::cout<<"  Module Name: "<<filters[filter]<<" filter#: "<<int(filter)<<"/"<<filters.size()<<" ncandcut: "<<trigTools::getMinNrObjsRequiredByFilter(filters[filter])<<std::endl;
00137                 if(pathName.find("Photon")!=pathName.npos){
00138                   activePhoFilters.push_back(filters[filter]);//saves all "Photon" paths into photon set
00139                   int posPho = pathName.find("Pho")+1;
00140                   if( pathName.find("Pho",posPho)!=pathName.npos || pathName.find("SC",posPho)!=pathName.npos ){
00141                     //This saves all "x_Photon_x_Photon_x" and "x_Photon_x_SC_x" path filters into 2leg photon set
00142                     activePho2LegFilters.push_back(filters[filter]);
00143                     //std::cout<<"Pho2LegPath: "<<pathName<<std::endl;
00144                   }
00145                 }
00146                 if(pathName.find("Ele")!=pathName.npos){
00147                   activeEleFilters.push_back(filters[filter]);//saves all "Ele" paths into electron set
00148                   int posEle = pathName.find("Ele")+1;
00149                   if( pathName.find("Ele",posEle)!=pathName.npos || pathName.find("SC",posEle)!=pathName.npos ){
00150                     if(
00151                        (filter<filters.size()-1  && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==2)
00152                        || (filter<filters.size()-1  && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("Mass")!=filters[filter+1].npos) 
00153                        || (filter<filters.size()-1  && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("SC")!=filters[filter+1].npos)  
00154                        || (filter<filters.size()-1  && trigTools::getMinNrObjsRequiredByFilter(filters[filter])==1 && trigTools::getMinNrObjsRequiredByFilter(filters[filter+1])==1 && filters[filter+1].find("FEM")!=filters[filter+1].npos)  
00155                        ){
00156                       //This saves all "x_Ele_x_Ele_x" and "x_Ele_x_SC_x" path filters into 2leg electron set
00157                       activeEle2LegFilters.push_back(filters[filter]+"::"+filters[filter+1]);
00158                       //std::cout<<"Ele2LegPath: "<<pathName<<std::endl;
00159                     }
00160                   }
00161                 }
00162               }
00163             }
00164           }
00165           //std::cout<<filters[filters.size()-2]<<std::endl;
00166           //}else activeFilters.push_back(filters.back());
00167         }
00168       }
00169     }//end hlt path check
00170   }//end path loop over
00171   /*for(size_t i=0;i<activeEle2LegFilters.size();i++){
00172     std::cout<<"Leg1: "<<activeEle2LegFilters[i].substr(0,activeEle2LegFilters[i].find("::"))<<std::endl;
00173     std::cout<<"Leg2: "<<activeEle2LegFilters[i].substr(activeEle2LegFilters[i].find("::")+2)<<std::endl<<std::endl;
00174     }*/
00175   std::sort(activeFilters.begin(),activeFilters.end());
00176   std::sort(activeEleFilters.begin(),activeEleFilters.end());
00177   std::sort(activeEle2LegFilters.begin(),activeEle2LegFilters.end());
00178   std::sort(activePhoFilters.begin(),activePhoFilters.end());
00179 }
00180 //----------------------------
00181 
00182 //this function will filter the inactive filternames
00183 //it assumes the list of active filters is sorted   
00184 //at some point this will be replaced with one line of fancy stl code but I want it to work now :)
00185 void trigTools::filterInactiveTriggers(std::vector<std::string>& namesToFilter,std::vector<std::string>& activeFilters)
00186 {
00187   //tempory vector to store the filtered results
00188   std::vector<std::string> filteredNames;
00189   /*
00190   for(size_t inputFilterNr=0;inputFilterNr<namesToFilter.size();inputFilterNr++){
00191     if(std::binary_search(activeFilters.begin(),activeFilters.end(),namesToFilter[inputFilterNr])){
00192       filteredNames.push_back(namesToFilter[inputFilterNr]);
00193     }//std::cout<<filteredNames[inputFilterNr]<<std::endl;
00194   }
00195   */
00196   //namesToFilter.swap(activeFilters);
00197   filteredNames = activeFilters;
00198   namesToFilter.swap(filteredNames);
00199 }
00200 
00201 //input filters have format filter1:filter2, this checks both filters are active, rejects ones where both are not active
00202 void trigTools::filterInactiveTightLooseTriggers(std::vector<std::string>& namesToFilter,const std::vector<std::string>& activeFilters)
00203 {
00204   //tempory vector to store the filtered results
00205   std::vector<std::string> filteredNames;
00206   
00207   for(size_t inputFilterNr=0;inputFilterNr<namesToFilter.size();inputFilterNr++){
00208     std::vector<std::string> names;
00209     boost::split(names,namesToFilter[inputFilterNr],boost::is_any_of(std::string(":")));
00210     if(names.size()!=2) continue; //format incorrect, reject it
00211     if(std::binary_search(activeFilters.begin(),activeFilters.end(),names[0]) &&
00212        std::binary_search(activeFilters.begin(),activeFilters.end(),names[1])){ //both filters are valid
00213       filteredNames.push_back(namesToFilter[inputFilterNr]);
00214     }
00215   }
00216   
00217   namesToFilter.swap(filteredNames);
00218 }
00219 
00220 //a comparison functiod for std::pair<std::string,std::string> 
00221 //this probably (infact must) exist elsewhere
00222 class StringPairCompare {
00223 public: 
00224   bool operator()(const std::pair<std::string,std::string>&lhs,
00225                   const std::pair<std::string,std::string>& rhs)const{return keyLess(lhs.first,rhs.first);}
00226   bool operator()(const std::pair<std::string,std::string>&lhs,
00227                   const std::pair<std::string,std::string>::first_type& rhs)const{return keyLess(lhs.first,rhs);}
00228   bool operator()(const std::pair<std::string,std::string>::first_type &lhs,
00229                   const std::pair<std::string,std::string>& rhs)const{return keyLess(lhs,rhs.first);}
00230 private:
00231   bool keyLess(const std::pair<std::string,std::string>::first_type& k1,const std::pair<std::string,std::string>::first_type& k2)const{return k1<k2;}
00232 };
00233 
00234 void trigTools::translateFiltersToPathNames(const HLTConfigProvider& hltConfig,const std::vector<std::string>& filters,std::vector<std::string>& paths)
00235 {
00236   
00237   paths.clear();
00238   std::vector<std::pair<std::string,std::string> > filtersAndPaths;
00239 
00240   for(size_t pathNr=0;pathNr<hltConfig.size();pathNr++){
00241     const std::string& pathName = hltConfig.triggerName(pathNr);
00242     if(pathName.find("HLT_")==0){ //hlt path as they all start with HLT_XXXX
00243   
00244       std::string lastFilter;
00245       const std::vector<std::string>& pathFilters = hltConfig.moduleLabels(pathNr);
00246       if(!pathFilters.empty()){
00247         if(pathFilters.back()=="hltBoolEnd" && pathFilters.size()>=2){
00248           //2nd to last element is the last filter, useally the case as last is hltBool except for ES bits
00249           filtersAndPaths.push_back(std::make_pair(pathFilters[pathFilters.size()-2],pathName));
00250         }else filtersAndPaths.push_back(std::make_pair(pathFilters.back(),pathName));
00251       }
00252     }//end hlt path check
00253   }//end path loop over
00254 
00255   std::sort(filtersAndPaths.begin(),filtersAndPaths.end(),StringPairCompare());
00256   
00257   for(size_t filterNr=0;filterNr<filters.size();filterNr++){
00258     typedef std::vector<std::pair<std::string,std::string> >::const_iterator VecIt;
00259     std::pair<VecIt,VecIt> searchResult = std::equal_range(filtersAndPaths.begin(),filtersAndPaths.end(),filters[filterNr],StringPairCompare());
00260     if(searchResult.first!=searchResult.second) paths.push_back(searchResult.first->second);
00261     else paths.push_back(filters[filterNr]);//if cant find the path, just  write the filter
00262     //---Morse-----
00263     //std::cout<<filtersAndPaths[filterNr].first<<"  "<<filtersAndPaths[filterNr].second<<std::endl;
00264     //-------------
00265   }
00266 
00267 }
00268 
00269 std::string trigTools::getL1SeedFilterOfPath(const HLTConfigProvider& hltConfig,const std::string& path)
00270 {
00271   const std::vector<std::string>& modules = hltConfig.moduleLabels(path);
00272 
00273   for(size_t moduleNr=0;moduleNr<modules.size();moduleNr++){
00274     const std::string& moduleName=modules[moduleNr]; 
00275     if(moduleName.find("hltL1s")==0) return moduleName; //found l1 seed module
00276   }
00277   std::string dummy;
00278   return dummy;
00279 
00280 }
00281   
00282 //hunts for first instance of pattern EtX where X = a number of any length and returns X
00283 float  trigTools::getEtThresFromName(const std::string& trigName)
00284 {
00285   size_t etStrPos = trigName.find("Et");
00286   while(etStrPos!=std::string::npos && trigName.find_first_of("1234567890",etStrPos)!=etStrPos+2){
00287     etStrPos = trigName.find("Et",etStrPos+1);  
00288   }
00289   if(etStrPos!=std::string::npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+2){
00290     size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+2);  
00291 
00292     std::istringstream etValStr(trigName.substr(etStrPos+2,endOfEtValStr-etStrPos-2));
00293     float etVal;
00294     etValStr>> etVal;
00295     return etVal;
00296     
00297   }
00298   return 0;
00299 
00300 }
00301 
00302 //hunts for second instance of pattern X where X = a number of any length and returns X
00303 //This has gotten ridiculously more complicated now that filters do not have the "Et" string in them
00304 float  trigTools::getSecondEtThresFromName(const std::string& trigName)
00305 {//std::cout<<"What the heck is this trigName?:"<<trigName<<std::endl;
00306   bool isEle=false,isPhoton=false,isEG=false,isEle2=false,isPhoton2=false,isEG2=false,isSC2=false;
00307   size_t etStrPos = trigName.npos;
00308   if( trigName.find("Ele")<trigName.find("Photon") && trigName.find("Ele")<trigName.find("EG") ){
00309     etStrPos=trigName.find("Ele");isEle=true; }
00310   else if( trigName.find("EG")<trigName.find("Photon") && trigName.find("EG")<trigName.find("Ele") ){
00311     etStrPos=trigName.find("EG");isEG=true; }
00312   else if( trigName.find("Photon")<trigName.find("Ele") && trigName.find("Photon")<trigName.find("EG") ){
00313     etStrPos=trigName.find("Photon");isPhoton=true; }
00314   //size_t etStrPos = trigName.find("Et");
00315   //std::cout<<"Got Original Et spot; etStrPos="<<etStrPos<<std::endl;
00316   /*while(etStrPos!=std::string::npos && trigName.find_first_of("1234567890",etStrPos)!=etStrPos+2){
00317     etStrPos = trigName.find("Et",etStrPos+1);//std::cout<<"Got first Et spot; etStrPos="<<etStrPos<<std::endl;
00318     }*/
00319   if(etStrPos!=trigName.npos
00320      && ( trigName.find("Ele",etStrPos+1)!=trigName.npos || trigName.find("EG",etStrPos+1)!=trigName.npos 
00321           || trigName.find("Photon",etStrPos+1)!=trigName.npos || trigName.find("SC",etStrPos+1)!=trigName.npos)){ 
00322     if(trigName.find("Ele",etStrPos+1)<trigName.find("Photon",etStrPos+1) && trigName.find("Ele",etStrPos+1)<trigName.find("EG",etStrPos+1) && trigName.find("Ele",etStrPos+1)<trigName.find("SC",etStrPos+1) ){etStrPos=trigName.find("Ele",etStrPos+1);isEle2=true;}
00323     else if(trigName.find("EG",etStrPos+1)<trigName.find("Photon",etStrPos+1) && trigName.find("EG",etStrPos+1)<trigName.find("Ele",etStrPos+1) && trigName.find("EG",etStrPos+1)<trigName.find("SC",etStrPos+1)){etStrPos=trigName.find("EG",etStrPos+1);isEG2=true;}
00324     else if(trigName.find("Photon",etStrPos+1)<trigName.find("EG",etStrPos+1) && trigName.find("Photon",etStrPos+1)<trigName.find("Ele",etStrPos+1) && trigName.find("Photon",etStrPos+1)<trigName.find("SC",etStrPos+1)){etStrPos=trigName.find("Photon",etStrPos+1);isPhoton2=true;}
00325     else if(trigName.find("SC",etStrPos+1)<trigName.find("EG",etStrPos+1) && trigName.find("SC",etStrPos+1)<trigName.find("Ele",etStrPos+1) && trigName.find("SC",etStrPos+1)<trigName.find("Photon",etStrPos+1)){etStrPos=trigName.find("Photon",etStrPos+1);isSC2=true;}
00326     //std::cout<<"Got second Et spot; etStrPos="<<etStrPos<<std::endl;//}//get second instance.  if it dne, keep first
00327     
00328     if(isEle2){
00329       if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+3){//std::cout<<"In if"<<std::endl;
00330         size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+3);  
00331         
00332         std::istringstream etValStr(trigName.substr(etStrPos+3,endOfEtValStr-etStrPos-3));
00333         float etVal;
00334         etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<"   etVal= "<<etVal<<std::endl;
00335         return etVal;
00336       }
00337     }
00338     if(isEG2 || isSC2){
00339       if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+2){//std::cout<<"In if"<<std::endl;
00340         size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+2);  
00341         
00342         std::istringstream etValStr(trigName.substr(etStrPos+2,endOfEtValStr-etStrPos-2));
00343         float etVal;
00344         etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<"   etVal= "<<etVal<<std::endl;
00345         return etVal;
00346       }
00347     }      
00348 
00349     if(isPhoton2){
00350       if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+6){//std::cout<<"In if"<<std::endl;
00351         size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+6);  
00352         
00353         std::istringstream etValStr(trigName.substr(etStrPos+6,endOfEtValStr-etStrPos-6));
00354         float etVal;
00355         etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<"   etVal= "<<etVal<<std::endl;
00356         return etVal;
00357       }
00358     }
00359   }
00360   else if(etStrPos!=trigName.npos){
00361     if(isEle){
00362       if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+3){//std::cout<<"In if"<<std::endl;
00363         size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+3);  
00364         
00365         std::istringstream etValStr(trigName.substr(etStrPos+3,endOfEtValStr-etStrPos-3));
00366         float etVal;
00367         etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<"   etVal= "<<etVal<<std::endl;
00368         return etVal;
00369       }
00370     }
00371     if(isEG){
00372       if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+2){//std::cout<<"In if"<<std::endl;
00373         size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+2);  
00374         
00375         std::istringstream etValStr(trigName.substr(etStrPos+2,endOfEtValStr-etStrPos-2));
00376         float etVal;
00377         etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<"   etVal= "<<etVal<<std::endl;
00378         return etVal;
00379       }
00380     }      
00381 
00382     if(isPhoton){
00383       if(etStrPos!=trigName.npos && trigName.find_first_of("1234567890",etStrPos)==etStrPos+6){//std::cout<<"In if"<<std::endl;
00384         size_t endOfEtValStr = trigName.find_first_not_of("1234567890",etStrPos+6);  
00385         
00386         std::istringstream etValStr(trigName.substr(etStrPos+6,endOfEtValStr-etStrPos-6));
00387         float etVal;
00388         etValStr>> etVal;//std::cout<<"TrigName= "<<trigName<<"   etVal= "<<etVal<<std::endl;
00389         return etVal;
00390       }
00391     }
00392   }
00393 
00394   return 0;
00395   
00396 }