]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HMPID/AliHMPID.cxx
Adding pre-computed list of neighbours (Laurent)
[u/mrichter/AliRoot.git] / HMPID / AliHMPID.cxx
1 //  **************************************************************************
2 //  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 //  *                                                                        *
4 //  * Author: The ALICE Off-line Project.                                    *
5 //  * Contributors are mentioned in the code where appropriate.              *
6 //  *                                                                        *
7 //  * Permission to use, copy, modify and distribute this software and its   *
8 //  * documentation strictly for non-commercial purposes is hereby granted   *
9 //  * without fee, provided that the above copyright notice appears in all   *
10 //  * copies and that both the copyright notice and this permission notice   *
11 //  * appear in the supporting documentation. The authors make no claims     *
12 //  * about the suitability of this software for any purpose. It is          *
13 //  * provided "as is" without express or implied warranty.                  *
14 //  **************************************************************************
15
16 #include "AliHMPID.h"
17 #include "AliHMPIDHit.h"   //OccupancyPrint(), HitQa()
18 #include "AliHMPIDDigit.h" //
19 #include <TParticle.h>  //SummaryOfEvent(), HitQa()
20 #include <TBenchmark.h>  //HitQA()
21 #include <TPDGCode.h>    //HitQA()
22 #include <AliStack.h>   //SummaryOfEvent(), HitQa()
23 #include <AliRun.h>     //HitQa() 
24 #include <AliMC.h>       //ctor
25 #include <AliHeader.h>
26 #include <TH1F.h>        //HitQA()
27 #include <AliLog.h>      //in many methods to print AliInfo 
28
29 Bool_t AliHMPID::fDoFeed=kTRUE;
30  
31 ClassImp(AliHMPID)    
32 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
33 AliHMPID::AliHMPID(const char *name, const char *title):AliDetector(name,title),fSdi(0),fDig(0),fClu(0)
34 {
35 //Named ctor
36   AliDebug(1,"Start.");
37 //AliDetector ctor deals with Hits and Digits (reset them to 0, does not create them)
38   HitCreate();          gAlice->GetMCApp()->AddHitList(fHits);
39   AliDebug(1,"Stop.");
40 }//AliHMPID::AliHMPID(const char *name, const char *title)
41 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
42 AliHMPID::~AliHMPID()
43 {
44 //dtor
45   AliDebug(1,"Start.");
46
47   
48   if(fHits)      delete fHits;
49   if(fDigits)    delete fDigits;
50   if(fSdi)       delete fSdi;
51   if(fDig)      {fDig->Delete();   delete fDig;}
52   if(fClu)      {fClu->Delete();   delete fClu;}
53   AliDebug(1,"Stop.");    
54 }//AliHMPID::~AliHMPID()
55 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56 void AliHMPID::MakeBranch(Option_t* option)
57 {
58 //Create Tree branches for the HMPID.
59   AliDebug(1,Form("Start with option= %s.",option));
60     
61   const Int_t kBufSize = 4000;
62       
63   const char *cH = strstr(option,"H");
64   const char *cD = strstr(option,"D");
65   const char *cR = strstr(option,"R");
66   const char *cS = strstr(option,"S");
67
68   if(cH&&         TreeH()){HitCreate();                       MakeBranchInTree(         TreeH(),     "HMPID"     ,&fHits       ,kBufSize,0);}
69   if(cS&&fLoader->TreeS()){SdiCreate();                       MakeBranchInTree(fLoader->TreeS(),     "HMPID"     ,&fSdi        ,kBufSize,0);}
70   if(cD&&fLoader->TreeD()){DigCreate();for(Int_t i=0;i<7;i++) MakeBranchInTree(fLoader->TreeD(),Form("HMPID%d",i),&((*fDig)[i]),kBufSize,0);}
71   if(cR&&fLoader->TreeR()){CluCreate();for(Int_t i=0;i<7;i++) MakeBranchInTree(fLoader->TreeR(),Form("HMPID%d",i),&((*fClu)[i]),kBufSize,0);}   
72   
73   AliDebug(1,"Stop.");   
74 }//void AliHMPID::MakeBranch(Option_t* option)
75 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
76 void AliHMPID::SetTreeAddress()
77 {
78 //Set branch address for the Hits and Digits Tree.
79   AliDebug(1,"Start.");
80   if(fLoader->TreeH() && fLoader->TreeH()->GetBranch("HMPID" )){HitCreate();                      fLoader->TreeH()->SetBranchAddress(     "HMPID"     ,&fHits       );}
81   if(fLoader->TreeS() && fLoader->TreeS()->GetBranch("HMPID" )){SdiCreate();                      fLoader->TreeS()->SetBranchAddress(     "HMPID"     ,&fSdi        );}
82   if(fLoader->TreeD() && fLoader->TreeD()->GetBranch("HMPID0")){DigCreate(); for(int i=0;i<7;i++) fLoader->TreeD()->SetBranchAddress(Form("HMPID%d",i),&((*fDig)[i]));}
83   if(fLoader->TreeR() && fLoader->TreeR()->GetBranch("HMPID0")){CluCreate(); for(int i=0;i<7;i++) fLoader->TreeR()->SetBranchAddress(Form("HMPID%d",i),&((*fClu)[i]));}
84   AliDebug(1,"Stop.");
85 }//void AliHMPID::SetTreeAddress()
86 //__________________________________________________________________________________________________
87 // AliHMPIDHit* AliHMPID::Hit(Int_t tid)const
88 // {
89 // // Search for the first HMPID hit belonging to the given tid
90 //   GetLoader()->LoadHits();
91 //   for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop      
92 //     GetLoader()->TreeH()->GetEntry(iPrimN);
93 //     for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){
94 //       AliHMPIDHit *pHit=(AliHMPIDHit*)Hits()->At(iHitN);
95 //       if(tid==pHit->Track()) {GetLoader()->UnloadHits();return pHit;}
96 //     }//hits
97 //   }//prims loop
98 //   GetLoader()->UnloadHits();
99 //   return 0;
100 // }