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
284
285#include "TRestDetectorReadout.h"
286
287#include <TFile.h>
288
289using namespace std;
290
291ClassImp(TRestDetectorReadout);
296
311TRestDetectorReadout::TRestDetectorReadout(const char* configFilename) : TRestMetadata(configFilename) {
312 cout << "Loading readout. This might take few seconds" << endl;
313 Initialize();
314
316}
317
331TRestDetectorReadout::TRestDetectorReadout(const char* configFilename, const string& name)
332 : TRestMetadata(configFilename) {
333 cout << "Loading readout. This might take few seconds" << endl;
334 Initialize();
335
337}
338
343 SetSectionName(this->ClassName());
344 SetLibraryVersion(LIBRARY_VERSION);
345 fReadoutPlanes.clear();
346}
347
352
358 Int_t modules = 0;
359 for (int p = 0; p < GetNumberOfReadoutPlanes(); p++) {
360 modules += fReadoutPlanes[p].GetNumberOfModules();
361 }
362 return modules;
363}
364
370 Int_t channels = 0;
371 for (int p = 0; p < GetNumberOfReadoutPlanes(); p++) {
372 for (size_t m = 0; m < fReadoutPlanes[p].GetNumberOfModules(); m++) {
373 channels += fReadoutPlanes[p][m].GetNumberOfChannels();
374 }
375 }
376 return channels;
377}
378
383 for (unsigned int i = 0; i < fModuleDefinitions.size(); i++) {
384 if (fModuleDefinitions[i].GetName() == name) {
385 return i;
386 }
387 }
388 return -1;
389}
390
395 for (int i = 0; i < this->GetNumberOfReadoutPlanes(); i++) {
396 if (fReadoutPlanes[i].GetID() == id) {
397 return &fReadoutPlanes[i];
398 }
399 }
400
401 return nullptr;
402}
403
410 for (int i = 0; i < this->GetNumberOfReadoutPlanes(); i++) {
412
413 for (size_t j = 0; j < plane.GetNumberOfModules(); j++) {
414 if (plane[j].GetModuleID() == id) {
415 return &plane[j];
416 }
417 }
418 }
419 return nullptr;
420}
421
426 for (int p = 0; p < GetNumberOfReadoutPlanes(); p++) {
427 for (size_t m = 0; m < fReadoutPlanes[p].GetNumberOfModules(); m++) {
428 for (size_t c = 0; c < fReadoutPlanes[p][m].GetNumberOfChannels(); c++) {
429 if (fReadoutPlanes[p][m][c].GetDaqID() == daqId) {
430 return &fReadoutPlanes[p][m][c];
431 }
432 }
433 }
434 }
435 return nullptr;
436}
437
442 if (p < GetNumberOfReadoutPlanes())
443 return &fReadoutPlanes[p];
444 else {
445 RESTWarning << "TRestDetectorReadout::GetReadoutPlane." << RESTendl;
446 RESTWarning << "Readout plane index exceeded." << RESTendl;
447 RESTWarning << "Index requested : " << p << RESTendl;
448 RESTWarning << "Number of readout planes defined : " << GetNumberOfReadoutPlanes() << RESTendl;
449 }
450
451 return nullptr;
452}
453
458 fReadoutPlanes.emplace_back(plane);
459}
460
466 fMappingNodes = StringToInteger(GetParameter("mappingNodes", "0"));
467
468 TiXmlElement* moduleDefinition = GetElement("readoutModule");
469 while (moduleDefinition != nullptr) {
471 cout << "------module-----------------" << endl;
472 cout << moduleDefinition << endl;
473 cout << "-----------------------------" << endl;
474 GetChar();
475 }
476
477 TRestDetectorReadoutModule module = *ParseModuleDefinition(moduleDefinition);
478 module.SetMappingNodes(fMappingNodes);
479 module.DoReadoutMapping();
480 fModuleDefinitions.push_back(module);
481 moduleDefinition = GetNextElement(moduleDefinition);
482 }
483
484 TiXmlElement* planeDefinition = GetElement("readoutPlane");
485 Int_t addedChannels = 0;
486 vector<TRestDetectorReadoutModule> moduleVector;
487 while (planeDefinition != nullptr) {
489
490 plane.SetID(GetNumberOfReadoutPlanes());
491 plane.SetPosition(Get3DVectorParameterWithUnits("position", planeDefinition));
492 plane.SetNormal(Get3DVectorParameterWithUnits("normal", planeDefinition));
493 plane.SetHeight(GetDblParameterWithUnits("height", planeDefinition));
494 plane.SetChargeCollection(StringToDouble(GetFieldValue("chargeCollection", planeDefinition)));
495 plane.SetRotation(GetDblParameterWithUnits("rotation", planeDefinition, 0));
496 plane.SetName(GetParameter("name", planeDefinition, plane.GetName()));
497 plane.SetType(GetParameter("type", planeDefinition, plane.GetType()));
498
499 cout << "plane name: " << plane.GetName() << endl;
500 cout << "plane type: " << plane.GetType() << endl;
501
502 moduleVector.clear();
503 TiXmlElement* moduleDefinition = GetElement("addReadoutModule", planeDefinition);
504 while (moduleDefinition != nullptr) {
505 TString modName = GetFieldValue("name", moduleDefinition);
506 Int_t mid = GetModuleDefinitionId(modName);
507
508 if (mid == -1) {
509 RESTError << "TRestDetectorReadout at <addReadoutModule>. Module name " << modName
510 << " not found!" << RESTendl;
511 RESTError << "Please, check spelling" << RESTendl;
512 exit(1);
513 }
514
515 fModuleDefinitions[mid].SetModuleID(StringToInteger(GetFieldValue("id", moduleDefinition)));
516 fModuleDefinitions[mid].SetOrigin(StringTo2DVector(GetFieldValue("origin", moduleDefinition)));
517 fModuleDefinitions[mid].SetRotation(GetDblParameterWithUnits("rotation", moduleDefinition));
518
519 Int_t firstDaqChannel = StringToInteger(GetFieldValue("firstDaqChannel", moduleDefinition));
520
521 if (firstDaqChannel == -1) {
522 fModuleDefinitions[mid].SetFirstDaqChannel(addedChannels);
523 } else {
524 fModuleDefinitions[mid].SetFirstDaqChannel(firstDaqChannel);
525 }
526
527 string decodingFile = GetFieldValue("decodingFile", moduleDefinition);
528 fModuleDefinitions[mid].SetDecodingFile(decodingFile);
529 addedChannels += fModuleDefinitions[mid].GetNumberOfChannels();
530
531 moduleVector.push_back(std::move(fModuleDefinitions[mid]));
532 // plane.AddModule( fModuleDefinitions[mid] );
533
534 moduleDefinition = GetNextElement(moduleDefinition);
535 }
536
537 // We removed the constraint that module id's should start by 0 and have no
538 // missing numbers in a multi-module readout plane. Modules can have their
539 // special "id", e.g. M0, M2, M3, M4 in SJTU proto. We don't have M1
540
541 for (auto& mod : moduleVector) {
542 plane.AddModule(mod);
543 }
544
545 this->AddReadoutPlane(std::move(plane));
546 planeDefinition = GetNextElement(planeDefinition);
547 }
548
550}
551
552TRestDetectorReadoutModule* TRestDetectorReadout::ParseModuleDefinition(TiXmlElement* moduleDefinition) {
553 auto mod = new TRestDetectorReadoutModule();
554 TRestDetectorReadoutModule& module = *mod;
555 if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Warning) module.EnableWarnings();
556
557 module.SetName(GetFieldValue("name", moduleDefinition));
558 module.SetSize(StringTo2DVector(GetFieldValue("size", moduleDefinition)));
559 module.SetTolerance(StringToDouble(GetFieldValue("tolerance", moduleDefinition)));
560 Double_t pixelTolerance = StringToDouble(GetFieldValue("pixelTolerance", moduleDefinition));
561 if (pixelTolerance == -1) pixelTolerance = 1.e-6;
562
563 vector<TRestDetectorReadoutChannel> channelVector;
564 vector<int> channelIDVector;
565 TiXmlElement* channelDefinition = GetElement("readoutChannel", moduleDefinition);
566 while (channelDefinition != nullptr) {
568
569 Int_t id = StringToInteger(GetFieldValue("id", channelDefinition));
570 if (id != -1) {
571 channelIDVector.push_back(id);
572 }
573 channel.SetDaqID(-1);
574
575 const string channelName = GetFieldValue("name", channelDefinition);
576 channel.SetChannelName(channelName);
577
578 vector<TRestDetectorReadoutPixel> pixelVector;
579 vector<int> pixelIDVector;
580 TiXmlElement* pixelDefinition = GetElement("addPixel", channelDefinition);
581 while (pixelDefinition != nullptr) {
583
584 pixel.SetOrigin(StringTo2DVector(GetFieldValue("origin", pixelDefinition)));
585 pixel.SetSize(StringTo2DVector(GetFieldValue("size", pixelDefinition)));
586 pixel.SetRotation(StringToDouble(GetFieldValue("rotation", pixelDefinition)));
587 pixel.SetTriangle(StringToBool(GetFieldValue("triangle", pixelDefinition)));
588 pixel.SetTolerance(pixelTolerance);
589
590 if (StringToInteger(GetFieldValue("id", pixelDefinition)) != -1)
591 pixelIDVector.push_back(StringToInteger(GetFieldValue("id", pixelDefinition)));
592 pixelVector.push_back(pixel);
593 // channel.AddPixel( pixel );
594 pixelDefinition = GetNextElement(pixelDefinition);
595 }
596
597 if (!pixelIDVector.empty() && pixelIDVector.size() != pixelVector.size()) {
598 RESTError
599 << "pixel id definition may be wrong! It must be coherent and starts from 0. Check your "
600 "readout module definition!"
601 << RESTendl;
602 exit(0);
603 }
604
605 // Creating the vector fReadoutPixel in the channel with pixels added in the
606 // order of their ID.
607 for (Int_t i(0); i < (Int_t)pixelVector.size(); i++) {
608 for (Int_t j(0); j < (Int_t)pixelVector.size(); j++) {
609 if (pixelIDVector[j] == i) {
610 channel.AddPixel(pixelVector[j]);
611 break;
612 }
613 }
614 }
615
616 if (channel.GetNumberOfPixels() != (int)pixelVector.size()) {
617 RESTError << "pixel id definition may be wrong! check your "
618 "readout module definition!"
619 << RESTendl;
620 exit(0);
621 }
622
623 channelVector.push_back(channel);
624 channelDefinition = GetNextElement(channelDefinition);
625 }
626
627 if (!channelIDVector.empty() && channelIDVector.size() != channelVector.size()) {
628 RESTError << "TRestDetectorReadout::ParseModuleDefinition. Channel id definition may be wrong!"
629 << "check your readout module definition!" << RESTendl;
630 RESTError << " " << RESTendl;
631 RESTError << "channelIDVector size : " << channelIDVector.size() << RESTendl;
632 RESTError << "channel vector size : " << channelVector.size() << RESTendl;
633
634 exit(0);
635 }
636
637 // Creating the vector fReadoutChannel in the module with channels added in
638 // the order of their ID.
639 for (Int_t i(0); i < (Int_t)channelVector.size(); i++) {
640 for (Int_t j(0); j < (Int_t)channelVector.size(); j++) {
641 if (channelIDVector[j] == i) {
642 module.AddChannel(channelVector[j]);
643 break;
644 }
645 }
646 }
647
648 if (module.GetNumberOfChannels() != channelVector.size()) {
649 RESTError << "TRestDetectorReadout::ParseModuleDefinition. Channel id definition may be wrong!"
650 << "check your readout module definition!" << RESTendl;
651 RESTError << " " << RESTendl;
652 RESTError << "Module number of channels : " << module.GetNumberOfChannels() << RESTendl;
653 RESTError << "channel vector size : " << channelVector.size() << RESTendl;
654
655 exit(0);
656 }
657
658 return mod;
659}
660
666 RESTDebug << "--------------------------------------------------" << RESTendl;
667 RESTDebug << "TRestDetectorReadout::ValidateReadout:: NOT IMPLEMENTED" << RESTendl;
668 RESTDebug << "This function should crosscheck that there are no repeated "
669 "DaqChannels IDs"
670 << RESTendl;
671 RESTDebug << "If any checks are implemented in the future. Those checks should be "
672 "an option."
673 << RESTendl;
674 RESTDebug << "No dead area in the readout module" << RESTendl;
675 RESTDebug << "And other checks" << RESTendl;
676 RESTDebug << "--------------------------------------------------" << RESTendl;
677}
678
679void TRestDetectorReadout::GetPlaneModuleChannel(Int_t signalID, Int_t& planeID, Int_t& moduleID,
680 Int_t& channelID) {
681 for (int p = 0; p < GetNumberOfReadoutPlanes(); p++) {
683 for (size_t m = 0; m < plane->GetNumberOfModules(); m++) {
684 TRestDetectorReadoutModule* mod = &(*plane)[m];
685
686 if (mod->IsDaqIDInside(signalID)) {
687 planeID = plane->GetID();
688 moduleID = mod->GetModuleID();
689 channelID = mod->DaqToReadoutChannel(signalID);
690 }
691 }
692 }
693}
694
695Int_t TRestDetectorReadout::GetHitsDaqChannel(const TVector3& position, Int_t& planeID, Int_t& moduleID,
696 Int_t& channelID) {
697 for (int p = 0; p < GetNumberOfReadoutPlanes(); p++) {
699 int m = plane->GetModuleIDFromPosition(position);
700 if (m >= 0) {
701 // TRestDetectorReadoutModule* mod = plane->GetModuleByID(m);
703 Int_t readoutChannel = mod->FindChannel({position.X(), position.Y()});
704 if (readoutChannel >= 0) {
705 planeID = plane->GetID();
706 moduleID = mod->GetModuleID();
707 channelID = readoutChannel;
708 return mod->GetChannel(readoutChannel)->GetDaqID();
709 }
710 }
711 }
712 return -1;
713}
714
726//
729 const TVector3& position, Int_t planeId) {
730 if (planeId > GetNumberOfReadoutPlanes()) {
731 RESTWarning << "TRestDetectorReadout. Fail trying to retrieve planeId : " << planeId << RESTendl;
732 RESTWarning << "Number of readout planes: " << GetNumberOfReadoutPlanes() << RESTendl;
733 return std::make_tuple(-1, -1, -1);
734 }
735
736 set<Int_t> daqIds;
737 Int_t moduleID = -1;
738 Int_t channelID = -1;
739
741 int m = plane.GetModuleIDFromPosition(position);
742 if (m >= 0) {
744
745 TRestDetectorReadoutChannel* channel = nullptr;
746 int channelIndex = -1;
747 if (mod->GetNumberOfChannels() == 1) {
748 // workaround for vetoes which only have one channel
749 channelIndex = 0;
750 channel = mod->GetChannel(channelIndex);
751 } else {
752 channelIndex = mod->FindChannel({position.X(), position.Y()});
753 channel = mod->GetChannel(channelIndex);
754 }
755 if (channel != nullptr) {
756 moduleID = mod->GetModuleID();
757 channelID = channelIndex;
758 daqIds.insert(channel->GetDaqID());
759 }
760 }
761
762 if (daqIds.empty()) {
763 return std::make_tuple(-1, -1, -1);
764 } else if (daqIds.size() == 1) {
765 Int_t daqId = *daqIds.begin();
766 return std::make_tuple(daqId, moduleID, channelID);
767 } else {
768 cerr << "TRestDetectorReadout::GetHitsDaqChannelAtReadoutPlane. More than one daq channel found for "
769 "the given position. This means there is a problem with the readout definition."
770 << endl;
771 exit(1);
772 }
773}
774
779Double_t TRestDetectorReadout::GetX(Int_t signalID) {
780 Int_t planeID, readoutChannel = -1, readoutModule;
781 GetPlaneModuleChannel(signalID, planeID, readoutModule, readoutChannel);
782 if (readoutChannel == -1) {
783 return std::numeric_limits<Double_t>::quiet_NaN();
784 }
785 return GetX(planeID, readoutModule, readoutChannel);
786}
787
792Double_t TRestDetectorReadout::GetY(Int_t signalID) {
793 Int_t planeID, readoutChannel = -1, readoutModule;
794 GetPlaneModuleChannel(signalID, planeID, readoutModule, readoutChannel);
795 if (readoutChannel == -1) {
796 return std::numeric_limits<Double_t>::quiet_NaN();
797 }
798 return GetY(planeID, readoutModule, readoutChannel);
799}
800
806Double_t TRestDetectorReadout::GetX(Int_t plane, Int_t modID, Int_t chID) {
807 return GetReadoutPlaneWithID(plane)->GetX(modID, chID);
808}
809
815Double_t TRestDetectorReadout::GetY(Int_t plane, Int_t modID, Int_t chID) {
816 return GetReadoutPlaneWithID(plane)->GetY(modID, chID);
817}
818
825void TRestDetectorReadout::PrintMetadata(Int_t DetailLevel) {
826 if (DetailLevel >= 0) {
828
829 RESTMetadata << "Number of readout planes : " << GetNumberOfReadoutPlanes() << RESTendl;
830 RESTMetadata << "-----------------------------------" << RESTendl;
831 for (int p = 0; p < GetNumberOfReadoutPlanes(); p++) {
832 fReadoutPlanes[p].Print(DetailLevel - 1);
833 }
834 RESTMetadata << "****************************************" << RESTendl;
835 cout << endl;
836 }
837}
838
843 cout << " TRestDetectorReadout::Draw() is not implemented" << endl;
844 cout << " To draw a TRestDetectorReadout class with name \"readoutName\"";
845 cout << " stored in a ROOT file \"rootFile.root\"" << endl;
846 cout << " You can use the script : REST_Readout_Viewer( \"rootFile.root\", "
847 "\"readoutName\" )"
848 << endl;
849 cout << endl;
850 cout << " Or you can access directly a readout plane and draw using : " << endl;
851 cout << " readout->GetReadoutPlane( 0 )->Draw( ); " << endl;
852}
853
857void TRestDetectorReadout::Export(const string& fileName) {
858 if (TRestTools::GetFileNameExtension(fileName) == "root") {
859 TFile* f = TFile::Open(fileName.c_str(), "UPDATE");
860 this->Write();
861 f->Close();
862 } else {
863 RESTWarning << "Can only export readout as a root file, skipping..." << RESTendl;
864 }
865}
866
867Int_t TRestDetectorReadout::GetDaqId(const TVector3& position, bool check) {
868 std::vector<int> daqIds;
869 for (int planeIndex = 0; planeIndex < GetNumberOfReadoutPlanes(); planeIndex++) {
870 // const TRestDetectorReadoutPlane& plane = fReadoutPlanes[planeIndex];
871 const auto [daqId, moduleID, channelID] = GetHitsDaqChannelAtReadoutPlane(position, planeIndex);
872 if (daqId != -1) {
873 if (!check) {
874 return daqId;
875 }
876 daqIds.push_back(daqId);
877 }
878 }
879
880 if (daqIds.empty()) {
881 return -1;
882 } else if (daqIds.size() == 1) {
883 return daqIds[0];
884 } else {
885 cerr << "TRestDetectorReadout::GetDaqId. More than one daq channel found for "
886 "the given position. This means there is a problem with the readout definition."
887 << endl;
888 exit(1);
889 }
890}
891
892set<Int_t> TRestDetectorReadout::GetAllDaqIds() {
893 set<Int_t> daqIds;
894
895 for (int p = 0; p < GetNumberOfReadoutPlanes(); p++) {
896 for (size_t m = 0; m < fReadoutPlanes[p].GetNumberOfModules(); m++) {
897 for (size_t c = 0; c < fReadoutPlanes[p][m].GetNumberOfChannels(); c++) {
898 auto channel = fReadoutPlanes[p][m][c];
899 daqIds.insert(channel.GetDaqID());
900 }
901 }
902 }
903
904 return daqIds;
905}
906
907string TRestDetectorReadout::GetTypeForChannelDaqId(Int_t daqId) {
908 for (int p = 0; p < GetNumberOfReadoutPlanes(); p++) {
909 for (size_t m = 0; m < fReadoutPlanes[p].GetNumberOfModules(); m++) {
910 for (size_t c = 0; c < fReadoutPlanes[p][m].GetNumberOfChannels(); c++) {
911 auto channel = fReadoutPlanes[p][m][c];
912 if (channel.GetDaqID() == daqId) {
913 return channel.GetType();
914 }
915 }
916 }
917 }
918 return {};
919}
std::string GetType() const
Returns the channel type.
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.
void SetSize(const TVector2 &size)
Sets the module size by definition using TVector2 input.
void AddChannel(TRestDetectorReadoutChannel &channel)
Adds a new channel to the module.
Int_t GetModuleID() const
Returns the module id.
void SetMappingNodes(Int_t nodes)
Sets number of nodes.
void DoReadoutMapping()
Starts the readout mapping initialization. This process is computationally expensive but it greatly o...
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.
Bool_t IsDaqIDInside(Int_t daqID)
Determines if a given daqID number is in the range of 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.
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 SetOrigin(const TVector2 &origin)
Sets the origin of the pixel using a TVector2.
void SetSize(const TVector2 &size)
Sets the size of the pixel using a TVector2.
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.
Int_t GetModuleIDFromPosition(const TVector3 &position) const
This method returns the module id where pos is found. The z-coordinate must be found in between the c...
void SetChargeCollection(Double_t charge)
Sets the value for the charge collection.
size_t GetNumberOfModules() const
Returns the total number of modules in the readout plane.
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...
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.
void AddModule(const TRestDetectorReadoutModule &module)
Adds a new module to the readout plane.
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.
void AddReadoutPlane(const TRestDetectorReadoutPlane &plane)
Adds a readout plane to the readout.
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.
void Export(const std::string &fileName)
Export readout to a root file.
TRestDetectorReadoutModule * GetReadoutModuleWithID(int id)
Returns a pointer to the readout module by ID.
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.
std::tuple< Int_t, Int_t, Int_t > GetHitsDaqChannelAtReadoutPlane(const TVector3 &position, Int_t planeId=0)
Returns a tuple with the DaqID, ModuleID, ChannelID.
TRestDetectorReadoutChannel * GetReadoutChannelWithDaqID(int daqId)
Returns a pointer to the readout channel by daq id.
void Initialize() override
Initializes the readout members and defines the section name.
*TRestDetectorReadoutModule definitions *void ValidateReadout() const
This method is not implemented yet. But it could do some checks to help verifying the readout.
void Draw()
Draws the readout on screen. Not yet implemented.
Int_t GetModuleDefinitionId(const TString &name)
Returns the id of the readout module with a given name.
Int_t GetDaqId(const TVector3 &position, bool check=true)
Returns the DaqID of the channel for position. If no channel is found returns -1.
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 SetSectionName(std::string sName)
set the section name, clear the section content
std::string fConfigFileName
Full name of the rml file.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
overwriting the write() method with fStore considered
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 std::string GetFileNameExtension(const std::string &fullname)
Gets the file extension as the substring found after the latest ".".
Definition: TRestTools.cxx:823
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.