]>
Commit | Line | Data |
---|---|---|
65792ca0 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | /// | |
20 | /// This class provides access to PHOS digits in raw data. | |
21 | /// | |
22 | /// It loops over all PHOS digits in the raw data given by the AliRawReader. | |
23 | /// The Next method goes to the next digit. If there are no digits left | |
24 | /// it returns kFALSE. | |
25 | /// Several getters provide information about the current digit. | |
b7f3cbac | 26 | /// usage: |
27 | /// root > AliRawReaderFile rawReader ; | |
28 | /// root > AliPHOSRawStream input(&rawReader) ; | |
29 | /// root > while (input.Next()) ..... | |
65792ca0 | 30 | /////////////////////////////////////////////////////////////////////////////// |
31 | ||
c2b19535 | 32 | #include "TClonesArray.h" |
33 | #include "TClass.h" | |
34 | ||
35 | ||
36 | ||
65792ca0 | 37 | #include "AliPHOSRawStream.h" |
38 | #include "AliRawReader.h" | |
c2b19535 | 39 | #include "AliPHOSConTableDB.h" |
40 | #include "AliPHOSDigit.h" | |
65792ca0 | 41 | |
c2b19535 | 42 | #ifdef ALI_DATE |
43 | #include "event.h" | |
44 | #else | |
45 | #include "AliPHOSevent.h" | |
46 | #endif | |
65792ca0 | 47 | |
c2b19535 | 48 | ClassImp(AliPHOSRawStream) |
65792ca0 | 49 | |
50 | //_____________________________________________________________________________ | |
c2b19535 | 51 | AliPHOSRawStream::AliPHOSRawStream(AliRawReader* rawReader) : TObject() |
65792ca0 | 52 | { |
c2b19535 | 53 | fRawReader = rawReader ; |
54 | fctdb = 0 ; | |
55 | } | |
56 | //_____________________________________________________________________________ | |
57 | Bool_t AliPHOSRawStream::ReadDigits(TClonesArray * digits){ | |
58 | ||
59 | Bool_t isOK = kFALSE ; | |
60 | if(!fctdb){ | |
61 | Error("ReadDigits","Connection table not set") ; | |
62 | return kFALSE ; | |
63 | } | |
65792ca0 | 64 | |
c2b19535 | 65 | if(!digits){ |
66 | Error("ReadDigits","Output array not created") ; | |
67 | return kFALSE ; | |
68 | } | |
69 | ||
70 | if(!(digits->GetClass()->InheritsFrom("AliPHOSDigit"))){ | |
71 | Error("ReadDigits","Digits contanier made for %s, not AliPHOSDigits",digits->GetClass()->GetName()) ; | |
72 | return kFALSE ; | |
73 | } | |
74 | ||
75 | digits->Clear() ; | |
76 | ||
77 | //Check, if current event - PHYSICS event | |
78 | if(!((fRawReader->GetType() & EVENT_TYPE_MASK)==PHYSICS_EVENT)){ | |
79 | return kFALSE ; | |
80 | } | |
81 | ||
82 | //Scan subevents until subevent with digits | |
83 | while(fRawReader->ReadNextData(fData)){ | |
84 | switch (fRawReader->GetEquipmentType()){ | |
85 | case kPattUnitMarker: | |
86 | if(fRawReader->GetEquipmentId() == kPattUnitEquipId){ //Read PHOS trigger | |
87 | Int_t * patt = (Int_t *)fData; | |
88 | if(fRawReader->GetEquipmentSize() >= (Int_t)sizeof(Int_t)) | |
89 | fTrig = patt[0]; | |
90 | else | |
91 | fTrig = 0 ; | |
92 | } | |
93 | break; | |
94 | case kPhosAdcMarker: | |
95 | if(fRawReader->GetEquipmentId() == kPhosAdcEquipId){ | |
96 | Int_t ndigits = fRawReader->GetEquipmentSize()/sizeof(Int_t); | |
97 | digits->Expand(ndigits) ; | |
98 | for(Int_t i=0; i<ndigits; i++){ | |
99 | Int_t * amps = (Int_t *)fData ; | |
100 | Int_t absID = fctdb->Raw2AbsId(i) ; | |
101 | Int_t time = 0; | |
102 | if(absID>0) //Only real digits are filled, last ADC numbers (if any) are scipped | |
103 | new((*digits)[i]) AliPHOSDigit( -1, absID, amps[i], time) ; | |
104 | } | |
105 | digits->Sort() ; | |
106 | digits->Compress() ; | |
107 | digits->Expand(digits->GetEntriesFast()) ; | |
108 | ||
109 | //Set indexes in list of digits and make true digitization of the energy | |
110 | for (Int_t id = 0 ; id < digits->GetEntriesFast() ; id++) { | |
111 | AliPHOSDigit * digit = dynamic_cast<AliPHOSDigit*>( digits->At(id) ) ; | |
112 | digit->SetIndexInList(id) ; | |
113 | } | |
114 | ||
115 | isOK = kTRUE ; | |
116 | } | |
117 | break; | |
118 | case kTdcMarker: | |
119 | if(fRawReader->GetEquipmentId() == kTdcEquipId){ | |
120 | // Probably sometime we will need to handle these data | |
121 | } | |
122 | break; | |
123 | case kChargeAdcMarker: | |
124 | if(fRawReader->GetEquipmentId() == kChargeAdcEquipId){ | |
125 | //Probably sometime we will need to handle these data | |
126 | } | |
127 | break; | |
128 | case kScalerMarker: | |
129 | if(fRawReader->GetEquipmentId() == kScalerEquipId){ | |
130 | //Probably sometime we will need to handle these data | |
131 | } | |
132 | break; | |
133 | default: | |
134 | break; | |
135 | } | |
136 | } | |
137 | return isOK ; | |
65792ca0 | 138 | } |
c2b19535 | 139 |