// The reconstruction requires digits or raw data as input. For the creation //
// of digits and raw data have a look at the class AliSimulation. //
// //
+// The input data of a detector can be replaced by the corresponding HLT //
+// data by calling (usual detector string) //
+// SetUseHLTData("..."); //
+// //
// For debug purposes the method SetCheckPointLevel can be used. If the //
// argument is greater than 0, files with ESD events will be written after //
// selected steps of the reconstruction for each event: //
#include <TLorentzVector.h>
#include <TArrayS.h>
#include <TArrayD.h>
+#include <TObjArray.h>
#include "AliReconstruction.h"
#include "AliCodeTimer.h"
#include "AliAlignObj.h"
#include "AliCentralTrigger.h"
+#include "AliTriggerConfiguration.h"
+#include "AliTriggerClass.h"
#include "AliCTPRawStream.h"
#include "AliAODEvent.h"
#include "AliPlaneEff.h"
#include "AliSysInfo.h" // memory snapshots
+#include "AliRawHLTManager.h"
ClassImp(AliReconstruction)
fUniformField(kTRUE),
fRunVertexFinder(kTRUE),
+ fRunVertexFinderTracks(kTRUE),
fRunHLTTracking(kFALSE),
fRunMuonTracking(kFALSE),
fRunV0Finder(kTRUE),
fLoadAlignFromCDB(kTRUE),
fLoadAlignData("ALL"),
fESDPar(""),
+ fUseHLTData(),
fRunLoader(NULL),
fRawReader(NULL),
+ fParentRawReader(NULL),
fVertexer(NULL),
fDiamondProfile(NULL),
fUniformField(rec.fUniformField),
fRunVertexFinder(rec.fRunVertexFinder),
+ fRunVertexFinderTracks(rec.fRunVertexFinderTracks),
fRunHLTTracking(rec.fRunHLTTracking),
fRunMuonTracking(rec.fRunMuonTracking),
fRunV0Finder(rec.fRunV0Finder),
if (!fEquipIdMap.IsNull() && fRawReader)
fRawReader->LoadEquipmentIdsMap(fEquipIdMap);
+ if (!fUseHLTData.IsNull()) {
+ // create the RawReaderHLT which performs redirection of HLT input data for
+ // the specified detectors
+ AliRawReader* pRawReader=AliRawHLTManager::CreateRawReaderHLT(fRawReader, fUseHLTData.Data());
+ if (pRawReader) {
+ fParentRawReader=fRawReader;
+ fRawReader=pRawReader;
+ } else {
+ AliError(Form("can not create Raw Reader for HLT input %s", fUseHLTData.Data()));
+ }
+ }
+
AliSysInfo::AddStamp("Start");
// get the run loader
if (!InitRunLoader()) return kFALSE;
TObjArray *arr=
qadm->Init(AliQA::kRECPOINTS, AliCDBManager::Instance()->GetRun());
AliTracker::SetResidualsArray(arr);
+ qadm->Init(AliQA::kESDS, AliCDBManager::Instance()->GetRun());
if (!fInLoopQA) {
qadm->StartOfCycle(AliQA::kRECPOINTS);
+ qadm->StartOfCycle(AliQA::kESDS,"same");
}
}
}
if (fRunGlobalQA) {
AliQADataMakerRec *qadm = GetQADataMaker(fgkNDetectors);
qadm->StartOfCycle(AliQA::kRECPOINTS);
+ qadm->StartOfCycle(AliQA::kESDS,"same");
}
}
// HLT tracking
if (!fRunTracking.IsNull()) {
if (fRunHLTTracking) {
- hltesd->SetVertex(esd->GetVertex());
+ hltesd->SetPrimaryVertexSPD(esd->GetVertex());
if (!RunHLTTracking(hltesd)) {
if (fStopOnError) {CleanUp(file, fileOld); return kFALSE;}
}
file->cd();
- //Try to improve the reconstructed primary vertex position using the tracks
- AliESDVertex *pvtx=0;
- Bool_t dovertex=kTRUE;
- TObject* obj = fOptions.FindObject("ITS");
+ //
+ // Propagate track to the beam pipe (if not laready done by ITS)
+ //
+ const Int_t ntracks = esd->GetNumberOfTracks();
+ const Double_t kBz = esd->GetMagneticField();
+ const Double_t kRadius = 2.8; //something less than the beam pipe radius
+
+ TObjArray trkArray;
+ UShort_t *selectedIdx=new UShort_t[ntracks];
+
+ for (Int_t itrack=0; itrack<ntracks; itrack++){
+ const Double_t kMaxStep = 5; //max step over the material
+ Bool_t ok;
+
+ AliESDtrack *track = esd->GetTrack(itrack);
+ if (!track) continue;
+
+ AliExternalTrackParam *tpcTrack =
+ (AliExternalTrackParam *)track->GetTPCInnerParam();
+ ok = kFALSE;
+ if (tpcTrack)
+ ok = AliTracker::
+ PropagateTrackTo(tpcTrack,kRadius,track->GetMass(),kMaxStep,kTRUE);
+ if (ok) {
+ Int_t n=trkArray.GetEntriesFast();
+ selectedIdx[n]=track->GetID();
+ trkArray.AddLast(tpcTrack);
+ }
+
+ if (track->GetX() < kRadius) continue;
+
+ ok = AliTracker::
+ PropagateTrackTo(track,kRadius,track->GetMass(),kMaxStep,kTRUE);
+ if (ok) {
+ track->RelateToVertex(esd->GetPrimaryVertexSPD(), kBz, kRadius);
+ }
+ }
+
+ //
+ // Improve the reconstructed primary vertex position using the tracks
+ //
+ TObject *obj = fOptions.FindObject("ITS");
if (obj) {
TString optITS = obj->GetTitle();
if (optITS.Contains("cosmics") || optITS.Contains("COSMICS"))
- dovertex=kFALSE;
+ fRunVertexFinderTracks=kFALSE;
+ }
+ if (fRunVertexFinderTracks) {
+ // TPC + ITS primary vertex
+ AliESDVertex *pvtx=tVertexer.FindPrimaryVertex(esd);
+ if (pvtx) {
+ if (pvtx->GetStatus()) {
+ esd->SetPrimaryVertex(pvtx);
+ for (Int_t i=0; i<ntracks; i++) {
+ AliESDtrack *t = esd->GetTrack(i);
+ t->RelateToVertex(pvtx, kBz, kRadius);
+ }
+ }
+ }
+
+ // TPC-only primary vertex
+ pvtx=tVertexer.FindPrimaryVertex(&trkArray,selectedIdx);
+ if (pvtx) {
+ if (pvtx->GetStatus()) {
+ esd->SetPrimaryVertexTPC(pvtx);
+ Int_t nsel=trkArray.GetEntriesFast();
+ for (Int_t i=0; i<nsel; i++) {
+ AliExternalTrackParam *t =
+ (AliExternalTrackParam *)trkArray.UncheckedAt(i);
+ t->PropagateToDCA(pvtx, kBz, kRadius);
+ }
+ }
+ }
+
}
- if(dovertex) pvtx=tVertexer.FindPrimaryVertex(esd);
+ delete[] selectedIdx;
+
if(fDiamondProfile) esd->SetDiamond(fDiamondProfile);
- if (pvtx)
- if (pvtx->GetStatus()) {
- // Store the improved primary vertex
- esd->SetPrimaryVertex(pvtx);
- // Propagate the tracks to the DCA to the improved primary vertex
- Double_t somethingbig = 777.;
- Double_t bz = esd->GetMagneticField();
- Int_t nt=esd->GetNumberOfTracks();
- while (nt--) {
- AliESDtrack *t = esd->GetTrack(nt);
- t->RelateToVertex(pvtx, bz, somethingbig);
- }
- }
if (fRunV0Finder) {
// V0 finding
// write ESD
if (fCleanESD) CleanESD(esd);
+
+ if (fRunQA && fRunGlobalQA) {
+ AliQADataMakerRec *qadm = GetQADataMaker(fgkNDetectors);
+ if (qadm) qadm->Exec(AliQA::kESDS, esd);
+ }
+
if (fWriteESDfriend) {
esdf->~AliESDfriend();
new (esdf) AliESDfriend(); // Reset...
AliQADataMakerRec *qadm = GetQADataMaker(fgkNDetectors);
if (qadm) {
qadm->EndOfCycle(AliQA::kRECPOINTS);
+ qadm->EndOfCycle(AliQA::kESDS);
qadm->Finish();
}
}
tree->Write(tree->GetName(),TObject::kOverwrite);
hlttree->Write();
+// Finish with Plane Efficiency evaluation: before of CleanUp !!!
+ if (fRunPlaneEff && !FinishPlaneEff()) {
+ AliWarning("Finish PlaneEff evaluation failed");
+ }
+
gROOT->cd();
CleanUp(file, fileOld);
esdFile->Close();
}
-// Finish with Plane Efficiency evaluation
- if (fRunPlaneEff && !FinishPlaneEff()) {
- AliWarning("Finish PlaneEff evaluation failed");
- }
-
- gROOT->cd();
- CleanUp(file, fileOld);
-
// Create tags for the events in the ESD tree (the ESD tree is always present)
// In case of empty events the tags will contain dummy values
AliESDTagCreator *esdtagCreator = new AliESDTagCreator();
AliQADataMakerRec *qadm = GetQADataMaker(fgkNDetectors);
if (qadm) {
qadm->EndOfCycle(AliQA::kRECPOINTS);
+ qadm->EndOfCycle(AliQA::kESDS);
qadm->Finish();
}
}
AliWarning("no vertex reconstructed");
vertex = new AliESDVertex(vtxPos, vtxErr);
}
- esd->SetVertex(vertex);
+ esd->SetPrimaryVertexSPD(vertex);
// if SPD multiplicity has been determined, it is stored in the ESD
AliMultiplicity *mult = fVertexer->GetMultiplicity();
if(mult)esd->SetMultiplicity(mult);
// pass 2: ALL backwards
- if (fRunQA && fRunGlobalQA) AliTracker::SetFillResiduals(kTRUE);
-
for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
if (!fTracker[iDet]) continue;
AliDebug(1, Form("%s back propagation", fgkDetectorName[iDet]));
AliSysInfo::AddStamp(Form("Tracking1%s_%d",fgkDetectorName[iDet],eventNr), iDet,3, eventNr);
}
- if (fRunQA && fRunGlobalQA) AliTracker::SetFillResiduals(kFALSE);
-
// write space-points to the ESD in case alignment data output
// is switched on
if (fWriteAlignmentData)
// pass 3: TRD + TPC + ITS refit inwards
+ if (fRunQA && fRunGlobalQA) AliTracker::SetFillResiduals(kTRUE);
for (Int_t iDet = 2; iDet >= 0; iDet--) {
if (!fTracker[iDet]) continue;
AliSysInfo::AddStamp(Form("RUnloadCluster%s_%d",fgkDetectorName[iDet],eventNr), iDet,5, eventNr);
}
- //
- // Propagate track to the vertex - if not done by ITS
- //
- Int_t ntracks = esd->GetNumberOfTracks();
- for (Int_t itrack=0; itrack<ntracks; itrack++){
- const Double_t kRadius = 3; // beam pipe radius
- const Double_t kMaxStep = 5; // max step
- const Double_t kMaxD = 123456; // max distance to prim vertex
- Double_t fieldZ = AliTracker::GetBz(); //
- AliESDtrack * track = esd->GetTrack(itrack);
- if (!track) continue;
- if (track->IsOn(AliESDtrack::kITSrefit)) continue;
- AliTracker::PropagateTrackTo(track,kRadius,track->GetMass(),kMaxStep,kTRUE);
- track->RelateToVertex(esd->GetVertex(),fieldZ, kMaxD);
- }
+ if (fRunQA && fRunGlobalQA) AliTracker::SetFillResiduals(kFALSE);
+
eventNr++;
return kTRUE;
}
AliInfo("Filling trigger information into the ESD");
+ AliCentralTrigger *aCTP = NULL;
+
if (fRawReader) {
AliCTPRawStream input(fRawReader);
if (!input.Next()) {
}
esd->SetTriggerMask(input.GetClassMask());
esd->SetTriggerCluster(input.GetClusterMask());
+
+ aCTP = new AliCentralTrigger();
+ TString configstr("");
+ if (!aCTP->LoadConfiguration(configstr)) { // Load CTP config from OCDB
+ AliError("No trigger configuration found in OCDB! The trigger classes information will no be stored in ESD!");
+ return kFALSE;
+ }
}
else {
AliRunLoader *runloader = AliRunLoader::GetRunLoader();
if (runloader) {
if (!runloader->LoadTrigger()) {
- AliCentralTrigger *aCTP = runloader->GetTrigger();
+ aCTP = runloader->GetTrigger();
esd->SetTriggerMask(aCTP->GetClassMask());
esd->SetTriggerCluster(aCTP->GetClusterMask());
}
}
}
+ // Now fill the trigger class names into AliESDRun object
+ AliTriggerConfiguration *config = aCTP->GetConfiguration();
+ if (!config) {
+ AliError("No trigger configuration has been found! The trigger classes information will no be stored in ESD!");
+ return kFALSE;
+ }
+
+ const TObjArray& classesArray = config->GetClasses();
+ Int_t nclasses = classesArray.GetEntriesFast();
+ for( Int_t j=0; j<nclasses; j++ ) {
+ AliTriggerClass* trclass = (AliTriggerClass*)classesArray.At( j );
+ Int_t trindex = (Int_t)TMath::Log2(trclass->GetMask());
+ esd->SetTriggerClass(trclass->GetName(),trindex);
+ }
+
return kTRUE;
}
fRunLoader = NULL;
delete fRawReader;
fRawReader = NULL;
+ if (fParentRawReader) delete fParentRawReader;
+ fParentRawReader=NULL;
if (file) {
file->Close();
//for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
for (Int_t iDet = 0; iDet < 1; iDet++) { // for the time being only ITS
//if (!IsSelected(fgkDetectorName[iDet], detStr)) continue;
- //if(fReconstructor[iDet]->GetRecoParam()->GetComputePlaneEff()) continue;
- ret=fTracker[iDet]->GetPlaneEff()->WriteIntoCDB();
+ if(fTracker[iDet]) ret=fTracker[iDet]->GetPlaneEff()->WriteIntoCDB();
}
return ret;
}