// // C++ Implementation: MvdCalcStrip // // Description: // // // Author: HG Zaunick , (C) 2007 // // Copyright: See COPYING file that comes with this distribution // modified by A. Sanchez for Hyp detector // #include #include "PndHypCalcStrip.h" #include "TRandom3.h" //#include "FairGeoVector.h" //static const int CH_PER_FE = 128; PndHypCalcStrip::PndHypCalcStrip(){ fPitch = 0.; fOrient = 0.; fAnchor = TVector2(0.,0.); fNrStrips = 0; fThreshold = 0.; fNoise = 0.; fVerboseLevel = 1; fRNG = new TRandom3(); } PndHypCalcStrip::PndHypCalcStrip(Double_t pitch, Double_t orient, Int_t nrStrips, Int_t nrFeChannels, const TVector2& firstStripAnchor, Double_t threshold, Double_t noise) : fPitch(pitch), fOrient(orient), fNrStrips(nrStrips), fNrFeChannels(nrFeChannels), fAnchor(firstStripAnchor), fThreshold(threshold), fNoise(noise) { fStripDir.Set(cos(fOrient),sin(fOrient)); fOrthoDir.Set(sin(fOrient),-cos(fOrient)); fVerboseLevel = 1; fRNG = new TRandom3(); //Print(); } PndHypCalcStrip::PndHypCalcStrip(const PndHypStripDigiPar* digipar, SensorSide side) { if(side == kTOP) { fPitch = digipar->GetTopPitch(); fOrient = digipar->GetOrient(); fAnchor = digipar->GetTopAnchor(); fNrStrips = digipar->GetNrTopFE()*digipar->GetNrFECh(); } else if(side == kBOTTOM) { fPitch = digipar->GetBotPitch(); fOrient = digipar->GetOrient() + digipar->GetSkew(); fAnchor = digipar->GetBotAnchor(); fNrStrips = digipar->GetNrBotFE()*digipar->GetNrFECh(); } fNrFeChannels = digipar->GetNrFECh(); fThreshold = digipar->GetThreshold(); fNoise = digipar->GetNoise(); fStripDir.Set(cos(fOrient),sin(fOrient)); fOrthoDir.Set(sin(fOrient),-cos(fOrient)); fVerboseLevel = 1; fRNG = new TRandom3(); //Print(); } std::vector PndHypCalcStrip::GetStrips(Double_t inx, Double_t iny, Double_t inz, Double_t outx, Double_t outy, Double_t outz, Double_t eLoss,int id) {//1 if (fVerboseLevel > 2) std::cout<<"-I- PndHypCalcStrip::GetStrips "< 2){ std::cout<<" InPoint: ("< strips; Double_t SmearedQ; if (path.Mod()<1E-18) { std::cout<<"-W- PndHypCalcStrip::GetStrips : No Trajectory inside Sensor!"< 1) std::cout<<" pathlength: "< 2) std::cout<<" nuIn = "< (Double_t(fNrStrips))){ Q *= ((Double_t)fNrStrips-nuOut)/(-nuOut+nuIn); nuIn = Double_t(fNrStrips); } // is the Out-Point inside active area ? if (nuOut<0.){ Q *= (nuIn)/(-nuOut+nuIn); nuOut = 0.; } else if (nuOut > (Double_t(fNrStrips))){ Q *= ((Double_t)fNrStrips-nuIn)/(nuOut-nuIn); nuOut = Double_t(fNrStrips); } // only one strip hit ? if (Int_t(nuIn) == Int_t(nuOut)) { // this strip collected the entire charge SmearedQ = SmearCharge(Q); if (SmearedQ >= fThreshold)strips.push_back(PndHypStrip(Int_t(nuOut),SmearedQ)); if (fVerboseLevel > 1) std::cout<<" -> 1 strip hit."<nuIn) ? 1. : -1.; // calculate portion of track in first strip Int_t nextIn = Int_t(nuIn + 0.5+0.5*dir); Double_t Q1 = dQ*std::fabs(nextIn-nuIn); if (fVerboseLevel > 2) { std::cout<<" part of first strip : "<= fThreshold)strips.push_back(PndHypStrip(Int_t(nuIn),SmearedQ)); nrHits++; Q -= Q1; // calculate portion of track in last strip Int_t prevOut = Int_t(nuOut + 0.5-0.5*dir); Double_t Q2 = dQ*std::fabs(nuOut-prevOut); if (fVerboseLevel > 2){ std::cout<<" part of last strip : "<<(nuOut-prevOut)<= fThreshold)strips.push_back(PndHypStrip(Int_t(nuOut),SmearedQ)); nrHits++; Q -= Q2; // Distribute the charge among the intermediate strips nextIn = Int_t(nextIn - 0.5 + 0.5*dir); prevOut = Int_t(prevOut - 0.5 + 0.5*dir); if (fVerboseLevel > 2) { std::cout<<" dir="< 2)if (fabs(Q)>1.) std::cout<<" charge Q = "< 1) std::cout<<" -> "<Gaus(charge,fNoise); if (fVerboseLevel > 2) std::cout<<" charge = "< fNrStrips) { // nr -= fNrStrips; // side = kBOTTOM; // } else side = kTOP; if (nr < fNrStrips) { side = kTOP; } else { nr -= fNrStrips; side = kBOTTOM; } strip = nr; //std::cout<< "strip "<