1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 /// This class provides access to PHOS digits in raw data.
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.
27 /// root > AliRawReaderFile rawReader ;
28 /// root > AliPHOSRawStream2004 input(&rawReader) ;
29 /// root > while (input.Next()) .....
30 ///////////////////////////////////////////////////////////////////////////////
32 #include "TClonesArray.h"
35 #include "AliPHOSRawStream2004.h"
36 #include "AliRawReader.h"
37 #include "AliRawEventHeaderBase.h"
38 #include "AliPHOSConTableDB.h"
39 #include "AliPHOSDigit.h"
41 #define EVENT_TYPE_MASK ((UInt_t)0x0000FFFF)
43 ClassImp(AliPHOSRawStream2004)
45 //_____________________________________________________________________________
46 AliPHOSRawStream2004::AliPHOSRawStream2004(AliRawReader* rawReader) :
47 fRawReader(rawReader),
55 //_____________________________________________________________________________
56 AliPHOSRawStream2004::AliPHOSRawStream2004(const AliPHOSRawStream2004 & rhs) :
58 fRawReader(rhs.fRawReader),
66 //_____________________________________________________________________________
67 AliPHOSRawStream2004 & AliPHOSRawStream2004::operator = (const AliPHOSRawStream2004 &rhs)
69 TObject::operator = (rhs);
70 fRawReader = rhs.fRawReader;
78 //_____________________________________________________________________________
79 Bool_t AliPHOSRawStream2004::ReadDigits(TClonesArray * digits){
81 Bool_t isOK = kFALSE ;
83 Error("ReadDigits","Connection table not set") ;
88 Error("ReadDigits","Output array not created") ;
92 if(!(digits->GetClass()->InheritsFrom("AliPHOSDigit"))){
93 Error("ReadDigits","Digits contanier made for %s, not AliPHOSDigits",digits->GetClass()->GetName()) ;
99 //Check, if current event - PHYSICS event
100 if(!((fRawReader->GetType() & EVENT_TYPE_MASK)==AliRawEventHeaderBase::kPhysicsEvent)){
104 //Scan subevents until subevent with digits
105 while(fRawReader->ReadNextData(fData)){
106 switch (fRawReader->GetEquipmentType()){
107 case kPattUnitMarker:
108 if(fRawReader->GetEquipmentId() == kPattUnitEquipId){ //Read PHOS trigger
109 Int_t * patt = (Int_t *)fData;
110 if(fRawReader->GetEquipmentSize() >= (Int_t)sizeof(Int_t))
117 if(fRawReader->GetEquipmentId() == kPhosAdcEquipId){
118 Int_t ndigits = fRawReader->GetEquipmentSize()/sizeof(Int_t);
119 digits->Expand(ndigits) ;
120 for(Int_t i=0; i<ndigits; i++){
121 Int_t * amps = (Int_t *)fData ;
122 Int_t absID = fctdb->Raw2AbsId(i) ;
124 if(absID>0) //Only real digits are filled, last ADC numbers (if any) are scipped
125 new((*digits)[i]) AliPHOSDigit( -1, absID, amps[i], time) ;
129 digits->Expand(digits->GetEntriesFast()) ;
131 //Set indexes in list of digits and make true digitization of the energy
132 for (Int_t id = 0 ; id < digits->GetEntriesFast() ; id++) {
133 AliPHOSDigit * digit = dynamic_cast<AliPHOSDigit*>( digits->At(id) ) ;
134 digit->SetIndexInList(id) ;
141 if(fRawReader->GetEquipmentId() == kTdcEquipId){
142 // Probably sometime we will need to handle these data
145 case kChargeAdcMarker:
146 if(fRawReader->GetEquipmentId() == kChargeAdcEquipId){
147 //Probably sometime we will need to handle these data
151 if(fRawReader->GetEquipmentId() == kScalerEquipId){
152 //Probably sometime we will need to handle these data