fFixedMaxStrip(0),
fFixedPulseGain(0),
fEdepMip(0),
+ fHasRcuTrailer(kTRUE),
+ fHasCompleteHeader(kTRUE),
fZeroSuppression(0),
fSampleRate(0),
fPedestal(0),
@param min Minimum strip number (0-127).
@param max Maximum strip number (0-127). */
void SetStripRange(UShort_t min=0, UShort_t max=127);
+ /** Whether raw data is in the old ALTRO format (i.e., no RCU
+ trailer), or in the new format (with a trailer).
+ @param yes if true the raw data has RCU trailer */
+ void UseRcuTrailer(Bool_t yes=kTRUE) { fHasRcuTrailer = yes; }
+ /** Whether raw data has full common data header (8 32bit words) or
+ the older invalid format (7 32bit words with bogus entries)
+ @param yes if true the raw data has complete data header */
+ void UseCompleteHeader(Bool_t yes=kTRUE) { fHasCompleteHeader = yes; }
/** @} */
/** @{ */
Char_t ring,
UShort_t sector,
UShort_t strip) const;
+ /** Get the number of pre-samples in ALTRO channels
+ @param detector Detector # (1-3)
+ @param ring Ring ID ('I' or 'O')
+ @param sector Sector number (0-39)
+ @param strip Strip number (0-511)
+ @return Maximum strip */
+ UShort_t GetPreSamples(UShort_t,
+ Char_t,
+ UShort_t,
+ UShort_t) const { return 14+5; }
/** Translate hardware address to detector coordinates
@param ddl DDL number
@param board Board address
@return Get the map that translates hardware to detector
coordinates */
AliFMDAltroMapping* GetAltroMap() const;
+ /** Whether raw data is in the old ALTRO format (i.e., no RCU
+ trailer), or in the new format (with a trailer).
+ @return false if the raw data has no RCU trailer */
+ Bool_t HasRcuTrailer() const { return fHasRcuTrailer; }
+ /** Whether raw data has full common data header (8 32bit words) or
+ the older invalid format (7 32bit words with bogus entries)
+ @return false if the raw data has incomplete data header */
+ Bool_t HasCompleteHeader() const { return fHasCompleteHeader; }
+
/** @} */
static const char* PulseGainPath() { return fgkPulseGain; }
fFixedMaxStrip(o.fFixedMaxStrip),
fFixedPulseGain(o.fFixedPulseGain),
fEdepMip(o.fEdepMip),
+ fHasRcuTrailer(o.fHasRcuTrailer),
+ fHasCompleteHeader(o.fHasCompleteHeader),
fZeroSuppression(o.fZeroSuppression),
fSampleRate(o.fSampleRate),
fPedestal(o.fPedestal),
UShort_t fFixedMaxStrip; // Maximum strip read-out
mutable Float_t fFixedPulseGain; //! Gain (cached)
mutable Float_t fEdepMip; //! Cache of energy loss for a MIP
+ Bool_t fHasRcuTrailer; // if the raw data has RCU trailer
+ Bool_t fHasCompleteHeader; // raw data has incomplete data header
AliFMDCalibZeroSuppression* fZeroSuppression; // Zero suppression from CDB
AliFMDCalibSampleRate* fSampleRate; // Sample rate from CDB
// Get sample rate
AliFMDParameters* pars = AliFMDParameters::Instance();
AliFMDRawStream input(fReader);
+ AliFMDDebug(5, ("Setting old RCU format and 7 word headers"));
+ input.SetOldRCUFormat(!pars->HasRcuTrailer());
+ input.SetShortDataHeader(!pars->HasCompleteHeader());
UShort_t stripMin = 0;
UShort_t stripMax = 127;
- UShort_t preSamp = 0;
+ UShort_t preSamp = 14+5;
UInt_t ddl = 0;
UInt_t rate = 0;
// Data array is approx twice the size needed.
UShort_t data[2048];
- while (input.ReadChannel(ddl, hwaddr, last, data)) {
+ Bool_t isGood = kTRUE;
+ while (isGood) {
+ isGood = input.ReadChannel(ddl, hwaddr, last, data);
AliFMDDebug(5, ("Read channel 0x%x of size %d", hwaddr, last));
UShort_t det, sec, str;
rate = pars->GetSampleRate(det, ring, sec, str);
stripMin = pars->GetMinStrip(det, ring, sec, str);
stripMax = pars->GetMaxStrip(det, ring, sec, str);
+ preSamp = pars->GetPreSamples(det, ring, sec, str);
AliFMDDebug(5, ("DDL 0x%04x, address 0x%03x maps to FMD%d%c[%2d,%3d]",
ddl, hwaddr, det, ring, sec, str));
for (size_t i = 0; i < last; i++) {
if (i < preSamp) continue;
Int_t n = array->GetEntriesFast();
- UShort_t curStr = str + stripMin + i / rate;
+ Short_t curStr = str + stripMin + (i-preSamp) / rate;
if ((curStr-str) > stripMax) {
- AliError(Form("Current strip is %d but DB says max is %d",
- curStr, stripMax));
+ // AliInfo(Form("timebin %4d -> (%3d+%3d+(%4d-%d)/%d) -> %d",
+ // i, str, stripMin, i, preSamp, rate, curStr));
+ // AliError(Form("Current strip is %3d (0x%04x,0x%03x,%4d) "
+ // "but DB says max is %3d (rate=%d)",
+ // curStr, ddl, hwaddr, i, str+stripMax, rate));
+ // Garbage timebins - ignore
+ continue;
}
AliFMDDebug(5, ("making digit for FMD%d%c[%2d,%3d] from sample %4d",
det, ring, sec, curStr, i));
det, ring, sector, strip));
continue;
}
+ preSamples = pars->GetPreSamples(det, ring, sector, strip);
+
AliFMDDebug(10, ("FMD%d%c[%2d,%3d]-> ddl: 0x%x addr: 0x%x",
det, ring, sector, strip, ddl, addr));
if (addr != prevaddr) {
@brief Read raw data into a TClonesArray - for testing
*/
void
-ReadRaw()
+ReadRaw(const char* file=0, Int_t evno=0, bool old=false)
{
+ TString src(file ? file : "");
AliCDBManager* cdb = AliCDBManager::Instance();
cdb->SetRun(0);
cdb->SetDefaultStorage("local://$ALICE_ROOT");
- AliLog::SetModuleDebugLevel("FMD", 10);
+ AliLog::SetModuleDebugLevel("FMD", 1);
AliFMDParameters::Instance()->Init();
- AliRawReader* r = new AliRawReaderFile(0);
+ AliFMDParameters::Instance()->UseRcuTrailer(!old);
+ AliFMDParameters::Instance()->UseCompleteHeader(!old);
+ AliRawReader* r = 0;
+ if (src.IsNull()) {
+ std::cout << "Reading via AliRawReaderFile" << std::endl;
+ r = new AliRawReaderFile(0);
+ }
+ else if (src.EndsWith(".root")) {
+ std::cout << "Reading via AliRawReaderRoot" << std::endl;
+ r = new AliRawReaderRoot(src.Data(), evno);
+ }
+ else if (src.EndsWith(".raw")) {
+ std::cout << "Reading via AliRawReaderDate" << std::endl;
+ r = new AliRawReaderDate(src.Data());
+ }
+ else {
+ std::cerr << "Unknown raw type for source " << src
+ << " assuming simulated raw files in directory " << src
+ << std::endl;
+ r = new AliRawReaderFile(src);
+ }
AliFMDRawReader* fr = new AliFMDRawReader(r, 0);
- TClonesArray* a = new TClonesArray("AliFMDDigit");
+ TClonesArray* a = new TClonesArray("AliFMDDigit", 0);
fr->ReadAdcs(a);
+
+ std::cout << "Read " << a->GetEntriesFast() << " digits" << std::endl;
+
+ bool read[3][2][40][512];
+ for (UShort_t det = 0; det < 3; det++) {
+ for (UShort_t rng = 0; rng < 2; rng++) {
+ for (UShort_t sec = 0; sec < 40; sec++) {
+ for (UShort_t str = 0; str < 512; str++) {
+ read[det][rng][sec][str] = false;
+ }
+ }
+ }
+ }
+
+
+ TIter next(a);
+ AliFMDDigit* d = 0;
+ while ((d = static_cast<AliFMDDigit*>(next()))) {
+ UShort_t det = d->Detector() - 1;
+ UShort_t rng = d->Ring() == 'I' ? 0 : 1;
+ UShort_t sec = d->Sector();
+ UShort_t str = d->Strip();
+ read[det][rng][sec][str] = true;
+ }
+ const UShort_t lineLength = 64;
+ for (UShort_t det = 0; det < 3; det++) {
+ for (UShort_t rng = 0; rng < 2; rng++) {
+ if (det == 0 && rng == 1) continue;
+ Char_t rid = rng == 0 ? 'I' : 'O';
+ UShort_t nsec = rng == 0 ? 20 : 40;
+ UShort_t nstr = rng == 0 ? 512 : 256;
+ std::cout << "FMD" << det+1 << rid << ":" << std::endl;
+ for (UShort_t sec = 0; sec < nsec; sec++) {
+ std::cout << " Sector " << sec << "\n" << std::flush;
+ for (UShort_t str = 0; str < nstr; str++) {
+ bool on = read[det][rng][sec][str];
+ if (str % lineLength == 0) std::cout << " ";
+ std::cout << (on ? '+' : '-');
+ if (str % lineLength == lineLength-1) std::cout << "\n";
+ }
+ }
+ }
+ }
+ // a->ls();
}
//____________________________________________________________________
//