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 "AliMUONTrackerData.h"
20 #include "AliCodeTimer.h"
22 #include "AliMUON1DArray.h"
23 #include "AliMUON1DMap.h"
24 #include "AliMUON2DMap.h"
25 #include "AliMUONCalibParamND.h"
26 #include "AliMUONSparseHisto.h"
27 #include "AliMUONVStore.h"
28 #include "AliMpBusPatch.h"
29 #include "AliMpConstants.h"
30 #include "AliMpDDLStore.h"
31 #include "AliMpDEIterator.h"
32 #include "AliMpDEManager.h"
33 #include "AliMpDetElement.h"
34 #include "AliMpHVNamer.h"
35 #include "AliMpManuIterator.h"
36 #include <Riostream.h>
38 #include <TObjArray.h>
39 #include <TObjString.h>
44 /// \class AliMUONTrackerData
46 /// Implementation of AliMUONVTrackerData class
48 /// \author Laurent Aphecetche, Subatech
51 ClassImp(AliMUONTrackerData)
54 const Int_t AliMUONTrackerData::fgkExtraDimension = 2;
55 const Int_t AliMUONTrackerData::fgkVirtualExtraDimension = 1;
57 //_____________________________________________________________________________
58 AliMUONTrackerData::AliMUONTrackerData(const char* name, const char* title,
61 : AliMUONVTrackerData(name,title),
62 fIsSingleEvent(issingleevent),
69 fDimension(External2Internal(dimension)+fgkExtraDimension),
71 fDimensionNames(new TObjArray(fDimension+fgkVirtualExtraDimension)),
72 fExternalDimensionNames(new TObjArray(dimension)),
73 fExternalDimension(dimension),
74 fHistogramming(new Int_t[fExternalDimension]),
80 memset(fHistogramming,0,sizeof(Int_t)); // histogramming is off by default. Use MakeHistogramForDimension to turn it on.
81 fExternalDimensionNames->SetOwner(kTRUE);
82 fDimensionNames->SetOwner(kTRUE);
83 fDimensionNames->AddAt(new TObjString("occ"),IndexOfOccupancyDimension());
84 fDimensionNames->AddAt(new TObjString("N"),IndexOfNumberDimension());
85 fDimensionNames->AddAt(new TObjString("n"),NumberOfDimensions()-fgkVirtualExtraDimension);
89 //_____________________________________________________________________________
90 AliMUONTrackerData::~AliMUONTrackerData()
93 delete fChannelValues;
95 delete fBusPatchValues;
97 delete fChamberValues;
99 delete fDimensionNames;
100 delete fExternalDimensionNames;
101 delete[] fHistogramming;
102 delete fChannelHistos;
105 //_____________________________________________________________________________
107 AliMUONTrackerData::Add(const AliMUONVStore& store)
109 /// Add the given external store to our internal store
111 AliCodeTimerAuto(GetName());
113 if ( IsSingleEvent() && fNevents == 1 )
115 AliError(Form("%s is supposed to be single event only",GetName()));
121 NumberOfEventsChanged();
125 Int_t numberOfBusPatches(0);
126 Int_t numberOfDEs(0);
128 // get number of bus patches and number of detection element
129 // to initialize fBusPatchValues and fDEValues below
131 TExMapIter it(AliMpDDLStore::Instance()->GetBusPatchesIterator());
133 while ( it.Next(key,value) ) ++numberOfBusPatches;
134 AliMpDEIterator deIt;
136 while (!deIt.IsDone())
142 fChannelValues = new AliMUON2DMap(kTRUE);
143 fManuValues = new AliMUON2DMap(kTRUE);
144 fPCBValues = new AliMUON2DMap(kFALSE);
145 fBusPatchValues = new AliMUON1DMap(numberOfBusPatches);
146 fDEValues = new AliMUON1DMap(numberOfDEs);
147 fChamberValues = new AliMUON1DArray;
150 TIter next(store.CreateIterator());
151 AliMUONVCalibParam* external;
155 if ( IsSingleEvent() ) nk = 1;
157 while ( ( external = static_cast<AliMUONVCalibParam*>(next()) ) )
159 if ( external->Dimension() != ExternalDimension() )
161 AliError(Form("Incompatible dimensions %d vs %d",
162 external->Dimension(),ExternalDimension()));
167 AliMUONVCalibParam* chamber, *de, *busPatch, *pcb, *manu, *channel;
168 AliMpDetElement* mpde;
170 Int_t manuId = GetParts(external,chamber,de,busPatch,pcb,manu,channel,mpde);
172 if ( manuId < 0 ) continue;
174 Int_t detElemId = mpde->GetId();
176 Double_t value[] = { 0.0, 0.0 };
178 Int_t nch = mpde->NofChannelsInManu(manuId);
180 for ( Int_t i = 0; i < external->Size(); ++i )
182 Bool_t existingChannel = ( nch == AliMpConstants::ManuNofChannels() ? kTRUE
183 : mpde->IsConnectedChannel(manuId,i));
184 // note we only use IsConnectedChannel method when really needed, as
185 // it costs (some) CPU time...
187 if ( existingChannel )
189 Bool_t validChannel(kFALSE);
191 for ( Int_t j = 0; j < external->Dimension(); ++j )
193 Double_t vext = external->IsDoublePrecision() ?
194 external->ValueAsDoubleFast(i,j) :
195 external->ValueAsFloatFast(i,j);
197 if ( vext >= AliMUONVCalibParam::InvalidFloatValue() ) continue;
199 validChannel = kTRUE;
201 Int_t ix = External2Internal(j);
204 value[1] = vext*vext;
206 if ( IsHistogrammed(j) )
208 FillChannel(detElemId,manuId,i,j,vext);
211 for ( Int_t k = 0; k < nk; ++k )
213 channel->SetValueAsDoubleFast(i,ix+k,channel->ValueAsDoubleFast(i,ix+k)+value[k]);
215 manu->SetValueAsDoubleFast(0,ix+k,manu->ValueAsDoubleFast(0,ix+k)+value[k]);
217 busPatch->SetValueAsDoubleFast(0,ix+k,busPatch->ValueAsDoubleFast(0,ix+k)+value[k]);
219 de->SetValueAsDoubleFast(0,ix+k,de->ValueAsDoubleFast(0,ix+k)+value[k]);
221 chamber->SetValueAsDoubleFast(0,ix+k,chamber->ValueAsDoubleFast(0,ix+k)+value[k]);
225 pcb->SetValueAsDoubleFast(0,ix+k,pcb->ValueAsDoubleFast(0,ix+k)+value[k]);
232 channel->SetValueAsDoubleFast(i,IndexOfOccupancyDimension(),
233 channel->ValueAsDoubleFast(i,IndexOfOccupancyDimension())+1.0);
234 manu->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
235 manu->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
236 busPatch->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
237 busPatch->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
238 de->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
239 de->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
240 chamber->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
241 chamber->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
244 pcb->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
245 pcb->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
255 //_____________________________________________________________________________
257 AliMUONTrackerData::BusPatch(Int_t busPatchId, Int_t dim) const
259 /// Return the value of a given buspatch for a given dimension
260 /// or 0 if not existing
261 AliMUONVCalibParam* param = BusPatchParam(busPatchId);
262 return param ? Value(*param,0,dim) : 0.0;
265 //_____________________________________________________________________________
267 AliMUONTrackerData::BusPatchParam(Int_t busPatchId, Bool_t create) const
269 /// Return (if it exist), the VCalibParam for a given busPatch
271 AliMUONVCalibParam* busPatch = fBusPatchValues ? static_cast<AliMUONVCalibParam*>
272 (fBusPatchValues->FindObject(busPatchId)) : 0x0;
274 if (!busPatch && create && fBusPatchValues)
276 busPatch = CreateBusPatchParam(busPatchId);
277 fBusPatchValues->Add(busPatch);
283 //_____________________________________________________________________________
285 AliMUONTrackerData::CreateBusPatchParam(Int_t busPatchId) const
287 /// Create storage for one bus patch
289 AliCodeTimerAuto("");
291 AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(busPatchId);
295 AliError(Form("Got an invalid buspatchId = %d",busPatchId));
299 AliMUONVCalibParam* busPatch = new AliMUONCalibParamND(Dimension(),1,busPatchId,0,0.0);
301 // set the number of channels in that buspatch
305 Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromBus(busPatchId);
307 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
309 for ( Int_t i = 0; i < bp->GetNofManus(); ++i )
311 Int_t manuId = bp->GetManuId(i);
312 nchannels += de->NofChannelsInManu(manuId);
315 busPatch->SetValueAsDouble(0,IndexOfNumberDimension(),nchannels);
320 //_____________________________________________________________________________
322 AliMUONTrackerData::Chamber(Int_t chamberId, Int_t dim) const
324 /// Return the value fo a given chamber for a given dimension,
325 /// or zero if not existing
326 AliMUONVCalibParam* param = ChamberParam(chamberId);
327 return param ? Value(*param,0,dim) : 0.0;
330 //_____________________________________________________________________________
332 AliMUONTrackerData::ChamberParam(Int_t chamberId, Bool_t create) const
334 /// Return (if it exist) the VCalibParam for a given chamber
336 AliMUONVCalibParam* chamber = fChamberValues ? static_cast<AliMUONVCalibParam*>
337 (fChamberValues->FindObject(chamberId)) : 0x0;
339 if (!chamber && create && fChamberValues)
341 chamber = CreateChamberParam(chamberId);
342 fChamberValues->Add(chamber);
348 //_____________________________________________________________________________
350 AliMUONTrackerData::CreateChamberParam(Int_t chamberId) const
352 /// Create storage for one chamber
354 AliCodeTimerAuto("");
356 AliMUONVCalibParam* chamber = new AliMUONCalibParamND(Dimension(),1,chamberId,0,0.0);
358 // set the number of channels in that chamber
366 while ( !it.IsDone() )
368 AliMpDetElement* det = it.CurrentDE();
370 for ( Int_t i = 0; i < det->GetNofBusPatches(); ++i )
372 Int_t busPatchId = det->GetBusPatchId(i);
373 AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(busPatchId);
374 for ( Int_t j = 0; j < bp->GetNofManus(); ++j )
376 Int_t manuId = bp->GetManuId(j);
377 nchannels += det->NofChannelsInManu(manuId);
384 chamber->SetValueAsDouble(0,IndexOfNumberDimension(),nchannels);
389 //_____________________________________________________________________________
391 AliMUONTrackerData::Channel(Int_t detElemId, Int_t manuId,
392 Int_t manuChannel, Int_t dim) const
394 /// Return the value for a given channel for a given dimension
396 AliMUONVCalibParam* param = ChannelParam(detElemId,manuId);
398 return param ? Value(*param,manuChannel,dim) : 0.0;
401 //_____________________________________________________________________________
403 AliMUONTrackerData::ChannelParam(Int_t detElemId, Int_t manuId,
404 AliMUONVCalibParam* external) const
406 /// Return (if it exist) the VCalibParam for a given manu
408 AliMUONVCalibParam* param = fChannelValues ? static_cast<AliMUONVCalibParam*>
409 (fChannelValues->FindObject(detElemId,manuId)) : 0x0 ;
411 if (!param && external && fChannelValues)
413 param = CreateDouble(*external,detElemId,manuId);
414 fChannelValues->Add(param);
420 //_____________________________________________________________________________
422 AliMUONTrackerData::Clear(Option_t*)
424 /// Clear all the values
425 if ( fChannelValues ) fChannelValues->Clear();
426 if ( fManuValues ) fManuValues->Clear();
427 if ( fBusPatchValues) fBusPatchValues->Clear();
428 if ( fPCBValues ) fPCBValues->Clear();
429 if ( fDEValues) fDEValues->Clear();
430 if ( fChamberValues ) fChamberValues->Clear();
431 if ( fChannelHistos ) fChannelHistos->Clear();
433 NumberOfEventsChanged();
436 //_____________________________________________________________________________
438 AliMUONTrackerData::Count(Int_t detElemId, Int_t manuId,
439 Int_t manuChannel) const
441 /// Return the number of times a given channel had data
443 return Channel(detElemId,manuId,manuChannel,IndexOfNumberDimension());
446 //_____________________________________________________________________________
448 AliMUONTrackerData::CreateDouble(const AliMUONVCalibParam& param,
449 Int_t detElemId, Int_t manuId) const
451 /// Create a double version of VCalibParam, for internal use
453 AliCodeTimerAuto("");
455 AliMUONVCalibParam* c = new AliMUONCalibParamND(Dimension(),
461 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId,manuId);
463 for ( Int_t i = 0; i < c->Size(); ++i )
467 if ( de->IsConnectedChannel(manuId,i) ) value = 1.0;
469 c->SetValueAsDouble(i,IndexOfNumberDimension(),value);
475 //_____________________________________________________________________________
477 AliMUONTrackerData::DetectionElement(Int_t detElemId, Int_t dim) const
479 /// Return the value for a given detection element for a given dimension
480 AliMUONVCalibParam* param = DetectionElementParam(detElemId);
481 return param ? Value(*param,0,dim) : 0.0;
485 //_____________________________________________________________________________
487 AliMUONTrackerData::DetectionElementParam(Int_t detElemId, Bool_t create) const
489 /// Return (if it exist) the VCalibParam for a given detection element
491 AliMUONVCalibParam* de = fDEValues ? static_cast<AliMUONVCalibParam*>
492 (fDEValues->FindObject(detElemId)) : 0x0 ;
494 if (!de && create && fDEValues)
496 de = CreateDetectionElementParam(detElemId);
504 //_____________________________________________________________________________
506 AliMUONTrackerData::CreateDetectionElementParam(Int_t detElemId) const
508 /// Create storage for one detection element
510 AliCodeTimerAuto("");
512 AliMUONVCalibParam* de = new AliMUONCalibParamND(Dimension(),1,detElemId,0,0.0);
514 AliMpDetElement* det = AliMpDDLStore::Instance()->GetDetElement(detElemId);
517 for ( Int_t i = 0; i < det->GetNofBusPatches(); ++i )
519 Int_t busPatchId = det->GetBusPatchId(i);
520 AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(busPatchId);
521 for ( Int_t j = 0; j < bp->GetNofManus(); ++j )
523 Int_t manuId = bp->GetManuId(j);
524 nchannels += det->NofChannelsInManu(manuId);
528 de->SetValueAsDouble(0,IndexOfNumberDimension(),nchannels);
533 //_____________________________________________________________________________
535 AliMUONTrackerData::DimensionName(Int_t dim) const
537 /// Get the name of a given dimension
538 TObjString* value = static_cast<TObjString*>(fDimensionNames->At(dim));
541 return value->String();
545 return TString("Invalid");
549 //_____________________________________________________________________________
551 AliMUONTrackerData::External2Internal(Int_t index) const
553 /// From external to internal dimension
554 return IsSingleEvent() ? index : index*2;
557 //_____________________________________________________________________________
559 AliMUONTrackerData::ExternalDimensionName(Int_t dim) const
561 /// Get the name of a given external dimension
563 TObjString* value = static_cast<TObjString*>(fExternalDimensionNames->At(dim));
566 return value->String();
570 return TString("Invalid");
574 //_____________________________________________________________________________
576 AliMUONTrackerData::FillChannel(Int_t detElemId, Int_t manuId, Int_t manuChannel,
577 Int_t dim, Double_t value)
579 /// Fill histogram of a given channel
581 AliMUONSparseHisto* h = GetChannelSparseHisto(detElemId, manuId, manuChannel,dim);
583 h->Fill(static_cast<Int_t>(TMath::Nint(value)));
586 //_____________________________________________________________________________
588 AliMUONTrackerData::GetChannelSparseHisto(Int_t detElemId, Int_t manuId,
589 Int_t manuChannel, Int_t dim) const
591 /// Get histogram of a given channel
593 if (!fChannelHistos) return 0x0;
595 AliMUON1DMap* m = static_cast<AliMUON1DMap*>(fChannelHistos->FindObject(detElemId,manuId));
598 UInt_t uid = ( manuChannel << 16 ) | dim;
600 AliMUONSparseHisto* h = static_cast<AliMUONSparseHisto*>(m->FindObject(uid));
605 //_____________________________________________________________________________
607 AliMUONTrackerData::GetChannelSparseHisto(Int_t detElemId, Int_t manuId,
608 Int_t manuChannel, Int_t dim)
610 /// Get histogram of a given channel. Create it if necessary
612 if (!fChannelHistos) fChannelHistos = new AliMUON2DMap(kTRUE);
614 AliMUON1DMap* m = static_cast<AliMUON1DMap*>(fChannelHistos->FindObject(detElemId,manuId));
617 m = new AliMUON1DMap(AliMpConstants::ManuNofChannels()); // start with only 1 dim
618 m->SetUniqueID( ( manuId << 16 ) | detElemId );
619 fChannelHistos->Add(m);
622 UInt_t uid = ( manuChannel << 16 ) | dim;
624 AliMUONSparseHisto* h = static_cast<AliMUONSparseHisto*>(m->FindObject(uid));
627 h = new AliMUONSparseHisto(fXmin,fXmax);
637 //_____________________________________________________________________________
639 AliMUONTrackerData::GetParts(AliMUONVCalibParam* external,
640 AliMUONVCalibParam*& chamber,
641 AliMUONVCalibParam*& de,
642 AliMUONVCalibParam*& busPatch,
643 AliMUONVCalibParam*& pcb,
644 AliMUONVCalibParam*& manu,
645 AliMUONVCalibParam*& channel,
646 AliMpDetElement*& mpde)
648 /// Get containers at all levels
650 AliMpDDLStore* ddlStore = AliMpDDLStore::Instance();
655 if ( external->ID1() <= 0 )
657 // we get a manu serial number
658 Int_t serial = external->ID0();
659 AliMpIntPair pair = ddlStore->GetDetElemIdManu(serial);
660 detElemId = pair.GetFirst();
661 manuId = pair.GetSecond();
664 AliError(Form("DE %d manuId %d from serial %d is not correct !",
665 detElemId,manuId,serial));
671 // we get a (de,manu) pair
672 detElemId = external->ID0();
673 manuId = external->ID1();
676 mpde = ddlStore->GetDetElement(detElemId);
678 Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
680 Int_t busPatchId = ddlStore->GetBusPatchId(detElemId,manuId);
684 AliMp::StationType stationType = mpde->GetStationType();
686 if ( stationType == AliMp::kStation345 )
689 pcbIndex = namer.ManuId2PCBIndex(detElemId,manuId);
692 channel = ChannelParam(detElemId,manuId,external);
694 manu = ManuParam(detElemId,manuId,kTRUE);
696 busPatch = BusPatchParam(busPatchId,kTRUE);
698 de = DetectionElementParam(detElemId,kTRUE);
700 chamber = ChamberParam(chamberId,kTRUE);
706 pcb = PCBParam(detElemId,pcbIndex,kTRUE);
712 //_____________________________________________________________________________
714 AliMUONTrackerData::HasBusPatch(Int_t busPatchId) const
716 /// Whether we have data for a given buspatch
717 return ( BusPatchParam(busPatchId) != 0 );
720 //_____________________________________________________________________________
722 AliMUONTrackerData::HasChamber(Int_t chamberId) const
724 /// Whether we have data for a given chamber
725 return ( ChamberParam(chamberId) != 0 );
728 //_____________________________________________________________________________
730 AliMUONTrackerData::HasDetectionElement(Int_t detElemId) const
732 /// Whether we have data for a given detection element
733 return ( DetectionElementParam(detElemId) != 0 );
736 //_____________________________________________________________________________
738 AliMUONTrackerData::HasManu(Int_t detElemId, Int_t manuId) const
740 /// Whether we have data for a given manu
741 return ( ManuParam(detElemId,manuId) != 0 );
744 //_____________________________________________________________________________
746 AliMUONTrackerData::HasPCB(Int_t detElemId, Int_t pcbIndex) const
748 /// Whether we have data for a given pcb
749 return ( PCBParam(detElemId,pcbIndex) != 0 );
752 //_____________________________________________________________________________
754 AliMUONTrackerData::Manu(Int_t detElemId, Int_t manuId, Int_t dim) const
756 /// Return the value for a given manu and a given dimension
758 AliMUONVCalibParam* param = ManuParam(detElemId,manuId);
759 return param ? Value(*param,0,dim) : 0.0;
762 //_____________________________________________________________________________
764 AliMUONTrackerData::ManuParam(Int_t detElemId, Int_t manuId, Bool_t create) const
766 /// Get the VCalibParam for a given manu
768 AliMUONVCalibParam* manu = fManuValues ? static_cast<AliMUONVCalibParam*>
769 (fManuValues->FindObject(detElemId,manuId)) : 0x0 ;
771 if (!manu && create && fManuValues)
773 manu = CreateManuParam(detElemId,manuId);
774 fManuValues->Add(manu);
780 //_____________________________________________________________________________
782 AliMUONTrackerData::CreateManuParam(Int_t detElemId, Int_t manuId) const
784 /// Create storage for one manu
786 AliCodeTimerAuto("");
788 AliMUONVCalibParam* manu = new AliMUONCalibParamND(Dimension(),1,detElemId,manuId,0.0);
790 // set the number of channels in that manu
792 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
794 manu->SetValueAsDouble(0,IndexOfNumberDimension(),de->NofChannelsInManu(manuId));
799 //_____________________________________________________________________________
801 AliMUONTrackerData::Merge(TCollection*)
803 /// Merge all tracker data objects from li into a single one.
805 AliError("Not implemented yet");
810 //_____________________________________________________________________________
812 AliMUONTrackerData::NumberOfDimensions() const
814 /// Number of dimensions we're dealing with
816 return fDimension + fgkVirtualExtraDimension;
819 //_____________________________________________________________________________
821 AliMUONTrackerData::PCB(Int_t detElemId, Int_t pcbIndex, Int_t dim) const
823 /// Return the value of a given pcb for a given dimension
825 AliMUONVCalibParam* param = PCBParam(detElemId,pcbIndex);
827 return param ? Value(*param,pcbIndex,dim) : 0.0;
830 //_____________________________________________________________________________
832 AliMUONTrackerData::PCBParam(Int_t detElemId, Int_t pcbIndex, Bool_t create) const
834 /// Return (if it exist) the VCalibParam for a given pcb
836 AliMUONVCalibParam* pcb = fPCBValues ? static_cast<AliMUONVCalibParam*>
837 (fPCBValues->FindObject(detElemId,pcbIndex)) : 0x0 ;
839 if (create && fPCBValues && !pcb)
841 pcb = CreatePCBParam(detElemId,pcbIndex);
842 fPCBValues->Add(pcb);
848 //_____________________________________________________________________________
850 AliMUONTrackerData::CreatePCBParam(Int_t detElemId, Int_t pcbIndex) const
852 /// Create storage for one PCB (station345 only)
854 AliCodeTimerAuto("");
858 AliMUONVCalibParam* pcb = new AliMUONCalibParamND(Dimension(),
859 namer.NumberOfPCBs(detElemId),
866 //_____________________________________________________________________________
868 AliMUONTrackerData::Print(Option_t* wildcard, Option_t* opt) const
874 if ( !fIsSingleEvent )
876 cout << " Nevents=" << fNevents << endl;
879 for ( Int_t i = 0; i <= fExternalDimensionNames->GetLast(); ++i )
881 TObjString* name = static_cast<TObjString*>(fExternalDimensionNames->At(i));
882 cout << Form("External Dimension %2d Name %s %s",i,
883 ( name ? name->String().Data() : "null"),
884 ( IsHistogrammed(i) ? "(histogrammed)" : "")) << endl;
887 for ( Int_t i = 0; i <= fDimensionNames->GetLast(); ++i )
889 TObjString* name = static_cast<TObjString*>(fDimensionNames->At(i));
890 cout << Form("Internal Dimension %2d Name %s",i,
891 ( name ? name->String().Data() : "null")) << endl;
897 if ( sopt.Contains("CHANNEL") && fChannelValues )
899 fChannelValues->Print(wildcard,opt);
902 if ( sopt.Contains("MANU") && fManuValues )
904 fManuValues->Print(wildcard,opt);
907 if ( sopt.Contains("BUSPATCH") && fBusPatchValues )
909 fBusPatchValues->Print(wildcard,opt);
912 if ( sopt.Contains("DE") && fDEValues )
914 fDEValues->Print(wildcard,opt);
917 if ( sopt.Contains("CHAMBER") && fChamberValues )
919 fChamberValues->Print(wildcard,opt);
924 //_____________________________________________________________________________
926 AliMUONTrackerData::SetDimensionName(Int_t index, const char* name)
928 /// Set the name of a given dimension
930 if ( index >= fExternalDimension )
932 AliError(Form("Index out of bounds : %d / %d",index,fExternalDimension));
936 Int_t ix = External2Internal(index);
938 if ( !IsSingleEvent() )
940 const char* prefix[] = { "mean", "sigma" };
942 for ( Int_t i = 0; i < 2; ++i )
946 SetInternalDimensionName(j,Form("%s of %s",prefix[i],name));
951 SetInternalDimensionName(index,name);
954 SetExternalDimensionName(index,name);
957 //_____________________________________________________________________________
959 AliMUONTrackerData::MakeHistogramForDimension(Int_t index, Bool_t value, Double_t xmin, Double_t xmax)
961 /// decide to make histos for a given dimension
962 if ( index >= ExternalDimension() )
964 AliError(Form("Index out of bounds : %d / %d",index,ExternalDimension()));
968 fHistogramming[index] = value;
973 //_____________________________________________________________________________
975 AliMUONTrackerData::SetInternalDimensionName(Int_t index, const char* value)
977 /// Set the name of a given internal dimension
978 if ( index >= fDimension )
980 AliError(Form("Index out of bounds : %d / %d",index,fDimension));
984 TObjString* ovalue = static_cast<TObjString*>(fDimensionNames->At(index));
988 fDimensionNames->Remove(ovalue);
991 fDimensionNames->AddAt(new TObjString(value),index);
994 //_____________________________________________________________________________
996 AliMUONTrackerData::SetExternalDimensionName(Int_t index, const char* value)
998 /// Set the name of a given external dimension
999 if ( index >= fExternalDimension )
1001 AliError(Form("Index out of bounds : %d / %d",index,fExternalDimension));
1005 TObjString* ovalue = static_cast<TObjString*>(fExternalDimensionNames->At(index));
1009 fExternalDimensionNames->Remove(ovalue);
1012 fExternalDimensionNames->AddAt(new TObjString(value),index);
1015 //_____________________________________________________________________________
1017 AliMUONTrackerData::Value(const AliMUONVCalibParam& param, Int_t i, Int_t dim) const
1019 /// Compute the value for a given dim, using the internal information we have
1020 /// Basically we're converting sum of weights and sum of squares of weights
1021 /// into means and sigmas, and number of events into occupancy number.
1023 Double_t n = param.ValueAsDouble(i,IndexOfNumberDimension());
1025 if ( dim == IndexOfNumberDimension() ) return n; // the number of channels in any given element does not depend on the number of events
1027 Double_t occ = param.ValueAsDouble(i,IndexOfOccupancyDimension());
1029 if ( dim >= fDimension )
1034 if ( dim == IndexOfOccupancyDimension() ) return occ/n/NumberOfEvents();
1036 Double_t value = param.ValueAsDouble(i,dim);
1038 if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return AliMUONVCalibParam::InvalidFloatValue();
1040 if ( TMath::Even(dim) || IsSingleEvent() )
1050 Double_t mean = param.ValueAsDouble(i,dim-1)/n;
1052 return TMath::Sqrt(TMath::Abs((value-n*mean*mean)/(n-1.0)));
1060 AliError("Why am I here ?");