fRequiredEvents(0),
fCurrentEvent(0),
fRunno(0),
- fSummaries(0)
+ fSummaries(0),
+ fAll(false)
{
//Constructor
for(Int_t i = 0; i< 3;i++) {
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++) {
//_____________________________________________________________________
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);
}
//_____________________________________________________________________
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);
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++)
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) {
+ }
}
AliFMDBaseDA::Runner::Runner()
: fReader(0),
fDiagFile(""),
- fDiag(false)
+ fDiag(false),
+ fAll(false)
{}
//_____________________________________________________________________
<< "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"
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;
if (ExtractValue(arg, val))
fDiagFile = val;
}
+ else if (arg.EqualTo("--all")) fAll = true;
else badOption = true;
}
else { // Short option
i++;
}
break;
+ case 'A': fAll = true ; break ;
default: badOption = true;
}
} // End of options
timer.Start();
da.SetSaveDiagnostics(fDiag || !fDiagFile.IsNull());
+ da.SetTryAll(fAll);
if (!fDiagFile.IsNull()) da.SetDiagnosticsFilename(fDiagFile);
da.Run(fReader);
* @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
*
*/
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();
AliRawReader* fReader;
TString fDiagFile;
Bool_t fDiag;
+ Bool_t fAll;
};
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