**************************************************************************/
/*
+$Log$
Revision 0.03 2005/07/28 A. De Caro
Implement public method
// //
////////////////////////////////////////////////////////////////
+#include "Riostream.h"
+
#include "TClonesArray.h"
-#include "TFile.h"
+//#include "TFile.h"
#include "TTree.h"
#include "AliDAQ.h"
#include "AliRawReader.h"
#include "AliRunLoader.h"
-#include "AliTOFcalib.h"
#include "AliTOFCal.h"
+#include "AliTOFcalib.h"
#include "AliTOFChannel.h"
#include "AliTOFClusterFinder.h"
#include "AliTOFcluster.h"
#include "AliTOFdigit.h"
-#include "AliTOFGeometryV5.h"
#include "AliTOFGeometry.h"
+#include "AliTOFGeometryV5.h"
+#include "AliTOFrawData.h"
#include "AliTOFRawStream.h"
-extern TFile *gFile;
+//extern TFile *gFile;
ClassImp(AliTOFClusterFinder)
fTOFGeometry(new AliTOFGeometryV5()),
fDigits(new TClonesArray("AliTOFdigit", 4000)),
fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
- fNumberOfTofClusters(0)
+ fNumberOfTofClusters(0),
+ fVerbose(0)
{
//
// Constructor
fTOFGeometry(new AliTOFGeometryV5()),
fDigits(new TClonesArray("AliTOFdigit", 4000)),
fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
- fNumberOfTofClusters(0)
+ fNumberOfTofClusters(0),
+ fVerbose(0)
{
//
// Constructor
fTOFGeometry(new AliTOFGeometryV5()),
fDigits(new TClonesArray("AliTOFdigit", 4000)),
fRecPoints(new TClonesArray("AliTOFcluster", 4000)),
- fNumberOfTofClusters(0)
+ fNumberOfTofClusters(0),
+ fVerbose(0)
{
// copy constructor
this->fDigits=source.fDigits;
this->fDigits=source.fDigits;
this->fRecPoints=source.fRecPoints;
this->fTOFGeometry=source.fTOFGeometry;
+ this->fVerbose=source.fVerbose;
return *this;
}
return;
}
- TClonesArray dummy("AliTOFdigit",10000), *digits=&dummy;
+ TClonesArray *digits = new TClonesArray("AliTOFdigit",10000);
branch->SetAddress(&digits);
ResetRecpoint();
Int_t bufsize = 32000;
clustersTree->Branch("TOF", &fRecPoints, bufsize);
+ TClonesArray * clonesRawData;
+
Int_t ii = 0;
- Int_t indexDDL = 0;
+ Int_t dummy = -1;
Int_t detectorIndex[5];
Float_t position[3];
Float_t tToT;
Double_t tTdcND;
+ ofstream ftxt;
+ if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app);
+
+ Int_t indexDDL = 0;
+ for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
+
+ rawReader->Reset();
+ AliTOFRawStream tofInput(rawReader);
+ tofInput.LoadRawData(indexDDL);
+
+ clonesRawData = (TClonesArray*)tofInput.GetRawData();
+
+ for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
+
+ AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
+
+ if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
+
+ if (fVerbose==2) {
+ if (indexDDL<10) ftxt << " " << indexDDL;
+ else ftxt << " " << indexDDL;
+ if (tofRawDatum->GetTRM()<10) ftxt << " " << tofRawDatum->GetTRM();
+ else ftxt << " " << tofRawDatum->GetTRM();
+ ftxt << " " << tofRawDatum->GetTRMchain();
+ if (tofRawDatum->GetTDC()<10) ftxt << " " << tofRawDatum->GetTDC();
+ else ftxt << " " << tofRawDatum->GetTDC();
+ ftxt << " " << tofRawDatum->GetTDCchannel();
+ }
+
+ tofInput.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
+ tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
+ dummy = detectorIndex[3];
+ detectorIndex[3] = detectorIndex[4];
+ detectorIndex[4] = dummy;
+
+ if (fVerbose==2) {
+ if (detectorIndex[0]<10) ftxt << " -> " << detectorIndex[0];
+ else ftxt << " -> " << detectorIndex[0];
+ ftxt << " " << detectorIndex[1];
+ if (detectorIndex[2]<10) ftxt << " " << detectorIndex[2];
+ else ftxt << " " << detectorIndex[2];
+ ftxt << " " << detectorIndex[3];
+ if (detectorIndex[4]<10) ftxt << " " << detectorIndex[4];
+ else ftxt << " " << detectorIndex[4];
+ }
+
+ for (ii=0; ii<3; ii++) position[ii] = 0.;
+ fTOFGeometry->GetPos(detectorIndex, position);
+
+ cylindricalPosition[0] = TMath::Sqrt(position[0]*position[0] + position[1]*position[1]);
+ cylindricalPosition[1] = TMath::ATan2(position[1], position[0]);
+ cylindricalPosition[2] = position[2];
+ cylindricalPosition[3] = tofRawDatum->GetTOF();
+ cylindricalPosition[4] = tofRawDatum->GetTOT();
+ tToT = tofRawDatum->GetTOT();
+ tTdcND = -1.;
+ AliTOFcluster *tofCluster = new AliTOFcluster(cylindricalPosition, detectorIndex);
+ tofCluster->SetToT(tToT);
+ tofCluster->SetTDCND(tTdcND);
+ InsertCluster(tofCluster);
+
+ if (fVerbose==2) {
+ if (cylindricalPosition[4]<10) ftxt << " " << cylindricalPosition[4];
+ else if (cylindricalPosition[4]>=10 && cylindricalPosition[4]<100) ftxt << " " << cylindricalPosition[4];
+ else ftxt << " " << cylindricalPosition[4];
+ if (cylindricalPosition[3]<10) ftxt << " " << cylindricalPosition[3] << endl;
+ else if (cylindricalPosition[3]>=10 && cylindricalPosition[3]<100) ftxt << " " << cylindricalPosition[3] << endl;
+ else if (cylindricalPosition[3]>=100 && cylindricalPosition[3]<1000) ftxt << " " << cylindricalPosition[3] << endl;
+ else ftxt << " " << cylindricalPosition[3] << endl;
+ }
+
+ } // closed loop on TOF raw data per current DDL file
+
+ clonesRawData->Clear();
+
+ } // closed loop on DDL index
+
+ /*
+ Int_t indexDDL = 0;
for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
rawReader->Reset();
} // while loop
} // loop on DDL files
+ */
+
+ if (fVerbose==2) ftxt.close();
AliInfo(Form("Number of found clusters: %i", fNumberOfTofClusters));
Int_t bufsize = 32000;
fTreeR->Branch("TOF", &fRecPoints, bufsize);
+ TClonesArray * clonesRawData;
+
Int_t ii = 0;
- Int_t indexDDL = 0;
+ Int_t dummy = -1;
Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
Float_t position[3];
Float_t tToT;
Double_t tTdcND;
+ ofstream ftxt;
+ if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app);
+
+ Int_t indexDDL = 0;
for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
rawReader->Reset();
AliTOFRawStream tofInput(rawReader);
- rawReader->Select("TOF", indexDDL, indexDDL);
-
- while(tofInput.Next()) {
-
- for (ii=0; ii<5; ii++) detectorIndex[ii] = -1;
-
- detectorIndex[0] = (Int_t)tofInput.GetSector();
- detectorIndex[1] = (Int_t)tofInput.GetPlate();
- detectorIndex[2] = (Int_t)tofInput.GetStrip();
- detectorIndex[3] = (Int_t)tofInput.GetPadZ();
- detectorIndex[4] = (Int_t)tofInput.GetPadX();
-
- if (detectorIndex[0]==-1 ||
- detectorIndex[1]==-1 ||
- detectorIndex[2]==-1 ||
- detectorIndex[3]==-1 ||
- detectorIndex[4]==-1) continue;
-
- //AliInfo(Form(" %2i %1i %2i %1i %2i ",detectorIndex[0],detectorIndex[1],detectorIndex[2],detectorIndex[3],detectorIndex[4]));
+ tofInput.LoadRawData(indexDDL);
+
+ clonesRawData = (TClonesArray*)tofInput.GetRawData();
+
+ for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
+
+ AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
+
+ if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
+
+ if (fVerbose==2) {
+ if (indexDDL<10) ftxt << " " << indexDDL;
+ else ftxt << " " << indexDDL;
+ if (tofRawDatum->GetTRM()<10) ftxt << " " << tofRawDatum->GetTRM();
+ else ftxt << " " << tofRawDatum->GetTRM();
+ ftxt << " " << tofRawDatum->GetTRMchain();
+ if (tofRawDatum->GetTDC()<10) ftxt << " " << tofRawDatum->GetTDC();
+ else ftxt << " " << tofRawDatum->GetTDC();
+ ftxt << " " << tofRawDatum->GetTDCchannel();
+ }
+
+ tofInput.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
+ tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
+ dummy = detectorIndex[3];
+ detectorIndex[3] = detectorIndex[4];
+ detectorIndex[4] = dummy;
+
+ if (fVerbose==2) {
+ if (detectorIndex[0]<10) ftxt << " -> " << detectorIndex[0];
+ else ftxt << " -> " << detectorIndex[0];
+ ftxt << " " << detectorIndex[1];
+ if (detectorIndex[2]<10) ftxt << " " << detectorIndex[2];
+ else ftxt << " " << detectorIndex[2];
+ ftxt << " " << detectorIndex[3];
+ if (detectorIndex[4]<10) ftxt << " " << detectorIndex[4];
+ else ftxt << " " << detectorIndex[4];
+ }
for (ii=0; ii<3; ii++) position[ii] = 0.;
-
fTOFGeometry->GetPos(detectorIndex, position);
-
- cylindricalPosition[0] = (Double_t)TMath::Sqrt(position[0]*position[0] + position[1]*position[1]);
- cylindricalPosition[1] = (Double_t)TMath::ATan2(position[1], position[0]);
- cylindricalPosition[2] = (Double_t)position[2];
- cylindricalPosition[3] = (Double_t)tofInput.GetTofBin();
- cylindricalPosition[4] = (Double_t)tofInput.GetToTbin();
- tToT = tofInput.GetToTbin();
+
+ cylindricalPosition[0] = TMath::Sqrt(position[0]*position[0] + position[1]*position[1]);
+ cylindricalPosition[1] = TMath::ATan2(position[1], position[0]);
+ cylindricalPosition[2] = position[2];
+ cylindricalPosition[3] = tofRawDatum->GetTOF();
+ cylindricalPosition[4] = tofRawDatum->GetTOT();
+ tToT = tofRawDatum->GetTOT();
tTdcND = -1.;
-
AliTOFcluster *tofCluster = new AliTOFcluster(cylindricalPosition, detectorIndex);
tofCluster->SetToT(tToT);
tofCluster->SetTDCND(tTdcND);
InsertCluster(tofCluster);
- } // while loop
+ if (fVerbose==2) {
+ if (cylindricalPosition[4]<10) ftxt << " " << cylindricalPosition[4];
+ else if (cylindricalPosition[4]>=10 && cylindricalPosition[4]<100) ftxt << " " << cylindricalPosition[4];
+ else ftxt << " " << cylindricalPosition[4];
+ if (cylindricalPosition[3]<10) ftxt << " " << cylindricalPosition[3] << endl;
+ else if (cylindricalPosition[3]>=10 && cylindricalPosition[3]<100) ftxt << " " << cylindricalPosition[3] << endl;
+ else if (cylindricalPosition[3]>=100 && cylindricalPosition[3]<1000) ftxt << " " << cylindricalPosition[3] << endl;
+ else ftxt << " " << cylindricalPosition[3] << endl;
+ }
- } // DDL Loop
+ } // closed loop on TOF raw data per current DDL file
+
+ clonesRawData->Clear();
+
+ } // closed loop on DDL index
+
+ if (fVerbose==2) ftxt.close();
AliInfo(Form("Number of found clusters: %i", fNumberOfTofClusters));
// (temporary solution)
//
+ //const Int_t kDDL = fTOFGeometry->NDDL()*fTOFGeometry->NSectors();
+ const Int_t kDDL = fTOFGeometry->NDDL()*fTOFGeometry->NSectors();
+
fRunLoader->GetEvent(iEvent);
fTreeD = fTOFLoader->TreeD();
fTreeD = fTOFLoader->TreeD();
}
- TClonesArray dummy("AliTOFdigit",10000), *tofDigits=&dummy;
+ TClonesArray *tofDigits = new TClonesArray("AliTOFdigit",10000);
Int_t bufsize = 32000;
fTreeD->Branch("TOF", &tofDigits, bufsize);
-
- const Int_t kDDL = fTOFGeometry->NDDL()*fTOFGeometry->NSectors();
-
fRunLoader->GetEvent(iEvent);
AliDebug(2,Form(" Event number %2i ", iEvent));
- Int_t ii = 0;
- Int_t indexDDL = 0;
+ TClonesArray * clonesRawData;
+
+ Int_t dummy = -1;
Int_t detectorIndex[5];
Float_t digit[4];
+ Int_t indexDDL = 0;
for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
rawReader->Reset();
AliTOFRawStream tofInput(rawReader);
- rawReader->Select("TOF", indexDDL, indexDDL);
+ tofInput.LoadRawData(indexDDL);
- while(tofInput.Next()) {
+ clonesRawData = (TClonesArray*)tofInput.GetRawData();
- for (ii=0; ii<5; ii++) detectorIndex[ii] = -1;
+ for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
- detectorIndex[0] = tofInput.GetSector();
- detectorIndex[1] = tofInput.GetPlate();
- detectorIndex[2] = tofInput.GetStrip();
- detectorIndex[3] = tofInput.GetPadX();
- detectorIndex[4] = tofInput.GetPadZ();
-
- //AliInfo(Form(" %2i %1i %2i %1i %2i ",detectorIndex[0],detectorIndex[1],detectorIndex[2],detectorIndex[3],detectorIndex[4]));
+ AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
- if (detectorIndex[0]==-1 ||
- detectorIndex[1]==-1 ||
- detectorIndex[2]==-1 ||
- detectorIndex[3]==-1 ||
- detectorIndex[4]==-1) continue;
+ if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
+
+ tofInput.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
+ tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
+ dummy = detectorIndex[3];
+ detectorIndex[3] = detectorIndex[4];
+ detectorIndex[4] = dummy;
digit[0] = (Float_t)tofInput.GetTofBin();
digit[1] = (Float_t)tofInput.GetToTbin();
} // while loop
+ clonesRawData->Clear();
+
} // DDL Loop
fTreeD->Fill();