- added protection for slice and partition values out of range (referring to the...
authorkkanaki <kkanaki@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 26 Nov 2009 21:32:50 +0000 (21:32 +0000)
committerkkanaki <kkanaki@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 26 Nov 2009 21:32:50 +0000 (21:32 +0000)
- cleanup of unnecessary variables

HLT/TPCLib/AliHLTTPCTrackHistoComponent.cxx
HLT/TPCLib/AliHLTTPCTrackHistoComponent.h

index c7da0de..dbdfd0d 100644 (file)
@@ -19,7 +19,7 @@
 /** @file   AliHLTTPCTrackHistoComponent.cxx
     @author Gaute Ovrebekk, Matthias Richter
     @date   
-    @brief  The TPC conformal mapping tracker component.
+    @brief  A histogram component with track and associated cluster properties 
 */
 
 #if __GNUC__>= 3
@@ -50,18 +50,15 @@ ClassImp(AliHLTTPCTrackHistoComponent)
 
 AliHLTTPCTrackHistoComponent::AliHLTTPCTrackHistoComponent()
     :
-    fMinSlice(35)
-  , fMaxSlice(0)
-  , fMinPartition(5)
-  , fMaxPartition(0)
   //, fReset(0)
-  , fNEvents(0)
+    fNEvents(0)
   , fNtotTracks(0)
   , fEvtMod(20)
   , fBufferSize(5000)
   , fdEdx(kFALSE)
   , fMeanMultiplicity(NULL)
   , fMultiplicity(NULL)
+  //, fdNdEta(NULL)
   , fDeDxVsP(NULL)
   , fClusters(NULL)
   , fTracks(NULL)
@@ -135,12 +132,11 @@ int AliHLTTPCTrackHistoComponent::DoInit( int argc, const char** argv ){
   fClusters->SetCircular(5000);
   fTracks->SetCircular(5000);
  
-  //fTracksArray = new AliHLTTPCTrackArray();
-
   fMultiplicity     = new TH1F("fMultiplicity",     "Track multiplicity per event",     1000,           0, 1000);
   fMeanMultiplicity = new TH1F("fMeanMultiplicity", "Mean track multiplicity vs. #evt", 10000/fEvtMod, 0, 10000);
   fDeDxVsP          = new TProfile("fDeDxVsP",      "E deposition per unit length vs. p",100, 0, 100);
   fDeDxVsP->SetXTitle("p (GeV/c)");
+  //fdNdEta = new TH1F("fdNdEta", "dN/d#eta",100,-10,10);
   
   // first configure the default
   int iResult=0;
@@ -158,12 +154,12 @@ int AliHLTTPCTrackHistoComponent::DoDeinit(){
   
   delete fClusters;
   delete fTracks;
-  //delete fTracksArray;
-
+  
   delete fMultiplicity;
   delete fMeanMultiplicity;
   delete fDeDxVsP;
-
+  //delete fdNdEta;
+  
   return 0;
 }
 
@@ -187,8 +183,6 @@ int AliHLTTPCTrackHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtD
 
   fNEvents++;
 
-  //if(!fTracksArray) fTracksArray = new AliHLTTPCTrackArray();
-
   const AliHLTComponentBlockData *iter = NULL;
  
  
@@ -260,13 +254,7 @@ int AliHLTTPCTrackHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtD
 void AliHLTTPCTrackHistoComponent::ReadTracks(const AliHLTComponentBlockData* iter,Int_t &tt){
 // see header file for class documentation
 
-  AliHLTUInt8_t slice    = AliHLTTPCDefinitions::GetMinSliceNr(*iter);
-  AliHLTUInt8_t partition = AliHLTTPCDefinitions::GetMinPatchNr(*iter);
-  if( slice     < fMinSlice )    fMinSlice     = slice;
-  if( slice     > fMaxSlice )    fMaxSlice     = slice;
-  if( partition < fMinPartition ) fMinPartition = partition;
-  if( partition > fMaxPartition ) fMaxPartition = partition;
+  AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr(*iter);
   
   Int_t usedSpacePoints = 0;
   
@@ -282,54 +270,63 @@ void AliHLTTPCTrackHistoComponent::ReadTracks(const AliHLTComponentBlockData* it
            
        UInt_t nHits = element->GetNumberOfPoints();
        fTracks->Fill( 1./element->OneOverPt(), element->GetSnp(), element->GetTgl(), nHits );  
+       //fdNdEta->Fill(element->GetSnp());
       
-      Double_t totCharge = 0;
-      const UInt_t *hitnum = element->GetPoints();
-      for(UInt_t i=0; i<element->GetNumberOfPoints(); i++){
-          
-         UInt_t idTrack   = hitnum[i];
-          Int_t sliceTrack = (idTrack>>25) & 0x7f;
-          Int_t patchTrack = (idTrack>>22) & 0x7;
-          UInt_t pos       = idTrack&0x3fffff;
-
-          if( !fClustersArray[sliceTrack][patchTrack]    ) continue;
-          if(  fNSpacePoints[sliceTrack][patchTrack]<pos ) HLTError("Space point array out of boundaries!"); 
-         
-         totCharge += (fClustersArray[sliceTrack][patchTrack])[pos].fCharge; 
-         
-         Float_t xyz[3]; xyz[0] = xyz[1] = xyz[2] = 0.;
-       
-          xyz[0] = (fClustersArray[sliceTrack][patchTrack])[pos].fX;
-          xyz[1] = (fClustersArray[sliceTrack][patchTrack])[pos].fY;
-          xyz[2] = (fClustersArray[sliceTrack][patchTrack])[pos].fZ;
-       
-          AliHLTTPCTransform::Local2Global(xyz,slice); 
-         
-         Double_t p[2]   = { xyz[1], xyz[2]};
-          Double_t cov[3] = { (fClustersArray[sliceTrack][patchTrack])[pos].fSigmaY2, 0., (fClustersArray[sliceTrack][patchTrack])[pos].fSigmaZ2};  
-         Double_t *res = element->GetResiduals(p,cov,kFALSE); 
-         
-         //HLTInfo("resy: %f, resz: %f", res[0], res[1]);
-         
-         if(!res)  res[0] = res[1] = -1000.;
-         else      fClusters->Fill( (fClustersArray[sliceTrack][patchTrack])[pos].fCharge, (fClustersArray[sliceTrack][patchTrack])[pos].fQMax, res[0], res[1]);
+       Double_t totCharge = 0;
+       const UInt_t *hitnum = element->GetPoints();
+       for(UInt_t i=0; i<element->GetNumberOfPoints(); i++){
            
-         usedSpacePoints++;      
-       }        
+          UInt_t idTrack   = hitnum[i];
+           Int_t sliceTrack = (idTrack>>25) & 0x7f;
+           Int_t patchTrack = (idTrack>>22) & 0x7;
+           UInt_t pos      = idTrack&0x3fffff;
+
+           if( !fClustersArray[sliceTrack][patchTrack] ) continue;            
+          
+          if(sliceTrack<0 || sliceTrack>36 || patchTrack<0 || patchTrack>5 ){
+             HLTError("Corrupted TPC cluster Id: slice %d, patch %d, cluster %d", sliceTrack, patchTrack, idTrack);
+             continue;
+          }
+
+           if(fNSpacePoints[sliceTrack][patchTrack]<=pos ){
+             HLTError("Space point array out of boundaries!");
+             continue;
+           }
+          
+          totCharge += (fClustersArray[sliceTrack][patchTrack])[pos].fCharge; 
+          
+          Float_t xyz[3]; xyz[0] = xyz[1] = xyz[2] = 0.;
+        
+           xyz[0] = (fClustersArray[sliceTrack][patchTrack])[pos].fX;
+           xyz[1] = (fClustersArray[sliceTrack][patchTrack])[pos].fY;
+           xyz[2] = (fClustersArray[sliceTrack][patchTrack])[pos].fZ;
+        
+           AliHLTTPCTransform::Local2Global(xyz,slice); 
+          
+          Double_t p[2]   = { xyz[1], xyz[2] };
+           Double_t cov[3] = { (fClustersArray[sliceTrack][patchTrack])[pos].fSigmaY2, 0., (fClustersArray[sliceTrack][patchTrack])[pos].fSigmaZ2};  
+          Double_t *res = element->GetResiduals(p,cov,kFALSE); 
+          
+          //HLTInfo("resy: %f, resz: %f", res[0], res[1]);
+          
+          if(!res)  res[0] = res[1] = -1000.;
+          else      fClusters->Fill( (fClustersArray[sliceTrack][patchTrack])[pos].fCharge, (fClustersArray[sliceTrack][patchTrack])[pos].fQMax, res[0], res[1]);
+            
+          usedSpacePoints++;      
+       }       
    if(fdEdx==kTRUE && trackLength > 0) fDeDxVsP->Fill(element->OneOverPt()*TMath::Sqrt(1.+element->GetTgl()*element->GetTgl()), totCharge/trackLength);       
    }
 }
 
 void AliHLTTPCTrackHistoComponent::PushHisto(){
 // see header file for class documentation
-
-    AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(fMinSlice,fMaxSlice,fMinPartition,fMaxPartition);
     
-    PushBack( (TObject*)fTracks,           kAliHLTDataTypeTNtuple  |kAliHLTDataOriginTPC, fSpecification);   
-    PushBack( (TObject*)fClusters,         kAliHLTDataTypeTNtuple  |kAliHLTDataOriginTPC, fSpecification);
-    PushBack( (TObject*)fMultiplicity,     kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC, fSpecification);
-    PushBack( (TObject*)fMeanMultiplicity, kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC, fSpecification); 
-    PushBack( (TObject*)fDeDxVsP,          kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC, fSpecification);
+    PushBack( (TObject*)fTracks,           kAliHLTDataTypeTNtuple  |kAliHLTDataOriginTPC, 0x0);   
+    PushBack( (TObject*)fClusters,         kAliHLTDataTypeTNtuple  |kAliHLTDataOriginTPC, 0x0);
+    PushBack( (TObject*)fMultiplicity,     kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC, 0x0);
+    PushBack( (TObject*)fMeanMultiplicity, kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC, 0x0); 
+    PushBack( (TObject*)fDeDxVsP,          kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC, 0x0);
+    //PushBack( (TObject*)fdNdEta,           kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC, 0x0);
 }
 
 int AliHLTTPCTrackHistoComponent::ScanConfigurationArgument(int argc, const char** argv){
index c8b215c..88e9f6b 100644 (file)
@@ -23,15 +23,14 @@ class TProfile;
 
 /**
  * @class AliHLTTPCTrackHistoComponent
- * Component for ploting proparties of Tracks. 
- * The component gives out two NTuples. One for cluster- and one for track proprties
+ * Component for plotting proparties of Tracks. 
+ * The component gives out 2 NTuples. One for cluster and one for track properties
  * 
  * <h2>General properties:</h2> 
  *
  * Component ID: \b TPCTrackHisto <br>
  * Library: \b libAliHLTTPC.so <br>
  * Input Data Types: AliHLTTPCDefinitions::fgkClustersDataType,
- *                   AliHLTTPCDefinitions::fgkTrackSegmentsDataType or
  *                   AliHLTTPCDefinitions::fgkTracksDataType <br>
  * Output Data Types: ::kAliHLTDataTypeTNtuple <br> 
  *
@@ -115,11 +114,6 @@ private:
 
   void PushHisto();
  
-  AliHLTUInt8_t fMinSlice;     //! transient
-  AliHLTUInt8_t fMaxSlice;     //! transient
-  AliHLTUInt8_t fMinPartition; //! transient
-  AliHLTUInt8_t fMaxPartition; //! transient
-
   Int_t fNEvents;    //! transient
   Int_t fNtotTracks; //! transient
 
@@ -130,6 +124,7 @@ private:
 
   TH1F *fMeanMultiplicity; //! transient (mean multiplicity for every 20 evts vs. #evt by Z.Y.)
   TH1F *fMultiplicity;     //! transient (track multiplicity by Z.Y.)
+  //TH1F *fdNdEta;           //! transient (dN/dEta)
      
   //TH2F *fNClusterVsXY;   //! transient (#Clusters vs. x, y positions, by ZY)
   //TH2F *fChargeVsXY;     //! transient (Charge distr. vs. x, y added by ZY)
@@ -146,7 +141,7 @@ private:
   /** the default configuration entry for this component */
   static const char* fgkOCDBEntry; //!transient
 
-  ClassDef(AliHLTTPCTrackHistoComponent, 4);
+  ClassDef(AliHLTTPCTrackHistoComponent, 5);
 
 };
 #endif