12 TClonesArray* mcTracks, TClonesArray* gemPoints, TClonesArray* silPoints, TClonesArray* cscPoints,
13 Int_t code, vector<Int_t> &outCodes, Int_t minHits) {
15 Int_t decaysWritten = 0;
17 for (Int_t iTrack = 0; iTrack < mcTracks->GetEntriesFast(); iTrack++) {
22 vector<Int_t> outHitsCnt;
23 outHitsCnt.resize(outCodes.size(), 0);
25 for (Int_t jTrack = 0; jTrack < mcTracks->GetEntriesFast(); jTrack++) {
29 auto it = find(outCodes.begin(), outCodes.end(), offspringTrack->
GetPdgCode());
30 if (it == outCodes.end())
32 Int_t iOffspring = it - outCodes.begin();
37 for (Int_t iPoint = 0; iPoint < gemPoints->GetEntriesFast(); iPoint++) {
39 if (point->GetTrackID() != jTrack)
43 if (TESTBIT(stations, iStation))
45 SETBIT(stations, iStation);
46 outHitsCnt[iOffspring]++;
50 for (Int_t iPoint = 0; iPoint < silPoints->GetEntriesFast(); iPoint++) {
52 if (point->GetTrackID() != jTrack)
56 if (TESTBIT(stations, iStation))
58 SETBIT(stations, iStation);
59 outHitsCnt[iOffspring]++;
71 for (
size_t iOffspring = 0; iOffspring < outCodes.size(); iOffspring++) {
73 if (outHitsCnt[iOffspring] < minHits) {
83 return (decaysWritten == 1);
135 vector<vector<vector<TH2* > > > &hitVec) {
137 for (Int_t iHit = 0; iHit < pts->GetEntriesFast(); iHit++) {
144 Double_t driftCenterShift = 0.0;
146 driftCenterShift = 0.15;
148 driftCenterShift = 0.75;
149 Double_t x = pt->
GetX(pt->GetZ() + driftCenterShift);
150 Double_t y = pt->
GetY(pt->GetZ() + driftCenterShift);
151 Int_t iLayerOwned = -1;
152 for (
size_t iLay = 0; iLay < mod->
GetStripLayers().size(); iLay++) {
159 if (iLayerOwned == -1)
161 Int_t iZone = iLayerOwned / 2;
163 Double_t Pz = ((FairMCPoint*) pt)->GetPz();
175 TClonesArray* pts, TClonesArray* hits,
181 vector<vector<vector<TH2* > > > &hitVec) {
184 for (Int_t iPt = 0; iPt < pts->GetEntriesFast(); iPt++) {
191 Int_t iLayerOwned = -1;
193 Double_t driftCenterShift = 0.0;
195 driftCenterShift = 0.15;
197 driftCenterShift = 0.75;
198 Double_t x = pt->
GetX(pt->GetZ() + driftCenterShift);
199 Double_t y = pt->
GetY(pt->GetZ() + driftCenterShift);
200 for (
size_t iLay = 0; iLay < mod->
GetStripLayers().size(); iLay++) {
215 if (iLayerOwned == -1)
217 Int_t iZone = iLayerOwned / 2;
219 BmnHit *hitClosest =
nullptr;
220 Double_t MinDistance = DBL_MAX;
221 for (Int_t iHit = 0; iHit < hits->GetEntriesFast(); iHit++) {
228 Double_t
dist = Sq(hit->GetX() - x) + Sq(hit->GetY() - y);
232 if (
dist < MinDistance) {
237 if (MinDistance <
thr) {
239 Double_t Pz = ((FairMCPoint*) pt)->GetPz();
257 const Int_t nIters = 20;
258 TCutG *cutg =
new TCutG(name, nIters);
259 Double_t ct = TMath::Cos(theta);
260 Double_t st = TMath::Sin(theta);
261 Double_t dphi = 2 * M_PI / nIters;
263 for (Int_t
i = 0;
i < nIters - 1;
i++) {
265 Double_t projX = rx * TMath::Cos(phi);
266 Double_t projY = ry * TMath::Sin(phi);
268 x + projX * ct - projY*st,
269 y + projX * st + projY * ct);
271 Double_t firstX = 0.0;
272 Double_t firstY = 0.0;
273 cutg->GetPoint(0, firstX, firstY);
274 cutg->SetPoint(nIters - 1, firstX, firstY);
279 TTree *treeDST, TClonesArray *gemHits, TClonesArray *gemTracks, TClonesArray *tracks,
280 Double_t lowThr, Int_t ClusterSizeThr, Int_t nBins) {
281 Double_t minVal = DBL_MAX;
282 Double_t maxVal = DBL_MIN;
283 if (treeDST && gemHits) {
285 if (gemHits->GetClass() == BmnGemStripHit::Class()) {
286 for (Long64_t
i = 0;
i < tree->GetEntries();
i++) {
287 treeDST->GetEntry(
i);
288 for (Int_t iHit = 0; iHit < gemHits->GetEntriesFast(); iHit++) {
302 if (gemHits->GetClass() == BmnSiliconHit::Class()) {
303 for (Long64_t
i = 0;
i < tree->GetEntries();
i++) {
304 treeDST->GetEntry(
i);
305 for (Int_t iHit = 0; iHit < gemHits->GetEntriesFast(); iHit++) {
320 if (gemHits->GetClass() == BmnCSCHit::Class()) {
321 for (Long64_t
i = 0;
i < tree->GetEntries();
i++) {
322 treeDST->GetEntry(
i);
323 for (Int_t iHit = 0; iHit < gemHits->GetEntriesFast(); iHit++) {
338 for (Long64_t
i = 0;
i < tree->GetEntries();
i++) {
340 for (Int_t iDig = 0; iDig < arMC->GetEntriesFast(); iDig++) {
353 printf(
"Min = %f max = %f\n", minVal, maxVal);
354 TString name = Form(
"hSig_%s_%d", arMC->GetName(), rand());
355 TH1F *hSig =
new TH1F(name, name, nBins, minVal, maxVal);
357 if (treeDST && gemHits) {
359 if (gemHits->GetClass() == BmnGemStripHit::Class()) {
360 for (Long64_t
i = 0;
i < tree->GetEntries();
i++) {
361 treeDST->GetEntry(
i);
362 for (Int_t iHit = 0; iHit < gemHits->GetEntriesFast(); iHit++) {
400 if (gemHits->GetClass() == BmnSiliconHit::Class()) {
401 for (Long64_t
i = 0;
i < tree->GetEntries();
i++) {
402 treeDST->GetEntry(
i);
403 for (Int_t iHit = 0; iHit < gemHits->GetEntriesFast(); iHit++) {
414 if (gemHits->GetClass() == BmnCSCHit::Class()) {
415 for (Long64_t
i = 0;
i < tree->GetEntries();
i++) {
416 treeDST->GetEntry(
i);
417 for (Int_t iHit = 0; iHit < gemHits->GetEntriesFast(); iHit++) {
429 for (Long64_t
i = 0;
i < tree->GetEntries();
i++) {
431 for (Int_t iDig = 0; iDig < arMC->GetEntriesFast(); iDig++) {
440 name = Form(
"hIntSig_%s_%d", arMC->GetName(), rand());
441 TH1F hIntSig = TH1F(name, Form(
"Signal_%s", arMC->GetName()), nBins, minVal - 0.5 * (maxVal - minVal) / (Double_t) nBins, maxVal + 0.5 * (maxVal - minVal) / (Double_t) nBins);
443 for (Int_t
i = 0;
i < nBins;
i++) {
444 bc += hSig->GetBinContent(
i);
445 hIntSig.SetBinContent(
i, bc);
463 hIntSig.Scale(1 / bc);
464 hIntSig.SetLineColor(kRed);
467 TF1 *sig =
new TF1(Form(
"SignalInt_%s", arMC->GetName()),
468 [hIntSig, bc, minVal, maxVal, nBins](Double_t *x, Double_t * p) {
470 if (x[0] >= maxVal) return 1.0;
471 Int_t iBin = hIntSig.GetXaxis()->FindBin(x[0]);
472 Int_t jBin = iBin + ((x[0] > hIntSig.GetBinCenter(iBin)) ? 1 : -1);
473 Double_t v = hIntSig.GetBinContent(iBin) +
474 (hIntSig.GetBinContent(jBin) - hIntSig.GetBinContent(iBin))*
475 2 * abs(x[0] - hIntSig.GetBinCenter(iBin)) / (hIntSig.GetBinWidth(iBin) + hIntSig.GetBinWidth(jBin));
479 }, minVal, maxVal, 0);
481 sig->SetLineColor(kBlue);