]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
work on the TPC offline wrappers (Jacek)
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 25 Jun 2008 10:56:53 +0000 (10:56 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 25 Jun 2008 10:56:53 +0000 (10:56 +0000)
- added AliHLTTPCOfflineCalibrationComponent and corresponding macro
- geometry initialization of TPCOfflineTracker
- minor code cleanup
- calculated output data specification from input blocks
- added ESDfriend to TPCOfflineTracker output
- added TPCcalib library to dependency list

13 files changed:
HLT/TPCLib/AliHLTTPCAgent.cxx
HLT/TPCLib/AliHLTTPCDefinitions.cxx
HLT/TPCLib/AliHLTTPCDefinitions.h
HLT/TPCLib/macros/cal-hlt-tpc-offline.C [new file with mode: 0644]
HLT/TPCLib/macros/rec-hlt-tpc-offline.C
HLT/TPCLib/offline/AliHLTTPCOfflineCalibrationComponent.cxx [new file with mode: 0644]
HLT/TPCLib/offline/AliHLTTPCOfflineCalibrationComponent.h [new file with mode: 0644]
HLT/TPCLib/offline/AliHLTTPCOfflineClustererComponent.cxx
HLT/TPCLib/offline/AliHLTTPCOfflineClustererComponent.h
HLT/TPCLib/offline/AliHLTTPCOfflineTrackerComponent.cxx
HLT/TPCLib/offline/AliHLTTPCOfflineTrackerComponent.h
HLT/configure.ac
HLT/libAliHLTTPC.pkg

index bda180f62053befb463db2991e75220f56be41de..bb6a7e6d5217f1d057d361422e81d63c772202b5 100644 (file)
@@ -55,6 +55,7 @@ AliHLTTPCAgent gAliHLTTPCAgent;
 #include "AliHLTTPCEsdWriterComponent.h"
 #include "AliHLTTPCOfflineClustererComponent.h"
 #include "AliHLTTPCOfflineTrackerComponent.h"
 #include "AliHLTTPCEsdWriterComponent.h"
 #include "AliHLTTPCOfflineClustererComponent.h"
 #include "AliHLTTPCOfflineTrackerComponent.h"
+#include "AliHLTTPCOfflineCalibrationComponent.h"
 #include "AliHLTTPCClusterHistoComponent.h"
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 #include "AliHLTTPCClusterHistoComponent.h"
 
 /** ROOT macro for the implementation of ROOT specific class methods */
@@ -186,6 +187,7 @@ int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
   pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliConverter);
   pHandler->AddComponent(new AliHLTTPCOfflineClustererComponent);
   pHandler->AddComponent(new AliHLTTPCOfflineTrackerComponent);
   pHandler->AddComponent(new AliHLTTPCEsdWriterComponent::AliConverter);
   pHandler->AddComponent(new AliHLTTPCOfflineClustererComponent);
   pHandler->AddComponent(new AliHLTTPCOfflineTrackerComponent);
+  pHandler->AddComponent(new AliHLTTPCOfflineCalibrationComponent);
   pHandler->AddComponent(new AliHLTTPCClusterHistoComponent);
 
   return 0;
   pHandler->AddComponent(new AliHLTTPCClusterHistoComponent);
 
   return 0;
index e84180053fd2314e9248c08c5207a883151842a4..543919f0cda59608c91bf8ac69b790fb1c469c12 100644 (file)
@@ -63,6 +63,17 @@ const AliHLTComponentDataType AliHLTTPCDefinitions::fgkCalibPulserDataType =
 const AliHLTComponentDataType AliHLTTPCDefinitions::fgkCalibCEDataType =                                                                                     
   (AliHLTComponentDataType){sizeof(AliHLTComponentDataType),                          {'C','A','L','_','C','E',' ',' '},  kAliHLTDataOriginAny} | kAliHLTDataOriginTPC;
 
 const AliHLTComponentDataType AliHLTTPCDefinitions::fgkCalibCEDataType =                                                                                     
   (AliHLTComponentDataType){sizeof(AliHLTComponentDataType),                          {'C','A','L','_','C','E',' ',' '},  kAliHLTDataOriginAny} | kAliHLTDataOriginTPC;
 
+const AliHLTComponentDataType AliHLTTPCDefinitions::fgkOfflineCalibAlignDataType =                                                                                   
+
+  (AliHLTComponentDataType){sizeof(AliHLTComponentDataType),                          {'C','A','L','A','L','I','G','N'},  kAliHLTDataOriginAny} | kAliHLTDataOriginTPC;
+
+const AliHLTComponentDataType AliHLTTPCDefinitions::fgkOfflineCalibTracksDataType =                                                                                  
+  (AliHLTComponentDataType){sizeof(AliHLTComponentDataType),                          {'C','A','L','T','R','A','C','K'},  kAliHLTDataOriginAny} | kAliHLTDataOriginTPC;
+
+const AliHLTComponentDataType AliHLTTPCDefinitions::fgkOfflineCalibTracksGainDataType =                                                                                      
+  (AliHLTComponentDataType){sizeof(AliHLTComponentDataType),                          {'C','A','L','G','A','I','N',' '},  kAliHLTDataOriginAny} | kAliHLTDataOriginTPC;
+
+
 AliHLTTPCDefinitions::AliHLTTPCDefinitions()
 {
   // see header file for class documentation
 AliHLTTPCDefinitions::AliHLTTPCDefinitions()
 {
   // see header file for class documentation
index a013181eb759d72d19046311fe801c91805c444d..9b6d7df8c46742121fb6bbe16d367971e29985df 100644 (file)
@@ -98,6 +98,15 @@ public:
   /** central electrode calibration data */
   static const AliHLTComponentDataType fgkCalibCEDataType;         // see above
 
   /** central electrode calibration data */
   static const AliHLTComponentDataType fgkCalibCEDataType;         // see above
 
+  // offline calbration components
+
+  /** alignment calibration data */
+  static const AliHLTComponentDataType fgkOfflineCalibAlignDataType;         // see above
+  /** track calibration data */
+  static const AliHLTComponentDataType fgkOfflineCalibTracksDataType;        // see above
+  /** gain calibration data */
+  static const AliHLTComponentDataType fgkOfflineCalibTracksGainDataType;    // see above
+
   ClassDef(AliHLTTPCDefinitions, 2)
 };
 
   ClassDef(AliHLTTPCDefinitions, 2)
 };
 
diff --git a/HLT/TPCLib/macros/cal-hlt-tpc-offline.C b/HLT/TPCLib/macros/cal-hlt-tpc-offline.C
new file mode 100644 (file)
index 0000000..d887b98
--- /dev/null
@@ -0,0 +1,154 @@
+// $Id$
+/**
+ * @file cal-hlt-tpc-offline.C
+ * @brief Test macro for the HLT TPC offline calibration.
+ *
+ * The macro runs an HLT chain of TPC analysis, using the offline
+ * algorithms and appropriate wrappers. The final output is
+ * processed by the TPCOfflineCalibration component.
+ *
+ * Usage:
+ * <pre>
+ *   aliroot -b -q cal-hlt-tpc-offline.C | tee cal-hlt-tpc-offline.log
+ * </pre>
+ *
+ * The chain to be run is defined by the macro given to the parameter
+ * 'config='
+ *
+ * The macro asumes raw data to be available in the rawx folders, either
+ * simulated or real data. A different input can be specified as parameter
+ * <pre>
+ *   aliroot -b -q cal-hlt-tpc-offline.C'("input.root")'
+ * </pre>
+ *
+ * In the first section, an analysis chain is defined. The scale of the
+ * chain can be defined by choosing the range of sectors and partitions.
+ *
+ * The reconstruction is steered by the AliReconstruction object in the
+ * usual way.
+ *
+ * @ingroup alihlt_tpc
+ * @author Jacek Otwinowski <J.Otwinowski@gsi.de>, Matthias.Richter@ift.uib.no
+ */
+void cal_hlt_tpc_offline(const char* input="./")
+{
+  if (!input) {
+    cerr << "please specify input or run without arguments" << endl;
+    return;
+  }
+
+  ///////////////////////////////////////////////////////////////////////////////////////////////////
+  //
+  // init the HLT system in order to define the analysis chain below
+  //
+  gSystem->Load("libHLTrec.so");
+  AliHLTSystem* gHLT=AliHLTReconstructorBase::GetInstance();
+
+  //gHLT.SwitchAliLog(0);
+
+  ///////////////////////////////////////////////////////////////////////////////////////////////////
+  //
+  // define the analysis chain to be run
+  //
+
+  bool sectorClusterer=true; // run clusterer on sector or DDL level
+  // check if the AliRawReaderMemory supports multiple buffers
+  TClass* info=TClass::GetClass("AliRawReaderMemory");
+  TList* methods=info->GetListOfAllPublicMethods();
+  if (sectorClusterer && !methods->FindObject("AddBuffer")) {
+    cerr << "warning: AliRawReaderMemory does not support multiple buffers, falling back to run clusterer on DDL level" << endl;
+    sectorClusterer=false;
+  }
+  int iMinSlice=0;
+  int iMaxSlice=17;
+  int iMinPart=0;
+  int iMaxPart=5;
+
+  int DDLNoFromSlicePatch(int, int);
+
+  TString writerInput;
+  TString trackerInput;
+  TString calibratorInput;
+
+  for (int slice=iMinSlice; slice<=iMaxSlice; slice++) {
+    TString arg, clustererInput;
+    for (int part=iMinPart; part<=iMaxPart; part++) {
+      TString publisher, cf;
+
+      // raw data publisher components
+      int ddlno=DDLNoFromSlicePatch(slice, part);
+      arg.Form("-minid %d -datatype 'DDL_RAW ' 'TPC '  -dataspec 0x%02x%02x%02x%02x", ddlno, slice, slice, part, part);
+      publisher.Form("DP_%02d_%d", slice, part);
+      AliHLTConfiguration pubconf(publisher.Data(), "AliRawReaderPublisher", NULL , arg.Data());
+
+      if (!sectorClusterer) {
+      // cluster finder components
+      cf.Form("CF_%02d_%d", slice, part);
+      AliHLTConfiguration cfconf(cf.Data(), "TPCOfflineClusterer", publisher.Data(), "");
+
+      if (trackerInput.Length()>0) trackerInput+=" ";
+      trackerInput+=cf;
+      //if (writerInput.Length()>0) writerInput+=" ";
+      //writerInput+=cf;
+      } else {
+       if (clustererInput.Length()>0) clustererInput+=" ";
+       clustererInput+=publisher;
+      }
+    }
+    if (sectorClusterer) {
+      // cluster finder components
+      cf.Form("CF_%02d", slice);
+      AliHLTConfiguration cfconf(cf.Data(), "TPCOfflineClusterer", clustererInput.Data(), "");
+
+      if (trackerInput.Length()>0) trackerInput+=" ";
+      trackerInput+=cf;
+    }
+  }
+
+  // one global tracker component
+  TString tracker;
+  tracker.Form("Global_TR");
+  AliHLTConfiguration trackerconf(tracker.Data(), "TPCOfflineTracker", trackerInput.Data(), "");
+  if (writerInput.Length()>0) writerInput+=" ";
+  calibratorInput+=tracker;
+
+  // one global calibration component
+  TString calibrator;
+  calibrator.Form("Global_Calib");
+  AliHLTConfiguration calibconf(calibrator.Data(), "TPCOfflineCalibration", calibratorInput.Data(), "");
+  if (writerInput.Length()>0) writerInput+=" ";
+  writerInput+=calibrator;
+
+  // the writer configuration
+  AliHLTConfiguration rootfwconf("sink1", "ROOTFileWriter", writerInput.Data(), "-specfmt=_%d -subdir=out_%d -idfmt=_0x%08x");
+  //AliHLTConfiguration esdwconf("sink1", "EsdCollector"   , writerInput.Data(), "-directory hlt-tpc-offline");
+
+  ///////////////////////////////////////////////////////////////////////////////////////////////////
+  //
+  // Init and run the reconstruction
+  // All but HLT reconstructio is switched off
+  //
+  AliReconstruction rec;
+  rec.SetInput(input);
+  rec.SetRunVertexFinder(kFALSE);
+  rec.SetRunLocalReconstruction("HLT");
+  rec.SetRunTracking("");
+  rec.SetLoadAlignFromCDB(0);
+  rec.SetFillESD("");
+  rec.SetRunQA(kFALSE);
+  AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., AliMagFMaps::k5kG);
+  AliTracker::SetFieldMap(field,kTRUE);
+  rec.SetFillTriggerESD(kFALSE);
+  rec.SetOption("HLT", "libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so loglevel=0x7c chains=sink1");
+  rec.Run();
+}
+
+int DDLNoFromSlicePatch(int slice, int part)
+{
+  int ddlno=768;
+  if (part>1) ddlno+=72+4*slice+(part-2);
+  else ddlno+=2*slice+part;
+
+  return ddlno;
+}
index ec2eea0b598db0ce9f627f068fcbbc2c2e10ff39..608a0c57328dd0dd52f744ce71d7fd6183bf12e7 100644 (file)
  * The chain to be run is defined by the macro given to the parameter
  * 'config='
  *
  * The chain to be run is defined by the macro given to the parameter
  * 'config='
  *
- * The makro asumes that raw data is available in the rawx folders, either
- * simulated or real data.
+ * The macro asumes raw data to be available in the rawx folders, either
+ * simulated or real data. A different input can be specified as parameter
+ * <pre>
+ *   aliroot -b -q cal-hlt-tpc-offline.C'("input.root")'
+ * </pre>
  *
  * In the first section, an analysis chain is defined. The scale of the
  * chain can be defined by choosing the range of sectors and partitions.
  *
  * In the first section, an analysis chain is defined. The scale of the
  * chain can be defined by choosing the range of sectors and partitions.
  * The reconstruction is steered by the AliReconstruction object in the
  * usual way.
  *
  * The reconstruction is steered by the AliReconstruction object in the
  * usual way.
  *
- * Matthias.Richter@ift.uib.no
+ * @ingroup alihlt_tpc
+ * @author Matthias.Richter@ift.uib.no
  */
  */
-void rec_hlt_tpc_offline()
+void rec_hlt_tpc_offline(const char* input="./")
 {
 {
+  if (!input) {
+    cerr << "please specify input or run without arguments" << endl;
+    return;
+  }
   ///////////////////////////////////////////////////////////////////////////////////////////////////
   //
   // init the HLT system in order to define the analysis chain below
   ///////////////////////////////////////////////////////////////////////////////////////////////////
   //
   // init the HLT system in order to define the analysis chain below
@@ -110,7 +118,7 @@ void rec_hlt_tpc_offline()
   // All but HLT reconstructio is switched off
   //
   AliReconstruction rec;
   // All but HLT reconstructio is switched off
   //
   AliReconstruction rec;
-  rec.SetInput("./");
+  rec.SetInput(input);
   rec.SetRunVertexFinder(kFALSE);
   rec.SetRunLocalReconstruction("HLT");
   rec.SetRunTracking("");
   rec.SetRunVertexFinder(kFALSE);
   rec.SetRunLocalReconstruction("HLT");
   rec.SetRunTracking("");
diff --git a/HLT/TPCLib/offline/AliHLTTPCOfflineCalibrationComponent.cxx b/HLT/TPCLib/offline/AliHLTTPCOfflineCalibrationComponent.cxx
new file mode 100644 (file)
index 0000000..5bb2dbf
--- /dev/null
@@ -0,0 +1,315 @@
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//*                                                                        *
+//* Primary Authors: Jacek Otwinowski <J.Otwinowski@gsi.de>                *
+//*                                                                        *
+//* 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.                  *
+//**************************************************************************
+
+/** @file   AliHLTTPCOfflineCalibrationComponent.cxx
+    @author Jacek Otwinowski <J.Otwinowski@gsi.de>
+    @date   
+    @brief  TPC calibration component
+*/
+
+#include "AliHLTTPCOfflineCalibrationComponent.h"
+#include "TString.h"
+#include "TObjArray.h"
+#include "TObjString.h"
+#include "AliTPCcalibAlign.h"
+#include "AliTPCcalibTracksGain.h"
+#include "AliTPCcalibTracks.h"
+#include "AliESDEvent.h"
+#include "AliESDfriend.h"
+#include "AliCDBManager.h"
+#include "AliTPCcalibDB.h"
+#include "AliTPCClusterParam.h"
+#include "AliTPCcalibTracksCuts.h"
+#include "AliTPCseed.h"
+#include "AliTPCcalibTracksCuts.h"
+#include "AliTPCClusterParam.h"
+#include "AliHLTTPCDefinitions.h"
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTTPCOfflineCalibrationComponent)
+
+AliHLTTPCOfflineCalibrationComponent::AliHLTTPCOfflineCalibrationComponent() : AliHLTCalibrationProcessor(),
+fEnableAnalysis(kTRUE),
+fClustParam(0),
+fTrackCuts(0),
+fTPCcalibAlign(0),
+fTPCcalibTracksGain(0),
+fTPCcalibTracks(0)
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTTPCOfflineCalibrationComponent::~AliHLTTPCOfflineCalibrationComponent()
+{
+  // see header file for class documentation
+}
+
+const char* AliHLTTPCOfflineCalibrationComponent::GetComponentID()
+{
+  // see header file for class documentation
+  return "TPCOfflineCalibration";
+}
+
+void AliHLTTPCOfflineCalibrationComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
+{
+  // get input data type
+  list.clear();
+  list.push_back(kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC/*AliHLTTPCDefinitions::fgkOfflineClustersDataType*/);
+}
+
+AliHLTComponentDataType AliHLTTPCOfflineCalibrationComponent::GetOutputDataType()
+{
+  // return ouput data type
+  return kAliHLTMultipleDataType;
+}
+
+int AliHLTTPCOfflineCalibrationComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
+{
+  // create output data type
+  tgtList.clear();
+  tgtList.push_back(AliHLTTPCDefinitions::fgkOfflineCalibAlignDataType);
+  tgtList.push_back(AliHLTTPCDefinitions::fgkOfflineCalibTracksDataType);
+  tgtList.push_back(AliHLTTPCDefinitions::fgkOfflineCalibTracksGainDataType);
+
+  return tgtList.size(); 
+}
+
+void AliHLTTPCOfflineCalibrationComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
+{
+  // get output data size
+  constBase = 30000000;
+  inputMultiplier = 1;
+}
+
+AliHLTComponent* AliHLTTPCOfflineCalibrationComponent::Spawn()
+{
+  // create instance of the component
+  return new AliHLTTPCOfflineCalibrationComponent;
+}
+
+int AliHLTTPCOfflineCalibrationComponent::InitCalibration()
+{
+  // init configuration 
+  
+  HLTInfo("init calibration component");
+  int iResult=0;
+
+  //
+  // initialisation
+  //
+
+  // Init parameters and cuts
+  fClustParam = AliTPCcalibDB::Instance()->GetClusterParam();
+  fTrackCuts = new AliTPCcalibTracksCuts(20, 0.4, 0.5, 0.13, 0.018);
+
+  // Init calibration componenets
+  fTPCcalibAlign = new AliTPCcalibAlign("TPCcalibAlign","TPCcalibAlign");
+  fTPCcalibTracksGain = new AliTPCcalibTracksGain("TPCcalibTracksGain","TPCcalibTracksGain",fTrackCuts);
+  fTPCcalibTracks = new AliTPCcalibTracks("TPCcalibTracks","TPCcalibTracks",fClustParam,fTrackCuts);
+
+  if (!fTrackCuts || !fClustParam ||  !fTPCcalibAlign || !fTPCcalibTracksGain || !fTPCcalibTracks) {
+    HLTError("failed creating internal objects");
+    iResult=-ENOMEM;
+  }
+
+  return iResult;
+}
+
+Int_t AliHLTTPCOfflineCalibrationComponent::DeinitCalibration()
+{
+  // deinit configuration
+  if(fClustParam) delete fClustParam; fClustParam = 0; 
+  if(fTrackCuts) delete fTrackCuts; fTrackCuts = 0; 
+
+  if(fTPCcalibAlign) delete fTPCcalibAlign; fTPCcalibAlign = 0; 
+  if(fTPCcalibTracksGain) delete fTPCcalibTracksGain; fTPCcalibTracksGain = 0; 
+  if(fTPCcalibTracks) delete fTPCcalibTracks; fTPCcalibTracks = 0; 
+
+  return 0;
+}
+
+Int_t AliHLTTPCOfflineCalibrationComponent::ScanArgument(Int_t argc, const char** argv)
+{
+  int iResult = 0;
+  TString argument="";
+  TString configuration=""; 
+  int bMissingParam=0;
+  for (int i=0; i<argc && iResult>=0; i++) {
+    argument=argv[i];
+    if (argument.IsNull()) continue;
+
+  }
+  if (bMissingParam) {
+    HLTError("missing parameter for argument %s", argument.Data());
+    iResult=-EINVAL;
+  }
+
+  if (iResult>=0 && !configuration.IsNull()) {
+    iResult=Configure(configuration.Data());
+  } else {
+    iResult=Reconfigure(NULL, NULL);
+  }
+
+  return iResult;
+}
+
+int AliHLTTPCOfflineCalibrationComponent::ProcessCalibration(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
+{
+  // calibration function
+  HLTInfo("ProcessCalibration processing data");
+
+  int iResult=0;
+  AliESDEvent *pESD =0;
+  AliESDfriend* pESDfriend=0;
+  int slice, patch;
+  
+  // calculate specification
+  const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC); 
+  if(!pBlock) {
+     HLTError("Cannot get first data block 0x%08x ",pBlock);
+     iResult=-ENOMEM; return iResult;
+  }
+  int minSlice=AliHLTTPCDefinitions::GetMinSliceNr(pBlock->fSpecification);
+  int maxSlice=AliHLTTPCDefinitions::GetMaxSliceNr(pBlock->fSpecification);
+  int minPatch=AliHLTTPCDefinitions::GetMinPatchNr(pBlock->fSpecification);
+  int maxPatch=AliHLTTPCDefinitions::GetMaxPatchNr(pBlock->fSpecification);  
+  if (fTPCcalibAlign && fTPCcalibTracksGain && fTPCcalibTracks) 
+  {
+    // loop over input data blocks: ESD events
+    for (TObject *pObj = (TObject *)GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC,"ESD",0);
+        pObj !=0 && iResult>=0;
+        pObj = (TObject *)GetNextInputObject(0)) {
+      pESD = dynamic_cast<AliESDEvent*>(pObj);
+      if (!pESD) continue;
+      pESD->GetStdContent();
+
+      //HLTInfo("load %d esd tracks from block %s 0x%08x", pESD->GetNumberOfTracks(), DataType2Text(GetDataType(pObj)).c_str(), GetSpecification(pObj));
+
+      slice=AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(pObj));
+      patch=AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(pObj));
+
+      if(slice < minSlice) minSlice=slice;
+      if(slice > maxSlice) maxSlice=slice;
+      if(patch < minPatch) minPatch=patch;
+      if(patch > maxPatch) maxPatch=patch;
+
+      // get ESD fiends
+      pESDfriend=static_cast<AliESDfriend*>(pESD->FindListObject("AliESDfriend"));
+      if (!pESDfriend) {
+         HLTError("Cannot load ESD friends  0x%08x", pESDfriend);
+         iResult=-ENOMEM; 
+        return iResult;
+      }
+    
+      // get TPC seeds 
+      Int_t n=pESD->GetNumberOfTracks();
+      for (Int_t i=0;i<n;++i) {
+         AliESDfriendTrack *friendTrack=pESDfriend->GetTrack(i);
+        if(!friendTrack) continue;
+
+         TObject *calibObject=0;
+         AliTPCseed *seed=0;
+       for (Int_t j=0;(calibObject=friendTrack->GetCalibObject(j));++j)
+          if ((seed=dynamic_cast<AliTPCseed*>(calibObject)) !=0) break;
+          if (seed) {
+              fTPCcalibAlign->Process(seed);
+              fTPCcalibTracksGain->Process(seed);
+              fTPCcalibTracks->Process(seed);
+         }
+       }
+    
+      // calculate specification from the specification of input data blocks
+        AliHLTUInt32_t iSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(minSlice, maxSlice, minPatch, maxPatch);
+
+       // send data
+       PushBack((TObject*)fTPCcalibAlign,AliHLTTPCDefinitions::fgkOfflineCalibAlignDataType,iSpecification);
+       PushBack((TObject*)fTPCcalibTracksGain,AliHLTTPCDefinitions::fgkOfflineCalibTracksGainDataType,iSpecification);
+       PushBack((TObject*)fTPCcalibTracks,AliHLTTPCDefinitions::fgkOfflineCalibTracksDataType,iSpecification);
+
+    }// end loop over input objects
+    
+  } else {
+    HLTError("component not initialized");
+    iResult=-ENOMEM;
+  }
+
+  return iResult;
+}
+
+Int_t AliHLTTPCOfflineCalibrationComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/,
+                                                      AliHLTComponentTriggerData& /*trigData*/ ) {
+// see header file for class documentation
+   if( fEnableAnalysis )        
+   {
+      fTPCcalibAlign->Analyze();
+      fTPCcalibTracksGain->Analyze();
+      fTPCcalibTracks->Analyze();
+   }
+   PushToFXS((TObject*)fTPCcalibAlign, "TPC", "TPCcalibAlign") ;
+   PushToFXS((TObject*)fTPCcalibTracksGain, "TPC", "TPCcalibTracksGain") ;
+   PushToFXS((TObject*)fTPCcalibTracks, "TPC", "TPCcalibTracks") ;
+
+return 0;
+}
+
+int AliHLTTPCOfflineCalibrationComponent::Configure(const char* arguments)
+{
+  // see header file for class documentation
+  int iResult=0;
+  if (!arguments) return iResult;
+
+  TString allArgs=arguments;
+  TString argument;
+  int bMissingParam=0;
+
+  TObjArray* pTokens=allArgs.Tokenize(" ");
+  if (pTokens) {
+    for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
+      argument=((TObjString*)pTokens->At(i))->GetString();
+      if (argument.IsNull()) continue;
+
+      if (argument.CompareTo("-something")==0) {
+       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+
+      } else {
+       HLTError("unknown argument %s", argument.Data());
+       iResult=-EINVAL;
+       break;
+      }
+    }
+    delete pTokens;
+  }
+  if (bMissingParam) {
+    HLTError("missing parameter for argument %s", argument.Data());
+    iResult=-EINVAL;
+  }
+  return iResult;
+}
+
+int AliHLTTPCOfflineCalibrationComponent::Reconfigure(const char* /*cdbEntry*/, const char* /*chainId*/)
+{
+  // see header file for class documentation
+  int iResult=0;
+  return iResult;
+}
diff --git a/HLT/TPCLib/offline/AliHLTTPCOfflineCalibrationComponent.h b/HLT/TPCLib/offline/AliHLTTPCOfflineCalibrationComponent.h
new file mode 100644 (file)
index 0000000..3d8079e
--- /dev/null
@@ -0,0 +1,127 @@
+//-*- Mode: C++ -*-
+// $Id$
+#ifndef ALIHLTTPCOFFLINECALIBRATIONCOMPONENT_H
+#define ALIHLTTPCOFFLINECALIBRATIONCOMPONENT_H
+
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//* See cxx source for full Copyright notice                               *
+
+/** @file   AliHLTTPCOfflineCalibrationComponent.h
+    @author Jacek Otwinowski
+    @date   
+    @brief  TPC calibration component
+*/
+
+#include "AliHLTCalibrationProcessor.h"
+
+/**
+ * @class AliHLTTPCOfflineCalibrationComponent
+ * TPC calibration component
+ *
+ * The component interfaces of the TPC offline calibration components
+ * to the online HLT. The component expects a full AliESD event containing the
+ * TPCseed track information. The outputs are calibration components.
+ *
+ * <h2>General properties:</h2>
+ *
+ * Component ID: \b TPCOfflineCalibration <br>
+ * Library: \b libAliHLTTPC.so     <br>
+ * Input Data Types: @ref kAliHLTDataTypeESDTree|kAliHLTDataOriginTPC <br>
+ * Output Data Types: @ref AliHLTTPCDefinitions::fgkOfflineCalibAlignDataType|kAliHLTDataOriginTPC <br>
+ * Output Data Types: @ref AliHLTTPCDefinitions::fgkOfflineCalibTracksDataType|kAliHLTDataOriginTPC <br>
+ * Output Data Types: @ref AliHLTTPCDefinitions::fgkOfflineCalibTracksGainDataType|kAliHLTDataOriginTPC <br>
+ *
+ * <h2>Mandatory arguments:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * <h2>Optional arguments:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * <h2>Configuration:</h2>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formatting -->
+ *
+ * <h2>Default CDB entries:</h2>
+ * - loads magnetic field value from <tt>HLT/ConfigHLT/SolenoidBz</tt>.
+ *
+ * <h2>Performance:</h2>
+ * To be determined.
+ *
+ * <h2>Memory consumption:</h2>
+ * To be determined.
+ *
+ * <h2>Output size:</h2>
+ * To be determined.
+ *
+ */
+
+class  AliTPCClusterParam;
+class  AliTPCcalibTracksCuts;
+
+class AliTPCcalibAlign;
+class AliTPCcalibTracksGain;
+class AliTPCcalibTracks;
+
+class AliHLTTPCOfflineCalibrationComponent : public AliHLTCalibrationProcessor {
+public:
+  AliHLTTPCOfflineCalibrationComponent();
+  virtual ~AliHLTTPCOfflineCalibrationComponent();
+
+  // AliHLTComponent interface functions
+  const char* GetComponentID();
+  void GetInputDataTypes(vector<AliHLTComponentDataType>& list);
+  AliHLTComponentDataType GetOutputDataType();
+  int GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList);
+  void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
+
+  // Spawn function, return new class instance
+  AliHLTComponent* Spawn();
+
+protected:
+  // AliHLTComponent interface functions
+
+
+   /** Initialize the calibration component. */
+   Int_t InitCalibration();
+
+   /** Scan commandline arguments of the calibration component. */
+   Int_t ScanArgument( Int_t argc, const char** argv );
+
+   /** DeInitialize the calibration component. */
+   Int_t DeinitCalibration();
+
+   /** Process the data in the calibration component. */
+   Int_t ProcessCalibration( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData );
+
+   /** Ship the data to the FXS at end of run or eventmodulo. */
+   Int_t ShipDataToFXS( const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& trigData );
+
+   using AliHLTCalibrationProcessor::ProcessCalibration;
+   using AliHLTCalibrationProcessor::ShipDataToFXS;
+
+private:
+  /** copy constructor prohibited */
+  AliHLTTPCOfflineCalibrationComponent(const AliHLTTPCOfflineCalibrationComponent&);
+  /** assignment operator prohibited */
+  AliHLTTPCOfflineCalibrationComponent& operator=(const AliHLTTPCOfflineCalibrationComponent&);
+  
+  Bool_t fEnableAnalysis;              //! enable component analysis
+
+  AliTPCClusterParam * fClustParam;  //! TPC cluster parameters
+  AliTPCcalibTracksCuts* fTrackCuts; //! TPC track cuts 
+
+  AliTPCcalibAlign *fTPCcalibAlign;    //! TPC geometry params
+  AliTPCcalibTracksGain *fTPCcalibTracksGain;  //! TPC tracker
+  AliTPCcalibTracks *fTPCcalibTracks;          //! AliESDEvent needed by TPC tracker
+
+  /**
+   * Configure the component.
+   * Parse a string for the configuration arguments and set the component
+   * properties.
+   */
+  int Configure(const char* arguments);
+  int Reconfigure(const char* /*cdbEntry*/, const char* /*chainId*/);
+
+  ClassDef(AliHLTTPCOfflineCalibrationComponent, 0)
+};
+#endif
index 1dc3a65e8c2220468aab9eb54adf483cf840c24a..0d82eccdf72152352b42c495dd7f24b8c87d4a39 100644 (file)
@@ -49,8 +49,7 @@ fGeometryFileName(""),
 fTPCRecoParam(0),
 fTPCGeomParam(0),
 fRawReader(0),
 fTPCRecoParam(0),
 fTPCGeomParam(0),
 fRawReader(0),
-fClusterer(0),
-fMagField(0)
+fClusterer(0)
 {
   // Default constructor
   fGeometryFileName = getenv("ALICE_ROOT");
 {
   // Default constructor
   fGeometryFileName = getenv("ALICE_ROOT");
@@ -146,7 +145,6 @@ int AliHLTTPCOfflineClustererComponent::DoInit( int argc, const char** argv )
   // initialisation
   //
 
   // initialisation
   //
 
-  /*
    
   // Load geometry
   HLTInfo("Geometry file %s",fGeometryFileName.c_str());
    
   // Load geometry
   HLTInfo("Geometry file %s",fGeometryFileName.c_str());
@@ -156,12 +154,6 @@ int AliHLTTPCOfflineClustererComponent::DoInit( int argc, const char** argv )
     iResult=-EINVAL;
   }
  
     iResult=-EINVAL;
   }
  
-  // Magnetic field
-  fMagField = new AliMagFMaps("Maps","Maps", 2, 1.0, 10., 2);
-  AliTracker::SetFieldMap(fMagField,kFALSE);
-
-  */
-
   // Raw Reader
   fRawReader = new AliRawReaderMemory;
 
   // Raw Reader
   fRawReader = new AliRawReaderMemory;
 
@@ -194,7 +186,6 @@ int AliHLTTPCOfflineClustererComponent::DoDeinit()
   if (fTPCGeomParam) delete fTPCGeomParam; fTPCGeomParam=0;
   if (fRawReader) delete fRawReader; fRawReader=0;
   if (fClusterer) delete fClusterer; fClusterer=0;
   if (fTPCGeomParam) delete fTPCGeomParam; fTPCGeomParam=0;
   if (fRawReader) delete fRawReader; fRawReader=0;
   if (fClusterer) delete fClusterer; fClusterer=0;
-  if (fMagField) delete fMagField; fMagField=0;
 
   return 0;
 }
 
   return 0;
 }
index 89af4be1b84515d290ea7ecb510c950bb8bf02f7..1a646c83df5b1221e74e00911cd45d7213c57887 100644 (file)
@@ -18,7 +18,6 @@ class AliTPCRecoParam;
 class AliTPCParam;
 class AliTPCclustererMI;
 class AliRawReaderMemory;
 class AliTPCParam;
 class AliTPCclustererMI;
 class AliRawReaderMemory;
-class AliMagFMaps;
 
 /**
  * @class AliHLTTPCOfflineClustererComponent
 
 /**
  * @class AliHLTTPCOfflineClustererComponent
@@ -108,7 +107,6 @@ private:
 
   AliRawReaderMemory *fRawReader; //! Memory reader
   AliTPCclustererMI *fClusterer;  //! TPC clusterer
 
   AliRawReaderMemory *fRawReader; //! Memory reader
   AliTPCclustererMI *fClusterer;  //! TPC clusterer
-  AliMagFMaps *fMagField; //! Magnetic field map
 
   ClassDef(AliHLTTPCOfflineClustererComponent, 1)
 };
 
   ClassDef(AliHLTTPCOfflineClustererComponent, 1)
 };
index 3b796ac68fb49ad6b1fd91d975a41260d28c4678..414fb33e24f5a1fb22aa2bd156b641995b6f0a20 100644 (file)
 #include "TString.h"
 #include "TObjArray.h"
 #include "TObjString.h"
 #include "TString.h"
 #include "TObjArray.h"
 #include "TObjString.h"
+#include "AliVParticle.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+#include "AliGeomManager.h"
+#include "AliMagFMaps.h"
 #include "AliTPCParam.h"
 #include "AliTPCParamSR.h"
 #include "AliTPCtrackerMI.h"
 #include "AliTPCClustersRow.h"
 #include "AliESDEvent.h"
 #include "AliTPCParam.h"
 #include "AliTPCParamSR.h"
 #include "AliTPCtrackerMI.h"
 #include "AliTPCClustersRow.h"
 #include "AliESDEvent.h"
+#include "AliESDfriend.h"
 #include "AliHLTTPCDefinitions.h"
 #include "AliHLTTPCDefinitions.h"
-#include "AliTracker.h"
-#include "AliMagFMaps.h"
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTTPCOfflineTrackerComponent)
 
 AliHLTTPCOfflineTrackerComponent::AliHLTTPCOfflineTrackerComponent() : AliHLTProcessor(),
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTTPCOfflineTrackerComponent)
 
 AliHLTTPCOfflineTrackerComponent::AliHLTTPCOfflineTrackerComponent() : AliHLTProcessor(),
-fOutputPercentage(100),
+fGeometryFileName(""),
 fTPCGeomParam(0),
 fTracker(0),
 fTPCGeomParam(0),
 fTracker(0),
-fESD(0)
+fESD(0),
+fESDfriend(0)
 {
 {
-  // see header file for class documentation
-  // or
-  // refer to README to build package
-  // or
-  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+  // Default constructor
+  fGeometryFileName = getenv("ALICE_ROOT");
+  fGeometryFileName += "/HLT/TPCLib/offline/geometry.root";
 }
 
 AliHLTTPCOfflineTrackerComponent::~AliHLTTPCOfflineTrackerComponent()
 }
 
 AliHLTTPCOfflineTrackerComponent::~AliHLTTPCOfflineTrackerComponent()
@@ -77,7 +80,7 @@ void AliHLTTPCOfflineTrackerComponent::GetOutputDataSize(unsigned long& constBas
 {
   // get output data size
   constBase = 2000000;
 {
   // get output data size
   constBase = 2000000;
-  inputMultiplier = ((double)fOutputPercentage)/100.0;
+  inputMultiplier = 1;
 }
 
 AliHLTComponent* AliHLTTPCOfflineTrackerComponent::Spawn()
 }
 
 AliHLTComponent* AliHLTTPCOfflineTrackerComponent::Spawn()
@@ -99,11 +102,26 @@ int AliHLTTPCOfflineTrackerComponent::DoInit( int argc, const char** argv )
   TString argument="";
   TString configuration=""; 
   int bMissingParam=0;
   TString argument="";
   TString configuration=""; 
   int bMissingParam=0;
+
+  // loop over input parameters
   for (int i=0; i<argc && iResult>=0; i++) {
     argument=argv[i];
     if (argument.IsNull()) continue;
 
   for (int i=0; i<argc && iResult>=0; i++) {
     argument=argv[i];
     if (argument.IsNull()) continue;
 
-  }
+    if (argument.CompareTo("-geometry")==0) {
+      if ((bMissingParam=(++i>=argc))) break;
+
+      HLTInfo("got \'-geometry\' argument: %s", argv[i]);
+      fGeometryFileName = argv[i];
+      HLTInfo("Geometry file is: %s", fGeometryFileName.c_str());
+
+      // the remaining arguments are treated as configuration
+    } else {
+      if (!configuration.IsNull()) configuration+=" ";
+      configuration+=argument;
+    }
+  } // end loop
+
   if (bMissingParam) {
     HLTError("missing parameter for argument %s", argument.Data());
     iResult=-EINVAL;
   if (bMissingParam) {
     HLTError("missing parameter for argument %s", argument.Data());
     iResult=-EINVAL;
@@ -115,13 +133,25 @@ int AliHLTTPCOfflineTrackerComponent::DoInit( int argc, const char** argv )
     iResult=Reconfigure(NULL, NULL);
   }
 
     iResult=Reconfigure(NULL, NULL);
   }
 
+  //
+  // initialisation
+  //
+   
+  // Load geometry
+  HLTInfo("Geometry file %s",fGeometryFileName.c_str());
+  AliGeomManager::LoadGeometry(fGeometryFileName.c_str());
+  if((AliGeomManager::GetGeometry()) == 0) {
+    HLTError("Cannot load geometry from file %s",fGeometryFileName.c_str());
+    iResult=-EINVAL;
+  }
   // TPC geometry parameters
   fTPCGeomParam = new AliTPCParamSR;
   if (fTPCGeomParam) {
     fTPCGeomParam->ReadGeoMatrices();
   }
 
   // TPC geometry parameters
   fTPCGeomParam = new AliTPCParamSR;
   if (fTPCGeomParam) {
     fTPCGeomParam->ReadGeoMatrices();
   }
 
-  // Init clusterer
+  // Init tracker
   fTracker = new AliTPCtrackerMI(fTPCGeomParam);
 
   // AliESDEvent event needed by AliTPCtrackerMI
   fTracker = new AliTPCtrackerMI(fTPCGeomParam);
 
   // AliESDEvent event needed by AliTPCtrackerMI
@@ -129,18 +159,10 @@ int AliHLTTPCOfflineTrackerComponent::DoInit( int argc, const char** argv )
   fESD = new AliESDEvent();
   if (fESD) {
     fESD->CreateStdContent();
   fESD = new AliESDEvent();
   if (fESD) {
     fESD->CreateStdContent();
-  }
 
 
-  // TODO: set the magnetic field correctly
-  // the tracker needs the field map correctly initialized in AliTracker.
-  // init from HLT/ConfigHLT/SolenoidBz or other appropriate CDB entry.
-  // temporarily set to 5kG
-  if (!AliTracker::GetFieldMap()) {
-    // this instance must never be deleted, the AliRoot framework and the design
-    // of AliTracker just does not support this. That's why we do not keep the
-    // pointer. The memory leak is relativly small.
-    AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., AliMagFMaps::k5kG);
-    AliTracker::SetFieldMap(field,kTRUE);
+    // add ESD friend
+    fESDfriend = new AliESDfriend();
+    if(fESDfriend) fESD->AddObject(fESDfriend);
   }
 
   if (!fTracker || !fESD || !fTPCGeomParam) {
   }
 
   if (!fTracker || !fESD || !fTPCGeomParam) {
@@ -148,6 +170,11 @@ int AliHLTTPCOfflineTrackerComponent::DoInit( int argc, const char** argv )
     iResult=-ENOMEM;
   }
 
     iResult=-ENOMEM;
   }
 
+  if (iResult>=0) {
+    // read the default CDB entries
+    iResult=Reconfigure(NULL, NULL);
+  }
+
   return iResult;
 }
 
   return iResult;
 }
 
@@ -158,6 +185,7 @@ int AliHLTTPCOfflineTrackerComponent::DoDeinit()
   if(fTPCGeomParam) delete fTPCGeomParam; fTPCGeomParam = 0; 
   if(fTracker) delete fTracker; fTracker = 0; 
   if(fESD) delete fESD; fESD = 0;
   if(fTPCGeomParam) delete fTPCGeomParam; fTPCGeomParam = 0; 
   if(fTracker) delete fTracker; fTracker = 0; 
   if(fESD) delete fESD; fESD = 0;
+  //Note: fESD is owner of fESDfriends
 
   return 0;
 }
 
   return 0;
 }
@@ -167,27 +195,36 @@ int AliHLTTPCOfflineTrackerComponent::DoEvent( const AliHLTComponentEventData& /
   // tracker function
   HLTInfo("DoEvent processing data");
 
   // tracker function
   HLTInfo("DoEvent processing data");
 
-//   Logging(kHLTLogDebug, "AliHLTTPCOfflineTrackerComponent::DoEvent", "Trigger data received",
-//          "Struct size %d Data size %d Data location 0x%x", trigData.fStructSize, trigData.fDataSize, (UInt_t*)trigData.fData);
-
-  TObjArray *clusterArray = 0;
-
   int iResult=0;
   int iResult=0;
+  TObjArray *clusterArray=0;
+  int slice, patch;
+
+  const AliHLTComponentBlockData* pBlock=GetFirstInputBlock(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC); 
+  if(!pBlock) {
+     HLTError("Cannot get first data block 0x%08x ",pBlock);
+     iResult=-ENOMEM; return iResult;
+  }
+  int minSlice=AliHLTTPCDefinitions::GetMinSliceNr(pBlock->fSpecification);
+  int maxSlice=AliHLTTPCDefinitions::GetMaxSliceNr(pBlock->fSpecification);
+  int minPatch=AliHLTTPCDefinitions::GetMinPatchNr(pBlock->fSpecification);
+  int maxPatch=AliHLTTPCDefinitions::GetMaxPatchNr(pBlock->fSpecification);  
 
   if (fTracker && fESD) {
 
   if (fTracker && fESD) {
-    // loop over input data blocks: TObjArrays of clusters
-    for (TObject *pObj = (TObject *)GetFirstInputObject(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC/*AliHLTTPCDefinitions::fgkOfflineClustersDataType*/,"TObjArray",0);
+      // loop over input data blocks: TObjArrays of clusters
+      for (TObject *pObj = (TObject *)GetFirstInputObject(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC/*AliHLTTPCDefinitions::fgkOfflineClustersDataType*/,"TObjArray",0);
         pObj !=0 && iResult>=0;
         pObj = (TObject *)GetNextInputObject(0)) {
       clusterArray = dynamic_cast<TObjArray*>(pObj);
       if (!clusterArray) continue;
         pObj !=0 && iResult>=0;
         pObj = (TObject *)GetNextInputObject(0)) {
       clusterArray = dynamic_cast<TObjArray*>(pObj);
       if (!clusterArray) continue;
-//       int lower=clusterArray->LowerBound();
-//       int entries=clusterArray->GetEntries();
-//       if (entries<=lower) continue;
-//       if (clusterArray->At(lower)==NULL) continue; 
-//       if (dynamic_cast<AliTPCClustersRow*>(clusterArray->At(lower))==NULL) continue;
 
       HLTInfo("load %d cluster rows from block %s 0x%08x", clusterArray->GetEntries(), DataType2Text(GetDataType(pObj)).c_str(), GetSpecification(pObj));
 
       HLTInfo("load %d cluster rows from block %s 0x%08x", clusterArray->GetEntries(), DataType2Text(GetDataType(pObj)).c_str(), GetSpecification(pObj));
+      slice=AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(pObj));
+      patch=AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(pObj));
+
+      if(slice < minSlice) minSlice=slice;
+      if(slice > maxSlice) maxSlice=slice;
+      if(patch < minPatch) minPatch=patch;
+      if(patch > maxPatch) maxPatch=patch;
 #ifndef HAVE_NOT_TPCOFFLINE_REC
       fTracker->LoadClusters(clusterArray);
 #endif //HAVE_NOT_TPCOFFLINE_REC
 #ifndef HAVE_NOT_TPCOFFLINE_REC
       fTracker->LoadClusters(clusterArray);
 #endif //HAVE_NOT_TPCOFFLINE_REC
@@ -204,23 +241,16 @@ int AliHLTTPCOfflineTrackerComponent::DoEvent( const AliHLTComponentEventData& /
     Int_t nTracks = fESD->GetNumberOfTracks();
     HLTInfo("Number of tracks %d", nTracks);
 
     Int_t nTracks = fESD->GetNumberOfTracks();
     HLTInfo("Number of tracks %d", nTracks);
 
-    // TODO: calculate specification from the specification of input data blocks
-    PushBack(fESD, kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC, 0);
-
-    // Alternatively: Push back tracks
-//     for (Int_t it = 0; it < nTracks; it++) {
-//       AliESDtrack* track = fESD->GetTrack(it);
-//       PushBack(track, AliHLTTPCDefinitions::fgkOfflineTrackSegmentsDataType, 0);
-//     }
+    // calculate specification from the specification of input data blocks
+    AliHLTUInt32_t iSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( minSlice, maxSlice, minPatch, maxPatch );
+    HLTInfo("minSlice %d, maxSlice %d, minPatch %d, maxPatch %d", minSlice, maxSlice, minPatch, maxPatch);
 
 
-    // is this necessary? If yes, we have to keep all the created TObjArrays
-    // from the loop above
-    // clear clusters
-    //clusterArray->Clear();
-    //clusterArray->Delete();
+    // send data
+    PushBack(fESD, kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC, iSpecification);
 
     // reset ESDs
     fESD->Reset();
 
     // reset ESDs
     fESD->Reset();
+
   } else {
     HLTError("component not initialized");
     iResult=-ENOMEM;
   } else {
     HLTError("component not initialized");
     iResult=-ENOMEM;
@@ -245,9 +275,35 @@ int AliHLTTPCOfflineTrackerComponent::Configure(const char* arguments)
       argument=((TObjString*)pTokens->At(i))->GetString();
       if (argument.IsNull()) continue;
 
       argument=((TObjString*)pTokens->At(i))->GetString();
       if (argument.IsNull()) continue;
 
-      if (argument.CompareTo("-something")==0) {
+      if (argument.CompareTo("-solenoidBz")==0) {
        if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
        if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
-
+       // TODO: check if there is common functionality in the AliMagF* classes
+       float SolenoidBz=((TObjString*)pTokens->At(i))->GetString().Atof();
+       if (SolenoidBz<kAlmost0Field) SolenoidBz=kAlmost0Field;
+       float factor=1.;
+       int map=AliMagFMaps::k2kG;
+       if (SolenoidBz<3.) {
+         map=AliMagFMaps::k2kG;
+         factor=SolenoidBz/2;
+       } else if (SolenoidBz>=3. && SolenoidBz<4.5) {
+         map=AliMagFMaps::k4kG;
+         factor=SolenoidBz/4;
+       } else {
+         map=AliMagFMaps::k5kG;
+         factor=SolenoidBz/5;
+       }
+       // the magnetic field map is not supposed to change
+       // field initialization should be done once in the beginning
+       // TODO: does the factor need adjustment?
+       const AliMagF* currentMap=AliTracker::GetFieldMap();
+       if (!currentMap) {
+         AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., map);
+         AliTracker::SetFieldMap(field,kTRUE);
+         HLTInfo("Solenoid Field set to: %f map %d", SolenoidBz, map);
+       } else if (currentMap->Map()!=map) {
+         HLTWarning("omitting request to override field map %s with %s", currentMap->Map(), map);
+       }
+       continue;
       } else {
        HLTError("unknown argument %s", argument.Data());
        iResult=-EINVAL;
       } else {
        HLTError("unknown argument %s", argument.Data());
        iResult=-EINVAL;
@@ -263,9 +319,31 @@ int AliHLTTPCOfflineTrackerComponent::Configure(const char* arguments)
   return iResult;
 }
 
   return iResult;
 }
 
-int AliHLTTPCOfflineTrackerComponent::Reconfigure(const char* /*cdbEntry*/, const char* /*chainId*/)
+int AliHLTTPCOfflineTrackerComponent::Reconfigure(const char* cdbEntry, const char* chainId)
 {
   // see header file for class documentation
   int iResult=0;
 {
   // see header file for class documentation
   int iResult=0;
+  const char* path=kAliHLTCDBSolenoidBz;
+  const char* defaultNotify="";
+  if (cdbEntry) {
+    path=cdbEntry;
+    defaultNotify=" (default)";
+  }
+  if (path) {
+    HLTDebug("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
+    AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
+    if (pEntry) {
+      TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
+      if (pString) {
+       HLTDebug("received configuration object string: \'%s\'", pString->GetString().Data());
+       iResult=Configure(pString->GetString().Data());
+      } else {
+       HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
+      }
+    } else {
+      HLTError("can not fetch object \"%s\" from CDB", path);
+    }
+  }
+  
   return iResult;
 }
   return iResult;
 }
index 2252a6a2d90a2b4ad50d17c02cb5583f2989b006..ffcc5ff169acb688a9535298db5748f15bf13c10 100644 (file)
@@ -57,6 +57,7 @@
 class AliTPCParam;
 class AliTPCtrackerMI;
 class AliESDEvent;
 class AliTPCParam;
 class AliTPCtrackerMI;
 class AliESDEvent;
+class AliESDfriend;
 
 class AliHLTTPCOfflineTrackerComponent : public AliHLTProcessor {
 public:
 
 class AliHLTTPCOfflineTrackerComponent : public AliHLTProcessor {
 public:
@@ -87,10 +88,12 @@ private:
   /** assignment operator prohibited */
   AliHLTTPCOfflineTrackerComponent& operator=(const AliHLTTPCOfflineTrackerComponent&);
   
   /** assignment operator prohibited */
   AliHLTTPCOfflineTrackerComponent& operator=(const AliHLTTPCOfflineTrackerComponent&);
   
-  Double_t fOutputPercentage; // percentage of output data  
-  AliTPCParam *fTPCGeomParam; // TPC geometry params
-  AliTPCtrackerMI *fTracker;  // TPC tracker
-  AliESDEvent *fESD;          // AliESDEvent needed by TPC tracker
+  string fGeometryFileName;   //! Geometry file with full path
+  AliTPCParam *fTPCGeomParam; //! TPC geometry params
+
+  AliTPCtrackerMI *fTracker;  //! TPC tracker
+  AliESDEvent *fESD;          //! AliESDEvent needed by TPC tracker
+  AliESDfriend *fESDfriend;   //! AliESDEvent needed by TPC calibration component
 
   /**
    * Configure the component.
 
   /**
    * Configure the component.
@@ -99,6 +102,6 @@ private:
    */
   int Configure(const char* arguments);
 
    */
   int Configure(const char* arguments);
 
-  ClassDef(AliHLTTPCOfflineTrackerComponent, 0)
+  ClassDef(AliHLTTPCOfflineTrackerComponent, 1)
 };
 #endif
 };
 #endif
index 45c57f927ca747f10c56e83ffbaf586f5cb7aa66..5a81a4513115e6cceee27ce8436eb6b3aa672841 100644 (file)
@@ -282,77 +282,6 @@ if test ! "x$have_aliroot" = "xno" ; then
   dnl
   dnl required header files and libraries for modules
   dnl
   dnl
   dnl required header files and libraries for modules
   dnl
-  if test ! "x$have_aliroot" = "xno" ; then
-    # the HLTTPCLib needs to link agains TPCbase and TPCrec
-    # TPC library for AliTPCParam and AliSimDigits used in 
-    # AliHLTTPCFileHandler.h and AliHLTTPCDisplay.cxx
-    # from May 07 TPCbase depends on libGui.so
-    CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS -I${ALICE_ROOT}/TPC"
-    have_alitpc=yes
-    AC_MSG_CHECKING(for required classes in TPC libraries)
-    if test ! "x$have_alitpc" = "xno" ; then
-      ALITPC_LIBS="-lGui -lTPCbase -lTPCrec"
-      LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS $ALITPC_LIBS"
-      AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliSimDigits.h>
-                                      #include <AliTPCParam.h>
-                                      #include <AliTPCParamSR.h>
-                                      #include <AliTPCDigitsArray.h>
-                                      #include <AliTPCClustersArray.h>
-                                      #include <AliTPCcluster.h>     
-                                      #include <AliTPCClustersRow.h>], 
-                                      [AliSimDigits dig;
-                                      AliTPCParam param;
-                                      AliTPCParamSR paramsr;
-                                      AliTPCDigitsArray digarray;
-                                      AliTPCClustersArray clustarray;
-                                      AliTPCcluster clust;
-                                      AliTPCClustersRow row])],
-                                      [AC_DEFINE(HAVE_ALITPC)], 
-                                     [have_alitpc=no
-                                      ALITPC_LIBS= ])
-    fi
-    AC_MSG_RESULT([$have_alitpc])
-
-    dnl
-    dnl Check for functionality in the TPC reconstruction required for online
-    dnl processing
-    dnl 
-    have_tpc_hltoffline_rec=no
-    AC_MSG_CHECKING(for on-line features of TPC offline reconstruction)
-      ALITPC_LIBS="-lGui -lTPCbase -lTPCrec"
-      LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS $ALITPC_LIBS"
-      AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliTPCtrackerMI.h>
-                                      #include <AliTPCclustererMI.h>   
-                                      #include <TObjArray.h>], 
-                                      [AliTPCtrackerMI tracker;
-                                      TObjArray* array=NULL;
-                                      tracker.LoadClusters(array);
-                                      AliTPCclustererMI cl(NULL, NULL);
-                                      cl.GetOutputArray();])],
-                                      [have_tpc_hltoffline_rec=yes], 
-                                     [AC_DEFINE(HAVE_NOT_TPCOFFLINE_REC)])
-    AC_MSG_RESULT([$have_tpc_hltoffline_rec])
-
-  fi
-  AC_CHECK_HEADER([AliTPCCalibPulser.h], [], [AC_DEFINE(HAVE_NOT_ALITPCCALIBPULSER)])
-  AC_CHECK_HEADER([AliTPCCalibPedestal.h], [], [AC_DEFINE(HAVE_NOT_ALITPCCALIBPEDESTAL)])
-
-  have_tpc_mapping=no
-  if test ! "x$have_aliroot" = "xno" ; then
-    # the TPCLib/AliHLTTPCRawReader needs the actual Pad layout of the TPC 
-    # which is stored in the TPC/mapping/Patchx.data files from
-    # AliRoot version v4-04-Release (May 2006)
-    AH_TEMPLATE([HAVE_TPC_MAPPING],[TPC pad mapping available])
-    TPC_PAD_MAPPING_PATH=$have_aliroot/TPC/mapping
-    AC_CHECK_FILE( [$TPC_PAD_MAPPING_PATH/Patch0.data], 
-                  [have_tpc_mapping=yes
-                   AC_SUBST(TPC_PAD_MAPPING_PATH)
-                   AC_DEFINE(HAVE_TPC_MAPPING)],
-                  [])
-    
-  fi
-  AC_MSG_CHECKING([for TPC mapping layout])
-  AC_MSG_RESULT([$have_tpc_mapping])
 
   dnl
   dnl Check for the interface of AliExternalTrackParam which has been changed
 
   dnl
   dnl Check for the interface of AliExternalTrackParam which has been changed
@@ -566,19 +495,17 @@ AC_MSG_RESULT([$enable_util])
 dnl ------------------------------------------------------------------
 AH_TEMPLATE([HLT_TPC],[hlt tpc library])
 
 dnl ------------------------------------------------------------------
 AH_TEMPLATE([HLT_TPC],[hlt tpc library])
 
+ALITPC_LIBS=
 CHECK_HLTMODULE([tpc],
                [AliTPCRawStream.h], 
                [$ALIROOT_CPPFLAGS -I$ALICE_ROOT/TPC],
 CHECK_HLTMODULE([tpc],
                [AliTPCRawStream.h], 
                [$ALIROOT_CPPFLAGS -I$ALICE_ROOT/TPC],
-               [], [-L$ROOTLIBDIR], [$ROOTLIBS $ADD_ROOTLIBS],
-               [], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
+               [Gui ANALYSIS], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS],
+               [TPCbase TPCrec TPCcalib], [-L$ROOTLIBDIR $ALIROOT_LDFLAGS], 
                [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
 
 if test "x$enable_module" = "xmissheader"; then
   enable_module="no...missing.headers"
   enable_tpc="no...missing.headers"
                [$ROOTLIBS $ADD_ROOTLIBS $ALIROOT_LIBS])
 
 if test "x$enable_module" = "xmissheader"; then
   enable_module="no...missing.headers"
   enable_tpc="no...missing.headers"
-elif test "x$have_alitpc" = "xno" ; then
-  enable_module="no...requires.AliRoot.TPC.libraries"
-  enable_tpc="no...requires.AliRoot.TPC.libraries"
 elif test "x$enable_module" = "xforce"; then
   enable_tpc="yes"
 else
 elif test "x$enable_module" = "xforce"; then
   enable_tpc="yes"
 else
@@ -586,7 +513,52 @@ else
 fi
 
 if test "x$enable_tpc" = "xyes" ; then 
 fi
 
 if test "x$enable_tpc" = "xyes" ; then 
+  AC_LANG_PUSH(C++)
   AC_DEFINE(HLT_TPC)
   AC_DEFINE(HLT_TPC)
+  echo $ALIHLTMODULE_LIBS
+  ALITPC_LIBS=$ALIHLTMODULE_LIBS
+  dnl
+  dnl Check for functionality in the TPC reconstruction required for online
+  dnl processing
+  dnl 
+  have_tpc_hltoffline_rec=no
+  AC_MSG_CHECKING(for on-line features of TPC offline reconstruction)
+    CPPFLAGS="$save_CPPFLAGS $ALIROOT_CPPFLAGS -I${ALICE_ROOT}/TPC"
+    LDFLAGS="$save_LDFLAGS -L${ROOTLIBDIR} $ALIROOT_LDFLAGS"
+    LIBS="$save_LIBS $ROOTLIBS $ALIROOT_LIBS $ALITPC_LIBS"
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <AliTPCtrackerMI.h>
+                                      #include <AliTPCclustererMI.h>   
+                                      #include <TObjArray.h>], 
+                                    [AliTPCtrackerMI tracker;
+                                      TObjArray* array=NULL;
+                                      tracker.LoadClusters(array);
+                                      AliTPCclustererMI cl(NULL, NULL);
+                                      cl.GetOutputArray();])],
+                                    [have_tpc_hltoffline_rec=yes], 
+                                     [AC_DEFINE(HAVE_NOT_TPCOFFLINE_REC)])
+  AC_MSG_RESULT([$have_tpc_hltoffline_rec])
+
+  AC_CHECK_HEADER([AliTPCCalibPulser.h], [], [AC_DEFINE(HAVE_NOT_ALITPCCALIBPULSER)])
+  AC_CHECK_HEADER([AliTPCCalibPedestal.h], [], [AC_DEFINE(HAVE_NOT_ALITPCCALIBPEDESTAL)])
+
+  have_tpc_mapping=no
+  if test ! "x$have_aliroot" = "xno" ; then
+    # the TPCLib/AliHLTTPCRawReader needs the actual Pad layout of the TPC 
+    # which is stored in the TPC/mapping/Patchx.data files from
+    # AliRoot version v4-04-Release (May 2006)
+    AH_TEMPLATE([HAVE_TPC_MAPPING],[TPC pad mapping available])
+    TPC_PAD_MAPPING_PATH=$have_aliroot/TPC/mapping
+    AC_CHECK_FILE( [$TPC_PAD_MAPPING_PATH/Patch0.data], 
+                  [have_tpc_mapping=yes
+                   AC_SUBST(TPC_PAD_MAPPING_PATH)
+                   AC_DEFINE(HAVE_TPC_MAPPING)],
+                  [])
+    
+  fi
+  AC_MSG_CHECKING([for TPC mapping layout])
+  AC_MSG_RESULT([$have_tpc_mapping])
+  AC_LANG_POP(C++)
+
 else
   enable_module=$enable_tpc
 fi
 else
   enable_module=$enable_tpc
 fi
@@ -608,9 +580,6 @@ CHECK_HLTMODULE([rcu],
 if test "x$enable_module" = "xmissheader"; then
   enable_module="no...missing.headers"
   enable_rcu="no...missing.headers"
 if test "x$enable_module" = "xmissheader"; then
   enable_module="no...missing.headers"
   enable_rcu="no...missing.headers"
-elif test "x$have_alircu" = "xno" ; then
-  enable_module="no...requires.AliRoot.RAW.libraries"
-  enable_rcu="no...requires.AliRoot.RAW.libraries"
 elif test "x$enable_module" = "xforce"; then
   enable_rcu="yes"
 else
 elif test "x$enable_module" = "xforce"; then
   enable_rcu="yes"
 else
index 60a5dce9735b8107320c08a132248e4d1479cda5..c92dfec1e14bd3147396aadd6db17ac6b5b05449 100644 (file)
@@ -25,6 +25,7 @@ CLASS_HDRS:=          AliHLTTPCTransform.h \
                offline/AliHLTTPCDigitPublisherComponent.h \
                offline/AliHLTTPCOfflineClustererComponent.h \
                offline/AliHLTTPCOfflineTrackerComponent.h \
                offline/AliHLTTPCDigitPublisherComponent.h \
                offline/AliHLTTPCOfflineClustererComponent.h \
                offline/AliHLTTPCOfflineTrackerComponent.h \
+               offline/AliHLTTPCOfflineCalibrationComponent.h \
                offline/AliHLTTPCOfflineCluster.h \
                AliHLTTPCClusters.h \
                AliHLTTPCConfMapFit.h \
                offline/AliHLTTPCOfflineCluster.h \
                AliHLTTPCClusters.h \
                AliHLTTPCConfMapFit.h \