]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSPreprocessorSSD.cxx
Changes to obey coding conventions
[u/mrichter/AliRoot.git] / ITS / AliITSPreprocessorSSD.cxx
index 5a72d02e2fb8716849d612c2ed201e6b0847f034..cf6c0ac82102befd31a41a5c31a8d65eb064daa6 100644 (file)
@@ -8,9 +8,9 @@
 #include <TObjString.h>
 
 #include "AliITSRawStreamSSD.h"
-#include "AliITSNoiseSSD.h"
-#include "AliITSPedestalSSD.h"
-#include "AliITSBadChannelsSSD.h"
+#include "AliITSNoiseSSDv2.h"
+#include "AliITSPedestalSSDv2.h"
+#include "AliITSBadChannelsSSDv2.h"
 #include <Riostream.h>
 
 
@@ -58,11 +58,17 @@ UInt_t AliITSPreprocessorSSD::Process(TMap* /*dcsAliasMap*/)
   // Note. To be modified: dcsAliasMap is not needed but I can not get rid
   // of it unless the base class AliPreprocessor is modified accordingly.
 
-  TObjArray calib_array(fgkNumberOfSSD); 
-  TObjArray badch_array(fgkNumberOfSSD); 
-  TObjArray ped_array(fgkNumberOfSSD); 
+  //  TObjArray calib_array(fgkNumberOfSSD); 
+  //TObjArray badch_array(fgkNumberOfSSD); 
+  //TObjArray ped_array(fgkNumberOfSSD); 
   //Float_t noise=0, gain=0;
   
+  //---------------------------------------
+  // initialize the calibration objects
+  AliITSNoiseSSDv2 *calib = new AliITSNoiseSSDv2();
+  AliITSBadChannelsSSDv2 *badch = new AliITSBadChannelsSSDv2();
+  AliITSPedestalSSDv2 *pedel = new AliITSPedestalSSDv2();
+  
   TString runType = GetRunType();
   if(runType == "ELECTRONICS_CALIBRATION_RUN") {
     
@@ -79,49 +85,6 @@ UInt_t AliITSPreprocessorSSD::Process(TMap* /*dcsAliasMap*/)
        TIter next(list);
        TObjString *ok;
        
-       //---------------------------------------
-       // in case some module was not calibrated!
-       for(Int_t i=0; i<fgkNumberOfSSD; i++) {
-         AliITSNoiseSSD *calib = new AliITSNoiseSSD();
-         calib->SetMod((UShort_t) i+500);
-         calib->SetNNoiseP(768);
-         calib->SetNNoiseN(768);
-         // take a reasonable averaged value for the noise on P- and N-side strips
-         for(Int_t j=0; j<768; j++) {
-           calib->AddNoiseP(j,1000.);
-           calib->AddNoiseN(j,1000.);
-         }
-         calib_array.AddAt(calib,i);
-       }
-       //-----------------------------------------
-       //---------------------------------------
-       // in case some module was not calibrated!
-       for(Int_t i=0; i<fgkNumberOfSSD; i++) {
-         AliITSBadChannelsSSD *badch = new AliITSBadChannelsSSD();
-         badch->SetMod((UShort_t) i+500);
-         badch->SetNBadPChannelsList(768);
-         badch->SetNBadNChannelsList(768);
-         badch_array.AddAt(badch,i);
-       }
-       //-----------------------------------------
-       
-       //---------------------------------------
-       // in case some module was not calibrated!
-       for(Int_t i=0; i<fgkNumberOfSSD; i++) {
-         AliITSPedestalSSD *pedel = new AliITSPedestalSSD();
-         pedel->SetMod((UShort_t) i+500);
-         pedel->SetNPedestalP(768);
-         pedel->SetNPedestalN(768);
-         for(Int_t j=0; j<768; j++) {
-           pedel->AddPedestalP(j,0.);
-           pedel->AddPedestalN(j,0.);
-         }
-         ped_array.AddAt(pedel,i);
-       }
-       //-----------------------------------------
-       
-       
-       
        // expect to iterate 3 times (LDC0, LDC1, LDC2)
        while ( (ok = (TObjString*) next()) ) {                               
          
@@ -139,49 +102,47 @@ UInt_t AliITSPreprocessorSSD::Process(TMap* /*dcsAliasMap*/)
                return 2;
            }
            
-           TObjArray *cal; 
-           f->GetObject("Noise;1", cal); 
+           AliITSNoiseSSDv2 *cal; 
+           f->GetObject("AliITSNoiseSSDv2;1", cal); 
            if(!cal) {
                Log("File does not contain expected data for the noise!");
                delete list;
                return 3;
            }       
-
-           Int_t nmod = cal->GetEntries();
-           Log(Form("\n#Mod %d", nmod ));
-           for(Int_t mod=0; mod<nmod; mod++) {
-             AliITSNoiseSSD *calib = (AliITSNoiseSSD*) cal->At(mod);
-             Log(Form("\nModId %d", calib->GetMod() ));
-             if((calib->GetMod()<500)||(calib->GetMod()>2198)) continue;
-             calib_array.AddAt(calib,calib->GetMod()-500);
-           }
-
-           TObjArray *bad; 
-           f->GetObject("BadChannels;1", bad); 
+           AliITSPedestalSSDv2 *ped;
+           f->GetObject("AliITSPedestalSSDv2;1", ped); 
+           if(!ped) {
+               Log("File does not contain expected data for the pedestals!");
+               delete list;
+               return 5;
+           }       
+           AliITSBadChannelsSSDv2 *bad;
+           f->GetObject("AliITSBadChannelsSSDv2;1", bad); 
            if(!bad) {
                Log("File does not contain expected data for bad channels  !");
                delete list;
                return 4;
            }       
-           nmod = bad->GetEntries();
-           for(Int_t mod=0; mod<nmod; mod++) {
-             AliITSBadChannelsSSD *badch = (AliITSBadChannelsSSD*) bad->At(mod);
-             if((badch->GetMod()<500)||(badch->GetMod()>2198)) continue;
-             badch_array.AddAt(badch,badch->GetMod()-500);
-           }
 
-           TObjArray *ped; 
-           f->GetObject("Pedestal;1", ped); 
-           if(!ped) {
-               Log("File does not contain expected data for the pedestals!");
-               delete list;
-               return 5;
-           }       
-           nmod = ped->GetEntries();
-           for(Int_t mod=0; mod<nmod; mod++) {
-             AliITSPedestalSSD *pedel = (AliITSPedestalSSD*) ped->At(mod);
-             if((pedel->GetMod()<500)||(pedel->GetMod()>2198)) continue;
-             ped_array.AddAt(pedel,pedel->GetMod()-500);
+           for(Int_t module=0; module<fgkNumberOfSSD; module++) {
+             for(Int_t strip=0; strip<768; strip++) {
+               if(cal->GetNoiseP(module,strip)) 
+                 calib->AddNoiseP(module,strip,cal->GetNoiseP(module,strip));
+               if(cal->GetNoiseN(module,strip)) 
+                 calib->AddNoiseN(module,strip,cal->GetNoiseN(module,strip));
+               if(ped->GetPedestalP(module,strip)) 
+                 pedel->AddPedestalP(module,strip,
+                                     ped->GetPedestalP(module,strip));
+               if(ped->GetPedestalN(module,strip)) 
+                 pedel->AddPedestalN(module,strip,
+                                     ped->GetPedestalN(module,strip));
+               if(bad->GetBadChannelP(module,strip)) 
+                 badch->AddBadChannelP(module,strip,
+                                        bad->GetBadChannelP(module,strip));
+               if(bad->GetBadChannelN(module,strip)) 
+                 badch->AddBadChannelN(module,strip,
+                                        bad->GetBadChannelN(module,strip));
+             }
            }
 
            f->Close(); delete f;           
@@ -200,23 +161,23 @@ UInt_t AliITSPreprocessorSSD::Process(TMap* /*dcsAliasMap*/)
          return 7;
       } // if list
     
-      //Now we have to store the final CDB file
-      AliCDBMetaData metaData;
-      metaData.SetBeamPeriod(0);
-      metaData.SetResponsible("Enrico Fragiacomo");
-      metaData.SetComment("Fills noise, pedestal and bad channels TObjArray");
-  
-      if(!Store("Calib", "NoiseSSD", &calib_array, &metaData, 0, 1)) {
+    //Now we have to store the final CDB file
+    AliCDBMetaData metaData;
+    metaData.SetBeamPeriod(0);
+    metaData.SetResponsible("Enrico Fragiacomo");
+    metaData.SetComment("Fills noise, pedestal and bad channels TObjArray");
+    
+      if(!Store("Calib", "NoiseSSD", (TObject *)calib, &metaData, 0, 1)) {
        Log("no store");
         return 1;
       }  
       
-      if(!Store("Calib", "BadChannelsSSD", &badch_array, &metaData, 0, 1)) {
+      if(!Store("Calib", "BadChannelsSSD", (TObject*)badch, &metaData, 0, 1)) {
        Log("no store");
         return 1;
       }  
       
-      if(!StoreReferenceData("Calib","PedestalSSD", &ped_array, &metaData)) {
+      if(!StoreReferenceData("Ref","PedestalSSD",  (TObject*)pedel, &metaData)) {
        Log("no store");
        return 1;
       }