#include "AliRunDigitizer.h"
#include "AliRun.h"
-#include "AliPDG.h"
#include "AliLoader.h"
#include "AliRunLoader.h"
{
// ctor which should be used
// fDebug =0;
- // if (GetDebug()>2)
- // cerr<<"AliFMDDigitizer::AliFMDDigitizer"
- // <<"(AliRunDigitizer* manager) was processed"<<endl;
+ if (GetDebug()>1)
+ Info("AliFMDDigitizer"," processed");
+
}
//------------------------------------------------------------------------
AliFMDDigitizer::~AliFMDDigitizer()
{
// Destructor
+
}
//------------------------------------------------------------------------
*/
AliRunLoader *inRL, *outRL;//in and out Run Loaders
- AliLoader *ingime, *outgime;// in and out ITSLoaders
+ AliLoader *pInFMD, *pOutFMD;// in and out ITSLoaders
outRL = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
- outgime = outRL->GetLoader("FMDLoader");
+ pOutFMD = outRL->GetLoader("FMDLoader");
+
#ifdef DEBUG
- cout<<"AliFMDDigitizer::>SDigits2Digits start...\n";
+ Info("Hits2Digits Exec"," start...";
#endif
for(Int_t j=0; j<50; j++)
for(Int_t ij=0; ij<520; ij++)
de[i][j][ij]=0;
- Int_t numberOfRings[5]=
- {512,256,512,256,512};
- Int_t numberOfSector[5]=
- {20,40,20,40,20};
+ Int_t numberOfRings[5]= {512,256,512,256,512};
+ Int_t numberOfSector[5] = {20,40,20,40,20};
AliFMDhit *fmdHit=0;
TTree *tH=0;
TBranch *brD=0;
inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0));
+
if (inRL == 0x0)
{
Error("Exec","Can not find Run Loader for input stream 0");
return;
}
- // Info("Exec","inRL->GetAliRun() %#x",inRL->GetAliRun());
if (!inRL->GetAliRun()) inRL->LoadgAlice();
AliFMD * fFMD = (AliFMD *) inRL->GetAliRun()->GetDetector("FMD");
- // Info("Exec","inRL->GetAliRun(): %#x, FMD: %#x, InRL %#x.",inRL->GetAliRun(),fFMD,inRL);
+
if (fFMD == 0x0)
{
Error("Exec","Can not get FMD from gAlice");
Int_t nFiles=GetManager()->GetNinputs();
for (Int_t inputFile=0; inputFile<nFiles;inputFile++)
{
- // cout<<" event "<<fManager->GetOutputEventNr()<<endl;
+
+#ifdef DEBUG
+ Info(" Digitizing event number ",fManager->GetOutputEventNr()) ;
+#endif
+
if (fFMD)
{
inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile));
- ingime = inRL->GetLoader("FMDLoader");
- ingime->LoadHits("READ");//probably it is necessary to load them before
+ pInFMD = inRL->GetLoader("FMDLoader");
+ pInFMD->LoadHits("READ");
- tH = ingime->TreeH();
+ tH = pInFMD->TreeH();
if (tH == 0x0)
{
- ingime->LoadHits("read");
- tH = ingime->TreeH();
+ pInFMD->LoadHits("read");
+ tH = pInFMD->TreeH();
}
brHits = tH->GetBranch("FMD");
if (brHits) {
- // brHits->SetAddress(&fHits);
fFMD->SetHitsAddressBranch(brHits);
}else{
Fatal("Exec","EXEC Branch FMD hit not found");
TClonesArray *fFMDhits = fFMD->Hits ();
Int_t ntracks = (Int_t) tH->GetEntries();
- // cout<<"Number of tracks TreeH"<<ntracks<<endl;
+
for (Int_t track = 0; track < ntracks; track++)
{
brHits->GetEntry(track);
Int_t nhits = fFMDhits->GetEntries ();
- // if(nhits>0) cout<<"nhits "<<nhits<<endl;
+
for (hit = 0; hit < nhits; hit++)
{
fmdHit = (AliFMDhit *) fFMDhits->UncheckedAt(hit);
ring = fmdHit->NumberOfRing ();
e = fmdHit->Edep ();
de[volume][sector][ring] += e;
- // if (fManager->GetOutputEventNr()>1)
- // cout<<" "<<volume<<" "<<sector<<" "<<ring<<endl;
+
} //hit loop
} //track loop
}
} //iSector
} //iRing
- TTree* treeD = outgime->TreeD();
- // cout<<" treeD "<<treeD;
+ TTree* treeD = pOutFMD->TreeD();
+
if (treeD == 0x0) {
- outgime->MakeTree("D");
- treeD = outgime->TreeD();
- // cout<<" After MakeTree "<<treeD<<endl;
+ pOutFMD->MakeTree("D");
+ treeD = pOutFMD->TreeD();
+
}
- // cout<<" Before reset "<<treeD<<endl;
- // treeD->Clear();
+
treeD->Reset();
fFMD->MakeBranchInTreeD(treeD);
brD = treeD->GetBranch("FMD");
- // cout<<" Make branch "<<brD<<endl;
+
treeD->Fill(); //this operator does not work for events >1
- //PH treeD->Print();
- outgime->WriteDigits("OVERWRITE");
-
- gAlice->ResetDigits();
+
+ pOutFMD->WriteDigits("OVERWRITE");
+ pOutFMD->UnloadHits();
+ inRL->GetAliRun() ->ResetDigits();
}
}
fNevents = 0 ; // Number of events to rreconnstraction, 0 means all events in current file
fRunLoader = rl;
- AliLoader* gime = fRunLoader->GetLoader("FMDLoader");
- if (gime == 0x0)
+ AliLoader* plFMD = fRunLoader->GetLoader("FMDLoader");
+ if (plFMD == 0x0)
{
Fatal("AliFMDReconstruction","Can not find FMD (loader) in specified event");
return;//never reached
}
//add Task to //root/Tasks folder
- gime->PostReconstructioner(this);
+// gime->PostReconstructioner(this);
}
//____________________________________________________________________________
AliFMDReconstruction::~AliFMDReconstruction()
{
- AliLoader* gime = fRunLoader->GetLoader("FMDLoader");
- gime->CleanReconstructioner();
+ AliLoader* plFMD = fRunLoader->GetLoader("FMDLoader");
+ plFMD->CleanReconstructioner();
}
//____________________________________________________________________________
*/
- cout<<"\nStart AliFMDReconstruction::Exec(...)"<<endl;
+#ifdef DEBUG
+ Info("Exec ","Start");
+#endif
+
Int_t const knumVolumes=5;
Int_t padADC;
Float_t eta, etain,etaout,rad,theta;
Error("Exec","Run Loader loader is NULL - Session not opened");
return;
}
-
-
- AliLoader* gime = fRunLoader->GetLoader("FMDLoader");
- if (gime == 0x0)
+
+ AliLoader* plFMD = fRunLoader->GetLoader("FMDLoader");
+ if (plFMD == 0x0)
{
Fatal("AliFMDReconstruction","Can not find FMD (loader) in specified event");
return;//never reached
if (!fRunLoader->GetAliRun()) fRunLoader->LoadgAlice();
if (!fRunLoader->TreeE()) fRunLoader->LoadHeader();
- Int_t retval;
+
TDirectory* cwd = gDirectory;
gDirectory = 0x0;
- Text_t buf1[20];
+ Text_t buf1[20];
TH2F* hTotal[10];
for (Int_t j=1; j<=5; j++){
sprintf(buf1,"hTotal%d",j);
}
gDirectory = cwd;
-
+ Int_t retval=0;
if(fNevents == 0) fNevents=Int_t (fRunLoader->TreeE()->GetEntries());
+#ifdef DEBUG
cout<<" fNevents "<<fNevents<<endl;
+#endif
for(Int_t ievent=0;ievent<fNevents;ievent++)
{
+#ifdef DEBUG
+ cout<<" *** event "<<ievent<<endl;
+#endif
fRunLoader->GetEvent(ievent) ;
+ //event z-vertex for correction eta-rad dependence
+ AliHeader *header = fRunLoader->GetHeader();
+ AliGenEventHeader* genHeader = header->GenEventHeader();
+ TArrayF *o = new TArrayF(3);
+ genHeader->PrimaryVertex(*o);
+ Float_t zVertex=o->At(2);
- cout<<" ievent "<<ievent<<endl;
- for (Int_t i=0; i<5; i++)
+ for (Int_t i=0; i<5; i++)
hTotal[i+1]->Reset();
- retval = gime->LoadDigits("READ");
+ retval = plFMD->LoadDigits("READ");
if (retval)
{
Error("Exec","Error occured while loading digits. Exiting.");
return;
}
- AliFMD * fFMD = (AliFMD *) gAlice->GetDetector("FMD");
+ AliFMD * fFMD = (AliFMD *)gAlice->GetDetector("FMD");
TClonesArray *fReconParticles=fFMD->ReconParticles();
TClonesArray *fDigits=fFMD->Digits();
- TTree* treeD = gime->TreeD();
+ TTree* treeD = plFMD->TreeD();
if (treeD == 0x0)
{
Error("Exec","Can not get Tree with Digits. Nothing to reconstruct - Exiting");
TBranch *brDigits=0;
brDigits=treeD->GetBranch("FMD");
- cout<<" brDigits "<<brDigits<<endl;
+
if (brDigits) {
brDigits->SetAddress(&fDigits);
- // fFMD->SetHitsAddressBranch(brHits);
}else{
cerr<<"EXEC Branch FMD digits not found"<<endl;
return;
}
- if(gime->TreeR()==0) gime->MakeTree("R");
+ if(plFMD->TreeR()==0) plFMD->MakeTree("R");
//Make branches
fFMD->MakeBranch("R");
Int_t zeroADC=6;
-
+ // read Digits
AliFMDdigit *fmdDigit;
if (fFMD)
{
- gime->TreeD()->GetEvent(0);
+ plFMD->TreeD()->GetEvent(0);
Int_t nDigits=fDigits->GetEntries();
- cout<<" nDigits "<<nDigits<<endl;
Int_t recParticles[6];
Int_t nRecPart=0 ;
- Int_t zeroPads=0;
- Int_t numberOfPads=0; //To avoid warning
- Int_t pedestal;
- Float_t channelWidth=(22400*50)/1024;
- for (Int_t digit=0;digit<nDigits;digit++)
- {
- fmdDigit=(AliFMDdigit*)fDigits->UncheckedAt(digit);
- ivol=fmdDigit->Volume();
- iSector=fmdDigit->NumberOfSector();
- iRing=fmdDigit->NumberOfRing();
- pedestal=Int_t(gRandom->Gaus(500,250));
- padADC= fmdDigit->ADCsignal()
- -Int_t(Float_t(pedestal)/channelWidth);
- if (padADC<0) padADC=0;
+ Int_t zeroPads=0;
+ Int_t numberOfPads=0;
+ Int_t pedestal;
+ Float_t channelWidth=(22400*50)/1024;
+ for (Int_t digit=0;digit<nDigits;digit++)
+ {
+ fmdDigit=(AliFMDdigit*)fDigits->UncheckedAt(digit);
+ ivol=fmdDigit->Volume();
+ iSector=fmdDigit->NumberOfSector();
+ iRing=fmdDigit->NumberOfRing();
+ pedestal=Int_t(gRandom->Gaus(500,250));
+ padADC= fmdDigit->ADCsignal()
+ -Int_t(Float_t(pedestal)/channelWidth);
+ if (padADC<0) padADC=0;
hTotal[ivol]->Fill(iSector,iRing,padADC);
- } //digit loop
- Int_t rmin=0; Int_t rmax=0; //To avoid warning
- Int_t smin=0; Int_t smax=0; //To avoid warning
- AliHeader *header = fRunLoader->GetHeader();
- AliGenEventHeader* genHeader = header->GenEventHeader();
- TArrayF *o = new TArrayF(3);
- genHeader->PrimaryVertex(*o);
- Float_t zVertex=o->At(2);
- for (ivol=0; ivol<knumVolumes; ivol++)
- {
- Float_t ring2number=Float_t (numberOfRings[ivol])/
- (rout[ivol]-rin[ivol]);
- Float_t realZ=zVertex+z[ivol];
- theta=TMath::ATan(rout[ivol]/TMath::Abs(realZ));
- etain = - TMath::Log( TMath::Tan(theta/2.));
- theta=TMath::ATan(rin[ivol]/TMath::Abs(realZ));
- etaout=- TMath::Log( TMath::Tan(theta/2.));
- numberOfEtaIntervals[ivol]=Int_t((etaout-etain)*10)-1;
- eta=etain;
- for (Int_t e1=0;e1<=numberOfEtaIntervals[ivol];e1++)
- {
- theta = 2.*TMath::ATan (TMath::Exp (-eta));
- Float_t radmin = TMath::Abs(realZ) * (TMath::Tan (theta));
- rmax= Int_t ( (radmin-rin[ivol])*ring2number+0.5);
- cout<<ivol<<" "<<" eta "<<eta<<" radmin "<<radmin<<
-
- " Rmax "<<rmax<<" "<<endl;;
- eta=eta+0.1;
- theta = 2.*TMath::ATan (TMath::Exp (-eta));
- rad = TMath::Abs(realZ) * (TMath::Tan (theta));
- rmin=Int_t( (rad-rin[ivol])*ring2number+0.5);
- cout<<"eta "<<eta<<" rad "<<rad<<" Rmin "<<rmin<<endl;
- // if(ivol==2&&e1==13) rmin=0;
- zeroPads=0;
- smin=0;
- smax=numberOfSectors[ivol];
- numberOfPads=(rmax-rmin)*(smax-smin);
- for (Int_t iring=rmin; iring<rmax; iring++)
- {
- for
- (Int_t isector=0;
- isector<numberOfSectors[ivol];
- isector++)
- {
- if(hTotal[ivol+1]->GetBinContent(isector+1,iring+1)
- <zeroADC) zeroPads++;}
-
- } //ring
- Float_t numberOfPads=Float_t(smax-smin)*Float_t(rmax-rmin);
-
- cout<<" zero "<<zeroPads++<<" pads "<<numberOfPads;
- Double_t lambda=-TMath::Log(Double_t(zeroPads)/numberOfPads);
- Int_t fRecon=Int_t (lambda*numberOfPads+0.5);
-
- Float_t zerosRatio=
- (Float_t)zeroPads/(Float_t)numberOfPads;
- cout<<" zerosRatio "<<zerosRatio<<" recon "<<fRecon<<endl;
- recParticles[0]=ivol+1;
- recParticles[1]=smin;
- recParticles[2]=smax;
- recParticles[3]=rmin;
- recParticles[4]=rmax;
- recParticles[5]= fRecon;
- new((*fReconParticles)[nRecPart++])
- AliFMDReconstParticles(recParticles);
+ } //digit loop
+
+ //reconstruct multiplicity in 0.1 eta according Poisson distribution
+ Int_t rmin=0; Int_t rmax=0;
+ Int_t smin=0; Int_t smax=0;
+ for (ivol=0; ivol<knumVolumes; ivol++)
+ {
+ Float_t ring2number=Float_t (numberOfRings[ivol])/
+ (rout[ivol]-rin[ivol]);
+ Float_t realZ=zVertex+z[ivol];
+ theta=TMath::ATan(rout[ivol]/TMath::Abs(realZ));
+ etain = - TMath::Log( TMath::Tan(theta/2.));
+ theta=TMath::ATan(rin[ivol]/TMath::Abs(realZ));
+ etaout=- TMath::Log( TMath::Tan(theta/2.));
+ numberOfEtaIntervals[ivol]=Int_t((etaout-etain)*10)-1;
+ eta=etain;
+ for (Int_t e1=0;e1<=numberOfEtaIntervals[ivol];e1++)
+ {
+ theta = 2.*TMath::ATan (TMath::Exp (-eta));
+ Float_t radmin = TMath::Abs(realZ) * (TMath::Tan (theta));
+ rmax= Int_t ( (radmin-rin[ivol])*ring2number+0.5);
+ eta=eta+0.1;
+ theta = 2.*TMath::ATan (TMath::Exp (-eta));
+ rad = TMath::Abs(realZ) * (TMath::Tan (theta));
+ rmin=Int_t( (rad-rin[ivol])*ring2number+0.5);
+
+ zeroPads=0;
+ smin=0;
+ smax=numberOfSectors[ivol];
+ numberOfPads=(rmax-rmin)*(smax-smin);
+ for (Int_t iring=rmin; iring<rmax; iring++)
+ {
+ for
+ (Int_t isector=0;
+ isector<numberOfSectors[ivol];
+ isector++)
+ {
+ if(hTotal[ivol+1]->GetBinContent(isector+1,iring+1)
+ <zeroADC) zeroPads++;}
+
+ } //ring
+ Float_t numberOfPads=Float_t(smax-smin)*Float_t(rmax-rmin);
+
+ Double_t lambda=-TMath::Log(Double_t(zeroPads)/numberOfPads);
+ Int_t fRecon=Int_t (lambda*numberOfPads+0.5);
+ recParticles[0]=ivol+1;
+ recParticles[1]=smin;
+ recParticles[2]=smax;
+ recParticles[3]=rmin;
+ recParticles[4]=rmax;
+ recParticles[5]= fRecon;
+ new((*fReconParticles)[nRecPart++]) AliFMDReconstParticles(recParticles);
+
} // eta
} // volume
}//if FMD
- gime->TreeR()->Reset();
- gime->TreeR()->Fill();
- gime->WriteRecPoints("OVERWRITE");
+ plFMD->TreeR()->Reset();
+ plFMD->TreeR()->Fill();
+ plFMD->WriteRecPoints("OVERWRITE");
+ plFMD->UnloadDigits();
} //event loop
- cout<<"\nAliFMDReconstruction::Exec finished"<<endl;
+#ifdef DEBUG
+ Info(" Exec"," finished");
+#endif
+ // delete hTotal[10];
+
}