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 TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator());
132 while ( next() ) ++numberOfBusPatches;
133 AliMpDEIterator deIt;
135 while (!deIt.IsDone())
141 fChannelValues = new AliMUON2DMap(kTRUE);
142 fManuValues = new AliMUON2DMap(kTRUE);
143 fPCBValues = new AliMUON2DMap(kFALSE);
144 fBusPatchValues = new AliMUON1DMap(numberOfBusPatches);
145 fDEValues = new AliMUON1DMap(numberOfDEs);
146 fChamberValues = new AliMUON1DArray;
149 TIter next(store.CreateIterator());
150 AliMUONVCalibParam* external;
154 if ( IsSingleEvent() ) nk = 1;
156 while ( ( external = static_cast<AliMUONVCalibParam*>(next()) ) )
158 if ( external->Dimension() != ExternalDimension() )
160 AliError(Form("Incompatible dimensions %d vs %d",
161 external->Dimension(),ExternalDimension()));
166 AliMUONVCalibParam* chamber, *de, *busPatch, *pcb, *manu, *channel;
167 AliMpDetElement* mpde;
169 Int_t manuId = GetParts(external,chamber,de,busPatch,pcb,manu,channel,mpde);
171 if ( manuId < 0 ) continue;
173 Int_t detElemId = mpde->GetId();
175 Double_t value[] = { 0.0, 0.0 };
177 Int_t nch = mpde->NofChannelsInManu(manuId);
179 for ( Int_t i = 0; i < external->Size(); ++i )
181 Bool_t existingChannel = ( nch == AliMpConstants::ManuNofChannels() ? kTRUE
182 : mpde->IsConnectedChannel(manuId,i));
183 // note we only use IsConnectedChannel method when really needed, as
184 // it costs (some) CPU time...
186 if ( existingChannel )
188 Bool_t validChannel(kFALSE);
190 for ( Int_t j = 0; j < external->Dimension(); ++j )
192 Double_t vext = external->IsDoublePrecision() ?
193 external->ValueAsDoubleFast(i,j) :
194 external->ValueAsFloatFast(i,j);
196 if ( vext >= AliMUONVCalibParam::InvalidFloatValue() ) continue;
198 validChannel = kTRUE;
200 Int_t ix = External2Internal(j);
203 value[1] = vext*vext;
205 if ( IsHistogrammed(j) )
207 FillChannel(detElemId,manuId,i,j,vext);
210 for ( Int_t k = 0; k < nk; ++k )
212 channel->SetValueAsDoubleFast(i,ix+k,channel->ValueAsDoubleFast(i,ix+k)+value[k]);
214 manu->SetValueAsDoubleFast(0,ix+k,manu->ValueAsDoubleFast(0,ix+k)+value[k]);
216 busPatch->SetValueAsDoubleFast(0,ix+k,busPatch->ValueAsDoubleFast(0,ix+k)+value[k]);
218 de->SetValueAsDoubleFast(0,ix+k,de->ValueAsDoubleFast(0,ix+k)+value[k]);
220 chamber->SetValueAsDoubleFast(0,ix+k,chamber->ValueAsDoubleFast(0,ix+k)+value[k]);
224 pcb->SetValueAsDoubleFast(0,ix+k,pcb->ValueAsDoubleFast(0,ix+k)+value[k]);
231 channel->SetValueAsDoubleFast(i,IndexOfOccupancyDimension(),
232 channel->ValueAsDoubleFast(i,IndexOfOccupancyDimension())+1.0);
233 manu->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
234 manu->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
235 busPatch->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
236 busPatch->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
237 de->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
238 de->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
239 chamber->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
240 chamber->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
243 pcb->SetValueAsDoubleFast(0,IndexOfOccupancyDimension(),
244 pcb->ValueAsDoubleFast(0,IndexOfOccupancyDimension())+1.0);
254 //_____________________________________________________________________________
256 AliMUONTrackerData::BusPatch(Int_t busPatchId, Int_t dim) const
258 /// Return the value of a given buspatch for a given dimension
259 /// or 0 if not existing
260 AliMUONVCalibParam* param = BusPatchParam(busPatchId);
261 return param ? Value(*param,0,dim) : 0.0;
264 //_____________________________________________________________________________
266 AliMUONTrackerData::BusPatchParam(Int_t busPatchId, Bool_t create) const
268 /// Return (if it exist), the VCalibParam for a given busPatch
270 AliMUONVCalibParam* busPatch = fBusPatchValues ? static_cast<AliMUONVCalibParam*>
271 (fBusPatchValues->FindObject(busPatchId)) : 0x0;
273 if (!busPatch && create && fBusPatchValues)
275 busPatch = CreateBusPatchParam(busPatchId);
276 fBusPatchValues->Add(busPatch);
282 //_____________________________________________________________________________
284 AliMUONTrackerData::CreateBusPatchParam(Int_t busPatchId) const
286 /// Create storage for one bus patch
288 AliCodeTimerAuto("");
290 AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(busPatchId);
294 AliError(Form("Got an invalid buspatchId = %d",busPatchId));
298 AliMUONVCalibParam* busPatch = new AliMUONCalibParamND(Dimension(),1,busPatchId,0,0.0);
300 // set the number of channels in that buspatch
304 Int_t detElemId = AliMpDDLStore::Instance()->GetDEfromBus(busPatchId);
306 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
308 for ( Int_t i = 0; i < bp->GetNofManus(); ++i )
310 Int_t manuId = bp->GetManuId(i);
311 nchannels += de->NofChannelsInManu(manuId);
314 busPatch->SetValueAsDouble(0,IndexOfNumberDimension(),nchannels);
319 //_____________________________________________________________________________
321 AliMUONTrackerData::Chamber(Int_t chamberId, Int_t dim) const
323 /// Return the value fo a given chamber for a given dimension,
324 /// or zero if not existing
325 AliMUONVCalibParam* param = ChamberParam(chamberId);
326 return param ? Value(*param,0,dim) : 0.0;
329 //_____________________________________________________________________________
331 AliMUONTrackerData::ChamberParam(Int_t chamberId, Bool_t create) const
333 /// Return (if it exist) the VCalibParam for a given chamber
335 AliMUONVCalibParam* chamber = fChamberValues ? static_cast<AliMUONVCalibParam*>
336 (fChamberValues->FindObject(chamberId)) : 0x0;
338 if (!chamber && create && fChamberValues)
340 chamber = CreateChamberParam(chamberId);
341 fChamberValues->Add(chamber);
347 //_____________________________________________________________________________
349 AliMUONTrackerData::CreateChamberParam(Int_t chamberId) const
351 /// Create storage for one chamber
353 AliCodeTimerAuto("");
355 AliMUONVCalibParam* chamber = new AliMUONCalibParamND(Dimension(),1,chamberId,0,0.0);
357 // set the number of channels in that chamber
365 while ( !it.IsDone() )
367 AliMpDetElement* det = it.CurrentDE();
369 for ( Int_t i = 0; i < det->GetNofBusPatches(); ++i )
371 Int_t busPatchId = det->GetBusPatchId(i);
372 AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(busPatchId);
373 for ( Int_t j = 0; j < bp->GetNofManus(); ++j )
375 Int_t manuId = bp->GetManuId(j);
376 nchannels += det->NofChannelsInManu(manuId);
383 chamber->SetValueAsDouble(0,IndexOfNumberDimension(),nchannels);
388 //_____________________________________________________________________________
390 AliMUONTrackerData::Channel(Int_t detElemId, Int_t manuId,
391 Int_t manuChannel, Int_t dim) const
393 /// Return the value for a given channel for a given dimension
395 AliMUONVCalibParam* param = ChannelParam(detElemId,manuId);
397 return param ? Value(*param,manuChannel,dim) : 0.0;
400 //_____________________________________________________________________________
402 AliMUONTrackerData::ChannelParam(Int_t detElemId, Int_t manuId,
403 AliMUONVCalibParam* external) const
405 /// Return (if it exist) the VCalibParam for a given manu
407 AliMUONVCalibParam* param = fChannelValues ? static_cast<AliMUONVCalibParam*>
408 (fChannelValues->FindObject(detElemId,manuId)) : 0x0 ;
410 if (!param && external && fChannelValues)
412 param = CreateDouble(*external,detElemId,manuId);
413 fChannelValues->Add(param);
419 //_____________________________________________________________________________
421 AliMUONTrackerData::Clear(Option_t*)
423 /// Clear all the values
424 if ( fChannelValues ) fChannelValues->Clear();
425 if ( fManuValues ) fManuValues->Clear();
426 if ( fBusPatchValues) fBusPatchValues->Clear();
427 if ( fPCBValues ) fPCBValues->Clear();
428 if ( fDEValues) fDEValues->Clear();
429 if ( fChamberValues ) fChamberValues->Clear();
430 if ( fChannelHistos ) fChannelHistos->Clear();
432 NumberOfEventsChanged();
435 //_____________________________________________________________________________
437 AliMUONTrackerData::Count(Int_t detElemId, Int_t manuId,
438 Int_t manuChannel) const
440 /// Return the number of times a given channel had data
442 return Channel(detElemId,manuId,manuChannel,IndexOfNumberDimension());
445 //_____________________________________________________________________________
447 AliMUONTrackerData::CreateDouble(const AliMUONVCalibParam& param,
448 Int_t detElemId, Int_t manuId) const
450 /// Create a double version of VCalibParam, for internal use
452 AliCodeTimerAuto("");
454 AliMUONVCalibParam* c = new AliMUONCalibParamND(Dimension(),
460 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId,manuId);
462 for ( Int_t i = 0; i < c->Size(); ++i )
466 if ( de->IsConnectedChannel(manuId,i) ) value = 1.0;
468 c->SetValueAsDouble(i,IndexOfNumberDimension(),value);
474 //_____________________________________________________________________________
476 AliMUONTrackerData::DetectionElement(Int_t detElemId, Int_t dim) const
478 /// Return the value for a given detection element for a given dimension
479 AliMUONVCalibParam* param = DetectionElementParam(detElemId);
480 return param ? Value(*param,0,dim) : 0.0;
484 //_____________________________________________________________________________
486 AliMUONTrackerData::DetectionElementParam(Int_t detElemId, Bool_t create) const
488 /// Return (if it exist) the VCalibParam for a given detection element
490 AliMUONVCalibParam* de = fDEValues ? static_cast<AliMUONVCalibParam*>
491 (fDEValues->FindObject(detElemId)) : 0x0 ;
493 if (!de && create && fDEValues)
495 de = CreateDetectionElementParam(detElemId);
503 //_____________________________________________________________________________
505 AliMUONTrackerData::CreateDetectionElementParam(Int_t detElemId) const
507 /// Create storage for one detection element
509 AliCodeTimerAuto("");
511 AliMUONVCalibParam* de = new AliMUONCalibParamND(Dimension(),1,detElemId,0,0.0);
513 AliMpDetElement* det = AliMpDDLStore::Instance()->GetDetElement(detElemId);
516 for ( Int_t i = 0; i < det->GetNofBusPatches(); ++i )
518 Int_t busPatchId = det->GetBusPatchId(i);
519 AliMpBusPatch* bp = AliMpDDLStore::Instance()->GetBusPatch(busPatchId);
520 for ( Int_t j = 0; j < bp->GetNofManus(); ++j )
522 Int_t manuId = bp->GetManuId(j);
523 nchannels += det->NofChannelsInManu(manuId);
527 de->SetValueAsDouble(0,IndexOfNumberDimension(),nchannels);
532 //_____________________________________________________________________________
534 AliMUONTrackerData::DimensionName(Int_t dim) const
536 /// Get the name of a given dimension
537 TObjString* value = static_cast<TObjString*>(fDimensionNames->At(dim));
540 return value->String();
544 return TString("Invalid");
548 //_____________________________________________________________________________
550 AliMUONTrackerData::External2Internal(Int_t index) const
552 /// From external to internal dimension
553 return IsSingleEvent() ? index : index*2;
556 //_____________________________________________________________________________
558 AliMUONTrackerData::ExternalDimensionName(Int_t dim) const
560 /// Get the name of a given external dimension
562 TObjString* value = static_cast<TObjString*>(fExternalDimensionNames->At(dim));
565 return value->String();
569 return TString("Invalid");
573 //_____________________________________________________________________________
575 AliMUONTrackerData::FillChannel(Int_t detElemId, Int_t manuId, Int_t manuChannel,
576 Int_t dim, Double_t value)
578 /// Fill histogram of a given channel
580 AliMUONSparseHisto* h = GetChannelSparseHisto(detElemId, manuId, manuChannel,dim);
582 h->Fill(static_cast<Int_t>(TMath::Nint(value)));
585 //_____________________________________________________________________________
587 AliMUONTrackerData::GetChannelSparseHisto(Int_t detElemId, Int_t manuId,
588 Int_t manuChannel, Int_t dim) const
590 /// Get histogram of a given channel
592 if (!fChannelHistos) return 0x0;
594 AliMUON1DMap* m = static_cast<AliMUON1DMap*>(fChannelHistos->FindObject(detElemId,manuId));
597 UInt_t uid = ( manuChannel << 16 ) | dim;
599 AliMUONSparseHisto* h = static_cast<AliMUONSparseHisto*>(m->FindObject(uid));
604 //_____________________________________________________________________________
606 AliMUONTrackerData::GetChannelSparseHisto(Int_t detElemId, Int_t manuId,
607 Int_t manuChannel, Int_t dim)
609 /// Get histogram of a given channel. Create it if necessary
611 if (!fChannelHistos) fChannelHistos = new AliMUON2DMap(kTRUE);
613 AliMUON1DMap* m = static_cast<AliMUON1DMap*>(fChannelHistos->FindObject(detElemId,manuId));
616 m = new AliMUON1DMap(AliMpConstants::ManuNofChannels()); // start with only 1 dim
617 m->SetUniqueID( ( manuId << 16 ) | detElemId );
618 fChannelHistos->Add(m);
621 UInt_t uid = ( manuChannel << 16 ) | dim;
623 AliMUONSparseHisto* h = static_cast<AliMUONSparseHisto*>(m->FindObject(uid));
626 h = new AliMUONSparseHisto(fXmin,fXmax);
636 //_____________________________________________________________________________
638 AliMUONTrackerData::GetParts(AliMUONVCalibParam* external,
639 AliMUONVCalibParam*& chamber,
640 AliMUONVCalibParam*& de,
641 AliMUONVCalibParam*& busPatch,
642 AliMUONVCalibParam*& pcb,
643 AliMUONVCalibParam*& manu,
644 AliMUONVCalibParam*& channel,
645 AliMpDetElement*& mpde)
647 /// Get containers at all levels
649 AliMpDDLStore* ddlStore = AliMpDDLStore::Instance();
654 if ( external->ID1() <= 0 )
656 // we get a manu serial number
657 Int_t serial = external->ID0();
658 AliMpIntPair pair = ddlStore->GetDetElemIdManu(serial);
659 detElemId = pair.GetFirst();
660 manuId = pair.GetSecond();
663 AliError(Form("DE %d manuId %d from serial %d is not correct !",
664 detElemId,manuId,serial));
670 // we get a (de,manu) pair
671 detElemId = external->ID0();
672 manuId = external->ID1();
675 mpde = ddlStore->GetDetElement(detElemId);
677 Int_t chamberId = AliMpDEManager::GetChamberId(detElemId);
679 Int_t busPatchId = ddlStore->GetBusPatchId(detElemId,manuId);
683 AliMp::StationType stationType = mpde->GetStationType();
685 if ( stationType == AliMp::kStation345 )
688 pcbIndex = namer.ManuId2PCBIndex(detElemId,manuId);
691 channel = ChannelParam(detElemId,manuId,external);
693 manu = ManuParam(detElemId,manuId,kTRUE);
695 busPatch = BusPatchParam(busPatchId,kTRUE);
697 de = DetectionElementParam(detElemId,kTRUE);
699 chamber = ChamberParam(chamberId,kTRUE);
705 pcb = PCBParam(detElemId,pcbIndex,kTRUE);
711 //_____________________________________________________________________________
713 AliMUONTrackerData::HasBusPatch(Int_t busPatchId) const
715 /// Whether we have data for a given buspatch
716 return ( BusPatchParam(busPatchId) != 0 );
719 //_____________________________________________________________________________
721 AliMUONTrackerData::HasChamber(Int_t chamberId) const
723 /// Whether we have data for a given chamber
724 return ( ChamberParam(chamberId) != 0 );
727 //_____________________________________________________________________________
729 AliMUONTrackerData::HasDetectionElement(Int_t detElemId) const
731 /// Whether we have data for a given detection element
732 return ( DetectionElementParam(detElemId) != 0 );
735 //_____________________________________________________________________________
737 AliMUONTrackerData::HasManu(Int_t detElemId, Int_t manuId) const
739 /// Whether we have data for a given manu
740 return ( ManuParam(detElemId,manuId) != 0 );
743 //_____________________________________________________________________________
745 AliMUONTrackerData::HasPCB(Int_t detElemId, Int_t pcbIndex) const
747 /// Whether we have data for a given pcb
748 return ( PCBParam(detElemId,pcbIndex) != 0 );
751 //_____________________________________________________________________________
753 AliMUONTrackerData::Manu(Int_t detElemId, Int_t manuId, Int_t dim) const
755 /// Return the value for a given manu and a given dimension
757 AliMUONVCalibParam* param = ManuParam(detElemId,manuId);
758 return param ? Value(*param,0,dim) : 0.0;
761 //_____________________________________________________________________________
763 AliMUONTrackerData::ManuParam(Int_t detElemId, Int_t manuId, Bool_t create) const
765 /// Get the VCalibParam for a given manu
767 AliMUONVCalibParam* manu = fManuValues ? static_cast<AliMUONVCalibParam*>
768 (fManuValues->FindObject(detElemId,manuId)) : 0x0 ;
770 if (!manu && create && fManuValues)
772 manu = CreateManuParam(detElemId,manuId);
773 fManuValues->Add(manu);
779 //_____________________________________________________________________________
781 AliMUONTrackerData::CreateManuParam(Int_t detElemId, Int_t manuId) const
783 /// Create storage for one manu
785 AliCodeTimerAuto("");
787 AliMUONVCalibParam* manu = new AliMUONCalibParamND(Dimension(),1,detElemId,manuId,0.0);
789 // set the number of channels in that manu
791 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
793 manu->SetValueAsDouble(0,IndexOfNumberDimension(),de->NofChannelsInManu(manuId));
798 //_____________________________________________________________________________
800 AliMUONTrackerData::Merge(TCollection*)
802 /// Merge all tracker data objects from li into a single one.
804 AliError("Not implemented yet");
809 //_____________________________________________________________________________
811 AliMUONTrackerData::NumberOfDimensions() const
813 /// Number of dimensions we're dealing with
815 return fDimension + fgkVirtualExtraDimension;
818 //_____________________________________________________________________________
820 AliMUONTrackerData::PCB(Int_t detElemId, Int_t pcbIndex, Int_t dim) const
822 /// Return the value of a given pcb for a given dimension
824 AliMUONVCalibParam* param = PCBParam(detElemId,pcbIndex);
826 return param ? Value(*param,pcbIndex,dim) : 0.0;
829 //_____________________________________________________________________________
831 AliMUONTrackerData::PCBParam(Int_t detElemId, Int_t pcbIndex, Bool_t create) const
833 /// Return (if it exist) the VCalibParam for a given pcb
835 AliMUONVCalibParam* pcb = fPCBValues ? static_cast<AliMUONVCalibParam*>
836 (fPCBValues->FindObject(detElemId,pcbIndex)) : 0x0 ;
838 if (create && fPCBValues && !pcb)
840 pcb = CreatePCBParam(detElemId,pcbIndex);
841 fPCBValues->Add(pcb);
847 //_____________________________________________________________________________
849 AliMUONTrackerData::CreatePCBParam(Int_t detElemId, Int_t pcbIndex) const
851 /// Create storage for one PCB (station345 only)
853 AliCodeTimerAuto("");
857 AliMUONVCalibParam* pcb = new AliMUONCalibParamND(Dimension(),
858 namer.NumberOfPCBs(detElemId),
865 //_____________________________________________________________________________
867 AliMUONTrackerData::Print(Option_t* wildcard, Option_t* opt) const
873 if ( !fIsSingleEvent )
875 cout << " Nevents=" << fNevents << endl;
878 for ( Int_t i = 0; i <= fExternalDimensionNames->GetLast(); ++i )
880 TObjString* name = static_cast<TObjString*>(fExternalDimensionNames->At(i));
881 cout << Form("External Dimension %2d Name %s %s",i,
882 ( name ? name->String().Data() : "null"),
883 ( IsHistogrammed(i) ? "(histogrammed)" : "")) << endl;
886 for ( Int_t i = 0; i <= fDimensionNames->GetLast(); ++i )
888 TObjString* name = static_cast<TObjString*>(fDimensionNames->At(i));
889 cout << Form("Internal Dimension %2d Name %s",i,
890 ( name ? name->String().Data() : "null")) << endl;
896 if ( sopt.Contains("CHANNEL") && fChannelValues )
898 fChannelValues->Print(wildcard,opt);
901 if ( sopt.Contains("MANU") && fManuValues )
903 fManuValues->Print(wildcard,opt);
906 if ( sopt.Contains("BUSPATCH") && fBusPatchValues )
908 fBusPatchValues->Print(wildcard,opt);
911 if ( sopt.Contains("DE") && fDEValues )
913 fDEValues->Print(wildcard,opt);
916 if ( sopt.Contains("CHAMBER") && fChamberValues )
918 fChamberValues->Print(wildcard,opt);
923 //_____________________________________________________________________________
925 AliMUONTrackerData::SetDimensionName(Int_t index, const char* name)
927 /// Set the name of a given dimension
929 if ( index >= fExternalDimension )
931 AliError(Form("Index out of bounds : %d / %d",index,fExternalDimension));
935 Int_t ix = External2Internal(index);
937 if ( !IsSingleEvent() )
939 const char* prefix[] = { "mean", "sigma" };
941 for ( Int_t i = 0; i < 2; ++i )
945 SetInternalDimensionName(j,Form("%s of %s",prefix[i],name));
950 SetInternalDimensionName(index,name);
953 SetExternalDimensionName(index,name);
956 //_____________________________________________________________________________
958 AliMUONTrackerData::MakeHistogramForDimension(Int_t index, Bool_t value, Double_t xmin, Double_t xmax)
960 /// decide to make histos for a given dimension
961 if ( index >= ExternalDimension() )
963 AliError(Form("Index out of bounds : %d / %d",index,ExternalDimension()));
967 fHistogramming[index] = value;
972 //_____________________________________________________________________________
974 AliMUONTrackerData::SetInternalDimensionName(Int_t index, const char* value)
976 /// Set the name of a given internal dimension
977 if ( index >= fDimension )
979 AliError(Form("Index out of bounds : %d / %d",index,fDimension));
983 TObjString* ovalue = static_cast<TObjString*>(fDimensionNames->At(index));
987 fDimensionNames->Remove(ovalue);
990 fDimensionNames->AddAt(new TObjString(value),index);
993 //_____________________________________________________________________________
995 AliMUONTrackerData::SetExternalDimensionName(Int_t index, const char* value)
997 /// Set the name of a given external dimension
998 if ( index >= fExternalDimension )
1000 AliError(Form("Index out of bounds : %d / %d",index,fExternalDimension));
1004 TObjString* ovalue = static_cast<TObjString*>(fExternalDimensionNames->At(index));
1008 fExternalDimensionNames->Remove(ovalue);
1011 fExternalDimensionNames->AddAt(new TObjString(value),index);
1014 //_____________________________________________________________________________
1016 AliMUONTrackerData::Value(const AliMUONVCalibParam& param, Int_t i, Int_t dim) const
1018 /// Compute the value for a given dim, using the internal information we have
1019 /// Basically we're converting sum of weights and sum of squares of weights
1020 /// into means and sigmas, and number of events into occupancy number.
1022 Double_t n = param.ValueAsDouble(i,IndexOfNumberDimension());
1024 if ( dim == IndexOfNumberDimension() ) return n; // the number of channels in any given element does not depend on the number of events
1026 Double_t occ = param.ValueAsDouble(i,IndexOfOccupancyDimension());
1028 if ( dim >= fDimension )
1033 if ( dim == IndexOfOccupancyDimension() ) return occ/n/NumberOfEvents();
1035 Double_t value = param.ValueAsDouble(i,dim);
1037 if ( value >= AliMUONVCalibParam::InvalidFloatValue() ) return AliMUONVCalibParam::InvalidFloatValue();
1039 if ( TMath::Even(dim) || IsSingleEvent() )
1049 Double_t mean = param.ValueAsDouble(i,dim-1)/nn;
1051 return TMath::Sqrt(TMath::Abs((value-nn*mean*mean)/(nn-1.0)));
1059 AliError("Why am I here ?");