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 "AliCodeTimer.h"
22 #include "AliMUON2DMap.h"
23 #include "AliMUONCalibParamND.h"
24 #include "AliMUONCalibrationData.h"
25 #include "AliMUONDigitCalibrator.h"
26 #include "AliMUONDigitMaker.h"
27 #include "AliMUONDigitStoreV2R.h"
28 #include "AliMUONTrackerData.h"
29 #include "AliMUONVDigit.h"
30 #include "AliMUONVDigitStore.h"
31 #include "AliMpDDLStore.h"
32 #include "AliCDBManager.h"
33 #include "AliCDBStorage.h"
34 #include "AliRawEventHeaderBase.h"
35 #include "AliRawReader.h"
37 #include <Riostream.h>
38 #include "AliMUONRawStreamTracker.h"
40 ///\class AliMUONTrackerRawDataMaker
42 /// Creator of raw AliMUONVTrackerData from AliRawReader
44 ///\author Laurent Aphecetche, Subatech
47 ClassImp(AliMUONTrackerRawDataMaker)
50 Int_t AliMUONTrackerRawDataMaker::fgkCounter(0);
52 //_____________________________________________________________________________
53 AliMUONTrackerRawDataMaker::AliMUONTrackerRawDataMaker(AliRawReader* reader, Bool_t histogram)
54 : AliMUONVTrackerDataMaker(),
56 fAccumulatedData(0x0),
57 fOneEventData(new AliMUON2DMap(true)),
59 fSource("unspecified"),
64 reader->NextEvent(); // to be sure to get run number available
66 Int_t runNumber = reader->GetRunNumber();
73 name = Form("%sRAW(%d)",(histogram?"H":""),fgkCounter);
77 name = Form("%sRAW%d",(histogram?"H":""),runNumber);
80 fAccumulatedData = new AliMUONTrackerData(name.Data(),"charge values",1);
81 fAccumulatedData->SetDimensionName(0,"Raw charge");
84 fAccumulatedData->MakeHistogramForDimension(0,kTRUE);
87 reader->RewindEvents();
90 //_____________________________________________________________________________
91 AliMUONTrackerRawDataMaker::~AliMUONTrackerRawDataMaker()
95 if ( fIsOwner ) delete fAccumulatedData;
98 //_____________________________________________________________________________
100 AliMUONTrackerRawDataMaker::NextEvent()
104 AliCodeTimerAuto("");
106 static Int_t nphysics(0);
107 static Int_t ngood(0);
109 fOneEventData->Clear();
111 if ( !IsRunning() ) return kTRUE;
113 Bool_t ok = fRawReader->NextEvent();
120 Int_t eventType = fRawReader->GetType();
124 if (eventType != AliRawEventHeaderBase::kPhysicsEvent )
126 return kTRUE; // for the moment
131 AliMUONVRawStreamTracker* stream = new AliMUONRawStreamTracker(fRawReader);
140 while ( stream->Next(buspatchId,manuId,manuChannel,adc) )
142 Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromBus(buspatchId);
144 AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(fOneEventData->FindObject(detElemId,manuId));
147 param = new AliMUONCalibParamND(1,64,detElemId,manuId,
148 AliMUONVCalibParam::InvalidFloatValue());
149 fOneEventData->Add(param);
152 param->SetValueAsDouble(manuChannel,0,adc);
155 if ( !stream->IsErrorMessage() )
158 fAccumulatedData->Add(*fOneEventData);
161 AliDebug(1,Form("n %10d nphysics %10d ngood %10d",fNumberOfEvents,nphysics,ngood));
168 //_____________________________________________________________________________
170 AliMUONTrackerRawDataMaker::Print(Option_t*) const
174 cout << "Source=" << Source() << " Running=" << ( IsRunning() ? "YES" : "NO")
179 //_____________________________________________________________________________
181 AliMUONTrackerRawDataMaker::Rewind()
184 fRawReader->RewindEvents();