LCOV - code coverage report
Current view: top level - HLT/TPCLib - AliHLTTPCClusterHistoComponent.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 21 159 13.2 %
Date: 2016-06-14 17:26:59 Functions: 7 16 43.8 %

          Line data    Source code
       1             : // $Id$
       2             : //**************************************************************************
       3             : //* This file is property of and copyright by the ALICE HLT Project        * 
       4             : //* ALICE Experiment at CERN, All rights reserved.                         *
       5             : //*                                                                        *
       6             : //* Primary Authors: Gaute Ovrebekk <ovrebekk@ift.uib.no>                  *
       7             : //*                  for The ALICE HLT Project.                            *
       8             : //*                                                                        *
       9             : //* Permission to use, copy, modify and distribute this software and its   *
      10             : //* documentation strictly for non-commercial purposes is hereby granted   *
      11             : //* without fee, provided that the above copyright notice appears in all   *
      12             : //* copies and that both the copyright notice and this permission notice   *
      13             : //* appear in the supporting documentation. The authors make no claims     *
      14             : //* about the suitability of this software for any purpose. It is          *
      15             : //* provided "as is" without express or implied warranty.                  *
      16             : //**************************************************************************
      17             : 
      18             : /// @file   AliHLTTPCClusterHistoComponent.cxx
      19             : /// @author Gaute Ovrebekk
      20             : /// @brief  Component for ploting charge in clusters
      21             : ///
      22             : 
      23             : #include "AliHLTTPCClusterHistoComponent.h"
      24             : #include "AliHLTTPCGeometry.h"
      25             : #include "AliHLTTPCClusterDataFormat.h"
      26             : #include "AliHLTTPCDefinitions.h"
      27             : #include "AliCDBEntry.h"
      28             : #include "AliCDBManager.h"
      29             : #include <TFile.h>
      30             : #include <TString.h>
      31             : #include "TObjString.h"
      32             : #include "TObjArray.h"
      33             : 
      34             : /** ROOT macro for the implementation of ROOT specific class methods */
      35           6 : ClassImp(AliHLTTPCClusterHistoComponent)
      36             : 
      37           3 : AliHLTTPCClusterHistoComponent::AliHLTTPCClusterHistoComponent()
      38             : :
      39           3 : fTotalClusterChargeOROCAll(NULL),                     
      40           3 :   fTotalClusterChargeIROCAll(NULL),                   
      41           3 :   fTotalClusterChargeROCSelection(NULL),               
      42           3 :   fTotalClusterChargePartitionSelection(NULL),         
      43           3 :   fQMaxPartitionAll(NULL),                             
      44           3 :   fQMaxROCAll(NULL),                              
      45           3 :   fNumberOfClusters(NULL),                        
      46           3 :   fPlotChargeOROCAll(kTRUE),   
      47           3 :   fPlotChargeIROCAll(kTRUE),
      48           3 :   fPlotChargeROCSel(kFALSE), 
      49           3 :   fPlotChargePartSel(kFALSE),
      50           3 :   fPlotQmaxPartAll(kTRUE),  
      51           3 :   fPlotQmaxROCAll(kTRUE),   
      52           3 :   fPlotNClusters(kTRUE)    
      53          15 : {
      54             :   // see header file for class documentation
      55             :   // or
      56             :   // refer to README to build package
      57             :   // or
      58             :   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
      59             : 
      60           6 : }
      61             : 
      62             : AliHLTTPCClusterHistoComponent::~AliHLTTPCClusterHistoComponent()
      63          12 : {
      64             :   // see header file for class documentation
      65          12 : }
      66             : 
      67             : // Public functions to implement AliHLTComponent's interface.
      68             : // These functions are required for the registration process
      69             : 
      70             : const char* AliHLTTPCClusterHistoComponent::GetComponentID()
      71             : {
      72             :   // see header file for class documentation
      73             :   
      74         474 :   return "TPCClusterHisto";
      75             : }
      76             : 
      77             : void AliHLTTPCClusterHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
      78             : {
      79             :   // see header file for class documentation
      80           0 :   list.clear();
      81           0 :   list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
      82           0 : }
      83             : 
      84             : AliHLTComponentDataType AliHLTTPCClusterHistoComponent::GetOutputDataType()
      85             : {
      86             :   // see header file for class documentation
      87           0 :   return kAliHLTDataTypeHistogram;
      88             : 
      89             : }
      90             : 
      91             : void AliHLTTPCClusterHistoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
      92             : {
      93             :   // see header file for class documentation
      94             :   // XXX TODO: Find more realistic values.
      95           0 :   constBase = 80000;
      96           0 :   inputMultiplier = 1;
      97           0 : }
      98             : 
      99             : AliHLTComponent* AliHLTTPCClusterHistoComponent::Spawn()
     100             : {
     101             :   // see header file for class documentation
     102           0 :   return new AliHLTTPCClusterHistoComponent;
     103           0 : }
     104             : 
     105             : int AliHLTTPCClusterHistoComponent::DoInit( int argc, const char** argv )
     106             : {
     107             :   //  HLTFatal("Initializing with log fatal");
     108             :   //  cout<<"Initializing with cout"<<endl;
     109             :   
     110           0 :   fPlotChargeOROCAll=kTRUE;   
     111           0 :   fPlotChargeIROCAll=kTRUE;
     112           0 :   fPlotChargeROCSel=kFALSE; 
     113           0 :   fPlotChargePartSel=kFALSE;
     114           0 :   fPlotQmaxPartAll=kTRUE;  
     115           0 :   fPlotQmaxROCAll=kTRUE;   
     116           0 :   fPlotNClusters=kTRUE;
     117             :    
     118           0 :   if(fPlotChargeOROCAll){fTotalClusterChargeOROCAll = new TH1F("fTotalClusterChargeOROCAll","Total Charge of clusters in all OROC",4000,0,4000);}
     119           0 :   if(fPlotChargeIROCAll){fTotalClusterChargeIROCAll = new TH1F("fTotalClusterChargeIROCAll","Total Charge of clusters in all IROC",4000,0,4000);}
     120           0 :   if(fPlotChargeROCSel){fTotalClusterChargeROCSelection = new TH1F("fTotalClusterChargeROCSelection","Total Charge of clusters in selection ROC",4000,0,4000);}
     121           0 :   if(fPlotChargePartSel){fTotalClusterChargePartitionSelection = new TH1F("fTotalClusterChargePartitionSelection","Total Charge of clusters in sel Part",4000,0,4000);}
     122           0 :   if(fPlotQmaxPartAll){fQMaxPartitionAll = new TH1F("fQMaxPartitionAll","QMax for All Partitions",216,0,216);}
     123           0 :   if(fPlotQmaxROCAll){fQMaxROCAll = new TH1F("fQMaxROCAll","QMax for All Partitions",72,0,72);}
     124           0 :   if(fPlotNClusters){fNumberOfClusters = new TH1F("fNumberOfClusters","Total Number of Clusters",1,0,1);}
     125             : 
     126             :   int iResult=0;
     127           0 :   TString configuration="";
     128           0 :   TString argument="";
     129           0 :   for (int i=0; i<argc && iResult>=0; i++) {
     130           0 :     argument=argv[i];
     131           0 :     if (!configuration.IsNull()) configuration+=" ";
     132           0 :     configuration+=argument;
     133             :   }
     134             :   
     135           0 :   if (!configuration.IsNull()) {
     136           0 :     iResult=Configure(configuration.Data());
     137           0 :   }  
     138             : 
     139             :   return iResult; 
     140           0 : }
     141             :   
     142             : int AliHLTTPCClusterHistoComponent::DoDeinit()
     143             : {
     144             :   // see header file for class documentation
     145           0 :   if(fTotalClusterChargeOROCAll!=NULL) delete fTotalClusterChargeOROCAll;
     146           0 :   if(fTotalClusterChargeIROCAll!=NULL) delete fTotalClusterChargeIROCAll;     
     147           0 :   if(fQMaxPartitionAll!=NULL) delete fQMaxPartitionAll;
     148           0 :   if(fQMaxROCAll!=NULL) delete fQMaxROCAll;
     149           0 :   return 0;
     150             : }
     151             : 
     152             : int AliHLTTPCClusterHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
     153             : {
     154             :   
     155             :   int TotalSpacePoint = 0;
     156             :   
     157             :   const AliHLTComponentBlockData* iter = NULL;
     158             :   
     159           0 :   if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
     160           0 :     return 0;
     161             :   
     162           0 :   fQMaxPartitionAll->Reset();
     163           0 :   fQMaxROCAll->Reset();
     164             : 
     165           0 :   for ( iter = GetFirstInputBlock(AliHLTTPCDefinitions::fgkClustersDataType); iter != NULL; iter = GetNextInputBlock() ) {
     166             :     
     167           0 :     Int_t thisrow=-1,thissector=-1,row=-1;
     168             :     
     169           0 :     AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
     170           0 :     AliHLTUInt8_t patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
     171           0 :     row = AliHLTTPCGeometry::GetFirstRow(patch); 
     172           0 :     AliHLTTPCGeometry::Slice2Sector(slice,row,thissector,thisrow);
     173             :     
     174             :     HLTDebug ( "Input Data - TPC cluster - Slice/Patch: %d/%d.", slice, patch );
     175             :     
     176           0 :     const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*) iter->fPtr;
     177           0 :     Int_t nSpacepoint = (Int_t) clusterData->fSpacePointCnt;
     178           0 :     TotalSpacePoint += nSpacepoint;
     179             :     //HLTInfo("KryptonHisto found %d Spacepoints in slice %d patch %d", nSpacepoint, slice, patch);
     180           0 :     AliHLTTPCSpacePointData *clusters = (AliHLTTPCSpacePointData*) &clusterData->fSpacePoints;
     181             :     
     182             :     UInt_t tmpQPart = 0;//,tmpQROC = -1;
     183             :     
     184           0 :     for(int i=0;i<nSpacepoint;i++){
     185           0 :       if(fPlotChargeOROCAll){
     186           0 :         if(thissector>=36){
     187           0 :           fTotalClusterChargeOROCAll->Fill(clusters[i].fCharge);
     188           0 :         }
     189             :       }
     190           0 :       if(fPlotChargeIROCAll){
     191           0 :         if(thissector<=35){
     192           0 :           fTotalClusterChargeIROCAll->Fill(clusters[i].fCharge);
     193           0 :         }
     194             :       }
     195           0 :       if(fPlotChargeROCSel){
     196             :         
     197             :       }
     198           0 :       if(fPlotChargePartSel){
     199             :         
     200             :       }
     201           0 :       if(fPlotQmaxPartAll){
     202           0 :         if(clusters[i].fQMax>tmpQPart){
     203           0 :           fQMaxPartitionAll->SetBinContent(patch+6*slice,clusters[i].fQMax);
     204           0 :           tmpQPart=clusters[i].fQMax;
     205           0 :         }
     206             :       }
     207           0 :       if(fPlotQmaxROCAll){
     208           0 :         if(clusters[i].fQMax>fQMaxROCAll->GetBinContent(thissector)){
     209           0 :           fQMaxROCAll->SetBinContent(thissector,clusters[i].fQMax);
     210             :           //      tmpQROC=clusters[i].fQMax;
     211           0 :         }
     212             :       }
     213             :     }
     214           0 :     if(fPlotNClusters){
     215           0 :       fNumberOfClusters->Fill(nSpacepoint);
     216           0 :     }
     217           0 :   }
     218             :   
     219             :   //delete til dodeinit
     220           0 :   if(fPlotChargeOROCAll){
     221           0 :     AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,2,5);
     222           0 :     PushBack( (TObject*) fTotalClusterChargeOROCAll,kAliHLTDataTypeHistogram,fSpecification);
     223           0 :   }
     224           0 :   if(fPlotChargeIROCAll){
     225           0 :     AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,1);
     226           0 :     PushBack( (TObject*) fTotalClusterChargeIROCAll,kAliHLTDataTypeHistogram,fSpecification);
     227           0 :   }
     228           0 :   if(fPlotChargeROCSel){
     229             :     
     230             :     
     231             :   }
     232           0 :   if(fPlotChargePartSel){
     233             :     
     234             :     
     235             :   }
     236           0 :   if(fPlotQmaxPartAll){
     237           0 :     AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5);
     238           0 :     PushBack( (TObject*) fQMaxPartitionAll,kAliHLTDataTypeHistogram,fSpecification);
     239             :     //delete fQMaxPartitionAll;
     240           0 :   }
     241           0 :   if(fPlotQmaxROCAll){
     242           0 :     AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5);
     243           0 :     PushBack( (TObject*) fQMaxROCAll,kAliHLTDataTypeHistogram,fSpecification);
     244             :     //delete fQMaxROCAll;
     245           0 :   }
     246           0 :   if(fPlotNClusters){
     247             :     
     248             :     
     249             :   }
     250             :   
     251           0 :   HLTInfo("KryptonHisto found %d Total Spacepoints", TotalSpacePoint);
     252             :   
     253           0 :   return 0;
     254           0 : }
     255             : 
     256             : int AliHLTTPCClusterHistoComponent::Configure(const char* arguments)
     257             : {
     258             :   
     259             :   int iResult=0;
     260           0 :   if (!arguments) return iResult;
     261             :   
     262           0 :   TString allArgs=arguments;
     263           0 :   TString argument;
     264             :   
     265           0 :   TObjArray* pTokens=allArgs.Tokenize(" ");
     266             :   
     267           0 :   if (pTokens) {
     268           0 :     for (int i=0; i<pTokens->GetEntries() && iResult>=0; i++) {
     269           0 :       argument=((TObjString*)pTokens->At(i))->GetString();
     270           0 :       if (argument.IsNull()) continue;
     271             :       
     272           0 :       if (argument.CompareTo("-plot-all")==0) {
     273           0 :         HLTInfo("Ploting charge of all clusters");
     274             :         //fPlotAll = kTRUE;
     275             :         continue;
     276             :       }
     277             :       
     278           0 :       else if (argument.CompareTo("-plot-trackclusters")==0) {
     279           0 :         HLTInfo("Ploting charge of clusters used on a track");
     280             :         //fPlotAll = kFALSE;
     281             :         continue;
     282             :       }
     283             :       else {
     284           0 :         HLTError("unknown argument %s", argument.Data());
     285             :         iResult=-EINVAL;
     286           0 :         break;
     287             :       }
     288             :     }
     289           0 :     delete pTokens;
     290             :   }
     291             :   
     292             :   //if hvis det eksisterer
     293           0 :   if(fPlotChargeOROCAll){fTotalClusterChargeOROCAll = new TH1F("fTotalClusterChargeOROCAll","Total Charge of clusters in all OROC",4000,0,4000);}
     294           0 :   if(fPlotChargeIROCAll){fTotalClusterChargeIROCAll = new TH1F("fTotalClusterChargeIROCAll","Total Charge of clusters in all IROC",4000,0,4000);}
     295           0 :   if(fPlotChargeROCSel){fTotalClusterChargeROCSelection = new TH1F("fTotalClusterChargeROCSelection","Total Charge of clusters in selection ROC",4000,0,4000);}
     296           0 :   if(fPlotChargePartSel){fTotalClusterChargePartitionSelection = new TH1F("fTotalClusterChargePartitionSelection","Total Charge of clusters in sel Part",4000,0,4000);}
     297           0 :   if(fPlotQmaxPartAll){fQMaxPartitionAll = new TH1F("fQMaxPartitionAll","QMax for All Partitions",216,0,216);}
     298           0 :   if(fPlotQmaxROCAll){fQMaxROCAll = new TH1F("fQMaxROCAll","QMax for All Partitions",72,0,72);}
     299           0 :   if(fPlotNClusters){fNumberOfClusters = new TH1F("fNumberOfClusters","Total Number of Clusters",100,0,100);}
     300             : 
     301             :   return iResult;
     302           0 : }
     303             : 
     304             : int AliHLTTPCClusterHistoComponent::Reconfigure(const char* cdbEntry, const char* chainId)
     305             : {
     306             :   // see header file for class documentation
     307             :   int iResult=0;
     308             :   const char* path="HLT/ConfigTPC/KryptonHistoComponent";
     309             :   const char* defaultNotify="";
     310           0 :   if (cdbEntry) {
     311             :     path=cdbEntry;
     312             :     defaultNotify=" (default)";
     313           0 :   }
     314           0 :   if (path) {
     315           0 :     HLTInfo("reconfigure from entry %s%s, chain id %s", path, defaultNotify,(chainId!=NULL && chainId[0]!=0)?chainId:"<none>");
     316           0 :     AliCDBEntry *pEntry = AliCDBManager::Instance()->Get(path/*,GetRunNo()*/);
     317           0 :     if (pEntry) {
     318           0 :       TObjString* pString=dynamic_cast<TObjString*>(pEntry->GetObject());
     319           0 :       if (pString) {
     320           0 :         HLTInfo("received configuration object string: \'%s\'", pString->GetString().Data());
     321           0 :         iResult=Configure(pString->GetString().Data());
     322           0 :       } else {
     323           0 :         HLTError("configuration object \"%s\" has wrong type, required TObjString", path);
     324             :       }
     325           0 :     } else {
     326           0 :       HLTError("can not fetch object \"%s\" from CDB", path);
     327             :     }
     328           0 :   }
     329             : 
     330           0 :   return iResult;
     331           0 : }

Generated by: LCOV version 1.11