sprintf(branchname,"%s",GetName());
- if(fSDigits && fLoader->TreeS()){
+ if(fLoader->TreeS()){
if (fSDigits == 0x0) fSDigits = new TClonesArray("AliITSpListItem",1000);
MakeBranchInTree(fLoader->TreeS(),branchname,&fSDigits,buffersize,fl);
} // end if
#if !defined(__CINT__) || defined(__MAKECINT__)
+#include "AliRun.h"
#include "AliITS.h"
#include "AliITSgeom.h"
#include "AliITSclustererV2.h"
+#include "AliRawReaderRoot.h"
+#include "AliRunLoader.h"
#include <TFile.h>
#include <TTree.h>
#endif
-void AliITSRawClusterer(const char* fileNameParam = "its.digits.root",
- const char* fileNameClusters = "its.clusters.root")
+void AliITSRawClusterer(const char* fileNameRawData = "event.root",
+ Int_t iEvent = 0,
+ const char* fileNameGalice = "galice.root")
{
- delete gAlice;
- TFile* file = TFile::Open(fileNameParam);
- AliRun* gAlice = (AliRun*) file->Get("gAlice");
- AliITS* its = (AliITS*) gAlice->GetModule("ITS");
- AliITSgeom* geom = (AliITSgeom*) its->GetITSgeom();
- AliITSclustererV2 clusterer(geom);
+// To run the cluster finder on raw data a galice.root file is needed.
+// This file has to contain a run loader, a loader for ITS and
+// the geometry of the ITS
+
+ AliRawReaderRoot rawReader(fileNameRawData, iEvent);
- TFile* out = TFile::Open(fileNameClusters, "recreate");
- geom->Write();
+ AliRunLoader* runLoader = AliRunLoader::Open(fileNameGalice);
+ runLoader->CdGAFile();
+ AliITSgeom* geom = (AliITSgeom*) gFile->Get("AliITSgeom");
+ AliITSclustererV2 clusterer(geom);
- clusterer.Digits2Clusters(out);
+ runLoader->GetLoader("ITSLoader")->LoadRecPoints("recreate");
+ runLoader->SetEventNumber(iEvent);
- out->Close();
- delete out;
- file->Close();
- delete file;
+ clusterer.Digits2Clusters(&rawReader);
}
ClassImp(AliITSRawStream)
-AliITSRawStream::AliITSRawStream()
+AliITSRawStream::AliITSRawStream(AliRawReader* rawReader)
{
// create an object to read ITS raw digits
+ fRawReader = rawReader;
fModuleID = fPrevModuleID = fCoord1 = fCoord2 = fSignal = -1;
}
* See cxx source for full Copyright notice */
#include <TObject.h>
+#include "AliRawReader.h"
class AliITSRawStream: public TObject {
public :
- AliITSRawStream();
+ AliITSRawStream(AliRawReader* rawReader);
virtual Bool_t Next() = 0;
inline Int_t GetSignal() const {return fSignal;};
protected :
+ AliRawReader* fRawReader; // object for reading the raw data
+
Int_t fModuleID; // index of current module
Int_t fPrevModuleID; // index of previous module
Int_t fCoord1; // current 1st coordinate
{458,459,464,465,466,467,472,473,474,475,480,481,482,483,488,489,490,491,496,497,498,499}};
-AliITSRawStreamSDD::AliITSRawStreamSDD() :
- fRawReader("SDDslice", kTRUE)
+AliITSRawStreamSDD::AliITSRawStreamSDD(AliRawReader* rawReader) :
+ AliITSRawStream(rawReader)
{
// create an object to read ITS SDD raw digits
+ fRawReader->Select(2);
}
// returns kFALSE if there is no digit left
fPrevModuleID = fModuleID;
- if (!fRawReader.ReadNextInt(fData)) return kFALSE;
+ if (!fRawReader->ReadNextInt(fData)) return kFALSE;
UInt_t relModuleID = (fData >> 25) & 0x0000007F;
- fModuleID = kDDLModuleMap[fRawReader.GetDDLID()][relModuleID];
+ fModuleID = kDDLModuleMap[fRawReader->GetDDLID()][relModuleID];
fCoord1 = (fData >> 16) & 0x000001FF;
fCoord2 = (fData >> 8) & 0x000000FF;
fSignal = fData & 0x000000FF;
class AliITSRawStreamSDD: public AliITSRawStream {
public :
- AliITSRawStreamSDD();
+ AliITSRawStreamSDD(AliRawReader* rawReader);
virtual Bool_t Next();
static const Int_t kDDLModuleMap[kDDLsNumber][kModulesPerDDL];
private :
- AliRawReader fRawReader; // object for reading the raw data file
UInt_t fData; // data read for file
ClassDef(AliITSRawStreamSDD, 0) // class for reading ITS SDD raw digits
ClassImp(AliITSRawStreamSPD)
-AliITSRawStreamSPD::AliITSRawStreamSPD() :
- fRawReader("SPDslice", kTRUE)
+AliITSRawStreamSPD::AliITSRawStreamSPD(AliRawReader* rawReader) :
+ AliITSRawStream(rawReader)
{
// create an object to read ITS SPD raw digits
+ fRawReader->Select(1);
}
// returns kFALSE if there is no digit left
fPrevModuleID = fModuleID;
- while (fRawReader.ReadNextShort(fData)) {
+ while (fRawReader->ReadNextShort(fData)) {
if ((fData & 0xE000) == 0x6000) { // header
fHitCount = 0;
* See cxx source for full Copyright notice */
#include "AliITSRawStream.h"
-#include "AliRawReader.h"
class AliITSRawStreamSPD: public AliITSRawStream {
public :
- AliITSRawStreamSPD();
+ AliITSRawStreamSPD(AliRawReader* rawReader);
virtual Bool_t Next();
inline Int_t GetColumn() const {return fCoord2;};
private :
- AliRawReader fRawReader; // object for reading the raw data file
UShort_t fData; // data read for file
UInt_t fOffset; // offset for cell column
UInt_t fHitCount; // counter of hits
};
-AliITSRawStreamSSD::AliITSRawStreamSSD() :
- fRawReader("SSDslice", kTRUE)
+AliITSRawStreamSSD::AliITSRawStreamSSD(AliRawReader* rawReader) :
+ AliITSRawStream(rawReader)
{
// create an object to read ITS SSD raw digits
+ fRawReader->Select(3);
}
// returns kFALSE if there is no digit left
fPrevModuleID = fModuleID;
- if (!fRawReader.ReadNextInt(fData)) return kFALSE;
+ if (!fRawReader->ReadNextInt(fData)) return kFALSE;
UInt_t relModuleID = (fData >> 21) & 0x000007FF;
- fModuleID = kDDLModuleMap[fRawReader.GetDDLID()][relModuleID];
+ fModuleID = kDDLModuleMap[fRawReader->GetDDLID()][relModuleID];
fCoord1 = (fData >> 20) & 0x00000001;
fCoord2 = (fData >> 10) & 0x000003FF;
fSignal = (fData & 0x000003FF) + 1;
class AliITSRawStreamSSD: public AliITSRawStream {
public :
- AliITSRawStreamSSD();
+ AliITSRawStreamSSD(AliRawReader* rawReader);
virtual Bool_t Next();
static const Int_t kDDLModuleMap[kDDLsNumber][kModulesPerDDL];
private :
- AliRawReader fRawReader; // object for reading the raw data file
UInt_t fData; // data read for file
ClassDef(AliITSRawStreamSSD, 0) // class for reading ITS SSD raw digits
#include "AliITSclustererV2.h"
#include "AliITSclusterV2.h"
+#include "AliRawReader.h"
#include "AliITSRawStreamSPD.h"
#include "AliITSRawStreamSDD.h"
#include "AliITSRawStreamSSD.h"
delete digitsSDD;
delete digitsSSD;
+ //delete dTree;
+
Info("Digits2Clusters","Number of found clusters : %d",ncl);
return 0;
}
-void AliITSclustererV2::Digits2Clusters(TFile *out) {
+void AliITSclustererV2::Digits2Clusters(AliRawReader* rawReader) {
//------------------------------------------------------------
// This function creates ITS clusters from raw data
//------------------------------------------------------------
- TDirectory *savedir=gDirectory;
- if (!out->IsOpen()) {
- Error("Digits2Clusters","Output file not open !");
+ AliRunLoader* runLoader = AliRunLoader::GetRunLoader();
+ if (!runLoader) {
+ Error("Digits2Clusters", "no run loader found");
+ return;
+ }
+ AliLoader* itsLoader = runLoader->GetLoader("ITSLoader");
+ if (!itsLoader) {
+ Error("Digits2Clusters", "no loader for ITS found");
return;
}
- out->cd();
+ if (!itsLoader->TreeR()) itsLoader->MakeTree("R");
+ TTree* cTree = itsLoader->TreeR();
- Char_t name[100];
- sprintf(name,"TreeC_ITS_%d",fEvent);
- TTree cTree(name,"ITS clusters V2");
TClonesArray *array=new TClonesArray("AliITSclusterV2",1000);
- cTree.Branch("Clusters",&array);
+ cTree->Branch("Clusters",&array);
delete array;
TClonesArray** clusters = new TClonesArray*[fNModules];
// one TClonesArray per module
- AliITSRawStreamSPD inputSPD;
+ rawReader->Reset();
+ AliITSRawStreamSPD inputSPD(rawReader);
FindClustersSPD(&inputSPD, clusters);
- AliITSRawStreamSDD inputSDD;
+
+ rawReader->Reset();
+ AliITSRawStreamSDD inputSDD(rawReader);
FindClustersSDD(&inputSDD, clusters);
- AliITSRawStreamSSD inputSSD;
+
+ rawReader->Reset();
+ AliITSRawStreamSSD inputSSD(rawReader);
FindClustersSSD(&inputSSD, clusters);
// write all clusters to the tree
Error("Digits2Clusters", "data for module %d missing!", iModule);
array = new TClonesArray("AliITSclusterV2");
}
- cTree.SetBranchAddress("Clusters", &array);
- cTree.Fill();
+ cTree->SetBranchAddress("Clusters", &array);
+ cTree->Fill();
nClusters += array->GetEntriesFast();
delete array;
}
- cTree.Write();
-
- savedir->cd();
+ itsLoader->WriteRecPoints("OVERWRITE");
Info("Digits2Clusters", "total number of found clusters in ITS: %d\n",
nClusters);
class AliITSgeom;
class AliITSclusterV2;
+class AliRawReader;
class AliITSRawStream;
class AliITSclustererV2 : public TObject {
void SetEvent(Int_t event) { fEvent=event; }
Int_t Digits2Clusters(TTree *in, TTree *out);
- void Digits2Clusters(TFile *out);
+ void Digits2Clusters(AliRawReader* rawReader);
void FindClustersSPD(const TClonesArray *dig, TClonesArray *cls);
void FindClustersSPD(AliITSRawStream* input, TClonesArray** clusters);
void FindClustersSDD(const TClonesArray *dig, TClonesArray *cls);