]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added method to retrieve TDC matching window
authorrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 3 Apr 2009 07:53:02 +0000 (07:53 +0000)
committerrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 3 Apr 2009 07:53:02 +0000 (07:53 +0000)
TOF/AliTOFFEEReader.cxx
TOF/AliTOFFEEReader.h

index 08e755c86fc685f3cfe2da53e961a4776c615b36..01c3a757d223135061f065c94eb42f99892ec2d4 100644 (file)
@@ -40,7 +40,8 @@ ClassImp(AliTOFFEEReader)
 AliTOFFEEReader::AliTOFFEEReader() :
   TObject(),
   fFEEConfig(new AliTOFFEEConfig()),
-  fChannelEnabled()
+  fChannelEnabled(),
+  fMatchingWindow()
 {
   /* 
    * 
@@ -48,6 +49,7 @@ AliTOFFEEReader::AliTOFFEEReader() :
    *
    */
 
+  Reset();
 }
 
 //_______________________________________________________________
@@ -76,9 +78,6 @@ AliTOFFEEReader::operator=(const AliTOFFEEReader &source)
    * 
    */
 
-  if (this == &source)
-    return *this;
-
   TObject::operator=(source);
   memcpy(fFEEConfig, source.fFEEConfig, sizeof(AliTOFFEEConfig));
   return *this;
@@ -114,6 +113,23 @@ AliTOFFEEReader::ResetChannelEnabledArray()
 
 //_______________________________________________________________
 
+void
+AliTOFFEEReader::Reset()
+{
+  /*
+   *
+   * reset 
+   *
+   */
+
+  for (Int_t iIndex = 0; iIndex < GetNumberOfIndexes(); iIndex++) {
+    fChannelEnabled[iIndex] = kFALSE;
+    fMatchingWindow[iIndex] = 0;
+  }
+}
+
+//_______________________________________________________________
+
 void
 AliTOFFEEReader::LoadFEEConfig(const Char_t *FileName) const
 {
@@ -151,7 +167,7 @@ AliTOFFEEReader::ParseFEEConfig()
   Int_t volume[5], index;
   Int_t temp;
 
-  ResetChannelEnabledArray();
+  Reset();
 
   /* loop over all FEE channels */
   for (Int_t iDDL = 0; iDDL < GetNumberOfDDLs(); iDDL++)
@@ -165,12 +181,20 @@ AliTOFFEEReader::ParseFEEConfig()
              rawStream.EquipmentId2VolumeId(iDDL, iTRM + 3, iChain, iTDC, iChannel, volume);
              /* swap padx and padz to fit AliTOFGeometry::GetIndex behaviour */
              temp = volume[4]; volume[4] = volume[3]; volume[3] = temp; 
+             /* check if index is ok */
+             if (volume[0] < 0 || volume[0] > 17 ||
+                 volume[1] < 0 || volume[1] > 4 ||
+                 volume[2] < 0 || volume[2] > 18 ||
+                 volume[3] < 0 || volume[3] > 1 ||
+                 volume[4] < 0 || volume[4] > 47)
+               continue;
              /* convert detector indexes into calibration index */
              index = AliTOFGeometry::GetIndex(volume);
              /* check calibration index */
              if (index != -1 && index < GetNumberOfIndexes()) {
                /* set calibration channel enabled */
                fChannelEnabled[index] = kTRUE;
+               fMatchingWindow[index] = GetMatchingWindow(iDDL, iTRM + 3, iChain, iTDC, iChannel);
                nEnabled++;
              }
            }
@@ -286,6 +310,49 @@ AliTOFFEEReader::IsChannelEnabled(Int_t iDDL, Int_t iTRM, Int_t iChain, Int_t iT
   
 }
 
+//_______________________________________________________________
+
+Int_t 
+AliTOFFEEReader::GetMatchingWindow(Int_t iDDL, Int_t iTRM, Int_t iChain, Int_t iTDC, Int_t iChannel) const
+{
+  /*
+   *
+   * get matching window
+   *
+   * checks whether a FEE channel is enabled using the
+   * TOF FEE config object and return the associated
+   * matching window
+   *
+   */
+
+  AliTOFFEEConfig *feeConfig;
+  AliTOFCrateConfig *crateConfig;
+  AliTOFTRMConfig *trmConfig;
+  Int_t maskPB, maskTDC;
+  
+  /* get and check fee config */
+  if (!(feeConfig = GetFEEConfig()))
+    return 0;
+  
+  /* get and check crate config */
+  if (!(crateConfig = feeConfig->GetCrateConfig(iDDL)))
+    return 0;
+  
+  /* get and check TRM config */
+  if (!(trmConfig = crateConfig->GetTRMConfig(iTRM - 3)))
+    return 0;
+
+  /* check DRM enabled */
+  if (!crateConfig->IsDRMEnabled())
+    return 0;
+
+  /* check TRM enabled */
+  if (!crateConfig->IsTRMEnabled(iTRM - 3))
+    return 0;
+
+  return trmConfig->GetMatchingWindow();
+}
+
 
 void
 AliTOFFEEReader::DumpFEEConfig()
index ef08bcd491c041308430eb548f15d298abcfba0c..27493a8cd1e9a05aaa36982e5317d89a7340a585 100644 (file)
@@ -39,6 +39,7 @@ public TObject
   static Int_t GetNumberOfIndexes() {return fgkNumberOfIndexes;}; // get number of indexes
   AliTOFFEEConfig *GetFEEConfig() const {return fFEEConfig;}; // get FEE 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
   
   /* setters */
   
@@ -47,8 +48,10 @@ public TObject
   void DumpFEEConfig(); // dump FEE config
   Int_t ParseFEEConfig(); // parse FEE 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:
 
@@ -61,6 +64,7 @@ public TObject
 
   AliTOFFEEConfig *fFEEConfig; // FEE config
   Bool_t fChannelEnabled[fgkNumberOfIndexes]; // channel enabled
+  Int_t fMatchingWindow[fgkNumberOfIndexes]; // matching window
 
   ClassDef(AliTOFFEEReader, 1);