From: nilsen Date: Mon, 9 Sep 2002 17:25:25 +0000 (+0000) Subject: Bug fix having to do with the size of arrays of track and hit index numbers. X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=7e7436620fb94c0696023a2e04aa7309d8541976 Bug fix having to do with the size of arrays of track and hit index numbers. Fully backwards compatible thanks to automatic schema evolusion. --- diff --git a/ITS/AliITSdigit.cxx b/ITS/AliITSdigit.cxx index faea5353ba3..4387f4bcec1 100644 --- a/ITS/AliITSdigit.cxx +++ b/ITS/AliITSdigit.cxx @@ -60,16 +60,18 @@ AliITSdigitSPD::AliITSdigitSPD():AliITSdigit(){ // default constructor, zero coordinates and set array // elements to clearly unphysical values. A value of 0 may // be a valide track of hit number. + Int_t i; - fTracks[0] = fTracks[1] = fTracks[2] = -3; - fHits[0] = fHits[1] = fHits[2] = -1; + for(i=0;i> fTracks[0] >> fTracks[1] >> fTracks[2]; - *os >> fHits[0] >> fHits[1] >> fHits[2] >> fSignalSPD; + for(i=0;i> fTracks[i]; + for(i=0;i> fHits[i]; + *os >> fSignalSPD; } //______________________________________________________________________ ostream &operator<<(ostream &os,AliITSdigitSPD &source){ @@ -126,11 +131,12 @@ AliITSdigitSDD::AliITSdigitSDD():AliITSdigit(){ // default constructor, zero coordinates and set array // elements to clearly unphysical values. A value of 0 may // be a valide track of hit number. + Int_t i; - fTracks[0] = fTracks[1] = fTracks[2] = -3; - fHits[0] = fHits[1] = fHits[2] = -1; + for(i=0;i>fPhysics; - *os >> fTcharges[0] >> fTcharges[1] >> fTcharges[2]; - *os >> fTracks[0] >> fTracks[1] >> fTracks[2]; - *os >> fHits[0] >> fHits[1] >> fHits[2]; + for(i=0; i> fTcharges[i]; + for(i=0; i> fTracks[i]; + for(i=0; i> fHits[i]; } //______________________________________________________________________ ostream &operator<<(ostream &os,AliITSdigitSDD &source){ @@ -240,9 +248,10 @@ istream &operator>>(istream &os,AliITSTransientDigit &source){ ClassImp(AliITSdigitSSD) AliITSdigitSSD::AliITSdigitSSD():AliITSdigit(){ // default constructor + Int_t i; - fTracks[0] = fTracks[1] = fTracks[2] = -3; - fHits[0] = fHits[1] = fHits[2] = -1; + for(i=0; i> fTracks[0] >> fTracks[1] >> fTracks[2]; - *os >> fHits[0] >> fHits[1] >> fHits[2]; + for(i=0; i> fTracks[i]; + for(i=0; i> fHits[i]; } //______________________________________________________________________ ostream &operator<<(ostream &os,AliITSdigitSSD &source){ diff --git a/ITS/AliITSdigit.h b/ITS/AliITSdigit.h index 7945b893131..93eea429839 100644 --- a/ITS/AliITSdigit.h +++ b/ITS/AliITSdigit.h @@ -21,9 +21,12 @@ class AliITSdigit: public TObject { AliITSdigit(const Int_t *digits); //Destructor virtual ~AliITSdigit() { } - //returns pointer to array of tracks + // returns the array size used to store Tracks and Hits + // virtual Int_t GetNTracks() {return 0;} + //returns pointer to array of tracks numbers virtual Int_t *GetTracks() {return 0;} - //returns pointer to array of hits + // returns pointer to array of hits numbers for this module (as given by + // AliITSmodule). virtual Int_t *GetHits() {return 0;} // returns track number kept in the array element i of fTracks virtual Int_t GetTrack(Int_t i) const {return 0;} @@ -58,6 +61,8 @@ class AliITSdigitSPD: public AliITSdigit { //standard creator with digits, tracks, and hits AliITSdigitSPD(const Int_t *digits,const Int_t *tracks,const Int_t *hits); virtual ~AliITSdigitSPD(){/*destructor*/} + // returns the array size used to store Tracks and Hits + static Int_t GetNTracks() {return fkSspd;} // returns pointer to the array of tracks which make this digit virtual Int_t *GetTracks() {return &fTracks[0];} //returns the pointer to the array of hits which made this digit @@ -79,19 +84,22 @@ class AliITSdigitSPD: public AliITSdigit { void Print(ostream *os); // Class ascii print function void Read(istream *os); // Class ascii read function + private: + static const Int_t fkSspd = 10; // size of fTracks and fHits arrays + public: // debugging -- goes to the dictionary - Int_t fTracks[3]; // tracks making this digit - Int_t fHits[3]; // hits associated to the tracks - // 3 hits temporarily - it will be only 1 - Int_t fSignalSPD; // Signal in electrons + Int_t fTracks[fkSspd]; //[fkSspd] tracks making this digit + Int_t fHits[fkSspd]; //[fkSspd] hits associated to the tracks + Int_t fSignalSPD; // Signal in electrons - ClassDef(AliITSdigitSPD,1) // Simulated digit object for SPD + ClassDef(AliITSdigitSPD,2) // Simulated digit object for SPD }; // Input and output functions for standard C++ input/output. ostream &operator<<(ostream &os,AliITSdigitSPD &source); istream &operator>>(istream &os,AliITSdigitSPD &source); + //______________________________________________________________________ class AliITSdigitSDD: public AliITSdigit { @@ -103,6 +111,8 @@ class AliITSdigitSDD: public AliITSdigit { AliITSdigitSDD( Float_t phys,const Int_t *digits,const Int_t *tracks, const Int_t *hits,const Float_t *charges); virtual ~AliITSdigitSDD(){/* destructor*/} + // returns the array size used to store Tracks and Hits + static Int_t GetNTracks() {return fkSsdd;} // returns pointer to the array of tracks which make this digit virtual Int_t *GetTracks() {return &fTracks[0];} // returns the pointer to the array of hits which made this digit @@ -124,15 +134,18 @@ class AliITSdigitSDD: public AliITSdigit { void Print(ostream *os); // Class ascii print function void Read(istream *os); // Class ascii read function + private: + static const Int_t fkSsdd = 10; // size of fTracks and fHits arrays + public: // debugging -- goes to the dictionary - Int_t fTracks[3]; // tracks making this digit - Int_t fHits[3]; // hits associated to the tracks - // 3 hits temporarily - it will be only 1 - Float_t fTcharges[3]; // charge per track making this digit - Float_t fPhysics; // signal particles contribution to signal + Int_t fTracks[fkSsdd]; //[fkSsdd] tracks making this digit + Int_t fHits[fkSsdd]; //[fkSsdd] hits associated to the tracks + // 3 hits temporarily - it will be only 1 + Float_t fTcharges[fkSsdd]; //[fkSsdd] charge per track making this digit + Float_t fPhysics; // signal particles contribution to signal - ClassDef(AliITSdigitSDD,1) // Simulated digit object for SDD + ClassDef(AliITSdigitSDD,2) // Simulated digit object for SDD }; // Input and output functions for standard C++ input/output. @@ -179,6 +192,8 @@ class AliITSdigitSSD: public AliITSdigit { //Standard constructor with digits, tracks, and hits AliITSdigitSSD(const Int_t *digits,const Int_t *tracks,const Int_t *hits); virtual ~AliITSdigitSSD(){/* destructor */} + // returns the array size used to store Tracks and Hits + static Int_t GetNTracks() {return fkSssd;} Int_t GetSignal() const {/* returns signal*/return fSignal;} Int_t GetStripNumber() const {/* returns strip number*/return fCoord2;} //returns 1 when side P and 0 when side N @@ -204,13 +219,16 @@ class AliITSdigitSSD: public AliITSdigit { void Print(ostream *os); // Class ascii print function void Read(istream *os); // Class ascii read function + private: + static const Int_t fkSssd = 10; // size of fTracks and fHits arrays + public: // debugging -- goes to the dictionary - Int_t fTracks[3]; // tracks making this digit - Int_t fHits[3]; // hits associated to the tracks - // 3 hits temporarily - it will be only 1 + Int_t fTracks[fkSssd]; //[fkSssd] tracks making this digit + Int_t fHits[fkSssd]; //[fkSssd] hits associated to the tracks + // 3 hits temporarily - it will be only 1 - ClassDef(AliITSdigitSSD,1) // Simulated digit object for SSD + ClassDef(AliITSdigitSSD,2) // Simulated digit object for SSD }; // Input and output functions for standard C++ input/output.