]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
HistogramHandlerComponent: Put more functionality in to the -use-general option
authorkaamodt <kaamodt@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 19 Jan 2009 14:10:26 +0000 (14:10 +0000)
committerkaamodt <kaamodt@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 19 Jan 2009 14:10:26 +0000 (14:10 +0000)
NoiseMap: Changed the way the data is read, and minor cleanup.
ClusterFinderComponent: Added Configure function, and moved the argument scanning here.
ClusterFinder: Added Getter function for the Occupancy limit.

HLT/TPCLib/AliHLTTPCClusterFinder.h
HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx
HLT/TPCLib/AliHLTTPCClusterFinderComponent.h
HLT/TPCLib/AliHLTTPCHistogramHandlerComponent.cxx
HLT/TPCLib/AliHLTTPCHistogramHandlerComponent.h
HLT/TPCLib/AliHLTTPCNoiseMapComponent.cxx
HLT/TPCLib/AliHLTTPCNoiseMapComponent.h

index b5fb2c3576e221634f6de6f562e32865df322cf8..d95eeab48f86524b8e1cca64bf5b28317f630d7f 100644 (file)
@@ -156,6 +156,9 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
   /** Returns the number of clusters */
   Int_t GetNumberOfClusters() const {return fNClusters;}
 
+  /** Returns the Ocuppancy limit */
+  Float_t GetOccupancyLimit() {return fOccupancyLimit;}
+  
   // setters
   void SetDeconv(Bool_t f) {fDeconvPad=f; fDeconvTime=f;}
   void SetDeconvPad(Bool_t f) {fDeconvPad=f;}
index 38594685ea2896295acc8173e03d3871b615f8d0..d0624e17da622c7ca9e3bca700b3675ff27cd460 100644 (file)
@@ -43,6 +43,11 @@ using namespace std;
 #include <cerrno>
 #include "TString.h"
 #include "TObjString.h"
+#include "TObjArray.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
+
 #include <sys/time.h>
 
 /** ROOT macro for the implementation of ROOT specific class methods */
@@ -166,189 +171,19 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
 
   fClusterFinder = new AliHLTTPCClusterFinder();
 
-  Float_t occulimit = 1.0;
-
-  Int_t i = 0;
-  Char_t* cpErr;
-
-  while ( i < argc ) {      
-
-    // -- deconvolute-time option
-    if ( !strcmp( argv[i], "-deconvolute-time" ) ) {
-      fDeconvTime = kTRUE;
-      i++;
-      continue;
-    }
-
-    // -- deconvolute-pad option
-    if ( !strcmp( argv[i], "-deconvolute-pad" ) ) {
-      fDeconvPad = kTRUE;
-      i++;
-      continue;
-    }
-
-    // -- number of timebins (default 1024)
-    if (!strcmp( argv[i], "-timebins") || !strcmp( argv[i], "timebins" )){
-      TString parameter(argv[i+1]);
-      parameter.Remove(TString::kLeading, ' '); // remove all blanks
-      if (parameter.IsDigit()) {
-       AliHLTTPCTransform::SetNTimeBins(parameter.Atoi());
-       HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
-       fClusterFinder->UpdateLastTimeBin();
-      } else {
-       HLTError("Cannot timebin specifier '%s'.", argv[i+1]);
-       return EINVAL;
-      }
-      if(!strcmp( argv[i], "timebins")){
-       HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
-      }
-      i+=2;
-      continue;
-    }
-
-    // -first-timebin (default 0)
-    if ( !strcmp( argv[i], "-first-timebin" ) ) {
-      TString parameter(argv[i+1]);
-      parameter.Remove(TString::kLeading, ' '); // remove all blanks
-      if (parameter.IsDigit()){
-       fFirstTimeBin=parameter.Atoi();
-       HLTDebug("fFirstTimeBin set to %d",fFirstTimeBin);
-      } 
-      else {
-       HLTError("Cannot -first-timebin specifier '%s'. Not a number.", argv[i+1]);
-       return EINVAL;
-      }
-      i+=2;
-      continue;
-    }
-
-    // -last-timebin (default 1024)
-    if ( !strcmp( argv[i], "-last-timebin" ) ) {
-      TString parameter(argv[i+1]);
-      parameter.Remove(TString::kLeading, ' '); // remove all blanks
-      if (parameter.IsDigit()){
-       fLastTimeBin=parameter.Atoi();
-       HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
-      } 
-      else {
-       HLTError("Cannot -last-timebin specifier '%s'. Not a number.", argv[i+1]);
-       return EINVAL;
-      }
-      i+=2;
-      continue;
-    }
-
-    // --  unsorted option
-    if ( !strcmp( argv[i], "-sorted" ) ) {
-      fUnsorted=0;
-      i++;
-      continue;
-    }
-
-      
-    // -- checking for active pads, used in 2007 December run
-    if ( !strcmp( argv[i], "-active-pads" ) || !strcmp( argv[i], "activepads" ) ) {
-      if(!strcmp( argv[i], "activepads" )){
-       HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'active-pads'");
-      }
-      fGetActivePads = strtoul( argv[i+1], &cpErr ,0);
-      if ( *cpErr ){
-       HLTError("Cannot convert activepads specifier '%s'. Should  be 0(off) or 1(on), must be integer", argv[i+1]);
-       return EINVAL;
-      }
-      i+=2;
-      continue;
-    }
-
-    // -- pad occupancy limit
-    if ( !strcmp( argv[i], "-occupancy-limit" ) || !strcmp( argv[i], "occupancy-limit" ) ) {
-      if(!strcmp( argv[i], "occupancy-limit" )){
-       HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
-      }
-      occulimit = strtod( argv[i+1], &cpErr);
-      if ( *cpErr ) {
-       HLTError("Cannot convert occupancy specifier '%s'.", argv[i+1]);
-       return EINVAL;
-      }
-      if(fModeSwitch!=kClusterFinderPacked){
-       HLTWarning("Argument '-occupancy-limit' is only used with -sorted set and with the TPCClusterFinderPacked , argument is deprecated");
-      }
-      i+=2;
-      continue;
-    }
-
-    // -- raw reader mode option
-    if ( !strcmp( argv[i], "rawreadermode" ) ) {
-      if ( argc <= i+1 ) {
-       Logging( kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Missing rawreadermode", "Raw Reader Mode not specified. rawreadermode is no longer a valid argument and will be deprecated even if rawreadermode is specified." );
-       return ENOTSUP;
-      }
-
-      HLTWarning("Argument 'rawreadermode' is deprecated");      
-
-      i += 2;
-      continue;
-    }
-
-    // -- pp-run option
-    if ( !strcmp( argv[i], "pp-run") ) {
-      HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
-      fClusterDeconv = false;
-      i++;
-      continue;
-    }
-
-    // -- zero suppression threshold
-    if ( !strcmp( argv[i], "adc-threshold" ) ) {
-      strtoul( argv[i+1], &cpErr ,0);
-      if ( *cpErr ) {
-       HLTError("Cannot convert threshold specifier '%s'.", argv[i+1]);
-       return EINVAL;
-      }
-      HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
-      i+=2;
-      continue;
-    }
-
-    // -- checking for rcu format
-    if ( !strcmp( argv[i], "oldrcuformat" ) ) {
-      strtoul( argv[i+1], &cpErr ,0);
-      if ( *cpErr ){
-       HLTError("Cannot convert oldrcuformat specifier '%s'. Should  be 0(off) or 1(on), must be integer", argv[i+1]);
-       return EINVAL;
-      }
-      HLTWarning("Argument 'oldrcuformat' is deprecated.");
-      i+=2;
-      continue;
-    }
-      
-    // -- checking for unsorted clusterfinding (default 1)
-    if ( !strcmp( argv[i], "unsorted" ) ) {
-      fUnsorted = strtoul( argv[i+1], &cpErr ,0);
-      if ( *cpErr ){
-       HLTError("Cannot convert unsorted specifier '%s'. Should  be 0(off) or 1(on), must be integer", argv[i+1]);
-       return EINVAL;
-      }
-      HLTWarning("Argument 'unsorted' is old and does not follow the new argument naming convention. A change has been made, and the clusterfinder will read the data unsorted by default. For sorted reading, please use '-sorted' as argument. (unsorted 0 will do the same job, but please change anyway.)");
-      i+=2;
-      continue;
-    }
-
-    // -- checking for nsigma-threshold, used in 2007 December run in ZeroSuppression
-    if ( !strcmp( argv[i], "nsigma-threshold" ) ) {
-      strtoul( argv[i+1], &cpErr ,0);
-      if ( *cpErr ){
-       HLTError("Cannot convert nsigma-threshold specifier '%s'. Must be integer", argv[i+1]);
-       return EINVAL;
-      }
-      i+=2;
-      HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
-      continue;
-    }
-
-    Logging(kHLTLogError, "HLT::TPCClusterFinder::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
-    return EINVAL;
-
+  Int_t iResult=0;
+  TString configuration="";
+  TString argument="";
+  for (int i=0; i<argc && iResult>=0; i++) {
+    argument=argv[i];
+    if (!configuration.IsNull()) configuration+=" ";
+    configuration+=argument;
+  }
+  
+  if (!configuration.IsNull()) {
+    iResult=Configure(configuration.Data());
+  } else {
+    iResult=Reconfigure(NULL, NULL);
   }
 
   //Checking for conflicting arguments
@@ -357,7 +192,7 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
       HLTWarning("Conflicting arguments: argument 'pp-run' will be ignored.");
     }
   }
-  if(occulimit!=1.0 && fUnsorted){
+  if(fClusterFinder->GetOccupancyLimit()!=1.0 && fUnsorted){
     HLTWarning("Argument 'occupancy-limit' is deprecated when doing unsorted data reading.");
   }
   if(fGetActivePads==kTRUE && fUnsorted==kFALSE){
@@ -385,12 +220,10 @@ int AliHLTTPCClusterFinderComponent::DoInit( int argc, const char** argv )
   else{
     HLTFatal("No mode set for clusterfindercomponent");
   }
-  // if pp-run use occupancy limit else set to 1. ==> use all 
-  if ( !fClusterDeconv )
-    fClusterFinder->SetOccupancyLimit(occulimit);
-  else 
+
+  if(fClusterDeconv){
     fClusterFinder->SetOccupancyLimit(1.0);
-      
+  }
   
   fClusterFinder->SetDeconv(fClusterDeconv);
   fClusterFinder->SetDeconvPad(fDeconvPad);
@@ -563,10 +396,6 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
        AliHLTUInt16_t* outputHWPtr= (AliHLTUInt16_t*)(outputPtr+tSize);
        Int_t nHWAdd = fClusterFinder->FillHWAddressList(outputHWPtr, maxNumberOfHW);
       
-       //cout<<"Number of hardwareaddresses: "<<nHWAdd<<endl;
-       for(AliHLTUInt16_t test=0;test<nHWAdd;test++){
-        //cout<<"The HW address is: "<<(AliHLTUInt16_t)outputHWPtr[test]<<endl;
-       }
        AliHLTComponentBlockData bdHW;
        FillBlockData( bdHW );
        bdHW.fOffset = tSize ;
@@ -585,10 +414,114 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
   return 0;
 }
 
+int AliHLTTPCClusterFinderComponent::Configure(const char* arguments){
+  // see header file for class documentation
+  int iResult=0;
+  if (!arguments) return iResult;
+  
+  TString allArgs=arguments;
+  TString argument;
+  int bMissingParam=0;
+
+  TObjArray* pTokens=allArgs.Tokenize(" ");
+  if (pTokens) {
+    
+    for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
+      argument=((TObjString*)pTokens->At(i))->GetString();
+
+      if (argument.IsNull()) continue;
+      
+
+      // -- deconvolute-time option
+      if (argument.CompareTo("-deconvolute-time")==0){
+       HLTDebug("Switching on deconvolution in time direction.");
+       fDeconvTime = kTRUE;
+      }
+      else if (argument.CompareTo("-deconvolute-pad")==0){
+       HLTDebug("Switching on deconvolution in pad direction.");
+       fDeconvPad = kTRUE;
+      }
+      else if (argument.CompareTo("-timebins")==0 || argument.CompareTo("timebins" )==0){
+       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       AliHLTTPCTransform::SetNTimeBins(((TObjString*)pTokens->At(i))->GetString().Atoi());
+       fClusterFinder->UpdateLastTimeBin();
+       HLTInfo("number of timebins set to %d, zbin=%f", AliHLTTPCTransform::GetNTimeBins(), AliHLTTPCTransform::GetZWidth());
+       if(argument.CompareTo("timebins")==0){
+         HLTWarning("Argument 'timebins' is old, please switch to new argument naming convention (-timebins). The timebins argument will still work, but please change anyway.");
+       }
+      }
+      else if (argument.CompareTo("-first-timebin")==0){
+       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       fFirstTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi();
+       HLTDebug("Kenneth fFirstTimeBin set to %d",fFirstTimeBin);
+      }
+      else if (argument.CompareTo("-last-timebin")==0){
+       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       fLastTimeBin = ((TObjString*)pTokens->At(i))->GetString().Atoi();
+       HLTDebug("fLastTimeBin set to %d",fLastTimeBin);
+      }
+      else if (argument.CompareTo("-sorted")) {
+       fUnsorted=0;
+       HLTDebug("Swithching unsorted off.");
+      }
+      else if (argument.CompareTo("-active-pads")==0 || argument.CompareTo("activepads")==0){
+       if(argument.CompareTo("activepads" )==0){
+         HLTWarning("Please change to new component argument naming scheme and use '-active-pads' instead of 'activepads'");
+       }
+       HLTDebug("Switching on ActivePads");
+       fGetActivePads = 1;
+      }
+      else if (argument.CompareTo("-occupancy-limit")==0 ||argument.CompareTo("occupancy-limit")==0){
+       if(argument.CompareTo("occupancy-limit" )==0){
+         HLTWarning("Please switch to new component argument naming convention, use '-occupancy-limit' instead of 'occupancy-limit'");
+       }
+       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       fClusterFinder->SetOccupancyLimit(((TObjString*)pTokens->At(i))->GetString().Atof());
+       HLTDebug("Occupancy limit set to occulimit %f", ((TObjString*)pTokens->At(i))->GetString().Atof());
+      }
+      else if (argument.CompareTo("rawreadermode")==0){
+       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       HLTWarning("Argument 'rawreadermode' is deprecated");      
+      }
+      else if (argument.CompareTo("pp-run")==0){
+       HLTWarning("Argument 'pp-run' is obsolete, deconvolution is swiched off in both time and pad directions by default.");
+       fClusterDeconv = false;
+      }
+      else if (argument.CompareTo("adc-threshold" )==0){
+       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       HLTWarning("'adc-threshold' is no longer a valid argument, please use TPCZeroSuppression component if you want to zerosuppress data.");
+      }
+      else if (argument.CompareTo("oldrcuformat" )==0){
+       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       HLTWarning("Argument 'oldrcuformat' is deprecated.");
+      }
+      else if (argument.CompareTo("unsorted" )==0){
+       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       HLTWarning("Argument 'unsorted' is old and does not follow the new argument naming convention. A change has been made, and the clusterfinder will read the data unsorted by default. For sorted reading, please use '-sorted' as argument.");
+      }
+      else if (argument.CompareTo("nsigma-threshold")==0){
+       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       HLTWarning("Argument 'nsigma-threshold' argument is obsolete.");
+      }
+      else {
+       HLTError("unknown argument %s", argument.Data());
+       iResult=-EINVAL;
+       break;
+      }
+    }
+    delete pTokens;
+  }
+  if (bMissingParam) {
+    HLTError("missing parameter for argument %s", argument.Data());
+    iResult=-EINVAL;
+  }
+  return iResult;
+}
+
 int AliHLTTPCClusterFinderComponent::Reconfigure(const char* cdbEntry, const char* chainId)
 {
   // see header file for class documentation
-  const char* path="HLT/ConfigTPC";
+  const char* path="HLT/ConfigTPC/ClusterFinderComponent";
   if (cdbEntry) path=cdbEntry;
   if (path) {
     HLTInfo("reconfigure from entry %s, chain id %s", path, (chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
index 2ae3130245535511287db946493f05c9d20efd73..eeb0c3f8f0bafe04d1ff7375f4d6d03946d2da33 100644 (file)
@@ -122,6 +122,7 @@ class AliHLTTPCClusterFinderComponent : public AliHLTProcessor
        int DoEvent( const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks, 
                     AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, 
                     AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks );
+       int Configure(const char* arguments);
        int Reconfigure(const char* cdbEntry, const char* chainId);
        
        using AliHLTProcessor::DoEvent;
index 9836526d4a3496416cbbe30d9f14702a79598471..7e08be4776ba5aca86b92b19b38660a32c76b027 100644 (file)
@@ -1,4 +1,3 @@
-// $Id$
 
 //**************************************************************************
 //* This file is property of and copyright by the ALICE HLT Project        *
@@ -129,8 +128,8 @@ AliHLTComponent* AliHLTTPCHistogramHandlerComponent::Spawn() {
 int AliHLTTPCHistogramHandlerComponent::DoInit( int argc, const char** argv ) { 
   // see header file for class documentation
 
-  Int_t i = 0;
-  Char_t* cpErr;
+  //Int_t i = 0;
+  //Char_t* cpErr;
   
   int iResult=0;
   
@@ -149,47 +148,6 @@ int AliHLTTPCHistogramHandlerComponent::DoInit( int argc, const char** argv ) {
     iResult=Reconfigure(NULL, NULL);
   }
 
-  while ( i < argc ) {      
-    if (!strcmp( argv[i], "-sum-noise-histograms")) {
-      fNoiseHistograms = strtoul( argv[i+1], &cpErr ,0);
-            
-      if ( *cpErr ) {
-        HLTError("Cannot convert sum-noise-histograms specifier '%s'.", argv[i+1]);
-        return EINVAL;
-      }
-      i+=2;
-      continue;
-    }
-    
-    if (!strcmp( argv[i], "-sum-krypton-histograms")) {
-      fKryptonHistograms = strtoul( argv[i+1], &cpErr ,0);
-            
-      if ( *cpErr ) {
-        HLTError("Cannot convert sum-krypton-histograms specifier '%s'.", argv[i+1]);
-        return EINVAL;
-      }
-      i+=2;
-      continue;
-    }    
-
-    if (!strcmp( argv[i], "-use-general")) {
-      fUseGeneral = kTRUE;
-      i++;
-      continue;
-    }
-
-    if (!strcmp( argv[i], "-ignore-specification")) {
-      fIgnoreSpecification = kTRUE;
-      i++;
-      continue;
-    }
-    
-    Logging(kHLTLogError, "HLT::TPCHistogramHandler::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
-    return EINVAL;
-    
-  } // end while
-  
   if(fUseGeneral == kFALSE){
     fHistTPCSideAmax = new TH2F("fHistTPCSideAmax","TPC side A (max signal)",250,-250,250,250,-250,250);
     fHistTPCSideAmax->SetXTitle("global X (cm)"); fHistTPCSideAmax->SetYTitle("global Y (cm)");
@@ -227,7 +185,7 @@ int AliHLTTPCHistogramHandlerComponent::DoDeinit() {
 int AliHLTTPCHistogramHandlerComponent::DoEvent(const AliHLTComponentEventData&/* evtData*/, AliHLTComponentTriggerData& /*trigData*/){
   // see header file for class documentation
 
-  HLTInfo("--- Entering DoEvent() in TPCHistogramHandler ---");
+  //HLTInfo("--- Entering DoEvent() in TPCHistogramHandler ---");
   
   if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0;
  
@@ -237,21 +195,11 @@ int AliHLTTPCHistogramHandlerComponent::DoEvent(const AliHLTComponentEventData&/
     fQMaxPartitionAll          = new TH1F("fQMaxPartitionAll",         "QMax for All Partitions",             216,0,216);
     fPlotQmaxROCAll            = new TH1F("fQMaxROCAll",               "QMax for All ROC",                    72,0,72);
     fNumberOfClusters          = new TH1F("fNumberOfClusters",         "Total Number of Clusters",            1,0,1);
-    }    
-  //   fHistTH2Tmp = new TH2F("fHistTH2Tmp","fHistTH2Tmp",250,-250,250,250,-250,250);    
-  //   fHistTPCSideA = new TH2F("fHistTPCSideA","TPC side A (max signal)",250,-250,250,250,-250,250);
-  //   fHistTPCSideA->SetXTitle("global X (cm)"); fHistTPCSideA->SetYTitle("global Y (cm)");
-  //   fHistTPCSideC = new TH2F("fHistTPCSideC","TPC side C (max signal)",250,-250,250,250,-250,250);
-  //   fHistTPCSideC->SetXTitle("global X (cm)"); fHistTPCSideC->SetYTitle("global Y (cm)");
-  
-
-  
+  }    
 
-  const TObject *iter = NULL;  
-        
+  const TObject *iter = NULL;        
   for(iter = GetFirstInputObject(kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC); iter != NULL; iter = GetNextInputObject()){
   
-
     //      HLTInfo("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", 
     //               evtData.fEventID, evtData.fEventID,
     //               DataType2Text(GetDataType(iter)).c_str(), 
@@ -268,9 +216,8 @@ int AliHLTTPCHistogramHandlerComponent::DoEvent(const AliHLTComponentEventData&/
     // Summing the output histograms of the AliHLTTPCNoiseMapComponent (from partition to TPC sides)
 
     if(fUseGeneral == kFALSE){
-      if(fNoiseHistograms){  
+      if(fNoiseHistograms == kTRUE){  
         
-       //fHistTH2Tmp = new TH2F("fHistTH2Tmp","fHistTH2Tmp",250,-250,250,250,-250,250);        
        fHistTH2Tmp = (TH2F*)iter;
        TString histName = fHistTH2Tmp->GetName();
         
@@ -285,21 +232,16 @@ int AliHLTTPCHistogramHandlerComponent::DoEvent(const AliHLTComponentEventData&/
        
        // minSlice=maxSlice, when the Noise Map component runs on partition level (as it should)
         
-       if(minSlice<18){ 
-         if     (histName=="fHistMaxSignal") fHistTPCSideAmax->Add(fHistTPCSideAmax,fHistTH2Tmp,1,1); 
-         else if(histName=="fHistTotSignal") fHistTPCSideAtot->Add(fHistTPCSideAtot,fHistTH2Tmp,1,1);
-         else if(histName=="fHistPadRMS")    fHistTPCSideArms->Add(fHistTPCSideArms,fHistTH2Tmp,1,1);
-         else continue;
-       }
-       else{ 
-         if     (histName=="fHistMaxSignal") fHistTPCSideCmax->Add(fHistTPCSideCmax,fHistTH2Tmp,1,1);
-         else if(histName=="fHistTotSignal") fHistTPCSideCtot->Add(fHistTPCSideCtot,fHistTH2Tmp,1,1);
-         else if(histName=="fHistPadRMS")    fHistTPCSideCrms->Add(fHistTPCSideCrms,fHistTH2Tmp,1,1);
-         else continue;
-       }
+       if     (histName.Contains("fHistSideAMaxSignal")) fHistTPCSideAmax->Add(fHistTH2Tmp,1);
+       else if(histName.Contains("fHistSideATotSignal")) fHistTPCSideAtot->Add(fHistTH2Tmp,1);
+       else if(histName.Contains("fHistSideAPadRMS"))    fHistTPCSideArms->Add(fHistTH2Tmp,1);
+       else if(histName.Contains("fHistSideCMaxSignal")) fHistTPCSideCmax->Add(fHistTH2Tmp,1);
+       else if(histName.Contains("fHistSideCTotSignal")) fHistTPCSideCtot->Add(fHistTH2Tmp,1);
+       else if(histName.Contains("fHistSideCPadRMS"))    fHistTPCSideCrms->Add(fHistTH2Tmp,1);
+       else continue;
+       
       } // endif fNoiseHistograms==kTRUE   
-      
-      
+            
       // Summing the output of AliHLTTPCClusterHistoComponent
       if(fKryptonHistograms){
        Int_t thisrow=-1,thissector=-1,row=-1;
@@ -309,9 +251,7 @@ int AliHLTTPCHistogramHandlerComponent::DoEvent(const AliHLTComponentEventData&/
        row = AliHLTTPCTransform::GetFirstRow(patch); 
        AliHLTTPCTransform::Slice2Sector(slice,row,thissector,thisrow);
        
-       fHistTH1Tmp = (TH1F*)iter;      
-       //cout << fHistTH1Tmp->GetName() << "\t" << fHistTH1Tmp->GetEntries() << endl;
-       
+       fHistTH1Tmp = (TH1F*)iter;              
        TString name = fHistTH1Tmp->GetName();
        
        if(name=="fTotalClusterChargeIROCAll"){
@@ -343,7 +283,9 @@ int AliHLTTPCHistogramHandlerComponent::DoEvent(const AliHLTComponentEventData&/
        }     
       } //endif fKryptonHistograms==kTRUE
     }
-    else{ // means fUseGeneral ==kTRUE
+    
+    else { // means fUseGeneral ==kTRUE
+
       TH1 * tmp = (TH1*)iter;
       TString histName = tmp->GetName();
       UInt_t minSlice     = AliHLTTPCDefinitions::GetMinSliceNr(GetSpecification(iter)); 
@@ -354,6 +296,16 @@ int AliHLTTPCHistogramHandlerComponent::DoEvent(const AliHLTComponentEventData&/
       Bool_t histogramNotAdded = kTRUE;
 
       for(UInt_t i=0;i<fHistogramData.size();i++){
+        if(fIgnoreSpecification == kTRUE){
+       
+         /*
+           if(histName.Contains(Form("_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition))){
+           cout << "HistogramContains the given string." << endl;         
+           } 
+         */
+          histName.ReplaceAll(Form("_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition),"");
+       } 
+       
        if(histName.CompareTo(fHistogramData.at(i).fHistogram->GetName())==0){
          if((minSlice==fHistogramData.at(i).fMinSlice && maxSlice == fHistogramData.at(i).fMaxSlice) || fIgnoreSpecification == kTRUE){
            if((minPartition==fHistogramData.at(i).fMinPartition && maxPartition == fHistogramData.at(i).fMaxPartition) || fIgnoreSpecification == kTRUE){
@@ -370,18 +322,27 @@ int AliHLTTPCHistogramHandlerComponent::DoEvent(const AliHLTComponentEventData&/
          }
        }
       }
+      
+      if(fHistogramData.size()==0){       
+        if(fIgnoreSpecification == kTRUE){
+          if(histName.Contains(Form("_Slice_%.2d%.2d%_Partition_.2d%.2d", minSlice, maxSlice, minPartition, maxPartition))){
+             cout << "HistogramContains the given string." << endl;
+          } 
+           histName.ReplaceAll(Form("_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition),"");   
+        }
+      }
 
       if(histogramNotAdded == kTRUE){
-       AliHLTHistogramData  histogramData;
-       histogramData.fHistogram = tmp;
-       histogramData.fMinSlice = minSlice;
-       histogramData.fMaxSlice = maxSlice;
-       histogramData.fMinPartition = minPartition;
-       histogramData.fMaxPartition = maxPartition;
-       fHistogramData.push_back(histogramData);
+         tmp->SetName(histName);
+        AliHLTHistogramData  histogramData;
+        histogramData.fHistogram = tmp;
+        histogramData.fMinSlice = minSlice;
+        histogramData.fMaxSlice = maxSlice;
+        histogramData.fMinPartition = minPartition;
+        histogramData.fMaxPartition = maxPartition;
+        fHistogramData.push_back(histogramData);
       }
-    }
-    
+    }    
   } // end for loop over histogram blocks
   
   MakeHistosPublic();
@@ -425,7 +386,7 @@ void AliHLTTPCHistogramHandlerComponent::MakeHistosPublic() {
   else{ // means fUseGeneral == kTRUE
     for(UInt_t i=0;i<fHistogramData.size();i++){
       PushBack((TObject*)fHistogramData.at(i).fHistogram,kAliHLTDataTypeHistogram,AliHLTTPCDefinitions::EncodeDataSpecification( 
-               fHistogramData.at(i).fMinSlice,fHistogramData.at(i).fMaxSlice,fHistogramData.at(i).fMinPartition,fHistogramData.at(i).fMaxPartition));
+                                                                                                                               fHistogramData.at(i).fMinSlice,fHistogramData.at(i).fMaxSlice,fHistogramData.at(i).fMinPartition,fHistogramData.at(i).fMaxPartition));
     }
     fHistogramData.clear();
   }
@@ -462,6 +423,33 @@ int AliHLTTPCHistogramHandlerComponent::Configure(const char* arguments) {
       argument=((TObjString*)pTokens->At(i))->GetString();
       if (argument.IsNull()) continue;
      
+      if (argument.CompareTo("-sum-noise-histograms")==0) {
+       fNoiseHistograms = kTRUE;
+       HLTInfo("got \'-sum-noise-histograms\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
+       
+      } else if (argument.CompareTo("-sum-krypton-histograms")==0) {
+       fKryptonHistograms = kTRUE;
+       HLTInfo("got \'-sum-krypton-histograms\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
+       
+      } else if (argument.CompareTo("-use-general")==0) {
+       fUseGeneral = kTRUE;
+       HLTInfo("got \'-use-general\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
+       
+      } else if (argument.CompareTo("-ignore-specification")==0) {
+       fIgnoreSpecification = kTRUE;
+       HLTInfo("got \'-ignore-specification\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
+      }
+      else {
+       HLTError("unknown argument %s", argument.Data());
+       iResult=-EINVAL;
+       break;
+      }
+    } // end for
+    
+    /*for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
+      argument=((TObjString*)pTokens->At(i))->GetString();
+      if (argument.IsNull()) continue;
+     
       if (argument.CompareTo("-sum-noise-histograms")==0) {
        if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
        HLTInfo("got \'-sum-noise-histograms\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
@@ -470,13 +458,20 @@ int AliHLTTPCHistogramHandlerComponent::Configure(const char* arguments) {
        if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
        HLTInfo("got \'-sum-krypton-histograms\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
        
-      } 
+      } else if (argument.CompareTo("-use-general")==0) {
+       fUseGeneral = kTRUE;
+       HLTInfo("got \'-use-general\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
+       
+      } else if (argument.CompareTo("-ignore-specification")==0) {
+       fIgnoreSpecification = kTRUE;
+       HLTInfo("got \'-ignore-specification\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
+      }
       else {
        HLTError("unknown argument %s", argument.Data());
        iResult=-EINVAL;
        break;
       }
-    } // end for
+    } // end for*/
   
     delete pTokens;
   
index 4b3351f71a481e9d9d889d3b23962e7472bee0f1..9012cb0304f3ade66d42e43633ba57626f1c0fb9 100644 (file)
@@ -9,7 +9,7 @@
     //* See cxx source for full Copyright notice                               *
 
     /** @file   AliHLTTPCHistogramHandlerComponent.h
-       @author Kalliopi Kanaki
+       @author Kalliopi Kanaki, Kenneth Aamodt
        @date   
        @brief  Component for acting upon histograms
     */
@@ -34,10 +34,18 @@ class TH2;
  *  
  * The component has the following component arguments:
  *
- * -sum-noise-histograms Loops over the output of TPCNoiseMap and adds the histograms
+ * -sum-noise-histograms Loops over the output of TPCNoiseMap and sums the partition histograms
+ *  They are sorted per TPC side.
+ *
+ * -sum-krypton-histograms Loops over the output of the krypton CF and sums the histograms
+ * (it will become obsolete, when the next option does all the work)
+ *
+ * -use-general It will become the standard general option for summing histograms
+ *
+ * -ignore-specification It ignores the last part of the histogram name, if it has 
+ * the form "_Slice_%.2d%.2d_Partition_%.2d%.2d, minSlice, maxSlice, minPartition, maxPartition".
+ * It keeps the first part of the hist name and uses it to name the summed histogram.
  *
- * It loops over histogram input and sums up the TPC histograms per side (at the moment).
- * 
  * @ingroup alihlt_tpc
  */
 class AliHLTTPCHistogramHandlerComponent : public AliHLTProcessor {
@@ -100,14 +108,11 @@ private:
 
   /** the reader object for data decoding */
   AliHLTUInt32_t fSpecification;  //!transient
-      
-
-  
-      
-  Bool_t fNoiseHistograms;   //!transient
-  Bool_t fKryptonHistograms; //!transient
-  Bool_t fUseGeneral;        //!transient
-  Bool_t fIgnoreSpecification;//!transient 
+            
+  Bool_t fNoiseHistograms;     //!transient
+  Bool_t fKryptonHistograms;   //!transient
+  Bool_t fUseGeneral;          //!transient
+  Bool_t fIgnoreSpecification; //!transient 
       
   Int_t fSlice;  //!transient
       
@@ -118,12 +123,12 @@ private:
   TH1 *fPlotQmaxROCAll;            //!transient
   TH1 *fNumberOfClusters;          //!transient
             
-  TH2 *fHistTH2Tmp;    //!transient
-  TH2 *fHistTPCSideAmax;  //!transient 
+  TH2 *fHistTH2Tmp;       //!transient
+  TH2 *fHistTPCSideAmax;  //!transient 
   TH2 *fHistTPCSideCmax;  //!transient  
-  TH2 *fHistTPCSideAtot;  //!transient 
+  TH2 *fHistTPCSideAtot;  //!transient 
   TH2 *fHistTPCSideCtot;  //!transient  
-  TH2 *fHistTPCSideArms;  //!transient 
+  TH2 *fHistTPCSideArms;  //!transient 
   TH2 *fHistTPCSideCrms;  //!transient  
 
   vector<AliHLTHistogramData> fHistogramData;
index 5c01e1f4da4292132f56400b80210f18959a5361..cbb2b8f21e86553d720b9bf0152bf316aa088616 100644 (file)
@@ -28,7 +28,6 @@ using namespace std;
 
 #include "AliHLTTPCNoiseMapComponent.h"
 #include "AliHLTTPCDigitReaderDecoder.h"
-//#include "AliHLTTPCDigitReaderPacked.h"
 #include "AliHLTTPCTransform.h"
 #include "AliHLTTPCDefinitions.h"
 
@@ -56,22 +55,18 @@ ClassImp(AliHLTTPCNoiseMapComponent) //ROOT macro for the implementation of ROOT
 AliHLTTPCNoiseMapComponent::AliHLTTPCNoiseMapComponent()
     :    
     fSpecification(0),
-    fPlotSideA(0),
-    fPlotSideC(0),    
-    fApplyNoiseMap(0),
+    fReadNoiseMap(0),
     fResetHistograms(0),
-    fIsPacked(0),
-    fIsUnpacked(0),
-    fCurrentSlice(-99),
-    fCurrentPartition(-99),
+    fInitHist(kTRUE),    
     fCurrentRow(-99),
     fHistSignal(NULL),
-    fHistMaxSignal(NULL),
-    fHistTotSignal(NULL),
-    fHistPadRMS(NULL),
-    fHistCDBMap(NULL),    
-    fHistSideA(NULL),  
-    fHistSideC(NULL)
+    fHistSideAMaxSignal(NULL),
+    fHistSideATotSignal(NULL),
+    fHistSideAPadRMS(NULL),
+    fHistSideCMaxSignal(NULL),
+    fHistSideCTotSignal(NULL),
+    fHistSideCPadRMS(NULL),
+    fHistCDBMap(NULL)
 {
   // see header file for class documentation
   // or
@@ -131,8 +126,8 @@ AliHLTComponent* AliHLTTPCNoiseMapComponent::Spawn() {
 int AliHLTTPCNoiseMapComponent::DoInit( int argc, const char** argv ) { 
 // see header file for class documentation
  
-  Int_t i = 0;
-  Char_t* cpErr;
+  //Int_t i = 0;
+  //Char_t* cpErr;
   
   int iResult=0;
   
@@ -148,61 +143,39 @@ int AliHLTTPCNoiseMapComponent::DoInit( int argc, const char** argv ) {
   if (!configuration.IsNull()) {
     iResult=Configure(configuration.Data());
   } else {
-    iResult=Reconfigure(NULL, NULL);
+    //    iResult=Reconfigure(NULL, NULL);
   }
 
  
-  while ( i < argc ) {      
-    if (!strcmp( argv[i], "-apply-noisemap")) {
-        fApplyNoiseMap = strtoul( argv[i+1], &cpErr ,0);
-            
-    if ( *cpErr ) {
-        HLTError("Cannot convert apply-noisemap specifier '%s'.", argv[i+1]);
-        return EINVAL;
-    }
-      i+=2;
-      continue;
-    }
-    
-    if (!strcmp( argv[i], "-plot-side-a")) {
-        fPlotSideA = strtoul( argv[i+1], &cpErr ,0);
-            
-    if ( *cpErr ) {
-        HLTError("Cannot convert plot-side-a specifier '%s'.", argv[i+1]);
-        return EINVAL;
-    }
-      i+=2;
-      continue;
-    }
-    
-    if (!strcmp( argv[i], "-plot-side-c")) {
-        fPlotSideC = strtoul( argv[i+1], &cpErr ,0);
-    
-    if ( *cpErr ) {
-        HLTError("Cannot convert plot-side-c specifier '%s'.", argv[i+1]);
-        return EINVAL;
-    }
-      i+=2;
-      continue;
-    }
-
-    if (!strcmp( argv[i], "-reset-histograms")) {
-        fResetHistograms = strtoul( argv[i+1], &cpErr ,0);
-    
-    if ( *cpErr ) {
-        HLTError("Cannot convert reset-histograms specifier '%s'.", argv[i+1]);
-        return EINVAL;
-    }
-      i+=2;
-      continue;
-    }
-                   
-    Logging(kHLTLogError, "HLT::TPCNoiseMap::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
-    return EINVAL;
-
-  } // end while
+//   while ( i < argc ) {      
+//     if (!strcmp( argv[i], "-read-noisemap")) {
+//         fApplyNoiseMap = strtoul( argv[i+1], &cpErr ,0);
+//             
+//     if ( *cpErr ) {
+//         HLTError("Cannot convert apply-noisemap specifier '%s'.", argv[i+1]);
+//         return EINVAL;
+//     }
+//       i+=2;
+//       continue;
+//     }
+//     
+//     if (!strcmp( argv[i], "-reset-histograms")) {
+//         fResetHistograms = strtoul( argv[i+1], &cpErr ,0);
+//     
+//     if ( *cpErr ) {
+//         HLTError("Cannot convert reset-histograms specifier '%s'.", argv[i+1]);
+//         return EINVAL;
+//     }
+//       i+=2;
+//       continue;
+//     }
+//                    
+//     Logging(kHLTLogError, "HLT::TPCNoiseMap::DoInit", "Unknown Option", "Unknown option '%s'", argv[i] );
+//     return EINVAL;
+// 
+//   } // end while
   
-  if(fApplyNoiseMap){
+  if(fReadNoiseMap){
      AliHLTTPCNoiseMap *nm = AliHLTTPCNoiseMap::Instance();
      if(!nm) { 
          HLTWarning("AliHLTTPCNoiseMap instance not existent."); 
@@ -224,21 +197,6 @@ int AliHLTTPCNoiseMapComponent::DoInit( int argc, const char** argv ) {
 //     //fHistCDBMap = noisePad->MakeHisto2D(1); //side C
 //   }
    
-  if(fPlotSideA){
-     fHistSideA = new TH2F("fHistSideA","TPC Side A",250,-250,250,250,-250,250);               
-     fHistSideA->SetXTitle("global X (cm)"); fHistSideA->SetYTitle("global Y (cm)");
-  }   
-  
-  if(fPlotSideC){    
-     fHistSideC = new TH2F("fHistSideC","TPC Side C",250,-250,250,250,-250,250);
-     fHistSideC->SetXTitle("global X (cm)"); fHistSideC->SetYTitle("global Y (cm)");
-  }
-  fHistMaxSignal = new TH2F("fHistMaxSignal","maximum signal",   250,-250,250,250,-250,250);
-  fHistTotSignal = new TH2F("fHistTotSignal","total signal",     250,-250,250,250,-250,250);
-  fHistPadRMS    = new TH2F("fHistPadRMS",   "RMS",              250,-250,250,250,-250,250);
-  //fHistSignal    = new TH1F("fHistSignal", "signal distribution per pad",1024,0,1024);
 //   HLTDebug("using AliHLTTPCDigitReaderDecoder");
 //   pDigitReader = new AliHLTTPCDigitReaderDecoder(); // double-loop
 //   pDigitReader = new AliHLTTPCDigitReaderPacked();
@@ -250,21 +208,49 @@ int AliHLTTPCNoiseMapComponent::DoInit( int argc, const char** argv ) {
 int AliHLTTPCNoiseMapComponent::DoDeinit() { 
   // see header file for class documentation  
 
-  if(fHistMaxSignal) delete fHistMaxSignal; fHistMaxSignal = NULL;
-  if(fHistTotSignal) delete fHistTotSignal; fHistTotSignal = NULL;
-  if(fHistPadRMS)    delete fHistPadRMS;    fHistPadRMS    = NULL;
-  if(fHistSideA)     delete fHistSideA;     fHistSideA     = NULL;
-  if(fHistSideC)     delete fHistSideC;     fHistSideC     = NULL;
-       
+  if(fHistSideAMaxSignal) delete fHistSideAMaxSignal; fHistSideAMaxSignal = NULL;
+  if(fHistSideATotSignal) delete fHistSideATotSignal; fHistSideATotSignal = NULL;
+  if(fHistSideAPadRMS)    delete fHistSideAPadRMS;    fHistSideAPadRMS    = NULL;
+  
+  if(fHistSideCMaxSignal) delete fHistSideCMaxSignal; fHistSideCMaxSignal = NULL;
+  if(fHistSideCTotSignal) delete fHistSideCTotSignal; fHistSideCTotSignal = NULL;
+  if(fHistSideCPadRMS)   delete fHistSideCPadRMS;    fHistSideCPadRMS    = NULL;
+         
   return 0;
 }
 
+void AliHLTTPCNoiseMapComponent::InitializeHistograms(UInt_t minSlice, UInt_t maxSlice, UInt_t minPartition, UInt_t maxPartition){
+  // see header file for class documentation
+   
+  Char_t name1[50], name2[50], name3[50];
+  if(minSlice<18){
+     sprintf(name1, "fHistSideAMaxSignal_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition);
+     sprintf(name2, "fHistSideATotSignal_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition);
+     sprintf(name3, "fHistSideAPadRMS_Slice_%.2d%.2d_Partition_%.2d%.2d",    minSlice, maxSlice, minPartition, maxPartition);
+     fHistSideAMaxSignal = new TH2F(name1,name1,250,-250,250,250,-250,250);
+     fHistSideATotSignal = new TH2F(name2,name2,250,-250,250,250,-250,250);
+     fHistSideAPadRMS   = new TH2F(name3,name3,250,-250,250,250,-250,250);
+
+  } else {
+     sprintf(name1, "fHistSideCMaxSignal_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition);
+     sprintf(name2, "fHistSideCTotSignal_Slice_%.2d%.2d_Partition_%.2d%.2d", minSlice, maxSlice, minPartition, maxPartition);
+     sprintf(name3, "fHistSideCPadRMS_Slice_%.2d%.2d_Partition_%.2d%.2d",    minSlice, maxSlice, minPartition, maxPartition);  
+     fHistSideCMaxSignal = new TH2F(name1,name1,250,-250,250,250,-250,250);
+     fHistSideCTotSignal = new TH2F(name2,name2,250,-250,250,250,-250,250);
+     fHistSideCPadRMS   = new TH2F(name3,name3,250,-250,250,250,-250,250);
+  }
+    
+  fInitHist=kFALSE;
+  
+}
+
 int AliHLTTPCNoiseMapComponent::DoEvent(const AliHLTComponentEventData& evtData, AliHLTComponentTriggerData& /*trigData*/){
   // see header file for class documentation
  
-  //HLTInfo("--- Entering DoEvent() in TPCNoiseMap ---");
  
   if(GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR )) return 0;
+  //HLTInfo("--- Entering DoEvent() in TPCNoiseMap ---");
    
   const AliHLTComponentBlockData *iter = NULL;
 
@@ -273,52 +259,52 @@ int AliHLTTPCNoiseMapComponent::DoEvent(const AliHLTComponentEventData& evtData,
     
   for(iter = GetFirstInputBlock(kAliHLTDataTypeDDLRaw|kAliHLTDataOriginTPC); iter != NULL; iter = GetNextInputBlock()){
       
-    HLTInfo("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", 
-           evtData.fEventID, evtData.fEventID,
-           DataType2Text(iter->fDataType).c_str(), 
-           DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
-
-    if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType && GetEventCount()<2){
-      HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!", 
-                DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(),
-                DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
-    }      
+//     HLTInfo("Event 0x%08LX (%Lu) received datatype: %s - required datatype: %s", 
+//         evtData.fEventID, evtData.fEventID,
+//         DataType2Text(iter->fDataType).c_str(), 
+//         DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
+// 
+//     if (iter->fDataType == AliHLTTPCDefinitions::fgkDDLPackedRawDataType && GetEventCount()<2){
+//       HLTWarning("data type %s is depricated, use %s (kAliHLTDataTypeDDLRaw)!", 
+//              DataType2Text(AliHLTTPCDefinitions::fgkDDLPackedRawDataType).c_str(),
+//              DataType2Text(kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC).c_str());
+//     }      
      
     if (iter->fDataType != (kAliHLTDataTypeDDLRaw | kAliHLTDataOriginTPC)) continue;
       
-    UInt_t slice     = AliHLTTPCDefinitions::GetMinSliceNr(*iter); 
-    UInt_t partition = AliHLTTPCDefinitions::GetMinPatchNr(*iter);
-     
+    UInt_t minSlice     = AliHLTTPCDefinitions::GetMinSliceNr(*iter); 
+    UInt_t minPartition = AliHLTTPCDefinitions::GetMinPatchNr(*iter);
+    UInt_t maxSlice     = AliHLTTPCDefinitions::GetMaxSliceNr(*iter); 
+    UInt_t maxPartition = AliHLTTPCDefinitions::GetMaxPatchNr(*iter);
+    
+    if(fInitHist==kTRUE) InitializeHistograms(minSlice, maxSlice, minPartition, maxPartition);    
     fSpecification = iter->fSpecification;
      
     AliHLTTPCDigitReader *pDigitReader = new AliHLTTPCDigitReaderDecoder;
 
-    pDigitReader->InitBlock(iter->fPtr,iter->fSize,partition,slice);
+    pDigitReader->InitBlock(iter->fPtr,iter->fSize,minPartition,minSlice);
     if(!pDigitReader) break;
-       
-    //sprintf(name,"hMaxSignal_slice%d_partition%d", slice, partition);
-    //fHistMaxSignal = new TH2F(name,name,250,-250,250,250,-250,250);
-            
+                  
     //  while(pDigitReader->Next()){ 
 
-
     Float_t maxSignal     = 0.;
     Float_t totalSignal   = 0.;
     Float_t squaredSignal = 0.;
     Float_t rms = 0.; 
     
-    while( pDigitReader->NextChannel()) { // pad loop 
+    while(pDigitReader->NextChannel()) { // pad loop 
       
       fCurrentRow  = pDigitReader->GetRow();  
       fCurrentRow += pDigitReader->GetRowOffset();
+      
 
-      AliHLTTPCTransform::Slice2Sector(slice,fCurrentRow,thissector,thisrow);
+      AliHLTTPCTransform::Slice2Sector(minSlice,fCurrentRow,thissector,thisrow);
       AliHLTTPCTransform::Raw2Local(xyz,thissector,thisrow,pDigitReader->GetPad(),0);
-      
-      if(slice>17) xyz[1] = (-1.0)*xyz[1];
+            
+      if(minSlice>17) xyz[1] = (-1.0)*xyz[1];
       else continue;
       
-      AliHLTTPCTransform::Local2Global(xyz,slice);
+      AliHLTTPCTransform::Local2Global(xyz,minSlice);
       // temporarily the transformation Raw2Global will be broken down to 2 steps,
       // as there is a correction necessary at the y coordinate of the local xyz.
       
@@ -329,55 +315,53 @@ int AliHLTTPCNoiseMapComponent::DoEvent(const AliHLTComponentEventData& evtData,
       //       AliTPCCalROC *calRoc = noisePad->GetCalROC(thissector);
       //       calRoc->GetValue(thisrow,pDigitReader->GetPad());
       
-      
-      while( pDigitReader->NextBunch()) {
+      while(pDigitReader->NextBunch()) {
     
        const UInt_t *bunchData = pDigitReader->GetSignals();
-      
-       //fHistSignal = new TH1F("fHistSignal", "signal distribution per pad",1024,0,1024);
-      
-       //fHistSignal->Reset();
-       //Int_t time = pDigitReader->GetTime();
+       //Int_t time = pDigitReader->GetTime();
      
        for(Int_t i=0;i<pDigitReader->GetBunchSize();i++){
           
          if((Float_t)(bunchData[i])>maxSignal){ maxSignal = (Float_t)(bunchData[i]); }
-         totalSignal += (Float_t)bunchData[i];
+         totalSignal   += (Float_t)bunchData[i];
          squaredSignal += (Float_t)bunchData[i]*(Float_t)bunchData[i];
          //fHistSignal->Fill(time+i, bunchData[i]);
-       } // end for loop over bunches
+       } // end for loop
+
        rms = TMath::Sqrt(squaredSignal/pDigitReader->GetBunchSize());
             
-      } // end of inner while loop
-           
-    } // end of while loop over pads
+      } // end of inner while loop           
      
-    fHistMaxSignal->Fill(xyz[0],xyz[1],maxSignal);
-    fHistTotSignal->Fill(xyz[0],xyz[1],totalSignal);
      
-    fHistPadRMS->Fill(xyz[0],xyz[1],rms);
-      
-    //fHistPadRMS->Fill(xyz[0],xyz[1],fHistSignal->GetRMS());
-    //delete fHistSignal; fHistSignal = NULL;
-      
-    if(fPlotSideA || fPlotSideC){
-      if(slice<18) fHistSideA->Fill(xyz[0],xyz[1],maxSignal);
-      else           fHistSideC->Fill(xyz[0],xyz[1],maxSignal);                             
-    } // end if plotting sides    
+      if(minSlice<18){
+       if(maxSignal>0)
+         fHistSideAMaxSignal->Fill(xyz[0],xyz[1],maxSignal);     
+       if(totalSignal>0)
+         fHistSideATotSignal->Fill(xyz[0],xyz[1],totalSignal);     
+       if(rms>0)
+         fHistSideAPadRMS->Fill(xyz[0],xyz[1],rms);
+      } else if(minSlice>17){
+       if(maxSignal>0)
+         fHistSideCMaxSignal->Fill(xyz[0],xyz[1],maxSignal);
+       if(totalSignal>0)
+         fHistSideCTotSignal->Fill(xyz[0],xyz[1],totalSignal); 
+       if(rms>0)
+         fHistSideCPadRMS->Fill(xyz[0],xyz[1],rms);
+      } else continue;
       
+      maxSignal     = 0.;
+      totalSignal   = 0.;
+      squaredSignal = 0.;
+      rms = 0.; 
+    } // end of while loop over pads
     
-    maxSignal     = 0.;
-    totalSignal   = 0.;
-    squaredSignal = 0.;
-    rms = 0.; 
-
     pDigitReader->Reset();
     delete pDigitReader;
   } // end of for loop over data blocks
  
-  if(fResetHistograms) ResetHistograms();
+  if(fResetHistograms) ResetHistograms(); fResetHistograms = kFALSE;
   MakeHistosPublic();
-
   return 0;
 } // end DoEvent()
 
@@ -391,37 +375,33 @@ void AliHLTTPCNoiseMapComponent::MakeHistosPublic() {
 //   outputfile->Close();
 
   TObjArray histos;
-  histos.Add(fHistMaxSignal);
-  histos.Add(fHistTotSignal);
-  histos.Add(fHistPadRMS);
+  histos.Add(fHistSideAMaxSignal);
+  histos.Add(fHistSideATotSignal);
+  histos.Add(fHistSideAPadRMS);
+  
+  histos.Add(fHistSideCMaxSignal);
+  histos.Add(fHistSideCTotSignal);
+  histos.Add(fHistSideCPadRMS);
+  
   histos.Add(fHistCDBMap);
   //histos.Add(fHistSignal);
-  if(fPlotSideA) histos.Add(fHistSideA);
-  if(fPlotSideC) histos.Add(fHistSideC);
   
   TIter iterator(&histos);
   while(TObject *pObj=iterator.Next()){ PushBack(pObj, kAliHLTDataTypeHistogram|kAliHLTDataOriginTPC, fSpecification); }
     
   //PushBack( (TObject*) &histos, kAliHLTDataTypeHistogram, fSpecification);    
-//   if(fHistMaxSignal) delete fHistMaxSignal; fHistMaxSignal = NULL;
-//   if(fHistTotSignal) delete fHistTotSignal; fHistTotSignal = NULL;
-//   if(fHistPadRMS)    delete fHistPadRMS;    fHistPadRMS    = NULL;
-//   if(fHistSideA)     delete fHistSideA;     fHistSideA     = NULL;
-//   if(fHistSideC)     delete fHistSideC;     fHistSideC     = NULL;
-  
 }
 
 void AliHLTTPCNoiseMapComponent::ResetHistograms(){
 // see header file for class documentation
 
-  //if(fHistPartition) fHistPartition->Reset();  
-  if(fHistMaxSignal) fHistMaxSignal->Reset();
-  if(fHistTotSignal) fHistTotSignal->Reset();
-  if(fHistPadRMS)    fHistPadRMS->Reset();
-
-  if(fHistSideA) fHistSideA->Reset();
-  if(fHistSideC) fHistSideC->Reset();
+  if(fHistSideAMaxSignal) fHistSideAMaxSignal->Reset();
+  if(fHistSideATotSignal) fHistSideATotSignal->Reset();
+  if(fHistSideAPadRMS)    fHistSideAPadRMS->Reset();
+  if(fHistSideCMaxSignal) fHistSideCMaxSignal->Reset();
+  if(fHistSideCTotSignal) fHistSideCTotSignal->Reset();
+  if(fHistSideCPadRMS)   fHistSideCPadRMS->Reset();
 }
 
 int AliHLTTPCNoiseMapComponent::Configure(const char* arguments) { 
@@ -441,25 +421,16 @@ int AliHLTTPCNoiseMapComponent::Configure(const char* arguments) {
       argument=((TObjString*)pTokens->At(i))->GetString();
       if (argument.IsNull()) continue;
      
-      if (argument.CompareTo("-apply-noisemap")==0) {
-       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
-       HLTInfo("got \'-apply-noisemap\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
+      if (argument.CompareTo("-read-noisemap")==0) {
+       //if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       fReadNoiseMap = kTRUE;
+       HLTInfo("got \'-read-noisemap\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
        
       } 
-      else if (argument.CompareTo("-plot-side-c")==0) {
-       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
-       HLTInfo("got \'-plot-side-c\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
-       
-      } 
-      else if (argument.CompareTo("-plot-side-a")==0) {
-       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
-       HLTInfo("got \'-plot-side-a\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
-       
-      }       
       else if(argument.CompareTo("-reset-histograms")==0){
-       if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
-       HLTInfo("got \'-reset-histograms\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());
-       
+       //if ((bMissingParam=(++i>=pTokens->GetEntries()))) break;
+       fResetHistograms = kTRUE;
+       HLTInfo("got \'-reset-histograms\': %s", ((TObjString*)pTokens->At(i))->GetString().Data());    
       } 
       else {
        HLTError("unknown argument %s", argument.Data());
@@ -481,9 +452,10 @@ int AliHLTTPCNoiseMapComponent::Configure(const char* arguments) {
 
 int AliHLTTPCNoiseMapComponent::Reconfigure(const char* cdbEntry, const char* chainId) { 
 // see header file for class documentation
-  int iResult=0;
-  const char* path="HLT/ConfigTPC/TPCNoiseMapComponent";
-  const char* defaultNotify="";
+  
+  int iResult = 0;
+  const char* path = "HLT/ConfigTPC/TPCNoiseMapComponent";
+  const char* defaultNotify = "";
   if(cdbEntry){
       path          = cdbEntry;
       defaultNotify = "(manual operator entry)";
@@ -513,8 +485,8 @@ int AliHLTTPCNoiseMapComponent::Reconfigure(const char* cdbEntry, const char* ch
        else {
            HLTError("cannot fetch object \"%s\" from CDB", path);
         }
-     } // if stor is valid
-  } // if path is valid
+     } // end if stor is valid
+  } // end if path is valid
   
   return iResult;
 
index d07509e7d6a4e6d0a65875cd1588c9c04619f450..d35b47157c50070cf824eb9f0958d91540543c6e 100644 (file)
@@ -29,19 +29,11 @@ class AliTPCCalPad;
  * the noise map from HCDB by request.
  * 
  * The component implements the interface methods of the @ref AliHLTProcessor.
- * It reads the data pad by pad and fills histograms.
+ * It reads the data pad by pad and fills histograms per partition
  * 
  * The component has the following component arguments:
  * 
- * The histograms are filled on partition level and no argument is foreseen for this.
- * 
- * In the rare case we want to fill them per TPC side, the following 2 arguments can be used.
- * 
- * -plot-side-a   Histograms the TPC side A
- *          
- * -plot-side-c   Histograms the TPC side C
- *
- * -apply-noisemap  Reads the noise map from the HCDB (and plots it in a histogram)
+ * -read-noisemap  Reads the noise map from the HCDB (and plots it in a histogram)
  *
  * It returns an AliTPCCalPad object that can be used 
  * for other plots (e.g. noise subtraction in histograms) 
@@ -101,31 +93,31 @@ class AliHLTTPCNoiseMapComponent : public AliHLTProcessor {
 
       /** assignment operator prohibited */
       AliHLTTPCNoiseMapComponent& operator=(const AliHLTTPCNoiseMapComponent&);
-
+      
+      void InitializeHistograms(UInt_t minSlice, UInt_t maxSlice, UInt_t minPartition, UInt_t maxPartition);
       void ResetHistograms();
       
       AliHLTUInt32_t fSpecification;  //!transient
 
-      Bool_t fPlotSideA;      //!transient
-      Bool_t fPlotSideC;      //!transient
-      Bool_t fApplyNoiseMap;  //!transient
-      Bool_t fResetHistograms;//!transient
-      Bool_t fIsPacked;       //!transient   
-      Bool_t fIsUnpacked;     //!transient
-            
-      Int_t fCurrentSlice;     //!transient
-      Int_t fCurrentPartition; //!transient
-      Int_t fCurrentRow;       //!transient
+      Bool_t fReadNoiseMap;    //!transient
+      Bool_t fResetHistograms; //!transient      
+      Bool_t fInitHist;        //!transient
+
+      Int_t fCurrentRow; //!transient
       
       TH1 *fHistSignal;     //!transient 
-      TH2 *fHistMaxSignal;  //!transient 
-      TH2 *fHistTotSignal;  //!transient 
-      TH2 *fHistPadRMS;     //!transient 
+     
+      TH2 *fHistSideAMaxSignal;  //!transient 
+      TH2 *fHistSideATotSignal;  //!transient 
+      TH2 *fHistSideAPadRMS;     //!transient 
+     
+      TH2 *fHistSideCMaxSignal;  //!transient 
+      TH2 *fHistSideCTotSignal;  //!transient 
+      TH2 *fHistSideCPadRMS;    //!transient 
+     
       TH2 *fHistCDBMap;     //!transient 
-      TH2 *fHistSideA;      //!transient    
-      TH2 *fHistSideC;      //!transient  
            
-      ClassDef(AliHLTTPCNoiseMapComponent, 3)
+      ClassDef(AliHLTTPCNoiseMapComponent, 4)
     };
 
 #endif