Pmt/Channel ID

From Daya Bay
Jump to navigation Jump to search

The purpose of the PMT and RPC-channel identity (pmtID and channelID respectively) are to act a primary keys for database lookups providing access to the appropriate temporal data describing their associated detector element. To this end, as people who are familiar with relational databases will know, the best choices for such primary keys are opaque, i.e. containing no semantic content, unique numbers. Therefore simplest and most obvious choice is to represent both pmtIDs and channelIDs as simple integers.

The upshot of this choice is that we must provide mechanisms for looking up the appropriate integer for a known PMT or channel. (In database terms this is simple a SELECT from the appropriate "placement" table.) Thus, to access the physical location of a PMT will take the following form:

  // Find PmtId for PMT number 12 in AD 3
 int pmtId = PmtId.lookup(DetectorType::kAntiNu,
                          3,
                          12);
 PmtLocation location = geometrySrv->getPmtLocation(pmtId);

While access to the RPC channel location would that the following form:

 // Find channelId for Channel number 5 in RPC 2
 int channelId = ChannelId.lookup(2,
                                  5);
 ChannelLocation location = geometrySrv->getChannelLocation(channelId);

Similarly, mechansims must be supplied to recover the placement of a PMT or channel given an identity. These will take the following form:

 int ad = PmtId.container(DetectorType::kAntiNu,
                          pmtId);
 int pmtNumber = PmtId.number(pmtId);
 
 int rpc = ChannelId.container(channelId);
 int channelNumber = ChannelId.number(channelId);

Thus this leads to the definition for two "utility" classes as follows:

 class PmtId {
     static int lookup(DetectorType type,
                       int container,
                       int number);
     static int container(DetectorType type,
                          int id);
     static int number(int id);
 };
 class ChannelId {
     static int lookup(int container,
                       int number);
     static int container(int id);
     static int number(int id);
 };