X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliDetector.cxx;h=253e2e05026283bbac683a38e3bb1eb14f332ae6;hb=32150d2cdf3799a44390192048151f426d6ef629;hp=76a89e1eb7732ced3f2cc66b1948f7c775475c8e;hpb=4787b401df39b2d87d1e8e0cc7cfbd7cb1299aa6;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliDetector.cxx b/STEER/AliDetector.cxx index 76a89e1eb77..253e2e05026 100644 --- a/STEER/AliDetector.cxx +++ b/STEER/AliDetector.cxx @@ -34,13 +34,13 @@ /////////////////////////////////////////////////////////////////////////////// #include +#include #include #include "AliLog.h" #include "AliConfig.h" #include "AliDetector.h" #include "AliHit.h" -#include "AliPoints.h" #include "AliLoader.h" #include "AliRun.h" #include "AliMC.h" @@ -60,7 +60,6 @@ AliDetector::AliDetector(): fCurIterHit(0), fHits(0), fDigits(0), - fPoints(0), fLoader(0x0) { // @@ -68,24 +67,6 @@ AliDetector::AliDetector(): // } -//_______________________________________________________________________ -AliDetector::AliDetector(const AliDetector &det): - AliModule(det), - fTimeGate(200.e-9), - fIshunt(0), - fNhits(0), - fNdigits(0), - fBufferSize(1600), - fMaxIterHit(0), - fCurIterHit(0), - fHits(0), - fDigits(0), - fPoints(0), - fLoader(0x0) -{ - det.Copy(*this); -} - //_____________________________________________________________________________ AliDetector::AliDetector(const char* name,const char *title): AliModule(name,title), @@ -98,7 +79,6 @@ AliDetector::AliDetector(const char* name,const char *title): fCurIterHit(0), fHits(0), fDigits(0), - fPoints(0), fLoader(0x0) { // @@ -119,12 +99,6 @@ AliDetector::~AliDetector() // Destructor // - // Delete space point structure - if (fPoints) { - fPoints->Delete(); - delete fPoints; - fPoints = 0; - } // Delete digits structure if (fDigits) { fDigits->Delete(); @@ -196,7 +170,7 @@ TBranch* AliDetector::MakeBranchInTree(TTree *tree, const char* name, { branch = tree->Bronch(name, "TClonesArray", address, size, splitlevel); } - AliDebug(2,Form("Branch %s returning branch %#x",name,branch)); + AliDebug(2,Form("Branch %s returning branch %p",name,branch)); return branch; } @@ -206,7 +180,7 @@ void AliDetector::Browse(TBrowser *b) // // Insert Detector objects in the list of objects to be browsed // - char name[64]; + char name[64]=""; if( fHits == 0) return; TObject *obj; Int_t i, nobjects; @@ -214,20 +188,11 @@ void AliDetector::Browse(TBrowser *b) nobjects = fHits->GetEntries(); for (i=0;iAt(i); - sprintf(name,"%s_%d",obj->GetName(),i); + snprintf(name,63,"%s_%d",obj->GetName(),i); b->Add(obj, &name[0]); } } -//_______________________________________________________________________ -void AliDetector::Copy(TObject &) const -{ - // - // Copy *this onto det -- not implemented - // - AliFatal("Not implemented"); -} - //_______________________________________________________________________ void AliDetector::FinishRun() { @@ -247,8 +212,8 @@ AliHit* AliDetector::FirstHit(Int_t track) // 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(); @@ -274,91 +239,6 @@ AliHit* AliDetector::NextHit() } } -//_______________________________________________________________________ -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(fHits->UncheckedAt(hit)); - trk=ahit->GetTrack(); - if(trk>tracks) { - AliError(Form("Found track number %d, max track %d",trk, tracks)); - continue; - } - 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; trkSetMarkerColor(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) { @@ -369,9 +249,9 @@ 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); } } @@ -395,19 +275,6 @@ void AliDetector::ResetHits() if (fHits) fHits->Clear(); } -//_______________________________________________________________________ -void AliDetector::ResetPoints() -{ - // - // Reset array of points - // - if (fPoints) { - fPoints->Delete(); - delete fPoints; - fPoints = 0; - } -} - //_______________________________________________________________________ void AliDetector::SetTreeAddress() { @@ -418,7 +285,7 @@ void AliDetector::SetTreeAddress() // // Branch address for hit tree - TTree *tree = TreeH(); + TTree* tree = fLoader->TreeH(); if (tree && fHits) { branch = tree->GetBranch(GetName()); if (branch) @@ -439,8 +306,6 @@ void AliDetector::SetTreeAddress() branch = treeD->GetBranch(GetName()); if (branch) branch->SetAddress(&fDigits); } - - AliModule::SetTreeAddress(); } //_______________________________________________________________________ @@ -474,18 +339,4 @@ AliLoader* AliDetector::MakeLoader(const char* topfoldername) 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; -}