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 "AliPHOSConTableDB.h"
40 #include "AliPHOSDigit.h"
45 #include "AliPHOSevent.h"
48 ClassImp(AliPHOSRawStream)
50 //_____________________________________________________________________________
51 AliPHOSRawStream::AliPHOSRawStream(AliRawReader* rawReader) : TObject()
53 fRawReader = rawReader ;
56 //_____________________________________________________________________________
57 Bool_t AliPHOSRawStream::ReadDigits(TClonesArray * digits){
59 Bool_t isOK = kFALSE ;
61 Error("ReadDigits","Connection table not set") ;
66 Error("ReadDigits","Output array not created") ;
70 if(!(digits->GetClass()->InheritsFrom("AliPHOSDigit"))){
71 Error("ReadDigits","Digits contanier made for %s, not AliPHOSDigits",digits->GetClass()->GetName()) ;
77 //Check, if current event - PHYSICS event
78 if(!((fRawReader->GetType() & EVENT_TYPE_MASK)==PHYSICS_EVENT)){
82 //Scan subevents until subevent with digits
83 while(fRawReader->ReadNextData(fData)){
84 switch (fRawReader->GetEquipmentType()){
86 if(fRawReader->GetEquipmentId() == kPattUnitEquipId){ //Read PHOS trigger
87 Int_t * patt = (Int_t *)fData;
88 if(fRawReader->GetEquipmentSize() >= (Int_t)sizeof(Int_t))
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) ;
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) ;
107 digits->Expand(digits->GetEntriesFast()) ;
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) ;
119 if(fRawReader->GetEquipmentId() == kTdcEquipId){
120 // Probably sometime we will need to handle these data
123 case kChargeAdcMarker:
124 if(fRawReader->GetEquipmentId() == kChargeAdcEquipId){
125 //Probably sometime we will need to handle these data
129 if(fRawReader->GetEquipmentId() == kScalerEquipId){
130 //Probably sometime we will need to handle these data