#include <Riostream.h>
-#include <TFile.h>
#include <TBranch.h>
-#include <TTree.h>
-#include <TObjArray.h>
-#include <TTreeStream.h>
+#include <TFile.h>
#include <TGraph.h>
-#include <TLinearFitter.h>
#include <TH1D.h>
#include <TH2D.h>
+#include <TLinearFitter.h>
+#include <TObjArray.h>
+#include <TROOT.h>
+#include <TTree.h>
+#include <TTreeStream.h>
#include "AliESD.h"
#include "AliAlignObj.h"
#include "AliTRDCommonParam.h"
#include "AliTRDtracker.h"
#include "AliTRDReconstructor.h"
-#include "AliTRDCalibra.h"
+#include "AliTRDCalibraFillHisto.h"
+
ClassImp(AliTRDtracker)
const Float_t AliTRDtracker::fgkMinClustersInTrack = 0.5;
savedir->cd();
for (Int_t geomS = 0; geomS < kTrackingSectors; geomS++) {
- Int_t trS = CookSectorIndex(geomS);
+ Int_t trS = geomS;
fTrSec[trS] = new AliTRDtrackingSector(fGeom,geomS);
for (Int_t icham = 0; icham < AliTRDgeometry::kNcham; icham++) {
fHoles[icham][trS] = fGeom->IsHole(0,icham,geomS);
fNoTilt = kTRUE;
}
- fTimeBinsPerPlane = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
+ if (!AliTRDcalibDB::Instance()) {
+ AliFatal("Could not get calibration object");
+ }
+ fTimeBinsPerPlane = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
fDebugStreamer = new TTreeSRedirector("TRDdebug.root");
cluster->SetY(cluster->GetY() - driftX*exB);
Double_t xplane = (Double_t) AliTRDgeometry::GetTime0(plane);
- cluster->SetX(xplane- cluster->GetX());
+ cluster->SetX(xplane - cluster->GetX());
- TGeoHMatrix *matrix = fGeom->GetCorrectionMatrix(cluster->GetDetector());
+ TGeoHMatrix *matrix = fGeom->GetCorrectionMatrix(cluster->GetDetector());
if (!matrix) {
// No matrix found - if somebody used geometry with holes
AliError("Invalid Geometry - Default Geometry used\n");
}
if (plane == 5) {
- cluster->SetX(localPosTracker[0]+kX0shift5);
+ cluster->SetX(localPosTracker[0]+kX0shift5);
}
else {
cluster->SetX(localPosTracker[0]+kX0shift);
/**/
// Debug part of tracking
TTreeSRedirector &cstream = *fDebugStreamer;
- Int_t eventNr = event->GetEventNumber();
+ Int_t eventNrInFile = event->GetEventNumberInFile(); // This is most likely NOT the event number you'd like to use. It has nothing to do with the 'real' event number.
if (AliTRDReconstructor::StreamLevel() > 0) {
if (track->GetBackupTrack()) {
cstream << "Tracks"
- << "EventNr=" << eventNr
+ << "EventNrInFile=" << eventNrInFile
<< "ESD.=" << seed
<< "trd.=" << track
<< "trdback.=" << track->GetBackupTrack()
}
else {
cstream << "Tracks"
- << "EventNr=" << eventNr
+ << "EventNrInFile=" << eventNrInFile
<< "ESD.=" << seed
<< "trd.=" << track
<< "trdback.=" << track
AliTRDtracklet tracklet;
// Calibration fill 2D
- AliTRDCalibra *calibra = AliTRDCalibra::Instance();
+ AliTRDCalibraFillHisto *calibra = AliTRDCalibraFillHisto::Instance();
if (!calibra) {
AliInfo("Could not get Calibra instance\n");
}
Int_t localTimeBin = c->GetLocalTimeBin();
Int_t sector = fGeom->GetSector(detector);
Int_t plane = fGeom->GetPlane(detector);
- Int_t trackingSector = CookSectorIndex(sector);
+ Int_t trackingSector = sector;
//if (c->GetLabel(0) > 0) {
if (c->GetQ() > 10) {
}
}
- Int_t eventNr = esd->GetEventNumber();
+ Int_t eventNrInFile = esd->GetEventNumberInFile(); // This is most likely NOT the event number you'd like to use. It has nothing to do with the 'real' event number.
TTreeSRedirector &cstream = *fDebugStreamer;
//
TTreeSRedirector &cstream = *fDebugStreamer;
if (AliTRDReconstructor::StreamLevel() > 0) {
cstream << "Tracks"
- << "EventNr=" << eventNr
+ << "EventNrInFile=" << eventNrInFile
<< "ESD.=" << &esdtrack
<< "trd.=" << track
<< "trdback.=" << track
<< "Findable=" << findable
<< "NUsed=" << nused
<< "sLayer=" << sLayer
- << "EventNr=" << eventNr
+ << "EventNrInFile=" << eventNrInFile
<< "\n";
}
void AliTRDtracker::CookdEdxTimBin(AliTRDtrack &TRDtrack)
{
//
- // This is setting fdEdxPlane and fTimBinPlane
- // Sums up the charge in each plane for track TRDtrack and also get the
- // Time bin for Max. Cluster
- // Prashant Shukla (shukla@physi.uni-heidelberg.de)
+ // Build the information needed for TRD PID calculations. This are:
+ // - dE/dx - total
+ // - dE/dx - slices (0-14, 15-22, NONE). The Edep per slice is
+ // calculated as the sum of clusters charge weighted with average
+ // value from the <PH> spectrum
+ // - Time bin for Max. Cluster
//
+ // Authors:
+ // Prashant Shukla (shukla@physi.uni-heidelberg.de)
+ // Alex Bercuci (a.bercuci@gsi.de)
Double_t clscharge[AliESDtrack::kNPlane][AliESDtrack::kNSlice];
Double_t maxclscharge[AliESDtrack::kNPlane];
Int_t nCluster[AliESDtrack::kNPlane][AliESDtrack::kNSlice];
Int_t timebin[AliESDtrack::kNPlane];
- // Initialization of cluster charge per plane.
+ // Initialization of variables
for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
- clscharge[iPlane][iSlice] = 0.0;
+ clscharge[iPlane][iSlice] = 0.;
nCluster[iPlane][iSlice] = 0;
}
- }
-
- // Initialization of cluster charge per plane.
- for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
timebin[iPlane] = -1;
maxclscharge[iPlane] = 0.0;
}
+ // Average PH spectrum used for weighting the edep. It has to
+ // come eather from caligration DB or as parameter of the class. To
+ // be discuss with software responsibles
+ const Float_t fAveragePH[] = { 5.010e-03, 2.017e-02, 6.221e-02, 6.706e-02
+ , 5.551e-02, 4.812e-02, 4.395e-02, 4.219e-02
+ , 4.172e-02, 4.156e-02, 4.162e-02, 4.204e-02
+ , 4.278e-02, 4.367e-02, 4.460e-02, 4.554e-02
+ , 4.674e-02, 4.810e-02, 5.005e-02, 5.258e-02
+ , 5.587e-02, 5.892e-02, 5.587e-02, 5.258e-02 };
+
// Loop through all clusters associated to track TRDtrack
- Int_t nClus = TRDtrack.GetNumberOfClusters(); // from Kalmantrack
- for (Int_t iClus = 0; iClus < nClus; iClus++) {
+ AliTRDcluster *pTRDcluster = 0x0;
+ for (Int_t iClus = 0; iClus < TRDtrack.GetNumberOfClusters(); iClus++) {
Double_t charge = TRDtrack.GetClusterdQdl(iClus);
Int_t index = TRDtrack.GetClusterIndex(iClus);
- AliTRDcluster *pTRDcluster = (AliTRDcluster *) GetCluster(index);
- if (!pTRDcluster) {
- continue;
- }
- Int_t tb = pTRDcluster->GetLocalTimeBin();
- if (!tb) {
- continue;
- }
+ if (!(pTRDcluster = (AliTRDcluster*)GetCluster(index))) continue;
+
+ // check negative time bins ?!?!?
+ Int_t tb = pTRDcluster->GetLocalTimeBin();
+
+ // temporary until fix in GetT0
+ if(tb<0){
+ Warning("CookdEdxTimBin()", Form("Negative time bin value in track %d cluster %d", TRDtrack.GetLabel(), iClus));
+ continue;
+ }
+
Int_t detector = pTRDcluster->GetDetector();
Int_t iPlane = fGeom->GetPlane(detector);
- Int_t iSlice = tb * AliESDtrack::kNSlice / AliTRDtrack::kNtimeBins;
- clscharge[iPlane][iSlice] = clscharge[iPlane][iSlice] + charge;
+
+ // 2 slices method
+ Int_t iSlice = (tb < AliTRDtrack::kMidTimeBin) ? 0 : 1;
+ // weighted edep with <PH>
+ clscharge[iPlane][iSlice] += charge * fAveragePH[tb];
if (charge > maxclscharge[iPlane]) {
maxclscharge[iPlane] = charge;
timebin[iPlane] = tb;
nCluster[iPlane][iSlice]++;
} // End of loop over cluster
- // Setting the fdEdxPlane and fTimBinPlane variabales
- Double_t totalCharge = 0.0;
-
+ // Setting the fdEdxPlane and fTimBinPlane variables
+ Double_t totalCharge = 0.;
for (Int_t iPlane = 0; iPlane < AliESDtrack::kNPlane; iPlane++) {
- for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
- if (nCluster[iPlane][iSlice]) {
- clscharge[iPlane][iSlice] /= nCluster[iPlane][iSlice];
- }
+ for (Int_t iSlice = 0; iSlice < AliESDtrack::kNSlice; iSlice++) {
+ //if (nCluster[iPlane][iSlice]) {
+ // clscharge[iPlane][iSlice] /= nCluster[iPlane][iSlice];
+ //}
TRDtrack.SetPIDsignals(clscharge[iPlane][iSlice],iPlane,iSlice);
- totalCharge = totalCharge+clscharge[iPlane][iSlice];
+ totalCharge += clscharge[iPlane][iSlice];
}
- TRDtrack.SetPIDTimBin(timebin[iPlane],iPlane);
+ TRDtrack.SetPIDTimBin(timebin[iPlane],iPlane);
}
-
- // Still needed ????
- // Int_t i;
- // Int_t nc=TRDtrack.GetNumberOfClusters();
- // Float_t dedx=0;
- // for (i=0; i<nc; i++) dedx += TRDtrack.GetClusterdQdl(i);
- // dedx /= nc;
- // for (Int_t iPlane = 0; iPlane < kNPlane; iPlane++) {
- // TRDtrack.SetPIDsignals(dedx, iPlane);
- // TRDtrack.SetPIDTimBin(timbin[iPlane], iPlane);
- // }
-
}
//_____________________________________________________________________________