]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TRD/AliHLTTRDClusterHistoComponent.cxx
- adding new print mode for DataType2Text and some documentation
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDClusterHistoComponent.cxx
index 103e1381d81b179dacd5c8f62f6eda772328de0b..dbf6773ae17dcda31e09f8871ee5e63041e44696 100644 (file)
 using namespace std;
 #endif
 
-#include <time.h>
+#include "TFile.h"
+#include "TString.h"
+#include "TObjString.h"
+#include "TClonesArray.h"
+#include "TH1F.h"
 
 #include "AliHLTTRDClusterHistoComponent.h"
 #include "AliHLTTRDDefinitions.h"
-#include "AliHLTTRDCluster.h"
 #include "AliTRDcluster.h"
 #include "AliCDBEntry.h"
 #include "AliCDBManager.h"
-#include <TFile.h>
-#include <TString.h>
-#include "TObjString.h"
-#include "TClonesArray.h"
-#include "TTimeStamp.h"
 #include "AliHLTTRDUtils.h"
-#include "TH2F.h"
 
 //#include "AliHLTTRD.h"
 //#include <stdlib.h>
@@ -49,9 +46,8 @@ ClassImp(AliHLTTRDClusterHistoComponent)
 AliHLTTRDClusterHistoComponent::AliHLTTRDClusterHistoComponent()
 : AliHLTProcessor(),
   fOutputSize(100000),
+  fSpec(0),
   fClusterArray(NULL),
-  fNevent(0),
-  feveryNevent(20),
   fNClsDet(NULL),
   fClsAmp(NULL),
   fClsAmpDrift(NULL),
@@ -59,8 +55,7 @@ AliHLTTRDClusterHistoComponent::AliHLTTRDClusterHistoComponent()
   fClsAmpDist(NULL),
   fSClsDist(NULL),
   fNScls(NULL),
-  fClusterDist(NULL),
-  fClusterCandCharge(NULL)
+  fEvSize(NULL)
 {
   // see header file for class documentation
   // or
@@ -131,19 +126,17 @@ int AliHLTTRDClusterHistoComponent::DoInit(int argc, const char** argv)
 
   fClusterArray = new TClonesArray("AliTRDcluster");
 
-  fNClsDet = new TH1D("trdClsDet", ";detector", 540, -0.5, 539.5);
-  fClsAmp  = new TH1D("trdClsAmp", ";amplitude", 200, -0.5, 1999.5);
-  fClsAmpDrift = new TH1D("trdClsAmpDrift", ";amplitude", 200, -0.5, 199.5) ;
-  fClsTB = new TH1D("trdClsTB", ";time bin", 35, -0.5, 34.5);
-  fClsAmpDist = new TH1D("trdClsAmpDist", "mean amplitude", 200, 0, 1000);
-  fSClsDist = new TH1D("sclsdist", "Super cluster spectrum", 200, 0, 8000);
-  fNScls = new TH1D("nscls", "No. of Kr clusters per event", 540, 0, 540);
-  fClusterDist = new TH2F("cldist", "Cluster distribution;padrow;padcol", 16*5, -0.5, 79.5, 8*6*18, -0.5, 863.5);
-  fClusterCandCharge = new TH1D("qClsCand", "Cluster candidate charge;charge (ADC counts);counts", 200, 0, 8000);
+  fNClsDet = new TH1F("trdClsDet", ";detector", 540, -0.5, 539.5);
+  fClsAmp  = new TH1F("trdClsAmp", ";amplitude", 200, -0.5, 1999.5);
+  fClsAmpDrift = new TH1F("trdClsAmpDrift", ";amplitude", 200, -0.5, 199.5) ;
+  fClsTB = new TH1F("trdClsTB", ";time bin", 35, -0.5, 34.5);
+  fClsAmpDist = new TH1F("trdClsAmpDist", "mean amplitude", 200, 0, 1000);
+  fSClsDist = new TH1F("sclsdist", "Super cluster spectrum", 200, 0, 8000);
+  fNScls = new TH1F("nscls", "No. of Kr clusters per event", 540, 0, 540);
+  fEvSize = new TH1F("TrdClEvSize", "Clusters size per event per ddl in kbyte", 512, 0, 512);
 
   for(int i=0; i<540; i++) {
-    fClsAmpDriftDet[i] = new TH1D(Form("trdClsDriftDet_%d",i), "", 200, -0.5, 199.5);
-    fSlidingWindow[i].SetBins(9, -0.5, 8.5, 17, -0.5, 16.5);
+    fClsAmpDriftDet[i] = new TH1F(Form("trdClsDriftDet_%d",i), "", 200, -0.5, 199.5);
   }
   
   return 0;
@@ -163,12 +156,12 @@ int AliHLTTRDClusterHistoComponent::DoDeinit()
   if (fClsTB) delete fClsTB;
   if (fClsAmpDist) delete fClsAmpDist;
   if (fSClsDist) delete fSClsDist;
-  if (fClusterDist) delete fClusterDist;
-  if (fClusterCandCharge) delete fClusterCandCharge;
   if (fNScls) delete fNScls;
+  if (fEvSize) delete fEvSize;
 
-  for(int i=0; i<540; i++)
+  for(int i=0; i<540; i++){
     if (fClsAmpDriftDet[i]) delete fClsAmpDriftDet[i];
+  }
 
   return 0;
 }
@@ -192,31 +185,29 @@ int AliHLTTRDClusterHistoComponent::DoEvent(const AliHLTComponentEventData& /*ev
   //     fClsAmpDist->Write(); 
   //     fSClsDist->Write();
   //     fNScls->Write();
-  //     fClusterDist->Write();
-  //     fClusterCandCharge->Write();
   //     file->Close();
   //     HLTInfo("Histogram file dumped");
   //     return 0;
   //   }
 
-  if (GetFirstInputBlock(kAliHLTDataTypeSOR) || GetFirstInputBlock(kAliHLTDataTypeEOR)) return 0;
+  if(!IsDataEvent())return 0;
 
   const AliHLTComponentBlockData* iter = NULL;
-  
-  Float_t sClusterCharge[540] = { 0 };
-  for (Int_t iDet = 0; iDet < 540; iDet++) {
-    fSlidingWindow[iDet].Reset();
-  }
+  Bool_t gotData = kFALSE;
 
   for ( iter = GetFirstInputBlock(AliHLTTRDDefinitions::fgkClusterDataType); 
        iter != NULL; iter = GetNextInputBlock() ) {
 
-    HLTDebug("We get the right data type: Block Ptr: 0x%x; Block Size: %i",
-            iter->fPtr, iter->fSize);
-
+    fEvSize->Fill((iter->fSize+0.5f)/1024);
     AliHLTTRDUtils::ReadClusters(fClusterArray, iter->fPtr, iter->fSize);
     HLTDebug("TClonesArray of clusters: nbEntries = %i", fClusterArray->GetEntriesFast());
+    gotData = kTRUE;
+    fSpec |= iter->fSpecification;
+  }
+
+  if(!gotData) return 0;
 
+  Float_t sClusterCharge[540] = { 0 };
     AliTRDcluster *cls;
 
     // loop over clusters 
@@ -229,58 +220,39 @@ int AliHLTTRDClusterHistoComponent::DoEvent(const AliHLTComponentEventData& /*ev
       
       int tb = cls->GetPadTime();
       fClsTB->Fill(tb);
-      if (tb > 5 && tb <25)
+    if (tb > 5 && tb <25){
        fClsAmpDrift->Fill(cls->GetQ()); 
+    }
       
-      fClsAmpDriftDet[cls->GetDetector()]->Fill(cls->GetQ());
+    //fClsAmpDriftDet[cls->GetDetector()]->Fill(cls->GetQ());
 
       Int_t det = cls->GetDetector();
       sClusterCharge[det] += cls->GetQ();
 
-      fSlidingWindow[det].Fill((cls->GetPadCol() / 18), cls->GetPadRow(), cls->GetQ());
-      fSlidingWindow[det].Fill((cls->GetPadCol() / 18), cls->GetPadRow() + 1, cls->GetQ());
-      fSlidingWindow[det].Fill((cls->GetPadCol() / 18) + 1, cls->GetPadRow(), cls->GetQ());
-      fSlidingWindow[det].Fill((cls->GetPadCol() / 18) + 1, cls->GetPadRow() + 1, cls->GetQ());
     }
     
     fClusterArray->Delete();
     
-  }
-   
-  fClsAmpDist->Reset();
-  Int_t nSClusters = 0;
+  //fClsAmpDist->Reset();
+  //Int_t nSClusters = 0;
   for(int det=0; det<540; det++) {
-    if (fClsAmpDriftDet[det]->GetSum() > 0) 
-      fClsAmpDist->Fill(fClsAmpDriftDet[det]->GetMean());
+    // if (fClsAmpDriftDet[det]->GetSum() > 0) 
+    //   fClsAmpDist->Fill(fClsAmpDriftDet[det]->GetMean());
+    if(sClusterCharge[det])
     fSClsDist->Fill(sClusterCharge[det]);
-
-    Int_t xmax;
-    Int_t ymax;
-    Int_t zmax;
-    fSlidingWindow[det].GetMaximumBin(xmax, ymax, zmax);
-    Float_t charge = fSlidingWindow[det].GetBinContent(xmax, ymax);
-    fClusterCandCharge->Fill(charge);
-    if (charge > 2000. && charge < 6500.) {
-      nSClusters++;
-      fClusterDist->Fill((ymax-1) + 16 * ((det % 30) / 6), (det / 30) * 48 + 8 * (det % 6) + (xmax-1));
-    }
   }
 
-  fNScls->Fill(nSClusters);
-
-  if(fNevent%feveryNevent==0){
-    PushBack((TObject*)fNClsDet, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);   
-    PushBack((TObject*)fClsAmp, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);  
-    //  PushBack((TObject*)fClsAmpDrift, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);   
-    //  PushBack((TObject*)fClsTB, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);  
-    //  PushBack((TObject*)fClsAmpDist, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);  
-    PushBack((TObject*)fNScls, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);  
-    PushBack((TObject*)fSClsDist, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);  
-    PushBack((TObject*)fClusterDist, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);
-    PushBack((TObject*)fClusterCandCharge, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);
-  }
-  
-  fNevent++;
+  //fNScls->Fill(nSClusters);
+
+  PushBack((TObject*)fNClsDet, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
+  PushBack((TObject*)fClsAmp, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
+  PushBack((TObject*)fClsAmpDrift, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
+  PushBack((TObject*)fClsTB, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
+  //PushBack((TObject*)fClsAmpDist, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
+  //PushBack((TObject*)fNScls, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
+  PushBack((TObject*)fSClsDist, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
+  PushBack((TObject*)fEvSize, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, fSpec);
+
   return 0;
 }
 
@@ -304,12 +276,6 @@ int AliHLTTRDClusterHistoComponent::Configure(const char* arguments){
        fOutputSize=((TObjString*)pTokens->At(i))->GetString().Atoi();
        continue;
       } 
-      if (argument.CompareTo("-everyNevent")==0) {
-       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
-       HLTInfo("Pushing back every %s event.", ((TObjString*)pTokens->At(i))->GetString().Data());
-       feveryNevent=((TObjString*)pTokens->At(i))->GetString().Atoi();
-       continue;
-      } 
       else {
        HLTError("unknown argument: %s", argument.Data());
        iResult=-EINVAL;