Adding options to count false decisions also.
authoraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Nov 2010 02:52:18 +0000 (02:52 +0000)
committeraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Nov 2010 02:52:18 +0000 (02:52 +0000)
HLT/trigger/AliHLTTriggerCounterComponent.cxx
HLT/trigger/AliHLTTriggerCounterComponent.h

index 8d26fbb..99c5e9a 100644 (file)
@@ -51,7 +51,9 @@ AliHLTTriggerCounterComponent::AliHLTTriggerCounterComponent() :
        fInputTimes(TCollection::kInitHashTableCapacity, 2),
        fOutputTimes(TCollection::kInitHashTableCapacity, 2),
        fLastPublishTime(-1),
-       fPublishPeriod(-1)
+       fPublishPeriod(-1),
+       fCountFalseInputs(false),
+       fCountFalseOutputs(false)
 {
        // Default constructor.
        
@@ -126,6 +128,8 @@ Int_t AliHLTTriggerCounterComponent::DoInit(int argc, const char** argv)
        fOutputTimes.Clear();
        fLastPublishTime = -1;
        fPublishPeriod = -1;
+       fCountFalseInputs = false;
+       fCountFalseOutputs = false;
        bool loadCDBObject = true;
        
        for (int i = 0; i < argc; ++i)
@@ -185,6 +189,18 @@ Int_t AliHLTTriggerCounterComponent::DoInit(int argc, const char** argv)
                        continue;
                }
                
+               if (strcmp(argv[i], "-countfalseinputs") == 0)
+               {
+                       fCountFalseInputs = true;
+                       continue;
+               }
+               
+               if (strcmp(argv[i], "-countfalseoutputs") == 0)
+               {
+                       fCountFalseOutputs = true;
+                       continue;
+               }
+               
                HLTError("Unknown option '%s'.", argv[i]);
                return -EINVAL;
        } // for loop
@@ -229,33 +245,38 @@ int AliHLTTriggerCounterComponent::DoEvent(const AliHLTComponentEventData& /*evt
        const TObject* obj = GetFirstInputObject(kAliHLTDataTypeGlobalTrigger, "AliHLTGlobalTriggerDecision");
        while (obj != NULL)
        {
+               HLTDebug("Received trigger decision object of type AliHLTGlobalTriggerDecision.");
                const AliHLTGlobalTriggerDecision* decision = dynamic_cast<const AliHLTGlobalTriggerDecision*>(obj);
                if (decision != NULL)
                {
-                       HLTDebug("Received trigger decision object of type AliHLTGlobalTriggerDecision.");
-                       // Tokenise the global trigger description string which contains a
-                       // list of the triggers that were fired and increment the corresponding
-                       // counters.
-                       TString names = decision->Description();
-                       Ssiz_t from = 0;
-                       TString token;
-                       while (names.Tokenize(token, from, ","))
+                       if ((not fCountFalseOutputs and decision->Result()) or fCountFalseOutputs)
                        {
-                               TObject* cntobj = fOutputCounters.FindObject(token.Data());
-                               if (cntobj != NULL)
+                               // Tokenise the global trigger description string which contains a
+                               // list of the triggers that were fired and increment the corresponding
+                               // counters.
+                               TString names = decision->Description();
+                               Ssiz_t from = 0;
+                               TString token;
+                               while (names.Tokenize(token, from, ","))
                                {
-                                       AliHLTTriggerCounters::AliCounter* counter = static_cast<AliHLTTriggerCounters::AliCounter*>(cntobj);
-                                       counter->Increment();
-                                       UpdateCounterRate(
-                                                       counter,
-                                                       static_cast<AliRingBuffer*>( fOutputTimes.FindObject(token.Data()) ),
-                                                       outputTime
-                                               );
-                               }
-                               else
-                               {
-                                       fOutputCounters.Add(token.Data(), "New trigger output counter found during the run.", 1, 1);
-                                       fOutputTimes.Add(new AliRingBuffer(token.Data(), outputTime));
+                                       TObject* cntobj = fOutputCounters.FindObject(token.Data());
+                                       if (cntobj != NULL)
+                                       {
+                                               HLTDebug("Updating existing output counter \"%s\".", cntobj->GetName());
+                                               AliHLTTriggerCounters::AliCounter* counter = static_cast<AliHLTTriggerCounters::AliCounter*>(cntobj);
+                                               counter->Increment();
+                                               UpdateCounterRate(
+                                                               counter,
+                                                               static_cast<AliRingBuffer*>( fOutputTimes.FindObject(token.Data()) ),
+                                                               outputTime
+                                                       );
+                                       }
+                                       else
+                                       {
+                                               HLTDebug("Adding new output counter \"%s\".", cntobj->GetName());
+                                               fOutputCounters.Add(token.Data(), "New trigger output counter found during the run.", 1, 1);
+                                               fOutputTimes.Add(new AliRingBuffer(token.Data(), outputTime));
+                                       }
                                }
                        }
                        
@@ -272,6 +293,7 @@ int AliHLTTriggerCounterComponent::DoEvent(const AliHLTComponentEventData& /*evt
                                        TObject* cntobj = fInputCounters.FindObject(ctpName);
                                        if (cntobj != NULL)
                                        {
+                                               HLTDebug("Updating existing CTP counter \"%s\".", cntobj->GetName());
                                                AliHLTTriggerCounters::AliCounter* counter = static_cast<AliHLTTriggerCounters::AliCounter*>(cntobj);
                                                counter->Counter(counters[i]);
                                                UpdateCounterRate(
@@ -282,6 +304,7 @@ int AliHLTTriggerCounterComponent::DoEvent(const AliHLTComponentEventData& /*evt
                                        }
                                        else
                                        {
+                                               HLTDebug("Adding new CTP counter \"%s\".", cntobj->GetName());
                                                fInputCounters.Add(
                                                                ctpName,
                                                                "New CTP trigger input counter found during the run.",
@@ -297,10 +320,12 @@ int AliHLTTriggerCounterComponent::DoEvent(const AliHLTComponentEventData& /*evt
                        for (Int_t i = 0; i < decision->NumberOfTriggerInputs(); ++i)
                        {
                                const AliHLTTriggerDecision* input = decision->TriggerInput(i);
-                               if (input == NULL or not input->Result()) continue;
+                               if (input == NULL) continue;
+                               if (not fCountFalseInputs and not input->Result()) continue;
                                TObject* cntobj = fInputCounters.FindObject(input->Name());
                                if (cntobj != NULL)
                                {
+                                       HLTDebug("Updating existing input counter \"%s\".", cntobj->GetName());
                                        AliHLTTriggerCounters::AliCounter* counter = static_cast<AliHLTTriggerCounters::AliCounter*>(cntobj);
                                        counter->Increment();
                                        counter->SetBit(BIT(14), true);  // mark counter as updated
@@ -312,6 +337,7 @@ int AliHLTTriggerCounterComponent::DoEvent(const AliHLTComponentEventData& /*evt
                                }
                                else
                                {
+                                       HLTDebug("Adding new input counter \"%s\".", cntobj->GetName());
                                        fInputCounters.Add(input->Name(), "New trigger input counter found during the run.", 1, 1);
                                        fInputCounters.GetCounterN(fInputCounters.NumberOfCounters()-1).SetBit(BIT(14), true); // mark counter as updated
                                        fInputTimes.Add(new AliRingBuffer(input->Name(), inputTime));
@@ -325,13 +351,14 @@ int AliHLTTriggerCounterComponent::DoEvent(const AliHLTComponentEventData& /*evt
        obj = GetFirstInputObject(kAliHLTDataTypeTriggerDecision, "AliHLTTriggerDecision");
        while (obj != NULL)
        {
+               HLTDebug("Received trigger decision object of type AliHLTTriggerDecision.");
                const AliHLTTriggerDecision* decision = dynamic_cast<const AliHLTTriggerDecision*>(obj);
-               if (decision != NULL and decision->Result())
+               if (decision != NULL and ((not fCountFalseInputs and  decision->Result()) or fCountFalseInputs))
                {
-                       HLTDebug("Received trigger decision object of type AliHLTTriggerDecision.");
                        TObject* cntobj = fInputCounters.FindObject(decision->Name());
                        if (cntobj != NULL)
                        {
+                               HLTDebug("Updating existing input counter \"%s\".", cntobj->GetName());
                                AliHLTTriggerCounters::AliCounter* counter = static_cast<AliHLTTriggerCounters::AliCounter*>(cntobj);
                                if (not counter->TestBit(BIT(14)))  // Only update if marked as not updated.
                                {
@@ -345,6 +372,7 @@ int AliHLTTriggerCounterComponent::DoEvent(const AliHLTComponentEventData& /*evt
                        }
                        else
                        {
+                               HLTDebug("Adding new input counter \"%s\".", cntobj->GetName());
                                fInputCounters.Add(decision->Name(), "New trigger input counter found during the run.", 1, 1);
                                fInputTimes.Add(new AliRingBuffer(decision->Name(), inputTime));
                        }
@@ -361,6 +389,7 @@ int AliHLTTriggerCounterComponent::DoEvent(const AliHLTComponentEventData& /*evt
        if (fLastPublishTime == -1) fLastPublishTime = now;
        if (now - fLastPublishTime > fPublishPeriod)
        {
+               HLTDebug("Pushing back counter objects.");
                fLastPublishTime = now;
                bool inputCountersNotPushed = PushBack(&fInputCounters, kAliHLTDataTypeInputTriggerCounters) != 0;
                bool outputCountersNotPushed = PushBack(&fOutputCounters, kAliHLTDataTypeOutputTriggerCounters) != 0;
index 8b40564..ac8d528 100644 (file)
  *      The default is to publish for every event.
  * \li -skipcdb  <br>
  *      If specified then the initial counter configuration is not loaded from the CDB.
+ * \li -countfalseinputs  <br>
+ *      Indicates that input triggers which have false decision results should also be counted.
+ * \li -countfalseoutputs  <br>
+ *      Indicates that output triggers which have false decision results should also be counted.
  *
  * <h2>Configuration:</h2>
  * Can only be configured with the command line arguments.
@@ -52,7 +56,7 @@
  * HLT/ConfigHLT/HLTTriggerCounter - Contains the initial counter configuration.
  *
  * <h2>Performance:</h2>
- * Can run over 2kHz in HLT online system.
+ * Can run up to 1.8kHz in the HLT online system.
  *
  * <h2>Memory consumption:</h2>
  * Negligible.
@@ -190,6 +194,8 @@ private:
        THashTable fOutputTimes;  //! Cyclic buffer storing the time stamps when the output counters were received.
        Double_t fLastPublishTime;  //! The last time the counters were pushed back to the output.
        Double_t fPublishPeriod;  //! The time between calls to push back the counters to output.
+       bool fCountFalseInputs; //! Indicates if the false input trigger decisions should also be counted.
+       bool fCountFalseOutputs; //! Indicates if the false output trigger decisions should also be counted.
        
        static const char* fgkConfigCDBPath;  //! CDB configuration path.
        static TMap fgInitialCounterConfig;   //! Initial configuration information for the counters.