#include "Riostream.h"
#include "AliITSReconstructor.h"
#include "AliRun.h"
-#include "AliRunLoader.h"
#include "AliRawReader.h"
#include "AliITSDetTypeRec.h"
+#include "AliITSgeom.h"
#include "AliITSLoader.h"
#include "AliITStrackerMI.h"
#include "AliITStrackerV2.h"
ClassImp(AliITSReconstructor)
-
-AliITSRecoParam *AliITSReconstructor::fgkRecoParam =0; // reconstruction parameters
+AliITSRecoParam *AliITSReconstructor::fgRecoParamDefault = AliITSRecoParam::GetHighFluxParam();
+AliITSRecoParam *AliITSReconstructor::fgRecoParam =0; // reconstruction parameters
//___________________________________________________________________________
AliITSReconstructor::AliITSReconstructor() : AliReconstructor(),
-fItsPID(0)
+fItsPID(0),
+fDetTypeRec(0)
{
// Default constructor
- if (!fgkRecoParam) {
- AliError("The Reconstruction parameters nonitialized - Used default one");
- fgkRecoParam = AliITSRecoParam::GetHighFluxParam();
+ if (!fgRecoParam) {
+ AliWarning("Using default reconstruction parameters");
+ fgRecoParam = fgRecoParamDefault;
}
}
//___________________________________________________________________________
AliITSReconstructor::~AliITSReconstructor(){
// destructor
delete fItsPID;
- if(fgkRecoParam) delete fgkRecoParam;
+ if(!fgRecoParam && (fgRecoParam != fgRecoParamDefault)) delete fgRecoParam;
+ if(fDetTypeRec) delete fDetTypeRec;
}
//______________________________________________________________________
AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob),
- fItsPID(ob.fItsPID)
+fItsPID(ob.fItsPID),
+fDetTypeRec(ob.fDetTypeRec)
+
{
// Copy constructor
}
new(this) AliITSReconstructor(ob);
return *this;
}
+
//______________________________________________________________________
-void AliITSReconstructor::Init(AliRunLoader *runLoader) const{
+void AliITSReconstructor::Init() {
// Initalize this constructor bet getting/creating the objects
// nesseary for a proper ITS reconstruction.
// Inputs:
- // AliRunLoader *runLoader Pointer to the run loader to allow
- // the getting of files/folders data
- // needed to do reconstruction
+ // none.
// Output:
// none.
// Return:
AliITSInitGeometry initgeom;
AliITSgeom *geom = initgeom.CreateAliITSgeom();
AliInfo(Form("Geometry name: %s",(initgeom.GetGeometryName()).Data()));
- AliITSLoader* loader = static_cast<AliITSLoader*>
- (runLoader->GetLoader("ITSLoader"));
- if (!loader) {
- Error("Init", "ITS loader not found");
- return;
- }
- loader->SetITSgeom(geom);
+
+ fDetTypeRec = new AliITSDetTypeRec();
+ fDetTypeRec->SetITSgeom(geom);
+ fDetTypeRec->SetDefaults();
+
return;
}
+
//_____________________________________________________________________________
-void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const
+void AliITSReconstructor::Reconstruct(TTree *digitsTree, TTree *clustersTree) const
{
// reconstruct clusters
-
- AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
- if (!loader) {
- Error("Reconstruct", "ITS loader not found");
- return;
- }
- AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
- rec->SetDefaults();
-
- loader->LoadRecPoints("recreate");
- loader->LoadDigits("read");
- runLoader->LoadKinematics();
TString option = GetOption();
Bool_t clusfinder=kTRUE; // Default: V2 cluster finder
if(option.Contains("OrigCF"))clusfinder=kFALSE;
- Int_t nEvents = runLoader->GetNumberOfEvents();
-
- for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
- runLoader->GetEvent(iEvent);
- if(loader->TreeR()==0x0) loader->MakeTree("R");
- rec->MakeBranch("R");
- rec->SetTreeAddress();
- rec->DigitsToRecPoints(iEvent,0,"All",clusfinder);
- }
-
- loader->UnloadRecPoints();
- loader->UnloadDigits();
- runLoader->UnloadKinematics();
+ fDetTypeRec->SetTreeAddressD(digitsTree);
+ fDetTypeRec->MakeBranch(clustersTree,"R");
+ fDetTypeRec->SetTreeAddressR(clustersTree);
+ fDetTypeRec->DigitsToRecPoints(digitsTree,clustersTree,0,"All",clusfinder);
}
//_________________________________________________________________
-void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader,
- AliRawReader* rawReader) const
+void AliITSReconstructor::Reconstruct(AliRawReader* rawReader, TTree *clustersTree) const
{
-// reconstruct clusters
-
+ // reconstruct clusters from raw data
- AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
- if (!loader) {
- Error("Reconstruct", "ITS loader not found");
- return;
- }
-
- AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
- rec->SetDefaults();
- rec->SetDefaultClusterFindersV2(kTRUE);
-
- loader->LoadRecPoints("recreate");
-
- Int_t iEvent = 0;
-
- while(rawReader->NextEvent()) {
- runLoader->GetEvent(iEvent++);
- if(loader->TreeR()==0x0) loader->MakeTree("R");
- rec->DigitsToRecPoints(rawReader);
- }
-
- loader->UnloadRecPoints();
+ fDetTypeRec->SetDefaultClusterFindersV2(kTRUE);
+ fDetTypeRec->DigitsToRecPoints(rawReader,clustersTree);
}
//_____________________________________________________________________________
-AliTracker* AliITSReconstructor::CreateTracker(AliRunLoader* runLoader)const
+AliTracker* AliITSReconstructor::CreateTracker() const
{
// create a ITS tracker
AliITStrackerSA *sat=(AliITStrackerSA*)tracker;
if(selectedTracker.Contains("onlyITS"))sat->SetSAFlag(kTRUE);
if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
+ if(selectedTracker.Contains("cosmics")||selectedTracker.Contains("COSMICS"))
+ sat->SetOuterStartLayer(AliITSgeomTGeo::GetNLayers()-2);
}
TString selectedPIDmethod = GetOption();
- AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
- if (!loader) {
- Error("CreateTracker", "ITS loader not found");
- }
+ AliITSReconstructor* nc = const_cast<AliITSReconstructor*>(this);
if(selectedPIDmethod.Contains("LandauFitPID")){
- loader->AdoptITSpid(new AliITSpidESD2((AliITStrackerMI*)tracker,loader));
+ Info("FillESD","ITS LandauFitPID option has been selected\n");
+ nc->fItsPID = new AliITSpidESD2((AliITStrackerMI*)tracker);
}
else{
- Double_t parITS[] = {0.15, 10.}; //PH positions of the MIP peak
- loader->AdoptITSpid(new AliITSpidESD1(parITS));
+ Info("FillESD","ITS default PID\n");
+ Double_t parITS[] = {79.,0.13, 5.}; //IB: this is "pp tuning"
+ nc->fItsPID = new AliITSpidESD1(parITS);
}
+
return tracker;
}
//_____________________________________________________________________________
-AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) const
+AliVertexer* AliITSReconstructor::CreateVertexer() const
{
// create a ITS vertexer
}
//_____________________________________________________________________________
-void AliITSReconstructor::FillESD(AliRunLoader* runLoader,
+void AliITSReconstructor::FillESD(TTree * /*digitsTree*/, TTree *clustersTree,
AliESDEvent* esd) const
{
// make PID, find V0s and cascade
- AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
- AliITSpidESD *pidESD = 0;
- TString selectedPIDmethod = GetOption();
- if(selectedPIDmethod.Contains("LandauFitPID")){
- Info("FillESD","ITS LandauFitPID option has been selected\n");
- pidESD=loader->GetITSpid();
- }
- else{
- Info("FillESD","ITS default PID\n");
- pidESD=loader->GetITSpid();
- }
- if(pidESD!=0){
- pidESD->MakePID(esd);
+ if(fItsPID!=0) {
+ TString selectedPIDmethod = GetOption();
+ if(selectedPIDmethod.Contains("LandauFitPID")){
+ fItsPID->MakePID(clustersTree,esd);
+ }
+ else{
+ fItsPID->MakePID(esd);
+ }
}
else {
Error("FillESD","!! cannot do the PID !!\n");
}
}
-
-
-//_____________________________________________________________________________
-AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const
-{
-// get the ITS geometry
-
- if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
- if (!runLoader->GetAliRun()) {
- Error("GetITSgeom", "couldn't get AliRun object");
- return NULL;
- }
- AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
- AliITSgeom* geom = (AliITSgeom*)loader->GetITSgeom();
- if(!geom){
- Error("GetITSgeom","no ITS geometry available");
- return NULL;
- }
-
- return geom;
-}