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