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, Int_t numberOfEvents)
109 /// Add the given external store to our internal store
111 AliCodeTimerAuto(GetName());
113 fNevents += numberOfEvents;
114 NumberOfEventsChanged();
118 fChannelValues = new AliMUON2DMap(kTRUE);
119 fManuValues = new AliMUON2DMap(kTRUE);
120 fPCBValues = new AliMUON2DMap(kFALSE);
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 if ( manuId < 0 ) continue;
146 Int_t detElemId = mpde->GetId();
148 Double_t value[] = { 0.0, 0.0 };
150 Int_t nch = mpde->NofChannelsInManu(manuId);
152 for ( Int_t i = 0; i < external->Size(); ++i )
154 Bool_t existingChannel = ( nch == AliMpConstants::ManuNofChannels() ? kTRUE
155 : mpde->IsConnectedChannel(manuId,i));
156 // note we only use IsConnectedChannel method when really needed, as
157 // it costs (some) CPU time...
159 if ( existingChannel )
161 Bool_t validChannel(kFALSE);
163 for ( Int_t j = 0; j < external->Dimension(); ++j )
165 Double_t vext = external->IsDoublePrecision() ?
166 external->ValueAsDoubleFast(i,j) :
167 external->ValueAsFloatFast(i,j);
169 if ( vext >= AliMUONVCalibParam::InvalidFloatValue() ) continue;
171 validChannel = kTRUE;
173 Int_t ix = External2Internal(j);
176 value[1] = vext*vext;
178 if ( IsHistogrammed(j) )
180 FillChannel(detElemId,manuId,i,j,vext);
183 for ( Int_t k = 0; k < 2; ++k )
185 channel->SetValueAsDoubleFast(i,ix+k,channel->ValueAsDoubleFast(i,ix+k)+value[k]);
187 manu->SetValueAsDoubleFast(0,ix+k,manu->ValueAsDoubleFast(0,ix+k)+value[k]);
189 busPatch->SetValueAsDoubleFast(0,ix+k,busPatch->ValueAsDoubleFast(0,ix+k)+value[k]);
191 de->SetValueAsDoubleFast(0,ix+k,de->ValueAsDoubleFast(0,ix+k)+value[k]);
193 chamber->SetValueAsDoubleFast(0,ix+k,chamber->ValueAsDoubleFast(0,ix+k)+value[k]);
197 pcb->SetValueAsDoubleFast(0,ix+k,pcb->ValueAsDoubleFast(0,ix+k)+value[k]);
204 channel->SetValueAsDoubleFast(i,IndexOfOccupancyDimension(),
205 channel->ValueAsDoubleFast(i,IndexOfOccupancyDimension())+1.0);
206 manu->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
207 manu->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
208 busPatch->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
209 busPatch->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
210 de->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
211 de->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
212 chamber->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
213 chamber->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
216 pcb->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
217 pcb->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
227 //_____________________________________________________________________________
229 AliMUONTrackerData::BusPatch(Int_t busPatchId, Int_t dim) const
231 /// Return the value of a given buspatch for a given dimension
232 /// or 0 if not existing
233 AliMUONVCalibParam* param = BusPatchParam(busPatchId);
234 return param ? Value(*param,0,dim) : 0.0;
237 //_____________________________________________________________________________
239 AliMUONTrackerData::BusPatchParam(Int_t busPatchId, Bool_t create) const
241 /// Return (if it exist), the VCalibParam for a given busPatch
243 AliMUONVCalibParam* busPatch = fBusPatchValues ? static_cast<AliMUONVCalibParam*>
244 (fBusPatchValues->FindObject(busPatchId)) : 0x0;
246 if (!busPatch && create && fBusPatchValues)
248 busPatch = CreateBusPatchParam(busPatchId);
249 fBusPatchValues->Add(busPatch);
255 //_____________________________________________________________________________
257 AliMUONTrackerData::CreateBusPatchParam(Int_t busPatchId) const
259 /// Create storage for one bus patch
261 AliCodeTimerAuto("");
263 AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(busPatchId);
267 AliError(Form("Got an invalid buspatchId = %d",busPatchId));
271 AliMUONVCalibParam* busPatch = new AliMUONCalibParamND(Dimension(),1,busPatchId,0,0.0);
273 // set the number of channels in that buspatch
277 Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromBus(busPatchId);
279 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
281 for ( Int_t i = 0; i < bp->GetNofManus(); ++i )
283 Int_t manuId = bp->GetManuId(i);
284 nchannels += de->NofChannelsInManu(manuId);
287 busPatch->SetValueAsDouble(0,IndexOfNumberDimension(),nchannels);
292 //_____________________________________________________________________________
294 AliMUONTrackerData::Chamber(Int_t chamberId, Int_t dim) const
296 /// Return the value fo a given chamber for a given dimension,
297 /// or zero if not existing
298 AliMUONVCalibParam* param = ChamberParam(chamberId);
299 return param ? Value(*param,0,dim) : 0.0;
302 //_____________________________________________________________________________
304 AliMUONTrackerData::ChamberParam(Int_t chamberId, Bool_t create) const
306 /// Return (if it exist) the VCalibParam for a given chamber
308 AliMUONVCalibParam* chamber = fChamberValues ? static_cast<AliMUONVCalibParam*>
309 (fChamberValues->FindObject(chamberId)) : 0x0;
311 if (!chamber && create && fChamberValues)
313 chamber = CreateChamberParam(chamberId);
314 fChamberValues->Add(chamber);
320 //_____________________________________________________________________________
322 AliMUONTrackerData::CreateChamberParam(Int_t chamberId) const
324 /// Create storage for one chamber
326 AliCodeTimerAuto("");
328 AliMUONVCalibParam* chamber = new AliMUONCalibParamND(Dimension(),1,chamberId,0,0.0);
330 // set the number of channels in that chamber
338 while ( !it.IsDone() )
340 AliMpDetElement* det = it.CurrentDE();
342 for ( Int_t i = 0; i < det->GetNofBusPatches(); ++i )
344 Int_t busPatchId = det->GetBusPatchId(i);
345 AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(busPatchId);
346 for ( Int_t j = 0; j < bp->GetNofManus(); ++j )
348 Int_t manuId = bp->GetManuId(j);
349 nchannels += det->NofChannelsInManu(manuId);
356 chamber->SetValueAsDouble(0,IndexOfNumberDimension(),nchannels);
361 //_____________________________________________________________________________
363 AliMUONTrackerData::Channel(Int_t detElemId, Int_t manuId,
364 Int_t manuChannel, Int_t dim) const
366 /// Return the value for a given channel for a given dimension
368 AliMUONVCalibParam* param = ChannelParam(detElemId,manuId);
370 return param ? Value(*param,manuChannel,dim) : 0.0;
373 //_____________________________________________________________________________
375 AliMUONTrackerData::ChannelParam(Int_t detElemId, Int_t manuId,
376 AliMUONVCalibParam* external) const
378 /// Return (if it exist) the VCalibParam for a given manu
380 AliMUONVCalibParam* param = fChannelValues ? static_cast<AliMUONVCalibParam*>
381 (fChannelValues->FindObject(detElemId,manuId)) : 0x0 ;
383 if (!param && external && fChannelValues)
385 param = CreateDouble(*external,detElemId,manuId);
386 fChannelValues->Add(param);
392 //_____________________________________________________________________________
394 AliMUONTrackerData::Clear(Option_t*)
396 /// Clear all the values
397 if ( fChannelValues ) fChannelValues->Clear();
398 if ( fManuValues ) fManuValues->Clear();
399 if ( fBusPatchValues) fBusPatchValues->Clear();
400 if ( fPCBValues ) fPCBValues->Clear();
401 if ( fDEValues) fDEValues->Clear();
402 if ( fChamberValues ) fChamberValues->Clear();
403 if ( fChannelHistos ) fChannelHistos->Clear();
405 NumberOfEventsChanged();
408 //_____________________________________________________________________________
410 AliMUONTrackerData::Count(Int_t detElemId, Int_t manuId,
411 Int_t manuChannel) const
413 /// Return the number of times a given channel had data
415 return Channel(detElemId,manuId,manuChannel,IndexOfNumberDimension());
418 //_____________________________________________________________________________
420 AliMUONTrackerData::CreateDouble(const AliMUONVCalibParam& param,
421 Int_t detElemId, Int_t manuId) const
423 /// Create a double version of VCalibParam, for internal use
425 AliCodeTimerAuto("");
427 AliMUONVCalibParam* c = new AliMUONCalibParamND(Dimension(),
433 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId,manuId);
435 for ( Int_t i = 0; i < c->Size(); ++i )
439 if ( de->IsConnectedChannel(manuId,i) ) value = 1.0;
441 c->SetValueAsDouble(i,IndexOfNumberDimension(),value);
447 //_____________________________________________________________________________
449 AliMUONTrackerData::DetectionElement(Int_t detElemId, Int_t dim) const
451 /// Return the value for a given detection element for a given dimension
452 AliMUONVCalibParam* param = DetectionElementParam(detElemId);
453 return param ? Value(*param,0,dim) : 0.0;
457 //_____________________________________________________________________________
459 AliMUONTrackerData::DetectionElementParam(Int_t detElemId, Bool_t create) const
461 /// Return (if it exist) the VCalibParam for a given detection element
463 AliMUONVCalibParam* de = fDEValues ? static_cast<AliMUONVCalibParam*>
464 (fDEValues->FindObject(detElemId)) : 0x0 ;
466 if (!de && create && fDEValues)
468 de = CreateDetectionElementParam(detElemId);
476 //_____________________________________________________________________________
478 AliMUONTrackerData::CreateDetectionElementParam(Int_t detElemId) const
480 /// Create storage for one detection element
482 AliCodeTimerAuto("");
484 AliMUONVCalibParam* de = new AliMUONCalibParamND(Dimension(),1,detElemId,0,0.0);
486 AliMpDetElement* det = AliMpDDLStore::Instance()->GetDetElement(detElemId);
489 for ( Int_t i = 0; i < det->GetNofBusPatches(); ++i )
491 Int_t busPatchId = det->GetBusPatchId(i);
492 AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(busPatchId);
493 for ( Int_t j = 0; j < bp->GetNofManus(); ++j )
495 Int_t manuId = bp->GetManuId(j);
496 nchannels += det->NofChannelsInManu(manuId);
500 de->SetValueAsDouble(0,IndexOfNumberDimension(),nchannels);
505 //_____________________________________________________________________________
507 AliMUONTrackerData::DimensionName(Int_t dim) const
509 /// Get the name of a given dimension
510 TObjString* value = static_cast<TObjString*>(fDimensionNames->At(dim));
513 return value->String();
517 return TString("Invalid");
521 //_____________________________________________________________________________
523 AliMUONTrackerData::ExternalDimensionName(Int_t dim) const
525 /// Get the name of a given external dimension
527 TObjString* value = static_cast<TObjString*>(fExternalDimensionNames->At(dim));
530 return value->String();
534 return TString("Invalid");
538 //_____________________________________________________________________________
540 AliMUONTrackerData::FillChannel(Int_t detElemId, Int_t manuId, Int_t manuChannel,
541 Int_t dim, Double_t value)
543 /// Fill histogram of a given channel
545 AliMUONSparseHisto* h = GetChannelSparseHisto(detElemId, manuId, manuChannel,dim);
547 h->Fill(static_cast<Int_t>(TMath::Nint(value)));
550 //_____________________________________________________________________________
552 AliMUONTrackerData::GetChannelSparseHisto(Int_t detElemId, Int_t manuId,
553 Int_t manuChannel, Int_t dim) const
555 /// Get histogram of a given channel
557 if (!fChannelHistos) return 0x0;
559 AliMUON1DMap* m = static_cast<AliMUON1DMap*>(fChannelHistos->FindObject(detElemId,manuId));
562 UInt_t uid = ( manuChannel << 16 ) | dim;
564 AliMUONSparseHisto* h = static_cast<AliMUONSparseHisto*>(m->FindObject(uid));
569 //_____________________________________________________________________________
571 AliMUONTrackerData::GetChannelSparseHisto(Int_t detElemId, Int_t manuId,
572 Int_t manuChannel, Int_t dim)
574 /// Get histogram of a given channel. Create it if necessary
576 if (!fChannelHistos) fChannelHistos = new AliMUON2DMap(kTRUE);
578 AliMUON1DMap* m = static_cast<AliMUON1DMap*>(fChannelHistos->FindObject(detElemId,manuId));
581 m = new AliMUON1DMap(AliMpConstants::ManuNofChannels()); // start with only 1 dim
582 m->SetUniqueID( ( manuId << 16 ) | detElemId );
583 fChannelHistos->Add(m);
586 UInt_t uid = ( manuChannel << 16 ) | dim;
588 AliMUONSparseHisto* h = static_cast<AliMUONSparseHisto*>(m->FindObject(uid));
591 h = new AliMUONSparseHisto(fXmin,fXmax);
601 //_____________________________________________________________________________
603 AliMUONTrackerData::GetParts(AliMUONVCalibParam* external,
604 AliMUONVCalibParam*& chamber,
605 AliMUONVCalibParam*& de,
606 AliMUONVCalibParam*& busPatch,
607 AliMUONVCalibParam*& pcb,
608 AliMUONVCalibParam*& manu,
609 AliMUONVCalibParam*& channel,
610 AliMpDetElement*& mpde)
612 /// Get containers at all levels
614 AliMpDDLStore* ddlStore = AliMpDDLStore::Instance();
619 if ( external->ID1() <= 0 )
621 // we get a manu serial number
622 Int_t serial = external->ID0();
623 AliMpIntPair pair = ddlStore->GetDetElemIdManu(serial);
624 detElemId = pair.GetFirst();
625 manuId = pair.GetSecond();
628 AliError(Form("DE %d manuId %d from serial %d is not correct !",
629 detElemId,manuId,serial));
635 // we get a (de,manu) pair
636 detElemId = external->ID0();
637 manuId = external->ID1();
640 mpde = ddlStore->GetDetElement(detElemId);
642 Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
644 Int_t busPatchId = ddlStore->GetBusPatchId(detElemId,manuId);
648 AliMp::StationType stationType = mpde->GetStationType();
650 if ( stationType == AliMp::kStation345 )
653 pcbIndex = namer.ManuId2PCBIndex(detElemId,manuId);
656 channel = ChannelParam(detElemId,manuId,external);
658 manu = ManuParam(detElemId,manuId,kTRUE);
660 busPatch = BusPatchParam(busPatchId,kTRUE);
662 de = DetectionElementParam(detElemId,kTRUE);
664 chamber = ChamberParam(chamberId,kTRUE);
670 pcb = PCBParam(detElemId,pcbIndex,kTRUE);
676 //_____________________________________________________________________________
678 AliMUONTrackerData::HasBusPatch(Int_t busPatchId) const
680 /// Whether we have data for a given buspatch
681 return ( BusPatchParam(busPatchId) != 0 );
684 //_____________________________________________________________________________
686 AliMUONTrackerData::HasChamber(Int_t chamberId) const
688 /// Whether we have data for a given chamber
689 return ( ChamberParam(chamberId) != 0 );
692 //_____________________________________________________________________________
694 AliMUONTrackerData::HasDetectionElement(Int_t detElemId) const
696 /// Whether we have data for a given detection element
697 return ( DetectionElementParam(detElemId) != 0 );
700 //_____________________________________________________________________________
702 AliMUONTrackerData::HasManu(Int_t detElemId, Int_t manuId) const
704 /// Whether we have data for a given manu
705 return ( ManuParam(detElemId,manuId) != 0 );
708 //_____________________________________________________________________________
710 AliMUONTrackerData::HasPCB(Int_t detElemId, Int_t pcbIndex) const
712 /// Whether we have data for a given pcb
713 return ( PCBParam(detElemId,pcbIndex) != 0 );
716 //_____________________________________________________________________________
718 AliMUONTrackerData::Manu(Int_t detElemId, Int_t manuId, Int_t dim) const
720 /// Return the value for a given manu and a given dimension
722 AliMUONVCalibParam* param = ManuParam(detElemId,manuId);
723 return param ? Value(*param,0,dim) : 0.0;
726 //_____________________________________________________________________________
728 AliMUONTrackerData::ManuParam(Int_t detElemId, Int_t manuId, Bool_t create) const
730 /// Get the VCalibParam for a given manu
732 AliMUONVCalibParam* manu = fManuValues ? static_cast<AliMUONVCalibParam*>
733 (fManuValues->FindObject(detElemId,manuId)) : 0x0 ;
735 if (!manu && create && fManuValues)
737 manu = CreateManuParam(detElemId,manuId);
738 fManuValues->Add(manu);
744 //_____________________________________________________________________________
746 AliMUONTrackerData::CreateManuParam(Int_t detElemId, Int_t manuId) const
748 /// Create storage for one manu
750 AliCodeTimerAuto("");
752 AliMUONVCalibParam* manu = new AliMUONCalibParamND(Dimension(),1,detElemId,manuId,0.0);
754 // set the number of channels in that manu
756 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
758 manu->SetValueAsDouble(0,IndexOfNumberDimension(),de->NofChannelsInManu(manuId));
763 //_____________________________________________________________________________
765 AliMUONTrackerData::Merge(TCollection*)
767 /// Merge all tracker data objects from li into a single one.
769 AliError("Not implemented yet");
774 //_____________________________________________________________________________
776 AliMUONTrackerData::NumberOfDimensions() const
778 /// Number of dimensions we're dealing with
780 return fDimension + fgkVirtualExtraDimension;
783 //_____________________________________________________________________________
785 AliMUONTrackerData::PCB(Int_t detElemId, Int_t pcbIndex, Int_t dim) const
787 /// Return the value of a given pcb for a given dimension
789 AliMUONVCalibParam* param = PCBParam(detElemId,pcbIndex);
791 return param ? Value(*param,pcbIndex,dim) : 0.0;
794 //_____________________________________________________________________________
796 AliMUONTrackerData::PCBParam(Int_t detElemId, Int_t pcbIndex, Bool_t create) const
798 /// Return (if it exist) the VCalibParam for a given pcb
800 AliMUONVCalibParam* pcb = fPCBValues ? static_cast<AliMUONVCalibParam*>
801 (fPCBValues->FindObject(detElemId,pcbIndex)) : 0x0 ;
803 if (create && fPCBValues && !pcb)
805 pcb = CreatePCBParam(detElemId,pcbIndex);
806 fPCBValues->Add(pcb);
812 //_____________________________________________________________________________
814 AliMUONTrackerData::CreatePCBParam(Int_t detElemId, Int_t pcbIndex) const
816 /// Create storage for one PCB (station345 only)
818 AliCodeTimerAuto("");
822 AliMUONVCalibParam* pcb = new AliMUONCalibParamND(Dimension(),
823 namer.NumberOfPCBs(detElemId),
830 //_____________________________________________________________________________
832 AliMUONTrackerData::Print(Option_t* wildcard, Option_t* opt) const
840 cout << " Nevents=" << fNevents << endl;
843 for ( Int_t i = 0; i <= fExternalDimensionNames->GetLast(); ++i )
845 TObjString* name = static_cast<TObjString*>(fExternalDimensionNames->At(i));
846 cout << Form("External Dimension %2d Name %s %s",i,
847 ( name ? name->String().Data() : "null"),
848 ( IsHistogrammed(i) ? "(histogrammed)" : "")) << endl;
851 for ( Int_t i = 0; i <= fDimensionNames->GetLast(); ++i )
853 TObjString* name = static_cast<TObjString*>(fDimensionNames->At(i));
854 cout << Form("Internal Dimension %2d Name %s",i,
855 ( name ? name->String().Data() : "null")) << endl;
861 if ( sopt.Contains("CHANNEL") && fChannelValues )
863 fChannelValues->Print(wildcard,opt);
866 if ( sopt.Contains("MANU") && fManuValues )
868 fManuValues->Print(wildcard,opt);
871 if ( sopt.Contains("BUSPATCH") && fBusPatchValues )
873 fBusPatchValues->Print(wildcard,opt);
876 if ( sopt.Contains("DE") && fDEValues )
878 fDEValues->Print(wildcard,opt);
881 if ( sopt.Contains("CHAMBER") && fChamberValues )
883 fChamberValues->Print(wildcard,opt);
888 //_____________________________________________________________________________
890 AliMUONTrackerData::SetDimensionName(Int_t index, const char* name)
892 /// Set the name of a given dimension
894 if ( index >= fExternalDimension )
896 AliError(Form("Index out of bounds : %d / %d",index,fExternalDimension));
900 Int_t ix = External2Internal(index);
902 const char* prefix[] = { "mean", "sigma" };
904 for ( Int_t i = 0; i < 2; ++i )
908 SetInternalDimensionName(j,Form("%s of %s",prefix[i],name));
911 SetExternalDimensionName(index,name);
914 //_____________________________________________________________________________
916 AliMUONTrackerData::MakeHistogramForDimension(Int_t index, Bool_t value, Double_t xmin, Double_t xmax)
918 /// decide to make histos for a given dimension
919 if ( index >= ExternalDimension() )
921 AliError(Form("Index out of bounds : %d / %d",index,ExternalDimension()));
925 fHistogramming[index] = value;
930 //_____________________________________________________________________________
932 AliMUONTrackerData::SetInternalDimensionName(Int_t index, const char* value)
934 /// Set the name of a given internal dimension
935 if ( index >= fDimension )
937 AliError(Form("Index out of bounds : %d / %d",index,fDimension));
941 TObjString* ovalue = static_cast<TObjString*>(fDimensionNames->At(index));
945 fDimensionNames->Remove(ovalue);
948 fDimensionNames->AddAt(new TObjString(value),index);
951 //_____________________________________________________________________________
953 AliMUONTrackerData::SetExternalDimensionName(Int_t index, const char* value)
955 /// Set the name of a given external dimension
956 if ( index >= fExternalDimension )
958 AliError(Form("Index out of bounds : %d / %d",index,fExternalDimension));
962 TObjString* ovalue = static_cast<TObjString*>(fExternalDimensionNames->At(index));
966 fExternalDimensionNames->Remove(ovalue);
969 fExternalDimensionNames->AddAt(new TObjString(value),index);
972 //_____________________________________________________________________________
974 AliMUONTrackerData::Value(const AliMUONVCalibParam& param, Int_t i, Int_t dim) const
976 /// Compute the value for a given dim, using the internal information we have
977 /// Basically we're converting sum of weights and sum of squares of weights
978 /// into means and sigmas, and number of events into occupancy number.
980 Double_t n = param.ValueAsDouble(i,IndexOfNumberDimension());
982 if ( dim == IndexOfNumberDimension() ) return n; // the number of channels in any given element does not depend on the number of events
984 Double_t occ = param.ValueAsDouble(i,IndexOfOccupancyDimension());
986 if ( dim >= fDimension )
991 if ( dim == IndexOfOccupancyDimension() ) return occ/n/NumberOfEvents();
993 Double_t value = param.ValueAsDouble(i,dim);
995 if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return AliMUONVCalibParam::InvalidFloatValue();
997 if ( TMath::Even(dim) )
1005 Double_t mean = param.ValueAsDouble(i,dim-1)/n;
1007 return TMath::Sqrt(TMath::Abs((value-n*mean*mean)/(n-1.0)));
1010 AliError("Why am I here ?");