]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Further integration of the HLT reconstruction (C.Cheshkov)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 1 Apr 2005 08:31:45 +0000 (08:31 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 1 Apr 2005 08:31:45 +0000 (08:31 +0000)
STEER/AliESD.h
STEER/AliReconstruction.cxx
STEER/AliReconstruction.h

index 7d59c331575b7c5aa59aded7f8d4540d7bcac8c9..2c2fe42e0ddbb1608fb161a248326d64c1acc91c 100644 (file)
@@ -106,7 +106,7 @@ public:
   }
 
 
-  void SetVertex(AliESDVertex* vertex) {
+  void SetVertex(const AliESDVertex* vertex) {
     new(&fPrimaryVertex) AliESDVertex(*vertex);
   }
   const AliESDVertex* GetVertex() const {return &fPrimaryVertex;};
index 556c72ab402da2e7eb78ee676668b107b9f52ea4..a9ee0e1073a003a5ceaca136d2b651b24f4698cb 100644 (file)
@@ -139,6 +139,7 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename,
 
   fRunLocalReconstruction("ALL"),
   fRunVertexFinder(kTRUE),
+  fRunHLTTracking(kFALSE),
   fRunTracking("ALL"),
   fFillESD("ALL"),
   fGAliceFileName(gAliceFilename),
@@ -170,6 +171,7 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) :
 
   fRunLocalReconstruction(rec.fRunLocalReconstruction),
   fRunVertexFinder(rec.fRunVertexFinder),
+  fRunHLTTracking(rec.fRunHLTTracking),
   fRunTracking(rec.fRunTracking),
   fFillESD(rec.fFillESD),
   fGAliceFileName(rec.fGAliceFileName),
@@ -283,15 +285,17 @@ Bool_t AliReconstruction::Run(const char* input,
   }
 
   // get the possibly already existing ESD file and tree
-  AliESD* esd = new AliESD;
+  AliESD* esd = new AliESD; AliESD* hltesd = new AliESD;
   TFile* fileOld = NULL;
-  TTree* treeOld = NULL;
+  TTree* treeOld = NULL; TTree *hlttreeOld = NULL;
   if (!gSystem->AccessPathName("AliESDs.root")){
     gSystem->CopyFile("AliESDs.root", "AliESDs.old.root", kTRUE);
     fileOld = TFile::Open("AliESDs.old.root");
     if (fileOld && fileOld->IsOpen()) {
       treeOld = (TTree*) fileOld->Get("esdTree");
       if (treeOld) treeOld->SetBranchAddress("ESD", &esd);
+      hlttreeOld = (TTree*) fileOld->Get("HLTesdTree");
+      if (hlttreeOld) hlttreeOld->SetBranchAddress("ESD", &hltesd);
     }
   }
 
@@ -303,8 +307,10 @@ Bool_t AliReconstruction::Run(const char* input,
   }
   TTree* tree = new TTree("esdTree", "Tree with ESD objects");
   tree->Branch("ESD", "AliESD", &esd);
-  delete esd;
-  esd = NULL;
+  TTree* hlttree = new TTree("HLTesdTree", "Tree with HLT ESD objects");
+  hlttree->Branch("ESD", "AliESD", &hltesd);
+  delete esd; delete hltesd;
+  esd = NULL; hltesd = NULL;
   gROOT->cd();
 
   // loop over events
@@ -319,6 +325,11 @@ Bool_t AliReconstruction::Run(const char* input,
        treeOld->GetEntry(iEvent);
       }
       tree->Fill();
+      if (hlttreeOld) {
+       hlttreeOld->SetBranchAddress("ESD", &hltesd);
+       hlttreeOld->GetEntry(iEvent);
+      }
+      hlttree->Fill();
       continue;
     }
 
@@ -338,11 +349,14 @@ Bool_t AliReconstruction::Run(const char* input,
       }
     }
 
-    esd = new AliESD;
+    esd = new AliESD; hltesd = new AliESD;
     esd->SetRunNumber(fRunLoader->GetHeader()->GetRun());
+    hltesd->SetRunNumber(fRunLoader->GetHeader()->GetRun());
     esd->SetEventNumber(fRunLoader->GetHeader()->GetEventNrInRun());
+    hltesd->SetEventNumber(fRunLoader->GetHeader()->GetEventNrInRun());
     if (gAlice) {
       esd->SetMagneticField(gAlice->Field()->SolenoidField());
+      hltesd->SetMagneticField(gAlice->Field()->SolenoidField());
     } else {
       // ???
     }
@@ -357,6 +371,16 @@ Bool_t AliReconstruction::Run(const char* input,
       }
     }
 
+    // HLT tracking
+    if (!fRunTracking.IsNull()) {
+      if (fRunHLTTracking) {
+       hltesd->SetVertex(esd->GetVertex());
+       if (!RunHLTTracking(hltesd)) {
+         if (fStopOnError) {CleanUp(file, fileOld); return kFALSE;}
+       }
+      }
+    }
+
     // barrel tracking
     if (!fRunTracking.IsNull()) {
       if (!ReadESD(esd, "tracking")) {
@@ -380,14 +404,17 @@ Bool_t AliReconstruction::Run(const char* input,
 
     // write ESD
     tree->Fill();
+    // write HLT ESD
+    hlttree->Fill();
 
     if (fCheckPointLevel > 0) WriteESD(esd, "final");
-    delete esd;
-    esd = NULL;
+    delete esd; delete hltesd;
+    esd = NULL; hltesd = NULL;
   }
 
   file->cd();
   tree->Write();
+  hlttree->Write();
   CleanUp(file, fileOld);
 
   return kTRUE;
@@ -560,6 +587,65 @@ Bool_t AliReconstruction::RunVertexFinder(AliESD*& esd)
   return kTRUE;
 }
 
+//_____________________________________________________________________________
+Bool_t AliReconstruction::RunHLTTracking(AliESD*& esd)
+{
+// run the HLT barrel tracking
+
+  TStopwatch stopwatch;
+  stopwatch.Start();
+
+  if (!fRunLoader) {
+    AliError("Missing runLoader!");
+    return kFALSE;
+  }
+
+  AliInfo("running HLT tracking");
+
+  // Get a pointer to the HLT reconstructor
+  AliReconstructor *reconstructor = GetReconstructor(fgkNDetectors-1);
+  if (!reconstructor) return kFALSE;
+
+  // TPC + ITS
+  for (Int_t iDet = 1; iDet >= 0; iDet--) {
+    TString detName = fgkDetectorName[iDet];
+    AliDebug(1, Form("%s HLT tracking", detName.Data()));
+    reconstructor->SetOption(detName.Data());
+    AliTracker *tracker = reconstructor->CreateTracker(fRunLoader);
+    if (!tracker) {
+      AliWarning(Form("couldn't create a HLT tracker for %s", detName.Data()));
+      if (fStopOnError) return kFALSE;
+    }
+    Double_t vtxPos[3];
+    Double_t vtxErr[3]={0.005,0.005,0.010};
+    const AliESDVertex *vertex = esd->GetVertex();
+    vertex->GetXYZ(vtxPos);
+    tracker->SetVertex(vtxPos,vtxErr);
+    if(iDet != 1) {
+      fLoader[iDet]->LoadRecPoints("read");
+      TTree* tree = fLoader[iDet]->TreeR();
+      if (!tree) {
+       AliError(Form("Can't get the %s cluster tree", detName.Data()));
+       return kFALSE;
+      }
+      tracker->LoadClusters(tree);
+    }
+    if (tracker->Clusters2Tracks(esd) != 0) {
+      AliError(Form("HLT %s Clusters2Tracks failed", fgkDetectorName[iDet]));
+      return kFALSE;
+    }
+    if(iDet != 1) {
+      tracker->UnloadClusters();
+    }
+    delete tracker;
+  }
+
+  AliInfo("execution time:");
+  ToAliInfo(stopwatch.Print());
+
+  return kTRUE;
+}
+
 //_____________________________________________________________________________
 Bool_t AliReconstruction::RunTracking(AliESD*& esd)
 {
@@ -962,7 +1048,10 @@ Bool_t AliReconstruction::CreateTrackers(const TString& detectors)
     AliReconstructor* reconstructor = GetReconstructor(iDet);
     if (!reconstructor) continue;
     TString detName = fgkDetectorName[iDet];
-    if (detName == "HLT") continue;
+    if (detName == "HLT") {
+      fRunHLTTracking = kTRUE;
+      continue;
+    }
 
     fTracker[iDet] = reconstructor->CreateTracker(fRunLoader);
     if (!fTracker[iDet] && (iDet < 7)) {
index 4847527b6547927f53621adea78e4b01bb438709..4aa168e8669f5947386ea67349aba40b4ebe52cc 100644 (file)
@@ -73,6 +73,7 @@ private:
   Bool_t         RunLocalReconstruction(const TString& detectors);
   Bool_t         RunLocalEventReconstruction(const TString& detectors);
   Bool_t         RunVertexFinder(AliESD*& esd);
+  Bool_t         RunHLTTracking(AliESD*& esd);
   Bool_t         RunTracking(AliESD*& esd);
   Bool_t         FillESD(AliESD*& esd, const TString& detectors);
 
@@ -88,6 +89,7 @@ private:
 
   TString        fRunLocalReconstruction; // run the local reconstruction for these detectors
   Bool_t         fRunVertexFinder;    // run the vertex finder
+  Bool_t         fRunHLTTracking;     // run the HLT tracking
   TString        fRunTracking;        // run the tracking for these detectors
   TString        fFillESD;            // fill ESD for these detectors
   TString        fGAliceFileName;     // name of the galice file