--- /dev/null
+void AliTRDDigits2Clusters()
+{
+
+/////////////////////////////////////////////////////////////////////////
+//
+// Creates cluster from the digit information.
+//
+/////////////////////////////////////////////////////////////////////////
+
+ // Dynamically link some shared libs
+ if (gClassTable->GetID("AliRun") < 0) {
+ gROOT->LoadMacro("loadlibs.C");
+ loadlibs();
+ cout << "Loaded shared libraries" << endl;
+ }
+
+ // Input and output file names
+ Char_t *infile = "galice.root";
+
+ // Create the clusterizer
+ AliTRDclusterizerV1 *clusterizer =
+ new AliTRDclusterizerV1("clusterizer","Clusterizer class");
+
+ // Read the parameter
+ TFile *parfile = TFile::Open(infile);
+ AliTRDparameter *par = (AliTRDparameter *) parfile->Get("TRDparameter");
+ par->ReInit();
+ clusterizer->SetParameter(par);
+
+ // Set the parameter
+ clusterizer->SetVerbose(1);
+
+ //Number of events
+ TTree * te = (TTree*)parfile->Get("TE");
+ Int_t nev = (Int_t)te->GetEntries();
+
+ for(Int_t iev=0;iev<nev;iev++) {
+
+ // Open the AliRoot file
+ clusterizer->Open(infile,iev);
+
+ // Load the digits
+ clusterizer->ReadDigits();
+ clusterizer->Dump();
+
+ // Find the cluster
+ clusterizer->MakeClusters();
+
+ // Write the cluster tree into file AliTRDclusters.root
+ clusterizer->WriteClusters(-1);
+
+ }
+
+}
--- /dev/null
+void AliTRDDigits2Raw() {
+
+ const char * inFile = "galice.root";
+ AliRunLoader *rl = AliRunLoader::Open(inFile,"Event","read");
+
+ rl->GetEvent(0);
+ AliLoader *trdloader=rl->GetLoader("TRDLoader");
+ trdloader->LoadDigits();
+ TTree *digitsTree=trdloader->TreeD();
+
+ digitsTree->Print();
+
+ AliTRDrawData *raw = new AliTRDrawData();
+ raw->SetDebug(2);
+
+ if (raw->Digits2Raw(digitsTree)) {
+ printf("Digits2Raw done! \n");
+ } else {
+ printf("Digits2Raw returned FALSE! \n");
+ }
+
+ delete rl;
+
+}
+
--- /dev/null
+void AliTRDDigitsDDL2Clusters()
+{
+
+/////////////////////////////////////////////////////////////////////////
+//
+// Creates cluster from the digit information.
+//
+/////////////////////////////////////////////////////////////////////////
+
+ // Dynamically link some shared libs
+ if (gClassTable->GetID("AliRun") < 0) {
+ gROOT->LoadMacro("loadlibs.C");
+ loadlibs();
+ cout << "Loaded shared libraries" << endl;
+ }
+
+ // Input and output file names
+ Char_t *infile = "galice.root";
+
+ // Create the clusterizer
+ AliTRDclusterizerV1 *clusterizer =
+ new AliTRDclusterizerV1("clusterizer","Clusterizer class");
+
+ // Read the parameter
+ TFile *parfile = TFile::Open(infile);
+ AliTRDparameter *par = (AliTRDparameter *) parfile->Get("TRDparameter");
+ par->ReInit();
+ clusterizer->SetParameter(par);
+
+ // Set the parameter
+ clusterizer->SetVerbose(1);
+
+ //Number of events
+ TTree * te = (TTree*)parfile->Get("TE");
+ Int_t nev = (Int_t)te->GetEntries();
+
+ for(Int_t iev=0;iev<nev;iev++) {
+
+ AliRawReaderFile rawReader(iev);
+
+ // Open the AliRoot file
+ clusterizer->Open(infile,iev);
+
+ // Load the digits
+ clusterizer->ReadDigits(&rawReader);
+ clusterizer->Dump();
+
+ // Find the cluster
+ clusterizer->MakeClusters();
+
+ // Write the cluster tree into file AliTRDclusters.root
+ clusterizer->WriteClusters(-1);
+
+ }
+
+}
{
AliTRDrawData *raw = new AliTRDrawData();
- raw->SetDebug(1);
+ raw->SetDebug(2);
AliRawReaderFile rawReader(iEvent);
+
AliTRDdigitsManager *digitsManagerRaw = raw->Raw2Digits(&rawReader);
// The geometry object
Int_t rowMax = par->GetRowMax(iPla,iCha,iSec);
Int_t colMax = par->GetColMax(iPla);
Int_t timeMax = par->GetTimeMax();
+ Int_t timeTotal = par->GetTimeTotal();
cout << "Geometry: rowMax = " << rowMax
<< " colMax = " << colMax
- << " timeMax = " << timeMax << endl;
- AliTRDmatrix *matrix = new AliTRDmatrix(rowMax,colMax,timeMax,iSec,iCha,iPla);
+ << " timeMax = " << timeMax
+ << " timeTotal = " << timeTotal << endl;
+ AliTRDmatrix *matrix = new AliTRDmatrix(rowMax,colMax,timeTotal,iSec,iCha,iPla);
AliRunLoader* rl = AliRunLoader::Open("galice.root");
AliLoader* loader = rl->GetLoader("TRDLoader");
Int_t DigAmpRaw, DigAmp;
// Loop through the detector pixel
- for (Int_t time = 0; time < timeMax; time++) {
+ for (Int_t time = 0; time < timeTotal; time++) {
for (Int_t col = 0; col < colMax; col++) {
for (Int_t row = 0; row < rowMax; row++) {
TCanvas *c1 = new TCanvas("c1","Canvas 1",10,10,600,500);
DigDiff->Draw();
+ printf("Number of digits expected = %d \n",timeTotal*rowMax*colMax);
+
}
#include "AliTRDRawStream.h"
#include "AliRawReader.h"
+#include "AliTRDparameter.h"
ClassImp(AliTRDRawStream)
-AliTRDRawStream::AliTRDRawStream(AliRawReader* rawReader) :
+AliTRDRawStream::AliTRDRawStream(AliRawReader* rawReader, AliTRDparameter* parameter) :
fRawReader(rawReader),
- fTimeMax(15),
+ fTimeTotal(parameter->GetTimeTotal()),
fCount(0),
fDetector(-1),
fPrevDetector(-1),
AliTRDRawStream::AliTRDRawStream(const AliTRDRawStream& stream) :
TObject(stream),
fRawReader(NULL),
- fTimeMax(15),
+ fTimeTotal(0),
fCount(0),
fDetector(-1),
fPrevDetector(-1),
return kFALSE;
}
fCount += (UInt_t(data) << 8);
+ if (!fRawReader->ReadNextChar(data)) {
+ Error("Next", "could not read number of bytes");
+ fCount = -1;
+ return kFALSE;
+ }
+ fCount += (UInt_t(data) << 16);
// read the number of active pads
if (!fRawReader->ReadNextChar(data)) {
}
fNPads += (UInt_t(data) << 8);
- // read the empty byte
- if (!fRawReader->ReadNextChar(data)) {
- Error("Next", "could not read fill byte");
- fCount = -1;
- return kFALSE;
- }
+ fTime = fTimeTotal;
- fTime = fTimeMax;
}
// read the pad row and column number
- if ((fTime >= fTimeMax) && (fCount > 2)) {
+ if ((fTime >= fTimeTotal) && (fCount > 2)) {
if (!fRawReader->ReadNextChar(data)) {
Error("Next", "could not read row number");
fCount = -1;
#include <TObject.h>
class AliRawReader;
-
+class AliTRDparameter;
class AliTRDRawStream: public TObject {
public :
- AliTRDRawStream(AliRawReader* rawReader);
+ AliTRDRawStream(AliRawReader* rawReader, AliTRDparameter* parameter);
virtual ~AliTRDRawStream();
virtual Bool_t Next();
AliRawReader* fRawReader; // object for reading the raw data
- Int_t fTimeMax; // maximal time bin
+ Int_t fTimeTotal; // total time bins
Int_t fCount; // counter of bytes to be read for current detector
Int_t fDetector; // index of current detector
#include "AliTRDtracker.h"
#include "AliTRDpidESD.h"
#include <TFile.h>
-
+#include "AliRawReaderFile.h"
+#include "AliLog.h"
ClassImp(AliTRDReconstructor)
loader->UnloadRecPoints();
}
+//_____________________________________________________________________________
+void AliTRDReconstructor::Reconstruct(AliRunLoader* runLoader,
+ AliRawReader* rawReader) const
+{
+// reconstruct clusters
+
+ AliInfo("Reconstruct TRD clusters from RAW data");
+
+ AliLoader *loader=runLoader->GetLoader("TRDLoader");
+ loader->LoadRecPoints("recreate");
+
+ AliTRDclusterizerV1 clusterer("clusterer", "TRD clusterizer");
+ runLoader->CdGAFile();
+ AliTRDparameter* trdParam = GetTRDparameter(runLoader);
+ if (!trdParam) {
+ Error("Reconstruct", "no TRD parameters found");
+ return;
+ }
+ trdParam->ReInit();
+ clusterer.SetParameter(trdParam);
+ Int_t nEvents = runLoader->GetNumberOfEvents();
+
+ for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
+ if (!rawReader->NextEvent()) break;
+ clusterer.Open(runLoader->GetFileName(), iEvent);
+ clusterer.ReadDigits(rawReader);
+ clusterer.MakeClusters();
+ clusterer.WriteClusters(-1);
+ }
+
+ loader->UnloadRecPoints();
+}
+
//_____________________________________________________________________________
AliTracker* AliTRDReconstructor::CreateTracker(AliRunLoader* runLoader) const
{
AliTRDReconstructor(): AliReconstructor() {};
virtual ~AliTRDReconstructor() {};
- virtual void Reconstruct(AliRunLoader*, AliRawReader*) const { };
+ virtual void Reconstruct(AliRunLoader* runLoader, AliRawReader* rawReader) const;
virtual void Reconstruct(AliRawReader*, TTree*) const { };
virtual void Reconstruct(TTree*, TTree*) const { };
virtual void Reconstruct(AliRunLoader* runLoader) const;
#include "AliRun.h"
#include "AliRunLoader.h"
#include "AliLoader.h"
+#include "AliRawReader.h"
#include "AliTRDclusterizerV1.h"
#include "AliTRDmatrix.h"
#include "AliTRDdigitsManager.h"
#include "AliTRDparameter.h"
#include "AliTRDpadPlane.h"
+#include "AliTRDrawData.h"
ClassImp(AliTRDclusterizerV1)
}
+//_____________________________________________________________________________
+Bool_t AliTRDclusterizerV1::ReadDigits(AliRawReader* rawReader)
+{
+ //
+ // Reads the digits arrays from the ddl file
+ //
+
+ AliTRDrawData *raw = new AliTRDrawData();
+ raw->SetDebug(1);
+
+ fDigitsManager = raw->Raw2Digits(rawReader);
+
+ return kTRUE;
+
+}
+
//_____________________________________________________________________________
Bool_t AliTRDclusterizerV1::MakeClusters()
{
class AliTRDdigitsManager;
class AliTRDparameter;
+class AliRawReader;
class AliTRDclusterizerV1 : public AliTRDclusterizer {
virtual void Copy(TObject &c) const;
virtual Bool_t MakeClusters();
virtual Bool_t ReadDigits();
+ virtual Bool_t ReadDigits(AliRawReader* rawReader);
protected:
#include "AliTRDdataArrayI.h"
#include "AliTRDRawStream.h"
#include "AliRawDataHeader.h"
+#include "AliRawReader.h"
ClassImp(AliTRDrawData)
const Int_t kNumberOfDDLs = 18;
const Int_t kSubeventHeaderLength = 8;
const Int_t kSubeventDummyFlag = 0xBB;
- int headerSubevent[2];
+ int headerSubevent[3];
ofstream *outputFile[kNumberOfDDLs];
UInt_t bHPosition[kNumberOfDDLs];
Int_t sect = geo->GetSector(det);
Int_t rowMax = par->GetRowMax(plan,cham,sect);
Int_t colMax = par->GetColMax(plan);
- Int_t timeMax = par->GetTimeMax();
- Int_t bufferMax = rowMax*colMax*timeMax;
+ Int_t timeTotal = par->GetTimeTotal();
+ Int_t bufferMax = rowMax*colMax*timeTotal;
int *buffer = new int[bufferMax];
npads = 0;
// Check whether data exists for this pad
Bool_t dataflag = kFALSE;
- for (Int_t time = 0; time < timeMax; time++) {
+ for (Int_t time = 0; time < timeTotal; time++) {
Int_t data = digits->GetDataUnchecked(row,col,time);
if (data) {
dataflag = kTRUE;
nbyte += 2;
Int_t nzero = 0;
- for (Int_t time = 0; time < timeMax; time++) {
+ for (Int_t time = 0; time < timeTotal; time++) {
Int_t data = digits->GetDataUnchecked(row,col,time);
if (!data) {
nzero++;
if ((nzero == 256) ||
- (time == timeMax-1)) {
+ (time == timeTotal-1)) {
*bytePtr++ = 0;
*bytePtr++ = nzero-1;
nbyte += 2;
*bytePtr++ = (det >> 8);
*bytePtr++ = (nbyte & 0xff);
*bytePtr++ = (nbyte >> 8);
+ *bytePtr++ = (nbyte >> 16);
*bytePtr++ = (npads & 0xff);
*bytePtr++ = (npads >> 8);
- *bytePtr++ = 0;
outputFile[iDDL]->write((char*)headerPtr,kSubeventHeaderLength);
// Write the buffer to the file
//
AliTRDdataArrayI *digits = 0;
+ AliTRDdataArrayI *track0 = 0;
+ AliTRDdataArrayI *track1 = 0;
+ AliTRDdataArrayI *track2 = 0;
AliTRDgeometryFull *geo = new AliTRDgeometryFull();
AliTRDparameter *par = new AliTRDparameter("TRDparameter"
digitsManager->SetDebug(fDebug);
digitsManager->CreateArrays();
- AliTRDRawStream input(rawReader);
+ AliTRDRawStream input(rawReader,par);
// Loop through the digits
while (input.Next()) {
if (input.IsNewDetector()) {
if (digits) digits->Compress(1,0);
+ if (track0) track0->Compress(1,0);
+ if (track1) track1->Compress(1,0);
+ if (track2) track2->Compress(1,0);
if (fDebug > 2) {
Info("Raw2Digits","Subevent header:");
Int_t sect = geo->GetSector(det);
Int_t rowMax = par->GetRowMax(plan,cham,sect);
Int_t colMax = par->GetColMax(plan);
- Int_t timeMax = par->GetTimeMax();
+ Int_t timeTotal = par->GetTimeTotal();
// Add a container for the digits of this detector
digits = digitsManager->GetDigits(det);
+ track0 = digitsManager->GetDictionary(det,0);
+ track1 = digitsManager->GetDictionary(det,1);
+ track2 = digitsManager->GetDictionary(det,2);
// Allocate memory space for the digits buffer
if (digits->GetNtime() == 0) {
- digits->Allocate(rowMax,colMax,timeMax);
+ digits->Allocate(rowMax,colMax,timeTotal);
+ track0->Allocate(rowMax,colMax,timeTotal);
+ track1->Allocate(rowMax,colMax,timeTotal);
+ track2->Allocate(rowMax,colMax,timeTotal);
}
}
+
digits->SetDataUnchecked(input.GetRow(),input.GetColumn(),
input.GetTime(),input.GetSignal());
+ track0->SetDataUnchecked(input.GetRow(),input.GetColumn(),
+ input.GetTime(), -1);
+ track1->SetDataUnchecked(input.GetRow(),input.GetColumn(),
+ input.GetTime(), -1);
+ track2->SetDataUnchecked(input.GetRow(),input.GetColumn(),
+ input.GetTime(), -1);
}
if (digits) digits->Compress(1,0);
+ if (track0) track0->Compress(1,0);
+ if (track1) track1->Compress(1,0);
+ if (track2) track2->Compress(1,0);
delete geo;
delete par;