170 fCanvas =
new TCanvas(
"canv",
"This is the canvas title", 1200, 1200);
173 TPad* pad1 =
new TPad(
"pad1",
"This is pad1", 0.01, 0.02, 0.99, 0.97);
178 fCanvas->SetBottomMargin(0.15);
181 std::map<int, std::vector<TVector2> > points;
183 TRandom3* rnd =
new TRandom3(0);
185 for (
int n = 0; n < nSamples; n++) {
186 Double_t xO = 2.5 * (rnd->Rndm() - 0.5) *
fMaskRadius;
187 Double_t yO = 2.5 * (rnd->Rndm() - 0.5) *
fMaskRadius;
193 if (points.count(
id) == 0) {
194 std::vector<TVector2> a;
195 a.push_back(TVector2(xO, yO));
198 points[id].push_back(TVector2(xO, yO));
202 std::vector<TGraph*> gridGraphs;
204 for (
const auto& x : points) {
206 TGraph* gr =
new TGraph();
207 gr->SetName(grname.c_str());
209 for (
unsigned int n = 0; n < x.second.size(); n++) {
210 gr->SetPoint(gr->GetN(), x.second[n].X(), x.second[n].Y());
214 gr->SetLineColor(kBlack);
215 gr->SetMarkerColor(kBlack);
216 gr->SetMarkerSize(0.6);
219 gr->SetMarkerColor((nGraphs * 3) % 29 + 20);
220 gr->SetLineColor((nGraphs * 3) % 29 + 20);
221 gr->SetMarkerSize(0.6);
225 gr->SetMarkerStyle(20);
226 gridGraphs.push_back(gr);
231 gridGraphs[0]->GetHistogram()->SetMaximum(1.25 *
fMaskRadius);
232 gridGraphs[0]->GetHistogram()->SetMinimum(-1.25 *
fMaskRadius);
234 gridGraphs[0]->GetXaxis()->SetTitle(
"X [mm]");
235 gridGraphs[0]->GetXaxis()->SetTitleSize(0.04);
236 gridGraphs[0]->GetXaxis()->SetLabelSize(0.04);
237 gridGraphs[0]->GetYaxis()->SetTitle(
"Y[mm]");
238 gridGraphs[0]->GetYaxis()->SetTitleOffset(1.5);
239 gridGraphs[0]->GetYaxis()->SetTitleSize(0.04);
240 gridGraphs[0]->GetYaxis()->SetLabelSize(0.04);
242 gridGraphs[0]->Draw(
"AP");
243 for (
int n = 1; n < nGraphs; n++) gridGraphs[n]->Draw(
"P");
Bool_t HitsPattern(Double_t x, Double_t y)
Returns true if the pattern was hit. If (x,y) it is inside a region then, the pattern was not hit by ...