1 //**************************************************************************
2 //* This file is property of and copyright by the ALICE HLT Project *
3 //* ALICE Experiment at CERN, All rights reserved. *
5 //* Primary Authors: Sylwester Radomski radomski@physi.uni-heidelberg.de *
6 //* for The ALICE HLT Project. *
8 //* Permission to use, copy, modify and distribute this software and its *
9 //* documentation strictly for non-commercial purposes is hereby granted *
10 //* without fee, provided that the above copyright notice appears in all *
11 //* copies and that both the copyright notice and this permission notice *
12 //* appear in the supporting documentation. The authors make no claims *
13 //* about the suitability of this software for any purpose. It is *
14 //* provided "as is" without express or implied warranty. *
15 //**************************************************************************
17 /** @file AliHLTTRDClusterHistoComponent.cxx
18 @author Sylwester Radomski
19 @brief Component for ploting charge in clusters
26 #include "AliHLTTRDClusterHistoComponent.h"
27 #include "AliHLTTRDDefinitions.h"
28 #include "AliHLTTRDCluster.h"
29 #include "AliTRDcluster.h"
30 #include "AliCDBEntry.h"
31 #include "AliCDBManager.h"
34 #include "TObjString.h"
35 #include "TClonesArray.h"
36 #include "AliHLTTRDUtils.h"
38 //#include "AliHLTTRD.h"
42 /** ROOT macro for the implementation of ROOT specific class methods */
43 ClassImp(AliHLTTRDClusterHistoComponent)
45 AliHLTTRDClusterHistoComponent::AliHLTTRDClusterHistoComponent()
52 // see header file for class documentation
54 // refer to README to build package
56 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
60 AliHLTTRDClusterHistoComponent::~AliHLTTRDClusterHistoComponent()
62 // see header file for class documentation
65 // Public functions to implement AliHLTComponent's interface.
66 // These functions are required for the registration process
68 const char* AliHLTTRDClusterHistoComponent::GetComponentID()
70 // see header file for class documentation
72 return "TRDClusterHisto";
75 void AliHLTTRDClusterHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
77 // see header file for class documentation
79 list.push_back( AliHLTTRDDefinitions::fgkClusterDataType );
82 AliHLTComponentDataType AliHLTTRDClusterHistoComponent::GetOutputDataType()
84 // see header file for class documentation
85 return kAliHLTDataTypeHistogram;
89 void AliHLTTRDClusterHistoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
91 // see header file for class documentation
92 // XXX TODO: Find more realistic values.
97 AliHLTComponent* AliHLTTRDClusterHistoComponent::Spawn()
99 // see header file for class documentation
100 return new AliHLTTRDClusterHistoComponent;
103 int AliHLTTRDClusterHistoComponent::DoInit( int argc, const char** argv )
105 // Initialize histograms
107 fNClsDet = new TH1D("trdClsDet", ";detector", 540, -0.5, 539.5);
108 fClsAmp = new TH1D("trdClsAmp", ";amplitude", 200, -0.5, 199.5);
109 fClsAmpDrift = new TH1D("trdClsAmpDrift", ";amplitude", 200, -0.5, 199.5) ;
110 fClsTB = new TH1D("trdClsTB", ";time bin", 35, -0.5, 34.5);
111 fClsAmpDist = new TH1D("trdClsAmpDist", "mean amplitude", 200, 0, 100);
113 for(int i=0; i<540; i++)
114 fClsAmpDriftDet[i] = new TH1D(Form("trdClsDriftDet_%d",i), "", 200, -0.5, 199.5);
120 TString configuration="";
122 for (int i=0; i<argc && iResult>=0; i++) {
124 if (!configuration.IsNull()) configuration+=" ";
125 configuration+=argument;
128 if (!configuration.IsNull()) {
129 iResult=Configure(configuration.Data());
138 int AliHLTTRDClusterHistoComponent::DoDeinit()
140 // see header file for class documentation
143 if (fNClsDet) delete fNClsDet;
144 if (fClsAmp) delete fClsAmp;
145 if (fClsAmpDrift) delete fClsAmpDrift;
146 if (fClsTB) delete fClsTB;
147 if (fClsAmpDist) delete fClsAmpDist;
149 for(int i=0; i<540; i++)
150 if (fClsAmpDriftDet[i]) delete fClsAmpDriftDet[i];
155 int AliHLTTRDClusterHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
156 AliHLTComponentTriggerData& /*trigData*/)
159 if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
162 const AliHLTComponentBlockData* iter = NULL;
164 for ( iter = GetFirstInputBlock(AliHLTTRDDefinitions::fgkClusterDataType);
165 iter != NULL; iter = GetNextInputBlock() ) {
167 HLTDebug("We get the right data type: Block Ptr: 0x%x; Block Size: %i",
168 iter->fPtr, iter->fSize);
170 TClonesArray* clusterArray = new TClonesArray("AliTRDcluster");
171 AliHLTTRDUtils::ReadClusters(clusterArray, iter->fPtr, iter->fSize);
172 HLTDebug("TClonesArray of clusters: nbEntries = %i", clusterArray->GetEntriesFast());
176 // loop over clusters
177 for(int i=0;i<clusterArray->GetEntriesFast();i++) {
179 cls=(AliTRDcluster*)clusterArray->At(i);
181 fNClsDet->Fill(cls->GetDetector());
182 fClsAmp->Fill(cls->GetQ());
184 int tb = cls->GetPadTime();
186 if (tb > 5 && tb <25)
187 fClsAmpDrift->Fill(cls->GetQ());
189 fClsAmpDriftDet[cls->GetDetector()]->Fill(cls->GetQ());
192 clusterArray->Delete();
197 fClsAmpDist->Reset();
198 for(int det=0; det<540; det++)
199 if (fClsAmpDriftDet[det]->GetSum() > 0)
200 fClsAmpDist->Fill(fClsAmpDriftDet[det]->GetMean());
202 PushBack((TObject*)fNClsDet, kAliHLTDataTypeHistogram, 0);
203 PushBack((TObject*)fClsAmp, kAliHLTDataTypeHistogram, 0);
204 PushBack((TObject*)fClsAmpDrift, kAliHLTDataTypeHistogram, 0);
205 PushBack((TObject*)fClsTB, kAliHLTDataTypeHistogram, 0);
206 PushBack((TObject*)fClsAmpDist, kAliHLTDataTypeHistogram, 0);
208 //delete til dodeinit
209 // if(fPlotChargeOROCAll){
210 // AliHLTUInt32_t fSpecification = AliHLTTRDDefinitions::EncodeDataSpecification(0,35,2,5);
211 // PushBack( (TObject*) fTotalClusterChargeOROCAll,kAliHLTDataTypeHistogram,fSpecification);
217 int AliHLTTRDClusterHistoComponent::Configure(const char* arguments)
222 int AliHLTTRDClusterHistoComponent::Reconfigure(const char* cdbEntry, const char* chainId)