Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:47

0001 // Test the various geometry/position transformations in
0002 // candidates from the GCT
0003 //
0004 // Alex Tapper 5th October 2007
0005 //
0006 
0007 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctEmCand.h"
0008 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctJetCand.h"
0009 
0010 #include <iostream>
0011 
0012 using namespace std;
0013 
0014 int main() {
0015   bool fail = false;
0016 
0017   // Check we get back out what we constructed the object with even when we use the regionID object
0018   for (unsigned rank = 1; rank < 64;
0019        rank++) {  // Start at rank=1 since rank =0 returns the default values for the hardware, not what you input for eta and phi
0020     for (unsigned phi = 0; phi < 18; phi++) {
0021       for (unsigned eta = 0; eta < 7; eta++) {
0022         for (unsigned etaSign = 0; etaSign < 2; etaSign++) {
0023           for (unsigned iso = 0; iso < 2; iso++) {
0024             unsigned gctEta = (etaSign << 3) | (eta & 0x7);
0025             L1GctEmCand e(rank, phi, gctEta, iso);
0026             if (e.rank() != rank || e.etaIndex() != gctEta || e.phiIndex() != phi || e.isolated() != iso) {
0027               cout << "Error in L1GctEmCand constructor rank=" << rank << " phi=" << phi << " eta=" << gctEta
0028                    << " iso=" << iso << endl;
0029               fail = true;
0030             }
0031             unsigned ieta = etaSign ? 10 - eta : 11 + eta;
0032             if (e.regionId().iphi() != phi || e.regionId().ieta() != ieta) {
0033               cout << "Error in L1GctEmCand regionId() eta=" << ieta << " phi=" << phi << endl;
0034               fail = true;
0035             }
0036           }
0037         }
0038       }
0039     }
0040   }
0041 
0042   // Check we get back out what we constructed the object with even when we use the regionID object
0043   for (unsigned rank = 0; rank < 64; rank++) {
0044     for (unsigned phi = 0; phi < 18; phi++) {
0045       for (unsigned eta = 0; eta < 7; eta++) {
0046         for (unsigned tau = 0; tau < 2; tau++) {
0047           for (unsigned etaSign = 0; etaSign < 2; etaSign++) {
0048             unsigned gctEta = (etaSign << 3) | (eta & 0x7);
0049             L1GctJetCand j(rank, phi, gctEta, tau, false);
0050             if (j.rank() != rank || j.etaIndex() != gctEta || j.phiIndex() != phi || j.isTau() != tau) {
0051               cout << "Error in L1GctJetCand constructor rank=" << rank << " phi=" << phi << " eta=" << gctEta
0052                    << " tau=" << tau << endl;
0053               fail = true;
0054             }
0055             unsigned ieta = etaSign ? 10 - eta : 11 + eta;
0056             if (j.regionId().iphi() != phi || j.regionId().ieta() != ieta) {
0057               cout << "Error in L1GctJetCand regionId() eta=" << ieta << " phi=" << phi << endl;
0058               fail = true;
0059             }
0060           }
0061         }
0062       }
0063     }
0064   }
0065 
0066   // Check we get back out what we constructed the object with even when we use the regionID object
0067   for (unsigned rank = 0; rank < 64; rank++) {
0068     for (unsigned phi = 0; phi < 18; phi++) {
0069       for (unsigned eta = 0; eta < 3; eta++) {
0070         for (unsigned etaSign = 0; etaSign < 2; etaSign++) {
0071           unsigned gctEta = (etaSign << 3) | (eta & 0x7);
0072           L1GctJetCand j(rank, phi, gctEta, false, true);
0073           if (j.rank() != rank || j.etaIndex() != gctEta || j.phiIndex() != phi) {
0074             cout << "Error in L1GctJetCand (forward) constructor rank=" << rank << " phi=" << phi << " eta=" << gctEta
0075                  << endl;
0076             fail = true;
0077           }
0078           unsigned ieta = etaSign ? 3 - eta : 18 + eta;
0079           if (j.regionId().iphi() != phi || j.regionId().ieta() != ieta) {
0080             cout << "Error in L1GctJetCand (forward) regionId() eta=" << ieta << " phi=" << phi << endl;
0081             fail = true;
0082           }
0083         }
0084       }
0085     }
0086   }
0087 
0088   if (!fail)
0089     return 0;
0090   else
0091     return 1;
0092 }