Figure 1.: Use Case for reconstruction. Only PHOS is implemented. Other detectors are ignored. Click on image for full scale
fRootFile = new TFile("MyFileName", "update") ; // open the root file created by the simulation gAlice = (AliRun*) fRootFile->Get("gAlice"); // get from file the AliRun object fPHOS = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ; // get from file the detector object fGeom = AliPHOSGeometry::GetInstance( // get the geometry used for the simulation fPHOS->GetGeometry()->GetName(), fPHOS->GetGeometry()->GetTitle() ) ; //========== Initializes the Index to Object converter fObjGetter = AliPHOSIndexToObject::GetInstance(fPHOS) ; //========== Create the Clusterizer and set a few parameters fClu = new AliPHOSClusterizerv1() ; fClu->SetEmcEnergyThreshold(0.030) ; fClu->SetEmcClusteringThreshold(1.0) ; fClu->SetPpsdEnergyThreshold (0.0000002) ; fClu->SetPpsdClusteringThreshold(0.0000001) ; fClu->SetLocalMaxCut(0.03) ; fClu->SetCalibrationParameters(0., 0.00000001) ; cout << "AnalyzeOneEvent > using clusterizer " << fClu->GetName() << endl ; fClu->PrintParameters() ; //========== Creates the track segment maker fTrs = new AliPHOSTrackSegmentMakerv1() ; cout << "AnalyzeOneEvent > using tack segment maker " << fTrs->GetName() << endl ; fTrs->UnsetUnfoldFlag() ; //========== Creates the particle identifier fPID = new AliPHOSPIDv1() ; cout << "AnalyzeOneEvent > using particle identifier " << fPID->GetName() << endl ; fPID->SetShowerProfileCuts(0., 0., 0., 0.) ; fPIS->SetDispersionCutOff(0.34) ; //========== Creates the Reconstructioner fRec = new AliPHOSReconstructioner(fClu, fTrs, fPID) ; //=========== Connect the various Tree's for evt gAlice->GetEvent(evt); //=========== Fill the fDigits array from the Digit TTree gAlice->TreeD()->GetEvent(0) ; //=========== Do the reconstruction fPHOS->Reconstruction(fRec); // =========== Write to the root file fRootFile->Close() ;
The reconstructed points are contained in two TObjArray (mandatory because the size of a reconstructed point depends on the number of digits used to build it) which are stored in TreeR, branch PHOSEmcRP for EMCA and branch PHOSPpsdRP for PPSD.
The track segments are contained in a TClonesArray which are stored in TreeR, branch PHOSTS.
NEUTRAL: | a reconstructed point in EMCA, none in the two layers of the PPSD; |
GAMMA : | a reconstructed point in the lower PPSD layer, none in the upper one, and a reconstructed point in EMCA that satisfies the shower topology cuts; |
GAMMAHADRON : | as a GAMMA, but the EMCA reconstructed point does not satisfy the shower topology cuts; |
CHARGED: | a reconstructed point in EMCA, and one in the upper layer of the PPSD; |
NEUTRALEM: | a NEUTRAL particle for which the EMCA reconstructed point satisfies the shower profile cut; |
NEUTRALHADRON: | a NEUTRAL particle for which the EMCA reconstructed point does not satisfy the shower profile cut; |
ELECTRON: | a CHARGED particle for which the EMCA reconstructed point satisfies the shower profile cut; |
CHARGEDHADRON: | a CHARGED particle for which the EMCA reconstructed point does not satisfy the shower profile cut; |
root [2] TFile myfile("junk.root") root [3] TTree * reconstructedtree = (TTree *)myfile.Get("TreeR0") root [5] reconstructedtree.Print() ****************************************************************************** *Tree :TreeR0 : Reconstruction * *Entries : 1 : Total Size = 10882 bytes File Size = 4024 * * : : Tree compression factor = 5.65 * ****************************************************************************** *Branch :PHOSEmcRP : PHOSEmcRP * *Entries : 1 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 16000 bytes Compression= 1.00 * *............................................................................* *Branch :PHOSPpsdRP : PHOSPpsdRP * *Entries : 1 : Total Size = 8334 bytes File Size = 1476 * *Baskets : 1 : Basket Size = 16000 bytes Compression= 5.65 * *............................................................................* *Branch :PHOSTS : PHOSTS * *Entries : 1 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 16000 bytes Compression= 1.00 * *............................................................................* *Branch :PHOSRP : PHOSRP * *Entries : 1 : Total Size = 0 bytes File Size = 0 * *Entries : 1 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 16000 bytes Compression= 1.00 * *............................................................................* root [6]
Figure 2: Branches in TreeR generated by the PHOS reconstruction. PHOSEmc(Ppsd)RP contains EMCA(PPSD) reconstructed points in TObjArray; PHOSTS contains track segments in a TClonesArray; PHOSRP contains reconstructed particles in a TClonesArray.
AliPHOS * phos = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ; AliPHOSIndexToObject::GetInstance(phos) ;It can then be used as follow, for example for retrieving a particle from the kine tree (TreeK):
AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ; Int_t index = 123 ; TParticle * primaryparticle = please->GimePrimaryParticle(index) ;We shall now detail how the various reconstruction objects are linked together.
// initialization // open root file TFile rootfile("junk.root") ; // get AliRun object gAlice = (AliRun *)rootfile.Get("gAlice") ; // get detector object AliPHOSv0 * phos = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ; // get the geometry associated with the detector AliPHOSGeometry::GetInstance( phos->GetGeometry()->GetName(), phos->GetGeometry()->GetTitle() ) ; // initializes the index to object converter AliPHOSIndexToObject::GetInstance(phos) ; // get the list of digits TClonesArray * digitslist = phos->Digits() ; // loop over the list of digits TIter nextdigit(digitslist) ; AliPHOSDigit * digit ; TParticle * primaryparticle[3] ; // get the pointer of the index to object converter AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ; while ( digit = (AliPHOSDigit * )nextdigit() ) { for ( Int_t i = 0 ; i < digit->GetNprimary() ; i++ ) primary[i] = please->GimePrimaryParticle(digit->GetPrimary(i) ) ; }
// initialization // open root file TFile rootfile("junk.root") ; // get AliRun object gAlice = (AliRun *)rootfile.Get("gAlice") ; // get detector object AliPHOSv0 * phos = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ; // get the geometry associated with the detector AliPHOSGeometry::GetInstance( phos->GetGeometry()->GetName(), phos->GetGeometry()->GetTitle() ) ; // initializes the index to object converter AliPHOSIndexToObject::GetInstance(phos) ; // get the reconstructed points list Int_t evt = 123 ; TObjArray * recpointslist = phos->EmcRecPoints(evt) ; // loop over reconstructed points TIter nextrecpoint(recpointslist) ; // get the pointer of the index to object converter AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ; AliPHOSEmcRecPoint * recpoint ; while ( recpoint = (AliPHOSEmcRecPoint * )nextrecpoint() ) { // get the associated digits list Int_t * digitsindexeslist = recpoint->GetDigitsList() ; // loop over the list of digits for ( Int_t i = 0 ; i < recpoint->GetDigitsMultiplicity() ; i++ ) { AliPHOSDigit * digit = please->GimeDigit(digitsindexeslist[i] ) ; // get the primary particle associated with that digit Int_t numberofprimaries = 0 ; Int_t * prim = digit->GetPrimaries(numberofprimaries) ; for (Int_t i = 0 ; i < numberofprimaries ; i++ ) // and print them please->GimePrimaryParticle( prim[i] )->Print() ; } } // or get the primaries directly from the reconstructed point Int_t numberofprimaries = 0 ; Int_t * prim = recpoint->GetPrimaries(numberofprimaries) ; }
// initialization // open root file TFile rootfile("junk.root") ; // get AliRun object gAlice = (AliRun *)rootfile.Get("gAlice") ; // get detector object AliPHOSv0 * phos = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ; // get the geometry associated with the detector AliPHOSGeometry::GetInstance( phos->GetGeometry()->GetName(), phos->GetGeometry()->GetTitle() ) ; // initializes the index to object converter AliPHOSIndexToObject::GetInstance(phos) ; // get the track segments list Int_t evt = 123 ; TClonesArray * tracksegmentslist = phos->TrackSegments(evt) ; // loop over track segments TIter nexttracksegment(tracksegmentslist) ; AliPHOSTrackSegment * tracksegment ; // get the pointer of the index to object converter AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ; while ( tracksegment = (AliPHOSTrackSegment * )nexttracksegment() ) { // get the associated reconstructed points AliPHOSEmcRecPoint * emcrecpoint = please->GimeRecPoint(tracksegment->GetEmcRecPoint(), "emc" ) ; AliPHOSPpsdRecPoint * ppsduprecpoint = please->GimeRecPoint(tracksegment->GetPpsdUpRecPoint(), "ppsd" ) ; AliPHOSPpsdRecPoint * ppsdlowrecpoint = please->GimeRecPoint(tracksegment->GetPpsdLowRecPoint(),"ppsd" ) ; // get the primaries particles Int_t numberofprimariestoemc = 0 ; Int_t * primemc = tracksegment->GetPrimariesEmc(numberofprimariestoemc) ; Int_t numberofprimariestoppsdup = 0 ; Int_t * primppsdup = tracksegment->GetPrimariesPpsdUp(numberofprimariestoppsdup) ; Int_t numberofprimariestoppsdlow = 0 ; Int_t * primppsdlow = tracksegment->GetPrimariesPpsdLow(numberofprimariestoppsdlow) ; // print one as example please->GimePrimaryParticle( primppsdlow[0] )->Print() ; } rootfile.Close() ; gAlice = 0 ; phos = 0 ; recparticleslist = 0 ;
// initialization // open root file TFile rootfile("junk.root") ; // get AliRun object gAlice = (AliRun *)rootfile.Get("gAlice") ; // get detector object AliPHOSv0 * phos = (AliPHOSv0 *)gAlice->GetDetector("PHOS") ; // get the geometry associated with the detector AliPHOSGeometry::GetInstance( phos->GetGeometry()->GetName(), phos->GetGeometry()->GetTitle() ) ; // initializes the index to object converter AliPHOSIndexToObject::GetInstance(phos) ; // get the reconstructed particles list Int_t evt = 123 ; TClonesArray * recparticleslist = phos->RecParticles(evt) ; // loop over reconstructed particles TIter nextrecparticle(recparticleslist) ; AliPHOSRecParticle * recparticle ; // get the pointer of the index to object converter AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ; while ( recparticle = (AliPHOSRecParticle * )nextrecparticle() ) { // get the track segment ... AliPHOSTrackSegment * tracksegment = recparticle->GetPHOSTrackSegment() ; // and print it tracksegment->Print() ; // get the list of primaries ... Int_t numberofprimaries = 0 ; Int_t * prim = recparticle->GetPrimaries(numberofprimaries) ; for (Int_t i = 0 ; i < numberofprimaries ; i++ ) // and print them please->GimePrimaryParticle( prim[i] )->Print() ; } rootfile.Close() ; gAlice = 0 ; phos = 0 ; recparticleslist = 0 ;A short cut allows to access the primaries at the origin of the reconstructed particle:
Int_t numberofprimaries = 0 ; Int_t * prim = recparticle->GetPrimariesPpsdLow(numberofprimaries) ;