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 > AliPHOSRawStream input(&rawReader) ;
29 /// root > while (input.Next()) .....
30 ///////////////////////////////////////////////////////////////////////////////
32 #include "TClonesArray.h"
37 #include "AliPHOSRawStream.h"
38 #include "AliRawReader.h"
39 #include "AliRawEventHeader.h"
40 #include "AliPHOSConTableDB.h"
41 #include "AliPHOSDigit.h"
43 #define EVENT_TYPE_MASK ((UInt_t)0x0000FFFF)
45 ClassImp(AliPHOSRawStream)
47 //_____________________________________________________________________________
48 AliPHOSRawStream::AliPHOSRawStream(AliRawReader* rawReader) : TObject()
50 fRawReader = rawReader ;
53 //_____________________________________________________________________________
54 Bool_t AliPHOSRawStream::ReadDigits(TClonesArray * digits){
56 Bool_t isOK = kFALSE ;
58 Error("ReadDigits","Connection table not set") ;
63 Error("ReadDigits","Output array not created") ;
67 if(!(digits->GetClass()->InheritsFrom("AliPHOSDigit"))){
68 Error("ReadDigits","Digits contanier made for %s, not AliPHOSDigits",digits->GetClass()->GetName()) ;
74 //Check, if current event - PHYSICS event
75 if(!((fRawReader->GetType() & EVENT_TYPE_MASK)==AliRawEventHeader::kPhysicsEvent)){
79 //Scan subevents until subevent with digits
80 while(fRawReader->ReadNextData(fData)){
81 switch (fRawReader->GetEquipmentType()){
83 if(fRawReader->GetEquipmentId() == kPattUnitEquipId){ //Read PHOS trigger
84 Int_t * patt = (Int_t *)fData;
85 if(fRawReader->GetEquipmentSize() >= (Int_t)sizeof(Int_t))
92 if(fRawReader->GetEquipmentId() == kPhosAdcEquipId){
93 Int_t ndigits = fRawReader->GetEquipmentSize()/sizeof(Int_t);
94 digits->Expand(ndigits) ;
95 for(Int_t i=0; i<ndigits; i++){
96 Int_t * amps = (Int_t *)fData ;
97 Int_t absID = fctdb->Raw2AbsId(i) ;
99 if(absID>0) //Only real digits are filled, last ADC numbers (if any) are scipped
100 new((*digits)[i]) AliPHOSDigit( -1, absID, amps[i], time) ;
104 digits->Expand(digits->GetEntriesFast()) ;
106 //Set indexes in list of digits and make true digitization of the energy
107 for (Int_t id = 0 ; id < digits->GetEntriesFast() ; id++) {
108 AliPHOSDigit * digit = dynamic_cast<AliPHOSDigit*>( digits->At(id) ) ;
109 digit->SetIndexInList(id) ;
116 if(fRawReader->GetEquipmentId() == kTdcEquipId){
117 // Probably sometime we will need to handle these data
120 case kChargeAdcMarker:
121 if(fRawReader->GetEquipmentId() == kChargeAdcEquipId){
122 //Probably sometime we will need to handle these data
126 if(fRawReader->GetEquipmentId() == kScalerEquipId){
127 //Probably sometime we will need to handle these data