mchview version 0.94 which adds the possibility to read ASCII calibration files produ...
[u/mrichter/AliRoot.git] / MUON / AliMUONTrackerACFDataMaker.cxx
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 *                                                                        *
4 * Author: The ALICE Off-line Project.                                    *
5 * Contributors are mentioned in the code where appropriate.              *
6 *                                                                        *
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 **************************************************************************/
15
16 // $Id$
17
18 #include "AliMUONTrackerACFDataMaker.h"
19
20 #include "AliMUONTrackerData.h"
21 #include "AliMUONTrackerIO.h"
22 #include "AliMUON2DMap.h"
23 #include "AliMUON1DMap.h"
24 #include "AliLog.h"
25 #include <TString.h>
26 #include <TSystem.h>
27
28 ///\class AliMUONTrackerACFDataMaker
29 ///
30 /// Producer of AliMUONVTrackerData from ASCII calibration files
31 ///
32 ///\author Laurent Aphecetche, Subatech
33
34 ///\cond CLASSIMP
35 ClassImp(AliMUONTrackerACFDataMaker)
36 ///\endcond
37
38 //_____________________________________________________________________________
39 AliMUONTrackerACFDataMaker::AliMUONTrackerACFDataMaker(const char* acfPath,
40                                                         const char* type)
41 : AliMUONVTrackerDataMaker(),
42   fIsValid(kTRUE),
43   fData(0x0),
44   fSource(Form("%s-%s",acfPath,type))
45 {
46     /// Ctor
47
48     static Int_t number(0);
49     
50     ++number;
51     
52     AliMUONVStore* store(0x0);
53     
54     TString stype(type);
55     stype.ToUpper();
56     Bool_t isSingleEvent(kTRUE);
57     TString filename(gSystem->ExpandPathName(acfPath));
58     
59     if ( stype == "PEDESTALS" )
60     {
61       fData = new AliMUONTrackerData(Form("PED",number),"Pedestals",2,isSingleEvent);
62       fData->SetDimensionName(0,"Mean");
63       fData->SetDimensionName(1,"Sigma");
64       store = new AliMUON2DMap(kTRUE);
65       AliMUONTrackerIO::ReadPedestals(filename.Data(),*store);
66     }
67     else if ( stype == "GAINS" ) 
68     {
69       fData = new AliMUONTrackerData(Form("GAIN%d",number),"Gains",5,isSingleEvent);
70       fData->SetDimensionName(0,"a1");
71       fData->SetDimensionName(1,"a2");
72       fData->SetDimensionName(2,"thres");
73       fData->SetDimensionName(3,"qual");
74       fData->SetDimensionName(4,"sat");
75       store = new AliMUON2DMap(kTRUE);
76       TString comment;
77       AliMUONTrackerIO::ReadGains(filename.Data(),*store,comment);
78     }
79     else if ( stype == "CAPACITANCES" )
80     {
81       fData = new AliMUONTrackerData(Form("CAPA%d",number),"Capacitances",2,isSingleEvent);
82       fData->SetDimensionName(0,"Capa");
83       fData->SetDimensionName(1,"Injection gain");
84       store = new AliMUON1DMap(20000);
85       AliMUONTrackerIO::ReadCapacitances(filename.Data(),*store);
86     }
87     
88     if (!store)
89     {
90       fIsValid = kFALSE;
91       delete fData;
92       fData = 0x0;
93       AliError("Could not create store");
94       return;
95     }
96     
97     fData->Add(*store);
98 }
99
100 //_____________________________________________________________________________
101 AliMUONTrackerACFDataMaker::~AliMUONTrackerACFDataMaker()
102 {
103   /// dtor
104   delete fData;
105 }
106
107 //_____________________________________________________________________________
108 Long64_t 
109 AliMUONTrackerACFDataMaker::Merge(TCollection*)
110 {
111   /// Merge
112   AliError("Not implemented. Does it have sense ?");
113   return 0;
114 }
115