X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=FMD%2FAliFMDReconstruction.cxx;h=e34b88758636082882cd0d6e0d06e717844d7cea;hp=49480abbf4dd816382798580f2546bc5760a5541;hb=7fe81cad193654658c64d842284123e1a2c4c6e9;hpb=cb1df35e6825057932d673b86d8e50c4d6359b0e diff --git a/FMD/AliFMDReconstruction.cxx b/FMD/AliFMDReconstruction.cxx index 49480abbf4d..e34b8875863 100644 --- a/FMD/AliFMDReconstruction.cxx +++ b/FMD/AliFMDReconstruction.cxx @@ -27,19 +27,28 @@ #include "TFile.h" #include "TROOT.h" #include "TFolder.h" -#include +#include "TH2F.h" // --- Standard library --- #include +#include // --- AliRoot header files --- +#include "AliRunLoader.h" +#include "AliLoader.h" + #include "AliFMDdigit.h" +#include "AliFMDhit.h" #include "AliFMDReconstParticles.h" #include "AliFMD.h" #include "AliFMDv1.h" #include "AliFMDReconstruction.h" #include "AliRun.h" +#include "AliConfig.h" +#include "AliHeader.h" +#include "AliGenEventHeader.h" + ClassImp(AliFMDReconstruction) @@ -48,20 +57,31 @@ ClassImp(AliFMDReconstruction) AliFMDReconstruction::AliFMDReconstruction():TTask("AliFMDReconstruction","") { fNevents = 0 ; // Number of events to rreconnstraction, 0 means all events in current file - // add Task to //root/Tasks folder - TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; - roottasks->Add(this) ; + fRunLoader = 0x0; + } //____________________________________________________________________________ -AliFMDReconstruction::AliFMDReconstruction(char* HeaderFile, char *ReconstParticlesFile):TTask("AliFMDReconstruction","") +AliFMDReconstruction::AliFMDReconstruction(AliRunLoader* rl):TTask("AliFMDReconstruction","") { + + if (rl == 0x0) + { + Fatal("AliFMDReconstruction","Argument AliRunLoader* is null!"); + return; + } + fNevents = 0 ; // Number of events to rreconnstraction, 0 means all events in current file - fReconstParticlesFile=ReconstParticlesFile ; - fHeadersFile=HeaderFile ; + + fRunLoader = rl; + AliLoader* gime = fRunLoader->GetLoader("FMDLoader"); + if (gime == 0x0) + { + Fatal("AliFMDReconstruction","Can not find FMD (loader) in specified event"); + return;//never reached + } //add Task to //root/Tasks folder - TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; - roottasks->Add(this) ; + gime->PostReconstructioner(this); } //____________________________________________________________________________ @@ -69,255 +89,214 @@ AliFMDReconstruction::AliFMDReconstruction(char* HeaderFile, char *ReconstPartic AliFMDReconstruction::~AliFMDReconstruction() { } -//---------------------------------------------------------------------------- -void AliFMDReconstruction::Exec(Option_t *option) +//____________________________________________________________________________ + +void AliFMDReconstruction::Exec() { - printf (" AliFMDReconstruction starting \n"); //Collects all digits in the same active volume into number of particles - - Int_t const NumVolums=5; - Int_t const NumSectors=40; - Int_t const NumRings=768; - Int_t PadADC[10][50][800]; + /* + Reconstruct number of particles + in given group of pads for given FMDvolume + determine by numberOfVolume , + numberOfMinSector,numberOfMaxSector, + numberOfMinRing, numberOgMaxRing + Reconstruction method choose dependence on number of empty pads + */ + + + cout<<"\nStart AliFMDReconstruction::Exec(...)"<GetLoader("FMDLoader"); + if (gime == 0x0) + { + Fatal("AliFMDReconstruction","Can not find FMD (loader) in specified event"); + return;//never reached + } + + fRunLoader->LoadgAlice(); + fRunLoader->LoadHeader(); + Int_t retval; + TDirectory* cwd = gDirectory; + gDirectory = 0x0; + Text_t buf1[20]; + TH2F* hTotal[10]; + for (Int_t j=1; j<=5; j++){ + sprintf(buf1,"hTotal%d",j); + + hTotal[j] = new TH2F(buf1," Number of primary particles ", + numberOfSectors[j-1],1,numberOfSectors[j-1], + numberOfRings[j-1],1,numberOfRings[j-1]); + } + gDirectory = cwd; + + + if(fNevents == 0) fNevents=Int_t (fRunLoader->TreeE()->GetEntries()); + cout<<" fNevents "<GetEvent(ievent) ; - Int_t size_EtaIntervalOuter=sizeof (EtaIntervalOuter)/sizeof(EtaIntervalOuter[0]); + cout<<" ievent "<Reset(); + + retval = gime->LoadDigits("READ"); + if (retval) + { + Error("Exec","Error occured while loading digits. Exiting."); + return; + } + + AliFMD * fFMD = (AliFMD *) gAlice->GetDetector("FMD"); + TClonesArray *fReconParticles=fFMD->ReconParticles(); + TClonesArray *fDigits=fFMD->Digits(); + + TTree* treeD = gime->TreeD(); + if (treeD == 0x0) + { + Error("Exec","Can not get Tree with Digits. Nothing to reconstruct - Exiting"); + return; + } + + TBranch *brDigits=0; + + brDigits=treeD->GetBranch("FMD"); + cout<<" brDigits "<SetAddress(&fDigits); + // fFMD->SetHitsAddressBranch(brHits); + }else{ + cerr<<"EXEC Branch FMD digits not found"<TreeR()==0) gime->MakeTree("R"); - AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD"); - TClonesArray *fReconParticles=FMD->ReconParticles(); - if(fNevents == 0) fNevents=(Int_t)gAlice->TreeE()->GetEntries(); - for(Int_t ievent=0;ieventGetEvent(ievent) ; - if(gAlice->TreeH()==0) return; - if(gAlice->TreeR()==0) gAlice->MakeTree("R"); //Make branches - AliFMDdigit *fmdDigit; - FMD->MakeBranch("R"); - - Int_t zeroADC=1; - // Int_t threshold_array_size=30; + fFMD->MakeBranch("R"); - // cout<<" AliFMDdigit "<TreeD()->GetEvent(0); - TClonesArray *FMDdigits=FMD->Digits(); - Int_t nDigits=FMDdigits->GetEntries(); - Int_t RecParticles[6]; - Int_t nRecPart=0 ; - Int_t ZeroPads=0; - Int_t NumberOfPads=0; //To avoid warning + gime->TreeD()->GetEvent(0); + + Int_t nDigits=fDigits->GetEntries(); + cout<<" nDigits "<UncheckedAt(digit); + fmdDigit=(AliFMDdigit*)fDigits->UncheckedAt(digit); ivol=fmdDigit->Volume(); iSector=fmdDigit->NumberOfSector(); iRing=fmdDigit->NumberOfRing(); pedestal=Int_t(gRandom->Gaus(500,250)); - PadADC[ivol-1][iSector-1][iRing-1]= - fmdDigit->ADCsignal() + padADC= fmdDigit->ADCsignal() -Int_t(Float_t(pedestal)/channelWidth); - if (PadADC[ivol-1][iSector-1][iRing-1]<0) - PadADC[ivol-1][iSector-1][iRing-1]=0; - } //digit loop - Int_t Rmin=0; Int_t Rmax=0; //To avoid warning - Int_t Smin=0; Int_t Smax=0; //To avoid warning - - for (ivol=1; ivol<=NumVolums; ivol++) + 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; ivolGetBinContent(isector+1,iring+1) + TreeR()->Reset(); - gAlice->TreeR()->Fill(); - gAlice->TreeR()->Write(0,TObject::kOverwrite); + gime->TreeR()->Reset(); + gime->TreeR()->Fill(); + gime->WriteRecPoints("OVERWRITE"); } //event loop - // cout<<"\nAliFMDReconstruction::Exec finished"<threshold[i] - &&PadADC[volume-1][isector][iring]<=threshold[i+1]) - { - NumPart+=i; - break; - }; // if in threshol interval - }; //threshold_array_size - }; //iring - }; //sector - // cout<<"\nEnd threshol method"<