7 #include "TClonesArray.h" 
   10 #include "FairRootManager.h" 
   11 #include "FairGeoVolume.h" 
   13 #include "FairRuntimeDb.h" 
   14 #include "FairGeoNode.h" 
   15 #include "FairMCEventHeader.h" 
   29 fDigiStripArray(NULL),
 
   30 fDigiPixelArray(NULL),
 
   62   FairRootManager* ioman = FairRootManager::Instance();
 
   66     std::cout << 
"-E- PndSdsNoiseProducer::Init: RootManager not instantiated!" << std::endl;
 
   73     std::cout << 
"-W- PndSdsNoiseProducer::Init: No "<<
fBranchNameStrip<<
" array!" << std::endl;
 
   74     std::cout << 
"    Create a new one." << std::endl;
 
   80     std::cout << 
"-W- PndSdsNoiseProducer::Init: No "<<
fBranchNamePixel<<
" array!" << std::endl;
 
   81     std::cout << 
"    Create a new one." << std::endl;
 
  104     std::cout <<
"-I- PndSdsNoiseProducer: Registered Sensors: " 
  110   std::cout << 
"-I- PndSdsNoiseProducer: Intialisation successfull" << std::endl;
 
  120         for (
int i = 0; 
i < sensorNames->GetEntries(); 
i++){
 
  121                 TString volname = ((TObjString*)(sensorNames->At(
i)))->GetString();
 
  122                 if(volname.Contains(
"Active"))
 
  126                   if(volname.Contains(
"Pixel"))
 
  128         if(volname.Contains(
"4x1")) 
fPixelIds4.push_back(
i);
 
  129         if(volname.Contains(
"6x1")) 
fPixelIds6.push_back(
i);
 
  130         if(volname.Contains(
"4x2")) 
fPixelIds8.push_back(
i);
 
  169   FairRun* ana = FairRun::Instance();
 
  170   FairRuntimeDb* 
rtdb=ana->GetRuntimeDb();
 
  175   Info(
"SetParContainers",
"done.");
 
  204   chanmax = nrCh * nrFE * nrSensors;
 
  207   chanwhite = gRandom->Poisson(xfrac*chanmax);
 
  208   if(
fVerbose>1) std::cout << 
"-I- PndSdsNoiseProducer: RECT xfrac = " << xfrac
 
  209     << 
" leading to " << chanwhite << 
" noisy digis of " << chanmax
 
  210     << 
" total channels" << std::endl;
 
  211   for(Int_t 
i = 0;
i < chanwhite;
i++)
 
  214     rnd = gRandom->Integer(chanmax);
 
  215     sens = rnd/(nrFE*nrCh);
 
  216     rnd = rnd % (nrFE*nrCh);
 
  229   chanmax = nrCh * nrFE * nrSensors;
 
  231   chanwhite = gRandom->Poisson(xfrac*chanmax);
 
  232   if(
fVerbose>1) std::cout << 
"-I- PndSdsNoiseProducer: TRAP xfrac = " << xfrac
 
  233     << 
" leading to " << chanwhite << 
" noisy digis of " << chanmax
 
  234     << 
" total channels" << std::endl;
 
  235   for(Int_t 
i = 0;
i < chanwhite;
i++)
 
  237     rnd = gRandom->Integer(chanmax);
 
  238     sens = rnd/(nrFE*nrCh);
 
  239     rnd = rnd % (nrFE*nrCh);
 
  250   chanmax = nrCh * nrFE;
 
  252   chanwhite = gRandom->Poisson(xfrac*chanmax);
 
  253   if(
fVerbose>1) std::cout << 
"-I- PndSdsNoiseProducer: PIXEL xfrac = " << xfrac
 
  254     << 
" leading to " << chanwhite << 
" noisy digis of " << chanmax
 
  255     << 
" total channels" << std::endl;
 
  256   for(Int_t 
i = 0;
i < chanwhite;
i++)
 
  259     rnd = gRandom->Integer(chanmax);
 
  297     std::cout <<
"-I- PndSdsNoiseProducer: Noise produced\t" 
  298     <<nNoisyStripRects <<
"xStripRect\t" 
  299     <<nNoisyStripTraps <<
"xStripTrap\t" 
  300     <<nNoisyPixels <<
"xPixels"<<std::endl;
 
  309   return 0.5*TMath::Erfc( threshold / (TMath::Sqrt2()*spread) );
 
  326   temp = TMath::Gaus(threshold,0,spread);
 
  327   temp = gRandom->Uniform(0.,temp);
 
  328   temp = -2.*spread*spread*
log(temp);
 
  340   for(Int_t kstr = 0; kstr < iStrip && found == kFALSE; kstr++)
 
  345         aDigi->
GetFE() == fe &&
 
  355     std::vector<Int_t> indices;
 
  356     indices.push_back(iPoint);
 
  357           FairMCEventHeader* MCevtHeader = (FairMCEventHeader*)FairRootManager::Instance()->GetObject(
"MCEventHeader.");
 
  358     new ((*fDigiStripArray)[iStrip]) 
PndSdsDigiStrip(indices,detID,sensorID,fe,chan,charge, MCevtHeader->GetT()) ;
 
  361       << 
" -I- PndSdsNoiseProducer: Added StripTrap Digi at: FE=" << fe
 
  362       << 
", channel=" << chan << 
", charge=" << charge<< 
" e" 
  363       << 
", in sensor \n" << sensorID <<std::endl;
 
  374   for(Int_t kstr = 0; kstr < iPix && found == kFALSE; kstr++)
 
  379         aDigi->
GetFE() == fe &&
 
  389           std::vector<Int_t> indices;
 
  390           indices.push_back(iPoint);
 
  391           FairMCEventHeader* MCevtHeader = (FairMCEventHeader*)FairRootManager::Instance()->GetObject(
"MCEventHeader.");
 
  393     new ((*fDigiPixelArray)[iPix]) 
PndSdsDigiPixel(indices,detID,sensorID,fe,col,row,charge, MCevtHeader->GetT()) ;
 
  396       << 
" -I- PndSdsNoiseProducer: Added Pixel Digi at: FE=" << fe
 
  397       << 
", col|row = ("<<col<<
"|"<<row<< 
"), charge=" << charge<< 
" e" 
  398       << 
", in sensor \n" << sensorID <<std::endl;
 
Int_t GetPixelRow() const 
Int_t GetSensorID() const 
virtual void AddIndex(int index)
void DiveDownNode(TGeoNode *fN)
PndSdsPixelDigiPar * fDigiParPix
friend F32vec4 sqrt(const F32vec4 &a)
void AddCharge(double charge)
Int_t GetPixelColumn() const 
virtual void SetParContainers()
Class for digitised strip hits. 
void AddDigiPixel(Int_t &noisies, Int_t iPoint, Int_t sensorID, Int_t fe, Int_t col, Int_t row, Double_t charge)
friend F32vec4 log(const F32vec4 &a)
void SetPersistency(Bool_t val=kTRUE)
Double_t GetNoise() const 
virtual InitStatus Init()
Double_t GetThreshold() const 
PndSdsStripDigiPar * fDigiParTrap
TClonesArray * fDigiPixelArray
std::vector< Int_t > fPixelIds8
void AddDigiStrip(Int_t &iStrip, Int_t iPoint, Int_t sensorID, Int_t fe, Int_t chan, Double_t charge)
Double_t GetNoise() const 
std::vector< Int_t > fStripRectIds
Digitization Parameter Class for MVD-Strip part. 
TClonesArray * fDigiStripArray
virtual void Exec(Option_t *opt)
TObjArray * GetSensorNames()
Double_t CalcDistFraction(Double_t spread, Double_t threshold)
std::vector< Int_t > fStripTrapIds
static PndGeoHandling * Instance()
virtual void SetBranchNames()=0
PndSdsStripDigiPar * fDigiParRect
virtual void SetParContainers()
std::vector< Int_t > fPixelIds6
Data class to store the digi output of a pixel module. 
std::vector< Int_t > fPixelIds12
virtual ~PndSdsNoiseProducer()
std::vector< Int_t > fPixelIds4
Geometry name handling. 
Int_t CalcChargeAboveThreshold(Double_t spread, Double_t threshold)
Double_t GetThreshold() const 
Digitization Parameter Class for SDS-Pixel part.