From 68861244d291f007608a46e0d3833153ee26bfd0 Mon Sep 17 00:00:00 2001 From: vicinanz Date: Tue, 28 Aug 2001 08:45:59 +0000 Subject: [PATCH] TTask and TFolder structures implemented --- TOF/AliTOF.cxx | 482 ++++++++++++++++++++-------------------- TOF/AliTOF.h | 136 +++--------- TOF/AliTOFDigitizer.cxx | 383 +++++++++++++++++++++++++++++++ TOF/AliTOFDigitizer.h | 55 +++++ TOF/AliTOFRawDigit.cxx | 47 ++++ TOF/AliTOFRawDigit.h | 36 +++ TOF/AliTOFRawSector.cxx | 191 ++++++++++++++++ TOF/AliTOFRawSector.h | 51 +++++ TOF/AliTOFRoc.cxx | 276 +++++++++++++++++++++++ TOF/AliTOFRoc.h | 85 +++++++ TOF/AliTOFdigit.cxx | 211 ++++++++++++++++++ TOF/AliTOFdigit.h | 66 ++++++ TOF/AliTOFhit.cxx | 126 +++++++++++ TOF/AliTOFhit.h | 66 ++++++ TOF/AliTOFv0.cxx | 341 +++++++++++++++------------- TOF/AliTOFv0.h | 11 +- TOF/AliTOFv1.cxx | 19 +- TOF/AliTOFv1.h | 3 +- TOF/AliTOFv2.cxx | 51 +++-- TOF/AliTOFv2.h | 3 +- TOF/AliTOFv3.cxx | 61 ++--- TOF/AliTOFv3.h | 3 +- TOF/AliTOFv4.cxx | 70 +++--- TOF/AliTOFv4.h | 3 +- TOF/Makefile | 3 +- TOF/TOFLinkDef.h | 1 + 26 files changed, 2172 insertions(+), 608 deletions(-) create mode 100644 TOF/AliTOFDigitizer.cxx create mode 100644 TOF/AliTOFDigitizer.h create mode 100644 TOF/AliTOFRawDigit.cxx create mode 100644 TOF/AliTOFRawDigit.h create mode 100644 TOF/AliTOFRawSector.cxx create mode 100644 TOF/AliTOFRawSector.h create mode 100644 TOF/AliTOFRoc.cxx create mode 100644 TOF/AliTOFRoc.h create mode 100644 TOF/AliTOFdigit.cxx create mode 100644 TOF/AliTOFdigit.h create mode 100644 TOF/AliTOFhit.cxx create mode 100644 TOF/AliTOFhit.h diff --git a/TOF/AliTOF.cxx b/TOF/AliTOF.cxx index 9d4225213e3..041e21f1a99 100644 --- a/TOF/AliTOF.cxx +++ b/TOF/AliTOF.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.21 2001/05/16 14:57:24 alibrary +New files for folders and Stack + Revision 1.20 2001/05/04 10:09:47 vicinanz Major upgrades to the strip structure @@ -55,9 +58,10 @@ Revision 1.9 1999/09/29 09:24:33 fca Introduction of the Copyright and cvs Log */ + /////////////////////////////////////////////////////////////////////////////// // // -// Time Of Flight FCA // +// Time Of Flight // // This class contains the basic functions for the Time Of Flight // // detector. Functions specific to one particular geometry are // // contained in the derived classes // @@ -82,15 +86,24 @@ Introduction of the Copyright and cvs Log /////////////////////////////////////////////////////////////////////////////// #include +#include #include "AliTOF.h" -#include "AliTOFD.h" +#include "AliTOFhit.h" +#include "AliTOFdigit.h" +#include "AliTOFRawSector.h" +#include "AliTOFRoc.h" +#include "AliTOFRawDigit.h" + +#include "TROOT.h" #include "TBRIK.h" #include "TNode.h" #include "TObject.h" #include "TRandom.h" #include "TTree.h" #include "TFile.h" +#include "TFolder.h" +#include "TTask.h" #include "AliRun.h" #include "AliMC.h" @@ -107,6 +120,10 @@ AliTOF::AliTOF() // Default constructor // fIshunt = 0; + fSDigits = 0 ; + fDigits = 0 ; + fName="TOF"; + CreateTOFFolders(); } //_____________________________________________________________________________ @@ -119,12 +136,17 @@ AliTOF::AliTOF(const char *name, const char *title) // Here are fixed some important parameters // - // Initialization of hits and digits array + // Initialization of hits, sdigits and digits array // fHits = new TClonesArray("AliTOFhit", 405); gAlice->AddHitList(fHits); fIshunt = 0; - fDigits = new TClonesArray("AliTOFdigit",405); + + fSDigits = new TClonesArray("AliTOFdigit", 405); + + fDigits = new TClonesArray("AliTOFdigit", 405); + + // // Digitization parameters // @@ -165,11 +187,73 @@ AliTOF::AliTOF(const char *name, const char *title) fChrgRes = 100.;//pC // DAQ characteristics - fPadXSector = 1932; - fNRoc = 14; - fNFec = 32; - fNTdc = 32; - fNPadXRoc = (Int_t)fPadXSector/fNRoc; +// cfr. TOF-TDR pag. 105 for Glossary +// TARODA : TOF-ALICE Read Out and Data Acquisition system + fPadXSector = 8928; // number of pad per sector -with no holes- + // ((15+2*19+2*20)*(48*2)) + fNRoc = 14; // number of Roc (Read Out Controller) (TARODA) + fNFec = 32; // number of Fec (Front-End electronic Card) + // (TARODA) + fNTdc = 32; // number of Tdc (Time to Digital Converter) + fNPadXRoc = (Int_t)fPadXSector/fNRoc; // number of pads for each ROC + + // Create TOF Folder Structure + CreateTOFFolders(); +} + +//_____________________________________________________________________________ +void AliTOF::CreateTOFFolders() +{ + // create the ALICE TFolder + // create the ALICE TTasks + // create the ALICE main TFolder + // to be done by AliRun + + TFolder * alice = new TFolder(); + alice->SetNameTitle("FPAlice", "Alice Folder") ; + gROOT->GetListOfBrowsables()->Add(alice) ; + + TFolder * aliceF = alice->AddFolder("folders", "Alice memory Folder") ; + // make it the owner of the objects that it contains + 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") ; +} + +//_____________________________________________________________________________ +AliTOF::~AliTOF() +{ + // remove the alice folder + // and task that TOF creates instead of AliRun + TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("FPAlice") ; + delete alice; + alice = 0; } //_____________________________________________________________________________ @@ -177,6 +261,7 @@ void AliTOF::AddHit(Int_t track, Int_t *vol, Float_t *hits) { // // Add a TOF hit + // new with placement used // TClonesArray &lhits = *fHits; new(lhits[fNhits++]) AliTOFhit(fIshunt, track, vol, hits); @@ -187,6 +272,7 @@ void AliTOF::AddDigit(Int_t *tracks, Int_t *vol, Float_t *digits) { // // Add a TOF digit + // new with placement used // TClonesArray &ldigits = *fDigits; new (ldigits[fNdigits++]) AliTOFdigit(tracks, vol, digits); @@ -222,7 +308,7 @@ void AliTOF::CreateGeometry() } //_____________________________________________________________________________ -void AliTOF::DrawModule() +void AliTOF::DrawModule() const { // // Draw a shaded view of the common part of the TOF geometry @@ -389,7 +475,7 @@ void AliTOF::CreateMaterials() } //_____________________________________________________________________________ -Int_t AliTOF::DistancetoPrimitive(Int_t , Int_t ) +Int_t AliTOF::DistancetoPrimitive(Int_t , Int_t ) const { // // Returns distance from mouse pointer to detector, default version @@ -415,111 +501,196 @@ void AliTOF::MakeBranch(Option_t* option, const char *file) // Initializes the Branches of the TOF inside the // trees written for each event. // AliDetector::MakeBranch initializes just the - // Branch inside TreeH. Here we add the branch in - // TreeD. + // Branch inside TreeH. Here we add the branches in + // TreeD and TreeS. // - AliDetector::MakeBranch(option,file); Int_t buffersize = 4000; Char_t branchname[10]; sprintf(branchname,"%s",GetName()); - const char *D = strstr(option,"D"); + const char *oD = strstr(option,"D"); + const char *oS = strstr(option,"S"); + + if (oD) + // + // one branch for TOF digits + // + - if (fDigits && gAlice->TreeD() && D){ - MakeBranchInTree(gAlice->TreeD(), + if (fDigits && gAlice->TreeD() && oD){ + MakeBranchInTree(gAlice->TreeD(), branchname, &fDigits,buffersize, file) ; } + + if (oS) + // + // one branch for TOF sdigits + // + + + if (fSDigits && gAlice->TreeS() && oS){ + MakeBranchInTree(gAlice->TreeS(), + branchname, &fSDigits,buffersize, file) ; + } + +} + +//____________________________________________________________________________ +void AliTOF::Makehits(Bool_t hits) +{ +// default argument used, see AliTOF.h +// Enable/Disable the writing of the TOF-hits branch +// on TreeH +// by default : enabled for TOFv1, v2, v3, v4 +// disabled for TOFv0 +// + if (hits && (IsVersion()!=0)) + fIdSens = gMC->VolId("FPAD"); + else + cout << "Option for writing the TOF-hits branch on TreeH: disabled" << endl; } //____________________________________________________________________________ void AliTOF::FinishEvent() { -// Hits2Digits(); +// do nothing } //___________________________________________ void AliTOF::SDigits2Digits() { // -// Genneratedigits +// Generate digits // int nparticles = gAlice->GetNtrack(); cout << "Particles :" < 0 ) { - Hits2Digits(0); + AliTOF::Hits2Digits(); } } //____________________________________________________________________________ -void AliTOF::Hits2Digits(Int_t evNumber) +void AliTOF::Hits2Digits() { // -// Starting from the Hits Tree (TreeH), this -// function writes the Digits Tree (TreeD) storing +// Starting from the Hits Tree (TreeH), this +// function writes the TOF Digits Branch in the Tree (TreeD) storing // the digits informations. -// Has to be called just at the end of an event or +// It has to be called just at the end of an event or // at the end of a whole run. -// It could also be called by AliTOF::Finish Event() -// but it can be too heavy. +// It could also be called by AliTOF::Finish Event() // Just for MC events. // -// Called by the macro H2D.C +// Called by the ROOT script Hits2Digits.C // +// Simulation of detector response. - AliTOFhit* currentHit; - TTree *tD, *tH; - Int_t tracks[3]; - Int_t vol[5]; - Float_t digit[2]; - TClonesArray* tofhits=this->Hits(); - - Int_t nparticles = gAlice->GetNtrack(); - if (nparticles <= 0) return; + Int_t ver = this->IsVersion(); + if(ver==0) return; // no digits for AliTOFv0 - tD = gAlice->TreeD(); - tH = gAlice->TreeH(); - Int_t ntracks =(Int_t) tH->GetEntries(); - Int_t nbytes, nhits; + Int_t nhits = 0; // total number of hits for the current track + Int_t evNumber = 0; // evnumber + Int_t tracks[3]; // track info + Int_t vol[5]; // dummy location for digit + Float_t digit[2]; // TOF digit variables + TRandom* rnd = new TRandom(); - for (Int_t ntk=0; ntkGetEvent(ntk); - nhits = tofhits->GetEntriesFast(); + // Get pointers to Alice detectors and Hits containers + AliDetector* TOF = gAlice->GetDetector("TOF"); + + + TTree* tD = gAlice->TreeD(); + + TTree* tH = gAlice->TreeH(); // pointer to the hits tree + Stat_t ntracks = tH->GetEntries(); + + cout << "Total number of processed tracks in event " << gAlice->GetEvNumber() << + " :" << ntracks << endl; + + // do nothing if no tracked particles + + if( ntracks > 0){ - for (Int_t hit=0; hitAt(hit)); + for(tofHit=(AliTOFhit*)TOF->FirstHit(track); tofHit; tofHit=(AliTOFhit*)TOF->NextHit()) { + ++nhits; + ++totnhits; - vol[0] = currentHit->GetSector(); - vol[1] = currentHit->GetPlate(); - vol[2] = currentHit->GetPadx(); - vol[3] = currentHit->GetPadz(); - vol[4] = currentHit->GetStrip(); + vol[0] = tofHit->GetSector(); + vol[1] = tofHit->GetPlate(); + vol[2] = tofHit->GetPadx(); + vol[3] = tofHit->GetPadz(); + vol[4] = tofHit->GetStrip(); - Float_t idealtime = currentHit->GetTof(); + // 95% of efficiency to be inserted here + // edge effect to be inserted here + // cross talk to be inserted here + + Float_t idealtime = tofHit->GetTof(); // unit s + idealtime *= 1.E+12; // conversion from s to ps + // fTimeRes is given usually in ps Float_t tdctime = rnd->Gaus(idealtime, fTimeRes); digit[0] = tdctime; - Float_t idealcharge = currentHit->GetEdep(); + // typical Landau Distribution to be inserted here + // instead of Gaussian Distribution + Float_t idealcharge = tofHit->GetEdep(); Float_t adccharge = rnd->Gaus(idealcharge, fChrgRes); digit[1] = adccharge; - - Int_t tracknum = currentHit -> GetTrack(); + Int_t tracknum = tofHit -> GetTrack(); tracks[0] = tracknum; tracks[1] = 0; tracks[2] = 0; Bool_t overlap = CheckOverlap(vol, digit, tracknum); - if(!overlap) AddDigit(tracks, vol, digit); - } - } - delete rnd; - rnd = 0; - tD->Fill(); - tD->Write(); + if(!overlap) + AddDigit(tracks, vol, digit); + ++totndigits; + } // end loop on hits for the current track + + } // end loop on ntracks + + // some statistics concerning digitization + cout << "Total number of processed TOF hits: " << totnhits << endl; + cout << "Total number of created TOF digits: " << totndigits << endl; + + } // close if TOF switched ON + +} // close if( ntracks > 0) + +// free used memory for TRandom object + delete rnd; + rnd = 0; + +// fill and write the branch + + evNumber = gAlice->GetEvNumber(); + char hname[30]; + sprintf(hname,"TreeD%d",evNumber); + + tD->Fill(); + + tD->Write(hname,TObject::kOverwrite); + + // reset tree + gAlice->TreeD()->Reset(); } //___________________________________________________________________________ @@ -568,6 +739,7 @@ void AliTOF::Digits2Raw(Int_t evNumber) TTree* tD; + // do nothing if no particles Int_t nparticles = gAlice->GetEvent(evNumber); if (nparticles <= 0) return; @@ -597,8 +769,8 @@ void AliTOF::Digits2Raw(Int_t evNumber) AliTOFRoc* currentROC = (AliTOFRoc*)rocData->UncheckedAt(roc); Int_t error = 0; currentROC->AddItem(fec, tdc, error, charge, time); - } - } + } // close if (sector==isect) i.e. end loop on digits for the current sector + } // end loop on TOF digits UInt_t totSize=16,rocSize=0; UInt_t rocHead[14],rocChek[14]; @@ -698,188 +870,6 @@ void AliTOF::Raw2Digits(Int_t evNumber) } } tD->Fill(); - tD->Write(); + tD->Write(0,TObject::kOverwrite); } - -/******************************************************************************/ - -ClassImp(AliTOFhit) - -//____________________________________________________________________________ -AliTOFhit::AliTOFhit(const AliTOFhit & hit) -{ - // - // copy ctor for AliTOFhit object - // - fTrack = hit.fTrack; - fX = hit.fX; - fY = hit.fY; - fZ = hit.fZ; - fSector = hit.fSector; - fPlate = hit.fPlate; - fStrip = hit.fStrip; - fPadx = hit.fPadx; - fPadz = hit.fPadz; - fPx = hit.fPx; - fPy = hit.fPy; - fPz = hit.fPz; - fPmom = hit.fPmom; - fTof = hit.fTof; - fDx = hit.fDx; - fDy = hit.fDy; - fDz = hit.fDz; - fIncA = hit.fIncA; - fEdep = hit.fEdep; - -} - -//______________________________________________________________________________ -AliTOFhit::AliTOFhit(Int_t shunt, Int_t track, Int_t *vol, - Float_t *hits) -:AliHit(shunt, track) -{ -// -// Constructor of hit object -// - // - // Hit Volume - // - fSector= vol[0]; - fPlate = vol[1]; - fStrip = vol[2]; - fPadx = vol[3]; - fPadz = vol[4]; - // - //Position of the hit - fX = hits[0]; - fY = hits[1]; - fZ = hits[2]; - // - // Momentum components of the particle in the ALICE frame when hit is produced - fPx = hits[3]; - fPy = hits[4]; - fPz = hits[5]; - fPmom= hits[6]; - // - // Time Of Flight for the particle that produces hit - fTof = hits[7]; //TOF[s] - // - // Other Data - fDx = hits[8]; //Distance from the edge along x axis - fDy = hits[9]; //Y cohordinate of the hit - fDz = hits[10]; //Distance from the edge along z axis - fIncA= hits[11]; //Incidence angle - fEdep= hits[12]; //Energy loss in TOF pad -} - -//****************************************************************************** - -ClassImp(AliTOFdigit) - -//______________________________________________________________________________ -AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol,Float_t *digit) -:AliDigit(tracks) -{ -// -// Constructor of digit object -// - - fSector = vol[0]; - fPlate = vol[1]; - fStrip = vol[2]; - fPadx = vol[3]; - fPadz = vol[4]; - fTdc = digit[0]; - fAdc = digit[1]; -} - -//____________________________________________________________________________ -AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit) -{ - // - // copy ctor for AliTOFdigit object - // - - Int_t i ; - for ( i = 0; i < 3 ; i++) - fTracks[i] = digit.fTracks[i] ; - fSector = digit.fSector; - fPlate = digit.fPlate; - fStrip = digit.fStrip; - fPadx = digit.fPadx; - fPadz = digit.fPadz; - fTdc = digit.fTdc; - fAdc = digit.fAdc; - -} - -//______________________________________________________________________________ -void AliTOFdigit::GetLocation(Int_t *Loc) -{ -// -// Get the cohordinates of the digit -// in terms of Sector - Plate - Strip - Pad -// - - Loc[0]=fSector; - Loc[1]=fPlate; - Loc[2]=fStrip; - Loc[3]=fPadx; - Loc[4]=fPadz; -} - -//______________________________________________________________________________ -Int_t AliTOFdigit::GetTotPad() -{ -// -// Get the "total" index of the pad inside a Sector -// starting from the digits data. -// - - AliTOF* tof; - - if(gAlice){ - tof =(AliTOF*) gAlice->GetDetector("TOF"); - }else{ - printf("AliTOFdigit::GetTotPad - No AliRun object present, exiting"); - return 0; - } - - Int_t pad = fPadx+tof->GetNpadX()*(fPadz-1); - Int_t before=0; - - switch(fPlate){ - case 1: before = 0; - break; - case 2: before = tof->GetNStripC(); - break; - case 3: before = tof->GetNStripB() + tof->GetNStripC(); - break; - case 4: before = tof->GetNStripA() + tof->GetNStripB() + tof->GetNStripC(); - break; - case 5: before = tof->GetNStripA() + 2*tof->GetNStripB() + tof->GetNStripC(); - break; - } - - Int_t strip = fStrip+before; - Int_t padTot = tof->GetPadXStr()*(strip-1)+pad; - return padTot; -} - -//______________________________________________________________________________ -void AliTOFdigit::AddTrack(Int_t track) -{ -// -// Add a track to the digit -// - - if (fTracks[1]==0){ - fTracks[1] = track; - }else if (fTracks[2]==0){ - fTracks[2] = track; - }else{ - // printf("AliTOFdigit::AddTrack ERROR: Too many Tracks (>3) \n"); - } -} - diff --git a/TOF/AliTOF.h b/TOF/AliTOF.h index 74df76bcc49..04b4ef9f142 100644 --- a/TOF/AliTOF.h +++ b/TOF/AliTOF.h @@ -1,10 +1,13 @@ //////////////////////////////////////////////// // // -// Manager, hit and digit classes for TOF // -// Interfaces: +// Manager classe for TOF // +// Interface : // // AliTOF // -// AliTOFhit // -// AliTOFdigit // +// Associations between TOF related objects // +// are defined here // +// -- Authors: Pierella, Seganti, Vicinanza // +// (Bologna and Salerno University) // +// // //////////////////////////////////////////////// #ifndef ALITOF_H @@ -14,21 +17,23 @@ /* $Id$ */ -#include "TObject.h" - class TFile; - +class TDirectory; +class TString ; +class TTask ; +class TFolder ; + +#include "TObject.h" +#include "TTree.h" #include "AliDetector.h" -#include "AliHit.h" -#include "AliDigit.h" -//#include "AliTOFD.h" +#include class AliTOF : public AliDetector { - public: - AliTOF(); + AliTOF(); AliTOF(const char *name, const char *title); - virtual ~AliTOF() {} +// virtual ~AliTOF() {} + virtual ~AliTOF() ; // getters for AliTOF object status Int_t GetNStripA() const {return fNStripA;} Int_t GetNStripB() const {return fNStripB;} @@ -42,20 +47,28 @@ public: virtual void CreateGeometry(); virtual void CreateMaterials(); virtual void Init(); - virtual void MakeBranch(Option_t*, const char *file=0); + virtual void MakeBranch(Option_t* option, const char *file=0); + virtual void Makehits(Bool_t hits=1); virtual void FinishEvent(); virtual Int_t IsVersion() const =0; - Int_t DistancetoPrimitive(Int_t px, Int_t py); + Int_t DistancetoPrimitive(Int_t px, Int_t py) const; virtual void StepManager()=0; virtual void TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, Float_t zlenB, Float_t zlenA, Float_t ztof0){} - virtual void DrawModule(); + virtual void DrawModule() const; + void CreateTOFFolders(); virtual void SDigits2Digits(); - void Hits2Digits(Int_t evNumber=0); + virtual void Hits2Digits(); + virtual void Hits2SDigits(){cout << "AliTOF::Hits2SDigits() dummy function called" << endl;} + virtual void Digits2Reco() {cout << "AliTOF::Digits2Reco() dummy function called" << endl;} void Digits2Raw (Int_t evNumber=0); void Raw2Digits (Int_t evNumber=0); protected: + TFolder* fFGeom ; // Folder that holds the Geometry definition + TTask* fDTask ; // TOF Digitizer container + TTask* fReTask; // TOF Reconstructioner container + TClonesArray* fSDigits; // List of summable digits Int_t fNTof; // number of TOF sectors Float_t fRmax; // upper bound for radial extension of TOF detector Float_t fRmin; // lower bound for radial extension of TOF detector @@ -63,7 +76,6 @@ protected: Float_t fZlenB; // length along z-axis of type B module Float_t fZlenC; // length along z-axis of type C module Float_t fZtof; // total semi-length of TOF detector - Float_t fStripLn; // Strip Length Float_t fSpace; // Space Beetween the strip and the bottom of the plate Float_t fDeadBndZ; // Dead Boundaries of a Strip along Z direction (width) @@ -76,102 +88,22 @@ protected: Int_t fNpadX; // Number of pads in a strip along the X direction Int_t fNpadZ; // Number of pads in a strip along the Z direction Int_t fPadXStr; // Number of pads per strip - Int_t fNStripA; // number of strips in A type module Int_t fNStripB; // number of strips in B type module Int_t fNStripC; // number of strips in C type module - Float_t fTimeRes; // time resolution of the TOF Float_t fChrgRes; // charge resolution of ADC - Int_t fPadXSector; // number of pads per sector Int_t fNRoc; // number of ROC Int_t fNFec; // number of FEC Int_t fNTdc; // number of TDC Int_t fNPadXRoc; // number of pads for each ROC - Int_t fIdSens; // the unique numeric identifier for sensitive volume FPAD - + Int_t fIdSens; // the unique numeric identifier for sensitive volume FPAD + private: - Bool_t CheckOverlap(Int_t* vol, Float_t* digit, Int_t Track); + Bool_t CheckOverlap(Int_t* vol, Float_t* digit, Int_t Track); - ClassDef(AliTOF,1) // Time Of Flight base class + ClassDef(AliTOF,2) // Time Of Flight base class }; -//___________________________________________ - -class AliTOFhit : public AliHit { - -public: - AliTOFhit() {} - AliTOFhit(Int_t shunt, Int_t track, Int_t* vol, - Float_t *hits); - AliTOFhit(const AliTOFhit & hit) ; - virtual ~AliTOFhit() {} - // getters for AliTOFhit object - Int_t GetSector() const {return fSector;} - Int_t GetPlate() const {return fPlate;} - Int_t GetPadx() const {return fPadx;} - Int_t GetPadz() const {return fPadz;} - Int_t GetStrip() const {return fStrip;} - Float_t GetTof() const {return fTof;} - Float_t GetMom() const {return fPmom;} - Float_t GetDx() const {return fDx;} - Float_t GetDz() const {return fDz;} - Float_t GetIncA() const {return fIncA;} - Float_t GetEdep() const {return fEdep;} - -protected: - Int_t fSector; // number of sector - Int_t fPlate; // number of plate - Int_t fStrip; // number of strip - Int_t fPadx; // number of pad along x - Int_t fPadz; // number of pad along z -// X, Y and Z coordinates of the hit are defined on mother class -// AliHit - Float_t fPx; // px in TOF - Float_t fPy; // py in TOF - Float_t fPz; // pz in TOF - Float_t fPmom; // P in TOF - Float_t fTof; // Time of Flight - Float_t fDx; // x of impact point in pad r.s. - Float_t fDy; // y of impact point in pad r.s. - Float_t fDz; // z of impact point in pad r.s. - Float_t fIncA; // Incidence angle - Float_t fEdep; // Energy lost in TOF sensitive layer - - ClassDef(AliTOFhit,1) // Hits for Time Of Flight -}; - -//_______________________________________________________ - -class AliTOFdigit : public AliDigit { - - public: - AliTOFdigit(){} - AliTOFdigit(Int_t* tracks, Int_t* vol, Float_t* digit); - AliTOFdigit(const AliTOFdigit & digit) ; - virtual ~AliTOFdigit(){} - void GetLocation(Int_t* Loc); - Int_t GetTotPad(); - void AddTrack(Int_t track); - // getters for AliTOFdigit object - Float_t GetTdc() const {return fTdc;} - Float_t GetAdc() const {return fAdc;} - Int_t GetSector() const {return fSector;} - // setters for AliTOFdigit object - void SetTdc(Float_t TDC){fTdc = TDC;} - void SetAdc(Float_t ADC){fAdc = ADC;} - -protected: - Int_t fSector; // number of sector - Int_t fPlate; // number of plate - Int_t fStrip; // number of strip - Int_t fPadx; // number of pad along x - Int_t fPadz; // number of pad along z - Float_t fTdc; // tdc values for digit - Float_t fAdc; // adc values for digit - - ClassDef(AliTOFdigit,2) // Digits for Time Of Flight -}; - #endif /* ALITOF_H */ diff --git a/TOF/AliTOFDigitizer.cxx b/TOF/AliTOFDigitizer.cxx new file mode 100644 index 00000000000..340712fcb57 --- /dev/null +++ b/TOF/AliTOFDigitizer.cxx @@ -0,0 +1,383 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + + +//_________________________________________________________________________ +// This is a TTask that makes TOF-Digits out of TOF-Hits. +// A TOF Digit is essentially a TOF hit with the smearing for strip +// time resolution and simulation of the ADC correlation signal. +// Digits are written to TreeD in branch "TOF". +// AliTOFDigitizer with all current parameters used for digitization +// (time resolution and ADC parameter) is written +// to TreeD branch "AliTOFDigitizer". +// Both branches have the same title. If necessary one can produce +// another set of Digits with different parameters. Two versions +// can be distunguished using titles of the branches. +// User case: +// root [0] AliTOFDigitizer * s = new AliTOFDigitizer("galice.root") +// Warning in : Detector size may not be write. +// Warning in : object already instantiated +// root [1] s->ExecuteTask() +// // Makes Digits for all events stored in galice.root +// root [2] s->SetTimeRes(100.) +// // One can change parameters of digitization +// root [3] s->SetDigitsBranch("Time Resolution 100. ps") +// // and write them into the new branch +// root [4] s->ExecuteTask("deb all tim") +// // available parameters: +// deb - print number of produced Digits +// deb all - print number and list of produced Digits +// tim - print benchmarking information +// +// -- Author : F. Pierella (Bologna University) pierella@bo.infn.it +////////////////////////////////////////////////////////////////////////////// + +#include "TFile.h" +#include "TTask.h" +#include "TTree.h" +#include "TSystem.h" +#include "TROOT.h" +#include "TFolder.h" +#include "TBenchmark.h" +#include "TRandom.h" + +#include + +#include "AliRun.h" +#include "AliTOFdigit.h" +#include "AliTOFhit.h" +#include "AliTOFDigitizer.h" + + +ClassImp(AliTOFDigitizer) + + +//____________________________________________________________________________ + AliTOFDigitizer::AliTOFDigitizer():TTask("AliTOFDigitizer","") +{ + // ctor + fTimeRes = 100; // ps + fChrgRes = 100.; // pC + fNevents = 0 ; + fDigits = 0 ; + fHits = 0 ; + fIsInitialized = kFALSE ; + +} + +//____________________________________________________________________________ +AliTOFDigitizer::AliTOFDigitizer(const char* headerFile, const char *digitsTitle):TTask("AliTOFDigitizer","") +{ + // ctor + fTimeRes = 100; // ps + fChrgRes = 100.; // pC + fNevents = 0 ; + fDigitsTitle = digitsTitle ; + fHeadersFile = headerFile ; + fIsInitialized = kFALSE ; + Init(); +} + +//____________________________________________________________________________ +AliTOFDigitizer::~AliTOFDigitizer() +{ + // dtor + if(fDigits) + delete fDigits ; + if(fHits) + delete fHits ; +} +//____________________________________________________________________________ +void AliTOFDigitizer::Init() +{ + // Initialization: open root-file, allocate arrays for hits and digits, + // attach task Digitizer to the list of TOF tasks + // + // Initialization can not be done in the default constructor + + if(!fIsInitialized){ + + if(fHeadersFile.IsNull()) + fHeadersFile="galice.root" ; + + TFile * file = (TFile*) gROOT->GetFile(fHeadersFile.Data() ) ; + + //if file was not opened yet, read gAlice + if(file == 0){ + if(fHeadersFile.Contains("rfio")) + file = TFile::Open(fHeadersFile,"update") ; + else + file = new TFile(fHeadersFile.Data(),"update") ; + gAlice = (AliRun *) file->Get("gAlice") ; + } + fHits = new TClonesArray("AliTOFhit" , 405); + fDigits = new TClonesArray("AliTOFdigit", 405); + + //add Task to //FPAlice/tasks/(S)Digitizer/TOF + TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("FPAlice") ; + TTask * aliceSD = (TTask*)alice->FindObject("tasks/(S)Digitizer") ; + TTask * tofD = (TTask*)aliceSD->GetListOfTasks()->FindObject("TOF") ; + tofD->Add(this) ; + + fIsInitialized = kTRUE ; + } +} +//____________________________________________________________________________ +void AliTOFDigitizer::Exec(Option_t *option) +{ + Int_t tracks[3]; // track info + Int_t vol[5]; // dummy location for digit + Float_t digit[2]; // TOF digit variables + + TRandom* rnd = new TRandom(); + + // Collects all hits in the same active volume into digit + + if(!fIsInitialized) + Init() ; + + if(strstr(option,"tim")) + gBenchmark->Start("TOFDigitizer"); + + fNevents = (Int_t) gAlice->TreeE()->GetEntries() ; + + Int_t ievent ; + // start loop on events + for(ievent = 0; ievent < fNevents; ievent++){ + gAlice->GetEvent(ievent) ; + gAlice->SetEvent(ievent) ; + + if(gAlice->TreeH()==0){ + cout << "AliTOFDigitizer: There is no Hit Tree" << endl; + return ; + } + + //set address of the hits + TBranch * branch = gAlice->TreeH()->GetBranch("TOF"); + if (branch) + branch->SetAddress(&fHits); + else{ + cout << "ERROR in AliTOFDigitizer: "<< endl ; + cout << " no branch TOF in TreeH"<< endl ; + cout << " do nothing " << endl ; + return ; + } + + fDigits->Clear(); + Int_t ndigits = 0 ; + + //Now made Digits from hits, for TOF it is the same a part for the tof smearing + // and some missing MC variables + Int_t itrack ; + for (itrack=0; itrack < gAlice->GetNtrack(); itrack++){ + + //=========== Get the TOF branch from Hits Tree for the Primary track itrack + branch->GetEntry(itrack,0); + + Int_t i; + for ( i = 0 ; i < fHits->GetEntries() ; i++ ) { + + AliTOFhit * hit = (AliTOFhit*)fHits->At(i) ; + + vol[0] = hit->GetSector(); + vol[1] = hit->GetPlate(); + vol[2] = hit->GetPadx(); + vol[3] = hit->GetPadz(); + vol[4] = hit->GetStrip(); + // 95% of efficiency to be inserted here + // edge effect to be inserted here + // cross talk to be inserted here + // simulation of the detector response + Float_t idealtime = hit->GetTof(); // unit s + idealtime *= 1.E+12; // conversion from s to ps + // fTimeRes is given usually in ps + Float_t tdctime = rnd->Gaus(idealtime, fTimeRes); + digit[0] = tdctime; + // typical Landau Distribution to be inserted here + Float_t idealcharge = hit->GetEdep(); + Float_t adccharge = rnd->Gaus(idealcharge, fChrgRes); + digit[1] = adccharge; + // to be added a check for overlaps + new((*fDigits)[ndigits]) AliTOFdigit(tracks, vol, digit); + ndigits++ ; + } + + } // end loop over tracks + + delete rnd; + rnd = 0; + + ndigits = fDigits->GetEntriesFast() ; + printf("AliTOFDigitizer: Total number of digits %d\n",ndigits); + + if(gAlice->TreeD() == 0) + gAlice->MakeTree("D") ; + + //check, if this branch already exits + TBranch * digitsBranch = 0; + TBranch * digitizerBranch = 0; + + TObjArray * branches = gAlice->TreeD()->GetListOfBranches() ; + Int_t ibranch; + Bool_t tofNotFound = kTRUE ; + Bool_t digitizerNotFound = kTRUE ; + + for(ibranch = 0;ibranch GetEntries();ibranch++){ + + if(tofNotFound){ + digitsBranch=(TBranch *) branches->At(ibranch) ; + if( (strcmp("TOF",digitsBranch->GetName())==0 ) && + (fDigitsTitle.CompareTo(digitsBranch->GetTitle()) == 0) ) + tofNotFound = kFALSE ; + } + if(digitizerNotFound){ + digitizerBranch = (TBranch *) branches->At(ibranch) ; + if( (strcmp(digitizerBranch->GetName(),"AliTOFDigitizer") == 0)&& + (fDigitsTitle.CompareTo(digitizerBranch->GetTitle()) == 0) ) + digitizerNotFound = kFALSE ; + } + } + + if(!(digitizerNotFound && tofNotFound)){ + cout << "AliTOFdigitizer error:" << endl ; + cout << "Can not overwrite existing branches: do not write" << endl ; + return ; + } + + //Make (if necessary) branches + char * file =0; + if(gSystem->Getenv("CONFIG_SPLIT_FILE")){ //generating file name + file = new char[strlen(gAlice->GetBaseFile())+20] ; + sprintf(file,"%s/TOF.Digits.root",gAlice->GetBaseFile()) ; + } + + TDirectory *cwd = gDirectory; + + //First list of digits + Int_t bufferSize = 32000 ; + digitsBranch = gAlice->TreeD()->Branch("TOF",&fDigits,bufferSize); + digitsBranch->SetTitle(fDigitsTitle.Data()); + if (file) { + digitsBranch->SetFile(file); + TIter next( digitsBranch->GetListOfBranches()); + TBranch * subbr; + while ((subbr=(TBranch*)next())) { + subbr->SetFile(file); + } + cwd->cd(); + } + + //second - Digitizer + Int_t splitlevel = 0 ; + AliTOFDigitizer * digtz = this ; + digitizerBranch = gAlice->TreeD()->Branch("AliTOFDigitizer","AliTOFDigitizer", + &digtz,bufferSize,splitlevel); + digitizerBranch->SetTitle(fDigitsTitle.Data()); + if (file) { + digitizerBranch->SetFile(file); + TIter next( digitizerBranch->GetListOfBranches()); + TBranch * subbr ; + while ((subbr=(TBranch*)next())) { + subbr->SetFile(file); + } + cwd->cd(); + delete file; + } + + digitsBranch->Fill(); + digitizerBranch->Fill(); + gAlice->TreeD()->Write(0,TObject::kOverwrite) ; + + if(strstr(option,"deb")) + PrintDigits(option) ; + + } + + if(strstr(option,"tim")){ + gBenchmark->Stop("TOFDigitizer"); + cout << "AliTOFDigitizer:" << endl ; + cout << " took " << gBenchmark->GetCpuTime("TOFDigitizer") << " seconds for Digitizing " + << gBenchmark->GetCpuTime("TOFDigitizer")/fNevents << " seconds per event " << endl ; + cout << endl ; + } + + +} +//__________________________________________________________________ +void AliTOFDigitizer::SetDigitsBranch(const char* title ) +{ + // Setting title to branch Digits + if(!fDigitsTitle.IsNull()) + cout << "AliTOFdigitizer: changing Digits file from " <GetEntriesFast() << endl ; + cout << endl ; + + if(strstr(option,"all")){// print all digits + + //loop over digits + AliTOFdigit * digit; + cout << "Digit # " << " Time of flight(ps) " << + " ADC(pC)" << " Sector #" << " Plate #" << + " Strip #" << " Pad # (x) " << " Pad # (z) " << endl; + Int_t index ; + for (index = 0 ; index < fDigits->GetEntries() ; index++) { + digit = (AliTOFdigit * ) fDigits->At(index) ; + + // set the width of the output with the setw(int width) manipulator + + cout << setw(7) << index << " " + << setw(13) << digit->GetTdc() << " " + << setw(13) << digit->GetAdc() << " " + << setw(6) << digit->GetSector() << " " + << setw(6) << digit->GetPlate() << " " + << setw(6) << digit->GetStrip() << " " + << setw(7) << digit->GetPadx() << " " + << setw(7) << digit->GetPadz() << " " << endl; + + } // end loop on digits + + } // close if "all" option selected +} diff --git a/TOF/AliTOFDigitizer.h b/TOF/AliTOFDigitizer.h new file mode 100644 index 00000000000..1b2fb82644d --- /dev/null +++ b/TOF/AliTOFDigitizer.h @@ -0,0 +1,55 @@ +#ifndef ALITOFDigitizer_H +#define ALITOFDigitizer_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//_________________________________________________________________________ +// Task Class for making Digits in TOF +// Comment: +// +// -- Author: F. Pierella (Bologna University) pierella@bo.infn.it + + +#include "TTask.h" +#include "TString.h" + +class AliTOFDigitizer: public TTask { + +public: + AliTOFDigitizer() ; // ctor + AliTOFDigitizer(const char* HeaderFile,const char* digitsTitle = 0) ; + virtual ~AliTOFDigitizer() ; // dtor + virtual void Exec(Option_t* option); + + Float_t GetTimeRes() const {return fTimeRes;} + Float_t GetChrgRes() const {return fChrgRes;} + char* GetDigitsBranch()const{return (char*) fDigitsTitle.Data();} + + virtual void Print(Option_t* option) const ; + + void SetTimeRes(Float_t timeRes) {fTimeRes = timeRes ;} + void SetChrgRes(Float_t chrgRes) {fChrgRes = chrgRes ;} + void SetDigitsBranch(const char* title ) ; + + Bool_t operator == (const AliTOFDigitizer & sd) const ; + +private: + void Init() ; + void PrintDigits(Option_t* option) ; + +private: + Float_t fTimeRes; // Time Resolution + Float_t fChrgRes; // ADC parameter + Int_t fNevents ; // Number of events to digitize + TString fDigitsTitle ; // title of Digits branch + TString fHeadersFile ; // input file + Bool_t fIsInitialized ; // kTRUE if Digitizer is initialized + TClonesArray* fDigits ; // list of Digits + TClonesArray* fHits ; // list of Hits + + + ClassDef(AliTOFDigitizer,1) // Task Class for making Digits in TOF + +}; + +#endif // AliTOFDigitizer_H diff --git a/TOF/AliTOFRawDigit.cxx b/TOF/AliTOFRawDigit.cxx new file mode 100644 index 00000000000..1d5cfaad4ac --- /dev/null +++ b/TOF/AliTOFRawDigit.cxx @@ -0,0 +1,47 @@ +//////////////////////////////////////////////// +// Digitization class for set: TOF // +// AliTOFRawDigit class // +// Member variables // +// // +// Member functions // +// // +//*-- Authors: Pierella, Seganti, Vicinanza // +// (Bologna and Salerno University) // +//////////////////////////////////////////////// + + +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +#include "AliTOFRawDigit.h" + + +//****************************************************************************** + +ClassImp(AliTOFRawDigit) + +//______________________________________________________________________________ +AliTOFRawDigit::AliTOFRawDigit() +{ +// +// Constructor of AliTOFRawDigit class +// + + fTreeD = 0; + fRawDigits = 0; +} + +//****************************************************************************** + diff --git a/TOF/AliTOFRawDigit.h b/TOF/AliTOFRawDigit.h new file mode 100644 index 00000000000..a349f484d9e --- /dev/null +++ b/TOF/AliTOFRawDigit.h @@ -0,0 +1,36 @@ +//////////////////////////////////////////////// +// Digitization class for set: TOF // +// AliTOFRawDigit class // +// Interface // +// Description // +//*-- Authors: Pierella, Seganti, Vicinanza // +// (Bologna and Salerno University) // +//////////////////////////////////////////////// + + +#ifndef ALITOFRAWDIGIT_H +#define ALITOFRAWDIGIT_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + +#include "TObject.h" +#include "TClonesArray.h" + +//_______________________________________________________ +class AliTOFRawDigit : public TObject{ + +public: + AliTOFRawDigit(); + virtual ~AliTOFRawDigit(){}; + +protected: + Int_t fTreeD; // class under construction + Int_t fRawDigits; // class under construction + + + ClassDef(AliTOFRawDigit,2) // TOF Digit in rawdata format +}; + +#endif /* ALITOFRAWDIGIT_H */ diff --git a/TOF/AliTOFRawSector.cxx b/TOF/AliTOFRawSector.cxx new file mode 100644 index 00000000000..7e8a8b53844 --- /dev/null +++ b/TOF/AliTOFRawSector.cxx @@ -0,0 +1,191 @@ +//////////////////////////////////////////////// +// Digitization class for set: TOF // +// AliTOFRawSector class // +// Member variables // +// // +// Member functions // +// // +//*-- Authors: Pierella, Seganti, Vicinanza // +// (Bologna and Salerno University) // +//////////////////////////////////////////////// + + +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +#include "TClonesArray.h" + +#include "AliTOFRawSector.h" +#include "AliTOFRoc.h" + +ClassImp(AliTOFRawSector) + +//______________________________________________________________________________ +AliTOFRawSector::AliTOFRawSector() +{ +// +// Constructor of AliTOFRawSector class +// Each sector is in effect a +// TClonesArray of 14 AliTOFRoc Objects +// + fRocData = new TClonesArray("AliTOFRoc",14); +} + +//______________________________________________________________________________ +AliTOFRawSector::AliTOFRawSector(const AliTOFRawSector& tofrawsector) + : fHeader(tofrawsector.fHeader), fGlobalCheckSum(tofrawsector.fGlobalCheckSum) +{ +// copy ctor for AliTOFRawSector class +// (required also by RC10 Coding Convention) +// +// we make here a new istance of the TClonesArray containing Roc Data + fRocData = new TClonesArray("AliTOFRoc",14); + +// we make here a copy of Roc Data + + for(Int_t nroc=1; nroc<=14; nroc++){ +// get the pointers to the current roc of new and to be copied TClonesArray + AliTOFRoc* currentrocnew = (AliTOFRoc*)fRocData->UncheckedAt(nroc); + AliTOFRoc* currentrocold = (AliTOFRoc*)tofrawsector.fRocData->UncheckedAt(nroc); + +// we create here 2 references: one for the new current roc and another for the old one + AliTOFRoc& newroc = *currentrocnew; + AliTOFRoc& oldroc = *currentrocold; + + newroc = oldroc; // 'operator =' called for AliTOFRoc + + } // end loop on Roc Data +} + +//______________________________________________________________________________ +AliTOFRawSector& AliTOFRawSector::operator=(const AliTOFRawSector& tofrawsector) +{ +// Assignment operator for AliTOFRawSector +// (required also by RC10 Coding Conventions) +// + if (this !=&tofrawsector) { // do nothing if assigned to self + fHeader=tofrawsector.fHeader; + fGlobalCheckSum=tofrawsector.fGlobalCheckSum; +// loop on ROC data + for(Int_t nroc=1; nroc<=14; nroc++){ +// get the pointers to the current roc of new and to be copied TClonesArray + AliTOFRoc* currentrocnew = (AliTOFRoc*)fRocData->UncheckedAt(nroc); + AliTOFRoc* currentrocold = (AliTOFRoc*)tofrawsector.fRocData->UncheckedAt(nroc); +// we create here 2 references: one for the new current roc and another for the old one + AliTOFRoc& newroc = *currentrocnew; + AliTOFRoc& oldroc = *currentrocold; + newroc = oldroc; // 'operator =' called for AliTOFRoc + } // end loop on Roc Data + } // close if + return *this; +} + +//______________________________________________________________________________ +AliTOFRawSector::~AliTOFRawSector() +{ +// destructor of the AliTOFRawSector object +// Here we delete the 14 AliTOFRoc istances +// + if (fRocData) { + fRocData->Delete() ; + delete fRocData; + fRocData = 0; + } +} + +//______________________________________________________________________________ +void AliTOFRawSector::WriteSector() +{ +// +// Starting from the raw data objects writes a binary file +// similar to real raw data. +// + + FILE *rawfile; + rawfile = fopen("rawdata.dat","w"); + +// fprintf(rawfile,Header); + + Int_t nRoc; + +// loop on all AliTOFRoc Headers to set them + for(nRoc=1; nRoc<=14; nRoc++){ + AliTOFRoc* currentRoc = (AliTOFRoc*)fRocData->UncheckedAt(nRoc); + currentRoc->SetHeader(); + // UInt_t RocHeader = currentRoc->fHeader; +// fprintf(rawfile,RocHeader); + } + + for(nRoc=1; nRoc<=14; nRoc++){ + AliTOFRoc* currentRoc = (AliTOFRoc*)fRocData->UncheckedAt(nRoc); + Int_t rocItems = currentRoc->GetItems(); + + for(Int_t nItem=1; nItem<=rocItems;nItem++){ + // UInt_t TimeRow = currentRoc->GetTimeRow(nItem); +// fprintf(rawfile,TimeRow); + // UInt_t ChrgRow = currentRoc->GetTimeRow(nItem); +// fprintf(rawfile,ChrgRow); + } + } + + // UInt_t EndOfSector = GlobalCheckSum; +// fprintf(rawfile,EndOfSector); +} + +//______________________________________________________________________________ +void AliTOFRawSector::ReadSector() +{ +// +// Starting from raw data initialize and write the +// Raw Data objects +//(i.e. a TClonesArray of 18 AliTOFRawSector) +// + + FILE *rawfile; + rawfile = fopen("rawdata.dat","r"); + +// fscanf(rawfile,Header); +// fscanf(rawfile,Header); + Int_t nRoc; + + for(nRoc=1; nRoc<=14; nRoc++){ + AliTOFRoc* currentRoc = (AliTOFRoc*)fRocData->UncheckedAt(nRoc); + UInt_t rocHeader; + fscanf(rawfile,"%u",&rocHeader); + currentRoc->SetHeader(rocHeader); + } + +// UInt_t SCMWord; +// fscanf(rawfile,"%u",SCMWord); + + for(nRoc=1; nRoc<=14; nRoc++){ + AliTOFRoc* currentRoc = (AliTOFRoc*)fRocData->UncheckedAt(nRoc); + // Int_t Size = currentRoc->SetSize(); + Int_t nItems = currentRoc->GetItems(); + for(Int_t nrow=0; nrow<=nItems; nrow++){ + UInt_t charRow,timeRow; + fscanf(rawfile,"%u",&charRow); + currentRoc->SetTime(nrow, charRow); + fscanf(rawfile,"%u",&timeRow); + currentRoc->SetTime(nrow, timeRow); + } + Int_t finalWord; + fscanf(rawfile,"%d",&finalWord); + } +// fscanf(rawfile,GlobalCheckSum); +} + + + diff --git a/TOF/AliTOFRawSector.h b/TOF/AliTOFRawSector.h new file mode 100644 index 00000000000..7a7b1fb24d2 --- /dev/null +++ b/TOF/AliTOFRawSector.h @@ -0,0 +1,51 @@ +//////////////////////////////////////////////// +// Digitization class for set: TOF // +// AliTOFRawSector class // +// Interface // +// Description // +//*-- Authors: Pierella, Seganti, Vicinanza // +// (Bologna and Salerno University) // +//////////////////////////////////////////////// + +#ifndef ALITOFRAWSECTOR_H +#define ALITOFRAWSECTOR_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + +#include "TObject.h" +#include "TClonesArray.h" + +//_______________________________________________________ +class AliTOFRawSector : public TObject{ + + public: + AliTOFRawSector(); +// dtor + virtual ~AliTOFRawSector(); +// copy ctor (required also by RC10 Coding Convention) + AliTOFRawSector(const AliTOFRawSector& tofrawsector); +// assignment operator (required also by RC10 Coding Convention) + AliTOFRawSector& operator = (const AliTOFRawSector& tofrawsector); + void WriteSector(); // write a DAQ sector + void ReadSector(); // read a DAQ sector + +// getters for AliTOFRawSector object + TClonesArray* GetRocData() const {return fRocData;} + UInt_t GetHeader() const {return fHeader;} + UInt_t GetGlobalCheckSum() const {return fGlobalCheckSum;} + +// setters for AliTOFRawSector object + void SetGlobalCS(UInt_t gcs){fGlobalCheckSum=gcs;} + void SetHeader (UInt_t hdr){fHeader = hdr;} + + protected: + TClonesArray* fRocData; // pointer to the TClonesArray of Roc Data + UInt_t fHeader; // RawSector header number + UInt_t fGlobalCheckSum; // check flag + + ClassDef(AliTOFRawSector,2) // Container Class for AliTOFRoc objects +}; + +#endif /* ALITOFRAWSECTOR_H */ diff --git a/TOF/AliTOFRoc.cxx b/TOF/AliTOFRoc.cxx new file mode 100644 index 00000000000..3528be2a6e3 --- /dev/null +++ b/TOF/AliTOFRoc.cxx @@ -0,0 +1,276 @@ +//////////////////////////////////////////////// +// Digitization class for set: TOF // +// AliTOFRoc class // +// Member variables // +// fItems : number of items // +// fSize : size // +// fNRoc : Roc number // +// fHeader: Roc header number // +// fChrgRow[1024]; // adc values // +// fTimeRow[1024]; // tdc values // +// // +// Member functions implemented here // +// // +//*-- Authors: Pierella, Seganti, Vicinanza // +// (Bologna and Salerno University) // +//////////////////////////////////////////////// + + +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +#include +#include + +#include "AliTOFRoc.h" + + +ClassImp(AliTOFRoc) + +//______________________________________________________________________________ +AliTOFRoc::AliTOFRoc() +{ +// +// Constructor of AliTOFRoc class +// The class represents a ROC in the TARODA system +// here we make the initialization of the member variables + fItems = 0; + fSize = 0; + fNRoc = 0; + fHeader= 0; +// initialization of fChrgRow[1024] and fTimeRow[1024] + for(Int_t i=0; i < 1024; i++){ + fChrgRow[i] = 0; + fTimeRow[i] = 0; + } // end loop +} + +//______________________________________________________________________________ +AliTOFRoc::AliTOFRoc(const AliTOFRoc& tofroc) + : fItems(tofroc.fItems), fSize(tofroc.fSize), fNRoc(tofroc.fNRoc), fHeader(tofroc.fHeader) +{ +// +// copy ctor for AliTOFRoc class +// + assert(tofroc.fItems >= 0); // check for number of items + assert(tofroc.fSize >= 0); // check for roc size +// making a copy of adc and tdc vectors + for(Int_t i=0; i < 1024; i++){ + fChrgRow[i] = tofroc.fChrgRow[i]; // coping adc values + fTimeRow[i] = tofroc.fTimeRow[i]; // coping tdc values + } // end loop +} + +//______________________________________________________________________________ +AliTOFRoc& AliTOFRoc::operator=(const AliTOFRoc& tofroc) +{ +// +// Assignment operator for AliTOFRoc +// (used by copy ctor of AliTOFRawSector) +// + if (this !=&tofroc) { // do nothing if assigned to self + // setting head member data + SetHeadVar(tofroc.fItems,tofroc.fSize,tofroc.fNRoc,tofroc.fHeader); + // loop on adc and tdc values + for(Int_t i=0; i < 1024; i++){ + fChrgRow[i] = tofroc.fChrgRow[i]; // coping adc values + fTimeRow[i] = tofroc.fTimeRow[i]; // coping tdc values + } // end loop + } + return *this; +} + +//______________________________________________________________________________ +AliTOFRoc::~AliTOFRoc(){} + +//______________________________________________________________________________ +Int_t AliTOFRoc::AddItem(Int_t Fec, Int_t Tdc, Int_t Error, + Float_t Charge, Float_t Time) +{ +// +// Adds an item (i.e. the charge, the TOF and the +// cohordinates of a hit pad) to the ROC class. +// + fItems++; + SetCharge(fItems,Fec,Tdc,Charge); + SetTime (fItems,Error,Time); + return fItems; // return the number of current items +} + +//______________________________________________________________________________ +void AliTOFRoc::SetHeadVar(Int_t items, Int_t size, Int_t nroc, UInt_t header) +{ +// +// set header member variables for AliTOFRoc +// + fItems = items; + fSize = size ; + fNRoc = nroc ; + fHeader= header ; +} + +//______________________________________________________________________________ +void AliTOFRoc::SetHeader() +{ +// +// Calculate the header line of the ROC in the raw data file +// + + fHeader = fNRoc<<28; + fHeader += fSize; +} + + +//______________________________________________________________________________ +void AliTOFRoc::SetTime(UInt_t Item, UInt_t Error, Float_t RealTime) +{ +// +// Calculate the raw data line relative to the TDC +// output of a pad in the current ROC. +// + + UInt_t itime; + itime = (UInt_t)(RealTime/50.); + if (itime >= TMath::Power(2,24)) itime = 2^24-1; + Error <<= 24; + fTimeRow[Item]= Error+itime; +} + +//______________________________________________________________________________ +void AliTOFRoc::SetCharge(UInt_t Item, UInt_t Fec, UInt_t Tdc, Float_t RealCharge) +{ +// +// Calculate the raw data line relative to the ADC +// output of a pad in the current ROC. +// + + UInt_t iCharge; + if (fNRoc>=TMath::Power(2,4)) fNRoc = 0; + fNRoc <<= 28; + if (Fec >=TMath::Power(2,6)) Fec = 0; + Fec <<= 22; + if (Tdc >=TMath::Power(2,6)) Tdc = 0; + Tdc <<= 16; + iCharge = (UInt_t)(RealCharge/50.); // 50 ps (TDC bin value) + if(iCharge>=TMath::Power(2,16)) iCharge = (UInt_t)TMath::Power(2,16)-1; + fChrgRow[Item] = iCharge+fNRoc+Fec+Tdc; +} + +//______________________________________________________________________________ +void AliTOFRoc::SetTime(UInt_t Item, UInt_t tir) +{ +// +// Writes the raw data line relative to the TDC +// + + fChrgRow[Item]=tir; +} + +//______________________________________________________________________________ +void AliTOFRoc::SetCharge(UInt_t Item, UInt_t chr) +{ +// +// Writes the raw data line relative to the ADC +// + + fChrgRow[Item]=chr; +} + +//______________________________________________________________________________ +Float_t AliTOFRoc::GetCharge(Int_t Item) const +{ +// +// Reads the effective value of the charge starting +// from the line of the raw data +// + + UInt_t icharge = fChrgRow[Item]&0x0000ffff; + Float_t charge = (Float_t)icharge*50.; + return charge; +} + +//______________________________________________________________________________ +Float_t AliTOFRoc::GetTime(Int_t Item, UInt_t& Error) +{ +// +// Reads the effective value of the time of flight starting +// from the line of the raw data +// + + UInt_t itime = fTimeRow[Item]&0x00ffffff; + Float_t time = (Float_t)itime*50.; + Error = fTimeRow[Item]>>24; // the same as Error = fTimeRow[Item] / 24; + return time; +} + +//______________________________________________________________________________ +Int_t AliTOFRoc::GetTotPad(Int_t Item) const +{ +// +// Reads the cohordinates of the pad starting +// from the line of the raw data +// + + UInt_t nRoc = (fChrgRow[Item]&0xf0000000)>>28; // >> the same as / (division by) + UInt_t nFec = (fChrgRow[Item]&0x0fc00000)>>22; + UInt_t nTdc = (fChrgRow[Item]&0x003f0000)>>16; + UInt_t pad = nRoc*32*32+nFec*32+nTdc; + return pad; +} + +//______________________________________________________________________________ +UInt_t AliTOFRoc::GetCheckSum() +{ +// +// Calculate the checksum word of the current ROC +// + + UInt_t checkSum=0; + for(Int_t i=0; i>=1){ + if(x&0x00000001) count++; + } + return count; +} + +//______________________________________________________________________________ +UInt_t AliTOFRoc::SetSize() +{ +// +// Reads the size of data from current ROC starting +// from the header line of the raw data +// + + fSize = fHeader&0x0000ffff; + fItems = (fSize-4)/4; + return fSize; +} + + + diff --git a/TOF/AliTOFRoc.h b/TOF/AliTOFRoc.h new file mode 100644 index 00000000000..3549a5ee094 --- /dev/null +++ b/TOF/AliTOFRoc.h @@ -0,0 +1,85 @@ +//////////////////////////////////////////////// +// Digitization class for set: TOF // +// AliTOFRoc class // +// Interface // +// Description // +//*-- Authors: Pierella, Seganti, Vicinanza // +// (Bologna and Salerno University) // +//////////////////////////////////////////////// + +#ifndef ALITOFROC_H +#define ALITOFROC_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + + +#include "TObject.h" +#include "TClonesArray.h" + +//_______________________________________________________ + +class AliTOFRoc : public TObject { + + public: + AliTOFRoc(); +// copy ctor (required also by RC10 Coding Convention) + AliTOFRoc(const AliTOFRoc& tofroc); +// assignment operator (required also by RC10 Coding Convention) + AliTOFRoc& operator = (const AliTOFRoc& tofroc); +// dtor + virtual ~AliTOFRoc(); + Int_t AddItem (Int_t Fec, Int_t Tdc, Int_t Error, Float_t Charge, Float_t Time); +// Int_t AddItem (Int_t, UInt_t); + +// setters for AliTOFRoc object + void SetHeadVar(Int_t items, Int_t size, Int_t nroc, UInt_t header); + void SetHeader(); + void SetTime (UInt_t Item, UInt_t Error, Float_t RealTime); + void SetTime (UInt_t Item, UInt_t tir); + void SetCharge(UInt_t Item, UInt_t Fec,UInt_t Tdc,Float_t RealCharge); + void SetCharge(UInt_t Item, UInt_t chr); + +// getters for AliTOFRoc object + Float_t GetTime (Int_t Item,UInt_t& Error); + Float_t GetCharge(Int_t Item) const; + Int_t GetTotPad(Int_t Item) const; + UInt_t GetCheckSum(); + UInt_t BitCount (UInt_t x) const; + UInt_t SetSize (); + + Int_t GetSize() const {return fItems*8+4;} + Int_t GetItems() const {return fItems;} + UInt_t GetChrgRow(Int_t i) const {return fChrgRow[i];} + UInt_t GetTimeRow(Int_t i) const {return fTimeRow[i];} + void SetHeader(UInt_t head){fHeader=head;} + + protected: + Int_t fItems; // number of items + Int_t fSize; // size + Int_t fNRoc; // Roc number + UInt_t fHeader; // Roc header number + +/* class ChargeRow + { + public: + UInt_t RocID:4; + UInt_t FecID:6; + UInt_t TdcID:6; + Int_t ChADC:16; + }Charge[1024]; + + class TimeRow + { + public: + UInt_t Error:12; + Int_t TDC :24; + }Time[1024]; +*/ + UInt_t fChrgRow[1024]; // adc values + UInt_t fTimeRow[1024]; // tdc values + + ClassDef(AliTOFRoc,2) // TOF Read Out Controller class +}; + +#endif /* ALITOFROC_H */ diff --git a/TOF/AliTOFdigit.cxx b/TOF/AliTOFdigit.cxx new file mode 100644 index 00000000000..32362f4460f --- /dev/null +++ b/TOF/AliTOFdigit.cxx @@ -0,0 +1,211 @@ +//_________________________________________________________________________ +// TOF digit: member variables +// fSector : TOF sector +// fPlate : TOF plate +// fStrip : strips number +// fPadx : pad number along x +// fPadz : pad number along z +// fTdc : TDC +// fAdc : ADC +// +// Getters, setters and member functions defined here +// +//*-- Authors: F. Pierella, A. Seganti, D. Vicinanza + + +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +#include + +#include "AliTOF.h" +#include "AliTOFdigit.h" +#include "AliRun.h" +#include "AliMC.h" + +ClassImp(AliTOFdigit) + +//______________________________________________________________________________ +AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol,Float_t *digit) +:AliDigit(tracks) +{ +// +// Constructor of digit object +// + fSector = vol[0]; + fPlate = vol[1]; + fStrip = vol[2]; + fPadx = vol[3]; + fPadz = vol[4]; + fTdc = digit[0]; + fAdc = digit[1]; +} + +//____________________________________________________________________________ +AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit) +{ + // + // copy ctor for AliTOFdigit object + // + + Int_t i ; + for ( i = 0; i < 3 ; i++) + fTracks[i] = digit.fTracks[i] ; + fSector = digit.fSector; + fPlate = digit.fPlate; + fStrip = digit.fStrip; + fPadx = digit.fPadx; + fPadz = digit.fPadz; + fTdc = digit.fTdc; + fAdc = digit.fAdc; + +} + +//______________________________________________________________________________ +AliTOFdigit::AliTOFdigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx, +Int_t padz, Float_t tdc, Float_t adc) +{ +// +// Constructor for sdigit +// + fSector = sector; + fPlate = plate; + fStrip = strip; + fPadx = padx; + fPadz = padz; + fTdc = tdc; + fAdc = adc; +} + +//______________________________________________________________________________ +void AliTOFdigit::GetLocation(Int_t *Loc) const +{ +// +// Get the cohordinates of the digit +// in terms of Sector - Plate - Strip - Pad +// + + Loc[0]=fSector; + Loc[1]=fPlate; + Loc[2]=fStrip; + Loc[3]=fPadx; + Loc[4]=fPadz; +} + +//______________________________________________________________________________ +Int_t AliTOFdigit::GetTotPad() const +{ +// +// Get the "total" index of the pad inside a Sector +// starting from the digits data. +// + + AliTOF* tof; + + if(gAlice){ + tof =(AliTOF*) gAlice->GetDetector("TOF"); + }else{ + printf("AliTOFdigit::GetTotPad - No AliRun object present, exiting"); + return 0; + } + + Int_t pad = fPadx+tof->GetNpadX()*(fPadz-1); + Int_t before=0; + + switch(fPlate){ + case 1: before = 0; + break; + case 2: before = tof->GetNStripC(); + break; + case 3: before = tof->GetNStripB() + tof->GetNStripC(); + break; + case 4: before = tof->GetNStripA() + tof->GetNStripB() + tof->GetNStripC(); + break; + case 5: before = tof->GetNStripA() + 2*tof->GetNStripB() + tof->GetNStripC(); + break; + } + + Int_t strip = fStrip+before; + Int_t padTot = tof->GetPadXStr()*(strip-1)+pad; + return padTot; +} + +//______________________________________________________________________________ +void AliTOFdigit::AddTrack(Int_t track) +{ +// +// Add a track to the digit +// + + if (fTracks[1]==0){ + fTracks[1] = track; + }else if (fTracks[2]==0){ + fTracks[2] = track; + }else{ + // printf("AliTOFdigit::AddTrack ERROR: Too many Tracks (>3) \n"); + } +} + +// Overloading of Streaming, Sum and Comparison operators + +//______________________________________________________________________________ +Bool_t AliTOFdigit::operator==(AliTOFdigit const &digit) const +{ +// +// Overloading of Comparison operator +// + if (fSector==digit.fSector && + fPlate==digit.fPlate && + fStrip==digit.fStrip && + fPadx==digit.fPadx && + fPadz==digit.fPadz && + fTdc==digit.fTdc && + fAdc==digit.fAdc) return kTRUE; + else return kFALSE; +} + +//______________________________________________________________________________ +AliTOFdigit& AliTOFdigit::operator+(AliTOFdigit const &digit) +{ +// +// Overloading of Sum operator +// Note: Some convolution +// between the two digit variables has to be inserted +// +if (fSector==digit.fSector && + fPlate==digit.fPlate && + fStrip==digit.fStrip && + fPadx==digit.fPadx && + fPadz==digit.fPadz) { + // convolution to be inserted here + fTdc+=digit.fTdc; + fAdc+=digit.fAdc; + } else + AliTOFdigit(fSector,fPlate,fStrip,fPadx,fPadz,fTdc,fAdc); + return *this; +} + +//______________________________________________________________________________ +ostream& operator << (ostream& out, const AliTOFdigit &digit) +{ +// +// Output streamer: output of the digit data +// +out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl; +out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl; +out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl; +return out; +} + diff --git a/TOF/AliTOFdigit.h b/TOF/AliTOFdigit.h new file mode 100644 index 00000000000..9d592e63fa2 --- /dev/null +++ b/TOF/AliTOFdigit.h @@ -0,0 +1,66 @@ +//////////////////////////////////////////////// +// // +// Digit class for TOF // +// Interface // +// Getters, Setters and member variables // +// declared here // +// // +//////////////////////////////////////////////// + +#ifndef ALITOFDIGIT_H +#define ALITOFDIGIT_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#include "AliDigit.h" + +class AliTOFdigit : public AliDigit { + + //overloading of the streamer << operator +friend class ostream& operator << ( ostream& , const AliTOFdigit&) ; + + public: + AliTOFdigit(){} + AliTOFdigit(Int_t* tracks, Int_t* vol, Float_t* digit); +// new ctor for sdigits + AliTOFdigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx, Int_t padz, Float_t tdc, Float_t adc); +// copy ctor + AliTOFdigit(const AliTOFdigit & digit) ; + virtual ~AliTOFdigit(){} + void GetLocation(Int_t* Loc) const; + Int_t GetTotPad() const; + void AddTrack(Int_t track); + // getters for AliTOFdigit object + Float_t GetTdc() const {return fTdc;} + Float_t GetAdc() const {return fAdc;} + Int_t GetSector() const {return fSector;} + Int_t GetPlate() const {return fPlate;} + Int_t GetStrip() const {return fStrip;} + Int_t GetPadx() const {return fPadx;} + Int_t GetPadz() const {return fPadz;} + + // setters for AliTOFdigit object + void SetTdc(Float_t TDC){fTdc = TDC;} + void SetAdc(Float_t ADC){fAdc = ADC;} + + //overloading of ==, + operators (summable digits) + + Bool_t operator==(const AliTOFdigit& digit) const; + AliTOFdigit& operator+(AliTOFdigit const &digit) ; + + +protected: + Int_t fSector; // number of sector + Int_t fPlate; // number of plate + Int_t fStrip; // number of strip + Int_t fPadx; // number of pad along x + Int_t fPadz; // number of pad along z + Float_t fTdc; // tdc values for digit + Float_t fAdc; // adc values for digit + + ClassDef(AliTOFdigit,2) // Digit for Time Of Flight +}; + +#endif /* ALITOFDIGIT_H */ diff --git a/TOF/AliTOFhit.cxx b/TOF/AliTOFhit.cxx new file mode 100644 index 00000000000..5f959a7d7a3 --- /dev/null +++ b/TOF/AliTOFhit.cxx @@ -0,0 +1,126 @@ +//_________________________________________________________________________ +// TOF hit : member variables +// fTrack : +// fX : X coordinate of the hit in the Master Reference Frame (LAB Frame) +// fY : Y coordinate of the hit in the Master Reference Frame (LAB Frame) +// fZ : Z coordinate of the hit in the Master Reference Frame (LAB Frame) +// fSector : Number of the TOF Sector which belongs the hit +// fPlate : Number of the TOF Plate or Module which belongs the hit +// fStrip : Number of the TOF Strip which belongs the hit +// fPadx : Number of the pad in the strip along the x-axis - in the strip reference frame +// - where hit is produced +// fPadz : Number of the pad in the strip along the z-axis - in the strip reference frame +// - where hit is produced +// fPx : x-director cosine of the Charged Particle Momentum when hit is +// produced - expressed in the Master Reference Frame (LAB Frame) - +// fPy : y-director cosine of the Charged Particle Momentum when hit is +// produced - expressed in the Master Reference Frame (LAB Frame) - +// fPz : z-director cosine of the Charged Particle Momentum when hit is +// produced - expressed in the Master Reference Frame (LAB Frame) - +// fPmom : Modulus of the Charged Particle Momentum when hit is produced +// fTof : Time of Flight i.e. the time between the charged particle is produced and this +// particle produce the hit on the TOF sensible volume (pad) +// fDx : Distance of the hit from the pad edge along x-axis +// fDy : y coordinate of the hit in the pad refernce frame +// fDz : Distance of the hit from the pad edge along z-axis +// fIncA : Incidence Angle between the Normal to the sensible volume where hit +// is produced (pad) and the Momentum Direction of the Charged Particle which +// produces the hit +// fEdep : Energy released by charged particle on the sensible TOF volume where hit is +// produced +// For more detailed informations about the meaning of the TOF-hit member +// variable look at +// http://www.bo.infn.it/alice/alice-doc/TOFWEB/variables-hits.html +// +// Getters, setters and member functions defined here +// +//*-- Authors: F. Pierella, A. Seganti, D. Vicinanza + + + +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +#include "AliTOFhit.h" + +ClassImp(AliTOFhit) + +//____________________________________________________________________________ +AliTOFhit::AliTOFhit(const AliTOFhit & hit) +{ + // + // copy ctor for AliTOFhit object + // + fTrack = hit.fTrack; + fX = hit.fX; + fY = hit.fY; + fZ = hit.fZ; + fSector = hit.fSector; + fPlate = hit.fPlate; + fStrip = hit.fStrip; + fPadx = hit.fPadx; + fPadz = hit.fPadz; + fPx = hit.fPx; + fPy = hit.fPy; + fPz = hit.fPz; + fPmom = hit.fPmom; + fTof = hit.fTof; + fDx = hit.fDx; + fDy = hit.fDy; + fDz = hit.fDz; + fIncA = hit.fIncA; + fEdep = hit.fEdep; + +} + +//______________________________________________________________________________ +AliTOFhit::AliTOFhit(Int_t shunt, Int_t track, Int_t *vol, + Float_t *hits) +:AliHit(shunt, track) +{ +// +// Constructor of hit object +// + // + // Hit Volume + // + fSector= vol[0]; + fPlate = vol[1]; + fStrip = vol[2]; + fPadx = vol[3]; + fPadz = vol[4]; + // + //Position of the hit + fX = hits[0]; + fY = hits[1]; + fZ = hits[2]; + // + // Momentum components of the particle in the ALICE frame when hit is produced + fPx = hits[3]; + fPy = hits[4]; + fPz = hits[5]; + fPmom= hits[6]; + // + // Time Of Flight for the particle that produces hit + fTof = hits[7]; //TOF[s] + // + // Other Data + fDx = hits[8]; //Distance from the edge along x axis + fDy = hits[9]; //Y cohordinate of the hit + fDz = hits[10]; //Distance from the edge along z axis + fIncA= hits[11]; //Incidence angle + fEdep= hits[12]; //Energy loss in TOF pad +} + diff --git a/TOF/AliTOFhit.h b/TOF/AliTOFhit.h new file mode 100644 index 00000000000..9a9e286c370 --- /dev/null +++ b/TOF/AliTOFhit.h @@ -0,0 +1,66 @@ +//////////////////////////////////////////////// +// // +// Hit class for TOF // +// Interface // +// Getters, Setters and member variables // +// declared here // +// // +//////////////////////////////////////////////// + +#ifndef ALITOFHIT_H +#define ALITOFHIT_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#include "AliHit.h" + + +class AliTOFhit : public AliHit { + +public: + AliTOFhit() {} + AliTOFhit(Int_t shunt, Int_t track, Int_t* vol, + Float_t *hits); + AliTOFhit(const AliTOFhit & hit) ; + virtual ~AliTOFhit() {} + // getters for AliTOFhit object + Int_t GetSector() const {return fSector;} + Int_t GetPlate() const {return fPlate;} + Int_t GetPadx() const {return fPadx;} + Int_t GetPadz() const {return fPadz;} + Int_t GetStrip() const {return fStrip;} + Float_t GetTof() const {return fTof;} + Float_t GetMom() const {return fPmom;} + Float_t GetPx() const {return fPx;} + Float_t GetPy() const {return fPy;} + Float_t GetPz() const {return fPz;} + Float_t GetDx() const {return fDx;} + Float_t GetDz() const {return fDz;} + Float_t GetIncA() const {return fIncA;} + Float_t GetEdep() const {return fEdep;} + +protected: + Int_t fSector; // number of sector + Int_t fPlate; // number of plate + Int_t fStrip; // number of strip + Int_t fPadx; // number of pad along x + Int_t fPadz; // number of pad along z +// X, Y and Z coordinates of the hit are defined on mother class +// AliHit + Float_t fPx; // px in TOF + Float_t fPy; // py in TOF + Float_t fPz; // pz in TOF + Float_t fPmom; // P in TOF + Float_t fTof; // Time of Flight + Float_t fDx; // x of impact point in pad r.s. + Float_t fDy; // y of impact point in pad r.s. + Float_t fDz; // z of impact point in pad r.s. + Float_t fIncA; // Incidence angle + Float_t fEdep; // Energy lost in TOF sensitive layer + + ClassDef(AliTOFhit,1) // Hit for Time Of Flight +}; + +#endif /* ALITOFHIT_H */ diff --git a/TOF/AliTOFv0.cxx b/TOF/AliTOFv0.cxx index c3ae03d3aa9..0310a0e4dfa 100644 --- a/TOF/AliTOFv0.cxx +++ b/TOF/AliTOFv0.cxx @@ -15,19 +15,19 @@ /* $Log$ -Revision 1.19 2001/05/04 10:09:48 vicinanz +Revision 1.9 2001/05/04 10:09:48 vicinanz Major upgrades to the strip structure -Revision 1.18 2000/12/04 08:48:20 alibrary +Revision 1.8 2000/12/04 08:48:20 alibrary Fixing problems in the HEAD -Revision 1.17 2000/10/02 21:28:17 fca +Revision 1.7 2000/10/02 21:28:17 fca Removal of useless dependecies via forward declarations -Revision 1.16 2000/05/10 16:52:18 vicinanz +Revision 1.6 2000/05/10 16:52:18 vicinanz New TOF version with holes for PHOS/RICH -Revision 1.14.2.1 2000/05/10 09:37:16 vicinanz +Revision 1.4.2.1 2000/05/10 09:37:16 vicinanz New version with Holes for PHOS/RICH Revision 1.14 1999/11/05 22:39:06 fca @@ -55,12 +55,13 @@ Introduction of the Copyright and cvs Log /////////////////////////////////////////////////////////////////////////////// // // -// Time Of Flight: design of C.Williams FCA // -// This class contains the functions for version 1 of the Time Of Flight // +// Time Of Flight: design of C.Williams // +// // +// This class contains the functions for version 0 of the Time Of Flight // // detector. // // // VERSION WITH 5 MODULES AND TILTED STRIPS -// +// NO HITS DEFINED BY DEFAULT FOR THIS VERSION // FULL COVERAGE VERSION // // Authors: @@ -89,11 +90,12 @@ Introduction of the Copyright and cvs Log #include "TBRIK.h" #include "TGeometry.h" #include "TNode.h" -#include "TObject.h" #include +#include "TObject.h" #include "AliRun.h" #include "AliMC.h" #include "AliConst.h" + ClassImp(AliTOFv0) @@ -103,7 +105,15 @@ AliTOFv0::AliTOFv0() // // Default constructor // - +} + +//_____________________________________________________________________________ +AliTOFv0::AliTOFv0(const char *name, const char *title) + : AliTOF(name,title) +{ + // + // Standard constructor + // // // Check that FRAME is there otherwise we have no place where to // put TOF @@ -117,16 +127,6 @@ AliTOFv0::AliTOFv0() exit(1); } - -} - -//_____________________________________________________________________________ -AliTOFv0::AliTOFv0(const char *name, const char *title) - : AliTOF(name,title) -{ - // - // Standard constructor - // } //____________________________________________________________________________ @@ -139,13 +139,13 @@ AliTOFv0::~AliTOFv0() delete fHits ; fHits = 0 ; } -/* + if ( fSDigits) { fSDigits->Delete() ; delete fSDigits ; fSDigits = 0 ; } -*/ + if ( fDigits) { fDigits->Delete() ; delete fDigits ; @@ -153,11 +153,12 @@ AliTOFv0::~AliTOFv0() } } - + //_____________________________________________________________________________ void AliTOFv0::BuildGeometry() { - // Build TOF ROOT geometry for the ALICE event viewver + // + // Build TOF ROOT geometry for the ALICE event display // TNode *node, *top; const int kColorTOF = 27; @@ -231,9 +232,11 @@ void AliTOFv0::BuildGeometry() node = new TNode(nodeName4,nodeName4,"S_TOF_A",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),0.,rotMatNum); node->SetLineColor(kColorTOF); fNodes->Add(node); - } + } // end loop on nodeNum } + + //_____________________________________________________________________________ void AliTOFv0::CreateGeometry() { @@ -260,10 +263,11 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, // xFLT, yFLT, zFLT - sizes of TOF modules (large) Float_t ycoor, zcoor; - Float_t par[3]; - Int_t *idtmed = fIdtmed->GetArray()-499; - Int_t idrotm[100]; - Int_t nrot = 0; + Float_t par[3]; + Int_t *idtmed = fIdtmed->GetArray()-499; + Int_t idrotm[100]; + Int_t nrot = 0; + Float_t hTof = fRmax-fRmin; Float_t radius = fRmin+2.;//cm @@ -283,8 +287,8 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, Float_t zcor2 = ztof0 - zlenC - zlenB*0.5; Float_t zcor3 = 0.; - AliMatrix(idrotm[0], 90., 0., 0., 0., 90, -90.); - AliMatrix(idrotm[1], 90., 180., 0., 0., 90, 90.); + AliMatrix(idrotm[0], 90., 0., 0., 0., 90,-90.); + AliMatrix(idrotm[1], 90.,180., 0., 0., 90, 90.); gMC->Gspos("FTOC", 1, "BTO1", 0, zcor1, 0, idrotm[0], "ONLY"); gMC->Gspos("FTOC", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY"); gMC->Gspos("FTOC", 1, "BTO2", 0, zcor1, 0, idrotm[0], "ONLY"); @@ -304,13 +308,15 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, gMC->Gspos("FTOA", 0, "BTO3", 0, zcor3, 0, idrotm[0], "ONLY"); Float_t db = 0.5;//cm - Float_t xFLT, yFLT, zFLTA, zFLTB, zFLTC; + Float_t xFLT, xFST, yFLT, zFLTA, zFLTB, zFLTC; - xFLT = 122.0;//cm + xFLT = fStripLn; yFLT = ytof; - zFLTA = zlenA - db*0.5; - zFLTB = zlenB - db*0.5; - zFLTC = zlenC - db*0.5; + zFLTA = zlenA; + zFLTB = zlenB; + zFLTC = zlenC; + + xFST = xFLT-fDeadBndX*2;//cm // Sizes of MRPC pads @@ -318,24 +324,23 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, // Large not sensitive volumes with Insensitive Freon par[0] = xFLT*0.5; - par[1] = yFLT*0.5; - - if (fDebug) cout << ClassName() << - ": ************************* TOF geometry **************************"<Gsvolu("FLTA", "BOX ", idtmed[512], par, 3); // Insensitive Freon - gMC->Gspos("FLTA", 0, "FTOA", 0., 0., 0., 0, "ONLY"); - + gMC->Gspos ("FLTA", 0, "FTOA", 0., 0., 0., 0, "ONLY"); + par[2] = (zFLTB * 0.5); gMC->Gsvolu("FLTB", "BOX ", idtmed[512], par, 3); // Insensitive Freon - gMC->Gspos("FLTB", 0, "FTOB", 0., 0., 0., 0, "ONLY"); + gMC->Gspos ("FLTB", 0, "FTOB", 0., 0., 0., 0, "ONLY"); par[2] = (zFLTC * 0.5); gMC->Gsvolu("FLTC", "BOX ", idtmed[512], par, 3); // Insensitive Freon - gMC->Gspos("FLTC", 0, "FTOC", 0., 0., 0., 0, "ONLY"); - -////////// Layers of Aluminum before and after detector ////////// + gMC->Gspos ("FLTC", 0, "FTOC", 0., 0., 0., 0, "ONLY"); + +////////// Layers of Aluminum before and after detector ////////// ////////// Aluminum Box for Modules (2.0 mm thickness) ///////// ////////// lateral walls not simulated par[0] = xFLT*0.5; @@ -343,36 +348,33 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, ycoor = -yFLT/2 + par[1]; par[2] = (zFLTA *0.5); gMC->Gsvolu("FALA", "BOX ", idtmed[508], par, 3); // Alluminium - gMC->Gspos("FALA", 1, "FLTA", 0., ycoor, 0., 0, "ONLY"); - gMC->Gspos("FALA", 2, "FLTA", 0.,-ycoor, 0., 0, "ONLY"); + gMC->Gspos ("FALA", 1, "FLTA", 0., ycoor, 0., 0, "ONLY"); + gMC->Gspos ("FALA", 2, "FLTA", 0.,-ycoor, 0., 0, "ONLY"); par[2] = (zFLTB *0.5); - gMC->Gsvolu("FALB", "BOX ", idtmed[508], par, 3); // Alluminium - gMC->Gspos("FALB", 1, "FLTB", 0., ycoor, 0., 0, "ONLY"); - gMC->Gspos("FALB", 2, "FLTB", 0.,-ycoor, 0., 0, "ONLY"); + gMC->Gsvolu("FALB", "BOX ", idtmed[508], par, 3); // Alluminium + gMC->Gspos ("FALB", 1, "FLTB", 0., ycoor, 0., 0, "ONLY"); + gMC->Gspos ("FALB", 2, "FLTB", 0.,-ycoor, 0., 0, "ONLY"); par[2] = (zFLTC *0.5); gMC->Gsvolu("FALC", "BOX ", idtmed[508], par, 3); // Alluminium - gMC->Gspos("FALC", 1, "FLTC", 0., ycoor, 0., 0, "ONLY"); - gMC->Gspos("FALC", 2, "FLTC", 0.,-ycoor, 0., 0, "ONLY"); - + gMC->Gspos ("FALC", 1, "FLTC", 0., ycoor, 0., 0, "ONLY"); + gMC->Gspos ("FALC", 2, "FLTC", 0.,-ycoor, 0., 0, "ONLY"); + ///////////////// Detector itself ////////////////////// - - Float_t stripWidth = 10.0;//cm - const Float_t kdeadBound = 1.5;//cm non-sensitive between the pad edge - //and the boundary of the strip - const Int_t knx = 48; // number of pads along x - const Int_t knz = 2; // number of pads along z - const Float_t kspace= 5.5; //cm distance from the front plate of the box - - Float_t zSenStrip; - zSenStrip = stripWidth-2*kdeadBound;//cm - - par[0] = xFLT/2; - par[1] = yPad/2; - par[2] = stripWidth/2.; - + const Float_t kdeadBound = fDeadBndZ; //cm non-sensitive between the pad edge + //and the boundary of the strip + const Int_t knx = fNpadX; // number of pads along x + const Int_t knz = fNpadZ; // number of pads along z + const Float_t kspace = fSpace; //cm distance from the front plate of the box + + Float_t zSenStrip = fZpad*fNpadZ;//cm + Float_t stripWidth = zSenStrip + 2*kdeadBound; + par[0] = xFLT*0.5; + par[1] = yPad*0.5; + par[2] = stripWidth*0.5; + // new description for strip volume // -- all constants are expressed in cm - // heigth of different layers +// heigth of different layers const Float_t khhony = 1. ; // heigth of HONY Layer const Float_t khpcby = 0.15 ; // heigth of PCB Layer const Float_t khmyly = 0.035 ; // heigth of MYLAR Layer @@ -383,18 +385,18 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, const Float_t klsensmx = 48*2.5; // cm const Float_t kwpadz = 3.5; // cm z dimension of the FPAD volume const Float_t klpadx = 2.5; // cm x dimension of the FPAD volume - + // heigth of the FSTR Volume (the strip volume) const Float_t khstripy = 2*(khhony+khpcby+khmyly+khgraphy+khglasseiy)+khsensmy; // width of the FSTR Volume (the strip volume) - const Float_t kwstripz = 10.; + const Float_t kwstripz = 10.; // length of the FSTR Volume (the strip volume) const Float_t klstripx = 122.; Float_t parfp[3]={klstripx*0.5,khstripy*0.5,kwstripz*0.5}; // coordinates of the strip center in the strip reference frame; used for positioning // internal strip volumes - Float_t posfp[3]={0.,0.,0.}; + Float_t posfp[3]={0.,0.,0.}; // FSTR volume definition and filling this volume with non sensitive Gas Mixture gMC->Gsvolu("FSTR","BOX",idtmed[512],parfp,3); @@ -406,21 +408,21 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, // positioning 2 HONY Layers on FSTR volume posfp[1]=-khstripy*0.5+parfp[1]; gMC->Gspos("FHON",1,"FSTR",0., posfp[1],0.,0,"ONLY"); - gMC->Gspos("FHON",2,"FSTR",0.,-posfp[1],0.,0,"ONLY"); - - //-- PCB Layer definition + gMC->Gspos("FHON",2,"FSTR",0.,-posfp[1],0.,0,"ONLY"); + + //-- PCB Layer definition parfp[1] = khpcby*0.5; gMC->Gsvolu("FPCB","BOX",idtmed[504],parfp,3); // positioning 2 PCB Layers on FSTR volume posfp[1]=-khstripy*0.5+khhony+parfp[1]; gMC->Gspos("FPCB",1,"FSTR",0., posfp[1],0.,0,"ONLY"); gMC->Gspos("FPCB",2,"FSTR",0.,-posfp[1],0.,0,"ONLY"); - + //-- MYLAR Layer definition parfp[1] = khmyly*0.5; gMC->Gsvolu("FMYL","BOX",idtmed[511],parfp,3); // positioning 2 MYLAR Layers on FSTR volume - posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1]; + posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1]; gMC->Gspos("FMYL",1,"FSTR",0., posfp[1],0.,0,"ONLY"); gMC->Gspos("FMYL",2,"FSTR",0.,-posfp[1],0.,0,"ONLY"); @@ -428,48 +430,47 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, parfp[1] = khgraphy*0.5; gMC->Gsvolu("FGRP","BOX",idtmed[502],parfp,3); // positioning 2 Graphite Layers on FSTR volume - posfp[1] = -khstripy*0.5+khhony+khpcby+khmyly+parfp[1]; + posfp[1] = -khstripy*0.5+khhony+khpcby+khmyly+parfp[1]; gMC->Gspos("FGRP",1,"FSTR",0., posfp[1],0.,0,"ONLY"); gMC->Gspos("FGRP",2,"FSTR",0.,-posfp[1],0.,0,"ONLY"); - + //-- Glass (EXT. +Semi INT.) Layer definition parfp[1] = khglasseiy*0.5; gMC->Gsvolu("FGLA","BOX",idtmed[514],parfp,3); - // positioning 2 Glass Layers on FSTR volume + // positioning 2 Glass Layers on FSTR volume posfp[1] = -khstripy*0.5+khhony+khpcby+khmyly+khgraphy+parfp[1]; gMC->Gspos("FGLA",1,"FSTR",0., posfp[1],0.,0,"ONLY"); gMC->Gspos("FGLA",2,"FSTR",0.,-posfp[1],0.,0,"ONLY"); - + //-- Sensitive Mixture Layer definition parfp[0] = klsensmx*0.5; parfp[1] = khsensmy*0.5; - parfp[2] = kwsensmz*0.5; + parfp[2] = kwsensmz*0.5; gMC->Gsvolu("FSEN","BOX",idtmed[513],parfp,3); // positioning the sensitive gas Layer on FSTR volume gMC->Gspos("FSEN",0,"FSTR",0.,0.,0.,0,"ONLY"); - + // dividing FSEN along z in knz=2 and along x in knx=48 gMC->Gsdvn("FSEZ","FSEN",knz,3); gMC->Gsdvn("FSEX","FSEZ",knx,1); - + // FPAD volume definition - parfp[0] = klpadx*0.5; + parfp[0] = klpadx*0.5; parfp[1] = khsensmy*0.5; parfp[2] = kwpadz*0.5; gMC->Gsvolu("FPAD","BOX",idtmed[513],parfp,3); // positioning the FPAD volumes on previous divisions gMC->Gspos("FPAD",0,"FSEX",0.,0.,0.,0,"ONLY"); - + //// Positioning the Strips (FSTR) in the FLT volumes ///// // Plate A (Central) Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel - Float_t gap = 4.; //cm distance between the strip axis + Float_t gap = fGapA; //cm distance between the strip axis Float_t zpos = 0; Float_t ang = 0; - Float_t last; Int_t i=1,j=1; nrot = 0; zcoor = 0; @@ -477,8 +478,11 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, AliMatrix (idrotm[0], 90., 0.,90.,90.,0., 90.); gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY"); - zcoor -= zSenStrip; + printf("%f, St. %2i, Pl.3 ",ang*kRaddeg,i); + printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); + + zcoor -= zSenStrip; j++; Int_t upDown = -1; // upDown=-1 -> Upper strip // upDown=+1 -> Lower strip @@ -492,6 +496,10 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, ycoor += (1-(upDown+1)/2)*gap; gMC->Gspos("FSTR",j ,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY"); gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); + + printf("%f, St. %2i, Pl.3 ",ang*kRaddeg,i); + printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); + j += 2; upDown*= -1; // Alternate strips zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)- @@ -499,11 +507,11 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, (zSenStrip/2)/TMath::Cos(ang); } while (zcoor-(stripWidth/2)*TMath::Cos(ang)>-t+zFLTC+zFLTB+db*2); - zcoor = zcoor+(zSenStrip/2)/TMath::Cos(ang)- + zcoor = zcoor+(zSenStrip/2)/TMath::Cos(ang)+ upDown*gap*TMath::Tan(ang)+ (zSenStrip/2)/TMath::Cos(ang); - - gap = 6.; + + gap = fGapB; zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)- upDown*gap*TMath::Tan(ang)- (zSenStrip/2)/TMath::Cos(ang); @@ -518,27 +526,35 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, ycoor += (1-(upDown+1)/2)*gap; gMC->Gspos("FSTR",j ,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY"); gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); - - ycoor = -29./2.+ kspace;//2 cm over front plate + printf("%f, St. %2i, Pl.3 ",ang*kRaddeg,i); + printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); + + ycoor = -hTof/2.+ kspace;//2 cm over front plate // Plate B nrot = 0; i=1; - upDown *= -1; + upDown = 1; + Float_t deadRegion = 1.0;//cm zpos = zcoor - (zSenStrip/2)/TMath::Cos(ang)- upDown*gap*TMath::Tan(ang)- - (zSenStrip/2)/TMath::Cos(ang)-0.5/TMath::Cos(ang); + (zSenStrip/2)/TMath::Cos(ang)- + deadRegion/TMath::Cos(ang); ang = atan(zpos/radius); ang *= kRaddeg; AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.); ang /= kRaddeg; - ycoor = -29.*0.5+ kspace ; //2 cm over front plate + ycoor = -hTof*0.5+ kspace ; //2 cm over front plate ycoor += (1-(upDown+1)/2)*gap; zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); + + printf("%f, St. %2i, Pl.4 ",ang*kRaddeg,i); + printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); + i++; upDown*=-1; @@ -550,18 +566,23 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, ang *= kRaddeg; AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.); ang /= kRaddeg; - ycoor = -29.*0.5+ kspace ; //2 cm over front plate + ycoor = -hTof*0.5+ kspace ; //2 cm over front plate ycoor += (1-(upDown+1)/2)*gap; zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); + + printf("%f, St. %2i, Pl.4 ",ang*kRaddeg,i); + printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); + upDown*=-1; i++; - } while (TMath::Abs(ang*kRaddeg)<22.5);//till we reach a tilting angle of 22.5 degrees + } while (TMath::Abs(ang*kRaddeg)<22.5); + //till we reach a tilting angle of 22.5 degrees - ycoor = -29.*0.5+ kspace ; //2 cm over front plate + ycoor = -hTof*0.5+ kspace ; //2 cm over front plate + zpos = zpos - zSenStrip/TMath::Cos(ang); do { - i++; ang = atan(zpos/radius); ang *= kRaddeg; AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.); @@ -569,18 +590,22 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, zcoor = zpos+(zFLTB/2+zFLTA/2+db); gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); zpos = zpos - zSenStrip/TMath::Cos(ang); - last = stripWidth*TMath::Cos(ang)/2.; - } while (zpos>-t+zFLTC+db); + printf("%f, St. %2i, Pl.4 ",ang*kRaddeg,i); + printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); + i++; + } while (zpos-stripWidth*0.5/TMath::Cos(ang)>-t+zFLTC+db); // Plate C + + zpos = zpos + zSenStrip/TMath::Cos(ang); - zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)- + zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+ gap*TMath::Tan(ang)- (zSenStrip/2)/TMath::Cos(ang); nrot = 0; i=0; - ycoor= -29.*0.5+kspace+gap; + ycoor= -hTof*0.5+kspace+gap; do { i++; @@ -590,9 +615,12 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, ang /= kRaddeg; zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2); gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); + + printf("%f, St. %2i, Pl.5 ",ang*kRaddeg,i); + printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); + zpos = zpos - zSenStrip/TMath::Cos(ang); - last = stripWidth*TMath::Cos(ang)*0.5; - } while (zpos>-t+last); + } while (zpos-stripWidth*TMath::Cos(ang)*0.5>-t); ////////// Layers after strips ///////////////// @@ -673,7 +701,7 @@ fp */ } //_____________________________________________________________________________ -void AliTOFv0::DrawModule() +void AliTOFv0::DrawModule() const { // // Draw a shaded view of the Time Of Flight version 1 @@ -736,13 +764,11 @@ void AliTOFv0::Init() // // Initialise the detector after the geometry has been defined // - if(fDebug) { - printf("%s: **************************************" - " TOF " - "**************************************\n",ClassName()); - printf("\n%s: Version 0 of TOF initialing, " - "symmetric TOF\n",ClassName()); - } + printf("**************************************" + " TOF " + "**************************************\n"); + printf("\n Version 0 of TOF initialing, " + "symmetric TOF - Full Coverage version\n"); AliTOF::Init(); @@ -766,19 +792,20 @@ void AliTOFv0::StepManager() // // Procedure called at each step in the Time Of Flight // - Float_t hits[8],rho,phi,phid,z; + TLorentzVector mom, pos; + Float_t xm[3],pm[3],xpad[3],ppad[3]; + Float_t hits[13],phi,phid,z; + Int_t vol[5]; Int_t sector, plate, padx, padz, strip; Int_t copy, padzid, padxid, stripid, i; - Int_t vol[4]; Int_t *idtmed = fIdtmed->GetArray()-499; - TLorentzVector mom, pos; - + Float_t incidenceAngle; if(gMC->GetMedium()==idtmed[513] && gMC->IsTrackEntering() && gMC->TrackCharge() && gMC->CurrentVolID(copy)==fIdSens) { -// getting information about hit volumes + // getting information about hit volumes padzid=gMC->CurrentVolOffID(2,copy); padz=copy; @@ -789,50 +816,62 @@ void AliTOFv0::StepManager() stripid=gMC->CurrentVolOffID(4,copy); strip=copy; - padz = (strip-1)*2+padz; - gMC->TrackPosition(pos); gMC->TrackMomentum(mom); - rho = sqrt(pos[0]*pos[0]+pos[1]*pos[1]); - phi = TMath::ACos(pos[0]/rho); - Float_t as = TMath::ASin(pos[1]/rho); - if (as<0) phi = 2*3.141592654-phi; +// Double_t NormPos=1./pos.Rho(); + Double_t normMom=1./mom.Rho(); - z = pos[2]; - - plate = 0; - Float_t limA = fZlenA*0.5; - Float_t limB = fZlenB+limA; - - if (TMath::Abs(z)<=limA) plate = 3; - if (z<= limB && z> limA) plate = 2; - if (z>=-limB && z<-limA) plate = 4; - if (z> limB) plate = 1; - if (z<-limB) plate = 5; +// getting the cohordinates in pad ref system + xm[0] = (Float_t)pos.X(); + xm[1] = (Float_t)pos.Y(); + xm[2] = (Float_t)pos.Z(); + + pm[0] = (Float_t)mom.X()*normMom; + pm[1] = (Float_t)mom.Y()*normMom; + pm[2] = (Float_t)mom.Z()*normMom; + + gMC->Gmtod(xm,xpad,1); + gMC->Gmtod(pm,ppad,2); + + incidenceAngle = TMath::ACos(ppad[1])*kRaddeg; - if (plate==3) padz -= 2; + z = pos[2]; - phid = phi*kRaddeg; + plate = 0; + if (TMath::Abs(z) <= fZlenA*0.5) plate = 3; + if (z < (fZlenA*0.5+fZlenB) && + z > fZlenA*0.5) plate = 4; + if (z >-(fZlenA*0.5+fZlenB) && + z < -fZlenA*0.5) plate = 2; + if (z > (fZlenA*0.5+fZlenB)) plate = 5; + if (z <-(fZlenA*0.5+fZlenB)) plate = 1; + + phi = pos.Phi(); + phid = phi*kRaddeg+180.; sector = Int_t (phid/20.); sector++; - Double_t ptot = mom.Rho(); - Double_t norm = 1/ptot; for(i=0;i<3;++i) { hits[i] = pos[i]; - hits[i+3] = mom[i]*norm; + hits[i+3] = pm[i]; } - hits[6] = ptot; + + hits[6] = mom.Rho(); hits[7] = pos[3]; + hits[8] = xpad[0]; + hits[9] = xpad[1]; + hits[10]= xpad[2]; + hits[11]= incidenceAngle; + hits[12]= gMC->Edep(); - vol[0] = sector; - vol[1] = plate; - vol[2] = padx; - vol[3] = padz; - - Int_t track = gAlice->CurrentTrack(); - AliTOF::AddHit(track,vol, hits); + vol[0]= sector; + vol[1]= plate; + vol[2]= strip; + vol[3]= padx; + vol[4]= padz; + + AddHit(gAlice->CurrentTrack(),vol, hits); } } diff --git a/TOF/AliTOFv0.h b/TOF/AliTOFv0.h index 071a8a5ec5a..92e15ec2a8d 100644 --- a/TOF/AliTOFv0.h +++ b/TOF/AliTOFv0.h @@ -1,7 +1,7 @@ //_________________________________________________________________________ // Implementation version v0 of TOF Manager class -// NO HOLES i.e. FULL COVERAGE -// NB: for this version no hits are defined +// FULL COVERAGE VERSION i.e. NO HOLES FOR PHOS AND HMPID (RICH) ARE DEFINED +// NO HITS DEFINED FOR THIS VERSION //*-- //*-- Authors: Pierella, Seganti, Vicinanza (Bologna and Salerno University) @@ -11,13 +11,12 @@ * See cxx source for full Copyright notice */ /* $Id$ */ - + #include "AliTOF.h" -#include "AliHit.h" class AliTOFv0 : public AliTOF { - + public: AliTOFv0(); AliTOFv0(const char *name, const char *title); @@ -30,7 +29,7 @@ public: virtual void TOFpc(Float_t xtof,Float_t ytof,Float_t zlenC,Float_t zlenB, Float_t zlenA,Float_t ztof0); virtual void StepManager(); - virtual void DrawModule(); + virtual void DrawModule() const; private: Int_t fIdFTOA; // FTOA volume identifier (outer plate A) diff --git a/TOF/AliTOFv1.cxx b/TOF/AliTOFv1.cxx index f4d20724fc4..f92d3b737a8 100644 --- a/TOF/AliTOFv1.cxx +++ b/TOF/AliTOFv1.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.21 2001/05/16 14:57:24 alibrary +New files for folders and Stack + Revision 1.20 2001/05/04 10:09:48 vicinanz Major upgrades to the strip structure @@ -58,13 +61,13 @@ Introduction of the Copyright and cvs Log /////////////////////////////////////////////////////////////////////////////// // // -// Time Of Flight: design of C.Williams -// +// Time Of Flight: design of C.Williams // +// // // This class contains the functions for version 1 of the Time Of Flight // // detector. // // // VERSION WITH 5 MODULES AND TILTED STRIPS -// +// // HOLES FOR PHOS DETECTOR // // Authors: @@ -145,13 +148,13 @@ AliTOFv1::~AliTOFv1() delete fHits ; fHits = 0 ; } -/* + if ( fSDigits) { fSDigits->Delete() ; delete fSDigits ; fSDigits = 0 ; } -*/ + if ( fDigits) { fDigits->Delete() ; delete fDigits ; @@ -331,11 +334,11 @@ void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, // Large not sensitive volumes with Insensitive Freon par[0] = xFLT*0.5; par[1] = yFLT*0.5; - + if(fDebug) cout << ClassName() << ": ************************* TOF geometry **************************" <Gsvolu("FLTA", "BOX ", idtmed[512], par, 3); // Insensitive Freon gMC->Gspos ("FLTA", 0, "FTOA", 0., 0., 0., 0, "ONLY"); @@ -713,7 +716,7 @@ fp */ } //_____________________________________________________________________________ -void AliTOFv1::DrawModule() +void AliTOFv1::DrawModule() const { // // Draw a shaded view of the Time Of Flight version 1 diff --git a/TOF/AliTOFv1.h b/TOF/AliTOFv1.h index ab76e228250..3417a43578e 100644 --- a/TOF/AliTOFv1.h +++ b/TOF/AliTOFv1.h @@ -13,7 +13,6 @@ /* $Id$ */ #include "AliTOF.h" -#include "AliHit.h" class AliTOFv1 : public AliTOF { @@ -30,7 +29,7 @@ public: virtual void TOFpc(Float_t xtof,Float_t ytof,Float_t zlenC,Float_t zlenB, Float_t zlenA,Float_t ztof0); virtual void StepManager(); - virtual void DrawModule(); + virtual void DrawModule() const; private: Int_t fIdFTOA; // FTOA volume identifier (outer plate A) diff --git a/TOF/AliTOFv2.cxx b/TOF/AliTOFv2.cxx index fc49b17aa88..9f28e4cb718 100644 --- a/TOF/AliTOFv2.cxx +++ b/TOF/AliTOFv2.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.20 2001/05/16 14:57:24 alibrary +New files for folders and Stack + Revision 1.19 2001/05/04 10:09:48 vicinanz Major upgrades to the strip structure @@ -55,9 +58,9 @@ Introduction of the Copyright and cvs Log /////////////////////////////////////////////////////////////////////////////// // // -// Time Of Flight: design of C.Williams -// -// This class contains the functions for version 1 of the Time Of Flight // +// Time Of Flight: design of C.Williams +// +// This class contains the functions for version 2 of the Time Of Flight // // detector. // // // VERSION WITH 5 MODULES AND TILTED STRIPS @@ -140,13 +143,13 @@ AliTOFv2::~AliTOFv2() delete fHits ; fHits = 0 ; } -/* + if ( fSDigits) { fSDigits->Delete() ; delete fSDigits ; fSDigits = 0 ; } -*/ + if ( fDigits) { fDigits->Delete() ; delete fDigits ; @@ -506,7 +509,7 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); if(fDebug) { - printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); + printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos); } @@ -537,10 +540,10 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, gMC->Gspos("FSTR",j ,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY"); gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); - if(fDebug) { - printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); - printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos); - } + if(fDebug) { + printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); + printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos); + } ycoor = -hTof/2.+ kspace;//2 cm over front plate @@ -565,10 +568,10 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); - if(fDebug) { - printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); + if(fDebug) { + printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos); - } + } i++; upDown*=-1; @@ -587,7 +590,7 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); if(fDebug) { - printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); + printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos); } @@ -608,7 +611,7 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); zpos = zpos - zSenStrip/TMath::Cos(ang); if(fDebug) { - printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); + printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos); } i++; @@ -637,7 +640,7 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); if(fDebug) { - printf("%s: %f, St. %2i, Pl.5 ",ClassName(),ang*kRaddeg,i); + printf("%s: %f, St. %2i, Pl.5 ",ClassName(),ang*kRaddeg,i); printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos); } @@ -723,7 +726,7 @@ fp */ } //_____________________________________________________________________________ -void AliTOFv2::DrawModule() +void AliTOFv2::DrawModule() const { // // Draw a shaded view of the Time Of Flight version 1 @@ -786,13 +789,13 @@ void AliTOFv2::Init() // // Initialise the detector after the geometry has been defined // - if(fDebug) { + if(fDebug) { printf("%s: **************************************" - " TOF " - "**************************************\n",ClassName()); + " TOF " + "**************************************\n",ClassName()); printf("\n%s: Version 2 of TOF initialing, " - "TOF with holes for PHOS and RICH \n",ClassName()); - } + "TOF with holes for PHOS and RICH \n",ClassName()); + } AliTOF::Init(); @@ -805,8 +808,8 @@ void AliTOFv2::Init() if(fDebug) { printf("%s: **************************************" - " TOF " - "**************************************\n",ClassName()); + " TOF " + "**************************************\n",ClassName()); } } diff --git a/TOF/AliTOFv2.h b/TOF/AliTOFv2.h index 0168f064860..7fdd3efcb71 100644 --- a/TOF/AliTOFv2.h +++ b/TOF/AliTOFv2.h @@ -13,7 +13,6 @@ /* $Id$ */ #include "AliTOF.h" -#include "AliHit.h" class AliTOFv2 : public AliTOF { @@ -30,7 +29,7 @@ public: virtual void TOFpc(Float_t xtof,Float_t ytof,Float_t zlenC,Float_t zlenB, Float_t zlenA,Float_t ztof0); virtual void StepManager(); - virtual void DrawModule(); + virtual void DrawModule() const; private: Int_t fIdFTOA; // FTOA volume identifier (outer plate A) diff --git a/TOF/AliTOFv3.cxx b/TOF/AliTOFv3.cxx index 86a861fda14..d099a707561 100644 --- a/TOF/AliTOFv3.cxx +++ b/TOF/AliTOFv3.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.20 2001/05/16 14:57:24 alibrary +New files for folders and Stack + Revision 1.19 2001/05/04 10:09:48 vicinanz Major upgrades to the strip structure @@ -55,13 +58,13 @@ Introduction of the Copyright and cvs Log /////////////////////////////////////////////////////////////////////////////// // // -// Time Of Flight: design of C.Williams -// -// This class contains the functions for version 1 of the Time Of Flight // +// Time Of Flight: design of C.Williams // +// // +// This class contains the functions for version 3 of the Time Of Flight // // detector. // // // VERSION WITH 5 MODULES AND TILTED STRIPS -// +// HITS DEFINED FOR THIS VERSION // HOLES FOR RICH DETECTOR // // Authors: @@ -139,13 +142,13 @@ AliTOFv3::~AliTOFv3() delete fHits ; fHits = 0 ; } -/* + if ( fSDigits) { fSDigits->Delete() ; delete fSDigits ; fSDigits = 0 ; } -*/ + if ( fDigits) { fDigits->Delete() ; delete fDigits ; @@ -328,7 +331,7 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, par[0] = xFLT*0.5; par[1] = yFLT*0.5; - if (fDebug) cout << ClassName() << + if (fDebug) cout << ClassName() << cout <<": ************************* TOF geometry **************************"<Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY"); if(fDebug) { - printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); + printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); } zcoor -= zSenStrip; @@ -502,7 +505,7 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, gMC->Gspos("FSTR",j ,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY"); gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); if(fDebug) { - printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); + printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); } j += 2; @@ -531,9 +534,9 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, ycoor += (1-(upDown+1)/2)*gap; gMC->Gspos("FSTR",j ,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY"); gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); - if(fDebug) { - printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); - printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); + if(fDebug) { + printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); + printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); } ycoor = -hTof/2.+ kspace;//2 cm over front plate @@ -557,9 +560,9 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, ycoor += (1-(upDown+1)/2)*gap; zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); - if(fDebug) { - printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); - printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); + if(fDebug) { + printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); + printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); } i++; upDown*=-1; @@ -576,8 +579,8 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, ycoor += (1-(upDown+1)/2)*gap; zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); - if(fDebug) { - printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); + if(fDebug) { + printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); } upDown*=-1; @@ -596,8 +599,8 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, zcoor = zpos+(zFLTB/2+zFLTA/2+db); gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); zpos = zpos - zSenStrip/TMath::Cos(ang); - if(fDebug) { - printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); + if(fDebug) { + printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); } i++; @@ -624,10 +627,10 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, ang /= kRaddeg; zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2); gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); - if(fDebug) { - printf("%s: %f, St. %2i, Pl.5 ",ClassName(),ang*kRaddeg,i); + if(fDebug) { + printf("%s: %f, St. %2i, Pl.5 ",ClassName(),ang*kRaddeg,i); printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); - } + } zpos = zpos - zSenStrip/TMath::Cos(ang); } while (zpos-stripWidth*TMath::Cos(ang)*0.5>-t); @@ -710,7 +713,7 @@ fp */ } //_____________________________________________________________________________ -void AliTOFv3::DrawModule() +void AliTOFv3::DrawModule() const { // // Draw a shaded view of the Time Of Flight version 1 @@ -775,10 +778,10 @@ void AliTOFv3::Init() // if(fDebug) { printf("%s: **************************************" - " TOF " - "**************************************\n",ClassName()); + " TOF " + "**************************************\n",ClassName()); printf("\n%s Version 3 of TOF initialing, " - "TOF with holes for RICH detector\n",ClassName()); + "TOF with holes for RICH detector\n",ClassName()); } AliTOF::Init(); @@ -792,9 +795,9 @@ void AliTOFv3::Init() if(fDebug) { printf("%s: **************************************" - " TOF " - "**************************************\n",ClassName()); - } + " TOF " + "**************************************\n",ClassName()); + } } //_____________________________________________________________________________ diff --git a/TOF/AliTOFv3.h b/TOF/AliTOFv3.h index 82ca52c8fd9..6627b3b1713 100644 --- a/TOF/AliTOFv3.h +++ b/TOF/AliTOFv3.h @@ -13,7 +13,6 @@ /* $Id$ */ #include "AliTOF.h" -#include "AliHit.h" class AliTOFv3 : public AliTOF { @@ -30,7 +29,7 @@ public: virtual void TOFpc(Float_t xtof,Float_t ytof,Float_t zlenC,Float_t zlenB, Float_t zlenA,Float_t ztof0); virtual void StepManager(); - virtual void DrawModule(); + virtual void DrawModule() const; private: Int_t fIdFTOA; // FTOA volume identifier (outer plate A) diff --git a/TOF/AliTOFv4.cxx b/TOF/AliTOFv4.cxx index eda3a46f9df..a10b84cff5a 100644 --- a/TOF/AliTOFv4.cxx +++ b/TOF/AliTOFv4.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.10 2001/05/16 14:57:24 alibrary +New files for folders and Stack + Revision 1.9 2001/05/04 10:09:48 vicinanz Major upgrades to the strip structure @@ -55,27 +58,27 @@ Introduction of the Copyright and cvs Log /////////////////////////////////////////////////////////////////////////////// // // -// Time Of Flight: design of C.Williams +// Time Of Flight: design of C.Williams // -// This class contains the functions for version 1 of the Time Of Flight // +// This class contains the functions for version 4 of the Time Of Flight // // detector. // // -// VERSION WITH 5 MODULES AND TILTED STRIPS -// +// VERSION WITH 5 MODULES AND TILTED STRIPS +// // FULL COVERAGE VERSION // // Authors: -// +// // Alessio Seganti // Domenico Vicinanza -// +// // University of Salerno - Italy // // Fabrizio Pierella // University of Bologna - Italy // -// -//Begin_Html +// +//Begin_Html /* */ @@ -139,13 +142,13 @@ AliTOFv4::~AliTOFv4() delete fHits ; fHits = 0 ; } -/* + if ( fSDigits) { fSDigits->Delete() ; delete fSDigits ; fSDigits = 0 ; } -*/ + if ( fDigits) { fDigits->Delete() ; delete fDigits ; @@ -482,7 +485,7 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, AliMatrix (idrotm[0], 90., 0.,90.,90.,0., 90.); gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY"); if(fDebug) { - printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); + printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); } zcoor -= zSenStrip; @@ -500,7 +503,7 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, gMC->Gspos("FSTR",j ,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY"); gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); if(fDebug) { - printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); + printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); } j += 2; @@ -529,10 +532,10 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, ycoor += (1-(upDown+1)/2)*gap; gMC->Gspos("FSTR",j ,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY"); gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); - if(fDebug) { - printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); - printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); - } + if(fDebug) { + printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i); + printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); + } ycoor = -hTof/2.+ kspace;//2 cm over front plate // Plate B @@ -555,10 +558,10 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, ycoor += (1-(upDown+1)/2)*gap; zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); - if(fDebug) { - printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); - printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); - } + if(fDebug) { + printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); + printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); + } i++; upDown*=-1; @@ -575,7 +578,7 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); if(fDebug) { - printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); + printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); } upDown*=-1; @@ -595,7 +598,7 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); zpos = zpos - zSenStrip/TMath::Cos(ang); if(fDebug) { - printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); + printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i); printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); } i++; @@ -623,7 +626,7 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC, zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2); gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY"); if(fDebug) { - printf("%s: %f, St. %2i, Pl.5 ",ClassName(),ang*kRaddeg,i); + printf("%s: %f, St. %2i, Pl.5 ",ClassName(),ang*kRaddeg,i); printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos); } zpos = zpos - zSenStrip/TMath::Cos(ang); @@ -708,7 +711,7 @@ fp */ } //_____________________________________________________________________________ -void AliTOFv4::DrawModule() +void AliTOFv4::DrawModule() const { // // Draw a shaded view of the Time Of Flight version 1 @@ -771,13 +774,14 @@ void AliTOFv4::Init() // // Initialise the detector after the geometry has been defined // - if(fDebug) { + if(fDebug) { printf("%s: **************************************" - " TOF " - "**************************************\n",ClassName()); + " TOF " + "**************************************\n",ClassName()); printf("\n%s: Version 4 of TOF initialing, " - "symmetric TOF - Full Coverage version\n",ClassName()); + "symmetric TOF - Full Coverage version\n",ClassName()); } + AliTOF::Init(); fIdFTOA = gMC->VolId("FTOA"); @@ -786,12 +790,12 @@ void AliTOFv4::Init() fIdFLTA = gMC->VolId("FLTA"); fIdFLTB = gMC->VolId("FLTB"); fIdFLTC = gMC->VolId("FLTC"); - - if(fDebug) { + + if(fDebug) { printf("%s: **************************************" - " TOF " - "**************************************\n",ClassName()); - } + " TOF " + "**************************************\n",ClassName()); + } } //_____________________________________________________________________________ diff --git a/TOF/AliTOFv4.h b/TOF/AliTOFv4.h index dc064f72863..d421d49f99b 100644 --- a/TOF/AliTOFv4.h +++ b/TOF/AliTOFv4.h @@ -13,7 +13,6 @@ /* $Id$ */ #include "AliTOF.h" -#include "AliHit.h" class AliTOFv4 : public AliTOF { @@ -30,7 +29,7 @@ public: virtual void TOFpc(Float_t xtof,Float_t ytof,Float_t zlenC,Float_t zlenB, Float_t zlenA,Float_t ztof0); virtual void StepManager(); - virtual void DrawModule(); + virtual void DrawModule() const; private: Int_t fIdFTOA; // FTOA volume identifier (outer plate A) diff --git a/TOF/Makefile b/TOF/Makefile index 610b6790a89..7d0fc68f02e 100644 --- a/TOF/Makefile +++ b/TOF/Makefile @@ -9,7 +9,7 @@ PACKAGE = TOF # C++ sources -SRCS = AliTOF.cxx AliTOFv0.cxx AliTOFv1.cxx AliTOFv2.cxx AliTOFv3.cxx AliTOFv4.cxx AliTOFD.cxx +SRCS = AliTOF.cxx AliTOFv0.cxx AliTOFv1.cxx AliTOFv2.cxx AliTOFv3.cxx AliTOFv4.cxx AliTOFhit.cxx AliTOFdigit.cxx AliTOFRawSector.cxx AliTOFRoc.cxx AliTOFRawDigit.cxx AliTOFDigitizer.cxx # C++ Headers @@ -67,3 +67,4 @@ include $(ALICE_ROOT)/conf/GeneralMacros ############################ Dependencies ##################################### -include tgt_$(ALICE_TARGET)/Make-depend +# DO NOT DELETE diff --git a/TOF/TOFLinkDef.h b/TOF/TOFLinkDef.h index d6cf9ee1135..f5226b830c8 100644 --- a/TOF/TOFLinkDef.h +++ b/TOF/TOFLinkDef.h @@ -21,5 +21,6 @@ #pragma link C++ class AliTOFRoc+; #pragma link C++ class AliTOFRawSector+; #pragma link C++ class AliTOFRawDigit+; +#pragma link C++ class AliTOFDigitizer+; #endif -- 2.39.3