296 for (
string key, buffer; in >>
key; ) {
300 OMaddress.push_back(
OM(in));
302 else if (
key ==
"OM_cluster:")
306 else if (
key ==
"OM_position:")
310 else if (
key ==
"string:")
312 DetectorString.push_back(
String(in));
314 else if (
key ==
"OM_cluster_data:")
318 else if (
key ==
"LCM_logic:")
332 for (vector<LCM_logic>::const_iterator i = LCMlogic.begin(); i != LCMlogic.end(); ++i) {
334 const int lcm_id = i->getID();
336 for (LCM_logic::const_iterator j = i->begin(); j != i->end(); ++j) {
339 const int pmt_id =
distance(i->begin(),j) + 1;
348 sort(OMaddress .begin(), OMaddress .end());
349 sort(OMcluster .begin(), OMcluster .end());
350 sort(OMposition .begin(), OMposition .end());
351 sort(DetectorString .begin(), DetectorString .end());
352 sort(LCMreverselogic.begin(), LCMreverselogic.end());
360 vector<OM_cluster_data>::const_iterator OMclusterdataIterator;
363 for (OMclusterIterator = OMcluster.begin();
364 OMclusterIterator != OMcluster.end();
365 OMclusterIterator++) {
367 StringIterator =
find(DetectorString.begin(),
368 DetectorString.end(),
369 OMclusterIterator->string_id);
371 if (StringIterator != DetectorString.end()) {
373 const JLocation location(StringIterator->getID(), -1);
375 for (addressIterator = OMclusterIterator->begin();
376 addressIterator != OMclusterIterator->end();
379 OMIterator =
find(OMaddress.begin(),
383 if (OMIterator != OMaddress.end()) {
385 OMpositionIterator =
find(OMposition.begin(),
387 OMIterator->address);
389 if (OMpositionIterator != OMposition.end()) {
393 double ct = cos(StringIterator->twist * PI / 180.0);
394 double st = sin(StringIterator->twist * PI / 180.0);
396 double x = ct * OMpositionIterator->x - st * OMpositionIterator->y;
397 double y = st * OMpositionIterator->x + ct * OMpositionIterator->y;
400 StringIterator->y + y,
401 StringIterator->z + OMpositionIterator->z + OMclusterIterator->z);
404 StringIterator->twist * PI / 180.0 + OMpositionIterator->phi));
406 int lcm_id = OMclusterIterator->getID();
407 int pmt_id = OMIterator->address;
411 vector<LCM_reverse_logic>::const_iterator p =
find(LCMreverselogic.begin(),
412 LCMreverselogic.end(),
413 OMIterator->getID());
415 if (p != LCMreverselogic.end()) {
421 detector.
put(lcm_id, pmt_id - 1, location,
JPMT(OMIterator->getID(),
JAxis3D(pos, dir)));
431 for (OMclusterdataIterator = OMclusterdata.begin();
432 OMclusterdataIterator != OMclusterdata.end();
433 OMclusterdataIterator++) {
436 OMclusterdataIterator->y,
437 OMclusterdataIterator->z);
440 OMclusterdataIterator->phi,
441 OMclusterdataIterator->psi));
443 OMclusterIterator =
find(OMcluster.begin(),
445 OMclusterdataIterator->getID());
447 if (OMclusterIterator != OMcluster.end()) {
449 const JLocation location(OMclusterIterator->string_id, -1);
451 for (addressIterator = OMclusterIterator->begin();
452 addressIterator != OMclusterIterator->end();
455 OMIterator =
find(OMaddress.begin(),
459 if (OMIterator != OMaddress.end()) {
461 OMpositionIterator =
find(OMposition.begin(),
463 OMIterator->address);
465 if (OMpositionIterator != OMposition.end()) {
468 OMpositionIterator->y,
469 OMpositionIterator->z);
472 OMpositionIterator->phi));
479 int lcm_id = OMclusterIterator->getID();
480 int pmt_id = OMIterator->address;
484 vector<LCM_reverse_logic>::const_iterator p =
find(LCMreverselogic.begin(),
485 LCMreverselogic.end(),
486 OMIterator->getID());
488 if (p != LCMreverselogic.end()) {
494 detector.
put(lcm_id, pmt_id - 1, location,
JPMT(OMIterator->getID(),
JAxis3D(pos, dir)));
508 for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
510 if (module->getString() !=
string) {
511 string =
module->getString();
515 module->setLocation(JLocation(string,++floor));