]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- tutorial and sample macros updated
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Apr 2008 22:01:38 +0000 (22:01 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 25 Apr 2008 22:01:38 +0000 (22:01 +0000)
- added examples for the AliHLTRawReaderPublisherComponent
- bugfix in the TPCOfflineClustererComponent: type caused wrong boundery check

HLT/SampleLib/tutorial.c
HLT/TPCLib/offline/AliHLTTPCOfflineClustererComponent.cxx
HLT/exa/extract-ddlraw.C [new file with mode: 0644]
HLT/exa/monitoring.C
HLT/exa/publish-rawreader-data.C [new file with mode: 0644]
HLT/exa/sample-component1.C

index ee2d15914e331d1ad4410f18f5da7eab522ca7e0..d952cdfc4c995e2cbd2c34c3d702ba2fb5f65c9a 100644 (file)
@@ -60,9 +60,23 @@ You can run the following macro from the AliRoot promt.
 {
   AliHLTSystem gHLT;
   gHLT.LoadComponentLibraries("libAliHLTUtil.so libAliHLTSample.so");
+  // The AliHLTFilePublisher (component Id \em 'FilePublisher' provides
+  // the given file (see AliHLTFilePublisher for more options) to the
+  // subsequent components in the chain.
   AliHLTConfiguration publisher("fp1", "FilePublisher", NULL, "-datafile some-data.dat");
+
+  // The AliHLTDummyComponent (Id \em 'Dummy') just forwards a certain
+  // fraction of the input to the output or just repeats the input data
+  // if percentage > 100
   AliHLTConfiguration copy("cp", "Dummy", "fp1", "output_percentage 80");
+
+  // The AliHLTFileWriter (Id 'FileWriter') is a data sink. It writes
+  // all incoming data blocks to files. Several options available.
   AliHLTConfiguration sink1("sink1", "FileWriter", "cp", NULL);
+
+  // here you specify the top most configuration of the chain. The
+  // configuration depends on all the parents. The task lisy is build
+  // according to that.
   gHLT.BuildTaskList("sink1");
   gHLT.Run();
 }
@@ -78,20 +92,20 @@ directory.
 {
   AliHLTSystem gHLT;
   // load the component library
-  gHLT.LoadComponentLibraries("libAliHLTUtil.so libAliHLTTPC.so");
+  gHLT.LoadComponentLibraries("libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so");
 
   // data source components
-  AliHLTConfiguration fp0("fp0", "FilePublisher", NULL, "-datatype DDL_RWPK 'TPC ' -dataspec 0x00000000"
+  AliHLTConfiguration fp0("fp0", "FilePublisher", NULL, "-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x00000000"
                                                        "-datafile TPC_768.ddl");
-  AliHLTConfiguration fp1("fp1", "FilePublisher", NULL, "-datatype DDL_RWPK 'TPC ' -dataspec 0x00000101"
+  AliHLTConfiguration fp1("fp1", "FilePublisher", NULL, "-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x00000101"
                                                         "-datafile TPC_769.ddl");
-  AliHLTConfiguration fp2("fp2", "FilePublisher", NULL, "-datatype DDL_RWPK 'TPC ' -dataspec 0x00000202"
+  AliHLTConfiguration fp2("fp2", "FilePublisher", NULL, "-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x00000202"
                                                         "-datafile TPC_840.ddl");
-  AliHLTConfiguration fp3("fp3", "FilePublisher", NULL, "-datatype DDL_RWPK 'TPC ' -dataspec 0x00000303"
+  AliHLTConfiguration fp3("fp3", "FilePublisher", NULL, "-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x00000303"
                                                        "-datafile TPC_841.ddl");
-  AliHLTConfiguration fp4("fp4", "FilePublisher", NULL, "-datatype DDL_RWPK 'TPC ' -dataspec 0x00000404"
+  AliHLTConfiguration fp4("fp4", "FilePublisher", NULL, "-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x00000404"
                                                        "-datafile TPC_842.ddl");
-  AliHLTConfiguration fp5("fp5", "FilePublisher", NULL, "-datatype DDL_RWPK 'TPC ' -dataspec 0x00000505"
+  AliHLTConfiguration fp5("fp5", "FilePublisher", NULL, "-datatype 'DDL_RAW ' 'TPC ' -dataspec 0x00000505"
                                                        "-datafile TPC_843.ddl");
 
   // cluster finders
index 1df2e0a38de6bd64d70af8d5f57c6cadba36e9ab..0beb354d925a7c9cec23b9c74018159142f5cdd8 100644 (file)
@@ -124,11 +124,11 @@ int AliHLTTPCOfflineClustererComponent::DoEvent( const AliHLTComponentEventData&
     int patch=AliHLTTPCDefinitions::GetMinPatchNr(pBlock->fSpecification);
     if (slice!=AliHLTTPCDefinitions::GetMaxSliceNr(pBlock->fSpecification) ||
        patch!=AliHLTTPCDefinitions::GetMaxPatchNr(pBlock->fSpecification)) {
-      HLTError("ambiguous readout partition (specification 0x%80x), skipping input block", pBlock->fSpecification);
+      HLTError("ambiguous readout partition (specification 0x%08x), skipping input block", pBlock->fSpecification);
       break;
     }
-    if (slice<0 || slice>35 || patch<0 || slice>5) {
-      HLTError("invalid readout partition %d/%d (specification 0x%80x, skipping input block", slice, patch,  pBlock->fSpecification);
+    if (slice<0 || slice>35 || patch<0 || patch>5) {
+      HLTError("invalid readout partition %d/%d (specification 0x%08x, skipping input block", slice, patch,  pBlock->fSpecification);
       break;
     }
 
diff --git a/HLT/exa/extract-ddlraw.C b/HLT/exa/extract-ddlraw.C
new file mode 100644 (file)
index 0000000..3860b18
--- /dev/null
@@ -0,0 +1,152 @@
+// $Id$
+/**
+ * @file extract-ddlraw.C
+ * @brief Tool to extract DDL raw data.
+ *
+ * Usage:
+ * <pre>
+ *   aliroot -b -q 'extract-ddlraw.C("raw.root", 768, 769)' | tee extract-ddlraw.log
+ * </pre>
+ *
+ * This macro is an example for the AliHLTRawReaderPublisherComponent.
+ * It extracts the DDL payload from an AliRawReader in a given equipment
+ * range. Input can be either a root file or the path to the directory
+ * containing the 'rawx' sub folders.
+ *
+ * A light-weight AliReconstruction-like setup creates the appropriate
+ * RawReader for the specified input and uses the standard AliHLTReconstructor
+ * to run a small HLT chain. The chain utilizes the AliRawReaderPublisher
+ * to extract the payload of the equipments and writes this to files.
+ *
+ * @note In this example the AliHLTRawReaderPublisherComponent does not set any data
+ * type nor specification for the published data blocks. Please remember
+ * to provide appropriate arguments via '-datatype' and '-dataspec'
+ * arguments (see AliHLTRawReaderPublisherComponent).
+ *
+ * @author Matthias.Richter@ift.uib.no
+ * @ingroup alihlt_tutorial
+ */
+void extract_ddlraw(const char* input, int iMinDDLno, int iMaxDDLno)
+{
+  /////////////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////////////
+  //
+  // some defaults
+  const char* baseName="RAW.ddl";
+
+  /////////////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////////////
+  //
+  // setup of the RawReader
+  if (!input) {
+    cerr << "invalid path" << endl;
+    cerr << "usage: aliroot -b -q 'extract-ddlraw.C(\"raw.root\", 768, 769)'" << endl;
+    return;
+  }
+
+  AliRawReader* pRawReader=AliRawReader::Create(input);
+  if (!pRawReader) {
+    cout << "can not open RawReader for file " << input << endl;
+    return;
+  }
+  if (!pRawReader->NextEvent()) {
+    cerr << "no events available" << endl;
+    return;
+  }
+
+  /////////////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////////////
+  //
+  // setup of the HLT system
+  gSystem->Load("libHLTrec");
+  AliHLTSystem* pHLT=AliHLTReconstructorBase::GetInstance();
+  if (!pHLT) {
+    cerr << "fatal error: can not get HLT instance" << endl;
+  }
+
+  /////////////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////////////
+  //
+  // the configuration chain
+  // we show two possible configurations:
+  //  1. having one publisher for each ddl, the configurations are created
+  //     in a loop
+  //  2. all in one publisher
+  // can be easily switched with the following
+  bool bAllInOne=false;
+
+  TString writerInput;
+  TString arg;
+
+  if (!bAllInOne) {
+    // create one publisher for each ddl
+    for (int ddlno=iMinDDLno; ddlno<=iMaxDDLno; ddlno++) {
+      TString arg, publisher;
+
+      // raw data publisher components
+      arg.Form("-minid %d -skipempty", ddlno);
+      publisher.Form("DP_%d", ddlno);
+      // see AliHLTRawReaderPublisherComponent
+      AliHLTConfiguration pubconf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
+
+      if (!writerInput.IsNull()) writerInput+=" ";
+      writerInput+=publisher;
+    }
+  } else {
+    // publish all ddls by the same component, this is much more
+    // effective as it avoids repeated parsing through the data
+    arg.Form("-minid %d -maxid %d -skipempty", iMinDDLno, iMaxDDLno);
+    // see AliHLTRawReaderPublisherComponent
+    AliHLTConfiguration pubconf("publisher", "AliRawReaderPublisher", NULL , arg.Data());
+    if (!writerInput.IsNull()) writerInput+=" ";
+    writerInput+="publisher";
+  }
+
+  // the writer configuration is the same for both
+  arg.Form("-specfmt=_%%d -subdir=raw%%d -blcknofmt= -idfmt= -datafile %s", baseName);
+  // see AliHLTFileWriter
+  AliHLTConfiguration fwconf("sink1", "FileWriter"   , writerInput.Data(), arg.Data());
+
+
+  /////////////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////////////
+  //
+  // the reconstructor setup
+  AliHLTReconstructor hltRec;
+  hltRec.SetOption("libAliHLTUtil.so loglevel=0x7c chains=sink1");
+  if (hltRec.Init()<0) {
+    cerr << "initialization of reconstructor failed" << endl;
+    return;
+  }
+
+  // this is just a dummy ESD to provide valid parameters to the
+  // reconstructor
+  AliESDEvent* pESD = new AliESDEvent;
+  pESD->CreateStdContent();
+
+  /////////////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////////////
+  //
+  // the reconstruction loop
+  Int_t event=0;
+  UChar_t* pData=NULL;
+  pRawReader->RewindEvents();
+  while (pRawReader->NextEvent()) {
+    cout << "=======================================================" << endl;
+    cout << "event " << event << endl;
+    cout << "-------------------------------------------------------" << endl;
+    pRawReader->Reset();
+    hltRec.FillESD(pRawReader, NULL, pESD);
+    event++;
+  }
+
+  delete pESD;
+}
+
+void extract_ddlraw()
+{
+  cerr << "===============================================================" << endl;
+  cerr << "usage: aliroot -b -q 'extract-ddlraw.C(\"raw.root\", 768, 769)'" << endl << endl;
+  cerr << "please provide input, min and max equipment id" << endl;
+  cerr << "===============================================================" << endl;
+}
index ab13d1a106bcb8801eccbb6b4e5cc3c96afc6eb6..5d12143c81e523738ddfce22ffc21ea0a4371232 100644 (file)
@@ -33,7 +33,7 @@
   //log.SwitchAliLog(0);
 
   AliHLTSystem gHLT;
-  //gHLT.SetGlobalLoggingLevel(0x7c);
+  gHLT.SetGlobalLoggingLevel(0x7c);
 
   // load the component library
   gHLT.LoadComponentLibraries("libAliHLTUtil.so");
diff --git a/HLT/exa/publish-rawreader-data.C b/HLT/exa/publish-rawreader-data.C
new file mode 100644 (file)
index 0000000..2c9fab3
--- /dev/null
@@ -0,0 +1,90 @@
+// $Id$
+/**
+ * @file publish-rawreader-data.C
+ * @brief Publish data from the the RawReader provided by the AliReconstruction.
+ *
+ * Usage:
+ * <pre>
+ *   aliroot -b -q 'publish-rawreader-data.C("raw.root", 768, 769)' | tee publish-rawreader-data.log
+ * </pre>
+ *
+ * This macro runs shows a use case of the AliHLTRawReaderPublisherComponent
+ * An HLT chain is run inside the AliReconstruction and the DDL payload is
+ * extracted from the AliRawReader in a given  equipment range.
+ * Input can be either a root file or the path to the directory containing
+ * the 'rawx' sub folders.
+ *
+ * @author Matthias.Richter@ift.uib.no
+ */
+
+const char* defaultInput="./";
+const int defaultMinId=768;
+const int defaultMaxId=769;
+
+void publish_rawreader_data(const char* input, int iMinDDLno, int iMaxDDLno)
+{
+  /////////////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////////////
+  //
+  // some defaults
+  const char* baseName="RAW.ddl";
+
+  /////////////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////////////
+  //
+  // setup of the reconstruction
+  if (!input) {
+    cerr << "invalid path" << endl;
+    cerr << "usage: aliroot -b -q 'publish-rawreader-data.C(\"raw.root\", 768, 769)'" << endl;
+    return;
+  }
+
+  AliReconstruction rec;
+  rec.SetInput(input);
+  rec.SetOption("HLT", "libAliHLTUtil.so loglevel=0x7c chains=sink1");
+
+  /////////////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////////////
+  //
+  // setup of the HLT system
+  gSystem->Load("libHLTrec");
+  AliHLTSystem* pHLT=AliHLTReconstructorBase::GetInstance();
+  if (!pHLT) {
+    cerr << "fatal error: can not get HLT instance" << endl;
+  }
+
+  /////////////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////////////
+  //
+  // the configuration chain
+  TString writerInput;
+  TString arg;
+
+  arg.Form("-minid %d -maxid %d -skipempty", iMinDDLno, iMaxDDLno);
+  AliHLTConfiguration pubconf("publisher", "AliRawReaderPublisher", NULL , arg.Data());
+  if (!writerInput.IsNull()) writerInput+=" ";
+  writerInput+="publisher";
+
+  // the writer configuration
+  arg.Form("-specfmt=_%%d -subdir=raw%%d -blocknofmt= -idfmt= -datafile %s", baseName);
+  AliHLTConfiguration fwconf("sink1", "FileWriter"   , writerInput.Data(), arg.Data());
+
+
+  /////////////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////////////
+  //
+  // the reconstruction loop
+  rec.SetRunLocalReconstruction("HLT");
+  rec.SetRunReconstruction("HLT");
+  rec.SetRunTracking("");
+  rec.SetFillESD("HLT");
+  rec.SetRunVertexFinder(kFALSE);
+  rec.SetLoadAlignFromCDB(0);
+  rec.Run();
+}
+
+void publish_rawreader_data()
+{
+  cout << "runnig from defaults: input " << defaultInput << "  " << defaultMinId << "-" << defaultMaxId << endl;
+  publish_rawreader_data(defaultInput, defaultMinId, defaultMaxId);
+}
index 231bc107998cc9dd5461c6f51628f98b4488a44d..32ece7e9a825c5f91e1a2d168c0550ea11c8aa2d 100644 (file)
@@ -82,7 +82,7 @@
   //log.SwitchAliLog(0);
 
   AliHLTSystem gHLT;
-  //gHLT.SetGlobalLoggingLevel(0x7c);
+  gHLT.SetGlobalLoggingLevel(0x7c);
 
   // load the component library
   gHLT.LoadComponentLibraries("libAliHLTUtil.so");