9#include "CbmStsPoint.h"
11#include "FairRootManager.h"
58 FairRootManager* ioman = FairRootManager::Instance();
60 cout <<
"-E- BmnGemFastDigitize::Init: "
61 <<
"RootManager not instantiated!" << endl;
74 if (
gSystem->Exec(
"du -s clusLib")) {
75 LOG(fatal) <<
" !!! No clusLib directory found - exit !!!";
81 ifstream fin(
"clusLib/file_list.txt");
85 const Int_t nbinsx = 29, nbinsy = 5;
86 Double_t xlim[nbinsx] = {-72.5, 72.5};
88 fhInd =
new TH2I(
"hInd",
"", nbinsx, xlim[0], xlim[1], nbinsy, ylim[0], ylim[1]);
101 if (fileName(11) ==
'm')
103 if (fileName(17) ==
'm')
141 TCut cut0(
"abs(ibeg[0]-237)<5&&strout[0]==244");
142 TCut cut1(
"abs(ibeg[1]-252)<5&&strout[1]==259");
144 if (file->
Get(
"CUT"))
145 cut = *((
TCut*)file->
Get(
"CUT"));
148 clus->
Draw(
">>entryList", cut,
"entrylist", 9000000000);
151 cout <<
" xxxxxx " << fileName <<
" " << entryList->
GetN() <<
" " << ithx <<
" " << ithy <<
" " << indXY
168 map<Int_t, Int_t> strin[2];
169 std::multimap<Float_t, Int_t> mmm;
173 for (
Int_t j = 0; j < entries; ++j) {
178 for (
Int_t side = 0; side < 2; ++side) {
179 fXYmap[side][indXY].insert(pair<Float_t, Int_t>(
fCog[side], treeEn));
180 if (strin[side].find(
fStrin[side]) == strin[side].end())
181 strin[side][
fStrin[side]] = 0;
182 ++strin[side][
fStrin[side]];
187 for (
Int_t side = 0; side < 2; ++side) {
188 map<Int_t, Int_t>::iterator it = strin[side].begin();
189 fStrRef[side][indXY] = it->first;
190 Int_t maxStrip = it->second;
192 for (; it != strin[side].end(); ++it) {
193 if (it->second > maxStrip) {
194 maxStrip = it->second;
195 fStrRef[side][indXY] = it->first;
203 cout <<
"-I- BmnGemFastDigitize: Initialisation successful" << endl;
218 std::set<Int_t>& pSet,
221 map<
Int_t, set<Int_t>>& chanPointMapF,
222 map<
Int_t, set<Int_t>>& chanPointMapB)
228 set<Int_t>::iterator it1;
231 for (it1 = pSet.begin(); it1 != pSet.end(); it1++) {
240 point->Momentum(mom);
244 Double_t mnoc = 1.0, mass = 3.7283999;
265 TVector3 posIn, posOut;
268 TVector3 dpos = posOut;
281 if (stationNr % 2 == 0)
294 Int_t istrip0[2] = {0};
295 multimap<Float_t, Int_t>::iterator mit, mit1;
297 for (Int_t ixy = 0; ixy < 2; ++ixy) {
298 map<Int_t, Float_t> charges[2];
300 mit =
fXYmap[ixy][indXY].lower_bound(xy[ixy]);
304 Int_t entry = mit->second;
310 for (Int_t j = 0; j < ndig; ++j) {
320 entry = mit1->second;
335 for (Int_t j = 0; j < ndig; ++j) {
340 Int_t i1 =
TMath::Max(charges[0].rbegin()->first, charges[1].rbegin()->first);
364 istrip0[ixy] = sensor->
GetBackChannel(posOut.
X(), posOut.
Y(), posOut.
Z(), dPitch);
374 if (stationNr % 2 == 0) {
379 if (stationNr % 2 == 0)
383 Double_t qtot12 = qTot0 * w + qTot1 * w1;
384 Double_t dpitch12 = dpitch0 * w + dpitch1 * w1;
386 Int_t ntot = i1 - i0 + 1;
390 for (Int_t j = i0; j <= i1; ++j) {
391 if (charges[0].
find(j) == charges[0].
end())
393 if (charges[1].
find(j) == charges[1].
end())
396 q12array[j - i0] = (charges[0][j] * w + charges[1][j] * w1) * qtot12;
397 q12sum0 += q12array[j - i0];
399 Double_t shift = dPitch - dpitch12, q12 = 0;
401 map<Int_t, Double_t> buffer;
403 for (Int_t j = i0; j <= i1; ++j) {
405 q12 =
Interp(q12array, j - i0, ntot, -shift);
408 q12 =
Interp(q12array, j - i0, ntot, -shift);
421 for (map<Int_t, Double_t>::iterator it = buffer.begin(); it != buffer.end(); ++it) {
422 Int_t jj = it->first;
423 if (stationNr % 2 > 0)
426 jj = istrip0[ixy] - it->first + 0;
431 stripSignalF[jj] += it->second * scale;
432 chanPointMapF[jj].insert(iPoint);
436 stripSignalB[jj] += it->second * scale;
437 chanPointMapB[jj].insert(iPoint);
453 static Int_t indx0 = 0;
488 static Int_t first = 1;
494 vector<Int_t> ia(ny);
495 vector<vector<Int_t>> matri(nx, ia);
496 vector<Float_t> fa(ny);
497 vector<vector<Float_t>> matrf(nx, fa);
498 Int_t ix, iy, ix0, iy0, iz0, ixOK, iyOK;
499 std::queue<Int_t> que;
502 for (
Int_t j = 1; j <= ny; ++j) {
503 if (
fhInd->GetBinContent(
i, j)) {
504 matri[
i - 1][j - 1] =
fhInd->GetBin(
i, j);
505 que.push(
fhInd->GetBin(
i, j));
511 Int_t bin0 = que.front();
512 fhInd->GetBinXYZ(bin0, ix0, iy0, iz0);
515 Int_t binOK = matri[ix0][iy0];
516 fhInd->GetBinXYZ(binOK, ixOK, iyOK, iz0);
524 if (ix < 0 || ix > nx - 1)
527 for (
Int_t j = -1; j < 2; ++j) {
529 if (iy < 0 || iy > ny - 1)
531 if (
i == 0 && j == 0)
534 if (matri[ix][iy] && r20 < 0.1)
536 Float_t r2 = (ix - ixOK) * (ix - ixOK) + (iy - iyOK) * (iy - iyOK);
537 if (r20 < 0.1 || r2 < r20) {
539 matri[ix][iy] = matri[ix0][iy0];
541 que.push(
fhInd->GetBin(ix + 1, iy + 1));
548 for (
Int_t j = 1; j <= ny; ++j) {
549 fhInd->SetBinContent(
i, j, matri[
i - 1][j - 1]);
557 else if (ix >
fhInd->GetNbinsX())
558 ix =
fhInd->GetNbinsX();
562 else if (iy >
fhInd->GetNbinsY())
563 iy =
fhInd->GetNbinsY();
565 return fhInd->GetBinContent(ix, iy);
579 return TMath::Min(val * charge * charge, 20000.);
vector< Double_t > dist(vector< Double_t > qp, Double_t mu)
R__EXTERN TSystem * gSystem
~BmnGemFastDigitize()
Destructor.
BmnGemFastDigitize()
Default constructor.
virtual InitStatus Init()
Virtual method Init.
Int_t FindDataSet(Double_t theX, Double_t theY)
void ProduceHitResponseFast(CbmStsSensor *sensor, std::set< Int_t > &pSet, Double_t *stripSignalF, Double_t *stripSignalB, std::map< Int_t, std::set< Int_t > > &chanPointMapF, std::map< Int_t, std::set< Int_t > > &chanPointMapB)
std::map< Int_t, Int_t > fStrRef[2]
Double_t Interp(Double_t *yy, Int_t indx, Int_t ntot, Double_t dx)
virtual void Exec(Option_t *opt)
Virtual method Exec.
std::vector< Float_t > * fvDig1
std::vector< Float_t > * fvDig0
TClonesArray * fPoints
Input arrays.
std::vector< Float_t > fvDigis[2]
Double_t GetNumberOfClusters(Double_t beta, Double_t gamma, Double_t charge, Double_t p0, Double_t p1)
std::map< Int_t, TTree * > fTreeMap
std::map< Int_t, std::multimap< Float_t, Int_t > > fXYmap[2]
Output array of CbmStsHits.
virtual void Finish()
Virtual method Finish.
std::map< Int_t, TH2I * > fHistMap
Int_t GetPdgCode() const
Accessors.
void PositionOut(TVector3 &pos)
void PositionIn(TVector3 &pos)
Int_t GetNChannelsFront() const
Int_t GetNChannelsBack() const
Int_t GetFrontChannel(Double_t x, Double_t y, Double_t z, Double_t &dPitch)
Int_t GetBackChannel(Double_t x, Double_t y, Double_t z, Double_t &dPitch)
Int_t GetStationNr() const
static TDatabasePDG * Instance()
TParticlePDG * GetParticle(const char *name) const
T * Get(const char *namecycle)
virtual Long64_t GetEntry(Long64_t index)
virtual Long64_t GetN() const
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
TObject * Clone(const char *newname="") const override
virtual void GetRandom2(Double_t &x, Double_t &y, TRandom *rng=nullptr)
void SetVectM(const TVector3 &spatial, Double_t mass)
TObject * UncheckedAt(Int_t i) const
virtual void SetBranchStatus(const char *bname, bool status=true, UInt_t *found=nullptr)
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
virtual Long64_t Draw(const char *varexp, const char *selection, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
virtual void SetEntryList(TEntryList *list, Option_t *opt="")
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
double beta(double x, double y)
Double_t Min(Double_t a, Double_t b)
Double_t ATan2(Double_t y, Double_t x)
Double_t Max(Double_t a, Double_t b)
constexpr Double_t RadToDeg()
iterator find(const Key &key)
*brief create JSON pointer *sa reference_tokens end()
*brief append another JSON pointer at the end of this JSON pointer *sa ptr reference_tokens begin()