]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
AliTOFFEEReader modified in order to deal also with TOFFEElight data. The methods...
authorrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 7 Jun 2009 12:55:15 +0000 (12:55 +0000)
committerrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 7 Jun 2009 12:55:15 +0000 (12:55 +0000)
TOF/AliTOFFEEReader.cxx
TOF/AliTOFFEEReader.h
TOF/AliTOFFEElightConfig.h
TOF/ShuttleInput/TOFFEElight.20090515.120201.99999 [new file with mode: 0644]

index 102020071a55e0d8b03b4bd820864af5b770edfb..4c0a09e9b6b18c2f6cffb923caab898f5243f3fb 100644 (file)
@@ -28,6 +28,7 @@
 #include <TSystem.h>
 #include "AliTOFFEEReader.h"
 #include "AliTOFFEEConfig.h"
+#include "AliTOFFEElightConfig.h"
 #include "AliTOFRawStream.h"
 #include "AliTOFGeometry.h"
 #include "AliLog.h"
@@ -40,8 +41,10 @@ ClassImp(AliTOFFEEReader)
 AliTOFFEEReader::AliTOFFEEReader() :
   TObject(),
   fFEEConfig(new AliTOFFEEConfig()),
+  fFEElightConfig(new AliTOFFEElightConfig()),
   fChannelEnabled(),
-  fMatchingWindow()
+  fMatchingWindow(),
+  fLatencyWindow()
 {
   /* 
    * 
@@ -56,7 +59,8 @@ AliTOFFEEReader::AliTOFFEEReader() :
 
 AliTOFFEEReader::AliTOFFEEReader(const AliTOFFEEReader &source) :
   TObject(source),
-  fFEEConfig(new AliTOFFEEConfig())
+  fFEEConfig(new AliTOFFEEConfig()),
+  fFEElightConfig(new AliTOFFEElightConfig())
 {
   /* 
    * 
@@ -65,6 +69,7 @@ AliTOFFEEReader::AliTOFFEEReader(const AliTOFFEEReader &source) :
    */
 
   memcpy(fFEEConfig, source.fFEEConfig, sizeof(AliTOFFEEConfig));
+  memcpy(fFEElightConfig, source.fFEElightConfig, sizeof(AliTOFFEElightConfig));
 }
 
 //_______________________________________________________________
@@ -80,6 +85,7 @@ AliTOFFEEReader::operator=(const AliTOFFEEReader &source)
 
   TObject::operator=(source);
   memcpy(fFEEConfig, source.fFEEConfig, sizeof(AliTOFFEEConfig));
+  memcpy(fFEElightConfig, source.fFEElightConfig, sizeof(AliTOFFEElightConfig));
   return *this;
 }
 
@@ -94,6 +100,7 @@ AliTOFFEEReader::~AliTOFFEEReader()
    */
 
   delete fFEEConfig;
+  delete fFEElightConfig;
 }
 
 //_______________________________________________________________
@@ -125,6 +132,7 @@ AliTOFFEEReader::Reset()
   for (Int_t iIndex = 0; iIndex < GetNumberOfIndexes(); iIndex++) {
     fChannelEnabled[iIndex] = kFALSE;
     fMatchingWindow[iIndex] = 0;
+    fLatencyWindow[iIndex] = 0;
   }
 }
 
@@ -148,6 +156,24 @@ AliTOFFEEReader::LoadFEEConfig(const Char_t *FileName) const
 
 //_______________________________________________________________
 
+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()
 {
@@ -160,7 +186,7 @@ AliTOFFEEReader::ParseFEEConfig()
    *
    */
 
-  AliInfo("parsing TOF FEE config")
+  AliInfo("parsing TOF FEE config");
 
   AliTOFRawStream rawStream;
   Int_t nEnabled = 0;
@@ -203,6 +229,35 @@ AliTOFFEEReader::ParseFEEConfig()
 
 //_______________________________________________________________
 
+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
 {
@@ -449,3 +504,36 @@ AliTOFFEEReader::DumpFEEConfig()
   } /* 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();
+  
+}
index 27493a8cd1e9a05aaa36982e5317d89a7340a585..c17edbc01987ffbbde8f27d6440805604c4f93fc 100644 (file)
@@ -18,6 +18,7 @@
 //#include "AliTOFGeometry.h"
 
 class AliTOFFEEConfig;
+class AliTOFFEElightConfig;
 
 class AliTOFFEEReader :
 public TObject 
@@ -38,23 +39,35 @@ 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
@@ -63,8 +76,10 @@ public TObject
   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);
 
index 62188fb4af86e22de0e2158bde5387913aa90047..4105d03fc7a8ab34e003f0a6ba7bfa5aa71c94e7 100644 (file)
@@ -29,10 +29,17 @@ class AliTOFFEEchannelConfig
   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
 
 };
@@ -50,10 +57,17 @@ class AliTOFFEElightConfig
   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
 
 };
 
diff --git a/TOF/ShuttleInput/TOFFEElight.20090515.120201.99999 b/TOF/ShuttleInput/TOFFEElight.20090515.120201.99999
new file mode 100644 (file)
index 0000000..d2c9bbb
Binary files /dev/null and b/TOF/ShuttleInput/TOFFEElight.20090515.120201.99999 differ