]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- added the HLT interface for the TPC calibration analysis task
authorkkanaki <kkanaki@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 11 Aug 2009 07:55:19 +0000 (07:55 +0000)
committerkkanaki <kkanaki@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 11 Aug 2009 07:55:19 +0000 (07:55 +0000)
- added the respective HLT component that plays the role of the TPC/macros/CalibrateTPC.C macro
- modified the existing testing macro to call the afore-mentioned component by default (see documentation inside for choice of possible arguments)
- cleanup of the seed maker component and proper setting of the clusters in the AliTPCseed (by Michal Broz)

HLT/TPCLib/AliHLTTPCAgent.cxx
HLT/TPCLib/AliHLTTPCAnalysisTaskcalib.cxx [new file with mode: 0644]
HLT/TPCLib/AliHLTTPCAnalysisTaskcalib.h [new file with mode: 0644]
HLT/TPCLib/AliHLTTPCCalibSeedMakerComponent.cxx
HLT/TPCLib/AliHLTTPCCalibrationComponent.cxx [new file with mode: 0644]
HLT/TPCLib/AliHLTTPCCalibrationComponent.h [new file with mode: 0644]
HLT/TPCLib/macros/testTPCCalibration.C
HLT/libAliHLTTPC.pkg

index 2623fe421703081124b8d8e1d7bb1a68fc54512e..ded045fb9f681baeee40989964d7c7ddbc679302 100644 (file)
@@ -74,6 +74,7 @@ AliHLTTPCAgent gAliHLTTPCAgent;
 #include "AliHLTTPCCalibSeedMakerComponent.h"
 #include "AliHLTTPCCalibTimeComponent.h"
 #include "AliHLTTPCCalibTimeGainComponent.h"
+#include "AliHLTTPCCalibrationComponent.h"
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTTPCAgent)
@@ -297,6 +298,7 @@ int AliHLTTPCAgent::RegisterComponents(AliHLTComponentHandler* pHandler) const
   pHandler->AddComponent(new AliHLTTPCCalibSeedMakerComponent);
   pHandler->AddComponent(new AliHLTTPCCalibTimeComponent);
   pHandler->AddComponent(new AliHLTTPCCalibTimeGainComponent);
+  pHandler->AddComponent(new AliHLTTPCCalibrationComponent);
 
   return 0;
 }
diff --git a/HLT/TPCLib/AliHLTTPCAnalysisTaskcalib.cxx b/HLT/TPCLib/AliHLTTPCAnalysisTaskcalib.cxx
new file mode 100644 (file)
index 0000000..6778f2a
--- /dev/null
@@ -0,0 +1,271 @@
+// $Id$
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: Kalliopi Kanaki <Kalliopi.Kanaki@ift.uib.no>          *
+ *                  for The ALICE HLT Project.                            *
+ *                                                                        *
+ * 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   AliHLTTPCAnalysisTaskcalib.cxx
+    @author Kalliopi Kanaki
+    @date   
+    @brief  
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
+
+#if __GNUC__>= 3
+using namespace std;
+#endif
+
+#include "AliHLTTPCAnalysisTaskcalib.h"
+#include "AliTPCcalibBase.h"
+#include "AliESDEvent.h"
+#include "AliESDfriend.h"
+#include "AliESDtrack.h"
+#include "AliESDfriendTrack.h"
+#include "AliTPCseed.h"
+
+#include "AliESDInputHandler.h"
+#include "AliAnalysisManager.h"
+
+#include "TFile.h"
+#include "TSystem.h"
+#include "TTimeStamp.h"
+#include "TChain.h"
+
+ClassImp(AliHLTTPCAnalysisTaskcalib)
+
+AliHLTTPCAnalysisTaskcalib::AliHLTTPCAnalysisTaskcalib()
+   :
+   AliTPCAnalysisTaskcalib(),
+   fCalibJobs(0),
+   fESD(0),
+   fESDfriend(0),
+   fDebugOutputPath()
+{
+  //
+  // default constructor
+  // 
+}
+
+
+AliHLTTPCAnalysisTaskcalib::AliHLTTPCAnalysisTaskcalib(const char *name) 
+   :
+   AliTPCAnalysisTaskcalib(name),
+   fCalibJobs(0),
+   fESD(0),
+   fESDfriend(0),
+   fDebugOutputPath()
+{
+  //
+  // Constructor
+  //
+  DefineInput(0, TChain::Class());
+  DefineOutput(0, TObjArray::Class());
+  fCalibJobs = new TObjArray(0);
+  fCalibJobs->SetOwner(kTRUE);
+}
+
+AliHLTTPCAnalysisTaskcalib::~AliHLTTPCAnalysisTaskcalib() {
+  //
+  // destructor
+  //
+  printf("AliHLTTPCAnalysisTaskcalib::~AliHLTTPCAnalysisTaskcalib");
+  fCalibJobs->Delete();
+}
+
+void AliHLTTPCAnalysisTaskcalib::Exec(Option_t *) {
+  //
+  // Exec function
+  // Loop over tracks and call  Process function
+  if (!fESD) {
+    //Printf("ERROR: fESD not available");
+    return;
+  }
+  fESDfriend=static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend"));
+  if (!fESDfriend) {
+    //Printf("ERROR: fESDfriend not available");
+    return;
+  }
+  Int_t n=fESD->GetNumberOfTracks();
+  Process(fESD);
+  Int_t run = fESD->GetRunNumber();
+  for (Int_t i=0;i<n;++i) {
+    AliESDfriendTrack *friendTrack=fESDfriend->GetTrack(i);
+    AliESDtrack *track=fESD->GetTrack(i);
+    TObject *calibObject=0;
+    AliTPCseed *seed=0;
+    if (!friendTrack) continue;
+    for (Int_t j=0;(calibObject=friendTrack->GetCalibObject(j));++j)
+      if ((seed=dynamic_cast<AliTPCseed*>(calibObject)))
+       break;
+    if (track) Process(track, run);
+    if (seed)
+      Process(seed);
+  }
+  PostData(0,fCalibJobs);
+}
+
+void AliHLTTPCAnalysisTaskcalib::ConnectInputData(Option_t *) {
+  //
+  //
+  //
+  TTree* tree=dynamic_cast<TTree*>(GetInputData(0));
+  if (!tree) {
+    //Printf("ERROR: Could not read chain from input slot 0");
+  } 
+  else {
+    AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
+    if (!esdH) {
+      //Printf("ERROR: Could not get ESDInputHandler");
+    } 
+    else {
+      fESD = esdH->GetEvent();
+      //Printf("*** CONNECTED NEW EVENT ****");
+    }
+  }
+}
+
+void AliHLTTPCAnalysisTaskcalib::CreateOutputObjects() {
+  //
+  //
+  //
+  OpenFile(0, "RECREATE");
+}
+void AliHLTTPCAnalysisTaskcalib::Terminate(Option_t */*option*/) {
+  //
+  // Terminate
+  //
+  AliTPCcalibBase *job=0;
+  Int_t njobs = fCalibJobs->GetEntriesFast();
+  for (Int_t i=0;i<njobs;i++){
+    job = (AliTPCcalibBase*)fCalibJobs->UncheckedAt(i);
+    if (job) job->Terminate();
+  }
+  
+}
+
+void AliHLTTPCAnalysisTaskcalib::FinishTaskOutput()
+{
+  //
+  // According description in AliAnalisysTask this method is call 
+  // on the slaves before sending data
+  //
+  Terminate("slave");
+  RegisterDebugOutput();
+  
+}
+
+
+void AliHLTTPCAnalysisTaskcalib::Process(AliESDEvent *event) {
+  //
+  // Process ESD event
+  //
+  AliTPCcalibBase *job=0;
+   
+  Int_t njobs = fCalibJobs->GetEntriesFast(); 
+  for(Int_t i=0;i<njobs;i++){
+      job = (AliTPCcalibBase*)fCalibJobs->UncheckedAt(i);
+      if(job){
+         job->UpdateEventInfo(event);
+         if(job->AcceptTrigger()) job->Process(event);
+      }
+  }
+}
+
+void AliHLTTPCAnalysisTaskcalib::Process(AliTPCseed *track) {
+  //
+  // Process TPC track
+  //
+  AliTPCcalibBase *job=0;
+  Int_t njobs = fCalibJobs->GetEntriesFast();
+  for (Int_t i=0;i<njobs;i++){
+    job = (AliTPCcalibBase*)fCalibJobs->UncheckedAt(i);
+    if (job)  
+      if (job->AcceptTrigger())
+       job->Process(track);
+  }
+}
+
+void AliHLTTPCAnalysisTaskcalib::Process(AliESDtrack *track, Int_t run) {
+  //
+  // Process ESD track
+  //
+  AliTPCcalibBase *job=0;
+  Int_t njobs = fCalibJobs->GetEntriesFast();
+  for (Int_t i=0;i<njobs;i++){
+    job = (AliTPCcalibBase*)fCalibJobs->UncheckedAt(i);
+    if (job) 
+      if (job->AcceptTrigger())
+       job->Process(track,run);
+  }
+}
+
+Long64_t AliHLTTPCAnalysisTaskcalib::Merge(TCollection *li) {
+  TIterator *i=fCalibJobs->MakeIterator();
+  AliTPCcalibBase *job;
+  Long64_t n=0;
+  while ((job=dynamic_cast<AliTPCcalibBase*>(i->Next())))
+    n+=job->Merge(li);
+  return n;
+}
+
+void AliHLTTPCAnalysisTaskcalib::Analyze() {
+  //
+  // Analyze the content of the task
+  //
+  AliTPCcalibBase *job=0;
+  Int_t njobs = fCalibJobs->GetEntriesFast();
+  for (Int_t i=0;i<njobs;i++){
+    job = (AliTPCcalibBase*)fCalibJobs->UncheckedAt(i);
+    if (job) job->Analyze();
+  }
+}
+
+
+void AliHLTTPCAnalysisTaskcalib::RegisterDebugOutput(){
+  //
+  //
+  //
+  AliTPCcalibBase *job=0;
+  Int_t njobs = fCalibJobs->GetEntriesFast();
+  for (Int_t i=0;i<njobs;i++){
+    job = (AliTPCcalibBase*)fCalibJobs->UncheckedAt(i);
+    if (job) job->RegisterDebugOutput(fDebugOutputPath.Data());
+  }
+  TFile fff("CalibObjects.root","recreate");
+  fCalibJobs->Write("TPCCalib",TObject::kSingleKey);
+  fff.Close();
+  //
+  // store  - copy debug output to the destination position
+  // currently ONLY for local copy
+  TString dsName="CalibObjects.root";
+  TString dsName2=fDebugOutputPath.Data();
+  gSystem->MakeDirectory(dsName2.Data());
+  dsName2+=gSystem->HostName();
+  gSystem->MakeDirectory(dsName2.Data());
+  dsName2+="/";
+  TTimeStamp s;
+  dsName2+=Int_t(s.GetNanoSec());
+  dsName2+="/";
+  gSystem->MakeDirectory(dsName2.Data());
+  dsName2+=dsName;
+  AliInfo(Form("copy %s\t%s\n",dsName.Data(),dsName2.Data()));
+  printf("copy %s\t%s\n",dsName.Data(),dsName2.Data());
+  TFile::Cp(dsName.Data(),dsName2.Data());
+
+}
diff --git a/HLT/TPCLib/AliHLTTPCAnalysisTaskcalib.h b/HLT/TPCLib/AliHLTTPCAnalysisTaskcalib.h
new file mode 100644 (file)
index 0000000..1eb5976
--- /dev/null
@@ -0,0 +1,59 @@
+//-*- Mode: C++ -*-
+// $Id$
+#ifndef ALIHLTTPCANALYSISTASKCALIB_H
+#define ALIHLTTPCANALYSISTASKCALIB_H
+
+#include "AliTPCAnalysisTaskcalib.h"
+#include "TObjArray.h"
+#include "AliTPCcalibBase.h"
+#include "AliExternalTrackParam.h"
+
+class AliESDEvent;
+class AliESDtrack;
+class AliESDfriend;
+class AliTPCseed;
+
+class AliHLTTPCAnalysisTaskcalib : public AliTPCAnalysisTaskcalib
+{
+public:
+  /** constructor */
+  AliHLTTPCAnalysisTaskcalib();
+  AliHLTTPCAnalysisTaskcalib(const char *name);
+  /** destructor */
+  virtual ~AliHLTTPCAnalysisTaskcalib();
+  void AddJob(AliTPCcalibBase *job) {fCalibJobs->Add(job);}
+  TObjArray* GetJobs() {return fCalibJobs;}
+  
+
+  virtual void ConnectInputData(Option_t *option);
+  virtual void CreateOutputObjects();
+  virtual void Exec(Option_t *option);
+  virtual void Terminate(Option_t *option);
+  virtual void FinishTaskOutput();
+  void         SetDebugOuputhPath(const char * name){fDebugOutputPath=name;}
+
+//protected:
+  virtual void     Process(AliESDEvent *event);
+  virtual void     Process(AliTPCseed *track);
+  virtual void     Process(AliESDtrack *track, Int_t run);
+  virtual Long64_t Merge(TCollection *li);
+  virtual void     Analyze();
+  void             RegisterDebugOutput();
+
+private:
+  TObjArray    *fCalibJobs;   // array of calibration objects - WE ARE NOT OWNER?
+  AliESDEvent  *fESD;         //! current esd
+  AliESDfriend *fESDfriend;   //! current esd friend
+  TString       fDebugOutputPath; // debug output path   
+  
+  /** copy constructor prohibited */
+  AliHLTTPCAnalysisTaskcalib(const AliHLTTPCAnalysisTaskcalib&); 
+  /** assignment operator prohibited */
+  AliHLTTPCAnalysisTaskcalib& operator=(const AliHLTTPCAnalysisTaskcalib&);
+  
+  ClassDef(AliHLTTPCAnalysisTaskcalib,0)
+};
+
+#endif
index 30067cadb723386ac5d26c02043f77f33b2cae41..fe30013c0b0f4ba904fac1e316b4b888e3c95f6f 100644 (file)
@@ -141,7 +141,7 @@ int AliHLTTPCCalibSeedMakerComponent::DoDeinit() {
 // see header file for class documentation  
   
   if(fTPCGeomParam) delete fTPCGeomParam; fTPCGeomParam = NULL;          
-  if(fSeedArray)    delete fSeedArray;    fSeedArray    = NULL;          
+  if(fSeedArray)   {fSeedArray->Clear();  delete fSeedArray; }   fSeedArray    = NULL;          
   return 0;
 }
 
@@ -191,9 +191,9 @@ int AliHLTTPCCalibSeedMakerComponent::DoEvent(const AliHLTComponentEventData& /*
   
   //------------------ Access to track data blocks --------------------//
   
-  //TObjArray *offClusterArray = new TObjArray;
+  TObjArray *offClusterArray = new TObjArray;
   //offClusterArray->SetOwner(kTRUE);
-  //offClusterArray->Clear();
+  offClusterArray->Clear();
   
   fSeedArray->Clear();
   
@@ -234,14 +234,9 @@ int AliHLTTPCCalibSeedMakerComponent::DoEvent(const AliHLTComponentEventData& /*
          for (Int_t i=0;i<nrowlow;i++) xrow[i]         = fTPCGeomParam->GetPadRowRadiiLow(i);
          for (Int_t i=0;i<nrowup;i++)  xrow[i+nrowlow] = fTPCGeomParam->GetPadRowRadiiUp(i);
 
-         // sector rotation angles
-         Double_t angle_in        = fTPCGeomParam->GetInnerAngle();
-         Double_t angle_shift_in  = fTPCGeomParam->GetInnerAngleShift();
-         Double_t angle_out       = fTPCGeomParam->GetOuterAngle();
-         Double_t angle_shift_out = fTPCGeomParam->GetOuterAngleShift();
-         
-         //offClusterArray->Clear();
-         
+         // sector rotation angles - only one angle is needed
+         Double_t angle = fTPCGeomParam->GetInnerAngle();
+           
          const UInt_t *hitnum = element->GetPoints(); // store the clusters on each track in an array and loop over them
           for(UInt_t i=0; i<element->GetNumberOfPoints(); i++){
               
@@ -271,22 +266,16 @@ int AliHLTTPCCalibSeedMakerComponent::DoEvent(const AliHLTComponentEventData& /*
              offClus->SetDetector(sector);
              usedSpacePoints++;
              
-             //offClusterArray->Add(offClus);
-             
-             // the clusters are not sorted from max to min X              
+             offClusterArray->Add(offClus);
+                           
              rieman.AddPoint( offClus->GetX(),offClus->GetY(),offClus->GetZ(),TMath::Sqrt(offClus->GetSigmaY2()),TMath::Sqrt(offClus->GetSigmaZ2()) );    
               
              xmin = TMath::Min(xmin,xrow[offClus->GetRow()]); // min pad-row radius
-                     
-             if(sector<36){ 
-                 //xmin = TMath::Min(xmin,xrow[offClus->GetRow()]); // min pad-row radius
-                 alpha = angle_shift_in+angle_in*(sector%18);
-              } else {
-                 //xmin = TMath::Min(xmin,xrow[nrowlow+offClus->GetRow()]); // min pad-row radius
-                 alpha = angle_shift_out+angle_out*(sector%18);
-              }
-              //if(sector<36) HLTInfo("detector: %d, row: %d, xrow[row]: %f", sector, offClus->GetRow(), xrow[offClus->GetRow()]);
-              //else          HLTInfo("detector: %d, row: %d, xrow[row]: %f", sector, offClus->GetRow(), xrow[nrowlow+offClus->GetRow()]);
+                   
+              alpha = 0.5*angle+angle*(sector%18); //sector rotation angle
+              
+              // HLTInfo("detector: %d, row: %d, xrow[row]: %f", sector, offClus->GetRow(), xrow[offClus->GetRow()]);  
+            
           } // end of cluster loop
 
           // creation of AliTPCseed by means of a Riemann fit
@@ -294,23 +283,25 @@ int AliHLTTPCCalibSeedMakerComponent::DoEvent(const AliHLTComponentEventData& /*
           rieman.GetExternalParameters(xmin,param,cov);  
          seed = new AliTPCseed(xmin,alpha,param,cov,0);
         
-         // is it necessay to set the cluster pointers inside the seed??
-//       for(Int_t j=0; j<offClusterArray->GetEntries(); j++)  
-//                AliTPCclusterMI *cl = (AliTPCclusterMI*)offClusterArray->At(j);
-//                if(cl) seed->SetClusterPointer(cl->GetRow(),cl);
-//            }
+         // set up of the cluster pointers inside the seed
+         for(Int_t j=0; j<offClusterArray->GetEntries(); j++)
+              AliTPCclusterMI *cl = (AliTPCclusterMI*)offClusterArray->At(j);
+              if(cl) seed->SetClusterPointer(cl->GetRow(),cl);
+          }
 
+         offClusterArray->Clear();     
+          HLTDebug("External track parameters: seed: 0x%08x, xmin: %f, alpha: %f, param[0]: %f, cov[0]: %f", seed, xmin, alpha, param[0], cov[0]);
+         fSeedArray->Add(seed);         
 
-          HLTInfo("External track parameters: seed: 0x%08x, xmin: %f, alpha: %f, param[0]: %f, cov[0]: %f", seed, xmin, alpha, param[0], cov[0]);
-         fSeedArray->Add(seed);
-
-      }// end of vector track loop        
+      }// end of vector track loop           
   } // end of loop over blocks of merged tracks  
   
   HLTDebug("Used space points: %d", usedSpacePoints);
   HLTDebug("Number of entries in fSeedArray: %d", fSeedArray->GetEntries());
-
-
+  
+  if(offClusterArray) delete offClusterArray;
+  offClusterArray = NULL;
   fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( fMinSlice, fMaxSlice, fMinPartition, fMaxPartition );
   //PushBack((TObject*)offClusterArray, kAliHLTDataTypeTObjArray, fSpecification);
   PushBack((TObject*)fSeedArray,       kAliHLTDataTypeTObjArray, fSpecification);
diff --git a/HLT/TPCLib/AliHLTTPCCalibrationComponent.cxx b/HLT/TPCLib/AliHLTTPCCalibrationComponent.cxx
new file mode 100644 (file)
index 0000000..905b925
--- /dev/null
@@ -0,0 +1,230 @@
+// $Id$
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * ALICE Experiment at CERN, All rights reserved.                         *
+ *                                                                        *
+ * Primary Authors: Kalliopi Kanaki <Kalliopi.Kanaki@ift.uib.no>          *
+ *                  for The ALICE HLT Project.                            *
+ *                                                                        *
+ * 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   AliHLTTPCCalibrationComponent.cxx
+    @author Kalliopi Kanaki
+    @date   
+    @brief  
+*/
+
+// see header file for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
+
+#if __GNUC__>= 3
+using namespace std;
+#endif
+
+#include "AliHLTTPCCalibrationComponent.h"
+#include "AliHLTTPCDefinitions.h"
+#include "AliHLTTPCAnalysisTaskcalib.h"
+
+#include "AliAnalysisManager.h"
+#include "AliESDInputHandler.h"
+
+#include "AliTPCcalibTime.h"
+#include "AliTPCcalibTimeGain.h"
+#include "AliESDEvent.h"
+
+#include <cstdlib>
+#include <cerrno>
+
+#include "TString.h"
+#include "TObjArray.h"
+#include "TTimeStamp.h"
+
+ClassImp(AliHLTTPCCalibrationComponent) // ROOT macro for the implementation of ROOT specific class methods
+
+AliHLTTPCCalibrationComponent::AliHLTTPCCalibrationComponent()
+  :
+  fCalibTask(NULL),
+  fCalibTime(NULL),
+  fCalibTimeGain(NULL),
+  fESDEvent(NULL),
+  fSeedArray(NULL),
+  fMinPartition(5),
+  fMaxPartition(0),
+  fMinSlice(35),
+  fMaxSlice(0),
+  fSpecification(0) ,
+  fEnableAnalysis(kTRUE)
+{
+  // see header file for class documentation
+  // or
+  // refer to README to build package
+  // or
+  // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
+}
+
+AliHLTTPCCalibrationComponent::~AliHLTTPCCalibrationComponent() {
+// see header file for class documentation
+}
+
+const char* AliHLTTPCCalibrationComponent::GetComponentID() {
+// see header file for class documentation
+
+  return "TPCCalibration";
+}
+
+void AliHLTTPCCalibrationComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
+// see header file for class documentation
+
+  list.clear();   
+  list.push_back( kAliHLTDataTypeTObjArray ); // output of TPCCalibSeedMaker
+  list.push_back( kAliHLTDataTypeESDObject ); // output of TPCEsdConverter 
+}
+
+AliHLTComponentDataType AliHLTTPCCalibrationComponent::GetOutputDataType() {
+// see header file for class documentation
+
+  return AliHLTTPCDefinitions::fgkCalibCEDataType;
+}
+
+void AliHLTTPCCalibrationComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) {
+// see header file for class documentation
+
+  constBase = 0;
+  inputMultiplier = (2.0); // to be estimated
+}
+
+AliHLTComponent* AliHLTTPCCalibrationComponent::Spawn() {
+// see header file for class documentation
+
+  return new AliHLTTPCCalibrationComponent();
+}  
+
+
+Int_t AliHLTTPCCalibrationComponent::ScanArgument( Int_t argc, const char** argv ) {
+// see header file for class documentation
+
+  Int_t iResult = 0;
+  TString argument = "";
+  TString parameter = "";
+
+  if(!argc) return -EINVAL;
+
+  argument = argv[iResult];
+  
+  if(argument.IsNull()) return -EINVAL;
+
+  if( argument.CompareTo("-enable-analysis") == 0 ){
+    HLTInfo( "Analysis before shipping data to FXS enabled." );
+    fEnableAnalysis = kTRUE;
+  }
+  else {
+    iResult = -EINVAL;
+  }
+      
+  return iResult;
+}
+
+Int_t AliHLTTPCCalibrationComponent::InitCalibration() {
+// see header file for class documentation
+    
+  //TTimeStamp startTime(2008,9,0,0,0,0);
+  //TTimeStamp stopTime(2008,11,0,0,0,0);
+  
+//   AliAnalysisManager *mgr  = new AliAnalysisManager("TestManager");
+//   AliESDInputHandler *esdH = new AliESDInputHandler;
+//   esdH->SetActiveBranches("ESDfriend");
+//   mgr->SetInputEventHandler(esdH);  
+
+  if(fCalibTask) return EINPROGRESS;
+  fCalibTask = new AliHLTTPCAnalysisTaskcalib("TPC Calibration Task");
+  
+  if(fCalibTime) return EINPROGRESS;
+  fCalibTime = new AliTPCcalibTime("calibTimeGain","time dependent gain calibration",-2, 2, 1);
+  
+  fCalibTime->SetDebugLevel(20);
+  fCalibTime->SetStreamLevel(10);
+  fCalibTime->SetTriggerMask(-1,-1,kFALSE); //accept everything 
+
+  if(fCalibTimeGain) return EINPROGRESS;
+  fCalibTimeGain = new AliTPCcalibTimeGain();
+  
+  fCalibTask->AddJob(fCalibTime);
+  fCalibTask->AddJob(fCalibTimeGain);
+  fCalibTask->GetJobs();
+  return 0;
+}
+
+Int_t AliHLTTPCCalibrationComponent::DeinitCalibration() {
+// see header file for class documentation
+
+  if(fCalibTask)     delete fCalibTask;     fCalibTask     = NULL;
+  if(fCalibTime)     delete fCalibTime;     fCalibTime     = NULL;
+  if(fCalibTimeGain) delete fCalibTimeGain; fCalibTimeGain = NULL;
+
+  return 0;
+}
+
+Int_t AliHLTTPCCalibrationComponent::ProcessCalibration( const AliHLTComponentEventData& /*evtData*/,  AliHLTComponentTriggerData& /*trigData*/ ){
+// see header file for class documentation
+  
+  if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0;
+
+  TObject *iterESD, *iterSEED = NULL;
+
+  //----------- loop over output of TPCEsdConverter ----------------//
+  
+  for(iterESD = (TObject*)GetFirstInputObject(kAliHLTDataTypeESDObject|kAliHLTDataOriginTPC); iterESD != NULL; iterESD = (TObject*)GetNextInputObject()){   
+       
+      if(GetDataType(iterSEED) != (kAliHLTDataTypeESDObject | kAliHLTDataOriginTPC)) continue;
+  
+      AliHLTUInt8_t slice     = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iterESD)); 
+      AliHLTUInt8_t partition = AliHLTTPCDefinitions::GetMinPatchNr(GetSpecification(iterESD));
+      
+      if( partition < fMinPartition ) fMinPartition = partition;
+      if( partition > fMaxPartition ) fMaxPartition = partition;
+      if( slice < fMinSlice ) fMinSlice = slice;
+      if( slice > fMaxSlice ) fMaxSlice = slice;
+      
+      fESDEvent = dynamic_cast<AliESDEvent*>(iterESD);
+      fESDEvent->CreateStdContent();
+  } 
+
+  //--------------- output over TObjArray of AliTPCseed objects (output of TPCSeedMaker) -------------------//
+  
+  for(iterSEED = (TObject*)GetFirstInputObject(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC); iterSEED != NULL; iterSEED = (TObject*)GetNextInputObject()){  
+              
+       if(GetDataType(iterSEED) != (kAliHLTDataTypeTObjArray | kAliHLTDataOriginTPC)) continue;
+
+       fSeedArray = dynamic_cast<TObjArray*>(iterSEED); 
+  }
+  
+  fCalibTask->Process(fESDEvent);
+
+  fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification( fMinSlice, fMaxSlice, fMinPartition, fMaxPartition );
+  PushBack( (TObject*) fCalibTask, AliHLTTPCDefinitions::fgkCalibCEDataType, fSpecification);
+  
+  return 0;
+}
+
+Int_t AliHLTTPCCalibrationComponent::ShipDataToFXS( const AliHLTComponentEventData& /*evtData*/,  AliHLTComponentTriggerData& /*trigData*/ ){
+  // see header file for class documentation
+    
+  if(fEnableAnalysis) fCalibTask->Analyze();  
+  PushToFXS( (TObject*) fCalibTask, "TPC", "CALIB" ) ;
+  
+  return 0;
+} 
+
+
diff --git a/HLT/TPCLib/AliHLTTPCCalibrationComponent.h b/HLT/TPCLib/AliHLTTPCCalibrationComponent.h
new file mode 100644 (file)
index 0000000..33e0214
--- /dev/null
@@ -0,0 +1,95 @@
+//-*- Mode: C++ -*-
+// $Id$
+#ifndef ALIHLTTPCCALIBRATIONCOMPONENT_H
+#define ALIHLTTPCCALIBRATIONCOMPONENT_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   AliHLTTPCCalibrationComponent.h
+    @author Kalliopi Kanaki
+    @date   
+    @brief  
+*/
+
+// see below for class documentation
+// or
+// refer to README to build package
+// or
+// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
+
+#include "AliHLTCalibrationProcessor.h"
+class AliTPCcalibTime;
+class AliTPCcalibTimeGain;
+class AliHLTTPCAnalysisTaskcalib;
+class AliESDEvent;
+class TObjArray;
+
+/**
+ * @class AliHLTTPCCalibrationComponent
+ * 
+ * Interface of the offline algorithm (AliTPCcalibTimeGain) for updating
+ * the TPC gain as a function of time.
+ * 
+ * @ingroup alihlt_tpc_components
+ */
+class AliHLTTPCCalibrationComponent : public AliHLTCalibrationProcessor
+    {
+    public:
+      /** constructor */
+      AliHLTTPCCalibrationComponent();
+      /** destructor */
+      virtual ~AliHLTTPCCalibrationComponent();
+
+      const char* GetComponentID();
+      void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
+      AliHLTComponentDataType GetOutputDataType();
+      virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+      AliHLTComponent* Spawn();
+
+    protected:
+
+      using AliHLTCalibrationProcessor::ProcessCalibration;
+      using AliHLTCalibrationProcessor::ShipDataToFXS;
+           
+      /** 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 );
+
+    private:
+      /** copy constructor prohibited */
+      AliHLTTPCCalibrationComponent(const AliHLTTPCCalibrationComponent&);
+      /** assignment operator prohibited */
+      AliHLTTPCCalibrationComponent& operator=(const AliHLTTPCCalibrationComponent&);
+
+      AliHLTTPCAnalysisTaskcalib *fCalibTask;
+      AliTPCcalibTime            *fCalibTime;
+      AliTPCcalibTimeGain        *fCalibTimeGain;
+     
+      AliESDEvent                *fESDEvent;  //!transient
+      TObjArray                  *fSeedArray; //!transient
+      
+      AliHLTUInt8_t  fMinPartition;   // see above
+      AliHLTUInt8_t  fMaxPartition;   // see above
+      AliHLTUInt8_t  fMinSlice;       // see above
+      AliHLTUInt8_t  fMaxSlice;       // see above
+      AliHLTUInt32_t fSpecification;  // see above
+
+      /** Analyze calibration data before shipping to FXS */
+      Bool_t fEnableAnalysis;  // see above
+
+      ClassDef(AliHLTTPCCalibrationComponent, 0)
+    };
+#endif
index fb03bb9cc965344705b9c2fb36da72822ded6f23..3542a77fe63941642f066ebdffba2e97f0f2a70c 100644 (file)
@@ -9,25 +9,28 @@
  *
  * Usage:
  * <pre>
+ *   aliroot -b -q testTPCCalibration.C'("./")' | tee testTPCCalibration.log
  *   aliroot -b -q testTPCCalibration.C'("./","calibtime")' | tee testTPCCalibration.log
  *   aliroot -b -q testTPCCalibration.C'("./","calibtimegain")' | tee testTPCCalibration.log
  * </pre>
  *
  * The macro assumes raw data to be available in the rawx folders, either
- * simulated or real data. A different input can be specified as parameter
+ * simulated or real data. If this is the only input specified, the macro
+ * will load the calibration analysis task. If the second argument is specified,
+ * then the individual calibration classes can be tested.
+ *
  * <pre>
  *   aliroot -b -q testTPCCalibration.C'("raw.root","calibtime")'
  * </pre>
  *
- *
  * The reconstruction is steered by the AliReconstruction object in the
  * usual way.
  *
  * @ingroup alihlt_tpc
- * @author Matthias.Richter@ift.uib.no
+ * @author Kalliopi.Kanaki@ift.uib.no
  */
 
-void testTPCCalibration(const char* input="./", const char* option=" "){
+void testTPCCalibration(const char* input="./", const char* option="task"){
 
   gSystem->Load("libANALYSIS");
   gSystem->Load("libTPCcalib");  
@@ -62,10 +65,10 @@ void testTPCCalibration(const char* input="./", const char* option=" "){
   calibInput+="TPC-esd-converter";
   calibInput+=" ";
   calibInput+="seeds";
-  
+    
   TString calibOption = option;
-  if     (calibOption.CompareTo("calibtime")==0)     AliHLTConfiguration calibtimeconf("calibTime",     "TPCCalibTime",     calibInput.Data(), "");
+  if     (calibOption.CompareTo("task")==0)          AliHLTConfiguration calibtimeconf("TPCcalib",      "TPCCalibration",   calibInput.Data(), "");
+  else if(calibOption.CompareTo("calibtime")==0)     AliHLTConfiguration calibtimeconf("calibTime",     "TPCCalibTime",     calibInput.Data(), "");
   else if(calibOption.CompareTo("calibtimegain")==0) AliHLTConfiguration calibtimeconf("calibTimeGain", "TPCCalibTimeGain", calibInput.Data(), "");
   else 
     {
@@ -93,8 +96,9 @@ void testTPCCalibration(const char* input="./", const char* option=" "){
   // has already been prepared. This step is currently not necessary for
   // this macro
   rec.SetFillESD("");
+  if     (calibOption.CompareTo("task")==0)          rec.SetOption("HLT", "libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so loglevel=0x7c chains=TPCcalib"); 
   if     (calibOption.CompareTo("calibtime")==0)     rec.SetOption("HLT", "libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so loglevel=0x7c chains=calibTime"); 
   else if(calibOption.CompareTo("calibtimegain")==0) rec.SetOption("HLT", "libAliHLTUtil.so libAliHLTRCU.so libAliHLTTPC.so loglevel=0x7c chains=calibTimeGain");
+
   rec.Run();
 }
index ae3e299a5eb4449469d2bf0d418311cc127ca1d6..2ed07d41ba96d76d2a1222c17e488e5c5f9bcbf3 100644 (file)
@@ -109,8 +109,9 @@ CLASS_HDRS:=        AliHLTTPCTransform.h \
                AliHLTTPCTrackMCMarkerComponent.h \
                AliHLTTPCCalibSeedMakerComponent.h \
                AliHLTTPCCalibTimeComponent.h \
-               AliHLTTPCCalibTimeGainComponent.h
-
+               AliHLTTPCCalibTimeGainComponent.h \
+                AliHLTTPCAnalysisTaskcalib.h \
+               AliHLTTPCCalibrationComponent.h
 
 
 #              AliHLTTPCDDLDataFileHandler.h