Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:46:54

0001 #include <cassert>
0002 #include <iostream>
0003 #include <math.h>
0004 #include <time.h>
0005 #include <unistd.h>
0006 #include <stdio.h>
0007 #include <fstream>
0008 #include <stdlib.h>
0009 #include <string>
0010 #include <sstream>
0011 #include <vector>
0012 #include <map>
0013 using namespace std;
0014 
0015 // simple test program

0016 #include "../../interface/ME.h"
0017 #include "../../interface/MEGeom.h"
0018 #include "../../interface/MEChannel.h"
0019 
0020 int main(int argc, char **argv)
0021 {
0022   int ireg  = ME::iEBP;
0023   int isect = 5;
0024   int ichan = -1;
0025   int ieta  = -1;
0026   int iphi  = -1;
0027 
0028   int c;
0029   while ( (c = getopt( argc, argv, "r:s:c:e:p:" ) ) != EOF ) 
0030     {
0031       switch (c) 
0032     {
0033     case 'r': ireg     = atoi( optarg );    break;
0034     case 's': isect    = atoi( optarg );    break;
0035     case 'c': ichan    = atoi( optarg );    break;
0036     case 'e': ieta     = atoi( optarg );    break;
0037     case 'p': iphi     = atoi( optarg );    break;
0038     }
0039     }
0040 // 1597         EB-5

0041 // 1003         EB-6

0042 // 421           EB-8

0043 // 1239         EB-10

0044 // 320           EB-16

0045 // 1058         EB+10

0046 // 1442         EB+16

0047 // 682           EB+17

0048 
0049   if( ichan>=0 )
0050     {
0051       if( ireg==ME::iEBM ) isect+=18;
0052       if( ireg==ME::iEEM ) isect+=9;
0053       TString str_ = 
0054     ME::regTree( ireg )->getDescendant( ME::iSector, isect )
0055     ->getDescendant( ME::iCrystal, ichan )->oneLine();
0056       cout << str_ << endl;
0057       return 0;
0058     }
0059   assert( iphi>0 );
0060   assert( ieta!=0 && std::abs(ieta)<=85 );
0061   if( ieta>0 )      ireg=ME::iEBP;
0062   else if( ieta<0 ) ireg=ME::iEBM;
0063   vector< MEChannel* > vec;
0064   ME::regTree( ireg )->getListOfChannels( vec );
0065   for( unsigned int ii=0; ii<vec.size(); ii++ )
0066     {
0067       MEChannel* leaf_ = vec[ii];
0068       if( leaf_->ix()!=ieta ) continue;
0069       if( leaf_->iy()!=iphi ) continue;
0070       cout << leaf_->oneLine() << endl;
0071       return(0);
0072     }
0073 
0074   return(0);
0075 }