///////////////////////////////////////////////////////////////////////////////
#include <TBrowser.h>
+#include <TClonesArray.h>
#include <TTree.h>
#include "AliLog.h"
#include "AliConfig.h"
#include "AliDetector.h"
#include "AliHit.h"
-#include "AliPoints.h"
#include "AliLoader.h"
#include "AliRun.h"
#include "AliMC.h"
fNhits(0),
fNdigits(0),
fBufferSize(1600),
+ fMaxIterHit(0),
+ fCurIterHit(0),
fHits(0),
fDigits(0),
- fPoints(0),
fLoader(0x0)
{
//
//
}
-//_______________________________________________________________________
-AliDetector::AliDetector(const AliDetector &det):
- AliModule(det),
- fTimeGate(200.e-9),
- fIshunt(0),
- fNhits(0),
- fNdigits(0),
- fBufferSize(1600),
- fHits(0),
- fDigits(0),
- fPoints(0),
- fLoader(0x0)
-{
- det.Copy(*this);
-}
-
//_____________________________________________________________________________
AliDetector::AliDetector(const char* name,const char *title):
AliModule(name,title),
fNhits(0),
fNdigits(0),
fBufferSize(1600),
+ fMaxIterHit(0),
+ fCurIterHit(0),
fHits(0),
fDigits(0),
- fPoints(0),
fLoader(0x0)
{
//
// Destructor
//
- // Delete space point structure
- if (fPoints) {
- fPoints->Delete();
- delete fPoints;
- fPoints = 0;
- }
// Delete digits structure
if (fDigits) {
fDigits->Delete();
MayNotUse("Publish");
}
+//_______________________________________________________________________
+void AliDetector::AddAlignableVolumes() const
+{
+ //
+ AliWarning(Form("%s still has to implement the AddAlignableVolumes method!",GetName()));
+}
+
//_______________________________________________________________________
TBranch* AliDetector::MakeBranchInTree(TTree *tree, const char* name,
void* address, Int_t size,
//
//
//
-// if (GetDebug()>1)
AliDebug(2,Form("Making Branch %s",name));
if (tree == 0x0)
}
}
-//_______________________________________________________________________
-void AliDetector::Copy(TObject &) const
-{
- //
- // Copy *this onto det -- not implemented
- //
- AliFatal("Not implemented");
-}
-
//_______________________________________________________________________
void AliDetector::FinishRun()
{
// track is returned
//
if(track>=0) {
- gAlice->ResetHits(); //stupid = if N detector this method is called N times
- TreeH()->GetEvent(track); //skowron
+ gAlice->GetMCApp()->ResetHits(); //stupid = if N detector this method is called N times
+ fLoader->TreeH()->GetEvent(track); //skowron
}
//
fMaxIterHit=fHits->GetEntriesFast();
}
}
-//_______________________________________________________________________
-void AliDetector::LoadPoints(Int_t)
-{
- //
- // Store x, y, z of all hits in memory
- //
- if (fHits == 0)
- {
- AliError(Form("fHits == 0. Name is %s",GetName()));
- return;
- }
- //
- Int_t nhits = fHits->GetEntriesFast();
- if (nhits == 0)
- {
-// Error("LoadPoints","nhits == 0. Name is %s",GetName());
- return;
- }
- Int_t tracks = gAlice->GetMCApp()->GetNtrack();
- if (fPoints == 0) fPoints = new TObjArray(tracks);
- AliHit *ahit;
- //
- Int_t *ntrk=new Int_t[tracks];
- Int_t *limi=new Int_t[tracks];
- Float_t **coor=new Float_t*[tracks];
- for(Int_t i=0;i<tracks;i++) {
- ntrk[i]=0;
- coor[i]=0;
- limi[i]=0;
- }
- //
- AliPoints *points = 0;
- Float_t *fp=0;
- Int_t trk;
- Int_t chunk=nhits/4+1;
- //
- // Loop over all the hits and store their position
- for (Int_t hit=0;hit<nhits;hit++) {
- ahit = dynamic_cast<AliHit*>(fHits->UncheckedAt(hit));
- trk=ahit->GetTrack();
- if(trk>tracks) AliFatal(Form("Found track number %d, max track %d",trk, tracks));
- if(ntrk[trk]==limi[trk])
- {
- //
- // Initialise a new track
- fp=new Float_t[3*(limi[trk]+chunk)];
- if(coor[trk])
- {
- memcpy(fp,coor[trk],sizeof(Float_t)*3*limi[trk]);
- delete [] coor[trk];
- }
- limi[trk]+=chunk;
- coor[trk] = fp;
- }
- else
- {
- fp = coor[trk];
- }
- fp[3*ntrk[trk] ] = ahit->X();
- fp[3*ntrk[trk]+1] = ahit->Y();
- fp[3*ntrk[trk]+2] = ahit->Z();
- ntrk[trk]++;
- }
- //
- for(trk=0; trk<tracks; ++trk) {
- if(ntrk[trk]) {
- points = new AliPoints();
- points->SetMarkerColor(GetMarkerColor());
- points->SetMarkerSize(GetMarkerSize());
- points->SetDetector(this);
- points->SetParticle(trk);
- points->SetPolyMarker(ntrk[trk],coor[trk],GetMarkerStyle());
- fPoints->AddAt(points,trk);
- delete [] coor[trk];
- coor[trk]=0;
- }
- }
- delete [] coor;
- delete [] ntrk;
- delete [] limi;
-}
-
//_______________________________________________________________________
void AliDetector::MakeBranch(Option_t *option)
{
AliDebug(2,Form(" for %s",GetName()));
const char *cH = strstr(option,"H");
- if (fHits && TreeH() && cH)
+ if (fHits && fLoader->TreeH() && cH)
{
- MakeBranchInTree(TreeH(), GetName(), &fHits, fBufferSize, 0);
+ MakeBranchInTree(fLoader->TreeH(), GetName(), &fHits, fBufferSize, 0);
}
}
if (fHits) fHits->Clear();
}
-//_______________________________________________________________________
-void AliDetector::ResetPoints()
-{
- //
- // Reset array of points
- //
- if (fPoints) {
- fPoints->Delete();
- delete fPoints;
- fPoints = 0;
- }
-}
-
//_______________________________________________________________________
void AliDetector::SetTreeAddress()
{
//
// Branch address for hit tree
- TTree *tree = TreeH();
+ TTree* tree = fLoader->TreeH();
if (tree && fHits) {
branch = tree->GetBranch(GetName());
if (branch)
branch = treeD->GetBranch(GetName());
if (branch) branch->SetAddress(&fDigits);
}
-
- AliModule::SetTreeAddress();
}
//_______________________________________________________________________
return fLoader;
}
-//_______________________________________________________________________
-TTree* AliDetector::TreeH() const
-{
-//Get the hits container from the folder
- if (GetLoader() == 0x0)
- {
- //sunstitude this with make getter when we can obtain the event folder name
- AliError("Can not get the getter");
- return 0x0;
- }
-
- TTree* tree = (TTree*)GetLoader()->TreeH();
- return tree;
-}