Changeset 19507 for trunk/FACT++/src


Ignore:
Timestamp:
05/25/19 13:52:01 (5 years ago)
Author:
tbretz
Message:
Implemented a filter list to only trigger with certain paket IDs. Simplified some stuff by converting teh list of paket types to  std::map
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/gcn.cc

    r19498 r19507  
    5959    }
    6060
    61     GCN::PaketType_t GetType(const QDomElement &what)
     61    GCN::PaketPtr GetType(const QDomElement &what)
    6262    {
    6363        const auto value = GetParamValue(what, "Packet_Type");
    6464        if (value.isEmpty())
    65             return { -1, "", "" };
     65            return GCN::PaketTypes.end();
    6666
    6767        const uint16_t val = value.toUInt();
    68         const auto it = fTypes.find(val);
    69         if (it!=fTypes.end())
    70             return it->second;
    71 
    72         Warn("Unknown paket type "+to_string(val)+".");
    73         return { -1, "", "" };
     68
     69        const auto it = GCN::PaketTypes.find(val);
     70
     71        if (it==GCN::PaketTypes.end())
     72            Warn("Unknown paket type "+to_string(val)+".");
     73
     74        return it;
     75
    7476    }
    7577
     
    126128                return -1;
    127129
    128             const GCN::PaketType_t ptype = GetType(what);
     130            const auto ptype = GetType(what);
    129131
    130132            const QDomElement date   = who.firstChildElement("Date");
     
    146148            const QDomElement errad  = pos2d.firstChildElement("Error2Radius");
    147149
    148             const bool is_gw = ptype.type==150 || ptype.type==151 || ptype.type==152 || ptype.type==153 || ptype.type==164;
     150            const auto &id = ptype->first;
     151
     152            const bool is_gw = id==150 || id==151 || id==152 || id==153 || id==164;
    149153
    150154            vector<string> missing;
     
    234238             */
    235239
     240            const auto &paket = ptype->second;
     241
    236242            const string unit = pos2d.attribute("unit").toStdString();
    237243
     
    247253            if (!desc.isNull())
    248254                Out() << "[" << desc.text().toStdString()  << "]\n";
    249             Out() << ptype.name << "[" << ptype.type << "]: " << ptype.description << endl;
     255            Out() << paket.name << "[" << id << "]: " << paket.description << endl;
    250256            Out() << left;
    251257            Out() << "  " << setw(5) << "TIME" << "= " << Time(time.text().toStdString()).GetAsStr() << '\n';
     
    256262            const bool has_coordinates = n1=="RA" && n2=="Dec" && unit=="deg";
    257263
    258             if (has_coordinates)
     264            const std::set<int16_t> typelist =
     265            {
     266                51,  // INTEGRAL_POINTDIR
     267
     268                53,  // INTEGRAL_WAKEUP
     269                54,  // INTEGRAL_REFINED
     270                55,  // INTEGRAL_OFFLINE
     271
     272                // 56, // INTEGRAL_WEAK
     273                // 59, // KONUS_LC
     274
     275                60,  // SWIFT_BAT_GRB_ALERT
     276                61,  // SWIFT_BAT_GRB_POS_ACK
     277                62,  // SWIFT_BAT_GRB_POS_NACK
     278
     279                83,  // SWIFT_POINTDIR
     280
     281                97,  // SWIFT_BAT_QL_POS
     282
     283                100, // AGILE_GRB_WAKEUP
     284                101, // AGILE_GRB_GROUND
     285                102, // AGILE_GRB_REFINED
     286
     287                110, // FERMI_GBM_FLT_POS
     288                111, // FERMI_GBM_GND_POS
     289                112, // FERMI_GBM_LC
     290                115, // FERMI_GBM_TRANS
     291
     292                123, // FERMI_LAT_TRANS
     293                125, // FERMI_LAT_MONITOR
     294
     295                // 134, // MAXI_UNKNOWN
     296                // 135, // MAXI_KNOWN
     297                // 136, // MAXI_TEST
     298
     299                157, // AMON_ICECUBE_COINC
     300                158, // AMON_ICECUBE_HESE
     301
     302                169, // AMON_ICECUBE_EHE
     303                171, // HAWC_BURST_MONITOR
     304                173, // ICECUBE_GOLD
     305                174, // ICECUBE_BRONZE
     306            };
     307
     308            const bool valid = typelist.find(id)!=typelist.end();
     309
     310            if (valid && has_coordinates)
    259311            {
    260312                const ToO::DataGRB data =
    261313                {
    262                     .type   = ptype.type,
     314                    .type   = id,
    263315                    .trigid = trig,
    264316                    .ra     = ra,
     
    426478    {
    427479        SetLogStream(&imp);
    428 
    429         for (auto it=GCN::kTypes; it->type>0; it++)
    430             fTypes[it->type] = *it;
    431480    }
    432481
Note: See TracChangeset for help on using the changeset viewer.