#include <TFile.h>
#include <TFolder.h>
#include <TROOT.h>
-#include <TTask.h>
#include <TTree.h>
#include <TVirtualMC.h>
#include <TStopwatch.h>
class AliTOFcluster;
-extern TFile *gFile;
-extern TROOT *gROOT;
-extern TVirtualMC *gMC;
+// extern TROOT *gROOT;
+// extern TVirtualMC *TVirtualMC::GetMC();
-extern AliRun *gAlice;
+// extern AliRun *gAlice;
ClassImp(AliTOF)
//_____________________________________________________________________________
AliTOF::AliTOF():
fFGeom(0x0),
- fDTask(0x0),
- fReTask(0x0),
fSDigits(0x0),
fNSDigits(0),
fReconParticles(0x0),
:
AliDetector(name,title),
fFGeom(0x0),
- fDTask(0x0),
- fReTask(0x0),
fSDigits(0x0),
fNSDigits(0),
fReconParticles(0x0),
}
//____________________________________________________________________________
-void AliTOF::SetTOFSectors(Int_t *sectors)
+void AliTOF::SetTOFSectors(Int_t * const sectors)
{
// Setter for partial/full TOF configuration
void AliTOF::CreateTOFFolders()
{
// create the ALICE TFolder
- // create the ALICE TTasks
// create the ALICE main TFolder
// to be done by AliRun
aliceF->SetOwner() ;
// geometry folder
TFolder * geomF = aliceF->AddFolder("Geometry", "Geometry objects") ;
- TFolder * aliceT = alice->AddFolder("tasks", "Alice tasks Folder") ;
- // make it the owner of the objects that it contains
- aliceT->SetOwner() ;
-
- TTask * aliceDi = new TTask("(S)Digitizer", "Alice SDigitizer & Digitizer") ;
- aliceT->Add(aliceDi);
-
- TTask * aliceRe = new TTask("Reconstructioner", "Alice Reconstructioner") ;
- aliceT->Add(aliceRe);
-
- char * tempo = new char[80] ;
-
- // creates the TOF Digitizer and adds it to alice main (S)Digitizer task
- sprintf(tempo, "%sDigitizers container",GetName() ) ;
- fDTask = new TTask(GetName(), tempo);
- aliceDi->Add(fDTask) ;
-
- // creates the TOF reconstructioner and adds it to alice main Reconstructioner task
- sprintf(tempo, "%sReconstructioner container",GetName() ) ;
- fReTask = new TTask(GetName(), tempo);
- aliceRe->Add(fReTask) ;
-
- delete [] tempo ;
// creates the TOF geometry folder
geomF->AddFolder("TOF", "Geometry for TOF") ;
{
// dtor:
// it remove also the alice folder
- // and task that TOF creates instead of AliRun
/* PH Temporarily commented because of problems
TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("FPAlice") ;
delete alice;
}
-//_____________________________________________________________________________
-void AliTOF::DrawModule() const
-{
- //
- // Draw a shaded view of the common part of the TOF geometry
- //
-
- AliInfo(" Drawing of AliTOF");
- // Set everything unseen
- gMC->Gsatt("*", "seen", -1);
- //
- // Set ALIC mother transparent
- gMC->Gsatt("ALIC","SEEN",0);
- //
- // Set the volumes visible
- gMC->Gsatt("FTOA","SEEN",1);
- gMC->Gsatt("FTOB","SEEN",1);
- gMC->Gsatt("FTOC","SEEN",1);
- gMC->Gsatt("FLTA","SEEN",1);
- gMC->Gsatt("FLTB","SEEN",1);
- gMC->Gsatt("FLTC","SEEN",1);
- gMC->Gsatt("FSTR","SEEN",1);
- //
- gMC->Gdopt("hide", "on");
- gMC->Gdopt("shad", "on");
- gMC->Gsatt("*", "fill", 7);
- gMC->SetClipBox(".");
- gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
- gMC->DefaultRange();
- gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
- gMC->Gdhead(1111, "Time Of Flight");
- gMC->Gdman(18, 4, "MAN");
- gMC->Gdopt("hide","off");
-}
//___________________________________________
void AliTOF::ResetHits ()
// Initialise TOF detector after it has been built
//
// Set id of TOF sensitive volume
- if (IsVersion() !=0) fIdSens=gMC->VolId("FPAD");
+ if (IsVersion() !=0) fIdSens=TVirtualMC::GetMC()->VolId("FPAD");
/*
// Save the geometry
AliDetector::MakeBranch(option);
Int_t buffersize = 4000;
- Char_t branchname[10];
- sprintf(branchname,"%s",GetName());
+ const Int_t kSize=10;
+ Char_t branchname[kSize];
+ snprintf(branchname,kSize,"%s",GetName());
const char *oD = strstr(option,"D");
const char *oS = strstr(option,"S");
// disabled for TOFv0
//
if (hits && (IsVersion()!=0))
- fIdSens = gMC->VolId("FPAD");
+ fIdSens = TVirtualMC::GetMC()->VolId("FPAD");
else
AliInfo("Option for writing the TOF-hits branch on TreeH: disabled");
}
// AliInfo("Start...");
AliRunLoader * rl = fLoader->GetRunLoader();
- AliInfo("Initialized runLoader");
+ AliDebug(2,"Initialized runLoader");
AliTOFSDigitizer sd((rl->GetFileName()).Data());
- AliInfo("Initialized TOF sdigitizer");
+ AliDebug(2,"Initialized TOF sdigitizer");
//ToAliDebug(1, sd.Print(""));
- AliInfo("ToAliDebug");
+ //AliInfo("ToAliDebug");
- sd.Exec("all") ;
+ //sd.Digitize("all") ;
+ sd.Digitize("partial") ;
- AliInfo("I am sorting from AliTOF class");
+ AliDebug(2,"I am sorting from AliTOF class");
}
AliTOFSDigitizer sd((rl->GetFileName()).Data(),evNumber1,evNumber2) ;
ToAliDebug(1, sd.Print(""));
- sd.Exec("") ;
+ sd.Digitize("") ;
}
//___________________________________________________________________________
-AliDigitizer* AliTOF::CreateDigitizer(AliRunDigitizer* manager) const
+AliDigitizer* AliTOF::CreateDigitizer(AliDigitizationInput* digInput) const
{
- AliInfo("I am in the AliTOF::CreateDigitizer)");
- return new AliTOFDigitizer(manager);
+ AliDebug(2,"I am creating the TOF digitizer");
+ return new AliTOFDigitizer(digInput);
}
//___________________________________________________________________________
-Bool_t AliTOF::CheckOverlap(Int_t* vol, Int_t* digit,Int_t Track)
+Bool_t AliTOF::CheckOverlap(const Int_t * const vol,
+ Int_t* digit,Int_t Track)
{
//
// Checks if 2 or more hits belong to the same pad.
AliTOFRawStream tofRawStream = AliTOFRawStream();
tofRawStream.Raw2SDigits(rawReader, fSDigits);
- /*
- //ofstream ftxt;
- //if (fVerbose==2) ftxt.open("TOFsdigitsRead.txt",ios::app);
- Int_t inholes = 0;
-
- const Int_t kDDL = AliDAQ::NumberOfDdls("TOF");
-
- TClonesArray staticRawData("AliTOFrawData",10000);
- staticRawData.Clear();
- TClonesArray * clonesRawData = &staticRawData;
-
- Int_t dummy = -1;
- Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
- Int_t digit[2];
- Int_t track = -1;
- Int_t last = -1;
-
- Int_t indexDDL = 0;
- Int_t iRawData = 0;
- for (indexDDL=0; indexDDL<kDDL; indexDDL++) {
-
- rawReader->Reset();
- //if (fDecoderVersion) {
- //AliInfo("Using New Decoder \n");
- //fTOFRawStream.LoadRawDataBuffers(indexDDL, 0);
- //}
- //else
- fTOFRawStream.LoadRawData(indexDDL);
-
- clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
- if (clonesRawData->GetEntriesFast()!=0) AliInfo(Form(" TOF raw data number = %3d", clonesRawData->GetEntriesFast()));
- for (iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
-
- AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
-
- //if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
- if (tofRawDatum->GetTOF()==-1) continue;
-
- fTOFRawStream.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
- tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
-
- dummy = detectorIndex[3];
- detectorIndex[3] = detectorIndex[4];//padz
- detectorIndex[4] = dummy;//padx
-
- digit[0] = tofRawDatum->GetTOF();
- digit[1] = tofRawDatum->GetTOT();
-
- dummy = detectorIndex[3];
- detectorIndex[3] = detectorIndex[4];//padx
- detectorIndex[4] = dummy;//padz
-
- // Do not reconstruct anything in the holes
- if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes
- if (detectorIndex[1]==2) { // plate with holes
- inholes++;
- continue;
- }
- }
-
- last = fSDigits->GetEntriesFast();
- new (aSDigits[last]) AliTOFSDigit(track, detectorIndex, digit);
- //
- 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();
-
- 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[4];
- if (detectorIndex[4]<10) ftxt << " " << detectorIndex[3];
- else ftxt << " " << detectorIndex[3];
-
- if (digit[1]<10)ftxt << " " << digit[1];
- else if (digit[1]>=10 && digit[1]<100) ftxt << " " << digit[1];
- else ftxt << " " << digit[1];
- if (digit[0]<10) ftxt << " " << digit[0] << endl;
- else if (digit[0]>=10 && digit[0]<100) ftxt << " " << digit[0] << endl;
- else if (digit[0]>=100 && digit[0]<1000) ftxt << " " << digit[0] << endl;
- else ftxt << " " << digit[3] << endl;
- }
- //
- AliDebug(2, Form(" Raw data reading %2d -> %2d %1d %2d %1d %2d (%d, %d, %d)",
- last,
- detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[4], detectorIndex[3],
- digit[0], digit[1], digit[3]));
-
- } // while loop
-
- clonesRawData->Clear();
-
- } // DDL Loop
-
- //if (fVerbose==2) ftxt.close();
-
- if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
-
- */
GetLoader()->TreeS()->Fill(); GetLoader()->WriteSDigits("OVERWRITE");//write out sdigits
Int_t nSDigits = fSDigits->GetEntries();
AliTOFRawStream tofRawStream = AliTOFRawStream();
tofRawStream.Raw2Digits(rawReader, fDigits);
- /*
- Int_t inholes = 0;
-
- const Int_t kMaxNumberOfTracksPerDigit = 3;
- const Int_t kDDL = AliDAQ::NumberOfDdls("TOF");
-
- AliTOFRawStream fTOFRawStream = AliTOFRawStream();
- fTOFRawStream.Clear();
- fTOFRawStream.SetRawReader(rawReader);
-
- //ofstream ftxt;
- //if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app);
-
- TClonesArray staticRawData("AliTOFrawData",10000);
- staticRawData.Clear();
- TClonesArray * clonesRawData = &staticRawData;
-
- Int_t dummy = -1;
- Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
- Int_t digit[4];
- Int_t tracks[kMaxNumberOfTracksPerDigit];
- for (Int_t ii=0; ii<kMaxNumberOfTracksPerDigit; ii++)
- tracks[ii] = -1;
- Int_t last = -1;
-
- Int_t indexDDL = 0;
- Int_t iRawData = 0;
- for (indexDDL=0; indexDDL<kDDL; indexDDL++) {
-
- rawReader->Reset();
- //if (fDecoderVersion) {
- //AliInfo("Using New Decoder \n");
- //fTOFRawStream.LoadRawDataBuffers(indexDDL, 0);
- //}
- //else
- fTOFRawStream.LoadRawData(indexDDL);
-
- clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
- if (clonesRawData->GetEntriesFast()!=0) AliInfo(Form(" TOF raw data number = %3d", clonesRawData->GetEntriesFast()));
- for (iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
-
- AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
-
- //if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
- if (tofRawDatum->GetTOF()==-1) continue;
-
- fTOFRawStream.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
- tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
-
- dummy = detectorIndex[3];
- detectorIndex[3] = detectorIndex[4];//padz
- detectorIndex[4] = dummy;//padx
-
- digit[0] = tofRawDatum->GetTOF();
- digit[1] = tofRawDatum->GetTOT();
- digit[2] = tofRawDatum->GetTOT();
- digit[3] = -1;//tofRawDatum->GetTOF(); //tofND
-
- dummy = detectorIndex[3];
- detectorIndex[3] = detectorIndex[4];//padx
- detectorIndex[4] = dummy;//padz
-
- // Do not reconstruct anything in the holes
- if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes
- if (detectorIndex[1]==2) { // plate with holes
- inholes++;
- continue;
- }
- }
-
- last = fDigits->GetEntriesFast();
- new (aDigits[last]) AliTOFdigit(tracks, detectorIndex, digit);
- //
- 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();
-
- 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[4];
- if (detectorIndex[4]<10) ftxt << " " << detectorIndex[3];
- else ftxt << " " << detectorIndex[3];
-
- if (digit[1]<10)ftxt << " " << digit[1];
- else if (digit[1]>=10 && digit[1]<100) ftxt << " " << digit[1];
- else ftxt << " " << digit[1];
- if (digit[0]<10) ftxt << " " << digit[0] << endl;
- else if (digit[0]>=10 && digit[0]<100) ftxt << " " << digit[0] << endl;
- else if (digit[0]>=100 && digit[0]<1000) ftxt << " " << digit[0] << endl;
- else ftxt << " " << digit[3] << endl;
- }
- //
- AliDebug(2, Form(" Raw data reading %2d -> %2d %1d %2d %1d %2d (%d, %d, %d)",
- last,
- detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[4], detectorIndex[3],
- digit[0], digit[1], digit[3]));
-
- } // while loop
-
- clonesRawData->Clear();
-
- } // DDL Loop
-
- if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
-
- //if (fVerbose==2) ftxt.close();
- */
-
GetLoader()->TreeD()->Fill(); GetLoader()->WriteDigits("OVERWRITE");//write out digits
Int_t nDigits = fDigits->GetEntries();