/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/src/geometry/DiracChamber1.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/DiracChamber1.hh"
00008 
00009 #include "geometry/DiracBoard.hh"
00010 #include "geometry/DiracChip.hh"
00011 #include "geometry/Dif.hh"
00012 #include <iostream>
00013 #include <vector>
00014 #include "tools/Log.hh"
00015 #include "tools/SteerDesc.hh"
00016 
00017 using namespace std;
00018 //--------------- Constructor -------------//
00019 DiracChamber1::DiracChamber1(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 
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 << "] :DiracChamber1 must be composed of:\n"
00031             "-[1] dif." << endl <<
00032             "-[1] board." << endl <<
00033             "-[1] chips." << endl << endl <<
00034             "-> And chamber your XML file is composed of:" << endl <<
00035             "[" <<  difInfos.size()   << "] dif" << endl <<
00036             "[" <<  boardInfos.size() << "] board" << endl <<
00037             "[" <<  chipInfos.size()  << "] chips" << endl;
00038        myIsValid = false;
00039   }
00040   else {
00041     FILE_LOG(logDEBUG1) << "---DiracChamber1 constructor id " << id << endl;
00042      description = "DiracChamber1";
00043     // type = DIRACCHAMBER;
00044      init(id, difInfos,  boardInfos,  chipInfos);
00045      myIsValid = true;
00046   }
00047 
00048 }; // DiracChamber1
00049 
00050 //--------------- Destructor -------------//
00051 DiracChamber1::~DiracChamber1()
00052 {
00053   //FILE_LOG(logDEBUG) << "---DiracChamber1 destructor"<< endl;
00054 }; // ~DiracChamber1
00055 
00056 
00057 //--------------- Destructor -------------//
00058 void DiracChamber1::init(i32 id, const std::vector<DifInfo_t>&   difInfos,
00059                                    const std::vector<BoardInfo_t>& boardInfos,
00060                                    const std::vector<ChipInfo_t>&  chipInfos)
00061 {
00062 
00063 
00064       FILE_LOG(logDEBUG1)<< " add chamber[" << id << "]" <<  endl;
00065       for (int difNum = 0 ; difNum < difInfos.size(); difNum++)
00066       {
00067           const DifInfo_t& difInfo = difInfos[difNum];
00068 
00069           if (difInfo.chamberId != this->getId() )
00070           {
00071               continue;
00072           }
00073 
00074           Dif *dif = new Dif(difInfo.id);
00075           this->addDif(dif);
00076 
00077           for (int boardNum = 0 ; boardNum < boardInfos.size(); boardNum++) {
00078               const BoardInfo_t& boardInfo = boardInfos[boardNum];
00079               if (boardInfo.difId != dif->getId() || boardInfo.chamberId != this->getId())
00080               {
00081                   continue;
00082               }
00083               DiracBoard *board = new DiracBoard(*this, 0,  0, 1, 1, boardInfo.id);
00084               dif->addBoard(board);
00085               this->addBoard(board);
00086 
00087 
00088 
00089               for (int chipNum = 0, crow = 0 ; chipNum < chipInfos.size(); chipNum++) {
00090                   const ChipInfo_t& chipInfo = chipInfos[chipNum];
00091                   if ((chipInfo.boardId != boardInfo.id)
00092                    || (chipInfo.difId != difInfo.id)
00093                    || (chipInfo.chamberId != id))
00094                     continue;
00095                   FILE_LOG(logDEBUG1)<< "      Detector.build : chip " << chipInfo.id << ", board " << chipInfo.boardId << endl;
00096                   int crow = chipNum % 4;
00097                   DiracChip *chip = new DiracChip(*board, 0, crow, 8, 8, chipInfo.id,chipInfo.serial);
00098                   board->addChip(chip);
00099               }
00100               FILE_LOG(logDEBUG1)<< "  Detector.build : dif " << difInfo.id << ", chamber " << difInfo.chamberId << *this << endl;
00101           }
00102       }
00103 }
00104 /*
00105 //-------------------------------------------//
00106 const ui32  DiracChamber1::getXLength() const
00107 {
00108   const Board& board = *(boards.begin()->second);
00109   return this->nbColumns * ( board.getXLength() + this->getXGap() );
00110 }
00111 
00112 //-------------------------------------------//
00113 const ui32  DiracChamber1::getYLength() const
00114 {
00115   const Board& board = *(boards.begin()->second);
00116   return this->nbRows * ( board.getYLength() + this->getYGap() );
00117 }
00118 */

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