]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Merge Jens and Christian changes
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 5 Dec 2007 17:37:33 +0000 (17:37 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 5 Dec 2007 17:37:33 +0000 (17:37 +0000)
TPC/AliTPCCalibPedestal.cxx
TPC/AliTPCCalibPedestal.h
TPC/AliTPCRawStreamFast.cxx
TPC/TPCPEDESTALda.cxx

index 72ffa0e7867c5c9e17dbf1724a07ecb1a9928b59..802b427c356a82243d60310ce363b0699c7e6cce 100644 (file)
 #include "AliRawReaderRoot.h"
 #include "AliRawReaderDate.h"
 #include "AliTPCRawStream.h"
-#include "AliTPCRawStreamFast.h"
 #include "AliTPCCalROC.h"
 #include "AliTPCROC.h"
 #include "AliMathBase.h"
 #include "TTreeStream.h"
+#include "AliTPCRawStreamFast.h"
 
 //date
 #include "event.h"
@@ -208,6 +208,7 @@ AliTPCCalibPedestal::AliTPCCalibPedestal() : /*FOLD00*/
   fOldRCUformat(kTRUE),
   fTimeAnalysis(kFALSE),
   fROC(AliTPCROC::Instance()),
+  fMapping(NULL),
   fCalRocArrayPedestal(72),
   fCalRocArrayRMS(72),
   fHistoPedestalArray(72),
@@ -229,6 +230,7 @@ AliTPCCalibPedestal::AliTPCCalibPedestal(const AliTPCCalibPedestal &ped) : /*FOL
   fOldRCUformat(ped.fOldRCUformat),
   fTimeAnalysis(ped.fTimeAnalysis),
   fROC(AliTPCROC::Instance()),
+  fMapping(NULL),
   fCalRocArrayPedestal(72),
   fCalRocArrayRMS(72),
   fHistoPedestalArray(72),
@@ -286,6 +288,9 @@ AliTPCCalibPedestal::~AliTPCCalibPedestal() /*FOLD00*/
     delete [] fTimeSignal;
     fTimeSignal = 0;
   }
+
+  // do not delete fMapping, because we do not own it.
+
 }
 
 
@@ -345,7 +350,7 @@ Int_t AliTPCCalibPedestal::Update(const Int_t icsector, /*FOLD00*/
 
   Int_t iChannel  = fROC->GetRowIndexes(icsector)[icRow]+icPad; //  global pad position in sector
 
-  // fast filling methode.
+  // fast filling method
   // Attention: the entry counter of the histogram is not increased
   //            this means that e.g. the colz draw option gives an empty plot
   Int_t bin = (iChannel+1)*(fAdcMax-fAdcMin+2)+((Int_t)csignal-fAdcMin+1);
@@ -354,6 +359,8 @@ Int_t AliTPCCalibPedestal::Update(const Int_t icsector, /*FOLD00*/
 
   return 0;
 }
+
+
 //_____________________________________________________________________
 Bool_t AliTPCCalibPedestal::ProcessEventFast(AliTPCRawStreamFast *rawStreamFast)
 {
@@ -388,13 +395,12 @@ Bool_t AliTPCCalibPedestal::ProcessEventFast(AliRawReader *rawReader)
   //
   //  Event processing loop - AliRawReader
   //
- printf("ProcessEventFast - raw reader\n");
-
-  AliTPCRawStreamFast *rawStreamFast = new AliTPCRawStreamFast(rawReader);
+  AliTPCRawStreamFast *rawStreamFast = new AliTPCRawStreamFast(rawReader, (AliAltroMapping**)fMapping);
   Bool_t res=ProcessEventFast(rawStreamFast);
   delete rawStreamFast;
   return res;
 }
+
 //_____________________________________________________________________
 Bool_t AliTPCCalibPedestal::ProcessEvent(AliTPCRawStream *rawStream)
 {
@@ -407,6 +413,7 @@ Bool_t AliTPCCalibPedestal::ProcessEvent(AliTPCRawStream *rawStream)
   Bool_t withInput = kFALSE;
 
   while (rawStream->Next()) {
+
     Int_t iSector  = rawStream->GetSector();      //  current ROC
     Int_t iRow     = rawStream->GetRow();         //  current row
     Int_t iPad     = rawStream->GetPad();         //  current pad
@@ -416,8 +423,11 @@ Bool_t AliTPCCalibPedestal::ProcessEvent(AliTPCRawStream *rawStream)
     Update(iSector,iRow,iPad,iTimeBin,signal);
     withInput = kTRUE;
   }
+
   return withInput;
 }
+
+
 //_____________________________________________________________________
 Bool_t AliTPCCalibPedestal::ProcessEvent(AliRawReader *rawReader)
 {
@@ -425,7 +435,8 @@ Bool_t AliTPCCalibPedestal::ProcessEvent(AliRawReader *rawReader)
   //  Event processing loop - AliRawReader
   //
 
-  AliTPCRawStream rawStream(rawReader);
+  // if fMapping is NULL the rawstream will crate its own mapping
+  AliTPCRawStream rawStream(rawReader, (AliAltroMapping**)fMapping);
   rawReader->Select("TPC");
   return ProcessEvent(&rawStream);
 }
@@ -472,8 +483,8 @@ Bool_t AliTPCCalibPedestal::TestEvent() /*FOLD00*/
 
 //_____________________________________________________________________
 TH2F* AliTPCCalibPedestal::GetHisto(Int_t sector, TObjArray *arr, /*FOLD00*/
-                                 Int_t nbinsY, Float_t ymin, Float_t ymax,
-                                 Char_t *type, Bool_t force)
+                                   Int_t nbinsY, Float_t ymin, Float_t ymax,
+                                   Char_t *type, Bool_t force)
 {
     //
     // return pointer to Q histogram
index afe17ff9c9bc004e7803b034080c5307ef605253..2bb2cfc4f56a07218e6b5123ebb03de10070469c 100644 (file)
@@ -16,6 +16,7 @@ class AliTPCCalROC;
 class AliTPCRawStream;
 class AliTPCRawStreamFast;
 class AliRawReader;
+class AliTPCAltroMapping;
 
 struct eventHeaderStruct;
 
@@ -29,7 +30,7 @@ public:
   AliTPCCalibPedestal& operator = (const  AliTPCCalibPedestal &source);
 
   Bool_t ProcessEventFast(AliTPCRawStreamFast *rawStreamFast);
-  Bool_t ProcessEventFast(AliRawReader            *rawReader);
+  Bool_t ProcessEventFast(AliRawReader        *rawReader);
 
   Bool_t ProcessEvent(AliTPCRawStream *rawStream);
   Bool_t ProcessEvent(AliRawReader    *rawReader);
@@ -39,6 +40,9 @@ public:
                const Int_t iTimeBin, const Float_t signal);
   void   Analyse();
   //
+  AliTPCAltroMapping **GetAltroMapping() { return fMapping; };
+  void  SetAltroMapping(AliTPCAltroMapping **mapp) { fMapping = mapp; };
+  //
   AliTPCCalROC* GetCalRocPedestal (Int_t sector, Bool_t force=kFALSE);  // get calibration object - sector
   AliTPCCalROC* GetCalRocRMS(Int_t sector, Bool_t force=kFALSE);        // get calibration object - sector
   const TObjArray* GetCalPadPedestal (){return &fCalRocArrayPedestal;}  // get calibration object
@@ -77,6 +81,7 @@ private:
   Bool_t  fTimeAnalysis;            //! Should we use the time dependent analysis? ONLY ON LDC!
 
   AliTPCROC *fROC;                  //! ROC information
+  AliTPCAltroMapping **fMapping;    //! Altro Mapping object
 
   TObjArray fCalRocArrayPedestal;   //  Array of AliTPCCalROC class for Time0 calibration
   TObjArray fCalRocArrayRMS;        //  Array of AliTPCCalROC class for signal width calibration
@@ -92,7 +97,7 @@ private:
   AliTPCCalROC* GetCalRoc(Int_t sector, TObjArray* arr, Bool_t force);
 
 public:
-  ClassDef(AliTPCCalibPedestal, 2)  // Implementation of the TPC pedestal and noise calibration
+  ClassDef(AliTPCCalibPedestal, 4)  // Implementation of the TPC pedestal and noise calibration
 };
 
 
index f72a7d69747517cbfed33beb7bec76ab42f88d95..99f3329354f70800d4c3f28ff10e51262ea2a0f4 100644 (file)
@@ -43,7 +43,7 @@ AliTPCRawStreamFast::AliTPCRawStreamFast(AliRawReader* rawReader, AliAltroMappin
   fPrevRow(-1),
   fPad(-1),
   fPrevPad(-1),
-  fIsMapOwner(kTRUE)
+  fIsMapOwner(kFALSE)
 {
   // create an object to read TPC raw digits
 
@@ -59,6 +59,7 @@ AliTPCRawStreamFast::AliTPCRawStreamFast(AliRawReader* rawReader, AliAltroMappin
       path2 += ".data";
       fMapping[i] = new AliTPCAltroMapping(path2.Data());
     }
+    fIsMapOwner = kTRUE;
   }
   else {
     for(Int_t i = 0; i < 6; i++)
index 3ec68a717b2476d8d1b2aeace2bc616db8f24fbe..3b62e74e4ee3a97225ac87e07f3314ec9d305407 100644 (file)
@@ -45,7 +45,6 @@ extern "C" {
 #include "AliRawReaderDate.h"
 #include "AliTPCmapper.h"
 #include "AliTPCRawStream.h"
-#include "AliTPCAltroMapping.h"
 #include "AliTPCROC.h"
 #include "AliTPCCalROC.h"
 #include "AliTPCCalPad.h"
@@ -96,13 +95,13 @@ int main(int argc, char **argv) {
   status = daqDA_DB_getFile(MAPPING_FILE,"./tpcMapping.root");
   if (status) {
     printf("Failed to get mapping file (%s) from DAQdetDB, status=%d\n", MAPPING_FILE, status);
-    printf("Continue anyway ... maybe it works?\n");              // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-    //return -1;   // temporarily uncommented for testing on pcald47 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    printf("Continue anyway ... maybe it works?\n");              // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    //return -1;   // temporarily uncommented for testing on pcald47 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   }
 
   /* open the mapping file and retrieve mapping object */
-  TFile *fileMapping = new TFile(MAPPING_FILE, "read");
   AliTPCmapper *mapping = 0;   // The TPC mapping
+  TFile *fileMapping = new TFile(MAPPING_FILE, "read");
   mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping");
   if (mapping == 0) {
     printf("Failed to get mapping object from %s. Exiting ...\n", MAPPING_FILE);
@@ -111,11 +110,10 @@ int main(int argc, char **argv) {
   } else {
     printf("Got mapping object from %s\n", MAPPING_FILE);
   }
-  AliTPCAltroMapping **altromapp = mapping->GetAltroMapping();
 
-  AliTPCCalibPedestal calibPedestal;           // pedestal and noise calibration
-  calibPedestal.SetTimeAnalysis(timeAnalysis); // pedestal(t) calibration
-  calibPedestal.SetAltroMapping(altromapp);    // Use altro mapping we got from daqDetDb
+  AliTPCCalibPedestal calibPedestal;                         // pedestal and noise calibration
+  calibPedestal.SetTimeAnalysis(timeAnalysis);               // pedestal(t) calibration
+  calibPedestal.SetAltroMapping(mapping->GetAltroMapping()); // Use altro mapping we got from daqDetDb
 
   /* loop over RAW data files */
   int nevents=0;
@@ -153,15 +151,15 @@ int main(int argc, char **argv) {
        continue;
 
       /* retry if got no event */
-      if (event==NULL) {
+      if (event==NULL)
        continue;
-      }
 
       nevents++;
 
       //  Pedestal calibration
       AliRawReader *rawReader = new AliRawReaderDate((void*)event);
-      calibPedestal.ProcessEvent(rawReader);
+      //calibPedestal.ProcessEvent(rawReader);
+      calibPedestal.ProcessEventFast(rawReader);   // fast data reader
       delete rawReader;
 
       /* free resources */
@@ -221,10 +219,11 @@ int main(int argc, char **argv) {
            Float_t rms = 0.;
            Float_t ctr = 0.;
            for ( int channel = 0; channel < 16; channel++ ) {
-             Int_t hwadd = mapping->CodeHWAddress(branch, fec, altro, channel);
-             Int_t row   = mapping->GetPadRow(patch, hwadd);
-             Int_t pad   = mapping->GetPad(patch, hwadd);
-             Float_t ped = calibPedestal.GetCalRocPedestal(roc)->GetValue(row,pad);
+             Int_t hwadd     = mapping->CodeHWAddress(branch, fec, altro, channel);
+             Int_t row       = mapping->GetPadRow(patch, hwadd);        // row in a ROC
+             Int_t globalrow = mapping->GetGlobalPadRow(patch, hwadd);  // row in full sector
+             Int_t pad       = mapping->GetPad(patch, hwadd);
+             Float_t ped     = calibPedestal.GetCalRocPedestal(roc)->GetValue(row,pad);
              // fixed pedestal
              if ( ped > 1.e-10 ) {
                pedfile << ctr_channel << "\t" << side << "\t" << sector << "\t" << patch << "\t"
@@ -232,11 +231,11 @@ int main(int argc, char **argv) {
                ctr_channel++;
              }
              // pedestal(t)
-             if ( timePed && fabs(timePed[row][pad].GetSum()) > 1e-10 ) {
+             if ( timePed && fabs(timePed[globalrow][pad].GetSum()) > 1e-10 ) {
                pedmemfile << ctr_pattern << "\t" << side << "\t" << sector << "\t" << patch
                           << "\t" << hwadd;
                for ( Int_t timebin = 0; timebin < 1024; timebin++ )
-                 pedmemfile << "\t" << timePed[row][pad].At(timebin);
+                 pedmemfile << "\t" << timePed[globalrow][pad].At(timebin);
                pedmemfile << std::endl;
                ctr_pattern++;
              }