Adding macro to convert dHLT data in HLTOUT DDL streams to either ROOT objects or...
authoraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 11 Jul 2008 17:26:40 +0000 (17:26 +0000)
committeraszostak <aszostak@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 11 Jul 2008 17:26:40 +0000 (17:26 +0000)
Minor fix to Rootifier component to prevent generation of decision object if not decision raw data blocks are found in the input data.

HLT/MUON/AliHLTMUONMansoTrack.cxx
HLT/MUON/OfflineInterface/AliHLTMUONRootifierComponent.cxx
HLT/MUON/macros/HLToutputTodHLTRootObjects.C [new file with mode: 0644]

index ab54fdb..ad7f6af 100644 (file)
@@ -1,5 +1,5 @@
 /**************************************************************************
- * This file is property of and copyright by the ALICE HLT Project        * 
+ * This file is property of and copyright by the ALICE HLT Project        *
  * All rights reserved.                                                   *
  *                                                                        *
  * Primary Authors:                                                       *
@@ -10,7 +10,7 @@
  * without fee, provided that the above copyright notice appears in all   *
  * copies and that both the copyright notice and this permission notice   *
  * appear in the supporting documentation. The authors make no claims     *
- * about the suitability of this software for any purpose. It is          * 
+ * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
index fadf9c3..742f8da 100644 (file)
@@ -402,6 +402,7 @@ int AliHLTMUONRootifierComponent::DoEvent(
                }
        }
        
+       bool decisionBlockFound = false;
        UInt_t numLowPt = 0;
        UInt_t numHighPt = 0;
        TClonesArray singlesDecisions("AliHLTMUONDecision::AliTrackDecision");
@@ -413,6 +414,7 @@ int AliHLTMUONRootifierComponent::DoEvent(
             block = GetNextInputBlock()
            )
        {
+               decisionBlockFound = true;
                specification |= block->fSpecification;
                AliHLTUInt8_t* ptr = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr);
                ptr += block->fOffset;
@@ -475,6 +477,7 @@ int AliHLTMUONRootifierComponent::DoEvent(
             block = GetNextInputBlock()
            )
        {
+               decisionBlockFound = true;
                specification |= block->fSpecification;
                AliHLTUInt8_t* ptr = reinterpret_cast<AliHLTUInt8_t*>(block->fPtr);
                ptr += block->fOffset;
@@ -538,24 +541,30 @@ int AliHLTMUONRootifierComponent::DoEvent(
                }
        }
        
-       AliHLTMUONDecision* triggerDecision = new AliHLTMUONDecision(
-                       numLowPt, numHighPt, numUnlikeAnyPt, numUnlikeLowPt,
-                       numUnlikeHighPt, numLikeAnyPt, numLikeLowPt,
-                       numLikeHighPt, numAnyMass, numLowMass, numHighMass
-               );
-       for (Int_t i = 0; i < singlesDecisions.GetEntriesFast(); i++)
-       {
-               AliHLTMUONDecision::AliTrackDecision* decision =
-                       static_cast<AliHLTMUONDecision::AliTrackDecision*>( singlesDecisions[i] );
-               triggerDecision->AddDecision(decision);
-       }
-       for (Int_t j = 0; j < pairsDecisions.GetEntriesFast(); j++)
+       
+       // Do not add the decision if no decision blocks were found.
+       if (decisionBlockFound)
        {
-               AliHLTMUONDecision::AliPairDecision* decision =
-                       static_cast<AliHLTMUONDecision::AliPairDecision*>( pairsDecisions[j] );
-               triggerDecision->AddDecision(decision);
+               AliHLTMUONDecision* triggerDecision = new AliHLTMUONDecision(
+                               numLowPt, numHighPt, numUnlikeAnyPt, numUnlikeLowPt,
+                               numUnlikeHighPt, numLikeAnyPt, numLikeLowPt,
+                               numLikeHighPt, numAnyMass, numLowMass, numHighMass
+                       );
+               for (Int_t i = 0; i < singlesDecisions.GetEntriesFast(); i++)
+               {
+                       AliHLTMUONDecision::AliTrackDecision* decision =
+                               static_cast<AliHLTMUONDecision::AliTrackDecision*>( singlesDecisions[i] );
+                       triggerDecision->AddDecision(decision);
+               }
+               for (Int_t j = 0; j < pairsDecisions.GetEntriesFast(); j++)
+               {
+                       AliHLTMUONDecision::AliPairDecision* decision =
+                               static_cast<AliHLTMUONDecision::AliPairDecision*>( pairsDecisions[j] );
+                       triggerDecision->AddDecision(decision);
+               }
+               
+               event.Add(triggerDecision);
        }
-       event.Add(triggerDecision);
        
        PushBack(&event, "ROOTEVNT", "MUON", specification);
        
diff --git a/HLT/MUON/macros/HLToutputTodHLTRootObjects.C b/HLT/MUON/macros/HLToutputTodHLTRootObjects.C
new file mode 100644 (file)
index 0000000..f7059f9
--- /dev/null
@@ -0,0 +1,70 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        *
+ * All rights reserved.                                                   *
+ *                                                                        *
+ * Primary Authors:                                                       *
+ *   Artur Szostak <artursz@iafrica.com>                                  *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+// $Id: $
+
+/**
+ * @file HLToutputTodHLTRootObjects.C
+ * @brief Macro for converting dHLT output in HLTOUT into ROOT objects or dumping to file.
+ *
+ * This macro converts dHLT output data blocks in HLTOUT to dHLT ROOT
+ * objects which can be used for dHLT specific analysis or debugging.
+ * Alternatively the dHLT data blocks are dumped to file in raw binary format.
+ *
+ * @note The macro must be run in the directory with the raw0, raw1 etc
+ * directories. Also no reconstructed ROOT files should be in this directory
+ * either. Backup any reconstructed AliESDs.root files if you want, and then
+ * delete all root files in the directory where you will run this macro.
+ *
+ * @author Artur Szostak <artursz@iafrica.com>
+ * @ingroup alihlt_dimuon_macros
+ */
+void HLToutputTodHLTRootObjects(bool dumpBinary = false)
+{
+       // setup of the HLT system
+       gSystem->Load("libHLTrec.so");
+       AliHLTSystem* sys = AliHLTReconstructorBase::GetInstance();
+       if (sys == NULL)
+       {
+               cerr << "FATAL ERROR: Cannot get HLT system instance." << endl;
+               return;
+       }
+
+       // Configure the chain.
+       AliHLTConfiguration pub("Pub", "AliHLTOUTPublisher" , NULL, "-origin 'MUON'");
+       TString sources = "Pub";
+       if (dumpBinary)
+       {
+               AliHLTConfiguration sink("dhlt-output-dump", "FileWriter", sources, "-datafile output.dat -specfmt");
+       }
+       else
+       {
+               AliHLTConfiguration convert("convert", "MUONRootifier", sources, "");
+               AliHLTConfiguration sink("dhlt-output-dump", "ROOTFileWriter", "convert", "-concatenate-events -datafile output.root -specfmt");
+       }
+       
+       // Setup the reconstruction and run.
+       AliReconstruction rec;
+       rec.SetInput("./");
+       rec.SetRunLocalReconstruction("HLT");
+       rec.SetRunTracking("");
+       rec.SetFillESD("");
+       rec.SetRunQA(kFALSE);
+       rec.SetFillTriggerESD(kFALSE);
+       rec.SetRunVertexFinder(kFALSE);
+       rec.SetOption("HLT", "libAliHLTMUON.so loglevel=0x78 chains=dhlt-output-dump");
+       rec.Run();
+}