Skip to content

Commit

Permalink
Merge pull request #21 from rest-for-physics/fixes_readout_macro
Browse files Browse the repository at this point in the history
REST_Detector_CheckReadout. Adding few protections
  • Loading branch information
jgalan authored Sep 8, 2021
2 parents 11afe3a + 940c23d commit 1f88d83
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion macros/REST_Detector_CheckReadout.C
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,23 @@ TGraph* GetHittedStripMap(TRestDetectorReadoutPlane* p, Int_t mask[4], Double_t
Int_t REST_Detector_CheckReadout(TString rootFile, TString name, Double_t region[4], Int_t stripsMask[4],
Int_t offset = 0, Int_t N = 1E4, Int_t plane = 0) {
TFile* f = new TFile(rootFile);
if (!f) {
cout << "File not found: " << rootFile << endl;
return 1;
}

TRestDetectorReadout* readout = (TRestDetectorReadout*)f->Get(name);
if (!readout) {
cout << "The readout with name " << name << " does not exist inside the file " << rootFile << endl;
return 2;
}
readout->PrintMetadata();

TRestDetectorReadoutPlane* readoutPlane = &(*readout)[plane];

if (!readoutPlane) {
cout << "The readout definition does not contain a readout plane with id : " << plane << endl;
return 3;
}
Int_t nModules = readoutPlane->GetNumberOfModules();

Int_t totalPixels = 0;
Expand Down

0 comments on commit 1f88d83

Please sign in to comment.