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 #include "AliMUONTrackerRawDataMaker.h"
20 #include "AliCDBManager.h"
21 #include "AliCDBStorage.h"
22 #include "AliCodeTimer.h"
25 #include "AliMUON2DMap.h"
26 #include "AliMUONCalibParamND.h"
27 #include "AliMUONCalibrationData.h"
28 #include "AliMUONDigitCalibrator.h"
29 #include "AliMUONDigitMaker.h"
30 #include "AliMUONDigitStoreV2R.h"
31 #include "AliMUONRawStreamTracker.h"
32 #include "AliMUONRawStreamTrackerHP.h"
33 #include "AliMUONTrackerData.h"
34 #include "AliMUONVDigit.h"
35 #include "AliMUONVDigitStore.h"
36 #include "AliMpDDLStore.h"
37 #include "AliRawEventHeaderBase.h"
38 #include "AliRawReader.h"
39 #include <Riostream.h>
41 ///\class AliMUONTrackerRawDataMaker
43 /// Creator of raw AliMUONVTrackerData from AliRawReader
45 ///\author Laurent Aphecetche, Subatech
48 ClassImp(AliMUONTrackerRawDataMaker)
51 Int_t AliMUONTrackerRawDataMaker::fgkCounter(0);
53 //_____________________________________________________________________________
54 AliMUONTrackerRawDataMaker::AliMUONTrackerRawDataMaker(AliRawReader* reader,
57 : AliMUONVTrackerDataMaker(),
59 fAccumulatedData(0x0),
60 fOneEventData(new AliMUON2DMap(true)),
61 fSource("unspecified"),
65 fIsEventByEvent(kFALSE),
66 fUseHPDecoder(useHPdecoder)
72 fRawReader->NextEvent(); // to be sure to get run number available
73 fRunNumber = fRawReader->GetRunNumber();
74 fRawReader->RewindEvents();
82 name = Form("%sRAW(%d)",(histogram?"H":""),fgkCounter);
86 name = Form("%sRAW%d",(histogram?"H":""),fRunNumber);
89 fAccumulatedData = new AliMUONTrackerData(name.Data(),"charge values",1);
90 fAccumulatedData->SetDimensionName(0,"Raw charge");
93 fAccumulatedData->MakeHistogramForDimension(0,kTRUE);
97 //_____________________________________________________________________________
98 AliMUONTrackerRawDataMaker::~AliMUONTrackerRawDataMaker()
101 delete fOneEventData;
102 delete fAccumulatedData;
106 //_____________________________________________________________________________
108 AliMUONTrackerRawDataMaker::Merge(TCollection*)
110 /// Merge objects in collection
112 // AliRawReader* fRawReader; //!< reader of the data (owner)
113 // AliMUONVTrackerData* fAccumulatedData; ///< data (owner)
114 // AliMUONVStore* fOneEventData; ///< data for one event (owner)
115 // TString fSource; ///< where the data comes from
116 // Bool_t fIsRunning; ///< whether we are running or are paused
117 // Int_t fNumberOfEvents; ///< number of events seen
118 // Int_t fRunNumber; ///< run number of the data
119 // Bool_t fIsEventByEvent; ///< we only keep one event's data (no accumulation)
120 // Bool_t fUseHPDecoder; ///< whether to use high performance decoder or not (false by default)
122 AliError("Not implemented yet");
126 //_____________________________________________________________________________
128 AliMUONTrackerRawDataMaker::NextEvent()
132 AliCodeTimerAuto("");
134 static Int_t nphysics(0);
135 static Int_t ngood(0);
137 fOneEventData->Clear();
139 if ( !IsRunning() ) return kTRUE;
141 Bool_t ok = fRawReader->NextEvent();
148 Int_t eventType = fRawReader->GetType();
152 if (eventType != AliRawEventHeaderBase::kPhysicsEvent )
154 return kTRUE; // for the moment
159 AliMUONVRawStreamTracker* stream = 0x0;
163 stream = new AliMUONRawStreamTrackerHP(fRawReader);
167 stream = new AliMUONRawStreamTracker(fRawReader);
177 while ( stream->Next(buspatchId,manuId,manuChannel,adc) )
179 Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromBus(buspatchId);
181 AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(fOneEventData->FindObject(detElemId,manuId));
184 param = new AliMUONCalibParamND(1,64,detElemId,manuId,
185 AliMUONVCalibParam::InvalidFloatValue());
186 fOneEventData->Add(param);
189 param->SetValueAsDouble(manuChannel,0,adc);
192 if ( !stream->IsErrorMessage() )
195 fAccumulatedData->Add(*fOneEventData);
198 AliDebug(1,Form("n %10d nphysics %10d ngood %10d",fNumberOfEvents,nphysics,ngood));
205 //_____________________________________________________________________________
207 AliMUONTrackerRawDataMaker::Print(Option_t*) const
211 cout << "Source=" << Source() << " Running=" << ( IsRunning() ? "YES" : "NO")
216 //_____________________________________________________________________________
218 AliMUONTrackerRawDataMaker::Rewind()
221 fRawReader->RewindEvents();