@@ -46,7 +46,13 @@ void CTPTrendingTask::initCTP(Trigger& t)
4646 std::string run = std::to_string (t.activity .mId );
4747 // CTPRunManager::setCCDBHost("https://alice-ccdb.cern.ch");
4848 // mCTPconfig = CTPRunManager::getConfigFromCCDB(t.timestamp, run);
49- std::string CCDBHost = " https://alice-ccdb.cern.ch" ;
49+ std::string CCDBHost;
50+ try {
51+ CCDBHost = std::stof (mCustomParameters .at (" ccdbName" , " default" ));
52+ } catch (const std::exception& e) {
53+ CCDBHost = " https://alice-ccdb.cern.ch" ;
54+ }
55+
5056 auto & mgr = o2::ccdb::BasicCCDBManager::instance ();
5157 mgr.setURL (CCDBHost);
5258 map<string, string> metadata; // can be empty
@@ -56,6 +62,67 @@ void CTPTrendingTask::initCTP(Trigger& t)
5662 ILOG (Warning, Support) << " CTP Config not found for run:" << run << " timesamp " << t.timestamp << ENDM ;
5763 return ;
5864 }
65+
66+ try {
67+ mClassNames [0 ] = std::stof (mCustomParameters .at (" minBias1Class" , " default" ));
68+ } catch (const std::exception& e) {
69+ mClassNames [0 ] = mClassNamesDefault [0 ];
70+ }
71+
72+ try {
73+ mClassNames [1 ] = std::stof (mCustomParameters .at (" minBias2Class" , " default" ));
74+ } catch (const std::exception& e) {
75+ mClassNames [1 ] = mClassNamesDefault [1 ];
76+ }
77+
78+ try {
79+ mClassNames [2 ] = std::stof (mCustomParameters .at (" minBisDMCclass" , " default" ));
80+ } catch (const std::exception& e) {
81+ mClassNames [2 ] = mClassNamesDefault [2 ];
82+ }
83+
84+ try {
85+ mClassNames [3 ] = std::stof (mCustomParameters .at (" minBiasEMCclass" , " default" ));
86+ } catch (const std::exception& e) {
87+ mClassNames [3 ] = mClassNamesDefault [3 ];
88+ }
89+
90+ try {
91+ mClassNames [4 ] = std::stof (mCustomParameters .at (" minBiasPHOclass" , " default" ));
92+ } catch (const std::exception& e) {
93+ mClassNames [4 ] = mClassNamesDefault [4 ];
94+ }
95+
96+ try {
97+ mInputNames [0 ] = std::stof (mCustomParameters .at (" minBias1Input" , " default" ));
98+ } catch (const std::exception& e) {
99+ mInputNames [0 ] = mInputNamesDefault [0 ];
100+ }
101+
102+ try {
103+ mInputNames [1 ] = std::stof (mCustomParameters .at (" minBias2Input" , " default" ));
104+ } catch (const std::exception& e) {
105+ mInputNames [1 ] = mInputNamesDefault [1 ];
106+ }
107+
108+ try {
109+ mInputNames [2 ] = std::stof (mCustomParameters .at (" minBisDMCInput" , " default" ));
110+ } catch (const std::exception& e) {
111+ mInputNames [2 ] = mInputNamesDefault [2 ];
112+ }
113+
114+ try {
115+ mInputNames [3 ] = std::stof (mCustomParameters .at (" minBiasEMCInput" , " default" ));
116+ } catch (const std::exception& e) {
117+ mInputNames [3 ] = mInputNamesDefault [3 ];
118+ }
119+
120+ try {
121+ mInputNames [4 ] = std::stof (mCustomParameters .at (" minBiasPHOInput" , " default" ));
122+ } catch (const std::exception& e) {
123+ mInputNames [4 ] = mInputNamesDefault [4 ];
124+ }
125+
59126 // get the indeces of the classes we want to trend
60127 std::vector<ctp::CTPClass> ctpcls = mCTPconfig ->getCTPClasses ();
61128 std::vector<int > clslist = mCTPconfig ->getTriggerClassList ();
@@ -68,6 +135,15 @@ void CTPTrendingTask::initCTP(Trigger& t)
68135 }
69136 }
70137
138+ for (size_t i = 0 ; i < sizeof (ctpinputs) / sizeof (std::string); i++) {
139+ for (size_t j = 0 ; j < mNumOfInputs ; j++) {
140+ if (ctpinputs[i].find (mInputNames [j]) != std::string::npos) {
141+ mInputIndex [j] = i + 1 ;
142+ break ;
143+ }
144+ }
145+ }
146+
71147 // Preparing data structure of TTree
72148 for (const auto & source : mConfig .dataSources ) {
73149 mReductors .emplace (source.name , root_class_factory::create<o2::quality_control_modules::ctp::TH1ctpReductor>(source.moduleName , source.reductorName ));
@@ -77,20 +153,18 @@ void CTPTrendingTask::initCTP(Trigger& t)
77153 mTrend ->Branch (" runNumber" , &mMetaData .runNumber );
78154 mTrend ->Branch (" time" , &mTime );
79155 for (const auto & [sourceName, reductor] : mReductors ) {
80- reductor->SetMTVXIndex (mClassIndex [0 ]);
81- reductor->SetMVBAIndex (mClassIndex [1 ]);
82- reductor->SetTVXDCMIndex (mClassIndex [2 ]);
83- reductor->SetTVXEMCIndex (mClassIndex [3 ]);
84- reductor->SetTVXPHOIndex (mClassIndex [4 ]);
156+ reductor->SetClassIndexes (mClassIndex [0 ], mClassIndex [1 ], mClassIndex [2 ], mClassIndex [3 ], mClassIndex [4 ]);
157+ reductor->SetInputIndexes (mInputIndex [0 ], mInputIndex [1 ], mInputIndex [2 ], mInputIndex [3 ], mInputIndex [4 ]);
85158 mTrend ->Branch (sourceName.c_str (), reductor->getBranchAddress (), reductor->getBranchLeafList ());
86159 }
160+
87161 getObjectsManager ()->startPublishing (mTrend .get ());
88162 ILOG (Debug, Devel) << " Trending run : " << run << ENDM ;
89163}
90164void CTPTrendingTask::initialize (Trigger t, framework::ServiceRegistryRef services)
91165{
92166 // // read out the CTPConfiguration
93- // initCCTP( ); - too eraly here ?
167+ // initCTP(t ); // - too eraly here ?
94168}
95169
96170void CTPTrendingTask::update (Trigger t, framework::ServiceRegistryRef services)
@@ -169,12 +243,24 @@ void CTPTrendingTask::generatePlots()
169243 mPlots [plot.name ] = nullptr ;
170244 }
171245
246+ if (index < 5 && mInputIndex [index] == 49 ) { // if the class index == 65, this class is not defined in the config, so it won't be trended
247+ ILOG (Info, Support) << " Input " << mInputNames [index] << " is not trended." << ENDM ;
248+ index++;
249+ continue ;
250+ }
251+
172252 if (index > 4 && index < 10 && mClassIndex [index - 5 ] == 65 ) { // if the class index == 65, this class is not defined in the config, so it won't be trended
173253 ILOG (Info, Support) << " Class " << mClassNames [index - 5 ] << " is not trended." << ENDM ;
174254 index++;
175255 continue ;
176256 }
177257
258+ if (index > 9 && index < 14 && (mInputIndex [index - 9 ] == 49 || mInputIndex [0 ] == 49 )) { // if the class index == 65, this class is not defined in the config, so it won't be trended
259+ ILOG (Info, Support) << " Input ratio " << mInputNames [index - 13 ] << " / " << mInputNames [0 ] << " is not trended." << ENDM ;
260+ index++;
261+ continue ;
262+ }
263+
178264 if (index > 13 && (mClassIndex [index - 13 ] == 65 || mClassIndex [0 ] == 65 )) { // if the class index == 65, this class is not defined in the config, so it won't be trended
179265 ILOG (Info, Support) << " Class ratio " << mClassNames [index - 13 ] << " / " << mClassNames [0 ] << " is not trended." << ENDM ;
180266 index++;
0 commit comments