#include "AliAODVertex.h"
#include "AliAODCluster.h"
-#include "AliQualAssDataMaker.h"
+#include "AliQADataMaker.h"
+
+//#include "TMemStatManager.h" // memory snapshots
+#include "AliSysInfo.h" // memory snapshots
ClassImp(AliReconstruction)
fRunCascadeFinder(kTRUE),
fStopOnError(kFALSE),
fWriteAlignmentData(kFALSE),
- fCleanESD(kTRUE),
fWriteESDfriend(kFALSE),
fWriteAOD(kFALSE),
fFillTriggerESD(kTRUE),
+ fCleanESD(kTRUE),
+ fDmax(50.),
+ fZmax(50.),
+
fRunLocalReconstruction("ALL"),
fRunTracking("ALL"),
fFillESD("ALL"),
+ fUseTrackingErrorsForAlignment(""),
fGAliceFileName(gAliceFilename),
fInput(""),
fEquipIdMap(""),
fReconstructor[iDet] = NULL;
fLoader[iDet] = NULL;
fTracker[iDet] = NULL;
- fQualAssDataMaker[iDet] = NULL;
+ fQADataMaker[iDet] = NULL;
+ fQACycles[iDet] = 999999;
}
AliPID pid;
}
fRunCascadeFinder(rec.fRunCascadeFinder),
fStopOnError(rec.fStopOnError),
fWriteAlignmentData(rec.fWriteAlignmentData),
- fCleanESD(rec.fCleanESD),
fWriteESDfriend(rec.fWriteESDfriend),
fWriteAOD(rec.fWriteAOD),
fFillTriggerESD(rec.fFillTriggerESD),
+ fCleanESD(rec.fCleanESD),
+ fDmax(rec.fDmax),
+ fZmax(rec.fZmax),
+
fRunLocalReconstruction(rec.fRunLocalReconstruction),
fRunTracking(rec.fRunTracking),
fFillESD(rec.fFillESD),
+ fUseTrackingErrorsForAlignment(rec.fUseTrackingErrorsForAlignment),
fGAliceFileName(rec.fGAliceFileName),
fInput(rec.fInput),
fEquipIdMap(rec.fEquipIdMap),
fReconstructor[iDet] = NULL;
fLoader[iDet] = NULL;
fTracker[iDet] = NULL;
- fQualAssDataMaker[iDet] = NULL;
+ fQADataMaker[iDet] = NULL;
+ fQACycles[iDet] = rec.fQACycles[iDet];
}
for (Int_t i = 0; i < rec.fSpecCDBUri.GetEntriesFast(); i++) {
if (rec.fSpecCDBUri[i]) fSpecCDBUri.Add(rec.fSpecCDBUri[i]->Clone());
// Remote storage (the Grid storage) is used if it is activated
// and if the object is not found in the default storage
- if (man->IsRemoteStorageSet())
- {
- AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
- AliWarning("Remote CDB storage has been already set !");
- AliWarning(Form("Ignoring the remote storage declared in AliReconstruction: %s",fRemoteCDBUri.Data()));
- AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
- fRemoteCDBUri = "";
- }
- else {
- AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
- AliDebug(2, Form("Remote CDB storage is set to: %s",fRemoteCDBUri.Data()));
- AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
- man->SetRemoteStorage(fRemoteCDBUri);
- }
+ // OBSOLETE: Removed
+ // if (man->IsRemoteStorageSet())
+ // {
+ // AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+ // AliWarning("Remote CDB storage has been already set !");
+ // AliWarning(Form("Ignoring the remote storage declared in AliReconstruction: %s",fRemoteCDBUri.Data()));
+ // AliWarning("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+ // fRemoteCDBUri = "";
+ // }
+ // else {
+ // AliDebug(2,"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+ // AliDebug(2, Form("Remote CDB storage is set to: %s",fRemoteCDBUri.Data()));
+ // AliDebug(2, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+ // man->SetRemoteStorage(fRemoteCDBUri);
+ // }
// Now activate the detector specific CDB storage locations
for (Int_t i = 0; i < fSpecCDBUri.GetEntriesFast(); i++) {
if (!fEquipIdMap.IsNull() && fRawReader)
fRawReader->LoadEquipmentIdsMap(fEquipIdMap);
-
+ AliSysInfo::AddStamp("Start");
// get the run loader
if (!InitRunLoader()) return kFALSE;
+ AliSysInfo::AddStamp("LoadLoader");
// Initialize the CDB storage
InitCDBStorage();
+ AliSysInfo::AddStamp("LoadCDB");
// Set run number in CDBManager (if it is not already set by the user)
if (!SetRunNumber()) if (fStopOnError) return kFALSE;
}
if (!MisalignGeometry(fLoadAlignData)) if (fStopOnError) return kFALSE;
+ AliSysInfo::AddStamp("LoadGeom");
// local reconstruction
if (!fRunLocalReconstruction.IsNull()) {
return kFALSE;
}
}
+ AliSysInfo::AddStamp("Vertexer");
// get trackers
if (!fRunTracking.IsNull() && !CreateTrackers(fRunTracking)) {
return kFALSE;
}
}
+ AliSysInfo::AddStamp("LoadTrackers");
// get the possibly already existing ESD file and tree
AliESDEvent* esd = new AliESDEvent(); AliESDEvent* hltesd = new AliESDEvent();
}
if (!fFillESD.IsNull())
- RunQualAss(fFillESD.Data(), esd);
+ RunQA(fFillESD.Data(), esd);
// fill Event header information from the RawEventHeader
if (fRawReader){FillRawEventHeaderESD(esd);}
}
}
+ file->cd();
+
//Try to improve the reconstructed primary vertex position using the tracks
AliESDVertex *pvtx=0;
Bool_t dovertex=kTRUE;
for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
if (!IsSelected(fgkDetectorName[iDet], detStr))
continue;
- AliQualAssDataMaker * qadm = GetQualAssDataMaker(iDet);
+ AliQADataMaker * qadm = GetQADataMaker(iDet);
if (!qadm) continue;
- qadm->Finish(AliQualAss::kRECPOINTS);
- qadm->Finish(AliQualAss::kESDS) ;
+ qadm->EndOfCycle(AliQA::kRECPOINTS);
+ qadm->EndOfCycle(AliQA::kESDS);
+ qadm->Finish(AliQA::kRECPOINTS);
+ qadm->Finish(AliQA::kESDS) ;
}
tree->GetUserInfo()->Add(esd);
file->cd();
if (fWriteESDfriend)
tree->SetBranchStatus("ESDfriend*",0);
- tree->Write();
+ // we want to have only one tree version number
+ tree->Write(tree->GetName(),TObject::kOverwrite);
hlttree->Write();
if (fWriteAOD) {
Bool_t AliReconstruction::RunLocalReconstruction(const TString& detectors)
{
// run the local reconstruction
-
+ static Int_t eventNr=0;
AliCodeTimerAuto("")
// AliCDBManager* man = AliCDBManager::Instance();
// }
// AliCodeTimerStop(Form("running reconstruction for %s", fgkDetectorName[iDet]));
+ // AliSysInfo::AddStamp(Form("LRec%s_%d",fgkDetectorName[iDet],eventNr));
// // unload calibration data
// man->UnloadFromCache(calibPath);
// if (fStopOnError) return kFALSE;
// }
+ eventNr++;
return kTRUE;
}
Bool_t AliReconstruction::RunLocalEventReconstruction(const TString& detectors)
{
// run the local reconstruction
-
+ static Int_t eventNr=0;
AliCodeTimerAuto("")
TString detStr = detectors;
loader->UnloadDigits();
}
- AliQualAssDataMaker * qadm = GetQualAssDataMaker(iDet);
+ AliQADataMaker * qadm = GetQADataMaker(iDet);
if (qadm) {
AliCodeTimerStart(Form("running quality assurance data maker for %s", fgkDetectorName[iDet]));
AliInfo(Form("running quality assurance data maker for %s", fgkDetectorName[iDet]));
- qadm->Exec(AliQualAss::kRECPOINTS, clustersTree) ;
+
+ if (qadm->IsCycleDone() ) {
+ qadm->EndOfCycle(AliQA::kRECPOINTS) ;
+ qadm->EndOfCycle(AliQA::kESDS) ;
+ qadm->StartOfCycle(AliQA::kRECPOINTS) ;
+ qadm->StartOfCycle(AliQA::kESDS, "same") ;
+ }
+ qadm->Exec(AliQA::kRECPOINTS, clustersTree) ;
AliCodeTimerStop(Form("running quality assurance data maker for %s", fgkDetectorName[iDet]));
}
loader->WriteRecPoints("OVERWRITE");
loader->UnloadRecPoints();
+ AliSysInfo::AddStamp(Form("LRec%s_%d",fgkDetectorName[iDet],eventNr));
}
if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) {
detStr.Data()));
if (fStopOnError) return kFALSE;
}
-
+ eventNr++;
return kTRUE;
}
Bool_t AliReconstruction::RunTracking(AliESDEvent*& esd)
{
// run the barrel tracking
-
+ static Int_t eventNr=0;
AliCodeTimerAuto("")
AliInfo("running tracking");
if (iDet == 1) {
GetReconstructor(1)->FillESD((TTree*)NULL, (TTree*)NULL, esd);
AliESDpid::MakePID(esd);
- }
+ }
+ AliSysInfo::AddStamp(Form("Tracking0%s_%d",fgkDetectorName[iDet],eventNr));
}
// pass 2: ALL backwards
AliError(Form("Can't get the %s cluster tree", fgkDetectorName[iDet]));
return kFALSE;
}
- fTracker[iDet]->LoadClusters(tree);
+ fTracker[iDet]->LoadClusters(tree);
+ AliSysInfo::AddStamp(Form("LoadCluster0%s_%d",fgkDetectorName[iDet],eventNr));
}
// run tracking
GetReconstructor(1)->FillESD((TTree*)NULL, (TTree*)NULL, esd);
AliESDpid::MakePID(esd);
}
+ AliSysInfo::AddStamp(Form("Tracking1%s_%d",fgkDetectorName[iDet],eventNr));
}
// write space-points to the ESD in case alignment data output
// unload clusters
fTracker[iDet]->UnloadClusters();
fLoader[iDet]->UnloadRecPoints();
+ AliSysInfo::AddStamp(Form("Tracking2%s_%d",fgkDetectorName[iDet],eventNr));
}
//
// Propagate track to the vertex - if not done by ITS
AliTracker::PropagateTrackTo(track,kRadius,track->GetMass(),kMaxStep,kTRUE);
track->RelateToVertex(esd->GetVertex(),fieldZ, kMaxD);
}
-
+ eventNr++;
return kTRUE;
}
//
AliInfo("Cleaning the ESD...");
-
- const AliESDVertex *vertex=esd->GetVertex();
- Double_t vz=vertex->GetZv();
-
Int_t nTracks=esd->GetNumberOfTracks();
- for (Int_t i=0; i<nTracks; i++) {
- AliESDtrack *track=esd->GetTrack(i);
+ AliInfo(Form("Number of ESD tracks before cleaning %d",nTracks));
- Float_t xy,z; track->GetImpactParameters(xy,z);
- if (TMath::Abs(xy) < 50.) continue;
- if (vertex->GetStatus())
- if (TMath::Abs(vz-z) < 5.) continue;
+ Float_t cleanPars[]={fDmax,fZmax};
+ Bool_t rc=esd->Clean(cleanPars);
- esd->RemoveTrack(i);
- }
+ nTracks=esd->GetNumberOfTracks();
+ AliInfo(Form("Number of ESD tracks after cleaning %d",nTracks));
- return kTRUE;
+ return rc;
}
//_____________________________________________________________________________
// fill the event summary data
AliCodeTimerAuto("")
-
+ static Int_t eventNr=0;
TString detStr = detectors;
for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
if (!IsSelected(fgkDetectorName[iDet], detStr)) continue;
detStr.Data()));
if (fStopOnError) return kFALSE;
}
-
+ AliSysInfo::AddStamp(Form("FillESD%d",eventNr));
+ eventNr++;
return kTRUE;
}
TString recName = "Ali" + detName + "Reconstructor";
if (gAlice && !gAlice->GetDetector(detName) && (detName != "HLT")) return NULL;
- if (detName == "HLT") {
- if (!gROOT->GetClass("AliLevel3")) {
- gSystem->Load("libAliHLTSrc.so");
- gSystem->Load("libAliHLTMisc.so");
- gSystem->Load("libAliHLTHough.so");
- gSystem->Load("libAliHLTComp.so");
- }
- }
-
AliReconstructor* reconstructor = NULL;
// first check if a plugin is defined for the reconstructor
TPluginHandler* pluginHandler =
fLoader[iDet] = NULL;
delete fTracker[iDet];
fTracker[iDet] = NULL;
- delete fQualAssDataMaker[iDet];
- fQualAssDataMaker[iDet] = NULL;
+ delete fQADataMaker[iDet];
+ fQADataMaker[iDet] = NULL;
}
delete fVertexer;
fVertexer = NULL;
AliAODTrack *primTrack = NULL;
Char_t ttype=AliAODCluster::kUndef;
- if (cluster->IsPHOS()) ttype=AliAODCluster::kPHOSNeutral;
- else if (cluster->IsEMCAL()) {
-
- if (cluster->GetClusterType() == AliESDCaloCluster::kPseudoCluster)
- ttype = AliAODCluster::kEMCALPseudoCluster;
- else
- ttype = AliAODCluster::kEMCALClusterv1;
-
+ if (cluster->GetClusterType() == AliESDCaloCluster::kPHOSCluster){
+ ttype = AliAODCluster::kPHOSNeutral;
}
+ else if (cluster->GetClusterType() == AliESDCaloCluster::kEMCALClusterv1){
+ ttype = AliAODCluster::kEMCALClusterv1;
+ }
+ else if (cluster->GetClusterType() == AliESDCaloCluster::kEMCALPseudoCluster){
+ ttype = AliAODCluster::kEMCALPseudoCluster;
+ }
new(clusters[jClusters++]) AliAODCluster(id,
label,
Int_t isp = 0;
Int_t isp2 = 0;
while (isp < nspdet) {
- Bool_t isvalid = tracker->GetTrackPoint(idx[isp2],p); isp2++;
+ Bool_t isvalid;
+ if(IsSelected(fgkDetectorName[iDet],fUseTrackingErrorsForAlignment)) {
+ isvalid = tracker->GetTrackPointTrackingError(idx[isp2],p,track);
+ } else {
+ isvalid = tracker->GetTrackPoint(idx[isp2],p);
+ }
+ isp2++;
const Int_t kNTPCmax = 159;
if (iDet==1 && isp2>kNTPCmax) break; // to be fixed
if (!isvalid) continue;
}
//_____________________________________________________________________________
-AliQualAssDataMaker * AliReconstruction::GetQualAssDataMaker(Int_t iDet)
+AliQADataMaker * AliReconstruction::GetQADataMaker(Int_t iDet)
{
// get the quality assurance data maker object and the loader for a detector
- if (fQualAssDataMaker[iDet])
- return fQualAssDataMaker[iDet];
+ if (fQADataMaker[iDet])
+ return fQADataMaker[iDet];
// load the QA data maker object
TPluginManager* pluginManager = gROOT->GetPluginManager();
TString detName = fgkDetectorName[iDet];
- TString qadmName = "Ali" + detName + "QualAssDataMaker";
+ TString qadmName = "Ali" + detName + "QADataMaker";
if (gAlice && !gAlice->GetDetector(detName) && (detName != "HLT"))
return NULL;
- AliQualAssDataMaker * qadm = NULL;
+ AliQADataMaker * qadm = NULL;
// first check if a plugin is defined for the quality assurance data maker
- TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQualAssDataMaker", detName);
+ TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName);
// if not, add a plugin for it
if (!pluginHandler) {
AliDebug(1, Form("defining plugin for %s", qadmName.Data()));
TString libs = gSystem->GetLibraries();
if (libs.Contains("lib" + detName + "base.so") ||
(gSystem->Load("lib" + detName + "base.so") >= 0)) {
- pluginManager->AddHandler("AliQualAssDataMaker", detName,
+ pluginManager->AddHandler("AliQADataMaker", detName,
qadmName, detName + "qadm", qadmName + "()");
} else {
- pluginManager->AddHandler("AliQualAssDataMaker", detName,
+ pluginManager->AddHandler("AliQADataMaker", detName,
qadmName, detName, qadmName + "()");
}
- pluginHandler = pluginManager->FindHandler("AliQualAssDataMaker", detName);
+ pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName);
}
if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) {
- qadm = (AliQualAssDataMaker *) pluginHandler->ExecPlugin(0);
+ qadm = (AliQADataMaker *) pluginHandler->ExecPlugin(0);
}
if (qadm) {
AliInfo(Form("Initializing quality assurance data maker for %s", fgkDetectorName[iDet]));
- qadm->Init(AliQualAss::kRECPOINTS);
- qadm->Init(AliQualAss::kESDS) ;
- fQualAssDataMaker[iDet] = qadm;
+ qadm->Init(AliQA::kRECPOINTS, AliCDBManager::Instance()->GetRun(), GetQACycles(fgkDetectorName[iDet]));
+ qadm->StartOfCycle(AliQA::kRECPOINTS);
+ qadm->Init(AliQA::kESDS, AliCDBManager::Instance()->GetRun());
+ qadm->StartOfCycle(AliQA::kESDS, "same") ;
+ fQADataMaker[iDet] = qadm;
}
return qadm;
}
//_____________________________________________________________________________
-Bool_t AliReconstruction::RunQualAss(const char* detectors, AliESDEvent *& esd)
+Bool_t AliReconstruction::RunQA(const char* detectors, AliESDEvent *& esd)
{
// run the Quality Assurance data producer
for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
if (!IsSelected(fgkDetectorName[iDet], detStr))
continue;
- AliQualAssDataMaker * qadm = GetQualAssDataMaker(iDet);
+ AliQADataMaker * qadm = GetQADataMaker(iDet);
if (!qadm)
continue;
AliCodeTimerStart(Form("running quality assurance data maker for %s", fgkDetectorName[iDet]));
AliInfo(Form("running quality assurance data maker for %s", fgkDetectorName[iDet]));
- qadm->Exec(AliQualAss::kESDS, esd) ;
+ qadm->Exec(AliQA::kESDS, esd) ;
+ qadm->Increment() ;
AliCodeTimerStop(Form("running quality assurance data maker for %s", fgkDetectorName[iDet]));
}
}
return kTRUE;
+
+
+}
+
+//_____________________________________________________________________________
+Int_t AliReconstruction::GetDetIndex(const char* detector)
+{
+ // return the detector index corresponding to detector
+ Int_t index = -1 ;
+ for (index = 0; index < fgkNDetectors ; index++) {
+ if ( strcmp(detector, fgkDetectorName[index]) == 0 )
+ break ;
+ }
+ return index ;
}