#include "AliTPCExB.h"
#include "AliRawReader.h"
#include "AliTPCRawStream.h"
+#include "TTreeStream.h"
ClassImp(AliTPC)
//_____________________________________________________________________________
fNoiseTable(0),
fCurrentNoise(0),
fActiveSectors(0),
- fGainFactor(1.)
-
+ fGainFactor(1.),
+ fDebugStreamer(0)
{
//
fNoiseTable(0),
fCurrentNoise(0),
fActiveSectors(0),
- fGainFactor(1.)
+ fGainFactor(1.),
+ fDebugStreamer(0)
{
//
if (!strcmp(title,"Default")) {
- fTPCParam = new AliTPCParamSR;
+ //fTPCParam = new AliTPCParamSR;
+ fTPCParam = AliTPCcalibDB::Instance()->GetParameters();
} else {
AliWarning("In Config.C you must set non-default parameters.");
fTPCParam=0;
}
+
}
//_____________________________________________________________________________
fIshunt = 0;
delete fHits;
delete fDigits;
- delete fTPCParam;
+ //delete fTPCParam;
delete fTrackHits; //MI 15.09.2000
// delete fTrackHitsOld; //MI 10.12.2001
fDigitsArray = 0x0;
delete [] fNoiseTable;
delete [] fActiveSectors;
-
+ if (fDebugStreamer) delete fDebugStreamer;
}
//_____________________________________________________________________________
AliRunLoader* rl = (AliRunLoader*)fLoader->GetEventFolder()->FindObject(AliRunLoader::GetRunLoaderName());
rl->CdGAFile();
AliTPCParamSR *param=(AliTPCParamSR*)gDirectory->Get("75x40_100x60");
- if(param){
- AliInfo("You are using 2 pad-length geom hits with 3 pad-lenght geom digits...");
- delete param;
- param = new AliTPCParamSR();
- }
- else {
- param=(AliTPCParamSR*)gDirectory->Get("75x40_100x60_150x60");
- }
+ // if(param){
+// AliInfo("You are using 2 pad-length geom hits with 3 pad-lenght geom digits...");
+// delete param;
+// param = new AliTPCParamSR();
+// }
+// else {
+// param=(AliTPCParamSR*)gDirectory->Get("75x40_100x60_150x60");
+// }
+ param = (AliTPCParamSR*)AliTPCcalibDB::Instance()->GetParameters();
+ if (!param->IsGeoRead()){
+ //
+ // read transformation matrices for gGeoManager
+ //
+ param->ReadGeoMatrices();
+ }
if(!param){
AliFatal("No TPC parameters found");
}
AliTPCPRF2D * prfinner = new AliTPCPRF2D;
AliTPCPRF2D * prfouter1 = new AliTPCPRF2D;
AliTPCPRF2D * prfouter2 = new AliTPCPRF2D;
- AliTPCRF1D * rf = new AliTPCRF1D(kTRUE);
- rf->SetGauss(param->GetZSigma(),param->GetZWidth(),1.);
- rf->SetOffset(3*param->GetZSigma());
- rf->Update();
+
+ //AliTPCRF1D * rf = new AliTPCRF1D(kTRUE);
+ //rf->SetGauss(param->GetZSigma(),param->GetZWidth(),1.);
+ //rf->SetOffset(3*param->GetZSigma());
+ //rf->Update();
+ //
+ // Use gamma 4
+ //
+ char strgamma4[1000];
+ sprintf(strgamma4,"AliTPCRF1D::Gamma4((x-0.135+%f)*%f,55,160)",3*param->GetZSigma(), 1000000000*param->GetTSample()/param->GetZWidth());
+
+ TF1 * fgamma4 = new TF1("fgamma4",strgamma4, -1,1);
+ AliTPCRF1D * rf = new AliTPCRF1D(kTRUE,1000);
+ rf->SetParam(fgamma4,param->GetZWidth(), 1,0.2);
+ rf->SetOffset(3*param->GetZSigma());
+ rf->Update();
+
TDirectory *savedir=gDirectory;
TFile *f=TFile::Open("$ALICE_ROOT/TPC/AliTPCprf2d.root");
if (!f->IsOpen())
//-----------------------------------------------------------
// summable digits - 16 bit "ADC", no noise, no saturation
//-----------------------------------------------------------
+ if (0) fDebugStreamer = new TTreeSRedirector("TPCSimdebug.root");
if (!fTPCParam->IsGeoRead()){
//
fLoader->UnloadHits();
fLoader->UnloadSDigits();
+ if (fDebugStreamer) {
+ delete fDebugStreamer;
+ fDebugStreamer=0;
+ }
}
//_____________________________________________________________________________
// Origin: Marian Ivanov, marian.ivanov@cern.ch
//-----------------------------------------------------------------
AliTPCcalibDB* const calib=AliTPCcalibDB::Instance();
+ if (gAlice){ // Set correctly the magnetic field in the ExB calculation
+ AliMagF * field = gAlice->Field();
+ if (field) {
+ calib->SetExBField(field->SolenoidField());
+ }
+ }
Float_t gasgain = fTPCParam->GetGasGain();
gasgain = gasgain/fGainFactor;
TransportElectron(xyz,index);
Int_t rowNumber;
- fTPCParam->GetPadRow(xyz,index);
+ Int_t padrow = fTPCParam->GetPadRow(xyz,index);
//
// Add Time0 correction due unisochronity
// xyz[0] - pad row coordinate
// xyz[2] - is in now time bin coordinate system
Float_t correction =0;
if (calib->GetPadTime0()){
- if (!calib->GetPadTime0()->GetCalROC(isec)) continue;
- correction = calib->GetPadTime0()->GetCalROC(isec)->GetValue(TMath::Nint(xyz[0]),TMath::Nint(xyz[1]));
+ if (!calib->GetPadTime0()->GetCalROC(isec)) continue;
+ Int_t npads = fTPCParam->GetNPads(isec,padrow);
+ // Int_t pad = TMath::Nint(xyz[1]+fTPCParam->GetNPads(isec,TMath::Nint(xyz[0]))*0.5);
+ // pad numbering from -npads/2 .. npads/2-1
+ Int_t pad = TMath::Nint(xyz[1]+npads/2);
+ if (pad<0) pad=0;
+ if (pad>=npads) pad=npads-1;
+ correction = calib->GetPadTime0()->GetCalROC(isec)->GetValue(padrow,pad);
+ // printf("%d\t%d\t%d\t%f\n",isec,padrow,pad,correction);
+ if (fDebugStreamer){
+ (*fDebugStreamer)<<"Time0"<<
+ "isec="<<isec<<
+ "padrow="<<padrow<<
+ "pad="<<pad<<
+ "x0="<<xyz[0]<<
+ "x1="<<xyz[1]<<
+ "x2="<<xyz[2]<<
+ "hit.="<<tpcHit<<
+ "cor="<<correction<<
+ "\n";
+ }
}
xyz[2]+=correction;
+ xyz[2]+=fTPCParam->GetNTBinsL1(); // adding Level 1 time bin offset
//
// Electron track time (for pileup simulation)
- xyz[4] = tpcHit->Time()/fTPCParam->GetTSample();
+ xyz[2]+=tpcHit->Time()/fTPCParam->GetTSample(); // adding time of flight
+ xyz[4] =0;
+
+ //
// row 0 - cross talk from the innermost row
// row fNRow+1 cross talk from the outermost row
rowNumber = index[2]+1;
//transform position to local digit coordinates
//relative to nearest pad row
if ((rowNumber<0)||rowNumber>fTPCParam->GetNRow(isec)+1) continue;
- Float_t x1,y1;
+ /* Float_t x1,y1;
if (isec <fTPCParam->GetNInnerSector()) {
x1 = xyz[1]*fTPCParam->GetInnerPadPitchWidth();
y1 = fTPCParam->GetYInner(rowNumber);
// gain inefficiency at the wires edges - linear
x1=TMath::Abs(x1);
y1-=1.;
- if(x1>y1) xyz[3]*=TMath::Max(1.e-6,(y1-x1+1.));
+ if(x1>y1) xyz[3]*=TMath::Max(1.e-6,(y1-x1+1.)); */
nofElectrons[rowNumber]++;
//----------------------------------
AliDebug(1,"*********************************************");
}
-//_____________________________________________________________________________
-void AliTPC::MakeBranch(Option_t* option)
-{
- //
- // Create Tree branches for the TPC.
- //
- AliDebug(1,"");
- Int_t buffersize = 4000;
- char branchname[10];
- sprintf(branchname,"%s",GetName());
-
- const char *h = strstr(option,"H");
-
- if ( h && (fHitType<=1) && (fHits == 0x0)) fHits = new TClonesArray("AliTPChit", 176);//skowron 20.06.03
-
- AliDetector::MakeBranch(option);
-
- const char *d = strstr(option,"D");
-
- if (fDigits && fLoader->TreeD() && d) {
- MakeBranchInTree(gAlice->TreeD(), branchname, &fDigits, buffersize, 0);
- }
-
- if (fHitType>1) MakeBranch2(option,0); // MI change 14.09.2000
-}
-
//_____________________________________________________________________________
void AliTPC::ResetDigits()
{
// xyz and index must be already transformed to system 1
//
- fTPCParam->Transform1to2(xyz,index);
+ fTPCParam->Transform1to2(xyz,index); // mis-alignment applied in this step
//add diffusion
Float_t driftl=xyz[2];
AliDebugClass(1,Form("TPC parameters %s found.",paramName));
} else {
AliWarningClass("TPC parameters not found. Create new (they may be incorrect)");
- paramTPC = new AliTPCParamSR;
+ //paramTPC = new AliTPCParamSR;
+ paramTPC = AliTPCcalibDB::Instance()->GetParameters();
+ if (!paramTPC->IsGeoRead()){
+ //
+ // read transformation matrices for gGeoManager
+ //
+ paramTPC->ReadGeoMatrices();
+ }
+
}
return paramTPC;