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