]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Some changes to make it possible to run the DA's
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 10 Jun 2013 10:59:21 +0000 (10:59 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 10 Jun 2013 10:59:21 +0000 (10:59 +0000)
on local files and get all 3 sub-detectors.

FMD/AliFMDBaseDA.cxx
FMD/AliFMDBaseDA.h
FMD/FMDBaseda.cxx

index e37f9ea17740778f2bdb55c7567a76b039fa3c94..26da4c309bd3211278c1f3a83c1ad5ee7563a3e4 100644 (file)
@@ -154,7 +154,8 @@ AliFMDBaseDA::AliFMDBaseDA() :
   fRequiredEvents(0),
   fCurrentEvent(0), 
   fRunno(0),
-  fSummaries(0)
+  fSummaries(0),
+  fAll(false)
 {
   //Constructor
   for(Int_t i = 0; i< 3;i++) {
@@ -179,7 +180,8 @@ AliFMDBaseDA::AliFMDBaseDA(const AliFMDBaseDA & baseDA) :
   fRequiredEvents(baseDA.fRequiredEvents),
   fCurrentEvent(baseDA.fCurrentEvent),
   fRunno(baseDA.fRunno),
-  fSummaries(0)
+  fSummaries(0),
+  fAll(baseDA.fAll)
 {
   //Copy constructor
   for(Int_t i = 0; i< 3;i++) {
@@ -200,12 +202,32 @@ AliFMDBaseDA::~AliFMDBaseDA()
 //_____________________________________________________________________
 Bool_t AliFMDBaseDA::HaveEnough(Int_t nEvents) const
 {
-  return nEvents > GetRequiredEvents();
+  // if (!fAll) return nEvents > GetRequiredEvents();
+  if (nEvents <= 1) return false;
+
+  Bool_t ret = true; // Assume we have it 
+  for (Int_t i = 0; i < 3; i++) { 
+    if (!fSeenDetectors[i]) continue;
+    if (fNEventsPerDetector[i] <= GetRequiredEvents()) ret = false;
+  }
+  return ret;
 }
 //_____________________________________________________________________
 UShort_t AliFMDBaseDA::GetProgress(Int_t nEvents) const
 {
-  return UShort_t((nEvents *100)/ GetRequiredEvents());
+  // if (!fAll) 
+  //  return UShort_t((nEvents *100)/ GetRequiredEvents());
+
+  if (nEvents <= 1) return 0;
+
+  Int_t got = 0;
+  Int_t total = 0;
+  for (Int_t i = 0; i < 3; i++) {
+    if (!fSeenDetectors[i]) continue;
+    got   += fNEventsPerDetector[i];
+    total += GetRequiredEvents();
+  }
+  return UShort_t((got * 100.) / total);
 }
 
 //_____________________________________________________________________
@@ -256,7 +278,12 @@ void AliFMDBaseDA::Run(AliRawReader* reader)
   for(Int_t i = 0; i< 3;i++) fNEventsPerDetector[i] = 0;
 
   for(Int_t n = 1; !HaveEnough(n); n++) {
+    AliInfoF("Get the next event %d", n);
     if(!reader->NextEvent()) { n--; continue; }
+    UInt_t eventType = reader->GetType();
+    AliInfoF("Event type is %d", eventType);
+    if(eventType != AliRawEventHeaderBase::kPhysicsEvent) { n--; continue; }
+
     SetCurrentEvent(n);
     digitArray->Clear();
     fmdReader->ReadAdcs(digitArray);
@@ -267,7 +294,10 @@ void AliFMDBaseDA::Run(AliRawReader* reader)
       UShort_t det = digit->Detector();
       fSeenDetectors[det-1] = true;
       seen[det-1]           = true;
-      FillChannels(digit);
+
+      // Only fill if we do not have enough for this detector 
+      if (fNEventsPerDetector[det-1] < GetRequiredEvents()) 
+       FillChannels(digit);
     }
     
     for(Int_t i = 0; i< 3;i++) 
@@ -275,10 +305,19 @@ void AliFMDBaseDA::Run(AliRawReader* reader)
       
     FinishEvent();
     
+    Int_t nReq = GetRequiredEvents();
+    AliInfoF("%9d: %6d/%6d %6d/%6d %6d/%6d", n, 
+            fNEventsPerDetector[0], nReq,
+            fNEventsPerDetector[1], nReq,
+            fNEventsPerDetector[2], nReq);
+
     int progress = GetProgress(n);
     if (progress <= lastProgress) continue;
     lastProgress = progress;
     std::cout << "Progress: " << lastProgress << " / 100 " << std::endl;
+
+    if (AliLog::GetDebugLevel("FMD","") >= 0) { 
+    }
     
   }
   
@@ -611,7 +650,8 @@ AliFMDBaseDA::GetStripArray(UShort_t det, Char_t ring,
 AliFMDBaseDA::Runner::Runner()
   : fReader(0),
     fDiagFile(""), 
-    fDiag(false)
+    fDiag(false),
+    fAll(false)
 {}
 
 //_____________________________________________________________________ 
@@ -660,7 +700,8 @@ AliFMDBaseDA::Runner::ShowUsage(std::ostream& o, const char* progname)
     << "Options:\n"
     << "   -h,--help                Show this help\n"
     << "   -d,--diagnostics[=FILE]  Write diagnostics to file\n"
-    << "   -D,--debug=LEVEL         Set the debug level\n\n"
+    << "   -D,--debug=LEVEL         Set the debug level\n"
+    << "   -A,--all                 Try to get data from all detectors\n\n"
     << "SOURCE is one of\n"
     << " * FILE.raw                Raw data file\n"
     << " * FILE.root               ROOT'ified raw data file\n"
@@ -694,7 +735,7 @@ AliFMDBaseDA::Runner::Init(int argc, char** argv)
   TString source;
   Int_t   debugLevel  = 0;
   Bool_t  help        = false;
-  
+
   for (int i = 1; i < argc; i++) { 
     TString arg(argv[i]);
     Bool_t  badOption   = false;
@@ -712,6 +753,7 @@ AliFMDBaseDA::Runner::Init(int argc, char** argv)
          if (ExtractValue(arg, val)) 
            fDiagFile = val;
        }
+       else if (arg.EqualTo("--all"))  fAll = true;
        else badOption = true;
       }
       else { // Short option 
@@ -730,6 +772,7 @@ AliFMDBaseDA::Runner::Init(int argc, char** argv)
            i++;
          }
          break;
+       case 'A': fAll = true ; break ;
        default: badOption = true;
        }
       } // End of options
@@ -794,6 +837,7 @@ AliFMDBaseDA::Runner::Exec(AliFMDBaseDA& da)
   timer.Start();
 
   da.SetSaveDiagnostics(fDiag || !fDiagFile.IsNull());
+  da.SetTryAll(fAll);
   if (!fDiagFile.IsNull()) da.SetDiagnosticsFilename(fDiagFile);
 
   da.Run(fReader);
index 921efef96e109e7566455cab2abf19a21e602009..39f3181f65ed3cbd4a26e2f5c1280c61caa3f2b8 100644 (file)
@@ -86,6 +86,12 @@ public:
    * @param nEvents Number of event we need
    */
   void SetRequiredEvents(Int_t nEvents) {fRequiredEvents = nEvents;}
+  /** 
+   * Set whether we should try to get all detectors 
+   *
+   * @param all If true, try to get all detectors 
+   */
+  void SetTryAll(Bool_t all=true) { fAll = all; }
   /** 
    * Get the number of required events
    * 
@@ -112,7 +118,8 @@ public:
    */
   struct Runner {
     Runner();
-    Runner(const Runner&) : fReader(0), fDiagFile(""), fDiag(false) {}
+    Runner(const Runner&) 
+      : fReader(0), fDiagFile(""), fDiag(false), fAll(false) {}
     ~Runner() {} 
     Runner& operator=(const Runner&) { return *this; }
     void   AddHandlers();
@@ -123,6 +130,7 @@ public:
     AliRawReader* fReader;
     TString       fDiagFile;
     Bool_t        fDiag;
+    Bool_t        fAll;
   };
 protected:
   /** 
@@ -323,6 +331,7 @@ protected:
   Int_t         fCurrentEvent;         // the current event       
   UInt_t        fRunno;                // Current run number 
   TObjArray     fSummaries;            // Summary histograms 
+  Bool_t        fAll;                  // Try to get data from all dets
   
   ClassDef(AliFMDBaseDA,0) // Base Detector algorithm for all run types
 
index 4cebf14b3b9a21f8be6bfd67c5a79aa05f15ddfe..c472c85497d342372d31e1a35e8060c3f0b8cd70 100644 (file)
@@ -154,7 +154,7 @@ int main(int argc, char **argv)
       retval = 
        daqDA_FES_storeFile("conditions.csv", 
                            AliFMDParameters::Instance()->GetConditionsShuttleID());
-      if (retval != 0) cerr << "Base DA failed" << endl;
+      if (retval != 0) std::cerr << "Base DA failed" << std::endl;
       
       break;