Exemplo n.º 1
0
        private BlockStoreDetectorResponse processDetectorQueryAverage(BlockStoreDetectorQuery query, int[] blockIDs)
        {
            BlockStoreDetectorResponse dr = new BlockStoreDetectorResponse();

            dr.Channels = new Dictionary <string, TOFChannel>();
            using (BlockDatabaseDataContext dc = new BlockDatabaseDataContext())
            {
                IEnumerable <DBTOFChannelSet> tcss = from DBTOFChannelSet tcs in dc.DBTOFChannelSets
                                                     where (tcs.detector == query.Detector) &&
                                                     blockIDs.Contains(tcs.blockID)
                                                     select tcs;
                // accumulate the average TCS
                TOFChannelSetAccumulator tcsa = new TOFChannelSetAccumulator();
                foreach (DBTOFChannelSet dbTcs in tcss)
                {
                    TOFChannelSet t = deserializeTCS(dbTcs.tcsData.ToArray());
                    tcsa.Add(t);
                }
                // TODO: Handle special channels
                TOFChannelSet averageTCS = tcsa.GetResult();
                foreach (string channel in query.Channels)
                {
                    dr.Channels.Add(channel, (TOFChannel)averageTCS.GetChannel(channel));
                }
            }
            return(dr);
        }
Exemplo n.º 2
0
        private BlockStoreDetectorResponse processDetectorQuery(BlockStoreDetectorQuery query, int blockID)
        {
            BlockStoreDetectorResponse dr = new BlockStoreDetectorResponse();

            dr.Channels = new Dictionary <string, TOFChannel>();
            using (BlockDatabaseDataContext dc = new BlockDatabaseDataContext())
            {
                IEnumerable <DBTOFChannelSet> tcss = from DBTOFChannelSet tcs in dc.DBTOFChannelSets
                                                     where (tcs.detector == query.Detector) &&
                                                     (tcs.blockID == blockID)
                                                     select tcs;
                // there should only be one item - better to check or not?
                DBTOFChannelSet tc = tcss.First();
                TOFChannelSet   t  = deserializeTCS(tc.tcsData.ToArray());
                // TODO: Handle special channels
                foreach (string channel in query.Channels)
                {
                    dr.Channels.Add(channel, (TOFChannel)t.GetChannel(channel));
                }
            }
            return(dr);
        }
Exemplo n.º 3
0
 private BlockStoreDetectorResponse processDetectorQueryAverage(BlockStoreDetectorQuery query, int[] blockIDs)
 {
     BlockStoreDetectorResponse dr = new BlockStoreDetectorResponse();
     dr.Channels = new Dictionary<string, TOFChannel>();
     using (BlockDatabaseDataContext dc = new BlockDatabaseDataContext())
     {
         IEnumerable<DBTOFChannelSet> tcss = from DBTOFChannelSet tcs in dc.DBTOFChannelSets
                                             where (tcs.detector == query.Detector)
                                             && blockIDs.Contains(tcs.blockID)
                                             select tcs;
         // accumulate the average TCS
         TOFChannelSetAccumulator tcsa = new TOFChannelSetAccumulator();
         foreach (DBTOFChannelSet dbTcs in tcss)
         {
             TOFChannelSet t = deserializeTCS(dbTcs.tcsData.ToArray());
             tcsa.Add(t);
         }
         // TODO: Handle special channels
         TOFChannelSet averageTCS = tcsa.GetResult();
         foreach (string channel in query.Channels)
             dr.Channels.Add(channel, (TOFChannel)averageTCS.GetChannel(channel));
     }
     return dr;
 }
Exemplo n.º 4
0
        private BlockStoreDetectorResponse processDetectorQuery(BlockStoreDetectorQuery query, int blockID)
        {
            BlockStoreDetectorResponse dr = new BlockStoreDetectorResponse();
            dr.Channels = new Dictionary<string, TOFChannel>();
            using (BlockDatabaseDataContext dc = new BlockDatabaseDataContext())
            {
                IEnumerable<DBTOFChannelSet> tcss = from DBTOFChannelSet tcs in dc.DBTOFChannelSets
                                                    where (tcs.detector == query.Detector)
                                                    && (tcs.blockID == blockID)
                                                    select tcs;
                // there should only be one item - better to check or not?
                DBTOFChannelSet tc = tcss.First();
                TOFChannelSet t = deserializeTCS(tc.tcsData.ToArray());
                // TODO: Handle special channels
                foreach (string channel in query.Channels)
                    dr.Channels.Add(channel, (TOFChannel)t.GetChannel(channel));

            }
            return dr;
        }