- // for (Int_t rows=0;rows<nrows; rows++){
- // for (Int_t col=0;col<ncols; col++){
- for (Int_t elem=0;elem<nElems; elem++){
- //for (Int_t elem=nElems;elem<nElems; elem++){
-
- q=0;
- labptr=0;
- // looop over digits
- for (Int_t i=0;i<nInputs; i++){
- // q += digarr[i]->GetDigitFast(rows,col);
- q += *(pdig[i]);
-
- for (Int_t tr=0;tr<3;tr++) {
- // Int_t lab = digarr[i]->GetTrackIDFast(rows,col,tr);
- Int_t lab = ptr[i][tr*nElems];
- if ( (lab > 1) && *(pdig[i])>zerosup) {
- label[labptr]=lab+masks[i];
- labptr++;
- }
- }
- pdig[i]++;
- ptr[i]++;
-
- }
- q/=16.; //conversion factor
- // Float_t noise = gRandom->Gaus(0,param->GetNoise()*param->GetNoiseNormFac());
- Float_t noise = pTPC->GetNoise();
- q+=noise;
+ for (Int_t elem=0;elem<nElems; elem++)
+ {
+
+ q=0;
+ labptr=0;
+ // looop over digits
+ for (Int_t i=0;i<nInputs; i++) if (active[i])
+ {
+ // q += digarr[i]->GetDigitFast(rows,col);
+ q += *(pdig[i]);
+
+ for (Int_t tr=0;tr<3;tr++)
+ {
+ // Int_t lab = digarr[i]->GetTrackIDFast(rows,col,tr);
+ Int_t lab = ptr[i][tr*nElems];
+ if ( (lab > 1) && *(pdig[i])>zerosup)
+ {
+ label[labptr]=lab+masks[i];
+ labptr++;
+ }
+ }
+ pdig[i]++;
+ ptr[i]++;
+ }
+ q/=16.; //conversion factor
+ Float_t gain = gainROC->GetValue(row,elem/nrows); // get gain for given - pad-row pad
+ //if (gain<0.5){
+ //printf("problem\n");
+ //}
+ q*= gain;
+ Float_t noisePad = noiseROC->GetValue(row,elem/nrows);
+ // Float_t noise = gRandom->Gaus(0,param->GetNoise()*param->GetNoiseNormFac());
+ Float_t noise = pTPC->GetNoise();
+ q+=noise*noisePad;