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

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