#include "AliTOFSDigitizer.h"
#include "AliTOFhit.h"
#include "AliTOFhitT0.h"
-#include "AliTOFv1.h"
-#include "AliTOFv2.h"
-#include "AliTOFv3.h"
-#include "AliTOFv4.h"
#include "AliMC.h"
ClassImp(AliTOFSDigitizer)
//____________________________________________________________________________
- AliTOFSDigitizer::AliTOFSDigitizer():TTask("AliTOFSDigitizer","")
+ AliTOFSDigitizer::AliTOFSDigitizer():TTask("TOFSDigitizer","")
{
// ctor
}
//____________________________________________________________________________
-AliTOFSDigitizer::AliTOFSDigitizer(const char* HeaderFile, Int_t evNumber1, Int_t nEvents):TTask("AliTOFSDigitizer","")
+AliTOFSDigitizer::AliTOFSDigitizer(const char* HeaderFile, Int_t evNumber1, Int_t nEvents):TTask("TOFSDigitizer","")
{
ftail = 0;
fSelectedSector=-1; // by default we sdigitize all sectors
}
// add Task to //root/Tasks folder
- fRunLoader = AliRunLoader::Open(HeaderFile);//open session and mount on default event folder
+ TString evfoldname = AliConfig::GetDefaultEventFolderName();
+ fRunLoader = AliRunLoader::GetRunLoader(evfoldname);
+ if (!fRunLoader)
+ fRunLoader = AliRunLoader::Open(HeaderFile);//open session and mount on default event folder
if (fRunLoader == 0x0)
{
Fatal("AliTOFSDigitizer","Event is not loaded. Exiting");
return;
}
- fRunLoader->LoadHeader();
+ if (fRunLoader->TreeE() == 0x0) fRunLoader->LoadHeader();
if (evNumber1>=0) fEvent1 = evNumber1;
else fEvent1=0;
AliTOFSDigitizer::~AliTOFSDigitizer()
{
// dtor
+ fTOFLoader->CleanSDigitizer();
}
//____________________________________________________________________________
{
// set parameters for detector simulation
- fTimeResolution =0.120;
- fpadefficiency =0.99 ;
+ fTimeResolution = 0.080; //0.120; OLD
+ fpadefficiency = 0.99 ;
fEdgeEffect = 2 ;
fEdgeTails = 0 ;
fHparameter = 0.4 ;
fEffBoundary = 0.65;
fEff2Boundary = 0.90;
fEff3Boundary = 0.08;
- fResCenter = 50. ;
+ fAddTRes = 68. ; // \sqrt{2x20^2 + 15^2 + 2x10^2 + 30^2 + 50^2} (Pb-Pb)
+ //fAddTRes = 48. ; // \sqrt{2x20^2 + 15^2 + 2x10^2 + 30^2 + 15^2} (p-p)
+ // 30^2+20^2+40^2+50^2+50^2+50^2 = 10400 ps^2 (very old value)
+ fResCenter = 35. ; //50. ; // OLD
fResBoundary = 70. ;
- fResSlope = 40. ;
+ fResSlope = 37. ; //40. ; // OLD
fTimeWalkCenter = 0. ;
fTimeWalkBoundary=0. ;
fTimeWalkSlope = 0. ;
Bool_t thereIsNotASelection=(fSelectedSector==-1) && (fSelectedPlate==-1);
- fRunLoader->LoadgAlice();
+ if (fRunLoader->GetAliRun() == 0x0) fRunLoader->LoadgAlice();
gAlice = fRunLoader->GetAliRun();
fRunLoader->LoadKinematics();
- AliTOF *TOF = (AliTOF *) gAlice->GetDetector("TOF");
+ AliTOF *tof = (AliTOF *) gAlice->GetDetector("TOF");
- if (!TOF) {
+ if (!tof) {
Error("AliTOFSDigitizer","TOF not found");
return;
}
fTOFLoader->LoadSDigits("recreate");
for (Int_t iEvent=fEvent1; iEvent<fEvent2; iEvent++) {
- cout << "------------------- "<< GetName() << " ------------- \n";
- cout << "Sdigitizing event " << iEvent << endl;
+// cout << "------------------- "<< GetName() << " ------------- \n";
+// cout << "Sdigitizing event " << iEvent << endl;
fRunLoader->GetEvent(iEvent);
- TTree *TH = fTOFLoader->TreeH ();
- if (!TH) return;
+ TTree *hitTree = fTOFLoader->TreeH ();
+ if (!hitTree) return;
if (fTOFLoader->TreeS () == 0) fTOFLoader->MakeTree ("S");
//Make branch for digits
- TOF->MakeBranch("S");
+ tof->MakeBranch("S");
// recreate TClonesArray fSDigits - for backward compatibility
- if (TOF->SDigits() == 0) {
- TOF->CreateSDigitsArray();
+ if (tof->SDigits() == 0) {
+ tof->CreateSDigitsArray();
} else {
- TOF->RecreateSDigitsArray();
+ tof->RecreateSDigitsArray();
}
- TOF->SetTreeAddress();
+ tof->SetTreeAddress();
- Int_t version=TOF->IsVersion();
+ Int_t version=tof->IsVersion();
Int_t nselectedHitsinEv=0;
Int_t ntotalsdigitsinEv=0;
TParticle *particle;
//AliTOFhit *tofHit;
- TClonesArray *TOFhits = TOF->Hits();
+ TClonesArray *tofHitArray = tof->Hits();
// create hit map
- AliTOFHitMap *hitMap = new AliTOFHitMap(TOF->SDigits());
+ AliTOFHitMap *hitMap = new AliTOFHitMap(tof->SDigits());
- TBranch * tofHitsBranch = TH->GetBranch("TOF");
+ TBranch * tofHitsBranch = hitTree->GetBranch("TOF");
- Int_t ntracks = static_cast<Int_t>(TH->GetEntries());
+ Int_t ntracks = static_cast<Int_t>(hitTree->GetEntries());
for (Int_t track = 0; track < ntracks; track++)
{
gAlice->ResetHits();
tofHitsBranch->GetEvent(track);
particle = gAlice->GetMCApp()->Particle(track);
- Int_t nhits = TOFhits->GetEntriesFast();
+ Int_t nhits = tofHitArray->GetEntriesFast();
// cleaning all hits of the same track in the same pad volume
// it is a rare event, however it happens
Int_t vol[5]; // location for a digit
Float_t digit[2]; // TOF digit variables
Int_t tracknum;
- Float_t Xpad;
- Float_t Zpad;
+ Float_t dxPad;
+ Float_t dzPad;
Float_t geantTime;
// fp: really sorry for this, it is a temporary trick to have
// track length too
if(version!=6){
- AliTOFhit *tofHit = (AliTOFhit *) TOFhits->UncheckedAt(hit);
+ AliTOFhit *tofHit = (AliTOFhit *) tofHitArray->UncheckedAt(hit);
tracknum = tofHit->GetTrack();
vol[0] = tofHit->GetSector();
vol[1] = tofHit->GetPlate();
vol[2] = tofHit->GetStrip();
vol[3] = tofHit->GetPadx();
vol[4] = tofHit->GetPadz();
- Xpad = tofHit->GetDx();
- Zpad = tofHit->GetDz();
+ dxPad = tofHit->GetDx();
+ dzPad = tofHit->GetDz();
geantTime = tofHit->GetTof(); // unit [s]
} else {
- AliTOFhitT0 *tofHit = (AliTOFhitT0 *) TOFhits->UncheckedAt(hit);
+ AliTOFhitT0 *tofHit = (AliTOFhitT0 *) tofHitArray->UncheckedAt(hit);
tracknum = tofHit->GetTrack();
vol[0] = tofHit->GetSector();
vol[1] = tofHit->GetPlate();
vol[2] = tofHit->GetStrip();
vol[3] = tofHit->GetPadx();
vol[4] = tofHit->GetPadz();
- Xpad = tofHit->GetDx();
- Zpad = tofHit->GetDz();
+ dxPad = tofHit->GetDx();
+ dzPad = tofHit->GetDz();
geantTime = tofHit->GetTof(); // unit [s]
}
nselectedHitsinEv++;
if (particle->GetFirstMother() < 0) nHitsFromPrim++; // counts hits due to primary particles
- Float_t xStrip=AliTOFGeometry::XPad()*(vol[3]+0.5-0.5*AliTOFGeometry::NpadX())+Xpad;
- Float_t zStrip=AliTOFGeometry::ZPad()*(vol[4]+0.5-0.5*AliTOFGeometry::NpadZ())+Zpad;
+ Float_t xStrip=AliTOFGeometry::XPad()*(vol[3]+0.5-0.5*AliTOFGeometry::NpadX())+dxPad;
+ Float_t zStrip=AliTOFGeometry::ZPad()*(vol[4]+0.5-0.5*AliTOFGeometry::NpadZ())+dzPad;
Int_t nActivatedPads = 0, nFiredPads = 0;
Bool_t isFired[4] = {kFALSE, kFALSE, kFALSE, kFALSE};
ntotalupdates++;
} else {
- TOF->AddSDigit(tracknum, vol, digit);
+ tof->AddSDigit(tracknum, vol, digit);
if(indexOfPad){
nnoisesdigits++;
fTOFLoader->TreeS()->Fill();
fTOFLoader->WriteSDigits("OVERWRITE");
- if (TOF->SDigits()) TOF->ResetSDigits();
+ if (tof->SDigits()) tof->ResetSDigits();
if (strstr(verboseOption,"all")) {
cout << "---------------------------------------- \n";
eff[nActivatedPads-1] = fEffCenter;
if (gRandom->Rndm() < eff[nActivatedPads-1]) {
nFiredPads = 1;
- res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + fResCenter * fResCenter); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns;
+ res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + fResCenter * fResCenter); // ns
isFired[nActivatedPads-1] = kTRUE;
tofTime[nActivatedPads-1] = gRandom->Gaus(geantTime + fTimeWalkCenter, res[0]);
averageTime = tofTime[nActivatedPads-1];
}
(effZ<effX) ? eff[nActivatedPads-1] = effZ : eff[nActivatedPads-1] = effX;
- (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resZ * resZ); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns
+ (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resZ * resZ); // ns
(timeWalkZ<timeWalkX) ? timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ : timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns
nActivatedPads++;
nPlace[nActivatedPads-1] = nPlace[0] + (3 - 2 * iz) * AliTOFGeometry::NpadX();
eff[nActivatedPads-1] = effZ;
- res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resZ * resZ); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns
+ res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resZ * resZ); // ns
timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ; // ns
nTail[nActivatedPads-1] = 2;
if (fTimeDelayFlag) {
nActivatedPads++;
nPlace[nActivatedPads-1] = nPlace[0] - 1;
eff[nActivatedPads-1] = effX;
- res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resX * resX); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns
+ res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resX * resX); // ns
timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns
nTail[nActivatedPads-1] = 2;
if (fTimeDelayFlag) {
nActivatedPads++;
nPlace[nActivatedPads-1] = nPlace[0] + (3 - 2 * iz) * AliTOFGeometry::NpadX() - 1;
eff[nActivatedPads-1] = effX * effZ;
- (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resZ * resZ); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns
+ (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resZ * resZ); // ns
(timeWalkZ<timeWalkX) ? timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ : timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns
nTail[nActivatedPads-1] = 2;
nActivatedPads++;
nPlace[nActivatedPads-1] = nPlace[0] + 1;
eff[nActivatedPads-1] = effX;
- res[nActivatedPads-1] = 0.001 * (TMath::Sqrt(10400 + resX * resX)); // ns
+ res[nActivatedPads-1] = 0.001 * (TMath::Sqrt(fAddTRes*fAddTRes + resX * resX)); // ns
timeWalk[nActivatedPads-1] = 0.001 * timeWalkX; // ns
nTail[nActivatedPads-1] = 2;
if (fTimeDelayFlag) {
nActivatedPads++;
nPlace[nActivatedPads - 1] = nPlace[0] + (3 - 2 * iz) * AliTOFGeometry::NpadX() + 1;
eff[nActivatedPads - 1] = effX * effZ;
- (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(10400 + resZ * resZ); // 10400=30^2+20^2+40^2+50^2+50^2+50^2 ns
+ (resZ<resX) ? res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resX * resX) : res[nActivatedPads-1] = 0.001 * TMath::Sqrt(fAddTRes*fAddTRes + resZ * resZ); // ns
(timeWalkZ<timeWalkX) ? timeWalk[nActivatedPads-1] = 0.001 * timeWalkZ : timeWalk[nActivatedPads-1] = 0.001*timeWalkX; // ns
nTail[nActivatedPads-1] = 2;
if (fTimeDelayFlag) {