reactivating TRDEsdWriterComponent to write ESDEvents with Esdfriends (Theodor)
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDCalibrationComponent.cxx
CommitLineData
95259bbb 1// $Id$
2
3/**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * *
6 * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7 * Timm Steinbeck <timm@kip.uni-heidelberg.de> *
8 * for The ALICE Off-line Project. *
9 * *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
18
19/** @file AliHLTTRDCalibrationComponent.cxx
20 @author Timm Steinbeck, Matthias Richter
dc2e6604 21 @date
95259bbb 22 @brief A TRDCalibration processing component for the HLT. */
23
24#if __GNUC__ >= 3
775f67d7 25using namespace std;
95259bbb 26#endif
27
28#include "TTree.h"
29#include "TFile.h"
30#include "TBranch.h"
d8731936 31#include "TH2I.h"
32#include "TH2.h"
33#include "TProfile2D.h"
34
35#include "AliHLTReadoutList.h"
95259bbb 36
37#include "AliHLTTRDCalibrationComponent.h"
38#include "AliHLTTRDDefinitions.h"
dc2e6604 39#include "AliHLTTRDUtils.h"
95259bbb 40
41#include "AliCDBManager.h"
775f67d7 42#include "AliCDBStorage.h"
95259bbb 43#include "AliRawReaderMemory.h"
d8731936 44
45#include "AliTRDCalPad.h"
46#include "AliTRDCalDet.h"
47
9aea5deb 48#include "AliTRDCalibraFillHisto.h"
dc2e6604 49#include "AliTRDtrackV1.h"
95259bbb 50
d8731936 51#include "AliTRDCalibraFit.h"
52#include "AliTRDCalibraMode.h"
53#include "AliTRDCalibraVector.h"
54#include "AliTRDCalibraVdriftLinearFit.h"
55
95259bbb 56#include <cstdlib>
57#include <cerrno>
58#include <string>
59
95259bbb 60ClassImp(AliHLTTRDCalibrationComponent);
dc2e6604 61
93ce7d1b 62AliHLTTRDCalibrationComponent::AliHLTTRDCalibrationComponent()
d8731936 63 : AliHLTCalibrationProcessor(),
64 fTRDCalibraFillHisto(NULL),
65 fOutputSize(500000),
66 fTracksArray(NULL),
67 fOutArray(NULL),
68 fAfterRunArray(NULL),
69 fDisplayArray(NULL),
d8731936 70 fRecievedTimeBins(kFALSE),
71 fTrgStrings(NULL),
72 fAccRejTrg(0)
95259bbb 73{
775f67d7 74 // Default constructor
95259bbb 75}
76
77AliHLTTRDCalibrationComponent::~AliHLTTRDCalibrationComponent()
78{
775f67d7 79 // Destructor
95259bbb 80}
81
82const char* AliHLTTRDCalibrationComponent::GetComponentID()
83{
775f67d7 84 // Return the component ID const char *
85 return "TRDCalibration"; // The ID of this component
95259bbb 86}
87
93ce7d1b 88void AliHLTTRDCalibrationComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
95259bbb 89{
775f67d7 90 // Get the list of input data
91 list.clear(); // We do not have any requirements for our input data type(s).
07f31c0e 92 list.push_back(AliHLTTRDDefinitions::fgkTracksDataType);
95259bbb 93}
94
93ce7d1b 95AliHLTComponentDataType AliHLTTRDCalibrationComponent::GetOutputDataType()
95259bbb 96{
775f67d7 97 // Get the output data type
d8731936 98 return kAliHLTMultipleDataType;
99 // return AliHLTTRDDefinitions::fgkCalibrationDataType;
100
101}
102
103int AliHLTTRDCalibrationComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& tgtList)
104{
105 // Get the output data type
106 tgtList.clear();
107 tgtList.push_back(AliHLTTRDDefinitions::fgkCalibrationDataType);
108 tgtList.push_back(AliHLTTRDDefinitions::fgkEORCalibrationDataType);
109 return tgtList.size();
95259bbb 110}
111
112void AliHLTTRDCalibrationComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
113{
775f67d7 114 // Get the output data size
93ce7d1b 115 constBase = fOutputSize;
116 inputMultiplier = 0;
95259bbb 117}
118
119AliHLTComponent* AliHLTTRDCalibrationComponent::Spawn()
120{
775f67d7 121 // Spawn function, return new instance of this class
122 return new AliHLTTRDCalibrationComponent;
95259bbb 123};
124
125Int_t AliHLTTRDCalibrationComponent::ScanArgument( int argc, const char** argv )
126{
775f67d7 127 // perform initialization. We check whether our relative output size is specified in the arguments.
128 int i = 0;
129 char* cpErr;
d8731936 130 if(!fTrgStrings)
131 fTrgStrings = new TObjArray();
132
775f67d7 133 while ( i < argc )
134 {
135 HLTDebug("argv[%d] == %s", i, argv[i] );
93ce7d1b 136 if ( !strcmp( argv[i], "output_size" ) )
dc2e6604 137 {
775f67d7 138 if ( i+1>=argc )
139 {
93ce7d1b 140 HLTError("Missing output_size parameter");
775f67d7 141 return ENOTSUP;
dc2e6604 142 }
775f67d7 143 HLTDebug("argv[%d+1] == %s", i, argv[i+1] );
93ce7d1b 144 fOutputSize = strtoul( argv[i+1], &cpErr, 0 );
775f67d7 145 if ( *cpErr )
146 {
93ce7d1b 147 HLTError("Cannot convert output_size parameter '%s'", argv[i+1] );
775f67d7 148 return EINVAL;
149 }
93ce7d1b 150 HLTInfo("Output size set to %lu %%", fOutputSize );
775f67d7 151 i += 2;
152 continue;
dc2e6604 153 }
93ce7d1b 154 if ( !strcmp( argv[i], "-everyNevent" ) )
155 {
156 if ( i+1>=argc )
157 {
158 HLTError("Missing everyNevent parameter");
159 return ENOTSUP;
160 }
161 HLTDebug("argv[%d+1] == %s", i, argv[i+1] );
d132a324 162 HLTInfo("Option -everyNevent depreceated");
93ce7d1b 163 i += 2;
164 continue;
165 }
d8731936 166 if ( !strcmp( argv[i], "-TrgStr" ) )
167 {
168 if ( i+1>=argc )
169 {
170 HLTError("Missing parameter for mbTriggerString");
171 return ENOTSUP;
172 }
173 HLTDebug("argv[%d+1] == %s", i, argv[i+1] );
174 fTrgStrings->Add(new TObjString(argv[i+1]));
175 i += 2;
176 continue;
177 }
178
179 if ( !strcmp( argv[i], "-acceptTrgStr" ) )
180 {
181 fAccRejTrg=1;
182 i += 1;
183 continue;
184 }
185 if ( !strcmp( argv[i], "-rejectTrgStr" ) )
186 {
187 fAccRejTrg=-1;
188 i += 1;
189 continue;
190 }
93ce7d1b 191
775f67d7 192 else {
193 HLTError("Unknown option '%s'", argv[i] );
194 return EINVAL;
195 }
196 }
d8731936 197 return i;
95259bbb 198}
199
200Int_t AliHLTTRDCalibrationComponent::InitCalibration()
201{
d8731936 202
bb2a05d3 203 if(!fTrgStrings)
d8731936 204 fTrgStrings = new TObjArray();
205
775f67d7 206 if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
93ce7d1b 207 HLTError("DefaultStorage is not set in CDBManager");
208 return -EINVAL;
775f67d7 209 }
210 if(AliCDBManager::Instance()->GetRun()<0){
93ce7d1b 211 HLTError("Run Number is not set in CDBManager");
212 return -EINVAL;
775f67d7 213 }
214 HLTInfo("CDB default storage: %s; RunNo: %i", (AliCDBManager::Instance()->GetDefaultStorage()->GetBaseFolder()).Data(), AliCDBManager::Instance()->GetRun());
775f67d7 215
d8731936 216 if(fTrgStrings->GetEntriesFast()>0 && !fAccRejTrg){
217 HLTError("Trigger string(s) given, but acceptTrgStr or rejectTrgStr not selected");
218 return -EINVAL;
219 }
220
775f67d7 221 fTRDCalibraFillHisto = AliTRDCalibraFillHisto::Instance();
d8731936 222 fTRDCalibraFillHisto->SetIsHLT(kTRUE);
775f67d7 223 fTRDCalibraFillHisto->SetHisto2d(); // choose to use histograms
224 fTRDCalibraFillHisto->SetCH2dOn(); // choose to calibrate the gain
225 fTRDCalibraFillHisto->SetPH2dOn(); // choose to calibrate the drift velocity
226 fTRDCalibraFillHisto->SetPRF2dOn(); // choose to look at the PRF
93ce7d1b 227 fTRDCalibraFillHisto->SetIsHLT(); // per detector
228 //fTRDCalibraFillHisto->SetDebugLevel(1);// debug
229 fTRDCalibraFillHisto->SetFillWithZero(kTRUE);
d8731936 230 fTRDCalibraFillHisto->SetLinearFitterOn(kTRUE);
231 fTRDCalibraFillHisto->SetNumberBinCharge(100);
232
93ce7d1b 233 fTracksArray = new TClonesArray("AliTRDtrackV1");
d8731936 234 fOutArray = new TObjArray(4);
235 fAfterRunArray=new TObjArray(5);
236 fDisplayArray=new TObjArray(4);
237
238 HLTDebug("run SetupCTPData");
239 SetupCTPData();
93ce7d1b 240
775f67d7 241 return 0;
95259bbb 242}
243
244Int_t AliHLTTRDCalibrationComponent::DeinitCalibration()
245{
93ce7d1b 246
775f67d7 247 // Deinitialization of the component
93ce7d1b 248
249 HLTDebug("DeinitCalibration");
d8731936 250 delete fTracksArray; fTracksArray=0;
251 //fTRDCalibraFillHisto->Destroy();
93ce7d1b 252 //fOutArray->Delete();
d8731936 253 delete fOutArray; fOutArray=0;
254 fAfterRunArray->Delete();
255 delete fAfterRunArray; fAfterRunArray=0;
256 fDisplayArray->Delete();
257 delete fDisplayArray; fDisplayArray=0;
258 fTrgStrings->Delete();
259 delete fTrgStrings; fTrgStrings=0;
775f67d7 260 return 0;
95259bbb 261}
262
d679dd6c 263Int_t AliHLTTRDCalibrationComponent::ProcessCalibration(const AliHLTComponent_EventData& evtData,
dc2e6604 264 const AliHLTComponent_BlockData* blocks,
d8731936 265 AliHLTComponent_TriggerData& trigData,
dc2e6604 266 AliHLTUInt8_t* /*outputPtr*/,
267 AliHLTUInt32_t& /*size*/,
268 vector<AliHLTComponent_BlockData>& /*outputBlocks*/)
95259bbb 269{
775f67d7 270 HLTDebug("NofBlocks %lu", evtData.fBlockCnt );
271 // Process an event
d8731936 272
273
775f67d7 274 // Loop over all input blocks in the event
275 vector<AliHLTComponent_DataType> expectedDataTypes;
276 GetInputDataTypes(expectedDataTypes);
277 for ( unsigned long iBlock = 0; iBlock < evtData.fBlockCnt; iBlock++ )
278 {
279 const AliHLTComponentBlockData &block = blocks[iBlock];
280 AliHLTComponentDataType inputDataType = block.fDataType;
281 Bool_t correctDataType = kFALSE;
282
283 for(UInt_t i = 0; i < expectedDataTypes.size(); i++)
284 if( expectedDataTypes.at(i) == inputDataType)
285 correctDataType = kTRUE;
286 if (!correctDataType) {
287 HLTDebug( "Block # %i/%i; Event 0x%08LX (%Lu) Wrong received datatype: %s - Skipping",
288 iBlock, evtData.fBlockCnt,
289 evtData.fEventID, evtData.fEventID,
290 DataType2Text(inputDataType).c_str());
291 continue;
292 }
293 else {
93ce7d1b 294 HLTDebug("We get the right data type: Block # %i/%i; Event 0x%08LX (%Lu) Received datatype: %s; Block Size: %i",
775f67d7 295 iBlock, evtData.fBlockCnt-1,
296 evtData.fEventID, evtData.fEventID,
93ce7d1b 297 DataType2Text(inputDataType).c_str(),
298 block.fSize);
775f67d7 299 }
300
93ce7d1b 301 Int_t nTimeBins;
302 AliHLTTRDUtils::ReadTracks(fTracksArray, block.fPtr, block.fSize, &nTimeBins);
303
d8731936 304
93ce7d1b 305 if(!fRecievedTimeBins){
306 HLTDebug("Reading number of time bins from input block. Value is: %d", nTimeBins);
efd646f3 307 fTRDCalibraFillHisto->Init2Dhistos(nTimeBins); // initialise the histos
93ce7d1b 308 fTRDCalibraFillHisto->SetNumberClusters(0); // At least 1 clusters
309 fTRDCalibraFillHisto->SetNumberClustersf(nTimeBins); // Not more than %d clusters
310 fRecievedTimeBins=kTRUE;
775f67d7 311 }
d8731936 312
313
314 Bool_t TriggerPassed=kFALSE;
315
316 if(fAccRejTrg){
317 if(fAccRejTrg>0){
318 TriggerPassed=kFALSE;
319 for(int i = 0; i < fTrgStrings->GetEntriesFast(); i++){
bb2a05d3 320 const TObjString *const obString=(TObjString*)fTrgStrings->At(i);
321 const TString tString=obString->GetString();
322 //printf("Trigger Output: %i\n",EvaluateCTPTriggerClass(tString.Data(),trigData));
d8731936 323 if(EvaluateCTPTriggerClass(tString.Data(),trigData)){TriggerPassed=kTRUE; break;}
324 }
325 }
326 else{
327 TriggerPassed=kTRUE;
328 for(int i = 0; i < fTrgStrings->GetEntriesFast(); i++){
bb2a05d3 329 const TObjString *const obString=(TObjString*)fTrgStrings->At(i);
330 const TString tString=obString->GetString();
d8731936 331 if(EvaluateCTPTriggerClass(tString.Data(),trigData)){TriggerPassed=kFALSE; break;}
332 }
333 }
334 }
335
336
93ce7d1b 337 Int_t nbEntries = fTracksArray->GetEntries();
338 HLTDebug(" %i TRDtracks in tracksArray", nbEntries);
339 AliTRDtrackV1* trdTrack = 0x0;
340 for (Int_t i = 0; i < nbEntries; i++){
341 HLTDebug("%i/%i: ", i+1, nbEntries);
342 trdTrack = (AliTRDtrackV1*)fTracksArray->At(i);
d8731936 343 //trdTrack->Print();
344 fTRDCalibraFillHisto->SetCH2dOn(TriggerPassed);
93ce7d1b 345 fTRDCalibraFillHisto->UpdateHistogramsV1(trdTrack);
d8731936 346 fTRDCalibraFillHisto->SetCH2dOn(kTRUE);
93ce7d1b 347 }
348
d8731936 349
350 if(!fOutArray->At(0))FormOutput(0);
351 if(!fDisplayArray->At(0))FormOutput(1);
d132a324 352 PushBack(fDisplayArray, AliHLTTRDDefinitions::fgkCalibrationDataType);
353
93ce7d1b 354 fTracksArray->Delete();
d132a324 355
775f67d7 356 }
d8731936 357
775f67d7 358 return 0;
dc2e6604 359
95259bbb 360}
361
d679dd6c 362/**
dc2e6604 363 * Form output array of histrograms
d679dd6c 364 */
365//============================================================================
d8731936 366void AliHLTTRDCalibrationComponent::FormOutput(Int_t param)
d679dd6c 367{
775f67d7 368 // gain histo
369 TH2I *hCH2d = fTRDCalibraFillHisto->GetCH2d();
d8731936 370 if(!param)fOutArray->Add(hCH2d);
371 else fDisplayArray->Add(hCH2d);
d679dd6c 372
775f67d7 373 // drift velocity histo
374 TProfile2D *hPH2d = fTRDCalibraFillHisto->GetPH2d();
d8731936 375 if(!param)fOutArray->Add(hPH2d);
376 else fDisplayArray->Add(hPH2d);
d679dd6c 377
775f67d7 378 // PRF histo
379 TProfile2D *hPRF2d = fTRDCalibraFillHisto->GetPRF2d();
d8731936 380 if(!param)fOutArray->Add(hPRF2d);
381 else fDisplayArray->Add(hPRF2d);
382
383 // Vdrift Linear Fit
384 if(!param){
385 AliTRDCalibraVdriftLinearFit *hVdriftLinearFitOne=(AliTRDCalibraVdriftLinearFit *)fTRDCalibraFillHisto->GetVdriftLinearFit();
386 fOutArray->Add(hVdriftLinearFitOne);
387 }
388 else{
389 TH2S *hVdriftLinearFitOne = (TH2S *)(((AliTRDCalibraVdriftLinearFit *)fTRDCalibraFillHisto->GetVdriftLinearFit())->GetLinearFitterHisto(10,kTRUE));
bb2a05d3 390 fDisplayArray->Add(hVdriftLinearFitOne);
d8731936 391 }
dc2e6604 392
bb2a05d3 393 HLTDebug("GetCH2d = 0x%x; NEntries = %i; size = %i", hCH2d, hCH2d->GetEntries(), sizeof(*hCH2d));
775f67d7 394 hCH2d->Print();
bb2a05d3 395 HLTDebug("GetPH2d = 0x%x; NEntries = %i; size = %i", hPH2d, hPH2d->GetEntries(), sizeof(*hPH2d));
775f67d7 396 hPH2d->Print();
bb2a05d3 397 HLTDebug("GetPRF2d = 0x%x; NEntries = %i; size = %i", hPRF2d, hPRF2d->GetEntries(), sizeof(*hPRF2d));
775f67d7 398 hPRF2d->Print();
bb2a05d3 399 //HLTDebug("GetVdriftLinearFit = 0x%x; size = %i", hVdriftLinearFitOne, sizeof(hVdriftLinearFitOne));
d8731936 400
93ce7d1b 401 HLTDebug("output Array: pointer = 0x%x; NEntries = %i; size = %i", fOutArray, fOutArray->GetEntries(), sizeof(fOutArray));
d8731936 402
d679dd6c 403}
404
93ce7d1b 405Int_t AliHLTTRDCalibrationComponent::ShipDataToFXS(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
406{
407 //fTRDCalibraFillHisto->DestroyDebugStreamer();
d8731936 408
409 AliHLTReadoutList rdList(AliHLTReadoutList::kTRD);
410
411 EORCalibration();
412
413 fOutArray->Remove(fOutArray->FindObject("AliTRDCalibraVdriftLinearFit"));
414 //fOutArray->Remove(fOutArray->FindObject("PRF2d"));
415 //fOutArray->Remove(fOutArray->FindObject("PH2d"));
416 //fOutArray->Remove(fOutArray->FindObject("CH2d"));
417
bb2a05d3 418 //if(!(fOutArray->FindObject("CH2d"))) {
419 // TH2I * ch2d = new TH2I("CH2d","Nz0Nrphi0",100,0.0,300.0,540,0,540);
420 // fOutArray->Add(ch2d);
421 //}
d8731936 422
bb2a05d3 423 //if(!(fOutArray->FindObject("PH2d"))) {
424 // TProfile2D * ph2d = new TProfile2D("PH2d","Nz0Nrphi0",30,-0.05,2.95,540,0,540);
425 // fOutArray->Add(ph2d);
426 //}
d8731936 427
bb2a05d3 428 //if(!(fOutArray->FindObject("PRF2d"))) {
429 // TProfile2D * prf2d = new TProfile2D("PRF2d","Nz0Nrphi0Ngp3",60,-9.0,9.0,540,0,540);
430 // fOutArray->Add(prf2d);
431 //}
d8731936 432
433
434 HLTDebug("Size of the fOutArray is %d\n",fOutArray->GetEntriesFast());
435
436 /*
437 TString fileName="$ALIHLT_TOPDIR/build-debug/output/CalibHistoDump_run";
438 fileName+=".root";
439 HLTInfo("Dumping Histogram file to %s",fileName.Data());
440 TFile* file = TFile::Open(fileName, "RECREATE");
441 //fAfterRunArray->Write();
442 fOutArray->Write();
443 file->Close();
444 HLTInfo("Histogram file dumped");
445 */
446
447 PushToFXS((TObject*)fOutArray, "TRD", "GAINDRIFTPRF", rdList.Buffer() );
448 //PushToFXS((TObject*)fOutArray->FindObject("CH2d"), "TRD", "GAINDRIFTPRF", rdList.Buffer() );
449
450
e03c1166 451 return 0;
93ce7d1b 452}
d8731936 453Int_t AliHLTTRDCalibrationComponent::EORCalibration()
454{
455 //Also Fill histograms for the online display
456 TH2I *hCH2d=(TH2I*)fOutArray->FindObject("CH2d");
457 TProfile2D *hPH2d=(TProfile2D*)fOutArray->FindObject("PH2d");
458 TProfile2D *hPRF2d= (TProfile2D*)fOutArray->FindObject("PRF2d");
459 AliTRDCalibraVdriftLinearFit* hVdriftLinearFit = (AliTRDCalibraVdriftLinearFit*)fOutArray->FindObject("AliTRDCalibraVdriftLinearFit");
460
461
462 if(!hCH2d || !hPH2d || !hPRF2d || !hVdriftLinearFit) return 0;
463
464 //Fit
465 AliTRDCalibraFit *calibra = AliTRDCalibraFit::Instance();
466
467 //Gain
468 calibra->SetMinEntries(100);
469 calibra->AnalyseCH(hCH2d);
470 Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(0))
471 + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(0));
472 Int_t nbfit = calibra->GetNumberFit();
473 Int_t nbE = calibra->GetNumberEnt();
474 TH1F *coefgain = 0x0;
475 // enough statistics
476 //if ((nbtg > 0) &&
477 // (nbfit >= 0.2*nbE)) {
478 // create the cal objects
479 //calibra->PutMeanValueOtherVectorFit(1,kTRUE);
480 TObjArray object = calibra->GetVectorFit();
481 AliTRDCalDet *objgaindet = calibra->CreateDetObjectGain(&object,kFALSE);
482 coefgain = objgaindet->MakeHisto1DAsFunctionOfDet();
483 //}
484 calibra->ResetVectorFit();
485
486 // vdrift second method
bb2a05d3 487 calibra->SetMinEntries(100); // If there is less than 100
d8731936 488 hVdriftLinearFit->FillPEArray();
489 calibra->AnalyseLinearFitters(hVdriftLinearFit);
490 nbtg = 540;
491 nbfit = calibra->GetNumberFit();
492 nbE = calibra->GetNumberEnt();
493 TH1F *coefdriftsecond = 0x0;
494 // enough statistics
495 //if ((nbtg > 0) &&
496 // (nbfit >= 0.1*nbE)) {
497 // create the cal objects
498 //calibra->PutMeanValueOtherVectorFit(1,kTRUE);
499 object = calibra->GetVectorFit();
500 AliTRDCalDet *objdriftvelocitydetsecond = calibra->CreateDetObjectVdrift(&object,kTRUE);
501 objdriftvelocitydetsecond->SetTitle("secondmethodvdrift");
502 coefdriftsecond = objdriftvelocitydetsecond->MakeHisto1DAsFunctionOfDet();
503 //}
504 calibra->ResetVectorFit();
505
506 // vdrift first method
507 calibra->SetMinEntries(100*20); // If there is less than 20000
508 calibra->AnalysePH(hPH2d);
509 nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1))
510 + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1));
511 nbfit = calibra->GetNumberFit();
512 nbE = calibra->GetNumberEnt();
513 TH1F *coefdrift = 0x0;
514 TH1F *coeft0 = 0x0;
515 // enough statistics
516 //if ((nbtg > 0) &&
517 // (nbfit >= 0.2*nbE)) {
518 // create the cal objects
519 //calibra->PutMeanValueOtherVectorFit(1,kTRUE);
520 //calibra->PutMeanValueOtherVectorFit2(1,kTRUE);
521 object = calibra->GetVectorFit();
522 AliTRDCalDet *objdriftvelocitydet = calibra->CreateDetObjectVdrift(&object,kTRUE);
523 coefdrift = objdriftvelocitydet->MakeHisto1DAsFunctionOfDet();
524 object = calibra->GetVectorFit2();
525 AliTRDCalDet *objtime0det = calibra->CreateDetObjectT0(&object,kTRUE);
526 coeft0 = objtime0det->MakeHisto1DAsFunctionOfDet();
527 //}
528 calibra->ResetVectorFit();
529
530
531 //PRF
532 calibra->SetMinEntries(200);
533 calibra->AnalysePRFMarianFit(hPRF2d);
534 nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(2))
535 + 6* 18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(2));
536 nbfit = calibra->GetNumberFit();
537 nbE = calibra->GetNumberEnt();
538 TH1F *coefprf = 0x0;
539 // enough statistics
540 //if ((nbtg > 0) &&
541 // (nbfit >= 0.95*nbE)) {
542 // create cal pad objects
543 object = calibra->GetVectorFit();
544 TObject *objPRFpad = calibra->CreatePadObjectPRF(&object);
545 coefprf = ((AliTRDCalPad *) objPRFpad)->MakeHisto1D();
546 //}
547 calibra->ResetVectorFit();
548
549
550 coefgain->SetName("coefgain");
551 coefprf->SetName("coefprf");
552 coefdrift->SetName("coefdrift");
553 coefdriftsecond->SetName("coefdriftsecond");
554 coeft0->SetName("coeft0");
555 if(coefgain) fAfterRunArray->Add(coefgain);
556 if(coefprf) fAfterRunArray->Add(coefprf);
557 if(coefdrift) fAfterRunArray->Add(coefdrift);
558 if(coefdriftsecond) fAfterRunArray->Add(coefdriftsecond);
559 if(coeft0) fAfterRunArray->Add(coeft0);
560
561
562 if(coefgain||coefprf||coefdrift||coeft0||coefdriftsecond) {
bb2a05d3 563 PushBack(fAfterRunArray, AliHLTTRDDefinitions::fgkEORCalibrationDataType);
564 }
d8731936 565
566 /*
567 TString fileName="$ALIHLT_TOPDIR/build-debug/output/CalibHistoDump_run";
568 fileName+=".root";
569 HLTInfo("Dumping Histogram file to %s",fileName.Data());
570 TFile* file = TFile::Open(fileName, "RECREATE");
571 fAfterRunArray->Write();
572 fOutArray->Write();
573 file->Close();
574 HLTInfo("Histogram file dumped");
575 */
576
577 return 0;
578}
579