29 src_(iConfig.getParameter<
edm::InputTag>(
"src")),
30 overlapAM_(iConfig.getParameter<
edm::InputTag>(
"OverlapAssoMap")),
31 keepTrackStats_(iConfig.getParameter<
bool>(
"keepTrackStats")),
32 keepHitPopulation_(iConfig.getParameter<
bool>(
"keepHitStats")),
33 statsTreeName_(iConfig.getParameter<
string>(
"TrkStatsFileName")),
34 hitsTreeName_(iConfig.getParameter<
string>(
"HitStatsFileName")),
35 prescale_(iConfig.getParameter<uint32_t>(
"TrkStatsPrescale")),
55 outtree_=
new TTree(
"AlignmentTrackStats",
"Statistics of Tracks used for Alignment");
64 outtree_->Branch(
"P" ,&
P ,
"P[Ntracks]/F");
119 unsigned int trk_cnt=0;
127 for(
int k=0;
k<7;
k++){
135 for(std::vector<reco::Track>::const_iterator ittrk = Tracks->begin(), edtrk = Tracks->end(); ittrk != edtrk; ++ittrk){
136 Eta[trk_cnt]=ittrk->eta();
137 Phi[trk_cnt]=ittrk->phi();
138 Chi2n[trk_cnt]=ittrk->normalizedChi2();
139 P[trk_cnt]=ittrk->p();
140 Pt[trk_cnt]=ittrk->pt();
141 Nhits[trk_cnt][0]=ittrk->numberOfValidHits();
159 DetHitMap::iterator mapiter;
166 hitmap_.insert(pair<uint32_t, uint32_t>(rawId, 1));
174 if(!(hitInPixel||hitInStrip)){
176 edm::LogError(
"AlignmentStats")<<
"Hit not belonging neither to pixels nor to strips! Skipping it. SubDet= "<<subDet;
182 const std::type_info &
type =
typeid(*hit);
187 if(striphit!=
nullptr){
189 inval = OverlapMap[stripclust];
193 throw cms::Exception(
"NullPointerError")<<
"ERROR in <AlignmentStats::analyze>: Dynamic cast of Strip RecHit1D failed! TypeId of the RecHit: "<<
className(*hit);
198 if(striphit!=
nullptr){
200 inval = OverlapMap[stripclust];
204 throw cms::Exception(
"NullPointerError")<<
"ERROR in <AlignmentStats::analyze>: Dynamic cast of Strip RecHit2D failed! TypeId of the RecHit: "<<
className(*hit);
212 if(pixelhit!=
nullptr){
214 inval = OverlapMap[pixclust];
218 edm::LogError(
"AlignmentStats")<<
"ERROR in <AlignmentStats::analyze>: Dynamic cast of Pixel RecHit failed! TypeId of the RecHit: "<<
className(*hit);
227 DetHitMap::iterator overlapiter;
234 overlapmap_.insert(pair<uint32_t, uint32_t>(rawId, 1));
243 Nhits[trk_cnt][subdethit]=
Nhits[trk_cnt][subdethit]+1;
265 edm::LogInfo(
"AlignmentStats")<<
"Writing out the TrackStatistics in "<<gDirectory->GetPath()<<std::endl;
273 TTree *hitstree=
new TTree(
"AlignmentHitMap",
"Maps of Hits used for Alignment");
275 unsigned int id=0,
nhits=0,noverlaps=0;
276 float posX(-99999.0),
posY(-77777.0),posZ(-88888.0);
277 float posEta(-6666.0),posPhi(-5555.0),posR(-4444.0);
279 unsigned int layer=0;
280 bool is2D=
false,isStereo=
false;
281 hitstree->Branch(
"DetId", &
id ,
"DetId/i");
282 hitstree->Branch(
"Nhits", &
nhits ,
"Nhits/i");
283 hitstree->Branch(
"Noverlaps",&noverlaps,
"Noverlaps/i");
284 hitstree->Branch(
"SubDet", &subdet,
"SubDet/I");
285 hitstree->Branch(
"Layer", &layer,
"Layer/i");
286 hitstree->Branch(
"is2D" , &is2D,
"is2D/B");
287 hitstree->Branch(
"isStereo", &isStereo,
"isStereo/B");
288 hitstree->Branch(
"posX", &
posX,
"posX/F");
289 hitstree->Branch(
"posY", &
posY,
"posY/F");
290 hitstree->Branch(
"posZ", &posZ,
"posZ/F");
291 hitstree->Branch(
"posR", &posR,
"posR/F");
292 hitstree->Branch(
"posEta", &posEta,
"posEta/F");
293 hitstree->Branch(
"posPhi", &posPhi,
"posPhi/F");
318 int ndetunits=Detunitslist.size();
319 edm::LogInfo(
"AlignmentStats")<<
"Number of DetUnits in the AlignableTracker: "<< ndetunits<<std::endl;
321 for(
int det_cnt=0;det_cnt< ndetunits;++det_cnt){
340 id=static_cast <uint32_t>( Detunitslist[det_cnt]->id() );
347 hitmap_.insert(pair<uint32_t, uint32_t>(
id, 0));
356 overlapmap_.insert(pair<uint32_t, uint32_t>(
id, 0));
360 posX= Detunitslist[det_cnt]->globalPosition().x();
361 posY= Detunitslist[det_cnt]->globalPosition().y();
362 posZ= Detunitslist[det_cnt]->globalPosition().z();
411 edm::LogError(
"AlignmentStats")<<
"Detector not belonging neither to pixels nor to strips! Skipping it. SubDet= "<<subdet;
ClusterRef cluster() const
EventNumber_t event() const
bool tecIsDoubleSide(const DetId &id) const
bool tobIsDoubleSide(const DetId &id) const
bool tibIsDoubleSide(const DetId &id) const
unsigned int tibLayer(const DetId &id) const
const edm::EventSetup * lastSetup_
bool tobIsStereo(const DetId &id) const
#define DEFINE_FWK_MODULE(type)
unsigned int pxfDisk(const DetId &id) const
Geom::Phi< T > phi() const
unsigned int tidWheel(const DetId &id) const
bool tidIsStereo(const DetId &id) const
uint32_t rawId() const
get the raw id
bool tecIsStereo(const DetId &id) const
bool is2D(HitType hitType)
ClusterRef cluster() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
unsigned int pxbLayer(const DetId &id) const
const TrackerGeometry * trackerGeometry_
const Alignables & deepComponents() const
std::string statsTreeName_
ClusterRef cluster() const
bool tibIsStereo(const DetId &id) const
AlignmentStats(const edm::ParameterSet &iConfig)
bool tidIsDoubleSide(const DetId &id) const
static const int MAXTRKS_
std::pair< OmniClusterRef, TrackingParticleRef > P
std::string hitsTreeName_
DetId geographicalId() const
~AlignmentStats() override
unsigned int tecWheel(const DetId &id) const
T const * product() const
std::string className(const T &t)
unsigned int tobLayer(const DetId &id) const
void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup) override