/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/src/geometry/Hardroc2Chamber1.cpp

Go to the documentation of this file.
00001 /* @version $Revision: 1393 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2011-12-16 00:10:36 +0100 (Fri, 16 Dec 2011) $ */
00002 
00003 
00004 // 2 x 3 boards * 6 x 4 chips * 8 x 8 channels
00005 
00006 
00007 #include "geometry/Hardroc2Chamber1.hh"
00008 #include "geometry/Hardroc2Board.hh"
00009 #include "geometry/Hardroc2Chip.hh"
00010 #include "geometry/Dif.hh"
00011 
00012 #include "tools/Log.hh"
00013 
00014 #include <iostream>
00015 
00016 using namespace std;
00017 
00018 //--------------- Constructor -------------//
00019 Hardroc2Chamber1::Hardroc2Chamber1(const float aX, const float aY, const float aZ, const bool   xRotation,const bool yRotation,const i16 zRotation, const i32 id,
00020                                  const std::vector<DifInfo_t>& difInfos,
00021                                  const std::vector<BoardInfo_t>& boardInfos,
00022                                  const std::vector<ChipInfo_t>& chipInfos)
00023 : Chamber(aX, aY , aZ ,  xRotation,yRotation, zRotation,  1, 1 , id)
00024 {
00025   FILE_LOG(logDEBUG1) << "---Hardroc2Chamber1 constructor id " << id << endl;
00026 
00027 
00028 
00029   if ( difInfos.size() != 1 |
00030       boardInfos.size() != 1 |
00031       chipInfos.size()  != 24)
00032    {
00033        FILE_LOG(logERROR)<< endl << "XML geometry error for chamber id[" << id << "] :Hardroc2Chamber1 must be composed of:\n"
00034             "-[1] dif." << endl <<
00035             "-[1] board." << endl <<
00036             "-[24] chips." << endl << endl <<
00037             "-> And in  your XML file:" << endl <<
00038             "[" <<  difInfos.size() << "]   dif" << endl <<
00039             "[" <<  boardInfos.size() << "] board" << endl <<
00040             "[" <<  chipInfos.size() << "]  chips" << endl;
00041        myIsValid = false;
00042    }
00043   else
00044   {
00045     description = "Hardroc2Chamber1";
00046      type = HARDROC2CHAMBER1;
00047      init(id, difInfos,  boardInfos,  chipInfos);
00048      myIsValid = true;
00049   }
00050 }
00051 
00052 
00053 //--------------- Destructor -------------//
00054 Hardroc2Chamber1::~Hardroc2Chamber1()
00055 {
00056   //FILE_LOG(logDEBUG) << "---Hardroc2Chamber1 destructor"<< endl;
00057 }; // ~Hardroc2Chamber1
00058 
00059 
00060 /*
00061 //-------------------------------------------//
00062 const ui32  Hardroc2Chamber1::getXLength() const
00063 {
00064   const Board& board = *(boards.begin()->second);
00065   return this->nbColumns * ( board.getXLength() + this->getXGap() );
00066 }
00067 
00068 //-------------------------------------------//
00069 const ui32  Hardroc2Chamber1::getYLength() const
00070 {
00071   const Board& board = *(boards.begin()->second);
00072   return this->nbRows * ( board.getYLength() + this->getYGap() );
00073 }
00074  */
00075 
00076 //------------------------------------------//
00077 void Hardroc2Chamber1::init(i32 id, const std::vector<DifInfo_t>&   difInfos,
00078                                    const std::vector<BoardInfo_t>& boardInfos,
00079                                    const std::vector<ChipInfo_t>&  chipInfos)
00080 {
00081 // Verify XML geometry
00082 int bcol = 0;
00083 int brow = 0;
00084 int index = 0;
00085 
00086 for (int difNum = 0 ; difNum < difInfos.size(); difNum++)
00087 {
00088    const DifInfo_t& difInfo =  difInfos.at(difNum);
00089 
00090    Dif *dif = new Dif(difInfo.id);
00091 
00092    for (int boardNum = 0 ; boardNum < boardInfos.size(); boardNum++)
00093    {
00094        const BoardInfo_t& boardInfo = boardInfos.at(boardNum);
00095        if (boardInfo.difId != dif->getId() )
00096        {
00097            continue;
00098        }
00099 
00100         Hardroc2Board *board = new Hardroc2Board(*this,0 , 0 , 6, 4, boardInfo.id);
00101 
00102         this->addDif(dif);
00103         dif->addBoard(board);
00104         this->addBoard(board);
00105 
00106         int ccol = 0;
00107         int crow = 0;
00108         for (int chipNum = 0; chipNum < chipInfos.size(); chipNum++)
00109         {
00110             const ChipInfo_t& chipInfo = chipInfos.at(chipNum);
00111             if ((chipInfo.boardId != boardInfo.id)
00112                  || (chipInfo.difId != difInfo.id))
00113             {
00114               continue;
00115             }
00116             FILE_LOG(logDEBUG1)<< "      Detector.build : chip " << chipInfo.id << ", board " << chipInfo.boardId << endl;
00117             ccol=  chipNum%6 ;
00118 
00119 
00120             Hardroc2Chip *chip = new Hardroc2Chip(*board, ccol, crow, chipInfo.id,chipInfo.serial);
00121             board->addChip(chip);
00122 
00123             if (ccol == 5) { ++crow; }
00124         }
00125         FILE_LOG(logDEBUG1)<< "  Detector.build : dif " << difInfo.id << ", chamber " << difInfo.chamberId << *this << endl;
00126         if ( brow >= 1) { bcol++ ; }
00127      }
00128 }
00129 }
00130 

Generated on Mon Jan 7 13:15:22 2013 for MicromegasFramework by  doxygen 1.4.7