]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fixes to DA code:
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 Apr 2010 22:53:26 +0000 (22:53 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 27 Apr 2010 22:53:26 +0000 (22:53 +0000)
* AliFMDBaseDA::Rotate(const char* file, int max)
  'log-rotates' files that start with 'file' up to a maximum of 'max'.
  This is applied to all FXS files (peds.csv, gains.csv, conditions.csv)
  as well as zero-suppression files.
* Added comment line in each output file, that tells us from which run
  the file was created, and when.
* Fixed some coding violations.

The DA's should be propagated to the release.

FMD/AliFMDBaseDA.cxx
FMD/AliFMDBaseDA.h
FMD/AliFMDGainDA.cxx
FMD/AliFMDGainDA.h
FMD/AliFMDPedestalDA.cxx
FMD/FMDBaseda.cxx
FMD/FMDPedestalda.cxx

index 6a3b64a4c8d84c68b69a0edee55fe166d537b363..71fbc91766ad1605be29e711622a3ef979c3b01f 100644 (file)
@@ -33,6 +33,8 @@
 #include "AliFMDCalibStripRange.h"
 #include "AliLog.h"
 #include "AliRawEventHeaderBase.h"
+#include <TDatime.h>
+#include <TSystem.h>
 
 //_____________________________________________________________________
 ClassImp(AliFMDBaseDA)
@@ -48,6 +50,17 @@ AliFMDBaseDA::GetStripPath(UShort_t det,
                           UShort_t str, 
                           Bool_t   full) const
 {
+  // Get the strip path 
+  // 
+  // Parameters 
+  //     det      Detector number
+  //     ring     Ring identifier 
+  //     sec      Sector number 
+  //     str      Strip number
+  //     full     If true, return full path 
+  // 
+  // Return 
+  //     The path
   return Form("%s%sFMD%d%c[%02d,%03d]", 
              (full ? GetSectorPath(det, ring, sec, full) : ""), 
              (full ? "/" : ""), det, ring, sec, str);
@@ -59,6 +72,17 @@ AliFMDBaseDA::GetSectorPath(UShort_t det,
                            UShort_t sec, 
                            Bool_t   full) const
 {
+  // Get the strip path 
+  // 
+  // Parameters 
+  //     det      Detector number
+  //     ring     Ring identifier 
+  //     sec      Sector number 
+  //     str      Strip number
+  //     full     If true, return full path 
+  // 
+  // Return 
+  //     The path
   return Form("%s%sFMD%d%c[%02d]", 
              (full ? GetRingPath(det, ring, full) : ""), 
              (full ? "/" : ""), det, ring, sec);
@@ -69,6 +93,17 @@ AliFMDBaseDA::GetRingPath(UShort_t det,
                          Char_t   ring, 
                          Bool_t   full) const
 {
+  // Get the strip path 
+  // 
+  // Parameters 
+  //     det      Detector number
+  //     ring     Ring identifier 
+  //     sec      Sector number 
+  //     str      Strip number
+  //     full     If true, return full path 
+  // 
+  // Return 
+  //     The path
   return Form("%s%sFMD%d%c", 
              (full ? GetDetectorPath(det, full) : ""), 
              (full ? "/" : ""), det, ring);
@@ -78,6 +113,17 @@ const char*
 AliFMDBaseDA::GetDetectorPath(UShort_t det, 
                              Bool_t   full) const
 {
+  // Get the strip path 
+  // 
+  // Parameters 
+  //     det      Detector number
+  //     ring     Ring identifier 
+  //     sec      Sector number 
+  //     str      Strip number
+  //     full     If true, return full path 
+  // 
+  // Return 
+  //     The path
   return Form("%s%sFMD%d", 
              (full ? fDiagnosticsFilename.Data() : ""), 
              (full ? ":/" : ""), det);
@@ -94,11 +140,13 @@ AliFMDBaseDA::AliFMDBaseDA() :
   fPulseSize(10),
   fPulseLength(10),
   fRequiredEvents(0),
-  fCurrentEvent(0)
+  fCurrentEvent(0), 
+  fRunno(0)
 {
   //Constructor
-   fSeenDetectors[0] = fSeenDetectors[1] = fSeenDetectors[2] = kFALSE;
+  fSeenDetectors[0] = fSeenDetectors[1] = fSeenDetectors[2] = kFALSE;
   fDetectorArray.SetOwner();
+  Rotate("conditions.csv", 3);
   fConditionsFile.open("conditions.csv");
 }
 //_____________________________________________________________________
@@ -112,7 +160,8 @@ AliFMDBaseDA::AliFMDBaseDA(const AliFMDBaseDA & baseDA) :
   fPulseSize(baseDA.fPulseSize),
   fPulseLength(baseDA.fPulseLength),
   fRequiredEvents(baseDA.fRequiredEvents),
-  fCurrentEvent(baseDA.fCurrentEvent)
+  fCurrentEvent(baseDA.fCurrentEvent),
+  fRunno(baseDA.fRunno)
 {
   //Copy constructor
   fSeenDetectors[0] = baseDA.fSeenDetectors[0];
@@ -143,7 +192,8 @@ void AliFMDBaseDA::Run(AliRawReader* reader)
   
   
   reader->Reset();
-  
+  fRunno = reader->GetRunNumber();
+
   AliFMDRawReader* fmdReader  = new AliFMDRawReader(reader,0);
   TClonesArray*    digitArray = new TClonesArray("AliFMDDigit",0);
   
@@ -304,6 +354,9 @@ void AliFMDBaseDA::WriteConditionsData(AliFMDRawReader* fmdReader)
   //Write the conditions data to file
   AliFMDParameters* pars       = AliFMDParameters::Instance();
   fConditionsFile.write(Form("# %s \n",pars->GetConditionsShuttleID()),14);
+  TDatime now;
+  fConditionsFile << "# This file created from run number " << fRunno 
+                 << " at " << now.AsString() << std::endl;
   
   AliFMDCalibSampleRate* sampleRate = new AliFMDCalibSampleRate();
   AliFMDCalibStripRange* stripRange = new AliFMDCalibStripRange();
@@ -371,8 +424,18 @@ void AliFMDBaseDA::WriteConditionsData(AliFMDRawReader* fmdReader)
   
 }
 //_____________________________________________________________________ 
-Int_t AliFMDBaseDA::GetHalfringIndex(UShort_t det, Char_t ring, UShort_t board) const {
-
+Int_t AliFMDBaseDA::GetHalfringIndex(UShort_t det, Char_t ring, 
+                                    UShort_t board) const 
+{
+  // Get the index corresponding to a half-ring 
+  // 
+  // Parameters: 
+  //   det    Detector number 
+  //   ring   Ring identifier 
+  //   board  Board number 
+  //
+  // Return 
+  //   Internal index of the board 
   UShort_t iring  =  (ring == 'I' ? 1 : 0);
   
   Int_t index = (((det-1) << 2) | (iring << 1) | (board << 0));
@@ -380,6 +443,44 @@ Int_t AliFMDBaseDA::GetHalfringIndex(UShort_t det, Char_t ring, UShort_t board)
   return index-2;
   
 }
+//_____________________________________________________________________ 
+void AliFMDBaseDA::Rotate(const char* base, int max) const
+{
+  // 
+  // Rotate a set of files.   base is the basic name of the files.
+  // If the file base.max exists it is removed. 
+  // If the file base.n exists (where n < max) it is renamed to
+  // base.(n-1).  
+  // If the file base exists, it is renamed to base.1 
+  //
+  // Parameters:
+  //   base Base name of the files
+  //   max  Maximum number to keep (minus one for the current).
+
+  // Note:  TSystem::AccessPathName returns false if the condition is
+  // fulfilled! 
+
+  // Check if we have base.max, and if so, remove it. 
+  TString testName(Form("%s.%d", base, max));
+  if (!gSystem->AccessPathName(testName.Data())) 
+    gSystem->Unlink(testName.Data());
+    
+  // Loop down from max-1 to 1 and move files 
+  for (int i = max-1; i >= 1; i--) { 
+    testName = Form("%s.%d", base, i);
+    if (!gSystem->AccessPathName(testName.Data())) {
+      TString newName(Form("%s.%d", base, i+1));
+      gSystem->Rename(testName.Data(), newName.Data());
+    }
+  }
+
+  // If we have the file base, rename it to base.1 
+  testName = Form("%s", base);
+  if (!gSystem->AccessPathName(testName.Data())){
+    TString newName(Form("%s.%d", base, 1));
+    gSystem->Rename(testName.Data(), newName.Data());
+  }
+}
 
 
 //_____________________________________________________________________ 
index dc9e6ba2f05e9910073075efbe3969baa53cd389..6e13dc52995a8306be748ae6d06e0346a9b4f00e 100644 (file)
 class TDirectory;
 class AliFMDRawReader;
 
-class AliFMDBaseDA: public TNamed {
-  
+class AliFMDBaseDA: public TNamed 
+{
 public:
+  /** 
+   * Constructor 
+   * 
+   */
   AliFMDBaseDA() ;
+  /** 
+   * Copy constructor 
+   * 
+   * @param baseDA 
+   */
   AliFMDBaseDA(const AliFMDBaseDA & baseDA) ;
   //  AliFMDBaseDA& operator = (const AliFMDBaseDA & baseDA) ; 
-  
+  /** 
+   * Destructor
+   * 
+   */  
   ~AliFMDBaseDA() ;
-  
+  /** 
+   * Run this DA
+   * 
+   * @param fmdReader Raw input reader
+   */  
   void Run(AliRawReader* fmdReader);
+  /** 
+   * Set whether to save diagnostics 
+   * 
+   * @param save If true, will output diagnostics file
+   */
   void SetSaveDiagnostics(Bool_t save) {fSaveHistograms = save;}
+  /** 
+   * Set the number of requried events
+   * 
+   * @param nEvents Number of event we need
+   */
   void SetRequiredEvents(Int_t nEvents) {fRequiredEvents = nEvents;}
+  /** 
+   * Get the number of required events
+   * 
+   * 
+   * @return number of required events
+   */
   Int_t GetRequiredEvents() const {return fRequiredEvents ;}
 protected:
-  
+  /** 
+   * Initialize 
+   * 
+   */  
   virtual void Init()  {};
+  /** 
+   * Fill channels 
+   * 
+   */
   virtual void FillChannels(AliFMDDigit* )  {};
+  /** 
+   * Analyse a single strip result
+   * 
+   */
   virtual void Analyse(UShort_t, Char_t, UShort_t, UShort_t )  {};
+  /** 
+   * Write header to output file
+   * 
+   */
   virtual void WriteHeaderToFile()  {};
-  virtual void AddChannelContainer(TObjArray*, UShort_t, Char_t, UShort_t, UShort_t )  {};
+  /** 
+   * Add a strip container 
+   * 
+   */
+  virtual void AddChannelContainer(TObjArray*, UShort_t, Char_t, 
+                                  UShort_t, UShort_t )  {};
+  /** 
+   * End of event
+   * 
+   */
   virtual void FinishEvent()  {};
+  /** 
+   * End of run
+   * 
+   */
   virtual void Terminate(TFile* ) {};
-  
+  /** 
+   * Current event number
+   * 
+   * 
+   * @return 
+   */  
   Int_t GetCurrentEvent() const {return fCurrentEvent;}
-  
+  /** 
+   * Rotate a set of files.   @a base is the basic name of the files.
+   * If the file @a base.max exists it is removed. 
+   * If the file @a base.n exists (where n < max) it is renamed to @a
+   * base.(n-1).  
+   * If the file @a base exists, it is renamed to @a base.1 
+   * 
+   * @param base Base name of the files
+   * @param max  Maximum number to keep (minus one for the current).
+   */
+  void Rotate(const char* base, int max) const;
   static const UInt_t fgkBaseDDL = 3072;   // base FMD ddl
   //Char_t* fDiagnosticsFilename;
   TString fDiagnosticsFilename;            // name of diagnostics file
@@ -66,20 +141,89 @@ protected:
   std::ofstream fConditionsFile;           // conditions file
   Bool_t fSaveHistograms;                  // save hists or not
   TObjArray fDetectorArray;                // array indiced by detector
-
+  /** 
+   * Ge the half-ring index 
+   * 
+   * @param UShort_t 
+   * @param Char_t 
+   * @param UShort_t 
+   * 
+   * @return 
+   */
   Int_t GetHalfringIndex(UShort_t, Char_t, UShort_t) const;
+  /** 
+   * Get the pulse size 
+   * 
+   * @param det   Detector number
+   * @param ring  Rin identifier
+   * @param board Board number 
+   * 
+   * @return Pulse step size
+   */
   Int_t GetPulseSize(UShort_t det , 
                     Char_t ring, 
-                    UShort_t board) {return fPulseSize.At(GetHalfringIndex(det,ring,board));}
+                    UShort_t board) 
+  {
+    return fPulseSize.At(GetHalfringIndex(det,ring,board));
+  }
+  /** 
+   * Get number of events per pulse size 
+   * 
+   * @param det   Detector number
+   * @param ring  Rin identifier
+   * @param board Board number 
+   * 
+   * @return number of events per Pulse size
+   */
   Int_t GetPulseLength(UShort_t det, 
                       Char_t ring, 
-                      UShort_t board) {return fPulseLength.At(GetHalfringIndex(det,ring,board));}
+                      UShort_t board) 
+  {
+    return fPulseLength.At(GetHalfringIndex(det,ring,board));
+  }
 
-  
+  /** 
+   * Get the detector path in diagnositcs file
+   * 
+   * @param det  Detector number
+   * @param full If true, return full path
+   * 
+   * @return Path to detector
+   */  
   const char* GetDetectorPath(UShort_t det, Bool_t full=kTRUE) const;
+  /** 
+   * Get the ring path in diagnositcs file
+   * 
+   * @param det  Detector number
+   * @param ring Ring identifier 
+   * @param full If true, return full path
+   * 
+   * @return Path to ring
+   */  
   const char* GetRingPath(UShort_t det, Char_t ring, Bool_t full=kTRUE) const;
+  /** 
+   * Get the sector path in diagnositcs file
+   * 
+   * @param det  Detector number
+   * @param ring Ring identifier 
+   * @param sec  Sector number
+   * @param full If true, return full path
+   * 
+   * @return Path to sector
+   */  
   const char* GetSectorPath(UShort_t det, Char_t ring, UShort_t sec, 
                            Bool_t full=kTRUE) const;
+  /** 
+   * Get the strip path in diagnositcs file
+   * 
+   * @param det  Detector number
+   * @param ring Ring identifier 
+   * @param sec  Sector number
+   * @param str  Strip number
+   * @param full If true, return full path
+   * 
+   * @return Path to strip
+   */  
   const char* GetStripPath(UShort_t det, Char_t ring, UShort_t sec, 
                           UShort_t str, Bool_t full=kTRUE) const;
   
@@ -90,16 +234,31 @@ protected:
 
   Bool_t  fSeenDetectors[3];              // Detectors seen so far
 private:
+  /** 
+   * Write conditions file 
+   * 
+   * @param fmdReader Raw input
+   */ 
   void WriteConditionsData(AliFMDRawReader* fmdReader);
+  /** 
+   * Set the current event 
+   * 
+   * @param currentEvent 
+   */
   void SetCurrentEvent(Int_t currentEvent) {fCurrentEvent = currentEvent; }
+  /** 
+   * Initialize container 
+   * 
+   * @param dir Directory to make containers in 
+   */
   void InitContainer(TDirectory* dir);
   Int_t fRequiredEvents;            // number of events required for this calib
   Int_t fCurrentEvent;              // the current event       
+protected:
+  UInt_t fRunno;                    // Current run number 
   
   
-  
-  ClassDef(AliFMDBaseDA,0)
+  ClassDef(AliFMDBaseDA,0) // Base Detector algorithm for all run types
 
 };
 #endif
index f24161e2a2005796cafb5b98714d72a769c7a252..2d0c069154944cae0406ad8240c6b2be461d614c 100644 (file)
 // pulse and the response of the detector.
 //
 #include "AliFMDGainDA.h"
-#include "iostream"
-#include "fstream"
+// #include <iostream>
+// #include <fstream>
 #include "AliLog.h"
 #include "TF1.h"
-#include "TH1.h"
-#include "TMath.h"
+#include "TH1S.h"
+// #include "TMath.h"
 #include "TGraphErrors.h"
 #include "AliFMDParameters.h"
 #include "AliFMDAltroMapping.h"
+#include <TDatime.h>
 
 //_____________________________________________________________________
 ClassImp(AliFMDGainDA)
@@ -57,6 +58,10 @@ AliFMDGainDA::AliFMDGainDA()
     fSummaryGains("GainsSummary","Summary of gains",51200,0,51200),
     fCurrentSummaryStrip(1)
 {
+  // Constructor 
+  // 
+  // Parameters: 
+  //   None
   fCurrentPulse.Reset(0);
   fCurrentChannel.Reset(0);
   fOutputFile.open("gains.csv");
@@ -75,6 +80,10 @@ AliFMDGainDA::AliFMDGainDA(const AliFMDGainDA & gainDA)
      fSummaryGains(gainDA.fSummaryGains),
      fCurrentSummaryStrip(gainDA.fCurrentSummaryStrip)
 {  
+  // Copy Constructor 
+  // 
+  // Parameters: 
+  //   gainDA   Object to copy from 
   fCurrentPulse.Reset(0);
   fCurrentChannel.Reset(0);
 }
@@ -82,36 +91,30 @@ AliFMDGainDA::AliFMDGainDA(const AliFMDGainDA & gainDA)
 //_____________________________________________________________________
 AliFMDGainDA::~AliFMDGainDA() 
 {
+  // Destructor 
+  // 
+  // Parameters: 
+  //   None
 }
 
 //_____________________________________________________________________
 void AliFMDGainDA::Init() 
 {
-  
+  // Initialize 
+  // 
+  // Parameters: 
+  //   None
   Int_t nEventsRequired = 0;
   
-  //for(UShort_t det=1; det<=3;det++) {
-  //  UShort_t firstring = (det == 1 ? 1 : 0);
-  //  for(UShort_t iring = firstring; iring <=1;iring++) {
-  //    Char_t ring = (iring == 1 ? 'I' : 'O');
-  //    for(UShort_t board =0 ; board <=1; board++) {
-  //   Int_t idx = GetHalfringIndex(det,ring,board);
-  for(Int_t idx = 0;idx<fEventsPerChannel.GetSize();idx++)
-    {
-      
-      Int_t nEvents = 0;
-      if(fPulseSize.At(idx))
-       nEvents = (fPulseLength.At(idx)*fHighPulse) / fPulseSize.At(idx);
-      fEventsPerChannel.AddAt(nEvents,idx);
-      if(nEvents>nEventsRequired) nEventsRequired = nEvents * fNumberOfStripsPerChip;
-      
-    }
-  //}
-  // }
-  
-  //8 pulser values * 128 strips * 100 samples
-  
+  for(Int_t idx = 0;idx<fEventsPerChannel.GetSize();idx++) {
+    Int_t nEvents = 0;
+    if(fPulseSize.At(idx))
+      nEvents = (fPulseLength.At(idx)*fHighPulse) / fPulseSize.At(idx);
+    fEventsPerChannel.AddAt(nEvents,idx);
+    if(nEvents>nEventsRequired) 
+      nEventsRequired = nEvents * fNumberOfStripsPerChip;
+    
+  }
   
   SetRequiredEvents(nEventsRequired); 
   
@@ -153,6 +156,14 @@ void AliFMDGainDA::AddChannelContainer(TObjArray* sectorArray,
                                       UShort_t sec, 
                                       UShort_t strip) 
 {  
+  // Make a channel container 
+  // 
+  // Parameters: 
+  //  sectorArray    Sectors 
+  //  det            Detector number
+  //  ring           Ring identifier 
+  //  sec            Sector number
+  //  strip          Strip number
   TGraphErrors* hChannel  = new TGraphErrors();
   hChannel->SetName(Form("FMD%d%c[%02d,%03d]", det, ring, sec, strip));
   hChannel->SetTitle(Form("FMD%d%c[%02d,%03d] ADC vs DAC", 
@@ -161,7 +172,12 @@ void AliFMDGainDA::AddChannelContainer(TObjArray* sectorArray,
 }
 
 //_____________________________________________________________________
-void AliFMDGainDA::FillChannels(AliFMDDigit* digit) {
+void AliFMDGainDA::FillChannels(AliFMDDigit* digit) 
+{
+  // Fill data into histogram
+  // 
+  // Parameters: 
+  //   digit  Digit to get the data from
 
   UShort_t det   = digit->Detector();
   Char_t   ring  = digit->Ring();
@@ -184,7 +200,15 @@ void AliFMDGainDA::FillChannels(AliFMDDigit* digit) {
 void AliFMDGainDA::Analyse(UShort_t det, 
                           Char_t   ring, 
                           UShort_t sec, 
-                          UShort_t strip) {
+                          UShort_t strip) 
+{
+  // Analyse result of a single strip
+  // 
+  // Parameters: 
+  //  det            Detector number
+  //  ring           Ring identifier 
+  //  sec            Sector number
+  //  strip          Strip number
   TGraphErrors* grChannel = GetChannel(det,ring,sec,strip);
   if(!grChannel->GetN()) {
     AliWarning(Form("No entries for FMD%d%c, sector %d, strip %d",
@@ -248,6 +272,10 @@ void AliFMDGainDA::Analyse(UShort_t det,
 //_____________________________________________________________________
 void AliFMDGainDA::Terminate(TFile* diagFile)
 {
+  // End of file 
+  // 
+  // Parameters: 
+  //   None
   if(diagFile) {
     diagFile->cd();
     fSummaryGains.Write();
@@ -257,8 +285,15 @@ void AliFMDGainDA::Terminate(TFile* diagFile)
 //_____________________________________________________________________
 void AliFMDGainDA::WriteHeaderToFile() 
 {
+  // Write header to the output file
+  // 
+  // Parameters: 
+  //   None
   AliFMDParameters* pars       = AliFMDParameters::Instance();
   fOutputFile.write(Form("# %s \n",pars->GetGainShuttleID()),9);
+  TDatime now;
+  fOutputFile << "# This file created from run # " << fRunno 
+             << " @ " << now.AsString() << std::endl;
   fOutputFile.write("# Detector, "
                    "Ring, "
                    "Sector, "
@@ -275,14 +310,21 @@ TH1S* AliFMDGainDA::GetChannelHistogram(UShort_t det,
                                        UShort_t sec, 
                                        UShort_t strip) 
 {
+  // Get the current histogram of a single strip
+  // 
+  // Parameters: 
+  //  det            Detector number
+  //  ring           Ring identifier 
+  //  sec            Sector number
+  //  strip          Strip number
   
-  UShort_t  Ring = 1;
+  UShort_t  lRing = 1;
   if(ring == 'O')
-    Ring = 0;
+    lRing = 0;
   
   
   TObjArray* detArray  = static_cast<TObjArray*>(fGainArray.At(det));
-  TObjArray* ringArray = static_cast<TObjArray*>(detArray->At(Ring));
+  TObjArray* ringArray = static_cast<TObjArray*>(detArray->At(lRing));
   TObjArray* secArray  = static_cast<TObjArray*>(ringArray->At(sec));
   TH1S* hChannel       = static_cast<TH1S*>(secArray->At(strip));
   
@@ -295,6 +337,13 @@ TGraphErrors* AliFMDGainDA::GetChannel(UShort_t det,
                                       UShort_t sec, 
                                       UShort_t strip) 
 {  
+  // Get the graph of a single strip
+  // 
+  // Parameters: 
+  //  det            Detector number
+  //  ring           Ring identifier 
+  //  sec            Sector number
+  //  strip          Strip number
   UShort_t      iring     = (ring == 'O' ? 0 : 1);
   TObjArray*    detArray  = static_cast<TObjArray*>(fDetectorArray.At(det));
   TObjArray*    ringArray = static_cast<TObjArray*>(detArray->At(iring));
@@ -310,6 +359,13 @@ void AliFMDGainDA::UpdatePulseAndADC(UShort_t det,
                                     UShort_t sec, 
                                     UShort_t strip) 
 {
+  // Go to next pulse size
+  // 
+  // Parameters: 
+  //  det            Detector number
+  //  ring           Ring identifier 
+  //  sec            Sector number
+  //  strip          Strip number
   
   AliFMDParameters* pars = AliFMDParameters::Instance();
   // UInt_t ddl, board,chip,ch;
@@ -377,12 +433,20 @@ void AliFMDGainDA::UpdatePulseAndADC(UShort_t det,
 //_____________________________________________________________________
 void AliFMDGainDA::ResetPulseAndUpdateChannel() 
 {  
+  // Reset all
+  // 
+  // Parameters: 
+  //   None
   fCurrentPulse.Reset(0); 
 }
 
 //_____________________________________________________________________
 void AliFMDGainDA::FinishEvent() 
 {
+  // End of event
+  // 
+  // Parameters: 
+  //   None
   for(UShort_t det=1; det<=3;det++) {
     UShort_t firstring = (det == 1 ? 1 : 0);
     for(UShort_t iring = firstring; iring <=1;iring++) {
@@ -390,12 +454,14 @@ void AliFMDGainDA::FinishEvent()
       for(UShort_t board =0 ; board <=1; board++) {
        Int_t idx = GetHalfringIndex(det,ring,board);
        
-       if( !fPulseLength.At(idx) || !fEventsPerChannel.At(idx))
+       if(!fPulseLength.At(idx) || !fEventsPerChannel.At(idx))
          continue;
-       if(GetCurrentEvent()>0 && ((GetCurrentEvent() % fPulseLength.At(idx)) == 0))
+       if(GetCurrentEvent()>0 && 
+          ((GetCurrentEvent() % fPulseLength.At(idx)) == 0))
          fCurrentPulse.AddAt(fCurrentPulse.At(idx)+1,idx);
        
-       if(GetCurrentEvent()>0 && ((GetCurrentEvent()) % fEventsPerChannel.At(idx)) == 0)
+       if(GetCurrentEvent()>0 && 
+          ((GetCurrentEvent()) % fEventsPerChannel.At(idx)) == 0)
          fCurrentPulse.AddAt(0,idx);
       }
     }
index 5a7fb278fa11dd8751e8210f6f38bf83c0d709a0..797467ebe4aecf5e334598b26943e44e6e4103c3 100644 (file)
 
 
 #include "AliFMDBaseDA.h"
-#include "TH1.h"
+#include "TH1F.h"
 #include "TObjArray.h"
-#include "TGraphErrors.h"
+// #include "TGraphErrors.h"
+class TGraphErrors;
+class TH1S;
 
-class AliFMDGainDA: public AliFMDBaseDA {
-  
- public:
-  
+class AliFMDGainDA: public AliFMDBaseDA 
+{
+public:
+  /** 
+   * Constructor 
+   * 
+   */
   AliFMDGainDA() ;
+  /** 
+   * Copy constructor 
+   * 
+   * @param gainDA  Object to copy from
+   */  
   AliFMDGainDA(const AliFMDGainDA & gainDA) ;
-  //  AliFMDGainDA& operator = (const AliFMDGainDA & gainDA) ; 
+  /** 
+   * Destructor 
+   * 
+   */
   virtual ~AliFMDGainDA();
+  /** 
+   * Initialize 
+   * 
+   */
   void Init();
-  // void SetPulseSize(Int_t pulseSize = 32) {fPulseSize = pulseSize; }
+  /** 
+   * Set the maximum pulse size 
+   * 
+   * @param highPulse Maximum pulse size
+   */
   void SetMaxPulse(Int_t highPulse = 256) {fHighPulse = highPulse; }
-  //  void SetPulseLength(Int_t pulseLength = 100) {fPulseLength = pulseLength; }
+  /** 
+   * Set the number of strips per input channel 
+   * 
+   * @param nStrips Number of strips per channel
+   */
   void SetNumberOfStrips(Int_t nStrips) {fNumberOfStripsPerChip = nStrips;}
 
- protected:
-  void AddChannelContainer(TObjArray* sectorArray, UShort_t det, Char_t ring, UShort_t sec, UShort_t strip);
+protected:
+  /** 
+   * Make a container for a channel 
+   * 
+   * @param sectorArray Sectors 
+   * @param det         Detector # 
+   * @param ring        Ring identifier 
+   * @param sec         Sector number
+   * @param strip       Strip number
+   */ 
+  void AddChannelContainer(TObjArray* sectorArray, 
+                          UShort_t det, Char_t ring, 
+                          UShort_t sec, UShort_t strip);
+  /** 
+   * Fill channel histogram 
+   * 
+   * @param digit Digit to fill from
+   */
   void FillChannels(AliFMDDigit* digit);
+  /** 
+   * Analyse the result
+   * 
+   * @param det         Detector # 
+   * @param ring        Ring identifier 
+   * @param sec         Sector number
+   * @param strip       Strip number
+   */
   void Analyse(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip);
+  /**
+   * Write out the header 
+   */
   void WriteHeaderToFile();
-  void UpdatePulseAndADC(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip);
+  /** 
+   * Go to the next sample
+   * 
+   * @param det         Detector # 
+   * @param ring        Ring identifier 
+   * @param sec         Sector number
+   * @param strip       Strip number
+   */
+  void UpdatePulseAndADC(UShort_t det, 
+                        Char_t ring, 
+                        UShort_t sec, 
+                        UShort_t strip);
+  /** 
+   * Reset all 
+   * 
+   */
   void ResetPulseAndUpdateChannel();
+  /** 
+   * End of event 
+   * 
+   */
   void FinishEvent();
-  void Terminate(TFile* );
-  
- private:
+  /** 
+   * End of job
+   * 
+   * @param dummy Not used
+   */
+  void Terminate(TFile* dummy);
   
-  TH1S* GetChannelHistogram(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip);
-  TGraphErrors* GetChannel(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip);
-  TObjArray fGainArray;
-  //  Int_t fPulseSize;
-  Int_t fHighPulse;
-  //Int_t fPulseLength;
-  TArrayS fEventsPerChannel;
-  TArrayS fCurrentPulse;
-  TArrayS fCurrentChannel;
-  Int_t fNumberOfStripsPerChip;
+private:
+  /** 
+   * Get the channel histogram
+   * 
+   * @param det         Detector # 
+   * @param ring        Ring identifier 
+   * @param sec         Sector number
+   * @param strip       Strip number
+   * 
+   * @return Histogram
+   */  
+  TH1S* GetChannelHistogram(UShort_t det, Char_t ring, UShort_t sec, 
+                           UShort_t strip);
+  /** 
+   * Get strip graph
+   * 
+   * @param det         Detector # 
+   * @param ring        Ring identifier 
+   * @param sec         Sector number
+   * @param strip       Strip number
+   * 
+   * @return Graph
+   */
+  TGraphErrors* GetChannel(UShort_t det, Char_t ring, 
+                          UShort_t sec, UShort_t strip);
+  TObjArray fGainArray;          // Array of gains 
+  Int_t     fHighPulse;          // Highest pulse
+  TArrayS   fEventsPerChannel;   // # of events per pulse step
+  TArrayS   fCurrentPulse;       // The current pulse size 
+  TArrayS   fCurrentChannel;     // The current strip number
+  Int_t     fNumberOfStripsPerChip; // Number of strips
   
-  TH1F fSummaryGains;
-  Int_t fCurrentSummaryStrip;
+  TH1F      fSummaryGains;         // Summary histogram 
+  Int_t     fCurrentSummaryStrip;  // Current strip for summary
   
-  ClassDef(AliFMDGainDA,0)
+  ClassDef(AliFMDGainDA,0) // Detector algorithm for gain runs
 
 };
 #endif
+// Local Variables: 
+//  mode: C++ 
+// End:
index bc43b238f86274e6622d41616b0724eaaa917610..2a6da0a3519655d3071852825fdde9f5f3866edf 100644 (file)
@@ -36,6 +36,7 @@
 #include "TObject.h"
 #include "TMath.h"
 #include <TSystem.h>
+#include <TDatime.h>
 
 //_____________________________________________________________________
 ClassImp(AliFMDPedestalDA)
@@ -52,9 +53,13 @@ AliFMDPedestalDA::AliFMDPedestalDA() : AliFMDBaseDA(),
   fMaxTimebin(3 * 4 * 3 * 16)  // 3 ddls, 4 FECs, 3 Altros, 16 channels
 {
   // Default constructor 
+  Rotate("peds.csv", 3);
   fOutputFile.open("peds.csv");
+  Rotate("ddl3072.csv", 10);
   fZSfileFMD1.open("ddl3072.csv");
+  Rotate("ddl3073.csv", 10);
   fZSfileFMD2.open("ddl3073.csv");
+  Rotate("ddl3074.csv", 10);
   fZSfileFMD3.open("ddl3074.csv");  
 }
 
@@ -358,6 +363,9 @@ void AliFMDPedestalDA::WriteHeaderToFile()
   // Write headers to output files 
   AliFMDParameters* pars       = AliFMDParameters::Instance();
   fOutputFile.write(Form("# %s \n",pars->GetPedestalShuttleID()),13);
+  TDatime now;
+  fOutputFile << "# This file created from run # " << fRunno 
+             << " @ " << now.AsString() << std::endl;
   fOutputFile.write("# Detector, "
                    "Ring, "
                    "Sector, "
@@ -369,14 +377,17 @@ void AliFMDPedestalDA::WriteHeaderToFile()
                    "Chi2/NDF \n", 71);
 
   std::ostream* zss[] = { &fZSfileFMD1, &fZSfileFMD2, &fZSfileFMD3, 0 };
-  for (size_t i = 0; i < 3; i++) 
-    *(zss[i]) << "# FMD 1 pedestals \n"
+  for (size_t i = 0; i < 3; i++)  {
+    *(zss[i]) << "# FMD " << (i+1) << " pedestals \n"
              << "# board, "
              << "altro, "
              << "channel, "
              << "timebin, "
              << "pedestal, "
              << "noise\n";
+    *(zss[i]) << "# This file created from run # " << fRunno 
+             << " @ " << now.AsString() << std::endl;
+  }
 }
 
 //_____________________________________________________________________
index 1f91e45c57f8a6ee79bad09ee3b20cfa3f712a41..a9c74fecbe5089ac36f33b23766f03faf5e4229c 100644 (file)
@@ -105,7 +105,9 @@ int main(int argc, char **argv)
       reader = new AliRawReaderDate((void*)event);
       baseDA.Run(reader);
       SODread = kTRUE;
-      retval = daqDA_FES_storeFile("conditions.csv", AliFMDParameters::Instance()->GetConditionsShuttleID());
+      retval = 
+       daqDA_FES_storeFile("conditions.csv", 
+                           AliFMDParameters::Instance()->GetConditionsShuttleID());
       if (retval != 0) std::cerr << "Base DA failed" << std::endl;
       
       break;
index 18ac307ce7528625ab369bf8e5af040374fbe5ea..2463a5a11b610906666ba47cccd298e826b972e0 100644 (file)
@@ -121,8 +121,12 @@ int main(int argc, char **argv)
   timer.Stop();
   timer.Print();
  
-  Int_t  retvalConditions = daqDA_FES_storeFile("conditions.csv", AliFMDParameters::Instance()->GetConditionsShuttleID());
-  Int_t  retvalPeds = daqDA_FES_storeFile("peds.csv", AliFMDParameters::Instance()->GetPedestalShuttleID());
+  Int_t  retvalConditions = 
+    daqDA_FES_storeFile("conditions.csv", 
+                       AliFMDParameters::Instance()->GetConditionsShuttleID());
+  Int_t  retvalPeds = 
+    daqDA_FES_storeFile("peds.csv", 
+                       AliFMDParameters::Instance()->GetPedestalShuttleID());
 
   if(retvalConditions!=0 || retvalPeds!=0)
     std::cerr << "Pedestal DA failed" << std::endl;