BunchCrossingInfo

HLTInfo

LumiAlgoType

LumiSectionData

TriggerInfo

TriggerType

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
#ifndef CondFormats_Luminosity_LumiSectionData_h
#define CondFormats_Luminosity_LumiSectionData_h
/** 
 *
 * BunchCrossingInfo holds Details information the lumi value, the error on this value 
 * and its quality for each bunch crossing (BX) in a given luminosity section (LS)   
 * BX definition: There are 3564 bunch crossing (BX) in each LHC orbit 
 * each event will occur at one of these BX. BX is defined to be the number of the
 * bunch crossing where this event occurred.
 *
 * $Id: LumiSectionData.h,v 1.2 2009/10/07 14:33:02 xiezhen Exp $
 *
 ************************************************************/

#include "CondFormats/Serialization/interface/Serializable.h"

#include <vector>
#include <string>

namespace lumi {
  static const int BXMIN = 1;
  static const int BXMAX = 3564;
  static const int LUMIALGOMAX = 3;

  typedef enum { ET = 0, OCCD1 = 1, OCCD2 = 2 } LumiAlgoType;
  typedef enum { ALGO = 0, TECH = 1 } TriggerType;

  struct HLTInfo {
    HLTInfo() : pathname(""), inputcount(-99), acceptcount(-99), prescale(-99) {}
    HLTInfo(const std::string& pathnameIN, int i, int a, int p)
        : pathname(pathnameIN), inputcount(i), acceptcount(a), prescale(p) {}
    std::string pathname;
    int inputcount;
    int acceptcount;
    int prescale;

    COND_SERIALIZABLE;
  };

  struct TriggerInfo {
    TriggerInfo() : name(""), triggercount(-99), deadtimecount(-99), prescale(-99) {}
    TriggerInfo(const std::string& trgname, int trgcount, int deadcount, int p)
        : name(trgname), triggercount(trgcount), deadtimecount(deadcount), prescale(p) {}
    std::string name;
    int triggercount;
    int deadtimecount;  //max 2**20*3564=3737124864, so wrong type
    int prescale;

    COND_SERIALIZABLE;
  };

  struct BunchCrossingInfo {
    BunchCrossingInfo() {}
    BunchCrossingInfo(int idx, float value, float err, int quality)
        : BXIdx(idx), lumivalue(value), lumierr(err), lumiquality(quality) {}
    int BXIdx;  //starting from 1
    float lumivalue;
    float lumierr;
    int lumiquality;

    COND_SERIALIZABLE;
  };

  static const BunchCrossingInfo BXNULL = BunchCrossingInfo(-99, -99.0, -99.0, -99);
  typedef std::vector<BunchCrossingInfo>::const_iterator BunchCrossingIterator;
  typedef std::vector<HLTInfo>::const_iterator HLTIterator;
  typedef std::vector<TriggerInfo>::const_iterator TriggerIterator;

  class LumiSectionData {
  public:
    LumiSectionData();
    ~LumiSectionData() {}

  public:
    ///
    ///getter methods
    ///
    std::string lumiVersion() const;
    int lumisectionID() const;
    size_t nBunchCrossing() const;
    //radom access to instant LumiAverage
    float lumiAverage() const;
    float lumiError() const;
    float deadFraction() const;
    int lumiquality() const;
    unsigned long long startorbit() const;
    //get bunchCrossingInfo by algorithm
    void bunchCrossingInfo(const LumiAlgoType lumialgotype, std::vector<BunchCrossingInfo>& result) const;
    //random access to bunchCrossingInfo by bunchcrossing index
    const BunchCrossingInfo bunchCrossingInfo(const int BXIndex, const LumiAlgoType lumialgotype) const;
    //sequential access to bunchCrossingInfo
    BunchCrossingIterator bunchCrossingBegin(const LumiAlgoType lumialgotype) const;
    BunchCrossingIterator bunchCrossingEnd(const LumiAlgoType lumialgotype) const;
    //total number of HLT paths
    size_t nHLTPath() const;
    bool HLThasData() const;
    HLTIterator hltBegin() const;
    HLTIterator hltEnd() const;

    bool TriggerhasData() const;
    TriggerIterator trgBegin() const;
    TriggerIterator trgEnd() const;

    short qualityFlag() const;
    ///
    ///setter methods.
    ///
    void setLumiNull();  //set versionid number to -99, signal no lumi data written.
    void setLumiVersion(const std::string& versionid);
    void setLumiSectionId(int sectionid);
    void setLumiAverage(float lumiavg);
    void setLumiQuality(int lumiquality);
    void setDeadFraction(float deadfrac);
    void setLumiError(float lumierr);
    void setStartOrbit(unsigned long long orbtnumber);
    void setBunchCrossingData(const std::vector<BunchCrossingInfo>& BXs, const LumiAlgoType algotype);
    void setHLTData(const std::vector<HLTInfo>& hltdetail);
    void setTriggerData(const std::vector<TriggerInfo>& triggerinfo);
    void setQualityFlag(short qualityflag);
    void print(std::ostream& s) const;

  private:
    std::vector<BunchCrossingInfo> m_bx;  //Lumi detail info sorted by algoright+BX number stored as blob
    int m_sectionid;                      //LS id counting from 1 as required by evt. Instead from 0
    std::string m_versionid;              //Lumi version
    float m_lumiavg;                      //instant lumi , selected from best algo
    float m_lumierror;                    //instant lumi err,
    short m_quality;                      //use 7 bits PIXEL,STRIP,MUON,HCAL,ECAL,HF,HLX
    float m_deadfrac;                     //deadtime fraction
    unsigned long long m_startorbit;      //first orbit number of this LS
    std::vector<HLTInfo> m_hlt;           //hlt scaler information sorted by hltpath independent of lumiversion
    std::vector<TriggerInfo> m_trigger;  //trigger scaler sorted by bit number 128algo+64tech independent of lumiversion

    COND_SERIALIZABLE;
  };
}  // namespace lumi
#endif