]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/MakeMUONRecoParamArray.C
In AliMUONReconstructor:
[u/mrichter/AliRoot.git] / MUON / MakeMUONRecoParamArray.C
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 /// \ingroup macros
19 /// \file MakeMUONRecoParamArray.C
20 /// \brief Macro to set reconstruction parameters and put them in the OCDB
21 ///
22 /// \author Philippe Pillot, SUBATECH
23
24 #if !defined(__CINT__) || defined(__MAKECINT__)
25
26 #include "AliMUONRecoParam.h"
27 #include "AliMUONCDB.h"
28
29 #include "AliCDBManager.h"
30 #include "AliRecoParam.h"
31
32 #include <TObjArray.h>
33 #include <TIterator.h>
34
35 #include <Riostream.h>
36
37 #endif
38
39
40
41 //-----------------------------------------------------------------------
42 void MakeMUONRecoParamArray(Int_t startRun = 0, Int_t endRun = AliCDBRunRange::Infinity(),
43                             Int_t settingsForCosmicRun = kFALSE)
44 {
45   /// set the reconstruction parameters and store them in the OCDB ($ALICE_ROOT/OCDB/MUON/Calib/RecoParam/).
46   /// - make a CDB entry for the run range [startRun, endRun]
47   /// - the choice between two possible configurations:
48   ///   -  settingsForCosmicRun = kFALSE (default), i.e.
49   ///      LowFlux (default)
50   ///      Calibration
51   ///   - settingsForCosmicRun = kTRUE, i.e.
52   ///      Cosmic (default)
53   ///      Calibration
54   
55   // init CDB
56   AliCDBManager* man = AliCDBManager::Instance();
57   if(!man->IsDefaultStorageSet()) man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
58   man->SetRun(startRun);
59   
60   // set RecoParams
61   AliMUONRecoParam *param;
62   TObjArray recoParams;
63
64   AliRecoParam::EventSpecie_t defaultParam = AliRecoParam::kLowMult;
65
66   if(!settingsForCosmicRun) {
67     // set parameters for p-p runs
68     param = AliMUONRecoParam::GetLowFluxParam();
69     recoParams.AddLast(param);
70   }
71   else {
72     // set parameters for cosmic runs
73     param = AliMUONRecoParam::GetCosmicParam();
74     recoParams.AddLast(param);
75     defaultParam = AliRecoParam::kCosmic;
76   }
77
78   // set (dummy) parameters for calibration runs
79   param = AliMUONRecoParam::GetCalibrationParam();
80   recoParams.AddLast(param);
81
82   // set parameters for Pb-Pb runs
83   // param = AliMUONRecoParam::GetHighFluxParam();
84   // recoParams.AddLast(param);
85
86   // identify default parameters (exit if identification failed)
87   Bool_t defaultIsSet = kFALSE;
88   TIter next(recoParams.MakeIterator());
89   while ( (param = static_cast<AliMUONRecoParam*>(next())) ) {
90     if (param->GetEventSpecie() == defaultParam) {
91       param->SetAsDefault();
92       defaultIsSet = kTRUE;
93     }
94     param->Print("FULL");
95   }
96   if (!defaultIsSet) {
97     cout<<"The default reconstruction parameters are not set! Exiting..."<<endl;
98     return;
99   }
100   
101   // save RecoParam in CDB
102   AliMUONCDB::WriteToCDB(&recoParams, "MUON/Calib/RecoParam", startRun, endRun, "reconstruction parameters for MUON", "Philippe Pillot");
103   
104 }
105