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()
46 : fClusterArray(NULL),
54 // see header file for class documentation
56 // refer to README to build package
58 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
62 AliHLTTRDClusterHistoComponent::~AliHLTTRDClusterHistoComponent()
64 // see header file for class documentation
67 // Public functions to implement AliHLTComponent's interface.
68 // These functions are required for the registration process
70 const char* AliHLTTRDClusterHistoComponent::GetComponentID()
72 // see header file for class documentation
74 return "TRDClusterHisto";
77 void AliHLTTRDClusterHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
79 // see header file for class documentation
81 list.push_back( AliHLTTRDDefinitions::fgkClusterDataType );
84 AliHLTComponentDataType AliHLTTRDClusterHistoComponent::GetOutputDataType()
86 // see header file for class documentation
87 return kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD;
91 void AliHLTTRDClusterHistoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
93 // see header file for class documentation
98 AliHLTComponent* AliHLTTRDClusterHistoComponent::Spawn()
100 // see header file for class documentation
101 return new AliHLTTRDClusterHistoComponent;
104 int AliHLTTRDClusterHistoComponent::DoInit(int /*argc*/, const char** /*argv*/ )
106 // Initialize histograms
108 fClusterArray = new TClonesArray("AliTRDcluster");
110 fNClsDet = new TH1D("trdClsDet", ";detector", 540, -0.5, 539.5);
111 fClsAmp = new TH1D("trdClsAmp", ";amplitude", 200, -0.5, 1999.5);
112 fClsAmpDrift = new TH1D("trdClsAmpDrift", ";amplitude", 200, -0.5, 199.5) ;
113 fClsTB = new TH1D("trdClsTB", ";time bin", 35, -0.5, 34.5);
114 fClsAmpDist = new TH1D("trdClsAmpDist", "mean amplitude", 200, 0, 1000);
115 fSClsDist = new TH1D("sclsdist", "Super cluster spectrum", 200, 0, 8000);
117 for(int i=0; i<540; i++)
118 fClsAmpDriftDet[i] = new TH1D(Form("trdClsDriftDet_%d",i), "", 200, -0.5, 199.5);
123 int AliHLTTRDClusterHistoComponent::DoDeinit()
125 // see header file for class documentation
127 fClusterArray->Delete();
128 delete fClusterArray;
131 if (fNClsDet) delete fNClsDet;
132 if (fClsAmp) delete fClsAmp;
133 if (fClsAmpDrift) delete fClsAmpDrift;
134 if (fClsTB) delete fClsTB;
135 if (fClsAmpDist) delete fClsAmpDist;
136 if (fSClsDist) delete fSClsDist;
138 for(int i=0; i<540; i++)
139 if (fClsAmpDriftDet[i]) delete fClsAmpDriftDet[i];
144 int AliHLTTRDClusterHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/,
145 AliHLTComponentTriggerData& /*trigData*/)
148 if (GetFirstInputBlock(kAliHLTDataTypeSOR) || GetFirstInputBlock(kAliHLTDataTypeEOR)) return 0;
150 const AliHLTComponentBlockData* iter = NULL;
152 Float_t sClusterCharge[540] = { 0 };
154 for ( iter = GetFirstInputBlock(AliHLTTRDDefinitions::fgkClusterDataType);
155 iter != NULL; iter = GetNextInputBlock() ) {
157 HLTDebug("We get the right data type: Block Ptr: 0x%x; Block Size: %i",
158 iter->fPtr, iter->fSize);
160 AliHLTTRDUtils::ReadClusters(fClusterArray, iter->fPtr, iter->fSize);
161 HLTDebug("TClonesArray of clusters: nbEntries = %i", fClusterArray->GetEntriesFast());
165 // loop over clusters
166 for(int i=0;i<fClusterArray->GetEntriesFast();i++) {
168 cls=(AliTRDcluster*)fClusterArray->At(i);
170 fNClsDet->Fill(cls->GetDetector());
171 sClusterCharge[cls->GetDetector()] += cls->GetQ();
172 fClsAmp->Fill(cls->GetQ());
174 int tb = cls->GetPadTime();
176 if (tb > 5 && tb <25)
177 fClsAmpDrift->Fill(cls->GetQ());
179 fClsAmpDriftDet[cls->GetDetector()]->Fill(cls->GetQ());
182 fClusterArray->Delete();
186 fClsAmpDist->Reset();
187 for(int det=0; det<540; det++) {
188 if (fClsAmpDriftDet[det]->GetSum() > 0)
189 fClsAmpDist->Fill(fClsAmpDriftDet[det]->GetMean());
190 fSClsDist->Fill(sClusterCharge[det]);
193 PushBack((TObject*)fNClsDet, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);
194 PushBack((TObject*)fClsAmp, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);
195 PushBack((TObject*)fClsAmpDrift, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);
196 PushBack((TObject*)fClsTB, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);
197 PushBack((TObject*)fClsAmpDist, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);
198 PushBack((TObject*)fSClsDist, kAliHLTDataTypeHistogram | kAliHLTDataOriginTRD, 0);