Run11 DSM algorithm code

I have made some progress in implementing the DSM algorithm for Run 11. The current version of the code can be found in TrigQt.cxx inside /star/u/adhikari/sim/fpdsim6/FpdRoot2/. 

Some preliminary information about DSM, including a link to a document containing Run 11 DSM algorithm can be found in my previous drupal post here

Three methods have been added to TrigQt: L0dsm2011(), L1dsm2011(), and L2dsm2011() that implement the 2011 dsm algorithm. Attempt has been made to follow the dsm algorithm as much as possible, even in cases where it would have made more sense to change the order in order to write less code and/or decrease the number of steps necessary. The code provides trigger bits output from L2dsm2011() called L2_TrigBits2011, which is a 15 bit number that has trigger bit information as follows (copied from Table 4 of the documentation mentioned earlier):

 

Table 4: Output of Layer 2 FPD/FMS DSM Board

Bit         Name                            Description

Bit 0      Fms-HT-th0                  FMS small-cell HT threshold-0 bit

Bit 1      Fms-HT-th1                  FMS large-cell HT threshold-1 bit

Bit 2      FmsSml-Cluster-th0      FMS small-cell cluster threshold-0 bit

Bit 3      FmsSml-Cluster-th1      FMS small-cell cluster threshold-1 bit

Bit 4      FmsSml-Cluster-th2      FMS small-cell cluster threshold-2 bit

Bit 5      FmsLrg-Cluster-th0       FMS large-cell cluster threshold-0 bit

Bit 6      FmsLrg-Cluster-th1       FMS large-cell cluster threshold-1 bit

Bit 7      FmsLrg-Cluster-th2       FMS large-cell cluster threshold-2 bit

Bit 8      Fms-JP-th0                   FMS Jet Patch threshold-0 bit

Bit 9      Fms-JP-th1                   FMS Jet Patch threshold-1 bit

Bit 10    Fms-JP-th2                   FMS Jet Patch threshold-2 bit

Bit 11    Fms-dijet                      FMS dijet bit

Bit 12    Unused                         Unused

Bit 13    Unused                         Unused

Bit 14    FPE                               FPE trigger bit

Bit 15   Unused                           Unused

 
In L2_TrigBits2011, last 4 bits are unused and hence set to 0. the FPE bit information comes from a different (FPD-East) detector, and hence is not implemented.
 
Initial tests
I ran some tests, basically took one run data file run12090002.11.root and subjected it through the trigger reconstruction (the code that has been used to to do can be found in /star/u/adhikari/sim/fpdsim6/FpdRoo2/SimTrigger.cxx). The output of the first two bits from the data and the dsm implementation match exactly, while there are some discrepencies in the rest, althought they match for most of the cases. Comparision of 1000 entries and the number of entries that do not match for each bit is tabulated below:
 
Bit         Name                           # unmatched (out of 1000)

Bit 0      Fms-HT-th0                  0

Bit 1      Fms-HT-th1                  0

Bit 2      FmsSml-Cluster-th0      33

Bit 3      FmsSml-Cluster-th1      53

Bit 4      FmsSml-Cluster-th2      149

Bit 5      FmsLrg-Cluster-th0       40

Bit 6      FmsLrg-Cluster-th1       75

Bit 7      FmsLrg-Cluster-th2       136

Bit 8      Fms-JP-th0                   102

Bit 9      Fms-JP-th1                   155

Bit 10    Fms-JP-th2                   337

Bit 11    Fms-dijet                      11

 

The above result indicates that there could still be bug(s) in the portion of my code where cluster sums are calculated and compared to the thresholds. I am looking for them in hopes that the bits from the data match that of the trigger simulation. It could, however, be the case that there might be other modifications necessary apart from the dsm algorithm. I doubt that is the case because the Run11 dsm documentation mentions that no changes were made at the qt level.