]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/OfflineInterface/AliHLTMUONTriggerRecordsSource.cxx
aa6163dc31ed70286482bf4420b3ee24d4f6528d
[u/mrichter/AliRoot.git] / HLT / MUON / OfflineInterface / AliHLTMUONTriggerRecordsSource.cxx
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project        *
3  * All rights reserved.                                                   *
4  *                                                                        *
5  * Primary Authors:                                                       *
6  *   Artur Szostak <artursz@iafrica.com>                                  *
7  *                                                                        *
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  **************************************************************************/
16
17 /* $Id$ */
18
19 /**
20  * @file   AliHLTMUONTriggerRecordsSource.cxx
21  * @author Artur Szostak <artursz@iafrica.com>
22  * @date   
23  * @brief  Implementation of the AliHLTMUONTriggerRecordsSource component.
24  */
25
26 #include "AliHLTMUONTriggerRecordsSource.h"
27 #include "AliHLTMUONConstants.h"
28 #include "AliHLTMUONUtils.h"
29 #include "AliHLTMUONDataBlockWriter.h"
30 #include "AliHLTMUONCalculations.h"
31 #include "AliMUONMCDataInterface.h"
32 #include "AliMUONDataInterface.h"
33 #include "AliMUONHit.h"
34 #include "AliMUONRawCluster.h"
35 #include "AliMUONConstants.h"
36 #include "AliMUONVClusterStore.h"
37 #include "AliMUONVHitStore.h"
38 #include "mapping/AliMpCDB.h"
39 #include "mapping/AliMpDDLStore.h"
40 #include "mapping/AliMpLocalBoard.h"
41 #include "mapping/AliMpTriggerCrate.h"
42 #include "mapping/AliMpDEManager.h"
43 #include "mapping/AliMpDetElement.h"
44 #include "AliLog.h"
45 #include "TClonesArray.h"
46 #include <cstdlib>
47 #include <cstdio>
48 #include <cerrno>
49 #include <cassert>
50 #include <new>
51
52 namespace
53 {
54         
55         //TODO: The following method should be in MUON/mapping
56         Int_t FindDDLOfDetElement(Int_t detElemId)
57         {
58                 // Find what the DDL ID number is for a detector element from
59                 // trigger chambers 11 to 14. We first have to find the local
60                 // board associated with the detector element and then we can
61                 // associate that local board to the trigger crate which has
62                 // the DDL number specified.
63                 AliMpDDLStore* ddlStore = AliMpDDLStore::Instance();
64                 if (ddlStore == NULL) return -1;
65                 Int_t ddl = -1, boardIndex = 1;
66                 do
67                 {
68                         AliMpLocalBoard* board = ddlStore->GetLocalBoard(boardIndex++);
69                         if (board == NULL) break;
70                         if (board->HasDEId(detElemId))
71                         {
72                                 AliMpTriggerCrate* crate = ddlStore->GetTriggerCrate(board->GetCrate());
73                                 if (crate == NULL) continue;
74                                 ddl = crate->GetDdlId();
75                                 break;
76                         }
77                 }
78                 while (ddl == -1);
79                 return ddl;
80         }
81
82 }
83
84
85 ClassImp(AliHLTMUONTriggerRecordsSource);
86
87
88 AliHLTMUONTriggerRecordsSource::AliHLTMUONTriggerRecordsSource() :
89         AliHLTOfflineDataSource(),
90         fMCDataInterface(NULL),
91         fDataInterface(NULL),
92         fBuildFromHits(false),
93         fSelection(kWholePlane),
94         fCurrentEventIndex(0)
95 {
96         ///
97         /// Default constructor.
98         ///
99 }
100
101
102 AliHLTMUONTriggerRecordsSource::~AliHLTMUONTriggerRecordsSource()
103 {
104         ///
105         /// Default destructor.
106         ///
107         
108         if (fMCDataInterface != NULL) delete fMCDataInterface;
109         if (fDataInterface != NULL) delete fDataInterface;
110 }
111
112
113 int AliHLTMUONTriggerRecordsSource::DoInit(int argc, const char** argv)
114 {
115         ///
116         /// Inherited from AliHLTComponent.
117         /// Parses the command line parameters and initialises the component.
118         ///
119         
120         HLTInfo("Initialising dHLT trigger record source component.");
121         
122         if (fMCDataInterface != NULL)
123         {
124                 delete fMCDataInterface;
125                 fMCDataInterface = NULL;
126         }
127         if (fDataInterface != NULL)
128         {
129                 delete fDataInterface;
130                 fDataInterface = NULL;
131         }
132         
133         // Parse the command line arguments:
134         bool hitdata = false;
135         bool simdata = false;
136         bool recdata = false;
137         fCurrentEventIndex = 0;
138         bool firstEventSet = false;
139         bool eventNumLitSet = false;
140         
141         for (int i = 0; i < argc; i++)
142         {
143                 if (strcmp(argv[i], "-hitdata") == 0)
144                 {
145                         hitdata = true;
146                 }
147                 else if (strcmp(argv[i], "-simdata") == 0)
148                 {
149                         simdata = true;
150                 }
151                 else if (strcmp(argv[i], "-recdata") == 0)
152                 {
153                         recdata = true;
154                 }
155                 else if (strcmp(argv[i], "-plane") == 0)
156                 {
157                         i++;
158                         if (i >= argc)
159                         {
160                                 Logging(kHLTLogError,
161                                         "AliHLTMUONTriggerRecordsSource::DoInit",
162                                         "Missing parameter",
163                                         "Expected one of 'left', 'right' or 'all' after '-plane'."
164                                 );
165                                 return -EINVAL;
166                         }
167                         if (strcmp(argv[i], "left") == 0)
168                                 fSelection = kLeftPlane;
169                         else if (strcmp(argv[i], "right") == 0)
170                                 fSelection = kRightPlane;
171                         else if (strcmp(argv[i], "all") == 0)
172                                 fSelection = kWholePlane;
173                         else
174                         {
175                                 Logging(kHLTLogError,
176                                         "AliHLTMUONTriggerRecordsSource::DoInit",
177                                         "Invalid parameter",
178                                         "The parameter '%s' is invalid and must be one of 'left',"
179                                           " 'right' or 'all'.",
180                                         argv[i]
181                                 );
182                                 return -EINVAL;
183                         }
184                 }
185                 else if (strcmp(argv[i], "-firstevent") == 0)
186                 {
187                         if (eventNumLitSet)
188                         {
189                                 HLTWarning("The -firstevent flag is overridden by a"
190                                         " previous use of -event_number_literal."
191                                 );
192                         }
193                         i++;
194                         if (i >= argc)
195                         {
196                                 HLTError("Expected a positive number after -firstevent.");
197                                 return -EINVAL;
198                         }
199                         char* end = NULL;
200                         long num = strtol(argv[i], &end, 0);
201                         if ((end != NULL and *end != '\0') or num < 0) // Check if the conversion is OK.
202                         {
203                                 HLTError(Form(
204                                         "Expected a positive number after -firstevent"
205                                         " but got: %s", argv[i]
206                                 ));
207                                 return -EINVAL;
208                         }
209                         fCurrentEventIndex = Int_t(num);
210                         firstEventSet = true;
211                 }
212                 else if (strcmp(argv[i], "-event_number_literal") == 0)
213                 {
214                         if (firstEventSet)
215                         {
216                                 HLTWarning("The -event_number_literal option will"
217                                         " override -firstevent."
218                                 );
219                         }
220                         fCurrentEventIndex = -1;
221                         eventNumLitSet = true;
222                 }
223                 else
224                 {
225                         Logging(kHLTLogError,
226                                 "AliHLTMUONTriggerRecordsSource::DoInit",
227                                 "Unknown argument",
228                                 "The argument '%s' is invalid.",
229                                 argv[i]
230                         );
231                         return -EINVAL;
232                 }
233         }
234
235         // Check that one and only one of the the -hitdata, -simdata or
236         // -recdata parameters was specified on the command line.
237         if ((not hitdata and not simdata and not recdata) or
238             (not hitdata and simdata and recdata) or
239             (hitdata and not simdata and recdata) or
240             (hitdata and simdata and not recdata) or
241             (hitdata and simdata and recdata)
242            )
243         {
244                 Logging(kHLTLogError,
245                         "AliHLTMUONTriggerRecordsSource::DoInit",
246                         "Missing arguments",
247                         "Must have one and only one of -hitdata, -simdata or -recdata specified."
248                 );
249                 return -EINVAL;
250         }
251         
252         // Must load the mapping data for AliMpTriggerCrate::GetDdlId()  //TODO AliMpTriggerCrate => AliMpDetElement
253         // to return useful information later on.
254         AliMpCDB::LoadDDLStore();
255         
256         // Now we can initialise the data interface objects and loaders.
257         fBuildFromHits = hitdata;
258         if (hitdata or simdata)
259         {
260                 const char* message = fBuildFromHits ?
261                         "Loading simulated GEANT hits with AliMUONMCDataInterface."
262                         : "Loading simulated local trigger objects with AliMUONMCDataInterface.";
263                                 
264                 Logging(kHLTLogDebug, "AliHLTMUONTriggerRecordsSource::DoInit",
265                         "Data interface", message
266                 );
267                 
268                 try
269                 {
270                         fMCDataInterface = new AliMUONMCDataInterface("galice.root");
271                 }
272                 catch (const std::bad_alloc&)
273                 {
274                         Logging(kHLTLogError,
275                                 "AliHLTMUONTriggerRecordsSource::DoInit",
276                                 "Out of memory",
277                                 "Not enough memory to allocate AliMUONMCDataInterface."
278                         );
279                         return -ENOMEM;
280                 }
281         }
282         else if (recdata)
283         {
284                 Logging(kHLTLogDebug,
285                         "AliHLTMUONTriggerRecordsSource::DoInit",
286                         "Data interface",
287                         "Loading reconstructed local trigger objects with AliMUONDataInterface."
288                 );
289                 
290                 try
291                 {
292                         fDataInterface = new AliMUONDataInterface("galice.root");
293                 }
294                 catch (const std::bad_alloc&)
295                 {
296                         Logging(kHLTLogError,
297                                 "AliHLTMUONTriggerRecordsSource::DoInit",
298                                 "Out of memory",
299                                 "Not enough memory to allocate AliMUONDataInterface."
300                         );
301                         return -ENOMEM;
302                 }
303         }
304         
305         // Check that the fCurrentEventIndex number falls within the correct range.
306         UInt_t maxevent = 0;
307         if (fMCDataInterface != NULL)
308                 maxevent = UInt_t(fMCDataInterface->NumberOfEvents());
309         else if (fDataInterface != NULL)
310                 maxevent = UInt_t(fDataInterface->NumberOfEvents());
311         if (fCurrentEventIndex != -1 and UInt_t(fCurrentEventIndex) >= maxevent and maxevent != 0)
312         {
313                 fCurrentEventIndex = 0;
314                 HLTWarning(Form("The selected first event number (%d) was larger than"
315                         " the available number of events (%d). Resetting the event"
316                         " counter to zero.", fCurrentEventIndex, maxevent
317                 ));
318         }
319         
320         return 0;
321 }
322
323
324 int AliHLTMUONTriggerRecordsSource::DoDeinit()
325 {
326         ///
327         /// Inherited from AliHLTComponent. Performs a cleanup of the component.
328         ///
329         
330         HLTInfo("Deinitialising dHLT trigger record source component.");
331         
332         if (fMCDataInterface != NULL)
333         {
334                 delete fMCDataInterface;
335                 fMCDataInterface = NULL;
336         }
337         if (fDataInterface != NULL)
338         {
339                 delete fDataInterface;
340                 fDataInterface = NULL;
341         }
342         return 0;
343 }
344
345
346 const char* AliHLTMUONTriggerRecordsSource::GetComponentID()
347 {
348         ///
349         /// Inherited from AliHLTComponent. Returns the component ID.
350         ///
351         
352         return AliHLTMUONConstants::TriggerRecordsSourceId();
353 }
354
355
356 AliHLTComponentDataType AliHLTMUONTriggerRecordsSource::GetOutputDataType()
357 {
358         ///
359         /// Inherited from AliHLTComponent. Returns the output data type.
360         ///
361         
362         return AliHLTMUONConstants::TriggerRecordsBlockDataType();
363 }
364
365
366 void AliHLTMUONTriggerRecordsSource::GetOutputDataSize(
367                 unsigned long& constBase, double& inputMultiplier
368         )
369 {
370         ///
371         /// Inherited from AliHLTComponent. Returns an estimate of the expected output data size.
372         ///
373         
374         constBase = sizeof(AliHLTMUONTriggerRecordsBlockStruct) +
375                 sizeof(AliHLTMUONTriggerRecordStruct) * AliMUONConstants::NTriggerCircuit();
376         inputMultiplier = 0;
377 }
378
379
380 AliHLTComponent* AliHLTMUONTriggerRecordsSource::Spawn()
381 {
382         ///
383         /// Inherited from AliHLTComponent. Creates a new object instance.
384         ///
385         
386         return new AliHLTMUONTriggerRecordsSource();
387 }
388
389
390 int AliHLTMUONTriggerRecordsSource::GetEvent(
391                 const AliHLTComponentEventData& evtData,
392                 AliHLTComponentTriggerData& /*trigData*/,
393                 AliHLTUInt8_t* outputPtr, 
394                 AliHLTUInt32_t& size,
395                 AliHLTComponentBlockDataList& outputBlocks
396         )
397 {
398         ///
399         /// Inherited from AliHLTOfflineDataSource. Creates new event data blocks.
400         ///
401         
402         assert( fMCDataInterface != NULL or fDataInterface != NULL );
403         
404         if (not IsDataEvent()) return 0;  // ignore non data events.
405
406         AliHLTInt32_t trigRecId = 0;
407
408         // Check the size of the event descriptor structure.
409         if (evtData.fStructSize < sizeof(AliHLTComponentEventData))
410         {
411                 Logging(kHLTLogError,
412                         "AliHLTMUONTriggerRecordsSource::GetEvent",
413                         "Invalid event descriptor",
414                         "The event descriptor (AliHLTComponentEventData) size is"
415                           " smaller than expected. It claims to be %d bytes, but"
416                           " we expect it to be %d bytes.",
417                         evtData.fStructSize,
418                         sizeof(AliHLTComponentEventData)
419                 );
420                 size = 0; // Important to tell framework that nothing was generated.
421                 return -EINVAL;
422         }
423         
424         // Use the fEventID as the event number to load if fCurrentEventIndex == -1,
425         // check it and load that event with the runloader.
426         // If fCurrentEventIndex is a positive number then use it instead and
427         // increment it.
428         UInt_t eventnumber = UInt_t(evtData.fEventID);
429         UInt_t maxevent = 0;
430         if (fMCDataInterface != NULL)
431                 maxevent = UInt_t(fMCDataInterface->NumberOfEvents());
432         else if (fDataInterface != NULL)
433                 maxevent = UInt_t(fDataInterface->NumberOfEvents());
434         if (fCurrentEventIndex != -1)
435         {
436                 eventnumber = UInt_t(fCurrentEventIndex);
437                 fCurrentEventIndex++;
438                 if (UInt_t(fCurrentEventIndex) >= maxevent)
439                         fCurrentEventIndex = 0;
440         }
441         if ( eventnumber >= maxevent )
442         {
443                 Logging(kHLTLogError,
444                         "AliHLTMUONTriggerRecordsSource::GetEvent",
445                         "Bad event ID",
446                         "The event number (%d) is larger than the available number"
447                           " of events on file (%d).",
448                         eventnumber,
449                         maxevent
450                 );
451                 size = 0; // Important to tell framework that nothing was generated.
452                 return -EINVAL;
453         }
454         
455         // Create and initialise a new data block.
456         AliHLTMUONTriggerRecordsBlockWriter block(outputPtr, size);
457         if (not block.InitCommonHeader())
458         {
459                 Logging(kHLTLogError,
460                         "AliHLTMUONTriggerRecordsSource::GetEvent",
461                         "Buffer too small",
462                         "There is not enough buffer space to create a new data block."
463                           " We require at least %d bytes but the buffer is only %d bytes.",
464                         sizeof(AliHLTMUONTriggerRecordsBlockWriter::HeaderType),
465                         block.BufferSize()
466                 );
467                 size = 0; // Important to tell framework that nothing was generated.
468                 return -ENOBUFS;
469         }
470         
471         // Initialise the DDL list containing the DDLs which contributed to the
472         // data block. These are required to create the specification word later.
473         bool ddlList[22];
474         for (Int_t i = 0; i < 22; i++)
475                 ddlList[i] = false;
476         
477         if (fMCDataInterface != NULL and fBuildFromHits)
478         {
479                 Logging(kHLTLogDebug,
480                         "AliHLTMUONTriggerRecordsSource::GetEvent",
481                         "Filling triggers",
482                         "Filling data block with trigger records from GEANT hits for event %d.",
483                         eventnumber
484                 );
485                 
486                 // Loop over all tracks, extract the hits from chambers 11 to 14 and
487                 // create trigger records from them to write to the data block.
488                 Int_t ntracks = fMCDataInterface->NumberOfTracks(eventnumber);
489                 for (Int_t i = 0; i < ntracks; ++i)
490                 {
491                         AliMUONHit* hit11 = NULL;
492                         AliMUONHit* hit12 = NULL;
493                         AliMUONHit* hit13 = NULL;
494                         AliMUONHit* hit14 = NULL;
495                         Int_t ddl11 = -1;
496                         Int_t ddl12 = -1;
497                         Int_t ddl13 = -1;
498                         Int_t ddl14 = -1;
499                         
500                         AliMUONVHitStore* hitStore = fMCDataInterface->HitStore(eventnumber,i);
501                         AliMUONHit* hit;
502                         TIter next(hitStore->CreateIterator());
503                         while ( ( hit = static_cast<AliMUONHit*>(next()) ) )
504                         {
505                                 // Select only hits on trigger chambers.
506                                 if (hit->Chamber() <= AliMUONConstants::NTrackingCh()) continue;
507                                 
508                                 // Only select hits from the given part of the plane
509                                 if (fSelection == kLeftPlane and not (hit->Xref() < 0)) continue;
510                                 if (fSelection == kRightPlane and not (hit->Xref() >= 0)) continue;
511                                 
512                                 // Workout which DDL this hit should be readout of.
513                                 Int_t ddl = FindDDLOfDetElement(hit->DetElemId());
514                                 if (not (0 <= ddl and ddl < 22))
515                                 {
516                                         ddl = -1;
517                                         Logging(kHLTLogError,
518                                                 "AliHLTMUONTriggerRecordsSource::GetEvent",
519                                                 "No DDL ID",
520                                                 "Could not find the DDL ID from which readout would take place."
521                                         );
522                                 }
523                                 
524                                 switch (hit->Chamber())
525                                 {
526                                 case 11: hit11 = hit; ddl11 = ddl; break;
527                                 case 12: hit12 = hit; ddl12 = ddl; break;
528                                 case 13: hit13 = hit; ddl13 = ddl; break;
529                                 case 14: hit14 = hit; ddl14 = ddl; break;
530                                 default: break;
531                                 }
532                         }
533                         
534                         // Check that there are at least 3 of 4 hits on the trigger chambers.
535                         Int_t hitCount = 0;
536                         if (hit11 != NULL) hitCount++;
537                         if (hit12 != NULL) hitCount++;
538                         if (hit13 != NULL) hitCount++;
539                         if (hit14 != NULL) hitCount++;
540                         if (hitCount < 3) continue;
541                                 
542                         AliHLTMUONTriggerRecordStruct* trigRec = block.AddEntry();
543                         if (trigRec == NULL)
544                         {
545                                 Logging(kHLTLogError,
546                                         "AliHLTMUONTriggerRecordsSource::GetEvent",
547                                         "Buffer overflow",
548                                         "There is not enough buffer space to add more trigger records."
549                                           " We overflowed the buffer which is only %d bytes.",
550                                         block.BufferSize()
551                                 );
552                                 size = 0; // Important to tell framework that nothing was generated.
553                                 return -ENOBUFS;
554                         }
555                         
556                         // Fill the new trigger record with the hit information.
557                         bool hitset[4] = {false, false, false, false};
558                         AliHLTFloat32_t x1 = 0, y1 = 0, y2 = 0, z1 = 0, z2 = 0;
559                         if (hit11 != NULL)
560                         {
561                                 trigRec->fHit[0].fX = hit11->Xref();
562                                 trigRec->fHit[0].fY = hit11->Yref();
563                                 trigRec->fHit[0].fZ = hit11->Zref();
564                                 hitset[0] = true;
565                                 x1 = hit11->Xref();
566                                 y1 = hit11->Yref();
567                                 z1 = hit11->Zref();
568                         }
569                         if (hit12 != NULL)
570                         {
571                                 trigRec->fHit[1].fX = hit12->Xref();
572                                 trigRec->fHit[1].fY = hit12->Yref();
573                                 trigRec->fHit[1].fZ = hit12->Zref();
574                                 hitset[1] = true;
575                                 x1 = hit12->Xref();
576                                 y1 = hit12->Yref();
577                                 z1 = hit12->Zref();
578                         }
579                         if (hit13 != NULL)
580                         {
581                                 trigRec->fHit[2].fX = hit13->Xref();
582                                 trigRec->fHit[2].fY = hit13->Yref();
583                                 trigRec->fHit[2].fZ = hit13->Zref();
584                                 hitset[2] = true;
585                                 y2 = hit13->Yref();
586                                 z2 = hit13->Zref();
587                         }
588                         if (hit14 != NULL)
589                         {
590                                 trigRec->fHit[3].fX = hit14->Xref();
591                                 trigRec->fHit[3].fY = hit14->Yref();
592                                 trigRec->fHit[3].fZ = hit14->Zref();
593                                 hitset[3] = true;
594                                 y2 = hit14->Yref();
595                                 z2 = hit14->Zref();
596                         }
597                         
598                         bool calculated = AliHLTMUONCalculations::ComputeMomentum(x1, y1, y2, z1, z2);
599                         if (not calculated)
600                                 Logging(kHLTLogDebug,
601                                         "AliHLTMUONTriggerRecordsSource::GetEvent",
602                                         "Calculation failure",
603                                         "Something went wrong when calculating the momentum from"
604                                           " x1 = %f, y1 = %f, y2 = %f, z1 = %f, z2 = %f.",
605                                         x1, y1, y2, z1, z2
606                                 );
607                         
608                         trigRec->fId = trigRecId++;
609                         trigRec->fFlags = AliHLTMUONUtils::PackTriggerRecordFlags(
610                                         AliHLTMUONCalculations::Sign(), hitset
611                                 );
612                         trigRec->fPx = AliHLTMUONCalculations::Px();
613                         trigRec->fPy = AliHLTMUONCalculations::Py();
614                         trigRec->fPz = AliHLTMUONCalculations::Pz();
615                         
616                         // Mark the DDLs over which this trigger record would be readout.
617                         if (ddl11 != -1) ddlList[ddl11] = true;
618                         if (ddl12 != -1) ddlList[ddl12] = true;
619                         if (ddl13 != -1) ddlList[ddl13] = true;
620                         if (ddl14 != -1) ddlList[ddl14] = true;
621                 }
622         }
623         else if (fMCDataInterface != NULL and not fBuildFromHits)
624         {
625                 Logging(kHLTLogDebug,
626                         "AliHLTMUONTriggerRecordsSource::GetEvent",
627                         "Filling triggers",
628                         "Filling data block with simulated local triggers for event %d.",
629                         eventnumber
630                 );
631                 
632                 AliFatal("Sorry, -simdata option not yet implemented!");
633                 // TODO
634         }
635         else if (fDataInterface != NULL)
636         {
637                 Logging(kHLTLogDebug,
638                         "AliHLTMUONTriggerRecordsSource::GetEvent",
639                         "Filling triggers",
640                         "Filling data block with reconstructed local triggers for event %d.",
641                         eventnumber
642                 );
643                 // TODO
644                 AliFatal("Sorry, -recdata option not yet implemented!");
645         }
646         else
647         {
648                 Logging(kHLTLogError,
649                         "AliHLTMUONTriggerRecordsSource::GetEvent",
650                         "Missing data interface",
651                         "Neither AliMUONDataInterface nor AliMUONMCDataInterface were created."
652                 );
653                 size = 0; // Important to tell framework that nothing was generated.
654                 return -EFAULT;
655         }
656         
657         AliHLTComponentBlockData bd;
658         FillBlockData(bd);
659         bd.fPtr = outputPtr;
660         bd.fOffset = 0;
661         bd.fSize = block.BytesUsed();
662         bd.fDataType = AliHLTMUONConstants::TriggerRecordsBlockDataType();
663         bd.fSpecification = AliHLTMUONUtils::PackSpecBits(ddlList);
664         outputBlocks.push_back(bd);
665         size = block.BytesUsed();
666
667         return 0;
668 }