REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
src/TRestDetectorReadout.cxx
1/*************************************************************************
2 * This file is part of the REST software framework. *
3 * *
4 * Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5 * For more information see http://gifna.unizar.es/trex *
6 * *
7 * REST is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * REST is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have a copy of the GNU General Public License along with *
18 * REST in $REST_PATH/LICENSE. *
19 * If not, see http://www.gnu.org/licenses/. *
20 * For the list of contributors see $REST_PATH/CREDITS. *
21 *************************************************************************/
22
266
267#include "TRestDetectorReadout.h"
268
269bool RESTREADOUT_DECODINGFILE_ERROR = false;
270
271ClassImp(TRestDetectorReadout);
276
291TRestDetectorReadout::TRestDetectorReadout(const char* configFilename) : TRestMetadata(configFilename) {
292 std::cout << "Loading readout. This might take few seconds" << std::endl;
293 Initialize();
294
296}
297
311TRestDetectorReadout::TRestDetectorReadout(const char* configFilename, std::string name)
312 : TRestMetadata(configFilename) {
313 std::cout << "Loading readout. This might take few seconds" << std::endl;
314 Initialize();
315
317}
318
323 SetSectionName(this->ClassName());
324 SetLibraryVersion(LIBRARY_VERSION);
325
326 fDecoding = false;
327
328 fNReadoutPlanes = 0;
329 fReadoutPlanes.clear();
330}
331
336
341
347 Int_t modules = 0;
348 for (int p = 0; p < GetNumberOfReadoutPlanes(); p++) modules += fReadoutPlanes[p].GetNumberOfModules();
349 return modules;
350}
351
357 Int_t channels = 0;
358 for (int p = 0; p < GetNumberOfReadoutPlanes(); p++)
359 for (size_t m = 0; m < fReadoutPlanes[p].GetNumberOfModules(); m++)
360 channels += fReadoutPlanes[p][m].GetNumberOfChannels();
361 return channels;
362}
363
368 for (unsigned int i = 0; i < fModuleDefinitions.size(); i++)
369 if (fModuleDefinitions[i].GetName() == name) return i;
370 return -1;
371}
372
377 for (int i = 0; i < this->GetNumberOfReadoutPlanes(); i++) {
378 if (fReadoutPlanes[i].GetID() == id) {
379 return &fReadoutPlanes[i];
380 }
381 }
382
383 return nullptr;
384}
385
392 for (int i = 0; i < this->GetNumberOfReadoutPlanes(); i++) {
394
395 for (size_t j = 0; j < plane.GetNumberOfModules(); j++) {
396 if (plane[j].GetModuleID() == id) {
397 return &plane[j];
398 }
399 }
400 }
401 return nullptr;
402}
403
408 int planeID = -1, moduleID = -1, channelID = -1;
409
410 GetPlaneModuleChannel(daqId, planeID, moduleID, channelID);
411 if (channelID >= 0) {
412 return &fReadoutPlanes[planeID][moduleID][channelID];
413 }
414
415 return nullptr;
416}
417
422 if (p < fNReadoutPlanes)
423 return &fReadoutPlanes[p];
424 else {
425 RESTWarning << "TRestDetectorReadout::GetReadoutPlane." << RESTendl;
426 RESTWarning << "Readout plane index exceeded." << RESTendl;
427 RESTWarning << "Index requested : " << p << RESTendl;
428 RESTWarning << "Number of readout planes defined : " << fNReadoutPlanes << RESTendl;
429 }
430
431 return nullptr;
432}
433
438 fReadoutPlanes.push_back(plane);
440}
441
447 fMappingNodes = StringToInteger(GetParameter("mappingNodes", "0"));
448
449 TiXmlElement* moduleDefinition = GetElement("readoutModule");
450 while (moduleDefinition != nullptr) {
452 std::cout << "------module-----------------" << std::endl;
453 std::cout << moduleDefinition << std::endl;
454 std::cout << "-----------------------------" << std::endl;
455 GetChar();
456 }
457
458 TRestDetectorReadoutModule module = *ParseModuleDefinition(moduleDefinition);
459 module.DoReadoutMapping(fMappingNodes);
460 fModuleDefinitions.push_back(module);
461 moduleDefinition = GetNextElement(moduleDefinition);
462 }
463
464 TiXmlElement* planeDefinition = GetElement("readoutPlane");
465 std::vector<TRestDetectorReadoutModule> moduleVector;
466 Int_t addedChannels = 0;
467 while (planeDefinition != nullptr) {
469
471 plane.SetPosition(Get3DVectorParameterWithUnits("position", planeDefinition));
472 plane.SetNormal(Get3DVectorParameterWithUnits("normal", planeDefinition));
473 plane.SetHeight(GetDblParameterWithUnits("height", planeDefinition));
474 plane.SetChargeCollection(StringToDouble(GetFieldValue("chargeCollection", planeDefinition)));
475 plane.SetRotation(GetDblParameterWithUnits("rotation", planeDefinition, 0));
476
477 moduleVector.clear();
478 TiXmlElement* moduleDefinition = GetElement("addReadoutModule", planeDefinition);
479 while (moduleDefinition != nullptr) {
480 TString modName = GetFieldValue("name", moduleDefinition);
481 Int_t mid = GetModuleDefinitionId(modName);
482
483 if (mid == -1) {
484 RESTError << "TRestDetectorReadout at <addReadoutModule>. Module name " << modName
485 << " not found!" << RESTendl;
486 RESTError << "Please, check spelling" << RESTendl;
487 exit(1);
488 }
489
490 fModuleDefinitions[mid].SetModuleID(StringToInteger(GetFieldValue("id", moduleDefinition)));
491 fModuleDefinitions[mid].SetOrigin(StringTo2DVector(GetFieldValue("origin", moduleDefinition)));
492 fModuleDefinitions[mid].SetRotation(GetDblParameterWithUnits("rotation", moduleDefinition));
493
494 Int_t firstDaqChannel = StringToInteger(GetFieldValue("firstDaqChannel", moduleDefinition));
495 if (firstDaqChannel == -1) firstDaqChannel = addedChannels;
496
497 std::string decodingFile = GetFieldValue("decodingFile", moduleDefinition);
498 if (decodingFile == "Not defined" || decodingFile.empty() || RESTREADOUT_DECODINGFILE_ERROR)
499 fDecoding = false;
500 else
501 fDecoding = true;
502
503 if (fDecoding && !TRestTools::fileExists(decodingFile)) {
504 RESTWarning << "The decoding file does not exist!" << RESTendl;
505 RESTWarning << "--------------------------------" << RESTendl;
506 RESTWarning << "File : " << decodingFile << RESTendl;
507 RESTWarning << "Default decoding will be used. readoutChannel=daqChannel" << RESTendl;
508 RESTWarning << "To avoid this message and use the default decoding define : "
509 "decodingFile=\"\""
510 << RESTendl;
511 RESTWarning << "--------------------------------" << RESTendl;
512 RESTWarning << "Press a KEY to continue..." << RESTendl;
513 getchar();
514 fDecoding = false;
515 RESTREADOUT_DECODINGFILE_ERROR = true;
516 }
517
518 std::vector<Int_t> rChannel;
519 std::vector<Int_t> dChannel;
520 if (fDecoding && TRestTools::fileExists(decodingFile)) {
521 FILE* f = fopen(decodingFile.c_str(), "r");
522
523 Int_t daq, readout;
524 while (!feof(f)) {
525 if (fscanf(f, "%d\t%d\n", &daq, &readout) <= 0) {
526 RESTError << "TRestDetectorReadout::InitFromConfigFile. Problem reading decoding"
527 << RESTendl;
528 RESTError << "This error might need support at REST forum" << RESTendl;
529 exit(-1);
530 }
531 // we skip blank daq channels if readout id is <0
532 // e.g. daq id: 22, readout id: -1
533 if (readout >= 0) {
534 rChannel.push_back(readout);
535 dChannel.push_back(daq + firstDaqChannel);
536 }
537 }
538 fclose(f);
539 }
540
542 std::cout << "------module-----------------" << std::endl;
543 std::cout << moduleDefinition << std::endl;
544 std::cout << "-----------------------------" << std::endl;
545 getchar();
546 }
547
548 if (fDecoding && (unsigned int)fModuleDefinitions[mid].GetNumberOfChannels() != rChannel.size()) {
549 RESTError << "TRestDetectorReadout."
550 << " The number of channels defined in the readout is not the same"
551 << " as the number of channels found in the decoding." << RESTendl;
552 exit(1);
553 }
554
555 for (size_t ch = 0; ch < fModuleDefinitions[mid].GetNumberOfChannels(); ch++) {
556 if (!fDecoding) {
557 Int_t id = ch;
558 rChannel.push_back(id);
559 dChannel.push_back(id + firstDaqChannel);
560 }
561
562 // WRONG version before -->
563 // fModuleDefinitions[mid].GetChannel(ch)->SetID( rChannel[ch] );
564 if (!fModuleDefinitions[mid].GetChannel(rChannel[ch])) {
565 RESTError << "Problem setting readout channel " << rChannel[ch]
566 << " with daq id: " << dChannel[ch] << RESTendl;
567 continue;
568 }
569 fModuleDefinitions[mid].GetChannel(rChannel[ch])->SetDaqID(dChannel[ch]);
570 fModuleDefinitions[mid].GetChannel(rChannel[ch])->SetChannelID(rChannel[ch]);
571
572 addedChannels++;
573 }
574 fModuleDefinitions[mid].SetMinMaxDaqIDs();
575
576 moduleVector.push_back(fModuleDefinitions[mid]);
577 // plane.AddModule( fModuleDefinitions[mid] );
578
579 moduleDefinition = GetNextElement(moduleDefinition);
580 }
581
582 // We removed the constraint that module id's should start by 0 and have no
583 // missing numbers in a multi-module readout plane. Modules can have their
584 // special "id", e.g. M0, M2, M3, M4 in SJTU proto. We don't have M1
585
586 for (auto& i : moduleVector) {
587 plane.AddModule(i);
588 }
589
590 this->AddReadoutPlane(plane);
591 planeDefinition = GetNextElement(planeDefinition);
592 }
593
595}
596
597TRestDetectorReadoutModule* TRestDetectorReadout::ParseModuleDefinition(TiXmlElement* moduleDefinition) {
598 auto mod = new TRestDetectorReadoutModule();
599 TRestDetectorReadoutModule& module = *mod;
600 if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Warning) module.EnableWarnings();
601
602 module.SetName(GetFieldValue("name", moduleDefinition));
603 module.SetSize(StringTo2DVector(GetFieldValue("size", moduleDefinition)));
604 module.SetTolerance(StringToDouble(GetFieldValue("tolerance", moduleDefinition)));
605 Double_t pixelTolerance = StringToDouble(GetFieldValue("pixelTolerance", moduleDefinition));
606 if (pixelTolerance == -1) pixelTolerance = 1.e-6;
607
608 std::vector<TRestDetectorReadoutChannel> channelVector;
609 std::vector<int> channelIDVector;
610 TiXmlElement* channelDefinition = GetElement("readoutChannel", moduleDefinition);
611 while (channelDefinition != nullptr) {
613
614 Int_t id = StringToInteger(GetFieldValue("id", channelDefinition));
615 if (id != -1) channelIDVector.push_back(id);
616 channel.SetDaqID(-1);
617
618 std::vector<TRestDetectorReadoutPixel> pixelVector;
619 std::vector<int> pixelIDVector;
620 TiXmlElement* pixelDefinition = GetElement("addPixel", channelDefinition);
621 while (pixelDefinition != nullptr) {
623
624 pixel.SetOrigin(StringTo2DVector(GetFieldValue("origin", pixelDefinition)));
625 pixel.SetSize(StringTo2DVector(GetFieldValue("size", pixelDefinition)));
626 pixel.SetRotation(StringToDouble(GetFieldValue("rotation", pixelDefinition)));
627 pixel.SetTriangle(StringToBool(GetFieldValue("triangle", pixelDefinition)));
628 pixel.SetTolerance(pixelTolerance);
629
630 if (StringToInteger(GetFieldValue("id", pixelDefinition)) != -1)
631 pixelIDVector.push_back(StringToInteger(GetFieldValue("id", pixelDefinition)));
632 pixelVector.push_back(pixel);
633 // channel.AddPixel( pixel );
634 pixelDefinition = GetNextElement(pixelDefinition);
635 }
636
637 if (!pixelIDVector.empty() && pixelIDVector.size() != pixelVector.size()) {
638 RESTError
639 << "pixel id definition may be wrong! It must be coherent and starts from 0. Check your "
640 "readout module definition!"
641 << RESTendl;
642 exit(0);
643 }
644
645 // Creating the std::vector fReadoutPixel in the channel with pixels added in the
646 // order of their ID.
647 for (Int_t i(0); i < (Int_t)pixelVector.size(); i++) {
648 for (Int_t j(0); j < (Int_t)pixelVector.size(); j++) {
649 if (pixelIDVector[j] == i) {
650 channel.AddPixel(pixelVector[j]);
651 break;
652 }
653 }
654 }
655
656 if (channel.GetNumberOfPixels() != (int)pixelVector.size()) {
657 RESTError << "pixel id definition may be wrong! check your "
658 "readout module definition!"
659 << RESTendl;
660 exit(0);
661 }
662
663 channelVector.push_back(channel);
664 channelDefinition = GetNextElement(channelDefinition);
665 }
666
667 if (!channelIDVector.empty() && channelIDVector.size() != channelVector.size()) {
668 RESTError << "TRestDetectorReadout::ParseModuleDefinition. Channel id definition may be wrong!"
669 << "check your readout module definition!" << RESTendl;
670 RESTError << " " << RESTendl;
671 RESTError << "channelIDVector size : " << channelIDVector.size() << RESTendl;
672 RESTError << "channel std::vector size : " << channelVector.size() << RESTendl;
673
674 exit(0);
675 }
676
677 // Creating the std::vector fReadoutChannel in the module with channels added in
678 // the order of their ID.
679 for (Int_t i(0); i < (Int_t)channelVector.size(); i++) {
680 for (Int_t j(0); j < (Int_t)channelVector.size(); j++) {
681 if (channelIDVector[j] == i) {
682 module.AddChannel(channelVector[j]);
683 break;
684 }
685 }
686 }
687
688 if (module.GetNumberOfChannels() != channelVector.size()) {
689 RESTError << "TRestDetectorReadout::ParseModuleDefinition. Channel id definition may be wrong!"
690 << "check your readout module definition!" << RESTendl;
691 RESTError << " " << RESTendl;
692 RESTError << "Module number of channels : " << module.GetNumberOfChannels() << RESTendl;
693 RESTError << "channel std::vector size : " << channelVector.size() << RESTendl;
694
695 exit(0);
696 }
697
698 return mod;
699}
700
706 RESTDebug << "--------------------------------------------------" << RESTendl;
707 RESTDebug << "TRestDetectorReadout::ValidateReadout:: NOT IMPLEMENTED" << RESTendl;
708 RESTDebug << "This function should crosscheck that there are no repeated "
709 "DaqChannels IDs"
710 << RESTendl;
711 RESTDebug << "If any checks are implemented in the future. Those checks should be "
712 "an option."
713 << RESTendl;
714 RESTDebug << "No dead area in the readout module" << RESTendl;
715 RESTDebug << "And other checks" << RESTendl;
716 RESTDebug << "--------------------------------------------------" << RESTendl;
717}
718
719void TRestDetectorReadout::GetPlaneModuleChannel(Int_t signalID, Int_t& planeID, Int_t& moduleID,
720 Int_t& channelID) {
721 for (int p = 0; p < GetNumberOfReadoutPlanes(); p++) {
723 for (size_t m = 0; m < plane->GetNumberOfModules(); m++) {
724 TRestDetectorReadoutModule* mod = &(*plane)[m];
725
726 if (mod->isDaqIDInside(signalID)) {
727 planeID = plane->GetID();
728 moduleID = mod->GetModuleID();
729 channelID = mod->DaqToReadoutChannel(signalID);
730 }
731 }
732 }
733}
734
735Int_t TRestDetectorReadout::GetHitsDaqChannel(const TVector3& position, Int_t& planeID, Int_t& moduleID,
736 Int_t& channelID) {
737 for (int p = 0; p < GetNumberOfReadoutPlanes(); p++) {
739 int m = plane->GetModuleIDFromPosition(position.X(), position.Y(), position.Z());
740 if (m >= 0) {
741 // TRestDetectorReadoutModule* mod = plane->GetModuleByID(m);
743 Int_t readoutChannel = mod->FindChannel({position.X(), position.Y()});
744 if (readoutChannel >= 0) {
745 planeID = plane->GetID();
746 moduleID = mod->GetModuleID();
747 channelID = readoutChannel;
748 return mod->GetChannel(readoutChannel)->GetDaqID();
749 }
750 }
751 }
752 return -1;
753}
754
766//
768Int_t TRestDetectorReadout::GetHitsDaqChannelAtReadoutPlane(const TVector3& hitpos, Int_t& moduleID,
769 Int_t& channelID, Int_t planeId) {
770 if (planeId > GetNumberOfReadoutPlanes()) {
771 RESTWarning << "TRestDetectorReadout. Fail trying to retrieve planeId : " << planeId << RESTendl;
772 RESTWarning << "Number of readout planes: " << GetNumberOfReadoutPlanes() << RESTendl;
773 return -1;
774 }
775
776 TRestDetectorReadoutPlane* plane = &fReadoutPlanes[planeId];
777 int m = plane->GetModuleIDFromPosition(hitpos.X(), hitpos.Y(), hitpos.Z());
778 if (m >= 0) {
780 Int_t readoutChannel = mod->FindChannel({hitpos.X(), hitpos.Y()});
781 if (readoutChannel >= 0) {
782 moduleID = mod->GetModuleID();
783 channelID = readoutChannel;
784 return mod->GetChannel(readoutChannel)->GetDaqID();
785 }
786 }
787 return -1;
788}
789
794Double_t TRestDetectorReadout::GetX(Int_t signalID) {
795 Int_t planeID, readoutChannel = -1, readoutModule;
796 GetPlaneModuleChannel(signalID, planeID, readoutModule, readoutChannel);
797 if (readoutChannel == -1) {
798 return std::numeric_limits<Double_t>::quiet_NaN();
799 }
800 return GetX(planeID, readoutModule, readoutChannel);
801}
802
807Double_t TRestDetectorReadout::GetY(Int_t signalID) {
808 Int_t planeID, readoutChannel = -1, readoutModule;
809 GetPlaneModuleChannel(signalID, planeID, readoutModule, readoutChannel);
810 if (readoutChannel == -1) {
811 return std::numeric_limits<Double_t>::quiet_NaN();
812 }
813 return GetY(planeID, readoutModule, readoutChannel);
814}
815
821Double_t TRestDetectorReadout::GetX(Int_t plane, Int_t modID, Int_t chID) {
822 return GetReadoutPlaneWithID(plane)->GetX(modID, chID);
823}
824
830Double_t TRestDetectorReadout::GetY(Int_t plane, Int_t modID, Int_t chID) {
831 return GetReadoutPlaneWithID(plane)->GetY(modID, chID);
832}
833
840void TRestDetectorReadout::PrintMetadata(Int_t DetailLevel) {
841 if (DetailLevel >= 0) {
843
844 RESTMetadata << "Number of readout planes : " << fNReadoutPlanes << RESTendl;
845 RESTMetadata << "Decoding was defined : ";
846 if (fDecoding)
847 RESTMetadata << "YES" << RESTendl;
848 else
849 RESTMetadata << "NO" << RESTendl;
850 RESTMetadata << "-----------------------------------" << RESTendl;
851 for (int p = 0; p < GetNumberOfReadoutPlanes(); p++) fReadoutPlanes[p].Print(DetailLevel - 1);
852 RESTMetadata << "****************************************" << RESTendl;
853 std::cout << std::endl;
854 }
855}
856
861 std::cout << " TRestDetectorReadout::Draw() is not implemented" << std::endl;
862 std::cout << " To draw a TRestDetectorReadout class with name \"readoutName\"";
863 std::cout << " stored in a ROOT file \"rootFile.root\"" << std::endl;
864 std::cout << " You can use the script : REST_Readout_Viewer( \"rootFile.root\", "
865 "\"readoutName\" )"
866 << std::endl;
867 std::cout << std::endl;
868 std::cout << " Or you can access directly a readout plane and draw using : " << std::endl;
869 std::cout << " readout->GetReadoutPlane( 0 )->Draw( ); " << std::endl;
870}
Int_t GetDaqID() const
Returns the corresponding daq channel id.
Int_t GetNumberOfPixels()
Returns the total number of pixels inside the readout channel.
void AddPixel(const TRestDetectorReadoutPixel &pixel)
Adds a new pixel to the readout channel.
void SetDaqID(Int_t id)
Sets the daq channel number id.
Int_t GetChannel(Double_t x, Double_t y)
Gets the channel number corresponding to coordinates (x,y)
void SetSize(const TVector2 &size)
Sets the module size by definition using TVector2 input.
Int_t GetModuleID() const
Returns the module id.
TRestDetectorReadoutChannel * GetChannel(size_t n)
Returns a pointer to a readout channel by index.
Int_t FindChannel(const TVector2 &position)
Returns the channel index corresponding to the absolute coordinates (absX, absY), but relative to the...
void EnableWarnings()
Enables warning output.
void AddChannel(TRestDetectorReadoutChannel &rChannel)
Adds a new channel to the module.
void SetTolerance(Double_t tolerance)
Sets the tolerance for independent pixel overlaps.
void SetName(const std::string &name)
Sets the name of the readout module.
size_t GetNumberOfChannels() const
Returns the total number of channels defined inside the module.
Bool_t isDaqIDInside(Int_t daqID)
Determines if a given daqID number is in the range of the module.
void DoReadoutMapping(Int_t nodes=0)
Starts the readout mapping initialization. This process is computationally expensive but it greatly o...
Int_t DaqToReadoutChannel(Int_t daqChannel)
Returns the physical readout channel index for a given daq id channel number.
A class to store the readout pixel definition used in TRestDetectorReadoutChannel.
void SetSize(Double_t sx, Double_t sy)
Sets the size of the pixel using the coordinate values sx,sy.
void SetOrigin(Double_t x, Double_t y)
Sets the origin of the pixel using the coordinate values x,y.
void SetTriangle(Bool_t type)
Sets the type of the pixel.
void SetRotation(Double_t rot)
Sets the rotation angle of the pixel in degrees.
void SetTolerance(Double_t tol)
Sets the value of the tolerance in mm. Used in IsInside method.
TRestDetectorReadoutModule * GetModuleByID(Int_t modID)
Returns a pointer to a module using its internal module id.
void SetPosition(const TVector3 &position)
Sets the readout plane position.
void SetNormal(const TVector3 &normal)
It updates the value of the normal vector and recalculates the corresponding X and Y axis.
void AddModule(TRestDetectorReadoutModule &rModule)
Adds a new module to the readout plane.
void SetChargeCollection(Double_t charge)
Sets the value for the charge collection.
void SetID(int id)
Sets the planeId. This is done by TRestDetectorReadout during initialization.
Double_t GetX(Int_t modID, Int_t chID)
Returns the X coordinate of a given channel in a given module using their internal module and channel...
Double_t GetY(Int_t modID, Int_t chID)
Returns the Y coordinate of a given channel in a given module using their internal module and channel...
size_t GetNumberOfModules()
Returns the total number of modules in the readout plane.
void SetHeight(Double_t d)
Used to define the height of the readout volume with sign crosscheck.
Int_t GetID() const
Returns an integer with the plane id number.
Int_t GetModuleIDFromPosition(const TVector3 &position)
This method returns the module id where pos is found. The z-coordinate must be found in between the c...
A metadata class to generate/store a readout description.
std::vector< TRestDetectorReadoutPlane > fReadoutPlanes
A std::vector storing the TRestDetectorReadoutPlane definitions.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
Int_t GetNumberOfChannels()
Returns the total number of channels implemented in all the readout planes and modules.
~TRestDetectorReadout() override
TRestDetectorReadout default destructor.
Int_t GetHitsDaqChannelAtReadoutPlane(const TVector3 &hitPosition, Int_t &moduleID, Int_t &channelID, Int_t planeId=0)
This method recovers the channel daq id corresponding to the (x,y,z) coordinates given by argument....
TRestDetectorReadoutPlane * GetReadoutPlane(int p)
Returns a pointer to the readout plane by index.
TRestDetectorReadoutPlane * GetReadoutPlaneWithID(int id)
Returns a pointer to the readout plane by ID.
Double_t GetY(Int_t signalID)
It returns the physical Y-coordinate corresponding to a given signal id in plane coordinates.
TRestDetectorReadout()
TRestDetectorReadout default constructor.
void InitFromConfigFile() override
Initializes the readout members using the information given in the TRestDetectorReadout RML section.
Int_t fNReadoutPlanes
Number of readout planes present on the readout.
TRestDetectorReadoutModule * GetReadoutModuleWithID(int id)
Returns a pointer to the readout module by ID.
void AddReadoutPlane(TRestDetectorReadoutPlane plane)
Adds a readout plane to the readout.
Double_t GetX(Int_t signalID)
It returns the physical X-coordinate corresponding to a given signal id in plane coordinates.
Int_t GetNumberOfModules()
Returns the total number of modules implemented in all the readout planes.
TRestDetectorReadoutChannel * GetReadoutChannelWithDaqID(int daqId)
Returns a pointer to the readout channel by daq id.
*TRestDetectorReadoutModule definitions *void ValidateReadout()
This method is not implemented yet. But it could do some checks to help verifying the readout.
void Initialize() override
Initializes the readout members and defines the section name.
Int_t GetModuleDefinitionId(TString name)
Returns the id of the readout module with a given name.
Int_t GetNumberOfReadoutPlanes()
Returns the number of readout planes defined on the readout.
void Draw()
Draws the readout on screen. Not yet implemented.
A base class for any REST metadata class.
Definition: TRestMetadata.h:70
virtual void PrintMetadata()
Implemented it in the derived metadata class to print out specific metadata information.
endl_t RESTendl
Termination flag object for TRestStringOutput.
TiXmlElement * GetElement(std::string eleDeclare, TiXmlElement *e=nullptr)
Get an xml element from a given parent element, according to its declaration.
Int_t LoadConfigFromFile(const std::string &configFilename, const std::string &sectionName="")
Give the file name, find out the corresponding section. Then call the main starter.
void SetLibraryVersion(TString version)
Set the library version of this metadata class.
TRestStringOutput::REST_Verbose_Level GetVerboseLevel()
returns the verboselevel in type of REST_Verbose_Level enumerator
std::string GetFieldValue(std::string parName, TiXmlElement *e)
Returns the field value of an xml element which has the specified name.
void Print()
Implementing TObject::Print() method.
void SetSectionName(std::string sName)
set the section name, clear the section content
std::string fConfigFileName
Full name of the rml file.
TiXmlElement * GetNextElement(TiXmlElement *e)
Get the next sibling xml element of this element, with same eleDeclare.
std::string GetParameter(std::string parName, TiXmlElement *e, TString defaultValue=PARAMETER_NOT_FOUND_STR)
Returns the value for the parameter named parName in the given section.
@ REST_Debug
+show the defined debug messages
static bool fileExists(const std::string &filename)
Returns true if the file (or directory) with path filename exists.
Definition: TRestTools.cxx:674
Int_t GetChar(std::string hint="Press a KEY to continue ...")
Helps to pause the program, printing a message before pausing.
Double_t StringToDouble(std::string in)
Gets a double from a string.
Int_t StringToInteger(std::string in)
Gets an integer from a string.
TVector2 StringTo2DVector(std::string in)
Gets a 2D-vector from a string.