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),
68 fDimension(dimension*2+fgkExtraDimension),
70 fDimensionNames(new TObjArray(fDimension+fgkVirtualExtraDimension)),
71 fExternalDimensionNames(new TObjArray(dimension)),
72 fExternalDimension(dimension),
73 fIsRunnable(runnable),
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());
114 NumberOfEventsChanged();
118 fChannelValues = store.Create();
119 fManuValues = store.Create();
120 fPCBValues = store.Create();
121 fBusPatchValues = new AliMUON1DMap;
122 fDEValues = new AliMUON1DMap;
123 fChamberValues = new AliMUON1DArray;
126 TIter next(store.CreateIterator());
127 AliMUONVCalibParam* external;
129 while ( ( external = static_cast<AliMUONVCalibParam*>(next()) ) )
131 if ( external->Dimension() != ExternalDimension() )
133 AliError(Form("Incompatible dimensions %d vs %d",
134 external->Dimension(),ExternalDimension()));
139 AliMUONVCalibParam* chamber, *de, *busPatch, *pcb, *manu, *channel;
140 AliMpDetElement* mpde;
142 Int_t manuId = GetParts(external,chamber,de,busPatch,pcb,manu,channel,mpde);
144 Int_t detElemId = mpde->GetId();
146 Double_t value[] = { 0.0, 0.0 };
148 Int_t nch = mpde->NofChannelsInManu(manuId);
150 for ( Int_t i = 0; i < external->Size(); ++i )
152 Bool_t existingChannel = ( nch == AliMpConstants::ManuNofChannels() ? kTRUE
153 : mpde->IsConnectedChannel(manuId,i));
154 // note we only use IsConnectedChannel method when really needed, as
155 // it costs (some) CPU time...
157 if ( existingChannel )
159 Bool_t validChannel(kFALSE);
161 for ( Int_t j = 0; j < external->Dimension(); ++j )
163 Double_t vext = external->IsDoublePrecision() ?
164 external->ValueAsDoubleFast(i,j) :
165 external->ValueAsFloatFast(i,j);
167 if ( vext >= AliMUONVCalibParam::InvalidFloatValue() ) continue;
169 validChannel = kTRUE;
171 Int_t ix = External2Internal(j);
174 value[1] = vext*vext;
176 if ( IsHistogrammed(j) )
178 FillChannel(detElemId,manuId,i,j,vext);
181 for ( Int_t k = 0; k < 2; ++k )
183 channel->SetValueAsDoubleFast(i,ix+k,channel->ValueAsDoubleFast(i,ix+k)+value[k]);
185 manu->SetValueAsDoubleFast(0,ix+k,manu->ValueAsDoubleFast(0,ix+k)+value[k]);
187 busPatch->SetValueAsDoubleFast(0,ix+k,busPatch->ValueAsDoubleFast(0,ix+k)+value[k]);
189 de->SetValueAsDoubleFast(0,ix+k,de->ValueAsDoubleFast(0,ix+k)+value[k]);
191 chamber->SetValueAsDoubleFast(0,ix+k,chamber->ValueAsDoubleFast(0,ix+k)+value[k]);
195 pcb->SetValueAsDoubleFast(0,ix+k,pcb->ValueAsDoubleFast(0,ix+k)+value[k]);
202 channel->SetValueAsDoubleFast(i,IndexOfOccupancyDimension(),
203 channel->ValueAsDoubleFast(i,IndexOfOccupancyDimension())+1.0);
204 manu->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
205 manu->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
206 busPatch->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
207 busPatch->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
208 de->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
209 de->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
210 chamber->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
211 chamber->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
214 pcb->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
215 pcb->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
225 //_____________________________________________________________________________
227 AliMUONTrackerData::BusPatch(Int_t busPatchId, Int_t dim) const
229 /// Return the value of a given buspatch for a given dimension
230 /// or 0 if not existing
231 AliMUONVCalibParam* param = BusPatchParam(busPatchId);
232 return param ? Value(*param,0,dim) : 0.0;
235 //_____________________________________________________________________________
237 AliMUONTrackerData::BusPatchParam(Int_t busPatchId, Bool_t create) const
239 /// Return (if it exist), the VCalibParam for a given busPatch
241 AliMUONVCalibParam* busPatch = fBusPatchValues ? static_cast<AliMUONVCalibParam*>
242 (fBusPatchValues->FindObject(busPatchId)) : 0x0;
244 if (!busPatch && create && fBusPatchValues)
246 busPatch = CreateBusPatchParam(busPatchId);
247 fBusPatchValues->Add(busPatch);
253 //_____________________________________________________________________________
255 AliMUONTrackerData::CreateBusPatchParam(Int_t busPatchId) const
257 /// Create storage for one bus patch
259 AliCodeTimerAuto("");
261 AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(busPatchId);
265 AliError(Form("Got an invalid buspatchId = %d",busPatchId));
269 AliMUONVCalibParam* busPatch = new AliMUONCalibParamND(Dimension(),1,busPatchId,0,0.0);
271 // set the number of channels in that buspatch
275 Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromBus(busPatchId);
277 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
279 for ( Int_t i = 0; i < bp->GetNofManus(); ++i )
281 Int_t manuId = bp->GetManuId(i);
282 nchannels += de->NofChannelsInManu(manuId);
285 busPatch->SetValueAsDouble(0,IndexOfNumberDimension(),nchannels);
290 //_____________________________________________________________________________
292 AliMUONTrackerData::Chamber(Int_t chamberId, Int_t dim) const
294 /// Return the value fo a given chamber for a given dimension,
295 /// or zero if not existing
296 AliMUONVCalibParam* param = ChamberParam(chamberId);
297 return param ? Value(*param,0,dim) : 0.0;
300 //_____________________________________________________________________________
302 AliMUONTrackerData::ChamberParam(Int_t chamberId, Bool_t create) const
304 /// Return (if it exist) the VCalibParam for a given chamber
306 AliMUONVCalibParam* chamber = fChamberValues ? static_cast<AliMUONVCalibParam*>
307 (fChamberValues->FindObject(chamberId)) : 0x0;
309 if (!chamber && create && fChamberValues)
311 chamber = CreateChamberParam(chamberId);
312 fChamberValues->Add(chamber);
318 //_____________________________________________________________________________
320 AliMUONTrackerData::CreateChamberParam(Int_t chamberId) const
322 /// Create storage for one chamber
324 AliCodeTimerAuto("");
326 AliMUONVCalibParam* chamber = new AliMUONCalibParamND(Dimension(),1,chamberId,0,0.0);
328 // set the number of channels in that chamber
336 while ( !it.IsDone() )
338 AliMpDetElement* det = it.CurrentDE();
340 for ( Int_t i = 0; i < det->GetNofBusPatches(); ++i )
342 Int_t busPatchId = det->GetBusPatchId(i);
343 AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(busPatchId);
344 for ( Int_t j = 0; j < bp->GetNofManus(); ++j )
346 Int_t manuId = bp->GetManuId(j);
347 nchannels += det->NofChannelsInManu(manuId);
354 chamber->SetValueAsDouble(0,IndexOfNumberDimension(),nchannels);
359 //_____________________________________________________________________________
361 AliMUONTrackerData::Channel(Int_t detElemId, Int_t manuId,
362 Int_t manuChannel, Int_t dim) const
364 /// Return the value for a given channel for a given dimension
366 AliMUONVCalibParam* param = ChannelParam(detElemId,manuId);
368 return param ? Value(*param,manuChannel,dim) : 0.0;
371 //_____________________________________________________________________________
373 AliMUONTrackerData::ChannelParam(Int_t detElemId, Int_t manuId,
374 AliMUONVCalibParam* external) const
376 /// Return (if it exist) the VCalibParam for a given manu
378 AliMUONVCalibParam* param = fChannelValues ? static_cast<AliMUONVCalibParam*>
379 (fChannelValues->FindObject(detElemId,manuId)) : 0x0 ;
381 if (!param && external && fChannelValues)
383 param = CreateDouble(*external);
384 fChannelValues->Add(param);
390 //_____________________________________________________________________________
392 AliMUONTrackerData::Clear(Option_t*)
394 /// Clear all the values
395 if ( fChannelValues ) fChannelValues->Clear();
396 if ( fManuValues ) fManuValues->Clear();
397 if ( fBusPatchValues) fBusPatchValues->Clear();
398 if ( fPCBValues ) fPCBValues->Clear();
399 if ( fDEValues) fDEValues->Clear();
400 if ( fChamberValues ) fChamberValues->Clear();
401 if ( fChannelHistos ) fChannelHistos->Clear();
403 NumberOfEventsChanged();
406 //_____________________________________________________________________________
408 AliMUONTrackerData::Count(Int_t detElemId, Int_t manuId,
409 Int_t manuChannel) const
411 /// Return the number of times a given channel had data
413 return Channel(detElemId,manuId,manuChannel,IndexOfNumberDimension());
416 //_____________________________________________________________________________
418 AliMUONTrackerData::CreateDouble(const AliMUONVCalibParam& param) const
420 /// Create a double version of VCalibParam, for internal use
422 AliCodeTimerAuto("");
424 AliMUONVCalibParam* c = new AliMUONCalibParamND(Dimension(),
430 for ( Int_t i = 0; i < c->Size(); ++i )
432 c->SetValueAsDouble(i,IndexOfNumberDimension(),1.0);
438 //_____________________________________________________________________________
440 AliMUONTrackerData::DetectionElement(Int_t detElemId, Int_t dim) const
442 /// Return the value for a given detection element for a given dimension
443 AliMUONVCalibParam* param = DetectionElementParam(detElemId);
444 return param ? Value(*param,0,dim) : 0.0;
448 //_____________________________________________________________________________
450 AliMUONTrackerData::DetectionElementParam(Int_t detElemId, Bool_t create) const
452 /// Return (if it exist) the VCalibParam for a given detection element
454 AliMUONVCalibParam* de = fDEValues ? static_cast<AliMUONVCalibParam*>
455 (fDEValues->FindObject(detElemId)) : 0x0 ;
457 if (!de && create && fDEValues)
459 de = CreateDetectionElementParam(detElemId);
467 //_____________________________________________________________________________
469 AliMUONTrackerData::CreateDetectionElementParam(Int_t detElemId) const
471 /// Create storage for one detection element
473 AliCodeTimerAuto("");
475 AliMUONVCalibParam* de = new AliMUONCalibParamND(Dimension(),1,detElemId,0,0.0);
477 AliMpDetElement* det = AliMpDDLStore::Instance()->GetDetElement(detElemId);
480 for ( Int_t i = 0; i < det->GetNofBusPatches(); ++i )
482 Int_t busPatchId = det->GetBusPatchId(i);
483 AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(busPatchId);
484 for ( Int_t j = 0; j < bp->GetNofManus(); ++j )
486 Int_t manuId = bp->GetManuId(j);
487 nchannels += det->NofChannelsInManu(manuId);
491 de->SetValueAsDouble(0,IndexOfNumberDimension(),nchannels);
496 //_____________________________________________________________________________
498 AliMUONTrackerData::DimensionName(Int_t dim) const
500 /// Get the name of a given dimension
501 TObjString* value = static_cast<TObjString*>(fDimensionNames->At(dim));
504 return value->String();
508 return TString("Invalid");
512 //_____________________________________________________________________________
514 AliMUONTrackerData::ExternalDimensionName(Int_t dim) const
516 /// Get the name of a given external dimension
518 TObjString* value = static_cast<TObjString*>(fExternalDimensionNames->At(dim));
521 return value->String();
525 return TString("Invalid");
529 //_____________________________________________________________________________
531 AliMUONTrackerData::FillChannel(Int_t detElemId, Int_t manuId, Int_t manuChannel,
532 Int_t dim, Double_t value)
534 /// Fill histogram of a given channel
536 AliMUONSparseHisto* h = GetChannelSparseHisto(detElemId, manuId, manuChannel,dim);
538 h->Fill(static_cast<Int_t>(TMath::Nint(value)));
541 //_____________________________________________________________________________
543 AliMUONTrackerData::GetChannelSparseHisto(Int_t detElemId, Int_t manuId,
544 Int_t manuChannel, Int_t dim) const
546 /// Get histogram of a given channel
548 if (!fChannelHistos) return 0x0;
550 AliMUON1DMap* m = static_cast<AliMUON1DMap*>(fChannelHistos->FindObject(detElemId,manuId));
553 UInt_t uid = ( manuChannel << 16 ) | dim;
555 AliMUONSparseHisto* h = static_cast<AliMUONSparseHisto*>(m->FindObject(uid));
560 //_____________________________________________________________________________
562 AliMUONTrackerData::GetChannelSparseHisto(Int_t detElemId, Int_t manuId,
563 Int_t manuChannel, Int_t dim)
565 /// Get histogram of a given channel. Create it if necessary
567 if (!fChannelHistos) fChannelHistos = new AliMUON2DMap(kTRUE);
569 AliMUON1DMap* m = static_cast<AliMUON1DMap*>(fChannelHistos->FindObject(detElemId,manuId));
572 m = new AliMUON1DMap(AliMpConstants::ManuNofChannels()); // start with only 1 dim
573 m->SetUniqueID( ( manuId << 16 ) | detElemId );
574 fChannelHistos->Add(m);
577 UInt_t uid = ( manuChannel << 16 ) | dim;
579 AliMUONSparseHisto* h = static_cast<AliMUONSparseHisto*>(m->FindObject(uid));
582 h = new AliMUONSparseHisto(fXmin,fXmax);
592 //_____________________________________________________________________________
594 AliMUONTrackerData::GetParts(AliMUONVCalibParam* external,
595 AliMUONVCalibParam*& chamber,
596 AliMUONVCalibParam*& de,
597 AliMUONVCalibParam*& busPatch,
598 AliMUONVCalibParam*& pcb,
599 AliMUONVCalibParam*& manu,
600 AliMUONVCalibParam*& channel,
601 AliMpDetElement*& mpde)
603 /// Get containers at all levels
605 AliMpDDLStore* ddlStore = AliMpDDLStore::Instance();
607 Int_t detElemId = external->ID0();
609 Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
611 Int_t manuId = external->ID1();
613 mpde = ddlStore->GetDetElement(detElemId);
615 Int_t busPatchId = ddlStore->GetBusPatchId(detElemId,manuId);
619 AliMp::StationType stationType = mpde->GetStationType();
621 if ( stationType == AliMp::kStation345 )
624 pcbIndex = namer.ManuId2PCBIndex(detElemId,manuId);
627 channel = ChannelParam(detElemId,manuId,external);
629 manu = ManuParam(detElemId,manuId,kTRUE);
631 busPatch = BusPatchParam(busPatchId,kTRUE);
633 de = DetectionElementParam(detElemId,kTRUE);
635 chamber = ChamberParam(chamberId,kTRUE);
641 pcb = PCBParam(detElemId,pcbIndex,kTRUE);
647 //_____________________________________________________________________________
649 AliMUONTrackerData::HasBusPatch(Int_t busPatchId) const
651 /// Whether we have data for a given buspatch
652 return ( BusPatchParam(busPatchId) != 0 );
655 //_____________________________________________________________________________
657 AliMUONTrackerData::HasChamber(Int_t chamberId) const
659 /// Whether we have data for a given chamber
660 return ( ChamberParam(chamberId) != 0 );
663 //_____________________________________________________________________________
665 AliMUONTrackerData::HasDetectionElement(Int_t detElemId) const
667 /// Whether we have data for a given detection element
668 return ( DetectionElementParam(detElemId) != 0 );
671 //_____________________________________________________________________________
673 AliMUONTrackerData::HasManu(Int_t detElemId, Int_t manuId) const
675 /// Whether we have data for a given manu
676 return ( ManuParam(detElemId,manuId) != 0 );
679 //_____________________________________________________________________________
681 AliMUONTrackerData::HasPCB(Int_t detElemId, Int_t pcbIndex) const
683 /// Whether we have data for a given pcb
684 return ( PCBParam(detElemId,pcbIndex) != 0 );
687 //_____________________________________________________________________________
689 AliMUONTrackerData::Manu(Int_t detElemId, Int_t manuId, Int_t dim) const
691 /// Return the value for a given manu and a given dimension
693 AliMUONVCalibParam* param = ManuParam(detElemId,manuId);
694 return param ? Value(*param,0,dim) : 0.0;
697 //_____________________________________________________________________________
699 AliMUONTrackerData::ManuParam(Int_t detElemId, Int_t manuId, Bool_t create) const
701 /// Get the VCalibParam for a given manu
703 AliMUONVCalibParam* manu = fManuValues ? static_cast<AliMUONVCalibParam*>
704 (fManuValues->FindObject(detElemId,manuId)) : 0x0 ;
706 if (!manu && create && fManuValues)
708 manu = CreateManuParam(detElemId,manuId);
709 fManuValues->Add(manu);
715 //_____________________________________________________________________________
717 AliMUONTrackerData::CreateManuParam(Int_t detElemId, Int_t manuId) const
719 /// Create storage for one manu
721 AliCodeTimerAuto("");
723 AliMUONVCalibParam* manu = new AliMUONCalibParamND(Dimension(),1,detElemId,manuId,0.0);
725 // set the number of channels in that manu
727 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
729 manu->SetValueAsDouble(0,IndexOfNumberDimension(),de->NofChannelsInManu(manuId));
734 //_____________________________________________________________________________
736 AliMUONTrackerData::NumberOfDimensions() const
738 /// Number of dimensions we're dealing with
740 return fDimension + fgkVirtualExtraDimension;
743 //_____________________________________________________________________________
745 AliMUONTrackerData::PCB(Int_t detElemId, Int_t pcbIndex, Int_t dim) const
747 /// Return the value of a given pcb for a given dimension
749 AliMUONVCalibParam* param = PCBParam(detElemId,pcbIndex);
751 return param ? Value(*param,pcbIndex,dim) : 0.0;
754 //_____________________________________________________________________________
756 AliMUONTrackerData::PCBParam(Int_t detElemId, Int_t pcbIndex, Bool_t create) const
758 /// Return (if it exist) the VCalibParam for a given pcb
760 AliMUONVCalibParam* pcb = fPCBValues ? static_cast<AliMUONVCalibParam*>
761 (fPCBValues->FindObject(detElemId,pcbIndex)) : 0x0 ;
763 if (create && fPCBValues && !pcb)
765 pcb = CreatePCBParam(detElemId,pcbIndex);
766 fPCBValues->Add(pcb);
772 //_____________________________________________________________________________
774 AliMUONTrackerData::CreatePCBParam(Int_t detElemId, Int_t pcbIndex) const
776 /// Create storage for one PCB (station345 only)
778 AliCodeTimerAuto("");
782 AliMUONVCalibParam* pcb = new AliMUONCalibParamND(Dimension(),
783 namer.NumberOfPCBs(detElemId),
790 //_____________________________________________________________________________
792 AliMUONTrackerData::Print(Option_t* wildcard, Option_t* opt) const
800 cout << " Nevents=" << fNevents << endl;
803 for ( Int_t i = 0; i <= fExternalDimensionNames->GetLast(); ++i )
805 TObjString* name = static_cast<TObjString*>(fExternalDimensionNames->At(i));
806 cout << Form("External Dimension %2d Name %s %s",i,
807 ( name ? name->String().Data() : "null"),
808 ( IsHistogrammed(i) ? "(histogrammed)" : "")) << endl;
811 for ( Int_t i = 0; i <= fDimensionNames->GetLast(); ++i )
813 TObjString* name = static_cast<TObjString*>(fDimensionNames->At(i));
814 cout << Form("Internal Dimension %2d Name %s",i,
815 ( name ? name->String().Data() : "null")) << endl;
821 if ( sopt.Contains("CHANNEL") && fChannelValues )
823 fChannelValues->Print(wildcard,opt);
826 if ( sopt.Contains("MANU") && fManuValues )
828 fManuValues->Print(wildcard,opt);
831 if ( sopt.Contains("BUSPATCH") && fBusPatchValues )
833 fBusPatchValues->Print(wildcard,opt);
836 if ( sopt.Contains("DE") && fDEValues )
838 fDEValues->Print(wildcard,opt);
841 if ( sopt.Contains("CHAMBER") && fChamberValues )
843 fChamberValues->Print(wildcard,opt);
848 //_____________________________________________________________________________
850 AliMUONTrackerData::SetDimensionName(Int_t index, const char* name)
852 /// Set the name of a given dimension
854 if ( index >= fExternalDimension )
856 AliError(Form("Index out of bounds : %d / %d",index,fExternalDimension));
860 Int_t ix = External2Internal(index);
862 const char* prefix[] = { "mean", "sigma" };
864 for ( Int_t i = 0; i < 2; ++i )
868 SetInternalDimensionName(j,Form("%s of %s",prefix[i],name));
871 SetExternalDimensionName(index,name);
874 //_____________________________________________________________________________
876 AliMUONTrackerData::MakeHistogramForDimension(Int_t index, Bool_t value, Double_t xmin, Double_t xmax)
878 /// decide to make histos for a given dimension
879 if ( index >= ExternalDimension() )
881 AliError(Form("Index out of bounds : %d / %d",index,ExternalDimension()));
885 fHistogramming[index] = value;
890 //_____________________________________________________________________________
892 AliMUONTrackerData::SetInternalDimensionName(Int_t index, const char* value)
894 /// Set the name of a given internal dimension
895 if ( index >= fDimension )
897 AliError(Form("Index out of bounds : %d / %d",index,fDimension));
901 TObjString* ovalue = static_cast<TObjString*>(fDimensionNames->At(index));
905 fDimensionNames->Remove(ovalue);
908 fDimensionNames->AddAt(new TObjString(value),index);
911 //_____________________________________________________________________________
913 AliMUONTrackerData::SetExternalDimensionName(Int_t index, const char* value)
915 /// Set the name of a given external dimension
916 if ( index >= fExternalDimension )
918 AliError(Form("Index out of bounds : %d / %d",index,fExternalDimension));
922 TObjString* ovalue = static_cast<TObjString*>(fExternalDimensionNames->At(index));
926 fExternalDimensionNames->Remove(ovalue);
929 fExternalDimensionNames->AddAt(new TObjString(value),index);
932 //_____________________________________________________________________________
934 AliMUONTrackerData::Value(const AliMUONVCalibParam& param, Int_t i, Int_t dim) const
936 /// Compute the value for a given dim, using the internal information we have
937 /// Basically we're converting sum of weights and sum of squares of weights
938 /// into means and sigmas, and number of events into occupancy number.
940 Double_t n = param.ValueAsDouble(i,IndexOfNumberDimension());
942 if ( dim == IndexOfNumberDimension() ) return n; // the number of channels in any given element does not depend on the number of events
944 Double_t occ = param.ValueAsDouble(i,IndexOfOccupancyDimension());
946 if ( dim >= fDimension )
951 if ( dim == IndexOfOccupancyDimension() ) return occ/n/NumberOfEvents();
953 Double_t value = param.ValueAsDouble(i,dim);
955 if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return AliMUONVCalibParam::InvalidFloatValue();
957 if ( TMath::Even(dim) )
965 Double_t mean = param.ValueAsDouble(i,dim-1)/n;
967 return TMath::Sqrt(TMath::Abs((value-n*mean*mean)/(n-1.0)));
970 AliError("Why am I here ?");