41 filename_(conf.getParameter<
std::
string>(
"fileName")), filenameFit_(conf.getParameter<
std::
string>(
"fileNameFit")), ptmin_(conf.getParameter<double>(
"ptMin")), simData_(conf.getParameter<
bool>(
"simData")), normChi2Max_(conf.getParameter<double>(
"normChi2Max")), clustSizeYMin_(conf.getParameter<
int>(
"clustSizeYMin")), residualMax_(conf.getParameter<double>(
"residualMax")), clustChargeMax_(conf.getParameter<double>(
"clustChargeMax")),hist_depth_(conf.getParameter<
int>(
"binsDepth")), hist_drift_(conf.getParameter<
int>(
"binsDrift")), trackerHitAssociatorConfig_(consumesCollector())
90 SiPixelLorentzAngleTree_->Branch(
"clust", &
clust_,
"x/F:y/F:charge/F:size_x/I:size_y/I:maxPixelCol/I:maxPixelRow:minPixelCol/I:minPixelRow/I", bufsize);
120 for(
int i_module = 1; i_module<=8; i_module++){
121 for(
int i_layer = 1; i_layer<=3; i_layer++){
122 sprintf(name,
"h_drift_depth_adc_layer%i_module%i", i_layer, i_module);
124 sprintf(name,
"h_drift_depth_adc2_layer%i_module%i", i_layer, i_module);
126 sprintf(name,
"h_drift_depth_noadc_layer%i_module%i", i_layer, i_module);
128 sprintf(name,
"h_drift_depth_layer%i_module%i", i_layer, i_module);
130 sprintf(name,
"h_mean_layer%i_module%i", i_layer, i_module);
142 h_tracks_ =
new TH1F(
"h_tracks",
"h_tracks",2,0.,2.);
171 std::unique_ptr<TrackerHitAssociator> associate;
189 if(!trajTrackCollectionHandle->
empty()){
196 std::vector<TrajectoryMeasurement> tmColl = traj.
measurements();
207 bool pixeltrack =
false;
208 for(std::vector<TrajectoryMeasurement>::const_iterator itTraj = tmColl.begin(); itTraj != tmColl.end(); itTraj++) {
209 if(! itTraj->updatedState().isValid())
continue;
211 if(! recHit->isValid() || recHit->geographicalId().det() !=
DetId::Tracker )
continue;
212 unsigned int subDetID = (recHit->geographicalId().subdetId());
224 DetId detIdObj = recHit->geographicalId();
226 if(!theGeomDet)
continue;
240 if(!recHitPix)
continue;
260 cout <<
"tsos not valid" << endl;
266 if(trackdirection.
z()==0)
continue;
278 matched = associate->associateHit((*recHitPix));
279 float dr_start=9999.;
280 for (std::vector<PSimHit>::iterator isim = matched.begin(); isim != matched.end(); ++isim){
281 DetId simdetIdObj((*isim).detUnitId());
282 if (simdetIdObj == detIdObj) {
283 float sim_x1 = (*isim).entryPoint().x();
284 float sim_y1 = (*isim).entryPoint().y();
285 float sim_x2 = (*isim).exitPoint().x();
286 float sim_y2 = (*isim).exitPoint().y();
287 float sim_xpos = 0.5*(sim_x1+sim_x2);
288 float sim_ypos = 0.5*(sim_y1+sim_y2);
289 float sim_px = (*isim).momentumAtEntry().x();
290 float sim_py = (*isim).momentumAtEntry().y();
291 float sim_pz = (*isim).momentumAtEntry().z();
307 bool large_pix =
false;
341 DetId detIdObj = recHit->geographicalId();
343 if(!theGeomDet)
continue;
359 if(!recHitPix)
continue;
379 cout <<
"tsos not valid" << endl;
385 if(trackdirection.
z()==0)
continue;
397 matched = associate->associateHit((*recHitPix));
398 float dr_start=9999.;
399 for (std::vector<PSimHit>::iterator isim = matched.begin(); isim != matched.end(); ++isim){
400 DetId simdetIdObj((*isim).detUnitId());
401 if (simdetIdObj == detIdObj) {
402 float sim_x1 = (*isim).entryPoint().x();
403 float sim_y1 = (*isim).entryPoint().y();
404 float sim_x2 = (*isim).exitPoint().x();
405 float sim_y2 = (*isim).exitPoint().y();
406 float sim_xpos = 0.5*(sim_x1+sim_x2);
407 float sim_ypos = 0.5*(sim_y1+sim_y2);
408 float sim_px = (*isim).momentumAtEntry().x();
409 float sim_py = (*isim).momentumAtEntry().y();
410 float sim_pz = (*isim).momentumAtEntry().z();
440 for(
int i_ring = 1; i_ring<=24; i_ring++){
446 TF1 *
f1 =
new TF1(
"f1",
"[0] + [1]*x",50., 235.);
447 f1->SetParName(0,
"p0");
448 f1->SetParName(1,
"p1");
449 f1->SetParameter(0,0);
450 f1->SetParameter(1,0.4);
453 fLorentzFit <<
"module" <<
"\t" <<
"layer" <<
"\t" <<
"offset" <<
"\t" <<
"error" <<
"\t" <<
"slope" <<
"\t" <<
"error" <<
"\t" "rel.err" <<
"\t" "pull" <<
"\t" <<
"chi2" <<
"\t" <<
"prob" << endl;
455 for(
int i_layer = 1; i_layer<=3; i_layer++){
456 for(
int i_module = 1; i_module<=8; i_module++){
459 findMean(
i, (i_module + (i_layer - 1) * 8));
461 _h_mean_[i_module + (i_layer - 1) * 8]->
Fit(f1,
"ERQ");
462 double p0 = f1->GetParameter(0);
463 double e0 = f1->GetParError(0);
464 double p1 = f1->GetParameter(1);
465 double e1 = f1->GetParError(1);
466 double chi2 = f1->GetChisquare();
467 double prob = f1->GetProb();
468 fLorentzFit << setprecision( 4 ) << i_module <<
"\t" << i_layer <<
"\t" << p0 <<
"\t" << e0 <<
"\t" << p1 << setprecision( 3 ) <<
"\t" << e1 <<
"\t" << e1 / p1 *100. <<
"\t"<< (p1 - 0.424) / e1 <<
"\t"<< chi2 <<
"\t" << prob << endl;
473 for(
int i_module = 1; i_module<=8; i_module++){
474 for(
int i_layer = 1; i_layer<=3; i_layer++){
479 _h_mean_[i_module + (i_layer -1) * 8]->Write();
500 const std::vector<SiPixelCluster::Pixel>& pixvector = LocPix.
pixels();
502 for(std::vector<SiPixelCluster::Pixel>::const_iterator itPix = pixvector.begin(); itPix != pixvector.end(); itPix++){
504 pixinfo.
row[pixinfo.
npix] = itPix->x;
505 pixinfo.
col[pixinfo.
npix] = itPix->y;
506 pixinfo.
adc[pixinfo.
npix] = itPix->adc;
508 pixinfo.
x[pixinfo.
npix] = lp.
x();
509 pixinfo.
y[pixinfo.
npix]= lp.
y();
544 _h_mean_[i_ring]->SetBinContent(i, mean);
545 _h_mean_[i_ring]->SetBinError(i, error);
TH2F * h_cluster_shape_adc_rot_
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
T getParameter(std::string const &) const
EventNumber_t event() const
TH1F * h_drift_depth_adc_slice_
std::map< int, TH2F * > _h_drift_depth_adc_
void findMean(int i, int i_ring)
friend struct const_iterator
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::map< int, TH2F * > _h_drift_depth_
TH2F * h_cluster_shape_adc_
unsigned int pxfDisk(const DetId &id) const
LocalVector localDirection() const
LocalPoint localPosition() const
bool empty() const
return true if empty
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
unsigned int pxbLadder(const DetId &id) const
const TrackerGeometry * tracker
double phi() const
azimuthal angle of momentum vector
unsigned int pxbModule(const DetId &id) const
const Plane & surface() const
The nominal surface of the GeomDet.
TH2F * h_cluster_shape_rot_
std::map< int, TH2F * > _h_drift_depth_adc2_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
DataContainer const & measurements() const
TH2F * h_cluster_shape_noadc_rot_
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
#define DEFINE_FWK_MODULE(type)
double eta() const
pseudorapidity of momentum vector
std::shared_ptr< TrackingRecHit const > ConstRecHitPointer
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
double pt() const
track transverse momentum
Tan< T >::type tan(const T &t)
unsigned int pxfModule(const DetId &id) const
TTree * SiPixelLorentzAngleTree_
unsigned int pxbLayer(const DetId &id) const
Point3DBase< float, LocalTag > Local3DPoint
int ndof(bool bon=true) const
edm::EDGetTokenT< TrajTrackAssociationCollection > t_trajTrack
ClusterRef cluster() const
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
~SiPixelLorentzAngle() override
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Pixel cluster – collection of neighboring pixels above threshold.
const TrackerGeomDet * idToDet(DetId) const override
unsigned int pxfSide(const DetId &id) const
LocalPoint localPosition() const final
const_iterator begin() const
first iterator over the map (read only)
TTree * SiPixelLorentzAngleTreeForward_
std::map< int, TH2F * > _h_drift_depth_noadc_
T const * product() const
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
const std::vector< Pixel > pixels() const
TH2F * h_cluster_shape_noadc_
std::map< int, TH1F * > _h_mean_
void fillPix(const SiPixelCluster &LocPix, const PixelTopology *topol, Pixinfo &pixinfo)