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