#include <Detector.hh>
Collaboration diagram for Detector:
Public Member Functions | |
Detector () | |
~Detector () | |
std::ostream & | operator<< (std::ostream &out) const |
bool | addChamber (Chamber *aChamber) |
ChamberMap_t | getChambers (void) const |
Chamber & | getChamberById (const i32 id) const |
i64 | getNumberOfChambers (void) const |
Dif & | getDifById (const i32 _id) const |
unsigned int | getNumberOfGaziplex96 () const |
int | build (const SteerDesc &sd) |
void | setDescription (std::string aDesc) |
std::string | getDescription (void) const |
void | setName (std::string aName) |
std::string | getName (void) const |
ui16 | getMonitoringId (void) const |
Private Attributes | |
std::string | name |
std::string | description |
ChamberMap_t | chambers |
ui16 | monDev |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Detector &x) |
Definition at line 23 of file Detector.hh.
Detector::Detector | ( | ) |
Definition at line 42 of file Detector.cpp.
00043 :monDev(0) 00044 { 00045 //FILE_LOG(logDEBUG) << "-----Detector constructor" << endl; 00046 }
Detector::~Detector | ( | ) |
Definition at line 49 of file Detector.cpp.
00050 { 00051 //FILE_LOG(logDEBUG)<< "----Detector destructor" << endl; 00052 for (ChamberMap_t::const_iterator it = chambers.begin(); it != chambers.end(); ++it) { 00053 delete (it->second); 00054 } 00055 00056 }
std::ostream & Detector::operator<< | ( | std::ostream & | out | ) | const |
Definition at line 59 of file Detector.cpp.
00059 { 00060 out << description << endl ; 00061 for (ChamberMap_t::const_iterator it = chambers.begin(); it != chambers.end(); ++it) { 00062 out << *(it->second); 00063 } 00064 return(out); 00065 }
bool Detector::addChamber | ( | Chamber * | aChamber | ) |
Definition at line 68 of file Detector.cpp.
Referenced by build().
00069 { 00070 if (!aChamber) 00071 return false; 00072 00073 chambers.insert(make_pair(aChamber->getId(), aChamber)); 00074 return true; 00075 }
ChamberMap_t Detector::getChambers | ( | void | ) | const [inline] |
Definition at line 34 of file Detector.hh.
Referenced by MicrorocXDaqReader::getAcqData(), MicrorocLabviewReader::getAcqData(), Hardroc2XdaqReader::getAcqData(), Hardroc2LabviewReader::getAcqData(), Hardroc1Reader::getAcqData(), getDifById(), TestMicrorocParser::getNextEvent(), DiracLabview::getNextEvent(), Centaure::getNextEvent(), CalibMicrorocParser::getNextEvent(), CalibHR2Parser::getNextEvent(), CalibHR1Parser::getNextEvent(), Event::initChannelHitVector(), main(), MicrorocReader::newHit(), Hardroc2Reader::newHit(), Hardroc1Reader::newHit(), DiracReader::newHit(), CalibMicrorocParser::newHit(), CalibHR2Parser::newHit(), CalibHR1Parser::newHit(), MTEvent::operator=(), and MTDetector::operator=().
00034 { return chambers; };
Chamber & Detector::getChamberById | ( | const i32 | id | ) | const |
Definition at line 78 of file Detector.cpp.
Referenced by BeamProfile::DrawChip2D(), BeamProfile::FillHitPerChannel(), BeamProfile::FillHitPerChipDist(), BeamProfile::FillXyDist(), and main().
00079 { 00080 ChamberMap_t::const_iterator result = chambers.find(_id); 00081 if (result != chambers.end()) 00082 { 00083 return *(result->second); 00084 } 00085 throw MicroException("No Chamber correspond for this detector and this id."); 00086 }
i64 Detector::getNumberOfChambers | ( | void | ) | const [inline] |
Dif & Detector::getDifById | ( | const i32 | _id | ) | const |
Definition at line 89 of file Detector.cpp.
Referenced by BeamProfile::DrawChannel2D(), MicrorocXDaqReader::getAcqData(), MicrorocLabviewReader::getAnalogData(), DiracReader::getConfigData(), DiracLabview::getNextEvent(), MicrorocLabviewReader::getScData(), Hardroc2LabviewReader::getScData(), Hardroc1Reader::getScData(), DifSynchroReader::getScData(), main(), MicrorocSCReader::parseSC(), MicrorocSCReader::parseSCFromDb(), and DiracReader::storeDifInfo().
00090 { 00091 const ChamberMap_t &chambers = getChambers(); 00092 for (ChamberMap_t::const_iterator it = chambers.begin(); it != chambers.end(); ++it) { 00093 Chamber& chamber = *(it->second); 00094 DifMap_t difs = chamber.getDifs(); 00095 DifMap_t::iterator difIt = difs.find(_id); 00096 if (difIt != difs.end()) 00097 return(*difIt->second); 00098 } 00099 throw MicroException("No Dif correspond for this detector and this id."); 00100 }
unsigned int Detector::getNumberOfGaziplex96 | ( | ) | const |
Definition at line 103 of file Detector.cpp.
Referenced by Centaure::getNextEvent().
00104 { 00105 unsigned int result = 0; 00106 00107 ChamberMap_t::const_iterator iter = chambers.begin(); 00108 00109 for ( iter = chambers.begin(); iter != chambers.end() ; iter++ ) 00110 { 00111 //cout << "chamber[" << iter->second->getId() << "]nbGassiplex[" << iter->second->getNumberOfBoards() << "]" << endl; 00112 // only count GassiplexBoards 00113 /* 00114 if ( iter->second->getType().compare(GASSIPLEXCHAMBER4)==0 00115 || iter->second->getType().compare(GASSIPLEXCHAMBER1)==0 00116 || iter->second->getType().compare(GASSIPLEXSTRIPCHAMBER1)==0) 00117 */ 00118 if ( iter->second->getType().find("GASSIPLEX") != string::npos ) 00119 { 00120 result = result + iter->second->getNumberOfBoards(); 00121 } 00122 } 00123 return result; 00124 }
int Detector::build | ( | const SteerDesc & | sd | ) |
Definition at line 127 of file Detector.cpp.
Referenced by main().
00127 { 00128 00129 00130 int nbChamber = 0; 00131 00132 monDev = sd.monitoringDif; 00133 00134 for (int index = 0 ; index < sd.chambers.size(); index++) 00135 { 00136 int brow = 0; 00137 const chamber_info_t& chamberInfo = sd.chambers[index]; 00138 00139 00140 // default unit is micrometer 00141 ui32 unit = 1; 00142 if ( chamberInfo.unit.compare("m")==0 ) { unit = 1000000 ;} // 1 m = 1 000 000 um 00143 else if ( chamberInfo.unit.compare("dm")==0 ) { unit = 100000 ;} // 1 dm = 100 000 um 00144 else if ( chamberInfo.unit.compare("cm")==0 ) { unit = 10000 ;} // 1 cm = 10 000 um 00145 else if ( chamberInfo.unit.compare("mm")==0 ) { unit = 1000 ;} // 1 mm = 1000 um 00146 else if ( chamberInfo.unit.compare("um")==0 ) { unit = 1 ;} 00147 00148 float xPos = chamberInfo.xPos * unit; 00149 float yPos = chamberInfo.yPos * unit; 00150 float zPos = chamberInfo.zPos * unit; 00151 bool xRotation = chamberInfo.xRotation; 00152 bool yRotation = chamberInfo.yRotation; 00153 i16 zRotation = chamberInfo.zRotation; 00154 bool stripHorizontal = chamberInfo.stripHorizontal; 00155 00156 //Get dif for this chamber 00157 std::vector<DifInfo_t>difs; // Steer desc infos: Chamber Id and Id 00158 std::vector<BoardInfo_t>boards; // Steer desc infos: Chamber Id dif Id and id 00159 std::vector<ChipInfo_t>chips; // Steer desc infos: Chamber Id dif Id Board Id and id 00160 00161 // fill Dif, Boards and chip for current chamber 00162 sd.fillDifByChamberId(difs,chamberInfo.id); 00163 sd.fillBoardByChamberId(boards,chamberInfo.id); 00164 sd.fillChipByChamberId(chips,chamberInfo.id); 00165 00166 FILE_LOG(logDEBUG1)<< "Detector.build : chamber " << chamberInfo.id << " ,chamberInfo.xPos: " << xPos 00167 << "um ,chamberInfo.yPos: " << yPos 00168 << "um ,chamberInfo.zPos: " << zPos 00169 << "um ,chamberInfo.stripHorizontal: " << chamberInfo.stripHorizontal << endl; 00170 if ( !chamberInfo.type.compare(GASSIPLEXCHAMBER1)) 00171 { 00172 GassiplexChamber1 *chamber = new GassiplexChamber1(xPos, yPos, zPos, xRotation, yRotation, zRotation, 1, 1, chamberInfo.id); 00173 if ( chamber->isValid()) { 00174 addChamber(chamber); 00175 nbChamber++; 00176 } 00177 } 00178 00179 else if ( !chamberInfo.type.compare(GASSIPLEXCHAMBER4)) 00180 { 00181 GassiplexChamber4 *chamber = new GassiplexChamber4(xPos, yPos, zPos, xRotation,yRotation, zRotation,2, 2, chamberInfo.id); 00182 if ( chamber->isValid()) { 00183 addChamber(chamber); 00184 nbChamber++; 00185 } 00186 00187 } 00188 00189 else if ( !chamberInfo.type.compare(GASSIPLEXSTRIPCHAMBER1)) 00190 { 00191 GassiplexStripChamber1 *chamber = new GassiplexStripChamber1(xPos, yPos, zPos, xRotation,yRotation, zRotation,1, 1, chamberInfo.id,chamberInfo.stripHorizontal); 00192 if ( chamber->isValid()) { 00193 addChamber(chamber); 00194 nbChamber++; 00195 } 00196 00197 } 00198 00199 00200 else if ( !chamberInfo.type.compare(HARDROC1CHAMBER)) 00201 /* 00202 ASU Test Beam 2009 et calibration: 1 Chambre (Hardroc1Chamber) composee de 1 PCB ( Hardroc1Board) 00203 composee de 4 Chip HR1 (Hardroc1Chip ) composee de 64 Channel ( Hardroc1Channel ) 00204 */ 00205 { 00206 Hardroc1Chamber *chamber = new Hardroc1Chamber(xPos, yPos, zPos, xRotation,yRotation, zRotation, chamberInfo.id,difs,boards,chips); 00207 if ( chamber->isValid()) { 00208 addChamber(chamber); 00209 nbChamber++; 00210 } 00211 } 00212 00213 /* 00214 * ASU "Calibration 2009" : 1 Chambre ( Hardroc2Chamber1 ) composee de 1 PCB ( Hardroc2Board24 ) 00215 * composee de 24 Chip HR2 ( * Hardroc2Chip ) composee de 64 Channel ( Hardroc2Channel ) 00216 */ 00217 else if ( !chamberInfo.type.compare(HARDROC2CHAMBER1)) 00218 { 00219 Hardroc2Chamber1 *chamber = new Hardroc2Chamber1(xPos, yPos, zPos, xRotation,yRotation, zRotation, chamberInfo.id,difs,boards,chips); 00220 if ( chamber->isValid()) { 00221 addChamber(chamber); 00222 nbChamber++; 00223 } 00224 } 00225 /* 00226 * ASU : 1 Chambre ( Hardroc2Chamber2 ) composee de 2 PCB ( Hardroc2Board24 ) 00227 * composee de 24 Chip HR2 ( * Hardroc2Chip ) composee de 64 Channel ( Hardroc2Channel ) 00228 */ 00229 00230 /* 00231 * ASU : 1 Chambre ( Hardroc2Chamber6 ) composee de 6 PCB ( Hardroc2Board24 ) 00232 * composee de 24 Chip HR2 ( * Hardroc2Chip ) composee de 64 Channel ( Hardroc2Channel ) 00233 */ 00234 else if ( !chamberInfo.type.compare(HARDROC2CHAMBER2)) 00235 { 00236 Hardroc2Chamber2 *chamber = new Hardroc2Chamber2(xPos, yPos, zPos, xRotation,yRotation, zRotation, chamberInfo.id,difs,boards,chips); 00237 if ( chamber->isValid()) { 00238 addChamber(chamber); 00239 nbChamber++; 00240 } 00241 } 00242 00243 /* 00244 * 1 Chambre ( Hardroc2Chamber6 ) composee de 6 PCB ( Hardroc2Board24 ) 00245 * composee de 24 Chip HR2 ( * Hardroc2Chip ) composee de 64 Channel ( Hardroc2Channel ) 00246 */ 00247 else if ( !chamberInfo.type.compare(HARDROC2CHAMBER6)) 00248 { 00249 Hardroc2Chamber6 *chamber = new Hardroc2Chamber6(xPos, yPos, zPos, xRotation,yRotation, zRotation, chamberInfo.id,difs,boards,chips); 00250 if ( chamber->isValid()) { 00251 addChamber(chamber); 00252 nbChamber++; 00253 } 00254 } 00255 00256 /* 00257 * ASU "IPNL " : 1 Chambre ( Hardroc2Chamber1 ) composee de 1 PCB ( Hardroc2Board24 ) 00258 * composee de 24 Chip HR2 IPNL ( * Hardroc2IPNLChip ) composee de 64 Channel ( Hardroc2Channel ) 00259 */ 00260 else if ( !chamberInfo.type.compare(HARDROC2IPNLCHAMBER6)) 00261 { 00262 Hardroc2IPNLChamber6 *chamber = new Hardroc2IPNLChamber6(xPos, yPos, zPos, xRotation,yRotation, zRotation, chamberInfo.id,difs,boards,chips); 00263 if ( chamber->isValid()) { 00264 addChamber(chamber); 00265 nbChamber++; 00266 } 00267 } 00268 00269 /* 00270 // Mettre Carre HR@ pour test beam june 2010 00271 * composee de 5 ASU de 24 Chip HR2 ( * Hardroc2Chip ) composee de 64 Channel ( Hardroc2Channel ) 00272 */ 00273 else if ( !chamberInfo.type.compare(METRECARRECHAMBER)) 00274 { 00275 MetreCarreChamber *chamber = new MetreCarreChamber(xPos, yPos, zPos, xRotation,yRotation, zRotation, chamberInfo.id,difs,boards,chips); 00276 if ( chamber->isValid()) { 00277 addChamber(chamber); 00278 nbChamber++; 00279 } 00280 } 00281 00282 00283 /* 00284 // Calibration MICROROC@ pour test beam 2011 00285 * composee de 1 ASU de 24 Chip Microroc ( * MicrorocChip ) composee de 64 Channel ( MicrorocChannel ) 00286 */ 00287 else if ( !chamberInfo.type.compare(MICROROCCHAMBER1)) 00288 { 00289 MicrorocChamber1 *chamber = new MicrorocChamber1(xPos, yPos, zPos, xRotation,yRotation, zRotation, chamberInfo.id,difs,boards,chips); 00290 if ( chamber->isValid()) { 00291 addChamber(chamber); 00292 nbChamber++; 00293 } 00294 } 00295 /* 00296 // Mettre Carre MICROROC@ pour test beam 2011 00297 * composee de 6 ASU de 24 Chip Microroc ( * MicrorocChip ) composee de 64 Channel ( MicrorocChannel ) 00298 */ 00299 else if ( !chamberInfo.type.compare(MICROROCCHAMBER6)) 00300 { 00301 MicrorocChamber6 *chamber = new MicrorocChamber6(xPos, yPos, zPos, xRotation,yRotation, zRotation, chamberInfo.id,difs,boards,chips); 00302 if ( chamber->isValid()) { 00303 addChamber(chamber); 00304 nbChamber++; 00305 } 00306 } 00307 00308 /* 00309 // Carte de test MICROROC 00310 * composee de 1 ASU de 14 Chip Microroc ( * MicrorocChip ) composee de 64 Channel ( MicrorocChannel ) 00311 */ 00312 else if ( !chamberInfo.type.compare(MICROROCTESTCHAMBER)) 00313 { 00314 MicrorocTestChamber *chamber = new MicrorocTestChamber(xPos, yPos, zPos, xRotation,yRotation, zRotation, chamberInfo.id,difs,boards,chips); 00315 if ( chamber->isValid()) { 00316 addChamber(chamber); 00317 nbChamber++; 00318 } 00319 } 00320 else if ( !chamberInfo.type.compare(DIRACCHAMBER1)) 00321 { 00322 DiracChamber1 *chamber = new DiracChamber1(xPos, yPos, zPos, xRotation,yRotation, zRotation, chamberInfo.id,difs,boards,chips); 00323 if ( chamber->isValid()) { 00324 addChamber(chamber); 00325 nbChamber++; 00326 } 00327 } // endif DIRAC1 00328 } 00329 00330 //FILE_LOG(logDEBUG) << *this; 00331 return nbChamber; 00332 } // Detector.build
void Detector::setDescription | ( | std::string | aDesc | ) | [inline] |
Definition at line 42 of file Detector.hh.
Referenced by SteerDesc::setRun().
00042 { description = aDesc; };
std::string Detector::getDescription | ( | void | ) | const [inline] |
Definition at line 43 of file Detector.hh.
Referenced by MTDetector::operator=().
00043 { return description; };
void Detector::setName | ( | std::string | aName | ) | [inline] |
Definition at line 45 of file Detector.hh.
Referenced by SteerDesc::setRun().
00045 { name = aName; };
std::string Detector::getName | ( | void | ) | const [inline] |
Definition at line 46 of file Detector.hh.
Referenced by MTDetector::operator=().
00046 { return name; };
ui16 Detector::getMonitoringId | ( | void | ) | const [inline] |
Definition at line 50 of file Detector.hh.
Referenced by MicrorocXDaqReader::getAcqData(), and MicrorocReader::newHit().
00050 { return monDev; } ;
std::ostream& operator<< | ( | std::ostream & | out, | |
const Detector & | x | |||
) | [friend] |
std::string Detector::name [private] |
std::string Detector::description [private] |
Definition at line 56 of file Detector.hh.
Referenced by getDescription(), operator<<(), and setDescription().
ChamberMap_t Detector::chambers [private] |
Definition at line 58 of file Detector.hh.
Referenced by addChamber(), getChamberById(), getChambers(), getDifById(), getNumberOfChambers(), getNumberOfGaziplex96(), operator<<(), and ~Detector().
ui16 Detector::monDev [private] |