* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.19 2002/10/14 14:57:43 hristov
-Merging the VirtualMC branch to the main development branch (HEAD)
-
-Revision 1.16.6.2 2002/07/24 10:09:30 alibrary
-Updating VirtualMC
-
-Revision 1.16.6.1 2002/06/10 15:28:58 hristov
-Merged with v3-08-02
-
-Revision 1.18 2002/04/12 12:13:23 cblume
-Add Jiris changes
-
-Revision 1.17 2002/03/28 14:59:07 cblume
-Coding conventions
-
-Revision 1.18 2002/04/12 12:13:23 cblume
-Add Jiris changes
-
-Revision 1.17 2002/03/28 14:59:07 cblume
-Coding conventions
-
-Revision 1.16 2002/02/12 11:42:08 cblume
-Remove fTree from destructor
-
-Revision 1.15 2002/02/11 14:27:54 cblume
-Geometry and hit structure update
-
-Revision 1.14 2001/11/14 10:50:46 cblume
-Changes in digits IO. Add merging of summable digits
-
-Revision 1.13 2001/11/06 17:19:41 cblume
-Add detailed geometry and simple simulator
-
-Revision 1.12 2001/05/16 14:57:28 alibrary
-New files for folders and Stack
-
-Revision 1.11 2001/03/13 09:30:35 cblume
-Update of digitization. Moved digit branch definition to AliTRD
-
-Revision 1.10 2001/01/26 19:56:57 hristov
-Major upgrade of AliRoot code
-
-Revision 1.9 2000/11/02 09:25:53 cblume
-Change also the dictionary to AliTRDdataArray
-
-Revision 1.8 2000/11/01 15:20:13 cblume
-Change AliTRDdataArrayI to AliTRDdataArray in MakeBranch()
-
-Revision 1.7 2000/11/01 14:53:20 cblume
-Merge with TRD-develop
-
-Revision 1.1.2.5 2000/10/17 02:27:34 cblume
-Get rid of global constants
-
-Revision 1.1.2.4 2000/10/15 23:40:01 cblume
-Remove AliTRDconst
-
-Revision 1.1.2.3 2000/10/06 16:49:46 cblume
-Made Getters const
-
-Revision 1.1.2.2 2000/10/04 16:34:58 cblume
-Replace include files by forward declarations
-
-Revision 1.5 2000/06/09 11:10:07 cblume
-Compiler warnings and coding conventions, next round
-
-Revision 1.4 2000/06/08 18:32:58 cblume
-Make code compliant to coding conventions
-
-Revision 1.3 2000/06/07 16:27:01 cblume
-Try to remove compiler warnings on Sun and HP
-
-Revision 1.2 2000/05/08 16:17:27 cblume
-Merge TRD-develop
-
-Revision 1.1.2.1 2000/05/08 14:44:01 cblume
-Add new class AliTRDdigitsManager
-
-*/
+/* $Id$ */
///////////////////////////////////////////////////////////////////////////////
// //
#include "AliTRDdataArrayI.h"
#include "AliTRDdigit.h"
#include "AliTRDgeometry.h"
-#include "AliTRD.h"
ClassImp(AliTRDdigitsManager)
fDebug = 0;
fSDigits = 0;
- fFile = NULL;
fTree = NULL;
fDigits = NULL;
for (Int_t iDict = 0; iDict < kNDict; iDict++) {
//_____________________________________________________________________________
AliTRDdigitsManager::AliTRDdigitsManager(const AliTRDdigitsManager &m)
+:TObject(m)
{
//
// AliTRDdigitsManager copy constructor
// AliTRDdigitsManager destructor
//
- if (fFile) {
- fFile->Close();
- delete fFile;
- fFile = NULL;
- }
-
if (fDigits) {
fDigits->Delete();
delete fDigits;
}
}
-
//_____________________________________________________________________________
-void AliTRDdigitsManager::SetRaw()
+void AliTRDdigitsManager::ResetArrays()
{
//
- // Switch on the raw digits flag
+ // Reset the data arrays
//
- fIsRaw = kTRUE;
-
- fDigits->SetBit(AliTRDdigit::RawDigit());
-
-}
-
-//_____________________________________________________________________________
-Short_t AliTRDdigitsManager::GetDigitAmp(Int_t row, Int_t col,Int_t time
- , Int_t det) const
-{
- //
- // Returns the amplitude of a digit
- //
-
- return ((Short_t) GetDigits(det)->GetData(row,col,time));
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDdigitsManager::Open(const Char_t *file)
-{
- //
- // Opens the file for the TRD digits
- //
-
- fFile = (TFile*) gROOT->GetListOfFiles()->FindObject(file);
- if (!fFile) {
- if (fDebug > 0) {
- printf("<AliTRDdigitsManager::Open> ");
- printf("Open the AliROOT-file %s.\n",file);
- }
- fFile = new TFile(file,"UPDATE");
- if (!fFile) return kFALSE;
+ if (fDigits) {
+ delete fDigits;
}
- else {
- if (fDebug > 0) {
- printf("<AliTRDdigitsManager::Open> ");
- printf("%s is already open.\n",file);
+ fDigits = new AliTRDsegmentArray("AliTRDdataArrayI",AliTRDgeometry::Ndet());
+
+ for (Int_t iDict = 0; iDict < kNDict; iDict++) {
+ if (fDictionary[iDict]) {
+ delete fDictionary[iDict];
}
+ fDictionary[iDict] = new AliTRDsegmentArray("AliTRDdataArrayI"
+ ,AliTRDgeometry::Ndet());
}
- return kTRUE;
-
}
//_____________________________________________________________________________
-void AliTRDdigitsManager::MakeTreeAndBranches(TFile *file, Int_t iEvent)
+void AliTRDdigitsManager::SetRaw()
{
//
- // Creates tree for (s)digits in the specified file
+ // Switch on the raw digits flag
//
- fEvent = iEvent;
- TDirectory *wd = gDirectory;
- file->cd();
- MakeBranch();
- wd->cd();
+ fIsRaw = kTRUE;
+ fDigits->SetBit(AliTRDdigit::RawDigit());
+
}
//_____________________________________________________________________________
-Bool_t AliTRDdigitsManager::MakeBranch(const Char_t *file)
+Short_t AliTRDdigitsManager::GetDigitAmp(Int_t row, Int_t col,Int_t time
+ , Int_t det) const
{
//
- // Creates the tree and branches for the digits and the dictionary
+ // Returns the amplitude of a digit
//
- // Create the TRD digits tree
- TTree *tree;
- Char_t treeName[12];
- if (fSDigits) {
- sprintf(treeName,"TreeS%d_TRD",fEvent);
- tree = new TTree(treeName,"TRD SDigits");
- }
- else {
- sprintf(treeName,"TreeD%d_TRD",fEvent);
- tree = new TTree(treeName,"TRD Digits");
- }
-
- if (fDebug > 0) {
- printf("<AliTRDdigitsManager::MakeBranch> ");
- printf("Creating tree %s\n",treeName);
- }
-
- return MakeBranch(tree,file);
+ return ((Short_t) GetDigits(det)->GetData(row,col,time));
}
-
+
//_____________________________________________________________________________
-Bool_t AliTRDdigitsManager::MakeBranch(TTree *tree, const Char_t *file)
+Bool_t AliTRDdigitsManager::MakeBranch(TTree *tree)
{
//
// Creates the tree and branches for the digits and the dictionary
Bool_t status = kTRUE;
- AliTRD *trd = (AliTRD *) gAlice->GetDetector("TRD") ;
-
if (tree) {
fTree = tree;
}
if (fDigits) {
const AliTRDdataArray *kDigits = (AliTRDdataArray *) fDigits->At(0);
if (kDigits) {
- trd->MakeBranchInTree(fTree,"TRDdigits",kDigits->IsA()->GetName()
- ,&kDigits,buffersize,99,file);
+ if (!fTree) return kFALSE;
+ TBranch* branch = fTree->GetBranch("TRDdigits");
+ if (!branch) fTree->Branch("TRDdigits",kDigits->IsA()->GetName(),
+ &kDigits,buffersize,99);
if (fDebug > 0) {
printf("<AliTRDdigitsManager::MakeBranch> ");
printf("Making branch TRDdigits\n");
const AliTRDdataArray *kDictionary =
(AliTRDdataArray *) fDictionary[iDict]->At(0);
if (kDictionary) {
- trd->MakeBranchInTree(fTree,branchname,kDictionary->IsA()->GetName()
- ,&kDictionary,buffersize,99,file);
+ if (!fTree) return kFALSE;
+ TBranch* branch = fTree->GetBranch(branchname);
+ if (!branch) fTree->Branch(branchname,kDictionary->IsA()->GetName(),
+ &kDictionary,buffersize,99);
if (fDebug > 0) {
printf("<AliTRDdigitsManager::MakeBranch> ");
printf("Making branch %s\n",branchname);
fTree = tree;
- }
- else {
-
- // Get the digits tree
- Char_t treeName[12];
- if (fSDigits) {
- sprintf(treeName,"TreeS%d_TRD",fEvent);
- }
- else {
- sprintf(treeName,"TreeD%d_TRD",fEvent);
- }
- if (fFile) {
- fTree = (TTree *) fFile->Get(treeName);
- }
- else {
- fTree = (TTree *) gDirectory->Get(treeName);
- }
-
- if (!fTree) {
- if (fDebug > 0) {
- printf("<AliTRDdigitsManager::ReadDigits> ");
- printf("Could not find tree %s.\n",treeName);
- }
- return kFALSE;
- }
-
}
if (!fDigits) {