* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
-
/* $Id$ */
///////////////////////////////////////////////////////////////////////////////
*/
//End_Html
-
-
-#include <Riostream.h>
-#include <Rstrstream.h>
-#include <stdlib.h>
-
-#include <TBRIK.h>
+#include <TClonesArray.h>
#include <TFile.h>
#include <TFolder.h>
-#include <TNode.h>
-#include <TObject.h>
#include <TROOT.h>
-#include <TSystem.h>
-#include <TTask.h>
#include <TTree.h>
#include <TVirtualMC.h>
-#include <TDirectory.h>
+#include <TStopwatch.h>
-#include "AliLog.h"
-#include "AliConfig.h"
-#include "AliHeader.h"
#include "AliConst.h"
#include "AliLoader.h"
-#include "AliMagF.h"
+#include "AliLog.h"
+#include "AliMC.h"
#include "AliRun.h"
-#include "AliTOF.h"
-#include "AliTOFGeometry.h"
-#include "AliTOFGeometryV4.h"
-#include "AliTOFGeometryV5.h"
-#include "AliTOFSDigit.h"
+#include "AliDAQ.h"
+#include "AliRawReader.h"
+
+//#include "AliTOFDDLRawData.h"
+#include "AliTOFDigitizer.h"
#include "AliTOFdigit.h"
-#include "AliTOFhit.h"
#include "AliTOFhitT0.h"
-#include "AliMC.h"
-#include "AliTOFDigitizer.h"
-#include "AliTOFDDLRawData.h"
-#include "AliTOFcluster.h"
-
+#include "AliTOFhit.h"
+#include "AliTOFGeometry.h"
+#include "AliTOFSDigitizer.h"
+#include "AliTOFSDigit.h"
+#include "AliTOF.h"
+#include "AliTOFrawData.h"
+#include "AliTOFRawStream.h"
+
+class AliTOFcluster;
+
+// extern TROOT *gROOT;
+// extern TVirtualMC *TVirtualMC::GetMC();
+
+// extern AliRun *gAlice;
+
ClassImp(AliTOF)
-
+
//_____________________________________________________________________________
-AliTOF::AliTOF()
+AliTOF::AliTOF():
+ fFGeom(0x0),
+ fSDigits(0x0),
+ fNSDigits(0),
+ fReconParticles(0x0),
+ fIdSens(-1),
+ fTZero(kFALSE),
+ fTOFHoles(kTRUE),
+ fTOFGeometry(0x0),
+ fTOFRawWriter(AliTOFDDLRawData())
{
//
// Default constructor
//
- fFGeom = 0x0;
- fDTask = 0x0;
- fReTask = 0x0;
+
+ //by default all sectors switched on
+ for (Int_t ii=0; ii<18; ii++) fTOFSectors[ii]=0;
+
+ fDigits = 0;
fIshunt = 0;
- fSDigits = 0 ;
- fNSDigits = 0;
- fDigits = 0 ;
- fReconParticles = 0x0;
- fName="TOF";
- fTZero = kFALSE;
- fTOFGeometry = 0;
+ fName = "TOF";
+
}
//_____________________________________________________________________________
AliTOF::AliTOF(const char *name, const char *title, Option_t *option)
- : AliDetector(name,title)
+ :
+ AliDetector(name,title),
+ fFGeom(0x0),
+ fSDigits(0x0),
+ fNSDigits(0),
+ fReconParticles(0x0),
+ fIdSens(-1),
+ fTZero(kFALSE),
+ fTOFHoles(kTRUE),
+ fTOFGeometry(0x0),
+ fTOFRawWriter(AliTOFDDLRawData())
{
//
// AliTOF standard constructor
// Initialization of hits, sdigits and digits array
// added option for time zero analysis
- fFGeom = 0x0; //skowron
- fDTask = 0x0;
- fReTask = 0x0;
- fReconParticles= 0x0;
+ //skowron
fTOFGeometry = new AliTOFGeometry();
+ //by default all sectors switched on
+ for (Int_t ii=0; ii<18; ii++) fTOFSectors[ii]=0;
+
if (strstr(option,"tzero")){
fHits = new TClonesArray("AliTOFhitT0", 1000);
fTZero = kTRUE;
- AliWarning("tzero option requires AliTOFv4T0/AliTOFv5T0 as TOF version (check Your Config.C)");
+ // AliWarning("tzero option requires AliTOFv4T0/AliTOFv5T0 as TOF version (check Your Config.C)");
}else{
fHits = new TClonesArray("AliTOFhit", 1000);
fTZero = kFALSE;
if (gAlice==0) {
AliFatal("gAlice==0 !");
}
- if (gAlice->GetMCApp()->GetHitLists())
- gAlice->GetMCApp()->AddHitList(fHits);
+
+ AliMC *mcApplication = (AliMC*)gAlice->GetMCApp();
+
+ if (mcApplication->GetHitLists())
+ mcApplication->AddHitList(fHits);
else AliError("gAlice->GetHitLists()==0");
fIshunt = 0;
fSDigits = new TClonesArray("AliTOFSDigit", 1000);
fDigits = new TClonesArray("AliTOFdigit", 1000);
- fNSDigits = 0;
-
- fFGeom = 0x0;
- fDTask = 0x0;
- fReTask = 0x0;
- fReconParticles = 0x0;
//
// Digitization parameters
//
// (Transfer Functions to be inserted here)
//
- SetMarkerColor(7);
- SetMarkerStyle(2);
- SetMarkerSize(0.4);
+ //PH SetMarkerColor(7);
+ //PH SetMarkerStyle(2);
+ //PH SetMarkerSize(0.4);
// Strip Parameters
//fGapA = 4.; //cm Gap beetween tilted strip in A-type plate
}
+//____________________________________________________________________________
+void AliTOF::SetTOFSectors(Int_t * const sectors)
+{
+ // Setter for partial/full TOF configuration
+
+ for(Int_t isec=0;isec<18;isec++){
+ fTOFSectors[isec]=sectors[isec];
+ }
+}
+//____________________________________________________________________________
+void AliTOF::GetTOFSectors(Int_t *sectors) const
+{
+ // Getter for partial/full TOF configuration
+
+ for(Int_t isec=0;isec<18;isec++){
+ sectors[isec]=fTOFSectors[isec];
+ }
+}
+
//_____________________________________________________________________________
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::AddDigit(Int_t *tracks, Int_t *vol, Float_t *digits)
+void AliTOF::AddDigit(Int_t *tracks, Int_t *vol, Int_t *digits)
{
//
// Add a TOF digit
}
//_____________________________________________________________________________
-void AliTOF::AddSDigit(Int_t tracknum, Int_t *vol, Float_t *digits)
+void AliTOF::AddSDigit(Int_t tracknum, Int_t *vol, Int_t *digits)
{
//
Float_t xTof, yTof;
- if (IsVersion()==7) {
+ if (IsVersion()==8) {
- xTof = fTOFGeometry->StripLength()+2.*(0.3+0.03); // cm, x-dimension of FTOA volume
+ xTof = 124.5;//fTOFGeometry->StripLength()+2.*(0.3+0.03); // cm, x-dimension of FTOA volume
+ yTof = fTOFGeometry->Rmax()-fTOFGeometry->Rmin(); // cm, y-dimension of FTOA volume
+ Float_t zTof = fTOFGeometry->ZlenA(); // cm, z-dimension of FTOA volume
+
+ // TOF module internal definitions
+ TOFpc(xTof, yTof, zTof);
+
+ } else if (IsVersion()==7) {
+
+ xTof = 124.5;//fTOFGeometry->StripLength()+2.*(0.3+0.03); // cm, x-dimension of FTOA volume
yTof = fTOFGeometry->Rmax()-fTOFGeometry->Rmin(); // cm, y-dimension of FTOA volume
Float_t zTof = fTOFGeometry->ZlenA(); // cm, z-dimension of FTOA volume
}
-//_____________________________________________________________________________
-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");
-}
-
-//_____________________________________________________________________________
-Int_t AliTOF::DistancetoPrimitive(Int_t , Int_t )
-{
- //
- // Returns distance from mouse pointer to detector, default version
- //
- return 9999;
-}
//___________________________________________
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
TDirectory* saveDir = gDirectory;
- gAlice->GetRunLoader()->CdGAFile();
+ AliRunLoader::Instance()->CdGAFile();
fTOFGeometry->Write("TOFGeometry");
saveDir->cd();
*/
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");
}
// Use the TOF SDigitizer to make TOF SDigits
//
-// cout<<"AliTOF::Hits2SDigits> start...\n";
+// AliInfo("Start...");
AliRunLoader * rl = fLoader->GetRunLoader();
+ AliDebug(2,"Initialized runLoader");
AliTOFSDigitizer sd((rl->GetFileName()).Data());
- ToAliDebug(1, sd.Print(""));
+ AliDebug(2,"Initialized TOF sdigitizer");
+ //ToAliDebug(1, sd.Print(""));
+ //AliInfo("ToAliDebug");
- sd.Exec("") ;
+ //sd.Digitize("all") ;
+ sd.Digitize("partial") ;
+
+ AliDebug(2,"I am sorting from AliTOF class");
}
//
if ((evNumber2-evNumber1)==1)
- AliDebug(1, Form("I am making sdigits for the %dth event", evNumber1))
- else if ((evNumber2-evNumber1)>1)
- AliDebug(1, Form("I am making sdigits for the events from the "
- "%dth to the %dth", evNumber1, evNumber2-1));
+ AliDebug(1, Form("I am making sdigits for the %dth event", evNumber1));
+ if ((evNumber2-evNumber1)>1)
+ AliDebug(1, Form("I am making sdigits for the events from the %dth to the %dth", evNumber1, evNumber2-1));
AliRunLoader * rl = fLoader->GetRunLoader();
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
{
- return new AliTOFDigitizer(manager);
+ AliDebug(2,"I am creating the TOF digitizer");
+ return new AliTOFDigitizer(digInput);
}
//___________________________________________________________________________
-Bool_t AliTOF::CheckOverlap(Int_t* vol, Float_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.
if (vol[i]!=vol2[i]) idem=kFALSE;}
if (idem){ // same pad fired
- Float_t tdc2 = digit[0];
- Float_t tdc1 = currentDigit->GetTdc();
+ Int_t tdc2 = digit[0];
+ Int_t tdc1 = currentDigit->GetTdc();
// we separate two digits on the same pad if
// they are separated in time by at least 25 ns
overlap = kTRUE;
return overlap;
} else
- overlap= kFALSE;
+ overlap= kFALSE;
} // close if (idem) -> two digits on the same TOF pad
// Starting from the TOF digits, writes the Raw Data objects
//
+ TStopwatch stopwatch;
+ stopwatch.Start();
+
fLoader->LoadDigits();
TTree* digits = fLoader->TreeD();
return;
}
- //AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read");
- fRunLoader->CdGAFile();
- TFile *in=(TFile*)gFile;
- in->cd();
- AliTOFGeometry *geometry = (AliTOFGeometry*)in->Get("TOFgeometry");
-
- AliTOFDDLRawData rawWriter(geometry);
//AliTOFDDLRawData rawWriter;
- rawWriter.SetVerbose(0);
+ fTOFRawWriter.Clear();
+ fTOFRawWriter.SetVerbose(0);
+ if (fTOFRawWriter.GetPackedAcquisitionMode()) {
+ if(fTOFRawWriter.GetMatchingWindow()>8192)
+ AliWarning(Form("You are running in packing mode and the matching window is %.2f ns, i.e. greater than 199.8848 ns",
+ fTOFRawWriter.GetMatchingWindow()*AliTOFGeometry::TdcBinWidth()*1.e-03));
+ }
- AliInfo("Formatting raw data for TOF");
+ AliDebug(1,"Formatting raw data for TOF");
digits->GetEvent(0);
- rawWriter.RawDataTOF(digits->GetBranch("TOF"));
+ fTOFRawWriter.RawDataTOF(digits->GetBranch("TOF"));
fLoader->UnloadDigits();
+ AliDebug(1, Form("Execution time to write TOF raw data : R:%.2fs C:%.2fs",
+ stopwatch.RealTime(),stopwatch.CpuTime()));
+
}
//____________________________________________________________________________
// delete TClonesArray fSDigits and create it again
// needed for backward compatability with PPR test production
//
- delete fSDigits;
- fSDigits = new TClonesArray("AliTOFSDigit", 1000);
+ fSDigits->Clear();
}
//____________________________________________________________________________
void AliTOF::CreateSDigitsArray() {
//
fSDigits = new TClonesArray("AliTOFSDigit", 1000);
}
+//____________________________________________________________________________
+Bool_t AliTOF::Raw2SDigits(AliRawReader* rawReader)
+{
+ //
+ // Converts raw data to sdigits for TOF
+ //
+
+ TStopwatch stopwatch;
+ stopwatch.Start();
+
+ if(!GetLoader()->TreeS()) {MakeTree("S"); MakeBranch("S");}
+ //TClonesArray &aSDigits = *fSDigits;
+
+ AliTOFRawStream tofRawStream = AliTOFRawStream();
+ tofRawStream.Raw2SDigits(rawReader, fSDigits);
+
+ GetLoader()->TreeS()->Fill(); GetLoader()->WriteSDigits("OVERWRITE");//write out sdigits
+ Int_t nSDigits = fSDigits->GetEntries();
+
+ ResetSDigits();
+
+ AliDebug(1, Form("Got %d TOF sdigits", nSDigits));
+ AliDebug(1, Form("Execution time to read TOF raw data and fill TOF sdigit tree : R:%.2fs C:%.2fs",
+ stopwatch.RealTime(),stopwatch.CpuTime()));
+
+ return kTRUE;
+
+}
+
+//____________________________________________________________________________
+void AliTOF::Raw2Digits(AliRawReader* rawReader)
+{
+ //
+ // Converts raw data to digits for TOF
+ //
+
+ TStopwatch stopwatch;
+ stopwatch.Start();
+
+ if(!GetLoader()->TreeD()) {MakeTree("D"); MakeBranch("D");}
+ //TClonesArray &aDigits = *fDigits;
+
+ AliTOFRawStream tofRawStream = AliTOFRawStream();
+ tofRawStream.Raw2Digits(rawReader, fDigits);
+
+ GetLoader()->TreeD()->Fill(); GetLoader()->WriteDigits("OVERWRITE");//write out digits
+ Int_t nDigits = fDigits->GetEntries();
+
+ ResetDigits();
+
+ AliDebug(1, Form("Got %d TOF digits", nDigits));
+ AliDebug(1, Form("Execution time to read TOF raw data and fill TOF digit tree : R:%.2fs C:%.2fs",
+ stopwatch.RealTime(),stopwatch.CpuTime()));
+
+}