-#include <AliITSVertex.h>
+#include <AliESDVertex.h>
#include <AliITSVertexer.h>
+#include <AliRunLoader.h>
+#include <AliITSLoader.h>
+#include <AliMultiplicity.h>
+#include <AliITSMultReconstructor.h>
ClassImp(AliITSVertexer)
//////////////////////////////////////////////////////////////////////
// Base class for primary vertex reconstruction //
-// AliITSVertex is a class for full 3D primary vertex finding //
+// AliESDVertexer is a class for full 3D primary vertex finding //
+// derived classes: AliITSVertexerIons AliITSvertexerPPZ //
+// AliITSVertexerTracks //
//////////////////////////////////////////////////////////////////////
//______________________________________________________________________
-AliITSVertexer::AliITSVertexer() {
+AliITSVertexer::AliITSVertexer():AliVertexer() {
// Default Constructor
-
- fCurrentVertex = 0;
- fInFile = 0;
- fOutFile = 0;
- SetDebug();
- SetFirstEvent(0);
- SetLastEvent(0);
}
-AliITSVertexer::AliITSVertexer(TFile *infile, TFile *outfile) {
+AliITSVertexer::AliITSVertexer(TString filename) {
// Standard constructor
+ AliRunLoader *rl = AliRunLoader::GetRunLoader();
+ if(!rl){
+ Fatal("AliITSVertexer","Run Loader not found");
+ }
+ if(rl->LoadgAlice()){
+ Fatal("AliITSVertexer","The AliRun object is not available - nothing done");
+ }
fCurrentVertex = 0;
- SetInputFile(infile);
- SetOutputFile(outfile);
- SetDebug();
+ fDebug = 0;
SetFirstEvent(0);
SetLastEvent(0);
- if(gAlice){
- Int_t lst;
- if(gAlice->TreeE()){
- lst = static_cast<Int_t>(gAlice->TreeE()->GetEntries());
- SetLastEvent(lst-1);
- }
+ rl->LoadHeader();
+ AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader");
+ if(!filename.Contains("default"))itsLoader->SetVerticesFileName(filename);
+ if(!filename.Contains("null"))itsLoader->LoadVertices("recreate");
+ itsLoader->LoadRecPoints();
+ Int_t lst;
+ if(rl->TreeE()){
+ lst = static_cast<Int_t>(rl->TreeE()->GetEntries());
+ SetLastEvent(lst-1);
}
}
//______________________________________________________________________
-AliITSVertexer::~AliITSVertexer() {
- // Default Destructor
- // The objects poited by the following pointers are not owned
- // by this class and are not deleted
-
- fCurrentVertex = 0;
- fInFile = 0;
- fOutFile = 0;
+AliITSVertexer::AliITSVertexer(const AliITSVertexer &vtxr) : AliVertexer(vtxr) {
+ // Copy constructor
+ // Copies are not allowed. The method is protected to avoid misuse.
+ Error("AliITSVertexer","Copy constructor not allowed\n");
}
//______________________________________________________________________
-void AliITSVertexer::WriteCurrentVertex(){
- // Write the current AliVertex object to file fOutFile
- if(!fOutFile){
- Error("WriteCurrentEvent","The output file is not defined");
+AliITSVertexer& AliITSVertexer::operator=(const AliITSVertexer& /* vtxr */){
+ // Assignment operator
+ // Assignment is not allowed. The method is protected to avoid misuse.
+ Error("= operator","Assignment operator not allowed\n");
+ return *this;
+}
+
+//______________________________________________________________________
+void AliITSVertexer::FindMultiplicity(Int_t evnumber){
+ // Invokes AliITSMultReconstructor to determine the
+ // charged multiplicity in the pixel layers
+ if(fMult){delete fMult; fMult = 0;}
+ Bool_t success=kTRUE;
+ if(!fCurrentVertex)success=kFALSE;
+ if(fCurrentVertex && fCurrentVertex->GetNContributors()<1)success=kFALSE;
+ if(!success){
+ AliWarning("Tracklets multiplicity not determined because the primary vertex was not found");
return;
}
- TDirectory *curdir = gDirectory;
- fOutFile->cd();
- fCurrentVertex->Write();
- curdir->cd();
- fCurrentVertex = 0;
+ AliITSMultReconstructor* multReco = new AliITSMultReconstructor();
+ AliRunLoader *rl =AliRunLoader::GetRunLoader();
+ AliITSLoader* itsLoader = (AliITSLoader*)rl->GetLoader("ITSLoader");
+ multReco->SetGeometry(itsLoader->GetITSgeom());
+ itsLoader->LoadRecPoints();
+ rl->GetEvent(evnumber);
+ TTree* itsClusterTree = itsLoader->TreeR();
+ if (!itsClusterTree) {
+ AliError(" Can't get the ITS cluster tree !\n");
+ return;
+ }
+ Double_t vtx[3];
+ fCurrentVertex->GetXYZ(vtx);
+ Float_t vtxf[3];
+ for(Int_t i=0;i<3;i++)vtxf[i]=vtx[i];
+ multReco->SetHistOn(kFALSE);
+ multReco->Reconstruct(itsClusterTree,vtxf,vtxf);
+ cout<<"======================================================="<<endl;
+ cout<<"Event number "<<evnumber<<"; tracklets= "<<multReco->GetNTracklets()<<endl;
+ Int_t notracks=multReco->GetNTracklets();
+ Float_t *trk = new Float_t [notracks];
+ Float_t *phi = new Float_t [notracks];
+ Float_t *dphi = new Float_t [notracks];
+ for(Int_t i=0;i<multReco->GetNTracklets();i++){
+ trk[i] = multReco->GetTracklet(i)[0];
+ phi[i] = multReco->GetTracklet(i)[1];
+ dphi[i] = multReco->GetTracklet(i)[2];
+ }
+ fMult = new AliMultiplicity(notracks,trk,phi, dphi);
+ delete [] trk;
+ delete [] phi;
+ delete [] dphi;
+ itsLoader->UnloadRecPoints();
+ delete multReco;
+ return;
+}
+
+//______________________________________________________________________
+void AliITSVertexer::WriteCurrentVertex(){
+ // Write the current AliVertex object to file fOutFile
+ AliRunLoader *rl = AliRunLoader::GetRunLoader();
+ AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader");
+ fCurrentVertex->SetName("Vertex");
+ // const char * name = fCurrentVertex->GetName();
+ // itsLoader->SetVerticesContName(name);
+ Int_t rc = itsLoader->PostVertex(fCurrentVertex);
+ rc = itsLoader->WriteVertices();
}