+ cp[i]=fCPar[i];
+ } // end for i
+}
+//______________________________________________________________________
+void AliITSresponseSDD::SetDeadChannels(Int_t nmod, Int_t nchip, Int_t nchan){
+ // Set fGain to zero to simulate a random distribution of
+ // dead modules, dead chips and single dead channels
+
+ for( Int_t m=0; m<fModules; m++ )
+ for( Int_t n=0; n<fChips; n++ )
+ for( Int_t p=0; p<fChannels; p++ )
+ fGain[m][n][p] = 1.;
+
+ fDeadModules = nmod;
+ fDeadChips = nchip;
+ fDeadChannels = nchan;
+
+ // nothing to do
+ if( nmod == 0 && nchip == 0 && nchan == 0 ) return;
+
+ if( nmod < 0 || nmod > fModules )
+ {
+ cout << "Wrong number of dead modules: " << nmod << endl;
+ return;
+ }
+ Int_t nmax = (fModules-nmod)*fChips;
+ if( nchip < 0 || nchip > nmax )
+ {
+ cout << "Wrong number of dead chips: " << nchip << endl;
+ return;
+ }
+ nmax = ((fModules - nmod)*fChips - nchip)*fChannels;
+ if( nchan < 0 || nchan > nmax )
+ {
+ cout << "Wrong number of dead channels: " << nchan << endl;
+ return;
+ }
+
+ TRandom *gran = new TRandom();
+
+ // cout << "modules" << endl;
+ Int_t * mod = new Int_t [nmod];
+ Int_t i; //loop variable
+ for( i=0; i<nmod; i++ )
+ {
+ mod[i] = (Int_t) (1.+fModules*gran->Uniform());
+ cout << i+1 << ": Dead module nr: " << mod[i] << endl;
+ for(Int_t n=0; n<fChips; n++)
+ for(Int_t p=0; p<fChannels; p++)
+ fGain[mod[i]-1][n][p] = 0.;
+ }
+
+ // cout << "chips" << endl;
+ Int_t * chip = new Int_t[nchip];
+ Int_t * chip_mod = new Int_t[nchip];
+ i = 0;
+ while( i < nchip )
+ {
+ Int_t module = (Int_t) (fModules*gran->Uniform() + 1.);
+ if( module <=0 || module > fModules )
+ cout << "Wrong module: " << module << endl;
+ Int_t flag_mod = 0;
+ for( Int_t k=0; k<nmod; k++ )
+ if( module == mod[k] ) { flag_mod = 1; break; }
+ if( flag_mod == 1 ) continue;
+
+ Int_t chi = (Int_t) (fChips*gran->Uniform() + 1.);
+ if( chi <=0 || chi > fChips ) cout << "Wrong chip: " << chi << endl;
+ i++;
+ chip[i-1] = chi;
+ chip_mod[i-1] = module;
+ for( Int_t m=0; m<fChannels; m++ )
+ fGain[module-1][chi-1][m] = 0.;
+ cout << i << ": Dead chip nr. " << chip[i-1] << " in module nr: "
+ << chip_mod[i-1] << endl;