#include <TSystem.h>
#include "AliTOFFEEReader.h"
#include "AliTOFFEEConfig.h"
+#include "AliTOFFEElightConfig.h"
#include "AliTOFRawStream.h"
#include "AliTOFGeometry.h"
#include "AliLog.h"
AliTOFFEEReader::AliTOFFEEReader() :
TObject(),
fFEEConfig(new AliTOFFEEConfig()),
+ fFEElightConfig(new AliTOFFEElightConfig()),
fChannelEnabled(),
- fMatchingWindow()
+ fMatchingWindow(),
+ fLatencyWindow()
{
/*
*
AliTOFFEEReader::AliTOFFEEReader(const AliTOFFEEReader &source) :
TObject(source),
- fFEEConfig(new AliTOFFEEConfig())
+ fFEEConfig(new AliTOFFEEConfig()),
+ fFEElightConfig(new AliTOFFEElightConfig())
{
/*
*
*/
memcpy(fFEEConfig, source.fFEEConfig, sizeof(AliTOFFEEConfig));
+ memcpy(fFEElightConfig, source.fFEElightConfig, sizeof(AliTOFFEElightConfig));
}
//_______________________________________________________________
TObject::operator=(source);
memcpy(fFEEConfig, source.fFEEConfig, sizeof(AliTOFFEEConfig));
+ memcpy(fFEElightConfig, source.fFEElightConfig, sizeof(AliTOFFEElightConfig));
return *this;
}
*/
delete fFEEConfig;
+ delete fFEElightConfig;
}
//_______________________________________________________________
for (Int_t iIndex = 0; iIndex < GetNumberOfIndexes(); iIndex++) {
fChannelEnabled[iIndex] = kFALSE;
fMatchingWindow[iIndex] = 0;
+ fLatencyWindow[iIndex] = 0;
}
}
//_______________________________________________________________
+void
+AliTOFFEEReader::LoadFEElightConfig(const Char_t *FileName) const
+{
+ /*
+ *
+ * load FEElight config
+ *
+ */
+
+ Char_t *expandedFileName = gSystem->ExpandPathName(FileName);
+ std::ifstream is;
+ is.open(expandedFileName, std::ios::binary);
+ is.read((Char_t *)fFEElightConfig, sizeof(AliTOFFEElightConfig));
+ is.close();
+}
+
+//_______________________________________________________________
+
Int_t
AliTOFFEEReader::ParseFEEConfig()
{
*
*/
- AliInfo("parsing TOF FEE config")
+ AliInfo("parsing TOF FEE config");
AliTOFRawStream rawStream;
Int_t nEnabled = 0;
//_______________________________________________________________
+Int_t
+AliTOFFEEReader::ParseFEElightConfig()
+{
+ /*
+ *
+ * parse FEElight config
+ *
+ * loops over all FEE channels, checks whether they are enabled
+ * and sets channel enabled
+ *
+ */
+
+ AliInfo("parsing TOF FEElight config");
+
+ Int_t nEnabled = 0;
+ AliTOFFEEchannelConfig *channelConfig = NULL;
+ for (Int_t i = 0; i < GetNumberOfIndexes(); i++) {
+ channelConfig = fFEElightConfig->GetChannelConfig(i);
+ if (channelConfig->IsEnabled())
+ nEnabled++;
+ fChannelEnabled[i] = channelConfig->IsEnabled();
+ fMatchingWindow[i] = channelConfig->GetMatchingWindow();
+ }
+
+ return nEnabled;
+}
+
+//_______________________________________________________________
+
Bool_t
AliTOFFEEReader::IsChannelEnabled(Int_t iDDL, Int_t iTRM, Int_t iChain, Int_t iTDC, Int_t iChannel) const
{
} /* loop over crates */
}
+//_______________________________________________________________
+
+void
+AliTOFFEEReader::CreateFEElightConfig(const Char_t *filename)
+{
+ /*
+ *
+ * create FEElight config
+ *
+ */
+
+ AliTOFFEElightConfig lightConfig;
+
+ for (Int_t i = 0; i < GetNumberOfIndexes(); i++) {
+ if (fChannelEnabled[i]) {
+ lightConfig.GetChannelConfig(i)->SetStatus(AliTOFFEEchannelConfig::kStatusEnabled);
+ lightConfig.GetChannelConfig(i)->SetMatchingWindow(fMatchingWindow[i]);
+ lightConfig.GetChannelConfig(i)->SetLatencyWindow(fLatencyWindow[i]);
+ }
+ else {
+ lightConfig.GetChannelConfig(i)->SetStatus(0x0);
+ lightConfig.GetChannelConfig(i)->SetMatchingWindow(0);
+ lightConfig.GetChannelConfig(i)->SetLatencyWindow(0);
+ }
+ }
+
+ Char_t *expandedFileName = gSystem->ExpandPathName(filename);
+ std::ofstream os;
+ os.open(expandedFileName, std::ios::binary);
+ os.write((Char_t *)&lightConfig, sizeof(AliTOFFEElightConfig));
+ os.close();
+
+}
//#include "AliTOFGeometry.h"
class AliTOFFEEConfig;
+class AliTOFFEElightConfig;
class AliTOFFEEReader :
public TObject
static Int_t GetNumberOfChannels() {return fgkNumberOfChannels;}; // get number of channels
static Int_t GetNumberOfIndexes() {return fgkNumberOfIndexes;}; // get number of indexes
AliTOFFEEConfig *GetFEEConfig() const {return fFEEConfig;}; // get FEE config
+ AliTOFFEElightConfig *GetFEElightConfig() const {return fFEElightConfig;}; // get FEElight config
Bool_t GetChannelEnabled(Int_t iIndex) const {return iIndex < GetNumberOfIndexes() ? fChannelEnabled[iIndex] : kFALSE;}; // get channel enabled
Int_t GetMatchingWindow(Int_t iIndex) const {return iIndex < GetNumberOfIndexes() ? fMatchingWindow[iIndex] : 0;}; // get matching window
+ Int_t GetLatencyWindow(Int_t iIndex) const {return iIndex < GetNumberOfIndexes() ? fLatencyWindow[iIndex] : 0;}; // get latency window
/* setters */
/* methods */
+
+ /* TOFFEE methods */
void LoadFEEConfig(const Char_t *FileName) const; // load FEE config
void DumpFEEConfig(); // dump FEE config
Int_t ParseFEEConfig(); // parse FEE config
+
+ /* TOFFEElight methods */
+ void LoadFEElightConfig(const Char_t *FileName) const; // load FEElight config
+ void CreateFEElightConfig(const Char_t *filename); // create FEElight config
+ Int_t ParseFEElightConfig(); // parse FEElight config
+
void ResetChannelEnabledArray(); // reset channel enabled array
void Reset(); // reset channel enabled array
- Bool_t IsChannelEnabled(Int_t iDDL, Int_t iTRM, Int_t iChain, Int_t iTDC, Int_t iChannel) const; // is channel enabled
Bool_t IsChannelEnabled(Int_t iIndex) const {return GetChannelEnabled(iIndex);}; // is channel enabled
- Int_t GetMatchingWindow(Int_t iDDL, Int_t iTRM, Int_t iChain, Int_t iTDC, Int_t iChannel) const; // get matching window
private:
+ /* TOFFEE */
+ Bool_t IsChannelEnabled(Int_t iDDL, Int_t iTRM, Int_t iChain, Int_t iTDC, Int_t iChannel) const; // is channel enabled (from TOFFEE)
+ Int_t GetMatchingWindow(Int_t iDDL, Int_t iTRM, Int_t iChain, Int_t iTDC, Int_t iChannel) const; // get matching window (from TOFFEE)
+
static const Int_t fgkNumberOfDDLs = 72; // number of DDLs
static const Int_t fgkNumberOfTRMs = 10; // number of TRMs
static const Int_t fgkNumberOfChains = 2; // number of chains
static const Int_t fgkNumberOfIndexes = 157248; // number of indexes
AliTOFFEEConfig *fFEEConfig; // FEE config
+ AliTOFFEElightConfig *fFEElightConfig; // FEElight config
Bool_t fChannelEnabled[fgkNumberOfIndexes]; // channel enabled
Int_t fMatchingWindow[fgkNumberOfIndexes]; // matching window
+ Int_t fLatencyWindow[fgkNumberOfIndexes]; // matching window
ClassDef(AliTOFFEEReader, 1);
Int_t fLatencyWindow; // latency window [ns]
public:
+ AliTOFFEEchannelConfig() : fStatus(0x0), fMatchingWindow(0), fLatencyWindow(0) {}; // default construct
+ ~AliTOFFEEchannelConfig() {}; // default destructor
+
UChar_t GetStatus() const {return fStatus;}; // get status
Int_t GetMatchingWindow() const {return fMatchingWindow;}; // get matching window
Int_t GetLatencyWindow() const {return fLatencyWindow;}; // get latency window
+ void SetStatus(UChar_t value) {fStatus = value;}; // set status
+ void SetMatchingWindow(Int_t value) {fMatchingWindow = value;}; // set matching window
+ void SetLatencyWindow(Int_t value) {fLatencyWindow = value;}; // set latency window
+
Bool_t IsEnabled() const {return (GetStatus() & kStatusEnabled);}; // is enabled
};
AliTOFFEEchannelConfig fChannelConfig[fgkNumberOfChannels]; // channel config array
public:
+ AliTOFFEElightConfig() : fVersion(0), fRunNumber(0), fRunType(0), fChannelConfig() {}; // default construct
+ ~AliTOFFEElightConfig() {}; // default destructor
+
Int_t GetVersion() const {return fVersion;}; // get version
Int_t GetRunNumber() const {return fRunNumber;}; // get run number
Int_t GetRunType() const {return fRunType;}; // get run type
- AliTOFFEEchannelConfig *GetChannelConfig(Int_t i) {return i < fgkNumberOfChannels ? &fChannelConfig[i] : NULL;}; // get channel config
+ AliTOFFEEchannelConfig *GetChannelConfig(Int_t i) {return (i < fgkNumberOfChannels ? &fChannelConfig[i] : NULL);}; // get channel config
+
+ void SetVersion(Int_t value) {fVersion = value;}; // get version
+ void SetRunNumber(Int_t value) {fRunNumber = value;}; // get run number
+ void SetRunType(Int_t value) {fRunType = value;}; // get run type
};