73 Charge_Vs_Path =
new TH3F (
"Charge_Vs_Path" ,
"Charge_Vs_Path" ,
P_NBins,
P_Min,
P_Max,
Path_NBins,
Path_Min,
Path_Max,
Charge_NBins,
Charge_Min,
Charge_Max);
91 if( strcmp(
algoMode.c_str(),
"MultiJob")==0){
96 }
else if( strcmp(
algoMode.c_str(),
"WriteOnDB")==0){
98 Charge_Vs_Path = (TH3F*)(Input->FindObjectAny(
"Charge_Vs_Path"))->Clone();
100 }
else if(strcmp(
algoMode.c_str(),
"CalibTree")==0){
106 Charge_Vs_Path = (TH3F*)(Input->FindObjectAny(
"Charge_Vs_Path"))->Clone();
119 unsigned track_index = 0;
121 const Track& track = *it->val;
128 const vector<TrajectoryMeasurement> & measurements = traj.
measurements();
129 for(vector<TrajectoryMeasurement>::const_iterator it = measurements.begin(); it!=measurements.end(); it++){
131 if( !trajState.
isValid())
continue;
135 if(!recHit || !recHit->
isValid())
continue;
137 float cosine = trackDirection.
z()/trackDirection.
mag();
148 if(!thit.isValid())
return;
150 auto const & clus = thit.firstClusterRef();
151 if(!clus.isValid())
return;
156 }
else if(clus.isStrip() && !thit.isMatched()){
157 auto& detUnit = *(recHit->
detUnit());
158 auto& cluster = clus.stripCluster();
159 if( cluster.amplitudes().size()>
MaxNrStrips) {
return; }
162 float pathLen = 10.0*detUnit.surface().bounds().thickness()/fabs(cosine);
164 float charge = chargeAbs/pathLen;
168 }
else if(clus.isStrip() && thit.isMatched()){
170 if(!matchedHit)
return;
173 auto& detUnitM = *(gdet->
monoDet());
175 if( clusterM.amplitudes().size()>
MaxNrStrips) {
return; }
178 float pathLen = 10.0*detUnitM.surface().bounds().thickness()/fabs(cosine);
180 float charge = chargeAbs/pathLen;
187 if( clusterS.amplitudes().size()>
MaxNrStrips) {
return; }
190 pathLen = 10.0*detUnitS.surface().bounds().thickness()/fabs(cosine);
192 charge = chargeAbs/pathLen;
206 unsigned int NEvent = 0;
208 printf(
"Openning file %3i/%3i --> %s\n",
i+1, (
int)
VInputFiles.size(), (
char*)(
VInputFiles[
i].c_str())); fflush(stdout);
209 TChain*
tree =
new TChain(
"gainCalibrationTree/tree");
212 TString EventPrefix(
"");
213 TString EventSuffix(
"");
215 TString TrackPrefix(
"track");
216 TString TrackSuffix(
"");
218 TString CalibPrefix(
"GainCalibration");
219 TString CalibSuffix(
"");
221 unsigned int eventnumber = 0; tree->SetBranchAddress(EventPrefix +
"event" + EventSuffix, &eventnumber ,
NULL);
222 unsigned int runnumber = 0; tree->SetBranchAddress(EventPrefix +
"run" + EventSuffix, &runnumber ,
NULL);
223 std::vector<bool>* TrigTech = 0; tree->SetBranchAddress(EventPrefix +
"TrigTech" + EventSuffix, &TrigTech ,
NULL);
225 std::vector<double>* trackchi2ndof = 0; tree->SetBranchAddress(TrackPrefix +
"chi2ndof" + TrackSuffix, &trackchi2ndof ,
NULL);
226 std::vector<float>* trackp = 0; tree->SetBranchAddress(TrackPrefix +
"momentum" + TrackSuffix, &trackp ,
NULL);
227 std::vector<float>* trackpt = 0; tree->SetBranchAddress(TrackPrefix +
"pt" + TrackSuffix, &trackpt ,
NULL);
228 std::vector<double>* tracketa = 0; tree->SetBranchAddress(TrackPrefix +
"eta" + TrackSuffix, &tracketa ,
NULL);
229 std::vector<double>* trackphi = 0; tree->SetBranchAddress(TrackPrefix +
"phi" + TrackSuffix, &trackphi ,
NULL);
230 std::vector<unsigned int>* trackhitsvalid = 0; tree->SetBranchAddress(TrackPrefix +
"hitsvalid" + TrackSuffix, &trackhitsvalid,
NULL);
232 std::vector<int>* trackindex = 0; tree->SetBranchAddress(CalibPrefix +
"trackindex" + CalibSuffix, &trackindex ,
NULL);
233 std::vector<unsigned int>* rawid = 0; tree->SetBranchAddress(CalibPrefix +
"rawid" + CalibSuffix, &rawid ,
NULL);
234 std::vector<unsigned short>* firststrip = 0; tree->SetBranchAddress(CalibPrefix +
"firststrip" + CalibSuffix, &firststrip ,
NULL);
235 std::vector<unsigned short>* nstrips = 0; tree->SetBranchAddress(CalibPrefix +
"nstrips" + CalibSuffix, &nstrips ,
NULL);
236 std::vector<unsigned int>*
charge = 0; tree->SetBranchAddress(CalibPrefix +
"charge" + CalibSuffix, &charge ,
NULL);
237 std::vector<float>*
path = 0; tree->SetBranchAddress(CalibPrefix +
"path" + CalibSuffix, &path ,
NULL);
238 std::vector<unsigned char>* amplitude = 0; tree->SetBranchAddress(CalibPrefix +
"amplitude" + CalibSuffix, &litude ,
NULL);
239 std::vector<double>* gainused = 0; tree->SetBranchAddress(CalibPrefix +
"gainused" + CalibSuffix, &gainused ,
NULL);
241 printf(
"Number of Events = %i + %i = %i\n",NEvent,(
unsigned int)tree->GetEntries(),(
unsigned int)(NEvent+tree->GetEntries()));NEvent+=tree->GetEntries();
242 printf(
"Progressing Bar :0%% 20%% 40%% 60%% 80%% 100%%\n");
243 printf(
"Looping on the Tree :");
244 int TreeStep = tree->GetEntries()/50;
if(TreeStep<=1)TreeStep=1;
245 for (
unsigned int ientry = 0; ientry < tree->GetEntries(); ientry++) {
246 if(ientry%TreeStep==0){printf(
".");fflush(stdout);}
247 tree->GetEntry(ientry);
249 int FirstAmplitude = 0;
250 for(
unsigned int c=0;
c<(*path).size();
c++){
251 FirstAmplitude+=(*nstrips)[
c];
252 int t = (*trackindex)[
c];
253 if((*trackpt)[
t]<5)
continue;
254 if((*trackhitsvalid)[
t]<5)
continue;
259 auto & gain = gains[(*firststrip)[
c]/128];
260 for(
unsigned int s=0;
s<(*nstrips)[
c];
s++){
261 int StripCharge = (*amplitude)[FirstAmplitude-(*nstrips)[
c]+
s];
263 StripCharge=(int)(StripCharge/gain);
264 if(StripCharge>=1024){
266 }
else if(StripCharge>=254){
270 Charge += StripCharge;
273 Charge = (*charge)[
c];
277 double ClusterChargeOverPath = ( (double) Charge )/(*path)[
c] ;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const GeomDetUnit * monoDet() const
friend struct const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
SiStripCluster const & monoCluster() const
LocalVector localDirection() const
LocalVector localMomentum() const
DataContainer const & measurements() const
double eta() const
pseudorapidity of momentum vector
virtual void algoBeginJob(const edm::EventSetup &)
tuple path
else: Piece not in the list, fine.
void algoAnalyzeTheTree(const edm::EventSetup &iSetup)
const GeomDet * det() const
unsigned int MinTrackHits
double pt() const
track transverse momentum
void processHit(const TrackingRecHit *recHit, float trackMomentum, float &cosine, const TrajectoryStateOnSurface &trajState)
virtual void algoAnalyze(const edm::Event &, const edm::EventSetup &)
std::vector< std::string > VInputFiles
std::string m_calibrationPath
virtual void algoEndJob()
~DeDxDiscriminatorLearner()
SiStripCluster const & stereoCluster() const
virtual const GeomDetUnit * detUnit() const
unsigned short found() const
Number of valid hits on track.
edm::EDGetTokenT< TrajTrackAssociationCollection > m_trajTrackAssociationTag
edm::EDGetTokenT< reco::TrackCollection > m_tracksTag
const GeomDetUnit * stereoDet() const
std::vector< std::vector< float > > calibGains
PhysicsTools::Calibration::HistogramD3D * getNewObject()
DeDxDiscriminatorLearner(const edm::ParameterSet &)