]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/TRD/AliHLTTRDClusterHistoComponent.cxx
HLTsim
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDClusterHistoComponent.cxx
index b80f472275def172cf5d6763edde07e8d6158eb2..85a23b730393192238d197688a23ed0d2d69f22a 100644 (file)
     @brief  Component for ploting charge in clusters
 */
 
-#if __GNUC__>= 3
-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 "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>
 //#include <cerrno>
 
+using namespace std;
+
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTTRDClusterHistoComponent)
 
 AliHLTTRDClusterHistoComponent::AliHLTTRDClusterHistoComponent()
 : AliHLTProcessor(),
   fOutputSize(100000),
+  fSpec(0),
   fClusterArray(NULL),
   fNClsDet(NULL),
   fClsAmp(NULL),
   fClsAmpDrift(NULL),
   fClsTB(NULL),
+  fClsAmpDriftDet(),
   fClsAmpDist(NULL),
   fSClsDist(NULL),
-  fNScls(NULL)
+  fNScls(NULL),
+  fEvSize(NULL)
 {
   // see header file for class documentation
   // or
   // refer to README to build package
   // or
   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-
+  memset(fClsAmpDriftDet, 0, sizeof(fClsAmpDriftDet));
 }
 
 AliHLTTRDClusterHistoComponent::~AliHLTTRDClusterHistoComponent()
@@ -126,16 +125,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);
+  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);
+    fClsAmpDriftDet[i] = new TH1F(Form("trdClsDriftDet_%d",i), "", 200, -0.5, 199.5);
   }
   
   return 0;
@@ -156,9 +156,11 @@ int AliHLTTRDClusterHistoComponent::DoDeinit()
   if (fClsAmpDist) delete fClsAmpDist;
   if (fSClsDist) delete fSClsDist;
   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;
 }
@@ -187,21 +189,24 @@ int AliHLTTRDClusterHistoComponent::DoEvent(const AliHLTComponentEventData& /*ev
   //     return 0;
   //   }
 
-  if (GetFirstInputBlock(kAliHLTDataTypeSOR) || GetFirstInputBlock(kAliHLTDataTypeEOR)) return 0;
+  if(!IsDataEvent())return 0;
 
   const AliHLTComponentBlockData* iter = NULL;
-  
-  Float_t sClusterCharge[540] = { 0 };
+  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 
@@ -214,10 +219,11 @@ 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();
@@ -226,26 +232,25 @@ int AliHLTTRDClusterHistoComponent::DoEvent(const AliHLTComponentEventData& /*ev
     
     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]);
-
   }
 
-  fNScls->Fill(nSClusters);
+  //fNScls->Fill(nSClusters);
 
-  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*)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;
 }
@@ -270,11 +275,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("Option -everyNevent depreceated");
-       continue;
-      } 
       else {
        HLTError("unknown argument: %s", argument.Data());
        iResult=-EINVAL;