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
#include <cassert>
#include <iostream>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include <stdio.h>
#include <fstream>
#include <stdlib.h>
#include <string>
#include <sstream>
#include <vector>
#include <map>
using namespace std;

// simple test program
#include "../../interface/ME.h"
#include "../../interface/MEGeom.h"
#include "../../interface/MEChannel.h"

int main(int argc, char **argv)
{
  int ireg  = ME::iEBP;
  int isect = 5;
  int ichan = -1;
  int ieta  = -1;
  int iphi  = -1;

  int c;
  while ( (c = getopt( argc, argv, "r:s:c:e:p:" ) ) != EOF ) 
    {
      switch (c) 
	{
	case 'r': ireg     = atoi( optarg );    break;
	case 's': isect    = atoi( optarg );    break;
	case 'c': ichan    = atoi( optarg );    break;
	case 'e': ieta     = atoi( optarg );    break;
	case 'p': iphi     = atoi( optarg );    break;
	}
    }
// 1597         EB-5
// 1003         EB-6
// 421           EB-8
// 1239         EB-10
// 320           EB-16
// 1058         EB+10
// 1442         EB+16
// 682           EB+17

  if( ichan>=0 )
    {
      if( ireg==ME::iEBM ) isect+=18;
      if( ireg==ME::iEEM ) isect+=9;
      TString str_ = 
	ME::regTree( ireg )->getDescendant( ME::iSector, isect )
	->getDescendant( ME::iCrystal, ichan )->oneLine();
      cout << str_ << endl;
      return 0;
    }
  assert( iphi>0 );
  assert( ieta!=0 && std::abs(ieta)<=85 );
  if( ieta>0 )      ireg=ME::iEBP;
  else if( ieta<0 ) ireg=ME::iEBM;
  vector< MEChannel* > vec;
  ME::regTree( ireg )->getListOfChannels( vec );
  for( unsigned int ii=0; ii<vec.size(); ii++ )
    {
      MEChannel* leaf_ = vec[ii];
      if( leaf_->ix()!=ieta ) continue;
      if( leaf_->iy()!=iphi ) continue;
      cout << leaf_->oneLine() << endl;
      return(0);
    }

  return(0);
}