Пример #1
0
 def isGoodRinger(self):
     if self._dataframe is DataframeEnum.Electron_v1 or DataframeEnum.Photon_v1:
         rings = stdvector_to_list(self._event.trig_L2_calo_rings)
         return True if len(rings) != 0 else False
     else:
         self._logger.warning(
             "Impossible to retrieve the value of ringer rings. Unknow dataframe."
         )
         return False
Пример #2
0
 def ringsE(self):
     """
       Retrieve the L2Calo Ringer Rins information from Physval or SkimmedNtuple
     """
     if self._dataframe is DataframeEnum.Electron_v1 or DataframeEnum.Photon_v1:
         rings = stdvector_to_list(self._event.trig_L2_calo_rings)
         return np.array(rings, dtype=np.float32)
     else:
         self._logger.warning(
             "Impossible to retrieve the value of L2Calo Ringer Rings. Unknow dataframe"
         )
         return None
Пример #3
0
 def energy(self, idx=None):
     if self._dataframe is DataframeEnum.Electron_v1 or DataframeEnum.Photon_v1:
         if idx:
             return self._event.trig_L2_calo_energySample[idx]
         else:
             return sum(
                 stdvector_to_list(self._event.trig_L2_calo_energySample))
     else:
         self._logger.warning(
             "Impossible to retrieve the value of e2tsts1. Unknow dataframe"
         )
         return -999
Пример #4
0
    def initialize(self):

        if self._dataframe is DataframeEnum.Electron_v1:
            branches = self.__eventBranches["Electron_v1"]
        elif self._dataframe is DataframeEnum.Photon_v1:
            branches = self.__eventBranches["Photon_v1"]
        else:
            MSG_WARNING(
                self,
                'Not possible to initialize this metadata using this dataframe. skip!'
            )
            return StatusCode.SUCCESS

        inputFile = self._metadataParams['file']
        # Check if file exists
        f = ROOT.TFile.Open(inputFile, 'read')
        if not f or f.IsZombie():
            MSG_WARNING(self, 'Couldn' 't open file: %s', inputFile)
            return StatusCode.FAILURE

        # Inform user whether TTree exists, and which options are available:
        MSG_DEBUG(self, "Adding file: %s", inputFile)
        treePath = self._metadataParams['basepath'] + '/' + self._metadataName
        obj = f.Get(treePath)
        if not obj:
            MSG_WARNING(self, "Couldn't retrieve TTree (%s)!", treePath)
            MSG_INFO(self, "File available info:")
            f.ReadAll()
            f.ReadKeys()
            f.ls()
            return StatusCode.FAILURE
        elif not isinstance(obj, ROOT.TTree):
            MSG_FATAL(self, "%s is not an instance of TTree!", treePath,
                      ValueError)
        try:
            obj.GetEntry(0)
            self._triggerList = stdvector_to_list(obj.trig_tdt_triggerList)
            for trigItem in self._triggerList:
                MSG_INFO(self, "Metadata trigger: %s", trigItem)
        except:
            MSG_ERROR(
                self,
                "Can not extract the trigger list from the metadata file.")
            return StatusCode.FAILURE

        try:
            self.link(branches)
            return StatusCode.SUCCESS
        except:
            MSG_WARNING(self, "Impossible to create the TDTMetaData Container")
            return StatusCode.FAILURE
Пример #5
0
 def isGoodRinger(self):
     if self._dataframe is DataframeEnum.Electron_v1:
         if self._is_hlt:
             self._logger.warning(
                 "Ringer rings information not available in HLT Electron object."
             )
             return False
         else:
             rings = stdvector_to_list(self._event.el_ringsE)
             return True if len(rings) != 0 else False
     else:
         self._logger.warning(
             "Impossible to retrieve the value of ringer rings. Unknow dataframe."
         )
         return False
Пример #6
0
    def ringsE(self):
        """
      Retrieve the Ringer Rings information from Physval or SkimmedNtuple
    """

        if self._dataframe is DataframeEnum.Electron_v1:
            if self._is_hlt:
                self._logger.warning(
                    "Ringer rings information not available in HLT Electron object."
                )
                return -999
            else:
                rings = stdvector_to_list(self._event.el_ringsE)
                return rings
        else:
            self._logger.warning(
                "Impossible to retrieve the value of ringer rings. Unknow dataframe."
            )
            return -999