def accept(self, context):

        ph = context.getHandler("HLT__PhotonContainer")

        branch = self.getProperty("Branch")

        if not ph.checkBody(branch):
            MSG_FATAL(self,
                      "The branch %s is not found into the HLT photon body.",
                      branch)

        # helper accessor function
        def getDecision(container, branch):
            passed = False
            current = container.getPos()
            for it in container:
                if it.accept(branch):
                    passed = True
                    break
            container.setPos(current)  # to avoid location fail
            return passed

        # Decorate the HLT electron with all final decisions
        passed = getDecision(ph, branch)

        return Accept(self.name(), [("Pass", passed)])
Esempio n. 2
0
    def __getAcceptInfo(self):

        accept = Accept(self.name())
        self.output = -999
        accept.setCutResult("Pass", False)
        accept.setDecor("discriminant", self.output)
        return accept
    def accept(self, context):

        elCont = context.getHandler("HLT__TrigElectronContainer")
        current = elCont.getPos()

        bitAccept = [False for _ in range(elCont.size())]

        etThr = self.getProperty('EtCut')
        trackPtthr = self.getProperty('TrackPt')
        calotrackdeta = self.getProperty('CaloTrackdETA')
        calotrackdphi = self.getProperty('CaloTrackdPHI')
        calotrackdeoverp_low = self.getProperty('CaloTrackdEoverPLow')
        calotrackdeoverp_high = self.getProperty('CaloTrackdEoverPHigh')
        trtratio = self.getProperty('TRTRatio')

        for el in elCont:
            # Retrieve all quantities
            dPhiCalo = el.trkClusDphi()
            dEtaCalo = el.trkClusDeta()
            pTcalo = el.pt()
            eTOverPt = el.etOverPt()
            NTRHits = el.numberOfTRTHits()
            NStrawHits = el.numberOfTRTHiThresholdHits()
            TRTHitRatio = 1e10 if NStrawHits == 0 else NTRHits / float(
                NStrawHits)
            # apply cuts

            if (pTcalo > trackPtthr):
                if (dEtaCalo < calotrackdeta):
                    if (dPhiCalo < calotrackdphi):
                        if (eTOverPt > calotrackdeoverp_low):
                            if (eTOverPt < calotrackdeoverp_high):
                                if (TRTHitRatio > trtratio):
                                    # TrigElectron passed all cuts: set flags
                                    bitAccept[el.getPos()] = True
                                    MSG_DEBUG(self, "Event accepted !")
                                #TRTHitRatio
                            #etOverPt
                        #dphi
                    #deta
                #pt
            #apply cuts
        # Loop over electrons

        elCont.setPos(current)
        # got this far => passed!
        passed = any(bitAccept)
        return Accept(self.name(), [("Pass", passed)])
  def accept( self, context ):

    phCont = context.getHandler( "HLT__PhotonContainer" ) # beware, this should be review!
    current = phCont.getPos()

    bitAccept = [False for _ in range(phCont.size())]
    etThr =  self.getProperty('EtCut')
    for ph in phCont:
      # Retrieve all quantities
      # pTcalo      = ph.pt();
      bitAccept[ph.getPos()] = True
      MSG_DEBUG( self,  "Event accepted !" )

    phCont.setPos( current )
    passed = any( bitAccept )
    return Accept( self.name(), [("Pass", passed)] )
Esempio n. 5
0
 def accept(self, context):
     passed = self.emulation(context)
     return Accept(self.name(), [("Pass", passed)])
Esempio n. 6
0
    def getAcceptInfo(self):

        accept = Accept(self.name())
        accept.addCut('L1Calo')
        accept.addCut('L2Calo')
        accept.addCut('L2')
        accept.addCut('EFCalo')
        accept.addCut('HLT')
        accept.addCut('Pass')
        return accept
  def accept(self, context):

    elCont= context.getHandler("HLT__ElectronContainer")

    current = elCont.getPos()

    passed = False

    for el in elCont:


      etcone20 = el.isolationValue( IsolationType.etcone20 )
      etcone30 = el.isolationValue( IsolationType.etcone30 )
      etcone40 = el.isolationValue( IsolationType.etcone40 )

      ptcone20 = el.isolationValue( IsolationType.ptcone20 )
      ptcone30 = el.isolationValue( IsolationType.ptcone30 )
      ptcone40 = el.isolationValue( IsolationType.ptcone40 )

      ptvarcone20 = el.isolationValue( IsolationType.ptvarcone20 )
      ptvarcone30 = el.isolationValue( IsolationType.ptvarcone30 )
      ptvarcone40 = el.isolationValue( IsolationType.ptvarcone40 )

      etcone = [
                etcone20,
                etcone30,
                etcone40,
               ]

      
      ptcone = [
                ptcone20,
                ptcone30,
                ptcone40,
                ptvarcone20,
                ptvarcone30,
                ptvarcone40
                ]

      el_clus_pt     = el.caloCluster().et()
      el_trk_pt      = el.trackParticle().pt() if el.trackParticle() else -999
      caloIso_ele_pt = el_clus_pt if self.__useClusETforCaloIso else el_trk_pt
      trkIso_ele_pt  = el_clus_pt if self.__useClusETforTrackIso else el_trk_pt



      absEtConeCut_ispassed = True

      # Cut on Absolute Calo Isolation
      for idx, value in enumerate( etcone ):
        if self.__etConeCut[idx] > 0 and value > self.__etConeCut[idx]:
          absEtConeCut_ispassed = False
          break


      if not absEtConeCut_ispassed:
        continue

      
      absPtConeCut_ispassed = True

      # Cut on Absolute Track Isolation
      for idx, value in enumerate( ptcone ):
        if self.__ptConeCut[idx] > 0 and value > self.__ptConeCut[idx]:
          absPtConeCut_ispassed = False
          break


      if not absPtConeCut_ispassed:
        continue



      relEtcone = []

      # Fill rel et cone
      for idx, value in enumerate( etcone ):
        if caloIso_ele_pt > 0.:
          relEtcone.append( value/caloIso_ele_pt )
        else:
          relEtcone.append( 99990. )


      relPtcone = []
      
      # Fill rel pt cone
      for idx, value in enumerate( ptcone ):
        if caloIso_ele_pt > 0.:
          relPtcone.append( value/trkIso_ele_pt )
        else:
          relPtcone.append( 99990. )

      


      relEtConeCut_ispassed = True

      # Cut on Absolute Calo Isolation
      for idx, value in enumerate( relEtcone ):
        if self.__relEtConeCut[idx] > 0 and value > self.__relEtConeCut[idx]:
          relEtConeCut_ispassed = False
          break


      if not relEtConeCut_ispassed:
        continue

      
      relPtConeCut_ispassed = True

      # Cut on Absolute Track Isolation
      for idx, value in enumerate( relPtcone ):
        if self.__ptConeCut[idx] > 0 and value > self.__ptConeCut[idx]:
          relPtConeCut_ispassed = False
          break


      if not relPtConeCut_ispassed:
        continue

      
      passed=True
      if passed:
        break
      

    elCont.setPos( current )

    return Accept( self.name(), [ ("Pass", passed) ] )
Esempio n. 8
0
    def accept(self, context):

        l1 = context.getHandler("HLT__EmTauRoIContainer")
        passed = self.emulation(l1, self.__l1type, self.__l1item,
                                self.__l1threshold)
        return Accept(self.name(), [("Pass", passed)])