* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
-
+//
+//
+//
+//
#include "AliHMPIDDigitizer.h"
+#include "AliHMPIDDigit.h"
#include "AliHMPID.h"
-#include <AliRun.h>
#include <AliRunLoader.h>
#include "AliRunDigitizer.h"
#include <AliLoader.h>
ClassImp(AliHMPIDDigitizer)
-Bool_t AliHMPIDDigitizer::fDoNoise=kFALSE;
+Bool_t AliHMPIDDigitizer::fgDoNoise=kFALSE;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void AliHMPIDDigitizer::Exec(Option_t*)
{
// make noise array
Float_t arrNoise[7][6][80][48];
- if(fDoNoise) {
+ if(fgDoNoise) {
for (Int_t iCh=AliHMPIDDigit::kMinCh;iCh<=AliHMPIDDigit::kMaxCh;iCh++)
for (Int_t iPc=AliHMPIDDigit::kMinPc;iPc<=AliHMPIDDigit::kMaxPc;iPc++)
for(Int_t iPx=AliHMPIDDigit::kMinPx;iPx<=AliHMPIDDigit::kMaxPx;iPx++)
iNdigPad=1;
aTids[0]=pSdig->GetTrack(0);aTids[1]=aTids[2]=-1;
q=pSdig->Q();
- if(fDoNoise) q+=arrNoise[iCh][pSdig->Pc()][pSdig->PadPcX()][pSdig->PadPcY()];
+ if(fgDoNoise) q+=arrNoise[iCh][pSdig->Pc()][pSdig->PadPcX()][pSdig->PadPcY()];
arrNoise[iCh][pSdig->Pc()][pSdig->PadPcX()][pSdig->PadPcY()]=0;
}//sdigits loop (sorted)
if(AliHMPIDDigit::IsOverTh(q)) new((*pLst[iCh])[iCnt[iCh]++]) AliHMPIDDigit(iPad,(Int_t)q,aTids); //add the last one, in case of empty sdigits list q=-1
// add noise pad above threshold with no signal merged...if any
- if(!fDoNoise) return;
+ if(!fgDoNoise) return;
aTids[0]=aTids[1]=aTids[2]=-1;
for (Int_t iCh=AliHMPIDDigit::kMinCh;iCh<=AliHMPIDDigit::kMaxCh;iCh++)
for (Int_t iPc=AliHMPIDDigit::kMinPc;iPc<=AliHMPIDDigit::kMaxPc;iPc++)
#define AliHMPIDDigitizer_h
/* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
+//
-
+#include <AliRun.h>
#include <AliDigitizer.h>
-#include "AliHMPIDDigit.h"
class AliRunDigitizer;
class TClonesArray;
class TObjArray;
AliHMPIDDigitizer(AliRunDigitizer *pRunDig):AliDigitizer(pRunDig) {}
virtual ~AliHMPIDDigitizer() {}
void Exec(Option_t* option=0); //virtual
- void DoNoise(Bool_t doNoise) {fDoNoise=doNoise;} // Set noise or not
+ void DoNoise(Bool_t doNoise) {fgDoNoise=doNoise;} // Set noise or not
//
static void Sdi2Dig(TClonesArray *pSDigLst,TObjArray *pDigLst);
protected:
- static Bool_t fDoNoise;
+ static Bool_t fgDoNoise; // flag to switch off/on noise
ClassDef(AliHMPIDDigitizer,0)
};
#include "AliHMPIDCluster.h" //Dig2Clu()
#include "AliHMPIDParam.h" //FillEsd()
#include <AliESD.h> //FillEsd()
-#include <AliRunLoader.h> //Reconstruct() for simulated digits
#include <AliRawReader.h> //Reconstruct() for raw digits
-#include <AliRun.h> //Reconstruct()
ClassImp(AliHMPIDReconstructor)
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+AliHMPIDReconstructor::AliHMPIDReconstructor():AliReconstructor()
+{
+//
+//ctor
+//
+ fClu=new TObjArray(AliHMPIDDigit::kMaxCh+1);
+ fDig=new TObjArray(AliHMPIDDigit::kMaxCh+1);
+ fClu->SetOwner(kTRUE);
+ for(int i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++){
+ fDig->AddAt(new TClonesArray("AliHMPIDDigit"),i);
+ fClu->AddAt(new TClonesArray("AliHMPIDCluster"),i);
+ }
+ fDig->SetOwner(kTRUE);
+}//AliHMPIDReconstructor
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void AliHMPIDReconstructor::Dig2Clu(TObjArray *pDigAll,TObjArray *pCluAll,Bool_t isTryUnfold)
{
}//neighbours loop
}//FormClu()
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDReconstructor::Reconstruct(AliRunLoader *pAL)const
+void AliHMPIDReconstructor::Reconstruct(TTree *pDigTree,TTree *pCluTree)const
{
//Invoked by AliReconstruction to convert digits to clusters i.e. reconstruct simulated data
-//Arguments: pAL - ALICE run loader pointer
+//Arguments: pDigTree - pointer to Digit tree
+// pCluTree - poitner to Cluster tree
// Returns: none
AliDebug(1,"Start.");
- AliLoader *pRL=pAL->GetDetectorLoader("HMPID");
- AliHMPID *pRich=(AliHMPID*)pAL->GetAliRun()->GetDetector("HMPID");//get pointers for HMPID and HMPID loader
- pRL->LoadDigits();
- pRL->LoadRecPoints("recreate");
+ for(Int_t iCh=AliHMPIDDigit::kMinCh;iCh<=AliHMPIDDigit::kMaxCh;iCh++) {
+ pCluTree->Branch(Form("HMPID%d",iCh),&((*fClu)[iCh]),4000,0);
+ pDigTree->SetBranchAddress(Form("HMPID%d",iCh),&((*fDig)[iCh]));
+ }
+ pDigTree->GetEntry(0);
+ Dig2Clu(fDig,fClu); //cluster finder
+ pCluTree->Fill(); //fill tree for current event
+
+ for(Int_t iCh=AliHMPIDDigit::kMinCh;iCh<=AliHMPIDDigit::kMaxCh;iCh++){
+ fDig->At(iCh)->Clear();
+ fClu->At(iCh)->Clear();
+ }
- for(Int_t iEvtN=0;iEvtN<pAL->GetNumberOfEvents();iEvtN++){//events loop
- pAL->GetEvent(iEvtN); AliDebug(1,Form("Processing event %i...",iEvtN)); //switch current directory to next event
- pRL->TreeD()->GetEntry(0); pRL->MakeTree("R"); pRich->MakeBranch("R"); //load digits to memory and create branches for clusters
-
- Dig2Clu(pRich->DigLst(),pRich->CluLst());//cluster finder
-
- pRL->TreeR()->Fill(); //fill tree for current event
- pRL->WriteRecPoints("OVERWRITE");//write out clusters for current event
- pRich->DigReset(); pRich->CluReset();
- }//events loop
-
- pRL->UnloadDigits();
- pRL->UnloadRecPoints();
-
AliDebug(1,"Stop.");
}//Reconstruct(for simulated digits)
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
{
//Invoked by AliReconstruction to convert raw digits from DDL files to clusters
//Arguments: pAL - ALICE run loader pointer
-// pRR - ALICE raw reader pointer
-// Returns: none
+// pRR - ALICE raw reader pointer
+// Returns: none
AliLoader *pRL=pAL->GetDetectorLoader("HMPID"); AliHMPID *pRich=(AliHMPID*)pAL->GetAliRun()->GetDetector("HMPID");//get pointers for HMPID and HMPID loader
-
+
AliHMPIDDigit dig; //tmp digit, raw digit will be converted to it
-
- TObjArray digLst; Int_t iDigCnt[7]; for(Int_t i=0;i<7;i++){digLst.AddAt(new TClonesArray("AliHMPIDDigit"),i); iDigCnt[i]=0;} //tmp list of digits for all chambers
-
+
+ TObjArray digLst; Int_t iDigCnt[7]; for(Int_t i=0;i<7;i++){digLst.AddAt(new TClonesArray("AliHMPIDDigit"),i); iDigCnt[i]=0;} //tmp list of digits for allchambers
+
Int_t iEvtN=0;
while(pRR->NextEvent()){//events loop
pAL->GetEvent(iEvtN++);
pRL->MakeTree("R"); pRich->MakeBranch("R");
-
+
for(Int_t iCh=0;iCh<7;iCh++){//chambers loop
- pRR->Select("HMPID",2*iCh,2*iCh+1);//select only DDL files for the current chamber
+ pRR->Select("HMPID",2*iCh,2*iCh+1);//select only DDL files for the current chamber
UInt_t w32=0;
while(pRR->ReadNextInt(w32)){//raw records loop (in selected DDL files)
UInt_t ddl=pRR->GetDDLID(); //returns 0,1,2 ... 13
- dig.Raw(w32,ddl);
+ dig.Raw(w32,ddl);
AliDebug(1,Form("Ch=%i DDL=%i raw=0x%x digit=(%3i,%3i,%3i,%3i) Q=%5.2f",iCh,ddl,w32,dig.Ch(),dig.Pc(),dig.PadPcX(),dig.PadPcY(),dig.Q()));
new((*((TClonesArray*)digLst.At(iCh)))[iDigCnt[iCh]++]) AliHMPIDDigit(dig); //add this digit to the tmp list
}//raw records loop
- pRR->Reset();
+ pRR->Reset();
}//chambers loop
-
+
Dig2Clu(&digLst,pRich->CluLst());//cluster finder for all chambers
for(Int_t i=0;i<7;i++){digLst.At(i)->Delete(); iDigCnt[i]=0;} //clean up list of digits for all chambers
-
+
pRL->TreeR()->Fill(); //fill tree for current event
pRL->WriteRecPoints("OVERWRITE");//write out clusters for current event
pRich->CluReset();
- }//events loop
- pRL->UnloadRecPoints();
+ }//events loop
+ pRL->UnloadRecPoints();
}//Reconstruct raw data
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void AliHMPIDReconstructor::ConvertDigits(AliRawReader *pRR,TTree *pDigTree)const
+{
+//Invoked by AliReconstruction to convert raw digits from DDL files to digits
+//Arguments: pRR - ALICE raw reader pointer
+// pDigTree - pointer to Digit tree
+// Returns: none
+ AliDebug(1,"Start.");
+ AliHMPIDDigit dig; //tmp digit, raw digit will be converted to it
+ for(Int_t iCh=AliHMPIDDigit::kMinCh;iCh<=AliHMPIDDigit::kMaxCh;iCh++) {
+ pDigTree->Branch(Form("HMPID%d",iCh),&((*fDig)[iCh]),4000,0);
+ pRR->Select("HMPID",2*iCh,2*iCh+1);//select only DDL files for the current chamber
+ Int_t iDigCnt=0;
+ UInt_t w32=0;
+ while(pRR->ReadNextInt(w32)){//raw records loop (in selected DDL files)
+ UInt_t ddl=pRR->GetDDLID(); //returns 0,1,2 ... 13
+ dig.Raw(w32,ddl);
+ AliDebug(1,Form("Ch=%i DDL=%i raw=0x%x digit=(%3i,%3i,%3i,%3i) Q=%5.2f",iCh,ddl,w32,dig.Ch(),dig.Pc(),dig.PadPcX(),dig.PadPcY(),dig.Q()));
+ new((*((TClonesArray*)fDig->At(iCh)))[iDigCnt++]) AliHMPIDDigit(dig); //add this digit to the tmp list
+ }//raw records loop
+ pRR->Reset();
+ }//chambers loop
+ pDigTree->Fill();
+ for(Int_t iCh=AliHMPIDDigit::kMinCh;iCh<=AliHMPIDDigit::kMaxCh;iCh++)fDig->At(iCh)->Clear();
+ AliDebug(1,"Stop.");
+}//Reconstruct digits from raw digits
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void AliHMPIDReconstructor::FillESD(AliRunLoader *, AliESD *pESD) const
{
// Calculates probability to be a electron-muon-pion-kaon-proton
class AliHMPIDReconstructor: public AliReconstructor
{
public:
- AliHMPIDReconstructor(): AliReconstructor() {}//default ctor
- virtual ~AliHMPIDReconstructor() {}//dtor
+ AliHMPIDReconstructor();
+ virtual ~AliHMPIDReconstructor() {delete fDig;delete fClu;}//dtor
//framework part
AliTracker* CreateTracker (AliRunLoader* )const{return new AliHMPIDTracker;} //from AliReconstructor for clusters->PID
- void Reconstruct (AliRunLoader* pAL )const; //from AliReconstruction for digits->clusters
- void Reconstruct (AliRunLoader* pAL,AliRawReader *pRR)const; //from AliReconstruction for raws->clusters
- virtual void FillESD (AliRunLoader* pAL,AliESD *pESD)const; //calculate pid for HMPID
- virtual void FillESD(AliRunLoader*, AliRawReader*, AliESD*) const { };
- virtual void FillESD(AliRawReader*, TTree*, AliESD*) const { };
- virtual void FillESD(TTree*, TTree*, AliESD*) const { };
-
+ void ConvertDigits (AliRawReader *pRR, TTree *pDigTree) const; //from AliReconstruction for raw->digit
+ Bool_t HasDigitConversion() const {return kTRUE;} //HMPID digits converted with ConvertDigits
+ void Reconstruct (TTree* digitsTree, TTree* clustersTree) const; //from AliReconstruction for digit->cluster
+ void Reconstruct (AliRunLoader *pAL,AliRawReader* pRR)const; //from AliReconstruction for raw->cluster with Digits on fly
+ Bool_t HasLocalReconstruction() const {return kTRUE;} // HMPID has local reconstruction algorithm
+ void FillESD (AliRunLoader* pAL,AliESD *pESD)const; //calculate pid for HMPID
- using AliReconstructor::Reconstruct; //to get rid of virtual hidden warning
+ using AliReconstructor::FillESD; //
+ using AliReconstructor::Reconstruct; //
//private part
static void Dig2Clu (TObjArray *pDigLst,TObjArray *pCluLst,Bool_t isUnfold=kTRUE );//digits->clusters
static inline AliHMPIDDigit* UseDig (Int_t padX,Int_t padY, TClonesArray *pDigLst,TMatrixF *pDigMap);//use this pad's digit to form a cluster
protected:
+ TObjArray *fDig; // tmp list of digits
+ TObjArray *fClu; // tmp list of clusters
ClassDef(AliHMPIDReconstructor, 0) //class for the HMPID reconstruction
};
#include <AliCDBEntry.h>
ClassImp(AliHMPIDTracker)
-
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+AliHMPIDTracker::AliHMPIDTracker():AliTracker()
+{
+// ctor
+ fClu=new TObjArray(AliHMPIDDigit::kMaxCh+1);
+ fClu->SetOwner(kTRUE);
+ for(int i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++) fClu->AddAt(new TClonesArray("AliHMPIDCluster"),i);
+}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Bool_t AliHMPIDTracker::GetTrackPoint(Int_t idx, AliTrackPoint& point) const
{
Int_t iCham=idx/1000000;
Int_t iClu=idx%1000000;
point.SetVolumeID(AliAlignObj::LayerToVolUID(AliAlignObj::kHMPID,iCham-1));//layer and chamber number
- AliHMPID *pRich=((AliHMPID*)gAlice->GetDetector("HMPID"));
- AliHMPIDCluster *pClu=(AliHMPIDCluster*)pRich->CluLst(iCham)->UncheckedAt(iClu);//get pointer to cluster
+ TClonesArray *pArr=(TClonesArray*)(*fClu)[iCham];
+ AliHMPIDCluster *pClu=(AliHMPIDCluster*)pArr->UncheckedAt(iClu);//get pointer to cluster
Double_t mars[3];
AliHMPIDParam::Instance()->Lors2Mars(iCham,pClu->X(),pClu->Y(),mars);
point.SetXYZ(mars[0],mars[1],mars[2]);
// Interface callback methode invoked from AliReconstruction::RunTracking() to load HMPID clusters before PropagateBack() gets control
// Arguments: pCluTree- pointer to clusters tree got by AliHMPIDLoader::LoadRecPoints("read") then AliHMPIDLoader::TreeR()
// Returns: error code (currently ignored in AliReconstruction::RunTraking())
- AliDebug(1,"Start."); pCluTree->GetEntry(0); AliDebug(1,"Stop."); return 0;
+ AliDebug(1,"Start.");
+ for(int i=AliHMPIDDigit::kMinCh;i<=AliHMPIDDigit::kMaxCh;i++) pCluTree->SetBranchAddress(Form("HMPID%d",i),&((*fClu)[i]));
+ pCluTree->GetEntry(0);
+ AliDebug(1,"Stop.");
+ return 0;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Int_t AliHMPIDTracker::PropagateBack(AliESD *pEsd)
AliCDBEntry *pQthreEnt =AliCDBManager::Instance()->Get("HMPID/Calib/Qthre",pEsd->GetRunNumber()); //contains TObjArray of 7 TF1
if(!pNmeanEnt) AliFatal("No Nmean C6F14 ");
if(!pQthreEnt) AliFatal("No Qthre");
-
+
AliHMPID *pHmpid=((AliHMPID*)gAlice->GetDetector("HMPID"));
return Recon(pEsd,pHmpid->CluLst(),(TObjArray*)pNmeanEnt->GetObject());
}
class AliHMPIDTracker : public AliTracker
{
public:
- AliHMPIDTracker():AliTracker() {}
- virtual ~AliHMPIDTracker() {}
+ AliHMPIDTracker();
+ virtual ~AliHMPIDTracker() {delete fClu;}
//framework part
AliCluster *GetCluster (Int_t )const {return 0;} //pure virtual from AliTracker
Bool_t GetTrackPoint (Int_t idx,AliTrackPoint &pt)const; // from AliTracker
static Int_t IntTrkCha(AliESDtrack *pTrk,Double_t &xPc,Double_t &yPc); //find track-PC intersection, retuns chamber ID
static Int_t Recon (AliESD *pEsd,TObjArray *pCluAll,TObjArray *pNmean=0); //do actual job, returns status code
protected:
- ClassDef(AliHMPIDTracker,0)
+ TObjArray *fClu; //! each chamber holds it's one list of clusters
+
+ClassDef(AliHMPIDTracker,0)
};//class AliHMPIDTracker
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
case 3: fprintf(pF," AliGenFixed *pG3=new AliGenFixed(1); pG3->SetPart(%i); pG3->SetMomentum(%.1f);\n",pid,pmin);
fprintf(pF," pG3->SetTheta(109.5); pG3->SetPhi(30); pG->AddGenerator(pG3,\"g3\",1);\n"); break;
case 4: fprintf(pF," AliGenFixed *pG4=new AliGenFixed(1); pG4->SetPart(%i); pG4->SetMomentum(%.1f);\n",pid,pmin);
- fprintf(pF," pG4->SetTheta( 90.0); pG4->SetPhi(30); pG->AddGenerator(pG4,\"g4\",1);\n"); break;
+ fprintf(pF," pG4->SetTheta( 87.0); pG4->SetPhi(30); pG->AddGenerator(pG4,\"g4\",1);\n"); break;
case 5: fprintf(pF," AliGenFixed *pG5=new AliGenFixed(1); pG5->SetPart(%i); pG5->SetMomentum(%.1f);\n",pid,pmin);
fprintf(pF," pG5->SetTheta( 70.5); pG5->SetPhi(30); pG->AddGenerator(pG5,\"g5\",1);\n"); break;
case 6: fprintf(pF," AliGenFixed *pG6=new AliGenFixed(1); pG6->SetPart(%i); pG6->SetMomentum(%.1f);\n",pid,pmin);