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();
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()) {
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;
242 unsigned int NEvent = 0;
246 TChain*
tree =
new TChain(
"gainCalibrationTree/tree");
249 TString EventPrefix(
"");
250 TString EventSuffix(
"");
252 TString TrackPrefix(
"track");
253 TString TrackSuffix(
"");
255 TString CalibPrefix(
"GainCalibration");
256 TString CalibSuffix(
"");
258 unsigned int eventnumber = 0;
259 tree->SetBranchAddress(EventPrefix +
"event" + EventSuffix, &eventnumber,
nullptr);
261 tree->SetBranchAddress(EventPrefix +
"run" + EventSuffix, &
runnumber,
nullptr);
262 std::vector<bool>* TrigTech =
nullptr;
263 tree->SetBranchAddress(EventPrefix +
"TrigTech" + EventSuffix, &TrigTech,
nullptr);
265 std::vector<double>* trackchi2ndof =
nullptr;
266 tree->SetBranchAddress(TrackPrefix +
"chi2ndof" + TrackSuffix, &trackchi2ndof,
nullptr);
267 std::vector<float>* trackp =
nullptr;
268 tree->SetBranchAddress(TrackPrefix +
"momentum" + TrackSuffix, &trackp,
nullptr);
269 std::vector<float>* trackpt =
nullptr;
270 tree->SetBranchAddress(TrackPrefix +
"pt" + TrackSuffix, &trackpt,
nullptr);
271 std::vector<double>* tracketa =
nullptr;
272 tree->SetBranchAddress(TrackPrefix +
"eta" + TrackSuffix, &tracketa,
nullptr);
273 std::vector<double>* trackphi =
nullptr;
274 tree->SetBranchAddress(TrackPrefix +
"phi" + TrackSuffix, &trackphi,
nullptr);
275 std::vector<unsigned int>* trackhitsvalid =
nullptr;
276 tree->SetBranchAddress(TrackPrefix +
"hitsvalid" + TrackSuffix, &trackhitsvalid,
nullptr);
278 std::vector<int>* trackindex =
nullptr;
279 tree->SetBranchAddress(CalibPrefix +
"trackindex" + CalibSuffix, &trackindex,
nullptr);
280 std::vector<unsigned int>* rawid =
nullptr;
281 tree->SetBranchAddress(CalibPrefix +
"rawid" + CalibSuffix, &rawid,
nullptr);
282 std::vector<unsigned short>* firststrip =
nullptr;
283 tree->SetBranchAddress(CalibPrefix +
"firststrip" + CalibSuffix, &firststrip,
nullptr);
284 std::vector<unsigned short>* nstrips =
nullptr;
285 tree->SetBranchAddress(CalibPrefix +
"nstrips" + CalibSuffix, &nstrips,
nullptr);
286 std::vector<unsigned int>*
charge =
nullptr;
287 tree->SetBranchAddress(CalibPrefix +
"charge" + CalibSuffix, &
charge,
nullptr);
288 std::vector<float>*
path =
nullptr;
289 tree->SetBranchAddress(CalibPrefix +
"path" + CalibSuffix, &
path,
nullptr);
290 std::vector<unsigned char>*
amplitude =
nullptr;
291 tree->SetBranchAddress(CalibPrefix +
"amplitude" + CalibSuffix, &
amplitude,
nullptr);
292 std::vector<double>* gainused =
nullptr;
293 tree->SetBranchAddress(CalibPrefix +
"gainused" + CalibSuffix, &gainused,
nullptr);
295 printf(
"Number of Events = %i + %i = %i\n",
297 (
unsigned int)
tree->GetEntries(),
298 (
unsigned int)(NEvent +
tree->GetEntries()));
299 NEvent +=
tree->GetEntries();
300 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
301 printf(
"Looping on the Tree :");
302 int TreeStep =
tree->GetEntries() / 50;
305 for (
unsigned int ientry = 0; ientry <
tree->GetEntries(); ientry++) {
306 if (ientry % TreeStep == 0) {
310 tree->GetEntry(ientry);
312 int FirstAmplitude = 0;
313 for (
unsigned int c = 0;
c < (*path).size();
c++) {
314 FirstAmplitude += (*nstrips)[
c];
315 int t = (*trackindex)[
c];
316 if ((*trackpt)[
t] < 5)
318 if ((*trackhitsvalid)[
t] < 5)
325 for (
unsigned int s = 0;
s < (*nstrips)[
c];
s++) {
326 int StripCharge = (*amplitude)[FirstAmplitude - (*nstrips)[
c] +
s];
327 if (StripCharge < 254) {
328 StripCharge = (
int)(StripCharge /
gain);
329 if (StripCharge >= 1024) {
331 }
else if (StripCharge >= 254) {
342 double ClusterChargeOverPath = ((double)
Charge) / (*path)[
c];
351 auto obj = std::make_unique<PhysicsTools::Calibration::HistogramD3D>(
Charge_Vs_Path->GetNbinsX(),
T getParameter(std::string const &) const
void algoAnalyze(const edm::Event &, const edm::EventSetup &) override
std::vector< std::vector< float > > calibGains
friend struct const_iterator
#define DEFINE_FWK_MODULE(type)
void algoEndJob() override
const GeomDet * det() const
DataContainer const & measurements() const
const_iterator end() const
last iterator over the map (read only)
T getUntrackedParameter(std::string const &, T const &) const
void algoAnalyzeTheTree(const edm::EventSetup &iSetup)
SiStripCluster const & monoCluster() const
std::unique_ptr< PhysicsTools::Calibration::HistogramD3D > getNewObject() override
unsigned int MinTrackHits
LocalVector localDirection() const
void processHit(const TrackingRecHit *recHit, float trackMomentum, float &cosine, const TrajectoryStateOnSurface &trajState)
LocalVector localMomentum() const
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > m_tkGeomToken
bool getData(T &iHolder) const
std::vector< std::string > VInputFiles
const GeomDetUnit * monoDet() const
std::string m_calibrationPath
constexpr float gains[NGAINS]
~DeDxDiscriminatorLearner() override
void algoBeginJob(const edm::EventSetup &) override
const GeomDetUnit * stereoDet() const
SiStripCluster const & stereoCluster() const
const_iterator begin() const
first iterator over the map (read only)
edm::EDGetTokenT< TrajTrackAssociationCollection > m_trajTrackAssociationTag
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
DeDxDiscriminatorLearner(const edm::ParameterSet &)