Skip to content

Commit 0c31fc0

Browse files
author
Christian Holm Christensen
authored
Merge branch 'AliceO2Group:dev' into cholmcc_aod_producers_refactor
2 parents fda6a94 + 1170977 commit 0c31fc0

22 files changed

Lines changed: 390 additions & 107 deletions

File tree

CCDB/src/CCDBDownloader.cxx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -403,30 +403,37 @@ std::string CCDBDownloader::trimHostUrl(std::string full_host_url) const
403403
{
404404
CURLU* host_url = curl_url();
405405
curl_url_set(host_url, CURLUPART_URL, full_host_url.c_str(), 0);
406-
// Get host part
406+
407+
// Get host part (the only critical part)
407408
char* host;
408409
CURLUcode host_result = curl_url_get(host_url, CURLUPART_HOST, &host, 0);
409-
std::string host_name;
410-
if (host_result == CURLUE_OK) {
411-
// Host part present
412-
host_name = host;
413-
curl_free(host);
414-
} else {
410+
if (host_result != CURLUE_OK) {
415411
LOG(error) << "CCDBDownloader: Malformed url detected when processing redirect, could not identify the host part: " << host;
416412
curl_url_cleanup(host_url);
417413
return "";
418414
}
419415
// Get scheme (protocol) part
420416
char* scheme;
421417
CURLUcode scheme_result = curl_url_get(host_url, CURLUPART_SCHEME, &scheme, 0);
418+
// Get port
419+
char* port;
420+
CURLUcode port_result = curl_url_get(host_url, CURLUPART_PORT, &port, 0);
421+
422422
curl_url_cleanup(host_url);
423+
424+
// Assemble parts
425+
std::string trimmed_url = "";
423426
if (scheme_result == CURLUE_OK) {
424-
// If protocol present combine with host
425-
curl_free(scheme);
426-
return scheme + std::string("://") + host_name;
427-
} else {
428-
return host_name;
427+
trimmed_url += scheme + std::string("://");
428+
free(scheme);
429+
}
430+
trimmed_url += host;
431+
free(host);
432+
if (port_result == CURLUE_OK) {
433+
trimmed_url += std::string(":") + port;
434+
free(port);
429435
}
436+
return trimmed_url;
430437
}
431438

432439
std::string CCDBDownloader::prepareRedirectedURL(std::string address, std::string potentialHost) const

DataFormats/Detectors/CTP/src/Configuration.cxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,9 @@ void CTPInputsConfiguration::printStream(std::ostream& stream) const
10491049
input.printStream(stream);
10501050
}
10511051
}
1052+
//
1053+
// EMBA - software generated input for EMC - Min Bias Accepted
1054+
//
10521055
const std::vector<CTPInput> CTPInputsConfiguration::CTPInputsDefault =
10531056
{
10541057
CTPInput("MT0A", "FT0", 1), CTPInput("MT0C", "FT0", 2), CTPInput("MTVX", "FT0", 3), CTPInput("MTSC", "FT0", 4), CTPInput("MTCE", "FT0", 5),
@@ -1057,7 +1060,7 @@ const std::vector<CTPInput> CTPInputsConfiguration::CTPInputsDefault =
10571060
CTPInput("0DMC", "EMC", 14), CTPInput("0DJ1", "EMC", 41), CTPInput("0DG1", "EMC", 42), CTPInput("0DJ2", "EMC", 43), CTPInput("0DG2", "EMC", 44),
10581061
CTPInput("0EMC", "EMC", 21), CTPInput("0EJ1", "EMC", 37), CTPInput("0EG1", "EMC", 38), CTPInput("0EJ2", "EMC", 39), CTPInput("0EG2", "EMC", 40),
10591062
CTPInput("0PH0", "PHS", 22), CTPInput("1PHL", "PHS", 27), CTPInput("1PHH", "PHS", 28), CTPInput("1PHL", "PHM", 29),
1060-
CTPInput("1ZED", "ZDC", 25), CTPInput("1ZNC", "ZDC", 26)};
1063+
CTPInput("1ZED", "ZDC", 25), CTPInput("1ZNC", "ZDC", 26), CTPInput("EMBA", "EMC", 48)};
10611064
void CTPInputsConfiguration::initDefaultInputConfig()
10621065
{
10631066
defaultInputConfig.CTPInputs = CTPInputsConfiguration::CTPInputsDefault;

DataFormats/Detectors/CTP/src/Scalers.cxx

Lines changed: 62 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,8 @@ void CTPRunScalers::printLMBRateVsT() const
628628

629629
// returns the pair of global (levelled) interaction rate, as well as instantaneous interpolated
630630
// rate in Hz at a certain orbit number within the run
631+
// type - 7 : inputs
632+
// type - 1..6 : lmb,lma,l0b,l0a,l1b,l1a
631633
std::pair<double, double> CTPRunScalers::getRate(uint32_t orbit, int classindex, int type) const
632634
{
633635
if (mScalerRecordO2.size() <= 1) {
@@ -646,23 +648,49 @@ std::pair<double, double> CTPRunScalers::getRate(uint32_t orbit, int classindex,
646648
auto next = &mScalerRecordO2[index2];
647649
auto prev = &mScalerRecordO2[index1];
648650
auto timedelta = (next->intRecord.orbit - prev->intRecord.orbit) * 88.e-6; // converts orbits into time
649-
auto s0 = &(prev->scalers[classindex]); // type CTPScalerO2*
650-
auto s1 = &(next->scalers[classindex]);
651-
return (s1->lmBefore - s0->lmBefore) / timedelta; // rate --> should be made better by selecting on type
651+
if (type < 7) {
652+
auto s0 = &(prev->scalers[classindex]); // type CTPScalerO2*
653+
auto s1 = &(next->scalers[classindex]);
654+
switch (type) {
655+
case 1:
656+
return (s1->lmBefore - s0->lmBefore) / timedelta;
657+
case 2:
658+
return (s1->lmAfter - s0->lmAfter) / timedelta;
659+
case 3:
660+
return (s1->l0Before - s0->l0Before) / timedelta;
661+
case 4:
662+
return (s1->l0After - s0->l0After) / timedelta;
663+
case 5:
664+
return (s1->l1Before - s0->l1Before) / timedelta;
665+
case 6:
666+
return (s1->l1After - s0->l1After) / timedelta;
667+
default:
668+
LOG(error) << "Wrong type:" << type;
669+
return -1; // wrong type
670+
}
671+
} else if (type == 7) {
672+
auto s0 = &(prev->scalersInps[classindex]); // type CTPScalerO2*
673+
auto s1 = &(next->scalersInps[classindex]);
674+
return (s1 - s0) / timedelta;
675+
} else {
676+
LOG(error) << "Wrong type:" << type;
677+
return -1; // wrong type
678+
}
652679
};
653680

654681
if (nextindex == 0 || nextindex == mScalerRecordO2.size()) {
655682
// orbit is out of bounds
656683
LOG(info) << "query orbit " << orbit << " out of bounds; Just returning the global rate";
657684
return std::make_pair(/*global mean rate*/ calcRate(0, mScalerRecordO2.size() - 1), /* current rate */ -1);
658685
} else {
659-
660686
return std::make_pair(/*global mean rate*/ calcRate(0, mScalerRecordO2.size() - 1), /* current rate */ calcRate(nextindex - 1, nextindex));
661687
}
662688
return std::make_pair(-1., -1.);
663689
}
664690
// returns the pair of global (levelled) interaction rate, as well as instantaneous interpolated
665691
// rate in Hz at a certain orbit number within the run
692+
// type - 7 : inputs
693+
// type - 1..6 : lmb,lma,l0b,l0a,l1b,l1a
666694
std::pair<double, double> CTPRunScalers::getRateGivenT(double timestamp, int classindex, int type) const
667695
{
668696
if (mScalerRecordO2.size() <= 1) {
@@ -681,11 +709,37 @@ std::pair<double, double> CTPRunScalers::getRateGivenT(double timestamp, int cla
681709
auto next = &mScalerRecordO2[index2];
682710
auto prev = &mScalerRecordO2[index1];
683711
auto timedelta = (next->intRecord.orbit - prev->intRecord.orbit) * 88.e-6; // converts orbits into time
684-
auto s0 = &(prev->scalers[classindex]); // type CTPScalerO2*
685-
auto s1 = &(next->scalers[classindex]);
686-
return (s1->lmBefore - s0->lmBefore) / timedelta; // rate --> should be made better by selecting on type
712+
// std::cout << "timedelta:" << timedelta << std::endl;
713+
if (type < 7) {
714+
auto s0 = &(prev->scalers[classindex]); // type CTPScalerO2*
715+
auto s1 = &(next->scalers[classindex]);
716+
switch (type) {
717+
case 1:
718+
return (s1->lmBefore - s0->lmBefore) / timedelta;
719+
case 2:
720+
return (s1->lmAfter - s0->lmAfter) / timedelta;
721+
case 3:
722+
return (s1->l0Before - s0->l0Before) / timedelta;
723+
case 4:
724+
return (s1->l0After - s0->l0After) / timedelta;
725+
case 5:
726+
return (s1->l1Before - s0->l1Before) / timedelta;
727+
case 6:
728+
return (s1->l1After - s0->l1After) / timedelta;
729+
default:
730+
LOG(error) << "Wrong type:" << type;
731+
return -1; // wrong type
732+
}
733+
} else if (type == 7) {
734+
// LOG(info) << "doing input:";
735+
auto s0 = prev->scalersInps[classindex]; // type CTPScalerO2*
736+
auto s1 = next->scalersInps[classindex];
737+
return (s1 - s0) / timedelta;
738+
} else {
739+
LOG(error) << "Wrong type:" << type;
740+
return -1; // wrong type
741+
}
687742
};
688-
689743
if (nextindex == 0 || nextindex == mScalerRecordO2.size()) {
690744
// orbit is out of bounds
691745
LOG(info) << "query timestamp " << timestamp << " out of bounds; Just returning the global rate";

DataFormats/Detectors/TPC/include/DataFormatsTPC/PIDResponse.h

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class PIDResponse
5858
GPUd() float getExpectedSignal(const TrackTPC& track, const o2::track::PID::ID id) const;
5959

6060
/// get most probable PID of the track
61-
GPUd() o2::track::PID::ID getMostProbablePID(const TrackTPC& track, float PID_EKrangeMin, float PID_EKrangeMax, float PID_EPrangeMin, float PID_EPrangeMax, float PID_EDrangeMin, float PID_EDrangeMax, float PID_ETrangeMin, float PID_ETrangeMax) const;
61+
GPUd() o2::track::PID::ID getMostProbablePID(const TrackTPC& track, float PID_EKrangeMin, float PID_EKrangeMax, float PID_EPrangeMin, float PID_EPrangeMax, float PID_EDrangeMin, float PID_EDrangeMax, float PID_ETrangeMin, float PID_ETrangeMax, char PID_useNsigma, float PID_sigma) const;
6262

6363
private:
6464
float mBetheBlochParams[5] = {0.19310481, 4.26696118, 0.00522579, 2.38124907, 0.98055396}; // BBAleph average fit parameters
@@ -88,7 +88,7 @@ GPUd() float PIDResponse::getExpectedSignal(const TrackTPC& track, const o2::tra
8888
}
8989

9090
// get most probable PID
91-
GPUd() o2::track::PID::ID PIDResponse::getMostProbablePID(const TrackTPC& track, float PID_EKrangeMin, float PID_EKrangeMax, float PID_EPrangeMin, float PID_EPrangeMax, float PID_EDrangeMin, float PID_EDrangeMax, float PID_ETrangeMin, float PID_ETrangeMax) const
91+
GPUd() o2::track::PID::ID PIDResponse::getMostProbablePID(const TrackTPC& track, float PID_EKrangeMin, float PID_EKrangeMax, float PID_EPrangeMin, float PID_EPrangeMax, float PID_EDrangeMin, float PID_EDrangeMax, float PID_ETrangeMin, float PID_ETrangeMax, char PID_useNsigma, float PID_sigma) const
9292
{
9393
const float dEdx = track.getdEdx().dEdxTotTPC;
9494

@@ -97,12 +97,28 @@ GPUd() o2::track::PID::ID PIDResponse::getMostProbablePID(const TrackTPC& track,
9797
}
9898

9999
auto id = o2::track::PID::Electron;
100-
float distanceMin = o2::gpu::GPUCommonMath::Abs(dEdx - getExpectedSignal(track, id));
100+
float distanceMin = 0.;
101+
float dEdxExpected = getExpectedSignal(track, id);
102+
if (PID_useNsigma) {
103+
// using nSigma
104+
distanceMin = o2::gpu::GPUCommonMath::Abs((dEdx - dEdxExpected) / (PID_sigma * dEdxExpected));
105+
} else {
106+
// using absolute distance
107+
distanceMin = o2::gpu::GPUCommonMath::Abs(dEdx - dEdxExpected);
108+
}
101109

102110
// calculate the distance to the expected dEdx signals
103111
// start from Pion to exlude Muons
104112
for (o2::track::PID::ID i = o2::track::PID::Pion; i < o2::track::PID::NIDs; i++) {
105-
const float distance = o2::gpu::GPUCommonMath::Abs(dEdx - getExpectedSignal(track, i));
113+
float distance = 0.;
114+
dEdxExpected = getExpectedSignal(track, i);
115+
if (PID_useNsigma) {
116+
// using nSigma
117+
distance = o2::gpu::GPUCommonMath::Abs((dEdx - dEdxExpected) / (PID_sigma * dEdxExpected));
118+
} else {
119+
// using absolute distance
120+
distance = o2::gpu::GPUCommonMath::Abs(dEdx - dEdxExpected);
121+
}
106122
if (distance < distanceMin) {
107123
id = i;
108124
distanceMin = distance;

DataFormats/Detectors/TRD/include/DataFormatsTRD/Constants.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ constexpr int TRDLINKID = 15; ///< hard coded link id, specific to TRD
4141
constexpr int NCOLUMN = 144; ///< the number of pad columns for each chamber
4242
constexpr int NROWC0 = 12; ///< the number of pad rows for chambers of type C0 (installed in stack 2)
4343
constexpr int NROWC1 = 16; ///< the number of pad rows for chambers of type C1 (installed in stacks 0, 1, 3 and 4)
44+
constexpr int FIRSTROW[NSTACK] = {0, 16, 32, 44, 60}; ///< first pad row for each stack
4445

4546
constexpr int NMCMROB = 16; ///< the number of MCMs per ROB
4647
constexpr int NMCMHCMAX = 64; ///< the maximum number of MCMs for one half chamber (C1 type)

DataFormats/Detectors/TRD/include/DataFormatsTRD/Digit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class Digit
8282
int getPadCol() const { return HelperMethods::getPadColFromADC(mROB, mMCM, mChannel); }
8383
int getROB() const { return mROB; }
8484
int getMCM() const { return mMCM; }
85+
int getMCMCol() const { return (getMCM() % constants::NMCMROBINCOL) + constants::NMCMROBINCOL * (getROB() % 2); }
8586
int getChannel() const { return mChannel; }
8687
int getPreTrigPhase() const { return ((mDetector >> 12) & 0xf); }
8788
bool isSharedDigit() const;

DataFormats/MemoryResources/test/testMemoryResources.cxx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int testData::nconstructions = 0;
4747

4848
BOOST_AUTO_TEST_CASE(transportallocatormap_test)
4949
{
50-
size_t session{fair::mq::tools::UuidHash()};
50+
size_t session{(size_t)getpid() * 1000};
5151
fair::mq::ProgOptions config;
5252
config.SetProperty<std::string>("session", std::to_string(session));
5353

@@ -64,7 +64,7 @@ using namespace boost::container::pmr;
6464

6565
BOOST_AUTO_TEST_CASE(allocator_test)
6666
{
67-
size_t session{fair::mq::tools::UuidHash()};
67+
size_t session{(size_t)getpid() * 1000 + 1};
6868
fair::mq::ProgOptions config;
6969
config.SetProperty<std::string>("session", std::to_string(session));
7070

@@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(allocator_test)
102102

103103
BOOST_AUTO_TEST_CASE(getMessage_test)
104104
{
105-
size_t session{fair::mq::tools::UuidHash()};
105+
size_t session{(size_t)getpid() * 1000 + 2};
106106
fair::mq::ProgOptions config;
107107
config.SetProperty<std::string>("session", std::to_string(session));
108108

@@ -154,7 +154,7 @@ BOOST_AUTO_TEST_CASE(getMessage_test)
154154

155155
BOOST_AUTO_TEST_CASE(adoptVector_test)
156156
{
157-
size_t session{fair::mq::tools::UuidHash()};
157+
size_t session{(size_t)getpid() * 1000 + 3};
158158
fair::mq::ProgOptions config;
159159
config.SetProperty<std::string>("session", std::to_string(session));
160160

@@ -165,7 +165,7 @@ BOOST_AUTO_TEST_CASE(adoptVector_test)
165165

166166
testData::nconstructions = 0;
167167

168-
//Create a bogus message
168+
// Create a bogus message
169169
auto message = factoryZMQ->CreateMessage(3 * sizeof(testData));
170170
auto messageAddr = message.get();
171171
testData tmpBuf[3] = {3, 2, 1};

Detectors/CTP/macro/PlotPbLumi.C

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <iostream>
2626
#endif
2727
using namespace o2::ctp;
28-
void PlotPbLumiII(int runNumber, int fillN, std::string ccdbHost = "http://ccdb-test.cern.ch:8080")
28+
void PlotPbLumi(int runNumber, int fillN, std::string ccdbHost = "http://ccdb-test.cern.ch:8080")
2929
{ //
3030
// what = 1: znc rate
3131
// what = 2: (TCE+TSC)/ZNC
@@ -173,4 +173,10 @@ void PlotPbLumiII(int runNumber, int fillN, std::string ccdbHost = "http://ccdb-
173173
gr3->Draw("AP");
174174
c1->cd(4);
175175
gr4->Draw("AP");
176+
// getRate test:
177+
double tt = timeStamp / 1000.;
178+
std::pair<double, double> r1 = scl->getRateGivenT(tt, 25, 7);
179+
std::cout << "ZDC input getRateGivetT:" << r1.first / 28. << " " << r1.second / 28. << std::endl;
180+
std::pair<double, double> r2 = scl->getRateGivenT(tt, tce, 1);
181+
std::cout << "LM before TCE class getRateGivetT:" << r2.first << " " << r2.second << std::endl;
176182
}

0 commit comments

Comments
 (0)