#include "AliLoader.h"
#include "AliRun.h"
#include "AliSTART.h"
+#include "AliSTARTLoader.h"
#include "AliSTARTdigit.h"
#include "AliSTARThit.h"
#include "AliSTARThitPhoton.h"
}
+//______________________________________________________________________
+AliLoader* AliSTART::MakeLoader(const char* topfoldername)
+{
+ Info("MakeLoader", "Creating AliSTARTLoader. Top folder is %s.", topfoldername);
+ fLoader = new AliSTARTLoader(GetName(), topfoldername);
+ return fLoader;
+}
+
//_____________________________________________________________________________
AliDigitizer* AliSTART::CreateDigitizer(AliRunDigitizer* manager) const
{
return new AliSTARTDigitizer(manager);
}
+//_____________________________________________________________________________
+void AliSTART::FillESD(AliESD* pESD) const
+{
+ AliSTARTvertex reco;
+ reco.Reconstruct(fLoader->GetRunLoader(), pESD);
+}
+
virtual void StepManager(){}
virtual void ResetHits();
virtual void SetTreeAddress();
+ virtual AliLoader* MakeLoader(const char* topfoldername);
TClonesArray *Photons() {return fPhotons;}
virtual AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const;
// virtual void Reconstruct() const{ AliSTARTvertex reco; reco.Reconstruct();}
- virtual void FillESD(AliESD* pESD) const{ AliSTARTvertex reco; reco.Reconstruct(pESD);}
+ virtual void FillESD(AliESD* pESD) const;
protected:
Int_t fIdSens; // Sensetive Cherenkov radiator
// Int_t thresholdAmpl=10;
- inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0));
-
-
- AliSTART *fSTART = (AliSTART*) inRL->GetAliRun()->GetDetector("START");
AliSTARThit *startHit;
TBranch *brHits=0;
TBranch *brHitPhoton=0;
+ pOutStartLoader->LoadDigits("UPDATE");//probably it is necessary to load them before
fdigits= new AliSTARTdigit();
+ pOutStartLoader->GetDigitsDataLoader()->GetBaseLoader(0)->Post(fdigits);
Int_t nFiles=fManager->GetNinputs();
for (Int_t inputFile=0; inputFile<nFiles; inputFile++) {
+ if (inputFile < nFiles-1) {
+ Warning("Exec", "ignoring input stream %d", inputFile);
+ continue;
+ }
Float_t besttimeright=9999.;
Float_t besttimeleft=9999.;
}
inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile));
+ if (!inRL->GetAliRun()) inRL->LoadgAlice();
+ AliSTART *fSTART = (AliSTART*) inRL->GetAliRun()->GetDetector("START");
pInStartLoader = inRL->GetLoader("STARTLoader");
pInStartLoader->LoadHits("READ");//probably it is necessary to load them before
- pOutStartLoader->LoadDigits("UPDATE");//probably it is necessary to load them before
TClonesArray *fHits = fSTART->Hits ();
TTree *th = pInStartLoader->TreeH();
else
{timeAv=999999; timeDiff=99999;}
-// trick to find out output dir:
-
- TDirectory *wd = gDirectory;
- pOutStartLoader->GetDigitsDataLoader()->GetDirectory()->cd();
- fdigits->Write("START_D");
- wd->cd();
pInStartLoader->UnloadHits();
- pOutStartLoader->UnloadDigits();
- } //event loop
+ } //input streams loop
+
+ pOutStartLoader->WriteDigits("OVERWRITE");
+ pOutStartLoader->UnloadDigits();
}
// and evrtex position (cm) //
/////////////////////////////////////////////////////////////////////////////
#include "AliSTARTLoader.h"
-#include <AliRunLoader.h>
-#include "AliDataLoader.h"
-
-#include <TTree.h>
-#include <TFile.h>
-
-#include <stdlib.h>
-#include <Riostream.h>
-#include <Riostream.h>
+#include "AliConfig.h"
+#include "AliRunLoader.h"
ClassImp(AliSTARTLoader)
/*****************************************************************************/
-AliSTARTLoader::AliSTARTLoader(const Char_t *name,const Char_t *topfoldername):
- AliLoader(name,topfoldername)
-
+void AliSTARTLoader::InitObjectLoaders()
{
-//ctor
- cout<<" AliSTARTLoader "<<endl;
-
-
-
+// use an object instead of a tree for digits and rec points
+
+ // D I G I T S
+ if (fDataLoaders->At(kDigits)) {
+ delete fDataLoaders->Remove(fDataLoaders->At(kDigits));
+ }
+ AliDataLoader* dl = new AliDataLoader(fDetectorName + ".Digits.root","START_D", "Digits","O");//we want to have object data not tree
+ AliTaskLoader* tl = new AliTaskLoader(fDetectorName + AliConfig::Instance()->GetDigitizerTaskName(),dl,AliRunLoader::GetRunDigitizer(),kTRUE);
+ dl->SetBaseTaskLoader(tl);
+ fDataLoaders->AddAt(dl,kDigits);
+
+ // R E C O N S T R U C T E D P O I N T S, here: V E R T E X
+ if (fDataLoaders->At(kRecPoints)) {
+ delete fDataLoaders->Remove(fDataLoaders->At(kRecPoints));
+ }
+ dl = new AliDataLoader(fDetectorName + ".RecPoints.root","START_V", "Reconstructed Points","O");//we want to have object data not tree
+ tl = new AliTaskLoader(fDetectorName + AliConfig::Instance()->GetReconstructionerTaskName(),dl,AliRunLoader::GetRunReconstructioner(),kTRUE);
+ dl->SetBaseTaskLoader(tl);
+ fDataLoaders->AddAt(dl,kRecPoints);
}
-/*****************************************************************************/
-
-AliSTARTLoader::AliSTARTLoader(const Char_t *name,TFolder *topfolder):
- AliLoader(name,topfolder)
-{
-//ctor
-
- cout<<" My AliSTARTLoader!!!!! "<<endl;
-
-
-}
-/*****************************************************************************/
-AliSTARTLoader::~AliSTARTLoader()
-{
- //destructor
- UnloadDigits();
- fDataLoaders->Remove(&fDigitsDataLoader);
-
- UnloadRecPoints();
- fDataLoaders->Remove(&fVertexDataLoader);
-
-
-}
-
#ifndef ALISTARTLOADER_H
#define ALISTARTLOADER_H
-#include <AliLoader.h>
-#include "AliDataLoader.h"
-#include "AliSTARTdigit.h"
-#include "AliSTARTvertex.h"
-class AliSTART;
-class AliSTARTLoader: public AliLoader
- {
+#include "AliLoader.h"
+
+class AliSTARTdigit;
+
+
+class AliSTARTLoader: public AliLoader {
public:
- AliSTARTLoader(){};
- AliSTARTLoader(const Char_t *name,const Char_t *topfoldername);
- AliSTARTLoader(const Char_t *name,TFolder *topfolder);
-
- virtual ~AliSTARTLoader();
+ AliSTARTLoader() : AliLoader() {};
+ AliSTARTLoader(const Char_t *detname,const Char_t *eventfoldername) :
+ AliLoader(detname, eventfoldername) {InitObjectLoaders();};
+ AliSTARTLoader(const Char_t *detname,TFolder* eventfolder) :
+ AliLoader(detname, eventfolder) {InitObjectLoaders();};
+
// Digits
- virtual void CleanDigits() {fDigitsDataLoader.GetBaseDataLoader()->Clean();}
- Int_t LoadDigits(Option_t* opt=""){return fDigitsDataLoader.GetBaseDataLoader()->Load(opt);}
-
- void UnloadDigits(){fDigitsDataLoader.GetBaseDataLoader()->Unload();}
- virtual Int_t WriteDigits(Option_t* opt=""){return fDigitsDataLoader.GetBaseDataLoader()->WriteData(opt);}
- virtual Int_t PostDigits(AliSTARTdigit *dgt){return fDigitsDataLoader.GetBaseDataLoader()->Post(dgt);}
-
- TObject* Digits(){ return fDigitsDataLoader.GetBaseDataLoader()->Get();} // returns a pointer to the tree of RawClusters
-
-
- //Vertices
- virtual void CleanRecPoints() {fVertexDataLoader.GetBaseDataLoader()->Clean();}
- Int_t LoadRecPoints(Option_t* opt=""){return fVertexDataLoader.GetBaseDataLoader()->Load(opt);}
- void UnloadRecPoints(){fVertexDataLoader.GetBaseDataLoader()->Unload();}
- virtual Int_t WriteRecPoints(Option_t* opt=""){return fVertexDataLoader.GetBaseDataLoader()->WriteData(opt);}
- // AliSTARTVertex *GetVertex(){return static_cast <AliSTARTVertex*>(fVertexDataLoader.GetBaseDataLoader()->Get());}
- virtual Int_t PostRecPoints(AliSTARTvertex *vrt){return fVertexDataLoader.GetBaseDataLoader()->Post(vrt);}
- // TObject* Vertex(){ return fVertexDataLoader.GetBaseDataLoader()->Get();} // returns a pointer to the tree of RawClusters
-
- protected:
- // methods
-
- Int_t PostDigits(){return fDigitsDataLoader.GetBaseDataLoader()->Post();}
- Int_t PostRecPoints(){return fVertexDataLoader.GetBaseDataLoader()->Post();}
-
-
- // DATA
- AliDataLoader fDigitsDataLoader; //digits loader
-
- AliDataLoader fVertexDataLoader; // RecPoints (vertex position) loader
-
- public:
+ AliSTARTdigit* Digits(){ return (AliSTARTdigit*) GetDigitsDataLoader()->GetBaseDataLoader()->Get();} // returns a pointer to the tree of RawClusters
+
+ private:
+ void InitObjectLoaders();
+
ClassDef(AliSTARTLoader,1)
- };
+};
#endif
virtual void SetADCLeft (TArrayI &o);
virtual void GetADCRight (TArrayI &o);
virtual void GetADCLeft (TArrayI &o);
+ virtual const char* GetName() const {return "START_D";}
private:
// Float_t fProcessKoef; // for pp fProcessKoef=1 ; for Pb-Pb - 0.001
Int_t fTimeAverage; // Average time
#include <AliRun.h>
#include <AliRunLoader.h>
#include "AliSTART.h"
+#include "AliSTARTLoader.h"
#include "AliSTARTdigit.h"
#include "AliSTARThit.h"
#include "AliSTARTvertex.h"
ClassImp(AliSTARTvertex)
-AliSTARTvertex::AliSTARTvertex( Int_t * Zposit)
-{
- //
- // The creator for the AliSTARTvertex class. This routine fills the
- // AliSTARTvertex data members from the array vertex.
- // The order of the elements in the vertex array are
- // fZposition = vertex[0],
- //
-
- Zposit = &fZposition ;
-}
-
-void AliSTARTvertex::Reconstruct(AliESD *pESD)
+void AliSTARTvertex::Reconstruct(AliRunLoader* rl, AliESD *pESD)
{
/***************************************************
Resonstruct digits to vertex position
Int_t timediff;
Float_t timePs;
-
- AliRunLoader* rl = AliRunLoader::Open("galice.root");
- //,AliConfig::fgkDefaultEventFolderName,"read");
- if (rl == 0x0)
- {
- cerr<<"Can not open session for file galice.root\n";
- return;
- }
-
-#ifdef DEBUG
- Info("Reconstruct","START!!!");
-#endif
- AliLoader* pStartLoader = rl->GetLoader("STARTLoader");
-
- // Event ------------------------- LOOP
-
+ if (!rl) {
+ Error("Reconstruct", "No run loader");
+ return;
+ }
- Int_t iNevents=rl->GetNumberOfEvents();
-
- for (Int_t evNumber=0; evNumber<iNevents; evNumber++)
- {
- rl->GetEvent(evNumber);
- pStartLoader ->LoadDigits("READ");
-
-#ifdef DEBUG
- gDirectory->ls();
-#endif
- AliSTARTdigit* pDigits=(AliSTARTdigit*)gDirectory->Get("START_D");
-
-#ifdef DEBUG
- pDigits->Dump();
-#endif
- if(pDigits->GetTimeDiff()<TMath::Abs(1000))
- {
- timediff=pDigits->GetTimeDiff(); //time in number of channels
- timePs=(512-timediff)*2.5; // time in Ps channel_width =10ps
- // Float_t c = 299792458/1.e9; //speed of light cm/ps
- Float_t c = 0.3; //speed of light mm/ps
- Float_t Zposit=timePs*c;// for 0 vertex
-#ifdef DEBUG
- cout<<"timediff "<< timediff<<" timePs "<<timePs<<" Zposit "<<Zposit<<endl;
-#endif
- pESD->SetT0zVertex(Zposit);
-
-#ifdef DEBUG
- cout<<" vertex in ESD "<< pESD->GetT0zVertex()<<endl;
-#endif
- } // vertex in 3 sigma
-
- } //event loop
+ if (rl->GetDebug()>1) Info("Reconstruct","START!!!");
+
+ AliSTARTLoader* pStartLoader = (AliSTARTLoader*) rl->GetLoader("STARTLoader");
+
+ pStartLoader->LoadDigits();
+ AliSTARTdigit* pDigits=pStartLoader->Digits();
+ if (!pDigits) {
+ Error("Reconstruct", "no digits found");
+ return;
+ }
+
+ if (rl->GetDebug()>1) pDigits->Dump();
+
+ if(pDigits->GetTimeDiff()<TMath::Abs(1000)) {
+ timediff=pDigits->GetTimeDiff(); //time in number of channels
+ timePs=(512-timediff)*2.5; // time in Ps channel_width =10ps
+ // Float_t c = 299792458/1.e9; //speed of light cm/ps
+ Float_t c = 0.3; //speed of light mm/ps
+ Float_t Zposit=timePs*c;// for 0 vertex
+
+ if (rl->GetDebug()>1) {
+ cout << "timediff " << timediff
+ <<" timePs " << timePs
+ <<" Zposit "<<Zposit<<endl;
+ }
+
+ fZposition = Zposit;
+ pESD->SetT0zVertex(Zposit);
+
+ if (rl->GetDebug()>1) {
+ cout<<" vertex in ESD "<< pESD->GetT0zVertex()<<endl;
+ }
+
+ } // vertex in 3 sigma
+ pStartLoader->UnloadDigits();
}
////////////////////////////////////////////////////////////////////////
- private:
- Int_t fZposition; // Z position of vertex (mm)
- AliRunLoader* fRunLoader;
public:
- AliSTARTvertex() {}
- AliSTARTvertex(Int_t *);
- void Reconstruct(AliESD *pESD);
- Int_t GetVertex();
- virtual ~AliSTARTvertex() {}
- void Set(Int_t);
+ AliSTARTvertex():TObject(),fZposition(0) {}
+ virtual ~AliSTARTvertex() {}
+
+ void Reconstruct(AliRunLoader* runLoader, AliESD *pESD);
+
+ Float_t GetVertex() const {return fZposition;}
+ void SetVertex(Float_t zPosition) {fZposition=zPosition;}
+
+ private:
+ Float_t fZposition; // Z position of vertex (mm)
ClassDef(AliSTARTvertex,1) //Reconstructive vertex (Header) object
};
-inline Int_t AliSTARTvertex::GetVertex(){return fZposition;}
-inline void AliSTARTvertex::Set(Int_t Z_position)
- {fZposition=Z_position;}
#endif