#include "TNode.h"
#include "TRandom.h"
+
// --- Standard library ---
#include <stdio.h>
// But save the cumulated hits instead (need to create the branch myself)
// It is put in the Digit Tree because the TreeH is filled after each primary
- // and the TreeD at the end of the event (branch is set in FinishEvent() ).
+ // and the TreeD at the end of the event (branch is set in FinishEvent() ).
- fTmpHits= new TClonesArray("AliPHOSHit",100) ;
+ fTmpHits= new TClonesArray("AliPHOSHit",1000) ;
fNTmpHits = fNhits = 0 ;
- fDigits = new TClonesArray("AliPHOSDigit",100) ;
+ fDigits = new TClonesArray("AliPHOSDigit",1000) ;
fIshunt = 1 ; // All hits are associated with primary particles
else
cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
}
+
//____________________________________________________________________________
AliPHOSv0::AliPHOSv0(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
AliPHOS(name,title)
// We do not want to save in TreeH the raw hits
//fHits = new TClonesArray("AliPHOSHit",100) ;
- fDigits = new TClonesArray("AliPHOSDigit",100) ;
- fTmpHits= new TClonesArray("AliPHOSHit",100) ;
+ fDigits = new TClonesArray("AliPHOSDigit",1000) ;
+ fTmpHits= new TClonesArray("AliPHOSHit",1000) ;
fNTmpHits = fNhits = 0 ;
{
// dtor
- fTmpHits->Delete() ;
- delete fTmpHits ;
- fTmpHits = 0 ;
+ if ( fTmpHits) {
+ fTmpHits->Delete() ;
+ delete fTmpHits ;
+ fTmpHits = 0 ;
+ }
- fEmcClusters->Delete() ;
- delete fEmcClusters ;
- fEmcClusters = 0 ;
+ if ( fEmcRecPoints ) {
+ fEmcRecPoints->Delete() ;
+ delete fEmcRecPoints ;
+ fEmcRecPoints = 0 ;
+ }
- fPpsdClusters->Delete() ;
- delete fPpsdClusters ;
- fPpsdClusters = 0 ;
+ if ( fPpsdRecPoints ) {
+ fPpsdRecPoints->Delete() ;
+ delete fPpsdRecPoints ;
+ fPpsdRecPoints = 0 ;
+ }
+
+ if ( fTrackSegments ) {
+ fTrackSegments->Delete() ;
+ delete fTrackSegments ;
+ fTrackSegments = 0 ;
+ }
- fTrackSegments->Delete() ;
- delete fTrackSegments ;
- fTrackSegments = 0 ;
}
//____________________________________________________________________________
}
} // PHOS modules
- delete rotname ;
- delete nodename ;
+ delete[] rotname ;
+ delete[] nodename ;
}
// Save the cumulated hits instead of raw hits (need to create the branch myself)
// It is put in the Digit Tree because the TreeH is filled after each primary
// and the TreeD at the end of the event.
- if ( fTmpHits && gAlice->TreeD() ) {
- char branchname[10] ;
- sprintf(branchname, "%sCH", GetName()) ;
- gAlice->TreeD()->Branch(branchname, &fTmpHits, fBufferSize) ;
- } else
- cout << "AliPHOSv0::AliPHOSv0: Failed to create branch PHOSCH in TreeD " << endl ;
+
Int_t i ;
Int_t relid[4];
newdigit = (AliPHOSDigit *) fDigits->At(i) ;
newdigit->SetIndexInList(i) ;
}
-
+
}
//____________________________________________________________________________
char branchname[10];
sprintf(branchname,"%s",GetName());
char *cdD = strstr(opt,"D");
-
if (fDigits && gAlice->TreeD() && cdD) {
gAlice->TreeD()->Branch(branchname, &fDigits, fBufferSize);
}
+
+ // Create new branche PHOSCH in the current Root Tree in the digit Tree for accumulated Hits
+ if ( ! (gAlice->IsLegoRun()) ) { // only when not in lego plot mode
+ if ( fTmpHits && gAlice->TreeD() && cdD) {
+ char branchname[10] ;
+ sprintf(branchname, "%sCH", GetName()) ;
+ gAlice->TreeD()->Branch(branchname, &fTmpHits, fBufferSize) ;
+ }
+ }
+
+}
+
+//____________________________________________________________________________
+AliPHOSRecPoint::RecPointsList * AliPHOSv0::PpsdRecPoints(Int_t evt)
+{
+ // returns the pointer to the PPSD RecPoints list
+ // if the list is empty, get it from TreeR on the disk file
+
+ AliPHOSRecPoint::RecPointsList * rv = 0 ;
+
+ if ( fPpsdRecPoints )
+ rv = fPpsdRecPoints ;
+
+ else {
+ fPpsdRecPoints = new TClonesArray("AliPHOSPpsdRecPoint", 100) ;
+ gAlice->GetEvent(evt) ;
+ TTree * fReconstruct = gAlice->TreeR() ;
+ fReconstruct->SetBranchAddress( "PHOSPpsdRP", &fPpsdRecPoints) ;
+ fReconstruct->GetEvent(0) ;
+ rv = fPpsdRecPoints ;
+ }
+
+ fPpsdRecPoints->Expand( fPpsdRecPoints->GetEntries() ) ;
+
+ return rv ;
+
}
//_____________________________________________________________________________
void AliPHOSv0::Reconstruction(AliPHOSReconstructioner * Reconstructioner)
{
// 1. Reinitializes the existing RecPoint, TrackSegment, and RecParticles Lists and
- // 2. Creates TreeR wit a branch for each list
+ // 2. Creates TreeR with a branch for each list
// 3. Steers the reconstruction processes
// 4. Saves the 3 lists in TreeR
// 5. Write the Tree to File
char branchname[10] ;
+
+
+
// 1.
- gAlice->MakeTree("R") ;
+ // gAlice->MakeTree("R") ;
Int_t splitlevel = 0 ;
- if (fEmcClusters) {
- fEmcClusters->Delete() ;
- delete fEmcClusters ;
- fEmcClusters = 0 ;
+ if (fEmcRecPoints) {
+ fEmcRecPoints->Delete() ;
+ delete fEmcRecPoints ;
+ fEmcRecPoints = 0 ;
}
- // fEmcClusters= new RecPointsList("AliPHOSEmcRecPoint", 100) ; if TClonesArray
- fEmcClusters= new RecPointsList(100) ;
+ // fEmcRecPoints= new AliPHOSRecPoint::RecPointsList("AliPHOSEmcRecPoint", 1000) ; if TClonesArray
+ fEmcRecPoints= new AliPHOSRecPoint::RecPointsList(100) ;
- if ( fEmcClusters && gAlice->TreeR() ) {
+ if ( fEmcRecPoints && gAlice->TreeR() ) {
sprintf(branchname,"%sEmcRP",GetName()) ;
- // gAlice->TreeR()->Branch(branchname, &fEmcClusters, fBufferSize); if TClonesArray
- gAlice->TreeR()->Branch(branchname, "TObjArray", &fEmcClusters, fBufferSize, splitlevel) ;
+ // gAlice->TreeR()->Branch(branchname, &fEmcRecPoints, fBufferSize); if TClonesArray
+ gAlice->TreeR()->Branch(branchname, "TObjArray", &fEmcRecPoints, fBufferSize, splitlevel) ;
}
- if (fPpsdClusters) {
- fPpsdClusters->Delete() ;
- delete fPpsdClusters ;
- fPpsdClusters = 0 ;
+ if (fPpsdRecPoints) {
+ fPpsdRecPoints->Delete() ;
+ delete fPpsdRecPoints ;
+ fPpsdRecPoints = 0 ;
}
- // fPpsdClusters = new RecPointsList("AliPHOSPpsdRecPoint", 100) ; if TClonesArray
- fPpsdClusters = new RecPointsList(100) ;
+ // fPpsdRecPoints = new AliPHOSRecPoint::RecPointsList("AliPHOSPpsdRecPoint", 1000) ; if TClonesArray
+ fPpsdRecPoints = new AliPHOSRecPoint::RecPointsList(100) ;
- if ( fPpsdClusters && gAlice->TreeR() ) {
+ if ( fPpsdRecPoints && gAlice->TreeR() ) {
sprintf(branchname,"%sPpsdRP",GetName()) ;
- // gAlice->TreeR()->Branch(branchname, &fPpsdClusters, fBufferSize); if TClonesArray
- gAlice->TreeR()->Branch(branchname, "TObjArray", &fPpsdClusters, fBufferSize, splitlevel);
+ // gAlice->TreeR()->Branch(branchname, &fPpsdRecPoints, fBufferSize); if TClonesArray
+ gAlice->TreeR()->Branch(branchname, "TObjArray", &fPpsdRecPoints, fBufferSize, splitlevel) ;
}
if (fTrackSegments) {
fTrackSegments = 0 ;
}
- fTrackSegments = new TrackSegmentsList("AliPHOSTrackSegment", 100) ;
+ fTrackSegments = new AliPHOSTrackSegment::TrackSegmentsList("AliPHOSTrackSegment", 1000) ;
if ( fTrackSegments && gAlice->TreeR() ) {
sprintf(branchname,"%sTS",GetName()) ;
- gAlice->TreeR()->Branch(branchname, &fTrackSegments, fBufferSize);
+ gAlice->TreeR()->Branch(branchname, &fTrackSegments, fBufferSize) ;
}
if (fRecParticles) {
delete fRecParticles ;
fRecParticles = 0 ;
}
- fRecParticles = new RecParticlesList("AliPHOSRecParticle", 100) ;
+ fRecParticles = new AliPHOSRecParticle::RecParticlesList("AliPHOSRecParticle", 1000) ;
if ( fRecParticles && gAlice->TreeR() ) {
sprintf(branchname,"%sRP",GetName()) ;
- gAlice->TreeR()->Branch(branchname, &fRecParticles, fBufferSize);
+ gAlice->TreeR()->Branch(branchname, &fRecParticles, fBufferSize) ;
}
// 3.
- fReconstructioner->Make(fDigits, fEmcClusters, fPpsdClusters, fTrackSegments, fRecParticles);
+ fReconstructioner->Make(fDigits, fEmcRecPoints, fPpsdRecPoints, fTrackSegments, fRecParticles);
// 4. Expand or Shrink the arrays to the proper size
Int_t size ;
- size = fEmcClusters->GetEntries() ;
- fEmcClusters->Expand(size) ;
+ size = fEmcRecPoints->GetEntries() ;
+ fEmcRecPoints->Expand(size) ;
- size = fPpsdClusters->GetEntries() ;
- fPpsdClusters->Expand(size) ;
+ size = fPpsdRecPoints->GetEntries() ;
+ fPpsdRecPoints->Expand(size) ;
size = fTrackSegments->GetEntries() ;
fTrackSegments->Expand(size) ;
fRecParticles->Expand(size) ;
gAlice->TreeR()->Fill() ;
-
+ cout << "filled" << endl ;
// 5.
gAlice->TreeR()->Write() ;
-
+ cout << "writen" << endl ;
+
+ // Deleting reconstructed objects
+ ResetReconstruction();
+
+
}
//____________________________________________________________________________
-void AliPHOSv0::ResetDigits()
-{
+void AliPHOSv0::ResetDigits()
+{
// May sound strange, but cumulative hits are store in digits Tree
-
+ AliDetector::ResetDigits();
if( fTmpHits ) {
fTmpHits->Delete();
fNTmpHits = 0 ;
}
-}
+}
+//____________________________________________________________________________
+void AliPHOSv0::ResetReconstruction()
+{
+ // Deleting reconstructed objects
+
+ if ( fEmcRecPoints ) fEmcRecPoints->Delete();
+ if ( fPpsdRecPoints ) fPpsdRecPoints->Delete();
+ if ( fTrackSegments ) fTrackSegments->Delete();
+ if ( fRecParticles ) fRecParticles->Delete();
+}
//____________________________________________________________________________
void AliPHOSv0::StepManager(void)
{