]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliDetectorTagCuts.cxx
Added methods to set/get centrailty from clusters in outer layer, which is less noisy...
[u/mrichter/AliRoot.git] / STEER / AliDetectorTagCuts.cxx
index c3001e6148ab38e552f499d7c34daaf31793469e..150a9b873c148a35088c3e1b26e78ec31e7c7226 100644 (file)
@@ -32,10 +32,17 @@ ClassImp(AliDetectorTagCuts)
 //___________________________________________________________________________
 AliDetectorTagCuts::AliDetectorTagCuts() :
   TObject(),
-  fDetectors(0), 
-  fDetectorsFlag(kFALSE)
+  fDetectorsReco(0),
+  fDetectorsDAQ(0),
+  fDetectorsFlag(kFALSE),
+  fDetectorValidityMatch(),
+  fDetectorValidityFlag()
 {
   //Default constructor which calls the Reset method.
+  for (int iter = 0; iter<AliDAQ::kHLTId; iter++) {
+    fDetectorValidityMatch[iter] = 0;
+    fDetectorValidityFlag[iter] = 0;
+  }
 }
 
 //___________________________________________________________________________
@@ -46,42 +53,64 @@ AliDetectorTagCuts::~AliDetectorTagCuts() {
 //___________________________________________________________________________
 Bool_t AliDetectorTagCuts::IsAccepted(AliDetectorTag *detTag) const {
   //Returns true if the event is accepted otherwise false.
-  if(fDetectorsFlag){
-    TString detStr = fDetectors;
-    TObjArray *activeDetectors = detTag->GetDetectorMask();
-    for (Int_t iDet = 0; iDet < activeDetectors->GetEntries(); iDet++) {
-      TObjString *detectorString = (TObjString *)activeDetectors->At(iDet);
-      if (!IsSelected(detectorString->GetString(), detStr))return kFALSE;
+  if (fDetectorsFlag) {
+    Bool_t daqsel = (detTag->GetIntDetectorMaskDAQ() & fDetectorsDAQ) > 0;
+    Bool_t recsel = (detTag->GetIntDetectorMaskReco() & fDetectorsReco) > 0;
+    Bool_t valsel = kTRUE;
+    for (int iter=0;  iter<AliDAQ::kHLTId; iter++) {
+      if (fDetectorValidityFlag[iter])
+       if (!(fDetectorValidityMatch[iter] == detTag->GetDetectorValidityRange(iter)))
+         valsel = kFALSE;
     }
+    return (daqsel && recsel && valsel);
   }
-  return kTRUE;
+  return true;
+
+//   if(fDetectorsFlag){
+//     TString detStr = fDetectors;
+//     TObjArray *activeDetectors = detTag->GetDetectorMask();
+//     for (Int_t iDet = 0; iDet < activeDetectors->GetEntries(); iDet++) {
+//       TObjString *detectorString = (TObjString *)activeDetectors->At(iDet);
+//       if (!IsSelected(detectorString->GetString(), detStr))return kFALSE;
+//     }
+//   }
+//   return kTRUE;
+}
+  
+void AliDetectorTagCuts::SetDetectorValidityValue(TString det, UShort_t val)
+{
+  // Set Validity requiement for detector
+
+  Short_t detid = AliDAQ::DetectorID(det.Data());
+  fDetectorValidityMatch[detid] = val;
+  fDetectorsFlag = kTRUE;
 }
 
 //___________________________________________________________________________
-Bool_t AliDetectorTagCuts::IsSelected(TString detName, TString& detectors) const {
-  //Returns true if the detector is included
-  if ((detectors.CompareTo("ALL") == 0) ||
-      detectors.BeginsWith("ALL ") ||
-      detectors.EndsWith(" ALL") ||
-      detectors.Contains(" ALL ")) {
-    detectors = "ALL";
-    return kTRUE;
-  }
+// Bool_t AliDetectorTagCuts::IsSelected(TString detName, TString& detectors) const {
+//   //Returns true if the detector is included
+//   if ((detectors.CompareTo("ALL") == 0) ||
+//       detectors.BeginsWith("ALL ") ||
+//       detectors.EndsWith(" ALL") ||
+//       detectors.Contains(" ALL ")) {
+//     detectors = "ALL";
+//     return kTRUE;
+//   }
   
-  // search for the given detector
-  Bool_t result = kFALSE;
-  if ((detectors.CompareTo(detName) == 0) ||
-      detectors.BeginsWith(detName+" ") ||
-      detectors.EndsWith(" "+detName) ||
-      detectors.Contains(" "+detName+" ")) {
-    detectors.ReplaceAll(detName, "");
-    result = kTRUE;
-  }
+//   // search for the given detector
+//   Bool_t result = kFALSE;
+//   if ((detectors.CompareTo(detName) == 0) ||
+//       detectors.BeginsWith(detName+" ") ||
+//       detectors.EndsWith(" "+detName) ||
+//       detectors.Contains(" "+detName+" ")) {
+//     detectors.ReplaceAll(detName, "");
+//     result = kTRUE;
+//   }
 
-  // clean up the detectors string
-  while (detectors.Contains("  ")) detectors.ReplaceAll("  ", " ");
-  while (detectors.BeginsWith(" ")) detectors.Remove(0, 1);
-  while (detectors.EndsWith(" ")) detectors.Remove(detectors.Length()-1, 1);
+//   // clean up the detectors string
+//   while (detectors.Contains("  ")) detectors.ReplaceAll("  ", " ");
+//   while (detectors.BeginsWith(" ")) detectors.Remove(0, 1);
+//   while (detectors.EndsWith(" ")) detectors.Remove(detectors.Length()-1, 1);
  
-  return result;
-}
+//   return result;
+// }