]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- introduce IsBad() virtual method in AliITSCalibration to check the status
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 Feb 2008 17:05:18 +0000 (17:05 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 Feb 2008 17:05:18 +0000 (17:05 +0000)
of an entire module
- introduce IsChipBad(Int_t) virtual method in AliITSCalibration to check the
status of a chip
- implementation of these methods for SDD
- new chip numberig scheme (0-7) instead of (2 x 0-3) in SDD calibration class
- minor modifications in AliITStrackerMI and AliITSsimulationSDD to comply
with new naming scheme

ITS/AliITSCalibration.h
ITS/AliITSCalibrationSDD.cxx
ITS/AliITSCalibrationSDD.h
ITS/AliITSCalibrationSPD.h
ITS/AliITSPreprocessorSDD.cxx
ITS/AliITSsimulationSDD.cxx
ITS/AliITStrackerMI.cxx
ITS/Calib/CalibSDD/Run0_9999999_v0_s0.root
ITS/StoreCalibSDD.C

index 4acd23ea66d9cf69a780cb45af68f94aa25cf63a..3e2131a875e78d3f7f5c0f074aced55f2fcaed28 100644 (file)
@@ -3,7 +3,7 @@
 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  * See cxx source for full Copyright notice                               */
 
-/* $Id:$ */
+/* $Id$ */
 
 //////////////////////////////////////////////
 // Base ITS calibration class               //
@@ -34,6 +34,11 @@ class AliITSCalibration : public TObject {
 
     // Destructor.
     virtual ~AliITSCalibration() {;}
+
+    // Check for dead modules anche chips
+    // Return 1 if the module/chip is dead, 0 if it is ok
+    virtual Bool_t IsBad() const {AliError("This method must be implemented in a derived class"); return kFALSE;}
+    virtual Bool_t IsChipBad(Int_t) const {AliError("This method must be implemented in a derived class"); return kFALSE;}
     //
     // Configuration methods
     //
index d7ae5a0aad01faa966730845fcda1c7197fd653a..c84138c67554ed5aa2727e8e1dd3023cd3775255 100644 (file)
@@ -41,7 +41,7 @@ AliITSCalibration(),
 fDeadChips(0),
 fDeadChannels(0),
 fMinVal(fgkMinValDefault),
-fIsDead(kFALSE),
+fIsBad(kFALSE),
 fBadChannels(),
 fUseACorrMap(0),
 fUseTCorrMap(0),
@@ -58,12 +58,13 @@ fDrSpeed1(0)
   for(Int_t ian=0;ian<fgkWings*fgkChannels*fgkChips;ian++){
     fBaseline[ian]=fgkBaselineDefault;
     fNoise[ian]=fgkNoiseDefault;
+    fGain[ian]=1.;
     SetNoiseAfterElectronics(ian);
   }
   for(Int_t iw=0;iw<fgkWings;iw++){
     for(Int_t icp=0;icp<fgkChips;icp++){
-      for(Int_t ich=0;ich<fgkChannels;ich++)
-       fGain[iw][icp][ich]=1.;
+      Int_t chipindex=iw*fgkChips+icp;
+      fIsChipBad[chipindex]=kFALSE;
     }
   }
   SetThresholds(fgkMinValDefault,0.);
@@ -77,7 +78,7 @@ AliITSCalibration(),
 fDeadChips(0),
 fDeadChannels(0),
 fMinVal(fgkMinValDefault),
-fIsDead(kFALSE),
+fIsBad(kFALSE),
 fBadChannels(),
 fUseACorrMap(0),
 fUseTCorrMap(0),
@@ -93,13 +94,14 @@ fDrSpeed1(0)
   SetDeadChannels();
   for(Int_t ian=0;ian<fgkWings*fgkChannels*fgkChips;ian++){
     fBaseline[ian]=fgkBaselineDefault;
-      fNoise[ian]=fgkNoiseDefault;
-      SetNoiseAfterElectronics(ian);
+    fNoise[ian]=fgkNoiseDefault;
+    fGain[ian]=1.;
+    SetNoiseAfterElectronics(ian);
   }  
   for(Int_t iw=0;iw<fgkWings;iw++){
     for(Int_t icp=0;icp<fgkChips;icp++){
-      for(Int_t ich=0;ich<fgkChannels;ich++)
-       fGain[iw][icp][ich]=1.;
+      Int_t chipindex=iw*fgkChips+icp;
+      fIsChipBad[chipindex]=kFALSE;
     }
   }
 
@@ -139,22 +141,8 @@ void AliITSCalibrationSDD::SetBadChannel(Int_t i,Int_t anode){
   //Set bad anode (set gain=0 for these channels);
 
   if(anode<0 || anode >fgkChannels*fgkChips*fgkWings-1)AliError("Wrong anode number");
-  Int_t wing=0;
-  Int_t chip,channel;
-  chip=anode/fgkChannels;
-  channel=anode-(chip*fgkChannels);
-  if(anode>=fgkChips*fgkChannels) wing=1;
-  if(wing==1)chip-=fgkChips;
   fBadChannels[i]=anode;
-  fGain[wing][chip][channel]=0;
-}
-//______________________________________________________________________
-Float_t AliITSCalibrationSDD::GetChannelGain(Int_t anode) const{
-  // returns gain for givenanode
-  Int_t iWing=GetWing(anode);
-  Int_t iChip=GetChip(anode);
-  Int_t iChan=GetChipChannel(anode);
-  return fGain[iWing][iChip][iChan];
+  fGain[anode]=0;
 }
 //______________________________________________________________________
 void AliITSCalibrationSDD::GetCorrections(Float_t z, Float_t x, Float_t &devz, Float_t &devx, AliITSsegmentationSDD* seg){
@@ -172,91 +160,6 @@ void AliITSCalibrationSDD::GetCorrections(Float_t z, Float_t x, Float_t &devz, F
   }
   return;
 }
-/*
-//______________________________________________________________________
-void AliITSCalibrationSDD::SetDeadChannels(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<fgkWings; m++ ) 
-    for( Int_t n=0; n<fgkChips; n++ ) 
-      for( Int_t p=0; p<fgkChannels; p++ ) 
-       fGain[m][n][p] = 1.;
-                 
-  //fDeadModules  = nmod;  
-  fDeadChips    = nchip;  
-  fDeadChannels = nchan; 
-  fBadChannels.Set(fDeadChannels);  
-  // nothing to do
-  //if( nmod == 0 && nchip == 0 && nchan == 0 ) return;
-
-  if( nchip == 0 && nchan == 0 ) return;
-  // if( nmod < 0 || nmod > fgkModules ) 
-  //  { 
-  //    cout << "Wrong number of dead modules: " << nmod << endl; 
-  //    return; 
-  //  }
-  
-  Int_t nmax = fgkWings*fgkChips; 
-  if( nchip < 0 || nchip > nmax ) 
-    { 
-      cout << "Wrong number of dead chips: " << nchip << endl; 
-      return; 
-    }
-  nmax = (fgkWings*fgkChips - nchip)*fgkChannels; 
-  if( nchan < 0 || nchan > nmax ) 
-    { 
-      cout << "Wrong number of dead channels: " << nchan << endl; 
-      return; 
-    }
-  
-  TRandom *gran = new TRandom();
-  //  cout << "chips" << endl;
-  Int_t * chip     = new Int_t[nchip];
-  Int_t i = 0;
-  while( i < nchip ) 
-    {
-      Int_t wing = (Int_t) (fgkWings*gran->Uniform() + 1.);
-      if( wing <=0 || wing > fgkWings ) Error("SetDeadChannels","Wrong wing");
-        
-      Int_t chi = (Int_t) (fgkChips*gran->Uniform() + 1.);
-      if( chi <=0 || chi > fgkChips ) Error("SetDeadChannels","Wrong chip:%d\n",chi);
-      i++;
-      chip[i-1] = chi; 
-      for( Int_t m=0; m<fgkChannels; m++ ) 
-       fGain[wing-1][chi-1][m] = 0.;
-    }
-
-  Int_t * channel      = new Int_t[nchan];
-  Int_t * channelChip = new Int_t[nchan];
-  i = 0;
-  while( i < nchan ) 
-    {
-      Int_t k; //loop variable
-      Int_t wing = (Int_t) (fgkWings*gran->Uniform() + 1.);
-      if( wing <=0 || wing > fgkWings ) Error("SetDeadChannels","Wrong wing:%d\n",wing);
-      Int_t chipp = (Int_t) (fgkChips*gran->Uniform() + 1.);
-      if( chipp <=0 || chipp > fgkChips ) Error("SetDeadChannels","Wrong chip:%d",chipp);
-      Int_t flagChip = 0;
-      for( k=0; k<nchip; k++) 
-       if( chipp == chip[k] ) { 
-         flagChip = 1; break; }
-      if( flagChip == 1 ) continue;
-      i++;
-      channel[i-1] = (Int_t) (fgkChannels*gran->Uniform() + 1.); 
-      if( channel[i-1] <=0 || channel[i-1] > fgkChannels ) 
-       Error("SetDeadChannels","Wrong channel:%d\n",channel[i-1]);
-      channelChip[i-1] = chipp;
-      fGain[wing-1][chipp-1][channel[i-1]-1] = 0.;
-    }
-    
-  delete [] chip;
-  delete [] channel;
-  delete [] channelChip;
-}
-*/
-
-
 //______________________________________________________________________
 void AliITSCalibrationSDD::PrintGains() const{
   //
@@ -271,14 +174,9 @@ void AliITSCalibrationSDD::PrintGains() const{
   cout << "**************************************************" << endl;
 
   // Print SDD electronic gains
-  for(Int_t t=0; t<fgkWings;t++)
-    for(Int_t u=0; u<fgkChips;u++)
-      for(Int_t v=0; v<fgkChannels;v++)
-       {
-         if( fGain[t][u][v] != 1.0 )
-           cout << "Gain for wing: " << t+1 << ", Chip " << u+1 << 
-             ", Channel " << v+1 << " = " << fGain[t][u][v] << endl;
-       }
+  for(Int_t ian=0; ian<fgkWings*fgkChips*fgkChannels;ian++){
+    printf("Gain for channel %d = %f\n",ian,fGain[ian]);
+  }
 }
 
 //______________________________________________________________________
index 1123ba9d47b77a8c2470665861397ca9cfd0e731..c89d20c5d83b6363a4c3a1108706a789808cbebd 100644 (file)
@@ -55,21 +55,23 @@ class AliITSCalibrationSDD : public AliITSCalibration {
     void SetDeadChannels(Int_t ndead=0){fDeadChannels=ndead; fBadChannels.Set(ndead);}
     Int_t GetDeadChips() const { return fDeadChips; }
     Int_t GetDeadChannels() const { return fDeadChannels; }
-    Float_t Gain(Int_t wing,Int_t chip,Int_t ch)const 
-        {return fGain[wing][chip][ch]; }
-    Float_t GetChannelGain(Int_t anode) const;
-    virtual void SetGain(Double_t g,Int_t wing,Int_t chip, Int_t ch) 
-      {fGain[wing][chip][ch]=g;}
+    Float_t GetChannelGain(Int_t anode) const {return fGain[anode];}
+    virtual void SetGain(Int_t anode,Double_t g){fGain[anode]=g;}
+
     
     Int_t GetWing(Int_t anode) const{
       if(anode>=fgkChips*fgkChannels) return 1;
       else return 0;
     }
     Int_t GetChipChannel(Int_t anode) const {return anode%fgkChannels;}
-    Int_t GetChip(Int_t anode) const {
-      Int_t chip=anode/fgkChannels;
-      if(GetWing(anode)==1)chip-=fgkChips;
-      return chip;
+    Int_t GetChip(Int_t anode) const {return anode/fgkChannels;}
+    Int_t GetAnodeNumber(Int_t iwing, Int_t ichip03, Int_t ichan) const {
+      if(iwing>=2 || ichip03>=4 || ichan>=64) return -1;
+      else return iwing*fgkChips*fgkChannels+ichip03*fgkChannels+ichan;
+    }
+    Int_t GetAnodeNumber(Int_t ichip07, Int_t ichan) const {
+      if(ichip07>=8 || ichan>=64) return -1;
+      else return ichip07*fgkChannels+ichan;
     }
     
     void    PrintGains() const;
@@ -90,8 +92,17 @@ class AliITSCalibrationSDD : public AliITSCalibration {
     virtual void    SigmaSpread(Double_t & /* p1 */,Double_t & /* p2 */) const 
       {NotImplemented("SigmaSpread");}
 
-    void   SetDead() { fIsDead = kTRUE; };
-    Bool_t IsDead() const { return fIsDead; };
+    void   SetBad() { 
+      fIsBad = kTRUE; 
+      for(Int_t i=0;i<fgkChips*fgkWings;i++) fIsChipBad[i]=kTRUE;
+    }
+    virtual Bool_t IsBad() const { return fIsBad; }
+    void   SetChipBad(Int_t nChip) { 
+      fIsChipBad[nChip] = kTRUE; 
+    }
+    virtual Bool_t IsChipBad(Int_t nChip) const { 
+      return fIsChipBad[nChip]; 
+    }
     Int_t Wings()const{return fgkWings;}//Total number of SDD wings
     Int_t Chips() const{return fgkChips;} // Number of chips/module
     Int_t Channels() const{ return fgkChannels;}//Number of channels/chip
@@ -178,14 +189,15 @@ class AliITSCalibrationSDD : public AliITSCalibration {
 
     Int_t fDeadChips;                     // Number of dead chips
     Int_t fDeadChannels;                  // Number of dead channels
-    Float_t fGain[fgkWings][fgkChips][fgkChannels];//Array for channel gains
+    Float_t fGain[fgkWings*fgkChips*fgkChannels];           //Array for channel gains
     Float_t fNoise[fgkWings*fgkChips*fgkChannels];          // Noise array
     Float_t fBaseline[fgkWings*fgkChips*fgkChannels];       // Baseline array
     Float_t fNoiseAfterEl[fgkWings*fgkChips*fgkChannels];   // Noise after electronics
     Float_t fMinVal;        // Min value used in 2D zero-suppression algo
 
-    Bool_t   fIsDead;  // module is dead or alive ?
-    TArrayI  fBadChannels; //Array with bad anodes number (0-512) 
+    Bool_t   fIsBad;                         // module is dead or alive ?
+    Bool_t   fIsChipBad[fgkWings*fgkChips];  // chip is dead or alive ?
+    TArrayI  fBadChannels;                   //Array with bad anodes number (0-512) 
 
     
     Bool_t fUseACorrMap;    // flag for the use of correction maps (anode)
@@ -203,7 +215,7 @@ class AliITSCalibrationSDD : public AliITSCalibration {
     AliITSCalibrationSDD& operator=(const AliITSCalibrationSDD & /* source */); // ass. op.
 
 
-    ClassDef(AliITSCalibrationSDD,9) // SDD response 
+    ClassDef(AliITSCalibrationSDD,10) // SDD response 
     
     };
 #endif
index 60834aeacf6b3bdc43ea5c95801cd2742c10bb26..6200dd28234479c172b8bdf3d3a1be24ba716d4f 100644 (file)
@@ -81,7 +81,7 @@ class AliITSCalibrationSPD :  public AliITSCalibration {
 
     void   SetBadList(TArrayI badlist) {fBadChannels=badlist;}
     void   SetNrBad(UInt_t nr) {fNrBad=nr;}
-    Bool_t IsBad() const {return (GetNrBad()==256*160);};
+    virtual Bool_t IsBad() const {return (GetNrBad()==256*160);};
 
  protected:
     // static const Double_t fgkDiffCoeffDefault; //default for fDiffCoeff
index 8f727960ae8e919edf2f4ffbd0b22ef1ef73f646..d3eb4da280e2c797d3467e0272fa640df117d5f9 100644 (file)
@@ -108,11 +108,10 @@ UInt_t AliITSPreprocessorSDD::Process(TMap* dcsAliasMap){
          FILE* basFil = fopen(inpFileName,"read");
          if (basFil == 0) {
            Log(Form("File %s not found.",inpFileName));
-           cal->SetDead();
-           continue;
+           return 2;
          }
          fscanf(basFil,"%d %d %d\n",&im,&is,&isgoodmod);
-         if(!isgoodmod) cal->SetDead();
+         if(!isgoodmod) cal->SetBad();
          for(Int_t ian=0;ian<(kNumberOfChannels/2);ian++){
            fscanf(basFil,"%d %d %f %d %d %f %f %f %f\n",&i,&isgoodan,&baseline,&basmin,&basoff,&rawnoise,&cmn,&corn,&gain);
            Int_t ich=ian;
@@ -124,9 +123,7 @@ UInt_t AliITSPreprocessorSDD::Process(TMap* dcsAliasMap){
            }
            cal->SetBaseline(ich,baseline);
            cal->SetNoiseAfterElectronics(ich,rawnoise);
-           Int_t iChip=cal->GetChip(ich);
-           Int_t iChInChip=cal->GetChipChannel(ich);
-           cal->SetGain(gain,isid,iChip,iChInChip);
+           cal->SetGain(ich,gain);
          }
          cal->SetDeadChannels(numOfBadChannels[modID]);
          for(Int_t ibad=0;ibad<numOfBadChannels[modID];ibad++){
@@ -139,7 +136,7 @@ UInt_t AliITSPreprocessorSDD::Process(TMap* dcsAliasMap){
     }
     md1->SetObjectClassName("AliITSCalibration");
     retcode = Store("Calib","CalibSDD",&calSDD,md1, 0, kTRUE);
-  }else if(runType== "INJECTOR"){
+  }else if(runType == "PHYSICS" || runType== "INJECTOR"){
 
     TObjArray vdrift(2*kNumberOfSDD);
     vdrift.SetOwner(kFALSE);
@@ -177,10 +174,7 @@ UInt_t AliITSPreprocessorSDD::Process(TMap* dcsAliasMap){
          FILE* injFil = fopen(inpFileName,"read");
          if (injFil == 0) {
            Log(Form("File %s not found.",inpFileName));
-           AliITSDriftSpeedSDD *dsp=new AliITSDriftSpeedSDD();
-           arr->AddDriftSpeed(dsp);
-           vdrift.AddAt(arr,2*modID+isid);
-           continue; 
+           return 2;
          }
          fscanf(injFil,"%d",&polDeg);
          while (!feof(injFil)){
index 182b3df1e8b8b2118c655188106aa2f2a9934020..bddc8383275d113ab61c71035b9561502244bed3 100644 (file)
@@ -748,7 +748,11 @@ void AliITSsimulationSDD::ChargeToSignal(Int_t mod,Bool_t bAddNoise, Bool_t bAdd
     baseline = res->GetBaseline(i);
     noise = res->GetNoise(i);
     gain = res->GetChannelGain(i);
-    if(res->IsDead()) gain=0;
+    if(res->IsBad()) gain=0.;
+    if( res->IsChipBad(res->GetChip(i)) ){ 
+      printf("Chip bad mod %d  chip %d anode %d\n",mod,res->GetChip(i),i);
+      gain=0.;
+    }
     for(k=0; k<fScaleSize*fMaxNofSamples; k++) {
       fInZR[k]  = fHitMap2->GetSignal(i,k);
       if(bAddGain) fInZR[k]*=gain;
index d7612b7fcfd687a14c45e475eaf0447b821de86a..b6cdb690d64795ec7bced991320c6c0bbab70304 100644 (file)
@@ -4890,7 +4890,7 @@ Int_t AliITStrackerMI::CheckDeadZone(/*AliITStrackMI *track,*/
     if(ilayer==3) idet += AliITSgeomTGeo::GetNLadders(3)*AliITSgeomTGeo::GetNDetectors(3);
     //printf("SDD det: %d\n",idet);
     AliITSCalibrationSDD *calibSDD = (AliITSCalibrationSDD*)sddEntry->At(idet);
-    if (calibSDD->IsDead()) return 2;
+    if (calibSDD->IsBad()) return 2;
   } else if (ilayer==4 || ilayer==5) { // SSD
   } else {
     Error("CheckDeadZone","Wrong layer number\n");
index 71938e6e82bb8f59da2f24c241aede211b006d20..4df977e11a381c36556f2a64076b8cd2ff0895d7 100644 (file)
Binary files a/ITS/Calib/CalibSDD/Run0_9999999_v0_s0.root and b/ITS/Calib/CalibSDD/Run0_9999999_v0_s0.root differ
index d94ed93c44ad0d576d4495a2656254e1d1018a20..a97972c14194686486d9c279db49338048745c72 100644 (file)
@@ -11,7 +11,7 @@
 #include <TRandom3.h>
 #endif
 
-void StoreCalibSDD(Int_t firstRun=0,Int_t lastRun=9999999 ){
+void StoreCalibSDD(Int_t firstRun=0,Int_t lastRun=9999999, Int_t lastRunResp=999999999 ){
   ///////////////////////////////////////////////////////////////////////
   // Macro to generate and store the calibration files for SDD         //
   // Generates:                                                        //
@@ -48,7 +48,7 @@ void StoreCalibSDD(Int_t firstRun=0,Int_t lastRun=9999999 ){
 
 
 
-  AliCDBId idRespSDD("ITS/Calib/RespSDD",firstRun, lastRun);
+  AliCDBId idRespSDD("ITS/Calib/RespSDD",firstRun, lastRunResp);
   AliITSresponseSDD* rd = new AliITSresponseSDD();
   const Int_t nData = 209;
   Int_t anodeUp[209] = {0,36,0,12,20,32,0,0,12,76,28,8,16,0,0,0,8,0,0,0,20,4,0,0,0,0,0,0
@@ -68,10 +68,6 @@ void StoreCalibSDD(Int_t firstRun=0,Int_t lastRun=9999999 ){
                          ,16,0,16,20,0,28,0,8,24,0,12,8,4,40,0,104,96,32,140,20,12,8,20,24,16,16,20
                          ,8,140,96,0,32,20,44};
 
-  Float_t drVelParam[4]={7.75,0.002344,-0.000009,0};
-  Float_t edrVelParam[4]={0,0,0,0};
-  Float_t drVel[4];
   TRandom3 *gran = new TRandom3();
   
   for(Int_t mod=0;mod<260;mod++){
@@ -89,7 +85,8 @@ void StoreCalibSDD(Int_t firstRun=0,Int_t lastRun=9999999 ){
        for(Int_t iChan=0; iChan<64;iChan++){
          Float_t gain=gran->Gaus(chipgain,0.01);
          if(gain<0.1) gain=0.1;
-         resd->SetGain(gain,iWing,iChip,iChan);
+         Int_t ian=resd->GetAnodeNumber(iWing,iChip,iChan);
+         resd->SetGain(ian,gain);
        }
       }
     }
@@ -141,7 +138,8 @@ void StoreCalibSDD(Int_t firstRun=0,Int_t lastRun=9999999 ){
     Int_t nSeToBad = 0;
     for (Int_t i=0; i<4; i++){
       for(Int_t j=0;j<64;j++){
-       if (resd->Gain(0,i,j)<0.0001) nSeToBad++;
+       Int_t ian=resd->GetAnodeNumber(0,i,j);
+       if (resd->GetChannelGain(ian)<0.0001) nSeToBad++;
       }
     }
     while (nSeToBad<nBadDown) {
@@ -189,7 +187,8 @@ void StoreCalibSDD(Int_t firstRun=0,Int_t lastRun=9999999 ){
     nSeToBad = 0;
     for (Int_t i=0; i<4; i++){
       for(Int_t j=0;j<64;j++){
-       if (resd->Gain(1,i,j)<0.0001) nSeToBad++;
+       Int_t ian=resd->GetAnodeNumber(1,i,j);
+       if (resd->GetChannelGain(ian)<0.0001) nSeToBad++;
       }
     }
 
@@ -215,7 +214,8 @@ void StoreCalibSDD(Int_t firstRun=0,Int_t lastRun=9999999 ){
     */
 
 
-    if(mod==88) resd->SetDead();
+    if(mod==88) resd->SetBad();
+    if(mod==202) for(Int_t ichip=0;ichip<4;ichip++) resd->SetChipBad(ichip);
     respSDD.Add(resd);
     printf("Added module %d\n",mod);
   }