- vectors removed from the ITSTracker class, to avoid a continuous increase of the...
authorsgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 7 Nov 2009 17:18:38 +0000 (17:18 +0000)
committersgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 7 Nov 2009 17:18:38 +0000 (17:18 +0000)
- cleanup

HLT/ITS/tracking/AliHLTITSDetector.cxx
HLT/ITS/tracking/AliHLTITSDetector.h
HLT/ITS/tracking/AliHLTITSTrackerComponent.cxx
HLT/ITS/tracking/AliITStrackerHLT.cxx
HLT/ITS/tracking/AliITStrackerHLT.h

index b8b98b8..a1f7422 100644 (file)
@@ -33,65 +33,7 @@ fCosPhi(det.fCosPhi),
 fYmin(det.fYmin),
 fYmax(det.fYmax),
 fZmin(det.fZmin),
-fZmax(det.fZmax),
-fIsBad(det.fIsBad),
-fNChips(det.fNChips),
-fChipIsBad(det.fChipIsBad)
+fZmax(det.fZmax)
 {
   //Copy constructor
 }
-//------------------------------------------------------------------------
-void AliHLTITSDetector::ReadBadDetectorAndChips(Int_t ilayer,Int_t idet,
-                                               const AliITSDetTypeRec *detTypeRec)
-{
-  //--------------------------------------------------------------------
-  // Read bad detectors and chips from calibration objects in AliITSDetTypeRec
-  //--------------------------------------------------------------------
-
-  // In AliITSDetTypeRec, detector numbers go from 0 to 2197
-  // while in the tracker they start from 0 for each layer
-  for(Int_t il=0; il<ilayer; il++) 
-    idet += AliITSgeomTGeo::GetNLadders(il+1)*AliITSgeomTGeo::GetNDetectors(il+1);
-
-  Int_t detType;
-  if (ilayer==0 || ilayer==1) {        // ----------  SPD
-    detType = 0;
-  } else if (ilayer==2 || ilayer==3) { // ----------  SDD
-    detType = 1;
-  } else if (ilayer==4 || ilayer==5) { // ----------  SSD
-    detType = 2;
-  } else {
-    printf("AliITStrackerHLT::AliHLTITSDetector::InitBadFromOCDB: Wrong layer number %d\n",ilayer);
-    return;
-  }
-
-  // Get calibration from AliITSDetTypeRec
-  AliITSCalibration *calib = (AliITSCalibration*)detTypeRec->GetCalibrationModel(idet);
-  calib->SetModuleIndex(idet);
-  AliITSCalibration *calibSPDdead = 0;
-  if(detType==0) calibSPDdead = (AliITSCalibration*)detTypeRec->GetSPDDeadModel(idet); // TEMPORARY
-  if (calib->IsBad() ||
-      (detType==0 && calibSPDdead->IsBad())) // TEMPORARY
-    {
-      SetBad();
-      //      printf("lay %d bad %d\n",ilayer,idet);
-    }
-
-  // Get segmentation from AliITSDetTypeRec
-  AliITSsegmentation *segm = (AliITSsegmentation*)detTypeRec->GetSegmentationModel(detType);
-
-  // Read info about bad chips
-  fNChips = segm->GetMaximumChipIndex()+1;
-  //printf("ilayer %d  detType %d idet %d fNChips %d %d  GetNumberOfChips %d\n",ilayer,detType,idet,fNChips,segm->GetMaximumChipIndex(),segm->GetNumberOfChips());
-  if(fChipIsBad) { delete [] fChipIsBad; fChipIsBad=NULL; }
-  fChipIsBad = new Bool_t[fNChips];
-  for (Int_t iCh=0;iCh<fNChips;iCh++) {
-    fChipIsBad[iCh] = calib->IsChipBad(iCh);
-    if (detType==0 && calibSPDdead->IsChipBad(iCh)) fChipIsBad[iCh] = kTRUE; // TEMPORARY
-    //if(fChipIsBad[iCh]) {printf("lay %d det %d bad chip %d\n",ilayer,idet,iCh);}
-  }
-
-  return;
-}
-
-
index d2eb4d8..73a7041 100644 (file)
@@ -23,9 +23,9 @@ class AliITSDetTypeRec;
 class AliHLTITSDetector 
 { 
  public:
-  AliHLTITSDetector():fR(0),fRmisal(0),fPhi(0),fSinPhi(0),fCosPhi(0),fYmin(0),fYmax(0),fZmin(0),fZmax(0),fIsBad(kFALSE),fNChips(0),fChipIsBad(0) {}
-  AliHLTITSDetector(Double_t r,Double_t phi):fR(r),fRmisal(r),fPhi(phi),fSinPhi(TMath::Sin(phi)),fCosPhi(TMath::Cos(phi)),fYmin(10000),fYmax(-1000),fZmin(10000),fZmax(-1000),fIsBad(kFALSE),fNChips(0),fChipIsBad(0) {}
-  ~AliHLTITSDetector() {if(fChipIsBad) delete [] fChipIsBad;}
+  AliHLTITSDetector():fR(0),fRmisal(0),fPhi(0),fSinPhi(0),fCosPhi(0),fYmin(0),fYmax(0),fZmin(0),fZmax(0){}
+  AliHLTITSDetector(Double_t r,Double_t phi):fR(r),fRmisal(r),fPhi(phi),fSinPhi(TMath::Sin(phi)),fCosPhi(TMath::Cos(phi)),fYmin(10000),fYmax(-1000),fZmin(10000),fZmax(-1000){}
+  ~AliHLTITSDetector() {}
   inline void GetGlobalXYZ( const AliITSRecPoint *cl, Double_t xyz[3]) const;
   Double_t GetR()   const {return fR;}
   Double_t GetRmisal()   const {return fRmisal;}
@@ -33,17 +33,12 @@ class AliHLTITSDetector
   Double_t GetYmin() const {return fYmin;}
   Double_t GetYmax() const {return fYmax;}
   Double_t GetZmin() const {return fZmin;}
-  Double_t GetZmax() const {return fZmax;}
-  Bool_t   IsBad() const {return fIsBad;}
-  Int_t    GetNChips() const {return fNChips;}
-  Bool_t   IsChipBad(Int_t iChip) const {return (fChipIsBad ? fChipIsBad[iChip] : kFALSE);}
+  Double_t GetZmax() const {return fZmax;}  
   void SetRmisal(Double_t rmisal) {fRmisal = rmisal;}
   void SetYmin(Double_t min) {fYmin = min;}
   void SetYmax(Double_t max) {fYmax = max;}
   void SetZmin(Double_t min) {fZmin = min;}
   void SetZmax(Double_t max) {fZmax = max;}
-  void SetBad() {fIsBad = kTRUE;}
-  void ReadBadDetectorAndChips(Int_t ilayer,Int_t idet,const AliITSDetTypeRec *detTypeRec);
 
  private:
 
@@ -59,10 +54,7 @@ class AliHLTITSDetector
   Double_t fYmin;   //  local y minimal
   Double_t fYmax;   //  local max y
   Double_t fZmin;   //  local z min
-  Double_t fZmax;   //  local z max
-  Bool_t fIsBad;    // is detector dead or noisy?
-  Int_t fNChips;    // number of chips
-  Bool_t *fChipIsBad; //[fNChips] is chip dead or noisy? 
+  Double_t fZmax;   //  local z max  
 };
 
 inline void  AliHLTITSDetector::GetGlobalXYZ(const AliITSRecPoint *cl, Double_t xyz[3]) const
index 49a7776..92cf2cd 100644 (file)
@@ -340,7 +340,7 @@ int AliHLTITSTrackerComponent::DoEvent
 
   AliHLTUInt32_t maxBufferSize = size;
   size = 0; // output size
-
+  
   if (!IsDataEvent()) return 0;
 
   if ( evtData.fBlockCnt <= 0 ) {
@@ -361,10 +361,23 @@ int AliHLTITSTrackerComponent::DoEvent
   vector< AliExternalTrackParam > tracksTPC;
   vector< int > tracksTPCId;
 
-  fTracker->StartLoadClusters();
   int nClustersTotal = 0;
 
-  //int currentTrackID = 0;
+  for (int ndx=0; ndx<nBlocks && iResult>=0; ndx++) {
+
+    const AliHLTComponentBlockData* iter = blocks+ndx;
+    if ( (iter->fDataType == (kAliHLTDataTypeClusters|kAliHLTDataOriginITSSSD) ) || 
+        (iter->fDataType == (kAliHLTDataTypeClusters|kAliHLTDataOriginITSSPD) ) ||
+        (iter->fDataType == (kAliHLTDataTypeClusters|kAliHLTDataOriginITSSDD) ) 
+        ){      
+      AliHLTITSClusterData *inPtr=reinterpret_cast<AliHLTITSClusterData*>( iter->fPtr );
+      nClustersTotal+=inPtr->fSpacePointCnt;
+    }         
+  }
+
+
+  fTracker->StartLoadClusters(nClustersTotal);
 
   for (int ndx=0; ndx<nBlocks && iResult>=0; ndx++) {
 
@@ -402,24 +415,18 @@ int AliHLTITSTrackerComponent::DoEvent
        Int_t info[3] = { d.fNy, d.fNz, d.fLayer };
        Float_t hit[6] = { d.fY, d.fZ, d.fSigmaY2, d.fSigmaZ2, d.fQ, d.fSigmaYZ };
        if( d.fLayer==4 ) hit[5] = -hit[5];
-
        fTracker->LoadCluster( AliITSRecPoint( lab, hit, info ) );
-       nClustersTotal++;
       }   
     }
     
   }// end read input blocks
   
-  // set clusters to tracker
-
-
-  //timer.Stop();
   // Reconstruct the event
 
   TStopwatch timerReco;
   
-  fTracker->Reconstruct( tracksTPC );
-
+  fTracker->Reconstruct( &(tracksTPC[0]), tracksTPC.size() );
+  
   timerReco.Stop();
   
   // Fill output tracks
@@ -442,10 +449,15 @@ int AliHLTITSTrackerComponent::DoEvent
       }
 
       outPtr->fCount = 0;
-      
-      std::vector< AliHLTITSTrack > &tracks = (iOut==0)?fTracker->Tracks() :fTracker->ITSOutTracks();
-
-      int nTracks = tracks.size();
+       AliHLTITSTrack *tracks=0;
+      int nTracks = 0;
+      if( iOut==0 ){
+       tracks = fTracker->Tracks();
+       nTracks = fTracker->NTracks();
+      } else{
+       tracks = fTracker->ITSOutTracks();
+       nTracks = fTracker->NITSOutTracks();
+      }
       
       for ( int itr = 0; itr < nTracks; itr++ ) {
        AliHLTITSTrack &t = tracks[itr];
index 640da54..37fab16 100644 (file)
@@ -59,6 +59,7 @@
 #include "TStopwatch.h"
 //#include "AliHLTTPCCATrackParam.h"
 //#include "AliHLTVertexer.h"
+#include <vector>
 
 
 ClassImp(AliITStrackerHLT)
@@ -79,17 +80,18 @@ AliITStrackerHLT::AliITStrackerHLT()
   :AliTracker(),
    fRecoParam(0),
    fLayers(new AliHLTITSLayer[AliITSgeomTGeo::kNLayers]),
-   fEsd(0),
    fUseTGeo(2),
    fxOverX0Pipe(-1.),
    fxTimesRhoPipe(-1.), 
-   fITSChannelStatus(0),
-   fTracks(),
-   fITSOutTracks(),
+   fTracks(0),
+   fITSOutTracks(0),
+   fNTracks(0),
+   fNITSOutTracks(0),
    fLoadTime(0),
    fRecoTime(0),
    fNEvents(0),
-   fClusters()
+   fClusters(0),
+   fNClusters(0)
 {
   //Default constructor
   Int_t i;
@@ -101,18 +103,19 @@ AliITStrackerHLT::AliITStrackerHLT()
 AliITStrackerHLT::AliITStrackerHLT(const Char_t *geom) 
 : AliTracker(),
   fRecoParam(0),
-  fLayers(new AliHLTITSLayer[AliITSgeomTGeo::kNLayers]),
-  fEsd(0),
+  fLayers(new AliHLTITSLayer[AliITSgeomTGeo::kNLayers]),  
   fUseTGeo(2),
   fxOverX0Pipe(-1.),
   fxTimesRhoPipe(-1.),
-  fITSChannelStatus(0),
-  fTracks(),
-  fITSOutTracks(),
+  fTracks(0),
+  fITSOutTracks(0),
+  fNTracks(0),
+  fNITSOutTracks(0),
   fLoadTime(0),
    fRecoTime(0),
   fNEvents(0),
-  fClusters()
+  fClusters(0),
+  fNClusters(0)
 {
   //--------------------------------------------------------------------
   //This is the AliITStrackerHLT constructor
@@ -216,18 +219,19 @@ AliITStrackerHLT::AliITStrackerHLT(const Char_t *geom)
 AliITStrackerHLT::AliITStrackerHLT(const AliITStrackerHLT &tracker)
 :AliTracker(tracker),
  fRecoParam( tracker.fRecoParam),
- fLayers(new AliHLTITSLayer[AliITSgeomTGeo::kNLayers]),
- fEsd(tracker.fEsd),
+ fLayers(new AliHLTITSLayer[AliITSgeomTGeo::kNLayers]), 
  fUseTGeo(tracker.fUseTGeo),
  fxOverX0Pipe(tracker.fxOverX0Pipe),
  fxTimesRhoPipe(tracker.fxTimesRhoPipe), 
- fITSChannelStatus(tracker.fITSChannelStatus),
- fTracks(),
- fITSOutTracks(),
+ fTracks(0),
+ fITSOutTracks(0),
+ fNTracks(0),
+ fNITSOutTracks(0),
   fLoadTime(0),
    fRecoTime(0),
  fNEvents(0),
- fClusters()
+ fClusters(0),
+ fNClusters(0)
 {
   //Copy constructor
   Int_t i;
@@ -257,8 +261,10 @@ AliITStrackerHLT::~AliITStrackerHLT()
   //
   //destructor
   //
-  if(fITSChannelStatus) delete fITSChannelStatus;
-  delete [] fLayers;
+  delete[] fLayers;
+  delete[] fTracks;
+  delete[] fITSOutTracks;
+  delete[] fClusters;
 }
 
 void AliITStrackerHLT::Init()
@@ -269,16 +275,17 @@ void AliITStrackerHLT::Init()
 }
 
 
-void AliITStrackerHLT::StartLoadClusters( Int_t guessForNClusters )
+void AliITStrackerHLT::StartLoadClusters( Int_t NOfClusters )
 {
   // !
-  fClusters.clear();
-  fClusters.reserve( guessForNClusters );
+  delete[] fClusters;
+  fClusters = new AliITSRecPoint[NOfClusters];
+  fNClusters = 0;
 }
 
 void AliITStrackerHLT::LoadCluster( const AliITSRecPoint &cluster) 
 {
-  fClusters.push_back( cluster );
+  fClusters[fNClusters++] = cluster ;
 }
 
 
@@ -289,7 +296,6 @@ Int_t AliITStrackerHLT::LoadClusters(TTree *cTree) {
   //This function loads ITS clusters
   //--------------------------------------------------------------------
 
-  StartLoadClusters();
 
   TBranch *branch=cTree->GetBranch("ITSRecPoints");
   if (!branch) { 
@@ -300,20 +306,36 @@ Int_t AliITStrackerHLT::LoadClusters(TTree *cTree) {
   static TClonesArray dummy("AliITSRecPoint",10000), *clusters=&dummy;
   branch->SetAddress(&clusters);
 
-  Int_t i=0,j=0,ndet=0;
-  for (i=0; i<AliITSgeomTGeo::GetNLayers(); i++) {
-    ndet=fLayers[i].GetNdetectors();
-    Int_t jmax = j + fLayers[i].GetNladders()*ndet;
-    for (; j<jmax; j++) {           
-      if (!cTree->GetEvent(j)) continue;
-      Int_t ncl=clusters->GetEntriesFast(); 
-      while (ncl--) {
-        LoadCluster( *( (AliITSRecPoint*)clusters->UncheckedAt(ncl)));
+  int nClustersTotal = 0;
+  {
+    Int_t j=0;
+    for (int i=0; i<AliITSgeomTGeo::GetNLayers(); i++) {
+      int ndet=fLayers[i].GetNdetectors();
+      Int_t jmax = j + fLayers[i].GetNladders()*ndet;
+      for (; j<jmax; j++) {           
+       if (!cTree->GetEvent(j)) continue;
+       nClustersTotal+=clusters->GetEntriesFast();      
+       clusters->Delete();
       }
-      clusters->Delete();
     }
   }
-  
+  StartLoadClusters(nClustersTotal);
+  {
+    Int_t j=0;
+    for (int i=0; i<AliITSgeomTGeo::GetNLayers(); i++) {
+      int ndet=fLayers[i].GetNdetectors();
+      Int_t jmax = j + fLayers[i].GetNladders()*ndet;
+      for (; j<jmax; j++) {           
+       if (!cTree->GetEvent(j)) continue;
+       Int_t ncl=clusters->GetEntriesFast(); 
+       while (ncl--) {
+         LoadCluster( *( (AliITSRecPoint*)clusters->UncheckedAt(ncl)));
+       }
+       clusters->Delete();
+      }
+    }
+  }
+
   dummy.Clear();
 
   return 0;
@@ -325,13 +347,15 @@ void AliITStrackerHLT::UnloadClusters() {
   //This function unloads ITS clusters
   //--------------------------------------------------------------------
   for (Int_t i=0; i<AliITSgeomTGeo::GetNLayers(); i++) fLayers[i].ResetClusters();
-  fClusters.clear();
+  delete[] fClusters;
+  fClusters = 0;
+  fNClusters=0;
 }
 
 
 
 
-void AliITStrackerHLT::Reconstruct( std::vector<AliExternalTrackParam> tracksTPC )
+void AliITStrackerHLT::Reconstruct( AliExternalTrackParam *tracksTPC, int nTPCTracks )
 {
 
   //--------------------------------------------------------------------
@@ -348,7 +372,7 @@ void AliITStrackerHLT::Reconstruct( std::vector<AliExternalTrackParam> tracksTPC
     fLayers[i].ResetClusters();
   }
 
-  for( unsigned int icl=0; icl<fClusters.size(); icl++ ){   
+  for( int icl=0; icl<fNClusters; icl++ ){   
     AliITSRecPoint &cl = fClusters[icl];
     if (!cl.Misalign()) AliWarning("Can't misalign this cluster !"); 
     fLayers[cl.GetLayer()].InsertCluster(&cl); 
@@ -365,10 +389,13 @@ void AliITStrackerHLT::Reconstruct( std::vector<AliExternalTrackParam> tracksTPC
   TStopwatch timer;
 
   Double_t pimass = TDatabasePDG::Instance()->GetParticle(211)->Mass();
-  fTracks.clear();
-  fITSOutTracks.clear();
-
-  for( unsigned int itr=0; itr<tracksTPC.size(); itr++ ){
+  delete[] fTracks;
+  delete[] fITSOutTracks;
+  fTracks = new AliHLTITSTrack[nTPCTracks];
+  fITSOutTracks = new AliHLTITSTrack[nTPCTracks];
+  fNTracks = 0;
+  fNITSOutTracks = 0;
+  for( int itr=0; itr<nTPCTracks; itr++ ){
 
     AliHLTITSTrack tMI( tracksTPC[itr] );
     AliHLTITSTrack *t = &tMI;
@@ -397,11 +424,11 @@ void AliITStrackerHLT::Reconstruct( std::vector<AliExternalTrackParam> tracksTPC
     //CorrectForPipeMaterial(t);
    
     TransportToX(t, 0 );
-    fTracks.push_back( *t );  
+    fTracks[fNTracks++] = *t;  
     if(  nclu>0 ){ // construct ITSOut track
       AliHLTITSTrack tOut(*t);
       if( FitOutward( &tOut ) ){
-       fITSOutTracks.push_back( *t );          
+       fITSOutTracks[fNITSOutTracks++] = *t;  
       }
     }
   }
@@ -420,10 +447,8 @@ Int_t AliITStrackerHLT::Clusters2Tracks(AliESDEvent *event) {
   //--------------------------------------------------------------------
   
   
-  fEsd = event;         // store pointer to the esd 
   std::vector<AliExternalTrackParam> tracksTPC;
   tracksTPC.reserve(event->GetNumberOfTracks());
-  fTracks.reserve(event->GetNumberOfTracks());
 
   for( int itr=0; itr<event->GetNumberOfTracks(); itr++ ){
 
@@ -439,10 +464,10 @@ Int_t AliITStrackerHLT::Clusters2Tracks(AliESDEvent *event) {
     tracksTPC.push_back( t );
   }
   //for( int iter=0; iter<100; iter++){
-  Reconstruct( tracksTPC );
+  Reconstruct( &(tracksTPC[0]), tracksTPC.size() );
   //}
 
-  for( unsigned int itr=0; itr<fTracks.size(); itr++ ){
+  for( int itr=0; itr<fNTracks; itr++ ){
     AliHLTITSTrack &t = fTracks[itr];    
     UpdateESDtrack(event->GetTrack(t.TPCtrackId()), &t, AliESDtrack::kITSin);          
     //event->GetTrack(t.TPCtrackId())->myITS = t;
index f50d33a..6d3e487 100644 (file)
@@ -21,19 +21,20 @@ class AliITSRecoParam;
 #include "AliITSRecPoint.h"
 #include "AliTracker.h"
 #include "AliHLTITSTrack.h"
-#include <vector>
 
 //-------------------------------------------------------------------------
 class AliITStrackerHLT : public AliTracker {
 public:
 
   
-  void StartLoadClusters( Int_t guessForNClusters=0 );
+  void StartLoadClusters( Int_t NClusters );
   void LoadCluster( const AliITSRecPoint &cluster);
-  void Reconstruct( std::vector<AliExternalTrackParam> tracksTPC );
+  void Reconstruct( AliExternalTrackParam *tracksTPC, int nTPCTracks );
 
-  std::vector< AliHLTITSTrack > &Tracks(){ return fTracks;}
-  std::vector< AliHLTITSTrack > &ITSOutTracks(){ return fITSOutTracks;}
+  AliHLTITSTrack *Tracks(){ return fTracks;}
+  Int_t NTracks(){ return fNTracks;}
+  AliHLTITSTrack *ITSOutTracks(){ return fITSOutTracks;}
+  Int_t NITSOutTracks(){ return fNITSOutTracks;}
 
   Bool_t TransportToX( AliExternalTrackParam *t, double x ) const;
   Bool_t TransportToPhiX( AliExternalTrackParam *t, double phi, double x ) const;
@@ -98,7 +99,6 @@ protected:
 
   AliHLTITSLayer* fLayers; //!
   
-  AliESDEvent  * fEsd;                   //! pointer to the ESD event
   Double_t fSPDdetzcentre[4];            // centres of SPD modules in z
   
   Int_t fUseTGeo;                        // use TGeo to get material budget
@@ -110,14 +110,15 @@ protected:
   Float_t fxOverX0Layer[6];              // material budget
   Float_t fxTimesRhoLayer[6];            // material budget
 
-  AliITSChannelStatus *fITSChannelStatus;//! bitmaps with channel status for SPD and SDD
-  std::vector< AliHLTITSTrack > fTracks; // array of its-updated tracks
-  std::vector< AliHLTITSTrack > fITSOutTracks; // array of tracks, fitted outward with ITS only
-
+  AliHLTITSTrack *fTracks; // array of its-updated tracks
+  AliHLTITSTrack *fITSOutTracks; // array of tracks, fitted outward with ITS only
+  int fNTracks;// n tracks
+  int fNITSOutTracks;// n out tracks
   double fLoadTime;
   double fRecoTime;
   int fNEvents;
-  std::vector<AliITSRecPoint> fClusters;
+  AliITSRecPoint *fClusters;
+  int fNClusters;
 
 private:
   AliITStrackerHLT(const AliITStrackerHLT &tracker);