93 if (strcmp(
algoMode.c_str(),
"CalibTree") == 0)
100 if (strcmp(
algoMode.c_str(),
"MultiJob") == 0) {
105 }
else if (strcmp(
algoMode.c_str(),
"WriteOnDB") == 0) {
109 }
else if (strcmp(
algoMode.c_str(),
"CalibTree") == 0) {
127 unsigned track_index = 0;
129 it != trajTrackAssociationHandle->
end();
130 ++it, track_index++) {
144 const vector<TrajectoryMeasurement>& measurements = traj.
measurements();
145 for (vector<TrajectoryMeasurement>::const_iterator it = measurements.begin(); it != measurements.end(); it++) {
154 float cosine = trackDirection.
z() / trackDirection.
mag();
165 auto const& thit = static_cast<BaseTrackerRecHit const&>(*
recHit);
169 auto const& clus = thit.firstClusterRef();
174 if (clus.isPixel()) {
176 }
else if (clus.isStrip() && !thit.isMatched()) {
177 auto& detUnit = *(
recHit->detUnit());
178 auto& cluster = clus.stripCluster();
188 float pathLen = 10.0 * detUnit.surface().bounds().thickness() / fabs(cosine);
190 float charge = chargeAbs / pathLen;
194 }
else if (clus.isStrip() && thit.isMatched()) {
198 const GluedGeomDet* gdet = static_cast<const GluedGeomDet*>(matchedHit->
det());
200 auto& detUnitM = *(gdet->
monoDet());
211 float pathLen = 10.0 * detUnitM.surface().bounds().thickness() / fabs(cosine);
213 float charge = chargeAbs / pathLen;
229 pathLen = 10.0 * detUnitS.surface().bounds().thickness() / fabs(cosine);
231 charge = chargeAbs / pathLen;
243 unsigned int NEvent = 0;
247 TChain*
tree =
new TChain(
"gainCalibrationTree/tree");
250 TString EventPrefix(
"");
251 TString EventSuffix(
"");
253 TString TrackPrefix(
"track");
254 TString TrackSuffix(
"");
256 TString CalibPrefix(
"GainCalibration");
257 TString CalibSuffix(
"");
259 unsigned int eventnumber = 0;
260 tree->SetBranchAddress(EventPrefix +
"event" + EventSuffix, &eventnumber,
nullptr);
262 tree->SetBranchAddress(EventPrefix +
"run" + EventSuffix, &
runnumber,
nullptr);
263 std::vector<bool>* TrigTech =
nullptr;
264 tree->SetBranchAddress(EventPrefix +
"TrigTech" + EventSuffix, &TrigTech,
nullptr);
266 std::vector<double>* trackchi2ndof =
nullptr;
267 tree->SetBranchAddress(TrackPrefix +
"chi2ndof" + TrackSuffix, &trackchi2ndof,
nullptr);
268 std::vector<float>* trackp =
nullptr;
269 tree->SetBranchAddress(TrackPrefix +
"momentum" + TrackSuffix, &trackp,
nullptr);
270 std::vector<float>* trackpt =
nullptr;
271 tree->SetBranchAddress(TrackPrefix +
"pt" + TrackSuffix, &trackpt,
nullptr);
272 std::vector<double>* tracketa =
nullptr;
273 tree->SetBranchAddress(TrackPrefix +
"eta" + TrackSuffix, &tracketa,
nullptr);
274 std::vector<double>* trackphi =
nullptr;
275 tree->SetBranchAddress(TrackPrefix +
"phi" + TrackSuffix, &trackphi,
nullptr);
276 std::vector<unsigned int>* trackhitsvalid =
nullptr;
277 tree->SetBranchAddress(TrackPrefix +
"hitsvalid" + TrackSuffix, &trackhitsvalid,
nullptr);
279 std::vector<int>* trackindex =
nullptr;
280 tree->SetBranchAddress(CalibPrefix +
"trackindex" + CalibSuffix, &trackindex,
nullptr);
281 std::vector<unsigned int>* rawid =
nullptr;
282 tree->SetBranchAddress(CalibPrefix +
"rawid" + CalibSuffix, &rawid,
nullptr);
283 std::vector<unsigned short>* firststrip =
nullptr;
284 tree->SetBranchAddress(CalibPrefix +
"firststrip" + CalibSuffix, &firststrip,
nullptr);
285 std::vector<unsigned short>* nstrips =
nullptr;
286 tree->SetBranchAddress(CalibPrefix +
"nstrips" + CalibSuffix, &nstrips,
nullptr);
287 std::vector<unsigned int>*
charge =
nullptr;
288 tree->SetBranchAddress(CalibPrefix +
"charge" + CalibSuffix, &
charge,
nullptr);
289 std::vector<float>*
path =
nullptr;
290 tree->SetBranchAddress(CalibPrefix +
"path" + CalibSuffix, &
path,
nullptr);
291 std::vector<unsigned char>*
amplitude =
nullptr;
292 tree->SetBranchAddress(CalibPrefix +
"amplitude" + CalibSuffix, &
amplitude,
nullptr);
293 std::vector<double>* gainused =
nullptr;
294 tree->SetBranchAddress(CalibPrefix +
"gainused" + CalibSuffix, &gainused,
nullptr);
296 printf(
"Number of Events = %i + %i = %i\n",
298 (
unsigned int)
tree->GetEntries(),
299 (
unsigned int)(NEvent +
tree->GetEntries()));
300 NEvent +=
tree->GetEntries();
301 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
302 printf(
"Looping on the Tree :");
303 int TreeStep =
tree->GetEntries() / 50;
306 for (
unsigned int ientry = 0; ientry <
tree->GetEntries(); ientry++) {
307 if (ientry % TreeStep == 0) {
311 tree->GetEntry(ientry);
313 int FirstAmplitude = 0;
314 for (
unsigned int c = 0;
c < (*path).size();
c++) {
315 FirstAmplitude += (*nstrips)[
c];
316 int t = (*trackindex)[
c];
317 if ((*trackpt)[
t] < 5)
319 if ((*trackhitsvalid)[
t] < 5)
325 auto&
gain = gains[(*firststrip)[
c] / 128];
326 for (
unsigned int s = 0;
s < (*nstrips)[
c];
s++) {
327 int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[
c] +
s];
328 if (StripCharge < 254) {
329 StripCharge = (
int)(StripCharge /
gain);
330 if (StripCharge >= 1024) {
332 }
else if (StripCharge >= 254) {
343 double ClusterChargeOverPath = ((double)
Charge) / (*path)[
c];
352 auto obj = std::make_unique<PhysicsTools::Calibration::HistogramD3D>(
Charge_Vs_Path->GetNbinsX(),