Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96

#include "Alignment/LaserAlignment/interface/LASGlobalLoop.h"

///
///
///
LASGlobalLoop::LASGlobalLoop() {}

///
/// full TEC loop (both endcaps)
/// with starting values given by parameter values
///
bool LASGlobalLoop::TECLoop(int& subdet, int& ring, int& beam, int& disk) const {
  if (subdet > 1) {
    std::cerr << " [LASGlobalLoop::TECLoop] ** ERROR: Endcap loop running on TIB/TOB (subdetector > 1)" << std::endl;
    throw 1;
  }

  ++disk;

  if (disk == 9) {
    ++beam;
    disk = 0;

    if (beam == 8) {
      ++ring;
      beam = 0;

      if (ring == 2) {
        ++subdet;
        ring = 0;

        if (subdet == 2)
          return false;
      }
    }
  }

  return true;
}

///
/// full TIB+TOB loop
/// with starting values given by parameter values
///
bool LASGlobalLoop::TIBTOBLoop(int& subdet, int& beam, int& position) const {
  if (subdet < 2) {
    std::cerr << " [LASGlobalLoop::TIBTOBLoop] ** ERROR: Barrel loop running on TEC (subdetector < 2)" << std::endl;
    throw 1;
  }

  ++position;

  if (position == 6) {
    ++beam;
    position = 0;

    if (beam == 8) {
      ++subdet;
      beam = 0;

      if (subdet == 4)
        return false;
    }
  }

  return true;
}

///
/// full TEC AT loop
/// with starting values given by parameter values
///
bool LASGlobalLoop::TEC2TECLoop(int& subdet, int& beam, int& disk) const {
  if (subdet > 1) {
    std::cerr << " [LASGlobalLoop::TEC2TECLoop] ** ERROR: TEC loop running on TIB/TOB (subdetector > 1)" << std::endl;
    throw 1;
  }

  ++disk;

  if (disk == 5) {
    ++beam;
    disk = 0;

    if (beam == 8) {
      ++subdet;
      beam = 0;

      if (subdet == 2)
        return false;
    }
  }

  return true;
}