// 1. The Input data for reconstruction - Options
// 1.a Simulated data - TTree - invoked Digits2Clusters()
// 1.b Raw data - Digits2Clusters(AliRawReader* rawReader);
+// 1.c HLT clusters - Digits2Clusters and Digits2Clusters(AliRawReader* rawReader)
+// invoke ReadHLTClusters()
+//
+// fUseHLTClusters - switches between different inputs
+// 1 -> only TPC raw/sim data
+// 2 -> if present TPC raw/sim data, otherwise HLT clusters
+// 3 -> only HLT clusters
+// 4 -> if present HLT clusters, otherwise TPC raw/sim data
//
// 2. The Output data
// 2.a TTree with clusters - if SetOutput(TTree * tree) invoked
#include <TRandom.h>
#include <TTree.h>
#include <TTreeStream.h>
+#include "TSystem.h"
+#include "TClass.h"
#include "AliDigits.h"
#include "AliLoader.h"
fRecoParam(0),
fBDumpSignal(kFALSE),
fBClonesArray(kFALSE),
+ fUseHLTClusters(1),
fAllBins(NULL),
fAllSigBins(NULL),
fAllNSigBins(NULL)
fRecoParam(0),
fBDumpSignal(kFALSE),
fBClonesArray(kFALSE),
+ fUseHLTClusters(1),
fAllBins(NULL),
fAllSigBins(NULL),
fAllNSigBins(NULL)
//
if (!tree) return;
fOutput= tree;
- AliTPCClustersRow clrow, *pclrow=&clrow;
- pclrow = new AliTPCClustersRow("AliTPCclusterMI");
+ AliTPCClustersRow clrow("AliTPCclusterMI");
+ AliTPCClustersRow *pclrow=&clrow;
fOutput->Branch("Segment","AliTPCClustersRow",&pclrow,32000,200);
}
AliTPCTransform *transform = AliTPCcalibDB::Instance()->GetTransform() ;
if (!transform) {
AliFatal("Tranformations not in calibDB");
+ return;
}
transform->SetCurrentRecoParam((AliTPCRecoParam*)fRecoParam);
Double_t x[3]={c.GetRow(),c.GetPad(),c.GetTimeBin()};
fRecoParam->Dump();
}
+ //-----------------------------------------------------------------
+ // Use HLT clusters
+ //-----------------------------------------------------------------
+ fUseHLTClusters = fRecoParam->GetUseHLTClusters();
+
+ AliInfo(Form("Usage of HLT clusters in TPC reconstruction : %d",fUseHLTClusters));
+
+ if (fUseHLTClusters == 3 || fUseHLTClusters == 4) {
+ AliInfo("Using HLT clusters for TPC off-line reconstruction");
+ fZWidth = fParam->GetZWidth();
+ Int_t iResult = ReadHLTClusters();
+
+ // HLT clusters present
+ if (iResult >= 0 && fNclusters > 0)
+ return;
+
+ // HLT clusters not present
+ if (iResult < 0 || fNclusters == 0) {
+ if (fUseHLTClusters == 3) {
+ AliError("No HLT clusters present, but requested.");
+ return;
+ }
+ else {
+ AliInfo("Now trying to read TPC RAW");
+ }
+ }
+ // Some other problem during cluster reading
+ else {
+ AliWarning("Some problem while unpacking of HLT clusters.");
+ return;
+ }
+ } // if (fUseHLTClusters == 3 || fUseHLTClusters == 4) {
+
+ //-----------------------------------------------------------------
+ // Run TPC off-line clusterer
+ //-----------------------------------------------------------------
AliTPCCalPad * gainTPC = AliTPCcalibDB::Instance()->GetPadGainFactor();
AliTPCCalPad * noiseTPC = AliTPCcalibDB::Instance()->GetPadNoise();
AliSimDigits digarr, *dummy=&digarr;
fZWidth = fParam->GetZWidth();
if (fSector < kNIS) {
fMaxPad = fParam->GetNPadsLow(row);
- fSign = (fSector < kNIS/2) ? 1 : -1;
+ fSign = (fSector < kNIS/2) ? 1 : -1;
fPadLength = fParam->GetPadPitchLength(fSector,row);
fPadWidth = fParam->GetPadPitchWidth();
} else {
}
Info("Digits2Clusters", "Number of found clusters : %d", nclusters);
+
+ if (fUseHLTClusters == 2 && nclusters == 0) {
+ AliInfo("No clusters from TPC Raw data, now trying to read HLT clusters.");
+
+ fZWidth = fParam->GetZWidth();
+ ReadHLTClusters();
+ }
}
void AliTPCclustererMI::ProcessSectorData(){
}
fRowDig = NULL;
+ //-----------------------------------------------------------------
+ // Use HLT clusters
+ //-----------------------------------------------------------------
+ fUseHLTClusters = fRecoParam->GetUseHLTClusters();
+
+ AliInfo(Form("Usage of HLT clusters in TPC reconstruction : %d",fUseHLTClusters));
+
+ if (fUseHLTClusters == 3 || fUseHLTClusters == 4) {
+ AliInfo("Using HLT clusters for TPC off-line reconstruction");
+ fZWidth = fParam->GetZWidth();
+ Int_t iResult = ReadHLTClusters();
+
+ // HLT clusters present
+ if (iResult >= 0 && fNclusters > 0)
+ return;
+
+ // HLT clusters not present
+ if (iResult < 0 || fNclusters == 0) {
+ if (fUseHLTClusters == 3) {
+ AliError("No HLT clusters present, but requested.");
+ return;
+ }
+ else {
+ AliInfo("Now trying to read TPC RAW");
+ }
+ }
+ // Some other problem during cluster reading
+ else {
+ AliWarning("Some problem while unpacking of HLT clusters.");
+ return;
+ }
+ } // if (fUseHLTClusters == 3 || fUseHLTClusters == 4) {
+
+ //-----------------------------------------------------------------
+ // Run TPC off-line clusterer
+ //-----------------------------------------------------------------
AliTPCCalPad * gainTPC = AliTPCcalibDB::Instance()->GetPadGainFactor();
AliTPCAltroMapping** mapping =AliTPCcalibDB::Instance()->GetMapping();
//
}
if (rawReader->GetEventId() && fOutput ){
- Info("Digits2Clusters", "File %s Event\t%d\tNumber of found clusters : %d\n", fOutput->GetName(),*(rawReader->GetEventId()), fNclusters);
+ Info("Digits2Clusters", "File %s Event\t%u\tNumber of found clusters : %d\n", fOutput->GetName(),*(rawReader->GetEventId()), fNclusters);
}
if(rawReader->GetEventId()) {
- Info("Digits2Clusters", "Event\t%d\tNumber of found clusters : %d\n",*(rawReader->GetEventId()), fNclusters);
+ Info("Digits2Clusters", "Event\t%u\tNumber of found clusters : %d\n",*(rawReader->GetEventId()), fNclusters);
}
if(fBClonesArray) {
//Info("Digits2Clusters", "Number of found clusters : %d\n",fOutputClonesArray->GetEntriesFast());
}
+
+ if (fUseHLTClusters == 2 && fNclusters == 0) {
+ AliInfo("No clusters from TPC Raw data, now trying to read HLT clusters.");
+
+ fZWidth = fParam->GetZWidth();
+ ReadHLTClusters();
+ }
}
rawReader->Select("TPC",indexDDL,indexDDL+nDDLs-1);
// select only good sector
- input.Next();
+ if (!input.Next()) continue;
if(input.GetSector() != fSector) continue;
AliTPCCalROC * gainROC = gainTPC->GetCalROC(fSector); // pad gains per given sector
dsignal[i] = signal[i];
}
- TGraph * graph=0;
//
// Big signals dumping
//
"Sector="<<uid[0]<<
"Row="<<uid[1]<<
"Pad="<<uid[2]<<
- "Graph="<<graph<<
+ // "Graph="<<graph<<
"Max="<<max<<
"MaxPos="<<maxPos<<
//
"Mean09="<<mean09<<
"RMS09="<<rms09<<
"\n";
- delete graph;
}
delete [] dsignal;
return median;
}
+Int_t AliTPCclustererMI::ReadHLTClusters()
+{
+ //
+ // read HLT clusters instead of off line custers,
+ // used in Digits2Clusters
+ //
+ TObject* pClusterAccess=NULL;
+ TClass* pCl=NULL;
+ ROOT::NewFunc_t pNewFunc=NULL;
+ do {
+ pCl=TClass::GetClass("AliHLTTPCClusterAccessHLTOUT");
+ } while (!pCl && gSystem->Load("libAliHLTTPC.so")==0);
+ if (!pCl || (pNewFunc=pCl->GetNew())==NULL) {
+ AliError("can not load class description of AliHLTTPCClusterAccessHLTOUT, aborting ...");
+ return -1;
+ }
+
+ void* p=(*pNewFunc)(NULL);
+ if (!p) {
+ AliError("unable to create instance of AliHLTTPCClusterAccessHLTOUT");
+ return -2;
+ }
+ pClusterAccess=reinterpret_cast<TObject*>(p);
+ if (!pClusterAccess) {
+ AliError("instance not of type TObject");
+ return -3 ;
+ }
+ const Int_t kNIS = fParam->GetNInnerSector();
+ const Int_t kNOS = fParam->GetNOuterSector();
+ const Int_t kNS = kNIS + kNOS;
+ fNclusters = 0;
+
+ for(fSector = 0; fSector < kNS; fSector++) {
+ Int_t iResult = 1;
+ TString param("sector="); param+=fSector;
+ pClusterAccess->Clear();
+ pClusterAccess->Execute("read", param, &iResult);
+ if (iResult < 0) {
+ return iResult;
+ AliError("HLT Clusters can not be found");
+ }
+ if (pClusterAccess->FindObject("clusterarray")==NULL) {
+ AliError("HLT clusters requested, but not cluster array not present");
+ return -4;
+ }
+
+ TClonesArray* clusterArray=dynamic_cast<TClonesArray*>(pClusterAccess->FindObject("clusterarray"));
+ if (!clusterArray) {
+ AliError("HLT cluster array is not of class type TClonesArray");
+ return -5;
+ }
+
+ AliDebug(4,Form("Reading %d clusters from HLT for sector %d", clusterArray->GetEntriesFast(), fSector));
+
+ Int_t nClusterSector=0;
+ Int_t nRows=fParam->GetNRow(fSector);
+
+ for (fRow = 0; fRow < nRows; fRow++) {
+ fRowCl->SetID(fParam->GetIndex(fSector, fRow));
+ if (fOutput) fOutput->GetBranch("Segment")->SetAddress(&fRowCl);
+ fNcluster=0; // reset clusters per row
+
+ fRx = fParam->GetPadRowRadii(fSector, fRow);
+ fPadLength = fParam->GetPadPitchLength(fSector, fRow);
+ fPadWidth = fParam->GetPadPitchWidth();
+ fMaxPad = fParam->GetNPads(fSector,fRow);
+ fMaxBin = fMaxTime*(fMaxPad+6); // add 3 virtual pads before and 3 after
+
+ fBins = fAllBins[fRow];
+ fSigBins = fAllSigBins[fRow];
+ fNSigBins = fAllNSigBins[fRow];
+
+ for (Int_t i=0; i<clusterArray->GetEntriesFast(); i++) {
+ if (!clusterArray->At(i))
+ continue;
+
+ AliTPCclusterMI* cluster=dynamic_cast<AliTPCclusterMI*>(clusterArray->At(i));
+ if (!cluster) continue;
+ if (cluster->GetRow()!=fRow) continue;
+ nClusterSector++;
+ AddCluster(*cluster, NULL, 0);
+ }
+
+ FillRow();
+ fRowCl->GetArray()->Clear("c");
+
+ } // for (fRow = 0; fRow < nRows; fRow++) {
+ if (nClusterSector!=clusterArray->GetEntriesFast()) {
+ AliError(Form("Failed to read %d out of %d HLT clusters",
+ clusterArray->GetEntriesFast()-nClusterSector,
+ clusterArray->GetEntriesFast()));
+ }
+ fNclusters+=nClusterSector;
+ } // for(fSector = 0; fSector < kNS; fSector++) {
+
+ delete pClusterAccess;
+
+ Info("Digits2Clusters", "Number of converted HLT clusters : %d", fNclusters);
+
+ return 0;
+}