86 if (fReadout !=
nullptr) {
87 Double_t firstX_id = -1.;
88 Double_t firstY_id = -1.;
89 Double_t firstX_t = 512.0;
90 Double_t firstY_t = 512.0;
92 Double_t lastX_id = -1.;
93 Double_t lastY_id = -1.;
94 Double_t lastX_t = 0.0;
95 Double_t lastY_t = 0.0;
97 double nan = numeric_limits<double>::quiet_NaN();
103 set<int> TriggeredModuleId;
105 double XEnergySum = 0;
106 double XEnergyPosSum = 0;
107 double YEnergySum = 0;
108 double YEnergyPosSum = 0;
111 for (
int i = 0; i < fSignalEvent->GetNumberOfSignals(); i++) {
115 fReadout->GetPlaneModuleChannel(sgnl->
GetID(), p, m, c);
116 TriggeredModuleId.insert(m);
118 if (!TMath::IsNaN(fReadout->GetX(sgnl->
GetID()))) {
122 if (!TMath::IsNaN(fReadout->GetY(sgnl->
GetID()))) {
128 if (!TMath::IsNaN(fReadout->GetX(sgnl->
GetID()))) {
129 firstX_id = sgnl->
GetID();
134 if (!TMath::IsNaN(fReadout->GetY(sgnl->
GetID()))) {
135 firstY_id = sgnl->
GetID();
141 if (!TMath::IsNaN(fReadout->GetX(sgnl->
GetID()))) {
142 lastX_id = sgnl->
GetID();
147 if (!TMath::IsNaN(fReadout->GetY(sgnl->
GetID()))) {
148 lastY_id = sgnl->
GetID();
154 this->
SetObservableValue(
"MeanX", XEnergySum == 0 ? nan : XEnergyPosSum / XEnergySum);
155 this->
SetObservableValue(
"MeanY", YEnergySum == 0 ? nan : YEnergyPosSum / YEnergySum);
160 map<int, int> modulefirstxchannel;
161 map<int, int> modulefirstychannel;
162 if (firstX_id > -1 && firstY_id > -1) {
163 double firstx = fReadout->GetX(firstX_id);
164 double firsty = fReadout->GetY(firstY_id);
165 double lastx = fReadout->GetX(lastX_id);
166 double lasty = fReadout->GetY(lastY_id);
172 int mod1 = -1, mod2 = -1;
173 int channel1 = -1, channel2 = -1;
175 fReadout->GetPlaneModuleChannel(firstX_id, plane, mod1, channel1);
176 fReadout->GetPlaneModuleChannel(firstY_id, plane, mod2, channel2);
177 if (mod1 == mod2 && mod1 > -1) {
180 int n = fReadout->GetReadoutModuleWithID(mod1)->GetNumberOfChannels() / 2;
181 if (channel1 >= n && channel2 < n) {
184 }
else if (channel2 >= n && channel1 < n) {
188 modulefirstxchannel[mod1] = x;
189 modulefirstychannel[mod1] = y;
190 if (fModuleHitMaps.count(mod1) > 0) {
191 if (fModuleHitMaps[mod1] !=
nullptr) fModuleHitMaps[mod1]->Fill(x, y);
198 RESTDebug <<
"TRestRawReadoutAnalysisProcess. Adding point to hitmap of "
201 RESTDebug <<
"Position on module(X, Y) : (" << x <<
", " << y <<
")" <<
RESTendl;
202 RESTDebug <<
"Absolute position:(X, Y) : (" << firstx <<
", " << firsty <<
")" <<
RESTendl;
209 vector<int> moduleid;
210 vector<int> channelid;
211 vector<double> baselinesigma;
212 vector<double> baseline;
213 vector<double> thresholdint;
218 for (
int i = 0; i < fSignalEvent->GetNumberOfSignals(); i++) {
222 int plane = -1, mod = -1, channel = -1;
223 fReadout->GetPlaneModuleChannel(sgn->
GetID(), plane, mod, channel);
224 if (mod != -1 && channel != -1) {
225 moduleid.push_back(mod);
226 channelid.push_back(channel);
231 if (fModuleHitMaps.count(mod) > 0) {
249 if (fReadout !=
nullptr) {
251 auto iter = fModuleHitMaps.begin();
252 while (iter != fModuleHitMaps.end()) {
253 if (fModuleHitMaps[iter->first] !=
nullptr) {
254 TH2D* histo = fModuleHitMaps[iter->first];
255 histo->GetXaxis()->SetTitle(
"X Channel");
256 histo->GetYaxis()->SetTitle(
"Y Channel");
260 if (fModuleCanvasSave !=
"none") {
261 if (fModuleHitMaps[iter->first] !=
nullptr) {
262 TH2D* histo = fModuleHitMaps[iter->first];
264 new TCanvas((TString)
"Can_ModuleHitMap" + ToString(iter->first),
265 (TString)
"Hit Map of Module " + ToString(iter->first), 800, 600);
268 c1->Print((TString)fModuleCanvasSave +
"/M" + ToString(iter->first) +
"_HitMap.png");
272 auto h0 = fModuleHitMaps[iter->first];
281 TCanvas* c1 =
new TCanvas(
282 (TString)
"Can_ModuleActivity" + ToString(iter->first),
283 (TString)
"Channel Activity of Module " + ToString(iter->first), 800, 600);
284 c1->Divide(2, 2, 0, 0);
286 h1->SetFillColor(kBlue);
288 h1->GetYaxis()->SetTitle(
"Counts");
292 h2->SetFillColor(kBlue);
294 h2->GetXaxis()->SetTitle(
"Counts");
300 c1->Print((TString)fModuleCanvasSave +
"/M" + ToString(iter->first) +
310 TCanvas* c1 =
new TCanvas(
311 (TString)
"Can_ModuleBSLS" + ToString(iter->first),
312 (TString)
"Channel Baseline Sigma of Module " + ToString(iter->first), 800, 600);
313 c1->Divide(2, 2, 0, 0);
315 h1->SetFillColor(kBlue);
317 h1->GetYaxis()->SetTitle(
"Baseline Sigma");
321 h2->SetFillColor(kBlue);
323 h2->GetXaxis()->SetTitle(
"Baseline Sigma");
329 c1->Print((TString)fModuleCanvasSave +
"/M" + ToString(iter->first) +
"_BSLS.png");
std::vector< std::string > Split(std::string in, std::string separator, bool allowBlankString=false, bool removeWhiteSpaces=false, int startPos=-1)
Split the input string according to the given separator. Returning a vector of fragments.